Files
XCEngine/tests/RHI/D3D12/unit/test_root_signature.cpp
ssdfasd fae520854e refactor: reorganize unit tests into separate folder
- Move test_*.cpp and fixtures/ to tests/RHI/D3D12/unit/
- Create unit/CMakeLists.txt with proper test configuration
- Simplify parent CMakeLists.txt to use add_subdirectory
- Integration tests remain in integration/ folder
2026-03-20 02:58:33 +08:00

43 lines
1.6 KiB
C++

#include "fixtures/D3D12TestFixture.h"
TEST_F(D3D12TestFixture, RootSignature_Placeholder) {
ASSERT_NE(GetDevice(), nullptr);
}
TEST_F(D3D12TestFixture, RootSignature_CreateEmptyRootSignature) {
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_CreateRootSignatureWithCBV) {
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 = &param;
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);
}