Skip to content

shader: use named register codes in gfx1013_sampled_pixel.cpp - #3905

Merged
R0Y00 merged 2 commits into
R0Y00:mainfrom
Leyukaka:quality-item2-s3-sampled-pixel
Dec 3, 2026
Merged

R0Y00 merged 2 commits into
R0Y00:mainfrom
Leyukaka:quality-item2-s3-sampled-pixel

Conversation

@Leyukaka

@Leyukaka Leyukaka commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator

Problem

src/gfx1013_sampled_pixel.cpp still writes operands as bare numbers: 128, 192, 193 and 208 for the inline integer bounds, 255 for the literal, 256 for the first VGPR operand and 124 for M0. #3830 added src/gfx1013_registers.h to keep the register code, operand and translator slot meanings apart, and #3901 converted gfx1013_graphics_wqm.inl.

Change

This is the third slice. No behaviour change.

  • a206c48b9 uses the constants from gfx1013_registers.h in src/gfx1013_sampled_pixel.cpp (+14/-11, one file). The substitution is textual and the values and types are unchanged, so the emitted HLSL and the refusal text are unchanged.
  • The file is its own translation unit outside namespace x2w, so it includes the header and adds namespace gfx1013 = x2w::gfx1013; inside its anonymous namespace. The uses then read gfx1013::operand::... and gfx1013::reg::m0, as in the earlier slices.
  • Left numeric:
    • the float constant range 240..247 and its table index index-240. The header's float_last is 248 (1/(2*pi)), which this translator does not accept, so naming only the lower bound would leave the range half-converted.
    • 256 as the VGPR file size (the array size and the destination bound) and addr<255. These are counts, not operand codes.
    • the 256+addr / 257+addr coordinate pair, 192u-index, decode masks, opcodes and HLSL text.
  • The five mutation anchors in tests/cmake/gfx1013_sampled_pixel.cmake (the string(REPLACE ...) sources) target lines this change does not touch.
  • No build change. gfx1013_registers.h is header-only and already in src.

Validation

Built on Windows with MSVC, head a206c48b9 on main b6171650f. The targeted set passed 68/68:

  • gfx1013_sampled_pixel_all and the gfx1013_sampled_pixel_* cases, which pin the generated HLSL and the refusal reasons.
  • The five mutation controls among them (*_mut, WILL_FAIL) still fail as expected, so the anchors still apply.
  • native_sampled_replay, native_sampled_pixel_warp and native_indexed_pixel_texture_warp.
  • native_translator_corpus_dxil and native_translator_corpus_ir.

Translator corpus: the TSV built from main b6171650f and the TSV built from this branch have the same SHA-256, so they are byte-identical.

Each replaced site was also read a second time against the header to confirm the same value, type and meaning.

Other open PRs

No open PR edits gfx1013_sampled_pixel.cpp. The next files in the plan, the gfx1013_direct_*.inl frontends (graphics, compute, mesh), are each edited by 12 to 15 open PRs, so they will follow once that work lands.

Replace the magic register and operand numbers in
src/gfx1013_sampled_pixel.cpp with the constants from
src/gfx1013_registers.h: M0 (124), the inline integer bounds (128, 192,
193, 208), the literal operand (255) and the VGPR operand base (256).
The file now includes the header and aliases x2w::gfx1013 inside its
anonymous namespace. The substitution is textual and the values and
types are unchanged, so the generated HLSL and bindings are
byte-identical. Left as they are: the float constant range 240..247 and
its table index (the header's float_last is 248), 192u - index, the
VGPR file size 256 (array size and destination bound), addr < 255, the
256 + addr / 257 + addr coordinate pair, decode masks, opcodes and HLSL
text. The mutation anchors in tests/cmake/gfx1013_sampled_pixel.cmake
are untouched.

@R0Y00 R0Y00 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independently reviewed e9d9b96. Each named register/operand code matches the previous numeric boundary and the scalar, literal, and VGPR paths keep the old behavior. MSVC Debug ctest --preset dev --no-tests=error -j 1 -R '^(gfx1013_sampled_pixel_all|shader_compile_sampled_pixel_cli_check|native_sampled_pixel_(warp|hardware))$' passed 4/4 in two serial selections on Windows 11 build 26300, WARP and RTX 4060 Laptop (616.56). Changing the lower negative bound to exclusive survived the default tests. With the existing dead scalar move changed locally from selector 200 to the first negative selector 193, the head passed and the mutant refused at byte 60. Both local edits were reverted and the original unit suite passed again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants