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/23653
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
Reviewed-by: Corentin Wallez <cwallez@google.com>
diff --git a/src/Vulkan/VkCommandBuffer.cpp b/src/Vulkan/VkCommandBuffer.cpp
index 7b51927..0d97a7e 100644
--- a/src/Vulkan/VkCommandBuffer.cpp
+++ b/src/Vulkan/VkCommandBuffer.cpp
@@ -220,6 +220,24 @@
 	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
 {
 	BlitImage(VkImage srcImage, VkImage dstImage, const VkImageBlit& region, VkFilter filter) :
@@ -597,7 +615,12 @@
 void CommandBuffer::clearColorImage(VkImage image, VkImageLayout imageLayout, const VkClearColorValue* pColor,
 	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,