39 lines
1.5 KiB
C++
39 lines
1.5 KiB
C++
#include "fixtures/D3D12TestFixture.h"
|
|
|
|
TEST_F(D3D12TestFixture, RootSignature_Create_EmptyRootSignature) {
|
|
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);
|
|
}
|
|
|
|
TEST_F(D3D12TestFixture, RootSignature_Create_WithCBV) {
|
|
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);
|
|
}
|