Repository navigation
Conversation
…rote starts the next render pass
A draw sees what the draws before it wrote through UAVs (D3D11.3 5.3.5.1), in every
stage. A tile-based GPU shades every draw's vertices in a render pass before any of its
fragments, and Metal has no barrier from fragment to vertex work inside a pass, so the
encoder dropped such a barrier ("A fragment-vertex barrier is omitted") and the later
draw's vertex shader read what was there before. The context now records which
resources the pass's pixel shaders read and wrote, and a draw whose vertex, hull, domain
or geometry shader, vertex or index buffers, indirect arguments or stream output read
what one of them wrote, or write what one read, ends the pass first, as a draw that has
no room for its scissors does. The next pass loads what this one stored.
d3d11_fragment_vertex_order reads, in a second draw's vertex shader, a value the first
draw's pixel shader wrote, through a shader resource view and as a vertex buffer, on the
immediate and a deferred context: without this all four read 0.
… Direct3D does every tessellated draw took the mesh emulation, whose object stage runs the vertex and hull shaders and whose mesh stage tessellates and runs the domain shader, a patch's workloads to a threadgroup. D3D12 has drawn through Metal's tessellator on Metal 3 encoders since c951e38, and D3D11's encoders are all Metal 3's. a pipeline whose tessellator Metal's tessellates as Direct3D's does, a triangle or quad domain to triangles with integer or pow2 partitioning (D3D11.3 11.7.7.1: the hull kernel rounds pow2's factors), with no geometry shader, stream output, clip distances the pixel shader tests, cull distances, UAVs in its vertex or hull shader or pipeline statistics, also has the converter's native functions (SM50_SHADER_PSO_TESSELLATOR_DATA's native, as D3D12's): a hull kernel and a post-tessellation vertex function running the domain shader. its direct draws run the kernel in a compute encoder before their pass, which waits for what the pass's vertex stages wait for and makes resident what the vertex and hull shaders read, and the pass waits for it; drawPatches then draws the patches it wrote. indirect draws, draws under pipeline statistics and draws after a pre-raster stage has written in the pass, which the kernel would read before the pass, keep the mesh pipeline, as does a pipeline Metal does not make the tessellator of. the domain shader's tables are the vertex stage's too, and the vertex and hull shaders' are kept for the kernel, so a pass mixes the two. d3d11.nativeTessellation = False keeps the mesh emulation for every draw. the encoder trace names the kernels' encoder "hull", with its draws, and counts drawPatches as tessellation draws: d3d11_trace_encoders expects it before the pass of the two direct tessellated draws. d3d11_tessellation_native draws tri and quad patches, integer, pow2 and fractional_odd, clockwise and counter-clockwise, directly, through 16- and 32-bit indices with a base vertex and a start instance, and indirectly between, with each stage's constant buffer and the domain shader's buffer: each pixel is checked, with each setting, and the trace shows 24 native draws with it on and none off. it fails without the change (0 hull kernels). d3d11_tessellator, whose triangles are the reference tessellator's, draws 256 of its draws natively. a large draw (8 draws of 128 quad patches x 4 instances, integer; GPU time between timestamp queries, median of 15 per run, three runs, Apple M6, no validation): factor 64 takes 4.28-4.32 ms natively against 8.74-8.86 ms through the mesh emulation (8.74-8.78 ms before the change), factor 8 0.97-1.20 ms against 1.14-1.33 ms.
This was referenced Nov 22, 2026
Contributor
Author
|
Closing; not a worthwhile change. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two D3D11 rendering changes: one correctness fix that games hit, and D3D11 tessellation on Metal's own tessellator. Split out of #341, with the same commits.
What changes
A fragment-vertex barrier is omitted) and the vertex shader read stale data.d3d11_fragment_vertex_order: without the change, all four cases (SRV and vertex buffer, immediate and deferred) read 0 instead of 7.drawPatches. The conditions: tri or quad domain to triangles, integer or pow2 partitioning, no GS, stream output, tested clip or cull distances, VS/HS UAVs or statistics, and direct draws.d3d11.nativeTessellation = Falseforces it.d3d11_tessellation_nativechecks every pixel on both paths and that 24 draws are native; before:0 draws ran hull kernels, want 24.d3d11_tessellator's 256 native draws match the reference tessellator.Evidence
Mac mini, Apple M6, macOS 27.3. MetalSharp Wine 8.0 (arm64 with FEX), copied with
--clone. ARM64EC build with-Denable_nvngx=true -Denable_nvapi=true -Denable_tests=true.tests/run.py --family nativewithd3d11_tessellator d3d11_tessellation_native d3d11_fragment_vertex_order d3d11_trace_encoders: 4 passed, 0 failed.main, and these tests passed on every default family with--validate --repeat 2.Not run