Add ResourceStates::GenericRead and HeapType enums

This commit is contained in:
2026-03-17 01:37:38 +08:00
parent ac9a62082e
commit 393a0c67f1
2 changed files with 19 additions and 1 deletions

View File

@@ -172,10 +172,20 @@ inline D3D12_RESOURCE_STATES ToD3D12(ResourceStates state) {
case ResourceStates::CopySrc: return D3D12_RESOURCE_STATE_COPY_SOURCE; case ResourceStates::CopySrc: return D3D12_RESOURCE_STATE_COPY_SOURCE;
case ResourceStates::CopyDst: return D3D12_RESOURCE_STATE_COPY_DEST; case ResourceStates::CopyDst: return D3D12_RESOURCE_STATE_COPY_DEST;
case ResourceStates::Present: return D3D12_RESOURCE_STATE_PRESENT; case ResourceStates::Present: return D3D12_RESOURCE_STATE_PRESENT;
case ResourceStates::GenericRead: return D3D12_RESOURCE_STATE_GENERIC_READ;
} }
return D3D12_RESOURCE_STATE_COMMON; return D3D12_RESOURCE_STATE_COMMON;
} }
inline D3D12_HEAP_TYPE ToD3D12(HeapType type) {
switch (type) {
case HeapType::Default: return D3D12_HEAP_TYPE_DEFAULT;
case HeapType::Upload: return D3D12_HEAP_TYPE_UPLOAD;
case HeapType::Readback: return D3D12_HEAP_TYPE_READBACK;
}
return D3D12_HEAP_TYPE_DEFAULT;
}
inline D3D12_PRIMITIVE_TOPOLOGY_TYPE ToD3D12(PrimitiveTopology topology) { inline D3D12_PRIMITIVE_TOPOLOGY_TYPE ToD3D12(PrimitiveTopology topology) {
switch (topology) { switch (topology) {
case PrimitiveTopology::PointList: return D3D12_PRIMITIVE_TOPOLOGY_TYPE_POINT; case PrimitiveTopology::PointList: return D3D12_PRIMITIVE_TOPOLOGY_TYPE_POINT;

View File

@@ -280,7 +280,15 @@ enum class ResourceStates : uint32_t {
PixelShaderResource, PixelShaderResource,
CopySrc, CopySrc,
CopyDst, CopyDst,
Present Present,
GenericRead
};
enum class HeapType : uint8_t {
Default,
Upload,
Readback,
Custom
}; };
} // namespace RHI } // namespace RHI