瀏覽代碼

vulkan: Reserve CB #0 as seq value for "never read/written"

rdb 4 天之前
父節點
當前提交
89ca3e9eeb

+ 19 - 7
panda/src/vulkandisplay/vulkanCommandBuffer.cxx

@@ -137,9 +137,15 @@ add_barrier(VulkanTextureContext *tc, VkImageLayout layout,
     } else {
       out << "TC " << tc;
     }
-    out << " on CB #" << _seq << " (last "
-        << ((tc->_read_seq > tc->_write_seq) ? "read on #" : "write on #")
-        << tc->_read_seq << ")\n";
+    out << " on CB #" << _seq;
+
+    if (tc->_read_seq == 0 && tc->_write_seq == 0) {
+      out << " (first use)\n";
+    } else {
+      out << " (last "
+          << ((tc->_read_seq > tc->_write_seq) ? "read on #" : "write on #")
+          << tc->_read_seq << ")\n";
+    }
   }
 #endif
 
@@ -291,13 +297,19 @@ add_barrier(VulkanBufferContext *bc, VkPipelineStageFlags2 dst_stage_mask,
   if (vulkandisplay_cat.is_spam()) {
     const char dst_type = (write_mask != 0) ? 'W' : 'R';
     const char src_type = (src_access_mask != 0) ? 'W' : 'R';
-    vulkandisplay_cat.spam()
+    auto &out = vulkandisplay_cat.spam()
       << (hoist_possible ? "Hoisting " : "Issuing ")
       << dst_type << 'a' << src_type << " barrier for "
       << "SSBO " << *(ShaderBuffer *)bc->get_object()
-      << " on CB #" << _seq << " (last "
-      << ((bc->_read_seq > bc->_write_seq) ? "read on #" : "write on #")
-      << bc->_read_seq << ")\n";
+      << " on CB #" << _seq;
+
+    if (bc->_read_seq == 0 && bc->_write_seq == 0) {
+      out << " (first use)\n";
+    } else {
+      out << " (last "
+          << ((bc->_read_seq > bc->_write_seq) ? "read on #" : "write on #")
+          << bc->_read_seq << ")\n";
+    }
   }
 #endif
 

+ 2 - 2
panda/src/vulkandisplay/vulkanGraphicsStateGuardian.h

@@ -331,8 +331,8 @@ private:
   VulkanCommandBuffer _transfer_cmd;
   VulkanCommandBuffer _render_cmd;
 
-  uint64_t _next_begin_command_buffer_seq = 0;
-  uint64_t _next_end_command_buffer_seq = 0;
+  uint64_t _next_begin_command_buffer_seq = 1;
+  uint64_t _next_end_command_buffer_seq = 1;
   pvector<VkCommandBuffer> _free_command_buffers; // new and unused
   pvector<VkCommandBuffer> _pending_command_buffers; // ready to submit
   pvector<VkBufferMemoryBarrier2> _pending_buffer_barriers;