mirror of
https://github.com/GPUOpen-LibrariesAndSDKs/D3D12MemoryAllocator.git
synced 2024-11-24 04:50:12 +00:00
Minor improvement: Additional protection with asserts in Allocation::PackedData setters.
This commit is contained in:
parent
38f53e8e4f
commit
33a596f18f
@ -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)
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user