Skip to content

Commit 201a3a0

Browse files
MikhailGorobetsTheMostDiligent
authored andcommitted
Rework super-resolution validation
1 parent f16b0cc commit 201a3a0

File tree

3 files changed

+89
-81
lines changed

3 files changed

+89
-81
lines changed

Graphics/SuperResolution/include/SuperResolutionBase.hpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ namespace Diligent
3939

4040
#define LOG_SUPER_RESOLUTION_ERROR_AND_THROW(Name, ...) LOG_ERROR_AND_THROW("Super resolution upscaler '", ((Name) != nullptr ? (Name) : ""), "': ", ##__VA_ARGS__)
4141

42+
#define DEV_CHECK_SUPER_RESOLUTION(Name, Expr, ...) DEV_CHECK_ERR(Expr, "Super resolution upscaler '", ((Name) != nullptr ? (Name) : ""), "': ", ##__VA_ARGS__)
43+
4244
#define VERIFY_SUPER_RESOLUTION(Name, Expr, ...) \
4345
do \
4446
{ \
@@ -48,22 +50,24 @@ namespace Diligent
4850
} \
4951
} while (false)
5052

53+
54+
5155
/// Validates super resolution description and throws an exception in case of an error.
5256
void ValidateSuperResolutionDesc(const SuperResolutionDesc& Desc) noexcept(false);
5357

5458
/// Validates super resolution description for temporal upscaling and throws an exception in case of an error.
5559
void ValidateTemporalSuperResolutionDesc(const SuperResolutionDesc& Desc) noexcept(false);
5660

57-
/// Validates super resolution source settings attributes and throws an exception in case of an error.
58-
void ValidateSourceSettingsAttribs(const SuperResolutionSourceSettingsAttribs& Attribs) noexcept(false);
61+
/// Validates super resolution source settings attributes using DEV checks.
62+
void ValidateSourceSettingsAttribs(const SuperResolutionSourceSettingsAttribs& Attribs);
5963

60-
/// Validates execute super resolution attributes and throws an exception in case of an error.
64+
/// Validates execute super resolution attributes using DEV checks.
6165
void ValidateExecuteSuperResolutionAttribs(const SuperResolutionDesc& Desc,
62-
const ExecuteSuperResolutionAttribs& Attribs) noexcept(false);
66+
const ExecuteSuperResolutionAttribs& Attribs);
6367

64-
/// Validates execute super resolution attributes for temporal upscaling and throws an exception in case of an error.
68+
/// Validates execute super resolution attributes for temporal upscaling using DEV checks.
6569
void ValidateTemporalExecuteSuperResolutionAttribs(const SuperResolutionDesc& Desc,
66-
const ExecuteSuperResolutionAttribs& Attribs) noexcept(false);
70+
const ExecuteSuperResolutionAttribs& Attribs);
6771

6872
class SuperResolutionBase : public ObjectBase<ISuperResolution>
6973
{

Graphics/SuperResolution/src/DSRProviderD3D12.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,10 @@ SuperResolutionD3D12_DSR::~SuperResolutionD3D12_DSR() = default;
170170
void DILIGENT_CALL_TYPE SuperResolutionD3D12_DSR::Execute(const ExecuteSuperResolutionAttribs& Attribs)
171171
{
172172
ValidateTemporalExecuteSuperResolutionAttribs(m_Desc, Attribs);
173-
VERIFY_SUPER_RESOLUTION(m_Desc.Name, Attribs.CameraNear > 0, "CameraNear must be greater than zero for temporal upscaling");
174-
VERIFY_SUPER_RESOLUTION(m_Desc.Name, Attribs.CameraFar > 0, "CameraFar must be greater than zero for temporal upscaling.");
175-
VERIFY_SUPER_RESOLUTION(m_Desc.Name, Attribs.CameraFovAngleVert > 0, "CameraFovAngleVert must be greater than zero for temporal upscaling.");
176-
VERIFY_SUPER_RESOLUTION(m_Desc.Name, Attribs.TimeDeltaInSeconds >= 0, "TimeDeltaInSeconds must be non-negative.");
173+
DEV_CHECK_SUPER_RESOLUTION(m_Desc.Name, Attribs.CameraNear > 0, "CameraNear must be greater than zero for temporal upscaling");
174+
DEV_CHECK_SUPER_RESOLUTION(m_Desc.Name, Attribs.CameraFar > 0, "CameraFar must be greater than zero for temporal upscaling.");
175+
DEV_CHECK_SUPER_RESOLUTION(m_Desc.Name, Attribs.CameraFovAngleVert > 0, "CameraFovAngleVert must be greater than zero for temporal upscaling.");
176+
DEV_CHECK_SUPER_RESOLUTION(m_Desc.Name, Attribs.TimeDeltaInSeconds >= 0, "TimeDeltaInSeconds must be non-negative.");
177177

178178
DeviceContextD3D12Impl* pCtx = ClassPtrCast<DeviceContextD3D12Impl>(Attribs.pContext);
179179

0 commit comments

Comments
 (0)