Files
Valiantsin DzerakhandClaude Opus 5.5 7abdbc90ac Render the game above 1080p and scale it to the window with FSR 1
The output and scene patch sets make the game read its output, swapchain and scene sizes from the patch page
(MacNativeGames' sites for 1.2.1 and 1.4.3); resolution.c picks them from TOTK_OUTPUT_RES and TOTK_RENDER_SCALE and
grows the HeapDef texture heap, its parent and the application pool to match. vk_fsr.c runs AMD FSR 1 EASU and RCAS
on the present when the window is larger than the game's output (TOTK_UPSCALER, TOTK_SHARPNESS).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 13:40:34 +03:00

42 lines
1.2 KiB
Plaintext

// AMD FidelityFX Super Resolution 1 robust contrast-adaptive sharpening (RCAS) of the EASU result
// (runtime/vk_fsr.c). ffx/ffx_a.h and ffx/ffx_fsr1.h are AMD's headers, unmodified (MIT, ffx/LICENSE.txt).
#version 450
#extension GL_GOOGLE_include_directive : require
layout(local_size_x = 64, local_size_y = 1, local_size_z = 1) in;
layout(set = 0, binding = 0) uniform sampler2D src;
layout(set = 0, binding = 1, rgba16f) uniform writeonly image2D dst;
layout(push_constant) uniform Params {
vec4 size; // width, height, sharpness in stops (0 = most), unused
} pc;
#define A_GPU 1
#define A_GLSL 1
#include "ffx/ffx_a.h"
#define FSR_RCAS_F 1
AF4 FsrRcasLoadF(ASU2 p) { return texelFetch(src, p, 0); }
void FsrRcasInputF(inout AF1 r, inout AF1 g, inout AF1 b) {}
#include "ffx/ffx_fsr1.h"
void put(AU2 p, AU4 con) {
if (p.x >= uint(pc.size.x) || p.y >= uint(pc.size.y)) return;
AF3 c;
FsrRcasF(c.r, c.g, c.b, p, con);
imageStore(dst, ivec2(p), vec4(c, 1.0));
}
void main() {
AU4 con;
FsrRcasCon(con, pc.size.z);
AU2 p = ARmp8x8(gl_LocalInvocationID.x) + AU2(gl_WorkGroupID.x << 4u, gl_WorkGroupID.y << 4u);
put(p, con);
p.x += 8u;
put(p, con);
p.y += 8u;
put(p, con);
p.x -= 8u;
put(p, con);
}