Second batch FS template to be pre-baked, after batch_untextured.
Adds the HLSL template + regen recipe + 72 DXBC blobs for the
(texture_mode != GPUTextureMode::Disabled AND m_texture_filter
== GPUTextureFilter::Nearest) slice. No C++ wiring yet - the
activation commit lands next, mirroring the
9e6f933 -> b6d1903 untextured arc.
Variant matrix (post-c532a34 TRANSPARENCY routing):
* Texture mode (6 combos via 3 `-D` macros):
(PALETTE_4_BIT=0, PALETTE_8_BIT=0, RAW_TEXTURE=0): Direct16Bit
(PALETTE_4_BIT=0, PALETTE_8_BIT=0, RAW_TEXTURE=1): RawDirect16Bit
(PALETTE_4_BIT=1, PALETTE_8_BIT=0, RAW_TEXTURE=0): Palette4Bit
(PALETTE_4_BIT=1, PALETTE_8_BIT=0, RAW_TEXTURE=1): RawPalette4Bit
(PALETTE_4_BIT=0, PALETTE_8_BIT=1, RAW_TEXTURE=0): Palette8Bit
(PALETTE_4_BIT=0, PALETTE_8_BIT=1, RAW_TEXTURE=1): RawPalette8Bit
PALETTE_4_BIT and PALETTE_8_BIT are mutually exclusive in the
shadergen #elif chain - no variant has both set. The
Reserved_Direct16Bit / Reserved_RawDirect16Bit enum values fold
to their non-Reserved counterparts at the C++ picker level
(their shader source is identical).
* USE_DUAL_SOURCE (0/1): drives o_col1 declaration + write.
Same axis as untextured (b6d1903).
* INTERP_CENTROID / INTERP_SAMPLE: interp tri-state qualifier.
Same axis as untextured.
* NOPERSP (0/1): `noperspective` on v_col0. Same axis as
untextured.
6 (tex_mode) x 2 (dual) x 3 (interp) x 2 (persp) = 72 blobs. The
MSAA axis (m_multisamples 1/2/4/8/16/32) does NOT multiply this
template - the batch FS samples from the single-sample shadow
VRAM regardless of m_multisamples, so there's no LOAD_TEXTURE_MS
unroll. MSAA only affects the interp qualifier (centroid /
sample), already captured by INTERP_*.
Without c532a34 (TRANSPARENCY -> u_render_mode routing) this
template would have been 6 x 4 x 2 x 3 x 2 = 288 variants on the
[render_mode] axis - 4x bigger. Worth the routing commit.
Files in this commit (74 total, no C++ touched):
data/shaders/d3d12/batch_textured_nearest.ps.hlsl
Hand-translated mirror of shadergen's textured-Nearest output:
BatchUBOData cbuffer, Texture2D + SamplerState bindings at
register t0/s0 (matches m_batch_root_signature - see
CreateRootSignatures in gpu_hw_d3d12.cpp), full
ApplyDithering / ApplyTextureWindow / ApplyUpscaledTextureWindow
/ FloatToIntegerCoords / RGBA8ToRGBA5551 / SampleFromVRAM
helpers, and the main() body with palette / direct / raw /
semitransparent / discard logic. The post-c532a34 runtime
branches on u_render_mode (premultiply, output arms,
OnlyOpaque/OnlyTransparent discards) and u_uv_limits (UV
clamping), u_dithering, u_interlacing, u_pgxp_depth, u_uv_limits
cbuffer scalars are all wired the same way as the Vulkan
template at batch_textured_nearest.frag.glsl.
tools/regen_d3d12_dxbc.py
TEMPLATE_VARIANTS gains a batch_textured_nearest.ps.hlsl entry
with all 72 variant tuples. Variant suffix encoding:
pXrY_d{0,1}_{none,centroid,sample}_n{0,1} where X is the
palette mode digit (4 / 8 / 0), Y is RawTextureBit, the d/n
digits encode the dual_source / nopersp bits, and the interp
word names the qualifier.
src/common/d3d12/embedded_dxbc/batch_textured_nearest_ps_*.inc
72 new .inc files, ~2592 KiB total on disk, ~400 KiB embedded
DXBC in the .so. Per-variant DXBC sizes range from 4132 bytes
(RawDirect16Bit + no dual + no qual) to 6656 bytes
(Palette8Bit + dual + centroid + nopersp); average ~5500
bytes. The raw variants are smaller because RAW_TEXTURE=1
skips the colour-modulation path; the palette variants are
larger because they unroll the index extraction + palette
sample.
What does NOT change in this commit:
- GPU_HW_D3D12::GetBatchPipeline still calls
GetBatchFragmentShader for textured slices, which runs
shadergen + D3DCompile. The 72 pre-baked Nearest blobs are
not yet consulted - they sit on disk waiting for the
activation commit (parallel to b6d1903 for untextured).
- src/common/d3d12/embedded_shaders.{h,cpp} untouched here -
they need 72 new extern declarations / includes to actually
surface the .inc blob symbols to the C++ linker, but adding
those without C++ consumers would yield -Wunused warnings
that the build flags treat as errors. Both land together in
the activation commit.
- m_texture_filter == Nearest sessions still go through
D3DCompile until the activation commit lands. The picker
function PickBatchUntexturedFSBytecode (gpu_hw_d3d12.cpp) is
untouched - the textured analogue lands with the activation.
Test:
- python3 tools/regen_d3d12_dxbc.py --fxc /tmp/fxc_lite/fxc_lite.exe
--wine /usr/bin/wine: 88 .inc files generated, 72 of which are
the new batch_textured_nearest_ps_* set. Build clean across all
72 variants - no fxc warnings or errors on any combination.
- Hand-compile of representative variants
(PALETTE_4_BIT=1 / PALETTE_8_BIT=1 / RAW_TEXTURE=1 / dual /
INTERP_SAMPLE / NOPERSP combos): all produce valid DXBC
blobs at expected sizes.
Cumulative pre-bake variant count progress for D3D12 batch FS:
Pre-arc: 75 264 (every axis a -D)
Post-cbuffer-routing of:
DITHERING/INTERLACING/UV_LIMITS/PGXP_DEPTH 4 704
Post-c532a34 (TRANSPARENCY -> u_render_mode) 1 176
Post-c01f8ae (untextured re-bake, slice live) 12 baked
Post-this-commit (Nearest .inc on disk):
Untextured slice (live): 12
Nearest slice (on disk): 72
Remaining filters (Bilinear/JINC2/xBR): 3 templates x 72 = 216
Next:
- Activation: 144 new extern decls + 72 new #includes in
embedded_shaders.{h,cpp}, plus a PickBatchNearestFSBytecode-
style helper in gpu_hw_d3d12.cpp and the GetBatchPipeline
branch that routes m_texture_filter == Nearest +
texture_mode != Disabled to the new picker. Parallel to
b6d1903 for untextured.
- Then the remaining 3 textured filter templates (Bilinear /
JINC2 / xBR) each as a foundation + activation pair.