anv/meta: Implement vkCmdClearAttachments
authorChad Versace <chad.versace@intel.com>
Thu, 14 Jan 2016 02:37:27 +0000 (18:37 -0800)
committerChad Versace <chad.versace@intel.com>
Fri, 15 Jan 2016 06:53:05 +0000 (22:53 -0800)
src/vulkan/anv_meta_clear.c

index 722751cda804a173c13465f08729779dd6af67c2..b7f2f18b994863cf8216be1fba989337f79d5843 100644 (file)
@@ -933,5 +933,19 @@ void anv_CmdClearAttachments(
     uint32_t                                    rectCount,
     const VkClearRect*                          pRects)
 {
-   stub();
+   ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer);
+   struct anv_meta_saved_state saved_state;
+
+   meta_clear_begin(&saved_state, cmd_buffer);
+
+   /* FINISHME: We can do better than this dumb loop. It thrashes too much
+    * state.
+    */
+   for (uint32_t a = 0; a < attachmentCount; ++a) {
+      for (uint32_t r = 0; r < rectCount; ++r) {
+         emit_clear(cmd_buffer, &pAttachments[a], &pRects[r]);
+      }
+   }
+
+   meta_clear_end(&saved_state, cmd_buffer);
 }