Translator: the address form reads patch and control-point indices through their pushed addresses; a fragment's primitive id is the patch's position
Under the identity domains (the runtime's), a post-tessellation function's control stage reads its factors through their pushed address and binds no buffer. It had no way to read a patch index buffer or a control-point index buffer, so it took each patch's index from its position and refused a control-point index type (NotImplemented(Tessellation)). The viewer's two pipelines are UInt32 control-point indices drawn by drawIndexedPatches, and both were refused. The control stage's push range now holds, at its offset: - 0: the factors' address (u64), as before; - 8: under a control-point index type, the control-point index buffer's address plus its offset (PushField::ControlPointIndexAddress, u64); otherwise the per-instance step's stride at 8 and the scale at 12, as before; - 16: the patch index buffer's address plus its offset (PushField::PatchIndexAddress, u64), 0 for a draw without one. 24 bytes in all, below the post-tessellation function's window (push::TESSELLATION_BASE). A control-point index type beside a per-instance factor step or an enabled factor scale has no room for both, and stays NotImplemented(Tessellation) (control::address_fits); the runtime refuses those two at state creation anyway. What the stage reads, from the Apple M3 Max's tables (jobs m3-max-80366 and m3-max-80398): - the patch at position p (patchStart plus its place in the draw) reads its factors at p, whatever its patch index; - its [[patch_id]] is the uint at index p of the patch index buffer where the pushed address is not 0, else p; - control point j of patch pid is the vertex the index at pid * N + j of the control-point index buffer names (a ushort read out of its aligned word for UInt16, a uint for UInt32), else pid * N + j. Each read goes through the address unchecked, as the factor reads do. No check form is added. A fragment function's [[primitive_id]] behind the stage is the patch's position, with a patch index buffer or without (the same tables): the control stage writes p to a flat varying at PATCH_POSITION_LOCATION (3), which the evaluation stage hands on, and the control point varying moves to location 4. Before, the varying carried the patch index, which equals the position only without a patch index buffer. The cache codec carries the two new push fields: ARTIFACT_FORMAT_VERSION 601. Translation output changes for every post-tessellation pipeline under the identity domains: SEMANTICS_VERSION 2323 (2322 is split-store's). Tests: control/tests.rs runs the address form's patch index and control points on the SPIR-V interpreter (both index types, a nonzero and a zero patch index address) and checks the pushed fields of each form; engine_tessellation compiles the stream's state under UInt16 and UInt32 on every committed profile with the identity domains, with the fields at 0, 8 and 16, and refuses UInt32 beside a per-instance step or a scale; lower::push checks the range fits below the window for every step, scale and index type the form takes.
This commit is contained in:
1 parent
975a9c0fc2
commit
082248f947
16 files changed
+525
-166
No files matched your search
+7
-9
@@ -1094,15 +1094,13 @@ indirect and indexed forms), with the factors from a tessellation factor buffer.
|
||||
orders the triangles (`PrecisionNote::TessellationTriangleOrder` where it is not Apple's).
|
||||
|
||||
A device without `tessellationShader` refuses the function (`Unsupported{Tessellation}`, naming
|
||||
the feature). A fragment function's `[[primitive_id]]` behind it is Metal's patch index, which
|
||||
the evaluation stage writes to a flat varying the fragment stage reads (`IoRole::PrimitiveId`), on
|
||||
every device. Without a patch index buffer that is Metal's value: the patch's position in its
|
||||
draw, `patchStart` included, the same in every instance and for every triangle of the patch
|
||||
(measured on an Apple M3 Max), where Vulkan's `PrimitiveId` counts the draw's patches from 0 and
|
||||
restarts in each instance. With a patch index buffer it would be the buffer's index for the
|
||||
patch, where Metal's `[[primitive_id]]` stays the patch's position (measured on an Apple M3 Max);
|
||||
the runtime refuses a patch draw through a patch index buffer. A fragment function compiled to
|
||||
read Vulkan's `PrimitiveId` behind it is `NeedsInput(PrimitiveId)`.
|
||||
the feature). A fragment function's `[[primitive_id]]` behind it is the patch's position in its
|
||||
draw, which the evaluation stage writes to a flat varying the fragment stage reads
|
||||
(`IoRole::PrimitiveId`), on every device: Metal's value, `patchStart` included, the same in every
|
||||
instance and for every triangle of the patch, with or without a patch index buffer (measured on
|
||||
an Apple M3 Max), where Vulkan's `PrimitiveId` counts the draw's patches from 0 and restarts in
|
||||
each instance. A fragment function compiled to read Vulkan's `PrimitiveId` behind it is
|
||||
`NeedsInput(PrimitiveId)`.
|
||||
|
||||
### Mesh pipelines
|
||||
|
||||
|
||||
Reference in new issue
Block a user