Repository navigation
fix(agc): read an unnormalized sampler without a mip filter at its base level - #5886
Conversation
…se level A guest sampler with FORCE_UNNORMALIZED and a mip filter of none read a multi-level texture and the driver refused it: an unnormalized sampler is accepted on a view with several levels only when every use is image_sample_lz and the S# has no minimum LOD and no LOD bias. Kena: Bridge of Spirits (PPSA01746) binds such a sampler (implicit LOD, point filters, mip filter none, LOD bias 7) to a 9-level texture and stopped with "guest texture sampled with unnormalized coordinates is not a single-layer 1D or 2D view ...". With the mip filter off the sampler reads only level 0, so the base-level path the driver already has for unnormalized samplers is exact for it whatever its uses, minimum LOD or bias. A sampler with a point or linear mip filter is unchanged. Measured on a PS5 (gfx1013) through a sampler descriptor rewritten to force unnormalized coordinates, a 64x64 texture of four levels with a distinct marker per level, coordinates in texel units: - mip filter point, explicit LOD 0, 1, 2, 3: level 0, 1, 2, 3, 256 of 256 texels each, coordinates read in texel units of the selected level - mip filter point, implicit LOD from a quad derivative of 8 texels: level 3 - mip filter none with LOD bias 7: explicit LOD 2, explicit LOD 3 and the implicit LOD of 3 each read level 0, 256 of 256 texels Tested: Windows 11, MinGW-w64 GCC 15.2.0, Release, RTX 4070 SUPER. agc_shader_memory_tests passes with the change and fails without it on the new assertion; agc_driver_image_sample_unnormalized_tests, agc_shader_disk_cache_tests and agc_driver_graphics_tests pass.
|
Ran this on PR head 766f6de (merge base 3242151, 438 commits behind main ab9a476). Setup: PR head checked out as-is (not rebased), default CMake build (CMAKE_BUILD_TYPE empty, unoptimized), Linux. The test is CPU-only; no GPU was used.
The test checks the descriptor flag; I did not check rendered output. Main has changed DescriptorBindingBuilder.cpp since the merge base (4 commits), though the old expression is still there, by reading. I did not test the PR rebased onto main. #4943, #5353, #5371, #5609, #5881 and #5958 also touch this file. Not checked: any title. AI-assisted: yes |
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
|
Thanks @Dextroid17 for running it and for the mutation check. Reverting the rule and getting the new assertion red 3 of 3 is exactly the proof I wanted the test to give. On the overlaps the bot listed for The shared Not tested here: a rebase onto current |
|
Checked on the HW oracle (T# with 4 levels, unnormalized S# with mip filter none): |
What
A guest sampler with FORCE_UNNORMALIZED and a mip filter of none reading a multi-level texture is refused: the driver accepts an unnormalized sampler on a view with several levels only when every use is
image_sample_lzand the S# has no minimum LOD and no LOD bias. Kena: Bridge of Spirits (PPSA01746) binds such a sampler (implicit LOD, point filters, mip filter none, LOD bias 7, min-reduction filter mode) to a 9-level texture and stops with:With the mip filter off the sampler reads only level 0, so the base-level path the driver already has for unnormalized samplers is exact for it whatever its uses, minimum LOD or bias. A sampler with a point or linear mip filter is unchanged.
Hardware measurement (PS5, gfx1013)
Through the PS5 Vulkan probe harness (mihawk-99/PS5_Vulkan): a 64x64 texture with four mip levels, each level a distinct marker, sampled by a compute shader through a sampler whose descriptor is rewritten to set FORCE_UNNORMALIZED (S# dword 0 bit 15). Coordinates are in texel units. Each row counts which level the 256 output texels came from.
Also: with a point mip filter the coordinates are read in texel units of the selected level (output texel (5, 2) reads texel (5, 2) at levels 1, 2 and 3 for the same coordinate (5.5, 2.5)); with the mip filter none they are level-0 texels (implicit row: texel (20, 8) for coordinate (20.5, 8.5)). The point-filter rows show the existing rule is exact only when LOD resolves to level 0, so they are not part of this change.
Tested
Windows 11, MinGW-w64 GCC 15.2.0, Release, NVIDIA GeForce RTX 4070 SUPER.
agc_shader_memory_testspasses with the change and fails without it on the new assertion ("an image read through an S# without a mip filter was not flagged as exact at its base level").agc_driver_image_sample_unnormalized_tests,agc_shader_disk_cache_testsandagc_driver_graphics_testspass. Conventions check passes.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