diff --git a/src/D3D12MemAlloc.cpp b/src/D3D12MemAlloc.cpp index f70ddf7..73da744 100644 --- a/src/D3D12MemAlloc.cpp +++ b/src/D3D12MemAlloc.cpp @@ -4514,6 +4514,34 @@ void AllocatorPimpl::WriteBudgetToJson(JsonWriter& json, const Budget& budget) //////////////////////////////////////////////////////////////////////////////// // Public class Allocation implementation +void Allocation::PackedData::SetType(Type type) +{ + const uint32_t u = (UINT)type; + D3D12MA_ASSERT(u < (1u << 2)); + m_Type = u; +} + +void Allocation::PackedData::SetResourceDimension(D3D12_RESOURCE_DIMENSION resourceDimension) +{ + const uint32_t u = (UINT)resourceDimension; + D3D12MA_ASSERT(u < (1u << 3)); + m_ResourceDimension = u; +} + +void Allocation::PackedData::SetResourceFlags(D3D12_RESOURCE_FLAGS resourceFlags) +{ + const uint32_t u = (UINT)resourceFlags; + D3D12MA_ASSERT(u < (1u << 7)); + m_ResourceFlags = u; +} + +void Allocation::PackedData::SetTextureLayout(D3D12_TEXTURE_LAYOUT textureLayout) +{ + const uint32_t u = (UINT)textureLayout; + D3D12MA_ASSERT(u < (1u << 2)); + m_TextureLayout = u; +} + void Allocation::Release() { if(this == NULL) diff --git a/src/D3D12MemAlloc.h b/src/D3D12MemAlloc.h index 841a2d0..4e70df2 100644 --- a/src/D3D12MemAlloc.h +++ b/src/D3D12MemAlloc.h @@ -561,10 +561,10 @@ private: D3D12_RESOURCE_FLAGS GetResourceFlags() const { return (D3D12_RESOURCE_FLAGS)m_ResourceFlags; } D3D12_TEXTURE_LAYOUT GetTextureLayout() const { return (D3D12_TEXTURE_LAYOUT)m_TextureLayout; } - void SetType(Type type) { m_Type = (UINT)type; } - void SetResourceDimension(D3D12_RESOURCE_DIMENSION resourceDimension) { m_ResourceDimension = (UINT)resourceDimension; } - void SetResourceFlags(D3D12_RESOURCE_FLAGS resourceFlags) { m_ResourceFlags = (UINT)resourceFlags; } - void SetTextureLayout(D3D12_TEXTURE_LAYOUT textureLayout) { m_TextureLayout = (UINT)textureLayout; } + void SetType(Type type); + void SetResourceDimension(D3D12_RESOURCE_DIMENSION resourceDimension); + void SetResourceFlags(D3D12_RESOURCE_FLAGS resourceFlags); + void SetTextureLayout(D3D12_TEXTURE_LAYOUT textureLayout); private: UINT m_Type : 2; // enum Type