Refactor: use engine enums for resource states and heap types

This commit is contained in:
2026-03-17 01:38:57 +08:00
parent 393a0c67f1
commit 4c9c03e1a7

View File

@@ -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<std::string, SubMesh*>(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;
};