Files
metal2vulkan/scripts
Anees Iqbal a5fac6fa9b rt: the depth clip mode Clamp and the triangle fill mode Lines, as pipelines of the draw's class made at first use
setDepthClipMode: and setTriangleFillMode: refused every value but Metal's defaults
(DrawKind::DepthClamp, DrawKind::FillMode). Vulkan 1.3 bakes both in
VkPipelineRasterizationStateCreateInfo, and only VK_EXT_extended_dynamic_state3 makes them
dynamic. The floor cannot require that extension: the UHD 630's Windows driver lists no EDS3, and
KosmicKrisp reports extendedDynamicState3PolygonMode false. So both are now first-use pipeline
variants, the accepted form. The encoder keeps a Raster (clamp, lines) and each draw takes
RenderCompiled::pipeline(topology, raster). The content keeps its primary VkPipeline (the triangle
or patch class at the default state) and a bounded list of the others, by class list topology and
raster state: at most 7 (three more states of the triangle or patch class, two of each other
class). The line and point classes take the clip mode alone, since Metal and Vulkan apply the fill
mode to triangles only. A triangle's edges under Lines chain Bresenham's rule, as the line class
does ("the effective rasterization input topology is in the line topology class"). The first draw
under a state makes its pipeline and waits for it: a first-use wait of a new site,
FirstUse::Raster (Metrics::first_use_raster_waits, _nanos, _max_nanos). The line and point
classes' first draws at the default state count where they did.

Floor:
- depthClamp joins REQUIRED, and the translator is told (=> DepthClamp), so the encoder maps the
  mode through metal::state::depth_clamp_enable. Vulkan 1.4 and Roadmap 2022 require it. The venue
  dumps report it true on every venue: m3-max-48727, 48728, 48729, 48730, 48731, 48736, 48737 and
  61508. tests/floor.rs, the README floor table, RUNTIME_FLOOR and profiles/runtime-floor.json
  add it.
- fillModeNonSolid is enabled where reported (FILL_MODES, told to the translator), and the setter
  maps Lines through metal::state::polygon_mode. KosmicKrisp on the M3 Max reports it false
  (m3-max-48737); every other dumped venue reports it true. There Lines stays DrawKind::FillMode,
  and so does the raw value 2, which no SDK header declares.

DrawKind::DepthClamp is deleted. The consumer's checkout names it nowhere (git grep in
reims-vgpu: 0 hits). Its only call sites are set_triangle_fill_mode and set_depth_clip_mode at
crates/reims-vgpu-vulkan/src/rt_platform/render.rs:371 and :374, whose signatures are unchanged.

The translator's raster-state test reads runtime-floor, which now states depthClamp. Clamp maps
there, and the refusal is asserted on runtime-floor without it, as ab8277a560 did for
depthBiasClamp. Other translator tests that read runtime-floor were grepped for DepthClamp and
FillModeNonSolid, and none reads the floor as lacking them.

Known gaps (README): a content's first draw under Clamp or Lines makes a VkPipeline, which Metal
does not. Under Clamp the depth a fragment function writes is the device's clamp's: Metal stores a
negative NaN as 0 below a range above 0, and the translator's depth_clamp_range variant is not
drawn.

Conformance: render-state-depth-clip and render-state-facing leave known-gaps-rt.tsv;
CONFORMANCE-COVERAGE.md regenerated. Docs: README (encoder, first-use waits, floor and fill-mode
tables, known gaps), REFUSALS.md, the api_signatures table (3 Metrics fields, 1 variant gone).

Tests:
- tests/raster.rs: a triangle in front of the near plane draws nothing under Clip and every
  texel under Clamp (twice: one pipeline made). Under Lines, through a viewport half a pixel
  right of and above the corner, the triangle draws its two edges inside the target, column 0
  and row 7, and nothing inside. Without fillModeNonSolid it is FillMode and fills. Pipelines
  made, raster first-use waits and first-use waits are each 1 + fillModeNonSolid.
- draw.rs: setting both modes makes no pipeline when no draw follows.
- floor.rs: depthClamp's missing case, and the fill-mode feature enabled where reported.
- first_use_sites.rs: the raster site.
2026-11-21 00:14:34 -08:00
..