Repository navigation
feat(agc): sample non-sRGB textures through FORCE_DEGAMMA samplers as sRGB views - #4487
Conversation
… sRGB views A sampler with FORCE_DEGAMMA decodes the texels of a non-sRGB 8-bit texture as sRGB. Such a binding was refused; it now samples an sRGB view of the same image. Snapshot images whose format has an sRGB twin (R8, R8G8, RGBA8, BGRA8, ABGR8 packed, BC1/2/3/7 UNORM) are created with MUTABLE_FORMAT, and storage images are already mutable. The view is made on first use for the full, first-layer or base-level range, with sampled usage only and the descriptor's minimum LOD. A format without an sRGB twin is still refused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Has this version been run on PPSA26344? The description says only an earlier one was. |
|
Another data point: High on Life (PPSA15388) stops on this error in its home base (a later save): With this PR cherry-picked onto my stack ( Tested and written by Claude (AI assistant) on a contributor's machine. |
|
Windows test (MinGW GCC 15.2, Release, Windows 10, RTX 4080 SUPER). Built on main
Not tested: no game run. The batch was built once, not per PR; nothing failed, so no bisect was needed. AI-assisted (Claude Code). |
… in the shader SrgbTwinFormat mapped R8_UNORM and R8G8_UNORM to R8_SRGB and R8G8_SRGB without asking the device. Where 8_SRGB or 8_8_SRGB is decoded in the shader (context.srgbDecodeFormats: the device cannot sample the sRGB format, or APS5_SRGB_SHADER_DECODE=1), the forced view would have been created with a format the device cannot sample. Those two formats now get no twin there, so a FORCE_DEGAMMA sampler on them keeps the refusal. The image is no longer created MUTABLE_FORMAT either. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@oneandonlydean thanks, you're right. On PPSA26344: no, this exact head hasn't run there. Our Yōtei runs (run85, about 66 minutes, intro and wolf scene, no stop on this error) used a local integration stack. It has the same forced-sRGB change plus the Tests
Tested and written by Claude (AI assistant) on a contributor's machine. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What
A guest sampler with FORCE_DEGAMMA makes the hardware decode the texels of a non-sRGB 8-bit texture as sRGB.
mainrefuses that binding ("…which is not sRGB, is sampled through a sampler that forces sRGB decoding, which is not implemented"). With this change the binding samples an sRGB view of the same image:Texture::SrgbViewcreates the view on first use, for the range the binding needs (full, first layer or base level). The view hasVK_IMAGE_USAGE_SAMPLED_BITusage only and carries the descriptor's minimum LOD.SrgbTwinFormatmaps R8, R8G8, RGBA8, BGRA8, ABGR8 (packed) and BC1/2/3/7 UNORM to their sRGB formats.VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT, so the view is valid. Textures viewed from storage images are already mutable.RequireDegammaFormatbecomesForcesDegammaOn, which tellsShaderResourcesto bind the sRGB view. A texture with no sRGB view (a format without an sRGB twin, or an image that isn't mutable) is still refused, and the message says so.Tested
Windows 11, RTX 4090.
agc_driver_image_sample_force_degamma. The case that expected a rejection for 8_8_8_8_UNORM now checks:On
mainthe new test fails with the old refusal.Validation layer (
VK_LAYER_KHRONOS_validation, SDK 1.4.363.0): the test passes with no errors or warnings. To check that the layer covers the change, I built it once withoutVK_IMAGE_CREATE_MUTABLE_FORMAT_BITon the image. The test still passed on this driver, but the layer reportedVUID-VkImageViewCreateInfo-image-12397(an R8G8B8A8_SRGB view of an R8G8B8A8_UNORM image).Full suite: 966/966 pass; 7 tests skip on this machine (
agc_driver_stencil_ref_export, fivevideo_out_flip_*,guest_video_out_wqhd_detection_no_vulkan).Ghost of Yōtei (PPSA26344): an earlier version of this change let its shader
0x80003fca00sample a BC1 texture through a FORCE_DEGAMMA sampler instead of stopping at the refusal. That version didn't create the image as mutable, which this one fixes.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt (the remaining case is a refusal).mdfiles or images added to the repository🤖 Generated with Claude Code