Commit f14ed320 by Alexis Hetu Committed by Alexis Hétu

Added clear color image command

Added the command to send the clear color image command to the Image object. Bug b/118619338 Change-Id: Ic4e00fbd49e8e043df1d2e707e3c26dadf159790 Reviewed-on: https://swiftshader-review.googlesource.com/c/23653Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarChris Forbes <chrisforbes@google.com> Reviewed-by: 's avatarCorentin Wallez <cwallez@google.com>
parent eca9ca64
...@@ -220,6 +220,24 @@ private: ...@@ -220,6 +220,24 @@ private:
const VkBufferImageCopy region; const VkBufferImageCopy region;
}; };
struct ClearImage : public CommandBuffer::Command
{
ClearImage(VkImage image, const VkClearColorValue& color, const VkImageSubresourceRange& range) :
image(image), color(color), range(range)
{
}
void play(CommandBuffer::ExecutionState& executionState)
{
Cast(image)->clear(color, range);
}
private:
VkImage image;
const VkClearColorValue color;
const VkImageSubresourceRange range;
};
struct BlitImage : public CommandBuffer::Command struct BlitImage : public CommandBuffer::Command
{ {
BlitImage(VkImage srcImage, VkImage dstImage, const VkImageBlit& region, VkFilter filter) : BlitImage(VkImage srcImage, VkImage dstImage, const VkImageBlit& region, VkFilter filter) :
...@@ -597,7 +615,12 @@ void CommandBuffer::fillBuffer(VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDev ...@@ -597,7 +615,12 @@ void CommandBuffer::fillBuffer(VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDev
void CommandBuffer::clearColorImage(VkImage image, VkImageLayout imageLayout, const VkClearColorValue* pColor, void CommandBuffer::clearColorImage(VkImage image, VkImageLayout imageLayout, const VkClearColorValue* pColor,
uint32_t rangeCount, const VkImageSubresourceRange* pRanges) uint32_t rangeCount, const VkImageSubresourceRange* pRanges)
{ {
UNIMPLEMENTED(); ASSERT(state == RECORDING);
for(uint32_t i = 0; i < rangeCount; i++)
{
commands->push_back(std::make_unique<ClearImage>(image, pColor[i], pRanges[i]));
}
} }
void CommandBuffer::clearDepthStencilImage(VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue* pDepthStencil, void CommandBuffer::clearDepthStencilImage(VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue* pDepthStencil,
......
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