mirror of
https://git.triforceproject.com/triforce/source
synced 2026-11-25 18:48:51 -04:00
Triforce v0.8.0
Evil HD (SMAA Ultra, 16x filtering, full textures, ambient occlusion with bounce light, sunlight shafts, foliage drawn 4x as far, the remastered texture pack's loader and the launcher's download of it), FSR 3.1 frame generation for every GPU, Intel XeSS, FSR 4 model choice, ReShade presets, Auto (this PC), HUD placement, the options menu in 13 languages, a second input for every control, hold to toggle, DualSense speaker and haptics, NFC from the player's own dumps, the above-60 fps game fixes, the Debug tab's flight and Inventory fixes, the launcher's full settings, and over 250 fixes.
This commit is contained in:
37
gpu/vk/shaders/fg_hud_composite.comp
Normal file
37
gpu/vk/shaders/fg_hud_composite.comp
Normal file
@@ -0,0 +1,37 @@
|
||||
#version 450
|
||||
// Frame generation (vk_framegen.cpp fsr3fi_frames): this frame's HUD over a frame AMD FSR 3.1 made. FSR 3.1 made it
|
||||
// from the pictures before the HUD alone (its present given as the HUD-less colour: it lays nothing over it), so it is the
|
||||
// scene, moved. Where the HUD's see-through amount is known (shaders/fg_hud_layer.comp: B, the HUD's own colour, and T), the
|
||||
// HUD goes over the made frame's own scene, B + T * scene, as the game drew it over its picture: its glows, shadows and faint
|
||||
// icons show the made frame's background, not a halo of the real frame's. Where T is unknown, the frame as presented, as
|
||||
// before. In the picture's encoding: the frame is the picture sRGB-encoded (pq: the native HDR picture, encoded already).
|
||||
// (tests/test_fsr3fi_hud_layer.py compiles hud_over as C++, and makes fg_hud_composite_comp_spv.h: --write)
|
||||
layout(local_size_x = 8, local_size_y = 8) in;
|
||||
layout(binding = 0, rgba8) uniform image2D made; // a made frame (the set's copy of it), written over in place
|
||||
layout(binding = 1) uniform sampler2D shown; // the game's frame as presented (fg_copy's crop, RGBA8)
|
||||
layout(binding = 2) uniform sampler2D layer; // fg_hud_layer.comp's B and T, the same crop
|
||||
layout(push_constant) uniform P { ivec2 size; int pq; } pc;
|
||||
|
||||
float srgb1(float v) {
|
||||
v = clamp(v, 0.0, 1.0);
|
||||
return v <= 0.0031308 ? 12.92 * v : 1.055 * pow(v, 1.0 / 2.4) - 0.055;
|
||||
}
|
||||
vec3 srgb(vec3 v) { return vec3(srgb1(v.r), srgb1(v.g), srgb1(v.b)); }
|
||||
float linear1(float v) { return v <= 0.04045 ? v / 12.92 : pow((v + 0.055) / 1.055, 2.4); }
|
||||
vec3 linear(vec3 v) { return vec3(linear1(v.r), linear1(v.g), linear1(v.b)); }
|
||||
|
||||
// A made pixel with the HUD over it: made, FSR 3.1's (the scene, moved); shown, the presented frame's; l, B and T
|
||||
vec3 hud_over(vec3 made, vec3 shown, vec4 l, bool pq) {
|
||||
if (l.a < 0.0) return shown; // (unknown: the presented pixel whole, as before)
|
||||
if (pq) return clamp(l.rgb + l.a * made, 0.0, 1.0);
|
||||
return srgb(l.rgb + l.a * linear(made));
|
||||
}
|
||||
|
||||
void main() {
|
||||
const ivec2 g = ivec2(gl_GlobalInvocationID.xy);
|
||||
if (any(greaterThanEqual(g, pc.size))) return;
|
||||
const vec4 l = texelFetch(layer, g, 0);
|
||||
if (l == vec4(0.0, 0.0, 0.0, 1.0)) return; // (no HUD: FSR 3.1's pixel, untouched)
|
||||
const vec3 m = imageLoad(made, g).rgb;
|
||||
imageStore(made, g, vec4(hud_over(m, texelFetch(shown, g, 0).rgb, l, pc.pq != 0), 1.0));
|
||||
}
|
||||
Reference in New Issue
Block a user