diff --git a/examples/common/entry/entry.cpp b/examples/common/entry/entry.cpp index a7a4fc65..89c48a8d 100644 --- a/examples/common/entry/entry.cpp +++ b/examples/common/entry/entry.cpp @@ -260,6 +260,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); || setOrToggle(s_reset, "flush", BGFX_RESET_FLUSH_AFTER_RENDER, 1, _argc, _argv) || setOrToggle(s_reset, "flip", BGFX_RESET_FLIP_AFTER_RENDER, 1, _argc, _argv) || setOrToggle(s_reset, "hidpi", BGFX_RESET_HIDPI, 1, _argc, _argv) + || setOrToggle(s_reset, "depthclamp", BGFX_RESET_DEPTH_CLAMP, 1, _argc, _argv) ) { return 0; diff --git a/src/renderer_d3d11.cpp b/src/renderer_d3d11.cpp index 912f68be..2618bb15 100644 --- a/src/renderer_d3d11.cpp +++ b/src/renderer_d3d11.cpp @@ -2182,11 +2182,10 @@ BX_PRAGMA_DIAGNOSTIC_POP(); m_samplerStateCache.invalidate(); } - bool depthClamp = false; - if (!!(_resolution.m_flags & BGFX_RESET_DEPTH_CLAMP) ) - { - depthClamp = m_featureLevel <= D3D_FEATURE_LEVEL_9_3; // disabling depth clamp is only supported on 10_0+ - } + bool depthClamp = true + && !!(_resolution.m_flags & BGFX_RESET_DEPTH_CLAMP) + && m_featureLevel > D3D_FEATURE_LEVEL_9_3 // disabling depth clamp is only supported on 10_0+ + ; if (m_depthClamp != depthClamp) { @@ -2673,7 +2672,7 @@ BX_PRAGMA_DIAGNOSTIC_POP(); desc.DepthBias = 0; desc.DepthBiasClamp = 0.0f; desc.SlopeScaledDepthBias = 0.0f; - desc.DepthClipEnable = m_depthClamp; + desc.DepthClipEnable = !m_depthClamp; desc.ScissorEnable = _scissor; desc.MultisampleEnable = !!(_state&BGFX_STATE_MSAA); desc.AntialiasedLineEnable = false; diff --git a/src/renderer_d3d12.cpp b/src/renderer_d3d12.cpp index 7fc33159..4249f4c7 100644 --- a/src/renderer_d3d12.cpp +++ b/src/renderer_d3d12.cpp @@ -2016,7 +2016,7 @@ data.NumQualityLevels = 0; desc.DepthBias = 0; desc.DepthBiasClamp = 0.0f; desc.SlopeScaledDepthBias = 0.0f; - desc.DepthClipEnable = m_depthClamp; + desc.DepthClipEnable = !m_depthClamp; desc.MultisampleEnable = !!(_state&BGFX_STATE_MSAA); desc.AntialiasedLineEnable = false; desc.ForcedSampleCount = 0;