Repository navigation
fix(shader): count vertex clip distances in the rect-list tessellation limits - #12228
Conversation
…n limits BuildRectListShaders sized the per-vertex tessellation interface from the position and the exported parameters only. The generated control and evaluation shaders also carry the vertex shader's ClipDistance array (up to eight scalars) as input and output builtins, so for a vertex shader that writes clip distances the interface was up to eight components larger than the checked size and could exceed maxTessellationControlPerVertexInputComponents and its siblings. The sibling barycentric geometry shader already counts them. The clip distance count is now read before the check, and both the parameter capacity and the component total include it, so parameters are trimmed to what fits and an interface that cannot fit is rejected.
…istances With eight per-vertex components, a ClipDistance[2] vertex shader still builds and a ClipDistance[8] one is rejected as exceeding the device limits.
|
Windows + NVIDIA result for head This PR's own tests: Host: Windows 11 26300, Intel i7-12700K, NVIDIA GeForce RTX 2070 SUPER (vendor 0x10de, device 0x1e84; Vulkan loader 1.4.357 from the NVIDIA driver 621.01), Khronos Validation Layers nightly 1.4.366 (b2b44c0d37) through Same focused run on
The tree also carried the open PRs #12298, #12272, #12262, #12256, #12250, #12234, #12211, #12210, #12209, #12208, #12207, all merged cleanly, so the run is a joint one. Not run on a PS5. AI-assisted: yes (Claude Code), the runs and the numbers above are from this machine. |
What
BuildRectListShaderssized the per-vertex tessellation interface from the position and the exported parameters only. The generated control and evaluation shaders also declare the vertex shader'sClipDistancearray (up to eight scalars) as input and output builtins, so for a vertex shader that writes clip distances the real interface was up to eight components larger than the checked size. The check could pass and emit shaders that exceedmaxTessellationControlPerVertexInputComponents, its output counterpart and the evaluation limits, which makes the pipeline invalid. The siblingBarycentricGeometryShader.cppalready counts clip distances (4 + clipDistances + 4 * sources).The clip distance count is now read before the check, and both the parameter capacity and the component total include it: parameters are trimmed to what fits, and an interface that cannot fit is rejected.
Two commits: the fix, then the test (
RectListPositionInvariant.cpp: with eight per-vertex components, aClipDistance[2]vertex shader still builds and aClipDistance[8]one is rejected as exceeding the device limits).Tested
Linux x86-64, a throwaway archive build with the host CPU gate patched.
agc_rect_list_position_invariantpasses. OnmaintheClipDistance[8]case is accepted (the checked size was 4 against a limit of 8), so the new assertion fails there; I reasoned that from the code rather than running the old build.tools/check_conventions.py --base upstream/mainandgit diff --checkpass.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)