diff --git a/code/Render/Context/RenderBlock.h b/code/Render/Context/RenderBlock.h index d0c08e42b6..35fe0304f9 100644 --- a/code/Render/Context/RenderBlock.h +++ b/code/Render/Context/RenderBlock.h @@ -251,6 +251,7 @@ class T_DLLCLASS SetScissorRenderBlock : public RenderBlock { public: Rectangle scissor; + virtual void render(IRenderView* renderView) const override final; }; diff --git a/code/Render/Types.h b/code/Render/Types.h index 485bda5b0b..db0f4acb5e 100644 --- a/code/Render/Types.h +++ b/code/Render/Types.h @@ -435,27 +435,20 @@ struct Rectangle int32_t top = 0; int32_t width = 0; int32_t height = 0; + Rectangle() = default; + Rectangle(int32_t l, int32_t t, int32_t w, int32_t h) - : left(l) - , top(t) - , width(w) - , height(h) + : left(l) + , top(t) + , width(w) + , height(h) { } - bool operator==(const Rectangle& other) const - { - return left == other.left && - top == other.top && - width == other.width && - height == other.height; - } + bool operator==(const Rectangle& other) const = default; - bool operator!=(const Rectangle& other) const - { - return !(*this == other); - } + bool operator!=(const Rectangle& other) const = default; }; /*! Display mode structure. */ diff --git a/code/Render/Vulkan/RenderViewVk.cpp b/code/Render/Vulkan/RenderViewVk.cpp index 9b92768970..9f78b10d99 100644 --- a/code/Render/Vulkan/RenderViewVk.cpp +++ b/code/Render/Vulkan/RenderViewVk.cpp @@ -533,9 +533,19 @@ void RenderViewVk::setScissor(const Rectangle& scissor) T_ASSERT(scissorRect.height >= 0); const auto& frame = m_frames[m_currentImageIndex]; - VkRect2D vkScissor = {}; - vkScissor.offset = VkOffset2D { scissor.left, scissor.top }; - vkScissor.extent = VkExtent2D { static_cast(scissor.width), static_cast(scissor.height) }; + VkRect2D vkScissor = + { + .offset = VkOffset2D + { + .x = scissor.left, + .y = scissor.top + }, + .extent = VkExtent2D + { + .width = (uint32_t)scissor.width, + .height = (uint32_t)scissor.height + } + }; vkCmdSetScissor(*frame.graphicsCommandBuffer, 0, 1, &vkScissor); } @@ -802,9 +812,19 @@ bool RenderViewVk::beginPass(IRenderTargetSet* renderTargetSet, const Clear* cle vkCmdSetViewport(*frame.graphicsCommandBuffer, 0, 1, &vp); // Set scissor - VkRect2D vkScissor = {}; - vkScissor.offset = VkOffset2D{ 0, 0 }; - vkScissor.extent = VkExtent2D{ (uint32_t)m_targetSet->getWidth(), (uint32_t)m_targetSet->getHeight() }; + VkRect2D vkScissor = + { + .offset = VkOffset2D + { + .x = 0, + .y = 0 + }, + .extent = VkExtent2D + { + .width = (uint32_t)m_targetSet->getWidth(), + .height = (uint32_t)m_targetSet->getHeight() + } + }; vkCmdSetScissor(*frame.graphicsCommandBuffer, 0, 1, &vkScissor); m_passCount++; @@ -920,9 +940,19 @@ bool RenderViewVk::beginPass(IRenderTargetSet* renderTargetSet, int32_t renderTa vkCmdSetViewport(*frame.graphicsCommandBuffer, 0, 1, &vp); // Set scissor - VkRect2D vkScissor = {}; - vkScissor.offset = VkOffset2D{ 0, 0 }; - vkScissor.extent = VkExtent2D{ (uint32_t)m_targetSet->getWidth(), (uint32_t)m_targetSet->getHeight() }; + VkRect2D vkScissor = + { + .offset = VkOffset2D + { + .x = 0, + .y = 0 + }, + .extent = VkExtent2D + { + .width = (uint32_t)m_targetSet->getWidth(), + .height = (uint32_t)m_targetSet->getHeight() + } + }; vkCmdSetScissor(*frame.graphicsCommandBuffer, 0, 1, &vkScissor); m_passCount++;