agc: sampled 8_SRGB decode on a device without R8_SRGB — measured filtering order and the fix shape it rules out (Ghost of Yōtei PPSA26344) #3751

Open
opened 2026-10-11 16:27:18 +00:00 by Dextroid17 · 8 comments
Dextroid17 commented 2026-10-11 16:27:18 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-11T16:27:18Z.


Sampled sRGB decode on a device without the sRGB format — measured filtering order, and what it rules out

SpirvImageEmitter.cpp throws "samples or gathers an sRGB image the device cannot sample, which is not implemented" for 8_SRGB / 8_8_SRGB, which TechnicalDebt.md records as a known gap. This note adds the measurement the implementation decision turns on, so the obvious implementation is not attempted by mistake.

Why a device hits this. Graphics::SrgbDecodeFormats probes Format8Srgb and Format8_8Srgb and only offers shader-side decode where the device cannot sample the sRGB variant but can sample the UNorm one. On lavapipe both FORMAT_R8_SRGB and FORMAT_R8G8_SRGB appear in vulkaninfo's unsupported list, so the mask is non-empty and the path is reachable. Only those two formats can enter the mask, so a title that trips this is sampling an R8 or R8G8 sRGB image.

What was measured, and on what. A 2×1 R8G8B8A8_SRGB image with texel0 R=255 and texel1 R=0, sampled at u=0.5 with a VK_FILTER_LINEAR sampler. The two candidate orders predict different values:

filter the stored (sRGB-encoded) values, then decode   = EOTF(0.5)  = 0.214041
decode each texel, then filter in linear space         = 0.5        = 0.500000

Result, identical on two independent drivers:

lavapipe (llvmpipe, Mesa 26.2.4 / LLVM 23.1.1)   R = 0.500000   |delta| 0.000000 vs 0.285959
NVIDIA RTX 3080 Ti (driver 615.71.09)            R = 0.500000   |delta| 0.000000 vs 0.285959

So both measured drivers decode sRGB to linear before filtering — filtering happens in linear space — and the two agreeing makes it very unlikely to be vendor-specific.

What that rules out. A post-sample decode — bind the UNorm view, sample, then apply the sRGB EOTF to the result — is exact only where no interpolation happens: gathers, and samples whose sampler does not blend between texels. Where the sampler does interpolate it is wrong, and wrong in the direction above: 0.214 where the reference produces 0.5. That is presumably why this was left as debt, and it means the two halves of the debt are not equally cheap:

  • non-interpolating samplers and gathers — a post-sample decode is equivalent by construction, since a single texel is decoded either way;
  • interpolating samplers — the decode has to be applied per texel with the filtering done in the shader, or the filtering has to happen on values that are already linear.

Two routes for the interpolating case, in case it helps decide:

  1. Filter in the shader over decoded texels — fetch the taps, decode each, blend. The emulated-comparison path already implements shader-side filtering with address modes and a linear flag, so the machinery and its conventions exist.
  2. Keep a linear proxy of the image — convert at write time (R8_SRGB → a UNorm/float view holding linear values) and sample that. Hardware filtering is then already in linear space and is exact by construction; the cost moves to the write path and to the memory the proxy needs.

Reproduction on a title. Ghost of Yōtei (PPSA26344) compute shader 0x8000376e00, presentation path:

what(): compute shader 0x8000376e00: samples or gathers an sRGB image the device cannot sample, which is not implemented

Instrumenting the sampler lookup for its sampled sRGB images shows the title's S# filter fields in both encodings, magFilter = (words2 >> 20) & 3 and minFilter = (words2 >> 22) & 3:

words2 = 0x05000000  → mag 0, min 0  (point)
words2 = 0x06500000  → mag 1, min 1  (bilinear)

so the title exercises both. The failing access itself resolves to Format8Srgb (guest format 128, SrgbDecodeBit 1) — a sampled, non-storage, non-packed, non-table image — but its own sampler's filter does not need to be known to make the point below: srgbDecodeCompatible is cleared by a needsSampler flag that carries no filtering information, and the reject aborts the compile before any pass reads the sampler words. A point-only increment would therefore first have to have the filter plumbed into that decision; a filter-independent route avoids the question entirely.

Environment: CachyOS, lavapipe (Mesa 26.2.4, LLVM 23.1.1) and NVIDIA 615.71.09, on a tree carrying the merged #3300 dispatch split, which is what let the title reach this wall.

Written with AI assistance.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5802933681 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3751). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-11T16:27:18Z. --- **Sampled sRGB decode on a device without the sRGB format — measured filtering order, and what it rules out** `SpirvImageEmitter.cpp` throws `"samples or gathers an sRGB image the device cannot sample, which is not implemented"` for `8_SRGB` / `8_8_SRGB`, which `TechnicalDebt.md` records as a known gap. This note adds the measurement the implementation decision turns on, so the obvious implementation is not attempted by mistake. **Why a device hits this.** `Graphics::SrgbDecodeFormats` probes `Format8Srgb` and `Format8_8Srgb` and only offers shader-side decode where the device cannot sample the sRGB variant but can sample the UNorm one. On lavapipe both `FORMAT_R8_SRGB` and `FORMAT_R8G8_SRGB` appear in `vulkaninfo`'s unsupported list, so the mask is non-empty and the path is reachable. Only those two formats can enter the mask, so a title that trips this is sampling an R8 or R8G8 sRGB image. **What was measured, and on what.** A 2×1 `R8G8B8A8_SRGB` image with texel0 R=255 and texel1 R=0, sampled at u=0.5 with a `VK_FILTER_LINEAR` sampler. The two candidate orders predict different values: ``` filter the stored (sRGB-encoded) values, then decode = EOTF(0.5) = 0.214041 decode each texel, then filter in linear space = 0.5 = 0.500000 ``` Result, identical on two independent drivers: ``` lavapipe (llvmpipe, Mesa 26.2.4 / LLVM 23.1.1) R = 0.500000 |delta| 0.000000 vs 0.285959 NVIDIA RTX 3080 Ti (driver 615.71.09) R = 0.500000 |delta| 0.000000 vs 0.285959 ``` So both measured drivers **decode sRGB to linear before filtering** — filtering happens in linear space — and the two agreeing makes it very unlikely to be vendor-specific. **What that rules out.** A post-sample decode — bind the UNorm view, sample, then apply the sRGB EOTF to the result — is exact only where no interpolation happens: gathers, and samples whose sampler does not blend between texels. Where the sampler does interpolate it is *wrong*, and wrong in the direction above: `0.214` where the reference produces `0.5`. That is presumably why this was left as debt, and it means the two halves of the debt are not equally cheap: - non-interpolating samplers and gathers — a post-sample decode is equivalent by construction, since a single texel is decoded either way; - interpolating samplers — the decode has to be applied per texel with the filtering done in the shader, or the filtering has to happen on values that are already linear. **Two routes for the interpolating case**, in case it helps decide: 1. **Filter in the shader over decoded texels** — fetch the taps, decode each, blend. The emulated-comparison path already implements shader-side filtering with address modes and a linear flag, so the machinery and its conventions exist. 2. **Keep a linear proxy of the image** — convert at write time (`R8_SRGB` → a UNorm/float view holding linear values) and sample that. Hardware filtering is then already in linear space and is exact by construction; the cost moves to the write path and to the memory the proxy needs. **Reproduction on a title.** Ghost of Yōtei (PPSA26344) compute shader `0x8000376e00`, presentation path: ``` what(): compute shader 0x8000376e00: samples or gathers an sRGB image the device cannot sample, which is not implemented ``` Instrumenting the sampler lookup for its sampled sRGB images shows the title's S# filter fields in both encodings, `magFilter = (words2 >> 20) & 3` and `minFilter = (words2 >> 22) & 3`: ``` words2 = 0x05000000 → mag 0, min 0 (point) words2 = 0x06500000 → mag 1, min 1 (bilinear) ``` so the title exercises both. The failing access itself resolves to `Format8Srgb` (guest format 128, `SrgbDecodeBit` 1) — a sampled, non-storage, non-packed, non-table image — but its own sampler's filter does not need to be known to make the point below: `srgbDecodeCompatible` is cleared by a `needsSampler` flag that carries no filtering information, and the reject aborts the compile before any pass reads the sampler words. A point-only increment would therefore first have to have the filter plumbed into that decision; a filter-independent route avoids the question entirely. **Environment:** CachyOS, lavapipe (Mesa 26.2.4, LLVM 23.1.1) and NVIDIA 615.71.09, on a tree carrying the merged `#3300` dispatch split, which is what let the title reach this wall. Written with AI assistance.
MarcZX10 commented 2026-10-11 16:34:30 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-11T16:34:30Z.


I am tracing the unsupported sampling path to see what a correct per-texel implementation would need to cover. Could you capture the four S# descriptor dwords for the specific failing image access in shader 0x8000376e00, together with its decoded sample opcode/flags (implicit or explicit LOD, gradients, offset, gather)? The dump currently establishes that the title uses both point and bilinear samplers, but not which sampler is paired with the access that triggers the compile failure. That distinction will help build a focused regression case and avoid assuming the failing path is bilinear.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6111211028 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3751#issuecomment-6111211028). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-11T16:34:30Z. --- I am tracing the unsupported sampling path to see what a correct per-texel implementation would need to cover. Could you capture the four S# descriptor dwords for the specific failing image access in shader `0x8000376e00`, together with its decoded sample opcode/flags (implicit or explicit LOD, gradients, offset, gather)? The dump currently establishes that the title uses both point and bilinear samplers, but not which sampler is paired with the access that triggers the compile failure. That distinction will help build a focused regression case and avoid assuming the failing path is bilinear.
Dextroid17 commented 2026-10-11 21:47:54 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-11T21:47:54Z.


Reproduces on a current stack, and the guard relaxation is not the fix

Two runs of one build — main 14a7e64dc plus the two still-open table PRs (#757 e904eb18c, #758 1ff81c241) — on lavapipe (Mesa 26.2.4, LLVM 23.1.1): one with a cold shader cache (0 hits, 232 misses at the point of failure) and one warm (1153 hits, 0 misses), on an otherwise idle box.

[videoout] presentation failed: compute shader 0x8000376e00:
  samples or gathers an sRGB image the device cannot sample, which is not implemented

Both runs abort here, at the same shader. Neither log names the min/max reduction refusal (0x80003af600) or the unnormalized-sampler fold — the run dies at the sRGB shader, so the paths that would emit them are not reached in these two runs.

Why this wall comes first here and not on the tree I measured before. On the older tree this issue was filed from, the sRGB refusal had been relaxed locally, which is why that run got past this shader and stopped on the min/max reduction instead. The two results are the same sequence seen from different starting points, not a disagreement: on a current tree, with the guard intact, the sRGB access is what the presentation path reaches first.

Scope. This holds only where the device probe finds no R8_SRGB sampling. On lavapipe FORMAT_R8_SRGB and FORMAT_R8G8_SRGB are both unsupported, so SrgbDecodeFormats is non-empty and the shader-side decode path is taken; the RTX 3080 Ti I also run on does support sampling FORMAT_R8_SRGB, so this wall cannot be provoked there at all.

What not to do. I have a local branch that "passes" this wall with a two-file guard relaxation (ResourceMaterializer.cpp, SpirvImageEmitter.cpp; +2/−8 — the same commit also carries unrelated scalar-aperture modelling): the SrgbUnsupported reject in inspectImageDescriptor, the srgbDecodeCompatible term in the RuntimeImageModes condition, and the emit-time refusal in EmitSamplingOp. That is a relaxation, not a decode: it lets the post-sample decode run in exactly the case this issue measured to be wrong in principle, so it would trade a refusal for a wrong colour. I did not capture a rendered frame from that branch, so this is the reason not to port it rather than a measurement of it — recording it here so a later reader does not mistake it for the fix.

What I could not check. No AMD GPU here. No part of this is device-independent: the wall exists only on devices without R8_SRGB sampling, and no R8_SRGB-capable device — including my Ampere box — can provoke it. The filtering-order numbers are this issue's measurement on lavapipe and the 3080 Ti, quoted rather than reproduced.

Hermes Agent 🤖 at your service — AI assistance: the build, the runs and this write-up were produced by an AI agent on the contributor's machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6114159624 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3751#issuecomment-6114159624). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-11T21:47:54Z. --- **Reproduces on a current stack, and the guard relaxation is not the fix** Two runs of one build — `main` `14a7e64dc` plus the two still-open table PRs (#757 `e904eb18c`, #758 `1ff81c241`) — on lavapipe (Mesa 26.2.4, LLVM 23.1.1): one with a cold shader cache (0 hits, 232 misses at the point of failure) and one warm (1153 hits, 0 misses), on an otherwise idle box. ``` [videoout] presentation failed: compute shader 0x8000376e00: samples or gathers an sRGB image the device cannot sample, which is not implemented ``` Both runs abort here, at the same shader. Neither log names the min/max reduction refusal (`0x80003af600`) or the unnormalized-sampler fold — the run dies at the sRGB shader, so the paths that would emit them are not reached in these two runs. **Why this wall comes first here and not on the tree I measured before.** On the older tree this issue was filed from, the sRGB refusal had been relaxed locally, which is why that run got past this shader and stopped on the min/max reduction instead. The two results are the same sequence seen from different starting points, not a disagreement: on a current tree, with the guard intact, the sRGB access is what the presentation path reaches first. **Scope.** This holds only where the device probe finds no R8_SRGB sampling. On lavapipe `FORMAT_R8_SRGB` and `FORMAT_R8G8_SRGB` are both unsupported, so `SrgbDecodeFormats` is non-empty and the shader-side decode path is taken; the RTX 3080 Ti I also run on *does* support sampling `FORMAT_R8_SRGB`, so this wall cannot be provoked there at all. **What not to do.** I have a local branch that "passes" this wall with a **two-file guard relaxation** (`ResourceMaterializer.cpp`, `SpirvImageEmitter.cpp`; +2/−8 — the same commit also carries unrelated scalar-aperture modelling): the `SrgbUnsupported` reject in `inspectImageDescriptor`, the `srgbDecodeCompatible` term in the `RuntimeImageModes` condition, and the emit-time refusal in `EmitSamplingOp`. That is a relaxation, not a decode: it lets the post-sample decode run in exactly the case this issue measured to be wrong in principle, so it would trade a refusal for a wrong colour. I did not capture a rendered frame from that branch, so this is the reason not to port it rather than a measurement of it — recording it here so a later reader does not mistake it for the fix. **What I could not check.** No AMD GPU here. No part of this is device-independent: the wall exists only on devices without R8_SRGB sampling, and no R8_SRGB-capable device — including my Ampere box — can provoke it. The filtering-order numbers are this issue's measurement on lavapipe and the 3080 Ti, quoted rather than reproduced. Hermes Agent 🤖 at your service — AI assistance: the build, the runs and this write-up were produced by an AI agent on the contributor's machine.
Dextroid17 commented 2026-10-12 17:26:22 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-12T17:26:22Z.


I set out to get you the four dwords for that access and could not — here is the instrument, and what
blocked it

I added the dump you need and ran it. It works, and it captures real sampler descriptors — these are
other pipelines, not yours, see below:

[sampler] binding=57 element=0 dwords=00000092 00fff000 05500000 00000000 compare=0 unnormalized=0
[sampler] binding=122 element=0 dwords=00000892 00fff000 05000000 00000000 compare=0 unnormalized=0

But it is not the access you asked about. Shader 0x8000376e00 never appears in the run at all — zero
occurrences in the log — so those descriptors belong to other pipelines. I would rather say that than hand
you four dwords and imply they came from your shader.

Why the shader is unreachable here. On the CI device (lavapipe, LLVM 23.1.1) it is never compiled.
The run logs, in this order:

1. 104 x "could not be prepared at registration (its s_swappc_b64 at program counter ...)"
    10 x "unsupported MIMG opcode 0xe5"  - both deferred ("preparing it when it is used"), not fatal
2. Shader 0x8000325e00 could not be prepared after registration
     ShaderRecompiler::Recompile: GetImageResource dword 0 is not a valid runtime value
     also not fatal; the run continues past it
3. compute shader 0x8000393600
     Vulkan dispatch: workgroup count exceeds device limits   <- abort, core dumped (SIGABRT)

So the sRGB refusal never fires — not because the guard is wrong, but because nothing reaches the access.
That order is itself the data point: the first fatal wall this title meets is the llvmpipe dispatch
limit, not the sampling path.
An earlier instrumented run on this same stack printed the dimensions the
current build omits: (129199x1x1, device limit 65535x65535x65535). On the 3080 Ti the same build does not
hit that wall at all (no dispatch-limit abort anywhere in that run), which is where I would try next.

The instrument, so it can be captured where the shader is reachable. A four-line helper beside
SamplerCacheDisabled, plus one line in the sampler loop, gated by an env var — what is printed is what the
driver is about to use, not a re-derivation:

bool SamplerDescriptorDump() {
    static const bool dump = std::getenv("APS5_DUMP_SAMPLER_DESCRIPTORS") != nullptr;
    return dump;
}
samplerSources.push_back({{words[0], words[1], words[2], words[3]}, compareEnable, unnormalized});
if (SamplerDescriptorDump()) std::fprintf(stderr, "[sampler] binding=%u element=%u dwords=%08x %08x %08x %08x compare=%u unnormalized=%u\n", binding.binding, element, words[0], words[1], words[2], words[3], compareEnable ? 1u : 0u, unnormalized ? 1u : 0u);

It goes in core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp, in the sampler else branch
that requires elementWords == 4 just above the loop (line 3117), so the four dwords are contiguous and in
stored order. compare is samplerDepthCompare, unnormalized the unnormalized-coordinate metadata, both
per-element and travelling with the words.

One limitation I would rather flag than let you find. That is one of two places that fill
samplerSources. addSamplerTable (ShaderResources.cpp:3455) does the same push for sampler-table
bindings and has no dump — so if the failing access arrives through the table path, this instrument stays
silent. If that is what happens, the same line belongs there too; I have not covered it.

On the flags half of your question. I did not get to it. The implicit/explicit-LOD, derivative, offset
and gather distinctions are the RdnaImageSampleFlag* bits; ImageSampleExplicitLod(flags, stage)
(IrMetadata/Resources.hpp:113) is the explicit-LOD predicate the recompiler already applies
(ShaderInfoCollector.cpp:467, SpirvImageEmitter.cpp:1309), and it does not cover offset or gather — so
the decode exists, I just have no access to decode it for. I am not going to guess at the opcode.

Written with AI assistance.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6129225437 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3751#issuecomment-6129225437). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-12T17:26:22Z. --- **I set out to get you the four dwords for that access and could not — here is the instrument, and what blocked it** I added the dump you need and ran it. It works, and it captures real sampler descriptors — these are **other pipelines, not yours**, see below: ``` [sampler] binding=57 element=0 dwords=00000092 00fff000 05500000 00000000 compare=0 unnormalized=0 [sampler] binding=122 element=0 dwords=00000892 00fff000 05000000 00000000 compare=0 unnormalized=0 ``` But **it is not the access you asked about.** Shader `0x8000376e00` never appears in the run at all — zero occurrences in the log — so those descriptors belong to other pipelines. I would rather say that than hand you four dwords and imply they came from your shader. **Why the shader is unreachable here.** On the CI device (lavapipe, `LLVM 23.1.1`) it is never compiled. The run logs, in this order: ``` 1. 104 x "could not be prepared at registration (its s_swappc_b64 at program counter ...)" 10 x "unsupported MIMG opcode 0xe5" - both deferred ("preparing it when it is used"), not fatal 2. Shader 0x8000325e00 could not be prepared after registration ShaderRecompiler::Recompile: GetImageResource dword 0 is not a valid runtime value also not fatal; the run continues past it 3. compute shader 0x8000393600 Vulkan dispatch: workgroup count exceeds device limits <- abort, core dumped (SIGABRT) ``` So the sRGB refusal never fires — not because the guard is wrong, but because nothing reaches the access. That order is itself the data point: **the first *fatal* wall this title meets is the llvmpipe dispatch limit, not the sampling path.** An earlier instrumented run on this same stack printed the dimensions the current build omits: `(129199x1x1, device limit 65535x65535x65535)`. On the 3080 Ti the same build does not hit that wall at all (no dispatch-limit abort anywhere in that run), which is where I would try next. **The instrument, so it can be captured where the shader is reachable.** A four-line helper beside `SamplerCacheDisabled`, plus one line in the sampler loop, gated by an env var — what is printed is what the driver is about to use, not a re-derivation: ```cpp bool SamplerDescriptorDump() { static const bool dump = std::getenv("APS5_DUMP_SAMPLER_DESCRIPTORS") != nullptr; return dump; } ``` ```cpp samplerSources.push_back({{words[0], words[1], words[2], words[3]}, compareEnable, unnormalized}); if (SamplerDescriptorDump()) std::fprintf(stderr, "[sampler] binding=%u element=%u dwords=%08x %08x %08x %08x compare=%u unnormalized=%u\n", binding.binding, element, words[0], words[1], words[2], words[3], compareEnable ? 1u : 0u, unnormalized ? 1u : 0u); ``` It goes in `core/libs/prx/libSceAgcDriver/Graphics/src/ShaderResources.cpp`, in the sampler `else` branch that requires `elementWords == 4` just above the loop (line 3117), so the four dwords are contiguous and in stored order. `compare` is `samplerDepthCompare`, `unnormalized` the unnormalized-coordinate metadata, both per-element and travelling with the words. **One limitation I would rather flag than let you find.** That is one of **two** places that fill `samplerSources`. `addSamplerTable` (`ShaderResources.cpp:3455`) does the same push for sampler-*table* bindings and has no dump — so if the failing access arrives through the table path, this instrument stays silent. If that is what happens, the same line belongs there too; I have not covered it. **On the flags half of your question.** I did not get to it. The implicit/explicit-LOD, derivative, offset and gather distinctions are the `RdnaImageSampleFlag*` bits; `ImageSampleExplicitLod(flags, stage)` (`IrMetadata/Resources.hpp:113`) is the explicit-LOD predicate the recompiler already applies (`ShaderInfoCollector.cpp:467`, `SpirvImageEmitter.cpp:1309`), and it does not cover offset or gather — so the decode exists, I just have no access to decode it for. I am not going to guess at the opcode. Written with AI assistance.
Dextroid17 commented 2026-10-12 18:11:47 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-12T18:11:47Z.


Correcting my comment above: "the shader is never reached" is wrong.

I wrote that on the CI device this access is never compiled and that the sRGB refusal never fires. Both
false. Eight runs on 2026-10-11 carry it, all on the same lavapipe ICD the CI device uses
(llvmpipe (LLVM 23.1.1)) — run locally, as the earlier comment's runs were:

[videoout] presentation failed: compute shader 0x8000376e00: samples or gathers an sRGB image the device cannot sample, which is not implemented

and one of them names the request explicitly (compute shader 0x8000376e00 (shader_8000376e00.req)).

So the wall is reachable on that device, and has been reached. What I actually measured was narrower
than what I asserted: the run I instrumented died earlier, on the llvmpipe dispatch limit
(compute shader 0x8000393600: Vulkan dispatch: workgroup count exceeds device limits), so that run never
got to this shader. I turned "this run did not reach it" into "this device never reaches it". The
first is a measurement; the second is false.

This helps your question rather than weakens it: the four S# dwords are obtainable here. The instrument
below is the right one and it works — it printed real descriptors on my run
([sampler] binding=57 element=0 dwords=00000092 00fff000 05500000 00000000 compare=0 unnormalized=0).
What it needs is a run whose stack gets past the dispatch wall first. One of the 2026-10-11 runs
demonstrably does — it logs the 0x8000393600 pipeline and then reaches this shader — and mine did not.
I am chasing that rather than asking you to.

Written with AI assistance.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6129934283 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3751#issuecomment-6129934283). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-12T18:11:47Z. --- **Correcting my comment above: "the shader is never reached" is wrong.** I wrote that on the CI device this access is never compiled and that the sRGB refusal never fires. Both false. Eight runs on 2026-10-11 carry it, all on the same lavapipe ICD the CI device uses (`llvmpipe (LLVM 23.1.1)`) — run locally, as the earlier comment's runs were: ``` [videoout] presentation failed: compute shader 0x8000376e00: samples or gathers an sRGB image the device cannot sample, which is not implemented ``` and one of them names the request explicitly (`compute shader 0x8000376e00 (shader_8000376e00.req)`). So the wall **is** reachable on that device, and has been reached. What I actually measured was narrower than what I asserted: **the run I instrumented** died earlier, on the llvmpipe dispatch limit (`compute shader 0x8000393600: Vulkan dispatch: workgroup count exceeds device limits`), so that run never got to this shader. I turned *"this run did not reach it"* into *"this device never reaches it"*. The first is a measurement; the second is false. This helps your question rather than weakens it: **the four S# dwords are obtainable here.** The instrument below is the right one and it works — it printed real descriptors on my run (`[sampler] binding=57 element=0 dwords=00000092 00fff000 05500000 00000000 compare=0 unnormalized=0`). What it needs is a run whose stack gets past the dispatch wall first. One of the 2026-10-11 runs demonstrably does — it logs the `0x8000393600` pipeline and then reaches this shader — and mine did not. I am chasing that rather than asking you to. Written with AI assistance.
Dextroid17 commented 2026-10-13 02:15:57 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-13T02:15:57Z.


@MarcZX100, these are the image (T#) dwords for the failing access, not the S# dwords and opcode flags you asked for; those are still not captured (see the end).

On main 510a2188c + #757 + #758 (llvmpipe, LLVM 23.1.1) the run now reaches 0x8000376e00; the earlier run in this thread did not. I added a temporary fprintf at the refusal in ResourceMaterializer.cpp:231 (PoisonReason::SrgbUnsupported, the decoded.srgbDecode && !base.srgbDecodeCompatible branch) and ran the title once:

[DBG-SRGB] src=21 pc=0xf48 format=128 table=4294967295 storage=0 dims=3
           d0=50602c00 d1=c8000000 d2=021bc3bf d3=91b00204
  • format=128 is IrBufferFormat::Format8Srgb (BufferFormat.hpp:87), so this is the single-channel R8 case, not R8G8. dims=3 is Dim2D.
  • table=4294967295 is NoTable: the image is bound directly, not through a bindless table. storage=0: it is a sampled image.
  • src=21 is the image resource's source; pc=0xf48 is its firstUsePc, the first use of the image, not necessarily the access that triggered the refusal.
  • The refusal is reached because ResourceTracker.cpp:1361 clears srgbDecodeCompatible when an opcode with needsSampler touches the image.

Not captured: the paired sampler dwords, the sample opcode, and its flags (LOD mode, gradients, offset, gather). So this still does not say whether the access interpolates, which separates the cheap half of the debt from the expensive one. The instrument is not in the tree. Capturing the rest means printing the ImageOpcodeInfo and the sampler resource at the same site; I have not done that.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6136740619 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3751#issuecomment-6136740619). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-13T02:15:57Z. --- @MarcZX100, these are the image (T#) dwords for the failing access, not the S# dwords and opcode flags you asked for; those are still not captured (see the end). On `main` `510a2188c` + #757 + #758 (llvmpipe, LLVM 23.1.1) the run now reaches `0x8000376e00`; the earlier run in this thread did not. I added a temporary `fprintf` at the refusal in `ResourceMaterializer.cpp:231` (`PoisonReason::SrgbUnsupported`, the `decoded.srgbDecode && !base.srgbDecodeCompatible` branch) and ran the title once: ``` [DBG-SRGB] src=21 pc=0xf48 format=128 table=4294967295 storage=0 dims=3 d0=50602c00 d1=c8000000 d2=021bc3bf d3=91b00204 ``` - `format=128` is `IrBufferFormat::Format8Srgb` (`BufferFormat.hpp:87`), so this is the single-channel R8 case, not R8G8. `dims=3` is `Dim2D`. - `table=4294967295` is `NoTable`: the image is bound directly, not through a bindless table. `storage=0`: it is a sampled image. - `src=21` is the image resource's `source`; `pc=0xf48` is its `firstUsePc`, the first use of the image, not necessarily the access that triggered the refusal. - The refusal is reached because `ResourceTracker.cpp:1361` clears `srgbDecodeCompatible` when an opcode with `needsSampler` touches the image. Not captured: the paired sampler dwords, the sample opcode, and its flags (LOD mode, gradients, offset, gather). So this still does not say whether the access interpolates, which separates the cheap half of the debt from the expensive one. The instrument is not in the tree. Capturing the rest means printing the `ImageOpcodeInfo` and the sampler resource at the same site; I have not done that.
Dextroid17 commented 2026-10-13 02:23:57 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-13T02:23:57Z.


@MarcZX100, the sample opcode and flags for the R8 sRGB image from my previous comment (same build: main 510a2188c + #757 + #758, llvmpipe LLVM 23.1.1). I temporarily printed every needsSampler access in ResourceTracker.cpp Merge for source == 21. The line at pc=0xf48:

[DBG-OP] src=21 pc=0xf48 op=428 flags=0x20 sampler=5 dmask=0x1 dim=3 addrComps=2 offset=0
  • op=428 is ImageGatherRaw (IrOpcode index 428; 427 is ImageSampleRaw).
  • flags=0x20 is RdnaImageSampleFlagLevelZero: no gradients, bias, offset or compare. dmask=0x1 is one channel, with a 2-component address.
  • A second gather of the same source appears at pc=0x104c with sampler=3, same flags.

By the split in this issue, a gather falls in the non-interpolating half, where decoding after the fetch equals decoding each texel. ResourceTracker.cpp:1361 clears srgbDecodeCompatible for every needsSampler opcode, which is what makes ResourceMaterializer.cpp:231 refuse.

Limits:

  • I matched this to 0x8000376e00 only by firstUsePc == 0xf48 from the T# dump in my previous comment. The [DBG-OP] lines carry no shader id and source == 21 is shared by many shaders, so another shader whose src=21 image first appears at 0xf48 would print the same line. The 0xf48 gathers show up in two places in the log, well before the abort, so I cannot show they belong to the failing shader.
  • The S# dwords are still not captured. The refusal is thrown from materializeTables (RuntimeImageMode), before ResolveImageTables reaches the sampler-pair loop (~line 919), so the sampler words are never read.
  • I have not tested whether keeping the decode for gathers gets past this stop. The instrument is not in the tree.
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6136828568 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3751#issuecomment-6136828568). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-13T02:23:57Z. --- @MarcZX100, the sample opcode and flags for the R8 sRGB image from my previous comment (same build: `main` `510a2188c` + #757 + #758, llvmpipe LLVM 23.1.1). I temporarily printed every `needsSampler` access in `ResourceTracker.cpp` `Merge` for `source == 21`. The line at `pc=0xf48`: ``` [DBG-OP] src=21 pc=0xf48 op=428 flags=0x20 sampler=5 dmask=0x1 dim=3 addrComps=2 offset=0 ``` - `op=428` is `ImageGatherRaw` (`IrOpcode` index 428; 427 is `ImageSampleRaw`). - `flags=0x20` is `RdnaImageSampleFlagLevelZero`: no gradients, bias, offset or compare. `dmask=0x1` is one channel, with a 2-component address. - A second gather of the same `source` appears at `pc=0x104c` with `sampler=3`, same flags. By the split in this issue, a gather falls in the non-interpolating half, where decoding after the fetch equals decoding each texel. `ResourceTracker.cpp:1361` clears `srgbDecodeCompatible` for every `needsSampler` opcode, which is what makes `ResourceMaterializer.cpp:231` refuse. Limits: - I matched this to `0x8000376e00` only by `firstUsePc == 0xf48` from the T# dump in my previous comment. The `[DBG-OP]` lines carry no shader id and `source == 21` is shared by many shaders, so another shader whose `src=21` image first appears at `0xf48` would print the same line. The `0xf48` gathers show up in two places in the log, well before the abort, so I cannot show they belong to the failing shader. - The S# dwords are still not captured. The refusal is thrown from `materializeTables` (`RuntimeImageMode`), before `ResolveImageTables` reaches the sampler-pair loop (~line 919), so the sampler words are never read. - I have not tested whether keeping the decode for gathers gets past this stop. The instrument is not in the tree.
Dextroid17 commented 2026-10-13 02:49:14 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-13T02:49:14Z.


@MarcZX100, a follow-up to the R8 sRGB gather above (same build: main 510a2188c + #757 + #758, llvmpipe LLVM 23.1.1). I tried a local spike that lets ImageGatherRaw keep the sRGB decode: ResourceTracker.cpp:1361 no longer clears srgbDecodeCompatible for a gather, and SpirvImageEmitter.cpp skips the sRGB refusal for gathers and runs DecodeSrgbTexel on the gathered lanes (5 lines; not pushed).

With the spike, this run no longer logs the sRGB refusal, and 0x8000376e00 now logs a different one, SpirvImageEmitter.cpp:1052 in MakeSampleSetup:

opcode=ImageGatherRaw reason=samples or gathers a converted unorm image,
which needs filtering in the shader and is not implemented

I printed every hit on that check (temporary fprintf, not in the tree). 33 hits in one run, from 30 distinct (source, pc) accesses, all ImageGatherRaw, all with conv=30 srgb=0. conv=30 is IrBufferFormat::Format11_11_10UNorm. src ranges over 0 to 48, so this is not one shader. The run aborts on the same refusal in shader 0x80003d0600; the other refusals are logged as non-fatal "could not be prepared after registration".

So on this build the sRGB gather is not the last wall on the way through: gathering a converted unorm image is a separate gap that sits right behind it. I have not read the emitted SPIR-V for the sRGB gather, so I cannot say the decoded values are correct. The run aborts before anything is presented.

Question for you: is the converted-unorm refusal at line 1052 meant to also cover gathers, which return whole texels and are not filtered? If gathers can go through UnpackImageGather plus a unorm-to-float step, I can try that as its own change.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6137109203 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3751#issuecomment-6137109203). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-13T02:49:14Z. --- @MarcZX100, a follow-up to the R8 sRGB gather above (same build: `main` `510a2188c` + #757 + #758, llvmpipe LLVM 23.1.1). I tried a local spike that lets `ImageGatherRaw` keep the sRGB decode: `ResourceTracker.cpp:1361` no longer clears `srgbDecodeCompatible` for a gather, and `SpirvImageEmitter.cpp` skips the sRGB refusal for gathers and runs `DecodeSrgbTexel` on the gathered lanes (5 lines; not pushed). With the spike, this run no longer logs the sRGB refusal, and `0x8000376e00` now logs a different one, `SpirvImageEmitter.cpp:1052` in `MakeSampleSetup`: ``` opcode=ImageGatherRaw reason=samples or gathers a converted unorm image, which needs filtering in the shader and is not implemented ``` I printed every hit on that check (temporary `fprintf`, not in the tree). 33 hits in one run, from 30 distinct `(source, pc)` accesses, all `ImageGatherRaw`, all with `conv=30 srgb=0`. `conv=30` is `IrBufferFormat::Format11_11_10UNorm`. `src` ranges over 0 to 48, so this is not one shader. The run aborts on the same refusal in shader `0x80003d0600`; the other refusals are logged as non-fatal "could not be prepared after registration". So on this build the sRGB gather is not the last wall on the way through: gathering a converted unorm image is a separate gap that sits right behind it. I have not read the emitted SPIR-V for the sRGB gather, so I cannot say the decoded values are correct. The run aborts before anything is presented. Question for you: is the converted-unorm refusal at line 1052 meant to also cover gathers, which return whole texels and are not filtered? If gathers can go through `UnpackImageGather` plus a unorm-to-float step, I can try that as its own change.
Dextroid17 commented 2026-10-13 03:25:02 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Dextroid17 on 2026-10-13T03:25:02Z.


Correction to my comment above: I called the spike "5 lines". The saved diff is 36 lines (the ResourceTracker.cpp change plus the emitter changes), so "a small local patch" is the accurate description. Nothing else in that comment changes.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6137504611 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3751#issuecomment-6137504611). Originally posted by [Dextroid17](https://github.com/Dextroid17) on 2026-10-13T03:25:02Z. --- Correction to my comment above: I called the spike "5 lines". The saved diff is 36 lines (the `ResourceTracker.cpp` change plus the emitter changes), so "a small local patch" is the accurate description. Nothing else in that comment changes.
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5#3751
No description provided.