Files
psxrecomp/runtime/shaders/present.vert
T
Martin Penkava 7ad8519128 vulkan: present through an opaque shader pass instead of a blit
The plain present path copied the VRAM image into the swapchain with
vkCmdBlitImage, alpha included. VRAM alpha is the PSX mask/STP bit, 0 on
most pixels, and AMD's compositor honours it even with an OPAQUE
compositeAlpha: parts of the window went see-through (8x8 black/white
blocks of whatever sat behind it). Reported in #411.

vk_renderer_present_vram/_wide now draw the displayed rect with a
fullscreen triangle whose fragment shader writes alpha = 1 (new
present.vert/.frag). The pass is self-contained and created lazily; if
any of it fails to build, presents fall back to the old blit. Its render
pass ends in TRANSFER_DST_OPTIMAL so finish_present (OSD + present
barrier) is unchanged. Wide surfaces gain SAMPLED usage for it.

Checked on an RX 7900 XT: intro/logo screens render correctly, no new
validation-layer messages.

Most of this was written by Claude Opus 5.5; I reviewed and tested it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-27 13:41:03 +02:00

10 lines
363 B
GLSL

#version 450
/* Fullscreen triangle for the swapchain present pass. The viewport is set to
* the letterbox rect, so v_uv [0,1] spans exactly the displayed picture. */
layout(location = 0) out vec2 v_uv;
void main() {
vec2 p = vec2(float((gl_VertexIndex << 1) & 2), float(gl_VertexIndex & 2));
v_uv = p;
gl_Position = vec4(p * 2.0 - 1.0, 0.0, 1.0);
}