vk/0.210.0: Fix how we handle access flags in barriers
authorJason Ekstrand <jason.ekstrand@intel.com>
Thu, 3 Dec 2015 19:05:52 +0000 (11:05 -0800)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 3 Dec 2015 21:44:02 +0000 (13:44 -0800)
The initial implementation in the 0.210.0 API update was misguieded as to
what the access flags meant.  This should be more correct.

src/vulkan/genX_cmd_buffer.c

index e404d5efa9e32528bdc90714d8ad8902899f079c..ac1ab822b494ab51df0d3e04de92038f7041daf9 100644 (file)
@@ -223,10 +223,11 @@ void genX(CmdPipelineBarrier)(
       }
    }
 
-   for_each_bit(b, dst_flags) {
+   /* The src flags represent how things were used previously.  This is
+    * what we use for doing flushes.
+    */
+   for_each_bit(b, src_flags) {
       switch ((VkAccessFlagBits)(1 << b)) {
-      case VK_ACCESS_HOST_WRITE_BIT:
-         break; /* FIXME: Little-core systems */
       case VK_ACCESS_SHADER_WRITE_BIT:
          cmd.DCFlushEnable = true;
          break;
@@ -241,14 +242,16 @@ void genX(CmdPipelineBarrier)(
          cmd.DepthCacheFlushEnable = true;
          break;
       default:
-         assert(!"Not a write bit");
+         /* Doesn't require a flush */
+         break;
       }
    }
 
-   for_each_bit(b, src_flags) {
+   /* The dst flags represent how things will be used in the fugure.  This
+    * is what we use for doing cache invalidations.
+    */
+   for_each_bit(b, dst_flags) {
       switch ((VkAccessFlagBits)(1 << b)) {
-      case VK_ACCESS_HOST_READ_BIT:
-         break; /* FIXME: Little-core systems */
       case VK_ACCESS_INDIRECT_COMMAND_READ_BIT:
       case VK_ACCESS_INDEX_READ_BIT:
       case VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT:
@@ -258,22 +261,19 @@ void genX(CmdPipelineBarrier)(
          cmd.ConstantCacheInvalidationEnable = true;
          /* fallthrough */
       case VK_ACCESS_SHADER_READ_BIT:
-         cmd.DCFlushEnable = true;
          cmd.TextureCacheInvalidationEnable = true;
          break;
       case VK_ACCESS_COLOR_ATTACHMENT_READ_BIT:
          cmd.TextureCacheInvalidationEnable = true;
          break;
-      case VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT:
-         cmd.DCFlushEnable = true;
-         break;
       case VK_ACCESS_TRANSFER_READ_BIT:
          cmd.TextureCacheInvalidationEnable = true;
          break;
       case VK_ACCESS_MEMORY_READ_BIT:
          break; /* XXX: What is this? */
       default:
-         assert(!"Not a read bit");
+         /* Doesn't require a flush */
+         break;
       }
    }