upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/src/vulkan_backend.h
diff options
context:
space:
mode:
authorShang Li <144836394+Mby159@users.noreply.github.com>2026-11-24 15:14:59 +0800
committerShang Li <144836394+Mby159@users.noreply.github.com>2026-11-24 12:35:29 +0000
commit916dbc619df63fb169cf5e587f4d53d8884eaccd (patch)
treee1dabdbf1f403785e973200b4a48d68c978afba4 /runtime/src/vulkan_backend.h
parent21625bca8c675c62f9dbffc318ce6a59d57faf31 (diff)
d3d12/vulkan: the mesh statistics pool enables no forbidden counter (D3D-291)
Diffstat (limited to 'runtime/src/vulkan_backend.h')
-rw-r--r--runtime/src/vulkan_backend.h13
1 files changed, 5 insertions, 8 deletions
diff --git a/runtime/src/vulkan_backend.h b/runtime/src/vulkan_backend.h
index e3e4defe8..89d0f00dd 100644
--- a/runtime/src/vulkan_backend.h
+++ b/runtime/src/vulkan_backend.h
@@ -244,12 +244,12 @@ public:
244 244
245 // Adds `count` pipeline-statistics results into one D3D12_QUERY_DATA_PIPELINE_STATISTICS at dst + offset: the 245 // Adds `count` pipeline-statistics results into one D3D12_QUERY_DATA_PIPELINE_STATISTICS at dst + offset: the
246 // segments of a statistics query that was split around helper dispatches (D3D-162) or mesh draws (D3D-291). 246 // segments of a statistics query that was split around helper dispatches (D3D-162) or mesh draws (D3D-291).
247 // Segment i is in `mesh_queries` when mesh[i] is set (four counters: clipping, fragment and compute; see 247 // Segment i is in `mesh_queries` when mesh[i] is set (two counters: fragment and compute; see
248 // statistics_sum.comp), otherwise in `queries` (all eleven). 248 // statistics_sum.comp), otherwise in `queries` (all eleven).
249 void sum_statistics(VkCommandBuffer cb, VkQueryPool queries, VkQueryPool mesh_queries, const std::uint8_t* mesh, 249 void sum_statistics(VkCommandBuffer cb, VkQueryPool queries, VkQueryPool mesh_queries, const std::uint8_t* mesh,
250 std::uint32_t first, std::uint32_t count, VkBuffer dst, VkDeviceSize offset) const { 250 std::uint32_t first, std::uint32_t count, VkBuffer dst, VkDeviceSize offset) const {
251 constexpr VkDeviceSize result = statistics_counters * word_size; 251 constexpr VkDeviceSize result = statistics_counters * word_size;
252 constexpr VkDeviceSize mesh_slot = 5 * word_size; // CInvocations, where the mesh pool's first counter goes 252 constexpr VkDeviceSize mesh_slot = 7 * word_size; // PSInvocations, where the mesh pool's first counter goes
253 begin_scratch_write(cb); 253 begin_scratch_write(cb);
254 vk_.vkCmdFillBuffer(cb, scratch_, 0, result, 0); 254 vk_.vkCmdFillBuffer(cb, scratch_, 0, result, 0);
255 bind(cb, statistics_pipeline_); 255 bind(cb, statistics_pipeline_);
@@ -2443,15 +2443,12 @@ private:
2443 if (std::find(statistics->mesh.begin(), statistics->mesh.end(), 1) == statistics->mesh.end()) { 2443 if (std::find(statistics->mesh.begin(), statistics->mesh.end(), 1) == statistics->mesh.end()) {
2444 statistics->mesh.clear(); 2444 statistics->mesh.clear();
2445 } else { 2445 } else {
2446 // The counters a mesh draw allows (VUID-vkCmdDrawMeshTasksEXT-pipelineStatistics-07076): clipping 2446 // The counters a mesh draw allows (VUID-vkCmdDrawMeshTasksEXT-pipelineStatistics-07076): the
2447 // invocations and primitives, fragment and compute invocations (D3D-291). 2447 // fragment and compute invocations, and no other (D3D-291).
2448 VkQueryPoolCreateInfo info{VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO}; 2448 VkQueryPoolCreateInfo info{VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO};
2449 info.queryType = VK_QUERY_TYPE_PIPELINE_STATISTICS; 2449 info.queryType = VK_QUERY_TYPE_PIPELINE_STATISTICS;
2450 info.queryCount = statistics_segments; 2450 info.queryCount = statistics_segments;
2451 info.pipelineStatistics = VK_QUERY_PIPELINE_STATISTIC_CLIPPING_INVOCATIONS_BIT | 2451 info.pipelineStatistics = kMeshStatisticsFlags;
2452 VK_QUERY_PIPELINE_STATISTIC_CLIPPING_PRIMITIVES_BIT |
2453 VK_QUERY_PIPELINE_STATISTIC_FRAGMENT_SHADER_INVOCATIONS_BIT |
2454 VK_QUERY_PIPELINE_STATISTIC_COMPUTE_SHADER_INVOCATIONS_BIT;
2455 if (context_.vk.vkCreateQueryPool(statistics->device, &info, nullptr, &statistics->mesh_pool) != 2452 if (context_.vk.vkCreateQueryPool(statistics->device, &info, nullptr, &statistics->mesh_pool) !=
2456 VK_SUCCESS) 2453 VK_SUCCESS)
2457 return ReplayResult::unsupported; 2454 return ReplayResult::unsupported;