Patch 9 in the glslang-elimination series. The display FS is the
densest shader in the project - shadergen takes depth_24bit (bool) x
interlace_mode (None/InterleavedFields/SeparateFields) x smooth_chroma
(bool) source variants, and the source m_vram_texture's sample count
varies with MSAA on top of that. The depth_24bit / interlace_mode pair
is the only knob set that varies at runtime within a session
(GPUSTAT.display_area_color_depth_24 and the CRTC interlace mode flip
during normal gameplay); smooth_chroma, MSAA, and RESOLUTION_SCALE are
all session-constant (toggling any of them goes through UpdateSettings
-> DestroyPipelines).
Shader converted:
DisplayFragmentShader. Reads the upscaled m_vram_texture, applies
field-discard for interlaced output, and writes the visible scanout
rectangle to m_display_texture - either as direct 16bpp samples or as
reconstructed 24bpp YUV-smoothed colour depending on the GPUSTAT bit.
Blobs:
display_fs - source sampler is sampler2D (non-MSAA path).
display_msaa_fs - source sampler is sampler2DMS, plus an extra
MULTISAMPLES spec constant for the LoadVRAM
averaging loop bound.
Common spec constants on both blobs:
id = 0 RESOLUTION_SCALE (uint) - common-knob convention.
id = 100 DEPTH_24BIT (bool) - 16bpp vs 24bpp reconstruction.
id = 101 INTERLACED (bool) - field-discard logic gate.
id = 102 INTERLEAVED (bool) - only meaningful when INTERLACED.
Selects interleaved-both-fields
coord folding vs separate-field.
id = 103 SMOOTH_CHROMA (bool) - only meaningful when DEPTH_24BIT.
Enables bilinear UV smoothing.
MSAA blob adds:
id = 1 MULTISAMPLES (uint) - common-knob convention.
The m_display_pipelines[depth_24][interlace_mode] 2x3 slot table is
preserved; each entry gets its own spec-const-specialised pipeline at
first-touch, like the VRAM fill pattern. interlace_mode is folded into
INTERLACED / INTERLEAVED at the call site:
None -> INTERLACED=false, INTERLEAVED=* (INTERLEAVED
irrelevant when
INTERLACED is
false)
InterleavedFields -> INTERLACED=true, INTERLEAVED=true
SeparateFields -> INTERLACED=true, INTERLEAVED=false
The render target (m_display_texture) is always single-sample at this
stage (line 1114 hardcodes VK_SAMPLE_COUNT_1_BIT regardless of MSAA);
the pipeline's multisample state is therefore single-sample on both
blobs, matching the original which did not call SetMultisamples either.
The MSAA-ness lives entirely in the input sampler type and the LoadVRAM
loop on the MSAA blob.
Bindings unchanged: push_constant for the UBO, set=0 binding=1 for the
source sampler, matching m_single_sampler_pipeline_layout.
The fixYCoord call from the original shadergen is dropped because the
Vulkan-side fixYCoord is the identity function (PSX VRAM Y matches
Vulkan Y); removing it spares a redundant function definition. The
GLSL-side helper macros (float4 / uint2 / etc) from WriteHeader are
also dropped since the .glsl files only need to work for Vulkan and
GLSL-native types are clearer than HLSL-style aliases.
Smoke tests:
- g++ -fsyntax-only on the touched common TU.
- spirv-val --target-env vulkan1.0 on both blobs (2391 / 2535
words, 9.5K / 9.9K).
- --target-env vulkan1.0 vs un-flagged glslangValidator: byte-
identical SPIR-V for both blobs.
Like VRAM fill / copy / write, the display pipeline is built on its
own first-touch path and is not on the UpdateSettings SSAA-toggle
hot-build path. shader_precompile=Disabled is expected to behave
identically to Enabled / Lazy.
Test priority:
- shader_precompile=Enabled / Lazy: routine smoke (any game).
- shader_precompile=Disabled: any game that flips interlace_mode
during gameplay (interlaced cutscenes -> progressive gameplay
transitions) or that toggles 24bpp display mode (FMV intros in
most JRPGs). Smooth-chroma path is exercised by enabling the
Chroma Smoothing 24-bit option in the core options and watching
an FMV. Worth doing a coarse SSAA round-trip too even though the
display pipeline shouldn't be sensitive to it.