TsundereStation/data
LibretroAdmin da20f5b80e Revert "core/d3d12: pre-bake the VRAM copy pixel shader"
This reverts commit cd971cd. The pre-baked DXBC blob causes
CreateGraphicsPipelineState to fail with E_FAIL (0x80004005)
during D3D12 backend Initialize, falling back to software
renderer. Confirmed by Lib's screenshot + log output:

  [libretro INFO] [GPU_HW_D3D12] Max texture size: 16384x16384
  [libretro INFO] [GPU_HW_D3D12] Dual-source blend: supported
  [libretro INFO] [GPU_HW_D3D12] Per-sample shading: supported
  [libretro INFO] [GPU_HW_D3D12] Max multisamples: 8
  [libretro ERROR] [GetPipelineState] CreateGraphicsPipelineState failed: 80004005
  [libretro ERROR] [Initialize] Failed to compile pipelines

Root cause is in the wine + vkd3d-shader compilation path used to
produce vram_copy_ps_pgxp{0,1}.inc. Inspecting the DXBC reveals
vkd3d-shader (vkd3d-shader 1.10 Wine bundled) strips the
SamplerState samp0_ss declaration from the RDEF chunk because the
shader uses .Load() not .Sample() so samp0_ss is unused:

  copy_ps.inc RDEF: 3 bindings (samp0_ss, samp0, UBOBlock) - works
  vram_copy_ps_pgxp0.inc RDEF: 2 bindings (samp0, UBOBlock) - fails

This SHOULD be fine since D3D12 allows the shader to use a subset
of the root signature's resource bindings. But the Microsoft D3D12
runtime rejects this particular blob at PSO creation - likely
some other metadata mismatch (SHEX vs SHDR chunk format, missing
STAT chunk, or vkd3d-shader emitting SV_Depth / discard in a form
Microsoft's runtime won't accept). Without D3D12 debug-layer
messages it's hard to localize further.

copy_ps and fullscreen_quad_vs (both Wine-compiled) work in
production, so vkd3d-shader output is not universally
incompatible - it's specific to this shader's combination of
features (SV_Depth output + discard + larger cbuffer + bool
member + uint arithmetic).

For future pre-bakes of more complex shaders, the .inc files
should be regenerated using the Microsoft fxc.exe from a Windows
10/11 SDK (running natively on Windows or under Wine - Microsoft's
fxc.exe is an x86 PE binary that runs fine under Wine, no
vkd3d-shader reimplementation in the path). The current
fullscreen_quad_vs + copy_ps blobs landed with vkd3d-shader
because they're simple enough that the resulting bytecode passes
PSO validation; vram_copy_ps is the threshold case where it
doesn't.

Next pre-bake attempt should:
  1. Switch tools/regen_d3d12_dxbc.py to prefer Microsoft fxc.exe
     by default (Wine prefix lookup + WINEPREFIX environment),
     fall back to fxc_lite only when explicitly asked.
  2. Regenerate fullscreen_quad_vs + copy_ps with Microsoft fxc
     (to confirm byte-different output - and to lock in a known-
     working reference for diff comparison when adding new
     pre-baked shaders).
  3. Then redo vram_copy_ps with Microsoft fxc; expect to land
     it with no other changes needed.

The non-batch RESOLUTION_SCALE cbuffer refactor arc (e56d4d4,
9d2b49d, 2980961, e64fc28) is unaffected by this revert - those
commits don't touch any pre-baked blobs, just route u_resolution_scale
through cbuffers. The pre-bake follow-ups can resume once the
fxc.exe toolchain is in place.
2026-05-18 21:57:44 +02:00
..
shaders Revert "core/d3d12: pre-bake the VRAM copy pixel shader" 2026-05-18 21:57:44 +02:00