Files
mandy/tests/semantic/test_perm_known_selector.py
ItsNotRexed dac28e6b19 Fix what the round-42 merges broke (tests and docs)
- shader_disasm: prune stale listings against every input, not the --skip-existing remainder (a resumed run
  deleted every listing it had just reused).
- progress_dashboard: a drive-letter path is never inside the repository off Windows (it printed user names);
  its own read_text helper is read_utf8, so the encoding check does not take it for pathlib's.
- Translator tests follow this round's rules: desc_lookup's BroadcastFirst in the typed-load condition walker;
  resinfo sizes are 0 past the last level and a 2D depth word is 0 (SHADER-388); SHADER-315 constant folding in
  the perm and i16 tests; #2089's structured wave64 emulation.
- test_semantic_translator_use: 57 oracle-only files merged before it are DEBT; test_spirv_tools_required is
  allowed (CI meta-test).
- Test fixes: image_fuzz fake writes the programs, preflight follows c506d00c's loader hint rule, feature_scan
  reads the first line of a pytest-decorated message, w64_graphics wording.
- docs: rows merged again in design.md, README.md, d3d12_vulkan.md; GameInput table rebuilt from #3172's rows;
  orphan rows in models.md and embedded_shaders.md; repeated bullets; anchors; a flag not on main.
- Repo rules: stdout guard on 14 programs; LF writes; csv lineterminator in bink_play.

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

30 lines
1.2 KiB
Python

"""Constant byte selectors use direct extracts; a clobbered SGPR uses the dynamic path."""
import sys
import unittest
from pathlib import Path
sys.path.insert(0, str(Path(__file__).resolve().parent))
from support import mrt0_words, translate_lines # noqa: E402
class PermKnownSelectorTests(unittest.TestCase):
@classmethod
def setUpClass(cls):
fixture = Path(__file__).with_name("fixtures") / "perm_known_selector.asm"
lines = [line for line in fixture.read_text(encoding="ascii").splitlines()
if line and not line.startswith(";")]
cls.spvasm = translate_lines("ps_perm_known_selector", lines)
def test_selector_values(self):
self.assertEqual(mrt0_words(self.spvasm), [0xFF008C80, 0xFF0000FF, 0x80808080, 0x13E49B80])
def test_only_clobbered_selector_dispatches_at_runtime(self):
# The dynamic lowering emits one >= 13 check per byte, at most for the one clobbered selector; since SHADER-315
# folds scalar ALU on constants, the clobbered selector is known at translate time too and none is emitted.
# test_selector_values still checks every word.
self.assertIn(self.spvasm.count("OpUGreaterThanEqual"), (0, 4))
if __name__ == "__main__":
unittest.main()