summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineD3D12
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2020-08-23 03:26:49 +0000
committerassiduous <assiduous@diligentgraphics.com>2020-08-23 03:26:49 +0000
commit2771c71fad9cc4311c287ad119d078662ef52c29 (patch)
treea0cf76cd433d6cba40b8a1478ed9d415a2517481 /Graphics/GraphicsEngineD3D12
parentD3D12 backend: improved command list version detection (diff)
downloadDiligentCore-2771c71fad9cc4311c287ad119d078662ef52c29.tar.gz
DiligentCore-2771c71fad9cc4311c287ad119d078662ef52c29.zip
Added USAGE_UNIFIED usage type (API 240066)
Diffstat (limited to 'Graphics/GraphicsEngineD3D12')
-rw-r--r--Graphics/GraphicsEngineD3D12/src/BufferD3D12Impl.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/Graphics/GraphicsEngineD3D12/src/BufferD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/BufferD3D12Impl.cpp
index a6e4a0c8..77fb9bc2 100644
--- a/Graphics/GraphicsEngineD3D12/src/BufferD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/BufferD3D12Impl.cpp
@@ -61,13 +61,17 @@ BufferD3D12Impl::BufferD3D12Impl(IReferenceCounters* pRefCounters,
)
// clang-format on
{
-#define LOG_BUFFER_ERROR_AND_THROW(...) LOG_ERROR_AND_THROW("Buffer \"", BuffDesc.Name ? BuffDesc.Name : "", "\": ", ##__VA_ARGS__)
+ ValidateBufferInitData(BuffDesc, pBuffData);
- if (m_Desc.Usage == USAGE_STATIC && (pBuffData == nullptr || pBuffData->pData == nullptr))
- LOG_BUFFER_ERROR_AND_THROW("Static buffer must be initialized with data at creation time");
+ if (m_Desc.Usage == USAGE_UNIFIED)
+ {
+ DecayUnifiedBuffer();
+ }
- if (m_Desc.Usage == USAGE_DYNAMIC && pBuffData != nullptr && pBuffData->pData != nullptr)
- LOG_BUFFER_ERROR_AND_THROW("Dynamic buffer must be initialized via Map()");
+ if (m_Desc.Usage == USAGE_STATIC)
+ VERIFY(pBuffData != nullptr && pBuffData->pData != nullptr, "Initial data must not be null for static buffers");
+ if (m_Desc.Usage == USAGE_DYNAMIC)
+ VERIFY(pBuffData == nullptr || pBuffData->pData == nullptr, "Initial data must be null for dynamic buffers");
Uint32 AlignmentMask = 1;
if (m_Desc.BindFlags & BIND_UNIFORM_BUFFER)
@@ -75,13 +79,12 @@ BufferD3D12Impl::BufferD3D12Impl(IReferenceCounters* pRefCounters,
if (m_Desc.Usage == USAGE_STAGING)
{
- if (m_Desc.CPUAccessFlags != CPU_ACCESS_WRITE && m_Desc.CPUAccessFlags != CPU_ACCESS_READ)
- LOG_BUFFER_ERROR_AND_THROW("Exactly one of the CPU_ACCESS_WRITE or CPU_ACCESS_READ flags must be specified for a cpu-accessible buffer");
+ VERIFY(m_Desc.CPUAccessFlags == CPU_ACCESS_WRITE || m_Desc.CPUAccessFlags == CPU_ACCESS_READ,
+ "Exactly one of the CPU_ACCESS_WRITE or CPU_ACCESS_READ flags must be specified for a staging buffer");
if (m_Desc.CPUAccessFlags == CPU_ACCESS_WRITE)
{
- if (pBuffData != nullptr && pBuffData->pData != nullptr)
- LOG_BUFFER_ERROR_AND_THROW("CPU-writable staging buffers must be updated via map");
+ VERIFY(pBuffData == nullptr || pBuffData->pData == nullptr, "CPU-writable staging buffers must be updated via map");
AlignmentMask = D3D12_TEXTURE_DATA_PITCH_ALIGNMENT - 1;
}