Files
psxrecomp/runtime/shaders/blit.frag
T
Matthew Stanley 0ac63b655c vulkan: 3rd renderer backend (WIP) — emitter, GPU-direct present, full-frame readback
Vulkan backend alongside software + OpenGL: geometry/textured-prim
pipelines, GPU-authoritative VRAM image, deferred-submit + drain-at-present
perf model, GPU-direct present (vk_renderer_present_vram), and a
full-VRAM-pack readback path (ensure_cpu rect_adds the whole VRAM rect
before pack_flush so screenshots/guest VRAM reads reflect live content,
not just the incremental pack-dirty rect — readback-only, no per-frame cost).

Runtime plumbing: --debug-port / --renderer / --window-title CLI overrides
(multi-instance fleet), latency_ring, SPIR-V shaders + embed_spirv.py,
config_loader renderer selection, debug_server screenshot wiring.

All on feat/vulkan-renderer; snapshot in backup/vulkan-wip-20260617.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-18 14:56:12 -07:00

25 lines
1.0 KiB
GLSL

#version 450
/* Quad blit fragment: sample an RGBA8 source (alpha = bit15), split by STP for
* the stencil-mirror write, OR set-mask into the output alpha. Exact integer
* source fetch (no normalized-uv edge precision). u_src_div maps fragcoord to
* src texel (S for native-res sources, 1 for hr-res); u_src_off is added after
* the divide in src texel units. Ported from the GL backend's BLIT_FS. */
layout(set = 0, binding = 0) uniform sampler2D u_src;
layout(push_constant) uniform PC {
float u_shift;
int u_stp_pass; /* 0=all, 1=bit15=0 only, 2=bit15=1 only */
int u_maskset;
int u_src_div;
ivec2 u_src_off;
ivec4 u_rect; /* unused in frag; keeps the block layout in sync */
} pc;
layout(location = 0) out vec4 frag;
void main() {
ivec2 p = ivec2(gl_FragCoord.xy);
vec4 c = texelFetch(u_src, p / pc.u_src_div + pc.u_src_off, 0);
bool stp = c.a >= 0.5;
if (pc.u_stp_pass == 1 && stp) discard;
if (pc.u_stp_pass == 2 && !stp) discard;
frag = vec4(c.rgb, (stp || pc.u_maskset != 0) ? 1.0 : 0.0);
}