Skip to content

Commit

Permalink
Traktor: Address PR review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jayrulez committed Nov 18, 2024
1 parent 38d1b65 commit 5df8a16
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 24 deletions.
1 change: 1 addition & 0 deletions code/Render/Context/RenderBlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ class T_DLLCLASS SetScissorRenderBlock : public RenderBlock
{
public:
Rectangle scissor;

virtual void render(IRenderView* renderView) const override final;
};

Expand Down
23 changes: 8 additions & 15 deletions code/Render/Types.h
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
48 changes: 39 additions & 9 deletions code/Render/Vulkan/RenderViewVk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint32_t>(scissor.width), static_cast<uint32_t>(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);
}

Expand Down Expand Up @@ -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++;
Expand Down Expand Up @@ -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++;
Expand Down

0 comments on commit 5df8a16

Please sign in to comment.