Skip to content

Xbox Cloud Gaming app for PS5 Homebrew

C
1.7 KB
Raw Blame
#version 450
// SPDX-License-Identifier: GPL-3.0-or-later
// Copyright (C) 2026 RafaelNGP
// FSR 1 RCAS (sharpening; off = a plain copy), then the menus laid over, into
// the swapchain image.
#extension GL_GOOGLE_include_directive : require
layout(local_size_x = 8, local_size_y = 8) in;
layout(binding = 0, rgba8) uniform readonly image2D upscaled;
layout(binding = 1) uniform sampler2D overlayTex;  // linear, alpha = coverage
layout(binding = 2) uniform writeonly image2D target;  // the swapchain's format
layout(push_constant) uniform Constants {
    uvec4 con;       // FsrRcasCon
    uint sharpen;    // 0: plain copy
    float overlayOpacity;
} pc;

#define A_GPU 1
#define A_GLSL 1
#include "ffx_a.h"
#define FSR_RCAS_F 1
#define FSR_RCAS_DENOISE 1
AF4 FsrRcasLoadF(ASU2 p) {
    ivec2 size = imageSize(upscaled);
    return imageLoad(upscaled, clamp(p, ivec2(0), size - 1));
}
void FsrRcasInputF(inout AF1 r, inout AF1 g, inout AF1 b) {}
#include "ffx_fsr1.h"

void main() {
    ivec2 p = ivec2(gl_GlobalInvocationID.xy);
    ivec2 size = imageSize(target);
    if (p.x >= size.x || p.y >= size.y) return;
    ivec2 box = imageSize(upscaled);
    ivec2 q = p - (size - box) / 2;
    if (q.x < 0 || q.y < 0 || q.x >= box.x || q.y >= box.y) {
        imageStore(target, p, vec4(0.0, 0.0, 0.0, 1.0));
        return;
    }
    vec3 color;
    if (pc.sharpen != 0u) {
        FsrRcasF(color.r, color.g, color.b, uvec2(q), pc.con);
    } else {
        color = imageLoad(upscaled, q).rgb;
    }
    if (pc.overlayOpacity > 0.0) {
        vec4 o = texture(overlayTex, (vec2(q) + 0.5) / vec2(box));
        color = mix(color, o.rgb, o.a * pc.overlayOpacity);
    }
    imageStore(target, p, vec4(color, 1.0));
}