vk: Update vkCmdPipelineBarrier to 0.130 header
authorChad Versace <chad.versace@intel.com>
Tue, 7 Jul 2015 22:42:38 +0000 (15:42 -0700)
committerChad Versace <chad.versace@intel.com>
Tue, 7 Jul 2015 22:43:41 +0000 (15:43 -0700)
include/vulkan/vulkan.h
src/vulkan/device.c

index bef5df4785bc5d4026399e68a11120f5bce16678..29386263bed27184214de77626cd360beff6159e 100644 (file)
@@ -1034,6 +1034,19 @@ typedef enum {
 } VkCmdBufferOptimizeFlagBits;
 typedef VkFlags VkCmdBufferOptimizeFlags;
 
+typedef enum {
+    VK_PIPE_EVENT_TOP_OF_PIPE_BIT = 0x00000001,
+    VK_PIPE_EVENT_VERTEX_PROCESSING_COMPLETE_BIT = 0x00000002,
+    VK_PIPE_EVENT_LOCAL_FRAGMENT_PROCESSING_COMPLETE_BIT = 0x00000004,
+    VK_PIPE_EVENT_FRAGMENT_PROCESSING_COMPLETE_BIT = 0x00000008,
+    VK_PIPE_EVENT_GRAPHICS_PIPELINE_COMPLETE_BIT = 0x00000010,
+    VK_PIPE_EVENT_COMPUTE_PIPELINE_COMPLETE_BIT = 0x00000020,
+    VK_PIPE_EVENT_TRANSFER_COMPLETE_BIT = 0x00000040,
+    VK_PIPE_EVENT_COMMANDS_COMPLETE_BIT = 0x00000080,
+    VK_PIPE_EVENT_CPU_SIGNAL_BIT = 0x00000100,
+} VkPipeEventFlagBits;
+typedef VkFlags VkPipeEventFlags;
+
 typedef enum {
     VK_QUERY_CONTROL_CONSERVATIVE_BIT = 0x00000001,
 } VkQueryControlFlagBits;
@@ -1974,7 +1987,7 @@ typedef void (VKAPI *PFN_vkCmdResolveImage)(VkCmdBuffer cmdBuffer, VkImage srcIm
 typedef void (VKAPI *PFN_vkCmdSetEvent)(VkCmdBuffer cmdBuffer, VkEvent event, VkPipeEvent pipeEvent);
 typedef void (VKAPI *PFN_vkCmdResetEvent)(VkCmdBuffer cmdBuffer, VkEvent event, VkPipeEvent pipeEvent);
 typedef void (VKAPI *PFN_vkCmdWaitEvents)(VkCmdBuffer cmdBuffer, VkWaitEvent waitEvent, uint32_t eventCount, const VkEvent* pEvents, uint32_t memBarrierCount, const void** ppMemBarriers);
-typedef void (VKAPI *PFN_vkCmdPipelineBarrier)(VkCmdBuffer cmdBuffer, VkWaitEvent waitEvent, uint32_t pipeEventCount, const VkPipeEvent* pPipeEvents, uint32_t memBarrierCount, const void** ppMemBarriers);
+typedef void (VKAPI *PFN_vkCmdPipelineBarrier)(VkCmdBuffer cmdBuffer, VkWaitEvent waitEvent, VkPipeEventFlags pipeEventMask, uint32_t memBarrierCount, const void* const* ppMemBarriers);
 typedef void (VKAPI *PFN_vkCmdBeginQuery)(VkCmdBuffer cmdBuffer, VkQueryPool queryPool, uint32_t slot, VkQueryControlFlags flags);
 typedef void (VKAPI *PFN_vkCmdEndQuery)(VkCmdBuffer cmdBuffer, VkQueryPool queryPool, uint32_t slot);
 typedef void (VKAPI *PFN_vkCmdResetQueryPool)(VkCmdBuffer cmdBuffer, VkQueryPool queryPool, uint32_t startQuery, uint32_t queryCount);
@@ -2536,10 +2549,9 @@ void VKAPI vkCmdWaitEvents(
 void VKAPI vkCmdPipelineBarrier(
     VkCmdBuffer                                 cmdBuffer,
     VkWaitEvent                                 waitEvent,
-    uint32_t                                    pipeEventCount,
-    const VkPipeEvent*                          pPipeEvents,
+    VkPipeEventFlags                            pipeEventMask,
     uint32_t                                    memBarrierCount,
-    const void**                                ppMemBarriers);
+    const void* const*                          ppMemBarriers);
 
 void VKAPI vkCmdBeginQuery(
     VkCmdBuffer                                 cmdBuffer,
index 11b820dc2cebe7a495f41f1131be4cf11a2af579..39229586d5195264210082f15e48d877bf370326 100644 (file)
@@ -3405,10 +3405,9 @@ void anv_CmdWaitEvents(
 void anv_CmdPipelineBarrier(
     VkCmdBuffer                                 cmdBuffer,
     VkWaitEvent                                 waitEvent,
-    uint32_t                                    pipeEventCount,
-    const VkPipeEvent*                          pPipeEvents,
+    VkPipeEventFlags                            pipeEventMask,
     uint32_t                                    memBarrierCount,
-    const void**                                ppMemBarriers)
+    const void* const*                          ppMemBarriers)
 {
    struct anv_cmd_buffer *cmd_buffer = (struct anv_cmd_buffer *)cmdBuffer;
    uint32_t b, *dw;
@@ -3420,27 +3419,33 @@ void anv_CmdPipelineBarrier(
 
    /* XXX: I think waitEvent is a no-op on our HW.  We should verify that. */
 
-   for (uint32_t i = 0; i < pipeEventCount; i++) {
-      switch (pPipeEvents[i]) {
-      case VK_PIPE_EVENT_TOP_OF_PIPE:
-         /* This is just what PIPE_CONTROL does */
-         break;
-      case VK_PIPE_EVENT_VERTEX_PROCESSING_COMPLETE:
-      case VK_PIPE_EVENT_LOCAL_FRAGMENT_PROCESSING_COMPLETE:
-      case VK_PIPE_EVENT_FRAGMENT_PROCESSING_COMPLETE:
-         cmd.StallAtPixelScoreboard = true;
-         break;
-      case VK_PIPE_EVENT_GRAPHICS_PIPELINE_COMPLETE:
-      case VK_PIPE_EVENT_COMPUTE_PIPELINE_COMPLETE:
-      case VK_PIPE_EVENT_TRANSFER_COMPLETE:
-      case VK_PIPE_EVENT_COMMANDS_COMPLETE:
-         cmd.CommandStreamerStallEnable = true;
-         break;
-      default:
-         unreachable("Invalid VkPipeEvent");
-      }
+   if (anv_clear_mask(&pipeEventMask, VK_PIPE_EVENT_TOP_OF_PIPE_BIT)) {
+      /* This is just what PIPE_CONTROL does */
+   }
+
+   if (anv_clear_mask(&pipeEventMask,
+                      VK_PIPE_EVENT_VERTEX_PROCESSING_COMPLETE_BIT |
+                      VK_PIPE_EVENT_LOCAL_FRAGMENT_PROCESSING_COMPLETE_BIT |
+                      VK_PIPE_EVENT_FRAGMENT_PROCESSING_COMPLETE_BIT)) {
+      cmd.StallAtPixelScoreboard = true;
+   }
+
+
+   if (anv_clear_mask(&pipeEventMask,
+                      VK_PIPE_EVENT_GRAPHICS_PIPELINE_COMPLETE_BIT |
+                      VK_PIPE_EVENT_COMPUTE_PIPELINE_COMPLETE_BIT |
+                      VK_PIPE_EVENT_TRANSFER_COMPLETE_BIT |
+                      VK_PIPE_EVENT_COMMANDS_COMPLETE_BIT)) {
+      cmd.CommandStreamerStallEnable = true;
    }
 
+   if (anv_clear_mask(&pipeEventMask, VK_PIPE_EVENT_CPU_SIGNAL_BIT)) {
+      anv_finishme("VK_PIPE_EVENT_CPU_SIGNAL_BIT");
+   }
+
+   /* We checked all known VkPipeEventFlags. */
+   anv_assert(pipeEventMask == 0);
+
    /* XXX: Right now, we're really dumb and just flush whatever categories
     * the app asks for.  One of these days we may make this a bit better
     * but right now that's all the hardware allows for in most areas.