From 3531a7d892a01cff3449d371df2784b75fa9a534 Mon Sep 17 00:00:00 2001 From: Egor Yusov Date: Tue, 17 Apr 2018 20:02:38 -0700 Subject: Working on Device context Vulkan implementation: implemented setting viewports & scissor rects --- Graphics/GraphicsEngine/include/DeviceContextBase.h | 12 ++++++------ Graphics/GraphicsEngine/interface/Constants.h | 3 +++ 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'Graphics/GraphicsEngine') diff --git a/Graphics/GraphicsEngine/include/DeviceContextBase.h b/Graphics/GraphicsEngine/include/DeviceContextBase.h index a586d393..796b4989 100644 --- a/Graphics/GraphicsEngine/include/DeviceContextBase.h +++ b/Graphics/GraphicsEngine/include/DeviceContextBase.h @@ -174,12 +174,12 @@ protected: Float32 m_BlendFactors[4] = { -1, -1, -1, -1 }; /// Current viewports - Viewport m_Viewports[MaxRenderTargets]; + Viewport m_Viewports[MaxViewports]; /// Number of current viewports Uint32 m_NumViewports = 0; /// Current scissor rects - Rect m_ScissorRects[MaxRenderTargets]; + Rect m_ScissorRects[MaxViewports]; /// Number of current scissor rects Uint32 m_NumScissorRects = 0; @@ -398,8 +398,8 @@ inline void DeviceContextBase :: SetViewports( Uint32 NumViewport GetRenderTargetSize( RTWidth, RTHeight ); } - VERIFY(NumViewports < MaxRenderTargets, "Num viewports (", NumViewports, ") exceeds the limit (", MaxRenderTargets, ")"); - m_NumViewports = std::min(MaxRenderTargets, NumViewports); + VERIFY(NumViewports < MaxViewports, "Number of viewports (", NumViewports, ") exceeds the limit (", MaxViewports, ")"); + m_NumViewports = std::min(MaxViewports, NumViewports); Viewport DefaultVP( 0, 0, static_cast(RTWidth), static_cast(RTHeight) ); // If no viewports are specified, use default viewport @@ -436,8 +436,8 @@ inline void DeviceContextBase :: SetScissorRects( Uint32 NumRects GetRenderTargetSize( RTWidth, RTHeight ); } - VERIFY(NumRects < MaxRenderTargets, "Num scissor rects (", NumRects, ") exceeds the limit (", MaxRenderTargets, ")"); - m_NumScissorRects = std::min(MaxRenderTargets, NumRects); + VERIFY(NumRects < MaxViewports, "Number of scissor rects (", NumRects, ") exceeds the limit (", MaxViewports, ")"); + m_NumScissorRects = std::min(MaxViewports, NumRects); for( Uint32 sr = 0; sr < m_NumScissorRects; ++sr ) { diff --git a/Graphics/GraphicsEngine/interface/Constants.h b/Graphics/GraphicsEngine/interface/Constants.h index a04140d5..99adf33b 100644 --- a/Graphics/GraphicsEngine/interface/Constants.h +++ b/Graphics/GraphicsEngine/interface/Constants.h @@ -36,4 +36,7 @@ namespace Diligent /// Maximum number of simultaneous render targets. static constexpr Uint32 MaxRenderTargets = 8; + + /// Maximum number of viewports. + static constexpr Uint32 MaxViewports = 16; } -- cgit v1.2.3