upleb.uk

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

summaryrefslogtreecommitdiff
path: root/docs/d3d12_vulkan.md
diff options
context:
space:
mode:
authorRain156 <77776581+Rain156@users.noreply.github.com>2026-11-24 21:40:18 +0800
committerRain156 <77776581+Rain156@users.noreply.github.com>2026-11-24 21:40:18 +0800
commit1b1d4edd2dea9ef1fbabfadb8e3d719be39e38eb (patch)
treeb9a8aa144a60538b022cdf92f85cd6ee679d171b /docs/d3d12_vulkan.md
parentabbd7d9b27dd624bc1446ced9539b78a0193c1ba (diff)
parent47c6511747c93aa3fb908d7782ca96173d0eead3 (diff)
Merge current main and retain mesh statistics in the first-run rendering context
Diffstat (limited to 'docs/d3d12_vulkan.md')
-rw-r--r--docs/d3d12_vulkan.md43
1 files changed, 27 insertions, 16 deletions
diff --git a/docs/d3d12_vulkan.md b/docs/d3d12_vulkan.md
index 07ded7571..247476da1 100644
--- a/docs/d3d12_vulkan.md
+++ b/docs/d3d12_vulkan.md
@@ -3456,23 +3456,34 @@ Implemented (`QueryHeap` in `runtime/shims/d3d12_vulkan_device.cpp`, the query c
3456 recording. The resolve fallback is unchanged: only resolves needing dispatches are refused there. 3456 recording. The resolve fallback is unchanged: only resolves needing dispatches are refused there.
3457- **Mesh draws during a pipeline-statistics query** (D3D-291). D3D12 allows `DispatchMesh` inside a statistics query 3457- **Mesh draws during a pipeline-statistics query** (D3D-291). D3D12 allows `DispatchMesh` inside a statistics query
3458 and reads its input-assembly, vertex, geometry and tessellation fields as 0. Vulkan forbids `vkCmdDrawMeshTasksEXT` 3458 and reads its input-assembly, vertex, geometry and tessellation fields as 0. Vulkan forbids `vkCmdDrawMeshTasksEXT`
3459 while a query with those counters is active (`VUID-vkCmdDrawMeshTasksEXT-pipelineStatistics-07076`), and the heap's 3459 while a query with the input-assembly, vertex, geometry, tessellation or clipping counters is active
3460 pool has all eleven. So a statistics query that holds a mesh draw is split as above, and a split before a draw stays 3460 (`VUID-vkCmdDrawMeshTasksEXT-pipelineStatistics-07076`), and the heap's pool has all eleven. So a statistics query
3461 outside its rendering scope. A segment's first draw decides its pool: the submission's full pool, or a second pool 3461 that holds a mesh draw is split as above, and a split before a draw stays outside its rendering scope. A segment's first draw decides its pool: the submission's full pool, or a second pool
3462 with only clipping invocations and primitives, fragment and compute invocations. A later draw of the other kind ends 3462 with only the fragment and compute invocations, the two the VUID leaves allowed. A later draw of the other kind ends
3463 the segment and begins one of its own kind; dispatches and segments without draws use the full pool, and 3463 the segment and begins one of its own kind; dispatches and segments without draws use the full pool, and
3464 `ExecuteIndirect` draws count as vertex draws. The sum copies a mesh segment's four counters into fields 5 to 8 of 3464 `ExecuteIndirect` draws count as vertex draws. The sum copies a mesh segment's two counters into fields 7 and 8 of
3465 its record, and `statistics_sum.comp` adds them as `CInvocations`, `CPrimitives`, `PSInvocations` and 3465 its record, and `statistics_sum.comp` adds them as `PSInvocations` and `CSInvocations`, so the other fields get
3466 `CSInvocations`, so the other fields get nothing from it. A query that holds only mesh draws is one mesh segment, 3466 nothing from it. D3D12 counts the clipping invocations and primitives of a mesh pipeline, but Vulkan has no counter
3467 resolved through the same sum. Without the compute helper there is no segment pool and such a list is refused 3467 for them during a mesh draw, so `CInvocations` and `CPrimitives` read 0 for a mesh segment. A query that holds only
3468 (`unsupported`) rather than run unsplit; so is one on the single-list `replay()` (D3D-399), whose 3468 mesh draws is one mesh segment, resolved through the same sum. Without the compute helper there is no segment pool
3469 `create_segment_pool` gives no mesh pool. Overlapping statistics queries (D3D-252) split the same way inside their 3469 and such a list is refused (`unsupported`) rather than run unsplit; so is one on the single-list `replay()` (D3D-399),
3470 shared segments: a draw of the other kind than the open segment's opens a new one, so every query that segment 3470 whose `create_segment_pool` gives no mesh pool. Overlapping statistics queries (D3D-252) split the same way inside
3471 belongs to sums both kinds. `replay_query_predication_test` (cases 15 and 16) checks the split points, the segment 3471 their shared segments: a draw of the other kind than the open segment's opens a new one, so every query that segment
3472 kinds and the resolve plan on the CPU. `d3d12_mesh_test` resolves a query around a vertex, two mesh and a vertex 3472 belongs to sums both kinds. `replay_query_predication_test` (cases 15 to 17) checks the split points, the segment
3473 draw, one around a mesh draw and one around the two vertex draws: the vertex fields count only the two triangles, 3473 kinds, the resolve plan and the counters the mesh pool may enable on the CPU. `d3d12_mesh_test` resolves a query
3474 and the mixed query has more clipping and pixel-shader invocations than the vertex-only one. On the RX 9060 XT 3474 around a vertex, two mesh and a vertex draw, one around a mesh draw and one around the two vertex draws: the vertex
3475 (RADV), the clipping counts add up exactly (2 + 10 = 12). 3475 fields count only the two triangles, the mixed query has the same clipping count as the vertex-only one and more
3476 pixel-shader invocations, and the mesh-only query has no clipping count without the mesh-primitives query below.
3477- **The clipping invocations of a mesh segment** (D3D-MESH-CLIPPING-COUNTER). D3D-291 leaves `CInvocations` and
3478 `CPrimitives` of a mesh segment at 0, because Vulkan has no clipping counter during a mesh draw. Where the device
3479 has the `meshShaderQueries` feature of `VK_EXT_mesh_shader`, the number of primitives the mesh shader emitted
3480 comes from a `VK_QUERY_TYPE_MESH_PRIMITIVES_GENERATED_EXT` query instead: a third pool of the submission, begun
3481 and ended with each mesh segment, next to the two the statistics split needs. Its count is copied to field 5 of the
3482 segment's record and `statistics_sum.comp` adds it as `CInvocations`; `CPrimitives` stays 0, because Vulkan has
3483 no clipped-primitive counter and D3D12's `CPrimitives` is the clipper's output (0 when a triangle is dropped, 2
3484 when it is split). The count is not D3D12's number: Vulkan counts a primitive the mesh shader culled with
3485 `gl_CullPrimitiveEXT`, which D3D12 does not count, so a mesh segment's `CInvocations` can be higher than D3D12's.
3486 Without the feature the field reads 0, as in D3D-291.
3476- **Timestamps.** `GetTimestampFrequency` is `1e9 / timestampPeriod` (1 GHz on the test GPU). Every D3D12 queue 3487- **Timestamps.** `GetTimestampFrequency` is `1e9 / timestampPeriod` (1 GHz on the test GPU). Every D3D12 queue
3477 shares one `VkQueue` for now (question 12), so they share one frequency. 3488 shares one `VkQueue` for now (question 12), so they share one frequency.
3478- **Timestamp resolves on MoltenVK.** On Apple GPUs, MoltenVK delays every `vkCmdWriteTimestamp` to the end of 3489- **Timestamp resolves on MoltenVK.** On Apple GPUs, MoltenVK delays every `vkCmdWriteTimestamp` to the end of