summaryrefslogtreecommitdiffstats
path: root/src/gui/rhi
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2023-10-24 21:25:47 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2023-11-17 20:06:33 +0200
commit9ea3947df91fb113568cf08a7d5b7a87eda24de0 (patch)
treecf61b9d1756cd9a01d079750eb244671c1c2df3c /src/gui/rhi
parent445fb40081c870c0a9b1c1c3cf27b20fdd36a531 (diff)
rhi: d3d12: Mark CBV root parameters as DATA_STATIC
CBV and SRV descriptor ranges default to DATA_STATIC_WHILE_SET_AT_EXECUTE with RS 1.1. Due to how constant buffers (that back Dynamic+UniformBuffer QRhiBuffers) are implemented, DATA_STATIC is more appropriate, leaving more optimization opportunities. The buffer contents will not change once setShaderResources() is called (which is what issues the SetGraphicsRootConstantBufferView()). In fact the buffer contents should not be changing anymore during the whole render pass recording (begin..endPass). Change-Id: I5901a6d9608fb7c61f04f9d6a3a9acebce37a673 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/gui/rhi')
-rw-r--r--src/gui/rhi/qrhid3d12.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/gui/rhi/qrhid3d12.cpp b/src/gui/rhi/qrhid3d12.cpp
index 502a9bc911..febe5364e6 100644
--- a/src/gui/rhi/qrhid3d12.cpp
+++ b/src/gui/rhi/qrhid3d12.cpp
@@ -2698,6 +2698,7 @@ bool QD3D12MipmapGenerator::create(QRhiD3D12 *rhiD)
// b0
rootParams[0].ParameterType = D3D12_ROOT_PARAMETER_TYPE_CBV;
rootParams[0].ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL;
+ rootParams[0].Descriptor.Flags = D3D12_ROOT_DESCRIPTOR_FLAG_DATA_STATIC;
// t0
descriptorRanges[0].RangeType = D3D12_DESCRIPTOR_RANGE_TYPE_SRV;
@@ -4821,6 +4822,7 @@ void QD3D12ShaderResourceBindings::visitUniformBuffer(QD3D12Stage s,
rootParam.ParameterType = D3D12_ROOT_PARAMETER_TYPE_CBV;
rootParam.ShaderVisibility = qd3d12_stageToVisibility(s);
rootParam.Descriptor.ShaderRegister = shaderRegister;
+ rootParam.Descriptor.Flags = D3D12_ROOT_DESCRIPTOR_FLAG_DATA_STATIC;
visitorData.cbParams[s].append(rootParam);
}