From 18ee32ef9da1dc960e9c0cb34512b23f4a6983ce Mon Sep 17 00:00:00 2001 From: Chad Versace Date: Tue, 7 Jul 2015 15:42:38 -0700 Subject: [PATCH] vk: Update vkCmdPipelineBarrier to 0.130 header --- include/vulkan/vulkan.h | 20 +++++++++++++---- src/vulkan/device.c | 49 +++++++++++++++++++++++------------------ 2 files changed, 43 insertions(+), 26 deletions(-) diff --git a/include/vulkan/vulkan.h b/include/vulkan/vulkan.h index bef5df4785b..29386263bed 100644 --- a/include/vulkan/vulkan.h +++ b/include/vulkan/vulkan.h @@ -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, diff --git a/src/vulkan/device.c b/src/vulkan/device.c index 11b820dc2ce..39229586d51 100644 --- a/src/vulkan/device.c +++ b/src/vulkan/device.c @@ -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. -- 2.30.2