mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-29 21:30:53 +00:00
Test cbuffers with huge spaces on D3D12
This commit is contained in:
@@ -238,9 +238,14 @@ cbuffer rootconsts : register(b1)
|
||||
float3_1 root_d;
|
||||
};
|
||||
|
||||
cbuffer hugespace : register(b0, space999999999)
|
||||
{
|
||||
float4 huge_val;
|
||||
};
|
||||
|
||||
float4 main() : SV_Target0
|
||||
{
|
||||
return test + root_zero + float4(0.1f, 0.0f, 0.0f, 0.0f);
|
||||
return test + root_zero + huge_val * 1e-30f + float4(0.1f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
)EOSHADER";
|
||||
@@ -266,7 +271,7 @@ float4 main() : SV_Target0
|
||||
return 3;
|
||||
|
||||
ID3DBlobPtr vsblob = Compile(D3DDefaultVertex, "main", "vs_5_0");
|
||||
ID3DBlobPtr psblob = Compile(pixel, "main", "ps_5_0");
|
||||
ID3DBlobPtr psblob = Compile(pixel, "main", "ps_5_1");
|
||||
|
||||
Vec4f cbufferdata[512];
|
||||
|
||||
@@ -299,6 +304,7 @@ float4 main() : SV_Target0
|
||||
ID3D12RootSignaturePtr sig = MakeSig({
|
||||
cbvParam(D3D12_SHADER_VISIBILITY_PIXEL, 0, 0),
|
||||
constParam(D3D12_SHADER_VISIBILITY_PIXEL, 0, 1, sizeof(rootData) / sizeof(uint32_t)),
|
||||
cbvParam(D3D12_SHADER_VISIBILITY_PIXEL, 999999999, 0),
|
||||
});
|
||||
|
||||
ID3D12PipelineStatePtr pso = MakePSO().RootSig(sig).InputLayout().VS(vsblob).PS(psblob).RTVs(
|
||||
@@ -335,6 +341,7 @@ float4 main() : SV_Target0
|
||||
cmd->SetGraphicsRootSignature(sig);
|
||||
cmd->SetGraphicsRootConstantBufferView(0, cb->GetGPUVirtualAddress());
|
||||
cmd->SetGraphicsRoot32BitConstants(1, sizeof(rootData) / sizeof(uint32_t), &rootData, 0);
|
||||
cmd->SetGraphicsRootConstantBufferView(2, cb->GetGPUVirtualAddress() + 256);
|
||||
|
||||
RSSetViewport(cmd, {0.0f, 0.0f, (float)screenWidth, (float)screenHeight, 0.0f, 1.0f});
|
||||
RSSetScissorRect(cmd, {0, 0, screenWidth, screenHeight});
|
||||
|
||||
@@ -15,6 +15,28 @@ class D3D12_CBuffer_Zoo(rdtest.TestCase):
|
||||
pipe: rd.PipeState = self.controller.GetPipelineState()
|
||||
|
||||
stage = rd.ShaderStage.Pixel
|
||||
|
||||
refl: rd.ShaderReflection = pipe.GetShaderReflection(stage)
|
||||
mapping: rd.ShaderBindpointMapping = pipe.GetBindpointMapping(stage)
|
||||
|
||||
# Make sure we have three constant buffers - b0 normal, b1 root constants, and space9999999:b0
|
||||
binds = [
|
||||
(0, 0),
|
||||
(0, 1),
|
||||
(999999999, 0),
|
||||
]
|
||||
|
||||
if len(refl.constantBlocks) != len(mapping.constantBlocks) or len(refl.constantBlocks) != len(binds):
|
||||
raise rdtest.TestFailureException(
|
||||
"Expected {}} constant buffers, only got {} {}".format(len(binds), len(refl.constantBlocks),
|
||||
len(refl.constantBlocks)))
|
||||
|
||||
for b in range(0, len(binds)):
|
||||
if binds[b][0] != mapping.constantBlocks[b].bindset or binds[b][1] != mapping.constantBlocks[b].bind:
|
||||
raise rdtest.TestFailureException(
|
||||
"Unexpected cb[{}] mapping: set {} bind {}".format(b, mapping.constantBlocks[b].bindset,
|
||||
mapping.constantBlocks[b].bind))
|
||||
|
||||
cbuf: rd.BoundCBuffer = pipe.GetConstantBuffer(stage, 0, 0)
|
||||
|
||||
var_check = rdtest.ConstantBufferChecker(
|
||||
@@ -340,3 +362,14 @@ class D3D12_CBuffer_Zoo(rdtest.TestCase):
|
||||
var_check.done()
|
||||
|
||||
rdtest.log.success("Root signature variables are as expected")
|
||||
|
||||
cbuf: rd.BoundCBuffer = pipe.GetConstantBuffer(stage, 2, 0)
|
||||
|
||||
var_check = rdtest.ConstantBufferChecker(
|
||||
self.controller.GetCBufferVariableContents(pipe.GetGraphicsPipelineObject(),
|
||||
pipe.GetShader(stage),
|
||||
pipe.GetShaderEntryPoint(stage), 2,
|
||||
cbuf.resourceId, cbuf.byteOffset))
|
||||
|
||||
# float4 huge_val;
|
||||
var_check.check('huge_val').rows(1).cols(4).value([64.0, 65.0, 66.0, 67.0])
|
||||
|
||||
Reference in New Issue
Block a user