refactor: 将 tests/D3D12 的 RootSignature 替换为 D3D12RootSignature
- 添加全局变量 gRootSignature - 使用 D3D12RootSignature::Initialize 替代原生 API - 测试通过
This commit is contained in:
@@ -21,6 +21,7 @@
|
|||||||
#include "XCEngine/RHI/D3D12/D3D12DescriptorHeap.h"
|
#include "XCEngine/RHI/D3D12/D3D12DescriptorHeap.h"
|
||||||
#include "XCEngine/RHI/D3D12/D3D12Fence.h"
|
#include "XCEngine/RHI/D3D12/D3D12Fence.h"
|
||||||
#include "XCEngine/RHI/D3D12/D3D12SwapChain.h"
|
#include "XCEngine/RHI/D3D12/D3D12SwapChain.h"
|
||||||
|
#include "XCEngine/RHI/D3D12/D3D12RootSignature.h"
|
||||||
#include "XCEngine/RHI/D3D12/D3D12Screenshot.h"
|
#include "XCEngine/RHI/D3D12/D3D12Screenshot.h"
|
||||||
#include "XCEngine/Debug/Logger.h"
|
#include "XCEngine/Debug/Logger.h"
|
||||||
#include "XCEngine/Debug/ConsoleLogSink.h"
|
#include "XCEngine/Debug/ConsoleLogSink.h"
|
||||||
@@ -65,6 +66,7 @@ UINT gDSVDescriptorSize = 0;
|
|||||||
// 命令相关
|
// 命令相关
|
||||||
XCEngine::RHI::D3D12CommandAllocator gCommandAllocator;
|
XCEngine::RHI::D3D12CommandAllocator gCommandAllocator;
|
||||||
XCEngine::RHI::D3D12CommandList gCommandList;
|
XCEngine::RHI::D3D12CommandList gCommandList;
|
||||||
|
XCEngine::RHI::D3D12RootSignature gRootSignature;
|
||||||
|
|
||||||
// 同步对象
|
// 同步对象
|
||||||
XCEngine::RHI::D3D12Fence gFence;
|
XCEngine::RHI::D3D12Fence gFence;
|
||||||
@@ -277,14 +279,9 @@ ID3D12RootSignature* InitRootSignature() {
|
|||||||
rootSignatureDesc.pStaticSamplers = samplerDesc;
|
rootSignatureDesc.pStaticSamplers = samplerDesc;
|
||||||
rootSignatureDesc.Flags = D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT;
|
rootSignatureDesc.Flags = D3D12_ROOT_SIGNATURE_FLAG_ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT;
|
||||||
|
|
||||||
ID3DBlob* signature;
|
gRootSignature.Initialize(gDevice.GetDevice(), rootSignatureDesc);
|
||||||
HRESULT hResult = D3D12SerializeRootSignature(&rootSignatureDesc, D3D_ROOT_SIGNATURE_VERSION_1, &signature, nullptr);
|
|
||||||
ID3D12RootSignature* d3d12RootSignature;
|
|
||||||
gDevice.GetDevice()->CreateRootSignature(
|
|
||||||
0, signature->GetBufferPointer(), signature->GetBufferSize(),
|
|
||||||
IID_PPV_ARGS(&d3d12RootSignature));
|
|
||||||
|
|
||||||
return d3d12RootSignature;
|
return gRootSignature.GetRootSignature();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
|
|||||||
Reference in New Issue
Block a user