core/d3d12: pre-bake the VRAM write pixel shader

Same template as cb4b443 (vram_copy pre-bake), applied to vram_write_ps.
vram_write_ps is the CPU->VRAM upload path - hit on every game's
framebuffer streaming and FMV staging path, so it runs many times
per frame in practice. Pre-baking it removes another D3DCompile
from cold-flips and another path that's exposed to shader-cache
invalidation.

Variant axis: PGXP_DEPTH on/off only (2 blobs). The shadergen's
`use_ssbo` parameter is GLSL/Vulkan-only - the D3D12 caller at
GPU_HW_D3D12::GetVRAMWritePipeline always passes `false`, so the
use_ssbo dimension collapses to a single value for D3D12 and only
the texture-buffer source path (Buffer<uint4> samp0) gets pre-baked.

Files added:

* data/shaders/d3d12/vram_write.ps.hlsl: standalone HLSL source
  matching GenerateVRAMWriteFragmentShader(false)'s D3D12 output
  post-9d2b49d. 44-byte cbuffer member-for-member identical to
  VRAMWriteUBOData (u_base_coords, u_end_coords, u_size,
  u_buffer_base_offset, u_mask_or_bits, u_depth_value,
  u_resolution_scale, u_pad0). VRAM_SIZE / RESOLUTION_SCALE aliases
  inlined. RGBA5551ToRGBA8 helper inlined (no shadergen prelude
  available to standalone HLSL). PGXP_DEPTH branch in body controls
  the o_depth assignment.

* src/common/d3d12/embedded_dxbc/vram_write_ps_pgxp0.inc: DXBC for
  /DPGXP_DEPTH=0 (PGXP off, conditional o_depth). 2048 bytes.
* src/common/d3d12/embedded_dxbc/vram_write_ps_pgxp1.inc: DXBC for
  /DPGXP_DEPTH=1 (PGXP on, o_depth = 1.0). 2028 bytes.

Both built with Microsoft fxc via Wine + d3dcompiler_47.dll - full
RDEF/ISGN/OSGN/SHEX/STAT chunk set, creator stamped "Microsoft (R)
HLSL Shader Compiler 10.1". Validator (check_microsoft_creator in
tools/regen_d3d12_dxbc.py) passes both.

Files modified:

* tools/regen_d3d12_dxbc.py: TEMPLATE_VARIANTS gains the
  vram_write.ps.hlsl entry with two rows (pgxp0, pgxp1). Same
  shape as the vram_copy entry.

* src/common/d3d12/embedded_shaders.h: extern declarations added
  for the two new blobs and their size constants. Header docblock
  explains the use_ssbo collapse.

* src/common/d3d12/embedded_shaders.cpp: two #include lines for
  the new .inc files, inside namespace D3D12::EmbeddedShaders.

* src/core/gpu_hw_d3d12.cpp GetVRAMWritePipeline: shadergen call +
  m_shader_cache.GetPixelShader path replaced with an inline
  D3D12_SHADER_BYTECODE picked via m_pgxp_depth_buffer. PSO build
  downstream is unchanged (same root signature, MSAA, depth state,
  shader-cache PSO disk-cache via gpbuilder.Create). The
  m_shadergen-not-yet-built check is dropped for this path since
  the embedded blob is statically linked.

Cost matrix delta (D3D12) for vram_write_ps:
  Cold-flip PGXP toggle: ~50 ms x 2 D3DCompile + ~10 ms x 2 PSO
                         -> ~10 ms x 2 PSO only.
  Disk-cache-warm: ~1 ms each -> 0 ms.
  Resolution scale: 0 ms (already cbuffer-routed since 9d2b49d).

The shadergen GenerateVRAMWriteFragmentShader function is left
intact in gpu_hw_shadergen.cpp - the other three backends still
call it through their runtime shader-cache paths. Only D3D12
bypasses it now.

Test:
  - Build: D3D12 backend links without unresolved symbols.
  - Runtime: every VRAM upload that previously worked must still
    work. Concrete test: any game's pre-rendered backdrop streaming
    (FF7 entering new screens, MGS pre-rendered cutscene backdrops),
    any FMV playback (Sony intro bookend, in-game cutscenes), and
    any sprite-page reload (fighting-game character select). If
    the embedded blob were wrong, framebuffer uploads would land
    at wrong VRAM offsets and produce visible texture garble
    within seconds of any of those activities.
  - PGXP toggle: flip the "PGXP CPU mode" core option in RetroArch.
    First flip rebuilds PSOs picking blob[1] vs blob[0]; subsequent
    same-direction flips hit the PSO cache.
  - Resolution scale toggle 1x <-> 4x: no PSO recompile (blob is
    scale-independent post-9d2b49d); next CPU->VRAM upload pushes
    a different u_resolution_scale through the cbuffer.

Next per the same template now that the toolchain is trusted and
the pattern is established: vram_fill_ps (8 variants on PGXP x
WRAPPED x INTERLACED, no scale-refactor needed - body doesn't
reference RESOLUTION_SCALE for D3D12 mode), vram_update_depth_ps
(2 MSAA variants - first MSAA texture-binding variant exercise),
vram_read_ps (M MSAA variants - on top of the e64fc28-line
cbuffer routing already done).
This commit is contained in:
LibretroAdmin 2026-05-18 21:04:21 +00:00 • committed by U-DESKTOP-SPFP6AQ\twistedtechre
commit ba013aa6de
7 changed files with 431 additions and 9 deletions

View file

@ -0,0 +1,113 @@
// Pre-baked VRAM write pixel shader for the D3D12 backend.
//
// Equivalent to GPU_HW_ShaderGen::GenerateVRAMWriteFragmentShader(false)
// in src/core/gpu_hw_shadergen.cpp. Used by GPU_HW_D3D12::GetVRAMWritePipeline
// for the CPU->VRAM upload path - this is hit on every game's
// framebuffer streaming (pre-rendered backgrounds in FF7, FMV decode
// staging, sprite-page reloads in fighting games, etc., so it runs
// many times per frame in practice).
//
// Variant axis: PGXP_DEPTH = 0 or 1. PGXP-depth disabled / enabled -
// the runtime m_pgxp_depth_buffer toggle. Two .inc blobs:
// vram_write_ps_pgxp0.inc (PGXP_DEPTH = 0)
// vram_write_ps_pgxp1.inc (PGXP_DEPTH = 1)
//
// use_ssbo: the shadergen path takes a `bool use_ssbo` parameter, but
// the D3D12 caller always passes `false` (HLSL has no direct SSBO
// equivalent; the shadergen's use_ssbo=true branch is GLSL/Vulkan-only).
// So the D3D12 pre-bake only covers the texture-buffer path
// (Buffer<uint4> samp0), and the use_ssbo dimension collapses to a
// single value here.
//
// RESOLUTION_SCALE / VRAM_SIZE derive at runtime from u_resolution_scale
// in the cbuffer below (post-9d2b49d refactor). Same DXBC serves
// every resolution-scale value.
cbuffer UBOBlock : register(b0)
{
// 44-byte cbuffer. C++ side is GPU_HW::VRAMWriteUBOData (gpu_hw.h);
// the field order here MUST match the struct member order there.
uint2 u_base_coords;
uint2 u_end_coords;
uint2 u_size;
uint u_buffer_base_offset;
uint u_mask_or_bits;
float u_depth_value;
uint u_resolution_scale;
uint u_pad0;
};
// VRAM_SIZE / RESOLUTION_SCALE derive from u_resolution_scale - mirrors
// the WriteCBufferResolutionScaleAliases helper's #define output in
// gpu_hw_shadergen.cpp.
#define RESOLUTION_SCALE u_resolution_scale
#define VRAM_SIZE (uint2(1024u, 512u) * u_resolution_scale)
// Texture-buffer source for the CPU upload data. PSX VRAM writes are
// 16-bit RGBA5551 packed into the texel buffer; the shader does
// per-pixel address arithmetic + RGBA5551 -> RGBA8 conversion below.
// `Buffer<uint4>` here matches what shadergen.cpp's DeclareTextureBuffer
// emits for HLSL when is_int=true / is_unsigned=true.
Buffer<uint4> samp0 : register(t0);
// RGBA5551 -> RGBA8 unpack. PSX 16-bit colour layout (bits 0-4 R,
// 5-9 G, 10-14 B, 15 alpha/mask). Identical to the helper inlined by
// WriteCommonFunctions in the shadergen path.
float4 RGBA5551ToRGBA8(uint v)
{
uint r = (v & 31u);
uint g = ((v >> 5) & 31u);
uint b = ((v >> 10) & 31u);
uint a = ((v >> 15) & 1u);
return float4(float(r) / 31.0, float(g) / 31.0, float(b) / 31.0, float(a));
}
void main(
in float2 v_tex0 : TEXCOORD0,
in float4 v_pos : SV_Position,
out float o_depth : SV_Depth,
out float4 o_col0 : SV_Target0)
{
// Map upscaled framebuffer pixel back to native VRAM coord. The
// runtime sets the viewport in upscaled VRAM space; the divide by
// RESOLUTION_SCALE collapses N upscaled pixels into one native one
// so the texture-buffer lookup uses native VRAM addressing.
uint2 coords = uint2(uint(v_pos.x) / RESOLUTION_SCALE,
uint(v_pos.y) / RESOLUTION_SCALE);
// Discard out-of-range pixels. Same wrap-around-rect logic as
// vram_copy: (coord < base) && (coord >= end) means the pixel sits
// outside both halves of a wrapped rect.
if ((coords.x < u_base_coords.x && coords.x >= u_end_coords.x) ||
(coords.y < u_base_coords.y && coords.y >= u_end_coords.y))
{
discard;
}
// Offset from the start of the rect, with native-VRAM wrap-around
// handling on each axis. (VRAM_SIZE.x / RESOLUTION_SCALE) is just
// 1024 in native coords; written this way to match the shadergen
// body byte-for-byte so the optimization opportunities are
// identical.
uint2 offset;
offset.x = (coords.x < u_base_coords.x)
? ((VRAM_SIZE.x / RESOLUTION_SCALE) - u_base_coords.x + coords.x)
: (coords.x - u_base_coords.x);
offset.y = (coords.y < u_base_coords.y)
? ((VRAM_SIZE.y / RESOLUTION_SCALE) - u_base_coords.y + coords.y)
: (coords.y - u_base_coords.y);
// Linearise (offset.x, offset.y) into a 1-D buffer index, fetch the
// 16-bit texel from the upload buffer, OR in the mask bit, unpack
// to RGBA8.
uint buffer_offset = u_buffer_base_offset + (offset.y * u_size.x) + offset.x;
uint value = samp0.Load(int(buffer_offset)).r | u_mask_or_bits;
o_col0 = RGBA5551ToRGBA8(value);
#if PGXP_DEPTH
o_depth = 1.0;
#else
o_depth = (o_col0.a == 1.0) ? u_depth_value : 0.0;
#endif
}

View file

@ -0,0 +1,139 @@
// Autogenerated from data/shaders/d3d12/vram_write.ps.hlsl.
// DO NOT EDIT. Regenerate with tools/regen_d3d12_dxbc.py.
// fxc /T ps_5_0 /E main /O3 /DPGXP_DEPTH=0
//
// Included inside namespace D3D12::EmbeddedShaders in
// embedded_shaders.cpp. The matching extern declaration lives in
// embedded_shaders.h.
const uint8_t k_vram_write_ps_pgxp0[] = {
0x44, 0x58, 0x42, 0x43, 0x2f, 0x3f, 0x6d, 0x99, 0x10, 0x77, 0xc5, 0x24, 0xcd, 0xb2, 0xd8, 0x90,
0xc3, 0xf0, 0xd2, 0x4f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
0x34, 0x00, 0x00, 0x00, 0x38, 0x03, 0x00, 0x00, 0x90, 0x03, 0x00, 0x00, 0xe4, 0x03, 0x00, 0x00,
0x64, 0x07, 0x00, 0x00, 0x52, 0x44, 0x45, 0x46, 0xfc, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x8c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x05, 0xff, 0xff,
0x00, 0x81, 0x00, 0x00, 0xd2, 0x02, 0x00, 0x00, 0x52, 0x44, 0x31, 0x31, 0x3c, 0x00, 0x00, 0x00,
0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00,
0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x73, 0x61, 0x6d, 0x70, 0x30, 0x00, 0x55, 0x42,
0x4f, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x00, 0xab, 0x82, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
0xa4, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xe4, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0xf8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x02, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xf8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
0x29, 0x02, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0xf8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x30, 0x02, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x4c, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
0x70, 0x02, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x4c, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x02, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x94, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
0xb8, 0x02, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x4c, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xcb, 0x02, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4c, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
0x75, 0x5f, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x73, 0x00, 0x75, 0x69,
0x6e, 0x74, 0x32, 0x00, 0x01, 0x00, 0x13, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf2, 0x01, 0x00, 0x00, 0x75, 0x5f, 0x65, 0x6e, 0x64, 0x5f, 0x63, 0x6f,
0x6f, 0x72, 0x64, 0x73, 0x00, 0x75, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x00, 0x75, 0x5f, 0x62, 0x75,
0x66, 0x66, 0x65, 0x72, 0x5f, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74,
0x00, 0x64, 0x77, 0x6f, 0x72, 0x64, 0x00, 0xab, 0x00, 0x00, 0x13, 0x00, 0x01, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x02, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x61,
0x73, 0x6b, 0x5f, 0x6f, 0x72, 0x5f, 0x62, 0x69, 0x74, 0x73, 0x00, 0x75, 0x5f, 0x64, 0x65, 0x70,
0x74, 0x68, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x00, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x00, 0xab,
0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x8d, 0x02, 0x00, 0x00, 0x75, 0x5f, 0x72, 0x65, 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x69, 0x6f, 0x6e,
0x5f, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x00, 0x75, 0x5f, 0x70, 0x61, 0x64, 0x30, 0x00, 0x4d, 0x69,
0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c,
0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72,
0x20, 0x31, 0x30, 0x2e, 0x31, 0x00, 0xab, 0xab, 0x49, 0x53, 0x47, 0x4e, 0x50, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x0f, 0x03, 0x00, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44,
0x00, 0x53, 0x56, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0xab, 0xab, 0xab,
0x4f, 0x53, 0x47, 0x4e, 0x4c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x0e, 0x00, 0x00,
0x53, 0x56, 0x5f, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x00, 0x53, 0x56, 0x5f, 0x44, 0x65, 0x70,
0x74, 0x68, 0x00, 0xab, 0x53, 0x48, 0x45, 0x58, 0x78, 0x03, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00,
0xde, 0x00, 0x00, 0x00, 0x6a, 0x08, 0x00, 0x01, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, 0x20, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x58, 0x08, 0x00, 0x04, 0x00, 0x70, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x00, 0x00, 0x64, 0x20, 0x00, 0x04, 0x32, 0x10, 0x10, 0x00,
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x02, 0x01, 0xc0, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02,
0x02, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x05, 0x32, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x46, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x00, 0x09, 0x32, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x00, 0x00, 0x46, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x56, 0x85, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x08,
0xc2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x04, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x06, 0x84, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x08,
0x32, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0xe6, 0x8a, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x07,
0x32, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0xe6, 0x0a, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x46, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x07, 0x12, 0x00, 0x10, 0x00,
0x01, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x10, 0x00,
0x01, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x04, 0x03, 0x0a, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00,
0x29, 0x00, 0x00, 0x0b, 0x32, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x56, 0x85, 0x20, 0x00,
0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00,
0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x00, 0x09,
0x32, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x00, 0x00, 0x46, 0x00, 0x10, 0x00,
0x01, 0x00, 0x00, 0x00, 0x56, 0x85, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x1e, 0x00, 0x00, 0x09, 0x32, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x00, 0x10, 0x00,
0x01, 0x00, 0x00, 0x00, 0x46, 0x80, 0x20, 0x80, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x07, 0x32, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00,
0x46, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00,
0x1e, 0x00, 0x00, 0x09, 0x32, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x46, 0x80, 0x20, 0x80, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x09, 0x32, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0xe6, 0x0a, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00,
0x46, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x0b, 0x22, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x80, 0x20, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2a, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x07, 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x2d, 0x00, 0x00, 0x89, 0x42, 0x00, 0x00, 0x80, 0x03, 0x11, 0x11, 0x00, 0x12, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x08, 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x07, 0x22, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00,
0x8a, 0x00, 0x00, 0x0f, 0xd2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00,
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x02, 0x40, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00,
0x0f, 0x00, 0x00, 0x00, 0x06, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x00, 0x00, 0x05,
0x22, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x38, 0x00, 0x00, 0x07, 0x12, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x08, 0x21, 0x04, 0x3d, 0x56, 0x00, 0x00, 0x05,
0x72, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0x03, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x18, 0x00, 0x00, 0x07, 0x82, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x07,
0x01, 0xc0, 0x00, 0x00, 0x3a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x80, 0x20, 0x00,
0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x0a, 0xe2, 0x20, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x06, 0x09, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x08, 0x21, 0x04, 0x3d, 0x08, 0x21, 0x04, 0x3d, 0x00, 0x00, 0x80, 0x3f,
0x3e, 0x00, 0x00, 0x01, 0x53, 0x54, 0x41, 0x54, 0x94, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x06, 0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
const size_t k_vram_write_ps_pgxp0_size_bytes = sizeof(k_vram_write_ps_pgxp0);

View file

@ -0,0 +1,138 @@
// Autogenerated from data/shaders/d3d12/vram_write.ps.hlsl.
// DO NOT EDIT. Regenerate with tools/regen_d3d12_dxbc.py.
// fxc /T ps_5_0 /E main /O3 /DPGXP_DEPTH=1
//
// Included inside namespace D3D12::EmbeddedShaders in
// embedded_shaders.cpp. The matching extern declaration lives in
// embedded_shaders.h.
const uint8_t k_vram_write_ps_pgxp1[] = {
0x44, 0x58, 0x42, 0x43, 0xda, 0x9c, 0x4d, 0x09, 0x39, 0xfa, 0xa4, 0xe1, 0xce, 0xca, 0xab, 0x51,
0x76, 0xca, 0x2c, 0x7f, 0x01, 0x00, 0x00, 0x00, 0xec, 0x07, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
0x34, 0x00, 0x00, 0x00, 0x38, 0x03, 0x00, 0x00, 0x90, 0x03, 0x00, 0x00, 0xe4, 0x03, 0x00, 0x00,
0x50, 0x07, 0x00, 0x00, 0x52, 0x44, 0x45, 0x46, 0xfc, 0x02, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x8c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x05, 0xff, 0xff,
0x00, 0x81, 0x00, 0x00, 0xd2, 0x02, 0x00, 0x00, 0x52, 0x44, 0x31, 0x31, 0x3c, 0x00, 0x00, 0x00,
0x18, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00,
0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x73, 0x61, 0x6d, 0x70, 0x30, 0x00, 0x55, 0x42,
0x4f, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x00, 0xab, 0x82, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
0xa4, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xe4, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0xf8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x02, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xf8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
0x29, 0x02, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0xf8, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x30, 0x02, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x4c, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
0x70, 0x02, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x4c, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x02, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x94, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
0xb8, 0x02, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x4c, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xcb, 0x02, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00,
0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4c, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00,
0x75, 0x5f, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x73, 0x00, 0x75, 0x69,
0x6e, 0x74, 0x32, 0x00, 0x01, 0x00, 0x13, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0xf2, 0x01, 0x00, 0x00, 0x75, 0x5f, 0x65, 0x6e, 0x64, 0x5f, 0x63, 0x6f,
0x6f, 0x72, 0x64, 0x73, 0x00, 0x75, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x00, 0x75, 0x5f, 0x62, 0x75,
0x66, 0x66, 0x65, 0x72, 0x5f, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74,
0x00, 0x64, 0x77, 0x6f, 0x72, 0x64, 0x00, 0xab, 0x00, 0x00, 0x13, 0x00, 0x01, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x02, 0x00, 0x00, 0x75, 0x5f, 0x6d, 0x61,
0x73, 0x6b, 0x5f, 0x6f, 0x72, 0x5f, 0x62, 0x69, 0x74, 0x73, 0x00, 0x75, 0x5f, 0x64, 0x65, 0x70,
0x74, 0x68, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x00, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x00, 0xab,
0x00, 0x00, 0x03, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x8d, 0x02, 0x00, 0x00, 0x75, 0x5f, 0x72, 0x65, 0x73, 0x6f, 0x6c, 0x75, 0x74, 0x69, 0x6f, 0x6e,
0x5f, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x00, 0x75, 0x5f, 0x70, 0x61, 0x64, 0x30, 0x00, 0x4d, 0x69,
0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66, 0x74, 0x20, 0x28, 0x52, 0x29, 0x20, 0x48, 0x4c, 0x53, 0x4c,
0x20, 0x53, 0x68, 0x61, 0x64, 0x65, 0x72, 0x20, 0x43, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x72,
0x20, 0x31, 0x30, 0x2e, 0x31, 0x00, 0xab, 0xab, 0x49, 0x53, 0x47, 0x4e, 0x50, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x0f, 0x03, 0x00, 0x00, 0x54, 0x45, 0x58, 0x43, 0x4f, 0x4f, 0x52, 0x44,
0x00, 0x53, 0x56, 0x5f, 0x50, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x00, 0xab, 0xab, 0xab,
0x4f, 0x53, 0x47, 0x4e, 0x4c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x0e, 0x00, 0x00,
0x53, 0x56, 0x5f, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x00, 0x53, 0x56, 0x5f, 0x44, 0x65, 0x70,
0x74, 0x68, 0x00, 0xab, 0x53, 0x48, 0x45, 0x58, 0x64, 0x03, 0x00, 0x00, 0x50, 0x00, 0x00, 0x00,
0xd9, 0x00, 0x00, 0x00, 0x6a, 0x08, 0x00, 0x01, 0x59, 0x00, 0x00, 0x04, 0x46, 0x8e, 0x20, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x58, 0x08, 0x00, 0x04, 0x00, 0x70, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x00, 0x00, 0x64, 0x20, 0x00, 0x04, 0x32, 0x10, 0x10, 0x00,
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x03, 0xf2, 0x20, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x02, 0x01, 0xc0, 0x00, 0x00, 0x68, 0x00, 0x00, 0x02,
0x02, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x05, 0x32, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x46, 0x10, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x00, 0x09, 0x32, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x00, 0x00, 0x46, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x56, 0x85, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x08,
0xc2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x04, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x06, 0x84, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x00, 0x00, 0x08,
0x32, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0xe6, 0x8a, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x07,
0x32, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0xe6, 0x0a, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x46, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x07, 0x12, 0x00, 0x10, 0x00,
0x01, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x10, 0x00,
0x01, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x04, 0x03, 0x0a, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00,
0x29, 0x00, 0x00, 0x0b, 0x32, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x56, 0x85, 0x20, 0x00,
0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00,
0x09, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4e, 0x00, 0x00, 0x09,
0x32, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x00, 0x00, 0x46, 0x00, 0x10, 0x00,
0x01, 0x00, 0x00, 0x00, 0x56, 0x85, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x1e, 0x00, 0x00, 0x09, 0x32, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00, 0x46, 0x00, 0x10, 0x00,
0x01, 0x00, 0x00, 0x00, 0x46, 0x80, 0x20, 0x80, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x07, 0x32, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00,
0x46, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00,
0x1e, 0x00, 0x00, 0x09, 0x32, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x46, 0x80, 0x20, 0x80, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x09, 0x32, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0xe6, 0x0a, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x00, 0x10, 0x00, 0x01, 0x00, 0x00, 0x00,
0x46, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x0b, 0x22, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x80, 0x20, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x2a, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x07, 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x2d, 0x00, 0x00, 0x89, 0x42, 0x00, 0x00, 0x80, 0x03, 0x11, 0x11, 0x00, 0x12, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0x7e, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x08, 0x12, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00,
0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x07, 0x22, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x0a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00,
0x8a, 0x00, 0x00, 0x0f, 0xd2, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00,
0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
0x02, 0x40, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00,
0x0f, 0x00, 0x00, 0x00, 0x06, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x00, 0x00, 0x05,
0x22, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x38, 0x00, 0x00, 0x07, 0x12, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x08, 0x21, 0x04, 0x3d, 0x56, 0x00, 0x00, 0x05,
0x32, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
0x38, 0x00, 0x00, 0x0a, 0x62, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x01, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x02, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x21, 0x04, 0x3d,
0x08, 0x21, 0x04, 0x3d, 0x00, 0x00, 0x00, 0x00, 0x56, 0x00, 0x00, 0x05, 0x82, 0x20, 0x10, 0x00,
0x00, 0x00, 0x00, 0x00, 0x3a, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x04,
0x01, 0xc0, 0x00, 0x00, 0x01, 0x40, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x3e, 0x00, 0x00, 0x01,
0x53, 0x54, 0x41, 0x54, 0x94, 0x00, 0x00, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
const size_t k_vram_write_ps_pgxp1_size_bytes = sizeof(k_vram_write_ps_pgxp1);

View file

@ -21,5 +21,7 @@ namespace D3D12::EmbeddedShaders {
#include "embedded_dxbc/copy_ps.inc"
#include "embedded_dxbc/vram_copy_ps_pgxp0.inc"
#include "embedded_dxbc/vram_copy_ps_pgxp1.inc"
#include "embedded_dxbc/vram_write_ps_pgxp0.inc"
#include "embedded_dxbc/vram_write_ps_pgxp1.inc"
} // namespace D3D12::EmbeddedShaders

View file

@ -77,4 +77,20 @@ extern const size_t k_vram_copy_ps_pgxp0_size_bytes;
extern const uint8_t k_vram_copy_ps_pgxp1[];
extern const size_t k_vram_copy_ps_pgxp1_size_bytes;
// VRAM write pixel shader. Equivalent to
// GPU_HW_ShaderGen::GenerateVRAMWriteFragmentShader(false) in D3D12
// mode. Used by GPU_HW_D3D12::GetVRAMWritePipeline for the CPU->VRAM
// upload path - hit constantly on every game's framebuffer streaming
// path (pre-rendered backgrounds, FMV staging, sprite-page reloads).
// Two variants on PGXP_DEPTH; the shadergen's `use_ssbo` parameter is
// GLSL/Vulkan-only, so for D3D12 only the texture-buffer source path
// gets pre-baked. u_resolution_scale lives in the cbuffer (post-
// 9d2b49d), so one blob per PGXP value serves every resolution scale.
//
// Source: data/shaders/d3d12/vram_write.ps.hlsl
extern const uint8_t k_vram_write_ps_pgxp0[];
extern const size_t k_vram_write_ps_pgxp0_size_bytes;
extern const uint8_t k_vram_write_ps_pgxp1[];
extern const size_t k_vram_write_ps_pgxp1_size_bytes;
} // namespace D3D12::EmbeddedShaders

View file

@ -1573,14 +1573,19 @@ GPU_HW_D3D12::ComPtr<ID3D12PipelineState> GPU_HW_D3D12::GetVRAMWritePipeline(uin
const D3D12_SHADER_BYTECODE vs = GetFullscreenQuadVertexShader();
if (!m_shadergen)
{
Log_ErrorPrint("GetVRAMWritePipeline called before CompilePipelines constructed the shadergen");
return {};
}
ComPtr<ID3DBlob> fs = m_shader_cache.GetPixelShader(m_shadergen->GenerateVRAMWriteFragmentShader(false));
if (!fs)
return {};
// Pre-baked DXBC blob - one per PGXP_DEPTH on/off. Same selection
// pattern as GetVRAMCopyPipeline (cb4b443). m_pgxp_depth_buffer is
// the runtime PGXP state that determines which o_depth path the
// shader takes. No D3DCompile / disk-shader-cache lookup needed;
// the .inc file IS the cache. RESOLUTION_SCALE is cbuffer-routed
// (9d2b49d), so one blob per PGXP value serves every resolution
// scale.
const D3D12_SHADER_BYTECODE fs =
m_pgxp_depth_buffer
? D3D12_SHADER_BYTECODE{D3D12::EmbeddedShaders::k_vram_write_ps_pgxp1,
D3D12::EmbeddedShaders::k_vram_write_ps_pgxp1_size_bytes}
: D3D12_SHADER_BYTECODE{D3D12::EmbeddedShaders::k_vram_write_ps_pgxp0,
D3D12::EmbeddedShaders::k_vram_write_ps_pgxp0_size_bytes};
D3D12::GraphicsPipelineBuilder gpbuilder;
gpbuilder.SetRootSignature(m_single_sampler_root_signature.Get());
@ -1590,7 +1595,7 @@ GPU_HW_D3D12::ComPtr<ID3D12PipelineState> GPU_HW_D3D12::GetVRAMWritePipeline(uin
gpbuilder.SetNoCullRasterizationState();
gpbuilder.SetNoBlendingState();
gpbuilder.SetVertexShader(vs);
gpbuilder.SetPixelShader(fs.Get());
gpbuilder.SetPixelShader(fs);
gpbuilder.SetMultisamples(m_multisamples);
gpbuilder.SetDepthState(true, true,
(depth_test != 0) ? D3D12_COMPARISON_FUNC_GREATER_EQUAL : D3D12_COMPARISON_FUNC_ALWAYS);

View file

@ -64,6 +64,15 @@ TEMPLATE_VARIANTS = {
("pgxp0", ["PGXP_DEPTH=0"]),
("pgxp1", ["PGXP_DEPTH=1"]),
],
# vram_write_ps: same PGXP_DEPTH on/off split as vram_copy. The
# shadergen's `use_ssbo` parameter is GLSL/Vulkan-only - the D3D12
# call site at GPU_HW_D3D12::GetVRAMWritePipeline always passes
# false, so the use_ssbo dimension collapses to a single value
# and doesn't show up here.
"vram_write.ps.hlsl": [
("pgxp0", ["PGXP_DEPTH=0"]),
("pgxp1", ["PGXP_DEPTH=1"]),
],
}