Repository navigation
Conversation
|
Thank you for your contribution! Authors with no pull requests merged into |
This was referenced Oct 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The tessellation lowering evaluates every ring and LDS address as
vertex * control point + relative * relative patch + constant. Av_and_b32with a constant was accepted only when the mask kept the low bits, like0xffor0x1fff. A hull program'sv1packs the control point into bits 8-12, above the relative patch in bits 0-7. A mask like0x1f00, which keeps only the control point, was refused withthe tessellation ring or LDS address is not affine in the control point and relative patch.(x mod 2^hi) - (x mod 2^lo).split. It proves each one exact: the part below the boundary must stay inside the boundary for every control point and relative patch.v1 & 0x1f00iscontrol point * 256, as long as the relative patch stays below 256 and the control point below 32.0x1e00drops the control point's low bit, and0x1f0fhas a gap.Why: Gran Turismo 7 (PPSA01317) has nine hull programs that address their control-point records in the off-chip ring this way: 0x1280676200, 0x1280ada900, 0x1280c98400, 0x1280d71100, 0x1280ed4e00, 0x1280ed8d00, 0x1280f63d00, 0x12810bce00 and 0x12810d5900. Their control-point records are 256 bytes.
(v1 & 0x1f00) + relative patch * patch stride. The patch stride is<< 10(4 control points) in eight of them and* 0x300(3 control points) in 0x1280ed8d00.v_and_b32 v0, 0x1f00, v1, thenv_lshl_add_u32 v0, v46, 10, v0withv46 = v1 & 0xff, thenbuffer_store_dwordx4 ... offen offset:0x68at pc 0x2d0.Tested
Gran Turismo 7, on a local stack of
mainwith the open PRs it needs before these hulls (#7243, #7256, #7550, #7978, #8564, #9020, #9335, #9068, #9700, #9721, #9743) and this commit:agc_shader_replayfrom the requests the driver dumped when it deferred them (APS5_DUMP_SHADERS).v1with0x1f00.--preparesucceeds for all nine, and the recompiled SPIR-V passesspirv-val --target-env vulkan1.2.guest texture sampled with unnormalized coordinates is not a single-layer 1D or 2D view ...).... PS_ITER_SAMPLE, a sample index or coverage input, a sample-mask export ...), before GT7 creates any tessellation pipeline.Windows 11 (build 26200), NVIDIA GeForce RTX 4090 (driver 616.92), MinGW GCC Release build with
BUILD_TESTING=ON, all on one machine.New tests:
agc_tessellation_loweringhas three new IR cases.((packed & 0x1f00) >> 3) + relative patch * stride, wherepackediscontrol point << 8 | relative patchas inv1, reads the invocation's own input control point.packed & 0x1e00, which drops the control point's low bit, andpacked & 0x1f0f, which has a gap.agc_driver_tessellation(GPU) addsHullMaskedControlPoint. It isHullCodewith its off-chip record address16 * control pointreplaced by(v1 & 0x1f00) >> 4. The domain program takes its positions from those records, so a wrong address moves or drops the patches. The test draws it and checks each patch likeHullCode.Runs:
agc_tessellation_lowering_tests,agc_tessellation_factor_ring_tests,agc_driver_tessellation_tests,agc_driver_graphics_tests,agc_vector_window_tests,agc_vertex_input_validation_tests,agc_driver_bda_device_testsandagc_shader_memory_tests.main8b3a6ba): 52/52 passed, each test run three times (ctest --repeat until-fail:3).maincontrol:main8b3a6ba with only this PR's two test files. Both tests fail. The new lowered case is refused withnot affine in the control point and relative patch, and the GPU test stops onHullMaskedControlPoint's store at pc 0x60 with the same refusal. The two refusal cases pass on both.VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation(Vulkan SDK 1.4.363.0),ANYPS5_NO_SHADER_CACHE=1andANYPS5_REQUIRE_VULKAN=1withctest -Von this PR: 52/52. The log has nowas not found but was requested by env var VK_INSTANCE_LAYERSand noVUID-line.tools/check_conventions.py --base origin/mainreports no findings.Checklist
main; no other open PR implements the same functions. No open PR changes the address evaluator'smask. This PR and fix(shader): read other control points' off-chip outputs in hull programs #9743 both add a helper beforeHull::mergeand cases at the end oftests/TessellationLowering.cpp; whichever lands second keeps both.NotImplemented_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)