Commit Graph

1 Commits

Author SHA1 Message Date
1e7b057ef2 runtime: rectangle lists (topology type 19) through a generated geometry stage
The title draws its full-screen passes and tiled lighting as D3D12.X rectangle
lists (pipeline topology type 19, list topology 17), which the Vulkan layer
refused, so those draws were lost. Ported from VIctory (GPL-3.0-or-later,
Marvisak and contributors, DexNom fork; victory-shader emit/rect.rs, 683ad7a99):

- src/rect_list_gs.h/.cpp read the vertex shader's SPIR-V output interface
  (Location outputs of 32-bit float/int/uint, Position, clip/cull distances when
  the shader declares their capability; separate built-ins or glslang's
  gl_PerVertex block, mirrored) and emit a SPIR-V 1.0 geometry shader, cached
  per output signature. VIctory's rule: the corner is the vertex sharing x with
  one other and y with the other; the fourth vertex is a + b - corner for every
  float output (exactly b or a where a or b has the corner's bits), integer
  outputs keep vertex 0's; unequal or non-positive w, coincident vertices or no
  corner stay a triangle. Two triangles, both led by vertex 0 (the provoking
  vertex for flat inputs) and turned as the title's; the primitive ID is passed.
- d3d12_vulkan_device.cpp: a type-19 PSO appends that stage and takes triangle
  lists; every other topology is unchanged. No geometryShader, or a VS the stage
  cannot be made for (no Position, Layer/ViewportIndex), is E_NOTIMPL with a log.
- tests/test_rect_list_gs.py runs the generator through rect_list_gs_tool on
  assembled vertex shaders and interprets the stage on the CPU (corner orders
  TL/BL/BR, TL/BL/TR and the third, unequal w, cache, refusals, spirv-val);
  d3d12_rect_list_test draws three rectangle orders plus a triangle control on
  the GPU (RTX 4060 Ti, 616.64, also under the validation layer).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 22:14:54 -05:00