"""SHADER-644: packed VS ISG1 elements that share a register. The fetch-call path replaces a driver fetch with one vec4 Vulkan input per ISG1 register. Two elements in the same register (for example xy and zw) must not create two OpVariable declarations with the same name. Run from the repository root: python -m pytest tests/test_vs_packed_inputs.py Every shader and DXBC container here is synthetic; no game data is used. """ import re import struct import pytest import rdna2spirv from conftest import make_dxbc, requires_tools pytestmark = requires_tools # s_swappc_b64 marks the driver fetch. All eight components of registers 0 and 1 # are read before being written, matching two ISG1 elements in register 0. VS_PACKED = """ s_swappc_b64 s[4:5], s[4:5] v_add_f32 v1, v4, v5 v_add_f32 v2, v6, v7 exp pos0 v1, v2, v1, v1 done exp param0 v4, v5, v6, v7 s_endpgm """ VS_TWO_REGISTERS = """ s_swappc_b64 s[4:5], s[4:5] v_add_f32 v1, v4, v8 v_add_f32 v2, v7, v11 exp pos0 v1, v2, v1, v1 done exp param0 v4, v5, v6, v7 exp param1 v8, v9, v10, v11 s_endpgm """ def isg1(elements): """ISG1 chunk: elements are (register, system value, component mask, component type).""" payload = bytearray(struct.pack("