Repository navigation
feat(agc): sample texture format 43 through a lossless B10G11R11 copy - #7271
Conversation
Texture format 43 holds unsigned floats of 10 bits (R, bit 0), 11 bits (G, bit 10) and 11 bits (B, bit 21). VK_FORMAT_B10G11R11_UFLOAT_PACK32 holds R11 at bit 0, G11 at bit 11 and B10 at bit 22, so storing the guest R field in the Vulkan B field and the guest B field in the Vulkan R field moves every texel without changing a bit of any component. A sampled texture of format 43 is now uploaded that way (a repack pass over the detiled words, TextureRepack.comp) and viewed with R and B swapped back (TextureComponentChannel), so the shader samples it natively: point and bilinear filtering, every mip level and LOD, and cube faces work as for any other float texture. A texture whose results a storage image still holds is copied from that image (vkCmdCopyImageToBuffer, the repack pass, vkCmdCopyBufferToImage) and copied again whenever the image changed, like the depth and block copies. The recompiler treats a sampled format-43 image as a float image without conversion; storage reads and writes keep the packed R32_UINT path, and a 3D texture whose results are still in a storage image is flushed and uploaded instead. PPSA01317 samples a mipmapped format-43 texture at a LOD other than 0 and a format-43 cube map during boot. AI-assisted: yes
|
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.
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.
|
Adopt Gjonn PR boykopovar#7271 with exact R10_G11_B11 repacking, native sampled views and storage-copy refreshes. Remove obsolete software sampler modes for native views, preserve independent 3D Z filtering, account retained copies against the sampled budget and use pooled allocation recovery. Test native filtering bit-for-bit against format 36 while retaining the converted volume and UNORM oracles. Validated on NVIDIA RTX 3070, Linux, driver 615.78.08: repacked and converted image tests, plus 71 selected regressions. The separate BDA stress-test failure from draft boykopovar#5859 remains under investigation. Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
Adopt Gjonn PR boykopovar#7271 with exact R10_G11_B11 repacking, native sampled views and storage-copy refreshes. Remove obsolete software sampler modes for native views, preserve independent 3D Z filtering, account retained copies against the sampled budget and use pooled allocation recovery. Test native filtering bit-for-bit against format 36 while retaining the converted volume and UNORM oracles. Validated on NVIDIA RTX 3070, Linux, driver 615.78.08: repacked and converted image tests, plus 71 selected regressions. The separate BDA stress-test failure from draft boykopovar#5859 remains under investigation. Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
Adopt Gjonn PR boykopovar#7271 with exact R10_G11_B11 repacking, native sampled views and storage-copy refreshes. Remove obsolete software sampler modes for native views, preserve independent 3D Z filtering, account retained copies against the sampled budget and use pooled allocation recovery. Test native filtering bit-for-bit against format 36 while retaining the converted volume and UNORM oracles. Validated on NVIDIA RTX 3070, Linux, driver 615.78.08: repacked and converted image tests, plus 71 selected regressions. The separate BDA stress-test failure from draft boykopovar#5859 remains under investigation. Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
|
RTX 4090 data point on PPSA01317, on top of my #7254 / #7256 runs (same stack, same box), where the title stopped on Setup. Gran Turismo 7 PPSA01317 01.000.001 (base package), Windows 11 (26200), RTX 4090 (NVIDIA 616.92), AMD Ryzen 7 5800X, MinGW-w64 GCC 15.2.0 r7 (UCRT), Release Result. Run 1 recompiled the shader cache (the recompiler source changed), runs 2 and 3 were warm. All three get past the cube sample: splash, the black loading screen with the GT spinner (title-bar counter 30 FPS, 1,150 frames at the last capture of run 3), save data mounted, three That is #5958's
The chain on this box tonight, all on a stderr of run 3 (warm, box idle) from the second 10 s summary to the abort, the 392 per-shader
|
Adopt Gjonn PR boykopovar#7271 with exact R10_G11_B11 repacking, native sampled views and storage-copy refreshes. Remove obsolete software sampler modes for native views, preserve independent 3D Z filtering, account retained copies against the sampled budget and use pooled allocation recovery. Test native filtering bit-for-bit against format 36 while retaining the converted volume and UNORM oracles. Validated on NVIDIA RTX 3070, Linux, driver 615.78.08: repacked and converted image tests, plus 71 selected regressions. The separate BDA stress-test failure from draft boykopovar#5859 remains under investigation. Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
Adopt Gjonn PR boykopovar#7271 with exact R10_G11_B11 repacking, native sampled views and storage-copy refreshes. Remove obsolete software sampler modes for native views, preserve independent 3D Z filtering, account retained copies against the sampled budget and use pooled allocation recovery. Test native filtering bit-for-bit against format 36 while retaining the converted volume and UNORM oracles. Validated on NVIDIA RTX 3070, Linux, driver 615.78.08: repacked and converted image tests, plus 71 selected regressions. The separate BDA stress-test failure from draft boykopovar#5859 remains under investigation. Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
10_11_11_UNORM (format 30) images are read and written through an R32_UINT view, so the hardware sampler cannot filter them. image_sample of a 2D or 2D array view now fetches the one or four texels at LOD 0, decodes them and blends them in the shader, with bilinear weights on the 8-bit grid, for point or bilinear filtering with wrap or clamp-to-edge addressing. A shader gets the converted sample mode only after a converted descriptor reaches one of its sampled images: that capture throws ConvertedSampleRequired and the driver prepares the program again with GuestContext::convertedSamples. The R10_G11_B11 float format is sampled natively since boykopovar#7271 and keeps its refusal on the converted path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adopt Gjonn PR boykopovar#7271 with exact R10_G11_B11 repacking, native sampled views and storage-copy refreshes. Remove obsolete software sampler modes for native views, preserve independent 3D Z filtering, account retained copies against the sampled budget and use pooled allocation recovery. Test native filtering bit-for-bit against format 36 while retaining the converted volume and UNORM oracles. Validated on NVIDIA RTX 3070, Linux, driver 615.78.08: repacked and converted image tests, plus 71 selected regressions. The separate BDA stress-test failure from draft boykopovar#5859 remains under investigation. Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
Adopt Gjonn PR boykopovar#7271 with exact R10_G11_B11 repacking, native sampled views and storage-copy refreshes. Remove obsolete software sampler modes for native views, preserve independent 3D Z filtering, account retained copies against the sampled budget and use pooled allocation recovery. Test native filtering bit-for-bit against format 36 while retaining the converted volume and UNORM oracles. Validated on NVIDIA RTX 3070, Linux, driver 615.78.08: repacked and converted image tests, plus 71 selected regressions. The separate BDA stress-test failure from draft boykopovar#5859 remains under investigation. Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
Adopt Gjonn PR boykopovar#7271 with exact R10_G11_B11 repacking, native sampled views and storage-copy refreshes. Remove obsolete software sampler modes for native views, preserve independent 3D Z filtering, account retained copies against the sampled budget and use pooled allocation recovery. Test native filtering bit-for-bit against format 36 while retaining the converted volume and UNORM oracles. Validated on NVIDIA RTX 3070, Linux, driver 615.78.08: repacked and converted image tests, plus 71 selected regressions. The separate BDA stress-test failure from draft boykopovar#5859 remains under investigation. Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
Adopt Gjonn PR boykopovar#7271 with exact R10_G11_B11 repacking, native sampled views and storage-copy refreshes. Remove obsolete software sampler modes for native views, preserve independent 3D Z filtering, account retained copies against the sampled budget and use pooled allocation recovery. Test native filtering bit-for-bit against format 36 while retaining the converted volume and UNORM oracles. Validated on NVIDIA RTX 3070, Linux, driver 615.78.08: repacked and converted image tests, plus 71 selected regressions. The separate BDA stress-test failure from draft boykopovar#5859 remains under investigation. Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
Adopt Gjonn PR boykopovar#7271 with exact R10_G11_B11 repacking, native sampled views and storage-copy refreshes. Remove obsolete software sampler modes for native views, preserve independent 3D Z filtering, account retained copies against the sampled budget and use pooled allocation recovery. Test native filtering bit-for-bit against format 36 while retaining the converted volume and UNORM oracles. Validated on NVIDIA RTX 3070, Linux, driver 615.78.08: repacked and converted image tests, plus 71 selected regressions. The separate BDA stress-test failure from draft boykopovar#5859 remains under investigation. Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
Adopt Gjonn PR boykopovar#7271 with exact R10_G11_B11 repacking, native sampled views and storage-copy refreshes. Remove obsolete software sampler modes for native views, preserve independent 3D Z filtering, account retained copies against the sampled budget and use pooled allocation recovery. Test native filtering bit-for-bit against format 36 while retaining the converted volume and UNORM oracles. Validated on NVIDIA RTX 3070, Linux, driver 615.78.08: repacked and converted image tests, plus 71 selected regressions. The separate BDA stress-test failure from draft boykopovar#5859 remains under investigation. Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
Adopt Gjonn PR boykopovar#7271 with exact R10_G11_B11 repacking, native sampled views and storage-copy refreshes. Remove obsolete software sampler modes for native views, preserve independent 3D Z filtering, account retained copies against the sampled budget and use pooled allocation recovery. Test native filtering bit-for-bit against format 36 while retaining the converted volume and UNORM oracles. Validated on NVIDIA RTX 3070, Linux, driver 615.78.08: repacked and converted image tests, plus 71 selected regressions. The separate BDA stress-test failure from draft boykopovar#5859 remains under investigation. Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
Adopt Gjonn PR boykopovar#7271 with exact R10_G11_B11 repacking, native sampled views and storage-copy refreshes. Remove obsolete software sampler modes for native views, preserve independent 3D Z filtering, account retained copies against the sampled budget and use pooled allocation recovery. Test native filtering bit-for-bit against format 36 while retaining the converted volume and UNORM oracles. Validated on NVIDIA RTX 3070, Linux, driver 615.78.08: repacked and converted image tests, plus 71 selected regressions. The separate BDA stress-test failure from draft boykopovar#5859 remains under investigation. Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
Adopt Gjonn PR boykopovar#7271 with exact R10_G11_B11 repacking, native sampled views and storage-copy refreshes. Remove obsolete software sampler modes for native views, preserve independent 3D Z filtering, account retained copies against the sampled budget and use pooled allocation recovery. Test native filtering bit-for-bit against format 36 while retaining the converted volume and UNORM oracles. Validated on NVIDIA RTX 3070, Linux, driver 615.78.08: repacked and converted image tests, plus 71 selected regressions. The separate BDA stress-test failure from draft boykopovar#5859 remains under investigation. Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
Adopt Gjonn PR boykopovar#7271 with exact R10_G11_B11 repacking, native sampled views and storage-copy refreshes. Remove obsolete software sampler modes for native views, preserve independent 3D Z filtering, account retained copies against the sampled budget and use pooled allocation recovery. Test native filtering bit-for-bit against format 36 while retaining the converted volume and UNORM oracles. Validated on NVIDIA RTX 3070, Linux, driver 615.78.08: repacked and converted image tests, plus 71 selected regressions. The separate BDA stress-test failure from draft boykopovar#5859 remains under investigation. Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
Adopt Gjonn PR boykopovar#7271 with exact R10_G11_B11 repacking, native sampled views and storage-copy refreshes. Remove obsolete software sampler modes for native views, preserve independent 3D Z filtering, account retained copies against the sampled budget and use pooled allocation recovery. Test native filtering bit-for-bit against format 36 while retaining the converted volume and UNORM oracles. Validated on NVIDIA RTX 3070, Linux, driver 615.78.08: repacked and converted image tests, plus 71 selected regressions. The separate BDA stress-test failure from draft boykopovar#5859 remains under investigation. Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
Adopt Gjonn PR boykopovar#7271 with exact R10_G11_B11 repacking, native sampled views and storage-copy refreshes. Remove obsolete software sampler modes for native views, preserve independent 3D Z filtering, account retained copies against the sampled budget and use pooled allocation recovery. Test native filtering bit-for-bit against format 36 while retaining the converted volume and UNORM oracles. Validated on NVIDIA RTX 3070, Linux, driver 615.78.08: repacked and converted image tests, plus 71 selected regressions. The separate BDA stress-test failure from draft boykopovar#5859 remains under investigation. Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
Adopt Gjonn PR boykopovar#7271 with exact R10_G11_B11 repacking, native sampled views and storage-copy refreshes. Remove obsolete software sampler modes for native views, preserve independent 3D Z filtering, account retained copies against the sampled budget and use pooled allocation recovery. Test native filtering bit-for-bit against format 36 while retaining the converted volume and UNORM oracles. Validated on NVIDIA RTX 3070, Linux, driver 615.78.08: repacked and converted image tests, plus 71 selected regressions. The separate BDA stress-test failure from draft boykopovar#5859 remains under investigation. Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
Adopt Gjonn PR boykopovar#7271 with exact R10_G11_B11 repacking, native sampled views and storage-copy refreshes. Remove obsolete software sampler modes for native views, preserve independent 3D Z filtering, account retained copies against the sampled budget and use pooled allocation recovery. Test native filtering bit-for-bit against format 36 while retaining the converted volume and UNORM oracles. Validated on NVIDIA RTX 3070, Linux, driver 615.78.08: repacked and converted image tests, plus 71 selected regressions. The separate BDA stress-test failure from draft boykopovar#5859 remains under investigation. Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
Adopt Gjonn PR boykopovar#7271 with exact R10_G11_B11 repacking, native sampled views and storage-copy refreshes. Remove obsolete software sampler modes for native views, preserve independent 3D Z filtering, account retained copies against the sampled budget and use pooled allocation recovery. Test native filtering bit-for-bit against format 36 while retaining the converted volume and UNORM oracles. Validated on NVIDIA RTX 3070, Linux, driver 615.78.08: repacked and converted image tests, plus 71 selected regressions. The separate BDA stress-test failure from draft boykopovar#5859 remains under investigation. Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
Adopt Gjonn PR boykopovar#7271 with exact R10_G11_B11 repacking, native sampled views and storage-copy refreshes. Remove obsolete software sampler modes for native views, preserve independent 3D Z filtering, account retained copies against the sampled budget and use pooled allocation recovery. Test native filtering bit-for-bit against format 36 while retaining the converted volume and UNORM oracles. Validated on NVIDIA RTX 3070, Linux, driver 615.78.08: repacked and converted image tests, plus 71 selected regressions. The separate BDA stress-test failure from draft boykopovar#5859 remains under investigation. Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
Adopt Gjonn PR boykopovar#7271 with exact R10_G11_B11 repacking, native sampled views and storage-copy refreshes. Remove obsolete software sampler modes for native views, preserve independent 3D Z filtering, account retained copies against the sampled budget and use pooled allocation recovery. Test native filtering bit-for-bit against format 36 while retaining the converted volume and UNORM oracles. Validated on NVIDIA RTX 3070, Linux, driver 615.78.08: repacked and converted image tests, plus 71 selected regressions. The separate BDA stress-test failure from draft boykopovar#5859 remains under investigation. Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
Adopt Gjonn PR boykopovar#7271 with exact R10_G11_B11 repacking, native sampled views and storage-copy refreshes. Remove obsolete software sampler modes for native views, preserve independent 3D Z filtering, account retained copies against the sampled budget and use pooled allocation recovery. Test native filtering bit-for-bit against format 36 while retaining the converted volume and UNORM oracles. Validated on NVIDIA RTX 3070, Linux, driver 615.78.08: repacked and converted image tests, plus 71 selected regressions. The separate BDA stress-test failure from draft boykopovar#5859 remains under investigation. Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
Adopt Gjonn PR boykopovar#7271 with exact R10_G11_B11 repacking, native sampled views and storage-copy refreshes. Remove obsolete software sampler modes for native views, preserve independent 3D Z filtering, account retained copies against the sampled budget and use pooled allocation recovery. Test native filtering bit-for-bit against format 36 while retaining the converted volume and UNORM oracles. Validated on NVIDIA RTX 3070, Linux, driver 615.78.08: repacked and converted image tests, plus 71 selected regressions. The separate BDA stress-test failure from draft boykopovar#5859 remains under investigation. Co-authored-by: Gjon Gojcevic <gjonn@hotmail.com>
What
Sampling a texture of format 43 (10_11_11 float) is refused on main ("samples or gathers a converted float image, or queries its LOD, which is not implemented"). This PR makes it sample natively, including at any LOD and from cube faces.
Format 43 holds unsigned floats of 10 bits (R, bit 0), 11 bits (G, bit 10) and 11 bits (B, bit 21).
VK_FORMAT_B10G11R11_UFLOAT_PACK32holds R11 at bit 0, G11 at bit 11 and B10 at bit 22. So if the guest R field goes into the Vulkan B field and the guest B field into the Vulkan R field, every texel moves without changing a bit of any component. A sampled format-43 texture is now uploaded that way: a repack pass runs over the detiled words (TextureRepack.comp), and the view swaps R and B back (TextureComponentChannel). The hardware sampler then filters it like any other float texture: point and bilinear, every mip level and LOD, and cube faces.If a storage image still holds the texture's results, the texture is copied from that image (
vkCmdCopyImageToBuffer, the repack pass,vkCmdCopyBufferToImage) and copied again whenever the image changes, as the depth and block copies are. The recompiler treats a sampled format-43 image as a float image with no conversion. Storage reads and writes keep the packedR32_UINTpath. A 3D texture whose results are still in a storage image is flushed and uploaded instead.Stops at: format 43 only. The other converted formats (11_11_10 unorm and the like) are unchanged.
Relation to open #5958 (converts converted unorm and float images in the shader): the two PRs complement each other. After this PR, format 43 no longer needs #5958's in-shader conversion, and #5958 is still needed for the other converted formats. They do interact in one test. If both merge, the #5958 test that expects its 8-bit-grid bilinear result for format 43 (1.693848) would need to drop that expectation, because native filtering gives 1.694336. Native hardware filtering is what the console's TMU does, so the native value is the exact one.
Tests:
ImageRepackedFloat(new GPU test):image_sample_lof a mipmapped format-43 texture at each LOD, plusimage_loadof mip 0. Cube-face samples are compared with a native B10G11R11 cube that holds the same texels, plusimage_loadof cube face 0.TextureFormat(CPU): format 43 is sampled asB10G11R11_UFLOATand stored asR32_UINT. Every R, G and B field value read through the repacked word and the swapped channel gives back the same bits and the same float, including Inf, NaN and denormals.ImageConvertedUnorm: pointimage_sample_lzofR10_G11_B11_FLOATwas expected to be refused and now returns the texel values. The test also samples it while the results are still on the GPU (from the storage image).Tested
Windows 11, NVIDIA GeForce RTX 5090 Laptop GPU, driver 616.92. Ninja/MinGW Release with
BUILD_TESTING=ON, on current main (bd56fa6).The test was failing before the change: I built main without the change, adding only this PR's test files. Two of those files call helpers this PR adds (
IsRepackedTextureFormat,RepackTextureWord), so on main they do not compile:To get runtime failures, I swapped in local copies of the two helpers (the bit swap only) for the main run:
With the change:
tools/check_conventions.py --base origin/mainandtools/check_test_registration.pyare clean.PPSA01317 on main: boot used to abort on its format-43 sampling, a mipmapped format-43 texture sampled at a LOD other than 0 and a format-43 cube map. With this PR it gets past both and runs to about 49 s into boot.
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)