Shaders: images counted once per stage again when the next stage's bindings start

Counting every per-mip binding of a DynamicIndex image in Info::AddBindings (4e7c4a0d) agreed
with the pipeline layout, but the rasterizer still advances one per image when it writes the next
stage's descriptors: the next stage's shader would look for them where they are not written. That
mode is used on NVIDIA (no VK_AMD_shader_image_load_store_lod), so it goes back to how it was until
both sides change together. Pipeline key version 6 again, so caches are not rebuilt for nothing.
The phi pass ordering from the same commit stays.
This commit is contained in:
ayozetr committed 2026-10-27 18:20:52 +00:00
1 parent 1f4f56164c
commit 007c1e4b60
2 files changed
+6 -10

No files matched your search

+5 -8
View File
@@ -255,14 +255,11 @@ struct Info : InfoPersistent {
void AddBindings(Backend::Bindings& bnd) const {
bnd.buffer += buffers.size();
// bbport: an image with a binding per mip level (MipStorageFallbackMode::DynamicIndex)
// takes as many as the SPIR-V emitter and the pipeline layout give it, not one, or the
// next stage's bindings start inside it. From Awaken's LanternEngine.
u32 image_bindings = 0;
for (const auto& image : images) {
image_bindings += image.NumBindings(*this);
}
bnd.unified += buffers.size() + image_bindings + samplers.size();
// bbport: one per image, as the rasterizer advances when it binds the next stage
// (BindResources); an image with a binding per mip level (DynamicIndex) gets more in the
// pipeline layout. Counting those here alone moved the next stage's shader away from
// where its descriptors are written, so both stay as they were.
bnd.unified += buffers.size() + images.size() + samplers.size();
bnd.user_data += ud_mask.NumRegs();
}
@@ -18,8 +18,7 @@ static constexpr u32 ShaderBinaryVersion = 9u; // layer page-table pairs / guard
static constexpr u32 ShaderMetaVersion = 7u; // bbport: ImageResource::needs_native
// bbport 6: stages no longer paired with a vertex shader built for another binding start
// (StageSpecialization::operator==): the pipelines saved with such pairs are rebuilt.
// bbport 7: images with a binding per mip level count all of them (Info::AddBindings).
static constexpr u32 PipelineKeyVersion = 7u; // bbport: Info layout (ImageResource::needs_native)
static constexpr u32 PipelineKeyVersion = 6u; // bbport: Info layout (ImageResource::needs_native)
} // namespace Serialization
namespace Vulkan {