2026-03-17 02:51:34 +08:00
|
|
|
#include "fixtures/D3D12TestFixture.h"
|
|
|
|
|
|
2026-03-20 03:18:30 +08:00
|
|
|
TEST_F(D3D12TestFixture, RootSignature_Create_EmptyRootSignature) {
|
Add Phase 4 tests for DescriptorHeap, Shader, RootSignature, PipelineState, Views
- DescriptorHeap: CBV_SRV_UAV, Sampler, RTV, DSV, HandleIncrementSize
- Shader: Vertex/Pixel/Compute profiles
- RootSignature: Empty, with CBV parameter
- PipelineState: Graphics/Compute pipeline desc defaults
- Views: RTV, DSV, CBV descriptor heaps, handle increment
- All 54 tests pass
2026-03-17 04:04:57 +08:00
|
|
|
D3D12_ROOT_SIGNATURE_DESC rootSigDesc = {};
|
|
|
|
|
rootSigDesc.NumParameters = 0;
|
|
|
|
|
rootSigDesc.NumStaticSamplers = 0;
|
|
|
|
|
rootSigDesc.Flags = D3D12_ROOT_SIGNATURE_FLAG_NONE;
|
|
|
|
|
|
|
|
|
|
ComPtr<ID3DBlob> blob;
|
|
|
|
|
ComPtr<ID3DBlob> errorBlob;
|
|
|
|
|
HRESULT hr = D3D12SerializeRootSignature(&rootSigDesc, D3D_ROOT_SIGNATURE_VERSION_1, &blob, &errorBlob);
|
|
|
|
|
ASSERT_HRESULT_SUCCEEDED(hr);
|
|
|
|
|
ASSERT_NE(blob.Get(), nullptr);
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-20 03:18:30 +08:00
|
|
|
TEST_F(D3D12TestFixture, RootSignature_Create_WithCBV) {
|
Add Phase 4 tests for DescriptorHeap, Shader, RootSignature, PipelineState, Views
- DescriptorHeap: CBV_SRV_UAV, Sampler, RTV, DSV, HandleIncrementSize
- Shader: Vertex/Pixel/Compute profiles
- RootSignature: Empty, with CBV parameter
- PipelineState: Graphics/Compute pipeline desc defaults
- Views: RTV, DSV, CBV descriptor heaps, handle increment
- All 54 tests pass
2026-03-17 04:04:57 +08:00
|
|
|
D3D12_ROOT_PARAMETER param = {};
|
|
|
|
|
param.ParameterType = D3D12_ROOT_PARAMETER_TYPE_CBV;
|
|
|
|
|
param.Descriptor.ShaderRegister = 0;
|
|
|
|
|
param.Descriptor.RegisterSpace = 0;
|
|
|
|
|
param.ShaderVisibility = D3D12_SHADER_VISIBILITY_ALL;
|
|
|
|
|
|
|
|
|
|
D3D12_ROOT_SIGNATURE_DESC rootSigDesc = {};
|
|
|
|
|
rootSigDesc.NumParameters = 1;
|
|
|
|
|
rootSigDesc.pParameters = ¶m;
|
|
|
|
|
rootSigDesc.NumStaticSamplers = 0;
|
|
|
|
|
rootSigDesc.Flags = D3D12_ROOT_SIGNATURE_FLAG_NONE;
|
|
|
|
|
|
|
|
|
|
ComPtr<ID3DBlob> blob;
|
|
|
|
|
ComPtr<ID3DBlob> errorBlob;
|
|
|
|
|
HRESULT hr = D3D12SerializeRootSignature(&rootSigDesc, D3D_ROOT_SIGNATURE_VERSION_1, &blob, &errorBlob);
|
|
|
|
|
ASSERT_HRESULT_SUCCEEDED(hr);
|
|
|
|
|
|
|
|
|
|
ComPtr<ID3D12RootSignature> rootSig;
|
|
|
|
|
hr = GetDevice()->CreateRootSignature(0, blob->GetBufferPointer(), blob->GetBufferSize(), IID_PPV_ARGS(&rootSig));
|
|
|
|
|
ASSERT_HRESULT_SUCCEEDED(hr);
|
|
|
|
|
ASSERT_NE(rootSig.Get(), nullptr);
|
2026-03-17 02:51:34 +08:00
|
|
|
}
|