Implemented depth and stencil clear command

Added the ClearDepthStencilImage command and made some minor adjustments
to Image clear functions to make the depth and stencil clears work.

Passes all test in:
api.image_clearing.dedicated_allocation.clear_depth_stencil_image.*

Bug b/119620767

Change-Id: If4cfe6aa97b955c9bc7881bba89ab725897c36f9
Reviewed-on: https://swiftshader-review.googlesource.com/c/23728
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Chris Forbes <chrisforbes@google.com>
diff --git a/src/Vulkan/VkCommandBuffer.cpp b/src/Vulkan/VkCommandBuffer.cpp
index 0d97a7e..57f9538 100644
--- a/src/Vulkan/VkCommandBuffer.cpp
+++ b/src/Vulkan/VkCommandBuffer.cpp
@@ -220,9 +220,9 @@
 	const VkBufferImageCopy region;
 };
 
-struct ClearImage : public CommandBuffer::Command
+struct ClearColorImage : public CommandBuffer::Command
 {
-	ClearImage(VkImage image, const VkClearColorValue& color, const VkImageSubresourceRange& range) :
+	ClearColorImage(VkImage image, const VkClearColorValue& color, const VkImageSubresourceRange& range) :
 		image(image), color(color), range(range)
 	{
 	}
@@ -238,6 +238,24 @@
 	const VkImageSubresourceRange range;
 };
 
+struct ClearDepthStencilImage : public CommandBuffer::Command
+{
+	ClearDepthStencilImage(VkImage image, const VkClearDepthStencilValue& depthStencil, const VkImageSubresourceRange& range) :
+		image(image), depthStencil(depthStencil), range(range)
+	{
+	}
+
+	void play(CommandBuffer::ExecutionState& executionState)
+	{
+		Cast(image)->clear(depthStencil, range);
+	}
+
+private:
+	VkImage image;
+	const VkClearDepthStencilValue depthStencil;
+	const VkImageSubresourceRange range;
+};
+
 struct BlitImage : public CommandBuffer::Command
 {
 	BlitImage(VkImage srcImage, VkImage dstImage, const VkImageBlit& region, VkFilter filter) :
@@ -619,14 +637,19 @@
 
 	for(uint32_t i = 0; i < rangeCount; i++)
 	{
-		commands->push_back(std::make_unique<ClearImage>(image, pColor[i], pRanges[i]));
+		commands->push_back(std::make_unique<ClearColorImage>(image, pColor[i], pRanges[i]));
 	}
 }
 
 void CommandBuffer::clearDepthStencilImage(VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue* pDepthStencil,
 	uint32_t rangeCount, const VkImageSubresourceRange* pRanges)
 {
-	UNIMPLEMENTED();
+	ASSERT(state == RECORDING);
+
+	for(uint32_t i = 0; i < rangeCount; i++)
+	{
+		commands->push_back(std::make_unique<ClearDepthStencilImage>(image, pDepthStencil[i], pRanges[i]));
+	}
 }
 
 void CommandBuffer::clearAttachments(uint32_t attachmentCount, const VkClearAttachment* pAttachments,