Commit dd4b6445 by Shahbaz Youssefi Committed by Commit Bot

Vulkan: Boilerplace for vkCmdSetScissor

Bug: angleproject:4836 Change-Id: I4fa5355fc3e7fcf3ecd091d299c5c0c8d3a74732 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2463984 Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: 's avatarCharlie Lao <cclao@google.com> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 61fa0878
...@@ -116,6 +116,8 @@ const char *GetCommandString(CommandID id) ...@@ -116,6 +116,8 @@ const char *GetCommandString(CommandID id)
return "ResolveImage"; return "ResolveImage";
case CommandID::SetEvent: case CommandID::SetEvent:
return "SetEvent"; return "SetEvent";
case CommandID::SetScissor:
return "SetScissor";
case CommandID::WaitEvents: case CommandID::WaitEvents:
return "WaitEvents"; return "WaitEvents";
case CommandID::WriteTimestamp: case CommandID::WriteTimestamp:
...@@ -549,6 +551,12 @@ void SecondaryCommandBuffer::executeCommands(VkCommandBuffer cmdBuffer) ...@@ -549,6 +551,12 @@ void SecondaryCommandBuffer::executeCommands(VkCommandBuffer cmdBuffer)
vkCmdSetEvent(cmdBuffer, params->event, params->stageMask); vkCmdSetEvent(cmdBuffer, params->event, params->stageMask);
break; break;
} }
case CommandID::SetScissor:
{
const SetScissorParams *params = getParamPtr<SetScissorParams>(currentCommand);
vkCmdSetScissor(cmdBuffer, 0, 1, &params->scissor);
break;
}
case CommandID::WaitEvents: case CommandID::WaitEvents:
{ {
const WaitEventsParams *params = getParamPtr<WaitEventsParams>(currentCommand); const WaitEventsParams *params = getParamPtr<WaitEventsParams>(currentCommand);
......
...@@ -78,6 +78,7 @@ enum class CommandID : uint16_t ...@@ -78,6 +78,7 @@ enum class CommandID : uint16_t
ResetQueryPool, ResetQueryPool,
ResolveImage, ResolveImage,
SetEvent, SetEvent,
SetScissor,
WaitEvents, WaitEvents,
WriteTimestamp, WriteTimestamp,
}; };
...@@ -416,6 +417,12 @@ struct SetEventParams ...@@ -416,6 +417,12 @@ struct SetEventParams
}; };
VERIFY_4_BYTE_ALIGNMENT(SetEventParams) VERIFY_4_BYTE_ALIGNMENT(SetEventParams)
struct SetScissorParams
{
VkRect2D scissor;
};
VERIFY_4_BYTE_ALIGNMENT(SetScissorParams)
struct WaitEventsParams struct WaitEventsParams
{ {
uint32_t eventCount; uint32_t eventCount;
...@@ -641,6 +648,8 @@ class SecondaryCommandBuffer final : angle::NonCopyable ...@@ -641,6 +648,8 @@ class SecondaryCommandBuffer final : angle::NonCopyable
void setEvent(VkEvent event, VkPipelineStageFlags stageMask); void setEvent(VkEvent event, VkPipelineStageFlags stageMask);
void setScissor(uint32_t firstScissor, uint32_t scissorCount, const VkRect2D *scissors);
void waitEvents(uint32_t eventCount, void waitEvents(uint32_t eventCount,
const VkEvent *events, const VkEvent *events,
VkPipelineStageFlags srcStageMask, VkPipelineStageFlags srcStageMask,
...@@ -1389,6 +1398,17 @@ ANGLE_INLINE void SecondaryCommandBuffer::setEvent(VkEvent event, VkPipelineStag ...@@ -1389,6 +1398,17 @@ ANGLE_INLINE void SecondaryCommandBuffer::setEvent(VkEvent event, VkPipelineStag
paramStruct->stageMask = stageMask; paramStruct->stageMask = stageMask;
} }
ANGLE_INLINE void SecondaryCommandBuffer::setScissor(uint32_t firstScissor,
uint32_t scissorCount,
const VkRect2D *scissors)
{
ASSERT(firstScissor == 0);
ASSERT(scissorCount == 1);
ASSERT(scissors != nullptr);
SetScissorParams *paramStruct = initCommand<SetScissorParams>(CommandID::SetScissor);
paramStruct->scissor = scissors[0];
}
ANGLE_INLINE void SecondaryCommandBuffer::waitEvents( ANGLE_INLINE void SecondaryCommandBuffer::waitEvents(
uint32_t eventCount, uint32_t eventCount,
const VkEvent *events, const VkEvent *events,
......
...@@ -343,6 +343,7 @@ class CommandBuffer : public WrappedObject<CommandBuffer, VkCommandBuffer> ...@@ -343,6 +343,7 @@ class CommandBuffer : public WrappedObject<CommandBuffer, VkCommandBuffer>
const void *data); const void *data);
void setEvent(VkEvent event, VkPipelineStageFlags stageMask); void setEvent(VkEvent event, VkPipelineStageFlags stageMask);
void setScissor(uint32_t firstScissor, uint32_t scissorCount, const VkRect2D *scissors);
VkResult reset(); VkResult reset();
void resetEvent(VkEvent event, VkPipelineStageFlags stageMask); void resetEvent(VkEvent event, VkPipelineStageFlags stageMask);
void resetQueryPool(const QueryPool &queryPool, uint32_t firstQuery, uint32_t queryCount); void resetQueryPool(const QueryPool &queryPool, uint32_t firstQuery, uint32_t queryCount);
...@@ -968,6 +969,14 @@ ANGLE_INLINE void CommandBuffer::setEvent(VkEvent event, VkPipelineStageFlags st ...@@ -968,6 +969,14 @@ ANGLE_INLINE void CommandBuffer::setEvent(VkEvent event, VkPipelineStageFlags st
vkCmdSetEvent(mHandle, event, stageMask); vkCmdSetEvent(mHandle, event, stageMask);
} }
ANGLE_INLINE void CommandBuffer::setScissor(uint32_t firstScissor,
uint32_t scissorCount,
const VkRect2D *scissors)
{
ASSERT(valid() && scissors != nullptr);
vkCmdSetScissor(mHandle, firstScissor, scissorCount, scissors);
}
ANGLE_INLINE void CommandBuffer::resetEvent(VkEvent event, VkPipelineStageFlags stageMask) ANGLE_INLINE void CommandBuffer::resetEvent(VkEvent event, VkPipelineStageFlags stageMask)
{ {
ASSERT(valid() && event != VK_NULL_HANDLE); ASSERT(valid() && event != VK_NULL_HANDLE);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment