Repository navigation
feat(agc): implement overestimating conservative rasterization - #1112
Conversation
|
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
|
4b26085 to
e86533b
Compare
adriadam10
left a comment
There was a problem hiding this comment.
Checked on current main: build + ctest green (441/441); agc_driver_conservative_rasterization runs on RADV with the extension (13 touched pixels vs 6 centres) and both new tests fail to build without the change.
One thing to fix:
State.cpp:506: the points/lines/rect-list rejection only applies whenresult.stages.path == ShaderPath::Vertex. On the Geometry, Tessellation and TessellationGeometry pathsresult.topologyis the input topology (triangles orPATCH_LIST), but the GS or tessellation stage can emit points or lines, and those would get Vulkan's overestimation, which isn't modelled. Either throw for 0x6001 on non-vertex paths, or derive the rasterized primitive type from the GS output / tessellation mode and throw unless it is triangles. Add a case for it toConservativeRasterizationTests.
Everything else looks fine (TechnicalDebt line, key/sameDecode coverage, device gate).
A draw whose PA_SC_CONSERVATIVE_RASTERIZATION_CNTL (context 0x313) was not the default 0x6000 threw in DecodeState and the draw precheck. 0x6001 sets OVER_RAST_ENABLE and now decodes to Vulkan's overestimation mode, chained to the pipeline's rasterization state and its key. The device enables VK_EXT_conservative_rasterization only when its primitiveOverestimationSize is at most 1/256 pixel and it rasterizes degenerate triangles; elsewhere the pipeline throws. Overestimation is accepted only when triangles reach the rasterizer: VGT_GS_OUT_PRIM_TYPE behind a geometry shader, VGT_TF_PARAM's output topology behind tessellation, VGT_PRIMITIVE_TYPE otherwise. Other 0x313 values and centroid interpolation still throw. Adds the agc_driver_conservative_rasterization GPU test and extends agc_driver_graphics.
e86533b to
29c2244
Compare
|
Thanks for catching that the check only looked at the input topology. It now looks at the primitive that actually reaches the rasterizer, on every path. With GS_EN set (the Geometry and TessellationGeometry paths) it reads One thing I found while writing the tests: on the old head these draws already threw, just not for this reason.
The new head is 29c2244. Details
|
adriadam10
left a comment
There was a problem hiding this comment.
Checked the rework on current main: build + ctest green (451/451). agc_driver_graphics and agc_driver_conservative_rasterization pass on RADV with the extension, and both fail to build without the change. The rasterizer-primitive check (VGT_GS_OUT_PRIM_TYPE / VGT_TF_PARAM / VGT_PRIMITIVE_TYPE) covers every path now, register fields match gfx10.3, and the pipeline key and sameDecode include the mode. Merging once the Linux job is green.
What
A draw whose PA_SC_CONSERVATIVE_RASTERIZATION_CNTL (context 0x313) isn't the default 0x6000 is skipped (
conservative rasterization is unsupported).OVER_RAST_ENABLE(bit 0 in amdgpu's gc_10_3_0_sh_mask.h). It becomesVK_CONSERVATIVE_RASTERIZATION_MODE_OVERESTIMATE_EXTin the pipeline's rasterization state and key.VK_EXT_conservative_rasterizationis enabled only ifprimitiveOverestimationSizeis at most 1/256 pixel (the vertex grid of PA_SU_VTX_CNTL 0x2d) anddegenerateTrianglesRasterizedis set; otherwise the pipeline throws.VGT_GS_OUT_PRIM_TYPE(geometry shader),VGT_TF_PARAM(tessellation) orVGT_PRIMITIVE_TYPE.DRAW_INDEX_INDIRECTtriangle strips with 0x313 = 0x6001 into a seven-target 3840x2160 G-buffer at 0x5050bc0000.DecodeState.Tested
mainc81c2b3: configure-DBUILD_TESTING=ON, full build,--target libs,ctest:ctest --output-on-failure)VK_DRIVER_FILES): 430/430 pass;agc_driver_flat_storeis left out there because it takes several minutes on Windows llvmpipeagc_driver_conservative_rasterization(GPU): three triangles write just the 6 pixels whose centres they cover, or with overestimation the 13 they touch; lavapipe (no extension) checks the throw and skips.agc_driver_graphics, also with points, lines and triangles out of geometry shaders and tessellation. Both fail or do not build onmain.conservative rasterization is unsupportedskips (a 1,500 s run without it had 1,432, 5-7 per present once the menus open), and no other error skips thoseDRAW_INDEX_INDIRECTdraws.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)