fix(rhi): align empty pipeline layout contract
This commit is contained in:
@@ -155,7 +155,7 @@ void D3D12Device::Shutdown() {
|
|||||||
bool D3D12Device::CreateDXGIFactory(bool enableDebugLayer) {
|
bool D3D12Device::CreateDXGIFactory(bool enableDebugLayer) {
|
||||||
UINT dxgiFactoryFlags = 0;
|
UINT dxgiFactoryFlags = 0;
|
||||||
|
|
||||||
{
|
if (enableDebugLayer) {
|
||||||
ID3D12Debug* debugController = nullptr;
|
ID3D12Debug* debugController = nullptr;
|
||||||
if (SUCCEEDED(D3D12GetDebugInterface(IID_PPV_ARGS(&debugController)))) {
|
if (SUCCEEDED(D3D12GetDebugInterface(IID_PPV_ARGS(&debugController)))) {
|
||||||
debugController->EnableDebugLayer();
|
debugController->EnableDebugLayer();
|
||||||
|
|||||||
@@ -72,12 +72,8 @@ bool D3D12PipelineLayout::InitializeInternal(D3D12Device* device, const RHIPipel
|
|||||||
rootIndex++;
|
rootIndex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_rootParameters.empty()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
D3D12_ROOT_SIGNATURE_DESC rootSigDesc = D3D12RootSignature::CreateDesc(
|
D3D12_ROOT_SIGNATURE_DESC rootSigDesc = D3D12RootSignature::CreateDesc(
|
||||||
m_rootParameters.data(),
|
m_rootParameters.empty() ? nullptr : m_rootParameters.data(),
|
||||||
static_cast<uint32_t>(m_rootParameters.size()),
|
static_cast<uint32_t>(m_rootParameters.size()),
|
||||||
nullptr, 0,
|
nullptr, 0,
|
||||||
D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT);
|
D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT);
|
||||||
|
|||||||
@@ -13,12 +13,11 @@ TEST_P(RHITestFixture, PipelineLayout_Create_Basic) {
|
|||||||
desc.uavCount = 0;
|
desc.uavCount = 0;
|
||||||
|
|
||||||
RHIPipelineLayout* layout = GetDevice()->CreatePipelineLayout(desc);
|
RHIPipelineLayout* layout = GetDevice()->CreatePipelineLayout(desc);
|
||||||
if (layout != nullptr) {
|
ASSERT_NE(layout, nullptr);
|
||||||
EXPECT_NE(layout->GetNativeHandle(), nullptr);
|
EXPECT_NE(layout->GetNativeHandle(), nullptr);
|
||||||
layout->Shutdown();
|
layout->Shutdown();
|
||||||
delete layout;
|
delete layout;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
TEST_P(RHITestFixture, PipelineLayout_Create_WithTextures) {
|
TEST_P(RHITestFixture, PipelineLayout_Create_WithTextures) {
|
||||||
RHIPipelineLayoutDesc desc = {};
|
RHIPipelineLayoutDesc desc = {};
|
||||||
@@ -28,12 +27,11 @@ TEST_P(RHITestFixture, PipelineLayout_Create_WithTextures) {
|
|||||||
desc.uavCount = 0;
|
desc.uavCount = 0;
|
||||||
|
|
||||||
RHIPipelineLayout* layout = GetDevice()->CreatePipelineLayout(desc);
|
RHIPipelineLayout* layout = GetDevice()->CreatePipelineLayout(desc);
|
||||||
if (layout != nullptr) {
|
ASSERT_NE(layout, nullptr);
|
||||||
EXPECT_NE(layout->GetNativeHandle(), nullptr);
|
EXPECT_NE(layout->GetNativeHandle(), nullptr);
|
||||||
layout->Shutdown();
|
layout->Shutdown();
|
||||||
delete layout;
|
delete layout;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
TEST_P(RHITestFixture, PipelineLayout_Create_WithSamplers) {
|
TEST_P(RHITestFixture, PipelineLayout_Create_WithSamplers) {
|
||||||
RHIPipelineLayoutDesc desc = {};
|
RHIPipelineLayoutDesc desc = {};
|
||||||
@@ -43,12 +41,11 @@ TEST_P(RHITestFixture, PipelineLayout_Create_WithSamplers) {
|
|||||||
desc.uavCount = 0;
|
desc.uavCount = 0;
|
||||||
|
|
||||||
RHIPipelineLayout* layout = GetDevice()->CreatePipelineLayout(desc);
|
RHIPipelineLayout* layout = GetDevice()->CreatePipelineLayout(desc);
|
||||||
if (layout != nullptr) {
|
ASSERT_NE(layout, nullptr);
|
||||||
EXPECT_NE(layout->GetNativeHandle(), nullptr);
|
EXPECT_NE(layout->GetNativeHandle(), nullptr);
|
||||||
layout->Shutdown();
|
layout->Shutdown();
|
||||||
delete layout;
|
delete layout;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
TEST_P(RHITestFixture, PipelineLayout_Create_WithUAVs) {
|
TEST_P(RHITestFixture, PipelineLayout_Create_WithUAVs) {
|
||||||
RHIPipelineLayoutDesc desc = {};
|
RHIPipelineLayoutDesc desc = {};
|
||||||
@@ -58,12 +55,11 @@ TEST_P(RHITestFixture, PipelineLayout_Create_WithUAVs) {
|
|||||||
desc.uavCount = 3;
|
desc.uavCount = 3;
|
||||||
|
|
||||||
RHIPipelineLayout* layout = GetDevice()->CreatePipelineLayout(desc);
|
RHIPipelineLayout* layout = GetDevice()->CreatePipelineLayout(desc);
|
||||||
if (layout != nullptr) {
|
ASSERT_NE(layout, nullptr);
|
||||||
EXPECT_NE(layout->GetNativeHandle(), nullptr);
|
EXPECT_NE(layout->GetNativeHandle(), nullptr);
|
||||||
layout->Shutdown();
|
layout->Shutdown();
|
||||||
delete layout;
|
delete layout;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
TEST_P(RHITestFixture, PipelineLayout_Create_Complex) {
|
TEST_P(RHITestFixture, PipelineLayout_Create_Complex) {
|
||||||
RHIPipelineLayoutDesc desc = {};
|
RHIPipelineLayoutDesc desc = {};
|
||||||
@@ -73,12 +69,11 @@ TEST_P(RHITestFixture, PipelineLayout_Create_Complex) {
|
|||||||
desc.uavCount = 1;
|
desc.uavCount = 1;
|
||||||
|
|
||||||
RHIPipelineLayout* layout = GetDevice()->CreatePipelineLayout(desc);
|
RHIPipelineLayout* layout = GetDevice()->CreatePipelineLayout(desc);
|
||||||
if (layout != nullptr) {
|
ASSERT_NE(layout, nullptr);
|
||||||
EXPECT_NE(layout->GetNativeHandle(), nullptr);
|
EXPECT_NE(layout->GetNativeHandle(), nullptr);
|
||||||
layout->Shutdown();
|
layout->Shutdown();
|
||||||
delete layout;
|
delete layout;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
TEST_P(RHITestFixture, PipelineLayout_Create_ZeroCounts) {
|
TEST_P(RHITestFixture, PipelineLayout_Create_ZeroCounts) {
|
||||||
RHIPipelineLayoutDesc desc = {};
|
RHIPipelineLayoutDesc desc = {};
|
||||||
@@ -88,12 +83,11 @@ TEST_P(RHITestFixture, PipelineLayout_Create_ZeroCounts) {
|
|||||||
desc.uavCount = 0;
|
desc.uavCount = 0;
|
||||||
|
|
||||||
RHIPipelineLayout* layout = GetDevice()->CreatePipelineLayout(desc);
|
RHIPipelineLayout* layout = GetDevice()->CreatePipelineLayout(desc);
|
||||||
if (layout != nullptr) {
|
ASSERT_NE(layout, nullptr);
|
||||||
EXPECT_NE(layout->GetNativeHandle(), nullptr);
|
EXPECT_NE(layout->GetNativeHandle(), nullptr);
|
||||||
layout->Shutdown();
|
layout->Shutdown();
|
||||||
delete layout;
|
delete layout;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
TEST_P(RHITestFixture, PipelineLayout_Shutdown) {
|
TEST_P(RHITestFixture, PipelineLayout_Shutdown) {
|
||||||
RHIPipelineLayoutDesc desc = {};
|
RHIPipelineLayoutDesc desc = {};
|
||||||
@@ -102,23 +96,21 @@ TEST_P(RHITestFixture, PipelineLayout_Shutdown) {
|
|||||||
desc.samplerCount = 1;
|
desc.samplerCount = 1;
|
||||||
|
|
||||||
RHIPipelineLayout* layout = GetDevice()->CreatePipelineLayout(desc);
|
RHIPipelineLayout* layout = GetDevice()->CreatePipelineLayout(desc);
|
||||||
if (layout != nullptr) {
|
ASSERT_NE(layout, nullptr);
|
||||||
layout->Shutdown();
|
layout->Shutdown();
|
||||||
delete layout;
|
delete layout;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
TEST_P(RHITestFixture, PipelineLayout_DoubleShutdown) {
|
TEST_P(RHITestFixture, PipelineLayout_DoubleShutdown) {
|
||||||
RHIPipelineLayoutDesc desc = {};
|
RHIPipelineLayoutDesc desc = {};
|
||||||
desc.constantBufferCount = 1;
|
desc.constantBufferCount = 1;
|
||||||
|
|
||||||
RHIPipelineLayout* layout = GetDevice()->CreatePipelineLayout(desc);
|
RHIPipelineLayout* layout = GetDevice()->CreatePipelineLayout(desc);
|
||||||
if (layout != nullptr) {
|
ASSERT_NE(layout, nullptr);
|
||||||
layout->Shutdown();
|
layout->Shutdown();
|
||||||
layout->Shutdown();
|
layout->Shutdown();
|
||||||
delete layout;
|
delete layout;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
TEST_P(RHITestFixture, PipelineLayout_DescriptorSetAllocation) {
|
TEST_P(RHITestFixture, PipelineLayout_DescriptorSetAllocation) {
|
||||||
RHIPipelineLayoutDesc layoutDesc = {};
|
RHIPipelineLayoutDesc layoutDesc = {};
|
||||||
|
|||||||
Reference in New Issue
Block a user