diff options
-rw-r--r-- | src/gui/rhi/qrhid3d11.cpp | 4 | ||||
-rw-r--r-- | src/gui/rhi/qrhimetal.mm | 3 | ||||
-rw-r--r-- | src/gui/rhi/qrhivulkan.cpp | 15 |
3 files changed, 22 insertions, 0 deletions
diff --git a/src/gui/rhi/qrhid3d11.cpp b/src/gui/rhi/qrhid3d11.cpp index b2bc631569..71faece6c1 100644 --- a/src/gui/rhi/qrhid3d11.cpp +++ b/src/gui/rhi/qrhid3d11.cpp @@ -3634,6 +3634,10 @@ void QD3D11ShaderResourceBindings::updateResources(UpdateFlags flags) }); } + Q_ASSERT(boundResourceData.count() == sortedBindings.count()); + for (BoundResourceData &bd : boundResourceData) + memset(&bd, 0, sizeof(BoundResourceData)); + generation += 1; } diff --git a/src/gui/rhi/qrhimetal.mm b/src/gui/rhi/qrhimetal.mm index 254f09ae08..e169550ee4 100644 --- a/src/gui/rhi/qrhimetal.mm +++ b/src/gui/rhi/qrhimetal.mm @@ -3191,6 +3191,9 @@ void QMetalShaderResourceBindings::updateResources(UpdateFlags flags) }); } + for (BoundResourceData &bd : boundResourceData) + memset(&bd, 0, sizeof(BoundResourceData)); + generation += 1; } diff --git a/src/gui/rhi/qrhivulkan.cpp b/src/gui/rhi/qrhivulkan.cpp index 43619d4299..45fb106a10 100644 --- a/src/gui/rhi/qrhivulkan.cpp +++ b/src/gui/rhi/qrhivulkan.cpp @@ -6637,6 +6637,21 @@ void QVkShaderResourceBindings::updateResources(UpdateFlags flags) }); } + // Reset the state tracking table too - it can deal with assigning a + // different QRhiBuffer/Texture/Sampler for a binding point, but it cannot + // detect changes in the associated data, such as the buffer offset. And + // just like after a create(), a call to updateResources() may lead to now + // specifying a different offset for the same QRhiBuffer for a given binding + // point. The same applies to other type of associated data that is not part + // of the layout, such as the mip level for a StorageImage. Instead of + // complicating the checks in setShaderResources(), reset the table here + // just like we do in create(). + for (int i = 0; i < QVK_FRAMES_IN_FLIGHT; ++i) { + Q_ASSERT(boundResourceData[i].count() == sortedBindings.count()); + for (BoundResourceData &bd : boundResourceData[i]) + memset(&bd, 0, sizeof(BoundResourceData)); + } + generation += 1; } |