summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngine
diff options
context:
space:
mode:
authorEgor Yusov <egor.yusov@gmail.com>2018-04-18 03:02:38 +0000
committerEgor Yusov <egor.yusov@gmail.com>2018-04-18 03:02:38 +0000
commit3531a7d892a01cff3449d371df2784b75fa9a534 (patch)
treee696e6c2ca892bd53112e65ab386e00c948deecb /Graphics/GraphicsEngine
parentAdded template version of RawPtr function to allow more convenient type conve... (diff)
downloadDiligentCore-3531a7d892a01cff3449d371df2784b75fa9a534.tar.gz
DiligentCore-3531a7d892a01cff3449d371df2784b75fa9a534.zip
Working on Device context Vulkan implementation: implemented setting viewports & scissor rects
Diffstat (limited to 'Graphics/GraphicsEngine')
-rw-r--r--Graphics/GraphicsEngine/include/DeviceContextBase.h12
-rw-r--r--Graphics/GraphicsEngine/interface/Constants.h3
2 files changed, 9 insertions, 6 deletions
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<BaseInterface> :: 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<float>(RTWidth), static_cast<float>(RTHeight) );
// If no viewports are specified, use default viewport
@@ -436,8 +436,8 @@ inline void DeviceContextBase<BaseInterface> :: 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;
}