Files
Triforce-Source/gpu/vk/shaders/smaa_setup.glsl
ruckus7382sfgsgdf 6f338c8f56 Triforce v0.5.0
In-game mods (GameBanana browser, search and installs, with the Mask Salesman), code-patch and cheat mods, the devs' test18 to test45 work (full performance overlay, frame pacing on, steady frame rate, save export and import, bug capture, new options rows, Setup's Mods page and Add to Steam), occlusion queries and new defaults, Auto resolution that scales, replay helper threads and robust buffers off by default, the options in sections.
2026-11-17 22:40:50 -06:00

23 lines
1.3 KiB
GLSL

// (Triforce) Settings and resources shared by the SMAA passes (gpu/vk/vk_aa.cpp; smaa_edge.comp, smaa_weight.comp,
// smaa_blend.comp). After NX2navi's shaders/smaa_setup.glsl. SMAA.hlsl (third_party/smaa, MIT: its PROVENANCE.md) is the SMAA
// reference implementation, unmodified, found through glslangValidator's -I; its pixel- and vertex-shader functions run here
// inside compute shaders, one invocation a pixel, with the texture coordinate of the pixel's centre. Its "discard" of a pixel
// without edges becomes nothing: the edge pass then stores the zero edges it found, which is what the next pass reads for
// such a pixel anyway. (The pass that includes this asks for GL_GOOGLE_include_directive first.)
layout(local_size_x = 8, local_size_y = 8) in;
layout(push_constant) uniform Push {
vec4 metrics; // (1 / width, 1 / height, width, height)
} pc;
#define SMAA_RT_METRICS pc.metrics
#define SMAA_GLSL_4 1
#define SMAA_PRESET_ULTRA 1
#define discard
#include "SMAA.hlsl"
// (the pixel this invocation works on and its centre's texture coordinate; false past the image's edge)
bool smaa_pixel(out ivec2 p, out vec2 uv) {
p = ivec2(gl_GlobalInvocationID.xy);
uv = (vec2(p) + 0.5) * pc.metrics.xy;
return p.x < int(pc.metrics.z) && p.y < int(pc.metrics.w);
}