Patch 15 in the glslang-elimination series. Final batch FS conversion
covering all three remaining texture filter families:
- Bilinear / BilinearBinAlpha (24 blobs)
- JINC2 / JINC2BinAlpha (24 blobs)
- xBR / xBRBinAlpha (24 blobs)
After this lands, every batch FS slot in m_batch_fragment_shaders is
filled from a pre-baked SPIR-V blob; the runtime shadergen path for
batch shaders is gone. The m_shadergen unique_ptr and its
construction in CompilePipelines are removed since they have no
consumers left.
Each filter family shares the same 4-axis structural cube as the
patch-15-Bilinear-prep work that immediately preceded this commit:
- Input interpolation qualifier (none / centroid / sample). 3.
- Color input perspective (standard / noperspective). 2.
- Dual-source output (1 vs 2 outputs). 2.
- PGXP depth output (writes gl_FragDepth or omits it). 2.
3 x 2 x 2 x 2 = 24 blobs per filter family. UV_LIMITS is implicit
for all non-Nearest filter families because ShouldUseUVLimits() in
gpu_hw.cpp forces m_using_uv_limits = true whenever
m_texture_filtering != Nearest. The *BinAlpha variant of each
family collapses into the BINALPHA per-call specialisation constant
(id=110) rather than a structural axis - the only SPIR-V difference
is a single ialpha-quantisation step at the end of
FilteredSampleFromVRAM.
Filter bodies are lifted from gpu_hw_shadergen.cpp WriteBatchTexture-
Filter:
- Bilinear lines ~188-224 (4-tap weighted average)
- JINC2 lines ~229-374 (4x4-tap sinc-windowed with anti-ring)
- xBR lines ~381-661 (5x5 neighbourhood, YCbCr edge
detection with BLEND_NONE / NORMAL /
DOMINANT directions per quadrant)
The xBR template is the largest of the three (~17 KiB per blob in
binary, the body is ~280 lines of GLSL). The translation from the
shadergen DSL is mechanical: float4 -> vec4, lerp -> mix, frac ->
fract, sign -> sign, VECTOR_EQ -> all(equal(...)), VECTOR_NEQ ->
any(notEqual(...)). The P() helper macro on xBR closes over coords
and uv_limits the same way the shadergen original does.
One xBR quirk is preserved verbatim: the Iw flag computation in
shadergen uses VECTOR_NEQ(H, ...) instead of VECTOR_NEQ(I, ...)
which is almost certainly a bug, but the alternative output would
differ visually from the released shadergen path. Preserving it
keeps the embedded-vs-shadergen output byte-identical for compat;
fixing it can be a follow-up patch with its own visual-test cycle.
GetBatchFragmentShader is now a switch on m_texture_filtering with
no fallback: every filter resolves to one of the embedded helpers.
The 'dual_source = ... || filter != Nearest' branch is preserved
verbatim from the shadergen-side derivation.
GenerateBatchFragmentShader and the m_shadergen unique_ptr are no
longer referenced. The construction at CompilePipelines is removed
along with the reset in DestroyPipelines and the declaration in
the header. The 'gpu_hw_shadergen.h' include is dropped from both
gpu_hw_vulkan.cpp and gpu_hw_vulkan.h. shader_compiler.{h,cpp},
dep/glslang/, and the Makefile / CMake glslang references are NOT
removed in this patch - that final cleanup will land separately
once this patch has been confirmed working in the wild, on the
theory that backing it out is easier with the runtime path's
support files still present.
Smoke tests:
- g++ -fsyntax-only on the touched common TU.
- spirv-val --target-env vulkan1.0 on all 72 new blobs: 72/72 valid.
- Total .inc text size for the three filter families: ~9.2 MiB
(Bilinear ~1.4 MiB, JINC2 ~2.6 MiB, xBR ~4.7 MiB). Binary
contribution is ~25% of those numbers, so adding ~2.3 MiB to
the .so. xBR alone is ~1.2 MiB binary contribution; this is the
largest single chunk of pre-baked SPIR-V in the project.
Test priority - this patch covers the actively-rendered path for
users who enable any non-Nearest filter, so:
- **Bilinear / BilinearBinAlpha**: smooth edges on textured
surfaces, slight softening of palette textures. Test by setting
the texture filter core option to Bilinear / Bilinear (BinAlpha).
- **JINC2 / JINC2BinAlpha**: sharper sampling than Bilinear with
visible anti-ringing on textured polygons. Heavier per-pixel
cost; testing on FF8/9 backgrounds, MGS textured screens, etc.
- **xBR / xBRBinAlpha**: pixel-art upscaler, very visible smooth
edges on 2D sprites. Best exercise targets are 2D-heavy games -
Castlevania SOTN, Symphony of the Night, Mega Man X4-6, the
Suikoden series. xBR is the most complex shader in the project
and produces visually-distinctive output that immediately
reveals miscompilation.
- All three families x every precompile mode (Disabled / Lazy /
Enabled) x antialiasing toggle round-trips.
- Cross-check: switch m_texture_filtering at runtime between all
six filter values plus Nearest. Each transition should produce
visibly-correct rendering without intermediate corruption.
After this lands and is confirmed working, the final patch in the
series will remove dep/glslang/, src/common/vulkan/shader_compiler
.{h,cpp}, and the Makefile.libretro / CMakeLists.txt entries that
pull glslang into the link.