From 4c9c03e1a7cb66aa7e3e84dc36a1758c0af6812c Mon Sep 17 00:00:00 2001 From: ssdfasd <2156608475@qq.com> Date: Tue, 17 Mar 2026 01:38:57 +0800 Subject: [PATCH] Refactor: use engine enums for resource states and heap types --- tests/D3D12/main.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/D3D12/main.cpp b/tests/D3D12/main.cpp index 08c9bd91..78db2667 100644 --- a/tests/D3D12/main.cpp +++ b/tests/D3D12/main.cpp @@ -170,7 +170,7 @@ public: fread(mVertexData, 1, sizeof(StaticMeshComponentVertexData) * mVertexCount, pFile); mVBO.InitializeWithData(gD3D12Device.GetDevice(), inCommandList, mVertexData, sizeof(StaticMeshComponentVertexData) * mVertexCount, - D3D12_RESOURCE_STATE_VERTEX_AND_CONSTANT_BUFFER); + ToD3D12(XCEngine::RHI::ResourceStates::VertexAndConstantBuffer)); while (!feof(pFile)) { fread(&temp, 4, 1, pFile); @@ -186,7 +186,7 @@ public: fread(indexes, 1, sizeof(unsigned int) * temp, pFile); submesh->mIBO.InitializeWithData(gD3D12Device.GetDevice(), inCommandList, indexes, sizeof(unsigned int) * temp, - D3D12_RESOURCE_STATE_INDEX_BUFFER); + ToD3D12(XCEngine::RHI::ResourceStates::IndexBuffer)); mSubMeshes.insert(std::pair(name, submesh)); delete[] indexes; } @@ -504,7 +504,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine gPixelShader.CompileFromFile(L"Res/Shader/gs.hlsl", "MainPS", "ps_5_1"); ID3D12PipelineState* pso = CreatePSO(rootSignature, gVertexShader.GetD3D12Bytecode(), gPixelShader.GetD3D12Bytecode(), gGeometryShader.GetD3D12Bytecode()); - gConstantBuffer.Initialize(gD3D12Device.GetDevice(), 65536, D3D12_RESOURCE_STATE_GENERIC_READ, D3D12_HEAP_TYPE_UPLOAD); + gConstantBuffer.Initialize(gD3D12Device.GetDevice(), 65536, ToD3D12(XCEngine::RHI::ResourceStates::GenericRead), ToD3D12(XCEngine::RHI::HeapType::Upload)); DirectX::XMMATRIX projectionMatrix = DirectX::XMMatrixPerspectiveFovLH( (45.0f * 3.141592f) / 180.0f, 1280.0f / 720.0f, 0.1f, 1000.0f); DirectX::XMMATRIX viewMatrix = DirectX::XMMatrixIdentity(); @@ -533,7 +533,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine gConstantBuffer.GetResource()->Unmap(0, nullptr); } - gMaterialBuffer.Initialize(gD3D12Device.GetDevice(), 65536, D3D12_RESOURCE_STATE_GENERIC_READ, D3D12_HEAP_TYPE_UPLOAD); + gMaterialBuffer.Initialize(gD3D12Device.GetDevice(), 65536, ToD3D12(XCEngine::RHI::ResourceStates::GenericRead), ToD3D12(XCEngine::RHI::HeapType::Upload)); struct MaterialData { float r; };