From 715e79f05c87c9f39758628fdd8b74b3ef731bad Mon Sep 17 00:00:00 2001 From: assiduous Date: Fri, 6 Nov 2020 20:43:53 -0800 Subject: Few more minor updates to parameter validation in device context --- .../GraphicsEngine/include/DeviceContextBase.hpp | 23 +++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'Graphics/GraphicsEngine') diff --git a/Graphics/GraphicsEngine/include/DeviceContextBase.hpp b/Graphics/GraphicsEngine/include/DeviceContextBase.hpp index 1df4682d..3edb27ca 100644 --- a/Graphics/GraphicsEngine/include/DeviceContextBase.hpp +++ b/Graphics/GraphicsEngine/include/DeviceContextBase.hpp @@ -1198,6 +1198,7 @@ inline bool DeviceContextBase::BeginQuery(I return false; } +#ifdef DILIGENT_DEVELOPMENT if (m_bIsDeferred) { LOG_ERROR_MESSAGE("IDeviceContext::BeginQuery: Deferred contexts do not support queries"); @@ -1209,6 +1210,7 @@ inline bool DeviceContextBase::BeginQuery(I LOG_ERROR_MESSAGE("BeginQuery() is disabled for timestamp queries. Call EndQuery() to set the timestamp."); return false; } +#endif if (!ValidatedCast(pQuery)->OnBeginQuery(this)) return false; @@ -1225,11 +1227,13 @@ inline bool DeviceContextBase::EndQuery(IQu return false; } +#ifdef DILIGENT_DEVELOPMENT if (m_bIsDeferred) { LOG_ERROR_MESSAGE("IDeviceContext::EndQuery: Deferred contexts do not support queries"); return false; } +#endif if (!ValidatedCast(pQuery)->OnEndQuery(this)) return false; @@ -1442,6 +1446,7 @@ void DeviceContextBase::ResolveTextureSubre template bool DeviceContextBase::BuildBLAS(const BuildBLASAttribs& Attribs, int) const { +#ifdef DILIGENT_DEVELOPMENT if (m_pDevice->GetDeviceCaps().Features.RayTracing != DEVICE_FEATURE_STATE_ENABLED) { LOG_ERROR_MESSAGE("IDeviceContext::BuildBLAS: ray tracing is not supported by this device"); @@ -1454,12 +1459,17 @@ bool DeviceContextBase::BuildBLAS(const Bui return false; } - return VerifyBuildBLASAttribs(Attribs); + if (!VerifyBuildBLASAttribs(Attribs)) + return false; +#endif + + return true; } template bool DeviceContextBase::BuildTLAS(const BuildTLASAttribs& Attribs, int) const { +#ifdef DILIGENT_DEVELOPMENT if (m_pDevice->GetDeviceCaps().Features.RayTracing != DEVICE_FEATURE_STATE_ENABLED) { LOG_ERROR_MESSAGE("IDeviceContext::BuildTLAS: ray tracing is not supported by this device"); @@ -1472,7 +1482,6 @@ bool DeviceContextBase::BuildTLAS(const Bui return false; } -#ifdef DILIGENT_DEVELOPMENT if (!VerifyBuildTLASAttribs(Attribs)) return false; @@ -1492,6 +1501,7 @@ bool DeviceContextBase::BuildTLAS(const Bui template bool DeviceContextBase::CopyBLAS(const CopyBLASAttribs& Attribs, int) const { +#ifdef DILIGENT_DEVELOPMENT if (m_pDevice->GetDeviceCaps().Features.RayTracing != DEVICE_FEATURE_STATE_ENABLED) { LOG_ERROR_MESSAGE("IDeviceContext::CopyBLAS: ray tracing is not supported by this device"); @@ -1504,7 +1514,6 @@ bool DeviceContextBase::CopyBLAS(const Copy return false; } -#ifdef DILIGENT_DEVELOPMENT if (!VerifyCopyBLASAttribs(Attribs)) return false; @@ -1521,6 +1530,7 @@ bool DeviceContextBase::CopyBLAS(const Copy template bool DeviceContextBase::CopyTLAS(const CopyTLASAttribs& Attribs, int) const { +#ifdef DILIGENT_DEVELOPMENT if (m_pDevice->GetDeviceCaps().Features.RayTracing != DEVICE_FEATURE_STATE_ENABLED) { LOG_ERROR_MESSAGE("IDeviceContext::CopyTLAS: ray tracing is not supported by this device"); @@ -1533,7 +1543,6 @@ bool DeviceContextBase::CopyTLAS(const Copy return false; } -#ifdef DILIGENT_DEVELOPMENT if (!VerifyCopyTLASAttribs(Attribs)) return false; @@ -1550,6 +1559,7 @@ bool DeviceContextBase::CopyTLAS(const Copy template bool DeviceContextBase::WriteBLASCompactedSize(const WriteBLASCompactedSizeAttribs& Attribs, int) const { +#ifdef DILIGENT_DEVELOPMENT if (m_pDevice->GetDeviceCaps().Features.RayTracing != DEVICE_FEATURE_STATE_ENABLED) { LOG_ERROR_MESSAGE("IDeviceContext::WriteBLASCompactedSize: ray tracing is not supported by this device"); @@ -1562,7 +1572,6 @@ bool DeviceContextBase::WriteBLASCompactedS return false; } -#ifdef DILIGENT_DEVELOPMENT if (!VerifyWriteBLASCompactedSizeAttribs(m_pDevice, Attribs)) return false; #endif @@ -1573,6 +1582,7 @@ bool DeviceContextBase::WriteBLASCompactedS template bool DeviceContextBase::WriteTLASCompactedSize(const WriteTLASCompactedSizeAttribs& Attribs, int) const { +#ifdef DILIGENT_DEVELOPMENT if (m_pDevice->GetDeviceCaps().Features.RayTracing != DEVICE_FEATURE_STATE_ENABLED) { LOG_ERROR_MESSAGE("IDeviceContext::WriteTLASCompactedSize: ray tracing is not supported by this device"); @@ -1585,7 +1595,6 @@ bool DeviceContextBase::WriteTLASCompactedS return false; } -#ifdef DILIGENT_DEVELOPMENT if (!VerifyWriteTLASCompactedSizeAttribs(m_pDevice, Attribs)) return false; #endif @@ -1596,6 +1605,7 @@ bool DeviceContextBase::WriteTLASCompactedS template bool DeviceContextBase::TraceRays(const TraceRaysAttribs& Attribs, int) const { +#ifdef DILIGENT_DEVELOPMENT if (m_pDevice->GetDeviceCaps().Features.RayTracing != DEVICE_FEATURE_STATE_ENABLED) { LOG_ERROR_MESSAGE("IDeviceContext::TraceRays: ray tracing is not supported by this device"); @@ -1614,7 +1624,6 @@ bool DeviceContextBase::TraceRays(const Tra return false; } -#ifdef DILIGENT_DEVELOPMENT if (!VerifyTraceRaysAttribs(Attribs)) return false; #endif -- cgit v1.2.3