Commit Graph

7 Commits

Author SHA1 Message Date
e3edd59a18 BUILD-1447: root-cause --bary-fallback PS deltas and fix %bary half-slot collision 2026-11-23 16:47:06 -03:00
5ed11f24be Fix two semantic tests the round-43 merges broke
- test_bary_fallback: #3647 (BUILD-1046) made a missing input folder exit 2 with "does not exist"; the test from
  #1379 still expected exit 1.
- test_format_decode_branch: the f16 reference uses the interpreter's pinned half_to_float (a NaN half widens to
  the canonical quiet NaN) instead of struct's '<e', whose NaN payload changed in Python 3.14 (CPython gh-130317).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 21:10:20 -05:00
1968dcdfa2 bary_fallback_gs: a missing spirv dir is an error, not an empty success
`bary_fallback_gs.py <dir>` with a path that does not exist (a typo, the wrong work folder) found no
index.json, built nothing and exited 0 with no output, so it looked like a successful run. It now exits 1
with `<dir>: not a directory`. build_for_index / write_for_index are unchanged: an existing directory
without index.json still means nothing to do.
2026-11-22 16:02:16 +05:30
18ebc2530d fix(shader): preserve vertex cull distances in barycentric helpers
A PS-only geometry helper cannot recover primitive culling from the fragment interface. Use the declared VS array for an explicit pair so fully negative primitives are discarded on the fallback path.
2026-11-22 10:32:31 +01:00
94a29af1fd fix(shader): preserve clip distances in paired barycentric helpers
A geometry shader becomes the last stage before clipping and must forward the producing vertex shader's clip array. Key an explicitly paired helper by the array length so distinct pipelines retain independent clip layouts.
2026-11-22 09:50:42 +01:00
f040a941f7 Translator: --bary-fallback takes the lowest free location, not one past the highest
A PS whose only attribute is attr30 put %bary at Location 31, which Khronos
validation rejects on drivers with 128 fragment input components (found by
@Vonsek on #804). The lowest location no attribute uses is always available
and is 0 there. The corpus is unchanged: the 321 fallback shaders keep
locations 1-5, since their attributes are dense. New semantic test for the
sparse case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SSJXX67xeoorUsLJ2f9zms
2026-11-21 22:28:26 -08:00
4030a386fb Translator: --bary-fallback for raw barycentrics without VK_KHR_fragment_shader_barycentric (SHADER-98)
The 321 pixel shaders that read the raw barycentric pair are translated to
BuiltIn BaryCoordKHR, so they can't run on a device without the extension
(NVIDIA Pascal, for one). With --bary-fallback the pair comes from an
ordinary vec3 input one location past the shader's attributes; the module
needs neither the capability nor the extension, and the index records the
location as bary_fallback_input. tools/bary_fallback_gs.py writes the
pass-through geometry shader that fills it: Position and the PS's inputs
copied unchanged, plus (1,0,0), (0,1,0), (0,0,1) at the three vertices,
whose perspective interpolation is the BaryCoordKHR value.

- LEONIDA_BARY_FALLBACK=1 for build.py, check.py and run_gpu_tests.py
  (like LEONIDA_W64_EMULATE): translate with the flag, build
  <name>.bary_gs.spv, draw those shaders through it.
- vk_harness: VKH_GS_HELPER=1 keeps VKH_SUBGROUP_SIZE on the fragment
  stage when the GS only feeds the pixel shader under test.
- tests/semantic/test_bary_fallback.py and the ps_bary fixture.
- docs/design.md contract row and index key, docs/testing.md section.

GTX 1060 (Pascal): ps_bary 4096/4096 exact, ps_uniform_branch and
ps_scc_mask32 pass with the fallback (SKIP without it). Pixel-shader corpus:
12,101/12,101 translate and pass spirv-val with and without the flag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SSJXX67xeoorUsLJ2f9zms
2026-11-21 22:28:25 -08:00