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>
This commit is contained in:
Laszlo Agocs 2023-10-24 21:25:47 +02:00
parent 445fb40081
commit 9ea3947df9

View File

@ -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);
}