summaryrefslogtreecommitdiffstats
path: root/src/vulkan
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2016-01-14 08:09:39 -0800
committerJason Ekstrand <[email protected]>2016-01-14 08:09:39 -0800
commitc310fb032d406984e72895b6c94e2f96bff8e70d (patch)
tree6c95f8e89dd81b831956d5f132ca2573ff8e8e33 /src/vulkan
parentb14a78cfb8aab71ddac016539d94e64d69ef813f (diff)
vulkan-1.0.0: Rework memory barriers
Diffstat (limited to 'src/vulkan')
-rw-r--r--src/vulkan/anv_dump.c6
-rw-r--r--src/vulkan/gen7_cmd_buffer.c8
-rw-r--r--src/vulkan/gen8_cmd_buffer.c12
-rw-r--r--src/vulkan/genX_cmd_buffer.c45
4 files changed, 37 insertions, 34 deletions
diff --git a/src/vulkan/anv_dump.c b/src/vulkan/anv_dump.c
index 2a747d46924..b7fa28be787 100644
--- a/src/vulkan/anv_dump.c
+++ b/src/vulkan/anv_dump.c
@@ -127,8 +127,8 @@ anv_dump_image_to_ppm(struct anv_device *device,
ANV_CALL(CmdPipelineBarrier)(cmd,
VK_PIPELINE_STAGE_TRANSFER_BIT,
VK_PIPELINE_STAGE_TRANSFER_BIT,
- true, 1,
- (const void * []) { &(VkImageMemoryBarrier) {
+ true, 0, NULL, 0, NULL, 1,
+ &(VkImageMemoryBarrier) {
.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
.srcAccessMask = VK_ACCESS_HOST_READ_BIT,
.dstAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT,
@@ -144,7 +144,7 @@ anv_dump_image_to_ppm(struct anv_device *device,
.baseArrayLayer = 0,
.layerCount = 1,
},
- }});
+ });
result = anv_EndCommandBuffer(cmd);
assert(result == VK_SUCCESS);
diff --git a/src/vulkan/gen7_cmd_buffer.c b/src/vulkan/gen7_cmd_buffer.c
index d3a9de5038f..e6501124139 100644
--- a/src/vulkan/gen7_cmd_buffer.c
+++ b/src/vulkan/gen7_cmd_buffer.c
@@ -888,8 +888,12 @@ void genX(CmdWaitEvents)(
const VkEvent* pEvents,
VkPipelineStageFlags srcStageMask,
VkPipelineStageFlags destStageMask,
- uint32_t memBarrierCount,
- const void* const* ppMemBarriers)
+ uint32_t memoryBarrierCount,
+ const VkMemoryBarrier* pMemoryBarriers,
+ uint32_t bufferMemoryBarrierCount,
+ const VkBufferMemoryBarrier* pBufferMemoryBarriers,
+ uint32_t imageMemoryBarrierCount,
+ const VkImageMemoryBarrier* pImageMemoryBarriers)
{
stub();
}
diff --git a/src/vulkan/gen8_cmd_buffer.c b/src/vulkan/gen8_cmd_buffer.c
index 4066c39aac8..65b4514d35e 100644
--- a/src/vulkan/gen8_cmd_buffer.c
+++ b/src/vulkan/gen8_cmd_buffer.c
@@ -1147,8 +1147,12 @@ void genX(CmdWaitEvents)(
const VkEvent* pEvents,
VkPipelineStageFlags srcStageMask,
VkPipelineStageFlags destStageMask,
- uint32_t memBarrierCount,
- const void* const* ppMemBarriers)
+ uint32_t memoryBarrierCount,
+ const VkMemoryBarrier* pMemoryBarriers,
+ uint32_t bufferMemoryBarrierCount,
+ const VkBufferMemoryBarrier* pBufferMemoryBarriers,
+ uint32_t imageMemoryBarrierCount,
+ const VkImageMemoryBarrier* pImageMemoryBarriers)
{
ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer);
for (uint32_t i = 0; i < eventCount; i++) {
@@ -1166,5 +1170,7 @@ void genX(CmdWaitEvents)(
genX(CmdPipelineBarrier)(commandBuffer, srcStageMask, destStageMask,
false, /* byRegion */
- memBarrierCount, ppMemBarriers);
+ memoryBarrierCount, pMemoryBarriers,
+ bufferMemoryBarrierCount, pBufferMemoryBarriers,
+ imageMemoryBarrierCount, pImageMemoryBarriers);
}
diff --git a/src/vulkan/genX_cmd_buffer.c b/src/vulkan/genX_cmd_buffer.c
index ac1ab822b49..4f7054f83d2 100644
--- a/src/vulkan/genX_cmd_buffer.c
+++ b/src/vulkan/genX_cmd_buffer.c
@@ -143,8 +143,12 @@ void genX(CmdPipelineBarrier)(
VkPipelineStageFlags srcStageMask,
VkPipelineStageFlags destStageMask,
VkBool32 byRegion,
- uint32_t memBarrierCount,
- const void* const* ppMemBarriers)
+ uint32_t memoryBarrierCount,
+ const VkMemoryBarrier* pMemoryBarriers,
+ uint32_t bufferMemoryBarrierCount,
+ const VkBufferMemoryBarrier* pBufferMemoryBarriers,
+ uint32_t imageMemoryBarrierCount,
+ const VkImageMemoryBarrier* pImageMemoryBarriers)
{
ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer);
uint32_t b, *dw;
@@ -197,30 +201,19 @@ void genX(CmdPipelineBarrier)(
VkAccessFlags src_flags = 0;
VkAccessFlags dst_flags = 0;
- for (uint32_t i = 0; i < memBarrierCount; i++) {
- const struct anv_common *common = ppMemBarriers[i];
- switch (common->sType) {
- case VK_STRUCTURE_TYPE_MEMORY_BARRIER: {
- ANV_COMMON_TO_STRUCT(VkMemoryBarrier, barrier, common);
- src_flags |= barrier->srcAccessMask;
- dst_flags |= barrier->dstAccessMask;
- break;
- }
- case VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER: {
- ANV_COMMON_TO_STRUCT(VkBufferMemoryBarrier, barrier, common);
- src_flags |= barrier->srcAccessMask;
- dst_flags |= barrier->dstAccessMask;
- break;
- }
- case VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER: {
- ANV_COMMON_TO_STRUCT(VkImageMemoryBarrier, barrier, common);
- src_flags |= barrier->srcAccessMask;
- dst_flags |= barrier->dstAccessMask;
- break;
- }
- default:
- unreachable("Invalid memory barrier type");
- }
+ for (uint32_t i = 0; i < memoryBarrierCount; i++) {
+ src_flags |= pMemoryBarriers[i].srcAccessMask;
+ dst_flags |= pMemoryBarriers[i].dstAccessMask;
+ }
+
+ for (uint32_t i = 0; i < bufferMemoryBarrierCount; i++) {
+ src_flags |= pBufferMemoryBarriers[i].srcAccessMask;
+ dst_flags |= pBufferMemoryBarriers[i].dstAccessMask;
+ }
+
+ for (uint32_t i = 0; i < imageMemoryBarrierCount; i++) {
+ src_flags |= pImageMemoryBarriers[i].srcAccessMask;
+ dst_flags |= pImageMemoryBarriers[i].dstAccessMask;
}
/* The src flags represent how things were used previously. This is