Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
1025c29
docs: plan upscaling and frame generation around the game's own TAAU
decoder37 Nov 8, 2026
d9566a1
feat: name each network binding's role in the upscaler input contract
decoder37 Nov 8, 2026
1a036c8
feat: route the game's upscale dispatch through one backend seam
decoder37 Nov 8, 2026
492bcd0
fix: read the upscaler contract in descriptor order, not from draw_sa…
decoder37 Nov 8, 2026
37afa2e
feat: compile AMD's FSR 3.1 upscaler passes from the FidelityFX SDK
decoder37 Nov 8, 2026
8f2fda3
feat: census the render target sets, to settle whether a G-buffer exists
decoder37 Nov 8, 2026
ced7485
Merge remote-tracking branch 'upstream/main' into feat/fsr-vendor
decoder37 Nov 8, 2026
7042b33
docs: the render target census ran, and the count alone does not sett…
decoder37 Nov 8, 2026
6b51433
feat: create FSR 3.1's pipelines and internal images
decoder37 Nov 8, 2026
8769c80
feat: record FSR 3.1's nine dispatches
decoder37 Nov 8, 2026
853cfe3
fix: the game's network takes one texture, so it is not a temporal up…
decoder37 Nov 8, 2026
e706b9d
An Output resolution row (2048x1152, 2560x1440, 3840x2160), a full-si…
BlueHeisenberg Nov 8, 2026
7985e00
NVIDIA DLSS in place of the game's upscale (optional, RTX GPUs; NVIDI…
BlueHeisenberg Nov 8, 2026
52bfca2
docs: the camera's field layout, read out of sead's projection update
decoder37 Nov 8, 2026
8bd7c8d
feat: publish Ocarina's camera, and make a backend reachable without …
decoder37 Nov 8, 2026
29c7cbe
feat: derive camera motion from the scene's depth, and keep that depth
decoder37 Nov 8, 2026
bf0382c
docs: the baseline, which says an upscaler is not what gets this to 60
decoder37 Nov 8, 2026
af0f871
docs: 60 fps is the floor here, not the target
decoder37 Nov 8, 2026
481b957
feat: give FSR the assembled depth and camera motion
decoder37 Nov 8, 2026
c630d59
fix: publish the camera from the inlined projection copies too
decoder37 Nov 8, 2026
2008ac7
feat: HOS_FPS_FORCE, because raising the limiter alone does not hold
decoder37 Nov 8, 2026
040a9ab
AMD FSR 4.1 in place of the game's upscale, with a sub-pixel jitter (…
madebyjordan Nov 8, 2026
211585a
FSR 4.1 review fixes: dynamic resolution, Linux build, barrier count,…
madebyjordan Nov 8, 2026
d4996a9
feat(fsr): run FSR 4 on Linux through a Vulkan FSR 4 library
N3oTraX Nov 8, 2026
01a60fc
fix(fsr): pick the first of equal providers, give the upscaler a unit…
N3oTraX Nov 8, 2026
33852b2
fix(fsr): build the FSR 4 path on Linux
N3oTraX Nov 8, 2026
157b5d2
feat(fsr): merge NotRexed/Hookshot#822 (FSR 3.1 passes and input cont…
N3oTraX Nov 9, 2026
491475f
fix(fsr): compile the FSR 3.1 passes for the inputs FSR 4.1 is given
N3oTraX Nov 8, 2026
6095c4d
feat(fsr): choose FSR 4.1 or FSR 3.1 from one row of the Insert menu
N3oTraX Nov 8, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/source-regressions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
run: python -m pip install --disable-pip-version-check --no-deps zstandard==0.25.0
- name: Compilers and the SPIR-V validator
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y g++ clang spirv-tools
run: sudo apt-get update && sudo apt-get install -y g++ clang spirv-tools glslang-tools

# (the steps below all run when one before them failed, so one run shows every failure)
- name: Check Windows native source regressions
Expand Down
316 changes: 316 additions & 0 deletions docs/upscaling.md

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions gpu/PROVENANCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,19 @@ mkw-recomp's changes, for the Switch 2:
`mkw_gpu.cpp` / `mkw_gpu.h` / `build-gpu.bat` are the earlier Vulkan stand-in (a window and a swapchain; no longer
loaded). `shadertool.cpp` runs dumped NVN2 programs through Eglantine's recompiler offline (SPIR-V; it prints what
each program reads from the constant banks).

Hookshot's NVIDIA DLSS (`vk/vk_dlss.cpp`, the DLSS part of `vk/vk_draw.cpp`, `vk/shaders/dlss_*.comp`) is ported from Lichii
(zortos293/Lichii: `vulkan_common/streamline.cpp`, `renderer_vulkan/vk_streamline_dlss.cpp`, `vk_ocarina_camera_motion.cpp`,
`host_shaders/ocarina_*.comp`; Eden Emulator Project, GPL-3.0-or-later; Lichii credits Duck912's Eglantine work).
`third_party/streamline/` is NVIDIA Streamline v2.14.16's headers (MIT, `license.txt`); its DLLs and NVIDIA's DLSS are
loaded from the user's PC at run time and are not vendored.

Hookshot's AMD FSR 4.1 (`vk/vk_fsr4.cpp`, the FSR and jitter parts of `vk/vk_draw.cpp`, the `fsr` paths of
`vk/shaders/dlss_*.comp`) is ported from madebyjordan's FSR 4.1 work on Lichii's OoT branch (`renderer_vulkan/vk_fsr4_upscaler.cpp`,
`vk_rasterizer.cpp`'s Ocarina jitter, `host_shaders/ocarina_*.comp`; GPL-3.0-or-later). `third_party/fidelityfx/` is AMD's
FSR API headers from FidelityFX SDK v2.4.0 (MIT, `LICENSE.md`); AMD's signed DLLs are loaded from the user's PC at run time
and are not vendored.

Hookshot's AMD FSR 3.1 (`vk/vk_fsr3.cpp`, `vk/upscale_seam.h`, `vk/upscale_contract.h`, `vk/shaders/fsr3_*`) comes from notquiteog's FSR 3.1
pull request on NotRexed/Hookshot (#822, GPL-3.0-or-later); the shaders are compiled from `third_party/fidelityfx-sdk/` (AMD FidelityFX SDK
v1.1.4, MIT).
60 changes: 60 additions & 0 deletions gpu/vk/shaders/camera_motion.comp
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#version 460 core
// (hookshot) Camera-only motion vectors from depth, for a temporal upscaler.
//
// Ocarina hands its own upscaler one colour texture and nothing else, so motion has to be derived
// rather than taken (docs/upscaling.md). For each pixel this reconstructs the world position from
// the reversed device depth with the inverse of this frame's view-projection, projects it with the
// previous frame's, and writes where it was, in render pixels, pointing at the previous frame.
//
// This is camera-only by construction: it is right for a world that does not move, and anything
// moving by itself -- a character, foliage, a particle -- ghosts, because its own motion is not in
// the depth buffer. That limit belongs in the setting that turns it on, not in a comment nobody
// reads.
layout(local_size_x = 8, local_size_y = 8, local_size_z = 1) in;

layout(binding = 0) uniform texture2D in_depth;
layout(binding = 1, rg16f) uniform writeonly image2D out_motion;
layout(binding = 1000) uniform sampler point_clamp;

layout(push_constant) uniform Push {
mat4 inverse_view_projection; // this frame's, inverted
mat4 previous_view_projection; // the frame before's
ivec2 render_size;
// The depth value that means "nothing here". With reversed depth the far plane is 0, and a
// pixel at the far plane has no position to reproject, so it gets zero motion rather than a
// vector derived from a degenerate reconstruction.
float far_depth;
float pad;
} push;

void main() {
const ivec2 at = ivec2(gl_GlobalInvocationID.xy);
if (any(greaterThanEqual(at, push.render_size))) {
return;
}
const float depth = texelFetch(sampler2D(in_depth, point_clamp), at, 0).r;
if (depth == push.far_depth) {
imageStore(out_motion, at, vec4(0.0));
return;
}
// The pixel's centre in clip space. Vulkan's y runs down the screen, so it is flipped here and
// flipped back below; getting that wrong gives motion that is right in x and inverted in y,
// which looks like a correct upscaler with vertical smearing.
const vec2 uv = (vec2(at) + 0.5) / vec2(push.render_size);
const vec4 clip = vec4(uv.x * 2.0 - 1.0, 1.0 - uv.y * 2.0, depth, 1.0);
const vec4 world = push.inverse_view_projection * clip;
if (world.w == 0.0) {
imageStore(out_motion, at, vec4(0.0));
return;
}
const vec4 previous = push.previous_view_projection * (world / world.w);
if (previous.w <= 0.0) { // (behind the previous camera: no on-screen history to point at)
imageStore(out_motion, at, vec4(0.0));
return;
}
const vec2 previous_ndc = previous.xy / previous.w;
const vec2 previous_uv = vec2(previous_ndc.x * 0.5 + 0.5, 0.5 - previous_ndc.y * 0.5);
// Toward the previous frame, in render pixels, which is what FSR 3.1 is compiled for
// (FFX_FSR3UPSCALER_OPTION_LOW_RESOLUTION_MOTION_VECTORS=1, unjittered).
imageStore(out_motion, at, vec4((previous_uv - uv) * vec2(push.render_size), 0.0, 0.0));
}
125 changes: 125 additions & 0 deletions gpu/vk/shaders/camera_motion_comp_spv.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
// 1116.2.0
#pragma once
const uint32_t CAMERA_MOTION_COMP_SPV[] = {
0x07230203,0x00010300,0x0008000b,0x000000a1,0x00000000,0x00020011,0x00000001,0x00020011,
0x00000031,0x0006000b,0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,
0x00000000,0x00000001,0x0006000f,0x00000005,0x00000004,0x6e69616d,0x00000000,0x0000000d,
0x00060010,0x00000004,0x00000011,0x00000008,0x00000008,0x00000001,0x00030003,0x00000002,
0x000001cc,0x00040005,0x00000004,0x6e69616d,0x00000000,0x00030005,0x00000009,0x00007461,
0x00080005,0x0000000d,0x475f6c67,0x61626f6c,0x766e496c,0x7461636f,0x496e6f69,0x00000044,
0x00040005,0x00000016,0x68737550,0x00000000,0x00090006,0x00000016,0x00000000,0x65766e69,
0x5f657372,0x77656976,0x6f72705f,0x7463656a,0x006e6f69,0x000a0006,0x00000016,0x00000001,
0x76657270,0x73756f69,0x6569765f,0x72705f77,0x63656a6f,0x6e6f6974,0x00000000,0x00060006,
0x00000016,0x00000002,0x646e6572,0x735f7265,0x00657a69,0x00060006,0x00000016,0x00000003,
0x5f726166,0x74706564,0x00000068,0x00040006,0x00000016,0x00000004,0x00646170,0x00040005,
0x00000018,0x68737570,0x00000000,0x00040005,0x00000025,0x74706564,0x00000068,0x00050005,
0x00000028,0x645f6e69,0x68747065,0x00000000,0x00050005,0x0000002c,0x6e696f70,0x6c635f74,
0x00706d61,0x00050005,0x00000040,0x5f74756f,0x69746f6d,0x00006e6f,0x00030005,0x00000048,
0x00007675,0x00040005,0x00000053,0x70696c63,0x00000000,0x00040005,0x00000061,0x6c726f77,
0x00000064,0x00050005,0x00000070,0x76657270,0x73756f69,0x00000000,0x00060005,0x00000082,
0x76657270,0x73756f69,0x63646e5f,0x00000000,0x00050005,0x00000089,0x76657270,0x73756f69,
0x0076755f,0x00040047,0x0000000d,0x0000000b,0x0000001c,0x00030047,0x00000016,0x00000002,
0x00040048,0x00000016,0x00000000,0x00000005,0x00050048,0x00000016,0x00000000,0x00000007,
0x00000010,0x00050048,0x00000016,0x00000000,0x00000023,0x00000000,0x00040048,0x00000016,
0x00000001,0x00000005,0x00050048,0x00000016,0x00000001,0x00000007,0x00000010,0x00050048,
0x00000016,0x00000001,0x00000023,0x00000040,0x00050048,0x00000016,0x00000002,0x00000023,
0x00000080,0x00050048,0x00000016,0x00000003,0x00000023,0x00000088,0x00050048,0x00000016,
0x00000004,0x00000023,0x0000008c,0x00040047,0x00000028,0x00000021,0x00000000,0x00040047,
0x00000028,0x00000022,0x00000000,0x00040047,0x0000002c,0x00000021,0x000003e8,0x00040047,
0x0000002c,0x00000022,0x00000000,0x00030047,0x00000040,0x00000019,0x00040047,0x00000040,
0x00000021,0x00000001,0x00040047,0x00000040,0x00000022,0x00000000,0x00040047,0x000000a0,
0x0000000b,0x00000019,0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,0x00040015,
0x00000006,0x00000020,0x00000001,0x00040017,0x00000007,0x00000006,0x00000002,0x00040020,
0x00000008,0x00000007,0x00000007,0x00040015,0x0000000a,0x00000020,0x00000000,0x00040017,
0x0000000b,0x0000000a,0x00000003,0x00040020,0x0000000c,0x00000001,0x0000000b,0x0004003b,
0x0000000c,0x0000000d,0x00000001,0x00040017,0x0000000e,0x0000000a,0x00000002,0x00030016,
0x00000013,0x00000020,0x00040017,0x00000014,0x00000013,0x00000004,0x00040018,0x00000015,
0x00000014,0x00000004,0x0007001e,0x00000016,0x00000015,0x00000015,0x00000007,0x00000013,
0x00000013,0x00040020,0x00000017,0x00000009,0x00000016,0x0004003b,0x00000017,0x00000018,
0x00000009,0x0004002b,0x00000006,0x00000019,0x00000002,0x00040020,0x0000001a,0x00000009,
0x00000007,0x00020014,0x0000001d,0x00040017,0x0000001e,0x0000001d,0x00000002,0x00040020,
0x00000024,0x00000007,0x00000013,0x00090019,0x00000026,0x00000013,0x00000001,0x00000000,
0x00000000,0x00000000,0x00000001,0x00000000,0x00040020,0x00000027,0x00000000,0x00000026,
0x0004003b,0x00000027,0x00000028,0x00000000,0x0002001a,0x0000002a,0x00040020,0x0000002b,
0x00000000,0x0000002a,0x0004003b,0x0000002b,0x0000002c,0x00000000,0x0003001b,0x0000002e,
0x00000026,0x0004002b,0x00000006,0x00000031,0x00000000,0x0004002b,0x0000000a,0x00000034,
0x00000000,0x0004002b,0x00000006,0x00000037,0x00000003,0x00040020,0x00000038,0x00000009,
0x00000013,0x00090019,0x0000003e,0x00000013,0x00000001,0x00000000,0x00000000,0x00000000,
0x00000002,0x00000007,0x00040020,0x0000003f,0x00000000,0x0000003e,0x0004003b,0x0000003f,
0x00000040,0x00000000,0x0004002b,0x00000013,0x00000043,0x00000000,0x0007002c,0x00000014,
0x00000044,0x00000043,0x00000043,0x00000043,0x00000043,0x00040017,0x00000046,0x00000013,
0x00000002,0x00040020,0x00000047,0x00000007,0x00000046,0x0004002b,0x00000013,0x0000004b,
0x3f000000,0x00040020,0x00000052,0x00000007,0x00000014,0x0004002b,0x00000013,0x00000056,
0x40000000,0x0004002b,0x00000013,0x00000058,0x3f800000,0x0004002b,0x0000000a,0x0000005a,
0x00000001,0x00040020,0x00000062,0x00000009,0x00000015,0x0004002b,0x0000000a,0x00000067,
0x00000003,0x0004002b,0x00000006,0x00000071,0x00000001,0x0004002b,0x0000000a,0x0000009f,
0x00000008,0x0006002c,0x0000000b,0x000000a0,0x0000009f,0x0000009f,0x0000005a,0x00050036,
0x00000002,0x00000004,0x00000000,0x00000003,0x000200f8,0x00000005,0x0004003b,0x00000008,
0x00000009,0x00000007,0x0004003b,0x00000024,0x00000025,0x00000007,0x0004003b,0x00000047,
0x00000048,0x00000007,0x0004003b,0x00000052,0x00000053,0x00000007,0x0004003b,0x00000052,
0x00000061,0x00000007,0x0004003b,0x00000052,0x00000070,0x00000007,0x0004003b,0x00000047,
0x00000082,0x00000007,0x0004003b,0x00000047,0x00000089,0x00000007,0x0004003d,0x0000000b,
0x0000000f,0x0000000d,0x0007004f,0x0000000e,0x00000010,0x0000000f,0x0000000f,0x00000000,
0x00000001,0x0004007c,0x00000007,0x00000011,0x00000010,0x0003003e,0x00000009,0x00000011,
0x0004003d,0x00000007,0x00000012,0x00000009,0x00050041,0x0000001a,0x0000001b,0x00000018,
0x00000019,0x0004003d,0x00000007,0x0000001c,0x0000001b,0x000500af,0x0000001e,0x0000001f,
0x00000012,0x0000001c,0x0004009a,0x0000001d,0x00000020,0x0000001f,0x000300f7,0x00000022,
0x00000000,0x000400fa,0x00000020,0x00000021,0x00000022,0x000200f8,0x00000021,0x000100fd,
0x000200f8,0x00000022,0x0004003d,0x00000026,0x00000029,0x00000028,0x0004003d,0x0000002a,
0x0000002d,0x0000002c,0x00050056,0x0000002e,0x0000002f,0x00000029,0x0000002d,0x0004003d,
0x00000007,0x00000030,0x00000009,0x00040064,0x00000026,0x00000032,0x0000002f,0x0007005f,
0x00000014,0x00000033,0x00000032,0x00000030,0x00000002,0x00000031,0x00050051,0x00000013,
0x00000035,0x00000033,0x00000000,0x0003003e,0x00000025,0x00000035,0x0004003d,0x00000013,
0x00000036,0x00000025,0x00050041,0x00000038,0x00000039,0x00000018,0x00000037,0x0004003d,
0x00000013,0x0000003a,0x00000039,0x000500b4,0x0000001d,0x0000003b,0x00000036,0x0000003a,
0x000300f7,0x0000003d,0x00000000,0x000400fa,0x0000003b,0x0000003c,0x0000003d,0x000200f8,
0x0000003c,0x0004003d,0x0000003e,0x00000041,0x00000040,0x0004003d,0x00000007,0x00000042,
0x00000009,0x00040063,0x00000041,0x00000042,0x00000044,0x000100fd,0x000200f8,0x0000003d,
0x0004003d,0x00000007,0x00000049,0x00000009,0x0004006f,0x00000046,0x0000004a,0x00000049,
0x00050050,0x00000046,0x0000004c,0x0000004b,0x0000004b,0x00050081,0x00000046,0x0000004d,
0x0000004a,0x0000004c,0x00050041,0x0000001a,0x0000004e,0x00000018,0x00000019,0x0004003d,
0x00000007,0x0000004f,0x0000004e,0x0004006f,0x00000046,0x00000050,0x0000004f,0x00050088,
0x00000046,0x00000051,0x0000004d,0x00000050,0x0003003e,0x00000048,0x00000051,0x00050041,
0x00000024,0x00000054,0x00000048,0x00000034,0x0004003d,0x00000013,0x00000055,0x00000054,
0x00050085,0x00000013,0x00000057,0x00000055,0x00000056,0x00050083,0x00000013,0x00000059,
0x00000057,0x00000058,0x00050041,0x00000024,0x0000005b,0x00000048,0x0000005a,0x0004003d,
0x00000013,0x0000005c,0x0000005b,0x00050085,0x00000013,0x0000005d,0x0000005c,0x00000056,
0x00050083,0x00000013,0x0000005e,0x00000058,0x0000005d,0x0004003d,0x00000013,0x0000005f,
0x00000025,0x00070050,0x00000014,0x00000060,0x00000059,0x0000005e,0x0000005f,0x00000058,
0x0003003e,0x00000053,0x00000060,0x00050041,0x00000062,0x00000063,0x00000018,0x00000031,
0x0004003d,0x00000015,0x00000064,0x00000063,0x0004003d,0x00000014,0x00000065,0x00000053,
0x00050091,0x00000014,0x00000066,0x00000064,0x00000065,0x0003003e,0x00000061,0x00000066,
0x00050041,0x00000024,0x00000068,0x00000061,0x00000067,0x0004003d,0x00000013,0x00000069,
0x00000068,0x000500b4,0x0000001d,0x0000006a,0x00000069,0x00000043,0x000300f7,0x0000006c,
0x00000000,0x000400fa,0x0000006a,0x0000006b,0x0000006c,0x000200f8,0x0000006b,0x0004003d,
0x0000003e,0x0000006d,0x00000040,0x0004003d,0x00000007,0x0000006e,0x00000009,0x00040063,
0x0000006d,0x0000006e,0x00000044,0x000100fd,0x000200f8,0x0000006c,0x00050041,0x00000062,
0x00000072,0x00000018,0x00000071,0x0004003d,0x00000015,0x00000073,0x00000072,0x0004003d,
0x00000014,0x00000074,0x00000061,0x00050041,0x00000024,0x00000075,0x00000061,0x00000067,
0x0004003d,0x00000013,0x00000076,0x00000075,0x00070050,0x00000014,0x00000077,0x00000076,
0x00000076,0x00000076,0x00000076,0x00050088,0x00000014,0x00000078,0x00000074,0x00000077,
0x00050091,0x00000014,0x00000079,0x00000073,0x00000078,0x0003003e,0x00000070,0x00000079,
0x00050041,0x00000024,0x0000007a,0x00000070,0x00000067,0x0004003d,0x00000013,0x0000007b,
0x0000007a,0x000500bc,0x0000001d,0x0000007c,0x0000007b,0x00000043,0x000300f7,0x0000007e,
0x00000000,0x000400fa,0x0000007c,0x0000007d,0x0000007e,0x000200f8,0x0000007d,0x0004003d,
0x0000003e,0x0000007f,0x00000040,0x0004003d,0x00000007,0x00000080,0x00000009,0x00040063,
0x0000007f,0x00000080,0x00000044,0x000100fd,0x000200f8,0x0000007e,0x0004003d,0x00000014,
0x00000083,0x00000070,0x0007004f,0x00000046,0x00000084,0x00000083,0x00000083,0x00000000,
0x00000001,0x00050041,0x00000024,0x00000085,0x00000070,0x00000067,0x0004003d,0x00000013,
0x00000086,0x00000085,0x00050050,0x00000046,0x00000087,0x00000086,0x00000086,0x00050088,
0x00000046,0x00000088,0x00000084,0x00000087,0x0003003e,0x00000082,0x00000088,0x00050041,
0x00000024,0x0000008a,0x00000082,0x00000034,0x0004003d,0x00000013,0x0000008b,0x0000008a,
0x00050085,0x00000013,0x0000008c,0x0000008b,0x0000004b,0x00050081,0x00000013,0x0000008d,
0x0000008c,0x0000004b,0x00050041,0x00000024,0x0000008e,0x00000082,0x0000005a,0x0004003d,
0x00000013,0x0000008f,0x0000008e,0x00050085,0x00000013,0x00000090,0x0000008f,0x0000004b,
0x00050083,0x00000013,0x00000091,0x0000004b,0x00000090,0x00050050,0x00000046,0x00000092,
0x0000008d,0x00000091,0x0003003e,0x00000089,0x00000092,0x0004003d,0x0000003e,0x00000093,
0x00000040,0x0004003d,0x00000007,0x00000094,0x00000009,0x0004003d,0x00000046,0x00000095,
0x00000089,0x0004003d,0x00000046,0x00000096,0x00000048,0x00050083,0x00000046,0x00000097,
0x00000095,0x00000096,0x00050041,0x0000001a,0x00000098,0x00000018,0x00000019,0x0004003d,
0x00000007,0x00000099,0x00000098,0x0004006f,0x00000046,0x0000009a,0x00000099,0x00050085,
0x00000046,0x0000009b,0x00000097,0x0000009a,0x00050051,0x00000013,0x0000009c,0x0000009b,
0x00000000,0x00050051,0x00000013,0x0000009d,0x0000009b,0x00000001,0x00070050,0x00000014,
0x0000009e,0x0000009c,0x0000009d,0x00000043,0x00000043,0x00040063,0x00000093,0x00000094,
0x0000009e,0x000100fd,0x00010038
};
25 changes: 25 additions & 0 deletions gpu/vk/shaders/dlss_color.comp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#version 450
// (hookshot) ported from Lichii (Eden lineage; Duck912's Eglantine work), GPL-3.0-or-later: vk_dlss.cpp

layout(local_size_x = 8, local_size_y = 8) in;
layout(binding = 0) uniform sampler2D guest_color;
layout(binding = 1, rgba16f) uniform writeonly image2D dlss_color;
layout(push_constant) uniform P { int encode; int fsr; } pc;

void main() {
ivec2 pixel = ivec2(gl_GlobalInvocationID.xy);
if (any(greaterThanEqual(pixel, imageSize(dlss_color)))) {
return;
}
// The guest has already tonemapped this square-root-encoded color for LDR (the network's input, RGB9E5). (hookshot) encode = 1:
// the tonemapped scene, the network's first passes left out (vk_draw.cpp), square-root encoded here the same way.
// dlss_output.comp squares it back
// (hookshot-amd) fsr = 1, AMD FSR 4.1: its LDR mode keeps history, where a NaN, infinite or out-of-range value would build up;
// and under its jitter moved up or left, the AMD driver draws nothing into the scene's last column or row (a stale near-white
// value, a flickering line on the right and bottom edges): they repeat the ones before them (vk_draw.cpp FsrJitter)
const ivec2 source = pc.fsr != 0 ? min(pixel, max(imageSize(dlss_color) - 2, ivec2(0))) : pixel;
vec3 c = max(texelFetch(guest_color, source, 0).rgb, vec3(0.0));
if (pc.fsr != 0 && (any(isnan(c)) || any(isinf(c)))) c = vec3(0.0);
c = pc.encode != 0 ? sqrt(c) : c;
imageStore(dlss_color, pixel, vec4(pc.fsr != 0 ? min(c, vec3(1.0)) : c, 1.0));
}
Loading