The ONE descriptor-binding layout every Qt-RHI shader family speaks (overlay, animation, surface, pointer) and the daemon's ShaderNodeRhi populates.
More...
The ONE descriptor-binding layout every Qt-RHI shader family speaks (overlay, animation, surface, pointer) and the daemon's ShaderNodeRhi populates.
Each family's shared GLSL header declares its samplers with layout(binding = N) from this table, the node builds its SRB from the same constants, and plasmazones-shader-validate reflects every baked stage back against it (expectedSamplerBinding), so a header that drifts from the table fails the pack gate instead of the pipeline.
The table is CONTIGUOUS and declared in this order:
0 the family's std140 uniform block 1 consumer slot (the overlay zone-labels texture, uZoneLabels) 2 .. 9 iChannel0 .. iChannel7, the multipass buffer outputs 10 uAudioSpectrum 11 .. 14 uTexture0 .. uTexture3 (the pointer family's uCursorSprite takes slot 11, the one it has no uTexture0 for) 15 uWallpaper / uBackdrop (one slot, two family names) 16 uDepthBuffer 17 .. 31 free for consumers via ShaderNodeRhi::setExtraBinding
The uniform block carries iChannelResolution[4] for the FIRST four channels only, so it keeps its 672-byte base layout across the channel growth; a pass that reads iChannel4 .. iChannel7 sizes them with textureSize(), which is what the builtin Kawase passes do.
| int PhosphorShaders::Bindings::kMaxBinding = 31 |
|
inlineconstexpr |
Highest binding a consumer may claim.
This is a PROJECT ceiling, not a Qt one. QRhi exposes no resource limit for binding count, and neither QRhiShaderResourceBindings nor QRhiShaderResourceBinding documents a portable maximum binding INDEX, so 31 is a convention this library enforces rather than a guarantee it inherits. ShaderNodeRhi.h says the same of kMaxConsumerBinding, which is this constant.
What Qt does document is a different quantity, and a smaller one: a per-shader SAMPLER COUNT. QRhiShaderResourceBinding states, of sampledTexture(), texture() and sampler() alike, that a shader may not be able to consume more than 16 textures or samplers depending on the underlying graphics API. The reserved range above claims bindings 1 to 16, which is exactly that many, so the contract sits AT the documented ceiling and every consumer slot in 17..31 is the seventeenth sampler onward in any stage that reaches it.
That became live rather than theoretical when the channel budget went from four to eight: createImageSrbMulti binds all kChannelCount channel slots unconditionally, dummy-filled for a pack that declares fewer, and the user textures, wallpaper and depth bindings are unconditional too, so a multipass pack already carries 14 fragment-stage samplers, 15 with audio and 16 with one consumer extra. Nothing has failed on the target: desktop Mesa and NVIDIA report far above the Vulkan minimum of 16 per-stage sampled images, and GL_MAX_TEXTURE_IMAGE_UNITS is 32 on Mesa. A conservative backend is where it would show, and adding a reserved slot is what would push it there.