diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.md index f95df86f..d5476c6a 100644 --- a/THIRD_PARTY_NOTICES.md +++ b/THIRD_PARTY_NOTICES.md @@ -30,6 +30,8 @@ Code copied or adapted from another project is listed here with its source, the | SDL 3.4.20, dynamic link, `SDL3.dll` copied next to `totk.exe`. Developer builds use the MSYS2 build (`mingw-w64-ucrt-x86_64-sdl3`, which imports `libiconv-2.dll`, LGPL-2.1, unmodified, copied beside it); the installer release ships the upstream release `SDL3-3.4.20-win32-x64.zip`, which imports no libiconv | https://libsdl.org, Copyright (c) 1997-2026 Sam Lantinga | zlib | `runtime/input_win.c` (gamepad input, rumble, gyro and accelerometer) | | libopus (MSYS2 `mingw-w64-ucrt-x86_64-opus`), dynamic link, `libopus-0.dll` copied next to `totk.exe` | https://opus-codec.org, Copyright (c) 2001-2023 Xiph.Org, Skype Limited, Octasic, Jean-Marc Valin, Timothy B. Terriberry, CSIRO, Gregory Maxwell, Mark Borgerding, Erik de Castro Lopo, Mozilla, Amazon | BSD-3-Clause | `runtime/ov_media.c` (nn::codec hardware Opus decoder) | | Dear ImGui 1.91.9 (core and Vulkan back end, unmodified), as vendored by LAS Recomp | https://github.com/ocornut/imgui, via https://github.com/peiikai/LASRecomp @ `da35b83a9611d046a9a681aae668d7085954d37f` (`third_party/imgui/`), Copyright (c) 2014-2025 Omar Cornut | MIT | `runtime/third_party/imgui/` (compiled into `totk.exe` for the in-game menu, `runtime/ui/`) | +| AMD FidelityFX SDK 1.1.4 subset (public host and shader headers, frame interpolation and optical flow components, the Vulkan backend `ffx_vk.cpp` and its GLSL shaders, shared helpers), with three marked Savage Wind patches (64-byte aligned backend scratch arrays, doubled context size where `wchar_t` is 4 bytes, all six descriptor pool sizes) | https://github.com/GPUOpen-LibrariesAndSDKs/FidelityFX-SDK/tree/v1.1.4, Copyright (C) 2024 Advanced Micro Devices, Inc., via https://github.com/Revivedx/SavageWindRecomp @ `bf6146c14c37fee8781a601e5a544b93dff6d75e` (`third_party/FidelityFX/`) | MIT | `runtime/third_party/FidelityFX/` (compiled into `totk.exe`; licence text in `runtime/third_party/FidelityFX/LICENSE.txt`, shipped as `licenses/FidelityFX-SDK-LICENSE.txt`) | +| SavageWindRecomp FidelityFX build support and frame generation set-up: the SDK-to-clang compat header, the glslang SPIR-V shader generator with its resource reflection, the blob lookup and the backend and context creation of `runtime/nvn/vulkan/framegen.cpp`, the pair's present spacing of `runtime/nvn/vulkan/device.c` `present_wait_turn` | https://github.com/Revivedx/SavageWindRecomp @ `bf6146c14c37fee8781a601e5a544b93dff6d75e` (`third_party/FidelityFX/ffx_compat.h`, `tools/ffx_shaders.py`, `runtime/nvn/vulkan/framegen.cpp`, `runtime/nvn/vulkan/device.c`) | MIT | `runtime/third_party/FidelityFX/ffx_compat.h`, `runtime/third_party/FidelityFX/spirv/ffx_shaders_vk.h` (output of `tools/ffx_shaders.py`), `tools/ffx_shaders.py`, `runtime/vk_fg.cpp`, `runtime/vk_backend.c` (`present_pair`) | | SavageWindRecomp settings menu: two-pane option rows (row look, left / right stepping, hold speed-up, description pane), the menu style and tab bar | https://github.com/Revivedx/SavageWindRecomp @ `575ad88e02f9a89a9a885d90039d48af33c982f4` (`runtime/ui/option_rows.mm`, `runtime/ui/menu.mm`), Copyright (c) 2026 Revivedx and the Savage Wind Recomp contributors, Copyright (c) 2026 Peiikai | MIT | `runtime/ui/option_rows.cpp`, `runtime/ui/option_rows.h`, `runtime/ui/menu.cpp` | | SavageWindRecomp descriptor sets allocated in growing batches per layout | https://github.com/Revivedx/SavageWindRecomp @ `740b18025fe11ba03c117dbb56668db304b5043e` (`runtime/nvn/vulkan/exec.c` vk_alloc_set), Copyright (c) 2026 Revivedx and the Savage Wind Recomp contributors, Copyright (c) 2026 Peiikai | MIT | `runtime/vk_exec_draw.c` (alloc_set_batched) | | SavageWindRecomp performance overlay: the frame ring and its one-second summary, the NVML calls, the sampling loop, the full panel's layout | https://github.com/Revivedx/SavageWindRecomp @ `575ad88e02f9a89a9a885d90039d48af33c982f4` (`runtime/perfmon.c`, `runtime/perfmon.h`, `perf_overlay_draw` in `runtime/ui/menu.mm`), Copyright (c) 2026 Revivedx and the Savage Wind Recomp contributors, Copyright (c) 2026 Peiikai | MIT | `runtime/perfmon.c`, `runtime/perfmon.h`, `runtime/ui/menu.cpp` | diff --git a/docs/settings.md b/docs/settings.md index 3cce1e92..7ab6ac2a 100644 --- a/docs/settings.md +++ b/docs/settings.md @@ -143,6 +143,13 @@ Many rows below are developer tools that only act together with another setting | `dyn_delta` (default `1`) | Records only the pipeline dynamic states (cull mode, depth and stencil tests, vertex input, blend enables, equations and write masks, ...) whose values changed since the last draw in the command buffer, also across pipeline changes; `0` records the full set at every change of pipeline state, as before; `ab` alternates with the `ab` blocks. | Fewer commands per pipeline change on the render and recorder threads; a driver that loses dynamic state across pipeline binds would draw with stale state. `TOTK_TRACE=perf` prints the calls and commands per submission. | Caution | | `feedback` | `0` samples a target that an earlier draw of the same pass wrote with no barrier; `restart` ends and restarts the pass behind a full barrier; otherwise the feedback-loop layout is used when the GPU supports it. | `0` brings back the old behaviour that the barrier fixed, so the picture can break in passes that read a target they draw into; `restart` costs extra passes. | Risky | | `flush_span` (default `0`) | `1` copies one span from the lowest to the highest flushed address of a pool, as an older version did. | Copies far more data to the GPU in crowded towns: an estimated 30-50 ms of GPU time per large copy over PCIe 3.0 x8. | Caution | +| `frame_gen` (default `off`) | The frame generator: `off`, or `fsr3`, which brings up AMD FSR 3 frame interpolation and optical flow (FidelityFX SDK 1.1.4) at start; with DLSS off the replay follows the scene and records the motion vectors (the camera's and the moving objects', `fg_objects`), the picture before the HUD and the interpolation of a frame between each two the game draws (`runtime/vk_fg.cpp`). Each frame then goes out as two presents: the generated picture once the GPU has drawn the frame (a timeline wait, not before the pacer's time), the game's half the smoothed interval later (`runtime/vk_backend.c` `present_pair`); `fps_limit` counts the pictures shown and the game draws half, 30 at least (`runtime/frame_rate.c` `frame_step_cap_ns`). Off with DLSS, `replay_workers` above 0, `sync_ahead = 1` or HDR output, and while a menu background or a loading or event fade is open; the game then draws at the whole limit. The swapchain gets one image more. Applies at once: turned on in the menu, the contexts are made at the next frame (a hitch of about 0.1 s once); turned off, they stay until exit. | The controls answer at the drawn rate, about half a frame later. Costs about 1.5 ms of GPU and 0.6 ms of the replay thread per drawn frame at 1080p (RX 9070, 7900X on 4 cores: 94 drawn without it, 86 drawn and 169 shown with it, no limit). For displays of 120 Hz and more. | Caution | +| `fg_test` | Frame generation checks: `1` presents the generated frame in place of the game's, `2` the picture before the HUD. Read at start. | Shows the frames out of their order: for checks only. | Caution | +| `fg_debug` | `1`: the generated frames hold the SDK's debug view (motion fields, optical flow, disocclusion). Read at start. | For checks only. | Caution | +| `fg_objects` (default `1`) | Frame generation's motion vectors get the per-object pass DLSS uses over the camera's: the moving scene draws (characters, enemies, objects) are drawn again with last frame's blocks (`runtime/vk_exec_draw.c` `vk_mvobj_execute`, `runtime/vk_mvprev.c`). `0`: the camera's motion alone; Link, whom the camera follows, then carries the world's motion and the generated pictures show him twice. Read at start. `dlaa_objmv = 0` also turns the object pass off. | About 0.04 ms of GPU and 0.8 ms of the replay thread per drawn frame (RX 9070, 7900X on 4 cores, field, 1080p: 85.6 drawn with `0`, 80.0 with `1`), half of it the host copy of the uniform snapshot the object pass reads. | Safe | +| `fg_shot` | Frame generation shots: a present number, or `w` of world time; the window texture, the generated frame and the picture before the HUD of three frames from there go to `fg_shot_dir` as `fg__.png`. | Writes PNGs. | Safe | +| `fg_shot_dir` | Folder for the `fg_shot` PNGs (default the working folder). | Only moves the output. | Safe | +| `fg_times` (default `1`) | `0` turns off the GPU timestamps of frame generation's steps; every 600 generated frames a log line gives their GPU times and the replay thread's recording time (median, p99). | Timestamps cost next to nothing. | Safe | | `shadow_snap` (default `1`) | Shadow storage (Linux, Wine): `1` syncs the pools from per-submission write-watch snapshots, each 2 MiB region queried at most once per submission and shared with the texture checks; `0` queries each pool at every part of a submission, as before. | `1` cut the replay thread's write tracking from about 4.4 to 1.3 ms a frame on a Steam Deck; `0` is for comparison runs. Under Wine/Proton the default is `0` until it has been measured there; `1` turns it on. No effect where shadow storage is off (Windows by default). | Caution | | `freeze_idle` (default `60`) | Number of submissions a 2 MiB region stays unwritten before it is made read-only; `0` turns the freeze off. | A larger value keeps more regions writable and costs more write tracking; a write to a frozen region costs about 60 microseconds. | Caution | | `gpl_draw_build` (default `1`) | `0` leaves the missing shader libraries of a waiting draw to its background job instead of building them in parallel at once. | Draws whose pipeline is not ready are skipped meanwhile, until the job finishes. | Caution | diff --git a/runtime/cfg.c b/runtime/cfg.c index b0b1b695..3dc8ea10 100644 --- a/runtime/cfg.c +++ b/runtime/cfg.c @@ -42,8 +42,8 @@ static const char *const known[] = { "BIND_ZL", "BIND_ZR", "BARRIER_MERGE", "BLOCK_VIEWS_3D", "CLIMB_FIX", "CLOTH_REALTIME", "COLOR_BRIGHTNESS", "COLOR_CONTRAST", "COLOR_GAMMA", "COLOR_PRESET", "COLOR_SATURATION", "CONTACT_DEBUG", "CONTACT_SHADOWS", "CORE_DIAG", "CRIT", "CRIT_OUT", "DESC_TEMPLATE", "DESWIZZLE", "DEVICE_PROFILE", "DIALOGUE_CLICK", "DISCORD_APP_ID", "DISCORD_IMAGE", "DISCORD_RPC", "DLAA", "DLAA_CAM_JITTER", "DLAA_EFFECTS_AFTER", "DLAA_JITTER", "DLAA_MV", "DLAA_MASKDEBUG", "DLAA_MVDEBUG", "DLAA_OBJMV", "DLAA_SURVEY", "DLAA_TIMES", "DLSS", "DLSS_CHAR_MASK", "DLSS_FIXED_EXPOSURE", "DLSS_PRESET", "DLSS_REACTIVE", "DUMP", "DUMP_BUF", "DUMP_DIR", - "DUMP_LOG", "DYNAMIC_RES", "DYN_DELTA", "EXEFS", "FEEDBACK", "FIXED_RES_PATCH", "FIX_C0", "FIX_ZERO", "FLIGHT", "FLIGHT_AT", "FLIGHT_DIR", "FLIGHT_FRAMES", - "FLIGHT_SPIKE_MS", "FLIGHT_THUMBS", "FLUSH_SPAN", "FOV", "FOV_PATCH", "FPS60", "FPS_LIMIT", "FRAME_QUEUE", "FREECAM_KEY", "FREECAM_PAD", "FREECAM_PATCH", + "DUMP_LOG", "DYNAMIC_RES", "DYN_DELTA", "EXEFS", "FEEDBACK", "FG_DEBUG", "FG_OBJECTS", "FG_SHOT", "FG_SHOT_DIR", "FG_TEST", "FG_TIMES", "FIXED_RES_PATCH", "FIX_C0", "FIX_ZERO", "FLIGHT", "FLIGHT_AT", "FLIGHT_DIR", "FLIGHT_FRAMES", + "FLIGHT_SPIKE_MS", "FLIGHT_THUMBS", "FLUSH_SPAN", "FOV", "FOV_PATCH", "FPS60", "FPS_LIMIT", "FRAME_GEN", "FRAME_QUEUE", "FREECAM_KEY", "FREECAM_PAD", "FREECAM_PATCH", "FREEZE_IDLE", "FREE_CORES", "FULLSCREEN", "FXAA", "GAMEPLAY_DISTANCE_SENSITIVITY", "GAMEPLAY_ITEM_AD", "GAMEPLAY_ITEM_SENSITIVITY", "GAMEPLAY_ITEM_WHEEL", @@ -74,7 +74,7 @@ static const char *const known[] = { // The totk.ini section a key cfg_set may write goes to when the file lacks it (totk.ini.example's sections). static const struct { const char *key, *section; } sections[] = { - {"FPS_LIMIT", "frame rate"}, {"FPS60", "frame rate"}, {"FRAME_QUEUE", "frame rate"}, + {"FPS_LIMIT", "frame rate"}, {"FPS60", "frame rate"}, {"FRAME_QUEUE", "frame rate"}, {"FRAME_GEN", "frame rate"}, {"REALTIME", "frame rate"}, {"CLOTH_REALTIME", "frame rate"}, {"HIGHFPS_FIX", "frame rate"}, {"CLIMB_FIX", "frame rate"}, {"AUDIO_DRAIN_FIX", "frame rate"}, {"SHUTTER_FIX", "frame rate"}, {"FULLSCREEN", "display"}, {"WINDOW_SIZE", "display"}, {"PERF_OVERLAY", "display"}, {"VK_PRESENT", "display"}, @@ -161,6 +161,7 @@ static const CfgMeta metas[] = { {"PCSS", "0", "0..200", RESTART}, // Game {"FPS_LIMIT", "60", "30|40|45|60|90|120|144|display", LIVE}, {"FPS60", "1", "0|1", LIVE}, {"FRAME_QUEUE", "0", "0|1", LIVE}, + {"FRAME_GEN", "off", "off|fsr3", LIVE}, // the generator; vk_fg.cpp vk_fg_engine maps it {"REALTIME", "1", "0|1", RESTART}, {"CLOTH_REALTIME", "1", "0|1", RESTART}, {"MODS_REBUILD", "auto", "auto|off", RESTART}, {"MODS_WITHOUT_CODE", "0", "0|1", RESTART}, // 1: a mod is used without the code module it cannot run (mods.c) diff --git a/runtime/frame_rate.c b/runtime/frame_rate.c index 19014073..fafc3e6d 100644 --- a/runtime/frame_rate.c +++ b/runtime/frame_rate.c @@ -160,6 +160,11 @@ uint64_t frame_step_cap_ns(void) { double hz = limit_hz ? limit_hz : gfx_window_refresh_hz(); if (hz < LIMIT_MIN_HZ) hz = 60; // display rate unknown (no window yet) if (hz > LIMIT_MAX_HZ) hz = LIMIT_MAX_HZ; + // Frame generation (vk_backend.c present_pair) shows two pictures for each frame the game draws: the limit counts + // the pictures shown and the game draws half, 30 at least (Savage Wind's framepace_period_ns, PR #1089). Only + // while the last frame went out with a generated picture: a menu or a fade, which has none, keeps the whole limit. + // The real-time step follows the game's presents (frame_step_present), so it is the drawn frames' interval. + if (gfx_frame_gen_live()) hz = hz / 2 < LIMIT_MIN_HZ ? LIMIT_MIN_HZ : hz / 2; return (uint64_t)(1e9 / hz + 0.5); } diff --git a/runtime/gfx.h b/runtime/gfx.h index f5bf4aa1..c3dedfc8 100644 --- a/runtime/gfx.h +++ b/runtime/gfx.h @@ -23,6 +23,8 @@ uint64_t gfx_vsync_ticks(void); // ticks since start uint64_t gfx_vsync_time_ns(uint64_t tick); // kern_now_ns() time of a tick (pacing) double gfx_window_refresh_hz(void); // refresh rate of the window's monitor; 0 unknown int gfx_window_focused(void); +uint64_t gfx_presents_shown(void); // gfx_present.c: presents queued since the start (two a frame with frame generation) +int gfx_frame_gen_live(void); // vk_backend.c: the last frame was shown with a generated picture before it int gfx_picture_rect(float out[4]); // where the last present put the picture, fractions of the swapchain (x, y, w, h); 0 before one void gfx_present_hold(int on); // 1: the window keeps its last picture, nothing new is presented (quick load) // NVIDIA Reflex (gfx_present.c, VK_NV_low_latency2): the NVN front end and the input service mark a frame's stages. diff --git a/runtime/gfx_present.c b/runtime/gfx_present.c index 3ad68607..fc1ca561 100644 --- a/runtime/gfx_present.c +++ b/runtime/gfx_present.c @@ -27,6 +27,7 @@ #include "platform/platform.h" #include "ui/menu.h" #include "vk.h" +#include "vk_fg.h" #define FRAMES 2 #define MAX_IMAGES 16 @@ -143,8 +144,15 @@ static VmaAllocation g_cap_alloc; static uint8_t *g_cap_ptr; static VkDeviceSize g_cap_size; static int g_cap_w, g_cap_h, g_cap_valid; -static int g_flip_on; // vk_present_blit submitted the blit of swapchain image g_flip_idx; vk_present_flip presents it -static uint32_t g_flip_idx; +// vk_present_blit submitted the blits of swapchain images g_flip_idx[0 .. g_flip_n), oldest first; vk_present_flip +// presents the oldest. Two only with frame generation's pair (vk_present_blit_pair): the generated picture, then the +// game's frame. +static int g_flip_n; +static uint32_t g_flip_idx[2]; +static int g_flip_gen[2]; // that blit shows a generated picture: its present carries no present ID +static volatile int64_t g_shown; // presents queued since the start (gfx_presents_shown) +static int g_overlay_on; // the pair's generated picture laid the menu out: the game's frame draws it again +static int g_fg_images = -1; // the swapchain was built with frame generation's extra image (build_swapchain) // ---- TOTK_FLIGHT thumbnails (flight.c; g_pl): each present also blits the swapchain image down into slot frame % g_th_n // of a host-visible ring. A slot's tag names the frame it holds complete; recording a new frame clears the tag first, @@ -259,6 +267,8 @@ static void window_settings_live(void) { snprintf(present, sizeof present, "%s", e); if (started) plat_xchg32(&g_dirty, 1); } + // frame_gen switched in the menu: the swapchain is built again with its image count + if (started && g_fg_images >= 0 && (vk_fg_engine() != VK_FG_OFF) != g_fg_images) plat_xchg32(&g_dirty, 1); if (started) gfx_window_apply_settings(); reflex_apply_locked(); started = 1; @@ -278,7 +288,7 @@ static uint64_t g_reflex_val; static uint64_t g_reflex_frame_next; // the last ID handed out static uint64_t g_reflex_frame; // the frame the game simulates now static _Thread_local uint64_t t_reflex_submit; // the frame whose work this thread submits; 0: g_reflex_frame -static uint64_t g_blit_pid, g_flip_pid; // the frame of the blit being made and of the present waiting (g_pl) +static uint64_t g_blit_pid, g_flip_pid[2]; // the frame of the blit being made and of each present waiting (g_pl) static uint64_t g_last_pid; // the last present ID presented (g_pl): present IDs only go up static int g_reflex_mode = -1; // 0=off, 1=on, 2=boost static uint32_t g_reflex_min_us = 1; @@ -468,19 +478,25 @@ static VkPresentModeKHR pick_present_mode(VkPhysicalDevice pd) { const char *gfx_window_present_mode(void) { return __atomic_load_n(&g_present_got, __ATOMIC_ACQUIRE); } -// Queues the present of a blit vk_present_blit left waiting (g_pl held). A swapchain rebuild and the next blit flush it -// first; the device release drops it. -static void flip_locked(void) { - if (!g_flip_on) return; - g_flip_on = 0; +// Queues the present of the oldest blit vk_present_blit left waiting (g_pl held). +static void flip_one(void) { + if (!g_flip_n) return; + uint32_t idx = g_flip_idx[0]; + uint64_t frame_pid = g_flip_pid[0]; + int generated = g_flip_gen[0]; + g_flip_idx[0] = g_flip_idx[1], g_flip_pid[0] = g_flip_pid[1], g_flip_gen[0] = g_flip_gen[1]; + g_flip_n--; if (!g_sc) return; VkCtx *c = vk_ctx(); uint64_t pid = 0; VkPresentIdKHR pid_info = {0}; - if (c && c->has_nv_reflex) { + // A generated picture goes out between two frames whose IDs follow each other: no ID is left for it, and the + // game's frame after it keeps the one its markers were set with (the rule of PR #1089) + int with_id = c && c->has_nv_reflex && !generated; + if (with_id) { // The frame's own ID; a present without one (a probe, a skipped frame's neighbour) takes the next free value, // as present IDs must grow on a swapchain - pid = g_flip_pid > g_last_pid ? g_flip_pid : g_last_pid + 1; + pid = frame_pid > g_last_pid ? frame_pid : g_last_pid + 1; g_last_pid = pid; pid_info.sType = VK_STRUCTURE_TYPE_PRESENT_ID_KHR; pid_info.swapchainCount = 1; @@ -488,17 +504,26 @@ static void flip_locked(void) { vk_reflex_marker(4, pid); // VK_LATENCY_MARKER_PRESENT_START_NV } VkPresentInfoKHR pi = {.sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR, - .pNext = (c && c->has_nv_reflex) ? &pid_info : NULL, + .pNext = with_id ? &pid_info : NULL, .waitSemaphoreCount = 1, - .pWaitSemaphores = &g_render_done[g_flip_idx], .swapchainCount = 1, .pSwapchains = &g_sc, - .pImageIndices = &g_flip_idx}; + .pWaitSemaphores = &g_render_done[idx], .swapchainCount = 1, .pSwapchains = &g_sc, + .pImageIndices = &idx}; vk_queue_lock(); VkResult r = vkQueuePresentKHR(c->gfx_queue, &pi); vk_queue_unlock(); - if (c && c->has_nv_reflex) vk_reflex_marker(5, pid); // VK_LATENCY_MARKER_PRESENT_END_NV - if (c) latency_note(c, pid ? pid : g_flip_pid); + if (with_id) vk_reflex_marker(5, pid); // VK_LATENCY_MARKER_PRESENT_END_NV + if (c && !generated) latency_note(c, pid ? pid : frame_pid); vk_device_fault_report(r); if (r == VK_ERROR_OUT_OF_DATE_KHR || r == VK_SUBOPTIMAL_KHR) plat_xchg32(&g_dirty, 1); + __atomic_add_fetch(&g_shown, 1, __ATOMIC_RELAXED); +} + +uint64_t gfx_presents_shown(void) { return (uint64_t)__atomic_load_n(&g_shown, __ATOMIC_RELAXED); } + +// Every blit left waiting goes out, in order (g_pl held): before a swapchain rebuild and before the next blit (but the +// pair's second); the device release drops them. +static void flip_locked(void) { + while (g_flip_n) flip_one(); } static void free_capture(void) { @@ -533,7 +558,10 @@ static int build_swapchain(void) { if (fmts[i].format == VK_FORMAT_B8G8R8A8_UNORM && fmts[i].colorSpace == VK_COLOR_SPACE_SRGB_NONLINEAR_KHR) { sf = fmts[i]; found = 1; } for (uint32_t i = 0; i < nf && !found; i++) if (fmts[i].format == VK_FORMAT_R8G8B8A8_UNORM && fmts[i].colorSpace == VK_COLOR_SPACE_SRGB_NONLINEAR_KHR) { sf = fmts[i]; found = 1; } - uint32_t count = caps.minImageCount + 1; + // Frame generation's pair holds two images acquired at once (the generated picture's blit waits while the game's + // frame is blitted): one image more, while frame_gen names a generator + int fg_images = g_fg_images = vk_fg_engine() != VK_FG_OFF; + uint32_t count = caps.minImageCount + 1 + (fg_images ? 1u : 0u); if (caps.maxImageCount && count > caps.maxImageCount) count = caps.maxImageCount; if (count > 8) count = 8; @@ -584,6 +612,12 @@ static int build_swapchain(void) { } free_capture(); vk_queue_unlock(); + if (fg_images) { + static uint32_t said; + if (said != g_sc_n) + said = g_sc_n, rt_log("gfx: swapchain of %u images (minimum %u; one more for frame generation's pair)", g_sc_n, + caps.minImageCount); + } // The Reflex sleep mode belongs to the swapchain: a new one (resize, fullscreen, out of date) starts with low // latency off, so the mode is set on it again even though the setting did not change. g_reflex_mode = -1; @@ -800,12 +834,16 @@ void gfx_fit_rect(int cw, int ch, int dw, int dh, int out[4]) { static volatile int32_t g_hold; void gfx_present_hold(int on) { plat_xchg32(&g_hold, on != 0); } -static void present_image(VkImage src, VkImageLayout layout, VkFormat fmt, int w, int h, const int crop[4], int defer) { - int general = layout == VK_IMAGE_LAYOUT_GENERAL; +// pair: 0 a present of its own; 1 frame generation's generated picture, the first of a pair; 2 the game's frame after +// it, which leaves the first blit's present waiting in front of its own and draws the menu as that blit laid it out. +// Returns 1 when the blit was submitted. +static int present_image(VkImage src, VkImageLayout layout, VkFormat fmt, int w, int h, const int crop[4], int defer, + int pair) { + int general = layout == VK_IMAGE_LAYOUT_GENERAL, done = 0; gfx_window_start(); VkCtx *c = vk_ctx(); plat_rmutex_lock(&g_pl); - flip_locked(); + if (pair != 2) flip_locked(); if (plat_cas32(&g_hold, 0, 0)) goto out; if (!g_sc || plat_cas32(&g_dirty, 0, 0)) { if (!wsys_minimized() && !create_swapchain() && !g_sc) goto out; @@ -846,10 +884,16 @@ static void present_image(VkImage src, VkImageLayout layout, VkFormat fmt, int w MenuTarget mt = {c->instance, c->phys, c->device, c->gfx_family, c->gfx_queue, g_sc_hdr ? VK_FORMAT_R8G8B8A8_UNORM : g_sc_fmt, g_sc_ext.width, g_sc_ext.height, cw, ch, g_scaler}; - int overlay = g_sc_view[idx] && + int overlay; + if (pair == 2) { + overlay = g_sc_view[idx] && g_overlay_on; + } else { + overlay = g_sc_view[idx] && menu_overlay_frame(__atomic_load_n(&gfx_counters.frames, __ATOMIC_RELAXED), &mt, &menu_shot); + g_overlay_on = overlay; + } int cap = (g_capture || menu_shot) && ensure_capture_buffer(); - int thumb = g_th_n && ensure_thumbs(); + int thumb = pair != 1 && g_th_n && ensure_thumbs(); // the flight recorder keeps the game's frames VkCommandBuffer cb = g_cb[slot]; vkResetCommandBuffer(cb, 0); @@ -962,9 +1006,11 @@ static void present_image(VkImage src, VkImageLayout layout, VkFormat fmt, int w r = vkQueueSubmit2(c->gfx_queue, 1, &si, g_fence[slot]); vk_queue_unlock(); if (r == VK_SUCCESS) { - g_flip_on = 1; - g_flip_idx = idx; - g_flip_pid = g_blit_pid; // the frame this blit shows (vk_reflex_present_frame) + if (g_flip_n == 2) flip_one(); // (not reached: every blit but a pair's second flushes the waiting ones) + g_flip_pid[g_flip_n] = g_blit_pid; // the frame this blit shows (vk_reflex_present_frame) + g_flip_gen[g_flip_n] = pair == 1; + g_flip_idx[g_flip_n++] = idx; + done = 1; if (!defer) flip_locked(); } else { vk_device_fault_report(r); @@ -981,19 +1027,30 @@ static void present_image(VkImage src, VkImageLayout layout, VkFormat fmt, int w } out: plat_rmutex_unlock(&g_pl); + return done; } void vk_present_image(VkImage src, VkImageLayout layout, VkFormat fmt, int w, int h, const int crop[4]) { - present_image(src, layout, fmt, w, h, crop, 0); + present_image(src, layout, fmt, w, h, crop, 0, 0); } void vk_present_blit(VkImage src, VkImageLayout layout, VkFormat fmt, int w, int h, const int crop[4]) { - present_image(src, layout, fmt, w, h, crop, 1); + present_image(src, layout, fmt, w, h, crop, 1, 0); +} + +int vk_present_blit_pair(VkImage gen, VkImage src, VkFormat fmt, int w, int h, const int crop[4]) { + // without the first blit (no swapchain, minimised, held) the game's frame goes alone, as any present + if (!present_image(gen, VK_IMAGE_LAYOUT_GENERAL, VK_FORMAT_R8G8B8A8_UNORM, w, h, crop, 1, 1)) { + present_image(src, VK_IMAGE_LAYOUT_GENERAL, fmt, w, h, crop, 1, 0); + return 0; + } + present_image(src, VK_IMAGE_LAYOUT_GENERAL, fmt, w, h, crop, 1, 2); + return 1; } void vk_present_flip(void) { plat_rmutex_lock(&g_pl); - flip_locked(); + flip_one(); plat_rmutex_unlock(&g_pl); } @@ -1013,7 +1070,7 @@ void gfx_window_release_vk(void) { vk_queue_lock(); vkDeviceWaitIdle(c->device); vk_queue_unlock(); - g_flip_on = 0; // its blit is done (device idle); the swapchain goes away unpresented + g_flip_n = 0; // their blits are done (device idle); the swapchain goes away unpresented menu_vk_release(); vk_fsr_release(); vk_color_release(); diff --git a/runtime/third_party/FidelityFX/LICENSE.txt b/runtime/third_party/FidelityFX/LICENSE.txt new file mode 100644 index 00000000..3712e34a --- /dev/null +++ b/runtime/third_party/FidelityFX/LICENSE.txt @@ -0,0 +1,21 @@ +This file is part of the FidelityFX SDK. + +Copyright (C) 2024 Advanced Micro Devices, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files(the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions : + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/runtime/third_party/FidelityFX/README.md b/runtime/third_party/FidelityFX/README.md new file mode 100644 index 00000000..f3940c99 --- /dev/null +++ b/runtime/third_party/FidelityFX/README.md @@ -0,0 +1,32 @@ +# AMD FidelityFX SDK 1.1.4 (subset) + +From , MIT (`LICENSE.txt`), via Savage Wind +(, MIT, `third_party/FidelityFX`). `runtime/vk_fg.cpp` drives the frame +interpolation and optical flow of FSR 3 on the SDK's Vulkan backend directly, without the SDK's frame interpolation +swapchain or its ffx-api DLL layer. + +What is here: + +- `sdk/include/FidelityFX/host`: the SDK's public headers; `gpu`: the shader headers of frame interpolation, optical + flow and SPD (which optical flow includes). Left out against Savage Wind's copy: the FSR 3 upscaler's and FSR 1's + shader headers (`gpu/fsr3upscaler`, `gpu/fsr1`), its component and its GLSL. The host headers of the upscaler and + the other effects stay, unchanged, because the SDK's own headers include each other. +- `sdk/src/components/frameinterpolation`, `opticalflow`: the two effects. +- `sdk/src/backends/vk/ffx_vk.cpp` and its `shaders/frameinterpolation`, `shaders/opticalflow` (GLSL). +- `sdk/src/shared`: the SDK's assert, message and object-management helpers. +- `sdk/src/backends/shared/ffx_shader_blobs.h`: the declaration of the blob lookup, which `runtime/vk_fg.cpp` implements. +- `spirv/ffx_shaders_vk.h`: the shaders compiled to SPIR-V with their bindings, by `tools/ffx_shaders.py` + (glslangValidator from MSYS2 UCRT64 or the Vulkan SDK) in place of the SDK's Windows-only FidelityFX_SC.exe. Only the + permutations used. Committed like `runtime/*_spv.h`: AMD's shaders, no game data. Regenerate after changing the GLSL: + `python tools/ffx_shaders.py`. +- `ffx_compat.h`: force-included into the SDK's sources (`tools/build_game.py`, rule `cc_ffx`) so they build with clang. + +Changes to the SDK's files (marked "Savage Wind" in them): + +- `sdk/src/backends/vk/ffx_vk.cpp`: the arrays the backend lays out in its scratch memory are aligned to 64 bytes + instead of 4, and start 64-byte aligned after its context. With 4, clang's aligned SSE stores into them (`movdqa`) + faulted; MSVC emits unaligned ones. +- `sdk/include/FidelityFX/host/ffx_types.h`: the contexts' default size is doubled outside Windows, where `wchar_t` + (their resources' debug names) is 4 bytes instead of 2. +- `sdk/src/backends/vk/ffx_vk.cpp`: the global descriptor pool is created with all six of the sizes it lists. It passed + five, leaving out the storage buffers (the validation layer reports it). diff --git a/runtime/third_party/FidelityFX/ffx_compat.h b/runtime/third_party/FidelityFX/ffx_compat.h new file mode 100644 index 00000000..e263ff2d --- /dev/null +++ b/runtime/third_party/FidelityFX/ffx_compat.h @@ -0,0 +1,67 @@ +// Savage Wind: force-included (-include) into the FidelityFX SDK's C++ sources, so that they build with clang/gcc +// (MinGW-w64 and Linux) unchanged: what MSVC's headers bring in on their own, and its _s functions where the C library +// has none. +#pragma once +#ifdef __cplusplus +#include +#include // (std::wstring_convert, which ffx_vk.cpp uses for the debug names: MSVC's headers bring it) +#include +#include +#include +#include +#include +#include +#endif + +#if !defined(_MSC_VER) +#define swprintf_s swprintf // (the SDK passes the size) +#if defined(__cplusplus) && !defined(_countof) +template constexpr size_t ffx_countof_(T (&)[N]) { return N; } +#define _countof(a) ffx_countof_(a) // (stdlib.h's on Windows; glibc has none) +#endif +#if !defined(_WIN32) +#include +#include +static inline int wcscpy_s(wchar_t *d, size_t n, const wchar_t *s) { + size_t l = wcslen(s); + if (l >= n) l = n - 1; + wmemcpy(d, s, l); + d[l] = 0; + return 0; +} +static inline int wcscat_s(wchar_t *d, size_t n, const wchar_t *s) { + size_t l = wcslen(d); + return l < n ? wcscpy_s(d + l, n - l, s) : 0; +} +static inline int strcpy_s(char *d, size_t n, const char *s) { + size_t l = strlen(s); + if (l >= n) l = n - 1; + memcpy(d, s, l); + d[l] = 0; + return 0; +} +#ifdef __cplusplus +template static inline int wcscpy_s(wchar_t (&d)[N], const wchar_t *s) { return wcscpy_s(d, N, s); } +template static inline int strcpy_s(char (&d)[N], const char *s) { return strcpy_s(d, N, s); } +template static inline int sprintf_s(char (&d)[N], const char *f, A... a) { return snprintf(d, N, f, a...); } +template static inline int sprintf_s(char *d, size_t n, const char *f, A... a) { return snprintf(d, n, f, a...); } +#endif +#ifndef FFX_UNUSED +#define FFX_UNUSED(x) ((void)(x)) // (ffx_message.cpp: defined by the SDK's Windows headers only) +#endif +#define sprintf_s snprintf // (the SDK passes the size and uses what it returns: the length written) +#ifndef _countof +#define _countof(a) (sizeof(a) / sizeof((a)[0])) // (MSVC's and MinGW's stdlib.h have it) +#endif +#endif +#endif + +// The contexts are opaque arrays of FFX_SDK_DEFAULT_CONTEXT_SIZE words, sized for Windows, where wchar_t is 2 bytes: +// with Linux's 4-byte wchar_t the frame interpolation context's own part is 768,072 bytes (401,992 with 2-byte +// wchar_t), past its 524,288 (a static assertion in ffx_frameinterpolation.cpp). Twice the room where wchar_t is wider. +#include +#if __SIZEOF_WCHAR_T__ > 2 +#undef FFX_SDK_DEFAULT_CONTEXT_SIZE +#define FFX_SDK_DEFAULT_CONTEXT_SIZE (1024 * 256) +#endif +#define FFX_UNUSED(x) ((void)(x)) // (as ffx_util.h has it: ffx_message.cpp uses it through ffx_assert.h alone) diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/brixelizer/ffx_brixelizer_host_gpu_shared.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/brixelizer/ffx_brixelizer_host_gpu_shared.h new file mode 100644 index 00000000..7afa787d --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/brixelizer/ffx_brixelizer_host_gpu_shared.h @@ -0,0 +1,230 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#ifndef FFX_BRIXELIZER_HOST_GPU_SHARED_H +#define FFX_BRIXELIZER_HOST_GPU_SHARED_H + +#include "../ffx_core.h" + +#define FFX_BRIXELIZER_MAX_CASCADES 24 +#define FFX_BRIXELIZER_MAX_INSTANCES (FfxUInt32(1) << FfxUInt32(16)) +#define FFX_BRIXELIZER_CASCADE_RESOLUTION 64 +#define FFX_BRIXELIZER_MAX_INSTANCES (FfxUInt32(1) << FfxUInt32(16)) +#define FFX_BRIXELIZER_INVALID_ID 0x00ffffffu +#define FFX_BRIXELIZER_UNINITIALIZED_ID 0xffffffffu +#define FFX_BRIXELIZER_INVALID_BOTTOM_AABB_NODE 0x7fff +#define FFX_BRIXELIZER_MAX_BRICKS_X8 (1 << 18) +#define FFX_BRIXELIZER_MAX_BRICKS FFX_BRIXELIZER_MAX_BRICKS_X8 +#define FFX_BRIXELIZER_BRICK_AABBS_STRIDE (sizeof(FfxUInt32)) +#define FFX_BRIXELIZER_BRICK_AABBS_SIZE (FFX_BRIXELIZER_MAX_BRICKS_X8 * FFX_BRIXELIZER_BRICK_AABBS_STRIDE) +#define FFX_BRIXELIZER_CASCADE_AABB_TREE_SIZE ((16 * 16 * 16) * sizeof(FfxUInt32) + (4 * 4 * 4 + 1) * sizeof(FfxFloat32x3) * 2) +#define FFX_BRIXELIZER_CASCADE_AABB_TREE_STRIDE (sizeof(FfxUInt32)) +#define FFX_BRIXELIZER_CASCADE_BRICK_MAP_SIZE (FFX_BRIXELIZER_CASCADE_RESOLUTION * FFX_BRIXELIZER_CASCADE_RESOLUTION * FFX_BRIXELIZER_CASCADE_RESOLUTION * sizeof(FfxUInt32)) +#define FFX_BRIXELIZER_CASCADE_BRICK_MAP_STRIDE (sizeof(FfxUInt32)) + +#define FFX_BRIXELIZER_BRICK_ID_MASK 0xffffff + +#define FFX_BRIXELIZER_CASCADE_DEGREE FfxUInt32(6) +#define FFX_BRIXELIZER_CASCADE_WRAP_MASK FfxUInt32(63) + +#define FFX_BRIXELIZER_STATIC_CONFIG_SDF_ATLAS_SIZE FfxUInt32(512) + +#if defined(FFX_CPU) + #define FFX_BRIXELIZER_CONST static const +#elif defined(FFX_HLSL) + #define FFX_BRIXELIZER_CONST static const +#elif defined(FFX_GLSL) + #define FFX_BRIXELIZER_CONST const +#else + FFX_STATIC_ASSERT(0) +#endif + +#ifdef FFX_CPU + #define FFX_BRIXELIZER_BEGIN_STRUCT(name) typedef struct name { + #define FFX_BRIXELIZER_END_STRUCT(name) } name; + #define FFX_BRIXELIZER_BEGIN_ENUM(name) typedef enum name { + #define FFX_BRIXELIZER_END_ENUM(name) } name; + #define FFX_BRIXELIZER_ENUM_VALUE(name, value) name = value, +#else + #define FFX_BRIXELIZER_BEGIN_STRUCT(name) struct name { + #define FFX_BRIXELIZER_END_STRUCT(name) }; + #define FFX_BRIXELIZER_BEGIN_ENUM(name) + #define FFX_BRIXELIZER_END_ENUM(name) + #define FFX_BRIXELIZER_ENUM_VALUE(name, value) FFX_BRIXELIZER_CONST FfxUInt32 name = value; +#endif + +/// An enumeration of flags which can be specified for different options when doing a cascade update. +/// +/// @ingroup Brixelizer +FFX_BRIXELIZER_BEGIN_ENUM(FfxBrixelizerCascadeUpdateFlags) + FFX_BRIXELIZER_ENUM_VALUE(FFX_BRIXELIZER_CASCADE_UPDATE_FLAG_NONE, FfxUInt32(0)) ///< No flags. + FFX_BRIXELIZER_ENUM_VALUE(FFX_BRIXELIZER_CASCADE_UPDATE_FLAG_RESET, FfxUInt32(1) << FfxUInt32(0)) ///< Reset the cascade. This clears and frees all bricks currently in the cascade ready to rebuild the cascade completely. +FFX_BRIXELIZER_END_ENUM(FfxBrixelizerCascadeUpdateFlags) + +/// An enumeration of the different possible debug outputs for the Brixelizer debug visualization. +/// +/// @ingroup Brixelizer +FFX_BRIXELIZER_BEGIN_ENUM(FfxBrixelizerTraceDebugModes) + FFX_BRIXELIZER_ENUM_VALUE(FFX_BRIXELIZER_TRACE_DEBUG_MODE_DISTANCE, 0) ///< Display a visualisation of the distance to hit, with closer hits in blue and further hits in green. + FFX_BRIXELIZER_ENUM_VALUE(FFX_BRIXELIZER_TRACE_DEBUG_MODE_UVW, 1) ///< Display the UVW coordinates of hits. + FFX_BRIXELIZER_ENUM_VALUE(FFX_BRIXELIZER_TRACE_DEBUG_MODE_ITERATIONS, 2) ///< Display a heatmap visualizing number of iterations in the scene. + FFX_BRIXELIZER_ENUM_VALUE(FFX_BRIXELIZER_TRACE_DEBUG_MODE_GRAD, 3) ///< Display the normals at hits. + FFX_BRIXELIZER_ENUM_VALUE(FFX_BRIXELIZER_TRACE_DEBUG_MODE_BRICK_ID, 4) ///< Display each brick in its own color. + FFX_BRIXELIZER_ENUM_VALUE(FFX_BRIXELIZER_TRACE_DEBUG_MODE_CASCADE_ID, 5) ///< Display each cascade in itw own color. +FFX_BRIXELIZER_END_ENUM(FfxBrixelizerTraceDebugModes) + +/// A structure of parameters describing a cascade. This structure is primarily for Brixelizer +/// internal use. +/// +/// @ingroup Brixelizer +FFX_BRIXELIZER_BEGIN_STRUCT(FfxBrixelizerCascadeInfo) + FfxFloat32x3 grid_min; + FfxFloat32 voxel_size; + + FfxFloat32x3 grid_max; + FfxUInt32 flags; ///< the latest build_flags; see FfxBrixelizerCascadeUpdateFlags + + FfxUInt32x3 clipmap_offset; + FfxUInt32 pad00; + + FfxInt32x3 clipmap_invalidation_offset; + FfxUInt32 pad33; + + FfxInt32x3 ioffset; + FfxUInt32 index; + + FfxFloat32x3 grid_mid; + FfxUInt32 is_enabled; + + FfxUInt32x2 rel_grid_min_fp16; + FfxUInt32x2 rel_grid_max_fp16; + + FfxUInt32 pad11; + FfxUInt32 pad22; + FfxFloat32 ivoxel_size; + FfxUInt32 is_initialized; +FFX_BRIXELIZER_END_STRUCT(FfxBrixelizerCascadeInfo) + +/// A structure of parameters describing the Brixelizer context. This structure is primarily +/// for Brixelizer internal use. +/// +/// @ingroup Brixelizer +FFX_BRIXELIZER_BEGIN_STRUCT(FfxBrixelizerContextInfo) + FfxUInt32 num_bricks; + FfxUInt32 frame_index; + FfxFloat32 imesh_unit; + FfxFloat32 mesh_unit; + + FfxBrixelizerCascadeInfo cascades[FFX_BRIXELIZER_MAX_CASCADES]; +FFX_BRIXELIZER_END_STRUCT(FfxBrixelizerContextInfo) + +// ============================================================================= +// Debug/context counters +// ============================================================================= +// Important to match the first a couple of counters with the FfxBrixelizerScratchCounters to share code +#define MEMBER_LIST \ + MEMBER(brickCount, BRICK_COUNT, 0) \ + MEMBER(dirtyBricks, DIRTY_BRICKS, 1) \ + MEMBER(freeBricks, FREE_BRICKS, 2) \ + MEMBER(clearBricks, CLEAR_BRICKS, 3) \ + MEMBER(mergeBricks, MERGE_BRICKS, 4) \ + MEMBER(numDebugAABBs, NUM_DEBUG_AABBS, 5) + +/// A structure containing all the counters used by the Brixelizer context. These can +/// be read back from the context after processing each update for analysis. +/// brickCount gives the total number of bricks allocated. +/// dirtyBricks gives the total number of bricks requiring an eikonal pass for completion. +/// freeBricks gives the total number of free bricks. This is the maximum number of bricks which can be allocated within a frame. +/// clearBricks gives the total number of bricks to be cleared in a frame. Bricks are cleared by having all distance values reset to 1. +/// mergeBricks gives the total number of bricks to be merged in a frame. +/// numDebugAABBs gives the total number of debug AABBs requested to be drawn in a debug visualization. +/// +/// @ingroup Brixelizer +FFX_BRIXELIZER_BEGIN_STRUCT(FfxBrixelizerDebugCounters) +#define MEMBER(camel_name, _upper_name, _index) FfxUInt32 camel_name; + MEMBER_LIST +#undef MEMBER +FFX_BRIXELIZER_END_STRUCT(FfxBrixelizerDebugCounters) + +FFX_BRIXELIZER_BEGIN_ENUM(FfxBrixelizerContextCounterIndex) +#define MEMBER(_camel_name, upper_name, index) FFX_BRIXELIZER_ENUM_VALUE(FFX_BRIXELIZER_CONTEXT_COUNTER_##upper_name, index) + MEMBER_LIST +#undef MEMBER +FFX_BRIXELIZER_END_ENUM(FfxBrixelizerContextCounterIndex) + +#define MEMBER(_camel_name, _upper_name, _index) + 1 +FFX_BRIXELIZER_CONST FfxUInt32 FFX_BRIXELIZER_NUM_CONTEXT_COUNTERS = 0 MEMBER_LIST; +#undef MEMBER +#undef MEMBER_LIST + +// ============================================================================= +// Scratch counters +// ============================================================================= +#define MEMBER_LIST \ + MEMBER(triangles, TRIANGLES, 0) \ + MEMBER(maxTriangles, MAX_TRIANGLES, 1) \ + MEMBER(references, REFERENCES, 2) \ + MEMBER(maxReferences, MAX_REFERENCES, 3) \ + MEMBER(groupIndex, GROUP_INDEX, 4) \ + MEMBER(compressionBricks, COMPRESSION_BRICKS, 5) \ + MEMBER(storageOffset, STORAGE_OFFSET, 6) \ + MEMBER(storageSize, STORAGE_SIZE, 7) \ + MEMBER(numBricksAllocated, NUM_BRICKS_ALLOCATED, 8) \ + MEMBER(clearBricks, CLEAR_BRICKS, 9) + +/// A structure containing the counters used by the Brixelizer context for each cascade +/// update. This can be readback and used for analysis after each update. The following +/// members contain useful information for analysing Brixelizer resource usage. +/// +/// triangles is used to store the total amount of storage space requested within the triangle buffer during an update. This is useful for determining a sensible value of triangleSwapSize in either FfxBrixelizerRawCascadeUpdateDescription or FfxBrixelizerUpdateDescription. +/// references is used to store the total number of reference allocations requested by Brixelizer during an update. This is useful for determining a sensible value of maxReferences in either FfxBrixelizerRawCascadeUpdateDescription or FfxBrixelizerUpdateDescription. +/// numBricksAllocated is used to store the number of brick allocations requested in an update. This is useful for determining a sensible value of maxBricksPerBake in either FfxBrixelizerRawCascadeUpdateDescription or FfxBrixelizerUpdateDescription. +/// +/// The following counters are used internally by Brixelizer. +/// +/// maxTriangles is used to store the storage size of the triangle buffer. +/// maxReferences is used to store the maxmimum number of references that can be stored. +/// groupIndex is used as a global atomic for wavefront synchronisation. +/// compressionBricks the number of bricks to compress (i.e. calculate AABBs for) this udpate. +/// storageOffset the next free position in the bricks scratch buffer. +/// storageSize the size of the bricks scratch buffer. +/// clearBricks the amount of bricks in the scratch buffer to initialize. +/// +/// @ingroup Brixelizer +FFX_BRIXELIZER_BEGIN_STRUCT(FfxBrixelizerScratchCounters) +#define MEMBER(camel_name, _upper_name, _index) FfxUInt32 camel_name; + MEMBER_LIST +#undef MEMBER +FFX_BRIXELIZER_END_STRUCT(FfxBrixelizerScratchCounters) + +FFX_BRIXELIZER_BEGIN_ENUM(FfxBrixelizerScratchCounterIndex) +#define MEMBER(_camel_name, upper_name, index) FFX_BRIXELIZER_ENUM_VALUE(FFX_BRIXELIZER_SCRATCH_COUNTER_##upper_name, index) + MEMBER_LIST +#undef MEMBER +FFX_BRIXELIZER_END_ENUM(FfxBrixelizerScratchCounterIndex) + +#define MEMBER(_camel_name, _upper_name, _index) + 1 +FFX_BRIXELIZER_CONST FfxUInt32 FFX_BRIXELIZER_NUM_SCRATCH_COUNTERS = 0 MEMBER_LIST; +#undef MEMBER +#undef MEMBER_LIST + +#endif diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/ffx_common_types.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/ffx_common_types.h new file mode 100644 index 00000000..2c4f0ba0 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/ffx_common_types.h @@ -0,0 +1,558 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#ifndef FFX_COMMON_TYPES_H +#define FFX_COMMON_TYPES_H + +#if defined(FFX_CPU) +#define FFX_PARAMETER_IN +#define FFX_PARAMETER_OUT +#define FFX_PARAMETER_INOUT +#define FFX_PARAMETER_UNIFORM +#elif defined(FFX_HLSL) +#define FFX_PARAMETER_IN in +#define FFX_PARAMETER_OUT out +#define FFX_PARAMETER_INOUT inout +#define FFX_PARAMETER_UNIFORM uniform +#elif defined(FFX_GLSL) +#define FFX_PARAMETER_IN in +#define FFX_PARAMETER_OUT out +#define FFX_PARAMETER_INOUT inout +#define FFX_PARAMETER_UNIFORM const //[cacao_placeholder] until a better fit is found! +#endif // #if defined(FFX_CPU) + +#if defined(FFX_CPU) +/// A typedef for a boolean value. +/// +/// @ingroup CPUTypes +typedef bool FfxBoolean; + +/// A typedef for a unsigned 8bit integer. +/// +/// @ingroup CPUTypes +typedef uint8_t FfxUInt8; + +/// A typedef for a unsigned 16bit integer. +/// +/// @ingroup CPUTypes +typedef uint16_t FfxUInt16; + +/// A typedef for a unsigned 32bit integer. +/// +/// @ingroup CPUTypes +typedef uint32_t FfxUInt32; + +/// A typedef for a unsigned 64bit integer. +/// +/// @ingroup CPUTypes +typedef uint64_t FfxUInt64; + +/// A typedef for a signed 8bit integer. +/// +/// @ingroup CPUTypes +typedef int8_t FfxInt8; + +/// A typedef for a signed 16bit integer. +/// +/// @ingroup CPUTypes +typedef int16_t FfxInt16; + +/// A typedef for a signed 32bit integer. +/// +/// @ingroup CPUTypes +typedef int32_t FfxInt32; + +/// A typedef for a signed 64bit integer. +/// +/// @ingroup CPUTypes +typedef int64_t FfxInt64; + +/// A typedef for a floating point value. +/// +/// @ingroup CPUTypes +typedef float FfxFloat32; + +/// A typedef for a 2-dimensional floating point value. +/// +/// @ingroup CPUTypes +typedef float FfxFloat32x2[2]; + +/// A typedef for a 3-dimensional floating point value. +/// +/// @ingroup CPUTypes +typedef float FfxFloat32x3[3]; + +/// A typedef for a 4-dimensional floating point value. +/// +/// @ingroup CPUTypes +typedef float FfxFloat32x4[4]; + +/// A typedef for a 2x2 floating point matrix. +/// +/// @ingroup CPUTypes +typedef float FfxFloat32x2x2[4]; + +/// A typedef for a 3x3 floating point matrix. +/// +/// @ingroup CPUTypes +typedef float FfxFloat32x3x3[9]; + +/// A typedef for a 3x4 floating point matrix. +/// +/// @ingroup CPUTypes +typedef float FfxFloat32x3x4[12]; + +/// A typedef for a 4x4 floating point matrix. +/// +/// @ingroup CPUTypes +typedef float FfxFloat32x4x4[16]; + +/// A typedef for a 2-dimensional 32bit signed integer. +/// +/// @ingroup CPUTypes +typedef int32_t FfxInt32x2[2]; + +/// A typedef for a 3-dimensional 32bit signed integer. +/// +/// @ingroup CPUTypes +typedef int32_t FfxInt32x3[3]; + +/// A typedef for a 4-dimensional 32bit signed integer. +/// +/// @ingroup CPUTypes +typedef int32_t FfxInt32x4[4]; + +/// A typedef for a 2-dimensional 32bit usigned integer. +/// +/// @ingroup CPUTypes +typedef uint32_t FfxUInt32x2[2]; + +/// A typedef for a 3-dimensional 32bit unsigned integer. +/// +/// @ingroup CPUTypes +typedef uint32_t FfxUInt32x3[3]; + +/// A typedef for a 4-dimensional 32bit unsigned integer. +/// +/// @ingroup CPUTypes +typedef uint32_t FfxUInt32x4[4]; +#endif // #if defined(FFX_CPU) + +#if defined(FFX_HLSL) + +#define FfxFloat32Mat4 matrix +#define FfxFloat32Mat3 matrix + +/// A typedef for a boolean value. +/// +/// @ingroup HLSLTypes +typedef bool FfxBoolean; + +#if FFX_HLSL_SM>=62 + +/// @defgroup HLSL62Types HLSL 6.2 And Above Types +/// HLSL 6.2 and above type defines for all commonly used variables +/// +/// @ingroup HLSLTypes + +/// A typedef for a floating point value. +/// +/// @ingroup HLSL62Types +typedef float32_t FfxFloat32; + +/// A typedef for a 2-dimensional floating point value. +/// +/// @ingroup HLSL62Types +typedef float32_t2 FfxFloat32x2; + +/// A typedef for a 3-dimensional floating point value. +/// +/// @ingroup HLSL62Types +typedef float32_t3 FfxFloat32x3; + +/// A typedef for a 4-dimensional floating point value. +/// +/// @ingroup HLSL62Types +typedef float32_t4 FfxFloat32x4; + +/// A [cacao_placeholder] typedef for matrix type until confirmed. +typedef float4x4 FfxFloat32x4x4; +typedef float3x4 FfxFloat32x3x4; +typedef float3x3 FfxFloat32x3x3; +typedef float2x2 FfxFloat32x2x2; + +/// A typedef for a unsigned 32bit integer. +/// +/// @ingroup HLSL62Types +typedef uint32_t FfxUInt32; + +/// A typedef for a 2-dimensional 32bit unsigned integer. +/// +/// @ingroup HLSL62Types +typedef uint32_t2 FfxUInt32x2; + +/// A typedef for a 3-dimensional 32bit unsigned integer. +/// +/// @ingroup HLSL62Types +typedef uint32_t3 FfxUInt32x3; + +/// A typedef for a 4-dimensional 32bit unsigned integer. +/// +/// @ingroup HLSL62Types +typedef uint32_t4 FfxUInt32x4; + +/// A typedef for a signed 32bit integer. +/// +/// @ingroup HLSL62Types +typedef int32_t FfxInt32; + +/// A typedef for a 2-dimensional signed 32bit integer. +/// +/// @ingroup HLSL62Types +typedef int32_t2 FfxInt32x2; + +/// A typedef for a 3-dimensional signed 32bit integer. +/// +/// @ingroup HLSL62Types +typedef int32_t3 FfxInt32x3; + +/// A typedef for a 4-dimensional signed 32bit integer. +/// +/// @ingroup HLSL62Types +typedef int32_t4 FfxInt32x4; + +#else // #if FFX_HLSL_SM>=62 + +/// @defgroup HLSLBaseTypes HLSL 6.1 And Below Types +/// HLSL 6.1 and below type defines for all commonly used variables +/// +/// @ingroup HLSLTypes + +#define FfxFloat32 float +#define FfxFloat32x2 float2 +#define FfxFloat32x3 float3 +#define FfxFloat32x4 float4 + +/// A [cacao_placeholder] typedef for matrix type until confirmed. +#define FfxFloat32x4x4 float4x4 +#define FfxFloat32x3x4 float3x4 +#define FfxFloat32x3x3 float3x3 +#define FfxFloat32x2x2 float2x2 + +/// A typedef for a unsigned 32bit integer. +/// +/// @ingroup GPU +typedef uint FfxUInt32; +typedef uint2 FfxUInt32x2; +typedef uint3 FfxUInt32x3; +typedef uint4 FfxUInt32x4; + +typedef int FfxInt32; +typedef int2 FfxInt32x2; +typedef int3 FfxInt32x3; +typedef int4 FfxInt32x4; + +#endif // #if FFX_HLSL_SM>=62 + +#if FFX_HALF + +#if FFX_HLSL_SM >= 62 + +typedef float16_t FfxFloat16; +typedef float16_t2 FfxFloat16x2; +typedef float16_t3 FfxFloat16x3; +typedef float16_t4 FfxFloat16x4; + +/// A typedef for an unsigned 16bit integer. +/// +/// @ingroup HLSLTypes +typedef uint16_t FfxUInt16; +typedef uint16_t2 FfxUInt16x2; +typedef uint16_t3 FfxUInt16x3; +typedef uint16_t4 FfxUInt16x4; + +/// A typedef for a signed 16bit integer. +/// +/// @ingroup HLSLTypes +typedef int16_t FfxInt16; +typedef int16_t2 FfxInt16x2; +typedef int16_t3 FfxInt16x3; +typedef int16_t4 FfxInt16x4; +#else // #if FFX_HLSL_SM>=62 +typedef min16float FfxFloat16; +typedef min16float2 FfxFloat16x2; +typedef min16float3 FfxFloat16x3; +typedef min16float4 FfxFloat16x4; + +/// A typedef for an unsigned 16bit integer. +/// +/// @ingroup HLSLTypes +typedef min16uint FfxUInt16; +typedef min16uint2 FfxUInt16x2; +typedef min16uint3 FfxUInt16x3; +typedef min16uint4 FfxUInt16x4; + +/// A typedef for a signed 16bit integer. +/// +/// @ingroup HLSLTypes +typedef min16int FfxInt16; +typedef min16int2 FfxInt16x2; +typedef min16int3 FfxInt16x3; +typedef min16int4 FfxInt16x4; +#endif // #if FFX_HLSL_SM>=62 + +#endif // FFX_HALF + +#endif // #if defined(FFX_HLSL) + +#if defined(FFX_GLSL) + +#define FfxFloat32Mat4 mat4 +#define FfxFloat32Mat3 mat3 + +/// A typedef for a boolean value. +/// +/// @ingroup GLSLTypes +#define FfxBoolean bool +#define FfxFloat32 float +#define FfxFloat32x2 vec2 +#define FfxFloat32x3 vec3 +#define FfxFloat32x4 vec4 +#define FfxUInt32 uint +#define FfxUInt32x2 uvec2 +#define FfxUInt32x3 uvec3 +#define FfxUInt32x4 uvec4 +#define FfxInt32 int +#define FfxInt32x2 ivec2 +#define FfxInt32x3 ivec3 +#define FfxInt32x4 ivec4 + +/// A [cacao_placeholder] typedef for matrix type until confirmed. +#define FfxFloat32x4x4 mat4 +#define FfxFloat32x3x4 mat4x3 +#define FfxFloat32x3x3 mat3 +#define FfxFloat32x2x2 mat2 + +#if FFX_HALF +#define FfxFloat16 float16_t +#define FfxFloat16x2 f16vec2 +#define FfxFloat16x3 f16vec3 +#define FfxFloat16x4 f16vec4 +#define FfxUInt16 uint16_t +#define FfxUInt16x2 u16vec2 +#define FfxUInt16x3 u16vec3 +#define FfxUInt16x4 u16vec4 +#define FfxInt16 int16_t +#define FfxInt16x2 i16vec2 +#define FfxInt16x3 i16vec3 +#define FfxInt16x4 i16vec4 +#endif // FFX_HALF +#endif // #if defined(FFX_GLSL) + +// Global toggles: +// #define FFX_HALF (1) +// #define FFX_HLSL_SM (62) + +#if FFX_HALF + +#if FFX_HLSL_SM >= 62 + +#define FFX_MIN16_SCALAR( TypeName, BaseComponentType ) typedef BaseComponentType##16_t TypeName; +#define FFX_MIN16_VECTOR( TypeName, BaseComponentType, COL ) typedef vector TypeName; +#define FFX_MIN16_MATRIX( TypeName, BaseComponentType, ROW, COL ) typedef matrix TypeName; + +#define FFX_16BIT_SCALAR( TypeName, BaseComponentType ) typedef BaseComponentType##16_t TypeName; +#define FFX_16BIT_VECTOR( TypeName, BaseComponentType, COL ) typedef vector TypeName; +#define FFX_16BIT_MATRIX( TypeName, BaseComponentType, ROW, COL ) typedef matrix TypeName; + +#else //FFX_HLSL_SM>=62 + +#define FFX_MIN16_SCALAR( TypeName, BaseComponentType ) typedef min16##BaseComponentType TypeName; +#define FFX_MIN16_VECTOR( TypeName, BaseComponentType, COL ) typedef vector TypeName; +#define FFX_MIN16_MATRIX( TypeName, BaseComponentType, ROW, COL ) typedef matrix TypeName; + +#define FFX_16BIT_SCALAR( TypeName, BaseComponentType ) FFX_MIN16_SCALAR( TypeName, BaseComponentType ); +#define FFX_16BIT_VECTOR( TypeName, BaseComponentType, COL ) FFX_MIN16_VECTOR( TypeName, BaseComponentType, COL ); +#define FFX_16BIT_MATRIX( TypeName, BaseComponentType, ROW, COL ) FFX_MIN16_MATRIX( TypeName, BaseComponentType, ROW, COL ); + +#endif //FFX_HLSL_SM>=62 + +#else //FFX_HALF + +#define FFX_MIN16_SCALAR( TypeName, BaseComponentType ) typedef BaseComponentType TypeName; +#define FFX_MIN16_VECTOR( TypeName, BaseComponentType, COL ) typedef vector TypeName; +#define FFX_MIN16_MATRIX( TypeName, BaseComponentType, ROW, COL ) typedef matrix TypeName; + +#define FFX_16BIT_SCALAR( TypeName, BaseComponentType ) typedef BaseComponentType TypeName; +#define FFX_16BIT_VECTOR( TypeName, BaseComponentType, COL ) typedef vector TypeName; +#define FFX_16BIT_MATRIX( TypeName, BaseComponentType, ROW, COL ) typedef matrix TypeName; + +#endif //FFX_HALF + +#if defined(FFX_GPU) +// Common typedefs: +#if defined(FFX_HLSL) +FFX_MIN16_SCALAR( FFX_MIN16_F , float ); +FFX_MIN16_VECTOR( FFX_MIN16_F2, float, 2 ); +FFX_MIN16_VECTOR( FFX_MIN16_F3, float, 3 ); +FFX_MIN16_VECTOR( FFX_MIN16_F4, float, 4 ); + +FFX_MIN16_SCALAR( FFX_MIN16_I, int ); +FFX_MIN16_VECTOR( FFX_MIN16_I2, int, 2 ); +FFX_MIN16_VECTOR( FFX_MIN16_I3, int, 3 ); +FFX_MIN16_VECTOR( FFX_MIN16_I4, int, 4 ); + +FFX_MIN16_SCALAR( FFX_MIN16_U, uint ); +FFX_MIN16_VECTOR( FFX_MIN16_U2, uint, 2 ); +FFX_MIN16_VECTOR( FFX_MIN16_U3, uint, 3 ); +FFX_MIN16_VECTOR( FFX_MIN16_U4, uint, 4 ); + +FFX_16BIT_SCALAR( FFX_F16_t , float ); +FFX_16BIT_VECTOR( FFX_F16_t2, float, 2 ); +FFX_16BIT_VECTOR( FFX_F16_t3, float, 3 ); +FFX_16BIT_VECTOR( FFX_F16_t4, float, 4 ); + +FFX_16BIT_SCALAR( FFX_I16_t, int ); +FFX_16BIT_VECTOR( FFX_I16_t2, int, 2 ); +FFX_16BIT_VECTOR( FFX_I16_t3, int, 3 ); +FFX_16BIT_VECTOR( FFX_I16_t4, int, 4 ); + +FFX_16BIT_SCALAR( FFX_U16_t, uint ); +FFX_16BIT_VECTOR( FFX_U16_t2, uint, 2 ); +FFX_16BIT_VECTOR( FFX_U16_t3, uint, 3 ); +FFX_16BIT_VECTOR( FFX_U16_t4, uint, 4 ); + +#define TYPEDEF_MIN16_TYPES(Prefix) \ +typedef FFX_MIN16_F Prefix##_F; \ +typedef FFX_MIN16_F2 Prefix##_F2; \ +typedef FFX_MIN16_F3 Prefix##_F3; \ +typedef FFX_MIN16_F4 Prefix##_F4; \ +typedef FFX_MIN16_I Prefix##_I; \ +typedef FFX_MIN16_I2 Prefix##_I2; \ +typedef FFX_MIN16_I3 Prefix##_I3; \ +typedef FFX_MIN16_I4 Prefix##_I4; \ +typedef FFX_MIN16_U Prefix##_U; \ +typedef FFX_MIN16_U2 Prefix##_U2; \ +typedef FFX_MIN16_U3 Prefix##_U3; \ +typedef FFX_MIN16_U4 Prefix##_U4; + +#define TYPEDEF_16BIT_TYPES(Prefix) \ +typedef FFX_16BIT_F Prefix##_F; \ +typedef FFX_16BIT_F2 Prefix##_F2; \ +typedef FFX_16BIT_F3 Prefix##_F3; \ +typedef FFX_16BIT_F4 Prefix##_F4; \ +typedef FFX_16BIT_I Prefix##_I; \ +typedef FFX_16BIT_I2 Prefix##_I2; \ +typedef FFX_16BIT_I3 Prefix##_I3; \ +typedef FFX_16BIT_I4 Prefix##_I4; \ +typedef FFX_16BIT_U Prefix##_U; \ +typedef FFX_16BIT_U2 Prefix##_U2; \ +typedef FFX_16BIT_U3 Prefix##_U3; \ +typedef FFX_16BIT_U4 Prefix##_U4; + +#define TYPEDEF_FULL_PRECISION_TYPES(Prefix) \ +typedef FfxFloat32 Prefix##_F; \ +typedef FfxFloat32x2 Prefix##_F2; \ +typedef FfxFloat32x3 Prefix##_F3; \ +typedef FfxFloat32x4 Prefix##_F4; \ +typedef FfxInt32 Prefix##_I; \ +typedef FfxInt32x2 Prefix##_I2; \ +typedef FfxInt32x3 Prefix##_I3; \ +typedef FfxInt32x4 Prefix##_I4; \ +typedef FfxUInt32 Prefix##_U; \ +typedef FfxUInt32x2 Prefix##_U2; \ +typedef FfxUInt32x3 Prefix##_U3; \ +typedef FfxUInt32x4 Prefix##_U4; +#endif // #if defined(FFX_HLSL) + +#if defined(FFX_GLSL) + +#if FFX_HALF + +#define FFX_MIN16_F float16_t +#define FFX_MIN16_F2 f16vec2 +#define FFX_MIN16_F3 f16vec3 +#define FFX_MIN16_F4 f16vec4 + +#define FFX_MIN16_I int16_t +#define FFX_MIN16_I2 i16vec2 +#define FFX_MIN16_I3 i16vec3 +#define FFX_MIN16_I4 i16vec4 + +#define FFX_MIN16_U uint16_t +#define FFX_MIN16_U2 u16vec2 +#define FFX_MIN16_U3 u16vec3 +#define FFX_MIN16_U4 u16vec4 + +#define FFX_16BIT_F float16_t +#define FFX_16BIT_F2 f16vec2 +#define FFX_16BIT_F3 f16vec3 +#define FFX_16BIT_F4 f16vec4 + +#define FFX_16BIT_I int16_t +#define FFX_16BIT_I2 i16vec2 +#define FFX_16BIT_I3 i16vec3 +#define FFX_16BIT_I4 i16vec4 + +#define FFX_16BIT_U uint16_t +#define FFX_16BIT_U2 u16vec2 +#define FFX_16BIT_U3 u16vec3 +#define FFX_16BIT_U4 u16vec4 + +#else // FFX_HALF + +#define FFX_MIN16_F float +#define FFX_MIN16_F2 vec2 +#define FFX_MIN16_F3 vec3 +#define FFX_MIN16_F4 vec4 + +#define FFX_MIN16_I int +#define FFX_MIN16_I2 ivec2 +#define FFX_MIN16_I3 ivec3 +#define FFX_MIN16_I4 ivec4 + +#define FFX_MIN16_U uint +#define FFX_MIN16_U2 uvec2 +#define FFX_MIN16_U3 uvec3 +#define FFX_MIN16_U4 uvec4 + +#define FFX_16BIT_F float +#define FFX_16BIT_F2 vec2 +#define FFX_16BIT_F3 vec3 +#define FFX_16BIT_F4 vec4 + +#define FFX_16BIT_I int +#define FFX_16BIT_I2 ivec2 +#define FFX_16BIT_I3 ivec3 +#define FFX_16BIT_I4 ivec4 + +#define FFX_16BIT_U uint +#define FFX_16BIT_U2 uvec2 +#define FFX_16BIT_U3 uvec3 +#define FFX_16BIT_U4 uvec4 + +#endif // FFX_HALF + +#endif // #if defined(FFX_GLSL) + +#endif // #if defined(FFX_GPU) +#endif // #ifndef FFX_COMMON_TYPES_H diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/ffx_core.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/ffx_core.h new file mode 100644 index 00000000..d1ed1441 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/ffx_core.h @@ -0,0 +1,80 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +/// @defgroup FfxGPU GPU +/// The FidelityFX SDK GPU References +/// +/// @ingroup ffxSDK + +/// @defgroup FfxHLSL HLSL References +/// FidelityFX SDK HLSL GPU References +/// +/// @ingroup FfxGPU + +/// @defgroup FfxGLSL GLSL References +/// FidelityFX SDK GLSL GPU References +/// +/// @ingroup FfxGPU + +/// @defgroup FfxGPUEffects FidelityFX GPU References +/// FidelityFX Effect GPU Reference Documentation +/// +/// @ingroup FfxGPU + +/// @defgroup GPUCore GPU Core +/// GPU defines and functions +/// +/// @ingroup FfxGPU + +#if !defined(FFX_CORE_H) +#define FFX_CORE_H + +#ifdef __hlsl_dx_compiler +#pragma dxc diagnostic push +#pragma dxc diagnostic ignored "-Wambig-lit-shift" +#endif //__hlsl_dx_compiler + +#include "ffx_common_types.h" + +#if defined(FFX_CPU) + #include "ffx_core_cpu.h" +#endif // #if defined(FFX_CPU) + +#if defined(FFX_GLSL) && defined(FFX_GPU) + #include "ffx_core_glsl.h" +#endif // #if defined(FFX_GLSL) && defined(FFX_GPU) + +#if defined(FFX_HLSL) && defined(FFX_GPU) + #include "ffx_core_hlsl.h" +#endif // #if defined(FFX_HLSL) && defined(FFX_GPU) + +#if defined(FFX_GPU) + #include "ffx_core_gpu_common.h" + #include "ffx_core_gpu_common_half.h" + #include "ffx_core_portability.h" +#endif // #if defined(FFX_GPU) + +#ifdef __hlsl_dx_compiler +#pragma dxc diagnostic pop +#endif //__hlsl_dx_compiler + +#endif // #if !defined(FFX_CORE_H) diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/ffx_core_cpu.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/ffx_core_cpu.h new file mode 100644 index 00000000..4b6c41aa --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/ffx_core_cpu.h @@ -0,0 +1,338 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +/// A define for a true value in a boolean expression. +/// +/// @ingroup CPUTypes +#define FFX_TRUE (1) + +/// A define for a false value in a boolean expression. +/// +/// @ingroup CPUTypes +#define FFX_FALSE (0) + +#if !defined(FFX_STATIC) +/// A define to abstract declaration of static variables and functions. +/// +/// @ingroup CPUTypes +#define FFX_STATIC static +#endif // #if !defined(FFX_STATIC) + +/// @defgroup CPUCore CPU Core +/// Core CPU-side defines and functions +/// +/// @ingroup ffxHost + +#ifdef __clang__ +#pragma clang diagnostic ignored "-Wunused-variable" +#endif + +/// Interpret the bit layout of an IEEE-754 floating point value as an unsigned integer. +/// +/// @param [in] x A 32bit floating value. +/// +/// @returns +/// An unsigned 32bit integer value containing the bit pattern of x. +/// +/// @ingroup CPUCore +FFX_STATIC FfxUInt32 ffxAsUInt32(FfxFloat32 x) +{ + union + { + FfxFloat32 f; + FfxUInt32 u; + } bits; + + bits.f = x; + return bits.u; +} + +FFX_STATIC FfxFloat32 ffxDot2(FfxFloat32x2 a, FfxFloat32x2 b) +{ + return a[0] * b[0] + a[1] * b[1]; +} + +FFX_STATIC FfxFloat32 ffxDot3(FfxFloat32x3 a, FfxFloat32x3 b) +{ + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; +} + +FFX_STATIC FfxFloat32 ffxDot4(FfxFloat32x4 a, FfxFloat32x4 b) +{ + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3]; +} + +/// Compute the linear interopation between two values. +/// +/// Implemented by calling the GLSL mix instrinsic function. Implements the +/// following math: +/// +/// (1 - t) * x + t * y +/// +/// @param [in] x The first value to lerp between. +/// @param [in] y The second value to lerp between. +/// @param [in] t The value to determine how much of x and how much of y. +/// +/// @returns +/// A linearly interpolated value between x and y according to t. +/// +/// @ingroup CPUCore +FFX_STATIC FfxFloat32 ffxLerp(FfxFloat32 x, FfxFloat32 y, FfxFloat32 t) +{ + return y * t + (-x * t + x); +} + +/// Compute the reciprocal of a value. +/// +/// @param [in] x The value to compute the reciprocal for. +/// +/// @returns +/// The reciprocal value of x. +/// +/// @ingroup CPUCore +FFX_STATIC FfxFloat32 ffxReciprocal(FfxFloat32 x) +{ + return 1.0f / x; +} + +/// Compute the square root of a value. +/// +/// @param [in] x The first value to compute the min of. +/// +/// @returns +/// The the square root of x. +/// +/// @ingroup CPUCore +FFX_STATIC FfxFloat32 ffxSqrt(FfxFloat32 x) +{ + return FfxFloat32(sqrt(x)); +} + +FFX_STATIC FfxUInt32 ffxAShrSU1(FfxUInt32 a, FfxUInt32 b) +{ + return FfxUInt32(FfxInt32(a) >> FfxInt32(b)); +} + +/// Compute the factional part of a decimal value. +/// +/// This function calculates x - floor(x). +/// +/// @param [in] x The value to compute the fractional part from. +/// +/// @returns +/// The fractional part of x. +/// +/// @ingroup CPUCore +FFX_STATIC FfxFloat32 ffxFract(FfxFloat32 x) +{ + return x - FfxFloat32(floor(x)); +} + +/// Compute the reciprocal square root of a value. +/// +/// @param [in] x The value to compute the reciprocal for. +/// +/// @returns +/// The reciprocal square root value of x. +/// +/// @ingroup CPUCore +FFX_STATIC FfxFloat32 ffxRsqrt(FfxFloat32 x) +{ + return ffxReciprocal(ffxSqrt(x)); +} + +FFX_STATIC FfxFloat32 ffxMin(FfxFloat32 x, FfxFloat32 y) +{ + return x < y ? x : y; +} + +FFX_STATIC FfxUInt32 ffxMin(FfxUInt32 x, FfxUInt32 y) +{ + return x < y ? x : y; +} + +FFX_STATIC FfxFloat32 ffxMax(FfxFloat32 x, FfxFloat32 y) +{ + return x > y ? x : y; +} + +FFX_STATIC FfxUInt32 ffxMax(FfxUInt32 x, FfxUInt32 y) +{ + return x > y ? x : y; +} + +/// Clamp a value to a [0..1] range. +/// +/// @param [in] x The value to clamp to [0..1] range. +/// +/// @returns +/// The clamped version of x. +/// +/// @ingroup CPUCore +FFX_STATIC FfxFloat32 ffxSaturate(FfxFloat32 x) +{ + return ffxMin(1.0f, ffxMax(0.0f, x)); +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +FFX_STATIC void ffxOpAAddOneF3(FfxFloat32x3 d, FfxFloat32x3 a, FfxFloat32 b) +{ + d[0] = a[0] + b; + d[1] = a[1] + b; + d[2] = a[2] + b; + return; +} + +FFX_STATIC void ffxOpACpyF3(FfxFloat32x3 d, FfxFloat32x3 a) +{ + d[0] = a[0]; + d[1] = a[1]; + d[2] = a[2]; + return; +} + +FFX_STATIC void ffxOpAMulF3(FfxFloat32x3 d, FfxFloat32x3 a, FfxFloat32x3 b) +{ + d[0] = a[0] * b[0]; + d[1] = a[1] * b[1]; + d[2] = a[2] * b[2]; + return; +} + +FFX_STATIC void ffxOpAMulOneF3(FfxFloat32x3 d, FfxFloat32x3 a, FfxFloat32 b) +{ + d[0] = a[0] * b; + d[1] = a[1] * b; + d[2] = a[2] * b; + return; +} + +FFX_STATIC void ffxOpARcpF3(FfxFloat32x3 d, FfxFloat32x3 a) +{ + d[0] = ffxReciprocal(a[0]); + d[1] = ffxReciprocal(a[1]); + d[2] = ffxReciprocal(a[2]); + return; +} + +/// Convert FfxFloat32 to half (in lower 16-bits of output). +/// +/// This function implements the same fast technique that is documented here: ftp://ftp.fox-toolkit.org/pub/fasthalffloatconversion.pdf +/// +/// The function supports denormals. +/// +/// Some conversion rules are to make computations possibly "safer" on the GPU, +/// -INF & -NaN -> -65504 +/// +INF & +NaN -> +65504 +/// +/// @param [in] f The 32bit floating point value to convert. +/// +/// @returns +/// The closest 16bit floating point value to f. +/// +/// @ingroup CPUCore +FFX_STATIC FfxUInt32 ffxF32ToF16(FfxFloat32 f) +{ + static FfxUInt16 base[512] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0001, 0x0002, 0x0004, 0x0008, 0x0010, 0x0020, 0x0040, 0x0080, 0x0100, 0x0200, 0x0400, + 0x0800, 0x0c00, 0x1000, 0x1400, 0x1800, 0x1c00, 0x2000, 0x2400, 0x2800, 0x2c00, 0x3000, 0x3400, 0x3800, 0x3c00, 0x4000, 0x4400, 0x4800, 0x4c00, 0x5000, + 0x5400, 0x5800, 0x5c00, 0x6000, 0x6400, 0x6800, 0x6c00, 0x7000, 0x7400, 0x7800, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, + 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, + 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, + 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, + 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, + 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, + 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x7bff, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, + 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, + 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, + 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, + 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, + 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8001, 0x8002, + 0x8004, 0x8008, 0x8010, 0x8020, 0x8040, 0x8080, 0x8100, 0x8200, 0x8400, 0x8800, 0x8c00, 0x9000, 0x9400, 0x9800, 0x9c00, 0xa000, 0xa400, 0xa800, 0xac00, + 0xb000, 0xb400, 0xb800, 0xbc00, 0xc000, 0xc400, 0xc800, 0xcc00, 0xd000, 0xd400, 0xd800, 0xdc00, 0xe000, 0xe400, 0xe800, 0xec00, 0xf000, 0xf400, 0xf800, + 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, + 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, + 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, + 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, + 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, + 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff, 0xfbff + }; + + static FfxUInt8 shift[512] = { + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x17, 0x16, 0x15, 0x14, 0x13, 0x12, 0x11, 0x10, 0x0f, 0x0e, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, + 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x17, 0x16, 0x15, 0x14, 0x13, 0x12, 0x11, 0x10, 0x0f, 0x0e, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, + 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x18, + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18 + }; + + union + { + FfxFloat32 f; + FfxUInt32 u; + } bits; + + bits.f = f; + FfxUInt32 u = bits.u; + FfxUInt32 i = u >> 23; + return (FfxUInt32)(base[i]) + ((u & 0x7fffff) >> shift[i]); +} + +/// Pack 2x32-bit floating point values in a single 32bit value. +/// +/// This function first converts each component of value into their nearest 16-bit floating +/// point representation, and then stores the X and Y components in the lower and upper 16 bits of the +/// 32bit unsigned integer respectively. +/// +/// @param [in] x A 2-dimensional floating point value to convert and pack. +/// +/// @returns +/// A packed 32bit value containing 2 16bit floating point values. +/// +/// @ingroup CPUCore +FFX_STATIC FfxUInt32 ffxPackHalf2x16(FfxFloat32x2 x) +{ + return ffxF32ToF16(x[0]) + (ffxF32ToF16(x[1]) << 16); +} diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/ffx_core_glsl.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/ffx_core_glsl.h new file mode 100644 index 00000000..c8dccacd --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/ffx_core_glsl.h @@ -0,0 +1,1916 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +/// @defgroup GLSLCore GLSL Core +/// GLSL core defines and functions +/// +/// @ingroup FfxGLSL + +/// A define for abstracting select functionality for pre/post HLSL 21 +/// +/// @ingroup GLSLCore +#define FFX_SELECT(cond, arg1, arg2) cond ? arg1 : arg2 + +/// A define for abstracting shared memory between shading languages. +/// +/// @ingroup GLSLCore +#define FFX_GROUPSHARED shared + +/// A define for abstracting compute memory barriers between shading languages. +/// +/// @ingroup GLSLCore +#define FFX_GROUP_MEMORY_BARRIER groupMemoryBarrier(); barrier() + +/// A define for abstracting compute atomic additions between shading languages. +/// +/// @ingroup GLSLCore +#define FFX_ATOMIC_ADD(x, y) atomicAdd(x, y) + +/// A define for abstracting compute atomic additions between shading languages. +/// +/// @ingroup GLSLCore +#define FFX_ATOMIC_ADD_RETURN(x, y, r) r = atomicAdd(x, y) + +/// A define for abstracting compute atomic OR between shading languages. +/// +/// @ingroup GLSLCore +#define FFX_ATOMIC_OR(x, y) atomicOr(x, y) + +/// A define for abstracting compute atomic min between shading languages. +/// +/// @ingroup GLSLCore +#define FFX_ATOMIC_MIN(x, y) atomicMin(x, y) + +/// A define for abstracting compute atomic max between shading languages. +/// +/// @ingroup GLSLCore +#define FFX_ATOMIC_MAX(x, y) atomicMax(x, y) + +/// A define added to accept static markup on functions to aid CPU/GPU portability of code. +/// +/// @ingroup GLSLCore +#define FFX_STATIC + +/// A define for abstracting loop unrolling between shading languages. +/// +/// @ingroup GLSLCore +#define FFX_UNROLL + +/// A define for abstracting a 'greater than' comparison operator between two types. +/// +/// @ingroup GLSLCore +#define FFX_GREATER_THAN(x, y) greaterThan(x, y) + +/// A define for abstracting a 'greater than or equal' comparison operator between two types. +/// +/// @ingroup GLSLCore +#define FFX_GREATER_THAN_EQUAL(x, y) greaterThanEqual(x, y) + +/// A define for abstracting a 'less than' comparison operator between two types. +/// +/// @ingroup GLSLCore +#define FFX_LESS_THAN(x, y) lessThan(x, y) + +/// A define for abstracting a 'less than or equal' comparison operator between two types. +/// +/// @ingroup GLSLCore +#define FFX_LESS_THAN_EQUAL(x, y) lessThanEqual(x, y) + +/// A define for abstracting an 'equal' comparison operator between two types. +/// +/// @ingroup GLSLCore +#define FFX_EQUAL(x, y) equal(x, y) + +/// A define for abstracting a 'not equal' comparison operator between two types. +/// +/// @ingroup GLSLCore +#define FFX_NOT_EQUAL(x, y) notEqual(x, y) + +/// A define for abstracting matrix multiply operations between shading languages. +/// +/// @ingroup GLSLCore +#define FFX_MATRIX_MULTIPLY(a, b) (a * b) + +/// A define for abstracting vector transformations between shading languages. +/// +/// @ingroup GLSLCore +#define FFX_TRANSFORM_VECTOR(a, b) (a * b) + +/// A define for abstracting modulo operations between shading languages. +/// +/// @ingroup GLSLCore +#define FFX_MODULO(a, b) (mod(a, b)) + +/// Broadcast a scalar value to a 1-dimensional floating point vector. +/// +/// @ingroup GLSLCore +#define FFX_BROADCAST_FLOAT32(x) FfxFloat32(x) + +/// Broadcast a scalar value to a 2-dimensional floating point vector. +/// +/// @ingroup GLSLCore +#define FFX_BROADCAST_FLOAT32X2(x) FfxFloat32x2(FfxFloat32(x)) + +/// Broadcast a scalar value to a 3-dimensional floating point vector. +/// +/// @ingroup GLSLCore +#define FFX_BROADCAST_FLOAT32X3(x) FfxFloat32x3(FfxFloat32(x)) + +/// Broadcast a scalar value to a 4-dimensional floating point vector. +/// +/// @ingroup GLSLCore +#define FFX_BROADCAST_FLOAT32X4(x) FfxFloat32x4(FfxFloat32(x)) + +/// Broadcast a scalar value to a 1-dimensional unsigned integer vector. +/// +/// @ingroup GLSLCore +#define FFX_BROADCAST_UINT32(x) FfxUInt32(x) + +/// Broadcast a scalar value to a 2-dimensional unsigned integer vector. +/// +/// @ingroup GLSLCore +#define FFX_BROADCAST_UINT32X2(x) FfxUInt32x2(FfxUInt32(x)) + +/// Broadcast a scalar value to a 3-dimensional unsigned integer vector. +/// +/// @ingroup GLSLCore +#define FFX_BROADCAST_UINT32X3(x) FfxUInt32x3(FfxUInt32(x)) + +/// Broadcast a scalar value to a 4-dimensional unsigned integer vector. +/// +/// @ingroup GLSLCore +#define FFX_BROADCAST_UINT32X4(x) FfxUInt32x4(FfxUInt32(x)) + +/// Broadcast a scalar value to a 1-dimensional signed integer vector. +/// +/// @ingroup GLSLCore +#define FFX_BROADCAST_INT32(x) FfxInt32(x) + +/// Broadcast a scalar value to a 2-dimensional signed integer vector. +/// +/// @ingroup GLSLCore +#define FFX_BROADCAST_INT32X2(x) FfxInt32x2(FfxInt32(x)) + +/// Broadcast a scalar value to a 3-dimensional signed integer vector. +/// +/// @ingroup GLSLCore +#define FFX_BROADCAST_INT32X3(x) FfxInt32x3(FfxInt32(x)) + +/// Broadcast a scalar value to a 4-dimensional signed integer vector. +/// +/// @ingroup GLSLCore +#define FFX_BROADCAST_INT32X4(x) FfxInt32x4(FfxInt32(x)) + +/// Broadcast a scalar value to a 1-dimensional half-precision floating point vector. +/// +/// @ingroup GLSLCore +#define FFX_BROADCAST_MIN_FLOAT16(x) FFX_MIN16_F(x) + +/// Broadcast a scalar value to a 2-dimensional half-precision floating point vector. +/// +/// @ingroup GLSLCore +#define FFX_BROADCAST_MIN_FLOAT16X2(x) FFX_MIN16_F2(FFX_MIN16_F(x)) + +/// Broadcast a scalar value to a 3-dimensional half-precision floating point vector. +/// +/// @ingroup GLSLCore +#define FFX_BROADCAST_MIN_FLOAT16X3(x) FFX_MIN16_F3(FFX_MIN16_F(x)) + +/// Broadcast a scalar value to a 4-dimensional half-precision floating point vector. +/// +/// @ingroup GLSLCore +#define FFX_BROADCAST_MIN_FLOAT16X4(x) FFX_MIN16_F4(FFX_MIN16_F(x)) + +/// Broadcast a scalar value to a 1-dimensional half-precision unsigned integer vector. +/// +/// @ingroup GLSLCore +#define FFX_BROADCAST_MIN_UINT16(x) FFX_MIN16_U(x) + +/// Broadcast a scalar value to a 2-dimensional half-precision unsigned integer vector. +/// +/// @ingroup GLSLCore +#define FFX_BROADCAST_MIN_UINT16X2(x) FFX_MIN16_U2(FFX_MIN16_U(x)) + +/// Broadcast a scalar value to a 3-dimensional half-precision unsigned integer vector. +/// +/// @ingroup GLSLCore +#define FFX_BROADCAST_MIN_UINT16X3(x) FFX_MIN16_U3(FFX_MIN16_U(x)) + +/// Broadcast a scalar value to a 4-dimensional half-precision unsigned integer vector. +/// +/// @ingroup GLSLCore +#define FFX_BROADCAST_MIN_UINT16X4(x) FFX_MIN16_U4(FFX_MIN16_U(x)) + +/// Broadcast a scalar value to a 1-dimensional half-precision signed integer vector. +/// +/// @ingroup GLSLCore +#define FFX_BROADCAST_MIN_INT16(x) FFX_MIN16_I(x) + +/// Broadcast a scalar value to a 2-dimensional half-precision signed integer vector. +/// +/// @ingroup GLSLCore +#define FFX_BROADCAST_MIN_INT16X2(x) FFX_MIN16_I2(FFX_MIN16_I(x)) + +/// Broadcast a scalar value to a 3-dimensional half-precision signed integer vector. +/// +/// @ingroup GLSLCore +#define FFX_BROADCAST_MIN_INT16X3(x) FFX_MIN16_I3(FFX_MIN16_I(x)) + +/// Broadcast a scalar value to a 4-dimensional half-precision signed integer vector. +/// +/// @ingroup GLSLCore +#define FFX_BROADCAST_MIN_INT16X4(x) FFX_MIN16_I4(FFX_MIN16_I(x)) + + #extension GL_EXT_shader_explicit_arithmetic_types : require +#if !defined(FFX_SKIP_EXT) +#if FFX_HALF + #extension GL_EXT_shader_16bit_storage : require +#endif // FFX_HALF + +#if defined(FFX_LONG) + #extension GL_ARB_gpu_shader_int64 : require + #extension GL_NV_shader_atomic_int64 : require +#endif // #if defined(FFX_LONG) + +#if defined(FFX_WAVE) + #extension GL_KHR_shader_subgroup_arithmetic : require + #extension GL_KHR_shader_subgroup_ballot : require + #extension GL_KHR_shader_subgroup_quad : require + #extension GL_KHR_shader_subgroup_shuffle : require +#endif // #if defined(FFX_WAVE) +#endif // #if !defined(FFX_SKIP_EXT) + +// Forward declarations +FfxFloat32 ffxSqrt(FfxFloat32 x); +FfxFloat32x2 ffxSqrt(FfxFloat32x2 x); +FfxFloat32x3 ffxSqrt(FfxFloat32x3 x); +FfxFloat32x4 ffxSqrt(FfxFloat32x4 x); + +/// Interprets the bit pattern of x as a floating-point number. +/// +/// @param [in] x The input value. +/// +/// @returns +/// The input interpreted as a floating-point number. +/// +/// @ingroup GLSLCore +FfxFloat32 ffxAsFloat(FfxUInt32 x) +{ + return uintBitsToFloat(x); +} + +/// Interprets the bit pattern of x as a floating-point number. +/// +/// @param [in] x The input value. +/// +/// @returns +/// The input interpreted as a floating-point number. +/// +/// @ingroup GLSLCore +FfxFloat32x2 ffxAsFloat(FfxUInt32x2 x) +{ + return uintBitsToFloat(x); +} + +/// Interprets the bit pattern of x as a floating-point number. +/// +/// @param [in] x The input value. +/// +/// @returns +/// The input interpreted as a floating-point number. +/// +/// @ingroup GLSLCore +FfxFloat32x3 ffxAsFloat(FfxUInt32x3 x) +{ + return uintBitsToFloat(x); +} + +/// Interprets the bit pattern of x as a floating-point number. +/// +/// @param [in] x The input value. +/// +/// @returns +/// The input interpreted as a floating-point number. +/// +/// @ingroup GLSLCore +FfxFloat32x4 ffxAsFloat(FfxUInt32x4 x) +{ + return uintBitsToFloat(x); +} + +/// Interprets the bit pattern of x as an unsigned integer. +/// +/// @param [in] x The input value. +/// +/// @returns +/// The input interpreted as an unsigned integer. +/// +/// @ingroup GLSLCore +FfxUInt32 ffxAsUInt32(FfxFloat32 x) +{ + return floatBitsToUint(x); +} + +/// Interprets the bit pattern of x as an unsigned integer. +/// +/// @param [in] x The input value. +/// +/// @returns +/// The input interpreted as an unsigned integer. +/// +/// @ingroup GLSLCore +FfxUInt32x2 ffxAsUInt32(FfxFloat32x2 x) +{ + return floatBitsToUint(x); +} + +/// Interprets the bit pattern of x as an unsigned integer. +/// +/// @param [in] x The input value. +/// +/// @returns +/// The input interpreted as an unsigned integer. +/// +/// @ingroup GLSLCore +FfxUInt32x3 ffxAsUInt32(FfxFloat32x3 x) +{ + return floatBitsToUint(x); +} + +/// Interprets the bit pattern of x as an unsigned integer. +/// +/// @param [in] x The input value. +/// +/// @returns +/// The input interpreted as an unsigned integer. +/// +/// @ingroup GLSLCore +FfxUInt32x4 ffxAsUInt32(FfxFloat32x4 x) +{ + return floatBitsToUint(x); +} + +/// Pack 2x32-bit floating point values in a single 32bit value. +/// +/// This function first converts each component of value into their nearest 16-bit floating +/// point representation, and then stores the X and Y components in the lower and upper 16 bits of the +/// 32bit unsigned integer respectively. +/// +/// @param [in] value A 2-dimensional floating point value to convert and pack. +/// +/// @returns +/// A packed 32bit value containing 2 16bit floating point values. +/// +/// @ingroup GLSLCore +FfxUInt32 ffxPackHalf2x16(FfxFloat32x2 value) +{ + return packHalf2x16(value); +} + +/// Convert a 32bit IEEE 754 floating point value to its nearest 16bit equivalent. +/// +/// @param [in] value The value to convert. +/// +/// @returns +/// The nearest 16bit equivalent of value. +/// +/// @ingroup GLSLCore +FfxUInt32 ffxF32ToF16(FfxFloat32 value) +{ + return packHalf2x16(FfxFloat32x2(value, 0.0)); +} + +/// Broadcast a scalar value to a 2-dimensional floating point vector. +/// +/// @param [in] value The value to to broadcast. +/// +/// @returns +/// A 2-dimensional floating point vector with value in each component. +/// +/// @ingroup GLSLCore +FfxFloat32x2 ffxBroadcast2(FfxFloat32 value) +{ + return FfxFloat32x2(value, value); +} + +/// Broadcast a scalar value to a 3-dimensional floating point vector. +/// +/// @param [in] value The value to to broadcast. +/// +/// @returns +/// A 3-dimensional floating point vector with value in each component. +/// +/// @ingroup GLSLCore +FfxFloat32x3 ffxBroadcast3(FfxFloat32 value) +{ + return FfxFloat32x3(value, value, value); +} + +/// Broadcast a scalar value to a 4-dimensional floating point vector. +/// +/// @param [in] value The value to to broadcast. +/// +/// @returns +/// A 4-dimensional floating point vector with value in each component. +/// +/// @ingroup GLSLCore +FfxFloat32x4 ffxBroadcast4(FfxFloat32 value) +{ + return FfxFloat32x4(value, value, value, value); +} + +/// Broadcast a scalar value to a 2-dimensional signed integer vector. +/// +/// @param [in] value The value to to broadcast. +/// +/// @returns +/// A 2-dimensional signed integer vector with value in each component. +/// +/// @ingroup GLSLCore +FfxInt32x2 ffxBroadcast2(FfxInt32 value) +{ + return FfxInt32x2(value, value); +} + +/// Broadcast a scalar value to a 3-dimensional signed integer vector. +/// +/// @param [in] value The value to to broadcast. +/// +/// @returns +/// A 3-dimensional signed integer vector with value in each component. +/// +/// @ingroup GLSLCore +FfxInt32x3 ffxBroadcast3(FfxInt32 value) +{ + return FfxInt32x3(value, value, value); +} + +/// Broadcast a scalar value to a 4-dimensional signed integer vector. +/// +/// @param [in] value The value to to broadcast. +/// +/// @returns +/// A 4-dimensional signed integer vector with value in each component. +/// +/// @ingroup GLSLCore +FfxInt32x4 ffxBroadcast4(FfxInt32 value) +{ + return FfxInt32x4(value, value, value, value); +} + +/// Broadcast a scalar value to a 2-dimensional unsigned integer vector. +/// +/// @param [in] value The value to to broadcast. +/// +/// @returns +/// A 2-dimensional unsigned integer vector with value in each component. +/// +/// @ingroup GLSLCore +FfxUInt32x2 ffxBroadcast2(FfxUInt32 value) +{ + return FfxUInt32x2(value, value); +} + +/// Broadcast a scalar value to a 3-dimensional unsigned integer vector. +/// +/// @param [in] value The value to to broadcast. +/// +/// @returns +/// A 3-dimensional unsigned integer vector with value in each component. +/// +/// @ingroup GLSLCore +FfxUInt32x3 ffxBroadcast3(FfxUInt32 value) +{ + return FfxUInt32x3(value, value, value); +} + +/// Broadcast a scalar value to a 4-dimensional unsigned integer vector. +/// +/// @param [in] value The value to to broadcast. +/// +/// @returns +/// A 4-dimensional unsigned integer vector with value in each component. +/// +/// @ingroup GLSLCore +FfxUInt32x4 ffxBroadcast4(FfxUInt32 value) +{ + return FfxUInt32x4(value, value, value, value); +} + +/// +/// +/// @ingroup GLSLCore +FfxUInt32 ffxBitfieldExtract(FfxUInt32 src, FfxUInt32 off, FfxUInt32 bits) +{ + return bitfieldExtract(src, FfxInt32(off), FfxInt32(bits)); +} + +/// +/// +/// @ingroup GLSLCore +FfxUInt32 ffxBitfieldInsert(FfxUInt32 src, FfxUInt32 ins, FfxUInt32 mask) +{ + return (ins & mask) | (src & (~mask)); +} + +// Proxy for V_BFI_B32 where the 'mask' is set as 'bits', 'mask=(1<mix instrinsic function. Implements the +/// following math: +/// +/// (1 - t) * x + t * y +/// +/// @param [in] x The first value to lerp between. +/// @param [in] y The second value to lerp between. +/// @param [in] t The value to determine how much of x and how much of y. +/// +/// @returns +/// A linearly interpolated value between x and y according to t. +/// +/// @ingroup GLSLCore +FfxFloat32 ffxLerp(FfxFloat32 x, FfxFloat32 y, FfxFloat32 t) +{ + return mix(x, y, t); +} + +/// Compute the linear interopation between two values. +/// +/// Implemented by calling the GLSL mix instrinsic function. Implements the +/// following math: +/// +/// (1 - t) * x + t * y +/// +/// @param [in] x The first value to lerp between. +/// @param [in] y The second value to lerp between. +/// @param [in] t The value to determine how much of x and how much of y. +/// +/// @returns +/// A linearly interpolated value between x and y according to t. +/// +/// @ingroup GLSLCore +FfxFloat32x2 ffxLerp(FfxFloat32x2 x, FfxFloat32x2 y, FfxFloat32 t) +{ + return mix(x, y, t); +} + +/// Compute the linear interopation between two values. +/// +/// Implemented by calling the GLSL mix instrinsic function. Implements the +/// following math: +/// +/// (1 - t) * x + t * y +/// +/// @param [in] x The first value to lerp between. +/// @param [in] y The second value to lerp between. +/// @param [in] t The value to determine how much of x and how much of y. +/// +/// @returns +/// A linearly interpolated value between x and y according to t. +/// +/// @ingroup GLSLCore +FfxFloat32x2 ffxLerp(FfxFloat32x2 x, FfxFloat32x2 y, FfxFloat32x2 t) +{ + return mix(x, y, t); +} + +/// Compute the linear interopation between two values. +/// +/// Implemented by calling the GLSL mix instrinsic function. Implements the +/// following math: +/// +/// (1 - t) * x + t * y +/// +/// @param [in] x The first value to lerp between. +/// @param [in] y The second value to lerp between. +/// @param [in] t The value to determine how much of x and how much of y. +/// +/// @returns +/// A linearly interpolated value between x and y according to t. +/// +/// @ingroup GLSLCore +FfxFloat32x3 ffxLerp(FfxFloat32x3 x, FfxFloat32x3 y, FfxFloat32 t) +{ + return mix(x, y, t); +} + +/// Compute the linear interopation between two values. +/// +/// Implemented by calling the GLSL mix instrinsic function. Implements the +/// following math: +/// +/// (1 - t) * x + t * y +/// +/// @param [in] x The first value to lerp between. +/// @param [in] y The second value to lerp between. +/// @param [in] t The value to determine how much of x and how much of y. +/// +/// @returns +/// A linearly interpolated value between x and y according to t. +/// +/// @ingroup GLSLCore +FfxFloat32x3 ffxLerp(FfxFloat32x3 x, FfxFloat32x3 y, FfxFloat32x3 t) +{ + return mix(x, y, t); +} + +/// Compute the linear interopation between two values. +/// +/// Implemented by calling the GLSL mix instrinsic function. Implements the +/// following math: +/// +/// (1 - t) * x + t * y +/// +/// @param [in] x The first value to lerp between. +/// @param [in] y The second value to lerp between. +/// @param [in] t The value to determine how much of x and how much of y. +/// +/// @returns +/// A linearly interpolated value between x and y according to t. +/// +/// @ingroup GLSLCore +FfxFloat32x4 ffxLerp(FfxFloat32x4 x, FfxFloat32x4 y, FfxFloat32 t) +{ + return mix(x, y, t); +} + +/// Compute the linear interopation between two values. +/// +/// Implemented by calling the GLSL mix instrinsic function. Implements the +/// following math: +/// +/// (1 - t) * x + t * y +/// +/// @param [in] x The first value to lerp between. +/// @param [in] y The second value to lerp between. +/// @param [in] t The value to determine how much of x and how much of y. +/// +/// @returns +/// A linearly interpolated value between x and y according to t. +/// +/// @ingroup GLSLCore +FfxFloat32x4 ffxLerp(FfxFloat32x4 x, FfxFloat32x4 y, FfxFloat32x4 t) +{ + return mix(x, y, t); +} + +/// Compute the maximum of three values. +/// +/// NOTE: This function should compile down to a single V_MAX3_F32 operation on +/// GCN or RDNA hardware. +/// +/// @param [in] x The first value to include in the max calculation. +/// @param [in] y The second value to include in the max calcuation. +/// @param [in] z The third value to include in the max calcuation. +/// +/// @returns +/// The maximum value of x, y, and z. +/// +/// @ingroup GLSLCore +FfxFloat32 ffxMax3(FfxFloat32 x, FfxFloat32 y, FfxFloat32 z) +{ + return max(x, max(y, z)); +} + +/// Compute the maximum of three values. +/// +/// NOTE: This function should compile down to a single V_MAX3_F32 operation on +/// GCN or RDNA hardware. +/// +/// @param [in] x The first value to include in the max calculation. +/// @param [in] y The second value to include in the max calcuation. +/// @param [in] z The third value to include in the max calcuation. +/// +/// @returns +/// The maximum value of x, y, and z. +/// +/// @ingroup GLSLCore +FfxFloat32x2 ffxMax3(FfxFloat32x2 x, FfxFloat32x2 y, FfxFloat32x2 z) +{ + return max(x, max(y, z)); +} + +/// Compute the maximum of three values. +/// +/// NOTE: This function should compile down to a single V_MAX3_F32 operation on +/// GCN or RDNA hardware. +/// +/// @param [in] x The first value to include in the max calculation. +/// @param [in] y The second value to include in the max calcuation. +/// @param [in] z The third value to include in the max calcuation. +/// +/// @returns +/// The maximum value of x, y, and z. +/// +/// @ingroup GLSLCore +FfxFloat32x3 ffxMax3(FfxFloat32x3 x, FfxFloat32x3 y, FfxFloat32x3 z) +{ + return max(x, max(y, z)); +} + +/// Compute the maximum of three values. +/// +/// NOTE: This function should compile down to a single V_MAX3_F32 operation on +/// GCN or RDNA hardware. +/// +/// @param [in] x The first value to include in the max calculation. +/// @param [in] y The second value to include in the max calcuation. +/// @param [in] z The third value to include in the max calcuation. +/// +/// @returns +/// The maximum value of x, y, and z. +/// +/// @ingroup GLSLCore +FfxFloat32x4 ffxMax3(FfxFloat32x4 x, FfxFloat32x4 y, FfxFloat32x4 z) +{ + return max(x, max(y, z)); +} + +/// Compute the maximum of three values. +/// +/// NOTE: This function should compile down to a single V_MAX3_F32 operation on +/// GCN or RDNA hardware. +/// +/// @param [in] x The first value to include in the max calculation. +/// @param [in] y The second value to include in the max calcuation. +/// @param [in] z The third value to include in the max calcuation. +/// +/// @returns +/// The maximum value of x, y, and z. +/// +/// @ingroup GLSLCore +FfxUInt32 ffxMax3(FfxUInt32 x, FfxUInt32 y, FfxUInt32 z) +{ + return max(x, max(y, z)); +} + +/// Compute the maximum of three values. +/// +/// NOTE: This function should compile down to a single V_MAX3_F32 operation on +/// GCN or RDNA hardware. +/// +/// @param [in] x The first value to include in the max calculation. +/// @param [in] y The second value to include in the max calcuation. +/// @param [in] z The third value to include in the max calcuation. +/// +/// @returns +/// The maximum value of x, y, and z. +/// +/// @ingroup GLSLCore +FfxUInt32x2 ffxMax3(FfxUInt32x2 x, FfxUInt32x2 y, FfxUInt32x2 z) +{ + return max(x, max(y, z)); +} + +/// Compute the maximum of three values. +/// +/// NOTE: This function should compile down to a single V_MAX3_F32 operation on +/// GCN/RDNA hardware. +/// +/// @param [in] x The first value to include in the max calculation. +/// @param [in] y The second value to include in the max calcuation. +/// @param [in] z The third value to include in the max calcuation. +/// +/// @returns +/// The maximum value of x, y, and z. +/// +/// @ingroup GLSLCore +FfxUInt32x3 ffxMax3(FfxUInt32x3 x, FfxUInt32x3 y, FfxUInt32x3 z) +{ + return max(x, max(y, z)); +} + +/// Compute the maximum of three values. +/// +/// NOTE: This function should compile down to a single V_MAX3_F32 operation on +/// GCN/RDNA hardware. +/// +/// @param [in] x The first value to include in the max calculation. +/// @param [in] y The second value to include in the max calcuation. +/// @param [in] z The third value to include in the max calcuation. +/// +/// @returns +/// The maximum value of x, y, and z. +/// +/// @ingroup GLSLCore +FfxUInt32x4 ffxMax3(FfxUInt32x4 x, FfxUInt32x4 y, FfxUInt32x4 z) +{ + return max(x, max(y, z)); +} + +/// Compute the median of three values. +/// +/// NOTE: This function should compile down to a single V_MED3_F32 operation on +/// GCN/RDNA hardware. +/// +/// @param [in] x The first value to include in the median calculation. +/// @param [in] y The second value to include in the median calcuation. +/// @param [in] z The third value to include in the median calcuation. +/// +/// @returns +/// The median value of x, y, and z. +/// +/// @ingroup GLSLCore +FfxFloat32 ffxMed3(FfxFloat32 x, FfxFloat32 y, FfxFloat32 z) +{ + return max(min(x, y), min(max(x, y), z)); +} + +/// Compute the median of three values. +/// +/// NOTE: This function should compile down to a single V_MED3_F32 operation on +/// GCN/RDNA hardware. +/// +/// @param [in] x The first value to include in the median calculation. +/// @param [in] y The second value to include in the median calcuation. +/// @param [in] z The third value to include in the median calcuation. +/// +/// @returns +/// The median value of x, y, and z. +/// +/// @ingroup GLSLCore +FfxFloat32x2 ffxMed3(FfxFloat32x2 x, FfxFloat32x2 y, FfxFloat32x2 z) +{ + return max(min(x, y), min(max(x, y), z)); +} + +/// Compute the median of three values. +/// +/// NOTE: This function should compile down to a single V_MED3_F32 operation on +/// GCN/RDNA hardware. +/// +/// @param [in] x The first value to include in the median calculation. +/// @param [in] y The second value to include in the median calcuation. +/// @param [in] z The third value to include in the median calcuation. +/// +/// @returns +/// The median value of x, y, and z. +/// +/// @ingroup GLSLCore +FfxFloat32x3 ffxMed3(FfxFloat32x3 x, FfxFloat32x3 y, FfxFloat32x3 z) +{ + return max(min(x, y), min(max(x, y), z)); +} + +/// Compute the median of three values. +/// +/// NOTE: This function should compile down to a single V_MED3_F32 operation on +/// GCN/RDNA hardware. +/// +/// @param [in] x The first value to include in the median calculation. +/// @param [in] y The second value to include in the median calcuation. +/// @param [in] z The third value to include in the median calcuation. +/// +/// @returns +/// The median value of x, y, and z. +/// +/// @ingroup GLSLCore +FfxFloat32x4 ffxMed3(FfxFloat32x4 x, FfxFloat32x4 y, FfxFloat32x4 z) +{ + return max(min(x, y), min(max(x, y), z)); +} + +/// Compute the median of three values. +/// +/// NOTE: This function should compile down to a single V_MED3_I32 operation on +/// GCN/RDNA hardware. +/// +/// @param [in] x The first value to include in the median calculation. +/// @param [in] y The second value to include in the median calcuation. +/// @param [in] z The third value to include in the median calcuation. +/// +/// @returns +/// The median value of x, y, and z. +/// +/// @ingroup GLSLCore +FfxInt32 ffxMed3(FfxInt32 x, FfxInt32 y, FfxInt32 z) +{ + return max(min(x, y), min(max(x, y), z)); +} + +/// Compute the median of three values. +/// +/// NOTE: This function should compile down to a single V_MED3_I32 operation on +/// GCN/RDNA hardware. +/// +/// @param [in] x The first value to include in the median calculation. +/// @param [in] y The second value to include in the median calcuation. +/// @param [in] z The third value to include in the median calcuation. +/// +/// @returns +/// The median value of x, y, and z. +/// +/// @ingroup GLSLCore +FfxInt32x2 ffxMed3(FfxInt32x2 x, FfxInt32x2 y, FfxInt32x2 z) +{ + return max(min(x, y), min(max(x, y), z)); +} + +/// Compute the median of three values. +/// +/// NOTE: This function should compile down to a single V_MED3_I32 operation on +/// GCN/RDNA hardware. +/// +/// @param [in] x The first value to include in the median calculation. +/// @param [in] y The second value to include in the median calcuation. +/// @param [in] z The third value to include in the median calcuation. +/// +/// @returns +/// The median value of x, y, and z. +/// +/// @ingroup GLSLCore +FfxInt32x3 ffxMed3(FfxInt32x3 x, FfxInt32x3 y, FfxInt32x3 z) +{ + return max(min(x, y), min(max(x, y), z)); +} + +/// Compute the median of three values. +/// +/// NOTE: This function should compile down to a single V_MED3_I32 operation on +/// GCN/RDNA hardware. +/// +/// @param [in] x The first value to include in the median calculation. +/// @param [in] y The second value to include in the median calcuation. +/// @param [in] z The third value to include in the median calcuation. +/// +/// @returns +/// The median value of x, y, and z. +/// +/// @ingroup GLSLCore +FfxInt32x4 ffxMed3(FfxInt32x4 x, FfxInt32x4 y, FfxInt32x4 z) +{ + return max(min(x, y), min(max(x, y), z)); +} + + +/// Compute the minimum of three values. +/// +/// NOTE: This function should compile down to a single V_MIN3_F32 operation on +/// GCN and RDNA hardware. +/// +/// @param [in] x The first value to include in the min calculation. +/// @param [in] y The second value to include in the min calcuation. +/// @param [in] z The third value to include in the min calcuation. +/// +/// @returns +/// The minimum value of x, y, and z. +/// +/// @ingroup GLSLCore +FfxFloat32 ffxMin3(FfxFloat32 x, FfxFloat32 y, FfxFloat32 z) +{ + return min(x, min(y, z)); +} + +/// Compute the minimum of three values. +/// +/// NOTE: This function should compile down to a single V_MIN3_F32 operation on +/// GCN/RDNA hardware. +/// +/// @param [in] x The first value to include in the min calculation. +/// @param [in] y The second value to include in the min calcuation. +/// @param [in] z The third value to include in the min calcuation. +/// +/// @returns +/// The minimum value of x, y, and z. +/// +/// @ingroup GLSLCore +FfxFloat32x2 ffxMin3(FfxFloat32x2 x, FfxFloat32x2 y, FfxFloat32x2 z) +{ + return min(x, min(y, z)); +} + +/// Compute the minimum of three values. +/// +/// NOTE: This function should compile down to a single V_MIN3_F32 operation on +/// GCN/RDNA hardware. +/// +/// @param [in] x The first value to include in the min calculation. +/// @param [in] y The second value to include in the min calcuation. +/// @param [in] z The third value to include in the min calcuation. +/// +/// @returns +/// The minimum value of x, y, and z. +/// +/// @ingroup GLSLCore +FfxFloat32x3 ffxMin3(FfxFloat32x3 x, FfxFloat32x3 y, FfxFloat32x3 z) +{ + return min(x, min(y, z)); +} + +/// Compute the minimum of three values. +/// +/// NOTE: This function should compile down to a single V_MIN3_F32 operation on +/// GCN/RDNA hardware. +/// +/// @param [in] x The first value to include in the min calculation. +/// @param [in] y The second value to include in the min calcuation. +/// @param [in] z The third value to include in the min calcuation. +/// +/// @returns +/// The minimum value of x, y, and z. +/// +/// @ingroup GLSLCore +FfxFloat32x4 ffxMin3(FfxFloat32x4 x, FfxFloat32x4 y, FfxFloat32x4 z) +{ + return min(x, min(y, z)); +} + +/// Compute the minimum of three values. +/// +/// NOTE: This function should compile down to a single V_MIN3_F32 operation on +/// GCN/RDNA hardware. +/// +/// @param [in] x The first value to include in the min calculation. +/// @param [in] y The second value to include in the min calcuation. +/// @param [in] z The third value to include in the min calcuation. +/// +/// @returns +/// The minimum value of x, y, and z. +/// +/// @ingroup GLSLCore +FfxUInt32 ffxMin3(FfxUInt32 x, FfxUInt32 y, FfxUInt32 z) +{ + return min(x, min(y, z)); +} + +/// Compute the minimum of three values. +/// +/// NOTE: This function should compile down to a single V_MIN3_F32 operation on +/// GCN/RDNA hardware. +/// +/// @param [in] x The first value to include in the min calculation. +/// @param [in] y The second value to include in the min calcuation. +/// @param [in] z The third value to include in the min calcuation. +/// +/// @returns +/// The minimum value of x, y, and z. +/// +/// @ingroup GLSLCore +FfxUInt32x2 ffxMin3(FfxUInt32x2 x, FfxUInt32x2 y, FfxUInt32x2 z) +{ + return min(x, min(y, z)); +} + +/// Compute the minimum of three values. +/// +/// NOTE: This function should compile down to a single V_MIN3_F32 operation on +/// GCN/RDNA hardware. +/// +/// @param [in] x The first value to include in the min calculation. +/// @param [in] y The second value to include in the min calcuation. +/// @param [in] z The third value to include in the min calcuation. +/// +/// @returns +/// The minimum value of x, y, and z. +/// +/// @ingroup GLSLCore +FfxUInt32x3 ffxMin3(FfxUInt32x3 x, FfxUInt32x3 y, FfxUInt32x3 z) +{ + return min(x, min(y, z)); +} + +/// Compute the minimum of three values. +/// +/// NOTE: This function should compile down to a single V_MIN3_F32 operation on +/// GCN/RDNA hardware. +/// +/// @param [in] x The first value to include in the min calculation. +/// @param [in] y The second value to include in the min calcuation. +/// @param [in] z The third value to include in the min calcuation. +/// +/// @returns +/// The minimum value of x, y, and z. +/// +/// @ingroup GLSLCore +FfxUInt32x4 ffxMin3(FfxUInt32x4 x, FfxUInt32x4 y, FfxUInt32x4 z) +{ + return min(x, min(y, z)); +} + +/// Compute the reciprocal of a value. +/// +/// NOTE: This function is only provided for GLSL. In HLSL the intrinsic function rcp can be used. +/// +/// @param [in] x The value to compute the reciprocal for. +/// +/// @returns +/// The reciprocal value of x. +/// +/// @ingroup GLSLCore +FfxFloat32 ffxReciprocal(FfxFloat32 x) +{ + return FfxFloat32(1.0) / x; +} + +/// Compute the reciprocal of a value. +/// +/// NOTE: This function is only provided for GLSL. In HLSL the intrinsic function rcp can be used. +/// +/// @param [in] x The value to compute the reciprocal for. +/// +/// @returns +/// The reciprocal value of x. +/// +/// @ingroup GLSLCore +FfxFloat32x2 ffxReciprocal(FfxFloat32x2 x) +{ + return ffxBroadcast2(1.0) / x; +} + +/// Compute the reciprocal of a value. +/// +/// NOTE: This function is only provided for GLSL. In HLSL the intrinsic function rcp can be used. +/// +/// @param [in] x The value to compute the reciprocal for. +/// +/// @returns +/// The reciprocal value of x. +/// +/// @ingroup GLSLCore +FfxFloat32x3 ffxReciprocal(FfxFloat32x3 x) +{ + return ffxBroadcast3(1.0) / x; +} + +/// Compute the reciprocal of a value. +/// +/// NOTE: This function is only provided for GLSL. In HLSL the intrinsic function rcp can be used. +/// +/// @param [in] x The value to compute the reciprocal for. +/// +/// @returns +/// The reciprocal value of x. +/// +/// @ingroup GLSLCore +FfxFloat32x4 ffxReciprocal(FfxFloat32x4 x) +{ + return ffxBroadcast4(1.0) / x; +} + +/// Compute the reciprocal square root of a value. +/// +/// NOTE: This function is only provided for GLSL. In HLSL the intrinsic function rsqrt can be used. +/// +/// @param [in] x The value to compute the reciprocal for. +/// +/// @returns +/// The reciprocal square root value of x. +/// +/// @ingroup GLSLCore +FfxFloat32 ffxRsqrt(FfxFloat32 x) +{ + return FfxFloat32(1.0) / ffxSqrt(x); +} + +/// Compute the reciprocal square root of a value. +/// +/// NOTE: This function is only provided for GLSL. In HLSL the intrinsic function rsqrt can be used. +/// +/// @param [in] x The value to compute the reciprocal for. +/// +/// @returns +/// The reciprocal square root value of x. +/// +/// @ingroup GLSLCore +FfxFloat32x2 ffxRsqrt(FfxFloat32x2 x) +{ + return ffxBroadcast2(1.0) / ffxSqrt(x); +} + +/// Compute the reciprocal square root of a value. +/// +/// NOTE: This function is only provided for GLSL. In HLSL the intrinsic function rsqrt can be used. +/// +/// @param [in] x The value to compute the reciprocal for. +/// +/// @returns +/// The reciprocal square root value of x. +/// +/// @ingroup GLSLCore +FfxFloat32x3 ffxRsqrt(FfxFloat32x3 x) +{ + return ffxBroadcast3(1.0) / ffxSqrt(x); +} + +/// Compute the reciprocal square root of a value. +/// +/// NOTE: This function is only provided for GLSL. In HLSL the intrinsic function rsqrt can be used. +/// +/// @param [in] x The value to compute the reciprocal for. +/// +/// @returns +/// The reciprocal square root value of x. +/// +/// @ingroup GLSLCore +FfxFloat32x4 rsqrt(FfxFloat32x4 x) +{ + return ffxBroadcast4(1.0) / ffxSqrt(x); +} + +/// Clamp a value to a [0..1] range. +/// +/// @param [in] x The value to clamp to [0..1] range. +/// +/// @returns +/// The clamped version of x. +/// +/// @ingroup GLSLCore +FfxFloat32 ffxSaturate(FfxFloat32 x) +{ + return clamp(x, FfxFloat32(0.0), FfxFloat32(1.0)); +} + +/// Clamp a value to a [0..1] range. +/// +/// @param [in] x The value to clamp to [0..1] range. +/// +/// @returns +/// The clamped version of x. +/// +/// @ingroup GLSLCore +FfxFloat32x2 ffxSaturate(FfxFloat32x2 x) +{ + return clamp(x, ffxBroadcast2(0.0), ffxBroadcast2(1.0)); +} + +/// Clamp a value to a [0..1] range. +/// +/// @param [in] x The value to clamp to [0..1] range. +/// +/// @returns +/// The clamped version of x. +/// +/// @ingroup GLSLCore +FfxFloat32x3 ffxSaturate(FfxFloat32x3 x) +{ + return clamp(x, ffxBroadcast3(0.0), ffxBroadcast3(1.0)); +} + +/// Clamp a value to a [0..1] range. +/// +/// @param [in] x The value to clamp to [0..1] range. +/// +/// @returns +/// The clamped version of x. +/// +/// @ingroup GLSLCore +FfxFloat32x4 ffxSaturate(FfxFloat32x4 x) +{ + return clamp(x, ffxBroadcast4(0.0), ffxBroadcast4(1.0)); +} + +/// Compute the factional part of a decimal value. +/// +/// This function calculates x - floor(x). Where floor is the intrinsic HLSL function. +/// +/// NOTE: This function should compile down to a single V_MAX3_F32 operation on GCN/RDNA hardware. It is +/// worth further noting that this function is intentionally distinct from the HLSL frac intrinsic +/// function. +/// +/// @param [in] x The value to compute the fractional part from. +/// +/// @returns +/// The fractional part of x. +/// +/// @ingroup GLSLCore +FfxFloat32 ffxFract(FfxFloat32 x) +{ + return fract(x); +} + +/// Compute the factional part of a decimal value. +/// +/// This function calculates x - floor(x). Where floor is the intrinsic HLSL function. +/// +/// NOTE: This function should compile down to a single V_MAX3_F32 operation on GCN/RDNA hardware. It is +/// worth further noting that this function is intentionally distinct from the HLSL frac intrinsic +/// function. +/// +/// @param [in] x The value to compute the fractional part from. +/// +/// @returns +/// The fractional part of x. +/// +/// @ingroup GLSLCore +FfxFloat32x2 ffxFract(FfxFloat32x2 x) +{ + return fract(x); +} + +/// Compute the factional part of a decimal value. +/// +/// This function calculates x - floor(x). Where floor is the intrinsic HLSL function. +/// +/// NOTE: This function should compile down to a single V_MAX3_F32 operation on GCN/RDNA hardware. It is +/// worth further noting that this function is intentionally distinct from the HLSL frac intrinsic +/// function. +/// +/// @param [in] x The value to compute the fractional part from. +/// +/// @returns +/// The fractional part of x. +/// +/// @ingroup GLSLCore +FfxFloat32x3 ffxFract(FfxFloat32x3 x) +{ + return fract(x); +} + +/// Compute the factional part of a decimal value. +/// +/// This function calculates x - floor(x). Where floor is the intrinsic HLSL function. +/// +/// NOTE: This function should compile down to a single V_MAX3_F32 operation on GCN/RDNA hardware. It is +/// worth further noting that this function is intentionally distinct from the HLSL frac intrinsic +/// function. +/// +/// @param [in] x The value to compute the fractional part from. +/// +/// @returns +/// The fractional part of x. +/// +/// @ingroup GLSLCore +FfxFloat32x4 ffxFract(FfxFloat32x4 x) +{ + return fract(x); +} + +/// Rounds to the nearest integer. In case the fractional part is 0.5, it will round to the nearest even integer. +/// +/// @param [in] x The value to be rounded. +/// +/// @returns +/// The nearest integer from x. The nearest even integer from x if equidistant from 2 integer. +/// +/// @ingroup GLSLCore +FfxFloat32 ffxRound(FfxFloat32 x) +{ + return roundEven(x); +} + +/// Rounds to the nearest integer. In case the fractional part is 0.5, it will round to the nearest even integer. +/// +/// @param [in] x The value to be rounded. +/// +/// @returns +/// The nearest integer from x. The nearest even integer from x if equidistant from 2 integer. +/// +/// @ingroup GLSLCore +FfxFloat32x2 ffxRound(FfxFloat32x2 x) +{ + return roundEven(x); +} + +/// Rounds to the nearest integer. In case the fractional part is 0.5, it will round to the nearest even integer. +/// +/// @param [in] x The value to be rounded. +/// +/// @returns +/// The nearest integer from x. The nearest even integer from x if equidistant from 2 integer. +/// +/// @ingroup GLSLCore +FfxFloat32x3 ffxRound(FfxFloat32x3 x) +{ + return roundEven(x); +} + +/// Rounds to the nearest integer. In case the fractional part is 0.5, it will round to the nearest even integer. +/// +/// @param [in] x The value to be rounded. +/// +/// @returns +/// The nearest integer from x. The nearest even integer from x if equidistant from 2 integer. +/// +/// @ingroup GLSLCore +FfxFloat32x4 ffxRound(FfxFloat32x4 x) +{ + return roundEven(x); +} + +FfxUInt32 ffxAShrSU1(FfxUInt32 a, FfxUInt32 b) +{ + return FfxUInt32(FfxInt32(a) >> FfxInt32(b)); +} + +FfxUInt32 ffxPackF32(FfxFloat32x2 v){ + return packHalf2x16(v); +} + +FfxFloat32x2 ffxUnpackF32(FfxUInt32 u){ + return unpackHalf2x16(u); +} + +FfxUInt32x2 ffxPackF32x2(FfxFloat32x4 v){ + return FfxUInt32x2(ffxPackF32(v.xy), ffxPackF32(v.zw)); +} + +FfxFloat32x4 ffxUnpackF32x2(FfxUInt32x2 a){ + return FfxFloat32x4(ffxUnpackF32(a.x), ffxUnpackF32(a.y)); +} + +/// @brief Inverts the value while avoiding division by zero. If the value is zero, zero is returned. +/// @param v Value to invert. +/// @return If v = 0 returns 0. If v != 0 returns 1/v. +FfxFloat32 ffxInvertSafe(FfxFloat32 v){ + FfxFloat32 s = sign(v); + FfxFloat32 s2 = s*s; + return s2/(v + s2 - 1.0); +} + +/// @brief Inverts the value while avoiding division by zero. If the value is zero, zero is returned. +/// @param v Value to invert. +/// @return If v = 0 returns 0. If v != 0 returns 1/v. +FfxFloat32x2 ffxInvertSafe(FfxFloat32x2 v){ + FfxFloat32x2 s = sign(v); + FfxFloat32x2 s2 = s*s; + return s2/(v + s2 - FfxFloat32x2(1.0, 1.0)); +} + +/// @brief Inverts the value while avoiding division by zero. If the value is zero, zero is returned. +/// @param v Value to invert. +/// @return If v = 0 returns 0. If v != 0 returns 1/v. +FfxFloat32x3 ffxInvertSafe(FfxFloat32x3 v){ + FfxFloat32x3 s = sign(v); + FfxFloat32x3 s2 = s*s; + return s2/(v + s2 - FfxFloat32x3(1.0, 1.0, 1.0)); +} + +/// @brief Inverts the value while avoiding division by zero. If the value is zero, zero is returned. +/// @param v Value to invert. +/// @return If v = 0 returns 0. If v != 0 returns 1/v. +FfxFloat32x4 ffxInvertSafe(FfxFloat32x4 v){ + FfxFloat32x4 s = sign(v); + FfxFloat32x4 s2 = s*s; + return s2/(v + s2 - FfxFloat32x4(1.0, 1.0, 1.0, 1.0)); +} +#if FFX_HALF +#define FFX_UINT32_TO_FLOAT16X2(x) unpackFloat2x16(FfxUInt32(x)) + +FfxUInt32 ffxPackF16(FfxFloat16x2 v){ + return packHalf2x16(v); +} + +FfxFloat16x2 ffxUnpackF16(FfxUInt32 u){ + return FfxFloat16x2(unpackHalf2x16(u)); +} + +FfxFloat16x4 ffxUint32x2ToFloat16x4(FfxUInt32x2 x) +{ + return FfxFloat16x4(unpackFloat2x16(x.x), unpackFloat2x16(x.y)); +} +#define FFX_UINT32X2_TO_FLOAT16X4(x) ffxUint32x2ToFloat16x4(FfxUInt32x2(x)) +#define FFX_UINT32_TO_UINT16X2(x) unpackUint2x16(FfxUInt32(x)) +#define FFX_UINT32X2_TO_UINT16X4(x) unpackUint4x16(pack64(FfxUInt32x2(x))) +//------------------------------------------------------------------------------------------------------------------------------ +#define FFX_FLOAT16X2_TO_UINT32(x) packFloat2x16(FfxFloat16x2(x)) +FfxUInt32x2 ffxFloat16x4ToUint32x2(FfxFloat16x4 x) +{ + return FfxUInt32x2(packFloat2x16(x.xy), packFloat2x16(x.zw)); +} +#define FFX_FLOAT16X4_TO_UINT32X2(x) ffxFloat16x4ToUint32x2(FfxFloat16x4(x)) +#define FFX_UINT16X2_TO_UINT32(x) packUint2x16(FfxUInt16x2(x)) +#define FFX_UINT16X4_TO_UINT32X2(x) unpack32(packUint4x16(FfxUInt16x4(x))) +//============================================================================================================================== +#define FFX_TO_UINT16(x) halfBitsToUint16(FfxFloat16(x)) +#define FFX_TO_UINT16X2(x) halfBitsToUint16(FfxFloat16x2(x)) +#define FFX_TO_UINT16X3(x) halfBitsToUint16(FfxFloat16x3(x)) +#define FFX_TO_UINT16X4(x) halfBitsToUint16(FfxFloat16x4(x)) +//------------------------------------------------------------------------------------------------------------------------------ +#define FFX_TO_FLOAT16(x) uint16BitsToHalf(FfxUInt16(x)) +#define FFX_TO_FLOAT16X2(x) uint16BitsToHalf(FfxUInt16x2(x)) +#define FFX_TO_FLOAT16X3(x) uint16BitsToHalf(FfxUInt16x3(x)) +#define FFX_TO_FLOAT16X4(x) uint16BitsToHalf(FfxUInt16x4(x)) +//============================================================================================================================== +FfxFloat16 ffxBroadcastFloat16(FfxFloat16 a) +{ + return FfxFloat16(a); +} +FfxFloat16x2 ffxBroadcastFloat16x2(FfxFloat16 a) +{ + return FfxFloat16x2(a, a); +} +FfxFloat16x3 ffxBroadcastFloat16x3(FfxFloat16 a) +{ + return FfxFloat16x3(a, a, a); +} +FfxFloat16x4 ffxBroadcastFloat16x4(FfxFloat16 a) +{ + return FfxFloat16x4(a, a, a, a); +} +#define FFX_BROADCAST_FLOAT16(a) FfxFloat16(a) +#define FFX_BROADCAST_FLOAT16X2(a) FfxFloat16x2(FfxFloat16(a)) +#define FFX_BROADCAST_FLOAT16X3(a) FfxFloat16x3(FfxFloat16(a)) +#define FFX_BROADCAST_FLOAT16X4(a) FfxFloat16x4(FfxFloat16(a)) +//------------------------------------------------------------------------------------------------------------------------------ +FfxInt16 ffxBroadcastInt16(FfxInt16 a) +{ + return FfxInt16(a); +} +FfxInt16x2 ffxBroadcastInt16x2(FfxInt16 a) +{ + return FfxInt16x2(a, a); +} +FfxInt16x3 ffxBroadcastInt16x3(FfxInt16 a) +{ + return FfxInt16x3(a, a, a); +} +FfxInt16x4 ffxBroadcastInt16x4(FfxInt16 a) +{ + return FfxInt16x4(a, a, a, a); +} +#define FFX_BROADCAST_INT16(a) FfxInt16(a) +#define FFX_BROADCAST_INT16X2(a) FfxInt16x2(FfxInt16(a)) +#define FFX_BROADCAST_INT16X3(a) FfxInt16x3(FfxInt16(a)) +#define FFX_BROADCAST_INT16X4(a) FfxInt16x4(FfxInt16(a)) +//------------------------------------------------------------------------------------------------------------------------------ +FfxUInt16 ffxBroadcastUInt16(FfxUInt16 a) +{ + return FfxUInt16(a); +} +FfxUInt16x2 ffxBroadcastUInt16x2(FfxUInt16 a) +{ + return FfxUInt16x2(a, a); +} +FfxUInt16x3 ffxBroadcastUInt16x3(FfxUInt16 a) +{ + return FfxUInt16x3(a, a, a); +} +FfxUInt16x4 ffxBroadcastUInt16x4(FfxUInt16 a) +{ + return FfxUInt16x4(a, a, a, a); +} +#define FFX_BROADCAST_UINT16(a) FfxUInt16(a) +#define FFX_BROADCAST_UINT16X2(a) FfxUInt16x2(FfxUInt16(a)) +#define FFX_BROADCAST_UINT16X3(a) FfxUInt16x3(FfxUInt16(a)) +#define FFX_BROADCAST_UINT16X4(a) FfxUInt16x4(FfxUInt16(a)) +//============================================================================================================================== +FfxUInt16 ffxAbsHalf(FfxUInt16 a) +{ + return FfxUInt16(abs(FfxInt16(a))); +} +FfxUInt16x2 ffxAbsHalf(FfxUInt16x2 a) +{ + return FfxUInt16x2(abs(FfxInt16x2(a))); +} +FfxUInt16x3 ffxAbsHalf(FfxUInt16x3 a) +{ + return FfxUInt16x3(abs(FfxInt16x3(a))); +} +FfxUInt16x4 ffxAbsHalf(FfxUInt16x4 a) +{ + return FfxUInt16x4(abs(FfxInt16x4(a))); +} +//------------------------------------------------------------------------------------------------------------------------------ +FfxFloat16 ffxClampHalf(FfxFloat16 x, FfxFloat16 n, FfxFloat16 m) +{ + return clamp(x, n, m); +} +FfxFloat16x2 ffxClampHalf(FfxFloat16x2 x, FfxFloat16x2 n, FfxFloat16x2 m) +{ + return clamp(x, n, m); +} +FfxFloat16x3 ffxClampHalf(FfxFloat16x3 x, FfxFloat16x3 n, FfxFloat16x3 m) +{ + return clamp(x, n, m); +} +FfxFloat16x4 ffxClampHalf(FfxFloat16x4 x, FfxFloat16x4 n, FfxFloat16x4 m) +{ + return clamp(x, n, m); +} +//------------------------------------------------------------------------------------------------------------------------------ +FfxFloat16 ffxFract(FfxFloat16 x) +{ + return fract(x); +} +FfxFloat16x2 ffxFract(FfxFloat16x2 x) +{ + return fract(x); +} +FfxFloat16x3 ffxFract(FfxFloat16x3 x) +{ + return fract(x); +} +FfxFloat16x4 ffxFract(FfxFloat16x4 x) +{ + return fract(x); +} +//------------------------------------------------------------------------------------------------------------------------------ +FfxFloat16 ffxLerp(FfxFloat16 x, FfxFloat16 y, FfxFloat16 a) +{ + return mix(x, y, a); +} +FfxFloat16x2 ffxLerp(FfxFloat16x2 x, FfxFloat16x2 y, FfxFloat16 a) +{ + return mix(x, y, a); +} +FfxFloat16x2 ffxLerp(FfxFloat16x2 x, FfxFloat16x2 y, FfxFloat16x2 a) +{ + return mix(x, y, a); +} +FfxFloat16x3 ffxLerp(FfxFloat16x3 x, FfxFloat16x3 y, FfxFloat16x3 a) +{ + return mix(x, y, a); +} +FfxFloat16x3 ffxLerp(FfxFloat16x3 x, FfxFloat16x3 y, FfxFloat16 a) +{ + return mix(x, y, a); +} +FfxFloat16x4 ffxLerp(FfxFloat16x4 x, FfxFloat16x4 y, FfxFloat16 a) +{ + return mix(x, y, a); +} +FfxFloat16x4 ffxLerp(FfxFloat16x4 x, FfxFloat16x4 y, FfxFloat16x4 a) +{ + return mix(x, y, a); +} +//------------------------------------------------------------------------------------------------------------------------------ +// No packed version of ffxMax3. +FfxFloat16 ffxMax3Half(FfxFloat16 x, FfxFloat16 y, FfxFloat16 z) +{ + return max(x, max(y, z)); +} +FfxFloat16x2 ffxMax3Half(FfxFloat16x2 x, FfxFloat16x2 y, FfxFloat16x2 z) +{ + return max(x, max(y, z)); +} +FfxFloat16x3 ffxMax3Half(FfxFloat16x3 x, FfxFloat16x3 y, FfxFloat16x3 z) +{ + return max(x, max(y, z)); +} +FfxFloat16x4 ffxMax3Half(FfxFloat16x4 x, FfxFloat16x4 y, FfxFloat16x4 z) +{ + return max(x, max(y, z)); +} +//------------------------------------------------------------------------------------------------------------------------------ +// No packed version of ffxMin3. +FfxFloat16 ffxMin3Half(FfxFloat16 x, FfxFloat16 y, FfxFloat16 z) +{ + return min(x, min(y, z)); +} +FfxFloat16x2 ffxMin3Half(FfxFloat16x2 x, FfxFloat16x2 y, FfxFloat16x2 z) +{ + return min(x, min(y, z)); +} +FfxFloat16x3 ffxMin3Half(FfxFloat16x3 x, FfxFloat16x3 y, FfxFloat16x3 z) +{ + return min(x, min(y, z)); +} +FfxFloat16x4 ffxMin3Half(FfxFloat16x4 x, FfxFloat16x4 y, FfxFloat16x4 z) +{ + return min(x, min(y, z)); +} +//------------------------------------------------------------------------------------------------------------------------------ +FfxFloat16 ffxMed3Half(FfxFloat16 x, FfxFloat16 y, FfxFloat16 z) +{ + return max(min(x, y), min(max(x, y), z)); +} +FfxFloat16x2 ffxMed3Half(FfxFloat16x2 x, FfxFloat16x2 y, FfxFloat16x2 z) +{ + return max(min(x, y), min(max(x, y), z)); +} +FfxFloat16x3 ffxMed3Half(FfxFloat16x3 x, FfxFloat16x3 y, FfxFloat16x3 z) +{ + return max(min(x, y), min(max(x, y), z)); +} +FfxFloat16x4 ffxMed3Half(FfxFloat16x4 x, FfxFloat16x4 y, FfxFloat16x4 z) +{ + return max(min(x, y), min(max(x, y), z)); +} +//------------------------------------------------------------------------------------------------------------------------------ +FfxFloat16 ffxReciprocalHalf(FfxFloat16 x) +{ + return FFX_BROADCAST_FLOAT16(1.0) / x; +} +FfxFloat16x2 ffxReciprocalHalf(FfxFloat16x2 x) +{ + return FFX_BROADCAST_FLOAT16X2(1.0) / x; +} +FfxFloat16x3 ffxReciprocalHalf(FfxFloat16x3 x) +{ + return FFX_BROADCAST_FLOAT16X3(1.0) / x; +} +FfxFloat16x4 ffxReciprocalHalf(FfxFloat16x4 x) +{ + return FFX_BROADCAST_FLOAT16X4(1.0) / x; +} +//------------------------------------------------------------------------------------------------------------------------------ +FfxFloat16 ffxReciprocalSquareRootHalf(FfxFloat16 x) +{ + return FFX_BROADCAST_FLOAT16(1.0) / sqrt(x); +} +FfxFloat16x2 ffxReciprocalSquareRootHalf(FfxFloat16x2 x) +{ + return FFX_BROADCAST_FLOAT16X2(1.0) / sqrt(x); +} +FfxFloat16x3 ffxReciprocalSquareRootHalf(FfxFloat16x3 x) +{ + return FFX_BROADCAST_FLOAT16X3(1.0) / sqrt(x); +} +FfxFloat16x4 ffxReciprocalSquareRootHalf(FfxFloat16x4 x) +{ + return FFX_BROADCAST_FLOAT16X4(1.0) / sqrt(x); +} +//------------------------------------------------------------------------------------------------------------------------------ +FfxFloat16 ffxSaturate(FfxFloat16 x) +{ + return clamp(x, FFX_BROADCAST_FLOAT16(0.0), FFX_BROADCAST_FLOAT16(1.0)); +} +FfxFloat16x2 ffxSaturate(FfxFloat16x2 x) +{ + return clamp(x, FFX_BROADCAST_FLOAT16X2(0.0), FFX_BROADCAST_FLOAT16X2(1.0)); +} +FfxFloat16x3 ffxSaturate(FfxFloat16x3 x) +{ + return clamp(x, FFX_BROADCAST_FLOAT16X3(0.0), FFX_BROADCAST_FLOAT16X3(1.0)); +} +FfxFloat16x4 ffxSaturate(FfxFloat16x4 x) +{ + return clamp(x, FFX_BROADCAST_FLOAT16X4(0.0), FFX_BROADCAST_FLOAT16X4(1.0)); +} +//------------------------------------------------------------------------------------------------------------------------------ +FfxUInt16 ffxBitShiftRightHalf(FfxUInt16 a, FfxUInt16 b) +{ + return FfxUInt16(FfxInt16(a) >> FfxInt16(b)); +} +FfxUInt16x2 ffxBitShiftRightHalf(FfxUInt16x2 a, FfxUInt16x2 b) +{ + return FfxUInt16x2(FfxInt16x2(a) >> FfxInt16x2(b)); +} +FfxUInt16x3 ffxBitShiftRightHalf(FfxUInt16x3 a, FfxUInt16x3 b) +{ + return FfxUInt16x3(FfxInt16x3(a) >> FfxInt16x3(b)); +} +FfxUInt16x4 ffxBitShiftRightHalf(FfxUInt16x4 a, FfxUInt16x4 b) +{ + return FfxUInt16x4(FfxInt16x4(a) >> FfxInt16x4(b)); +} +#endif // FFX_HALF + +#if defined(FFX_WAVE) +// Where 'x' must be a compile time literal. +FfxFloat32 ffxWaveXorF1(FfxFloat32 v, FfxUInt32 x) +{ + return subgroupShuffleXor(v, x); +} +FfxFloat32x2 ffxWaveXorF2(FfxFloat32x2 v, FfxUInt32 x) +{ + return subgroupShuffleXor(v, x); +} +FfxFloat32x3 ffxWaveXorF3(FfxFloat32x3 v, FfxUInt32 x) +{ + return subgroupShuffleXor(v, x); +} +FfxFloat32x4 ffxWaveXorF4(FfxFloat32x4 v, FfxUInt32 x) +{ + return subgroupShuffleXor(v, x); +} +FfxUInt32 ffxWaveXorU1(FfxUInt32 v, FfxUInt32 x) +{ + return subgroupShuffleXor(v, x); +} +FfxUInt32x2 ffxWaveXorU2(FfxUInt32x2 v, FfxUInt32 x) +{ + return subgroupShuffleXor(v, x); +} +FfxUInt32x3 ffxWaveXorU3(FfxUInt32x3 v, FfxUInt32 x) +{ + return subgroupShuffleXor(v, x); +} +FfxUInt32x4 ffxWaveXorU4(FfxUInt32x4 v, FfxUInt32 x) +{ + return subgroupShuffleXor(v, x); +} +FfxBoolean ffxWaveIsFirstLane() +{ + return subgroupElect(); +} +FfxUInt32 ffxWaveLaneIndex() +{ + return gl_SubgroupInvocationID; +} +FfxBoolean ffxWaveReadAtLaneIndexB1(FfxBoolean v, FfxUInt32 x ) +{ + return subgroupShuffle(v, x); +} +FfxUInt32 ffxWavePrefixCountBits(FfxBoolean v) +{ + return subgroupBallotExclusiveBitCount(subgroupBallot(v)); +} +FfxUInt32 ffxWaveActiveCountBits(FfxBoolean v) +{ + return subgroupBallotBitCount(subgroupBallot(v)); +} +FfxUInt32 ffxWaveReadLaneFirstU1(FfxUInt32 v) +{ + return subgroupBroadcastFirst(v); +} +FfxUInt32x2 ffxWaveReadLaneFirstU2(FfxUInt32x2 v) +{ + return subgroupBroadcastFirst(v); +} +FfxBoolean ffxWaveReadLaneFirstB1(FfxBoolean v) +{ + return subgroupBroadcastFirst(v); +} +FfxUInt32 ffxWaveOr(FfxUInt32 a) +{ + return subgroupOr(a); +} +FfxUInt32 ffxWaveMin(FfxUInt32 a) +{ + return subgroupMin(a); +} +FfxFloat32 ffxWaveMin(FfxFloat32 a) +{ + return subgroupMin(a); +} +FfxUInt32 ffxWaveMax(FfxUInt32 a) +{ + return subgroupMax(a); +} +FfxFloat32 ffxWaveMax(FfxFloat32 a) +{ + return subgroupMax(a); +} +FfxUInt32 ffxWaveSum(FfxUInt32 a) +{ + return subgroupAdd(a); +} +FfxFloat32 ffxWaveSum(FfxFloat32 a) +{ + return subgroupAdd(a); +} +FfxUInt32 ffxWaveLaneCount() +{ + return gl_SubgroupSize; +} +#if defined(FFX_WAVE_ALL_TRUE) +FfxBoolean ffxWaveAllTrue(FfxBoolean v) +{ + return subgroupAll(v); +} +#endif +FfxFloat32 ffxQuadReadX(FfxFloat32 v) +{ + return subgroupQuadSwapHorizontal(v); +} +FfxFloat32x2 ffxQuadReadX(FfxFloat32x2 v) +{ + return subgroupQuadSwapHorizontal(v); +} +FfxFloat32 ffxQuadReadY(FfxFloat32 v) +{ + return subgroupQuadSwapVertical(v); +} +FfxFloat32x2 ffxQuadReadY(FfxFloat32x2 v) +{ + return subgroupQuadSwapVertical(v); +} + +//------------------------------------------------------------------------------------------------------------------------------ +#if FFX_HALF +FfxFloat16x2 ffxWaveXorFloat16x2(FfxFloat16x2 v, FfxUInt32 x) +{ + return FFX_UINT32_TO_FLOAT16X2(subgroupShuffleXor(FFX_FLOAT16X2_TO_UINT32(v), x)); +} +FfxFloat16x4 ffxWaveXorFloat16x4(FfxFloat16x4 v, FfxUInt32 x) +{ + return FFX_UINT32X2_TO_FLOAT16X4(subgroupShuffleXor(FFX_FLOAT16X4_TO_UINT32X2(v), x)); +} +FfxUInt16x2 ffxWaveXorUint16x2(FfxUInt16x2 v, FfxUInt32 x) +{ + return FFX_UINT32_TO_UINT16X2(subgroupShuffleXor(FFX_UINT16X2_TO_UINT32(v), x)); +} +FfxUInt16x4 ffxWaveXorUint16x4(FfxUInt16x4 v, FfxUInt32 x) +{ + return FFX_UINT32X2_TO_UINT16X4(subgroupShuffleXor(FFX_UINT16X4_TO_UINT32X2(v), x)); +} +#endif // FFX_HALF +#endif // #if defined(FFX_WAVE) diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/ffx_core_gpu_common.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/ffx_core_gpu_common.h new file mode 100644 index 00000000..da03b07a --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/ffx_core_gpu_common.h @@ -0,0 +1,2736 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +/// A define for a true value in a boolean expression. +/// +/// @ingroup GPUCore +#define FFX_TRUE (true) + +/// A define for a false value in a boolean expression. +/// +/// @ingroup GPUCore +#define FFX_FALSE (false) + +/// A define value for positive infinity. +/// +/// @ingroup GPUCore +#define FFX_POSITIVE_INFINITY_FLOAT ffxAsFloat(0x7f800000u) + +/// A define value for negative infinity. +/// +/// @ingroup GPUCore +#define FFX_NEGATIVE_INFINITY_FLOAT ffxAsFloat(0xff800000u) + +/// A define value for PI. +/// +/// @ingroup GPUCore +#define FFX_PI (3.14159) + +FFX_STATIC const FfxFloat32 FFX_FP16_MIN = 6.10e-05f; +FFX_STATIC const FfxFloat32 FFX_FP16_MAX = 65504.0f; +FFX_STATIC const FfxFloat32 FFX_TONEMAP_EPSILON = 1.0f / FFX_FP16_MAX; + +#define FFX_HAS_FLAG(v, f) ((v & f) == f) + +/// Compute the min of two values. +/// +/// @param [in] x The first value to compute the min of. +/// @param [in] y The second value to compute the min of. +/// +/// @returns +/// The the lowest of two values. +/// +/// @ingroup GPUCore +FfxFloat32 ffxMin(FfxFloat32 x, FfxFloat32 y) +{ + return min(x, y); +} + +/// Compute the min of two values. +/// +/// @param [in] x The first value to compute the min of. +/// @param [in] y The second value to compute the min of. +/// +/// @returns +/// The the lowest of two values. +/// +/// @ingroup GPUCore +FfxFloat32x2 ffxMin(FfxFloat32x2 x, FfxFloat32x2 y) +{ + return min(x, y); +} + +/// Compute the min of two values. +/// +/// @param [in] x The first value to compute the min of. +/// @param [in] y The second value to compute the min of. +/// +/// @returns +/// The the lowest of two values. +/// +/// @ingroup GPUCore +FfxFloat32x3 ffxMin(FfxFloat32x3 x, FfxFloat32x3 y) +{ + return min(x, y); +} + +/// Compute the min of two values. +/// +/// @param [in] x The first value to compute the min of. +/// @param [in] y The second value to compute the min of. +/// +/// @returns +/// The the lowest of two values. +/// +/// @ingroup GPUCore +FfxFloat32x4 ffxMin(FfxFloat32x4 x, FfxFloat32x4 y) +{ + return min(x, y); +} + +/// Compute the min of two values. +/// +/// @param [in] x The first value to compute the min of. +/// @param [in] y The second value to compute the min of. +/// +/// @returns +/// The the lowest of two values. +/// +/// @ingroup GPUCore +FfxInt32 ffxMin(FfxInt32 x, FfxInt32 y) +{ + return min(x, y); +} + +/// Compute the min of two values. +/// +/// @param [in] x The first value to compute the min of. +/// @param [in] y The second value to compute the min of. +/// +/// @returns +/// The the lowest of two values. +/// +/// @ingroup GPUCore +FfxInt32x2 ffxMin(FfxInt32x2 x, FfxInt32x2 y) +{ + return min(x, y); +} + +/// Compute the min of two values. +/// +/// @param [in] x The first value to compute the min of. +/// @param [in] y The second value to compute the min of. +/// +/// @returns +/// The the lowest of two values. +/// +/// @ingroup GPUCore +FfxInt32x3 ffxMin(FfxInt32x3 x, FfxInt32x3 y) +{ + return min(x, y); +} + +/// Compute the min of two values. +/// +/// @param [in] x The first value to compute the min of. +/// @param [in] y The second value to compute the min of. +/// +/// @returns +/// The the lowest of two values. +/// +/// @ingroup GPUCore +FfxInt32x4 ffxMin(FfxInt32x4 x, FfxInt32x4 y) +{ + return min(x, y); +} + +/// Compute the min of two values. +/// +/// @param [in] x The first value to compute the min of. +/// @param [in] y The second value to compute the min of. +/// +/// @returns +/// The the lowest of two values. +/// +/// @ingroup GPUCore +FfxUInt32 ffxMin(FfxUInt32 x, FfxUInt32 y) +{ + return min(x, y); +} + +/// Compute the min of two values. +/// +/// @param [in] x The first value to compute the min of. +/// @param [in] y The second value to compute the min of. +/// +/// @returns +/// The the lowest of two values. +/// +/// @ingroup GPUCore +FfxUInt32x2 ffxMin(FfxUInt32x2 x, FfxUInt32x2 y) +{ + return min(x, y); +} + +/// Compute the min of two values. +/// +/// @param [in] x The first value to compute the min of. +/// @param [in] y The second value to compute the min of. +/// +/// @returns +/// The the lowest of two values. +/// +/// @ingroup GPUCore +FfxUInt32x3 ffxMin(FfxUInt32x3 x, FfxUInt32x3 y) +{ + return min(x, y); +} + +/// Compute the min of two values. +/// +/// @param [in] x The first value to compute the min of. +/// @param [in] y The second value to compute the min of. +/// +/// @returns +/// The the lowest of two values. +/// +/// @ingroup GPUCore +FfxUInt32x4 ffxMin(FfxUInt32x4 x, FfxUInt32x4 y) +{ + return min(x, y); +} + +/// Compute the max of two values. +/// +/// @param [in] x The first value to compute the max of. +/// @param [in] y The second value to compute the max of. +/// +/// @returns +/// The the lowest of two values. +/// +/// @ingroup GPUCore +FfxFloat32 ffxMax(FfxFloat32 x, FfxFloat32 y) +{ + return max(x, y); +} + +/// Compute the max of two values. +/// +/// @param [in] x The first value to compute the max of. +/// @param [in] y The second value to compute the max of. +/// +/// @returns +/// The the lowest of two values. +/// +/// @ingroup GPUCore +FfxFloat32x2 ffxMax(FfxFloat32x2 x, FfxFloat32x2 y) +{ + return max(x, y); +} + +/// Compute the max of two values. +/// +/// @param [in] x The first value to compute the max of. +/// @param [in] y The second value to compute the max of. +/// +/// @returns +/// The the lowest of two values. +/// +/// @ingroup GPUCore +FfxFloat32x3 ffxMax(FfxFloat32x3 x, FfxFloat32x3 y) +{ + return max(x, y); +} + +/// Compute the max of two values. +/// +/// @param [in] x The first value to compute the max of. +/// @param [in] y The second value to compute the max of. +/// +/// @returns +/// The the lowest of two values. +/// +/// @ingroup GPUCore +FfxFloat32x4 ffxMax(FfxFloat32x4 x, FfxFloat32x4 y) +{ + return max(x, y); +} + +/// Compute the max of two values. +/// +/// @param [in] x The first value to compute the max of. +/// @param [in] y The second value to compute the max of. +/// +/// @returns +/// The the lowest of two values. +/// +/// @ingroup GPUCore +FfxInt32 ffxMax(FfxInt32 x, FfxInt32 y) +{ + return max(x, y); +} + +/// Compute the max of two values. +/// +/// @param [in] x The first value to compute the max of. +/// @param [in] y The second value to compute the max of. +/// +/// @returns +/// The the lowest of two values. +/// +/// @ingroup GPUCore +FfxInt32x2 ffxMax(FfxInt32x2 x, FfxInt32x2 y) +{ + return max(x, y); +} + +/// Compute the max of two values. +/// +/// @param [in] x The first value to compute the max of. +/// @param [in] y The second value to compute the max of. +/// +/// @returns +/// The the lowest of two values. +/// +/// @ingroup GPUCore +FfxInt32x3 ffxMax(FfxInt32x3 x, FfxInt32x3 y) +{ + return max(x, y); +} + +/// Compute the max of two values. +/// +/// @param [in] x The first value to compute the max of. +/// @param [in] y The second value to compute the max of. +/// +/// @returns +/// The the lowest of two values. +/// +/// @ingroup GPUCore +FfxInt32x4 ffxMax(FfxInt32x4 x, FfxInt32x4 y) +{ + return max(x, y); +} + +/// Compute the max of two values. +/// +/// @param [in] x The first value to compute the max of. +/// @param [in] y The second value to compute the max of. +/// +/// @returns +/// The the lowest of two values. +/// +/// @ingroup GPUCore +FfxUInt32 ffxMax(FfxUInt32 x, FfxUInt32 y) +{ + return max(x, y); +} + +/// Compute the max of two values. +/// +/// @param [in] x The first value to compute the max of. +/// @param [in] y The second value to compute the max of. +/// +/// @returns +/// The the lowest of two values. +/// +/// @ingroup GPUCore +FfxUInt32x2 ffxMax(FfxUInt32x2 x, FfxUInt32x2 y) +{ + return max(x, y); +} + +/// Compute the max of two values. +/// +/// @param [in] x The first value to compute the max of. +/// @param [in] y The second value to compute the max of. +/// +/// @returns +/// The the lowest of two values. +/// +/// @ingroup GPUCore +FfxUInt32x3 ffxMax(FfxUInt32x3 x, FfxUInt32x3 y) +{ + return max(x, y); +} + +/// Compute the max of two values. +/// +/// @param [in] x The first value to compute the max of. +/// @param [in] y The second value to compute the max of. +/// +/// @returns +/// The the lowest of two values. +/// +/// @ingroup GPUCore +FfxUInt32x4 ffxMax(FfxUInt32x4 x, FfxUInt32x4 y) +{ + return max(x, y); +} + +/// Compute the value of the first parameter raised to the power of the second. +/// +/// @param [in] x The value to raise to the power y. +/// @param [in] y The power to which to raise x. +/// +/// @returns +/// The value of the first parameter raised to the power of the second. +/// +/// @ingroup GPUCore +FfxFloat32 ffxPow(FfxFloat32 x, FfxFloat32 y) +{ + return pow(x, y); +} + +/// Compute the value of the first parameter raised to the power of the second. +/// +/// @param [in] x The value to raise to the power y. +/// @param [in] y The power to which to raise x. +/// +/// @returns +/// The value of the first parameter raised to the power of the second. +/// +/// @ingroup GPUCore +FfxFloat32x2 ffxPow(FfxFloat32x2 x, FfxFloat32x2 y) +{ + return pow(x, y); +} + +/// Compute the value of the first parameter raised to the power of the second. +/// +/// @param [in] x The value to raise to the power y. +/// @param [in] y The power to which to raise x. +/// +/// @returns +/// The value of the first parameter raised to the power of the second. +/// +/// @ingroup GPUCore +FfxFloat32x3 ffxPow(FfxFloat32x3 x, FfxFloat32x3 y) +{ + return pow(x, y); +} + +/// Compute the value of the first parameter raised to the power of the second. +/// +/// @param [in] x The value to raise to the power y. +/// @param [in] y The power to which to raise x. +/// +/// @returns +/// The value of the first parameter raised to the power of the second. +/// +/// @ingroup GPUCore +FfxFloat32x4 ffxPow(FfxFloat32x4 x, FfxFloat32x4 y) +{ + return pow(x, y); +} + +/// Compute the square root of a value. +/// +/// @param [in] x The first value to compute the min of. +/// +/// @returns +/// The the square root of x. +/// +/// @ingroup GPUCore +FfxFloat32 ffxSqrt(FfxFloat32 x) +{ + return sqrt(x); +} + +/// Compute the square root of a value. +/// +/// @param [in] x The first value to compute the min of. +/// +/// @returns +/// The the square root of x. +/// +/// @ingroup GPUCore +FfxFloat32x2 ffxSqrt(FfxFloat32x2 x) +{ + return sqrt(x); +} + +/// Compute the square root of a value. +/// +/// @param [in] x The first value to compute the min of. +/// +/// @returns +/// The the square root of x. +/// +/// @ingroup GPUCore +FfxFloat32x3 ffxSqrt(FfxFloat32x3 x) +{ + return sqrt(x); +} + +/// Compute the square root of a value. +/// +/// @param [in] x The first value to compute the min of. +/// +/// @returns +/// The the square root of x. +/// +/// @ingroup GPUCore +FfxFloat32x4 ffxSqrt(FfxFloat32x4 x) +{ + return sqrt(x); +} + +/// Copy the sign bit from 's' to positive 'd'. +/// +/// @param [in] d The value to copy the sign bit into. +/// @param [in] s The value to copy the sign bit from. +/// +/// @returns +/// The value of d with the sign bit from s. +/// +/// @ingroup GPUCore +FfxFloat32 ffxCopySignBit(FfxFloat32 d, FfxFloat32 s) +{ + return ffxAsFloat(ffxAsUInt32(d) | (ffxAsUInt32(s) & FfxUInt32(0x80000000u))); +} + +/// Copy the sign bit from 's' to positive 'd'. +/// +/// @param [in] d The value to copy the sign bit into. +/// @param [in] s The value to copy the sign bit from. +/// +/// @returns +/// The value of d with the sign bit from s. +/// +/// @ingroup GPUCore +FfxFloat32x2 ffxCopySignBit(FfxFloat32x2 d, FfxFloat32x2 s) +{ + return ffxAsFloat(ffxAsUInt32(d) | (ffxAsUInt32(s) & ffxBroadcast2(0x80000000u))); +} + +/// Copy the sign bit from 's' to positive 'd'. +/// +/// @param [in] d The value to copy the sign bit into. +/// @param [in] s The value to copy the sign bit from. +/// +/// @returns +/// The value of d with the sign bit from s. +/// +/// @ingroup GPUCore +FfxFloat32x3 ffxCopySignBit(FfxFloat32x3 d, FfxFloat32x3 s) +{ + return ffxAsFloat(ffxAsUInt32(d) | (ffxAsUInt32(s) & ffxBroadcast3(0x80000000u))); +} + +/// Copy the sign bit from 's' to positive 'd'. +/// +/// @param [in] d The value to copy the sign bit into. +/// @param [in] s The value to copy the sign bit from. +/// +/// @returns +/// The value of d with the sign bit from s. +/// +/// @ingroup GPUCore +FfxFloat32x4 ffxCopySignBit(FfxFloat32x4 d, FfxFloat32x4 s) +{ + return ffxAsFloat(ffxAsUInt32(d) | (ffxAsUInt32(s) & ffxBroadcast4(0x80000000u))); +} + +/// A single operation to return the following: +/// m = NaN := 0 +/// m >= 0 := 0 +/// m < 0 := 1 +/// +/// Uses the following useful floating point logic, +/// saturate(+a*(-INF)==-INF) := 0 +/// saturate( 0*(-INF)== NaN) := 0 +/// saturate(-a*(-INF)==+INF) := 1 +/// +/// This function is useful when creating masks for branch-free logic. +/// +/// @param [in] m The value to test against 0. +/// +/// @returns +/// 1.0 when the value is negative, or 0.0 when the value is 0 or position. +/// +/// @ingroup GPUCore +FfxFloat32 ffxIsSigned(FfxFloat32 m) +{ + return ffxSaturate(m * FfxFloat32(FFX_NEGATIVE_INFINITY_FLOAT)); +} + +/// A single operation to return the following: +/// m = NaN := 0 +/// m >= 0 := 0 +/// m < 0 := 1 +/// +/// Uses the following useful floating point logic, +/// saturate(+a*(-INF)==-INF) := 0 +/// saturate( 0*(-INF)== NaN) := 0 +/// saturate(-a*(-INF)==+INF) := 1 +/// +/// This function is useful when creating masks for branch-free logic. +/// +/// @param [in] m The value to test against 0. +/// +/// @returns +/// 1.0 when the value is negative, or 0.0 when the value is 0 or position. +/// +/// @ingroup GPUCore +FfxFloat32x2 ffxIsSigned(FfxFloat32x2 m) +{ + return ffxSaturate(m * ffxBroadcast2(FFX_NEGATIVE_INFINITY_FLOAT)); +} + +/// A single operation to return the following: +/// m = NaN := 0 +/// m >= 0 := 0 +/// m < 0 := 1 +/// +/// Uses the following useful floating point logic, +/// saturate(+a*(-INF)==-INF) := 0 +/// saturate( 0*(-INF)== NaN) := 0 +/// saturate(-a*(-INF)==+INF) := 1 +/// +/// This function is useful when creating masks for branch-free logic. +/// +/// @param [in] m The value to test against 0. +/// +/// @returns +/// 1.0 when the value is negative, or 0.0 when the value is 0 or position. +/// +/// @ingroup GPUCore +FfxFloat32x3 ffxIsSigned(FfxFloat32x3 m) +{ + return ffxSaturate(m * ffxBroadcast3(FFX_NEGATIVE_INFINITY_FLOAT)); +} + +/// A single operation to return the following: +/// m = NaN := 0 +/// m >= 0 := 0 +/// m < 0 := 1 +/// +/// Uses the following useful floating point logic, +/// saturate(+a*(-INF)==-INF) := 0 +/// saturate( 0*(-INF)== NaN) := 0 +/// saturate(-a*(-INF)==+INF) := 1 +/// +/// This function is useful when creating masks for branch-free logic. +/// +/// @param [in] m The value to test against for have the sign set. +/// +/// @returns +/// 1.0 when the value is negative, or 0.0 when the value is 0 or positive. +/// +/// @ingroup GPUCore +FfxFloat32x4 ffxIsSigned(FfxFloat32x4 m) +{ + return ffxSaturate(m * ffxBroadcast4(FFX_NEGATIVE_INFINITY_FLOAT)); +} + +/// A single operation to return the following: +/// m = NaN := 1 +/// m > 0 := 0 +/// m <= 0 := 1 +/// +/// This function is useful when creating masks for branch-free logic. +/// +/// @param [in] m The value to test against zero. +/// +/// @returns +/// 1.0 when the value is position, or 0.0 when the value is 0 or negative. +/// +/// @ingroup GPUCore +FfxFloat32 ffxIsGreaterThanZero(FfxFloat32 m) +{ + return ffxSaturate(m * FfxFloat32(FFX_POSITIVE_INFINITY_FLOAT)); +} + +/// A single operation to return the following: +/// m = NaN := 1 +/// m > 0 := 0 +/// m <= 0 := 1 +/// +/// This function is useful when creating masks for branch-free logic. +/// +/// @param [in] m The value to test against zero. +/// +/// @returns +/// 1.0 when the value is position, or 0.0 when the value is 0 or negative. +/// +/// @ingroup GPUCore +FfxFloat32x2 ffxIsGreaterThanZero(FfxFloat32x2 m) +{ + return ffxSaturate(m * ffxBroadcast2(FFX_POSITIVE_INFINITY_FLOAT)); +} + +/// A single operation to return the following: +/// m = NaN := 1 +/// m > 0 := 0 +/// m <= 0 := 1 +/// +/// This function is useful when creating masks for branch-free logic. +/// +/// @param [in] m The value to test against zero. +/// +/// @returns +/// 1.0 when the value is position, or 0.0 when the value is 0 or negative. +/// +/// @ingroup GPUCore +FfxFloat32x3 ffxIsGreaterThanZero(FfxFloat32x3 m) +{ + return ffxSaturate(m * ffxBroadcast3(FFX_POSITIVE_INFINITY_FLOAT)); +} + +/// A single operation to return the following: +/// m = NaN := 1 +/// m > 0 := 0 +/// m <= 0 := 1 +/// +/// This function is useful when creating masks for branch-free logic. +/// +/// @param [in] m The value to test against zero. +/// +/// @returns +/// 1.0 when the value is position, or 0.0 when the value is 0 or negative. +/// +/// @ingroup GPUCore +FfxFloat32x4 ffxIsGreaterThanZero(FfxFloat32x4 m) +{ + return ffxSaturate(m * ffxBroadcast4(FFX_POSITIVE_INFINITY_FLOAT)); +} + +/// Convert a 32bit floating point value to sortable integer. +/// +/// - If sign bit=0, flip the sign bit (positives). +/// - If sign bit=1, flip all bits (negatives). +/// +/// The function has the side effects that: +/// - Larger integers are more positive values. +/// - Float zero is mapped to center of integers (so clear to integer zero is a nice default for atomic max usage). +/// +/// @param [in] value The floating point value to make sortable. +/// +/// @returns +/// The sortable integer value. +/// +/// @ingroup GPUCore +FfxUInt32 ffxFloatToSortableInteger(FfxUInt32 value) +{ + return value ^ ((ffxAShrSU1(value, FfxUInt32(31))) | FfxUInt32(0x80000000)); +} + +/// Convert a sortable integer to a 32bit floating point value. +/// +/// The function has the side effects that: +/// - If sign bit=1, flip the sign bit (positives). +/// - If sign bit=0, flip all bits (negatives). +/// +/// @param [in] value The floating point value to make sortable. +/// +/// @returns +/// The sortable integer value. +/// +/// @ingroup GPUCore +FfxUInt32 ffxSortableIntegerToFloat(FfxUInt32 value) +{ + return value ^ ((~ffxAShrSU1(value, FfxUInt32(31))) | FfxUInt32(0x80000000)); +} + +/// Calculate a low-quality approximation for the square root of a value. +/// +/// For additional information on the approximation family of functions, you can refer to Michal Drobot's excellent +/// presentation materials: +/// +/// - https://michaldrobot.files.wordpress.com/2014/05/gcn_alu_opt_digitaldragons2014.pdf +/// - https://github.com/michaldrobot/ShaderFastLibs/blob/master/ShaderFastMathLib.h +/// +/// @param [in] value The value to calculate an approximate to the square root for. +/// +/// @returns +/// An approximation of the square root, estimated to low quality. +/// +/// @ingroup GPUCore +FfxFloat32 ffxApproximateSqrt(FfxFloat32 value) +{ + return ffxAsFloat((ffxAsUInt32(value) >> FfxUInt32(1)) + FfxUInt32(0x1fbc4639)); +} + +/// Calculate a low-quality approximation for the reciprocal of a value. +/// +/// For additional information on the approximation family of functions, you can refer to Michal Drobot's excellent +/// presentation materials: +/// +/// - https://michaldrobot.files.wordpress.com/2014/05/gcn_alu_opt_digitaldragons2014.pdf +/// - https://github.com/michaldrobot/ShaderFastLibs/blob/master/ShaderFastMathLib.h +/// +/// @param [in] value The value to calculate an approximate to the reciprocal for. +/// +/// @returns +/// An approximation of the reciprocal, estimated to low quality. +/// +/// @ingroup GPUCore +FfxFloat32 ffxApproximateReciprocal(FfxFloat32 value) +{ + return ffxAsFloat(FfxUInt32(0x7ef07ebb) - ffxAsUInt32(value)); +} + +/// Calculate a medium-quality approximation for the reciprocal of a value. +/// +/// For additional information on the approximation family of functions, you can refer to Michal Drobot's excellent +/// presentation materials: +/// +/// - https://michaldrobot.files.wordpress.com/2014/05/gcn_alu_opt_digitaldragons2014.pdf +/// - https://github.com/michaldrobot/ShaderFastLibs/blob/master/ShaderFastMathLib.h +/// +/// @param [in] value The value to calculate an approximate to the reciprocal for. +/// +/// @returns +/// An approximation of the reciprocal, estimated to medium quality. +/// +/// @ingroup GPUCore +FfxFloat32 ffxApproximateReciprocalMedium(FfxFloat32 value) +{ + FfxFloat32 b = ffxAsFloat(FfxUInt32(0x7ef19fff) - ffxAsUInt32(value)); + return b * (-b * value + FfxFloat32(2.0)); +} + +/// Calculate a low-quality approximation for the reciprocal of a value. +/// +/// For additional information on the approximation family of functions, you can refer to Michal Drobot's excellent +/// presentation materials: +/// +/// - https://michaldrobot.files.wordpress.com/2014/05/gcn_alu_opt_digitaldragons2014.pdf +/// - https://github.com/michaldrobot/ShaderFastLibs/blob/master/ShaderFastMathLib.h +/// +/// @param [in] value The value to calculate an approximate to the reciprocal square root for. +/// +/// @returns +/// An approximation of the reciprocal square root, estimated to low quality. +/// +/// @ingroup GPUCore +FfxFloat32 ffxApproximateReciprocalSquareRoot(FfxFloat32 value) +{ + return ffxAsFloat(FfxUInt32(0x5f347d74) - (ffxAsUInt32(value) >> FfxUInt32(1))); +} + +/// Calculate a low-quality approximation for the square root of a value. +/// +/// For additional information on the approximation family of functions, you can refer to Michal Drobot's excellent +/// presentation materials: +/// +/// - https://michaldrobot.files.wordpress.com/2014/05/gcn_alu_opt_digitaldragons2014.pdf +/// - https://github.com/michaldrobot/ShaderFastLibs/blob/master/ShaderFastMathLib.h +/// +/// @param [in] value The value to calculate an approximate to the square root for. +/// +/// @returns +/// An approximation of the square root, estimated to low quality. +/// +/// @ingroup GPUCore +FfxFloat32x2 ffxApproximateSqrt(FfxFloat32x2 value) +{ + return ffxAsFloat((ffxAsUInt32(value) >> ffxBroadcast2(1u)) + ffxBroadcast2(0x1fbc4639u)); +} + +/// Calculate a low-quality approximation for the reciprocal of a value. +/// +/// For additional information on the approximation family of functions, you can refer to Michal Drobot's excellent +/// presentation materials: +/// +/// - https://michaldrobot.files.wordpress.com/2014/05/gcn_alu_opt_digitaldragons2014.pdf +/// - https://github.com/michaldrobot/ShaderFastLibs/blob/master/ShaderFastMathLib.h +/// +/// @param [in] value The value to calculate an approximate to the reciprocal for. +/// +/// @returns +/// An approximation of the reciprocal, estimated to low quality. +/// +/// @ingroup GPUCore +FfxFloat32x2 ffxApproximateReciprocal(FfxFloat32x2 value) +{ + return ffxAsFloat(ffxBroadcast2(0x7ef07ebbu) - ffxAsUInt32(value)); +} + +/// Calculate a medium-quality approximation for the reciprocal of a value. +/// +/// For additional information on the approximation family of functions, you can refer to Michal Drobot's excellent +/// presentation materials: +/// +/// - https://michaldrobot.files.wordpress.com/2014/05/gcn_alu_opt_digitaldragons2014.pdf +/// - https://github.com/michaldrobot/ShaderFastLibs/blob/master/ShaderFastMathLib.h +/// +/// @param [in] value The value to calculate an approximate to the reciprocal for. +/// +/// @returns +/// An approximation of the reciprocal, estimated to medium quality. +/// +/// @ingroup GPUCore +FfxFloat32x2 ffxApproximateReciprocalMedium(FfxFloat32x2 value) +{ + FfxFloat32x2 b = ffxAsFloat(ffxBroadcast2(0x7ef19fffu) - ffxAsUInt32(value)); + return b * (-b * value + ffxBroadcast2(2.0f)); +} + +/// Calculate a low-quality approximation for the square root of a value. +/// +/// For additional information on the approximation family of functions, you can refer to Michal Drobot's excellent +/// presentation materials: +/// +/// - https://michaldrobot.files.wordpress.com/2014/05/gcn_alu_opt_digitaldragons2014.pdf +/// - https://github.com/michaldrobot/ShaderFastLibs/blob/master/ShaderFastMathLib.h +/// +/// @param [in] value The value to calculate an approximate to the square root for. +/// +/// @returns +/// An approximation of the square root, estimated to low quality. +/// +/// @ingroup GPUCore +FfxFloat32x2 ffxApproximateReciprocalSquareRoot(FfxFloat32x2 value) +{ + return ffxAsFloat(ffxBroadcast2(0x5f347d74u) - (ffxAsUInt32(value) >> ffxBroadcast2(1u))); +} + +/// Calculate a low-quality approximation for the square root of a value. +/// +/// For additional information on the approximation family of functions, you can refer to Michal Drobot's excellent +/// presentation materials: +/// +/// - https://michaldrobot.files.wordpress.com/2014/05/gcn_alu_opt_digitaldragons2014.pdf +/// - https://github.com/michaldrobot/ShaderFastLibs/blob/master/ShaderFastMathLib.h +/// +/// @param [in] value The value to calculate an approximate to the square root for. +/// +/// @returns +/// An approximation of the square root, estimated to low quality. +/// +/// @ingroup GPUCore +FfxFloat32x3 ffxApproximateSqrt(FfxFloat32x3 value) +{ + return ffxAsFloat((ffxAsUInt32(value) >> ffxBroadcast3(1u)) + ffxBroadcast3(0x1fbc4639u)); +} + +/// Calculate a low-quality approximation for the reciprocal of a value. +/// +/// For additional information on the approximation family of functions, you can refer to Michal Drobot's excellent +/// presentation materials: +/// +/// - https://michaldrobot.files.wordpress.com/2014/05/gcn_alu_opt_digitaldragons2014.pdf +/// - https://github.com/michaldrobot/ShaderFastLibs/blob/master/ShaderFastMathLib.h +/// +/// @param [in] value The value to calculate an approximate to the reciprocal for. +/// +/// @returns +/// An approximation of the reciprocal, estimated to low quality. +/// +/// @ingroup GPUCore +FfxFloat32x3 ffxApproximateReciprocal(FfxFloat32x3 value) +{ + return ffxAsFloat(ffxBroadcast3(0x7ef07ebbu) - ffxAsUInt32(value)); +} + +/// Calculate a medium-quality approximation for the reciprocal of a value. +/// +/// For additional information on the approximation family of functions, you can refer to Michal Drobot's excellent +/// presentation materials: +/// +/// - https://michaldrobot.files.wordpress.com/2014/05/gcn_alu_opt_digitaldragons2014.pdf +/// - https://github.com/michaldrobot/ShaderFastLibs/blob/master/ShaderFastMathLib.h +/// +/// @param [in] value The value to calculate an approximate to the reciprocal for. +/// +/// @returns +/// An approximation of the reciprocal, estimated to medium quality. +/// +/// @ingroup GPUCore +FfxFloat32x3 ffxApproximateReciprocalMedium(FfxFloat32x3 value) +{ + FfxFloat32x3 b = ffxAsFloat(ffxBroadcast3(0x7ef19fffu) - ffxAsUInt32(value)); + return b * (-b * value + ffxBroadcast3(2.0f)); +} + +/// Calculate a low-quality approximation for the square root of a value. +/// +/// For additional information on the approximation family of functions, you can refer to Michal Drobot's excellent +/// presentation materials: +/// +/// - https://michaldrobot.files.wordpress.com/2014/05/gcn_alu_opt_digitaldragons2014.pdf +/// - https://github.com/michaldrobot/ShaderFastLibs/blob/master/ShaderFastMathLib.h +/// +/// @param [in] value The value to calculate an approximate to the square root for. +/// +/// @returns +/// An approximation of the square root, estimated to low quality. +/// +/// @ingroup GPUCore +FfxFloat32x3 ffxApproximateReciprocalSquareRoot(FfxFloat32x3 value) +{ + return ffxAsFloat(ffxBroadcast3(0x5f347d74u) - (ffxAsUInt32(value) >> ffxBroadcast3(1u))); +} + +/// Calculate a low-quality approximation for the square root of a value. +/// +/// For additional information on the approximation family of functions, you can refer to Michal Drobot's excellent +/// presentation materials: +/// +/// - https://michaldrobot.files.wordpress.com/2014/05/gcn_alu_opt_digitaldragons2014.pdf +/// - https://github.com/michaldrobot/ShaderFastLibs/blob/master/ShaderFastMathLib.h +/// +/// @param [in] value The value to calculate an approximate to the square root for. +/// +/// @returns +/// An approximation of the square root, estimated to low quality. +/// +/// @ingroup GPUCore +FfxFloat32x4 ffxApproximateSqrt(FfxFloat32x4 value) +{ + return ffxAsFloat((ffxAsUInt32(value) >> ffxBroadcast4(1u)) + ffxBroadcast4(0x1fbc4639u)); +} + +/// Calculate a low-quality approximation for the reciprocal of a value. +/// +/// For additional information on the approximation family of functions, you can refer to Michal Drobot's excellent +/// presentation materials: +/// +/// - https://michaldrobot.files.wordpress.com/2014/05/gcn_alu_opt_digitaldragons2014.pdf +/// - https://github.com/michaldrobot/ShaderFastLibs/blob/master/ShaderFastMathLib.h +/// +/// @param [in] value The value to calculate an approximate to the reciprocal for. +/// +/// @returns +/// An approximation of the reciprocal, estimated to low quality. +/// +/// @ingroup GPUCore +FfxFloat32x4 ffxApproximateReciprocal(FfxFloat32x4 value) +{ + return ffxAsFloat(ffxBroadcast4(0x7ef07ebbu) - ffxAsUInt32(value)); +} + +/// Calculate a medium-quality approximation for the reciprocal of a value. +/// +/// For additional information on the approximation family of functions, you can refer to Michal Drobot's excellent +/// presentation materials: +/// +/// - https://michaldrobot.files.wordpress.com/2014/05/gcn_alu_opt_digitaldragons2014.pdf +/// - https://github.com/michaldrobot/ShaderFastLibs/blob/master/ShaderFastMathLib.h +/// +/// @param [in] value The value to calculate an approximate to the reciprocal for. +/// +/// @returns +/// An approximation of the reciprocal, estimated to medium quality. +/// +/// @ingroup GPUCore +FfxFloat32x4 ffxApproximateReciprocalMedium(FfxFloat32x4 value) +{ + FfxFloat32x4 b = ffxAsFloat(ffxBroadcast4(0x7ef19fffu) - ffxAsUInt32(value)); + return b * (-b * value + ffxBroadcast4(2.0f)); +} + +/// Calculate a low-quality approximation for the square root of a value. +/// +/// For additional information on the approximation family of functions, you can refer to Michal Drobot's excellent +/// presentation materials: +/// +/// - https://michaldrobot.files.wordpress.com/2014/05/gcn_alu_opt_digitaldragons2014.pdf +/// - https://github.com/michaldrobot/ShaderFastLibs/blob/master/ShaderFastMathLib.h +/// +/// @param [in] value The value to calculate an approximate to the square root for. +/// +/// @returns +/// An approximation of the square root, estimated to low quality. +/// +/// @ingroup GPUCore +FfxFloat32x4 ffxApproximateReciprocalSquareRoot(FfxFloat32x4 value) +{ + return ffxAsFloat(ffxBroadcast4(0x5f347d74u) - (ffxAsUInt32(value) >> ffxBroadcast4(1u))); +} + +/// Calculate dot product of 'a' and 'b'. +/// +/// @param [in] a First vector input. +/// @param [in] b Second vector input. +/// +/// @returns +/// The value of a dot b. +/// +/// @ingroup GPUCore +FfxFloat32 ffxDot2(FfxFloat32x2 a, FfxFloat32x2 b) +{ + return dot(a, b); +} + +/// Calculate dot product of 'a' and 'b'. +/// +/// @param [in] a First vector input. +/// @param [in] b Second vector input. +/// +/// @returns +/// The value of a dot b. +/// +/// @ingroup GPUCore +FfxFloat32 ffxDot3(FfxFloat32x3 a, FfxFloat32x3 b) +{ + return dot(a, b); +} + +/// Calculate dot product of 'a' and 'b'. +/// +/// @param [in] a First vector input. +/// @param [in] b Second vector input. +/// +/// @returns +/// The value of a dot b. +/// +/// @ingroup GPUCore +FfxFloat32 ffxDot4(FfxFloat32x4 a, FfxFloat32x4 b) +{ + return dot(a, b); +} + + +/// Compute an approximate conversion from PQ to Gamma2 space. +/// +/// PQ is very close to x^(1/8). The functions below Use the fast FfxFloat32 approximation method to do +/// PQ conversions to and from Gamma2 (4th power and fast 4th root), and PQ to and from Linear +/// (8th power and fast 8th root). The maximum error is approximately 0.2%. +/// +/// @param a The value to convert between PQ and Gamma2. +/// +/// @returns +/// The value a converted into Gamma2. +/// +/// @ingroup GPUCore +FfxFloat32 ffxApproximatePQToGamma2Medium(FfxFloat32 a) +{ + return a * a * a * a; +} + +/// Compute an approximate conversion from PQ to linear space. +/// +/// PQ is very close to x^(1/8). The functions below Use the fast FfxFloat32 approximation method to do +/// PQ conversions to and from Gamma2 (4th power and fast 4th root), and PQ to and from Linear +/// (8th power and fast 8th root). The maximum error is approximately 0.2%. +/// +/// @param a The value to convert between PQ and linear. +/// +/// @returns +/// The value a converted into linear. +/// +/// @ingroup GPUCore +FfxFloat32 ffxApproximatePQToLinear(FfxFloat32 a) +{ + return a * a * a * a * a * a * a * a; +} + +/// Compute an approximate conversion from gamma2 to PQ space. +/// +/// PQ is very close to x^(1/8). The functions below Use the fast FfxFloat32 approximation method to do +/// PQ conversions to and from Gamma2 (4th power and fast 4th root), and PQ to and from Linear +/// (8th power and fast 8th root). The maximum error is approximately 0.2%. +/// +/// @param a The value to convert between gamma2 and PQ. +/// +/// @returns +/// The value a converted into PQ. +/// +/// @ingroup GPUCore +FfxFloat32 ffxApproximateGamma2ToPQ(FfxFloat32 a) +{ + return ffxAsFloat((ffxAsUInt32(a) >> FfxUInt32(2)) + FfxUInt32(0x2F9A4E46)); +} + +/// Compute a more accurate approximate conversion from gamma2 to PQ space. +/// +/// PQ is very close to x^(1/8). The functions below Use the fast FfxFloat32 approximation method to do +/// PQ conversions to and from Gamma2 (4th power and fast 4th root), and PQ to and from Linear +/// (8th power and fast 8th root). The maximum error is approximately 0.2%. +/// +/// @param a The value to convert between gamma2 and PQ. +/// +/// @returns +/// The value a converted into PQ. +/// +/// @ingroup GPUCore +FfxFloat32 ffxApproximateGamma2ToPQMedium(FfxFloat32 a) +{ + FfxFloat32 b = ffxAsFloat((ffxAsUInt32(a) >> FfxUInt32(2)) + FfxUInt32(0x2F9A4E46)); + FfxFloat32 b4 = b * b * b * b; + return b - b * (b4 - a) / (FfxFloat32(4.0) * b4); +} + +/// Compute a high accuracy approximate conversion from gamma2 to PQ space. +/// +/// PQ is very close to x^(1/8). The functions below Use the fast FfxFloat32 approximation method to do +/// PQ conversions to and from Gamma2 (4th power and fast 4th root), and PQ to and from Linear +/// (8th power and fast 8th root). The maximum error is approximately 0.2%. +/// +/// @param a The value to convert between gamma2 and PQ. +/// +/// @returns +/// The value a converted into PQ. +/// +/// @ingroup GPUCore +FfxFloat32 ffxApproximateGamma2ToPQHigh(FfxFloat32 a) +{ + return ffxSqrt(ffxSqrt(a)); +} + +/// Compute an approximate conversion from linear to PQ space. +/// +/// PQ is very close to x^(1/8). The functions below Use the fast FfxFloat32 approximation method to do +/// PQ conversions to and from Gamma2 (4th power and fast 4th root), and PQ to and from Linear +/// (8th power and fast 8th root). The maximum error is approximately 0.2%. +/// +/// @param a The value to convert between linear and PQ. +/// +/// @returns +/// The value a converted into PQ. +/// +/// @ingroup GPUCore +FfxFloat32 ffxApproximateLinearToPQ(FfxFloat32 a) +{ + return ffxAsFloat((ffxAsUInt32(a) >> FfxUInt32(3)) + FfxUInt32(0x378D8723)); +} + +/// Compute a more accurate approximate conversion from linear to PQ space. +/// +/// PQ is very close to x^(1/8). The functions below Use the fast FfxFloat32 approximation method to do +/// PQ conversions to and from Gamma2 (4th power and fast 4th root), and PQ to and from Linear +/// (8th power and fast 8th root). The maximum error is approximately 0.2%. +/// +/// @param a The value to convert between linear and PQ. +/// +/// @returns +/// The value a converted into PQ. +/// +/// @ingroup GPUCore +FfxFloat32 ffxApproximateLinearToPQMedium(FfxFloat32 a) +{ + FfxFloat32 b = ffxAsFloat((ffxAsUInt32(a) >> FfxUInt32(3)) + FfxUInt32(0x378D8723)); + FfxFloat32 b8 = b * b * b * b * b * b * b * b; + return b - b * (b8 - a) / (FfxFloat32(8.0) * b8); +} + +/// Compute a very accurate approximate conversion from linear to PQ space. +/// +/// PQ is very close to x^(1/8). The functions below Use the fast FfxFloat32 approximation method to do +/// PQ conversions to and from Gamma2 (4th power and fast 4th root), and PQ to and from Linear +/// (8th power and fast 8th root). The maximum error is approximately 0.2%. +/// +/// @param a The value to convert between linear and PQ. +/// +/// @returns +/// The value a converted into PQ. +/// +/// @ingroup GPUCore +FfxFloat32 ffxApproximateLinearToPQHigh(FfxFloat32 a) +{ + return ffxSqrt(ffxSqrt(ffxSqrt(a))); +} + +/// Compute an approximate conversion from PQ to Gamma2 space. +/// +/// PQ is very close to x^(1/8). The functions below Use the fast FfxFloat32 approximation method to do +/// PQ conversions to and from Gamma2 (4th power and fast 4th root), and PQ to and from Linear +/// (8th power and fast 8th root). The maximum error is approximately 0.2%. +/// +/// @param a The value to convert between PQ and Gamma2. +/// +/// @returns +/// The value a converted into Gamma2. +/// +/// @ingroup GPUCore +FfxFloat32x2 ffxApproximatePQToGamma2Medium(FfxFloat32x2 a) +{ + return a * a * a * a; +} + +/// Compute an approximate conversion from PQ to linear space. +/// +/// PQ is very close to x^(1/8). The functions below Use the fast FfxFloat32 approximation method to do +/// PQ conversions to and from Gamma2 (4th power and fast 4th root), and PQ to and from Linear +/// (8th power and fast 8th root). The maximum error is approximately 0.2%. +/// +/// @param a The value to convert between PQ and linear. +/// +/// @returns +/// The value a converted into linear. +/// +/// @ingroup GPUCore +FfxFloat32x2 ffxApproximatePQToLinear(FfxFloat32x2 a) +{ + return a * a * a * a * a * a * a * a; +} + +/// Compute an approximate conversion from gamma2 to PQ space. +/// +/// PQ is very close to x^(1/8). The functions below Use the fast FfxFloat32 approximation method to do +/// PQ conversions to and from Gamma2 (4th power and fast 4th root), and PQ to and from Linear +/// (8th power and fast 8th root). The maximum error is approximately 0.2%. +/// +/// @param a The value to convert between gamma2 and PQ. +/// +/// @returns +/// The value a converted into PQ. +/// +/// @ingroup GPUCore +FfxFloat32x2 ffxApproximateGamma2ToPQ(FfxFloat32x2 a) +{ + return ffxAsFloat((ffxAsUInt32(a) >> ffxBroadcast2(2u)) + ffxBroadcast2(0x2F9A4E46u)); +} + +/// Compute a more accurate approximate conversion from gamma2 to PQ space. +/// +/// PQ is very close to x^(1/8). The functions below Use the fast FfxFloat32 approximation method to do +/// PQ conversions to and from Gamma2 (4th power and fast 4th root), and PQ to and from Linear +/// (8th power and fast 8th root). The maximum error is approximately 0.2%. +/// +/// @param a The value to convert between gamma2 and PQ. +/// +/// @returns +/// The value a converted into PQ. +/// +/// @ingroup GPUCore +FfxFloat32x2 ffxApproximateGamma2ToPQMedium(FfxFloat32x2 a) +{ + FfxFloat32x2 b = ffxAsFloat((ffxAsUInt32(a) >> ffxBroadcast2(2u)) + ffxBroadcast2(0x2F9A4E46u)); + FfxFloat32x2 b4 = b * b * b * b; + return b - b * (b4 - a) / (FfxFloat32(4.0) * b4); +} + +/// Compute a high accuracy approximate conversion from gamma2 to PQ space. +/// +/// PQ is very close to x^(1/8). The functions below Use the fast FfxFloat32 approximation method to do +/// PQ conversions to and from Gamma2 (4th power and fast 4th root), and PQ to and from Linear +/// (8th power and fast 8th root). The maximum error is approximately 0.2%. +/// +/// @param a The value to convert between gamma2 and PQ. +/// +/// @returns +/// The value a converted into PQ. +/// +/// @ingroup GPUCore +FfxFloat32x2 ffxApproximateGamma2ToPQHigh(FfxFloat32x2 a) +{ + return ffxSqrt(ffxSqrt(a)); +} + +/// Compute an approximate conversion from linear to PQ space. +/// +/// PQ is very close to x^(1/8). The functions below Use the fast FfxFloat32 approximation method to do +/// PQ conversions to and from Gamma2 (4th power and fast 4th root), and PQ to and from Linear +/// (8th power and fast 8th root). The maximum error is approximately 0.2%. +/// +/// @param a The value to convert between linear and PQ. +/// +/// @returns +/// The value a converted into PQ. +/// +/// @ingroup GPUCore +FfxFloat32x2 ffxApproximateLinearToPQ(FfxFloat32x2 a) +{ + return ffxAsFloat((ffxAsUInt32(a) >> ffxBroadcast2(3u)) + ffxBroadcast2(0x378D8723u)); +} + +/// Compute a more accurate approximate conversion from linear to PQ space. +/// +/// PQ is very close to x^(1/8). The functions below Use the fast FfxFloat32 approximation method to do +/// PQ conversions to and from Gamma2 (4th power and fast 4th root), and PQ to and from Linear +/// (8th power and fast 8th root). The maximum error is approximately 0.2%. +/// +/// @param a The value to convert between linear and PQ. +/// +/// @returns +/// The value a converted into PQ. +/// +/// @ingroup GPUCore +FfxFloat32x2 ffxApproximateLinearToPQMedium(FfxFloat32x2 a) +{ + FfxFloat32x2 b = ffxAsFloat((ffxAsUInt32(a) >> ffxBroadcast2(3u)) + ffxBroadcast2(0x378D8723u)); + FfxFloat32x2 b8 = b * b * b * b * b * b * b * b; + return b - b * (b8 - a) / (FfxFloat32(8.0) * b8); +} + +/// Compute a very accurate approximate conversion from linear to PQ space. +/// +/// PQ is very close to x^(1/8). The functions below Use the fast FfxFloat32 approximation method to do +/// PQ conversions to and from Gamma2 (4th power and fast 4th root), and PQ to and from Linear +/// (8th power and fast 8th root). The maximum error is approximately 0.2%. +/// +/// @param a The value to convert between linear and PQ. +/// +/// @returns +/// The value a converted into PQ. +/// +/// @ingroup GPUCore +FfxFloat32x2 ffxApproximateLinearToPQHigh(FfxFloat32x2 a) +{ + return ffxSqrt(ffxSqrt(ffxSqrt(a))); +} + +/// Compute an approximate conversion from PQ to Gamma2 space. +/// +/// PQ is very close to x^(1/8). The functions below Use the fast FfxFloat32 approximation method to do +/// PQ conversions to and from Gamma2 (4th power and fast 4th root), and PQ to and from Linear +/// (8th power and fast 8th root). The maximum error is approximately 0.2%. +/// +/// @param a The value to convert between PQ and Gamma2. +/// +/// @returns +/// The value a converted into Gamma2. +/// +/// @ingroup GPUCore +FfxFloat32x3 ffxApproximatePQToGamma2Medium(FfxFloat32x3 a) +{ + return a * a * a * a; +} + +/// Compute an approximate conversion from PQ to linear space. +/// +/// PQ is very close to x^(1/8). The functions below Use the fast FfxFloat32 approximation method to do +/// PQ conversions to and from Gamma2 (4th power and fast 4th root), and PQ to and from Linear +/// (8th power and fast 8th root). The maximum error is approximately 0.2%. +/// +/// @param a The value to convert between PQ and linear. +/// +/// @returns +/// The value a converted into linear. +/// +/// @ingroup GPUCore +FfxFloat32x3 ffxApproximatePQToLinear(FfxFloat32x3 a) +{ + return a * a * a * a * a * a * a * a; +} + +/// Compute an approximate conversion from gamma2 to PQ space. +/// +/// PQ is very close to x^(1/8). The functions below Use the fast FfxFloat32 approximation method to do +/// PQ conversions to and from Gamma2 (4th power and fast 4th root), and PQ to and from Linear +/// (8th power and fast 8th root). The maximum error is approximately 0.2%. +/// +/// @param a The value to convert between gamma2 and PQ. +/// +/// @returns +/// The value a converted into PQ. +/// +/// @ingroup GPUCore +FfxFloat32x3 ffxApproximateGamma2ToPQ(FfxFloat32x3 a) +{ + return ffxAsFloat((ffxAsUInt32(a) >> ffxBroadcast3(2u)) + ffxBroadcast3(0x2F9A4E46u)); +} + +/// Compute a more accurate approximate conversion from gamma2 to PQ space. +/// +/// PQ is very close to x^(1/8). The functions below Use the fast FfxFloat32 approximation method to do +/// PQ conversions to and from Gamma2 (4th power and fast 4th root), and PQ to and from Linear +/// (8th power and fast 8th root). The maximum error is approximately 0.2%. +/// +/// @param a The value to convert between gamma2 and PQ. +/// +/// @returns +/// The value a converted into PQ. +/// +/// @ingroup GPUCore +FfxFloat32x3 ffxApproximateGamma2ToPQMedium(FfxFloat32x3 a) +{ + FfxFloat32x3 b = ffxAsFloat((ffxAsUInt32(a) >> ffxBroadcast3(2u)) + ffxBroadcast3(0x2F9A4E46u)); + FfxFloat32x3 b4 = b * b * b * b; + return b - b * (b4 - a) / (FfxFloat32(4.0) * b4); +} + +/// Compute a high accuracy approximate conversion from gamma2 to PQ space. +/// +/// PQ is very close to x^(1/8). The functions below Use the fast FfxFloat32 approximation method to do +/// PQ conversions to and from Gamma2 (4th power and fast 4th root), and PQ to and from Linear +/// (8th power and fast 8th root). The maximum error is approximately 0.2%. +/// +/// @param a The value to convert between gamma2 and PQ. +/// +/// @returns +/// The value a converted into PQ. +/// +/// @ingroup GPUCore +FfxFloat32x3 ffxApproximateGamma2ToPQHigh(FfxFloat32x3 a) +{ + return ffxSqrt(ffxSqrt(a)); +} + +/// Compute an approximate conversion from linear to PQ space. +/// +/// PQ is very close to x^(1/8). The functions below Use the fast FfxFloat32 approximation method to do +/// PQ conversions to and from Gamma2 (4th power and fast 4th root), and PQ to and from Linear +/// (8th power and fast 8th root). The maximum error is approximately 0.2%. +/// +/// @param a The value to convert between linear and PQ. +/// +/// @returns +/// The value a converted into PQ. +/// +/// @ingroup GPUCore +FfxFloat32x3 ffxApproximateLinearToPQ(FfxFloat32x3 a) +{ + return ffxAsFloat((ffxAsUInt32(a) >> ffxBroadcast3(3u)) + ffxBroadcast3(0x378D8723u)); +} + +/// Compute a more accurate approximate conversion from linear to PQ space. +/// +/// PQ is very close to x^(1/8). The functions below Use the fast FfxFloat32 approximation method to do +/// PQ conversions to and from Gamma2 (4th power and fast 4th root), and PQ to and from Linear +/// (8th power and fast 8th root). The maximum error is approximately 0.2%. +/// +/// @param a The value to convert between linear and PQ. +/// +/// @returns +/// The value a converted into PQ. +/// +/// @ingroup GPUCore +FfxFloat32x3 ffxApproximateLinearToPQMedium(FfxFloat32x3 a) +{ + FfxFloat32x3 b = ffxAsFloat((ffxAsUInt32(a) >> ffxBroadcast3(3u)) + ffxBroadcast3(0x378D8723u)); + FfxFloat32x3 b8 = b * b * b * b * b * b * b * b; + return b - b * (b8 - a) / (FfxFloat32(8.0) * b8); +} + +/// Compute a very accurate approximate conversion from linear to PQ space. +/// +/// PQ is very close to x^(1/8). The functions below Use the fast FfxFloat32 approximation method to do +/// PQ conversions to and from Gamma2 (4th power and fast 4th root), and PQ to and from Linear +/// (8th power and fast 8th root). The maximum error is approximately 0.2%. +/// +/// @param a The value to convert between linear and PQ. +/// +/// @returns +/// The value a converted into PQ. +/// +/// @ingroup GPUCore +FfxFloat32x3 ffxApproximateLinearToPQHigh(FfxFloat32x3 a) +{ + return ffxSqrt(ffxSqrt(ffxSqrt(a))); +} + +/// Compute an approximate conversion from PQ to Gamma2 space. +/// +/// PQ is very close to x^(1/8). The functions below Use the fast FfxFloat32 approximation method to do +/// PQ conversions to and from Gamma2 (4th power and fast 4th root), and PQ to and from Linear +/// (8th power and fast 8th root). The maximum error is approximately 0.2%. +/// +/// @param a The value to convert between PQ and Gamma2. +/// +/// @returns +/// The value a converted into Gamma2. +/// +/// @ingroup GPUCore +FfxFloat32x4 ffxApproximatePQToGamma2Medium(FfxFloat32x4 a) +{ + return a * a * a * a; +} + +/// Compute an approximate conversion from PQ to linear space. +/// +/// PQ is very close to x^(1/8). The functions below Use the fast FfxFloat32 approximation method to do +/// PQ conversions to and from Gamma2 (4th power and fast 4th root), and PQ to and from Linear +/// (8th power and fast 8th root). The maximum error is approximately 0.2%. +/// +/// @param a The value to convert between PQ and linear. +/// +/// @returns +/// The value a converted into linear. +/// +/// @ingroup GPUCore +FfxFloat32x4 ffxApproximatePQToLinear(FfxFloat32x4 a) +{ + return a * a * a * a * a * a * a * a; +} + +/// Compute an approximate conversion from gamma2 to PQ space. +/// +/// PQ is very close to x^(1/8). The functions below Use the fast FfxFloat32 approximation method to do +/// PQ conversions to and from Gamma2 (4th power and fast 4th root), and PQ to and from Linear +/// (8th power and fast 8th root). The maximum error is approximately 0.2%. +/// +/// @param a The value to convert between gamma2 and PQ. +/// +/// @returns +/// The value a converted into PQ. +/// +/// @ingroup GPUCore +FfxFloat32x4 ffxApproximateGamma2ToPQ(FfxFloat32x4 a) +{ + return ffxAsFloat((ffxAsUInt32(a) >> ffxBroadcast4(2u)) + ffxBroadcast4(0x2F9A4E46u)); +} + +/// Compute a more accurate approximate conversion from gamma2 to PQ space. +/// +/// PQ is very close to x^(1/8). The functions below Use the fast FfxFloat32 approximation method to do +/// PQ conversions to and from Gamma2 (4th power and fast 4th root), and PQ to and from Linear +/// (8th power and fast 8th root). The maximum error is approximately 0.2%. +/// +/// @param a The value to convert between gamma2 and PQ. +/// +/// @returns +/// The value a converted into PQ. +/// +/// @ingroup GPUCore +FfxFloat32x4 ffxApproximateGamma2ToPQMedium(FfxFloat32x4 a) +{ + FfxFloat32x4 b = ffxAsFloat((ffxAsUInt32(a) >> ffxBroadcast4(2u)) + ffxBroadcast4(0x2F9A4E46u)); + FfxFloat32x4 b4 = b * b * b * b * b * b * b * b; + return b - b * (b4 - a) / (FfxFloat32(4.0) * b4); +} + +/// Compute a high accuracy approximate conversion from gamma2 to PQ space. +/// +/// PQ is very close to x^(1/8). The functions below Use the fast FfxFloat32 approximation method to do +/// PQ conversions to and from Gamma2 (4th power and fast 4th root), and PQ to and from Linear +/// (8th power and fast 8th root). The maximum error is approximately 0.2%. +/// +/// @param a The value to convert between gamma2 and PQ. +/// +/// @returns +/// The value a converted into PQ. +/// +/// @ingroup GPUCore +FfxFloat32x4 ffxApproximateGamma2ToPQHigh(FfxFloat32x4 a) +{ + return ffxSqrt(ffxSqrt(a)); +} + +/// Compute an approximate conversion from linear to PQ space. +/// +/// PQ is very close to x^(1/8). The functions below Use the fast FfxFloat32 approximation method to do +/// PQ conversions to and from Gamma2 (4th power and fast 4th root), and PQ to and from Linear +/// (8th power and fast 8th root). The maximum error is approximately 0.2%. +/// +/// @param a The value to convert between linear and PQ. +/// +/// @returns +/// The value a converted into PQ. +/// +/// @ingroup GPUCore +FfxFloat32x4 ffxApproximateLinearToPQ(FfxFloat32x4 a) +{ + return ffxAsFloat((ffxAsUInt32(a) >> ffxBroadcast4(3u)) + ffxBroadcast4(0x378D8723u)); +} + +/// Compute a more accurate approximate conversion from linear to PQ space. +/// +/// PQ is very close to x^(1/8). The functions below Use the fast FfxFloat32 approximation method to do +/// PQ conversions to and from Gamma2 (4th power and fast 4th root), and PQ to and from Linear +/// (8th power and fast 8th root). The maximum error is approximately 0.2%. +/// +/// @param a The value to convert between linear and PQ. +/// +/// @returns +/// The value a converted into PQ. +/// +/// @ingroup GPUCore +FfxFloat32x4 ffxApproximateLinearToPQMedium(FfxFloat32x4 a) +{ + FfxFloat32x4 b = ffxAsFloat((ffxAsUInt32(a) >> ffxBroadcast4(3u)) + ffxBroadcast4(0x378D8723u)); + FfxFloat32x4 b8 = b * b * b * b * b * b * b * b; + return b - b * (b8 - a) / (FfxFloat32(8.0) * b8); +} + +/// Compute a very accurate approximate conversion from linear to PQ space. +/// +/// PQ is very close to x^(1/8). The functions below Use the fast FfxFloat32 approximation method to do +/// PQ conversions to and from Gamma2 (4th power and fast 4th root), and PQ to and from Linear +/// (8th power and fast 8th root). The maximum error is approximately 0.2%. +/// +/// @param a The value to convert between linear and PQ. +/// +/// @returns +/// The value a converted into PQ. +/// +/// @ingroup GPUCore +FfxFloat32x4 ffxApproximateLinearToPQHigh(FfxFloat32x4 a) +{ + return ffxSqrt(ffxSqrt(ffxSqrt(a))); +} + +// An approximation of sine. +// +// Valid input range is {-1 to 1} representing {0 to 2 pi}, and the output range +// is {-1/4 to 1/4} representing {-1 to 1}. +// +// @param [in] value The value to calculate approximate sine for. +// +// @returns +// The approximate sine of value. +FfxFloat32 ffxParabolicSin(FfxFloat32 value) +{ + return value * abs(value) - value; +} + +// An approximation of sine. +// +// Valid input range is {-1 to 1} representing {0 to 2 pi}, and the output range +// is {-1/4 to 1/4} representing {-1 to 1}. +// +// @param [in] value The value to calculate approximate sine for. +// +// @returns +// The approximate sine of value. +FfxFloat32x2 ffxParabolicSin(FfxFloat32x2 x) +{ + return x * abs(x) - x; +} + +// An approximation of cosine. +// +// Valid input range is {-1 to 1} representing {0 to 2 pi}, and the output range +// is {-1/4 to 1/4} representing {-1 to 1}. +// +// @param [in] value The value to calculate approximate cosine for. +// +// @returns +// The approximate cosine of value. +FfxFloat32 ffxParabolicCos(FfxFloat32 x) +{ + x = ffxFract(x * FfxFloat32(0.5) + FfxFloat32(0.75)); + x = x * FfxFloat32(2.0) - FfxFloat32(1.0); + return ffxParabolicSin(x); +} + +// An approximation of cosine. +// +// Valid input range is {-1 to 1} representing {0 to 2 pi}, and the output range +// is {-1/4 to 1/4} representing {-1 to 1}. +// +// @param [in] value The value to calculate approximate cosine for. +// +// @returns +// The approximate cosine of value. +FfxFloat32x2 ffxParabolicCos(FfxFloat32x2 x) +{ + x = ffxFract(x * ffxBroadcast2(0.5f) + ffxBroadcast2(0.75f)); + x = x * ffxBroadcast2(2.0f) - ffxBroadcast2(1.0f); + return ffxParabolicSin(x); +} + +// An approximation of both sine and cosine. +// +// Valid input range is {-1 to 1} representing {0 to 2 pi}, and the output range +// is {-1/4 to 1/4} representing {-1 to 1}. +// +// @param [in] value The value to calculate approximate cosine for. +// +// @returns +// A FfxFloat32x2 containing approximations of both sine and cosine of value. +FfxFloat32x2 ffxParabolicSinCos(FfxFloat32 x) +{ + FfxFloat32 y = ffxFract(x * FfxFloat32(0.5) + FfxFloat32(0.75)); + y = y * FfxFloat32(2.0) - FfxFloat32(1.0); + return ffxParabolicSin(FfxFloat32x2(x, y)); +} + +/// Conditional free logic AND operation using values. +/// +/// @param [in] x The first value to be fed into the AND operator. +/// @param [in] y The second value to be fed into the AND operator. +/// +/// @returns +/// Result of the AND operation. +/// +/// @ingroup GPUCore +FfxUInt32 ffxZeroOneAnd(FfxUInt32 x, FfxUInt32 y) +{ + return min(x, y); +} + +/// Conditional free logic AND operation using two values. +/// +/// @param [in] x The first value to be fed into the AND operator. +/// @param [in] y The second value to be fed into the AND operator. +/// +/// @returns +/// Result of the AND operation. +/// +/// @ingroup GPUCore +FfxUInt32x2 ffxZeroOneAnd(FfxUInt32x2 x, FfxUInt32x2 y) +{ + return min(x, y); +} + +/// Conditional free logic AND operation using two values. +/// +/// @param [in] x The first value to be fed into the AND operator. +/// @param [in] y The second value to be fed into the AND operator. +/// +/// @returns +/// Result of the AND operation. +/// +/// @ingroup GPUCore +FfxUInt32x3 ffxZeroOneAnd(FfxUInt32x3 x, FfxUInt32x3 y) +{ + return min(x, y); +} + +/// Conditional free logic AND operation using two values. +/// +/// @param [in] x The first value to be fed into the AND operator. +/// @param [in] y The second value to be fed into the AND operator. +/// +/// @returns +/// Result of the AND operation. +/// +/// @ingroup GPUCore +FfxUInt32x4 ffxZeroOneAnd(FfxUInt32x4 x, FfxUInt32x4 y) +{ + return min(x, y); +} + +/// Conditional free logic NOT operation using two values. +/// +/// @param [in] x The first value to be fed into the NOT operator. +/// +/// @returns +/// Result of the NOT operation. +/// +/// @ingroup GPUCore +FfxUInt32 ffxZeroOneAnd(FfxUInt32 x) +{ + return x ^ FfxUInt32(1); +} + +/// Conditional free logic NOT operation using two values. +/// +/// @param [in] x The first value to be fed into the NOT operator. +/// +/// @returns +/// Result of the NOT operation. +/// +/// @ingroup GPUCore +FfxUInt32x2 ffxZeroOneAnd(FfxUInt32x2 x) +{ + return x ^ ffxBroadcast2(1u); +} + +/// Conditional free logic NOT operation using two values. +/// +/// @param [in] x The first value to be fed into the NOT operator. +/// +/// @returns +/// Result of the NOT operation. +/// +/// @ingroup GPUCore +FfxUInt32x3 ffxZeroOneAnd(FfxUInt32x3 x) +{ + return x ^ ffxBroadcast3(1u); +} + +/// Conditional free logic NOT operation using two values. +/// +/// @param [in] x The first value to be fed into the NOT operator. +/// +/// @returns +/// Result of the NOT operation. +/// +/// @ingroup GPUCore +FfxUInt32x4 ffxZeroOneAnd(FfxUInt32x4 x) +{ + return x ^ ffxBroadcast4(1u); +} + +/// Conditional free logic OR operation using two values. +/// +/// @param [in] x The first value to be fed into the OR operator. +/// @param [in] y The second value to be fed into the OR operator. +/// +/// @returns +/// Result of the OR operation. +/// +/// @ingroup GPUCore +FfxUInt32 ffxZeroOneOr(FfxUInt32 x, FfxUInt32 y) +{ + return max(x, y); +} + +/// Conditional free logic OR operation using two values. +/// +/// @param [in] x The first value to be fed into the OR operator. +/// @param [in] y The second value to be fed into the OR operator. +/// +/// @returns +/// Result of the OR operation. +/// +/// @ingroup GPUCore +FfxUInt32x2 ffxZeroOneOr(FfxUInt32x2 x, FfxUInt32x2 y) +{ + return max(x, y); +} + +/// Conditional free logic OR operation using two values. +/// +/// @param [in] x The first value to be fed into the OR operator. +/// @param [in] y The second value to be fed into the OR operator. +/// +/// @returns +/// Result of the OR operation. +/// +/// @ingroup GPUCore +FfxUInt32x3 ffxZeroOneOr(FfxUInt32x3 x, FfxUInt32x3 y) +{ + return max(x, y); +} + +/// Conditional free logic OR operation using two values. +/// +/// @param [in] x The first value to be fed into the OR operator. +/// @param [in] y The second value to be fed into the OR operator. +/// +/// @returns +/// Result of the OR operation. +/// +/// @ingroup GPUCore +FfxUInt32x4 ffxZeroOneOr(FfxUInt32x4 x, FfxUInt32x4 y) +{ + return max(x, y); +} + +/// Conditional free logic signed NOT operation using two half-precision FfxFloat32 values. +/// +/// @param [in] x The first value to be fed into the AND OR operator. +/// +/// @returns +/// Result of the AND OR operation. +/// +/// @ingroup GPUCore +FfxUInt32 ffxZeroOneAndToU1(FfxFloat32 x) +{ + return FfxUInt32(FfxFloat32(1.0) - x); +} + +/// Conditional free logic signed NOT operation using two half-precision FfxFloat32 values. +/// +/// @param [in] x The first value to be fed into the AND OR operator. +/// +/// @returns +/// Result of the AND OR operation. +/// +/// @ingroup GPUCore +FfxUInt32x2 ffxZeroOneAndToU2(FfxFloat32x2 x) +{ + return FfxUInt32x2(ffxBroadcast2(1.0) - x); +} + +/// Conditional free logic signed NOT operation using two half-precision FfxFloat32 values. +/// +/// @param [in] x The first value to be fed into the AND OR operator. +/// +/// @returns +/// Result of the AND OR operation. +/// +/// @ingroup GPUCore +FfxUInt32x3 ffxZeroOneAndToU3(FfxFloat32x3 x) +{ + return FfxUInt32x3(ffxBroadcast3(1.0) - x); +} + +/// Conditional free logic signed NOT operation using two half-precision FfxFloat32 values. +/// +/// @param [in] x The first value to be fed into the AND OR operator. +/// +/// @returns +/// Result of the AND OR operation. +/// +/// @ingroup GPUCore +FfxUInt32x4 ffxZeroOneAndToU4(FfxFloat32x4 x) +{ + return FfxUInt32x4(ffxBroadcast4(1.0) - x); +} + +/// Conditional free logic AND operation using two values followed by a NOT operation +/// using the resulting value and a third value. +/// +/// @param [in] x The first value to be fed into the AND operator. +/// @param [in] y The second value to be fed into the AND operator. +/// @param [in] z The second value to be fed into the OR operator. +/// +/// @returns +/// Result of the AND OR operation. +/// +/// @ingroup GPUCore +FfxFloat32 ffxZeroOneAndOr(FfxFloat32 x, FfxFloat32 y, FfxFloat32 z) +{ + return ffxSaturate(x * y + z); +} + +/// Conditional free logic AND operation using two values followed by a NOT operation +/// using the resulting value and a third value. +/// +/// @param [in] x The first value to be fed into the AND operator. +/// @param [in] y The second value to be fed into the AND operator. +/// @param [in] z The second value to be fed into the OR operator. +/// +/// @returns +/// Result of the AND OR operation. +/// +/// @ingroup GPUCore +FfxFloat32x2 ffxZeroOneAndOr(FfxFloat32x2 x, FfxFloat32x2 y, FfxFloat32x2 z) +{ + return ffxSaturate(x * y + z); +} + +/// Conditional free logic AND operation using two values followed by a NOT operation +/// using the resulting value and a third value. +/// +/// @param [in] x The first value to be fed into the AND operator. +/// @param [in] y The second value to be fed into the AND operator. +/// @param [in] z The second value to be fed into the OR operator. +/// +/// @returns +/// Result of the AND OR operation. +/// +/// @ingroup GPUCore +FfxFloat32x3 ffxZeroOneAndOr(FfxFloat32x3 x, FfxFloat32x3 y, FfxFloat32x3 z) +{ + return ffxSaturate(x * y + z); +} + +/// Conditional free logic AND operation using two values followed by a NOT operation +/// using the resulting value and a third value. +/// +/// @param [in] x The first value to be fed into the AND operator. +/// @param [in] y The second value to be fed into the AND operator. +/// @param [in] z The second value to be fed into the OR operator. +/// +/// @returns +/// Result of the AND OR operation. +/// +/// @ingroup GPUCore +FfxFloat32x4 ffxZeroOneAndOr(FfxFloat32x4 x, FfxFloat32x4 y, FfxFloat32x4 z) +{ + return ffxSaturate(x * y + z); +} + +/// Given a value, returns 1.0 if greater than zero and 0.0 if not. +/// +/// @param [in] x The value to be compared. +/// +/// @returns +/// Result of the greater than zero comparison. +/// +/// @ingroup GPUCore +FfxFloat32 ffxZeroOneIsGreaterThanZero(FfxFloat32 x) +{ + return ffxSaturate(x * FfxFloat32(FFX_POSITIVE_INFINITY_FLOAT)); +} + +/// Given a value, returns 1.0 if greater than zero and 0.0 if not. +/// +/// @param [in] x The value to be compared. +/// +/// @returns +/// Result of the greater than zero comparison. +/// +/// @ingroup GPUCore +FfxFloat32x2 ffxZeroOneIsGreaterThanZero(FfxFloat32x2 x) +{ + return ffxSaturate(x * ffxBroadcast2(FFX_POSITIVE_INFINITY_FLOAT)); +} + +/// Given a value, returns 1.0 if greater than zero and 0.0 if not. +/// +/// @param [in] x The value to be compared. +/// +/// @returns +/// Result of the greater than zero comparison. +/// +/// @ingroup GPUCore +FfxFloat32x3 ffxZeroOneIsGreaterThanZero(FfxFloat32x3 x) +{ + return ffxSaturate(x * ffxBroadcast3(FFX_POSITIVE_INFINITY_FLOAT)); +} + +/// Given a value, returns 1.0 if greater than zero and 0.0 if not. +/// +/// @param [in] x The value to be compared. +/// +/// @returns +/// Result of the greater than zero comparison. +/// +/// @ingroup GPUCore +FfxFloat32x4 ffxZeroOneIsGreaterThanZero(FfxFloat32x4 x) +{ + return ffxSaturate(x * ffxBroadcast4(FFX_POSITIVE_INFINITY_FLOAT)); +} + +/// Conditional free logic signed NOT operation using two FfxFloat32 values. +/// +/// @param [in] x The first value to be fed into the AND OR operator. +/// +/// @returns +/// Result of the AND OR operation. +/// +/// @ingroup GPUCore +FfxFloat32 ffxZeroOneAnd(FfxFloat32 x) +{ + return FfxFloat32(1.0) - x; +} + +/// Conditional free logic signed NOT operation using two FfxFloat32 values. +/// +/// @param [in] x The first value to be fed into the AND OR operator. +/// +/// @returns +/// Result of the AND OR operation. +/// +/// @ingroup GPUCore +FfxFloat32x2 ffxZeroOneAnd(FfxFloat32x2 x) +{ + return ffxBroadcast2(1.0) - x; +} + +/// Conditional free logic signed NOT operation using two FfxFloat32 values. +/// +/// @param [in] x The first value to be fed into the AND OR operator. +/// +/// @returns +/// Result of the AND OR operation. +/// +/// @ingroup GPUCore +FfxFloat32x3 ffxZeroOneAnd(FfxFloat32x3 x) +{ + return ffxBroadcast3(1.0) - x; +} + +/// Conditional free logic signed NOT operation using two FfxFloat32 values. +/// +/// @param [in] x The first value to be fed into the AND OR operator. +/// +/// @returns +/// Result of the AND OR operation. +/// +/// @ingroup GPUCore +FfxFloat32x4 ffxZeroOneAnd(FfxFloat32x4 x) +{ + return ffxBroadcast4(1.0) - x; +} + +/// Conditional free logic OR operation using two FfxFloat32 values. +/// +/// @param [in] x The first value to be fed into the OR operator. +/// @param [in] y The second value to be fed into the OR operator. +/// +/// @returns +/// Result of the OR operation. +/// +/// @ingroup GPUCore +FfxFloat32 ffxZeroOneOr(FfxFloat32 x, FfxFloat32 y) +{ + return max(x, y); +} + +/// Conditional free logic OR operation using two FfxFloat32 values. +/// +/// @param [in] x The first value to be fed into the OR operator. +/// @param [in] y The second value to be fed into the OR operator. +/// +/// @returns +/// Result of the OR operation. +/// +/// @ingroup GPUCore +FfxFloat32x2 ffxZeroOneOr(FfxFloat32x2 x, FfxFloat32x2 y) +{ + return max(x, y); +} + +/// Conditional free logic OR operation using two FfxFloat32 values. +/// +/// @param [in] x The first value to be fed into the OR operator. +/// @param [in] y The second value to be fed into the OR operator. +/// +/// @returns +/// Result of the OR operation. +/// +/// @ingroup GPUCore +FfxFloat32x3 ffxZeroOneOr(FfxFloat32x3 x, FfxFloat32x3 y) +{ + return max(x, y); +} + +/// Conditional free logic OR operation using two FfxFloat32 values. +/// +/// @param [in] x The first value to be fed into the OR operator. +/// @param [in] y The second value to be fed into the OR operator. +/// +/// @returns +/// Result of the OR operation. +/// +/// @ingroup GPUCore +FfxFloat32x4 ffxZeroOneOr(FfxFloat32x4 x, FfxFloat32x4 y) +{ + return max(x, y); +} + +/// Choose between two FfxFloat32 values if the first paramter is greater than zero. +/// +/// @param [in] x The value to compare against zero. +/// @param [in] y The value to return if the comparision is greater than zero. +/// @param [in] z The value to return if the comparision is less than or equal to zero. +/// +/// @returns +/// The selected value. +/// +/// @ingroup GPUCore +FfxFloat32 ffxZeroOneSelect(FfxFloat32 x, FfxFloat32 y, FfxFloat32 z) +{ + FfxFloat32 r = (-x) * z + z; + return x * y + r; +} + +/// Choose between two FfxFloat32 values if the first paramter is greater than zero. +/// +/// @param [in] x The value to compare against zero. +/// @param [in] y The value to return if the comparision is greater than zero. +/// @param [in] z The value to return if the comparision is less than or equal to zero. +/// +/// @returns +/// The selected value. +/// +/// @ingroup GPUCore +FfxFloat32x2 ffxZeroOneSelect(FfxFloat32x2 x, FfxFloat32x2 y, FfxFloat32x2 z) +{ + FfxFloat32x2 r = (-x) * z + z; + return x * y + r; +} + +/// Choose between two FfxFloat32 values if the first paramter is greater than zero. +/// +/// @param [in] x The value to compare against zero. +/// @param [in] y The value to return if the comparision is greater than zero. +/// @param [in] z The value to return if the comparision is less than or equal to zero. +/// +/// @returns +/// The selected value. +/// +/// @ingroup GPUCore +FfxFloat32x3 ffxZeroOneSelect(FfxFloat32x3 x, FfxFloat32x3 y, FfxFloat32x3 z) +{ + FfxFloat32x3 r = (-x) * z + z; + return x * y + r; +} + +/// Choose between two FfxFloat32 values if the first paramter is greater than zero. +/// +/// @param [in] x The value to compare against zero. +/// @param [in] y The value to return if the comparision is greater than zero. +/// @param [in] z The value to return if the comparision is less than or equal to zero. +/// +/// @returns +/// The selected value. +/// +/// @ingroup GPUCore +FfxFloat32x4 ffxZeroOneSelect(FfxFloat32x4 x, FfxFloat32x4 y, FfxFloat32x4 z) +{ + FfxFloat32x4 r = (-x) * z + z; + return x * y + r; +} + +/// Given a value, returns 1.0 if less than zero and 0.0 if not. +/// +/// @param [in] x The value to be compared. +/// +/// @returns +/// Result of the sign value. +/// +/// @ingroup GPUCore +FfxFloat32 ffxZeroOneIsSigned(FfxFloat32 x) +{ + return ffxSaturate(x * FfxFloat32(FFX_NEGATIVE_INFINITY_FLOAT)); +} + +/// Given a value, returns 1.0 if less than zero and 0.0 if not. +/// +/// @param [in] x The value to be compared. +/// +/// @returns +/// Result of the sign value. +/// +/// @ingroup GPUCore +FfxFloat32x2 ffxZeroOneIsSigned(FfxFloat32x2 x) +{ + return ffxSaturate(x * ffxBroadcast2(FFX_NEGATIVE_INFINITY_FLOAT)); +} + +/// Given a value, returns 1.0 if less than zero and 0.0 if not. +/// +/// @param [in] x The value to be compared. +/// +/// @returns +/// Result of the sign value. +/// +/// @ingroup GPUCore +FfxFloat32x3 ffxZeroOneIsSigned(FfxFloat32x3 x) +{ + return ffxSaturate(x * ffxBroadcast3(FFX_NEGATIVE_INFINITY_FLOAT)); +} + +/// Given a value, returns 1.0 if less than zero and 0.0 if not. +/// +/// @param [in] x The value to be compared. +/// +/// @returns +/// Result of the sign value. +/// +/// @ingroup GPUCore +FfxFloat32x4 ffxZeroOneIsSigned(FfxFloat32x4 x) +{ + return ffxSaturate(x * ffxBroadcast4(FFX_NEGATIVE_INFINITY_FLOAT)); +} + +/// Compute a Rec.709 color space. +/// +/// Rec.709 is used for some HDTVs. +/// +/// Both Rec.709 and sRGB have a linear segment which as spec'ed would intersect the curved segment 2 times. +/// (a.) For 8-bit sRGB, steps {0 to 10.3} are in the linear region (4% of the encoding range). +/// (b.) For 8-bit 709, steps {0 to 20.7} are in the linear region (8% of the encoding range). +/// +/// @param [in] color The color to convert to Rec. 709. +/// +/// @returns +/// The color in linear space. +/// +/// @ingroup GPUCore +FfxFloat32 ffxRec709FromLinear(FfxFloat32 color) +{ + FfxFloat32x3 j = FfxFloat32x3(0.018 * 4.5, 4.5, 0.45); + FfxFloat32x2 k = FfxFloat32x2(1.099, -0.099); + return clamp(j.x, color * j.y, pow(color, j.z) * k.x + k.y); +} + +/// Compute a Rec.709 color space. +/// +/// Rec.709 is used for some HDTVs. +/// +/// Both Rec.709 and sRGB have a linear segment which as spec'ed would intersect the curved segment 2 times. +/// (a.) For 8-bit sRGB, steps {0 to 10.3} are in the linear region (4% of the encoding range). +/// (b.) For 8-bit 709, steps {0 to 20.7} are in the linear region (8% of the encoding range). +/// +/// @param [in] color The color to convert to Rec. 709. +/// +/// @returns +/// The color in linear space. +/// +/// @ingroup GPUCore +FfxFloat32x2 ffxRec709FromLinear(FfxFloat32x2 color) +{ + FfxFloat32x3 j = FfxFloat32x3(0.018 * 4.5, 4.5, 0.45); + FfxFloat32x2 k = FfxFloat32x2(1.099, -0.099); + return clamp(j.xx, color * j.yy, pow(color, j.zz) * k.xx + k.yy); +} + +/// Compute a Rec.709 color space. +/// +/// Rec.709 is used for some HDTVs. +/// +/// Both Rec.709 and sRGB have a linear segment which as spec'ed would intersect the curved segment 2 times. +/// (a.) For 8-bit sRGB, steps {0 to 10.3} are in the linear region (4% of the encoding range). +/// (b.) For 8-bit 709, steps {0 to 20.7} are in the linear region (8% of the encoding range). +/// +/// @param [in] color The color to convert to Rec. 709. +/// +/// @returns +/// The color in linear space. +/// +/// @ingroup GPUCore +FfxFloat32x3 ffxRec709FromLinear(FfxFloat32x3 color) +{ + FfxFloat32x3 j = FfxFloat32x3(0.018 * 4.5, 4.5, 0.45); + FfxFloat32x2 k = FfxFloat32x2(1.099, -0.099); + return clamp(j.xxx, color * j.yyy, pow(color, j.zzz) * k.xxx + k.yyy); +} + +/// Compute a linear value from a REC.709 value. +/// +/// @param [in] color The value to convert to linear from REC.709. +/// +/// @returns +/// A value in linear space. +/// +/// @ingroup GPUCore +FfxFloat32 ffxLinearFromRec709(FfxFloat32 color) +{ + FfxFloat32x3 j = FfxFloat32x3(0.081 / 4.5, 1.0 / 4.5, 1.0 / 0.45); + FfxFloat32x2 k = FfxFloat32x2(1.0 / 1.099, 0.099 / 1.099); + return ffxZeroOneSelect(ffxZeroOneIsSigned(color - j.x), color * j.y, pow(color * k.x + k.y, j.z)); +} + +/// Compute a linear value from a REC.709 value. +/// +/// @param [in] color The value to convert to linear from REC.709. +/// +/// @returns +/// A value in linear space. +/// +/// @ingroup GPUCore +FfxFloat32x2 ffxLinearFromRec709(FfxFloat32x2 color) +{ + FfxFloat32x3 j = FfxFloat32x3(0.081 / 4.5, 1.0 / 4.5, 1.0 / 0.45); + FfxFloat32x2 k = FfxFloat32x2(1.0 / 1.099, 0.099 / 1.099); + return ffxZeroOneSelect(ffxZeroOneIsSigned(color - j.xx), color * j.yy, pow(color * k.xx + k.yy, j.zz)); +} + +/// Compute a linear value from a REC.709 value. +/// +/// @param [in] color The value to convert to linear from REC.709. +/// +/// @returns +/// A value in linear space. +/// +/// @ingroup GPUCore +FfxFloat32x3 ffxLinearFromRec709(FfxFloat32x3 color) +{ + FfxFloat32x3 j = FfxFloat32x3(0.081 / 4.5, 1.0 / 4.5, 1.0 / 0.45); + FfxFloat32x2 k = FfxFloat32x2(1.0 / 1.099, 0.099 / 1.099); + return ffxZeroOneSelect(ffxZeroOneIsSigned(color - j.xxx), color * j.yyy, pow(color * k.xxx + k.yyy, j.zzz)); +} + +/// Compute a gamma value from a linear value. +/// +/// Typically 2.2 for some PC displays, or 2.4-2.5 for CRTs, or 2.2 FreeSync2 native. +/// +/// Note: 'rcpX' is '1/x', where the 'x' is what would be used in ffxLinearFromGamma. +/// +/// @param [in] value The value to convert to gamma space from linear. +/// @param [in] power The reciprocal of power value used for the gamma curve. +/// +/// @returns +/// A value in gamma space. +/// +/// @ingroup GPUCore +FfxFloat32 ffxGammaFromLinear(FfxFloat32 value, FfxFloat32 power) +{ + return pow(value, FfxFloat32(power)); +} + +/// Compute a gamma value from a linear value. +/// +/// Typically 2.2 for some PC displays, or 2.4-2.5 for CRTs, or 2.2 FreeSync2 native. +/// +/// Note: 'rcpX' is '1/x', where the 'x' is what would be used in ffxLinearFromGamma. +/// +/// @param [in] value The value to convert to gamma space from linear. +/// @param [in] power The reciprocal of power value used for the gamma curve. +/// +/// @returns +/// A value in gamma space. +/// +/// @ingroup GPUCore +FfxFloat32x2 ffxGammaFromLinear(FfxFloat32x2 value, FfxFloat32 power) +{ + return pow(value, ffxBroadcast2(power)); +} + +/// Compute a gamma value from a linear value. +/// +/// Typically 2.2 for some PC displays, or 2.4-2.5 for CRTs, or 2.2 FreeSync2 native. +/// +/// Note: 'rcpX' is '1/x', where the 'x' is what would be used in ffxLinearFromGamma. +/// +/// @param [in] value The value to convert to gamma space from linear. +/// @param [in] power The reciprocal of power value used for the gamma curve. +/// +/// @returns +/// A value in gamma space. +/// +/// @ingroup GPUCore +FfxFloat32x3 ffxGammaFromLinear(FfxFloat32x3 value, FfxFloat32 power) +{ + return pow(value, ffxBroadcast3(power)); +} + +/// Compute a linear value from a value in a gamma space. +/// +/// Typically 2.2 for some PC displays, or 2.4-2.5 for CRTs, or 2.2 FreeSync2 native. +/// +/// @param [in] color The value to convert to linear in gamma space. +/// @param [in] power The power value used for the gamma curve. +/// +/// @returns +/// A value in linear space. +/// +/// @ingroup GPUCore +FfxFloat32 ffxLinearFromGamma(FfxFloat32 color, FfxFloat32 power) +{ + return pow(color, FfxFloat32(power)); +} + +/// Compute a linear value from a value in a gamma space. +/// +/// Typically 2.2 for some PC displays, or 2.4-2.5 for CRTs, or 2.2 FreeSync2 native. +/// +/// @param [in] color The value to convert to linear in gamma space. +/// @param [in] power The power value used for the gamma curve. +/// +/// @returns +/// A value in linear space. +/// +/// @ingroup GPUCore +FfxFloat32x2 ffxLinearFromGamma(FfxFloat32x2 color, FfxFloat32 power) +{ + return pow(color, ffxBroadcast2(power)); +} + +/// Compute a linear value from a value in a gamma space. +/// +/// Typically 2.2 for some PC displays, or 2.4-2.5 for CRTs, or 2.2 FreeSync2 native. +/// +/// @param [in] color The value to convert to linear in gamma space. +/// @param [in] power The power value used for the gamma curve. +/// +/// @returns +/// A value in linear space. +/// +/// @ingroup GPUCore +FfxFloat32x3 ffxLinearFromGamma(FfxFloat32x3 color, FfxFloat32 power) +{ + return pow(color, ffxBroadcast3(power)); +} + +/// Compute a PQ value from a linear value. +/// +/// @param [in] value The value to convert to PQ from linear. +/// +/// @returns +/// A value in linear space. +/// +/// @ingroup GPUCore +FfxFloat32 ffxPQFromLinear(FfxFloat32 value) +{ + FfxFloat32 p = pow(value, FfxFloat32(0.159302)); + return pow((FfxFloat32(0.835938) + FfxFloat32(18.8516) * p) / (FfxFloat32(1.0) + FfxFloat32(18.6875) * p), FfxFloat32(78.8438)); +} + +/// Compute a PQ value from a linear value. +/// +/// @param [in] value The value to convert to PQ from linear. +/// +/// @returns +/// A value in linear space. +/// +/// @ingroup GPUCore +FfxFloat32x2 ffxPQFromLinear(FfxFloat32x2 value) +{ + FfxFloat32x2 p = pow(value, ffxBroadcast2(0.159302)); + return pow((ffxBroadcast2(0.835938) + ffxBroadcast2(18.8516) * p) / (ffxBroadcast2(1.0) + ffxBroadcast2(18.6875) * p), ffxBroadcast2(78.8438)); +} + +/// Compute a PQ value from a linear value. +/// +/// @param [in] value The value to convert to PQ from linear. +/// +/// @returns +/// A value in linear space. +/// +/// @ingroup GPUCore +FfxFloat32x3 ffxPQFromLinear(FfxFloat32x3 value) +{ + FfxFloat32x3 p = pow(value, ffxBroadcast3(0.159302)); + return pow((ffxBroadcast3(0.835938) + ffxBroadcast3(18.8516) * p) / (ffxBroadcast3(1.0) + ffxBroadcast3(18.6875) * p), ffxBroadcast3(78.8438)); +} + +/// Compute a linear value from a value in a PQ space. +/// +/// Typically 2.2 for some PC displays, or 2.4-2.5 for CRTs, or 2.2 FreeSync2 native. +/// +/// @param [in] value The value to convert to linear in PQ space. +/// +/// @returns +/// A value in linear space. +/// +/// @ingroup GPUCore +FfxFloat32 ffxLinearFromPQ(FfxFloat32 value) +{ + FfxFloat32 p = pow(value, FfxFloat32(0.0126833)); + return pow(ffxSaturate(p - FfxFloat32(0.835938)) / (FfxFloat32(18.8516) - FfxFloat32(18.6875) * p), FfxFloat32(6.27739)); +} + +/// Compute a linear value from a value in a PQ space. +/// +/// Typically 2.2 for some PC displays, or 2.4-2.5 for CRTs, or 2.2 FreeSync2 native. +/// +/// @param [in] value The value to convert to linear in PQ space. +/// +/// @returns +/// A value in linear space. +/// +/// @ingroup GPUCore +FfxFloat32x2 ffxLinearFromPQ(FfxFloat32x2 value) +{ + FfxFloat32x2 p = pow(value, ffxBroadcast2(0.0126833)); + return pow(ffxSaturate(p - ffxBroadcast2(0.835938)) / (ffxBroadcast2(18.8516) - ffxBroadcast2(18.6875) * p), ffxBroadcast2(6.27739)); +} + +/// Compute a linear value from a value in a PQ space. +/// +/// Typically 2.2 for some PC displays, or 2.4-2.5 for CRTs, or 2.2 FreeSync2 native. +/// +/// @param [in] value The value to convert to linear in PQ space. +/// +/// @returns +/// A value in linear space. +/// +/// @ingroup GPUCore +FfxFloat32x3 ffxLinearFromPQ(FfxFloat32x3 value) +{ + FfxFloat32x3 p = pow(value, ffxBroadcast3(0.0126833)); + return pow(ffxSaturate(p - ffxBroadcast3(0.835938)) / (ffxBroadcast3(18.8516) - ffxBroadcast3(18.6875) * p), ffxBroadcast3(6.27739)); +} + +/// Compute an SRGB value from a linear value. +/// +/// @param [in] value The value to convert to SRGB from linear. +/// +/// @returns +/// A value in SRGB space. +/// +/// @ingroup GPUCore +FfxFloat32 ffxSrgbFromLinear(FfxFloat32 value) +{ + FfxFloat32x3 j = FfxFloat32x3(0.0031308 * 12.92, 12.92, 1.0 / 2.4); + FfxFloat32x2 k = FfxFloat32x2(1.055, -0.055); + return clamp(j.x, value * j.y, pow(value, j.z) * k.x + k.y); +} + +/// Compute an SRGB value from a linear value. +/// +/// @param [in] value The value to convert to SRGB from linear. +/// +/// @returns +/// A value in SRGB space. +/// +/// @ingroup GPUCore +FfxFloat32x2 ffxSrgbFromLinear(FfxFloat32x2 value) +{ + FfxFloat32x3 j = FfxFloat32x3(0.0031308 * 12.92, 12.92, 1.0 / 2.4); + FfxFloat32x2 k = FfxFloat32x2(1.055, -0.055); + return clamp(j.xx, value * j.yy, pow(value, j.zz) * k.xx + k.yy); +} + +/// Compute an SRGB value from a linear value. +/// +/// @param [in] value The value to convert to SRGB from linear. +/// +/// @returns +/// A value in SRGB space. +/// +/// @ingroup GPUCore +FfxFloat32x3 ffxSrgbFromLinear(FfxFloat32x3 value) +{ + FfxFloat32x3 j = FfxFloat32x3(0.0031308 * 12.92, 12.92, 1.0 / 2.4); + FfxFloat32x2 k = FfxFloat32x2(1.055, -0.055); + return clamp(j.xxx, value * j.yyy, pow(value, j.zzz) * k.xxx + k.yyy); +} + +/// Compute a linear value from a value in a SRGB space. +/// +/// Typically 2.2 for some PC displays, or 2.4-2.5 for CRTs, or 2.2 FreeSync2 native. +/// +/// @param [in] value The value to convert to linear in SRGB space. +/// +/// @returns +/// A value in linear space. +/// +/// @ingroup GPUCore +FfxFloat32 ffxLinearFromSrgb(FfxFloat32 value) +{ + FfxFloat32x3 j = FfxFloat32x3(0.04045, 1.0 / 12.92, 2.4); + FfxFloat32x2 k = FfxFloat32x2(1.0 / 1.055, 0.055 / 1.055); + return ffxZeroOneSelect(ffxZeroOneIsSigned(value - j.x), value * j.y, pow(value * k.x + k.y, j.z)); +} + +/// Compute a linear value from a value in a SRGB space. +/// +/// Typically 2.2 for some PC displays, or 2.4-2.5 for CRTs, or 2.2 FreeSync2 native. +/// +/// @param [in] value The value to convert to linear in SRGB space. +/// +/// @returns +/// A value in linear space. +/// +/// @ingroup GPUCore +FfxFloat32x2 ffxLinearFromSrgb(FfxFloat32x2 value) +{ + FfxFloat32x3 j = FfxFloat32x3(0.04045, 1.0 / 12.92, 2.4); + FfxFloat32x2 k = FfxFloat32x2(1.0 / 1.055, 0.055 / 1.055); + return ffxZeroOneSelect(ffxZeroOneIsSigned(value - j.xx), value * j.yy, pow(value * k.xx + k.yy, j.zz)); +} + +/// Compute a linear value from a value in a SRGB space. +/// +/// Typically 2.2 for some PC displays, or 2.4-2.5 for CRTs, or 2.2 FreeSync2 native. +/// +/// @param [in] value The value to convert to linear in SRGB space. +/// +/// @returns +/// A value in linear space. +/// +/// @ingroup GPUCore +FfxFloat32x3 ffxLinearFromSrgb(FfxFloat32x3 value) +{ + FfxFloat32x3 j = FfxFloat32x3(0.04045, 1.0 / 12.92, 2.4); + FfxFloat32x2 k = FfxFloat32x2(1.0 / 1.055, 0.055 / 1.055); + return ffxZeroOneSelect(ffxZeroOneIsSigned(value - j.xxx), value * j.yyy, pow(value * k.xxx + k.yyy, j.zzz)); +} + +/// A remapping of 64x1 to 8x8 imposing rotated 2x2 pixel quads in quad linear. +/// +/// Remap illustration: +/// +/// 543210 +/// ~~~~~~ +/// ..xxx. +/// yy...y +/// +/// @param [in] a The input 1D coordinates to remap. +/// +/// @returns +/// The remapped 2D coordinates. +/// +/// @ingroup GPUCore +FfxUInt32x2 ffxRemapForQuad(FfxUInt32 a) +{ + return FfxUInt32x2(ffxBitfieldExtract(a, 1u, 3u), ffxBitfieldInsertMask(ffxBitfieldExtract(a, 3u, 3u), a, 1u)); +} + +/// A helper function performing a remap 64x1 to 8x8 remapping which is necessary for 2D wave reductions. +/// +/// The 64-wide lane indices to 8x8 remapping is performed as follows: +/// +/// 00 01 08 09 10 11 18 19 +/// 02 03 0a 0b 12 13 1a 1b +/// 04 05 0c 0d 14 15 1c 1d +/// 06 07 0e 0f 16 17 1e 1f +/// 20 21 28 29 30 31 38 39 +/// 22 23 2a 2b 32 33 3a 3b +/// 24 25 2c 2d 34 35 3c 3d +/// 26 27 2e 2f 36 37 3e 3f +/// +/// @param [in] a The input 1D coordinate to remap. +/// +/// @returns +/// The remapped 2D coordinates. +/// +/// @ingroup GPUCore +FfxUInt32x2 ffxRemapForWaveReduction(FfxUInt32 a) +{ + return FfxUInt32x2(ffxBitfieldInsertMask(ffxBitfieldExtract(a, 2u, 3u), a, 1u), ffxBitfieldInsertMask(ffxBitfieldExtract(a, 3u, 3u), ffxBitfieldExtract(a, 1u, 2u), 2u)); +} diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/ffx_core_gpu_common_half.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/ffx_core_gpu_common_half.h new file mode 100644 index 00000000..6b071d59 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/ffx_core_gpu_common_half.h @@ -0,0 +1,2981 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#if FFX_HALF +#if FFX_HLSL_SM >= 62 +/// A define value for 16bit positive infinity. +/// +/// @ingroup GPUCore +#define FFX_POSITIVE_INFINITY_HALF FFX_TO_FLOAT16((uint16_t)0x7c00u) + +/// A define value for 16bit negative infinity. +/// +/// @ingroup GPUCore +#define FFX_NEGATIVE_INFINITY_HALF FFX_TO_FLOAT16((uint16_t)0xfc00u) +#else +/// A define value for 16bit positive infinity. +/// +/// @ingroup GPUCore +#define FFX_POSITIVE_INFINITY_HALF FFX_TO_FLOAT16(0x7c00u) + +/// A define value for 16bit negative infinity. +/// +/// @ingroup GPUCore +#define FFX_NEGATIVE_INFINITY_HALF FFX_TO_FLOAT16(0xfc00u) +#endif // #if FFX_HLSL_SM>=62 + +/// Compute the min of two values. +/// +/// @param [in] x The first value to compute the min of. +/// @param [in] y The second value to compute the min of. +/// +/// @returns +/// The the lowest of two values. +/// +/// @ingroup GPUCore +FfxFloat16 ffxMin(FfxFloat16 x, FfxFloat16 y) +{ + return min(x, y); +} + +/// Compute the min of two values. +/// +/// @param [in] x The first value to compute the min of. +/// @param [in] y The second value to compute the min of. +/// +/// @returns +/// The the lowest of two values. +/// +/// @ingroup GPUCore +FfxFloat16x2 ffxMin(FfxFloat16x2 x, FfxFloat16x2 y) +{ + return min(x, y); +} + +/// Compute the min of two values. +/// +/// @param [in] x The first value to compute the min of. +/// @param [in] y The second value to compute the min of. +/// +/// @returns +/// The the lowest of two values. +/// +/// @ingroup GPUCore +FfxFloat16x3 ffxMin(FfxFloat16x3 x, FfxFloat16x3 y) +{ + return min(x, y); +} + +/// Compute the min of two values. +/// +/// @param [in] x The first value to compute the min of. +/// @param [in] y The second value to compute the min of. +/// +/// @returns +/// The the lowest of two values. +/// +/// @ingroup GPUCore +FfxFloat16x4 ffxMin(FfxFloat16x4 x, FfxFloat16x4 y) +{ + return min(x, y); +} + +/// Compute the min of two values. +/// +/// @param [in] x The first value to compute the min of. +/// @param [in] y The second value to compute the min of. +/// +/// @returns +/// The the lowest of two values. +/// +/// @ingroup GPUCore +FfxInt16 ffxMin(FfxInt16 x, FfxInt16 y) +{ + return min(x, y); +} + +/// Compute the min of two values. +/// +/// @param [in] x The first value to compute the min of. +/// @param [in] y The second value to compute the min of. +/// +/// @returns +/// The the lowest of two values. +/// +/// @ingroup GPUCore +FfxInt16x2 ffxMin(FfxInt16x2 x, FfxInt16x2 y) +{ + return min(x, y); +} + +/// Compute the min of two values. +/// +/// @param [in] x The first value to compute the min of. +/// @param [in] y The second value to compute the min of. +/// +/// @returns +/// The the lowest of two values. +/// +/// @ingroup GPUCore +FfxInt16x3 ffxMin(FfxInt16x3 x, FfxInt16x3 y) +{ + return min(x, y); +} + +/// Compute the min of two values. +/// +/// @param [in] x The first value to compute the min of. +/// @param [in] y The second value to compute the min of. +/// +/// @returns +/// The the lowest of two values. +/// +/// @ingroup GPUCore +FfxInt16x4 ffxMin(FfxInt16x4 x, FfxInt16x4 y) +{ + return min(x, y); +} + +/// Compute the min of two values. +/// +/// @param [in] x The first value to compute the min of. +/// @param [in] y The second value to compute the min of. +/// +/// @returns +/// The the lowest of two values. +/// +/// @ingroup GPUCore +FfxUInt16 ffxMin(FfxUInt16 x, FfxUInt16 y) +{ + return min(x, y); +} + +/// Compute the min of two values. +/// +/// @param [in] x The first value to compute the min of. +/// @param [in] y The second value to compute the min of. +/// +/// @returns +/// The the lowest of two values. +/// +/// @ingroup GPUCore +FfxUInt16x2 ffxMin(FfxUInt16x2 x, FfxUInt16x2 y) +{ + return min(x, y); +} + +/// Compute the min of two values. +/// +/// @param [in] x The first value to compute the min of. +/// @param [in] y The second value to compute the min of. +/// +/// @returns +/// The the lowest of two values. +/// +/// @ingroup GPUCore +FfxUInt16x3 ffxMin(FfxUInt16x3 x, FfxUInt16x3 y) +{ + return min(x, y); +} + +/// Compute the min of two values. +/// +/// @param [in] x The first value to compute the min of. +/// @param [in] y The second value to compute the min of. +/// +/// @returns +/// The the lowest of two values. +/// +/// @ingroup GPUCore +FfxUInt16x4 ffxMin(FfxUInt16x4 x, FfxUInt16x4 y) +{ + return min(x, y); +} + +/// Compute the max of two values. +/// +/// @param [in] x The first value to compute the max of. +/// @param [in] y The second value to compute the max of. +/// +/// @returns +/// The the lowest of two values. +/// +/// @ingroup GPUCore +FfxFloat16 ffxMax(FfxFloat16 x, FfxFloat16 y) +{ + return max(x, y); +} + +/// Compute the max of two values. +/// +/// @param [in] x The first value to compute the max of. +/// @param [in] y The second value to compute the max of. +/// +/// @returns +/// The the lowest of two values. +/// +/// @ingroup GPUCore +FfxFloat16x2 ffxMax(FfxFloat16x2 x, FfxFloat16x2 y) +{ + return max(x, y); +} + +/// Compute the max of two values. +/// +/// @param [in] x The first value to compute the max of. +/// @param [in] y The second value to compute the max of. +/// +/// @returns +/// The the lowest of two values. +/// +/// @ingroup GPUCore +FfxFloat16x3 ffxMax(FfxFloat16x3 x, FfxFloat16x3 y) +{ + return max(x, y); +} + +/// Compute the max of two values. +/// +/// @param [in] x The first value to compute the max of. +/// @param [in] y The second value to compute the max of. +/// +/// @returns +/// The the lowest of two values. +/// +/// @ingroup GPUCore +FfxFloat16x4 ffxMax(FfxFloat16x4 x, FfxFloat16x4 y) +{ + return max(x, y); +} + +/// Compute the max of two values. +/// +/// @param [in] x The first value to compute the max of. +/// @param [in] y The second value to compute the max of. +/// +/// @returns +/// The the lowest of two values. +/// +/// @ingroup GPUCore +FfxInt16 ffxMax(FfxInt16 x, FfxInt16 y) +{ + return max(x, y); +} + +/// Compute the max of two values. +/// +/// @param [in] x The first value to compute the max of. +/// @param [in] y The second value to compute the max of. +/// +/// @returns +/// The the lowest of two values. +/// +/// @ingroup GPUCore +FfxInt16x2 ffxMax(FfxInt16x2 x, FfxInt16x2 y) +{ + return max(x, y); +} + +/// Compute the max of two values. +/// +/// @param [in] x The first value to compute the max of. +/// @param [in] y The second value to compute the max of. +/// +/// @returns +/// The the lowest of two values. +/// +/// @ingroup GPUCore +FfxInt16x3 ffxMax(FfxInt16x3 x, FfxInt16x3 y) +{ + return max(x, y); +} + +/// Compute the max of two values. +/// +/// @param [in] x The first value to compute the max of. +/// @param [in] y The second value to compute the max of. +/// +/// @returns +/// The the lowest of two values. +/// +/// @ingroup GPUCore +FfxInt16x4 ffxMax(FfxInt16x4 x, FfxInt16x4 y) +{ + return max(x, y); +} + +/// Compute the max of two values. +/// +/// @param [in] x The first value to compute the max of. +/// @param [in] y The second value to compute the max of. +/// +/// @returns +/// The the lowest of two values. +/// +/// @ingroup GPUCore +FfxUInt16 ffxMax(FfxUInt16 x, FfxUInt16 y) +{ + return max(x, y); +} + +/// Compute the max of two values. +/// +/// @param [in] x The first value to compute the max of. +/// @param [in] y The second value to compute the max of. +/// +/// @returns +/// The the lowest of two values. +/// +/// @ingroup GPUCore +FfxUInt16x2 ffxMax(FfxUInt16x2 x, FfxUInt16x2 y) +{ + return max(x, y); +} + +/// Compute the max of two values. +/// +/// @param [in] x The first value to compute the max of. +/// @param [in] y The second value to compute the max of. +/// +/// @returns +/// The the lowest of two values. +/// +/// @ingroup GPUCore +FfxUInt16x3 ffxMax(FfxUInt16x3 x, FfxUInt16x3 y) +{ + return max(x, y); +} + +/// Compute the max of two values. +/// +/// @param [in] x The first value to compute the max of. +/// @param [in] y The second value to compute the max of. +/// +/// @returns +/// The the lowest of two values. +/// +/// @ingroup GPUCore +FfxUInt16x4 ffxMax(FfxUInt16x4 x, FfxUInt16x4 y) +{ + return max(x, y); +} + +/// Compute the value of the first parameter raised to the power of the second. +/// +/// @param [in] x The value to raise to the power y. +/// @param [in] y The power to which to raise x. +/// +/// @returns +/// The value of the first parameter raised to the power of the second. +/// +/// @ingroup GPUCore +FfxFloat16 ffxPow(FfxFloat16 x, FfxFloat16 y) +{ + return pow(x, y); +} + +/// Compute the value of the first parameter raised to the power of the second. +/// +/// @param [in] x The value to raise to the power y. +/// @param [in] y The power to which to raise x. +/// +/// @returns +/// The value of the first parameter raised to the power of the second. +/// +/// @ingroup GPUCore +FfxFloat16x2 ffxPow(FfxFloat16x2 x, FfxFloat16x2 y) +{ + return pow(x, y); +} + +/// Compute the value of the first parameter raised to the power of the second. +/// +/// @param [in] x The value to raise to the power y. +/// @param [in] y The power to which to raise x. +/// +/// @returns +/// The value of the first parameter raised to the power of the second. +/// +/// @ingroup GPUCore +FfxFloat16x3 ffxPow(FfxFloat16x3 x, FfxFloat16x3 y) +{ + return pow(x, y); +} + +/// Compute the value of the first parameter raised to the power of the second. +/// +/// @param [in] x The value to raise to the power y. +/// @param [in] y The power to which to raise x. +/// +/// @returns +/// The value of the first parameter raised to the power of the second. +/// +/// @ingroup GPUCore +FfxFloat16x4 ffxPow(FfxFloat16x4 x, FfxFloat16x4 y) +{ + return pow(x, y); +} + +/// Compute the square root of a value. +/// +/// @param [in] x The first value to compute the min of. +/// +/// @returns +/// The the square root of x. +/// +/// @ingroup GPUCore +FfxFloat16 ffxSqrt(FfxFloat16 x) +{ + return sqrt(x); +} + +/// Compute the square root of a value. +/// +/// @param [in] x The first value to compute the min of. +/// +/// @returns +/// The the square root of x. +/// +/// @ingroup GPUCore +FfxFloat16x2 ffxSqrt(FfxFloat16x2 x) +{ + return sqrt(x); +} + +/// Compute the square root of a value. +/// +/// @param [in] x The first value to compute the min of. +/// +/// @returns +/// The the square root of x. +/// +/// @ingroup GPUCore +FfxFloat16x3 ffxSqrt(FfxFloat16x3 x) +{ + return sqrt(x); +} + +/// Compute the square root of a value. +/// +/// @param [in] x The first value to compute the min of. +/// +/// @returns +/// The the square root of x. +/// +/// @ingroup GPUCore +FfxFloat16x4 ffxSqrt(FfxFloat16x4 x) +{ + return sqrt(x); +} + +/// Copy the sign bit from 's' to positive 'd'. +/// +/// @param [in] d The value to copy the sign bit into. +/// @param [in] s The value to copy the sign bit from. +/// +/// @returns +/// The value of d with the sign bit from s. +/// +/// @ingroup GPUCore +FfxFloat16 ffxCopySignBitHalf(FfxFloat16 d, FfxFloat16 s) +{ + return FFX_TO_FLOAT16(FFX_TO_UINT16(d) | (FFX_TO_UINT16(s) & FFX_BROADCAST_UINT16(0x8000u))); +} + +/// Copy the sign bit from 's' to positive 'd'. +/// +/// @param [in] d The value to copy the sign bit into. +/// @param [in] s The value to copy the sign bit from. +/// +/// @returns +/// The value of d with the sign bit from s. +/// +/// @ingroup GPUCore +FfxFloat16x2 ffxCopySignBitHalf(FfxFloat16x2 d, FfxFloat16x2 s) +{ + return FFX_TO_FLOAT16X2(FFX_TO_UINT16X2(d) | (FFX_TO_UINT16X2(s) & FFX_BROADCAST_UINT16X2(0x8000u))); +} + +/// Copy the sign bit from 's' to positive 'd'. +/// +/// @param [in] d The value to copy the sign bit into. +/// @param [in] s The value to copy the sign bit from. +/// +/// @returns +/// The value of d with the sign bit from s. +/// +/// @ingroup GPUCore +FfxFloat16x3 ffxCopySignBitHalf(FfxFloat16x3 d, FfxFloat16x3 s) +{ + return FFX_TO_FLOAT16X3(FFX_TO_UINT16X3(d) | (FFX_TO_UINT16X3(s) & FFX_BROADCAST_UINT16X3(0x8000u))); +} + +/// Copy the sign bit from 's' to positive 'd'. +/// +/// @param [in] d The value to copy the sign bit into. +/// @param [in] s The value to copy the sign bit from. +/// +/// @returns +/// The value of d with the sign bit from s. +/// +/// @ingroup GPUCore +FfxFloat16x4 ffxCopySignBitHalf(FfxFloat16x4 d, FfxFloat16x4 s) +{ + return FFX_TO_FLOAT16X4(FFX_TO_UINT16X4(d) | (FFX_TO_UINT16X4(s) & FFX_BROADCAST_UINT16X4(0x8000u))); +} + +/// A single operation to return the following: +/// m = NaN := 0 +/// m >= 0 := 0 +/// m < 0 := 1 +/// +/// Uses the following useful floating point logic, +/// saturate(+a*(-INF)==-INF) := 0 +/// saturate( 0*(-INF)== NaN) := 0 +/// saturate(-a*(-INF)==+INF) := 1 +/// +/// This function is useful when creating masks for branch-free logic. +/// +/// @param [in] m The value to test against 0. +/// +/// @returns +/// 1.0 when the value is negative, or 0.0 when the value is 0 or position. +/// +/// @ingroup GPUCore +FfxFloat16 ffxIsSignedHalf(FfxFloat16 m) +{ + return ffxSaturate(m * FFX_BROADCAST_FLOAT16(FFX_NEGATIVE_INFINITY_HALF)); +} + +/// A single operation to return the following: +/// m = NaN := 0 +/// m >= 0 := 0 +/// m < 0 := 1 +/// +/// Uses the following useful floating point logic, +/// saturate(+a*(-INF)==-INF) := 0 +/// saturate( 0*(-INF)== NaN) := 0 +/// saturate(-a*(-INF)==+INF) := 1 +/// +/// This function is useful when creating masks for branch-free logic. +/// +/// @param [in] m The value to test against 0. +/// +/// @returns +/// 1.0 when the value is negative, or 0.0 when the value is 0 or position. +/// +/// @ingroup GPUCore +FfxFloat16x2 ffxIsSignedHalf(FfxFloat16x2 m) +{ + return ffxSaturate(m * FFX_BROADCAST_FLOAT16X2(FFX_NEGATIVE_INFINITY_HALF)); +} + +/// A single operation to return the following: +/// m = NaN := 0 +/// m >= 0 := 0 +/// m < 0 := 1 +/// +/// Uses the following useful floating point logic, +/// saturate(+a*(-INF)==-INF) := 0 +/// saturate( 0*(-INF)== NaN) := 0 +/// saturate(-a*(-INF)==+INF) := 1 +/// +/// This function is useful when creating masks for branch-free logic. +/// +/// @param [in] m The value to test against 0. +/// +/// @returns +/// 1.0 when the value is negative, or 0.0 when the value is 0 or position. +/// +/// @ingroup GPUCore +FfxFloat16x3 ffxIsSignedHalf(FfxFloat16x3 m) +{ + return ffxSaturate(m * FFX_BROADCAST_FLOAT16X3(FFX_NEGATIVE_INFINITY_HALF)); +} + +/// A single operation to return the following: +/// m = NaN := 0 +/// m >= 0 := 0 +/// m < 0 := 1 +/// +/// Uses the following useful floating point logic, +/// saturate(+a*(-INF)==-INF) := 0 +/// saturate( 0*(-INF)== NaN) := 0 +/// saturate(-a*(-INF)==+INF) := 1 +/// +/// This function is useful when creating masks for branch-free logic. +/// +/// @param [in] m The value to test against 0. +/// +/// @returns +/// 1.0 when the value is negative, or 0.0 when the value is 0 or position. +/// +/// @ingroup GPUCore +FfxFloat16x4 ffxIsSignedHalf(FfxFloat16x4 m) +{ + return ffxSaturate(m * FFX_BROADCAST_FLOAT16X4(FFX_NEGATIVE_INFINITY_HALF)); +} + +/// A single operation to return the following: +/// m = NaN := 1 +/// m > 0 := 0 +/// m <= 0 := 1 +/// +/// This function is useful when creating masks for branch-free logic. +/// +/// @param [in] m The value to test against zero. +/// +/// @returns +/// 1.0 when the value is position, or 0.0 when the value is 0 or negative. +/// +/// @ingroup GPUCore +FfxFloat16 ffxIsGreaterThanZeroHalf(FfxFloat16 m) +{ + return ffxSaturate(m * FFX_BROADCAST_FLOAT16(FFX_POSITIVE_INFINITY_HALF)); +} + +/// A single operation to return the following: +/// m = NaN := 1 +/// m > 0 := 0 +/// m <= 0 := 1 +/// +/// This function is useful when creating masks for branch-free logic. +/// +/// @param [in] m The value to test against zero. +/// +/// @returns +/// 1.0 when the value is position, or 0.0 when the value is 0 or negative. +/// +/// @ingroup GPUCore +FfxFloat16x2 ffxIsGreaterThanZeroHalf(FfxFloat16x2 m) +{ + return ffxSaturate(m * FFX_BROADCAST_FLOAT16X2(FFX_POSITIVE_INFINITY_HALF)); +} + +/// A single operation to return the following: +/// m = NaN := 1 +/// m > 0 := 0 +/// m <= 0 := 1 +/// +/// This function is useful when creating masks for branch-free logic. +/// +/// @param [in] m The value to test against zero. +/// +/// @returns +/// 1.0 when the value is position, or 0.0 when the value is 0 or negative. +/// +/// @ingroup GPUCore +FfxFloat16x3 ffxIsGreaterThanZeroHalf(FfxFloat16x3 m) +{ + return ffxSaturate(m * FFX_BROADCAST_FLOAT16X3(FFX_POSITIVE_INFINITY_HALF)); +} + +/// A single operation to return the following: +/// m = NaN := 1 +/// m > 0 := 0 +/// m <= 0 := 1 +/// +/// This function is useful when creating masks for branch-free logic. +/// +/// @param [in] m The value to test against zero. +/// +/// @returns +/// 1.0 when the value is position, or 0.0 when the value is 0 or negative. +/// +/// @ingroup GPUCore +FfxFloat16x4 ffxIsGreaterThanZeroHalf(FfxFloat16x4 m) +{ + return ffxSaturate(m * FFX_BROADCAST_FLOAT16X4(FFX_POSITIVE_INFINITY_HALF)); +} + +/// Convert a 16bit floating point value to sortable integer. +/// +/// - If sign bit=0, flip the sign bit (positives). +/// - If sign bit=1, flip all bits (negatives). +/// +/// The function has the side effects that: +/// - Larger integers are more positive values. +/// - Float zero is mapped to center of integers (so clear to integer zero is a nice default for atomic max usage). +/// +/// @param [in] x The floating point value to make sortable. +/// +/// @returns +/// The sortable integer value. +/// +/// @ingroup GPUCore +FfxUInt16 ffxFloatToSortableIntegerHalf(FfxUInt16 x) +{ + return x ^ ((ffxBitShiftRightHalf(x, FFX_BROADCAST_UINT16(15))) | FFX_BROADCAST_UINT16(0x8000)); +} + +/// Convert a sortable integer to a 16bit floating point value. +/// +/// The function has the side effects that: +/// - If sign bit=1, flip the sign bit (positives). +/// - If sign bit=0, flip all bits (negatives). +/// +/// @param [in] x The sortable integer value to make floating point. +/// +/// @returns +/// The floating point value. +/// +/// @ingroup GPUCore +FfxUInt16 ffxSortableIntegerToFloatHalf(FfxUInt16 x) +{ + return x ^ ((~ffxBitShiftRightHalf(x, FFX_BROADCAST_UINT16(15))) | FFX_BROADCAST_UINT16(0x8000)); +} + +/// Convert a pair of 16bit floating point values to a pair of sortable integers. +/// +/// - If sign bit=0, flip the sign bit (positives). +/// - If sign bit=1, flip all bits (negatives). +/// +/// The function has the side effects that: +/// - Larger integers are more positive values. +/// - Float zero is mapped to center of integers (so clear to integer zero is a nice default for atomic max usage). +/// +/// @param [in] x The floating point values to make sortable. +/// +/// @returns +/// The sortable integer values. +/// +/// @ingroup GPUCore +FfxUInt16x2 ffxFloatToSortableIntegerHalf(FfxUInt16x2 x) +{ + return x ^ ((ffxBitShiftRightHalf(x, FFX_BROADCAST_UINT16X2(15))) | FFX_BROADCAST_UINT16X2(0x8000)); +} + +/// Convert a pair of sortable integers to a pair of 16bit floating point values. +/// +/// The function has the side effects that: +/// - If sign bit=1, flip the sign bit (positives). +/// - If sign bit=0, flip all bits (negatives). +/// +/// @param [in] x The sortable integer values to make floating point. +/// +/// @returns +/// The floating point values. +/// +/// @ingroup GPUCore +FfxUInt16x2 ffxSortableIntegerToFloatHalf(FfxUInt16x2 x) +{ + return x ^ ((~ffxBitShiftRightHalf(x, FFX_BROADCAST_UINT16X2(15))) | FFX_BROADCAST_UINT16X2(0x8000)); +} + +/// Packs the bytes from the X and Y components of a FfxUInt32x2 into a single 32-bit integer. +/// +/// The resulting integer will contain bytes in the following order, from most to least significant: +/// [Zero] Y0 [Zero] X0 +/// +/// @param [in] i The integer pair to pack. +/// +/// @returns +/// The packed integer value. +/// +/// @ingroup GPUCore +FfxUInt32 ffxPackBytesZeroY0ZeroX0(FfxUInt32x2 i) +{ + return ((i.x) & 0xffu) | ((i.y << 16) & 0xff0000u); +} + +/// Packs the bytes from the X and Y components of a FfxUInt32x2 into a single 32-bit integer. +/// +/// The resulting integer will contain bytes in the following order, from most to least significant: +/// [Zero] Y1 [Zero] X1 +/// +/// @param [in] i The integer pair to pack. +/// +/// @returns +/// The packed integer value. +/// +/// @ingroup GPUCore +FfxUInt32 ffxPackBytesZeroY1ZeroX1(FfxUInt32x2 i) +{ + return ((i.x >> 8) & 0xffu) | ((i.y << 8) & 0xff0000u); +} + +/// Packs the bytes from the X and Y components of a FfxUInt32x2 into a single 32-bit integer. +/// +/// The resulting integer will contain bytes in the following order, from most to least significant: +/// [Zero] Y2 [Zero] X2 +/// +/// @param [in] i The integer pair to pack. +/// +/// @returns +/// The packed integer value. +/// +/// @ingroup GPUCore +FfxUInt32 ffxPackBytesZeroY2ZeroX2(FfxUInt32x2 i) +{ + return ((i.x >> 16) & 0xffu) | ((i.y) & 0xff0000u); +} + +/// Packs the bytes from the X and Y components of a FfxUInt32x2 into a single 32-bit integer. +/// +/// The resulting integer will contain bytes in the following order, from most to least significant: +/// [Zero] Y3 [Zero] X3 +/// +/// @param [in] i The integer pair to pack. +/// +/// @returns +/// The packed integer value. +/// +/// @ingroup GPUCore +FfxUInt32 ffxPackBytesZeroY3ZeroX3(FfxUInt32x2 i) +{ + return ((i.x >> 24) & 0xffu) | ((i.y >> 8) & 0xff0000u); +} + +/// Packs the bytes from the X and Y components of a FfxUInt32x2 into a single 32-bit integer. +/// +/// The resulting integer will contain bytes in the following order, from most to least significant: +/// Y3 Y2 Y1 X0 +/// +/// @param [in] i The integer pair to pack. +/// +/// @returns +/// The packed integer value. +/// +/// @ingroup GPUCore +FfxUInt32 ffxPackBytesY3Y2Y1X0(FfxUInt32x2 i) +{ + return ((i.x) & 0x000000ffu) | (i.y & 0xffffff00u); +} + +/// Packs the bytes from the X and Y components of a FfxUInt32x2 into a single 32-bit integer. +/// +/// The resulting integer will contain bytes in the following order, from most to least significant: +/// Y3 Y2 Y1 X2 +/// +/// @param [in] i The integer pair to pack. +/// +/// @returns +/// The packed integer value. +/// +/// @ingroup GPUCore +FfxUInt32 ffxPackBytesY3Y2Y1X2(FfxUInt32x2 i) +{ + return ((i.x >> 16) & 0x000000ffu) | (i.y & 0xffffff00u); +} + +/// Packs the bytes from the X and Y components of a FfxUInt32x2 into a single 32-bit integer. +/// +/// The resulting integer will contain bytes in the following order, from most to least significant: +/// Y3 Y2 X0 Y0 +/// +/// @param [in] i The integer pair to pack. +/// +/// @returns +/// The packed integer value. +/// +/// @ingroup GPUCore +FfxUInt32 ffxPackBytesY3Y2X0Y0(FfxUInt32x2 i) +{ + return ((i.x << 8) & 0x0000ff00u) | (i.y & 0xffff00ffu); +} + +/// Packs the bytes from the X and Y components of a FfxUInt32x2 into a single 32-bit integer. +/// +/// The resulting integer will contain bytes in the following order, from most to least significant: +/// Y3 Y2 X2 Y0 +/// +/// @param [in] i The integer pair to pack. +/// +/// @returns +/// The packed integer value. +/// +/// @ingroup GPUCore +FfxUInt32 ffxPackBytesY3Y2X2Y0(FfxUInt32x2 i) +{ + return ((i.x >> 8) & 0x0000ff00u) | (i.y & 0xffff00ffu); +} + +/// Packs the bytes from the X and Y components of a FfxUInt32x2 into a single 32-bit integer. +/// +/// The resulting integer will contain bytes in the following order, from most to least significant: +/// Y3 X0 Y1 Y0 +/// +/// @param [in] i The integer pair to pack. +/// +/// @returns +/// The packed integer value. +/// +/// @ingroup GPUCore +FfxUInt32 ffxPackBytesY3X0Y1Y0(FfxUInt32x2 i) +{ + return ((i.x << 16) & 0x00ff0000u) | (i.y & 0xff00ffffu); +} + +/// Packs the bytes from the X and Y components of a FfxUInt32x2 into a single 32-bit integer. +/// +/// The resulting integer will contain bytes in the following order, from most to least significant: +/// Y3 X2 Y1 Y0 +/// +/// @param [in] i The integer pair to pack. +/// +/// @returns +/// The packed integer value. +/// +/// @ingroup GPUCore +FfxUInt32 ffxPackBytesY3X2Y1Y0(FfxUInt32x2 i) +{ + return ((i.x) & 0x00ff0000u) | (i.y & 0xff00ffffu); +} + +/// Packs the bytes from the X and Y components of a FfxUInt32x2 into a single 32-bit integer. +/// +/// The resulting integer will contain bytes in the following order, from most to least significant: +/// X0 Y2 Y1 Y0 +/// +/// @param [in] i The integer pair to pack. +/// +/// @returns +/// The packed integer value. +/// +/// @ingroup GPUCore +FfxUInt32 ffxPackBytesX0Y2Y1Y0(FfxUInt32x2 i) +{ + return ((i.x << 24) & 0xff000000u) | (i.y & 0x00ffffffu); +} + +/// Packs the bytes from the X and Y components of a FfxUInt32x2 into a single 32-bit integer. +/// +/// The resulting integer will contain bytes in the following order, from most to least significant: +/// X2 Y2 Y1 Y0 +/// +/// @param [in] i The integer pair to pack. +/// +/// @returns +/// The packed integer value. +/// +/// @ingroup GPUCore +FfxUInt32 ffxPackBytesX2Y2Y1Y0(FfxUInt32x2 i) +{ + return ((i.x << 8) & 0xff000000u) | (i.y & 0x00ffffffu); +} + +/// Packs the bytes from the X and Y components of a FfxUInt32x2 into a single 32-bit integer. +/// +/// The resulting integer will contain bytes in the following order, from most to least significant: +/// Y2 X2 Y0 X0 +/// +/// @param [in] i The integer pair to pack. +/// +/// @returns +/// The packed integer value. +/// +/// @ingroup GPUCore +FfxUInt32 ffxPackBytesY2X2Y0X0(FfxUInt32x2 i) +{ + return ((i.x) & 0x00ff00ffu) | ((i.y << 8) & 0xff00ff00u); +} + +/// Packs the bytes from the X and Y components of a FfxUInt32x2 into a single 32-bit integer. +/// +/// The resulting integer will contain bytes in the following order, from most to least significant: +/// Y2 Y0 X2 X0 +/// +/// @param [in] i The integer pair to pack. +/// +/// @returns +/// The packed integer value. +/// +/// @ingroup GPUCore +FfxUInt32 ffxPackBytesY2Y0X2X0(FfxUInt32x2 i) +{ + return (((i.x) & 0xffu) | ((i.x >> 8) & 0xff00u) | ((i.y << 16) & 0xff0000u) | ((i.y << 8) & 0xff000000u)); +} + +/// Takes two Float16x2 values x and y, normalizes them and builds a single Uint16x2 value in the format {{x0,y0},{x1,y1}}. +/// +/// @param [in] x The first float16x2 value to pack. +/// @param [in] y The second float16x2 value to pack. +/// +/// @returns +/// The packed FfxUInt32x2 value. +/// +/// @ingroup GPUCore +FfxUInt16x2 ffxPackX0Y0X1Y1UnsignedToUint16x2(FfxFloat16x2 x, FfxFloat16x2 y) +{ + x *= FFX_BROADCAST_FLOAT16X2(1.0 / 32768.0); + y *= FFX_BROADCAST_FLOAT16X2(1.0 / 32768.0); + return FFX_UINT32_TO_UINT16X2(ffxPackBytesY2X2Y0X0(FfxUInt32x2(FFX_UINT16X2_TO_UINT32(FFX_TO_UINT16X2(x)), FFX_UINT16X2_TO_UINT32(FFX_TO_UINT16X2(y))))); +} + +/// Given a FfxUInt32x2 value d, Float16x2 value i and a resulting FfxUInt32x2 value r, this function packs d.x[0:7] into r.x[0:7], +/// d.y[0:7] into r.y[0:7], i.x[8:15] into r.x[8:15], r.y[8:15] and i.y[0:15] into r.x[16:31], r.y[16:31] using 3 ops. +/// +/// r=ffxPermuteUByte0Float16x2ToUint2(d,i) +/// Where 'k0' is an SGPR with {1.0/32768.0} packed into the lower 16-bits +/// Where 'k1' is an SGPR with 0x???? +/// Where 'k2' is an SGPR with 0x???? +/// V_PK_FMA_F16 i,i,k0.x,0 +/// V_PERM_B32 r.x,i,i,k1 +/// V_PERM_B32 r.y,i,i,k2 +/// +/// @param [in] d The FfxUInt32x2 value to be packed. +/// @param [in] i The FfxFloat16x2 value to be packed. +/// +/// @returns +/// The packed FfxUInt32x2 value. +/// +/// @ingroup GPUCore +FfxUInt32x2 ffxPermuteUByte0Float16x2ToUint2(FfxUInt32x2 d, FfxFloat16x2 i) +{ + FfxUInt32 b = FFX_UINT16X2_TO_UINT32(FFX_TO_UINT16X2(i * FFX_BROADCAST_FLOAT16X2(1.0 / 32768.0))); + return FfxUInt32x2(ffxPackBytesY3Y2Y1X0(FfxUInt32x2(d.x, b)), ffxPackBytesY3Y2Y1X2(FfxUInt32x2(d.y, b))); +} + +/// Given a FfxUInt32x2 value d, Float16x2 value i and a resulting FfxUInt32x2 value r, this function packs d.x[0:7] into r.x[8:15], +/// d.y[0:7] into r.y[8:15], i.x[0:7] into r.x[0:7], r.y[0:7] and i.y[0:15] into r.x[16:31], r.y[16:31] using 3 ops. +/// +/// r=ffxPermuteUByte1Float16x2ToUint2(d,i) +/// Where 'k0' is an SGPR with {1.0/32768.0} packed into the lower 16-bits +/// Where 'k1' is an SGPR with 0x???? +/// Where 'k2' is an SGPR with 0x???? +/// V_PK_FMA_F16 i,i,k0.x,0 +/// V_PERM_B32 r.x,i,i,k1 +/// V_PERM_B32 r.y,i,i,k2 +/// +/// @param [in] d The FfxUInt32x2 value to be packed. +/// @param [in] i The FfxFloat16x2 value to be packed. +/// +/// @returns +/// The packed FfxUInt32x2 value. +/// +/// @ingroup GPUCore +FfxUInt32x2 ffxPermuteUByte1Float16x2ToUint2(FfxUInt32x2 d, FfxFloat16x2 i) +{ + FfxUInt32 b = FFX_UINT16X2_TO_UINT32(FFX_TO_UINT16X2(i * FFX_BROADCAST_FLOAT16X2(1.0 / 32768.0))); + return FfxUInt32x2(ffxPackBytesY3Y2X0Y0(FfxUInt32x2(d.x, b)), ffxPackBytesY3Y2X2Y0(FfxUInt32x2(d.y, b))); +} + +/// Given a FfxUInt32x2 value d, Float16x2 value i and a resulting FfxUInt32x2 value r, this function packs d.x[0:7] into r.x[16:23], +/// d.y[0:7] into r.y[16:23], i.x[0:15] into r.x[0:15], r.y[0:15] and i.y[8:15] into r.x[24:31], r.y[24:31] using 3 ops. +/// +/// r=ffxPermuteUByte2Float16x2ToUint2(d,i) +/// Where 'k0' is an SGPR with {1.0/32768.0} packed into the lower 16-bits +/// Where 'k1' is an SGPR with 0x???? +/// Where 'k2' is an SGPR with 0x???? +/// V_PK_FMA_F16 i,i,k0.x,0 +/// V_PERM_B32 r.x,i,i,k1 +/// V_PERM_B32 r.y,i,i,k2 +/// +/// @param [in] d The FfxUInt32x2 value to be packed. +/// @param [in] i The FfxFloat16x2 value to be packed. +/// +/// @returns +/// The packed FfxUInt32x2 value. +/// +/// @ingroup GPUCore +FfxUInt32x2 ffxPermuteUByte2Float16x2ToUint2(FfxUInt32x2 d, FfxFloat16x2 i) +{ + FfxUInt32 b = FFX_UINT16X2_TO_UINT32(FFX_TO_UINT16X2(i * FFX_BROADCAST_FLOAT16X2(1.0 / 32768.0))); + return FfxUInt32x2(ffxPackBytesY3X0Y1Y0(FfxUInt32x2(d.x, b)), ffxPackBytesY3X2Y1Y0(FfxUInt32x2(d.y, b))); +} + +/// Given a FfxUInt32x2 value d, Float16x2 value i and a resulting FfxUInt32x2 value r, this function packs d.x[0:7] into r.x[24:31], +/// d.y[0:7] into r.y[24:31], i.x[0:15] into r.x[0:15], r.y[0:15] and i.y[0:7] into r.x[16:23], r.y[16:23] using 3 ops. +/// +/// r=ffxPermuteUByte3Float16x2ToUint2(d,i) +/// Where 'k0' is an SGPR with {1.0/32768.0} packed into the lower 16-bits +/// Where 'k1' is an SGPR with 0x???? +/// Where 'k2' is an SGPR with 0x???? +/// V_PK_FMA_F16 i,i,k0.x,0 +/// V_PERM_B32 r.x,i,i,k1 +/// V_PERM_B32 r.y,i,i,k2 +/// +/// @param [in] d The FfxUInt32x2 value to be packed. +/// @param [in] i The FfxFloat16x2 value to be packed. +/// +/// @returns +/// The packed FfxUInt32x2 value. +/// +/// @ingroup GPUCore +FfxUInt32x2 ffxPermuteUByte3Float16x2ToUint2(FfxUInt32x2 d, FfxFloat16x2 i) +{ + FfxUInt32 b = FFX_UINT16X2_TO_UINT32(FFX_TO_UINT16X2(i * FFX_BROADCAST_FLOAT16X2(1.0 / 32768.0))); + return FfxUInt32x2(ffxPackBytesX0Y2Y1Y0(FfxUInt32x2(d.x, b)), ffxPackBytesX2Y2Y1Y0(FfxUInt32x2(d.y, b))); +} + +/// Given a FfxUInt32x2 value i and a resulting Float16x2 value r, this function packs i.x[0:7] into r.x[0:7] and i.y[0:7] into r.y[0:7] using 2 ops. +/// +/// @param [in] i The FfxUInt32x2 value to be unpacked. +/// +/// @returns +/// The unpacked FfxFloat16x2. +/// +/// @ingroup GPUCore +FfxFloat16x2 ffxPermuteUByte0Uint2ToFloat16x2(FfxUInt32x2 i) +{ + return FFX_TO_FLOAT16X2(FFX_UINT32_TO_UINT16X2(ffxPackBytesZeroY0ZeroX0(i))) * FFX_BROADCAST_FLOAT16X2(32768.0); +} + +/// Given a FfxUInt32x2 value i and a resulting Float16x2 value r, this function packs i.x[8:15] into r.x[0:7] and i.y[8:15] into r.y[0:7] using 2 ops. +/// +/// @param [in] i The FfxUInt32x2 value to be unpacked. +/// +/// @returns +/// The unpacked FfxFloat16x2. +/// +/// @ingroup GPUCore +FfxFloat16x2 ffxPermuteUByte1Uint2ToFloat16x2(FfxUInt32x2 i) +{ + return FFX_TO_FLOAT16X2(FFX_UINT32_TO_UINT16X2(ffxPackBytesZeroY1ZeroX1(i))) * FFX_BROADCAST_FLOAT16X2(32768.0); +} + +/// Given a FfxUInt32x2 value i and a resulting Float16x2 value r, this function packs i.x[16:23] into r.x[0:7] and i.y[16:23] into r.y[0:7] using 2 ops. +/// +/// @param [in] i The FfxUInt32x2 value to be unpacked. +/// +/// @returns +/// The unpacked FfxFloat16x2. +/// +/// @ingroup GPUCore +FfxFloat16x2 ffxPermuteUByte2Uint2ToFloat16x2(FfxUInt32x2 i) +{ + return FFX_TO_FLOAT16X2(FFX_UINT32_TO_UINT16X2(ffxPackBytesZeroY2ZeroX2(i))) * FFX_BROADCAST_FLOAT16X2(32768.0); +} + +/// Given a FfxUInt32x2 value i and a resulting Float16x2 value r, this function packs i.x[24:31] into r.x[0:7] and i.y[24:31] into r.y[0:7] using 2 ops. +/// +/// @param [in] i The FfxUInt32x2 value to be unpacked. +/// +/// @returns +/// The unpacked FfxFloat16x2. +/// +/// @ingroup GPUCore +FfxFloat16x2 ffxPermuteUByte3Uint2ToFloat16x2(FfxUInt32x2 i) +{ + return FFX_TO_FLOAT16X2(FFX_UINT32_TO_UINT16X2(ffxPackBytesZeroY3ZeroX3(i))) * FFX_BROADCAST_FLOAT16X2(32768.0); +} + +/// Takes two Float16x2 values x and y, normalizes them and builds a single Uint16x2 value in the format {{x0,y0},{x1,y1}}. +/// +/// @param [in] x The first float16x2 value to pack. +/// @param [in] y The second float16x2 value to pack. +/// +/// @returns +/// The packed FfxUInt32x2 value. +/// +/// @ingroup GPUCore +FfxUInt16x2 ffxPackX0Y0X1Y1SignedToUint16x2(FfxFloat16x2 x, FfxFloat16x2 y) +{ + x = x * FFX_BROADCAST_FLOAT16X2(1.0 / 32768.0) + FFX_BROADCAST_FLOAT16X2(0.25 / 32768.0); + y = y * FFX_BROADCAST_FLOAT16X2(1.0 / 32768.0) + FFX_BROADCAST_FLOAT16X2(0.25 / 32768.0); + return FFX_UINT32_TO_UINT16X2(ffxPackBytesY2X2Y0X0(FfxUInt32x2(FFX_UINT16X2_TO_UINT32(FFX_TO_UINT16X2(x)), FFX_UINT16X2_TO_UINT32(FFX_TO_UINT16X2(y))))); +} + +/// Given a FfxUInt32x2 value d, Float16x2 value i and a resulting FfxUInt32x2 value r, this function packs d.x[0:7] into r.x[0:7], +/// d.y[0:7] into r.y[0:7], i.x[8:15] into r.x[8:15], r.y[8:15] and i.y[0:15] into r.x[16:31], r.y[16:31] using 3 ops. +/// +/// Handles signed byte values. +/// +/// @param [in] d The FfxUInt32x2 value to be packed. +/// @param [in] i The FfxFloat16x2 value to be packed. +/// +/// @returns +/// The packed FfxUInt32x2 value. +/// +/// @ingroup GPUCore +FfxUInt32x2 ffxPermuteSByte0Float16x2ToUint2(FfxUInt32x2 d, FfxFloat16x2 i) +{ + FfxUInt32 b = FFX_UINT16X2_TO_UINT32(FFX_TO_UINT16X2(i * FFX_BROADCAST_FLOAT16X2(1.0 / 32768.0) + FFX_BROADCAST_FLOAT16X2(0.25 / 32768.0))); + return FfxUInt32x2(ffxPackBytesY3Y2Y1X0(FfxUInt32x2(d.x, b)), ffxPackBytesY3Y2Y1X2(FfxUInt32x2(d.y, b))); +} + +/// Given a FfxUInt32x2 value d, Float16x2 value i and a resulting FfxUInt32x2 value r, this function packs d.x[0:7] into r.x[8:15], +/// d.y[0:7] into r.y[8:15], i.x[0:7] into r.x[0:7], r.y[0:7] and i.y[0:15] into r.x[16:31], r.y[16:31] using 3 ops. +/// +/// Handles signed byte values. +/// +/// @param [in] d The FfxUInt32x2 value to be packed. +/// @param [in] i The FfxFloat16x2 value to be packed. +/// +/// @returns +/// The packed FfxUInt32x2 value. +/// +/// @ingroup GPUCore +FfxUInt32x2 ffxPermuteSByte1Float16x2ToUint2(FfxUInt32x2 d, FfxFloat16x2 i) +{ + FfxUInt32 b = FFX_UINT16X2_TO_UINT32(FFX_TO_UINT16X2(i * FFX_BROADCAST_FLOAT16X2(1.0 / 32768.0) + FFX_BROADCAST_FLOAT16X2(0.25 / 32768.0))); + return FfxUInt32x2(ffxPackBytesY3Y2X0Y0(FfxUInt32x2(d.x, b)), ffxPackBytesY3Y2X2Y0(FfxUInt32x2(d.y, b))); +} + +/// Given a FfxUInt32x2 value d, Float16x2 value i and a resulting FfxUInt32x2 value r, this function packs d.x[0:7] into r.x[16:23], +/// d.y[0:7] into r.y[16:23], i.x[0:15] into r.x[0:15], r.y[0:15] and i.y[8:15] into r.x[24:31], r.y[24:31] using 3 ops. +/// +/// Handles signed byte values. +/// +/// @param [in] d The FfxUInt32x2 value to be packed. +/// @param [in] i The FfxFloat16x2 value to be packed. +/// +/// @returns +/// The packed FfxUInt32x2 value. +/// +/// @ingroup GPUCore +FfxUInt32x2 ffxPermuteSByte2Float16x2ToUint2(FfxUInt32x2 d, FfxFloat16x2 i) +{ + FfxUInt32 b = FFX_UINT16X2_TO_UINT32(FFX_TO_UINT16X2(i * FFX_BROADCAST_FLOAT16X2(1.0 / 32768.0) + FFX_BROADCAST_FLOAT16X2(0.25 / 32768.0))); + return FfxUInt32x2(ffxPackBytesY3X0Y1Y0(FfxUInt32x2(d.x, b)), ffxPackBytesY3X2Y1Y0(FfxUInt32x2(d.y, b))); +} + +/// Given a FfxUInt32x2 value d, Float16x2 value i and a resulting FfxUInt32x2 value r, this function packs d.x[0:7] into r.x[24:31], +/// d.y[0:7] into r.y[24:31], i.x[0:15] into r.x[0:15], r.y[0:15] and i.y[0:7] into r.x[16:23], r.y[16:23] using 3 ops. +/// +/// Handles signed byte values. +/// +/// @param [in] d The FfxUInt32x2 value to be packed. +/// @param [in] i The FfxFloat16x2 value to be packed. +/// +/// @returns +/// The packed FfxUInt32x2 value. +/// +/// @ingroup GPUCore +FfxUInt32x2 ffxPermuteSByte3Float16x2ToUint2(FfxUInt32x2 d, FfxFloat16x2 i) +{ + FfxUInt32 b = FFX_UINT16X2_TO_UINT32(FFX_TO_UINT16X2(i * FFX_BROADCAST_FLOAT16X2(1.0 / 32768.0) + FFX_BROADCAST_FLOAT16X2(0.25 / 32768.0))); + return FfxUInt32x2(ffxPackBytesX0Y2Y1Y0(FfxUInt32x2(d.x, b)), ffxPackBytesX2Y2Y1Y0(FfxUInt32x2(d.y, b))); +} + +/// Given a FfxUInt32x2 value d, Float16x2 value i and a resulting FfxUInt32x2 value r, this function packs d.x[0:7] into r.x[0:7], +/// d.y[0:7] into r.y[0:7], i.x[8:15] into r.x[8:15], r.y[8:15] and i.y[0:15] into r.x[16:31], r.y[16:31] using 3 ops. +/// +/// Zero-based flips the MSB bit of the byte (making 128 "exact zero" actually zero). +/// This is useful if there is a desire for cleared values to decode as zero. +/// +/// Handles signed byte values. +/// +/// @param [in] d The FfxUInt32x2 value to be packed. +/// @param [in] i The FfxFloat16x2 value to be packed. +/// +/// @returns +/// The packed FfxUInt32x2 value. +/// +/// @ingroup GPUCore +FfxUInt32x2 ffxPermuteZeroBasedSByte0Float16x2ToUint2(FfxUInt32x2 d, FfxFloat16x2 i) +{ + FfxUInt32 b = FFX_UINT16X2_TO_UINT32(FFX_TO_UINT16X2(i * FFX_BROADCAST_FLOAT16X2(1.0 / 32768.0) + FFX_BROADCAST_FLOAT16X2(0.25 / 32768.0))) ^ 0x00800080u; + return FfxUInt32x2(ffxPackBytesY3Y2Y1X0(FfxUInt32x2(d.x, b)), ffxPackBytesY3Y2Y1X2(FfxUInt32x2(d.y, b))); +} + +/// Given a FfxUInt32x2 value d, Float16x2 value i and a resulting FfxUInt32x2 value r, this function packs d.x[0:7] into r.x[8:15], +/// d.y[0:7] into r.y[8:15], i.x[0:7] into r.x[0:7], r.y[0:7] and i.y[0:15] into r.x[16:31], r.y[16:31] using 3 ops. +/// +/// Zero-based flips the MSB bit of the byte (making 128 "exact zero" actually zero). +/// This is useful if there is a desire for cleared values to decode as zero. +/// +/// Handles signed byte values. +/// +/// @param [in] d The FfxUInt32x2 value to be packed. +/// @param [in] i The FfxFloat16x2 value to be packed. +/// +/// @returns +/// The packed FfxUInt32x2 value. +/// +/// @ingroup GPUCore +FfxUInt32x2 ffxPermuteZeroBasedSByte1Float16x2ToUint2(FfxUInt32x2 d, FfxFloat16x2 i) +{ + FfxUInt32 b = FFX_UINT16X2_TO_UINT32(FFX_TO_UINT16X2(i * FFX_BROADCAST_FLOAT16X2(1.0 / 32768.0) + FFX_BROADCAST_FLOAT16X2(0.25 / 32768.0))) ^ 0x00800080u; + return FfxUInt32x2(ffxPackBytesY3Y2X0Y0(FfxUInt32x2(d.x, b)), ffxPackBytesY3Y2X2Y0(FfxUInt32x2(d.y, b))); +} + +/// Given a FfxUInt32x2 value d, Float16x2 value i and a resulting FfxUInt32x2 value r, this function packs d.x[0:7] into r.x[16:23], +/// d.y[0:7] into r.y[16:23], i.x[0:15] into r.x[0:15], r.y[0:15] and i.y[8:15] into r.x[24:31], r.y[24:31] using 3 ops. +/// +/// Zero-based flips the MSB bit of the byte (making 128 "exact zero" actually zero). +/// This is useful if there is a desire for cleared values to decode as zero. +/// +/// Handles signed byte values. +/// +/// @param [in] d The FfxUInt32x2 value to be packed. +/// @param [in] i The FfxFloat16x2 value to be packed. +/// +/// @returns +/// The packed FfxUInt32x2 value. +/// +/// @ingroup GPUCore +FfxUInt32x2 ffxPermuteZeroBasedSByte2Float16x2ToUint2(FfxUInt32x2 d, FfxFloat16x2 i) +{ + FfxUInt32 b = FFX_UINT16X2_TO_UINT32(FFX_TO_UINT16X2(i * FFX_BROADCAST_FLOAT16X2(1.0 / 32768.0) + FFX_BROADCAST_FLOAT16X2(0.25 / 32768.0))) ^ 0x00800080u; + return FfxUInt32x2(ffxPackBytesY3X0Y1Y0(FfxUInt32x2(d.x, b)), ffxPackBytesY3X2Y1Y0(FfxUInt32x2(d.y, b))); +} + +/// Given a FfxUInt32x2 value d, Float16x2 value i and a resulting FfxUInt32x2 value r, this function packs d.x[0:7] into r.x[24:31], +/// d.y[0:7] into r.y[24:31], i.x[0:15] into r.x[0:15], r.y[0:15] and i.y[0:7] into r.x[16:23], r.y[16:23] using 3 ops. +/// +/// Zero-based flips the MSB bit of the byte (making 128 "exact zero" actually zero). +/// This is useful if there is a desire for cleared values to decode as zero. +/// +/// Handles signed byte values. +/// +/// @param [in] d The FfxUInt32x2 value to be packed. +/// @param [in] i The FfxFloat16x2 value to be packed. +/// +/// @returns +/// The packed FfxUInt32x2 value. +/// +/// @ingroup GPUCore +FfxUInt32x2 ffxPermuteZeroBasedSByte3Float16x2ToUint2(FfxUInt32x2 d, FfxFloat16x2 i) +{ + FfxUInt32 b = FFX_UINT16X2_TO_UINT32(FFX_TO_UINT16X2(i * FFX_BROADCAST_FLOAT16X2(1.0 / 32768.0) + FFX_BROADCAST_FLOAT16X2(0.25 / 32768.0))) ^ 0x00800080u; + return FfxUInt32x2(ffxPackBytesX0Y2Y1Y0(FfxUInt32x2(d.x, b)), ffxPackBytesX2Y2Y1Y0(FfxUInt32x2(d.y, b))); +} + +/// Given a FfxUInt32x2 value i and a resulting Float16x2 value r, this function packs i.x[0:7] into r.x[0:7] and i.y[0:7] into r.y[0:7] using 2 ops. +/// +/// Handles signed byte values. +/// +/// @param [in] i The FfxUInt32x2 value to be unpacked. +/// +/// @returns +/// The unpacked FfxFloat16x2. +/// +/// @ingroup GPUCore +FfxFloat16x2 ffxPermuteSByte0Uint2ToFloat16x2(FfxUInt32x2 i) +{ + return FFX_TO_FLOAT16X2(FFX_UINT32_TO_UINT16X2(ffxPackBytesZeroY0ZeroX0(i))) * FFX_BROADCAST_FLOAT16X2(32768.0) - FFX_BROADCAST_FLOAT16X2(0.25); +} + +/// Given a FfxUInt32x2 value i and a resulting Float16x2 value r, this function packs i.x[8:15] into r.x[0:7] and i.y[8:15] into r.y[0:7] using 2 ops. +/// +/// Handles signed byte values. +/// +/// @param [in] i The FfxUInt32x2 value to be unpacked. +/// +/// @returns +/// The unpacked FfxFloat16x2. +/// +/// @ingroup GPUCore +FfxFloat16x2 ffxPermuteSByte1Uint2ToFloat16x2(FfxUInt32x2 i) +{ + return FFX_TO_FLOAT16X2(FFX_UINT32_TO_UINT16X2(ffxPackBytesZeroY1ZeroX1(i))) * FFX_BROADCAST_FLOAT16X2(32768.0) - FFX_BROADCAST_FLOAT16X2(0.25); +} + +/// Given a FfxUInt32x2 value i and a resulting Float16x2 value r, this function packs i.x[16:23] into r.x[0:7] and i.y[16:23] into r.y[0:7] using 2 ops. +/// +/// Handles signed byte values. +/// +/// @param [in] i The FfxUInt32x2 value to be unpacked. +/// +/// @returns +/// The unpacked FfxFloat16x2. +/// +/// @ingroup GPUCore +FfxFloat16x2 ffxPermuteSByte2Uint2ToFloat16x2(FfxUInt32x2 i) +{ + return FFX_TO_FLOAT16X2(FFX_UINT32_TO_UINT16X2(ffxPackBytesZeroY2ZeroX2(i))) * FFX_BROADCAST_FLOAT16X2(32768.0) - FFX_BROADCAST_FLOAT16X2(0.25); +} + +/// Given a FfxUInt32x2 value i and a resulting Float16x2 value r, this function packs i.x[24:31] into r.x[0:7] and i.y[24:31] into r.y[0:7] using 2 ops. +/// +/// Handles signed byte values. +/// +/// @param [in] i The FfxUInt32x2 value to be unpacked. +/// +/// @returns +/// The unpacked FfxFloat16x2. +/// +/// @ingroup GPUCore +FfxFloat16x2 ffxPermuteSByte3Uint2ToFloat16x2(FfxUInt32x2 i) +{ + return FFX_TO_FLOAT16X2(FFX_UINT32_TO_UINT16X2(ffxPackBytesZeroY3ZeroX3(i))) * FFX_BROADCAST_FLOAT16X2(32768.0) - FFX_BROADCAST_FLOAT16X2(0.25); +} + +/// Given a FfxUInt32x2 value i and a resulting Float16x2 value r, this function packs i.x[0:7] into r.x[0:7] and i.y[0:7] into r.y[0:7] using 2 ops. +/// +/// Handles signed byte values. +/// +/// @param [in] i The FfxUInt32x2 value to be unpacked. +/// +/// @returns +/// The unpacked FfxFloat16x2. +/// +/// @ingroup GPUCore +FfxFloat16x2 ffxPermuteZeroBasedSByte0Uint2ToFloat16x2(FfxUInt32x2 i) +{ + return FFX_TO_FLOAT16X2(FFX_UINT32_TO_UINT16X2(ffxPackBytesZeroY0ZeroX0(i) ^ 0x00800080u)) * FFX_BROADCAST_FLOAT16X2(32768.0) - FFX_BROADCAST_FLOAT16X2(0.25); +} + +/// Given a FfxUInt32x2 value i and a resulting Float16x2 value r, this function packs i.x[8:15] into r.x[0:7] and i.y[8:15] into r.y[0:7] using 2 ops. +/// +/// Handles signed byte values. +/// +/// @param [in] i The FfxUInt32x2 value to be unpacked. +/// +/// @returns +/// The unpacked FfxFloat16x2. +/// +/// @ingroup GPUCore +FfxFloat16x2 ffxPermuteZeroBasedSByte1Uint2ToFloat16x2(FfxUInt32x2 i) +{ + return FFX_TO_FLOAT16X2(FFX_UINT32_TO_UINT16X2(ffxPackBytesZeroY1ZeroX1(i) ^ 0x00800080u)) * FFX_BROADCAST_FLOAT16X2(32768.0) - FFX_BROADCAST_FLOAT16X2(0.25); +} + +/// Given a FfxUInt32x2 value i and a resulting Float16x2 value r, this function packs i.x[16:23] into r.x[0:7] and i.y[16:23] into r.y[0:7] using 2 ops. +/// +/// Handles signed byte values. +/// +/// @param [in] i The FfxUInt32x2 value to be unpacked. +/// +/// @returns +/// The unpacked FfxFloat16x2. +/// +/// @ingroup GPUCore +FfxFloat16x2 ffxPermuteZeroBasedSByte2Uint2ToFloat16x2(FfxUInt32x2 i) +{ + return FFX_TO_FLOAT16X2(FFX_UINT32_TO_UINT16X2(ffxPackBytesZeroY2ZeroX2(i) ^ 0x00800080u)) * FFX_BROADCAST_FLOAT16X2(32768.0) - FFX_BROADCAST_FLOAT16X2(0.25); +} + +/// Given a FfxUInt32x2 value i and a resulting Float16x2 value r, this function packs i.x[24:31] into r.x[0:7] and i.y[24:31] into r.y[0:7] using 2 ops. +/// +/// Handles signed byte values. +/// +/// @param [in] i The FfxUInt32x2 value to be unpacked. +/// +/// @returns +/// The unpacked FfxFloat16x2. +/// +/// @ingroup GPUCore +FfxFloat16x2 ffxPermuteZeroBasedSByte3Uint2ToFloat16x2(FfxUInt32x2 i) +{ + return FFX_TO_FLOAT16X2(FFX_UINT32_TO_UINT16X2(ffxPackBytesZeroY3ZeroX3(i) ^ 0x00800080u)) * FFX_BROADCAST_FLOAT16X2(32768.0) - FFX_BROADCAST_FLOAT16X2(0.25); +} + +/// Calculate a half-precision low-quality approximation for the square root of a value. +/// +/// For additional information on the approximation family of functions, you can refer to Michal Drobot's excellent +/// presentation materials: +/// +/// - https://michaldrobot.files.wordpress.com/2014/05/gcn_alu_opt_digitaldragons2014.pdf +/// - https://github.com/michaldrobot/ShaderFastLibs/blob/master/ShaderFastMathLib.h +/// +/// @param [in] a The value to calculate an approximate to the square root for. +/// +/// @returns +/// An approximation of the square root, estimated to low quality. +/// +/// @ingroup GPUCore +FfxFloat16 ffxApproximateSqrtHalf(FfxFloat16 a) +{ + return FFX_TO_FLOAT16((FFX_TO_UINT16(a) >> FFX_BROADCAST_UINT16(1)) + FFX_BROADCAST_UINT16(0x1de2)); +} + +/// Calculate a half-precision low-quality approximation for the square root of a value. +/// +/// For additional information on the approximation family of functions, you can refer to Michal Drobot's excellent +/// presentation materials: +/// +/// - https://michaldrobot.files.wordpress.com/2014/05/gcn_alu_opt_digitaldragons2014.pdf +/// - https://github.com/michaldrobot/ShaderFastLibs/blob/master/ShaderFastMathLib.h +/// +/// @param [in] a The value to calculate an approximate to the square root for. +/// +/// @returns +/// An approximation of the square root, estimated to low quality. +/// +/// @ingroup GPUCore +FfxFloat16x2 ffxApproximateSqrtHalf(FfxFloat16x2 a) +{ + return FFX_TO_FLOAT16X2((FFX_TO_UINT16X2(a) >> FFX_BROADCAST_UINT16X2(1)) + FFX_BROADCAST_UINT16X2(0x1de2)); +} + +/// Calculate a half-precision low-quality approximation for the square root of a value. +/// +/// For additional information on the approximation family of functions, you can refer to Michal Drobot's excellent +/// presentation materials: +/// +/// - https://michaldrobot.files.wordpress.com/2014/05/gcn_alu_opt_digitaldragons2014.pdf +/// - https://github.com/michaldrobot/ShaderFastLibs/blob/master/ShaderFastMathLib.h +/// +/// @param [in] a The value to calculate an approximate to the square root for. +/// +/// @returns +/// An approximation of the square root, estimated to low quality. +/// +/// @ingroup GPUCore +FfxFloat16x3 ffxApproximateSqrtHalf(FfxFloat16x3 a) +{ + return FFX_TO_FLOAT16X3((FFX_TO_UINT16X3(a) >> FFX_BROADCAST_UINT16X3(1)) + FFX_BROADCAST_UINT16X3(0x1de2)); +} + +/// Calculate a half-precision low-quality approximation for the reciprocal of a value. +/// +/// For additional information on the approximation family of functions, you can refer to Michal Drobot's excellent +/// presentation materials: +/// +/// - https://michaldrobot.files.wordpress.com/2014/05/gcn_alu_opt_digitaldragons2014.pdf +/// - https://github.com/michaldrobot/ShaderFastLibs/blob/master/ShaderFastMathLib.h +/// +/// @param [in] a The value to calculate an approximate to the reciprocal for. +/// +/// @returns +/// An approximation of the reciprocal, estimated to low quality. +/// +/// @ingroup GPUCore +FfxFloat16 ffxApproximateReciprocalHalf(FfxFloat16 a) +{ + return FFX_TO_FLOAT16(FFX_BROADCAST_UINT16(0x7784) - FFX_TO_UINT16(a)); +} + +/// Calculate a half-precision low-quality approximation for the reciprocal of a value. +/// +/// For additional information on the approximation family of functions, you can refer to Michal Drobot's excellent +/// presentation materials: +/// +/// - https://michaldrobot.files.wordpress.com/2014/05/gcn_alu_opt_digitaldragons2014.pdf +/// - https://github.com/michaldrobot/ShaderFastLibs/blob/master/ShaderFastMathLib.h +/// +/// @param [in] a The value to calculate an approximate to the reciprocal for. +/// +/// @returns +/// An approximation of the reciprocal, estimated to low quality. +/// +/// @ingroup GPUCore +FfxFloat16x2 ffxApproximateReciprocalHalf(FfxFloat16x2 a) +{ + return FFX_TO_FLOAT16X2(FFX_BROADCAST_UINT16X2(0x7784) - FFX_TO_UINT16X2(a)); +} + +/// Calculate a half-precision low-quality approximation for the reciprocal of a value. +/// +/// For additional information on the approximation family of functions, you can refer to Michal Drobot's excellent +/// presentation materials: +/// +/// - https://michaldrobot.files.wordpress.com/2014/05/gcn_alu_opt_digitaldragons2014.pdf +/// - https://github.com/michaldrobot/ShaderFastLibs/blob/master/ShaderFastMathLib.h +/// +/// @param [in] a The value to calculate an approximate to the reciprocal for. +/// +/// @returns +/// An approximation of the reciprocal, estimated to low quality. +/// +/// @ingroup GPUCore +FfxFloat16x3 ffxApproximateReciprocalHalf(FfxFloat16x3 a) +{ + return FFX_TO_FLOAT16X3(FFX_BROADCAST_UINT16X3(0x7784) - FFX_TO_UINT16X3(a)); +} + +/// Calculate a half-precision low-quality approximation for the reciprocal of a value. +/// +/// For additional information on the approximation family of functions, you can refer to Michal Drobot's excellent +/// presentation materials: +/// +/// - https://michaldrobot.files.wordpress.com/2014/05/gcn_alu_opt_digitaldragons2014.pdf +/// - https://github.com/michaldrobot/ShaderFastLibs/blob/master/ShaderFastMathLib.h +/// +/// @param [in] a The value to calculate an approximate to the reciprocal for. +/// +/// @returns +/// An approximation of the reciprocal, estimated to low quality. +/// +/// @ingroup GPUCore +FfxFloat16x4 ffxApproximateReciprocalHalf(FfxFloat16x4 a) +{ + return FFX_TO_FLOAT16X4(FFX_BROADCAST_UINT16X4(0x7784) - FFX_TO_UINT16X4(a)); +} + +/// Calculate a half-precision medium-quality approximation for the reciprocal of a value. +/// +/// For additional information on the approximation family of functions, you can refer to Michal Drobot's excellent +/// presentation materials: +/// +/// - https://michaldrobot.files.wordpress.com/2014/05/gcn_alu_opt_digitaldragons2014.pdf +/// - https://github.com/michaldrobot/ShaderFastLibs/blob/master/ShaderFastMathLib.h +/// +/// @param [in] a The value to calculate an approximate to the reciprocal for. +/// +/// @returns +/// An approximation of the reciprocal, estimated to medium quality. +/// +/// @ingroup GPUCore +FfxFloat16 ffxApproximateReciprocalMediumHalf(FfxFloat16 a) +{ + FfxFloat16 b = FFX_TO_FLOAT16(FFX_BROADCAST_UINT16(0x778d) - FFX_TO_UINT16(a)); + return b * (-b * a + FFX_BROADCAST_FLOAT16(2.0)); +} + +/// Calculate a half-precision medium-quality approximation for the reciprocal of a value. +/// +/// For additional information on the approximation family of functions, you can refer to Michal Drobot's excellent +/// presentation materials: +/// +/// - https://michaldrobot.files.wordpress.com/2014/05/gcn_alu_opt_digitaldragons2014.pdf +/// - https://github.com/michaldrobot/ShaderFastLibs/blob/master/ShaderFastMathLib.h +/// +/// @param [in] a The value to calculate an approximate to the reciprocal for. +/// +/// @returns +/// An approximation of the reciprocal, estimated to medium quality. +/// +/// @ingroup GPUCore +FfxFloat16x2 ffxApproximateReciprocalMediumHalf(FfxFloat16x2 a) +{ + FfxFloat16x2 b = FFX_TO_FLOAT16X2(FFX_BROADCAST_UINT16X2(0x778d) - FFX_TO_UINT16X2(a)); + return b * (-b * a + FFX_BROADCAST_FLOAT16X2(2.0)); +} + +/// Calculate a half-precision medium-quality approximation for the reciprocal of a value. +/// +/// For additional information on the approximation family of functions, you can refer to Michal Drobot's excellent +/// presentation materials: +/// +/// - https://michaldrobot.files.wordpress.com/2014/05/gcn_alu_opt_digitaldragons2014.pdf +/// - https://github.com/michaldrobot/ShaderFastLibs/blob/master/ShaderFastMathLib.h +/// +/// @param [in] a The value to calculate an approximate to the reciprocal for. +/// +/// @returns +/// An approximation of the reciprocal, estimated to medium quality. +/// +/// @ingroup GPUCore +FfxFloat16x3 ffxApproximateReciprocalMediumHalf(FfxFloat16x3 a) +{ + FfxFloat16x3 b = FFX_TO_FLOAT16X3(FFX_BROADCAST_UINT16X3(0x778d) - FFX_TO_UINT16X3(a)); + return b * (-b * a + FFX_BROADCAST_FLOAT16X3(2.0)); +} + +/// Calculate a half-precision medium-quality approximation for the reciprocal of a value. +/// +/// For additional information on the approximation family of functions, you can refer to Michal Drobot's excellent +/// presentation materials: +/// +/// - https://michaldrobot.files.wordpress.com/2014/05/gcn_alu_opt_digitaldragons2014.pdf +/// - https://github.com/michaldrobot/ShaderFastLibs/blob/master/ShaderFastMathLib.h +/// +/// @param [in] a The value to calculate an approximate to the reciprocal for. +/// +/// @returns +/// An approximation of the reciprocal, estimated to medium quality. +/// +/// @ingroup GPUCore +FfxFloat16x4 ffxApproximateReciprocalMediumHalf(FfxFloat16x4 a) +{ + FfxFloat16x4 b = FFX_TO_FLOAT16X4(FFX_BROADCAST_UINT16X4(0x778d) - FFX_TO_UINT16X4(a)); + return b * (-b * a + FFX_BROADCAST_FLOAT16X4(2.0)); +} + +/// Calculate a half-precision low-quality approximation for the reciprocal of the square root of a value. +/// +/// For additional information on the approximation family of functions, you can refer to Michal Drobot's excellent +/// presentation materials: +/// +/// - https://michaldrobot.files.wordpress.com/2014/05/gcn_alu_opt_digitaldragons2014.pdf +/// - https://github.com/michaldrobot/ShaderFastLibs/blob/master/ShaderFastMathLib.h +/// +/// @param [in] a The value to calculate an approximate to the reciprocal of the square root for. +/// +/// @returns +/// An approximation of the reciprocal of the square root, estimated to low quality. +/// +/// @ingroup GPUCore +FfxFloat16 ffxApproximateReciprocalSquareRootHalf(FfxFloat16 a) +{ + return FFX_TO_FLOAT16(FFX_BROADCAST_UINT16(0x59a3) - (FFX_TO_UINT16(a) >> FFX_BROADCAST_UINT16(1))); +} + +/// Calculate a half-precision low-quality approximation for the reciprocal of the square root of a value. +/// +/// For additional information on the approximation family of functions, you can refer to Michal Drobot's excellent +/// presentation materials: +/// +/// - https://michaldrobot.files.wordpress.com/2014/05/gcn_alu_opt_digitaldragons2014.pdf +/// - https://github.com/michaldrobot/ShaderFastLibs/blob/master/ShaderFastMathLib.h +/// +/// @param [in] a The value to calculate an approximate to the reciprocal of the square root for. +/// +/// @returns +/// An approximation of the reciprocal of the square root, estimated to low quality. +/// +/// @ingroup GPUCore +FfxFloat16x2 ffxApproximateReciprocalSquareRootHalf(FfxFloat16x2 a) +{ + return FFX_TO_FLOAT16X2(FFX_BROADCAST_UINT16X2(0x59a3) - (FFX_TO_UINT16X2(a) >> FFX_BROADCAST_UINT16X2(1))); +} + +/// Calculate a half-precision low-quality approximation for the reciprocal of the square root of a value. +/// +/// For additional information on the approximation family of functions, you can refer to Michal Drobot's excellent +/// presentation materials: +/// +/// - https://michaldrobot.files.wordpress.com/2014/05/gcn_alu_opt_digitaldragons2014.pdf +/// - https://github.com/michaldrobot/ShaderFastLibs/blob/master/ShaderFastMathLib.h +/// +/// @param [in] a The value to calculate an approximate to the reciprocal of the square root for. +/// +/// @returns +/// An approximation of the reciprocal of the square root, estimated to low quality. +/// +/// @ingroup GPUCore +FfxFloat16x3 ffxApproximateReciprocalSquareRootHalf(FfxFloat16x3 a) +{ + return FFX_TO_FLOAT16X3(FFX_BROADCAST_UINT16X3(0x59a3) - (FFX_TO_UINT16X3(a) >> FFX_BROADCAST_UINT16X3(1))); +} + +/// Calculate a half-precision low-quality approximation for the reciprocal of the square root of a value. +/// +/// For additional information on the approximation family of functions, you can refer to Michal Drobot's excellent +/// presentation materials: +/// +/// - https://michaldrobot.files.wordpress.com/2014/05/gcn_alu_opt_digitaldragons2014.pdf +/// - https://github.com/michaldrobot/ShaderFastLibs/blob/master/ShaderFastMathLib.h +/// +/// @param [in] a The value to calculate an approximate to the reciprocal of the square root for. +/// +/// @returns +/// An approximation of the reciprocal of the square root, estimated to low quality. +/// +/// @ingroup GPUCore +FfxFloat16x4 ffxApproximateReciprocalSquareRootHalf(FfxFloat16x4 a) +{ + return FFX_TO_FLOAT16X4(FFX_BROADCAST_UINT16X4(0x59a3) - (FFX_TO_UINT16X4(a) >> FFX_BROADCAST_UINT16X4(1))); +} + +/// An approximation of sine. +/// +/// Valid input range is {-1 to 1} representing {0 to 2 pi}, and the output range +/// is {-1/4 to 1/4} representing {-1 to 1}. +/// +/// @param [in] x The value to calculate approximate sine for. +/// +/// @returns +/// The approximate sine of value. +FfxFloat16 ffxParabolicSinHalf(FfxFloat16 x) +{ + return x * abs(x) - x; +} + +/// An approximation of sine. +/// +/// Valid input range is {-1 to 1} representing {0 to 2 pi}, and the output range +/// is {-1/4 to 1/4} representing {-1 to 1}. +/// +/// @param [in] x The value to calculate approximate sine for. +/// +/// @returns +/// The approximate sine of value. +FfxFloat16x2 ffxParabolicSinHalf(FfxFloat16x2 x) +{ + return x * abs(x) - x; +} + +/// An approximation of cosine. +/// +/// Valid input range is {-1 to 1} representing {0 to 2 pi}, and the output range +/// is {-1/4 to 1/4} representing {-1 to 1}. +/// +/// @param [in] x The value to calculate approximate cosine for. +/// +/// @returns +/// The approximate cosine of value. +FfxFloat16 ffxParabolicCosHalf(FfxFloat16 x) +{ + x = ffxFract(x * FFX_BROADCAST_FLOAT16(0.5) + FFX_BROADCAST_FLOAT16(0.75)); + x = x * FFX_BROADCAST_FLOAT16(2.0) - FFX_BROADCAST_FLOAT16(1.0); + return ffxParabolicSinHalf(x); +} + +/// An approximation of cosine. +/// +/// Valid input range is {-1 to 1} representing {0 to 2 pi}, and the output range +/// is {-1/4 to 1/4} representing {-1 to 1}. +/// +/// @param [in] x The value to calculate approximate cosine for. +/// +/// @returns +/// The approximate cosine of value. +FfxFloat16x2 ffxParabolicCosHalf(FfxFloat16x2 x) +{ + x = ffxFract(x * FFX_BROADCAST_FLOAT16X2(0.5) + FFX_BROADCAST_FLOAT16X2(0.75)); + x = x * FFX_BROADCAST_FLOAT16X2(2.0) - FFX_BROADCAST_FLOAT16X2(1.0); + return ffxParabolicSinHalf(x); +} + +/// An approximation of both sine and cosine. +/// +/// Valid input range is {-1 to 1} representing {0 to 2 pi}, and the output range +/// is {-1/4 to 1/4} representing {-1 to 1}. +/// +/// @param [in] x The value to calculate approximate cosine for. +/// +/// @returns +/// A FfxFloat32x2 containing approximations of both sine and cosine of value. +FfxFloat16x2 ffxParabolicSinCosHalf(FfxFloat16 x) +{ + FfxFloat16 y = ffxFract(x * FFX_BROADCAST_FLOAT16(0.5) + FFX_BROADCAST_FLOAT16(0.75)); + y = y * FFX_BROADCAST_FLOAT16(2.0) - FFX_BROADCAST_FLOAT16(1.0); + return ffxParabolicSinHalf(FfxFloat16x2(x, y)); +} + +/// Conditional free logic AND operation using two half-precision values. +/// +/// @param [in] x The first value to be fed into the AND operator. +/// @param [in] y The second value to be fed into the AND operator. +/// +/// @returns +/// Result of the AND operation. +/// +/// @ingroup GPUCore +FfxUInt16 ffxZeroOneAndHalf(FfxUInt16 x, FfxUInt16 y) +{ + return min(x, y); +} + +/// Conditional free logic AND operation using two half-precision values. +/// +/// @param [in] x The first value to be fed into the AND operator. +/// @param [in] y The second value to be fed into the AND operator. +/// +/// @returns +/// Result of the AND operation. +/// +/// @ingroup GPUCore +FfxUInt16x2 ffxZeroOneAndHalf(FfxUInt16x2 x, FfxUInt16x2 y) +{ + return min(x, y); +} + +/// Conditional free logic AND operation using two half-precision values. +/// +/// @param [in] x The first value to be fed into the AND operator. +/// @param [in] y The second value to be fed into the AND operator. +/// +/// @returns +/// Result of the AND operation. +/// +/// @ingroup GPUCore +FfxUInt16x3 ffxZeroOneAndHalf(FfxUInt16x3 x, FfxUInt16x3 y) +{ + return min(x, y); +} + +/// Conditional free logic AND operation using two half-precision values. +/// +/// @param [in] x The first value to be fed into the AND operator. +/// @param [in] y The second value to be fed into the AND operator. +/// +/// @returns +/// Result of the AND operation. +/// +/// @ingroup GPUCore +FfxUInt16x4 ffxZeroOneAndHalf(FfxUInt16x4 x, FfxUInt16x4 y) +{ + return min(x, y); +} + +/// Conditional free logic NOT operation using two half-precision values. +/// +/// @param [in] x The first value to be fed into the NOT operator. +/// @param [in] y The second value to be fed into the NOT operator. +/// +/// @returns +/// Result of the NOT operation. +/// +/// @ingroup GPUCore +FfxUInt16 ffxZeroOneNotHalf(FfxUInt16 x) +{ + return x ^ FFX_BROADCAST_UINT16(1); +} + +/// Conditional free logic NOT operation using two half-precision values. +/// +/// @param [in] x The first value to be fed into the NOT operator. +/// @param [in] y The second value to be fed into the NOT operator. +/// +/// @returns +/// Result of the NOT operation. +/// +/// @ingroup GPUCore +FfxUInt16x2 ffxZeroOneNotHalf(FfxUInt16x2 x) +{ + return x ^ FFX_BROADCAST_UINT16X2(1); +} + +/// Conditional free logic NOT operation using two half-precision values. +/// +/// @param [in] x The first value to be fed into the NOT operator. +/// @param [in] y The second value to be fed into the NOT operator. +/// +/// @returns +/// Result of the NOT operation. +/// +/// @ingroup GPUCore +FfxUInt16x3 ffxZeroOneNotHalf(FfxUInt16x3 x) +{ + return x ^ FFX_BROADCAST_UINT16X3(1); +} + +/// Conditional free logic NOT operation using two half-precision values. +/// +/// @param [in] x The first value to be fed into the NOT operator. +/// @param [in] y The second value to be fed into the NOT operator. +/// +/// @returns +/// Result of the NOT operation. +/// +/// @ingroup GPUCore +FfxUInt16x4 ffxZeroOneNotHalf(FfxUInt16x4 x) +{ + return x ^ FFX_BROADCAST_UINT16X4(1); +} + +/// Conditional free logic OR operation using two half-precision values. +/// +/// @param [in] x The first value to be fed into the OR operator. +/// @param [in] y The second value to be fed into the OR operator. +/// +/// @returns +/// Result of the OR operation. +/// +/// @ingroup GPUCore +FfxUInt16 ffxZeroOneOrHalf(FfxUInt16 x, FfxUInt16 y) +{ + return max(x, y); +} + +/// Conditional free logic OR operation using two half-precision values. +/// +/// @param [in] x The first value to be fed into the OR operator. +/// @param [in] y The second value to be fed into the OR operator. +/// +/// @returns +/// Result of the OR operation. +/// +/// @ingroup GPUCore +FfxUInt16x2 ffxZeroOneOrHalf(FfxUInt16x2 x, FfxUInt16x2 y) +{ + return max(x, y); +} + +/// Conditional free logic OR operation using two half-precision values. +/// +/// @param [in] x The first value to be fed into the OR operator. +/// @param [in] y The second value to be fed into the OR operator. +/// +/// @returns +/// Result of the OR operation. +/// +/// @ingroup GPUCore +FfxUInt16x3 ffxZeroOneOrHalf(FfxUInt16x3 x, FfxUInt16x3 y) +{ + return max(x, y); +} + +/// Conditional free logic OR operation using two half-precision values. +/// +/// @param [in] x The first value to be fed into the OR operator. +/// @param [in] y The second value to be fed into the OR operator. +/// +/// @returns +/// Result of the OR operation. +/// +/// @ingroup GPUCore +FfxUInt16x4 ffxZeroOneOrHalf(FfxUInt16x4 x, FfxUInt16x4 y) +{ + return max(x, y); +} + +/// Convert a half-precision FfxFloat32 value between 0.0f and 1.0f to a half-precision Uint. +/// +/// @param [in] x The value to converted to a Uint. +/// +/// @returns +/// The converted Uint value. +/// +/// @ingroup GPUCore +FfxUInt16 ffxZeroOneFloat16ToUint16(FfxFloat16 x) +{ + return FFX_TO_UINT16(x * FFX_TO_FLOAT16(FFX_TO_UINT16(1))); +} + +/// Convert a half-precision FfxFloat32 value between 0.0f and 1.0f to a half-precision Uint. +/// +/// @param [in] x The value to converted to a Uint. +/// +/// @returns +/// The converted Uint value. +/// +/// @ingroup GPUCore +FfxUInt16x2 ffxZeroOneFloat16x2ToUint16x2(FfxFloat16x2 x) +{ + return FFX_TO_UINT16X2(x * FFX_TO_FLOAT16X2(FfxUInt16x2(1, 1))); +} + +/// Convert a half-precision FfxFloat32 value between 0.0f and 1.0f to a half-precision Uint. +/// +/// @param [in] x The value to converted to a Uint. +/// +/// @returns +/// The converted Uint value. +/// +/// @ingroup GPUCore +FfxUInt16x3 ffxZeroOneFloat16x3ToUint16x3(FfxFloat16x3 x) +{ + return FFX_TO_UINT16X3(x * FFX_TO_FLOAT16X3(FfxUInt16x3(1, 1, 1))); +} + +/// Convert a half-precision FfxFloat32 value between 0.0f and 1.0f to a half-precision Uint. +/// +/// @param [in] x The value to converted to a Uint. +/// +/// @returns +/// The converted Uint value. +/// +/// @ingroup GPUCore +FfxUInt16x4 ffxZeroOneFloat16x4ToUint16x4(FfxFloat16x4 x) +{ + return FFX_TO_UINT16X4(x * FFX_TO_FLOAT16X4(FfxUInt16x4(1, 1, 1, 1))); +} + +/// Convert a half-precision FfxUInt32 value between 0 and 1 to a half-precision FfxFloat32. +/// +/// @param [in] x The value to converted to a half-precision FfxFloat32. +/// +/// @returns +/// The converted half-precision FfxFloat32 value. +/// +/// @ingroup GPUCore +FfxFloat16 ffxZeroOneUint16ToFloat16(FfxUInt16 x) +{ + return FFX_TO_FLOAT16(x * FFX_TO_UINT16(FFX_TO_FLOAT16(1.0))); +} + +/// Convert a half-precision FfxUInt32 value between 0 and 1 to a half-precision FfxFloat32. +/// +/// @param [in] x The value to converted to a half-precision FfxFloat32. +/// +/// @returns +/// The converted half-precision FfxFloat32 value. +/// +/// @ingroup GPUCore +FfxFloat16x2 ffxZeroOneUint16x2ToFloat16x2(FfxUInt16x2 x) +{ + return FFX_TO_FLOAT16X2(x * FFX_TO_UINT16X2(FfxUInt16x2(FFX_TO_FLOAT16(1.0), FFX_TO_FLOAT16(1.0)))); +} + +/// Convert a half-precision FfxUInt32 value between 0 and 1 to a half-precision FfxFloat32. +/// +/// @param [in] x The value to converted to a half-precision FfxFloat32. +/// +/// @returns +/// The converted half-precision FfxFloat32 value. +/// +/// @ingroup GPUCore +FfxFloat16x3 ffxZeroOneUint16x3ToFloat16x3(FfxUInt16x3 x) +{ + return FFX_TO_FLOAT16X3(x * FFX_TO_UINT16X3(FfxUInt16x3(FFX_TO_FLOAT16(1.0), FFX_TO_FLOAT16(1.0), FFX_TO_FLOAT16(1.0)))); +} + +/// Convert a half-precision FfxUInt32 value between 0 and 1 to a half-precision FfxFloat32. +/// +/// @param [in] x The value to converted to a half-precision FfxFloat32. +/// +/// @returns +/// The converted half-precision FfxFloat32 value. +/// +/// @ingroup GPUCore +FfxFloat16x4 ffxZeroOneUint16x4ToFloat16x4(FfxUInt16x4 x) +{ + return FFX_TO_FLOAT16X4(x * FFX_TO_UINT16X4(FfxUInt16x4(FFX_TO_FLOAT16(1.0), FFX_TO_FLOAT16(1.0), FFX_TO_FLOAT16(1.0), FFX_TO_FLOAT16(1.0)))); +} + +/// Conditional free logic AND operation using two half-precision values. +/// +/// @param [in] x The first value to be fed into the AND operator. +/// @param [in] y The second value to be fed into the AND operator. +/// +/// @returns +/// Result of the AND operation. +/// +/// @ingroup GPUCore +FfxFloat16 ffxZeroOneAndHalf(FfxFloat16 x, FfxFloat16 y) +{ + return min(x, y); +} + +/// Conditional free logic AND operation using two half-precision values. +/// +/// @param [in] x The first value to be fed into the AND operator. +/// @param [in] y The second value to be fed into the AND operator. +/// +/// @returns +/// Result of the AND operation. +/// +/// @ingroup GPUCore +FfxFloat16x2 ffxZeroOneAndHalf(FfxFloat16x2 x, FfxFloat16x2 y) +{ + return min(x, y); +} + +/// Conditional free logic AND operation using two half-precision values. +/// +/// @param [in] x The first value to be fed into the AND operator. +/// @param [in] y The second value to be fed into the AND operator. +/// +/// @returns +/// Result of the AND operation. +/// +/// @ingroup GPUCore +FfxFloat16x3 ffxZeroOneAndHalf(FfxFloat16x3 x, FfxFloat16x3 y) +{ + return min(x, y); +} + +/// Conditional free logic AND operation using two half-precision values. +/// +/// @param [in] x The first value to be fed into the AND operator. +/// @param [in] y The second value to be fed into the AND operator. +/// +/// @returns +/// Result of the AND operation. +/// +/// @ingroup GPUCore +FfxFloat16x4 ffxZeroOneAndHalf(FfxFloat16x4 x, FfxFloat16x4 y) +{ + return min(x, y); +} + +/// Conditional free logic AND NOT operation using two half-precision values. +/// +/// @param [in] x The first value to be fed into the AND NOT operator. +/// @param [in] y The second value to be fed into the AND NOT operator. +/// +/// @returns +/// Result of the AND NOT operation. +/// +/// @ingroup GPUCore +FfxFloat16 ffxSignedZeroOneAndOrHalf(FfxFloat16 x, FfxFloat16 y) +{ + return (-x) * y + FFX_BROADCAST_FLOAT16(1.0); +} + +/// Conditional free logic AND NOT operation using two half-precision values. +/// +/// @param [in] x The first value to be fed into the AND NOT operator. +/// @param [in] y The second value to be fed into the AND NOT operator. +/// +/// @returns +/// Result of the AND NOT operation. +/// +/// @ingroup GPUCore +FfxFloat16x2 ffxSignedZeroOneAndOrHalf(FfxFloat16x2 x, FfxFloat16x2 y) +{ + return (-x) * y + FFX_BROADCAST_FLOAT16X2(1.0); +} + +/// Conditional free logic AND NOT operation using two half-precision values. +/// +/// @param [in] x The first value to be fed into the AND NOT operator. +/// @param [in] y The second value to be fed into the AND NOT operator. +/// +/// @returns +/// Result of the AND NOT operation. +/// +/// @ingroup GPUCore +FfxFloat16x3 ffxSignedZeroOneAndOrHalf(FfxFloat16x3 x, FfxFloat16x3 y) +{ + return (-x) * y + FFX_BROADCAST_FLOAT16X3(1.0); +} + +/// Conditional free logic AND NOT operation using two half-precision values. +/// +/// @param [in] x The first value to be fed into the AND NOT operator. +/// @param [in] y The second value to be fed into the AND NOT operator. +/// +/// @returns +/// Result of the AND NOT operation. +/// +/// @ingroup GPUCore +FfxFloat16x4 ffxSignedZeroOneAndOrHalf(FfxFloat16x4 x, FfxFloat16x4 y) +{ + return (-x) * y + FFX_BROADCAST_FLOAT16X4(1.0); +} + +/// Conditional free logic AND operation using two half-precision values followed by +/// a NOT operation using the resulting value and a third half-precision value. +/// +/// @param [in] x The first value to be fed into the AND operator. +/// @param [in] y The second value to be fed into the AND operator. +/// @param [in] z The second value to be fed into the OR operator. +/// +/// @returns +/// Result of the AND OR operation. +/// +/// @ingroup GPUCore +FfxFloat16 ffxZeroOneAndOrHalf(FfxFloat16 x, FfxFloat16 y, FfxFloat16 z) +{ + return ffxSaturate(x * y + z); +} + +/// Conditional free logic AND operation using two half-precision values followed by +/// a NOT operation using the resulting value and a third half-precision value. +/// +/// @param [in] x The first value to be fed into the AND operator. +/// @param [in] y The second value to be fed into the AND operator. +/// @param [in] z The second value to be fed into the OR operator. +/// +/// @returns +/// Result of the AND OR operation. +/// +/// @ingroup GPUCore +FfxFloat16x2 ffxZeroOneAndOrHalf(FfxFloat16x2 x, FfxFloat16x2 y, FfxFloat16x2 z) +{ + return ffxSaturate(x * y + z); +} + +/// Conditional free logic AND operation using two half-precision values followed by +/// a NOT operation using the resulting value and a third half-precision value. +/// +/// @param [in] x The first value to be fed into the AND operator. +/// @param [in] y The second value to be fed into the AND operator. +/// @param [in] z The second value to be fed into the OR operator. +/// +/// @returns +/// Result of the AND OR operation. +/// +/// @ingroup GPUCore +FfxFloat16x3 ffxZeroOneAndOrHalf(FfxFloat16x3 x, FfxFloat16x3 y, FfxFloat16x3 z) +{ + return ffxSaturate(x * y + z); +} + +/// Conditional free logic AND operation using two half-precision values followed by +/// a NOT operation using the resulting value and a third half-precision value. +/// +/// @param [in] x The first value to be fed into the AND operator. +/// @param [in] y The second value to be fed into the AND operator. +/// @param [in] z The second value to be fed into the OR operator. +/// +/// @returns +/// Result of the AND OR operation. +/// +/// @ingroup GPUCore +FfxFloat16x4 ffxZeroOneAndOrHalf(FfxFloat16x4 x, FfxFloat16x4 y, FfxFloat16x4 z) +{ + return ffxSaturate(x * y + z); +} + +/// Given a half-precision value, returns 1.0 if greater than zero and 0.0 if not. +/// +/// @param [in] x The value to be compared. +/// +/// @returns +/// Result of the greater than zero comparison. +/// +/// @ingroup GPUCore +FfxFloat16 ffxZeroOneIsGreaterThanZeroHalf(FfxFloat16 x) +{ + return ffxSaturate(x * FFX_BROADCAST_FLOAT16(FFX_POSITIVE_INFINITY_HALF)); +} + +/// Given a half-precision value, returns 1.0 if greater than zero and 0.0 if not. +/// +/// @param [in] x The value to be compared. +/// +/// @returns +/// Result of the greater than zero comparison. +/// +/// @ingroup GPUCore +FfxFloat16x2 ffxZeroOneIsGreaterThanZeroHalf(FfxFloat16x2 x) +{ + return ffxSaturate(x * FFX_BROADCAST_FLOAT16X2(FFX_POSITIVE_INFINITY_HALF)); +} + +/// Given a half-precision value, returns 1.0 if greater than zero and 0.0 if not. +/// +/// @param [in] x The value to be compared. +/// +/// @returns +/// Result of the greater than zero comparison. +/// +/// @ingroup GPUCore +FfxFloat16x3 ffxZeroOneIsGreaterThanZeroHalf(FfxFloat16x3 x) +{ + return ffxSaturate(x * FFX_BROADCAST_FLOAT16X3(FFX_POSITIVE_INFINITY_HALF)); +} + +/// Given a half-precision value, returns 1.0 if greater than zero and 0.0 if not. +/// +/// @param [in] x The value to be compared. +/// +/// @returns +/// Result of the greater than zero comparison. +/// +/// @ingroup GPUCore +FfxFloat16x4 ffxZeroOneIsGreaterThanZeroHalf(FfxFloat16x4 x) +{ + return ffxSaturate(x * FFX_BROADCAST_FLOAT16X4(FFX_POSITIVE_INFINITY_HALF)); +} + +/// Conditional free logic signed NOT operation using two half-precision FfxFloat32 values. +/// +/// @param [in] x The first value to be fed into the AND OR operator. +/// +/// @returns +/// Result of the AND OR operation. +/// +/// @ingroup GPUCore +FfxFloat16 ffxZeroOneNotHalf(FfxFloat16 x) +{ + return FFX_BROADCAST_FLOAT16(1.0) - x; +} + +/// Conditional free logic signed NOT operation using two half-precision FfxFloat32 values. +/// +/// @param [in] x The first value to be fed into the AND OR operator. +/// +/// @returns +/// Result of the AND OR operation. +/// +/// @ingroup GPUCore +FfxFloat16x2 ffxZeroOneNotHalf(FfxFloat16x2 x) +{ + return FFX_BROADCAST_FLOAT16X2(1.0) - x; +} + +/// Conditional free logic signed NOT operation using two half-precision FfxFloat32 values. +/// +/// @param [in] x The first value to be fed into the AND OR operator. +/// +/// @returns +/// Result of the AND OR operation. +/// +/// @ingroup GPUCore +FfxFloat16x3 ffxZeroOneNotHalf(FfxFloat16x3 x) +{ + return FFX_BROADCAST_FLOAT16X3(1.0) - x; +} + +/// Conditional free logic signed NOT operation using two half-precision FfxFloat32 values. +/// +/// @param [in] x The first value to be fed into the AND OR operator. +/// +/// @returns +/// Result of the AND OR operation. +/// +/// @ingroup GPUCore +FfxFloat16x4 ffxZeroOneNotHalf(FfxFloat16x4 x) +{ + return FFX_BROADCAST_FLOAT16X4(1.0) - x; +} + +/// Conditional free logic OR operation using two half-precision FfxFloat32 values. +/// +/// @param [in] x The first value to be fed into the OR operator. +/// @param [in] y The second value to be fed into the OR operator. +/// +/// @returns +/// Result of the OR operation. +/// +/// @ingroup GPUCore +FfxFloat16 ffxZeroOneOrHalf(FfxFloat16 x, FfxFloat16 y) +{ + return max(x, y); +} + +/// Conditional free logic OR operation using two half-precision FfxFloat32 values. +/// +/// @param [in] x The first value to be fed into the OR operator. +/// @param [in] y The second value to be fed into the OR operator. +/// +/// @returns +/// Result of the OR operation. +/// +/// @ingroup GPUCore +FfxFloat16x2 ffxZeroOneOrHalf(FfxFloat16x2 x, FfxFloat16x2 y) +{ + return max(x, y); +} + +/// Conditional free logic OR operation using two half-precision FfxFloat32 values. +/// +/// @param [in] x The first value to be fed into the OR operator. +/// @param [in] y The second value to be fed into the OR operator. +/// +/// @returns +/// Result of the OR operation. +/// +/// @ingroup GPUCore +FfxFloat16x3 ffxZeroOneOrHalf(FfxFloat16x3 x, FfxFloat16x3 y) +{ + return max(x, y); +} + +/// Conditional free logic OR operation using two half-precision FfxFloat32 values. +/// +/// @param [in] x The first value to be fed into the OR operator. +/// @param [in] y The second value to be fed into the OR operator. +/// +/// @returns +/// Result of the OR operation. +/// +/// @ingroup GPUCore +FfxFloat16x4 ffxZeroOneOrHalf(FfxFloat16x4 x, FfxFloat16x4 y) +{ + return max(x, y); +} + +/// Choose between two half-precision FfxFloat32 values if the first paramter is greater than zero. +/// +/// @param [in] x The value to compare against zero. +/// @param [in] y The value to return if the comparision is greater than zero. +/// @param [in] z The value to return if the comparision is less than or equal to zero. +/// +/// @returns +/// The selected value. +/// +/// @ingroup GPUCore +FfxFloat16 ffxZeroOneSelectHalf(FfxFloat16 x, FfxFloat16 y, FfxFloat16 z) +{ + FfxFloat16 r = (-x) * z + z; + return x * y + r; +} + +/// Choose between two half-precision FfxFloat32 values if the first paramter is greater than zero. +/// +/// @param [in] x The value to compare against zero. +/// @param [in] y The value to return if the comparision is greater than zero. +/// @param [in] z The value to return if the comparision is less than or equal to zero. +/// +/// @returns +/// The selected value. +/// +/// @ingroup GPUCore +FfxFloat16x2 ffxZeroOneSelectHalf(FfxFloat16x2 x, FfxFloat16x2 y, FfxFloat16x2 z) +{ + FfxFloat16x2 r = (-x) * z + z; + return x * y + r; +} + +/// Choose between two half-precision FfxFloat32 values if the first paramter is greater than zero. +/// +/// @param [in] x The value to compare against zero. +/// @param [in] y The value to return if the comparision is greater than zero. +/// @param [in] z The value to return if the comparision is less than or equal to zero. +/// +/// @returns +/// The selected value. +/// +/// @ingroup GPUCore +FfxFloat16x3 ffxZeroOneSelectHalf(FfxFloat16x3 x, FfxFloat16x3 y, FfxFloat16x3 z) +{ + FfxFloat16x3 r = (-x) * z + z; + return x * y + r; +} + +/// Choose between two half-precision FfxFloat32 values if the first paramter is greater than zero. +/// +/// @param [in] x The value to compare against zero. +/// @param [in] y The value to return if the comparision is greater than zero. +/// @param [in] z The value to return if the comparision is less than or equal to zero. +/// +/// @returns +/// The selected value. +/// +/// @ingroup GPUCore +FfxFloat16x4 ffxZeroOneSelectHalf(FfxFloat16x4 x, FfxFloat16x4 y, FfxFloat16x4 z) +{ + FfxFloat16x4 r = (-x) * z + z; + return x * y + r; +} + +/// Given a half-precision value, returns 1.0 if less than zero and 0.0 if not. +/// +/// @param [in] x The value to be compared. +/// +/// @returns +/// Result of the sign value. +/// +/// @ingroup GPUCore +FfxFloat16 ffxZeroOneIsSignedHalf(FfxFloat16 x) +{ + return ffxSaturate(x * FFX_BROADCAST_FLOAT16(FFX_NEGATIVE_INFINITY_HALF)); +} + +/// Given a half-precision value, returns 1.0 if less than zero and 0.0 if not. +/// +/// @param [in] x The value to be compared. +/// +/// @returns +/// Result of the sign value. +/// +/// @ingroup GPUCore +FfxFloat16x2 ffxZeroOneIsSignedHalf(FfxFloat16x2 x) +{ + return ffxSaturate(x * FFX_BROADCAST_FLOAT16X2(FFX_NEGATIVE_INFINITY_HALF)); +} + +/// Given a half-precision value, returns 1.0 if less than zero and 0.0 if not. +/// +/// @param [in] x The value to be compared. +/// +/// @returns +/// Result of the sign value. +/// +/// @ingroup GPUCore +FfxFloat16x3 ffxZeroOneIsSignedHalf(FfxFloat16x3 x) +{ + return ffxSaturate(x * FFX_BROADCAST_FLOAT16X3(FFX_NEGATIVE_INFINITY_HALF)); +} + +/// Given a half-precision value, returns 1.0 if less than zero and 0.0 if not. +/// +/// @param [in] x The value to be compared. +/// +/// @returns +/// Result of the sign value. +/// +/// @ingroup GPUCore +FfxFloat16x4 ffxZeroOneIsSignedHalf(FfxFloat16x4 x) +{ + return ffxSaturate(x * FFX_BROADCAST_FLOAT16X4(FFX_NEGATIVE_INFINITY_HALF)); +} + +/// Compute a Rec.709 color space. +/// +/// Rec.709 is used for some HDTVs. +/// +/// Both Rec.709 and sRGB have a linear segment which as spec'ed would intersect the curved segment 2 times. +/// (a.) For 8-bit sRGB, steps {0 to 10.3} are in the linear region (4% of the encoding range). +/// (b.) For 8-bit 709, steps {0 to 20.7} are in the linear region (8% of the encoding range). +/// +/// @param [in] c The color to convert to Rec. 709. +/// +/// @returns +/// The color in Rec.709 space. +/// +/// @ingroup GPUCore +FfxFloat16 ffxRec709FromLinearHalf(FfxFloat16 c) +{ + FfxFloat16x3 j = FfxFloat16x3(0.018 * 4.5, 4.5, 0.45); + FfxFloat16x2 k = FfxFloat16x2(1.099, -0.099); + return clamp(j.x, c * j.y, pow(c, j.z) * k.x + k.y); +} + +/// Compute a Rec.709 color space. +/// +/// Rec.709 is used for some HDTVs. +/// +/// Both Rec.709 and sRGB have a linear segment which as spec'ed would intersect the curved segment 2 times. +/// (a.) For 8-bit sRGB, steps {0 to 10.3} are in the linear region (4% of the encoding range). +/// (b.) For 8-bit 709, steps {0 to 20.7} are in the linear region (8% of the encoding range). +/// +/// @param [in] c The color to convert to Rec. 709. +/// +/// @returns +/// The color in Rec.709 space. +/// +/// @ingroup GPUCore +FfxFloat16x2 ffxRec709FromLinearHalf(FfxFloat16x2 c) +{ + FfxFloat16x3 j = FfxFloat16x3(0.018 * 4.5, 4.5, 0.45); + FfxFloat16x2 k = FfxFloat16x2(1.099, -0.099); + return clamp(j.xx, c * j.yy, pow(c, j.zz) * k.xx + k.yy); +} + +/// Compute a Rec.709 color space. +/// +/// Rec.709 is used for some HDTVs. +/// +/// Both Rec.709 and sRGB have a linear segment which as spec'ed would intersect the curved segment 2 times. +/// (a.) For 8-bit sRGB, steps {0 to 10.3} are in the linear region (4% of the encoding range). +/// (b.) For 8-bit 709, steps {0 to 20.7} are in the linear region (8% of the encoding range). +/// +/// @param [in] c The color to convert to Rec. 709. +/// +/// @returns +/// The color in Rec.709 space. +/// +/// @ingroup GPUCore +FfxFloat16x3 ffxRec709FromLinearHalf(FfxFloat16x3 c) +{ + FfxFloat16x3 j = FfxFloat16x3(0.018 * 4.5, 4.5, 0.45); + FfxFloat16x2 k = FfxFloat16x2(1.099, -0.099); + return clamp(j.xxx, c * j.yyy, pow(c, j.zzz) * k.xxx + k.yyy); +} + +/// Compute a gamma value from a linear value. +/// +/// Typically 2.2 for some PC displays, or 2.4-2.5 for CRTs, or 2.2 FreeSync2 native. +/// +/// Note: 'rcpX' is '1/x', where the 'x' is what would be used in ffxLinearFromGammaHalf. +/// +/// @param [in] c The value to convert to gamma space from linear. +/// @param [in] rcpX The reciprocal of power value used for the gamma curve. +/// +/// @returns +/// A value in gamma space. +/// +/// @ingroup GPUCore +FfxFloat16 ffxGammaFromLinearHalf(FfxFloat16 c, FfxFloat16 rcpX) +{ + return pow(c, FFX_BROADCAST_FLOAT16(rcpX)); +} + +/// Compute a gamma value from a linear value. +/// +/// Typically 2.2 for some PC displays, or 2.4-2.5 for CRTs, or 2.2 FreeSync2 native. +/// +/// Note: 'rcpX' is '1/x', where the 'x' is what would be used in ffxLinearFromGammaHalf. +/// +/// @param [in] c The value to convert to gamma space from linear. +/// @param [in] rcpX The reciprocal of power value used for the gamma curve. +/// +/// @returns +/// A value in gamma space. +/// +/// @ingroup GPUCore +FfxFloat16x2 ffxGammaFromLinearHalf(FfxFloat16x2 c, FfxFloat16 rcpX) +{ + return pow(c, FFX_BROADCAST_FLOAT16X2(rcpX)); +} + +/// Compute a gamma value from a linear value. +/// +/// Typically 2.2 for some PC displays, or 2.4-2.5 for CRTs, or 2.2 FreeSync2 native. +/// +/// Note: 'rcpX' is '1/x', where the 'x' is what would be used in ffxLinearFromGammaHalf. +/// +/// @param [in] c The value to convert to gamma space from linear. +/// @param [in] rcpX The reciprocal of power value used for the gamma curve. +/// +/// @returns +/// A value in gamma space. +/// +/// @ingroup GPUCore +FfxFloat16x3 ffxGammaFromLinearHalf(FfxFloat16x3 c, FfxFloat16 rcpX) +{ + return pow(c, FFX_BROADCAST_FLOAT16X3(rcpX)); +} + +/// Compute an SRGB value from a linear value. +/// +/// @param [in] c The value to convert to SRGB from linear. +/// +/// @returns +/// A value in SRGB space. +/// +/// @ingroup GPUCore +FfxFloat16 ffxSrgbFromLinearHalf(FfxFloat16 c) +{ + FfxFloat16x3 j = FfxFloat16x3(0.0031308 * 12.92, 12.92, 1.0 / 2.4); + FfxFloat16x2 k = FfxFloat16x2(1.055, -0.055); + return clamp(j.x, c * j.y, pow(c, j.z) * k.x + k.y); +} + +/// Compute an SRGB value from a linear value. +/// +/// @param [in] c The value to convert to SRGB from linear. +/// +/// @returns +/// A value in SRGB space. +/// +/// @ingroup GPUCore +FfxFloat16x2 ffxSrgbFromLinearHalf(FfxFloat16x2 c) +{ + FfxFloat16x3 j = FfxFloat16x3(0.0031308 * 12.92, 12.92, 1.0 / 2.4); + FfxFloat16x2 k = FfxFloat16x2(1.055, -0.055); + return clamp(j.xx, c * j.yy, pow(c, j.zz) * k.xx + k.yy); +} + +/// Compute an SRGB value from a linear value. +/// +/// @param [in] c The value to convert to SRGB from linear. +/// +/// @returns +/// A value in SRGB space. +/// +/// @ingroup GPUCore +FfxFloat16x3 ffxSrgbFromLinearHalf(FfxFloat16x3 c) +{ + FfxFloat16x3 j = FfxFloat16x3(0.0031308 * 12.92, 12.92, 1.0 / 2.4); + FfxFloat16x2 k = FfxFloat16x2(1.055, -0.055); + return clamp(j.xxx, c * j.yyy, pow(c, j.zzz) * k.xxx + k.yyy); +} + +/// Compute the square root of a value. +/// +/// @param [in] c The value to compute the square root for. +/// +/// @returns +/// A square root of the input value. +/// +/// @ingroup GPUCore +FfxFloat16 ffxSquareRootHalf(FfxFloat16 c) +{ + return sqrt(c); +} + +/// Compute the square root of a value. +/// +/// @param [in] c The value to compute the square root for. +/// +/// @returns +/// A square root of the input value. +/// +/// @ingroup GPUCore +FfxFloat16x2 ffxSquareRootHalf(FfxFloat16x2 c) +{ + return sqrt(c); +} + +/// Compute the square root of a value. +/// +/// @param [in] c The value to compute the square root for. +/// +/// @returns +/// A square root of the input value. +/// +/// @ingroup GPUCore +FfxFloat16x3 ffxSquareRootHalf(FfxFloat16x3 c) +{ + return sqrt(c); +} + +/// Compute the cube root of a value. +/// +/// @param [in] c The value to compute the cube root for. +/// +/// @returns +/// A cube root of the input value. +/// +/// @ingroup GPUCore +FfxFloat16 ffxCubeRootHalf(FfxFloat16 c) +{ + return pow(c, FFX_BROADCAST_FLOAT16(1.0 / 3.0)); +} + +/// Compute the cube root of a value. +/// +/// @param [in] c The value to compute the cube root for. +/// +/// @returns +/// A cube root of the input value. +/// +/// @ingroup GPUCore +FfxFloat16x2 ffxCubeRootHalf(FfxFloat16x2 c) +{ + return pow(c, FFX_BROADCAST_FLOAT16X2(1.0 / 3.0)); +} + +/// Compute the cube root of a value. +/// +/// @param [in] c The value to compute the cube root for. +/// +/// @returns +/// A cube root of the input value. +/// +/// @ingroup GPUCore +FfxFloat16x3 ffxCubeRootHalf(FfxFloat16x3 c) +{ + return pow(c, FFX_BROADCAST_FLOAT16X3(1.0 / 3.0)); +} + +/// Compute a linear value from a REC.709 value. +/// +/// @param [in] c The value to convert to linear from REC.709. +/// +/// @returns +/// A value in linear space. +/// +/// @ingroup GPUCore +FfxFloat16 ffxLinearFromRec709Half(FfxFloat16 c) +{ + FfxFloat16x3 j = FfxFloat16x3(0.081 / 4.5, 1.0 / 4.5, 1.0 / 0.45); + FfxFloat16x2 k = FfxFloat16x2(1.0 / 1.099, 0.099 / 1.099); + return ffxZeroOneSelectHalf(ffxZeroOneIsSignedHalf(c - j.x), c * j.y, pow(c * k.x + k.y, j.z)); +} + +/// Compute a linear value from a REC.709 value. +/// +/// @param [in] c The value to convert to linear from REC.709. +/// +/// @returns +/// A value in linear space. +/// +/// @ingroup GPUCore +FfxFloat16x2 ffxLinearFromRec709Half(FfxFloat16x2 c) +{ + FfxFloat16x3 j = FfxFloat16x3(0.081 / 4.5, 1.0 / 4.5, 1.0 / 0.45); + FfxFloat16x2 k = FfxFloat16x2(1.0 / 1.099, 0.099 / 1.099); + return ffxZeroOneSelectHalf(ffxZeroOneIsSignedHalf(c - j.xx), c * j.yy, pow(c * k.xx + k.yy, j.zz)); +} + +/// Compute a linear value from a REC.709 value. +/// +/// @param [in] c The value to convert to linear from REC.709. +/// +/// @returns +/// A value in linear space. +/// +/// @ingroup GPUCore +FfxFloat16x3 ffxLinearFromRec709Half(FfxFloat16x3 c) +{ + FfxFloat16x3 j = FfxFloat16x3(0.081 / 4.5, 1.0 / 4.5, 1.0 / 0.45); + FfxFloat16x2 k = FfxFloat16x2(1.0 / 1.099, 0.099 / 1.099); + return ffxZeroOneSelectHalf(ffxZeroOneIsSignedHalf(c - j.xxx), c * j.yyy, pow(c * k.xxx + k.yyy, j.zzz)); +} + +/// Compute a linear value from a value in a gamma space. +/// +/// Typically 2.2 for some PC displays, or 2.4-2.5 for CRTs, or 2.2 FreeSync2 native. +/// +/// @param [in] c The value to convert to linear in gamma space. +/// @param [in] x The power value used for the gamma curve. +/// +/// @returns +/// A value in linear space. +/// +/// @ingroup GPUCore +FfxFloat16 ffxLinearFromGammaHalf(FfxFloat16 c, FfxFloat16 x) +{ + return pow(c, FFX_BROADCAST_FLOAT16(x)); +} + +/// Compute a linear value from a value in a gamma space. +/// +/// Typically 2.2 for some PC displays, or 2.4-2.5 for CRTs, or 2.2 FreeSync2 native. +/// +/// @param [in] c The value to convert to linear in gamma space. +/// @param [in] x The power value used for the gamma curve. +/// +/// @returns +/// A value in linear space. +/// +/// @ingroup GPUCore +FfxFloat16x2 ffxLinearFromGammaHalf(FfxFloat16x2 c, FfxFloat16 x) +{ + return pow(c, FFX_BROADCAST_FLOAT16X2(x)); +} + +/// Compute a linear value from a value in a gamma space. +/// +/// Typically 2.2 for some PC displays, or 2.4-2.5 for CRTs, or 2.2 FreeSync2 native. +/// +/// @param [in] c The value to convert to linear in gamma space. +/// @param [in] x The power value used for the gamma curve. +/// +/// @returns +/// A value in linear space. +/// +/// @ingroup GPUCore +FfxFloat16x3 ffxLinearFromGammaHalf(FfxFloat16x3 c, FfxFloat16 x) +{ + return pow(c, FFX_BROADCAST_FLOAT16X3(x)); +} + +/// Compute a linear value from a value in a SRGB space. +/// +/// Typically 2.2 for some PC displays, or 2.4-2.5 for CRTs, or 2.2 FreeSync2 native. +/// +/// @param [in] c The value to convert to linear in SRGB space. +/// +/// @returns +/// A value in linear space. +/// +/// @ingroup GPUCore +FfxFloat16 ffxLinearFromSrgbHalf(FfxFloat16 c) +{ + FfxFloat16x3 j = FfxFloat16x3(0.04045, 1.0 / 12.92, 2.4); + FfxFloat16x2 k = FfxFloat16x2(1.0 / 1.055, 0.055 / 1.055); + return ffxZeroOneSelectHalf(ffxZeroOneIsSignedHalf(c - j.x), c * j.y, pow(c * k.x + k.y, j.z)); +} + +/// Compute a linear value from a value in a SRGB space. +/// +/// Typically 2.2 for some PC displays, or 2.4-2.5 for CRTs, or 2.2 FreeSync2 native. +/// +/// @param [in] c The value to convert to linear in SRGB space. +/// +/// @returns +/// A value in linear space. +/// +/// @ingroup GPUCore +FfxFloat16x2 ffxLinearFromSrgbHalf(FfxFloat16x2 c) +{ + FfxFloat16x3 j = FfxFloat16x3(0.04045, 1.0 / 12.92, 2.4); + FfxFloat16x2 k = FfxFloat16x2(1.0 / 1.055, 0.055 / 1.055); + return ffxZeroOneSelectHalf(ffxZeroOneIsSignedHalf(c - j.xx), c * j.yy, pow(c * k.xx + k.yy, j.zz)); +} + +/// Compute a linear value from a value in a SRGB space. +/// +/// Typically 2.2 for some PC displays, or 2.4-2.5 for CRTs, or 2.2 FreeSync2 native. +/// +/// @param [in] c The value to convert to linear in SRGB space. +/// +/// @returns +/// A value in linear space. +/// +/// @ingroup GPUCore +FfxFloat16x3 ffxLinearFromSrgbHalf(FfxFloat16x3 c) +{ + FfxFloat16x3 j = FfxFloat16x3(0.04045, 1.0 / 12.92, 2.4); + FfxFloat16x2 k = FfxFloat16x2(1.0 / 1.055, 0.055 / 1.055); + return ffxZeroOneSelectHalf(ffxZeroOneIsSignedHalf(c - j.xxx), c * j.yyy, pow(c * k.xxx + k.yyy, j.zzz)); +} + +/// A remapping of 64x1 to 8x8 imposing rotated 2x2 pixel quads in quad linear. +/// +/// Remap illustration: +/// +/// 543210 +/// ~~~~~~ +/// ..xxx. +/// yy...y +/// +/// @param [in] a The input 1D coordinates to remap. +/// +/// @returns +/// The remapped 2D coordinates. +/// +/// @ingroup GPUCore +FfxUInt16x2 ffxRemapForQuadHalf(FfxUInt32 a) +{ + return FfxUInt16x2(ffxBitfieldExtract(a, 1u, 3u), ffxBitfieldInsertMask(ffxBitfieldExtract(a, 3u, 3u), a, 1u)); +} + +/// A helper function performing a remap 64x1 to 8x8 remapping which is necessary for 2D wave reductions. +/// +/// The 64-wide lane indices to 8x8 remapping is performed as follows: +/// +/// 00 01 08 09 10 11 18 19 +/// 02 03 0a 0b 12 13 1a 1b +/// 04 05 0c 0d 14 15 1c 1d +/// 06 07 0e 0f 16 17 1e 1f +/// 20 21 28 29 30 31 38 39 +/// 22 23 2a 2b 32 33 3a 3b +/// 24 25 2c 2d 34 35 3c 3d +/// 26 27 2e 2f 36 37 3e 3f +/// +/// @param [in] a The input 1D coordinate to remap. +/// +/// @returns +/// The remapped 2D coordinates. +/// +/// @ingroup GPUCore +FfxUInt16x2 ffxRemapForWaveReductionHalf(FfxUInt32 a) +{ + return FfxUInt16x2(ffxBitfieldInsertMask(ffxBitfieldExtract(a, 2u, 3u), a, 1u), ffxBitfieldInsertMask(ffxBitfieldExtract(a, 3u, 3u), ffxBitfieldExtract(a, 1u, 2u), 2u)); +} + +#endif // FFX_HALF diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/ffx_core_hlsl.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/ffx_core_hlsl.h new file mode 100644 index 00000000..28827d98 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/ffx_core_hlsl.h @@ -0,0 +1,1898 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +/// @defgroup HLSLCore HLSL Core +/// HLSL core defines and functions +/// +/// @ingroup FfxHLSL + +#define DECLARE_SRV_REGISTER(regIndex) t##regIndex +#define DECLARE_UAV_REGISTER(regIndex) u##regIndex +#define DECLARE_CB_REGISTER(regIndex) b##regIndex +#define FFX_DECLARE_SRV(regIndex) register(DECLARE_SRV_REGISTER(regIndex)) +#define FFX_DECLARE_UAV(regIndex) register(DECLARE_UAV_REGISTER(regIndex)) +#define FFX_DECLARE_CB(regIndex) register(DECLARE_CB_REGISTER(regIndex)) + +/// A define for abstracting select functionality for pre/post HLSL 21 +/// +/// @ingroup HLSLCore +#if __HLSL_VERSION >= 2021 + +#define FFX_SELECT(cond, arg1, arg2) select(cond, arg1, arg2) + +#else // #if __HLSL_VERSION >= 2021 + +#define FFX_SELECT(cond, arg1, arg2) cond ? arg1 : arg2 + +#endif // #if __HLSL_VERSION >= 2021 + +/// A define for abstracting shared memory between shading languages. +/// +/// @ingroup HLSLCore +#define FFX_GROUPSHARED groupshared + +/// A define for abstracting compute memory barriers between shading languages. +/// +/// @ingroup HLSLCore +#define FFX_GROUP_MEMORY_BARRIER GroupMemoryBarrierWithGroupSync() + +/// A define for abstracting compute atomic additions between shading languages. +/// +/// @ingroup HLSLCore +#define FFX_ATOMIC_ADD(x, y) InterlockedAdd(x, y) + +/// A define for abstracting compute atomic additions between shading languages. +/// +/// @ingroup HLSLCore +#define FFX_ATOMIC_ADD_RETURN(x, y, r) InterlockedAdd(x, y, r) + +/// A define for abstracting compute atomic OR between shading languages. +/// +/// @ingroup HLSLCore +#define FFX_ATOMIC_OR(x, y) InterlockedOr(x, y) + +/// A define for abstracting compute atomic min between shading languages. +/// +/// @ingroup HLSLCore +#define FFX_ATOMIC_MIN(x, y) InterlockedMin(x, y) + +/// A define for abstracting compute atomic max between shading languages. +/// +/// @ingroup HLSLCore +#define FFX_ATOMIC_MAX(x, y) InterlockedMax(x, y) + +/// A define added to accept static markup on functions to aid CPU/GPU portability of code. +/// +/// @ingroup HLSLCore +#define FFX_STATIC static + +/// A define for abstracting loop unrolling between shading languages. +/// +/// @ingroup HLSLCore +#define FFX_UNROLL [unroll] + +/// A define for abstracting a 'greater than' comparison operator between two types. +/// +/// @ingroup HLSLCore +#define FFX_GREATER_THAN(x, y) x > y + +/// A define for abstracting a 'greater than or equal' comparison operator between two types. +/// +/// @ingroup HLSLCore +#define FFX_GREATER_THAN_EQUAL(x, y) x >= y + +/// A define for abstracting a 'less than' comparison operator between two types. +/// +/// @ingroup HLSLCore +#define FFX_LESS_THAN(x, y) x < y + +/// A define for abstracting a 'less than or equal' comparison operator between two types. +/// +/// @ingroup HLSLCore +#define FFX_LESS_THAN_EQUAL(x, y) x <= y + +/// A define for abstracting an 'equal' comparison operator between two types. +/// +/// @ingroup HLSLCore +#define FFX_EQUAL(x, y) x == y + +/// A define for abstracting a 'not equal' comparison operator between two types. +/// +/// @ingroup HLSLCore +#define FFX_NOT_EQUAL(x, y) x != y + +/// A define for abstracting matrix multiply operations between shading languages. +/// +/// @ingroup HLSLCore +#define FFX_MATRIX_MULTIPLY(a, b) mul(a, b) + +/// A define for abstracting vector transformations between shading languages. +/// +/// @ingroup HLSLCore +#define FFX_TRANSFORM_VECTOR(a, b) mul(a, b) + +/// A define for abstracting modulo operations between shading languages. +/// +/// @ingroup HLSLCore +#define FFX_MODULO(a, b) (fmod(a, b)) + +/// Broadcast a scalar value to a 1-dimensional floating point vector. +/// +/// @ingroup HLSLCore +#define FFX_BROADCAST_FLOAT32(x) FfxFloat32(x) + +/// Broadcast a scalar value to a 2-dimensional floating point vector. +/// +/// @ingroup HLSLCore +#define FFX_BROADCAST_FLOAT32X2(x) FfxFloat32(x) + +/// Broadcast a scalar value to a 3-dimensional floating point vector. +/// +/// @ingroup HLSLCore +#define FFX_BROADCAST_FLOAT32X3(x) FfxFloat32(x) + +/// Broadcast a scalar value to a 4-dimensional floating point vector. +/// +/// @ingroup HLSLCore +#define FFX_BROADCAST_FLOAT32X4(x) FfxFloat32(x) + +/// Broadcast a scalar value to a 1-dimensional unsigned integer vector. +/// +/// @ingroup HLSLCore +#define FFX_BROADCAST_UINT32(x) FfxUInt32(x) + +/// Broadcast a scalar value to a 2-dimensional unsigned integer vector. +/// +/// @ingroup HLSLCore +#define FFX_BROADCAST_UINT32X2(x) FfxUInt32(x) + +/// Broadcast a scalar value to a 4-dimensional unsigned integer vector. +/// +/// @ingroup HLSLCore +#define FFX_BROADCAST_UINT32X3(x) FfxUInt32(x) + +/// Broadcast a scalar value to a 4-dimensional unsigned integer vector. +/// +/// @ingroup HLSLCore +#define FFX_BROADCAST_UINT32X4(x) FfxUInt32(x) + +/// Broadcast a scalar value to a 1-dimensional signed integer vector. +/// +/// @ingroup HLSLCore +#define FFX_BROADCAST_INT32(x) FfxInt32(x) + +/// Broadcast a scalar value to a 2-dimensional signed integer vector. +/// +/// @ingroup HLSLCore +#define FFX_BROADCAST_INT32X2(x) FfxInt32(x) + +/// Broadcast a scalar value to a 3-dimensional signed integer vector. +/// +/// @ingroup HLSLCore +#define FFX_BROADCAST_INT32X3(x) FfxInt32(x) + +/// Broadcast a scalar value to a 4-dimensional signed integer vector. +/// +/// @ingroup HLSLCore +#define FFX_BROADCAST_INT32X4(x) FfxInt32(x) + +/// Broadcast a scalar value to a 1-dimensional half-precision floating point vector. +/// +/// @ingroup HLSLCore +#define FFX_BROADCAST_MIN_FLOAT16(a) FFX_MIN16_F(a) + +/// Broadcast a scalar value to a 2-dimensional half-precision floating point vector. +/// +/// @ingroup HLSLCore +#define FFX_BROADCAST_MIN_FLOAT16X2(a) FFX_MIN16_F(a) + +/// Broadcast a scalar value to a 3-dimensional half-precision floating point vector. +/// +/// @ingroup HLSLCore +#define FFX_BROADCAST_MIN_FLOAT16X3(a) FFX_MIN16_F(a) + +/// Broadcast a scalar value to a 4-dimensional half-precision floating point vector. +/// +/// @ingroup HLSLCore +#define FFX_BROADCAST_MIN_FLOAT16X4(a) FFX_MIN16_F(a) + +/// Broadcast a scalar value to a 1-dimensional half-precision unsigned integer vector. +/// +/// @ingroup HLSLCore +#define FFX_BROADCAST_MIN_UINT16(a) FFX_MIN16_U(a) + +/// Broadcast a scalar value to a 2-dimensional half-precision unsigned integer vector. +/// +/// @ingroup HLSLCore +#define FFX_BROADCAST_MIN_UINT16X2(a) FFX_MIN16_U(a) + +/// Broadcast a scalar value to a 3-dimensional half-precision unsigned integer vector. +/// +/// @ingroup HLSLCore +#define FFX_BROADCAST_MIN_UINT16X3(a) FFX_MIN16_U(a) + +/// Broadcast a scalar value to a 4-dimensional half-precision unsigned integer vector. +/// +/// @ingroup HLSLCore +#define FFX_BROADCAST_MIN_UINT16X4(a) FFX_MIN16_U(a) + +/// Broadcast a scalar value to a 1-dimensional half-precision signed integer vector. +/// +/// @ingroup HLSLCore +#define FFX_BROADCAST_MIN_INT16(a) FFX_MIN16_I(a) + +/// Broadcast a scalar value to a 2-dimensional half-precision signed integer vector. +/// +/// @ingroup HLSLCore +#define FFX_BROADCAST_MIN_INT16X2(a) FFX_MIN16_I(a) + +/// Broadcast a scalar value to a 3-dimensional half-precision signed integer vector. +/// +/// @ingroup HLSLCore +#define FFX_BROADCAST_MIN_INT16X3(a) FFX_MIN16_I(a) + +/// Broadcast a scalar value to a 4-dimensional half-precision signed integer vector. +/// +/// @ingroup HLSLCore +#define FFX_BROADCAST_MIN_INT16X4(a) FFX_MIN16_I(a) + +/// Convert FfxFloat32 to half (in lower 16-bits of output). +/// +/// This function implements the same fast technique that is documented here: ftp://ftp.fox-toolkit.org/pub/fasthalffloatconversion.pdf +/// +/// The function supports denormals. +/// +/// Some conversion rules are to make computations possibly "safer" on the GPU, +/// -INF & -NaN -> -65504 +/// +INF & +NaN -> +65504 +/// +/// @param [in] f The 32bit floating point value to convert. +/// +/// @returns +/// The closest 16bit floating point value to f. +/// +/// @ingroup HLSLCore +#define ffxF32ToF16 f32tof16 + +/// Pack 2x32-bit floating point values in a single 32bit value. +/// +/// This function first converts each component of value into their nearest 16-bit floating +/// point representation, and then stores the X and Y components in the lower and upper 16 bits of the +/// 32bit unsigned integer respectively. +/// +/// @param [in] value A 2-dimensional floating point value to convert and pack. +/// +/// @returns +/// A packed 32bit value containing 2 16bit floating point values. +/// +/// @ingroup HLSLCore +FfxUInt32 ffxPackHalf2x16(FfxFloat32x2 value) +{ + return ffxF32ToF16(value.x) | (ffxF32ToF16(value.y) << 16); +} + +/// Broadcast a scalar value to a 2-dimensional floating point vector. +/// +/// @param [in] value The value to to broadcast. +/// +/// @returns +/// A 2-dimensional floating point vector with value in each component. +/// +/// @ingroup HLSLCore +FfxFloat32x2 ffxBroadcast2(FfxFloat32 value) +{ + return FfxFloat32x2(value, value); +} + +/// Broadcast a scalar value to a 3-dimensional floating point vector. +/// +/// @param [in] value The value to to broadcast. +/// +/// @returns +/// A 3-dimensional floating point vector with value in each component. +/// +/// @ingroup HLSLCore +FfxFloat32x3 ffxBroadcast3(FfxFloat32 value) +{ + return FfxFloat32x3(value, value, value); +} + +/// Broadcast a scalar value to a 4-dimensional floating point vector. +/// +/// @param [in] value The value to to broadcast. +/// +/// @returns +/// A 4-dimensional floating point vector with value in each component. +/// +/// @ingroup HLSLCore +FfxFloat32x4 ffxBroadcast4(FfxFloat32 value) +{ + return FfxFloat32x4(value, value, value, value); +} + +/// Broadcast a scalar value to a 2-dimensional signed integer vector. +/// +/// @param [in] value The value to to broadcast. +/// +/// @returns +/// A 2-dimensional signed integer vector with value in each component. +/// +/// @ingroup HLSLCore +FfxInt32x2 ffxBroadcast2(FfxInt32 value) +{ + return FfxInt32x2(value, value); +} + +/// Broadcast a scalar value to a 3-dimensional signed integer vector. +/// +/// @param [in] value The value to to broadcast. +/// +/// @returns +/// A 3-dimensional signed integer vector with value in each component. +/// +/// @ingroup HLSLCore +FfxInt32x3 ffxBroadcast3(FfxInt32 value) +{ + return FfxInt32x3(value, value, value); +} + +/// Broadcast a scalar value to a 4-dimensional signed integer vector. +/// +/// @param [in] value The value to to broadcast. +/// +/// @returns +/// A 4-dimensional signed integer vector with value in each component. +/// +/// @ingroup HLSLCore +FfxInt32x4 ffxBroadcast4(FfxInt32 value) +{ + return FfxInt32x4(value, value, value, value); +} + +/// Broadcast a scalar value to a 2-dimensional unsigned integer vector. +/// +/// @param [in] value The value to to broadcast. +/// +/// @returns +/// A 2-dimensional unsigned integer vector with value in each component. +/// +/// @ingroup HLSLCore +FfxUInt32x2 ffxBroadcast2(FfxUInt32 value) +{ + return FfxUInt32x2(value, value); +} + +/// Broadcast a scalar value to a 3-dimensional unsigned integer vector. +/// +/// @param [in] value The value to to broadcast. +/// +/// @returns +/// A 3-dimensional unsigned integer vector with value in each component. +/// +/// @ingroup HLSLCore +FfxUInt32x3 ffxBroadcast3(FfxUInt32 value) +{ + return FfxUInt32x3(value, value, value); +} + +/// Broadcast a scalar value to a 4-dimensional unsigned integer vector. +/// +/// @param [in] value The value to to broadcast. +/// +/// @returns +/// A 4-dimensional unsigned integer vector with value in each component. +/// +/// @ingroup HLSLCore +FfxUInt32x4 ffxBroadcast4(FfxUInt32 value) +{ + return FfxUInt32x4(value, value, value, value); +} + +FfxUInt32 ffxBitfieldExtract(FfxUInt32 src, FfxUInt32 off, FfxUInt32 bits) +{ + FfxUInt32 mask = (1u << bits) - 1; + return (src >> off) & mask; +} + +FfxUInt32 ffxBitfieldInsert(FfxUInt32 src, FfxUInt32 ins, FfxUInt32 mask) +{ + return (ins & mask) | (src & (~mask)); +} + +FfxUInt32 ffxBitfieldInsertMask(FfxUInt32 src, FfxUInt32 ins, FfxUInt32 bits) +{ + FfxUInt32 mask = (1u << bits) - 1; + return (ins & mask) | (src & (~mask)); +} + +/// Interprets the bit pattern of x as an unsigned integer. +/// +/// @param [in] x The input value. +/// +/// @returns +/// The input interpreted as an unsigned integer. +/// +/// @ingroup HLSLCore +FfxUInt32 ffxAsUInt32(FfxFloat32 x) +{ + return asuint(x); +} + +/// Interprets the bit pattern of x as an unsigned integer. +/// +/// @param [in] x The input value. +/// +/// @returns +/// The input interpreted as an unsigned integer. +/// +/// @ingroup HLSLCore +FfxUInt32x2 ffxAsUInt32(FfxFloat32x2 x) +{ + return asuint(x); +} + +/// Interprets the bit pattern of x as an unsigned integer. +/// +/// @param [in] x The input value. +/// +/// @returns +/// The input interpreted as an unsigned integer. +/// +/// @ingroup HLSLCore +FfxUInt32x3 ffxAsUInt32(FfxFloat32x3 x) +{ + return asuint(x); +} + +/// Interprets the bit pattern of x as an unsigned integer. +/// +/// @param [in] x The input value. +/// +/// @returns +/// The input interpreted as an unsigned integer. +/// +/// @ingroup HLSLCore +FfxUInt32x4 ffxAsUInt32(FfxFloat32x4 x) +{ + return asuint(x); +} + +/// Interprets the bit pattern of x as a floating-point number. +/// +/// @param [in] x The input value. +/// +/// @returns +/// The input interpreted as a floating-point number. +/// +/// @ingroup HLSLCore +FfxFloat32 ffxAsFloat(FfxUInt32 x) +{ + return asfloat(x); +} + +/// Interprets the bit pattern of x as a floating-point number. +/// +/// @param [in] x The input value. +/// +/// @returns +/// The input interpreted as a floating-point number. +/// +/// @ingroup HLSLCore +FfxFloat32x2 ffxAsFloat(FfxUInt32x2 x) +{ + return asfloat(x); +} + +/// Interprets the bit pattern of x as a floating-point number. +/// +/// @param [in] x The input value. +/// +/// @returns +/// The input interpreted as a floating-point number. +/// +/// @ingroup HLSLCore +FfxFloat32x3 ffxAsFloat(FfxUInt32x3 x) +{ + return asfloat(x); +} + +/// Interprets the bit pattern of x as a floating-point number. +/// +/// @param [in] x The input value. +/// +/// @returns +/// The input interpreted as a floating-point number. +/// +/// @ingroup HLSLCore +FfxFloat32x4 ffxAsFloat(FfxUInt32x4 x) +{ + return asfloat(x); +} + +/// Compute the inverse of a value. +/// +/// @param [in] x The value to calulate the inverse of. +/// +/// @returns +/// The inverse of x. +/// +/// @ingroup HLSLCore +FfxFloat32 ffxReciprocal(FfxFloat32 x) +{ + return rcp(x); +} + +/// Compute the inverse of a value. +/// +/// @param [in] x The value to calulate the inverse of. +/// +/// @returns +/// The inverse of x. +/// +/// @ingroup HLSLCore +FfxFloat32x2 ffxReciprocal(FfxFloat32x2 x) +{ + return rcp(x); +} + +/// Compute the inverse of a value. +/// +/// @param [in] x The value to calulate the inverse of. +/// +/// @returns +/// The inverse of x. +/// +/// @ingroup HLSLCore +FfxFloat32x3 ffxReciprocal(FfxFloat32x3 x) +{ + return rcp(x); +} + +/// Compute the inverse of a value. +/// +/// @param [in] x The value to calulate the inverse of. +/// +/// @returns +/// The inverse of x. +/// +/// @ingroup HLSLCore +FfxFloat32x4 ffxReciprocal(FfxFloat32x4 x) +{ + return rcp(x); +} + +/// Compute the inverse square root of a value. +/// +/// @param [in] x The value to calulate the inverse square root of. +/// +/// @returns +/// The inverse square root of x. +/// +/// @ingroup HLSLCore +FfxFloat32 ffxRsqrt(FfxFloat32 x) +{ + return rsqrt(x); +} + +/// Compute the inverse square root of a value. +/// +/// @param [in] x The value to calulate the inverse square root of. +/// +/// @returns +/// The inverse square root of x. +/// +/// @ingroup HLSLCore +FfxFloat32x2 ffxRsqrt(FfxFloat32x2 x) +{ + return rsqrt(x); +} + +/// Compute the inverse square root of a value. +/// +/// @param [in] x The value to calulate the inverse square root of. +/// +/// @returns +/// The inverse square root of x. +/// +/// @ingroup HLSLCore +FfxFloat32x3 ffxRsqrt(FfxFloat32x3 x) +{ + return rsqrt(x); +} + +/// Compute the inverse square root of a value. +/// +/// @param [in] x The value to calulate the inverse square root of. +/// +/// @returns +/// The inverse square root of x. +/// +/// @ingroup HLSLCore +FfxFloat32x4 ffxRsqrt(FfxFloat32x4 x) +{ + return rsqrt(x); +} + +/// Compute the linear interopation between two values. +/// +/// Implemented by calling the HLSL mix instrinsic function. Implements the +/// following math: +/// +/// (1 - t) * x + t * y +/// +/// @param [in] x The first value to lerp between. +/// @param [in] y The second value to lerp between. +/// @param [in] t The value to determine how much of x and how much of y. +/// +/// @returns +/// A linearly interpolated value between x and y according to t. +/// +/// @ingroup HLSLCore +FfxFloat32 ffxLerp(FfxFloat32 x, FfxFloat32 y, FfxFloat32 t) +{ + return lerp(x, y, t); +} + +/// Compute the linear interopation between two values. +/// +/// Implemented by calling the HLSL mix instrinsic function. Implements the +/// following math: +/// +/// (1 - t) * x + t * y +/// +/// @param [in] x The first value to lerp between. +/// @param [in] y The second value to lerp between. +/// @param [in] t The value to determine how much of x and how much of y. +/// +/// @returns +/// A linearly interpolated value between x and y according to t. +/// +/// @ingroup HLSLCore +FfxFloat32x2 ffxLerp(FfxFloat32x2 x, FfxFloat32x2 y, FfxFloat32 t) +{ + return lerp(x, y, t); +} + +/// Compute the linear interopation between two values. +/// +/// Implemented by calling the HLSL mix instrinsic function. Implements the +/// following math: +/// +/// (1 - t) * x + t * y +/// +/// @param [in] x The first value to lerp between. +/// @param [in] y The second value to lerp between. +/// @param [in] t The value to determine how much of x and how much of y. +/// +/// @returns +/// A linearly interpolated value between x and y according to t. +/// +/// @ingroup HLSLCore +FfxFloat32x2 ffxLerp(FfxFloat32x2 x, FfxFloat32x2 y, FfxFloat32x2 t) +{ + return lerp(x, y, t); +} + +/// Compute the linear interopation between two values. +/// +/// Implemented by calling the HLSL mix instrinsic function. Implements the +/// following math: +/// +/// (1 - t) * x + t * y +/// +/// @param [in] x The first value to lerp between. +/// @param [in] y The second value to lerp between. +/// @param [in] t The value to determine how much of x and how much of y. +/// +/// @returns +/// A linearly interpolated value between x and y according to t. +/// +/// @ingroup HLSLCore +FfxFloat32x3 ffxLerp(FfxFloat32x3 x, FfxFloat32x3 y, FfxFloat32 t) +{ + return lerp(x, y, t); +} + +/// Compute the linear interopation between two values. +/// +/// Implemented by calling the HLSL mix instrinsic function. Implements the +/// following math: +/// +/// (1 - t) * x + t * y +/// +/// @param [in] x The first value to lerp between. +/// @param [in] y The second value to lerp between. +/// @param [in] t The value to determine how much of x and how much of y. +/// +/// @returns +/// A linearly interpolated value between x and y according to t. +/// +/// @ingroup HLSLCore +FfxFloat32x3 ffxLerp(FfxFloat32x3 x, FfxFloat32x3 y, FfxFloat32x3 t) +{ + return lerp(x, y, t); +} + +/// Compute the linear interopation between two values. +/// +/// Implemented by calling the HLSL mix instrinsic function. Implements the +/// following math: +/// +/// (1 - t) * x + t * y +/// +/// @param [in] x The first value to lerp between. +/// @param [in] y The second value to lerp between. +/// @param [in] t The value to determine how much of x and how much of y. +/// +/// @returns +/// A linearly interpolated value between x and y according to t. +/// +/// @ingroup HLSLCore +FfxFloat32x4 ffxLerp(FfxFloat32x4 x, FfxFloat32x4 y, FfxFloat32 t) +{ + return lerp(x, y, t); +} + +/// Compute the linear interopation between two values. +/// +/// Implemented by calling the HLSL mix instrinsic function. Implements the +/// following math: +/// +/// (1 - t) * x + t * y +/// +/// @param [in] x The first value to lerp between. +/// @param [in] y The second value to lerp between. +/// @param [in] t The value to determine how much of x and how much of y. +/// +/// @returns +/// A linearly interpolated value between x and y according to t. +/// +/// @ingroup HLSLCore +FfxFloat32x4 ffxLerp(FfxFloat32x4 x, FfxFloat32x4 y, FfxFloat32x4 t) +{ + return lerp(x, y, t); +} + +/// Clamp a value to a [0..1] range. +/// +/// @param [in] x The value to clamp to [0..1] range. +/// +/// @returns +/// The clamped version of x. +/// +/// @ingroup HLSLCore +FfxFloat32 ffxSaturate(FfxFloat32 x) +{ + return saturate(x); +} + +/// Clamp a value to a [0..1] range. +/// +/// @param [in] x The value to clamp to [0..1] range. +/// +/// @returns +/// The clamped version of x. +/// +/// @ingroup HLSLCore +FfxFloat32x2 ffxSaturate(FfxFloat32x2 x) +{ + return saturate(x); +} + +/// Clamp a value to a [0..1] range. +/// +/// @param [in] x The value to clamp to [0..1] range. +/// +/// @returns +/// The clamped version of x. +/// +/// @ingroup HLSLCore +FfxFloat32x3 ffxSaturate(FfxFloat32x3 x) +{ + return saturate(x); +} + +/// Clamp a value to a [0..1] range. +/// +/// @param [in] x The value to clamp to [0..1] range. +/// +/// @returns +/// The clamped version of x. +/// +/// @ingroup HLSLCore +FfxFloat32x4 ffxSaturate(FfxFloat32x4 x) +{ + return saturate(x); +} + +/// Compute the factional part of a decimal value. +/// +/// This function calculates x - floor(x). Where floor is the intrinsic HLSL function. +/// +/// NOTE: This function should compile down to a single V_MAX3_F32 operation on GCN/RDNA hardware. It is +/// worth further noting that this function is intentionally distinct from the HLSL frac intrinsic +/// function. +/// +/// @param [in] x The value to compute the fractional part from. +/// +/// @returns +/// The fractional part of x. +/// +/// @ingroup HLSLCore +FfxFloat32 ffxFract(FfxFloat32 x) +{ + return x - floor(x); +} + +/// Compute the factional part of a decimal value. +/// +/// This function calculates x - floor(x). Where floor is the intrinsic HLSL function. +/// +/// NOTE: This function should compile down to a single V_MAX3_F32 operation on GCN/RDNA hardware. It is +/// worth further noting that this function is intentionally distinct from the HLSL frac intrinsic +/// function. +/// +/// @param [in] x The value to compute the fractional part from. +/// +/// @returns +/// The fractional part of x. +/// +/// @ingroup HLSLCore +FfxFloat32x2 ffxFract(FfxFloat32x2 x) +{ + return x - floor(x); +} + +/// Compute the factional part of a decimal value. +/// +/// This function calculates x - floor(x). Where floor is the intrinsic HLSL function. +/// +/// NOTE: This function should compile down to a single V_MAX3_F32 operation on GCN/RDNA hardware. It is +/// worth further noting that this function is intentionally distinct from the HLSL frac intrinsic +/// function. +/// +/// @param [in] x The value to compute the fractional part from. +/// +/// @returns +/// The fractional part of x. +/// +/// @ingroup HLSLCore +FfxFloat32x3 ffxFract(FfxFloat32x3 x) +{ + return x - floor(x); +} + +/// Compute the factional part of a decimal value. +/// +/// This function calculates x - floor(x). Where floor is the intrinsic HLSL function. +/// +/// NOTE: This function should compile down to a single V_MAX3_F32 operation on GCN/RDNA hardware. It is +/// worth further noting that this function is intentionally distinct from the HLSL frac intrinsic +/// function. +/// +/// @param [in] x The value to compute the fractional part from. +/// +/// @returns +/// The fractional part of x. +/// +/// @ingroup HLSLCore +FfxFloat32x4 ffxFract(FfxFloat32x4 x) +{ + return x - floor(x); +} + +/// Rounds to the nearest integer. In case the fractional part is 0.5, it will round to the nearest even integer. +/// +/// @param [in] x The value to be rounded. +/// +/// @returns +/// The nearest integer from x. The nearest even integer from x if equidistant from 2 integer. +/// +/// @ingroup HLSLCore +FfxFloat32 ffxRound(FfxFloat32 x) +{ + return round(x); +} + +/// Rounds to the nearest integer. In case the fractional part is 0.5, it will round to the nearest even integer. +/// +/// @param [in] x The value to be rounded. +/// +/// @returns +/// The nearest integer from x. The nearest even integer from x if equidistant from 2 integer. +/// +/// @ingroup HLSLCore +FfxFloat32x2 ffxRound(FfxFloat32x2 x) +{ + return round(x); +} + +/// Rounds to the nearest integer. In case the fractional part is 0.5, it will round to the nearest even integer. +/// +/// @param [in] x The value to be rounded. +/// +/// @returns +/// The nearest integer from x. The nearest even integer from x if equidistant from 2 integer. +/// +/// @ingroup HLSLCore +FfxFloat32x3 ffxRound(FfxFloat32x3 x) +{ + return round(x); +} + +/// Rounds to the nearest integer. In case the fractional part is 0.5, it will round to the nearest even integer. +/// +/// @param [in] x The value to be rounded. +/// +/// @returns +/// The nearest integer from x. The nearest even integer from x if equidistant from 2 integer. +/// +/// @ingroup HLSLCore +FfxFloat32x4 ffxRound(FfxFloat32x4 x) +{ + return round(x); +} + +/// Compute the maximum of three values. +/// +/// NOTE: This function should compile down to a single V_MAX3_F32 operation on GCN/RDNA hardware. +/// +/// @param [in] x The first value to include in the max calculation. +/// @param [in] y The second value to include in the max calcuation. +/// @param [in] z The third value to include in the max calcuation. +/// +/// @returns +/// The maximum value of x, y, and z. +/// +/// @ingroup HLSLCore +FfxFloat32 ffxMax3(FfxFloat32 x, FfxFloat32 y, FfxFloat32 z) +{ + return max(x, max(y, z)); +} + +/// Compute the maximum of three values. +/// +/// NOTE: This function should compile down to a single V_MAX3_F32 operation on GCN/RDNA hardware. +/// +/// @param [in] x The first value to include in the max calculation. +/// @param [in] y The second value to include in the max calcuation. +/// @param [in] z The third value to include in the max calcuation. +/// +/// @returns +/// The maximum value of x, y, and z. +/// +/// @ingroup HLSLCore +FfxFloat32x2 ffxMax3(FfxFloat32x2 x, FfxFloat32x2 y, FfxFloat32x2 z) +{ + return max(x, max(y, z)); +} + +/// Compute the maximum of three values. +/// +/// NOTE: This function should compile down to a single V_MAX3_F32 operation on GCN/RDNA hardware. +/// +/// @param [in] x The first value to include in the max calculation. +/// @param [in] y The second value to include in the max calcuation. +/// @param [in] z The third value to include in the max calcuation. +/// +/// @returns +/// The maximum value of x, y, and z. +/// +/// @ingroup HLSLCore +FfxFloat32x3 ffxMax3(FfxFloat32x3 x, FfxFloat32x3 y, FfxFloat32x3 z) +{ + return max(x, max(y, z)); +} + +/// Compute the maximum of three values. +/// +/// NOTE: This function should compile down to a single V_MAX3_F32 operation on GCN/RDNA hardware. +/// +/// @param [in] x The first value to include in the max calculation. +/// @param [in] y The second value to include in the max calcuation. +/// @param [in] z The third value to include in the max calcuation. +/// +/// @returns +/// The maximum value of x, y, and z. +/// +/// @ingroup HLSLCore +FfxFloat32x4 ffxMax3(FfxFloat32x4 x, FfxFloat32x4 y, FfxFloat32x4 z) +{ + return max(x, max(y, z)); +} + +/// Compute the maximum of three values. +/// +/// NOTE: This function should compile down to a single V_MAX3_F32 operation on GCN/RDNA hardware. +/// +/// @param [in] x The first value to include in the max calculation. +/// @param [in] y The second value to include in the max calcuation. +/// @param [in] z The third value to include in the max calcuation. +/// +/// @returns +/// The maximum value of x, y, and z. +/// +/// @ingroup HLSLCore +FfxUInt32 ffxMax3(FfxUInt32 x, FfxUInt32 y, FfxUInt32 z) +{ + return max(x, max(y, z)); +} + +/// Compute the maximum of three values. +/// +/// NOTE: This function should compile down to a single V_MAX3_F32 operation on GCN/RDNA hardware. +/// +/// @param [in] x The first value to include in the max calculation. +/// @param [in] y The second value to include in the max calcuation. +/// @param [in] z The third value to include in the max calcuation. +/// +/// @returns +/// The maximum value of x, y, and z. +/// +/// @ingroup HLSLCore +FfxUInt32x2 ffxMax3(FfxUInt32x2 x, FfxUInt32x2 y, FfxUInt32x2 z) +{ + return max(x, max(y, z)); +} + +/// Compute the maximum of three values. +/// +/// NOTE: This function should compile down to a single V_MAX3_F32 operation on GCN/RDNA hardware. +/// +/// @param [in] x The first value to include in the max calculation. +/// @param [in] y The second value to include in the max calcuation. +/// @param [in] z The third value to include in the max calcuation. +/// +/// @returns +/// The maximum value of x, y, and z. +/// +/// @ingroup HLSLCore +FfxUInt32x3 ffxMax3(FfxUInt32x3 x, FfxUInt32x3 y, FfxUInt32x3 z) +{ + return max(x, max(y, z)); +} + +/// Compute the maximum of three values. +/// +/// NOTE: This function should compile down to a single V_MAX3_F32 operation on GCN/RDNA hardware. +/// +/// @param [in] x The first value to include in the max calculation. +/// @param [in] y The second value to include in the max calcuation. +/// @param [in] z The third value to include in the max calcuation. +/// +/// @returns +/// The maximum value of x, y, and z. +/// +/// @ingroup HLSLCore +FfxUInt32x4 ffxMax3(FfxUInt32x4 x, FfxUInt32x4 y, FfxUInt32x4 z) +{ + return max(x, max(y, z)); +} + +/// Compute the median of three values. +/// +/// NOTE: This function should compile down to a single V_MED3_F32 operation on GCN/RDNA hardware. +/// +/// @param [in] x The first value to include in the median calculation. +/// @param [in] y The second value to include in the median calcuation. +/// @param [in] z The third value to include in the median calcuation. +/// +/// @returns +/// The median value of x, y, and z. +/// +/// @ingroup HLSLCore +FfxFloat32 ffxMed3(FfxFloat32 x, FfxFloat32 y, FfxFloat32 z) +{ + return max(min(x, y), min(max(x, y), z)); +} + +/// Compute the median of three values. +/// +/// NOTE: This function should compile down to a single V_MED3_F32 operation on GCN/RDNA hardware. +/// +/// @param [in] x The first value to include in the median calculation. +/// @param [in] y The second value to include in the median calcuation. +/// @param [in] z The third value to include in the median calcuation. +/// +/// @returns +/// The median value of x, y, and z. +/// +/// @ingroup HLSLCore +FfxFloat32x2 ffxMed3(FfxFloat32x2 x, FfxFloat32x2 y, FfxFloat32x2 z) +{ + return max(min(x, y), min(max(x, y), z)); +} + +/// Compute the median of three values. +/// +/// NOTE: This function should compile down to a single V_MED3_F32 operation on GCN/RDNA hardware. +/// +/// @param [in] x The first value to include in the median calculation. +/// @param [in] y The second value to include in the median calcuation. +/// @param [in] z The third value to include in the median calcuation. +/// +/// @returns +/// The median value of x, y, and z. +/// +/// @ingroup HLSLCore +FfxFloat32x3 ffxMed3(FfxFloat32x3 x, FfxFloat32x3 y, FfxFloat32x3 z) +{ + return max(min(x, y), min(max(x, y), z)); +} + +/// Compute the median of three values. +/// +/// NOTE: This function should compile down to a single V_MED3_F32 operation on GCN/RDNA hardware. +/// +/// @param [in] x The first value to include in the median calculation. +/// @param [in] y The second value to include in the median calcuation. +/// @param [in] z The third value to include in the median calcuation. +/// +/// @returns +/// The median value of x, y, and z. +/// +/// @ingroup HLSLCore +FfxFloat32x4 ffxMed3(FfxFloat32x4 x, FfxFloat32x4 y, FfxFloat32x4 z) +{ + return max(min(x, y), min(max(x, y), z)); +} + +/// Compute the median of three values. +/// +/// NOTE: This function should compile down to a single V_MED3_F32 operation on GCN/RDNA hardware. +/// +/// @param [in] x The first value to include in the median calculation. +/// @param [in] y The second value to include in the median calcuation. +/// @param [in] z The third value to include in the median calcuation. +/// +/// @returns +/// The median value of x, y, and z. +/// +/// @ingroup HLSL +FfxInt32 ffxMed3(FfxInt32 x, FfxInt32 y, FfxInt32 z) +{ + return max(min(x, y), min(max(x, y), z)); + // return min(max(min(y, z), x), max(y, z)); + // return max(max(x, y), z) == x ? max(y, z) : (max(max(x, y), z) == y ? max(x, z) : max(x, y)); +} + +/// Compute the median of three values. +/// +/// NOTE: This function should compile down to a single V_MED3_F32 operation on GCN/RDNA hardware. +/// +/// @param [in] x The first value to include in the median calculation. +/// @param [in] y The second value to include in the median calcuation. +/// @param [in] z The third value to include in the median calcuation. +/// +/// @returns +/// The median value of x, y, and z. +/// +/// @ingroup HLSL +FfxInt32x2 ffxMed3(FfxInt32x2 x, FfxInt32x2 y, FfxInt32x2 z) +{ + return max(min(x, y), min(max(x, y), z)); + // return min(max(min(y, z), x), max(y, z)); + // return max(max(x, y), z) == x ? max(y, z) : (max(max(x, y), z) == y ? max(x, z) : max(x, y)); +} + +/// Compute the median of three values. +/// +/// NOTE: This function should compile down to a single V_MED3_F32 operation on GCN/RDNA hardware. +/// +/// @param [in] x The first value to include in the median calculation. +/// @param [in] y The second value to include in the median calcuation. +/// @param [in] z The third value to include in the median calcuation. +/// +/// @returns +/// The median value of x, y, and z. +/// +/// @ingroup HLSL +FfxInt32x3 ffxMed3(FfxInt32x3 x, FfxInt32x3 y, FfxInt32x3 z) +{ + return max(min(x, y), min(max(x, y), z)); +} + +/// Compute the median of three values. +/// +/// NOTE: This function should compile down to a single V_MED3_I32 operation on GCN/RDNA hardware. +/// +/// @param [in] x The first value to include in the median calculation. +/// @param [in] y The second value to include in the median calcuation. +/// @param [in] z The third value to include in the median calcuation. +/// +/// @returns +/// The median value of x, y, and z. +/// +/// @ingroup HLSL +FfxInt32x4 ffxMed3(FfxInt32x4 x, FfxInt32x4 y, FfxInt32x4 z) +{ + return max(min(x, y), min(max(x, y), z)); +} + +/// Compute the minimum of three values. +/// +/// NOTE: This function should compile down to a single V_MIN3_F32 operation on GCN/RDNA hardware. +/// +/// @param [in] x The first value to include in the min calculation. +/// @param [in] y The second value to include in the min calcuation. +/// @param [in] z The third value to include in the min calcuation. +/// +/// @returns +/// The minimum value of x, y, and z. +/// +/// @ingroup HLSLCore +FfxFloat32 ffxMin3(FfxFloat32 x, FfxFloat32 y, FfxFloat32 z) +{ + return min(x, min(y, z)); +} + +/// Compute the minimum of three values. +/// +/// NOTE: This function should compile down to a single V_MIN3_F32 operation on GCN/RDNA hardware. +/// +/// @param [in] x The first value to include in the min calculation. +/// @param [in] y The second value to include in the min calcuation. +/// @param [in] z The third value to include in the min calcuation. +/// +/// @returns +/// The minimum value of x, y, and z. +/// +/// @ingroup HLSLCore +FfxFloat32x2 ffxMin3(FfxFloat32x2 x, FfxFloat32x2 y, FfxFloat32x2 z) +{ + return min(x, min(y, z)); +} + +/// Compute the minimum of three values. +/// +/// NOTE: This function should compile down to a single V_MIN3_F32 operation on GCN/RDNA hardware. +/// +/// @param [in] x The first value to include in the min calculation. +/// @param [in] y The second value to include in the min calcuation. +/// @param [in] z The third value to include in the min calcuation. +/// +/// @returns +/// The minimum value of x, y, and z. +/// +/// @ingroup HLSLCore +FfxFloat32x3 ffxMin3(FfxFloat32x3 x, FfxFloat32x3 y, FfxFloat32x3 z) +{ + return min(x, min(y, z)); +} + +/// Compute the minimum of three values. +/// +/// NOTE: This function should compile down to a single V_MIN3_F32 operation on GCN/RDNA hardware. +/// +/// @param [in] x The first value to include in the min calculation. +/// @param [in] y The second value to include in the min calcuation. +/// @param [in] z The third value to include in the min calcuation. +/// +/// @returns +/// The minimum value of x, y, and z. +/// +/// @ingroup HLSLCore +FfxFloat32x4 ffxMin3(FfxFloat32x4 x, FfxFloat32x4 y, FfxFloat32x4 z) +{ + return min(x, min(y, z)); +} + +/// Compute the minimum of three values. +/// +/// NOTE: This function should compile down to a single V_MIN3_F32 operation on GCN/RDNA hardware. +/// +/// @param [in] x The first value to include in the min calculation. +/// @param [in] y The second value to include in the min calcuation. +/// @param [in] z The third value to include in the min calcuation. +/// +/// @returns +/// The minimum value of x, y, and z. +/// +/// @ingroup HLSLCore +FfxUInt32 ffxMin3(FfxUInt32 x, FfxUInt32 y, FfxUInt32 z) +{ + return min(x, min(y, z)); +} + +/// Compute the minimum of three values. +/// +/// NOTE: This function should compile down to a single V_MIN3_F32 operation on GCN/RDNA hardware. +/// +/// @param [in] x The first value to include in the min calculation. +/// @param [in] y The second value to include in the min calcuation. +/// @param [in] z The third value to include in the min calcuation. +/// +/// @returns +/// The minimum value of x, y, and z. +/// +/// @ingroup HLSLCore +FfxUInt32x2 ffxMin3(FfxUInt32x2 x, FfxUInt32x2 y, FfxUInt32x2 z) +{ + return min(x, min(y, z)); +} + +/// Compute the minimum of three values. +/// +/// NOTE: This function should compile down to a single V_MIN3_F32 operation on GCN/RDNA hardware. +/// +/// @param [in] x The first value to include in the min calculation. +/// @param [in] y The second value to include in the min calculation. +/// @param [in] z The third value to include in the min calculation. +/// +/// @returns +/// The minimum value of x, y, and z. +/// +/// @ingroup HLSLCore +FfxUInt32x3 ffxMin3(FfxUInt32x3 x, FfxUInt32x3 y, FfxUInt32x3 z) +{ + return min(x, min(y, z)); +} + +/// Compute the minimum of three values. +/// +/// NOTE: This function should compile down to a single V_MIN3_F32 operation on GCN/RDNA hardware. +/// +/// @param [in] x The first value to include in the min calculation. +/// @param [in] y The second value to include in the min calcuation. +/// @param [in] z The third value to include in the min calcuation. +/// +/// @returns +/// The minimum value of x, y, and z. +/// +/// @ingroup HLSLCore +FfxUInt32x4 ffxMin3(FfxUInt32x4 x, FfxUInt32x4 y, FfxUInt32x4 z) +{ + return min(x, min(y, z)); +} + + +FfxUInt32 ffxAShrSU1(FfxUInt32 a, FfxUInt32 b) +{ + return FfxUInt32(FfxInt32(a) >> FfxInt32(b)); +} + +FfxUInt32 ffxPackF32(FfxFloat32x2 v){ + FfxUInt32x2 p = FfxUInt32x2(ffxF32ToF16(FfxFloat32x2(v).x), ffxF32ToF16(FfxFloat32x2(v).y)); + return p.x | (p.y << 16); +} + +FfxFloat32x2 ffxUnpackF32(FfxUInt32 a){ + return f16tof32(FfxUInt32x2(a & 0xFFFF, a >> 16)); +} + +FfxUInt32x2 ffxPackF32x2(FfxFloat32x4 v){ + return FfxUInt32x2(ffxPackF32(v.xy), ffxPackF32(v.zw)); +} + +FfxFloat32x4 ffxUnpackF32x2(FfxUInt32x2 a){ + return FfxFloat32x4(ffxUnpackF32(a.x), ffxUnpackF32(a.y)); +} + +//============================================================================================================================== +// HLSL HALF +//============================================================================================================================== +//============================================================================================================================== +// Need to use manual unpack to get optimal execution (don't use packed types in buffers directly). +// Unpack requires this pattern: https://gpuopen.com/first-steps-implementing-fp16/ +FFX_MIN16_F2 ffxUint32ToFloat16x2(FfxUInt32 x) +{ + FfxFloat32x2 t = f16tof32(FfxUInt32x2(x & 0xFFFF, x >> 16)); + return FFX_MIN16_F2(t); +} +FFX_MIN16_F4 ffxUint32x2ToFloat16x4(FfxUInt32x2 x) +{ + return FFX_MIN16_F4(ffxUint32ToFloat16x2(x.x), ffxUint32ToFloat16x2(x.y)); +} +FFX_MIN16_U2 ffxUint32ToUint16x2(FfxUInt32 x) +{ + FfxUInt32x2 t = FfxUInt32x2(x & 0xFFFF, x >> 16); + return FFX_MIN16_U2(t); +} +FFX_MIN16_U4 ffxUint32x2ToUint16x4(FfxUInt32x2 x) +{ + return FFX_MIN16_U4(ffxUint32ToUint16x2(x.x), ffxUint32ToUint16x2(x.y)); +} + +FfxUInt32x2 ffxFloat16x4ToUint32x2(FFX_MIN16_F4 v) +{ + FfxUInt32x2 result; + result.x = ffxF32ToF16(v.x) | (ffxF32ToF16(v.y) << 16); + result.y = ffxF32ToF16(v.z) | (ffxF32ToF16(v.w) << 16); + return result; +} + +/// @brief Inverts the value while avoiding division by zero. If the value is zero, zero is returned. +/// @param v Value to invert. +/// @return If v = 0 returns 0. If v != 0 returns 1/v. +FfxFloat32 ffxInvertSafe(FfxFloat32 v){ + FfxFloat32 s = FfxFloat32(sign(v)); + FfxFloat32 s2 = s*s; + return s2/(v + s2 - 1.0); +} + +/// @brief Inverts the value while avoiding division by zero. If the value is zero, zero is returned. +/// @param v Value to invert. +/// @return If v = 0 returns 0. If v != 0 returns 1/v. +FfxFloat32x2 ffxInvertSafe(FfxFloat32x2 v){ + FfxFloat32x2 s = FfxFloat32x2(sign(v)); + FfxFloat32x2 s2 = s*s; + return s2/(v + s2 - FfxFloat32x2(1.0, 1.0)); +} + +/// @brief Inverts the value while avoiding division by zero. If the value is zero, zero is returned. +/// @param v Value to invert. +/// @return If v = 0 returns 0. If v != 0 returns 1/v. +FfxFloat32x3 ffxInvertSafe(FfxFloat32x3 v){ + FfxFloat32x3 s = FfxFloat32x3(sign(v)); + FfxFloat32x3 s2 = s*s; + return s2/(v + s2 - FfxFloat32x3(1.0, 1.0, 1.0)); +} + +/// @brief Inverts the value while avoiding division by zero. If the value is zero, zero is returned. +/// @param v Value to invert. +/// @return If v = 0 returns 0. If v != 0 returns 1/v. +FfxFloat32x4 ffxInvertSafe(FfxFloat32x4 v){ + FfxFloat32x4 s = FfxFloat32x4(sign(v)); + FfxFloat32x4 s2 = s*s; + return s2/(v + s2 - FfxFloat32x4(1.0, 1.0, 1.0, 1.0)); +} + +#define FFX_UINT32_TO_FLOAT16X2(x) ffxUint32ToFloat16x2(FfxUInt32(x)) +#if FFX_HALF + +#define FFX_UINT32X2_TO_FLOAT16X4(x) ffxUint32x2ToFloat16x4(FfxUInt32x2(x)) +#define FFX_UINT32_TO_UINT16X2(x) ffxUint32ToUint16x2(FfxUInt32(x)) +#define FFX_UINT32X2_TO_UINT16X4(x) ffxUint32x2ToUint16x4(FfxUInt32x2(x)) + +FfxUInt32 ffxPackF16(FfxFloat16x2 v){ + FfxUInt32x2 p = FfxUInt32x2(ffxF32ToF16(FfxFloat32x2(v).x), ffxF32ToF16(FfxFloat32x2(v).y)); + return p.x | (p.y << 16); +} + +FfxFloat16x2 ffxUnpackF16(FfxUInt32 a){ + return FfxFloat16x2(f16tof32(FfxUInt32x2(a & 0xFFFF, a >> 16))); +} + +//------------------------------------------------------------------------------------------------------------------------------ +FfxUInt32 FFX_MIN16_F2ToUint32(FFX_MIN16_F2 x) +{ + return ffxF32ToF16(x.x) + (ffxF32ToF16(x.y) << 16); +} +FfxUInt32x2 FFX_MIN16_F4ToUint32x2(FFX_MIN16_F4 x) +{ + return FfxUInt32x2(FFX_MIN16_F2ToUint32(x.xy), FFX_MIN16_F2ToUint32(x.zw)); +} +FfxUInt32 FFX_MIN16_U2ToUint32(FFX_MIN16_U2 x) +{ + return FfxUInt32(x.x) + (FfxUInt32(x.y) << 16); +} +FfxUInt32x2 FFX_MIN16_U4ToUint32x2(FFX_MIN16_U4 x) +{ + return FfxUInt32x2(FFX_MIN16_U2ToUint32(x.xy), FFX_MIN16_U2ToUint32(x.zw)); +} +#define FFX_FLOAT16X2_TO_UINT32(x) FFX_MIN16_F2ToUint32(FFX_MIN16_F2(x)) +#define FFX_FLOAT16X4_TO_UINT32X2(x) FFX_MIN16_F4ToUint32x2(FFX_MIN16_F4(x)) +#define FFX_UINT16X2_TO_UINT32(x) FFX_MIN16_U2ToUint32(FFX_MIN16_U2(x)) +#define FFX_UINT16X4_TO_UINT32X2(x) FFX_MIN16_U4ToUint32x2(FFX_MIN16_U4(x)) + +#if (FFX_HLSL_SM >= 62) && !defined(FFX_NO_16_BIT_CAST) +#define FFX_TO_UINT16(x) asuint16(x) +#define FFX_TO_UINT16X2(x) asuint16(x) +#define FFX_TO_UINT16X3(x) asuint16(x) +#define FFX_TO_UINT16X4(x) asuint16(x) +#else +#define FFX_TO_UINT16(a) FFX_MIN16_U(ffxF32ToF16(FfxFloat32(a))) +#define FFX_TO_UINT16X2(a) FFX_MIN16_U2(FFX_TO_UINT16((a).x), FFX_TO_UINT16((a).y)) +#define FFX_TO_UINT16X3(a) FFX_MIN16_U3(FFX_TO_UINT16((a).x), FFX_TO_UINT16((a).y), FFX_TO_UINT16((a).z)) +#define FFX_TO_UINT16X4(a) FFX_MIN16_U4(FFX_TO_UINT16((a).x), FFX_TO_UINT16((a).y), FFX_TO_UINT16((a).z), FFX_TO_UINT16((a).w)) +#endif // #if (FFX_HLSL_SM>=62) && !defined(FFX_NO_16_BIT_CAST) + +#if (FFX_HLSL_SM >= 62) && !defined(FFX_NO_16_BIT_CAST) +#define FFX_TO_FLOAT16(x) asfloat16(x) +#define FFX_TO_FLOAT16X2(x) asfloat16(x) +#define FFX_TO_FLOAT16X3(x) asfloat16(x) +#define FFX_TO_FLOAT16X4(x) asfloat16(x) +#else +#define FFX_TO_FLOAT16(a) FFX_MIN16_F(f16tof32(FfxUInt32(a))) +#define FFX_TO_FLOAT16X2(a) FFX_MIN16_F2(FFX_TO_FLOAT16((a).x), FFX_TO_FLOAT16((a).y)) +#define FFX_TO_FLOAT16X3(a) FFX_MIN16_F3(FFX_TO_FLOAT16((a).x), FFX_TO_FLOAT16((a).y), FFX_TO_FLOAT16((a).z)) +#define FFX_TO_FLOAT16X4(a) FFX_MIN16_F4(FFX_TO_FLOAT16((a).x), FFX_TO_FLOAT16((a).y), FFX_TO_FLOAT16((a).z), FFX_TO_FLOAT16((a).w)) +#endif // #if (FFX_HLSL_SM>=62) && !defined(FFX_NO_16_BIT_CAST) + +//============================================================================================================================== +#define FFX_BROADCAST_FLOAT16(a) FFX_MIN16_F(a) +#define FFX_BROADCAST_FLOAT16X2(a) FFX_MIN16_F(a) +#define FFX_BROADCAST_FLOAT16X3(a) FFX_MIN16_F(a) +#define FFX_BROADCAST_FLOAT16X4(a) FFX_MIN16_F(a) + +//------------------------------------------------------------------------------------------------------------------------------ +#define FFX_BROADCAST_INT16(a) FFX_MIN16_I(a) +#define FFX_BROADCAST_INT16X2(a) FFX_MIN16_I(a) +#define FFX_BROADCAST_INT16X3(a) FFX_MIN16_I(a) +#define FFX_BROADCAST_INT16X4(a) FFX_MIN16_I(a) + +//------------------------------------------------------------------------------------------------------------------------------ +#define FFX_BROADCAST_UINT16(a) FFX_MIN16_U(a) +#define FFX_BROADCAST_UINT16X2(a) FFX_MIN16_U(a) +#define FFX_BROADCAST_UINT16X3(a) FFX_MIN16_U(a) +#define FFX_BROADCAST_UINT16X4(a) FFX_MIN16_U(a) + +//============================================================================================================================== +FFX_MIN16_U ffxAbsHalf(FFX_MIN16_U a) +{ + return FFX_MIN16_U(abs(FFX_MIN16_I(a))); +} +FFX_MIN16_U2 ffxAbsHalf(FFX_MIN16_U2 a) +{ + return FFX_MIN16_U2(abs(FFX_MIN16_I2(a))); +} +FFX_MIN16_U3 ffxAbsHalf(FFX_MIN16_U3 a) +{ + return FFX_MIN16_U3(abs(FFX_MIN16_I3(a))); +} +FFX_MIN16_U4 ffxAbsHalf(FFX_MIN16_U4 a) +{ + return FFX_MIN16_U4(abs(FFX_MIN16_I4(a))); +} +//------------------------------------------------------------------------------------------------------------------------------ +FFX_MIN16_F ffxClampHalf(FFX_MIN16_F x, FFX_MIN16_F n, FFX_MIN16_F m) +{ + return max(n, min(x, m)); +} +FFX_MIN16_F2 ffxClampHalf(FFX_MIN16_F2 x, FFX_MIN16_F2 n, FFX_MIN16_F2 m) +{ + return max(n, min(x, m)); +} +FFX_MIN16_F3 ffxClampHalf(FFX_MIN16_F3 x, FFX_MIN16_F3 n, FFX_MIN16_F3 m) +{ + return max(n, min(x, m)); +} +FFX_MIN16_F4 ffxClampHalf(FFX_MIN16_F4 x, FFX_MIN16_F4 n, FFX_MIN16_F4 m) +{ + return max(n, min(x, m)); +} +//------------------------------------------------------------------------------------------------------------------------------ +// V_FRACT_F16 (note DX frac() is different). +FFX_MIN16_F ffxFract(FFX_MIN16_F x) +{ + return x - floor(x); +} +FFX_MIN16_F2 ffxFract(FFX_MIN16_F2 x) +{ + return x - floor(x); +} +FFX_MIN16_F3 ffxFract(FFX_MIN16_F3 x) +{ + return x - floor(x); +} +FFX_MIN16_F4 ffxFract(FFX_MIN16_F4 x) +{ + return x - floor(x); +} +//------------------------------------------------------------------------------------------------------------------------------ +FFX_MIN16_F ffxLerp(FFX_MIN16_F x, FFX_MIN16_F y, FFX_MIN16_F a) +{ + return lerp(x, y, a); +} +FFX_MIN16_F2 ffxLerp(FFX_MIN16_F2 x, FFX_MIN16_F2 y, FFX_MIN16_F a) +{ + return lerp(x, y, a); +} +FFX_MIN16_F2 ffxLerp(FFX_MIN16_F2 x, FFX_MIN16_F2 y, FFX_MIN16_F2 a) +{ + return lerp(x, y, a); +} +FFX_MIN16_F3 ffxLerp(FFX_MIN16_F3 x, FFX_MIN16_F3 y, FFX_MIN16_F a) +{ + return lerp(x, y, a); +} +FFX_MIN16_F3 ffxLerp(FFX_MIN16_F3 x, FFX_MIN16_F3 y, FFX_MIN16_F3 a) +{ + return lerp(x, y, a); +} +FFX_MIN16_F4 ffxLerp(FFX_MIN16_F4 x, FFX_MIN16_F4 y, FFX_MIN16_F a) +{ + return lerp(x, y, a); +} +FFX_MIN16_F4 ffxLerp(FFX_MIN16_F4 x, FFX_MIN16_F4 y, FFX_MIN16_F4 a) +{ + return lerp(x, y, a); +} +//------------------------------------------------------------------------------------------------------------------------------ +FFX_MIN16_F ffxMax3Half(FFX_MIN16_F x, FFX_MIN16_F y, FFX_MIN16_F z) +{ + return max(x, max(y, z)); +} +FFX_MIN16_F2 ffxMax3Half(FFX_MIN16_F2 x, FFX_MIN16_F2 y, FFX_MIN16_F2 z) +{ + return max(x, max(y, z)); +} +FFX_MIN16_F3 ffxMax3Half(FFX_MIN16_F3 x, FFX_MIN16_F3 y, FFX_MIN16_F3 z) +{ + return max(x, max(y, z)); +} +FFX_MIN16_F4 ffxMax3Half(FFX_MIN16_F4 x, FFX_MIN16_F4 y, FFX_MIN16_F4 z) +{ + return max(x, max(y, z)); +} +//------------------------------------------------------------------------------------------------------------------------------ +FFX_MIN16_F ffxMin3Half(FFX_MIN16_F x, FFX_MIN16_F y, FFX_MIN16_F z) +{ + return min(x, min(y, z)); +} +FFX_MIN16_F2 ffxMin3Half(FFX_MIN16_F2 x, FFX_MIN16_F2 y, FFX_MIN16_F2 z) +{ + return min(x, min(y, z)); +} +FFX_MIN16_F3 ffxMin3Half(FFX_MIN16_F3 x, FFX_MIN16_F3 y, FFX_MIN16_F3 z) +{ + return min(x, min(y, z)); +} +FFX_MIN16_F4 ffxMin3Half(FFX_MIN16_F4 x, FFX_MIN16_F4 y, FFX_MIN16_F4 z) +{ + return min(x, min(y, z)); +} +//------------------------------------------------------------------------------------------------------------------------------ +FFX_MIN16_F ffxMed3Half(FFX_MIN16_F x, FFX_MIN16_F y, FFX_MIN16_F z) +{ + return max(min(x, y), min(max(x, y), z)); +} +FFX_MIN16_F2 ffxMed3Half(FFX_MIN16_F2 x, FFX_MIN16_F2 y, FFX_MIN16_F2 z) +{ + return max(min(x, y), min(max(x, y), z)); +} +FFX_MIN16_F3 ffxMed3Half(FFX_MIN16_F3 x, FFX_MIN16_F3 y, FFX_MIN16_F3 z) +{ + return max(min(x, y), min(max(x, y), z)); +} +FFX_MIN16_F4 ffxMed3Half(FFX_MIN16_F4 x, FFX_MIN16_F4 y, FFX_MIN16_F4 z) +{ + return max(min(x, y), min(max(x, y), z)); +} +//------------------------------------------------------------------------------------------------------------------------------ +FFX_MIN16_I ffxMed3Half(FFX_MIN16_I x, FFX_MIN16_I y, FFX_MIN16_I z) +{ + return max(min(x, y), min(max(x, y), z)); +} +FFX_MIN16_I2 ffxMed3Half(FFX_MIN16_I2 x, FFX_MIN16_I2 y, FFX_MIN16_I2 z) +{ + return max(min(x, y), min(max(x, y), z)); +} +FFX_MIN16_I3 ffxMed3Half(FFX_MIN16_I3 x, FFX_MIN16_I3 y, FFX_MIN16_I3 z) +{ + return max(min(x, y), min(max(x, y), z)); +} +FFX_MIN16_I4 ffxMed3Half(FFX_MIN16_I4 x, FFX_MIN16_I4 y, FFX_MIN16_I4 z) +{ + return max(min(x, y), min(max(x, y), z)); +} +//------------------------------------------------------------------------------------------------------------------------------ +FFX_MIN16_F ffxReciprocalHalf(FFX_MIN16_F x) +{ + return rcp(x); +} +FFX_MIN16_F2 ffxReciprocalHalf(FFX_MIN16_F2 x) +{ + return rcp(x); +} +FFX_MIN16_F3 ffxReciprocalHalf(FFX_MIN16_F3 x) +{ + return rcp(x); +} +FFX_MIN16_F4 ffxReciprocalHalf(FFX_MIN16_F4 x) +{ + return rcp(x); +} +//------------------------------------------------------------------------------------------------------------------------------ +FFX_MIN16_F ffxReciprocalSquareRootHalf(FFX_MIN16_F x) +{ + return rsqrt(x); +} +FFX_MIN16_F2 ffxReciprocalSquareRootHalf(FFX_MIN16_F2 x) +{ + return rsqrt(x); +} +FFX_MIN16_F3 ffxReciprocalSquareRootHalf(FFX_MIN16_F3 x) +{ + return rsqrt(x); +} +FFX_MIN16_F4 ffxReciprocalSquareRootHalf(FFX_MIN16_F4 x) +{ + return rsqrt(x); +} +//------------------------------------------------------------------------------------------------------------------------------ +FFX_MIN16_F ffxSaturate(FFX_MIN16_F x) +{ + return saturate(x); +} +FFX_MIN16_F2 ffxSaturate(FFX_MIN16_F2 x) +{ + return saturate(x); +} +FFX_MIN16_F3 ffxSaturate(FFX_MIN16_F3 x) +{ + return saturate(x); +} +FFX_MIN16_F4 ffxSaturate(FFX_MIN16_F4 x) +{ + return saturate(x); +} +//------------------------------------------------------------------------------------------------------------------------------ +FFX_MIN16_U ffxBitShiftRightHalf(FFX_MIN16_U a, FFX_MIN16_U b) +{ + return FFX_MIN16_U(FFX_MIN16_I(a) >> FFX_MIN16_I(b)); +} +FFX_MIN16_U2 ffxBitShiftRightHalf(FFX_MIN16_U2 a, FFX_MIN16_U2 b) +{ + return FFX_MIN16_U2(FFX_MIN16_I2(a) >> FFX_MIN16_I2(b)); +} +FFX_MIN16_U3 ffxBitShiftRightHalf(FFX_MIN16_U3 a, FFX_MIN16_U3 b) +{ + return FFX_MIN16_U3(FFX_MIN16_I3(a) >> FFX_MIN16_I3(b)); +} +FFX_MIN16_U4 ffxBitShiftRightHalf(FFX_MIN16_U4 a, FFX_MIN16_U4 b) +{ + return FFX_MIN16_U4(FFX_MIN16_I4(a) >> FFX_MIN16_I4(b)); +} +#endif // FFX_HALF + +//============================================================================================================================== +// HLSL WAVE +//============================================================================================================================== +#if defined(FFX_WAVE) +// Where 'x' must be a compile time literal. +FfxFloat32 ffxWaveXorF1(FfxFloat32 v, FfxUInt32 x) +{ + return WaveReadLaneAt(v, WaveGetLaneIndex() ^ x); +} +FfxFloat32x2 ffxWaveXorF2(FfxFloat32x2 v, FfxUInt32 x) +{ + return WaveReadLaneAt(v, WaveGetLaneIndex() ^ x); +} +FfxFloat32x3 ffxWaveXorF3(FfxFloat32x3 v, FfxUInt32 x) +{ + return WaveReadLaneAt(v, WaveGetLaneIndex() ^ x); +} +FfxFloat32x4 ffxWaveXorF4(FfxFloat32x4 v, FfxUInt32 x) +{ + return WaveReadLaneAt(v, WaveGetLaneIndex() ^ x); +} +FfxUInt32 ffxWaveXorU1(FfxUInt32 v, FfxUInt32 x) +{ + return WaveReadLaneAt(v, WaveGetLaneIndex() ^ x); +} +FfxUInt32x2 ffxWaveXorU1(FfxUInt32x2 v, FfxUInt32 x) +{ + return WaveReadLaneAt(v, WaveGetLaneIndex() ^ x); +} +FfxUInt32x3 ffxWaveXorU1(FfxUInt32x3 v, FfxUInt32 x) +{ + return WaveReadLaneAt(v, WaveGetLaneIndex() ^ x); +} +FfxUInt32x4 ffxWaveXorU1(FfxUInt32x4 v, FfxUInt32 x) +{ + return WaveReadLaneAt(v, WaveGetLaneIndex() ^ x); +} +FfxBoolean ffxWaveIsFirstLane() +{ + return WaveIsFirstLane(); +} +FfxUInt32 ffxWaveLaneIndex() +{ + return WaveGetLaneIndex(); +} +FfxBoolean ffxWaveReadAtLaneIndexB1(FfxBoolean v, FfxUInt32 x) +{ + return WaveReadLaneAt(v, x); +} +FfxUInt32 ffxWavePrefixCountBits(FfxBoolean v) +{ + return WavePrefixCountBits(v); +} +FfxUInt32 ffxWaveActiveCountBits(FfxBoolean v) +{ + return WaveActiveCountBits(v); +} +FfxUInt32 ffxWaveReadLaneFirstU1(FfxUInt32 v) +{ + return WaveReadLaneFirst(v); +} +FfxUInt32x2 ffxWaveReadLaneFirstU2(FfxUInt32x2 v) +{ + return WaveReadLaneFirst(v); +} +FfxBoolean ffxWaveReadLaneFirstB1(FfxBoolean v) +{ + return WaveReadLaneFirst(v); +} +FfxUInt32 ffxWaveOr(FfxUInt32 a) +{ + return WaveActiveBitOr(a); +} +FfxUInt32 ffxWaveMin(FfxUInt32 a) +{ + return WaveActiveMin(a); +} +FfxFloat32 ffxWaveMin(FfxFloat32 a) +{ + return WaveActiveMin(a); +} +FfxUInt32 ffxWaveMax(FfxUInt32 a) +{ + return WaveActiveMax(a); +} +FfxFloat32 ffxWaveMax(FfxFloat32 a) +{ + return WaveActiveMax(a); +} +FfxUInt32 ffxWaveSum(FfxUInt32 a) +{ + return WaveActiveSum(a); +} +FfxFloat32 ffxWaveSum(FfxFloat32 a) +{ + return WaveActiveSum(a); +} +FfxUInt32 ffxWaveLaneCount() +{ + return WaveGetLaneCount(); +} +FfxBoolean ffxWaveAllTrue(FfxBoolean v) +{ + return WaveActiveAllTrue(v); +} +FfxFloat32 ffxQuadReadX(FfxFloat32 v) +{ + return QuadReadAcrossX(v); +} +FfxFloat32x2 ffxQuadReadX(FfxFloat32x2 v) +{ + return QuadReadAcrossX(v); +} +FfxFloat32 ffxQuadReadY(FfxFloat32 v) +{ + return QuadReadAcrossY(v); +} +FfxFloat32x2 ffxQuadReadY(FfxFloat32x2 v) +{ + return QuadReadAcrossY(v); +} + +#if FFX_HALF +FfxFloat16x2 ffxWaveXorFloat16x2(FfxFloat16x2 v, FfxUInt32 x) +{ + return FFX_UINT32_TO_FLOAT16X2(WaveReadLaneAt(FFX_FLOAT16X2_TO_UINT32(v), WaveGetLaneIndex() ^ x)); +} +FfxFloat16x4 ffxWaveXorFloat16x4(FfxFloat16x4 v, FfxUInt32 x) +{ + return FFX_UINT32X2_TO_FLOAT16X4(WaveReadLaneAt(FFX_FLOAT16X4_TO_UINT32X2(v), WaveGetLaneIndex() ^ x)); +} +FfxUInt16x2 ffxWaveXorUint16x2(FfxUInt16x2 v, FfxUInt32 x) +{ + return FFX_UINT32_TO_UINT16X2(WaveReadLaneAt(FFX_UINT16X2_TO_UINT32(v), WaveGetLaneIndex() ^ x)); +} +FfxUInt16x4 ffxWaveXorUint16x4(FfxUInt16x4 v, FfxUInt32 x) +{ + return FFX_UINT32X2_TO_UINT16X4(WaveReadLaneAt(FFX_UINT16X4_TO_UINT32X2(v), WaveGetLaneIndex() ^ x)); +} +#endif // FFX_HALF +#endif // #if defined(FFX_WAVE) diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/ffx_core_portability.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/ffx_core_portability.h new file mode 100644 index 00000000..12147b9a --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/ffx_core_portability.h @@ -0,0 +1,46 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +void ffxOpAAddOneF3(FFX_PARAMETER_OUT FfxFloat32x3 d, FfxFloat32x3 a, FfxFloat32 b) +{ + d = a + ffxBroadcast3(b); +} + +void ffxOpACpyF3(FFX_PARAMETER_OUT FfxFloat32x3 d, FfxFloat32x3 a) +{ + d = a; +} + +void ffxOpAMulF3(FFX_PARAMETER_OUT FfxFloat32x3 d, FfxFloat32x3 a, FfxFloat32x3 b) +{ + d = a * b; +} + +void ffxOpAMulOneF3(FFX_PARAMETER_OUT FfxFloat32x3 d, FfxFloat32x3 a, FfxFloat32 b) +{ + d = a * b; +} + +void ffxOpARcpF3(FFX_PARAMETER_OUT FfxFloat32x3 d, FfxFloat32x3 a) +{ + d = ffxReciprocal(a); +} diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/frameinterpolation/ffx_frameinterpolation.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/frameinterpolation/ffx_frameinterpolation.h new file mode 100644 index 00000000..ccf2e23b --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/frameinterpolation/ffx_frameinterpolation.h @@ -0,0 +1,187 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#ifndef FFX_FRAMEINTERPOLATION_H +#define FFX_FRAMEINTERPOLATION_H + +struct InterpolationSourceColor +{ + FfxFloat32x3 fRaw; + FfxFloat32x3 fLinear; + FfxFloat32 fBilinearWeightSum; +}; + +InterpolationSourceColor NewInterpolationSourceColor() +{ + InterpolationSourceColor c; + c.fRaw = FfxFloat32x3(0.0, 0.0, 0.0); + c.fLinear = FfxFloat32x3(0.0, 0.0, 0.0); + c.fBilinearWeightSum = 0.0; + return c; +} + +InterpolationSourceColor SampleTextureBilinear(FfxBoolean isCurrent, FfxFloat32x2 fUv, FfxFloat32x2 fMotionVector, FfxInt32x2 texSize) +{ + InterpolationSourceColor result = NewInterpolationSourceColor(); + + FfxFloat32x2 fReprojectedUv = fUv + fMotionVector; + BilinearSamplingData bilinearInfo = GetBilinearSamplingData(fReprojectedUv, texSize); + + FfxFloat32x3 fColor = FfxFloat32x3(0.0, 0.0, 0.0); + FfxFloat32 fWeightSum = 0.0f; + for (FfxInt32 iSampleIndex = 0; iSampleIndex < 4; iSampleIndex++) { + + const FfxInt32x2 iOffset = bilinearInfo.iOffsets[iSampleIndex]; + const FfxInt32x2 iSamplePos = bilinearInfo.iBasePos + iOffset; + + if (IsInRect(iSamplePos, InterpolationRectBase(), InterpolationRectSize())) + { + FfxFloat32 fWeight = bilinearInfo.fWeights[iSampleIndex]; + + if (isCurrent) + fColor += LoadCurrentBackbuffer(iSamplePos).rgb * fWeight; + else + fColor += LoadPreviousBackbuffer(iSamplePos).rgb * fWeight; + fWeightSum += fWeight; + } + } + + //normalize colors + fColor = (fWeightSum != 0.0f) ? fColor / fWeightSum : FfxFloat32x3(0.0f, 0.0f, 0.0f); + + result.fRaw = fColor; + result.fLinear = RawRGBToLinear(fColor); + result.fBilinearWeightSum = fWeightSum; + + return result; +} + +void updateInPaintingWeight(inout FfxFloat32 fInPaintingWeight, FfxFloat32 fFactor) +{ + fInPaintingWeight = ffxSaturate(ffxMax(fInPaintingWeight, fFactor)); +} + +void computeInterpolatedColor(FfxUInt32x2 iPxPos, out FfxFloat32x3 fInterpolatedColor, inout FfxFloat32 fInPaintingWeight) +{ + const FfxFloat32x2 fUvInInterpolationRect = (FfxFloat32x2(iPxPos - InterpolationRectBase()) + 0.5f) / InterpolationRectSize(); + const FfxFloat32x2 fUvInScreenSpace = (FfxFloat32x2(iPxPos) + 0.5f) / DisplaySize(); + const FfxFloat32x2 fLrUvInInterpolationRect = fUvInInterpolationRect * (FfxFloat32x2(RenderSize()) / GetMaxRenderSize()); + + const FfxFloat32x2 fUvLetterBoxScale = FfxFloat32x2(InterpolationRectSize()) / DisplaySize(); + + // game MV are top left aligned, the function scales them to render res UV + VectorFieldEntry gameMv; + LoadInpaintedGameFieldMv(fUvInInterpolationRect, gameMv); + + // OF is done on the back buffers which already have black bars + VectorFieldEntry ofMv; + SampleOpticalFlowMotionVectorField(fUvInScreenSpace, ofMv); + + // Binarize disucclusion factor + FfxFloat32x2 fDisocclusionFactor = FfxFloat32x2(FFX_EQUAL(ffxSaturate(SampleDisocclusionMask(fLrUvInInterpolationRect).xy), FfxFloat32x2(1.0, 1.0))); + + InterpolationSourceColor fPrevColorGame = SampleTextureBilinear(false, fUvInScreenSpace, +gameMv.fMotionVector * fUvLetterBoxScale, DisplaySize()); // Get in previous frame buffer, the color of interpolated pixel + InterpolationSourceColor fCurrColorGame = SampleTextureBilinear(true, fUvInScreenSpace, -gameMv.fMotionVector * fUvLetterBoxScale, DisplaySize()); // Get color in current framebuffer, of color of interpolated pixel + + InterpolationSourceColor fPrevColorOF = SampleTextureBilinear(false, fUvInScreenSpace, +ofMv.fMotionVector * fUvLetterBoxScale, DisplaySize()); + InterpolationSourceColor fCurrColorOF = SampleTextureBilinear(true, fUvInScreenSpace, -ofMv.fMotionVector * fUvLetterBoxScale, DisplaySize()); + + FfxFloat32 fDisoccludedFactor = 0.0f; + + // Disocclusion logic + { + fDisocclusionFactor.x *= FfxFloat32(!gameMv.bPosOutside); // fDisocclusionFactor.x of 1 means the pos of interpolated pixel is within bounds of previous frame. + fDisocclusionFactor.y *= FfxFloat32(!gameMv.bNegOutside); // fDisocclusionFactor.y of 1 means the pos of interpolated pixel is within bounds of current frame + + // Inpaint in bi-directional disocclusion areas + updateInPaintingWeight(fInPaintingWeight, FfxFloat32(length(fDisocclusionFactor) <= FFX_FRAMEINTERPOLATION_EPSILON)); + + FfxFloat32 t = 0.5f; + t += 0.5f * (1 - (fDisocclusionFactor.x)); + t -= 0.5f * (1 - (fDisocclusionFactor.y)); + // Say if fDisocclusionFactor.x is 1 and fDisocclusionFactor.y = 0, then t will be 0. fInterpolatedColor will be entirely from fPrevColorGame + fInterpolatedColor = ffxLerp(fPrevColorGame.fRaw, fCurrColorGame.fRaw, ffxSaturate(t)); + fDisoccludedFactor = ffxSaturate(1 - ffxMin(fDisocclusionFactor.x, fDisocclusionFactor.y)); + + if (fPrevColorGame.fBilinearWeightSum == 0.0f) + { + fInterpolatedColor = fCurrColorGame.fRaw; + } + else if (fCurrColorGame.fBilinearWeightSum == 0.0f) + { + fInterpolatedColor = fPrevColorGame.fRaw; + } + if (fPrevColorGame.fBilinearWeightSum == 0 && fCurrColorGame.fBilinearWeightSum == 0) + { + fInPaintingWeight = 1.0f; + } + } + + { + + FfxFloat32 ofT = 0.5f; + + if (fPrevColorOF.fBilinearWeightSum > 0 && fCurrColorOF.fBilinearWeightSum > 0) + { + ofT = 0.5f; + } + else if (fPrevColorOF.fBilinearWeightSum > 0) + { + ofT = 0; + } else { + ofT = 1; + } + + const FfxFloat32x3 ofColor = ffxLerp(fPrevColorOF.fRaw, fCurrColorOF.fRaw, ofT); + + FfxFloat32 fOF_Sim = NormalizedDot3(fPrevColorOF.fRaw, fCurrColorOF.fRaw); + FfxFloat32 fGame_Sim = NormalizedDot3(fPrevColorGame.fRaw, fCurrColorGame.fRaw); + + fGame_Sim = ffxLerp(ffxMax(FFX_FRAMEINTERPOLATION_EPSILON, fGame_Sim), 1.0f, ffxSaturate(fDisoccludedFactor)); + FfxFloat32 fGameMvBias = ffxPow(ffxSaturate(fGame_Sim / ffxMax(FFX_FRAMEINTERPOLATION_EPSILON, fOF_Sim)), 1.0f); + + const FfxFloat32 fFrameIndexFactor = FfxFloat32(FrameIndexSinceLastReset() < 10); + fGameMvBias = ffxLerp(fGameMvBias, 1.0f, fFrameIndexFactor); + + fInterpolatedColor = ffxLerp(ofColor, fInterpolatedColor, ffxSaturate(fGameMvBias)); + } +} + +void computeFrameinterpolation(FfxInt32x2 iPxPos) +{ + FfxFloat32x3 fColor = FfxFloat32x3(0, 0, 0); + FfxFloat32 fInPaintingWeight = 0.0f; + + if (IsInRect(iPxPos, InterpolationRectBase(), InterpolationRectSize()) == false || FrameIndexSinceLastReset() == 0) + { + // if we just reset or we are out of the interpolation rect, copy the current back buffer and don't interpolate + fColor = LoadCurrentBackbuffer(iPxPos); + } + else + { + computeInterpolatedColor(iPxPos, fColor, fInPaintingWeight); + } + + StoreFrameinterpolationOutput(FfxInt32x2(iPxPos), FfxFloat32x4(fColor, fInPaintingWeight)); +} + +#endif // FFX_FRAMEINTERPOLATION_H diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/frameinterpolation/ffx_frameinterpolation_callbacks_glsl.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/frameinterpolation/ffx_frameinterpolation_callbacks_glsl.h new file mode 100644 index 00000000..20c5c296 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/frameinterpolation/ffx_frameinterpolation_callbacks_glsl.h @@ -0,0 +1,758 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#include "ffx_frameinterpolation_resources.h" +#include "ffx_core.h" + +#define COUNTER_SPD 0 +#define COUNTER_FRAME_INDEX_SINCE_LAST_RESET 1 + + /////////////////////////////////////////////// + // declare CBs and CB accessors +/////////////////////////////////////////////// +#if defined(FFX_FRAMEINTERPOLATION_BIND_CB_FRAMEINTERPOLATION) + layout (set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_CB_FRAMEINTERPOLATION, std140) uniform cbFI_t + { + FfxInt32x2 renderSize; + FfxInt32x2 displaySize; + + FfxFloat32x2 displaySizeRcp; + FfxFloat32 cameraNear; + FfxFloat32 cameraFar; + + FfxInt32x2 upscalerTargetSize; + FfxInt32 Mode; + FfxInt32 reset; + + FfxFloat32x4 fDeviceToViewDepth; + + FfxFloat32 deltaTime; + FfxInt32 HUDLessAttachedFactor; + FfxInt32x2 distortionFieldSize; + + FfxFloat32x2 opticalFlowScale; + FfxInt32 opticalFlowBlockSize; + FfxUInt32 dispatchFlags; + + FfxInt32x2 maxRenderSize; + FfxInt32 opticalFlowHalfResMode; + FfxInt32 NumInstances; + + FfxInt32x2 interpolationRectBase; + FfxInt32x2 interpolationRectSize; + + FfxFloat32x3 debugBarColor; + FfxUInt32 backBufferTransferFunction; + + FfxFloat32x2 minMaxLuminance; + FfxFloat32 fTanHalfFOV; + FfxInt32 _pad1; + + FfxFloat32x2 fJitter; + FfxFloat32x2 fMotionVectorScale; + } cbFI; + + FfxFloat32x2 Jitter() + { + return cbFI.fJitter; + } + + FfxInt32x2 InterpolationRectBase() + { + return cbFI.interpolationRectBase; + } + + FfxInt32x2 InterpolationRectSize() + { + return cbFI.interpolationRectSize; + } + + FfxFloat32x2 MotionVectorScale() + { + return cbFI.fMotionVectorScale; + } + + FfxInt32x2 RenderSize() + { + return cbFI.renderSize; + } + + FfxInt32x2 DisplaySize() + { + return cbFI.displaySize; + } + + FfxBoolean Reset() + { + return cbFI.reset == 1; + } + + FfxFloat32x4 DeviceToViewSpaceTransformFactors() + { + return cbFI.fDeviceToViewDepth; + } + + FfxInt32x2 GetOpticalFlowSize() + { + FfxInt32x2 iOpticalFlowSize = FfxInt32x2((1.0 / cbFI.opticalFlowScale) / FfxFloat32x2(cbFI.opticalFlowBlockSize.xx)); + + return iOpticalFlowSize; + } + + FfxInt32x2 GetOpticalFlowSize2() + { + return GetOpticalFlowSize() * 1; + } + + FfxFloat32x2 GetOpticalFlowScale() + { + return cbFI.opticalFlowScale; + } + + FfxInt32 GetOpticalFlowBlockSize() + { + return cbFI.opticalFlowBlockSize; + } + + FfxInt32 GetHUDLessAttachedFactor() + { + return cbFI.HUDLessAttachedFactor; + } + + FfxInt32x2 GetDistortionFieldSize() + { + return cbFI.distortionFieldSize; + } + + FfxUInt32 GetDispatchFlags() + { + return cbFI.dispatchFlags; + } + + FfxInt32x2 GetMaxRenderSize() + { + return cbFI.maxRenderSize; + } + + FfxInt32 GetOpticalFlowHalfResMode() + { + return cbFI.opticalFlowHalfResMode; + } + + FfxFloat32x3 GetDebugBarColor() + { + return cbFI.debugBarColor; + } + + FfxFloat32 TanHalfFoV() + { + return cbFI.fTanHalfFOV; + } + + FfxUInt32 BackBufferTransferFunction() + { + return cbFI.backBufferTransferFunction; + } + + FfxFloat32 MinLuminance() + { + return cbFI.minMaxLuminance[0]; + } + + FfxFloat32 MaxLuminance() + { + return cbFI.minMaxLuminance[1]; + } + +#endif // defined(FFX_FRAMEINTERPOLATION_BIND_CB_FRAMEINTERPOLATION) + + +#if defined(FFX_FRAMEINTERPOLATION_BIND_CB_INPAINTING_PYRAMID) + layout (set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_CB_INPAINTING_PYRAMID, std140) uniform cbInpaintingPyramid_t + { + FfxUInt32 mips; + FfxUInt32 numWorkGroups; + FfxUInt32x2 workGroupOffset; + } cbInpaintingPyramid; + + FfxUInt32 NumMips() + { + return cbInpaintingPyramid.mips; + } + FfxUInt32 NumWorkGroups() + { + return cbInpaintingPyramid.numWorkGroups; + } + FfxUInt32x2 WorkGroupOffset() + { + return cbInpaintingPyramid.workGroupOffset; + } + +#endif // defined(FFX_FRAMEINTERPOLATION_BIND_CB_INPAINTING_PYRAMID) + + + /////////////////////////////////////////////// + // declare samplers +/////////////////////////////////////////////// + + +layout (set = 0, binding = 1000) uniform sampler s_LinearClamp; + + /////////////////////////////////////////////// + // declare SRVs and SRV accessors +/////////////////////////////////////////////// + +#ifdef FFX_FRAMEINTERPOLATION_BIND_SRV_PREVIOUS_INTERPOLATION_SOURCE + layout (set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_SRV_PREVIOUS_INTERPOLATION_SOURCE) uniform texture2D r_previous_interpolation_source; + + FfxFloat32x3 LoadPreviousBackbuffer(FFX_PARAMETER_IN FfxInt32x2 iPxPos) + { + return texelFetch(r_previous_interpolation_source, iPxPos, 0).rgb; + } + FfxFloat32x3 SamplePreviousBackbuffer(FFX_PARAMETER_IN FfxFloat32x2 fUv) + { + return textureLod(sampler2D(r_previous_interpolation_source, s_LinearClamp), fUv, 0.0).xyz; + } +#endif + +#ifdef FFX_FRAMEINTERPOLATION_BIND_SRV_CURRENT_INTERPOLATION_SOURCE + layout (set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_SRV_CURRENT_INTERPOLATION_SOURCE) uniform texture2D r_current_interpolation_source; + + FfxFloat32x3 LoadCurrentBackbuffer(FFX_PARAMETER_IN FfxInt32x2 iPxPos) + { + return texelFetch(r_current_interpolation_source, iPxPos, 0).rgb; + } + FfxFloat32x3 SampleCurrentBackbuffer(FFX_PARAMETER_IN FfxFloat32x2 fUv) + { + return textureLod(sampler2D(r_current_interpolation_source, s_LinearClamp), fUv, 0.0).xyz; + } +#endif + +#ifdef FFX_FRAMEINTERPOLATION_BIND_SRV_DILATED_MOTION_VECTORS + layout (set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_SRV_DILATED_MOTION_VECTORS) uniform texture2D r_dilated_motion_vectors; + + FfxFloat32x2 LoadDilatedMotionVector(FFX_PARAMETER_IN FfxInt32x2 iPxPos) + { + return texelFetch(r_dilated_motion_vectors, iPxPos, 0).xy; + } +#endif + +#ifdef FFX_FRAMEINTERPOLATION_BIND_SRV_DILATED_DEPTH + layout (set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_SRV_DILATED_DEPTH) uniform texture2D r_dilated_depth; + + FfxFloat32 LoadDilatedDepth(FFX_PARAMETER_IN FfxInt32x2 iPxPos) + { + return texelFetch(r_dilated_depth, iPxPos, 0).x; + } +#endif + +#ifdef FFX_FRAMEINTERPOLATION_BIND_SRV_RECONSTRUCTED_DEPTH_PREVIOUS_FRAME + layout (set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_SRV_RECONSTRUCTED_DEPTH_PREVIOUS_FRAME) uniform utexture2D r_reconstructed_depth_previous_frame; + + FfxFloat32 LoadReconstructedDepthPreviousFrame(FFX_PARAMETER_IN FfxInt32x2 iPxInput) + { + return ffxAsFloat(texelFetch(r_reconstructed_depth_previous_frame, iPxInput, 0).x); + } +#endif + +#ifdef FFX_FRAMEINTERPOLATION_BIND_SRV_RECONSTRUCTED_DEPTH_INTERPOLATED_FRAME + layout (set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_SRV_RECONSTRUCTED_DEPTH_INTERPOLATED_FRAME) uniform utexture2D r_reconstructed_depth_interpolated_frame; + + FfxFloat32 LoadEstimatedInterpolationFrameDepth(FFX_PARAMETER_IN FfxInt32x2 iPxInput) + { + return ffxAsFloat(texelFetch(r_reconstructed_depth_interpolated_frame, iPxInput, 0).x); + } +#endif + +#ifdef FFX_FRAMEINTERPOLATION_BIND_SRV_DISOCCLUSION_MASK + layout (set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_SRV_DISOCCLUSION_MASK) uniform texture2D r_disocclusion_mask; + + FfxFloat32x4 LoadDisocclusionMask(FFX_PARAMETER_IN FfxInt32x2 iPxPos) + { + return texelFetch(r_disocclusion_mask, iPxPos, 0); + } + FfxFloat32x4 SampleDisocclusionMask(FFX_PARAMETER_IN FfxFloat32x2 fUv) + { + return textureLod(sampler2D(r_disocclusion_mask, s_LinearClamp), fUv, 0); + } +#endif + +#if defined(FFX_FRAMEINTERPOLATION_BIND_SRV_GAME_MOTION_VECTOR_FIELD_X) && \ + defined(FFX_FRAMEINTERPOLATION_BIND_SRV_GAME_MOTION_VECTOR_FIELD_Y) + layout (set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_SRV_GAME_MOTION_VECTOR_FIELD_X) uniform utexture2D r_game_motion_vector_field_x; + layout (set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_SRV_GAME_MOTION_VECTOR_FIELD_Y) uniform utexture2D r_game_motion_vector_field_y; + + FfxUInt32x2 LoadGameFieldMv(FFX_PARAMETER_IN FfxInt32x2 iPxSample) + { + FfxUInt32 packedX = texelFetch(r_game_motion_vector_field_x, iPxSample, 0).x; + FfxUInt32 packedY = texelFetch(r_game_motion_vector_field_y, iPxSample, 0).x; + + return FfxUInt32x2(packedX, packedY); + } +#endif + +#if defined(FFX_FRAMEINTERPOLATION_BIND_SRV_OPTICAL_FLOW_MOTION_VECTOR_FIELD_X) && \ + defined(FFX_FRAMEINTERPOLATION_BIND_SRV_OPTICAL_FLOW_MOTION_VECTOR_FIELD_Y) + layout (set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_SRV_OPTICAL_FLOW_MOTION_VECTOR_FIELD_X) uniform utexture2D r_optical_flow_motion_vector_field_x; + layout (set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_SRV_OPTICAL_FLOW_MOTION_VECTOR_FIELD_Y) uniform utexture2D r_optical_flow_motion_vector_field_y; + + FfxUInt32x2 LoadOpticalFlowFieldMv(FFX_PARAMETER_IN FfxInt32x2 iPxSample) + { + FfxUInt32 packedX = texelFetch(r_optical_flow_motion_vector_field_x, iPxSample, 0).x; + FfxUInt32 packedY = texelFetch(r_optical_flow_motion_vector_field_y, iPxSample, 0).x; + + return FfxUInt32x2(packedX, packedY); + } +#endif + +#ifdef FFX_FRAMEINTERPOLATION_BIND_SRV_OPTICAL_FLOW + layout (set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_SRV_OPTICAL_FLOW) uniform itexture2D r_optical_flow; + + #if defined(FFX_FRAMEINTERPOLATION_BIND_CB_FRAMEINTERPOLATION) + FfxFloat32x2 LoadOpticalFlow(FFX_PARAMETER_IN FfxInt32x2 iPxPos) + { + return texelFetch(r_optical_flow, iPxPos, 0).xy * GetOpticalFlowScale(); + } + #endif +#endif + +#ifdef FFX_FRAMEINTERPOLATION_BIND_SRV_OPTICAL_FLOW_UPSAMPLED + layout (set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_SRV_OPTICAL_FLOW_UPSAMPLED) uniform texture2D r_optical_flow_upsampled; + + FfxFloat32x2 LoadOpticalFlowUpsampled(FFX_PARAMETER_IN FfxInt32x2 iPxPos) + { + return texelFetch(r_optical_flow_upsampled, iPxPos, 0).xy; + } +#endif + +#ifdef FFX_FRAMEINTERPOLATION_BIND_SRV_OPTICAL_FLOW_CONFIDENCE + layout (set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_SRV_OPTICAL_FLOW_CONFIDENCE) uniform utexture2D r_optical_flow_confidence; + + FfxFloat32 LoadOpticalFlowConfidence(FFX_PARAMETER_IN FfxInt32x2 iPxPos) + { + return texelFetch(r_optical_flow_confidence, iPxPos, 0).y; + } +#endif + +#ifdef FFX_FRAMEINTERPOLATION_BIND_SRV_OPTICAL_FLOW_GLOBAL_MOTION + layout (set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_SRV_OPTICAL_FLOW_GLOBAL_MOTION) uniform utexture2D r_optical_flow_global_motion; + + FfxUInt32 LoadOpticalFlowGlobalMotion(FFX_PARAMETER_IN FfxInt32x2 iPxPos) + { + return texelFetch(r_optical_flow_global_motion, iPxPos, 0).x; + } +#endif + +#ifdef FFX_FRAMEINTERPOLATION_BIND_SRV_OPTICAL_FLOW_SCENE_CHANGE_DETECTION + layout (set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_SRV_OPTICAL_FLOW_SCENE_CHANGE_DETECTION) uniform utexture2D r_optical_flow_scd; + + FfxUInt32 LoadOpticalFlowSceneChangeDetection(FFX_PARAMETER_IN FfxInt32x2 iPxPos) + { + return texelFetch(r_optical_flow_scd, iPxPos, 0).x; + } + + FfxBoolean HasSceneChanged() + { + #define SCD_OUTPUT_HISTORY_BITS_SLOT 1 + //if (FrameIndex() <= 5) // threshold according to original OpenCL code + //{ + // return 1.0; + //} + //else + { + // Report that the scene is changed if the change was detected in any of the + // 4 previous frames (0xfu - covers 4 history bits). + return ((texelFetch(r_optical_flow_scd, FfxInt32x2(SCD_OUTPUT_HISTORY_BITS_SLOT, 0), 0).x) & 0xfu) != 0; + } + } +#endif + +#ifdef FFX_FRAMEINTERPOLATION_BIND_SRV_OPTICAL_FLOW_DEBUG + layout (set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_SRV_OPTICAL_FLOW_DEBUG) uniform texture2D r_optical_flow_debug; + + FfxFloat32x4 LoadOpticalFlowDebug(FFX_PARAMETER_IN FfxInt32x2 iPxPos) + { + return texelFetch(r_optical_flow_debug, iPxPos, 0); + } +#endif + +#ifdef FFX_FRAMEINTERPOLATION_BIND_SRV_OUTPUT + layout (set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_SRV_OUTPUT) uniform texture2D r_output; + + FfxFloat32x4 LoadFrameInterpolationOutput(FFX_PARAMETER_IN FfxInt32x2 iPxInput) + { + return texelFetch(r_output, iPxInput, 0); + } +#endif + +#ifdef FFX_FRAMEINTERPOLATION_BIND_SRV_INPAINTING_PYRAMID + layout (set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_SRV_INPAINTING_PYRAMID) uniform texture2D r_inpainting_pyramid; + + FfxFloat32x4 LoadInpaintingPyramid(FFX_PARAMETER_IN FfxInt32 mipLevel, FFX_PARAMETER_IN FfxUInt32x2 iPxInput) + { + return texelFetch(r_inpainting_pyramid, FfxInt32x2(iPxInput), mipLevel); + } +#endif + +#ifdef FFX_FRAMEINTERPOLATION_BIND_SRV_PRESENT_BACKBUFFER + layout (set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_SRV_PRESENT_BACKBUFFER) uniform texture2D r_present_backbuffer; + + FfxFloat32x4 LoadPresentBackbuffer(FFX_PARAMETER_IN FfxInt32x2 iPxInput) + { + return texelFetch(r_present_backbuffer, iPxInput, 0); + } + FfxFloat32x4 SamplePresentBackbuffer(FFX_PARAMETER_IN FfxFloat32x2 fUv) + { + return textureLod(sampler2D(r_present_backbuffer, s_LinearClamp), fUv, 0.0); + } +#endif + +#ifdef FFX_FRAMEINTERPOLATION_BIND_SRV_COUNTERS + layout(set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_SRV_COUNTERS) readonly buffer FrameInterpolationCounters_t + { + FfxUInt32 data[]; + } r_counters; + + FfxUInt32 LoadCounter(FFX_PARAMETER_IN FfxInt32 iPxPos) + { + return r_counters.data[iPxPos]; + } + + FfxUInt32 FrameIndexSinceLastReset() + { + return LoadCounter(COUNTER_FRAME_INDEX_SINCE_LAST_RESET); + } +#endif + + +#if defined(FFX_FRAMEINTERPOLATION_BIND_SRV_INPUT_DEPTH) + layout (set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_SRV_INPUT_DEPTH) uniform texture2D r_input_depth; + + FfxFloat32 LoadInputDepth(FfxInt32x2 iPxPos) + { + return texelFetch(r_input_depth, iPxPos, 0).x; + } +#endif + +#if defined(FFX_FRAMEINTERPOLATION_BIND_SRV_INPUT_MOTION_VECTORS) + layout (set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_SRV_INPUT_MOTION_VECTORS) uniform texture2D r_input_motion_vectors; + + FfxFloat32x2 LoadInputMotionVector(FfxInt32x2 iPxDilatedMotionVectorPos) + { + FfxFloat32x2 fSrcMotionVector = texelFetch(r_input_motion_vectors, iPxDilatedMotionVectorPos, 0).xy; + + FfxFloat32x2 fUvMotionVector = fSrcMotionVector * MotionVectorScale(); + + #if FFX_FRAMEINTERPOLATION_OPTION_JITTERED_MOTION_VECTORS + fUvMotionVector -= MotionVectorJitterCancellation(); + #endif + + return fUvMotionVector; + } +#endif + +#if defined(FFX_FRAMEINTERPOLATION_BIND_SRV_DISTORTION_FIELD) + layout(set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_SRV_DISTORTION_FIELD) uniform texture2D r_input_distortion_field; + FfxFloat32x2 SampleDistortionField(FFX_PARAMETER_IN FfxFloat32x2 fUv) + { + return textureLod(sampler2D(r_input_distortion_field, s_LinearClamp), fUv, 0.0).xy; + } +#endif + +/////////////////////////////////////////////// +// declare UAVs and UAV accessors +/////////////////////////////////////////////// +#ifdef FFX_FRAMEINTERPOLATION_BIND_UAV_OUTPUT + layout(set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_UAV_OUTPUT /* app controlled format */) uniform image2D rw_output; + + FfxFloat32x4 RWLoadFrameinterpolationOutput(FFX_PARAMETER_IN FfxInt32x2 iPxPos) + { + return imageLoad(rw_output, iPxPos); + } + + void StoreFrameinterpolationOutput(FFX_PARAMETER_IN FfxInt32x2 iPxPos, FFX_PARAMETER_IN FfxFloat32x4 val) + { + imageStore(rw_output, iPxPos, val); + } +#endif + +#ifdef FFX_FRAMEINTERPOLATION_BIND_UAV_DILATED_MOTION_VECTORS + layout(set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_UAV_DILATED_MOTION_VECTORS, rg16f) uniform image2D rw_dilated_motion_vectors; + + FfxFloat32x2 RWLoadDilatedMotionVectors(FFX_PARAMETER_IN FfxInt32x2 iPxPos) + { + return imageLoad(rw_dilated_motion_vectors, iPxPos).xy; + } + + void StoreDilatedMotionVectors(FFX_PARAMETER_IN FfxInt32x2 iPxPos, FFX_PARAMETER_IN FfxFloat32x2 val) + { + imageStore(rw_dilated_motion_vectors, iPxPos, FfxFloat32x4(val, 0.0, 0.0)); + } +#endif + +#ifdef FFX_FRAMEINTERPOLATION_BIND_UAV_DILATED_DEPTH + layout(set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_UAV_DILATED_DEPTH, r32f) uniform image2D rw_dilated_depth; + + FfxFloat32 RWLoadDilatedDepth(FFX_PARAMETER_IN FfxInt32x2 iPxPos) + { + return imageLoad(rw_dilated_depth, iPxPos).x; + } + + void StoreDilatedDepth(FFX_PARAMETER_IN FfxInt32x2 iPxPos, FFX_PARAMETER_IN FfxFloat32 val) + { + imageStore(rw_dilated_depth, iPxPos, FfxFloat32x4(val, 0.0, 0.0, 0.0)); + } +#endif + +#ifdef FFX_FRAMEINTERPOLATION_BIND_UAV_RECONSTRUCTED_DEPTH_PREVIOUS_FRAME + layout(set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_UAV_RECONSTRUCTED_DEPTH_PREVIOUS_FRAME, r32ui) uniform uimage2D rw_reconstructed_depth_previous_frame; + + FfxFloat32 RWLoadReconstructedDepthPreviousFrame(FFX_PARAMETER_IN FfxInt32x2 iPxPos) + { + return ffxAsFloat(imageLoad(rw_reconstructed_depth_previous_frame, iPxPos).x); + } + + void UpdateReconstructedDepthPreviousFrame(FfxInt32x2 iPxSample, FfxFloat32 fDepth) + { + FfxUInt32 uDepth = ffxAsUInt32(fDepth); + +#if FFX_FRAMEINTERPOLATION_OPTION_INVERTED_DEPTH + imageAtomicMax(rw_reconstructed_depth_previous_frame, iPxSample, uDepth); +#else + imageAtomicMin(rw_reconstructed_depth_previous_frame, iPxSample, uDepth); // min for standard, max for inverted depth +#endif + } +#endif + +#ifdef FFX_FRAMEINTERPOLATION_BIND_UAV_RECONSTRUCTED_DEPTH_INTERPOLATED_FRAME + layout(set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_UAV_RECONSTRUCTED_DEPTH_INTERPOLATED_FRAME, r32ui) uniform uimage2D rw_reconstructed_depth_interpolated_frame; + + FfxFloat32 RWLoadReconstructedDepthInterpolatedFrame(FFX_PARAMETER_IN FfxInt32x2 iPxPos) + { + return ffxAsFloat(imageLoad(rw_reconstructed_depth_interpolated_frame, iPxPos).x); + } + + void StoreReconstructedDepthInterpolatedFrame(FFX_PARAMETER_IN FfxInt32x2 iPxPos, FFX_PARAMETER_IN FfxFloat32 value) + { + FfxUInt32 uDepth = ffxAsUInt32(value); + imageStore(rw_reconstructed_depth_interpolated_frame, iPxPos, FfxUInt32x4(uDepth, 0, 0, 0)); + } + + void UpdateReconstructedDepthInterpolatedFrame(FfxInt32x2 iPxSample, FfxFloat32 fDepth) + { + FfxUInt32 uDepth = ffxAsUInt32(fDepth); + +#if FFX_FRAMEINTERPOLATION_OPTION_INVERTED_DEPTH + imageAtomicMax(rw_reconstructed_depth_interpolated_frame, iPxSample, uDepth); +#else + imageAtomicMin(rw_reconstructed_depth_interpolated_frame, iPxSample, uDepth); // min for standard, max for inverted depth +#endif + } +#endif + +#ifdef FFX_FRAMEINTERPOLATION_BIND_UAV_DISOCCLUSION_MASK + layout(set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_UAV_DISOCCLUSION_MASK, rg8) uniform image2D rw_disocclusion_mask; + + FfxFloat32x2 RWLoadDisocclusionMask(FFX_PARAMETER_IN FfxInt32x2 iPxPos) + { + return imageLoad(rw_disocclusion_mask, iPxPos).xy; + } + + void StoreDisocclusionMask(FFX_PARAMETER_IN FfxInt32x2 iPxPos, FFX_PARAMETER_IN FfxFloat32x2 val) + { + imageStore(rw_disocclusion_mask, iPxPos, FfxFloat32x4(val, 0.0, 0.0)); + } +#endif + +#if defined(FFX_FRAMEINTERPOLATION_BIND_UAV_GAME_MOTION_VECTOR_FIELD_X) && \ + defined(FFX_FRAMEINTERPOLATION_BIND_UAV_GAME_MOTION_VECTOR_FIELD_Y) + + layout(set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_UAV_GAME_MOTION_VECTOR_FIELD_X, r32ui) uniform uimage2D rw_game_motion_vector_field_x; + layout(set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_UAV_GAME_MOTION_VECTOR_FIELD_Y, r32ui) uniform uimage2D rw_game_motion_vector_field_y; + + FfxUInt32 RWLoadGameMotionVectorFieldX(FFX_PARAMETER_IN FfxInt32x2 iPxPos) + { + return imageLoad(rw_game_motion_vector_field_x, iPxPos).x; + } + + void StoreGameMotionVectorFieldX(FFX_PARAMETER_IN FfxInt32x2 iPxPos, FFX_PARAMETER_IN FfxUInt32 val) + { + imageStore(rw_game_motion_vector_field_x, iPxPos, FfxUInt32x4(val, 0, 0, 0)); + } + + FfxUInt32 RWLoadGameMotionVectorFieldY(FFX_PARAMETER_IN FfxInt32x2 iPxPos) + { + return imageLoad(rw_game_motion_vector_field_y, iPxPos).x; + } + + void StoreGameMotionVectorFieldY(FFX_PARAMETER_IN FfxInt32x2 iPxPos, FFX_PARAMETER_IN FfxUInt32 val) + { + imageStore(rw_game_motion_vector_field_y, iPxPos, FfxUInt32x4(val, 0, 0, 0)); + } + + void UpdateGameMotionVectorField(FFX_PARAMETER_IN FfxInt32x2 iPxPos, FFX_PARAMETER_IN FfxUInt32x2 packedVector) + { + imageAtomicMax(rw_game_motion_vector_field_x, iPxPos, packedVector.x); + imageAtomicMax(rw_game_motion_vector_field_y, iPxPos, packedVector.y); + } + + FfxUInt32 UpdateGameMotionVectorFieldEx(FFX_PARAMETER_IN FfxInt32x2 iPxPos, FFX_PARAMETER_IN FfxUInt32x2 packedVector) + { + FfxUInt32 uPreviousValueX = imageAtomicMax(rw_game_motion_vector_field_x, iPxPos, packedVector.x); + FfxUInt32 uPreviousValueY = imageAtomicMax(rw_game_motion_vector_field_y, iPxPos, packedVector.y); + + const FfxUInt32 uExistingVectorFieldEntry = ffxMax(uPreviousValueX, uPreviousValueY); + + return uExistingVectorFieldEntry; + } +#endif + +#if defined(FFX_FRAMEINTERPOLATION_BIND_UAV_OPTICAL_FLOW_MOTION_VECTOR_FIELD_X) && \ + defined(FFX_FRAMEINTERPOLATION_BIND_UAV_OPTICAL_FLOW_MOTION_VECTOR_FIELD_Y) + + layout(set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_UAV_OPTICAL_FLOW_MOTION_VECTOR_FIELD_X, r32ui) uniform uimage2D rw_optical_flow_motion_vector_field_x; + layout(set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_UAV_OPTICAL_FLOW_MOTION_VECTOR_FIELD_Y, r32ui) uniform uimage2D rw_optical_flow_motion_vector_field_y; + + FfxUInt32 RWLoadOpticalflowMotionVectorFieldX(FFX_PARAMETER_IN FfxInt32x2 iPxPos) + { + return imageLoad(rw_optical_flow_motion_vector_field_x, iPxPos).x; + } + void StoreOpticalflowMotionVectorFieldX(FFX_PARAMETER_IN FfxInt32x2 iPxPos, FFX_PARAMETER_IN FfxUInt32 val) + { + imageStore(rw_optical_flow_motion_vector_field_x, iPxPos, FfxUInt32x4(val, 0, 0, 0)); + } + FfxUInt32 RWLoadOpticalflowMotionVectorFieldY(FFX_PARAMETER_IN FfxInt32x2 iPxPos) + { + return imageLoad(rw_optical_flow_motion_vector_field_y, iPxPos).x; + } + void StoreOpticalflowMotionVectorFieldY(FFX_PARAMETER_IN FfxInt32x2 iPxPos, FFX_PARAMETER_IN FfxUInt32 val) + { + imageStore(rw_optical_flow_motion_vector_field_y, iPxPos, FfxUInt32x4(val, 0, 0, 0)); + } + void UpdateOpticalflowMotionVectorField(FFX_PARAMETER_IN FfxInt32x2 iPxPos, FFX_PARAMETER_IN FfxUInt32x2 packedVector) + { + imageAtomicMax(rw_optical_flow_motion_vector_field_x, iPxPos, packedVector.x); + imageAtomicMax(rw_optical_flow_motion_vector_field_y, iPxPos, packedVector.y); + } +#endif + +#ifdef FFX_FRAMEINTERPOLATION_BIND_UAV_COUNTERS + layout(set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_UAV_COUNTERS) coherent buffer FrameInterpolationRWCounters_t + { + FfxUInt32 data[]; + } rw_counters; + + FfxUInt32 RWLoadCounter(FFX_PARAMETER_IN FfxInt32 iPxPos) + { + return rw_counters.data[iPxPos]; + } + + void StoreCounter(FFX_PARAMETER_IN FfxInt32 iPxPos, FFX_PARAMETER_IN FfxUInt32 counter) + { + rw_counters.data[iPxPos] = counter; + } + void AtomicIncreaseCounter(FFX_PARAMETER_IN FfxInt32 iPxPos, FFX_PARAMETER_OUT FfxUInt32 oldVal) + { + oldVal = atomicAdd(rw_counters.data[iPxPos], 1); + } +#endif + + +#if defined(FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_0) && \ + defined(FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_1) && \ + defined(FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_2) && \ + defined(FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_3) && \ + defined(FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_4) && \ + defined(FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_5) && \ + defined(FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_6) && \ + defined(FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_7) && \ + defined(FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_8) && \ + defined(FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_9) && \ + defined(FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_10) && \ + defined(FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_11) && \ + defined(FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_12) + + layout(set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_0, rgba16f) uniform image2D rw_inpainting_pyramid0; + layout(set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_1, rgba16f) uniform image2D rw_inpainting_pyramid1; + layout(set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_2, rgba16f) uniform image2D rw_inpainting_pyramid2; + layout(set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_3, rgba16f) uniform image2D rw_inpainting_pyramid3; + layout(set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_4, rgba16f) uniform image2D rw_inpainting_pyramid4; + layout(set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_5, rgba16f) coherent uniform image2D rw_inpainting_pyramid5; + layout(set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_6, rgba16f) uniform image2D rw_inpainting_pyramid6; + layout(set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_7, rgba16f) uniform image2D rw_inpainting_pyramid7; + layout(set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_8, rgba16f) uniform image2D rw_inpainting_pyramid8; + layout(set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_9, rgba16f) uniform image2D rw_inpainting_pyramid9; + layout(set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_10, rgba16f) uniform image2D rw_inpainting_pyramid10; + layout(set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_11, rgba16f) uniform image2D rw_inpainting_pyramid11; + layout(set = 0, binding = FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_12, rgba16f) uniform image2D rw_inpainting_pyramid12; + + + FfxFloat32x4 RWLoadInpaintingPyramid(FFX_PARAMETER_IN FfxInt32x2 iPxPos, FFX_PARAMETER_IN FfxUInt32 index) + { + #define LOAD(idx) \ + if (index == idx) \ + { \ + return imageLoad(rw_inpainting_pyramid##idx, iPxPos); \ + } + LOAD(0); + LOAD(1); + LOAD(2); + LOAD(3); + LOAD(4); + LOAD(5); + LOAD(6); + LOAD(7); + LOAD(8); + LOAD(9); + LOAD(10); + LOAD(11); + LOAD(12); + return FfxFloat32x4(0.0, 0.0, 0.0, 0.0); + + #undef LOAD + } + + void StoreInpaintingPyramid(FFX_PARAMETER_IN FfxInt32x2 iPxPos, FFX_PARAMETER_IN FfxFloat32x4 outValue, FFX_PARAMETER_IN FfxUInt32 index) + { + #define STORE(idx) \ + if (index == idx) \ + { \ + imageStore(rw_inpainting_pyramid##idx, iPxPos, outValue); \ + } + + STORE(0); + STORE(1); + STORE(2); + STORE(3); + STORE(4); + STORE(5); + STORE(6); + STORE(7); + STORE(8); + STORE(9); + STORE(10); + STORE(11); + STORE(12); + + #undef STORE + } +#endif diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/frameinterpolation/ffx_frameinterpolation_callbacks_hlsl.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/frameinterpolation/ffx_frameinterpolation_callbacks_hlsl.h new file mode 100644 index 00000000..a58743d2 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/frameinterpolation/ffx_frameinterpolation_callbacks_hlsl.h @@ -0,0 +1,814 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#include "ffx_frameinterpolation_resources.h" + +#if defined(FFX_GPU) +#ifdef __hlsl_dx_compiler +#pragma dxc diagnostic push +#pragma dxc diagnostic ignored "-Wambig-lit-shift" +#endif //__hlsl_dx_compiler +#include "ffx_core.h" +#ifdef __hlsl_dx_compiler +#pragma dxc diagnostic pop +#endif //__hlsl_dx_compiler +#endif // #if defined(FFX_GPU) + +#if defined(FFX_GPU) + +#define COUNTER_SPD 0 +#define COUNTER_FRAME_INDEX_SINCE_LAST_RESET 1 + + /////////////////////////////////////////////// + // declare CBs and CB accessors +/////////////////////////////////////////////// +#if defined(FFX_FRAMEINTERPOLATION_BIND_CB_FRAMEINTERPOLATION) + cbuffer cbFI : FFX_DECLARE_CB(FFX_FRAMEINTERPOLATION_BIND_CB_FRAMEINTERPOLATION) + { + FfxInt32x2 renderSize; + FfxInt32x2 displaySize; + + FfxFloat32x2 displaySizeRcp; + FfxFloat32 cameraNear; + FfxFloat32 cameraFar; + + FfxInt32x2 upscalerTargetSize; + FfxInt32 Mode; + FfxInt32 reset; + + FfxFloat32x4 fDeviceToViewDepth; + + FfxFloat32 deltaTime; + FfxInt32 HUDLessAttachedFactor; + FfxInt32x2 distortionFieldSize; + + FfxFloat32x2 opticalFlowScale; + FfxInt32 opticalFlowBlockSize; + FfxUInt32 dispatchFlags; + + FfxInt32x2 maxRenderSize; + FfxInt32 opticalFlowHalfResMode; + FfxInt32 NumInstances; + + FfxInt32x2 interpolationRectBase; + FfxInt32x2 interpolationRectSize; + + FfxFloat32x3 debugBarColor; + FfxUInt32 backBufferTransferFunction; + + FfxFloat32x2 minMaxLuminance; + FfxFloat32 fTanHalfFOV; + FfxInt32 _pad1; + + FfxFloat32x2 fJitter; + FfxFloat32x2 fMotionVectorScale; + } + + const FfxFloat32x2 Jitter() + { + return fJitter; + } + + const FfxFloat32x2 MotionVectorScale() + { + return fMotionVectorScale; + } + + const FfxInt32x2 InterpolationRectBase() + { + return interpolationRectBase; + } + + const FfxInt32x2 InterpolationRectSize() + { + return interpolationRectSize; + } + + const FfxInt32x2 RenderSize() + { + return renderSize; + } + + const FfxInt32x2 DisplaySize() + { + return displaySize; + } + + const FfxBoolean Reset() + { + return reset == 1; + } + + FfxFloat32x4 DeviceToViewSpaceTransformFactors() + { + return fDeviceToViewDepth; + } + + FfxInt32x2 GetOpticalFlowSize() + { + FfxInt32x2 iOpticalFlowSize = (1.0f / opticalFlowScale) / FfxFloat32x2(opticalFlowBlockSize.xx); + + return iOpticalFlowSize; + } + + FfxInt32x2 GetOpticalFlowSize2() + { + return GetOpticalFlowSize() * 1; + } + + FfxFloat32x2 GetOpticalFlowScale() + { + return opticalFlowScale; + } + + FfxInt32 GetOpticalFlowBlockSize() + { + return opticalFlowBlockSize; + } + + FfxInt32 GetHUDLessAttachedFactor() + { + return HUDLessAttachedFactor; + } + + FfxInt32x2 GetDistortionFieldSize() + { + return distortionFieldSize; + } + + FfxUInt32 GetDispatchFlags() + { + return dispatchFlags; + } + + FfxInt32x2 GetMaxRenderSize() + { + return maxRenderSize; + } + + FfxInt32 GetOpticalFlowHalfResMode() + { + return opticalFlowHalfResMode; + } + + FfxFloat32x3 GetDebugBarColor() + { + return debugBarColor; + } + + FfxFloat32 TanHalfFoV() + { + return fTanHalfFOV; + } + + FfxUInt32 BackBufferTransferFunction() + { + return backBufferTransferFunction; + } + + FfxFloat32 MinLuminance() + { + return minMaxLuminance[0]; + } + + FfxFloat32 MaxLuminance() + { + return minMaxLuminance[1]; + } + +#endif // #if defined(FFX_FRAMEINTERPOLATION_BIND_CB_FRAMEINTERPOLATION) + +#if defined(FFX_FRAMEINTERPOLATION_BIND_CB_INPAINTING_PYRAMID) + cbuffer cbInpaintingPyramid : FFX_DECLARE_CB(FFX_FRAMEINTERPOLATION_BIND_CB_INPAINTING_PYRAMID) + { + FfxUInt32 mips; + FfxUInt32 numWorkGroups; + FfxUInt32x2 workGroupOffset; + } + + FfxUInt32 NumMips() + { + return mips; + } + FfxUInt32 NumWorkGroups() + { + return numWorkGroups; + } + FfxUInt32x2 WorkGroupOffset() + { + return workGroupOffset; + } +#endif // #if defined(FFX_FRAMEINTERPOLATION_BIND_CB_INPAINTING_PYRAMID) + +#define FFX_FRAMEINTERPOLATION_ROOTSIG_STRINGIFY(p) FFX_FRAMEINTERPOLATION_ROOTSIG_STR(p) +#define FFX_FRAMEINTERPOLATION_ROOTSIG_STR(p) #p +#define FFX_FRAMEINTERPOLATION_ROOTSIG [RootSignature( "DescriptorTable(UAV(u0, numDescriptors = " FFX_FRAMEINTERPOLATION_ROOTSIG_STRINGIFY(FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_COUNT) ")), " \ + "DescriptorTable(SRV(t0, numDescriptors = " FFX_FRAMEINTERPOLATION_ROOTSIG_STRINGIFY(FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_COUNT) ")), " \ + "CBV(b0), " \ + "StaticSampler(s0, filter = FILTER_MIN_MAG_MIP_LINEAR, " \ + "addressU = TEXTURE_ADDRESS_CLAMP, " \ + "addressV = TEXTURE_ADDRESS_CLAMP, " \ + "addressW = TEXTURE_ADDRESS_CLAMP, " \ + "comparisonFunc = COMPARISON_NEVER, " \ + "borderColor = STATIC_BORDER_COLOR_TRANSPARENT_BLACK)" )] + +#define FFX_FRAMEINTERPOLATION_INPAINTING_ROOTSIG [RootSignature( "DescriptorTable(UAV(u0, numDescriptors = " FFX_FRAMEINTERPOLATION_ROOTSIG_STRINGIFY(FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_COUNT) ")), " \ + "DescriptorTable(SRV(t0, numDescriptors = " FFX_FRAMEINTERPOLATION_ROOTSIG_STRINGIFY(FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_COUNT) ")), " \ + "CBV(b0), " \ + "CBV(b1), " \ + "StaticSampler(s0, filter = FILTER_MIN_MAG_MIP_LINEAR, " \ + "addressU = TEXTURE_ADDRESS_CLAMP, " \ + "addressV = TEXTURE_ADDRESS_CLAMP, " \ + "addressW = TEXTURE_ADDRESS_CLAMP, " \ + "comparisonFunc = COMPARISON_NEVER, " \ + "borderColor = STATIC_BORDER_COLOR_TRANSPARENT_BLACK)" )] + +#if defined(FFX_FRAMEINTERPOLATION_EMBED_ROOTSIG) +#define FFX_FRAMEINTERPOLATION_EMBED_ROOTSIG_CONTENT FFX_FRAMEINTERPOLATION_ROOTSIG +#define FFX_FRAMEINTERPOLATION_EMBED_INPAINTING_ROOTSIG_CONTENT FFX_FRAMEINTERPOLATION_INPAINTING_ROOTSIG +#else +#define FFX_FRAMEINTERPOLATION_EMBED_ROOTSIG_CONTENT +#define FFX_FRAMEINTERPOLATION_EMBED_INPAINTING_ROOTSIG_CONTENT +#endif // #if FFX_FRAMEINTERPOLATION_EMBED_ROOTSIG + +/////////////////////////////////////////////// +// declare samplers +/////////////////////////////////////////////// + +SamplerState s_LinearClamp : register(s0); + +/////////////////////////////////////////////// +// declare SRVs and SRV accessors +/////////////////////////////////////////////// + +#ifdef FFX_FRAMEINTERPOLATION_BIND_SRV_PREVIOUS_INTERPOLATION_SOURCE + Texture2D r_previous_interpolation_source : FFX_DECLARE_SRV(FFX_FRAMEINTERPOLATION_BIND_SRV_PREVIOUS_INTERPOLATION_SOURCE); + + FfxFloat32x3 LoadPreviousBackbuffer(FFX_PARAMETER_IN FfxInt32x2 iPxPos) + { + return r_previous_interpolation_source[iPxPos].rgb; + } + FfxFloat32x3 SamplePreviousBackbuffer(FFX_PARAMETER_IN FfxFloat32x2 fUv) + { + return r_previous_interpolation_source.SampleLevel(s_LinearClamp, fUv, 0).xyz; + } +#endif + +#ifdef FFX_FRAMEINTERPOLATION_BIND_SRV_CURRENT_INTERPOLATION_SOURCE + Texture2D r_current_interpolation_source : FFX_DECLARE_SRV(FFX_FRAMEINTERPOLATION_BIND_SRV_CURRENT_INTERPOLATION_SOURCE); + + FfxFloat32x3 LoadCurrentBackbuffer(FFX_PARAMETER_IN FfxInt32x2 iPxPos) + { + return r_current_interpolation_source[iPxPos].rgb; + } + FfxFloat32x3 SampleCurrentBackbuffer(FFX_PARAMETER_IN FfxFloat32x2 fUv) + { + return r_current_interpolation_source.SampleLevel(s_LinearClamp, fUv, 0).xyz; + } +#endif + +#ifdef FFX_FRAMEINTERPOLATION_BIND_SRV_DILATED_MOTION_VECTORS + Texture2D r_dilated_motion_vectors : FFX_DECLARE_SRV(FFX_FRAMEINTERPOLATION_BIND_SRV_DILATED_MOTION_VECTORS); + + FfxFloat32x2 LoadDilatedMotionVector(FFX_PARAMETER_IN FfxInt32x2 iPxPos) + { + return r_dilated_motion_vectors[iPxPos].xy; + } +#endif + +#ifdef FFX_FRAMEINTERPOLATION_BIND_SRV_DILATED_DEPTH + Texture2D r_dilated_depth : FFX_DECLARE_SRV(FFX_FRAMEINTERPOLATION_BIND_SRV_DILATED_DEPTH); + + FfxFloat32 LoadDilatedDepth(FFX_PARAMETER_IN FfxInt32x2 iPxPos) + { + return r_dilated_depth[iPxPos].x; + } +#endif + +#ifdef FFX_FRAMEINTERPOLATION_BIND_SRV_RECONSTRUCTED_DEPTH_PREVIOUS_FRAME + Texture2D r_reconstructed_depth_previous_frame : FFX_DECLARE_SRV(FFX_FRAMEINTERPOLATION_BIND_SRV_RECONSTRUCTED_DEPTH_PREVIOUS_FRAME); + + FfxFloat32 LoadReconstructedDepthPreviousFrame(FFX_PARAMETER_IN FfxInt32x2 iPxInput) + { + return asfloat(r_reconstructed_depth_previous_frame[iPxInput]); + } +#endif + +#ifdef FFX_FRAMEINTERPOLATION_BIND_SRV_RECONSTRUCTED_DEPTH_INTERPOLATED_FRAME + Texture2D r_reconstructed_depth_interpolated_frame : FFX_DECLARE_SRV(FFX_FRAMEINTERPOLATION_BIND_SRV_RECONSTRUCTED_DEPTH_INTERPOLATED_FRAME); + + FfxFloat32 LoadEstimatedInterpolationFrameDepth(FFX_PARAMETER_IN FfxInt32x2 iPxInput) + { + return asfloat(r_reconstructed_depth_interpolated_frame[iPxInput]); + } +#endif + +#ifdef FFX_FRAMEINTERPOLATION_BIND_SRV_DISOCCLUSION_MASK + Texture2D r_disocclusion_mask : FFX_DECLARE_SRV(FFX_FRAMEINTERPOLATION_BIND_SRV_DISOCCLUSION_MASK); + + FfxFloat32x4 LoadDisocclusionMask(FFX_PARAMETER_IN FfxInt32x2 iPxPos) + { + return r_disocclusion_mask[iPxPos]; + } + FfxFloat32x4 SampleDisocclusionMask(FFX_PARAMETER_IN FfxFloat32x2 fUv) + { + return r_disocclusion_mask.SampleLevel(s_LinearClamp, fUv, 0); + } +#endif + +#if defined(FFX_FRAMEINTERPOLATION_BIND_SRV_GAME_MOTION_VECTOR_FIELD_X) && \ + defined(FFX_FRAMEINTERPOLATION_BIND_SRV_GAME_MOTION_VECTOR_FIELD_Y) + Texture2D r_game_motion_vector_field_x : FFX_DECLARE_SRV(FFX_FRAMEINTERPOLATION_BIND_SRV_GAME_MOTION_VECTOR_FIELD_X); + Texture2D r_game_motion_vector_field_y : FFX_DECLARE_SRV(FFX_FRAMEINTERPOLATION_BIND_SRV_GAME_MOTION_VECTOR_FIELD_Y); + + FfxUInt32x2 LoadGameFieldMv(FFX_PARAMETER_IN FfxInt32x2 iPxSample) + { + FfxUInt32 packedX = r_game_motion_vector_field_x[iPxSample]; + FfxUInt32 packedY = r_game_motion_vector_field_y[iPxSample]; + + return FfxUInt32x2(packedX, packedY); + } +#endif + +#if defined(FFX_FRAMEINTERPOLATION_BIND_SRV_OPTICAL_FLOW_MOTION_VECTOR_FIELD_X) && \ + defined(FFX_FRAMEINTERPOLATION_BIND_SRV_OPTICAL_FLOW_MOTION_VECTOR_FIELD_Y) + Texture2D r_optical_flow_motion_vector_field_x : FFX_DECLARE_SRV(FFX_FRAMEINTERPOLATION_BIND_SRV_OPTICAL_FLOW_MOTION_VECTOR_FIELD_X); + Texture2D r_optical_flow_motion_vector_field_y : FFX_DECLARE_SRV(FFX_FRAMEINTERPOLATION_BIND_SRV_OPTICAL_FLOW_MOTION_VECTOR_FIELD_Y); + + FfxUInt32x2 LoadOpticalFlowFieldMv(FFX_PARAMETER_IN FfxInt32x2 iPxSample) + { + FfxUInt32 packedX = r_optical_flow_motion_vector_field_x[iPxSample]; + FfxUInt32 packedY = r_optical_flow_motion_vector_field_y[iPxSample]; + + return FfxUInt32x2(packedX, packedY); + } +#endif + +#ifdef FFX_FRAMEINTERPOLATION_BIND_SRV_OPTICAL_FLOW + Texture2D r_optical_flow : FFX_DECLARE_SRV(FFX_FRAMEINTERPOLATION_BIND_SRV_OPTICAL_FLOW); + + #if defined(FFX_FRAMEINTERPOLATION_BIND_CB_FRAMEINTERPOLATION) + FfxFloat32x2 LoadOpticalFlow(FFX_PARAMETER_IN FfxInt32x2 iPxPos) + { + return r_optical_flow[iPxPos] * GetOpticalFlowScale(); + } + #endif +#endif + +#ifdef FFX_FRAMEINTERPOLATION_BIND_SRV_OPTICAL_FLOW_UPSAMPLED + Texture2D r_optical_flow_upsampled : FFX_DECLARE_SRV(FFX_FRAMEINTERPOLATION_BIND_SRV_OPTICAL_FLOW_UPSAMPLED); + + FfxFloat32x2 LoadOpticalFlowUpsampled(FFX_PARAMETER_IN FfxInt32x2 iPxPos) + { + return r_optical_flow_upsampled[iPxPos]; + } +#endif + +#ifdef FFX_FRAMEINTERPOLATION_BIND_SRV_OPTICAL_FLOW_CONFIDENCE + Texture2D r_optical_flow_confidence : FFX_DECLARE_SRV(FFX_FRAMEINTERPOLATION_BIND_SRV_OPTICAL_FLOW_CONFIDENCE); + + FfxFloat32 LoadOpticalFlowConfidence(FFX_PARAMETER_IN FfxInt32x2 iPxPos) + { + return r_optical_flow_confidence[iPxPos].y; + } +#endif + +#ifdef FFX_FRAMEINTERPOLATION_BIND_SRV_OPTICAL_FLOW_GLOBAL_MOTION + Texture2D r_optical_flow_global_motion : FFX_DECLARE_SRV(FFX_FRAMEINTERPOLATION_BIND_SRV_OPTICAL_FLOW_GLOBAL_MOTION); + + FfxUInt32 LoadOpticalFlowGlobalMotion(FFX_PARAMETER_IN FfxInt32x2 iPxPos) + { + return r_optical_flow_global_motion[iPxPos]; + } +#endif + +#ifdef FFX_FRAMEINTERPOLATION_BIND_SRV_OPTICAL_FLOW_SCENE_CHANGE_DETECTION + Texture2D r_optical_flow_scd : FFX_DECLARE_SRV(FFX_FRAMEINTERPOLATION_BIND_SRV_OPTICAL_FLOW_SCENE_CHANGE_DETECTION); + + FfxUInt32 LoadOpticalFlowSceneChangeDetection(FFX_PARAMETER_IN FfxInt32x2 iPxPos) + { + return r_optical_flow_scd[iPxPos]; + } + + FfxBoolean HasSceneChanged() + { + #define SCD_OUTPUT_HISTORY_BITS_SLOT 1 + //if (FrameIndex() <= 5) // threshold according to original OpenCL code + //{ + // return 1.0; + //} + //else + { + // Report that the scene is changed if the change was detected in any of the + // 4 previous frames (0xfu - covers 4 history bits). + return (r_optical_flow_scd[FfxInt32x2(SCD_OUTPUT_HISTORY_BITS_SLOT, 0)] & 0xfu) != 0; + } + } +#endif + +#ifdef FFX_FRAMEINTERPOLATION_BIND_SRV_OPTICAL_FLOW_DEBUG + Texture2D r_optical_flow_debug : FFX_DECLARE_SRV(FFX_FRAMEINTERPOLATION_BIND_SRV_OPTICAL_FLOW_DEBUG); + + FfxFloat32x4 LoadOpticalFlowDebug(FFX_PARAMETER_IN FfxInt32x2 iPxPos) + { + return r_optical_flow_debug[iPxPos]; + } +#endif + +#if defined(FFX_FRAMEINTERPOLATION_BIND_SRV_INPAINTING_MASK) && defined(FFX_FRAMEINTERPOLATION_BIND_SRV_OUTPUT) + Texture2D r_output : FFX_DECLARE_SRV(FFX_FRAMEINTERPOLATION_BIND_SRV_OUTPUT); + Texture2D r_inpainting_mask : FFX_DECLARE_SRV(FFX_FRAMEINTERPOLATION_BIND_SRV_INPAINTING_MASK); + + FfxFloat32x4 LoadFrameInterpolationOutput(FFX_PARAMETER_IN FfxInt32x2 iPxInput) + { + return FfxFloat32x4(r_output[iPxInput], r_inpainting_mask[iPxInput]); + } +#elif defined(FFX_FRAMEINTERPOLATION_BIND_SRV_OUTPUT) + Texture2D r_output : FFX_DECLARE_SRV(FFX_FRAMEINTERPOLATION_BIND_SRV_OUTPUT); + FfxFloat32x4 LoadFrameInterpolationOutput(FFX_PARAMETER_IN FfxInt32x2 iPxInput) + { + return r_output[iPxInput]; + } +#endif + +#ifdef FFX_FRAMEINTERPOLATION_BIND_SRV_INPAINTING_PYRAMID + Texture2D r_inpainting_pyramid : FFX_DECLARE_SRV(FFX_FRAMEINTERPOLATION_BIND_SRV_INPAINTING_PYRAMID); + + FfxFloat32x4 LoadInpaintingPyramid(FFX_PARAMETER_IN FfxInt32 mipLevel, FFX_PARAMETER_IN FfxUInt32x2 iPxInput) + { + return r_inpainting_pyramid.mips[mipLevel][iPxInput]; + } +#endif + +#ifdef FFX_FRAMEINTERPOLATION_BIND_SRV_PRESENT_BACKBUFFER + Texture2D r_present_backbuffer : FFX_DECLARE_SRV(FFX_FRAMEINTERPOLATION_BIND_SRV_PRESENT_BACKBUFFER); + + FfxFloat32x4 LoadPresentBackbuffer(FFX_PARAMETER_IN FfxInt32x2 iPxInput) + { + return r_present_backbuffer[iPxInput]; + } + FfxFloat32x4 SamplePresentBackbuffer(FFX_PARAMETER_IN FfxFloat32x2 fUv) + { + return r_present_backbuffer.SampleLevel(s_LinearClamp, fUv, 0); + } +#endif + +#ifdef FFX_FRAMEINTERPOLATION_BIND_SRV_COUNTERS + StructuredBuffer r_counters : FFX_DECLARE_SRV(FFX_FRAMEINTERPOLATION_BIND_SRV_COUNTERS); + + FfxUInt32 LoadCounter(FFX_PARAMETER_IN FfxInt32 iPxPos) + { + return r_counters[iPxPos]; + } + + const FfxUInt32 FrameIndexSinceLastReset() + { + return LoadCounter(COUNTER_FRAME_INDEX_SINCE_LAST_RESET); + } +#endif + +#if defined(FFX_FRAMEINTERPOLATION_BIND_SRV_INPUT_DEPTH) +Texture2D r_input_depth : FFX_DECLARE_SRV(FFX_FRAMEINTERPOLATION_BIND_SRV_INPUT_DEPTH); +FfxFloat32 LoadInputDepth(FfxInt32x2 iPxPos) +{ + return r_input_depth[iPxPos]; +} +#endif + +#if defined(FFX_FRAMEINTERPOLATION_BIND_SRV_INPUT_MOTION_VECTORS) +Texture2D r_input_motion_vectors : FFX_DECLARE_SRV(FFX_FRAMEINTERPOLATION_BIND_SRV_INPUT_MOTION_VECTORS); +FfxFloat32x2 LoadInputMotionVector(FfxInt32x2 iPxDilatedMotionVectorPos) +{ + FfxFloat32x2 fSrcMotionVector = r_input_motion_vectors[iPxDilatedMotionVectorPos].xy; + + FfxFloat32x2 fUvMotionVector = fSrcMotionVector * MotionVectorScale(); + +#if FFX_FRAMEINTERPOLATION_OPTION_JITTERED_MOTION_VECTORS + fUvMotionVector -= MotionVectorJitterCancellation(); +#endif + + return fUvMotionVector; +} +#endif + +#if defined(FFX_FRAMEINTERPOLATION_BIND_SRV_DISTORTION_FIELD) + Texture2D r_input_distortion_field : FFX_DECLARE_SRV(FFX_FRAMEINTERPOLATION_BIND_SRV_DISTORTION_FIELD); + FfxFloat32x2 SampleDistortionField(FFX_PARAMETER_IN FfxFloat32x2 fUv) + { + return r_input_distortion_field.SampleLevel(s_LinearClamp, fUv, 0); + } +#endif + +/////////////////////////////////////////////// +// declare UAVs and UAV accessors +/////////////////////////////////////////////// +#if defined(FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_MASK) && defined(FFX_FRAMEINTERPOLATION_BIND_UAV_OUTPUT) + RWTexture2D rw_output : FFX_DECLARE_UAV(FFX_FRAMEINTERPOLATION_BIND_UAV_OUTPUT); + RWTexture2D rw_inpainting_mask : FFX_DECLARE_UAV(FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_MASK); + + FfxFloat32x4 RWLoadFrameinterpolationOutput(FFX_PARAMETER_IN FfxInt32x2 iPxPos) + { + return FfxFloat32x4(rw_output[iPxPos], rw_inpainting_mask[iPxPos]); + } + + void StoreFrameinterpolationOutput(FFX_PARAMETER_IN FfxInt32x2 iPxPos, FFX_PARAMETER_IN FfxFloat32x4 val) + { + rw_output[iPxPos] = val.rgb; + rw_inpainting_mask[iPxPos] = val.a; + } + +#elif defined(FFX_FRAMEINTERPOLATION_BIND_UAV_OUTPUT) + RWTexture2D rw_output : FFX_DECLARE_UAV(FFX_FRAMEINTERPOLATION_BIND_UAV_OUTPUT); + + FfxFloat32x4 RWLoadFrameinterpolationOutput(FFX_PARAMETER_IN FfxInt32x2 iPxPos) + { + return rw_output[iPxPos]; + } + + void StoreFrameinterpolationOutput(FFX_PARAMETER_IN FfxInt32x2 iPxPos, FFX_PARAMETER_IN FfxFloat32x4 val) + { + rw_output[iPxPos] = val; + } +#endif + +#ifdef FFX_FRAMEINTERPOLATION_BIND_UAV_DILATED_MOTION_VECTORS + RWTexture2D rw_dilated_motion_vectors : FFX_DECLARE_UAV(FFX_FRAMEINTERPOLATION_BIND_UAV_DILATED_MOTION_VECTORS); + + FfxFloat32x2 RWLoadDilatedMotionVectors(FFX_PARAMETER_IN FfxInt32x2 iPxPos) + { + return rw_dilated_motion_vectors[iPxPos]; + } + + void StoreDilatedMotionVectors(FFX_PARAMETER_IN FfxInt32x2 iPxPos, FFX_PARAMETER_IN FfxFloat32x2 val) + { + rw_dilated_motion_vectors[iPxPos] = val; + } +#endif + +#ifdef FFX_FRAMEINTERPOLATION_BIND_UAV_DILATED_DEPTH + RWTexture2D rw_dilated_depth : FFX_DECLARE_UAV(FFX_FRAMEINTERPOLATION_BIND_UAV_DILATED_DEPTH); + + FfxFloat32 RWLoadDilatedDepth(FFX_PARAMETER_IN FfxInt32x2 iPxPos) + { + return rw_dilated_depth[iPxPos]; + } + + void StoreDilatedDepth(FFX_PARAMETER_IN FfxInt32x2 iPxPos, FFX_PARAMETER_IN FfxFloat32 val) + { + rw_dilated_depth[iPxPos] = val; + } +#endif + +#ifdef FFX_FRAMEINTERPOLATION_BIND_UAV_RECONSTRUCTED_DEPTH_PREVIOUS_FRAME + RWTexture2D rw_reconstructed_depth_previous_frame : FFX_DECLARE_UAV(FFX_FRAMEINTERPOLATION_BIND_UAV_RECONSTRUCTED_DEPTH_PREVIOUS_FRAME); + + FfxFloat32 RWLoadReconstructedDepthPreviousFrame(FFX_PARAMETER_IN FfxInt32x2 iPxPos) + { + return ffxAsFloat(rw_reconstructed_depth_previous_frame[iPxPos]); + } + + void UpdateReconstructedDepthPreviousFrame(FfxInt32x2 iPxSample, FfxFloat32 fDepth) + { + FfxUInt32 uDepth = ffxAsUInt32(fDepth); + +#if FFX_FRAMEINTERPOLATION_OPTION_INVERTED_DEPTH + InterlockedMax(rw_reconstructed_depth_previous_frame[iPxSample], uDepth); +#else + InterlockedMin(rw_reconstructed_depth_previous_frame[iPxSample], uDepth); // min for standard, max for inverted depth +#endif + } +#endif + +#ifdef FFX_FRAMEINTERPOLATION_BIND_UAV_RECONSTRUCTED_DEPTH_INTERPOLATED_FRAME + RWTexture2D rw_reconstructed_depth_interpolated_frame : FFX_DECLARE_UAV(FFX_FRAMEINTERPOLATION_BIND_UAV_RECONSTRUCTED_DEPTH_INTERPOLATED_FRAME); + + FfxFloat32 RWLoadReconstructedDepthInterpolatedFrame(FFX_PARAMETER_IN FfxInt32x2 iPxPos) + { + return ffxAsFloat(rw_reconstructed_depth_interpolated_frame[iPxPos]); + } + + void StoreReconstructedDepthInterpolatedFrame(FFX_PARAMETER_IN FfxInt32x2 iPxPos, FFX_PARAMETER_IN FfxFloat32 value) + { + FfxUInt32 uDepth = ffxAsUInt32(value); + rw_reconstructed_depth_interpolated_frame[iPxPos] = uDepth; + } + + void UpdateReconstructedDepthInterpolatedFrame(FfxInt32x2 iPxSample, FfxFloat32 fDepth) + { + FfxUInt32 uDepth = ffxAsUInt32(fDepth); + +#if FFX_FRAMEINTERPOLATION_OPTION_INVERTED_DEPTH + InterlockedMax(rw_reconstructed_depth_interpolated_frame[iPxSample], uDepth); +#else + InterlockedMin(rw_reconstructed_depth_interpolated_frame[iPxSample], uDepth); // min for standard, max for inverted depth +#endif + } +#endif + +#ifdef FFX_FRAMEINTERPOLATION_BIND_UAV_DISOCCLUSION_MASK + RWTexture2D rw_disocclusion_mask : FFX_DECLARE_UAV(FFX_FRAMEINTERPOLATION_BIND_UAV_DISOCCLUSION_MASK); + + FfxFloat32x2 RWLoadDisocclusionMask(FFX_PARAMETER_IN FfxInt32x2 iPxPos) + { + return rw_disocclusion_mask[iPxPos]; + } + + void StoreDisocclusionMask(FFX_PARAMETER_IN FfxInt32x2 iPxPos, FFX_PARAMETER_IN FfxFloat32x2 val) + { + rw_disocclusion_mask[iPxPos] = val; + } +#endif + +#if defined(FFX_FRAMEINTERPOLATION_BIND_UAV_GAME_MOTION_VECTOR_FIELD_X) && \ + defined(FFX_FRAMEINTERPOLATION_BIND_UAV_GAME_MOTION_VECTOR_FIELD_Y) + + RWTexture2D rw_game_motion_vector_field_x : FFX_DECLARE_UAV(FFX_FRAMEINTERPOLATION_BIND_UAV_GAME_MOTION_VECTOR_FIELD_X); + RWTexture2D rw_game_motion_vector_field_y : FFX_DECLARE_UAV(FFX_FRAMEINTERPOLATION_BIND_UAV_GAME_MOTION_VECTOR_FIELD_Y); + + FfxUInt32 RWLoadGameMotionVectorFieldX(FFX_PARAMETER_IN FfxInt32x2 iPxPos) + { + return rw_game_motion_vector_field_x[iPxPos]; + } + + void StoreGameMotionVectorFieldX(FFX_PARAMETER_IN FfxInt32x2 iPxPos, FFX_PARAMETER_IN FfxUInt32 val) + { + rw_game_motion_vector_field_x[iPxPos] = val; + } + + FfxUInt32 RWLoadGameMotionVectorFieldY(FFX_PARAMETER_IN FfxInt32x2 iPxPos) + { + return rw_game_motion_vector_field_y[iPxPos]; + } + + void StoreGameMotionVectorFieldY(FFX_PARAMETER_IN FfxInt32x2 iPxPos, FFX_PARAMETER_IN FfxUInt32 val) + { + rw_game_motion_vector_field_y[iPxPos] = val; + } + + void UpdateGameMotionVectorField(FFX_PARAMETER_IN FfxInt32x2 iPxPos, FFX_PARAMETER_IN FfxUInt32x2 packedVector) + { + InterlockedMax(rw_game_motion_vector_field_x[iPxPos], packedVector.x); + InterlockedMax(rw_game_motion_vector_field_y[iPxPos], packedVector.y); + } + + FfxUInt32 UpdateGameMotionVectorFieldEx(FFX_PARAMETER_IN FfxInt32x2 iPxPos, FFX_PARAMETER_IN FfxUInt32x2 packedVector) + { + FfxUInt32 uPreviousValueX = 0; + FfxUInt32 uPreviousValueY = 0; + InterlockedMax(rw_game_motion_vector_field_x[iPxPos], packedVector.x, uPreviousValueX); + InterlockedMax(rw_game_motion_vector_field_y[iPxPos], packedVector.y, uPreviousValueY); + + const FfxUInt32 uExistingVectorFieldEntry = ffxMax(uPreviousValueX, uPreviousValueY); + + return uExistingVectorFieldEntry; + } +#endif + +#if defined(FFX_FRAMEINTERPOLATION_BIND_UAV_OPTICAL_FLOW_MOTION_VECTOR_FIELD_X) && \ + defined(FFX_FRAMEINTERPOLATION_BIND_UAV_OPTICAL_FLOW_MOTION_VECTOR_FIELD_Y) + + RWTexture2D rw_optical_flow_motion_vector_field_x : FFX_DECLARE_UAV(FFX_FRAMEINTERPOLATION_BIND_UAV_OPTICAL_FLOW_MOTION_VECTOR_FIELD_X); + RWTexture2D rw_optical_flow_motion_vector_field_y : FFX_DECLARE_UAV(FFX_FRAMEINTERPOLATION_BIND_UAV_OPTICAL_FLOW_MOTION_VECTOR_FIELD_Y); + + FfxUInt32 RWLoadOpticalflowMotionVectorFieldX(FFX_PARAMETER_IN FfxInt32x2 iPxPos) + { + return rw_optical_flow_motion_vector_field_x[iPxPos]; + } + void StoreOpticalflowMotionVectorFieldX(FFX_PARAMETER_IN FfxInt32x2 iPxPos, FFX_PARAMETER_IN FfxUInt32 val) + { + rw_optical_flow_motion_vector_field_x[iPxPos] = val; + } + FfxUInt32 RWLoadOpticalflowMotionVectorFieldY(FFX_PARAMETER_IN FfxInt32x2 iPxPos) + { + return rw_optical_flow_motion_vector_field_y[iPxPos]; + } + void StoreOpticalflowMotionVectorFieldY(FFX_PARAMETER_IN FfxInt32x2 iPxPos, FFX_PARAMETER_IN FfxUInt32 val) + { + rw_optical_flow_motion_vector_field_y[iPxPos] = val; + } + void UpdateOpticalflowMotionVectorField(FFX_PARAMETER_IN FfxInt32x2 iPxPos, FFX_PARAMETER_IN FfxUInt32x2 packedVector) + { + InterlockedMax(rw_optical_flow_motion_vector_field_x[iPxPos], packedVector.x); + InterlockedMax(rw_optical_flow_motion_vector_field_y[iPxPos], packedVector.y); + } +#endif + +#ifdef FFX_FRAMEINTERPOLATION_BIND_UAV_COUNTERS + globallycoherent RWStructuredBuffer rw_counters : FFX_DECLARE_UAV(FFX_FRAMEINTERPOLATION_BIND_UAV_COUNTERS); + + FfxUInt32 RWLoadCounter(FFX_PARAMETER_IN FfxInt32 iPxPos) + { + return rw_counters[iPxPos]; + } + + void StoreCounter(FFX_PARAMETER_IN FfxInt32 iPxPos, FFX_PARAMETER_IN FfxUInt32 counter) + { + rw_counters[iPxPos] = counter; + } + void AtomicIncreaseCounter(FFX_PARAMETER_IN FfxInt32 iPxPos, FFX_PARAMETER_OUT FfxUInt32 oldVal) + { + InterlockedAdd(rw_counters[iPxPos], 1, oldVal); + } +#endif + + +#if defined(FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_0) && \ + defined(FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_1) && \ + defined(FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_2) && \ + defined(FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_3) && \ + defined(FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_4) && \ + defined(FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_5) && \ + defined(FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_6) && \ + defined(FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_7) && \ + defined(FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_8) && \ + defined(FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_9) && \ + defined(FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_10) && \ + defined(FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_11) && \ + defined(FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_12) + + RWTexture2D rw_inpainting_pyramid0 : FFX_DECLARE_UAV(FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_0); + RWTexture2D rw_inpainting_pyramid1 : FFX_DECLARE_UAV(FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_1); + RWTexture2D rw_inpainting_pyramid2 : FFX_DECLARE_UAV(FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_2); + RWTexture2D rw_inpainting_pyramid3 : FFX_DECLARE_UAV(FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_3); + RWTexture2D rw_inpainting_pyramid4 : FFX_DECLARE_UAV(FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_4); + globallycoherent RWTexture2D rw_inpainting_pyramid5 : FFX_DECLARE_UAV(FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_5); + RWTexture2D rw_inpainting_pyramid6 : FFX_DECLARE_UAV(FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_6); + RWTexture2D rw_inpainting_pyramid7 : FFX_DECLARE_UAV(FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_7); + RWTexture2D rw_inpainting_pyramid8 : FFX_DECLARE_UAV(FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_8); + RWTexture2D rw_inpainting_pyramid9 : FFX_DECLARE_UAV(FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_9); + RWTexture2D rw_inpainting_pyramid10 : FFX_DECLARE_UAV(FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_10); + RWTexture2D rw_inpainting_pyramid11 : FFX_DECLARE_UAV(FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_11); + RWTexture2D rw_inpainting_pyramid12 : FFX_DECLARE_UAV(FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_12); + + + FfxFloat32x4 RWLoadInpaintingPyramid(FFX_PARAMETER_IN FfxInt32x2 iPxPos, FFX_PARAMETER_IN FfxUInt32 index) + { + #define LOAD(idx) \ + if (index == idx) \ + { \ + return rw_inpainting_pyramid##idx[iPxPos]; \ + } + LOAD(0); + LOAD(1); + LOAD(2); + LOAD(3); + LOAD(4); + LOAD(5); + LOAD(6); + LOAD(7); + LOAD(8); + LOAD(9); + LOAD(10); + LOAD(11); + LOAD(12); + return 0; + + #undef LOAD + } + + void StoreInpaintingPyramid(FFX_PARAMETER_IN FfxInt32x2 iPxPos, FFX_PARAMETER_IN FfxFloat32x4 outValue, FFX_PARAMETER_IN FfxUInt32 index) + { + #define STORE(idx) \ + if (index == idx) \ + { \ + rw_inpainting_pyramid##idx[iPxPos] = outValue; \ + } + + STORE(0); + STORE(1); + STORE(2); + STORE(3); + STORE(4); + STORE(5); + STORE(6); + STORE(7); + STORE(8); + STORE(9); + STORE(10); + STORE(11); + STORE(12); + + #undef STORE + } +#endif + +#endif // #if defined(FFX_GPU) diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/frameinterpolation/ffx_frameinterpolation_common.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/frameinterpolation/ffx_frameinterpolation_common.h new file mode 100644 index 00000000..8206bf43 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/frameinterpolation/ffx_frameinterpolation_common.h @@ -0,0 +1,445 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#if !defined(FFX_FRAMEINTERPOLATION_COMMON_H) +#define FFX_FRAMEINTERPOLATION_COMMON_H + +#define FFX_FRAMEINTERPOLATION_DISPATCH_DRAW_DEBUG_TEAR_LINES (1 << 0) +#define FFX_FRAMEINTERPOLATION_DISPATCH_DRAW_DEBUG_RESET_INDICATORS (1 << 1) +#define FFX_FRAMEINTERPOLATION_DISPATCH_DRAW_DEBUG_VIEW (1 << 2) + +FFX_STATIC const FfxFloat32 FFX_FRAMEINTERPOLATION_EPSILON = 1e-03f; +FFX_STATIC const FfxFloat32 FFX_FRAMEINTERPOLATION_FLT_MAX = 3.402823466e+38f; +FFX_STATIC const FfxFloat32 FFX_FRAMEINTERPOLATION_FLT_MIN = 1.175494351e-38f; + +FFX_STATIC const FfxFloat32 fReconstructedDepthBilinearWeightThreshold = FFX_FRAMEINTERPOLATION_EPSILON; + +FfxFloat32 RGBToLuma(FfxFloat32x3 fLinearRgb) +{ + return dot(fLinearRgb, FfxFloat32x3(0.2126f, 0.7152f, 0.0722f)); +} + +FfxFloat32 LinearRec2020ToLuminance(FfxFloat32x3 linearRec2020RGB) +{ + FfxFloat32 fY = 0.2627 * linearRec2020RGB.x + 0.678 * linearRec2020RGB.y + 0.0593 * linearRec2020RGB.z; + return fY; +} + +FfxFloat32x3 ffxscRGBToLinear(FfxFloat32x3 value, FfxFloat32 minLuminance, FfxFloat32 maxLuminance) +{ + FfxFloat32x3 p = value - ffxBroadcast3(minLuminance / 80.0f); + return p / ffxBroadcast3((maxLuminance - minLuminance) / 80.0f); +} + +FfxFloat32x3 RawRGBToLinear(FfxFloat32x3 fRawRgb) +{ + FfxFloat32x3 fLinearRgb; + + switch (BackBufferTransferFunction()) + { + case 0: + fLinearRgb = ffxLinearFromSrgb(fRawRgb); + break; + case 1: + fLinearRgb = ffxLinearFromPQ(fRawRgb) * (10000.0f / MaxLuminance()); + break; + case 2: + fLinearRgb = ffxscRGBToLinear(fRawRgb, MinLuminance(), MaxLuminance()); + break; + } + + return fLinearRgb; +} + +FfxFloat32 RawRGBToLuminance(FfxFloat32x3 fRawRgb) +{ + FfxFloat32 fLuminance = 0.0f; + + switch (BackBufferTransferFunction()) + { + case 0: + fLuminance = RGBToLuma(RawRGBToLinear(fRawRgb)); + break; + case 1: + fLuminance = LinearRec2020ToLuminance(RawRGBToLinear(fRawRgb)); + break; + case 2: + fLuminance = RGBToLuma(RawRGBToLinear(fRawRgb)); + break; + } + + return fLuminance; +} + +FfxFloat32 RawRGBToPerceivedLuma(FfxFloat32x3 fRawRgb) +{ + FfxFloat32 fLuminance = RawRGBToLuminance(fRawRgb); + + FfxFloat32 fPercievedLuminance = 0; + if (fLuminance <= 216.0f / 24389.0f) + { + fPercievedLuminance = fLuminance * (24389.0f / 27.0f); + } + else + { + fPercievedLuminance = ffxPow(fLuminance, 1.0f / 3.0f) * 116.0f - 16.0f; + } + + return fPercievedLuminance * 0.01f; +} + +struct BilinearSamplingData +{ + FfxInt32x2 iOffsets[4]; + FfxFloat32 fWeights[4]; + FfxInt32x2 iBasePos; +}; + +BilinearSamplingData GetBilinearSamplingData(FfxFloat32x2 fUv, FfxInt32x2 iSize) +{ + BilinearSamplingData data; + + FfxFloat32x2 fPxSample = (fUv * iSize) - FfxFloat32x2(0.5f, 0.5f); + data.iBasePos = FfxInt32x2(floor(fPxSample)); + FfxFloat32x2 fPxFrac = ffxFract(fPxSample); + + data.iOffsets[0] = FfxInt32x2(0, 0); + data.iOffsets[1] = FfxInt32x2(1, 0); + data.iOffsets[2] = FfxInt32x2(0, 1); + data.iOffsets[3] = FfxInt32x2(1, 1); + + data.fWeights[0] = (1 - fPxFrac.x) * (1 - fPxFrac.y); + data.fWeights[1] = (fPxFrac.x) * (1 - fPxFrac.y); + data.fWeights[2] = (1 - fPxFrac.x) * (fPxFrac.y); + data.fWeights[3] = (fPxFrac.x) * (fPxFrac.y); + + return data; +} + +#if defined(FFX_FRAMEINTERPOLATION_BIND_CB_FRAMEINTERPOLATION) +FfxFloat32 ConvertFromDeviceDepthToViewSpace(FfxFloat32 fDeviceDepth) +{ + const FfxFloat32x4 deviceToViewDepth = DeviceToViewSpaceTransformFactors(); + return deviceToViewDepth[1] / (fDeviceDepth - deviceToViewDepth[0]); +} + +FfxFloat32x2 ComputeNdc(FfxFloat32x2 fPxPos, FfxInt32x2 iSize) +{ + return fPxPos / FfxFloat32x2(iSize) * FfxFloat32x2(2.0f, -2.0f) + FfxFloat32x2(-1.0f, 1.0f); +} + +FfxFloat32x3 GetViewSpacePosition(FfxInt32x2 iViewportPos, FfxInt32x2 iViewportSize, FfxFloat32 fDeviceDepth) +{ + const FfxFloat32x4 fDeviceToViewDepth = DeviceToViewSpaceTransformFactors(); + + const FfxFloat32 Z = ConvertFromDeviceDepthToViewSpace(fDeviceDepth); + + const FfxFloat32x2 fNdcPos = ComputeNdc(iViewportPos, iViewportSize); + const FfxFloat32 X = fDeviceToViewDepth[2] * fNdcPos.x * Z; + const FfxFloat32 Y = fDeviceToViewDepth[3] * fNdcPos.y * Z; + + return FfxFloat32x3(X, Y, Z); +} +#endif + +FfxBoolean IsOnScreen(FfxInt32x2 pos, FfxInt32x2 size) +{ + return all(FFX_LESS_THAN(FfxUInt32x2(pos), FfxUInt32x2(size))); +} + +FfxBoolean IsUvInside(FfxFloat32x2 fUv) +{ + return (fUv.x > 0.0f && fUv.x < 1.0f) && (fUv.y > 0.0f && fUv.y < 1.0f); +} + +FfxBoolean IsInRect(FfxInt32x2 pos, FfxInt32x2 iRectCorner, FfxInt32x2 iRectSize) +{ + return (pos.x >= iRectCorner.x && pos.x < (iRectSize.x + iRectCorner.x) && pos.y >= iRectCorner.y && pos.y < (iRectSize.y + iRectCorner.y)); +} + +FfxFloat32 MinDividedByMax(const FfxFloat32 v0, const FfxFloat32 v1) +{ + const FfxFloat32 m = ffxMax(v0, v1); + return m != 0 ? ffxMin(v0, v1) / m : 0; +} + +FfxFloat32 NormalizedDot3(const FfxFloat32x3 v0, const FfxFloat32x3 v1) +{ + FfxFloat32 fMaxLength = ffxMax(length(v0), length(v1)); + + return fMaxLength > 0.0f ? dot(v0 / fMaxLength, v1 / fMaxLength) : 1.0f; +} + +FfxFloat32 NormalizedDot2(const FfxFloat32x2 v0, const FfxFloat32x2 v1) +{ + FfxFloat32 fMaxLength = ffxMax(length(v0), length(v1)); + + return fMaxLength > 0.0f ? dot(v0 / fMaxLength, v1 / fMaxLength) : 1.0f; +} + +FfxFloat32 CalculateStaticContentFactor(FfxFloat32x3 fCurrentInterpolationSource, FfxFloat32x3 fPresentColor) +{ + const FfxFloat32x3 fFactor = ffxSaturate(FfxFloat32x3( + ffxSaturate((1.0f - MinDividedByMax(fCurrentInterpolationSource.r, fPresentColor.r)) / 0.1f), + ffxSaturate((1.0f - MinDividedByMax(fCurrentInterpolationSource.g, fPresentColor.g)) / 0.1f), + ffxSaturate((1.0f - MinDividedByMax(fCurrentInterpolationSource.b, fPresentColor.b)) / 0.1f) + )); + + return max(fFactor.x, max(fFactor.y, fFactor.z)); +} + +// +// MOTION VECTOR FIELD +// + +FFX_STATIC const FfxUInt32 MOTION_VECTOR_FIELD_ENTRY_BIT_COUNT = 32; + +// Make sure all bit counts add up to MOTION_VECTOR_FIELD_ENTRY_BIT_COUNT +FFX_STATIC const FfxUInt32 MOTION_VECTOR_FIELD_VECTOR_COEFFICIENT_BIT_COUNT = 16; +FFX_STATIC const FfxUInt32 MOTION_VECTOR_FIELD_PRIORITY_LOW_BIT_COUNT = 5; +FFX_STATIC const FfxUInt32 MOTION_VECTOR_FIELD_PRIORITY_HIGH_BIT_COUNT = 10; +FFX_STATIC const FfxUInt32 MOTION_VECTOR_PRIMARY_VECTOR_INDICATION_BIT_COUNT = 1; + +FFX_STATIC const FfxUInt32 MOTION_VECTOR_FIELD_PRIMARY_VECTOR_INDICATION_BIT = (1U << (MOTION_VECTOR_FIELD_ENTRY_BIT_COUNT - 1)); + +FFX_STATIC const FfxUInt32 PRIORITY_LOW_MAX = (1U << MOTION_VECTOR_FIELD_PRIORITY_LOW_BIT_COUNT) - 1; +FFX_STATIC const FfxUInt32 PRIORITY_HIGH_MAX = (1U << MOTION_VECTOR_FIELD_PRIORITY_HIGH_BIT_COUNT) - 1; + +FFX_STATIC const FfxUInt32 PRIORITY_LOW_OFFSET = MOTION_VECTOR_FIELD_VECTOR_COEFFICIENT_BIT_COUNT; +FFX_STATIC const FfxUInt32 PRIORITY_HIGH_OFFSET = PRIORITY_LOW_OFFSET + MOTION_VECTOR_FIELD_PRIORITY_LOW_BIT_COUNT; +FFX_STATIC const FfxUInt32 PRIMARY_VECTOR_INDICATION_OFFSET = PRIORITY_HIGH_OFFSET + MOTION_VECTOR_FIELD_PRIORITY_HIGH_BIT_COUNT; + +struct VectorFieldEntry +{ + FfxFloat32x2 fMotionVector; + FfxFloat32 uHighPriorityFactor; + FfxFloat32 uLowPriorityFactor; + FfxBoolean bValid; + FfxBoolean bPrimary; + FfxBoolean bSecondary; + FfxBoolean bInPainted; + FfxFloat32 fVelocity; + FfxBoolean bNegOutside; + FfxBoolean bPosOutside; +}; + +VectorFieldEntry NewVectorFieldEntry() +{ + VectorFieldEntry vfe; + vfe.fMotionVector = FfxFloat32x2(0.0, 0.0); + vfe.uHighPriorityFactor = 0.0; + vfe.uLowPriorityFactor = 0.0; + vfe.bValid = false; + vfe.bPrimary = false; + vfe.bSecondary = false; + vfe.bInPainted = false; + vfe.fVelocity = 0.0; + vfe.bNegOutside = false; + vfe.bPosOutside = false; + return vfe; +} + +FfxBoolean PackedVectorFieldEntryIsPrimary(FfxUInt32 packedEntry) +{ + return ((packedEntry & MOTION_VECTOR_FIELD_PRIMARY_VECTOR_INDICATION_BIT) != 0); +} + +FfxUInt32x2 PackVectorFieldEntries(FfxBoolean bIsPrimary, FfxUInt32 uHighPriorityFactor, FfxUInt32 uLowPriorityFactor, FfxFloat32x2 fMotionVector) +{ + const FfxUInt32 uPriority = + (FfxUInt32(bIsPrimary) * MOTION_VECTOR_FIELD_PRIMARY_VECTOR_INDICATION_BIT) + | ((uHighPriorityFactor & PRIORITY_HIGH_MAX) << PRIORITY_HIGH_OFFSET) + | ((uLowPriorityFactor & PRIORITY_LOW_MAX) << PRIORITY_LOW_OFFSET); + + FfxUInt32 packedX = uPriority | ffxF32ToF16(fMotionVector.x); + FfxUInt32 packedY = uPriority | ffxF32ToF16(fMotionVector.y); + + return FfxUInt32x2(packedX, packedY); +} + +void UnpackVectorFieldEntries(FfxUInt32x2 packed, out VectorFieldEntry vfElement) +{ + vfElement.uHighPriorityFactor = FfxFloat32((packed.x >> PRIORITY_HIGH_OFFSET) & PRIORITY_HIGH_MAX) / PRIORITY_HIGH_MAX; + vfElement.uLowPriorityFactor = FfxFloat32((packed.x >> PRIORITY_LOW_OFFSET) & PRIORITY_LOW_MAX) / PRIORITY_LOW_MAX; + + vfElement.bPrimary = PackedVectorFieldEntryIsPrimary(packed.x); + vfElement.bValid = (vfElement.uHighPriorityFactor > 0.0f); + vfElement.bSecondary = vfElement.bValid && !vfElement.bPrimary; + + // Reverse priority factor for secondary vectors + if (vfElement.bSecondary) + { + vfElement.uHighPriorityFactor = 1.0f - vfElement.uHighPriorityFactor; + } + + vfElement.fMotionVector.x = ffxUnpackF32(packed.x).x; + vfElement.fMotionVector.y = ffxUnpackF32(packed.y).x; + vfElement.bInPainted = false; +} + +// +// MOTION VECTOR FIELD +// + +#if defined(FFX_FRAMEINTERPOLATION_BIND_SRV_INPAINTING_PYRAMID) +FfxFloat32x4 ComputeMvInpaintingLevel(FfxFloat32x2 fUv, const FfxInt32 iMipLevel, const FfxInt32x2 iTexSize) +{ + BilinearSamplingData bilinearInfo = GetBilinearSamplingData(fUv, iTexSize); + + FfxFloat32 fSum = 0.0f; + FfxFloat32x4 fColor = FfxFloat32x4(0.0, 0.0, 0.0, 0.0); + fColor.z = 0; + + const FfxFloat32 fMaxPriorityFactor = 1.0f; + + for (FfxInt32 iSampleIndex = 0; iSampleIndex < 4; iSampleIndex++) + { + const FfxInt32x2 iOffset = bilinearInfo.iOffsets[iSampleIndex]; + const FfxInt32x2 iSamplePos = bilinearInfo.iBasePos + iOffset; + + if (IsOnScreen(iSamplePos, iTexSize)) + { + FfxFloat32x4 fSample = LoadInpaintingPyramid(iMipLevel, iSamplePos); + + const FfxFloat32 fPriorityFactor = fSample.z; + const FfxFloat32 fValidMvFactor = FfxFloat32(fSample.z > 0); + const FfxFloat32 fSampleWeight = bilinearInfo.fWeights[iSampleIndex] * fValidMvFactor * fPriorityFactor; + + fSum += fSampleWeight; + fColor += fSample * fSampleWeight; + } + } + + fColor /= (fSum > 0.0f) ? fSum : 1.0f; + + return fColor; +} +#if defined(FFX_FRAMEINTERPOLATION_BIND_CB_FRAMEINTERPOLATION) && \ + defined(FFX_FRAMEINTERPOLATION_BIND_SRV_GAME_MOTION_VECTOR_FIELD_X) && \ + defined(FFX_FRAMEINTERPOLATION_BIND_SRV_GAME_MOTION_VECTOR_FIELD_Y) + +void LoadInpaintedGameFieldMv(FfxFloat32x2 fUv, out VectorFieldEntry vfElement) +{ + FfxInt32x2 iPxSample = FfxInt32x2(fUv * RenderSize()); + FfxUInt32x2 packedGameFieldMv = LoadGameFieldMv(iPxSample); + UnpackVectorFieldEntries(packedGameFieldMv, vfElement); + + if (!vfElement.bValid) + { + //FfxFloat32x2 fUv = (FfxFloat32x2(iPxSample) + 0.5f) / RenderSize(); + FfxInt32x2 iTexSize = RenderSize(); + + FfxFloat32x4 fInPaintedVector = FfxFloat32x4(0.0, 0.0, 0.0, 0.0); + for (FfxInt32 iMipLevel = 0; iMipLevel < 11 && (fInPaintedVector.w == 0.0f); iMipLevel++) + { + iTexSize /= 2; + + fInPaintedVector = ComputeMvInpaintingLevel(fUv, iMipLevel, iTexSize); + } + + vfElement.fMotionVector = fInPaintedVector.xy; + vfElement.uHighPriorityFactor = fInPaintedVector.z; + vfElement.uLowPriorityFactor = fInPaintedVector.w; + vfElement.bInPainted = true; + } + + vfElement.bNegOutside = !IsUvInside(fUv - vfElement.fMotionVector); + vfElement.bPosOutside = !IsUvInside(fUv + vfElement.fMotionVector); + vfElement.fVelocity = length(vfElement.fMotionVector); +} +#endif +#endif + +#if defined(FFX_FRAMEINTERPOLATION_BIND_SRV_OPTICAL_FLOW_MOTION_VECTOR_FIELD_X) && \ + defined(FFX_FRAMEINTERPOLATION_BIND_SRV_OPTICAL_FLOW_MOTION_VECTOR_FIELD_Y) && \ + defined(FFX_FRAMEINTERPOLATION_BIND_CB_FRAMEINTERPOLATION) +void SampleOpticalFlowMotionVectorField(FfxFloat32x2 fUv, out VectorFieldEntry vfElement) +{ + const FfxFloat32 scaleFactor = 1.0f; + + BilinearSamplingData bilinearInfo = GetBilinearSamplingData(fUv, FfxInt32x2(GetOpticalFlowSize2() * scaleFactor)); + + vfElement = NewVectorFieldEntry(); + + FfxFloat32 fWeightSum = 0.0f; + for (FfxInt32 iSampleIndex = 0; iSampleIndex < 4; iSampleIndex++) + { + const FfxInt32x2 iOffset = bilinearInfo.iOffsets[iSampleIndex]; + const FfxInt32x2 iSamplePos = bilinearInfo.iBasePos + iOffset; + + if (IsOnScreen(iSamplePos, FfxInt32x2(GetOpticalFlowSize2() * scaleFactor))) + { + const FfxFloat32 fWeight = bilinearInfo.fWeights[iSampleIndex]; + + VectorFieldEntry fOfVectorSample = NewVectorFieldEntry(); + FfxInt32x2 packedOpticalFlowMv = FfxInt32x2(LoadOpticalFlowFieldMv(iSamplePos)); + UnpackVectorFieldEntries(packedOpticalFlowMv, fOfVectorSample); + + vfElement.fMotionVector += fOfVectorSample.fMotionVector * fWeight; + vfElement.uHighPriorityFactor += fOfVectorSample.uHighPriorityFactor * fWeight; + vfElement.uLowPriorityFactor += fOfVectorSample.uLowPriorityFactor * fWeight; + + fWeightSum += fWeight; + } + } + + if (fWeightSum > 0.0f) + { + vfElement.fMotionVector /= fWeightSum; + vfElement.uHighPriorityFactor /= fWeightSum; + vfElement.uLowPriorityFactor /= fWeightSum; + } + + vfElement.bNegOutside = !IsUvInside(fUv - vfElement.fMotionVector); + vfElement.bPosOutside = !IsUvInside(fUv + vfElement.fMotionVector); + vfElement.fVelocity = length(vfElement.fMotionVector); +} +#endif + +FfxFloat32x3 Tonemap(FfxFloat32x3 fRgb) +{ + return fRgb / (ffxMax(ffxMax(0.f, fRgb.r), ffxMax(fRgb.g, fRgb.b)) + 1.f).xxx; +} + +FfxFloat32x3 InverseTonemap(FfxFloat32x3 fRgb) +{ + return fRgb / ffxMax(FFX_TONEMAP_EPSILON, 1.f - ffxMax(fRgb.r, ffxMax(fRgb.g, fRgb.b))).xxx; +} + +FfxInt32x2 ComputeHrPosFromLrPos(FfxInt32x2 iPxLrPos) +{ + FfxFloat32x2 fSrcJitteredPos = FfxFloat32x2(iPxLrPos) + 0.5f - Jitter(); + FfxFloat32x2 fLrPosInHr = (fSrcJitteredPos / RenderSize()) * DisplaySize(); + FfxInt32x2 iPxHrPos = FfxInt32x2(floor(fLrPosInHr)); + return iPxHrPos; +} +#if FFX_HALF +FFX_MIN16_I2 ComputeHrPosFromLrPos(FFX_MIN16_I2 iPxLrPos) +{ + FFX_MIN16_F2 fSrcJitteredPos = FFX_MIN16_F2(iPxLrPos) + FFX_MIN16_F(0.5f) - FFX_MIN16_F2(Jitter()); + FFX_MIN16_F2 fLrPosInHr = (fSrcJitteredPos / FFX_MIN16_F2(RenderSize())) * FFX_MIN16_F2(DisplaySize()); + FFX_MIN16_I2 iPxHrPos = FFX_MIN16_I2(floor(fLrPosInHr)); + return iPxHrPos; +} +#endif + +#endif //!defined(FFX_FRAMEINTERPOLATION_COMMON_H) diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/frameinterpolation/ffx_frameinterpolation_compute_game_vector_field_inpainting_pyramid.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/frameinterpolation/ffx_frameinterpolation_compute_game_vector_field_inpainting_pyramid.h new file mode 100644 index 00000000..75b3e1e2 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/frameinterpolation/ffx_frameinterpolation_compute_game_vector_field_inpainting_pyramid.h @@ -0,0 +1,121 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#ifndef FFX_FRAMEINTERPOLATION_COMPUTE_GAME_VECTOR_FIELD_INPAINTING_PYRAMID_H +#define FFX_FRAMEINTERPOLATION_COMPUTE_GAME_VECTOR_FIELD_INPAINTING_PYRAMID_H + +#include "ffx_frameinterpolation_common.h" +//-------------------------------------------------------------------------------------- +// Buffer definitions - global atomic counter +//-------------------------------------------------------------------------------------- + +FFX_GROUPSHARED FfxUInt32 spdCounter; +FFX_GROUPSHARED FfxFloat32 spdIntermediateR[16][16]; +FFX_GROUPSHARED FfxFloat32 spdIntermediateG[16][16]; +FFX_GROUPSHARED FfxFloat32 spdIntermediateB[16][16]; +FFX_GROUPSHARED FfxFloat32 spdIntermediateA[16][16]; + +FfxFloat32x4 SpdLoadSourceImage(FfxInt32x2 tex, FfxUInt32 slice) +{ + VectorFieldEntry gameMv; + FfxUInt32x2 packedGameFieldMv = LoadGameFieldMv(tex); + UnpackVectorFieldEntries(packedGameFieldMv, gameMv); + + return FfxFloat32x4(gameMv.fMotionVector, gameMv.uHighPriorityFactor, gameMv.uLowPriorityFactor) * FfxFloat32(DisplaySize().x > 0); +} + +FfxFloat32x4 SpdLoad(FfxInt32x2 tex, FfxUInt32 slice) +{ + return RWLoadInpaintingPyramid(tex, 5); +} + +void SpdStore(FfxInt32x2 pix, FfxFloat32x4 outValue, FfxUInt32 index, FfxUInt32 slice) +{ + StoreInpaintingPyramid(pix, outValue, index); +} + +void SpdIncreaseAtomicCounter(FfxUInt32 slice) +{ + AtomicIncreaseCounter(COUNTER_SPD, spdCounter); +} + +FfxUInt32 SpdGetAtomicCounter() +{ + return spdCounter; +} +void SpdResetAtomicCounter(FfxUInt32 slice) +{ + StoreCounter(COUNTER_SPD, 0); +} + +FfxFloat32x4 SpdLoadIntermediate(FfxUInt32 x, FfxUInt32 y) +{ + return FfxFloat32x4( + spdIntermediateR[x][y], + spdIntermediateG[x][y], + spdIntermediateB[x][y], + spdIntermediateA[x][y]); +} + +void SpdStoreIntermediate(FfxUInt32 x, FfxUInt32 y, FfxFloat32x4 value) +{ + spdIntermediateR[x][y] = value.x; + spdIntermediateG[x][y] = value.y; + spdIntermediateB[x][y] = value.z; + spdIntermediateA[x][y] = value.w; +} + +FfxFloat32x4 SpdReduce4(FfxFloat32x4 v0, FfxFloat32x4 v1, FfxFloat32x4 v2, FfxFloat32x4 v3) +{ + FfxFloat32x4 vec = FfxFloat32x4(0,0,0,0); + + FfxFloat32 fWeightSum = 0.0f; +#define ADD(SAMPLE) { \ + FfxFloat32 fWeight = FfxFloat32(SAMPLE.z > 0.0f); \ + vec += SAMPLE * fWeight; \ + fWeightSum += fWeight; \ + } + + ADD(v0); + ADD(v1); + ADD(v2); + ADD(v3); + + vec /= (fWeightSum > FFX_FRAMEINTERPOLATION_EPSILON) ? fWeightSum : 1.0f; + + return vec; +} + +#include "spd/ffx_spd.h" + +void computeFrameinterpolationGameVectorFieldInpaintingPyramid(FfxInt32x3 iGroupId, FfxInt32 iLocalIndex) +{ + SpdDownsample( + FfxUInt32x2(iGroupId.xy), + FfxUInt32(iLocalIndex), + FfxUInt32(NumMips()), + FfxUInt32(NumWorkGroups()), + FfxUInt32(iGroupId.z), + FfxUInt32x2(WorkGroupOffset())); +} + +#endif // FFX_FRAMEINTERPOLATION_COMPUTE_GAME_VECTOR_FIELD_INPAINTING_PYRAMID_H diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/frameinterpolation/ffx_frameinterpolation_compute_inpainting_pyramid.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/frameinterpolation/ffx_frameinterpolation_compute_inpainting_pyramid.h new file mode 100644 index 00000000..da2b6728 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/frameinterpolation/ffx_frameinterpolation_compute_inpainting_pyramid.h @@ -0,0 +1,120 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#ifndef FFX_FRAMEINTERPOLATION_COMPUTE_INPAINTING_PYRAMID_H +#define FFX_FRAMEINTERPOLATION_COMPUTE_INPAINTING_PYRAMID_H + +//-------------------------------------------------------------------------------------- +// Buffer definitions - global atomic counter +//-------------------------------------------------------------------------------------- + +FFX_GROUPSHARED FfxUInt32 spdCounter; +FFX_GROUPSHARED FfxFloat32 spdIntermediateR[16][16]; +FFX_GROUPSHARED FfxFloat32 spdIntermediateG[16][16]; +FFX_GROUPSHARED FfxFloat32 spdIntermediateB[16][16]; +FFX_GROUPSHARED FfxFloat32 spdIntermediateA[16][16]; + +FfxFloat32x4 SpdLoadSourceImage(FfxInt32x2 tex, FfxUInt32 slice) +{ + FfxFloat32x4 fColor = LoadFrameInterpolationOutput(tex) * FfxFloat32(DisplaySize().x > 0); + + // reverse sample weights + fColor.w = ffxSaturate(1.0f - fColor.w); + + + if (tex.x < InterpolationRectBase().x || tex.x >= (InterpolationRectSize().x + InterpolationRectBase().x) || tex.y < InterpolationRectBase().y || + tex.y >= (InterpolationRectSize().y + InterpolationRectBase().y)) + { + fColor.w = 0.0f; // don't take contributions from outside of the interpolation rect + } + + return fColor; +} + +FfxFloat32x4 SpdLoad(FfxInt32x2 tex, FfxUInt32 slice) +{ + return RWLoadInpaintingPyramid(tex, 5); +} + +void SpdStore(FfxInt32x2 pix, FfxFloat32x4 outValue, FfxUInt32 index, FfxUInt32 slice) +{ + StoreInpaintingPyramid(pix, outValue, index); +} + +void SpdIncreaseAtomicCounter(FfxUInt32 slice) +{ + AtomicIncreaseCounter(COUNTER_SPD, spdCounter); +} + +FfxUInt32 SpdGetAtomicCounter() +{ + return spdCounter; +} +void SpdResetAtomicCounter(FfxUInt32 slice) +{ + StoreCounter(COUNTER_SPD, 0); +} + +FfxFloat32x4 SpdLoadIntermediate(FfxUInt32 x, FfxUInt32 y) +{ + return FfxFloat32x4( + spdIntermediateR[x][y], + spdIntermediateG[x][y], + spdIntermediateB[x][y], + spdIntermediateA[x][y]); +} + +void SpdStoreIntermediate(FfxUInt32 x, FfxUInt32 y, FfxFloat32x4 value) +{ + spdIntermediateR[x][y] = value.x; + spdIntermediateG[x][y] = value.y; + spdIntermediateB[x][y] = value.z; + spdIntermediateA[x][y] = value.w; +} + +FfxFloat32x4 SpdReduce4(FfxFloat32x4 v0, FfxFloat32x4 v1, FfxFloat32x4 v2, FfxFloat32x4 v3) +{ + FfxFloat32x4 w = FfxFloat32x4(v0.w, v1.w, v2.w, v3.w); + + FfxFloat32 sum = (w[0] + w[1] + w[2] + w[3]); + + if (sum == 0.0f) { + return FfxFloat32x4(0.0, 0.0, 0.0, 0.0); + } + + return (v0 * w[0] + v1 * w[1] + v2 * w[2] + v3 * w[3]) / sum; +} + +#include "spd/ffx_spd.h" + +void computeFrameinterpolationInpaintingPyramid(FfxInt32x3 iGroupId, FfxInt32 iLocalIndex) +{ + SpdDownsample( + FfxUInt32x2(iGroupId.xy), + FfxUInt32(iLocalIndex), + FfxUInt32(NumMips()), + FfxUInt32(NumWorkGroups()), + FfxUInt32(iGroupId.z), + FfxUInt32x2(WorkGroupOffset())); +} + +#endif // FFX_FRAMEINTERPOLATION_COMPUTE_INPAINTING_PYRAMID_H diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/frameinterpolation/ffx_frameinterpolation_debug_view.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/frameinterpolation/ffx_frameinterpolation_debug_view.h new file mode 100644 index 00000000..bcd3a52a --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/frameinterpolation/ffx_frameinterpolation_debug_view.h @@ -0,0 +1,172 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#ifndef FFX_FRAMEINTERPOLATION_DEBUG_VIEW_H +#define FFX_FRAMEINTERPOLATION_DEBUG_VIEW_H + +struct FfxFrameInterpolationDebugViewport +{ + FfxInt32x2 offset; + FfxInt32x2 size; +}; + +// Macro to cull and draw debug viewport +#define DRAW_VIEWPORT(function, pos, vp) \ + { \ + if (pointIsInsideViewport(pos, vp)) \ + { \ + function(pos, vp); \ + } \ + } + +FfxFloat32x2 getTransformedUv(FfxInt32x2 iPxPos, FfxFrameInterpolationDebugViewport vp) +{ + FfxFloat32x2 fUv = (FfxFloat32x2(iPxPos - vp.offset) + 0.5f) / vp.size; + + return fUv; +} + +FfxFloat32x4 getMotionVectorColor(FfxFloat32x2 fMotionVector) +{ + return FfxFloat32x4(0.5f + fMotionVector * DisplaySize() * 0.1f, 0.5f, 1.0f); +} + +FfxFloat32x4 getUnusedIndicationColor(FfxInt32x2 iPxPos, FfxFrameInterpolationDebugViewport vp) +{ + FfxInt32x2 basePos = iPxPos - vp.offset; + + FfxFloat32 ar = FfxFloat32(vp.size.x) / FfxFloat32(vp.size.y); + + return FfxFloat32x4(basePos.x == FfxInt32(basePos.y * ar), 0, 0, 1); +} + +void drawGameMotionVectorFieldVectors(FfxInt32x2 iPxPos, FfxFrameInterpolationDebugViewport vp) +{ + FfxFloat32x2 fUv = getTransformedUv(iPxPos, vp); + + VectorFieldEntry gameMv; + LoadInpaintedGameFieldMv(fUv, gameMv); + + StoreFrameinterpolationOutput(iPxPos, getMotionVectorColor(gameMv.fMotionVector)); +} + +void drawGameMotionVectorFieldDepthPriority(FfxInt32x2 iPxPos, FfxFrameInterpolationDebugViewport vp) +{ + FfxFloat32x2 fUv = getTransformedUv(iPxPos, vp); + + VectorFieldEntry gameMv; + LoadInpaintedGameFieldMv(fUv, gameMv); + + StoreFrameinterpolationOutput(iPxPos, FfxFloat32x4(0, gameMv.uHighPriorityFactor, 0, 1)); +} + +void drawOpticalFlowMotionVectorField(FfxInt32x2 iPxPos, FfxFrameInterpolationDebugViewport vp) +{ + FfxFloat32x2 fUv = getTransformedUv(iPxPos, vp); + + VectorFieldEntry ofMv; + SampleOpticalFlowMotionVectorField(fUv, ofMv); + + StoreFrameinterpolationOutput(iPxPos, getMotionVectorColor(ofMv.fMotionVector)); +} + +void drawDisocclusionMask(FfxInt32x2 iPxPos, FfxFrameInterpolationDebugViewport vp) +{ + FfxFloat32x2 fUv = getTransformedUv(iPxPos, vp); + + FfxFloat32x2 fLrUv = fUv * (FfxFloat32x2(RenderSize()) / GetMaxRenderSize()); + + FfxFloat32x2 fDisocclusionFactor = ffxSaturate(SampleDisocclusionMask(fLrUv).xy); + + StoreFrameinterpolationOutput(iPxPos, FfxFloat32x4(fDisocclusionFactor, 0, 1)); +} + +FfxFloat32x4 getDistortionField(FfxInt32x2 iPxPos, FfxFrameInterpolationDebugViewport vp) +{ + FfxFloat32x2 fUv = getTransformedUv(iPxPos, vp); + + FfxFloat32x2 fDistortionFieldUv = abs(SampleDistortionField(fUv).xy); + + return FfxFloat32x4(fDistortionFieldUv * 10.0f, 0.0f, 1.0f); +} + +void drawPresentBackbuffer(FfxInt32x2 iPxPos, FfxFrameInterpolationDebugViewport vp) +{ + FfxFloat32x2 fUv = getTransformedUv(iPxPos, vp); + + FfxFloat32x4 fPresentColor = getDistortionField(iPxPos, vp); + + if (GetHUDLessAttachedFactor() == 1) + { + fPresentColor = SamplePresentBackbuffer(fUv); + } + + StoreFrameinterpolationOutput(iPxPos, fPresentColor); +} + +void drawCurrentInterpolationSource(FfxInt32x2 iPxPos, FfxFrameInterpolationDebugViewport vp) +{ + FfxFloat32x2 fUv = getTransformedUv(iPxPos, vp); + + FfxFloat32x4 fCurrentBackBuffer = FfxFloat32x4(SampleCurrentBackbuffer(fUv), 1.0f); + + StoreFrameinterpolationOutput(iPxPos, fCurrentBackBuffer); +} + +FfxBoolean pointIsInsideViewport(FfxInt32x2 iPxPos, FfxFrameInterpolationDebugViewport vp) +{ + FfxInt32x2 extent = vp.offset + vp.size; + + return (iPxPos.x >= vp.offset.x && iPxPos.x < extent.x) && (iPxPos.y >= vp.offset.y && iPxPos.y < extent.y); +} + +void computeDebugView(FfxInt32x2 iPxPos) +{ +#define VIEWPORT_GRID_SIZE_X 3 +#define VIEWPORT_GRID_SIZE_Y 3 + + FfxFloat32x2 fViewportScale = FfxFloat32x2(1.0f / VIEWPORT_GRID_SIZE_X, 1.0f / VIEWPORT_GRID_SIZE_Y); + FfxInt32x2 iViewportSize = FfxInt32x2(DisplaySize() * fViewportScale); + + // compute grid [y][x] for easier placement of viewports + FfxFrameInterpolationDebugViewport vp[VIEWPORT_GRID_SIZE_Y][VIEWPORT_GRID_SIZE_X]; + for (FfxInt32 y = 0; y < VIEWPORT_GRID_SIZE_Y; y++) + { + for (FfxInt32 x = 0; x < VIEWPORT_GRID_SIZE_X; x++) + { + vp[y][x].offset = iViewportSize * FfxInt32x2(x, y); + vp[y][x].size = iViewportSize; + } + } + + // top row + DRAW_VIEWPORT(drawGameMotionVectorFieldVectors, iPxPos, vp[0][0]); + DRAW_VIEWPORT(drawGameMotionVectorFieldDepthPriority, iPxPos, vp[0][1]); + DRAW_VIEWPORT(drawOpticalFlowMotionVectorField, iPxPos, vp[0][2]); + + // bottom row + DRAW_VIEWPORT(drawDisocclusionMask, iPxPos, vp[2][0]); + DRAW_VIEWPORT(drawCurrentInterpolationSource, iPxPos, vp[2][1]); + DRAW_VIEWPORT(drawPresentBackbuffer, iPxPos, vp[2][2]); +} + +#endif // FFX_FRAMEINTERPOLATION_DEBUG_VIEW_H diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/frameinterpolation/ffx_frameinterpolation_disocclusion_mask.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/frameinterpolation/ffx_frameinterpolation_disocclusion_mask.h new file mode 100644 index 00000000..03adc96f --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/frameinterpolation/ffx_frameinterpolation_disocclusion_mask.h @@ -0,0 +1,146 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#ifndef FFX_FRAMEINTERPOLATION_DISOCCLUSION_MASK_H +#define FFX_FRAMEINTERPOLATION_DISOCCLUSION_MASK_H + +FFX_STATIC const FfxFloat32 DepthClipBaseScale = 1.0f; + +FfxFloat32 ComputeSampleDepthClip(FfxInt32x2 iPxSamplePos, FfxFloat32 fPreviousDepth, FfxFloat32 fPreviousDepthBilinearWeight, FfxFloat32 fCurrentDepthViewSpace) +{ + FfxFloat32 fPrevNearestDepthViewSpace = ConvertFromDeviceDepthToViewSpace(fPreviousDepth); + + // Depth separation logic ref: See "Minimum Triangle Separation for Correct Z-Buffer Occlusion" + // Intention: worst case of formula in Figure4 combined with Ksep factor in Section 4 + const FfxFloat32 fHalfViewportWidth = RenderSize().x * 0.5f; + FfxFloat32 fDepthThreshold = ffxMax(fCurrentDepthViewSpace, fPrevNearestDepthViewSpace); + + // WARNING: Ksep only works with reversed-z with infinite projection. + const FfxFloat32 Ksep = 1.37e-05f; + FfxFloat32 fRequiredDepthSeparation = Ksep * fDepthThreshold * TanHalfFoV() * fHalfViewportWidth; + FfxFloat32 fDepthDiff = fCurrentDepthViewSpace - fPrevNearestDepthViewSpace; + + FfxFloat32 fDepthClipFactor = (fDepthDiff > 0) ? ffxSaturate(fRequiredDepthSeparation / fDepthDiff) : 1.0f; + + return fPreviousDepthBilinearWeight * fDepthClipFactor * ffxLerp(1.0f, DepthClipBaseScale, ffxSaturate(fDepthDiff * fDepthDiff)); +} + +FfxFloat32 LoadEstimatedDepth(FfxUInt32 estimatedIndex, FfxInt32x2 iSamplePos) +{ + const FfxFloat32x2 fUv = FfxFloat32x2(iSamplePos + 0.5f) / RenderSize(); + const FfxFloat32x2 fDistortionFieldUv = SampleDistortionField(fUv); + FfxInt32x2 iDistortionPixelOffset = FfxInt32x2(fDistortionFieldUv.xy * RenderSize()); + + if (estimatedIndex == 0) + { + return LoadReconstructedDepthPreviousFrame(iSamplePos + iDistortionPixelOffset); + } + else if (estimatedIndex == 1) + { + return LoadDilatedDepth(iSamplePos + iDistortionPixelOffset); + } + + return 0; +} + +FfxFloat32 ComputeDepthClip(FfxUInt32 estimatedIndex, FfxFloat32x2 fUvSample, FfxFloat32 fCurrentDepthSample) +{ + FfxFloat32 fCurrentDepthViewSpace = ConvertFromDeviceDepthToViewSpace(fCurrentDepthSample); + BilinearSamplingData bilinearInfo = GetBilinearSamplingData(fUvSample, RenderSize()); + + FfxFloat32 fDilatedSum = 0.0f; + FfxFloat32 fDepth = 0.0f; + FfxFloat32 fWeightSum = 0.0f; + for (FfxInt32 iSampleIndex = 0; iSampleIndex < 4; iSampleIndex++) { + + const FfxInt32x2 iOffset = bilinearInfo.iOffsets[iSampleIndex]; + const FfxInt32x2 iSamplePos = bilinearInfo.iBasePos + iOffset; + + if (IsOnScreen(iSamplePos, RenderSize())) { + const FfxFloat32 fWeight = bilinearInfo.fWeights[iSampleIndex]; + if (fWeight > fReconstructedDepthBilinearWeightThreshold) { + + const FfxFloat32 fPrevDepthSample = LoadEstimatedDepth(estimatedIndex, iSamplePos); + const FfxFloat32 fPrevNearestDepthViewSpace = ConvertFromDeviceDepthToViewSpace(fPrevDepthSample); + + const FfxFloat32 fDepthDiff = fCurrentDepthViewSpace - fPrevNearestDepthViewSpace; + + if (fDepthDiff > 0.0f) { + +#if FFX_FRAMEINTERPOLATION_OPTION_INVERTED_DEPTH + const FfxFloat32 fPlaneDepth = ffxMin(fPrevDepthSample, fCurrentDepthSample); +#else + const FfxFloat32 fPlaneDepth = ffxMax(fPrevDepthSample, fCurrentDepthSample); +#endif + + const FfxFloat32x3 fCenter = GetViewSpacePosition(FfxInt32x2(RenderSize() * 0.5f), RenderSize(), fPlaneDepth); + const FfxFloat32x3 fCorner = GetViewSpacePosition(FfxInt32x2(0, 0), RenderSize(), fPlaneDepth); + + const FfxFloat32 fHalfViewportWidth = length(FfxFloat32x2(RenderSize())); + const FfxFloat32 fDepthThreshold = ffxMin(fCurrentDepthViewSpace, fPrevNearestDepthViewSpace); + + const FfxFloat32 Ksep = 1.37e-05f; + const FfxFloat32 Kfov = length(fCorner) / length(fCenter); + const FfxFloat32 fRequiredDepthSeparation = Ksep * Kfov * fHalfViewportWidth * fDepthThreshold; + + const FfxFloat32 fResolutionFactor = ffxSaturate(length(FfxFloat32x2(RenderSize())) / length(FfxFloat32x2(1920.0f, 1080.0f))); + const FfxFloat32 fPower = ffxLerp(1.0f, 3.0f, fResolutionFactor); + + fDepth += FfxFloat32((fRequiredDepthSeparation / fDepthDiff) >= 1.0f) * fWeight; + fWeightSum += fWeight; + } + } + } + } + + return (fWeightSum > 0.0f) ? ffxSaturate(1.0f - fDepth / fWeightSum) : 0.0f; +} + +void computeDisocclusionMask(FfxInt32x2 iPxPos) +{ + FfxFloat32 fDilatedDepth = LoadEstimatedInterpolationFrameDepth(iPxPos); + + FfxFloat32x2 fDepthUv = (iPxPos + 0.5f) / RenderSize(); + FfxFloat32 fCurrentDepthViewSpace = ConvertFromDeviceDepthToViewSpace(fDilatedDepth); + + VectorFieldEntry gameMv; + LoadInpaintedGameFieldMv(fDepthUv, gameMv); + + const FfxFloat32 fDepthClipInterpolatedToPrevious = 1.0f - ComputeDepthClip(0, fDepthUv + gameMv.fMotionVector, fDilatedDepth); + const FfxFloat32 fDepthClipInterpolatedToCurrent = 1.0f - ComputeDepthClip(1, fDepthUv - gameMv.fMotionVector, fDilatedDepth); + FfxFloat32x2 fDisocclusionMask = FfxFloat32x2(fDepthClipInterpolatedToPrevious, fDepthClipInterpolatedToCurrent); + + fDisocclusionMask = FfxFloat32x2(FFX_GREATER_THAN_EQUAL(fDisocclusionMask, ffxBroadcast2(FFX_FRAMEINTERPOLATION_EPSILON))); + + // Avoid false disocclusion if primary game vector pointer outside screen area + const FfxFloat32x2 fSrcMotionVector = gameMv.fMotionVector * 2.0f; + const FfxInt32x2 iSamplePosPrevious = FfxInt32x2((fDepthUv + fSrcMotionVector) * RenderSize()); + fDisocclusionMask.x = ffxSaturate(fDisocclusionMask.x + FfxFloat32(!IsOnScreen(iSamplePosPrevious, RenderSize()))); + + const FfxInt32x2 iSamplePosCurrent = FfxInt32x2((fDepthUv - fSrcMotionVector) * RenderSize()); + fDisocclusionMask.y = ffxSaturate(fDisocclusionMask.y + FfxFloat32(!IsOnScreen(iSamplePosCurrent, RenderSize()))); + + StoreDisocclusionMask(iPxPos, fDisocclusionMask); + +} + +#endif // FFX_FRAMEINTERPOLATION_DISOCCLUSION_MASK_H diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/frameinterpolation/ffx_frameinterpolation_game_motion_vector_field.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/frameinterpolation/ffx_frameinterpolation_game_motion_vector_field.h new file mode 100644 index 00000000..574e3dff --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/frameinterpolation/ffx_frameinterpolation_game_motion_vector_field.h @@ -0,0 +1,123 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#ifndef FFX_FRAMEINTERPOLATION_GAME_MOTION_VECTOR_FIELD_H +#define FFX_FRAMEINTERPOLATION_GAME_MOTION_VECTOR_FIELD_H + +FfxUInt32 getPriorityFactorFromViewSpaceDepth(FfxFloat32 fViewSpaceDepthInMeters) +{ + fViewSpaceDepthInMeters = ffxPow(fViewSpaceDepthInMeters, 0.33f); + + FfxUInt32 uPriorityFactor = FfxUInt32(FfxFloat32(1 - (fViewSpaceDepthInMeters * (1.0f / (1.0f + fViewSpaceDepthInMeters)))) * PRIORITY_HIGH_MAX); + + return ffxMax(1, uPriorityFactor); +} + +void computeGameFieldMvs(FfxInt32x2 iPxPos) +{ + const FfxFloat32x2 fUvInScreenSpace = (FfxFloat32x2(iPxPos) + 0.5f) / RenderSize(); + + const FfxFloat32x2 fDistortionFieldUv = SampleDistortionField(fUvInScreenSpace); + FfxInt32x2 iDistortionPixelOffset = FfxInt32x2(fDistortionFieldUv.xy * RenderSize()); + + const FfxFloat32x2 fUvInInterpolationRectStart = FfxFloat32x2(InterpolationRectBase()) / DisplaySize(); + const FfxFloat32x2 fUvLetterBoxScale = FfxFloat32x2(InterpolationRectSize()) / DisplaySize(); + const FfxFloat32x2 fUvInInterpolationRect = fUvInInterpolationRectStart + fUvInScreenSpace * fUvLetterBoxScale; + + const FfxFloat32 fDepthSample = LoadDilatedDepth(iPxPos + iDistortionPixelOffset); + const FfxFloat32x2 fGameMotionVector = LoadDilatedMotionVector(iPxPos + iDistortionPixelOffset); + const FfxFloat32x2 fMotionVectorHalf = fGameMotionVector * 0.5f; + const FfxFloat32x2 fInterpolatedLocationUv = fUvInScreenSpace + fMotionVectorHalf; + + const FfxFloat32 fViewSpaceDepth = ConvertFromDeviceDepthToViewSpace(fDepthSample); + const FfxUInt32 uHighPriorityFactorPrimary = getPriorityFactorFromViewSpaceDepth(fViewSpaceDepth); + + // pixel position in current frame + Game Motion Vector -> pixel position in previous frame + FfxFloat32x3 prevBackbufferCol = SamplePreviousBackbuffer(fUvInInterpolationRect+ fGameMotionVector * fUvLetterBoxScale).xyz; //returns color of current frame's pixel in previous frame buffer + FfxFloat32x3 curBackbufferCol = SampleCurrentBackbuffer(fUvInInterpolationRect).xyz; // returns color of current frame's pixel in current frame buffer + FfxFloat32 prevLuma = 0.001f + RawRGBToLuminance(prevBackbufferCol); + FfxFloat32 currLuma = 0.001f + RawRGBToLuminance(curBackbufferCol); + + FfxUInt32 uLowPriorityFactor = FfxUInt32(ffxRound(ffxPow(MinDividedByMax(prevLuma, currLuma), 1.0f / 1.0f) * PRIORITY_LOW_MAX)) + * FfxUInt32(IsUvInside(fUvInInterpolationRect + fGameMotionVector * fUvLetterBoxScale)); + + // Update primary motion vectors + { + const FfxUInt32x2 packedVectorPrimary = PackVectorFieldEntries(true, uHighPriorityFactorPrimary, uLowPriorityFactor, fMotionVectorHalf); + + BilinearSamplingData bilinearInfo = GetBilinearSamplingData(fInterpolatedLocationUv, RenderSize()); + for (FfxInt32 iSampleIndex = 0; iSampleIndex < 4; iSampleIndex++) + { + const FfxInt32x2 iOffset = bilinearInfo.iOffsets[iSampleIndex]; + const FfxInt32x2 iSamplePos = bilinearInfo.iBasePos + iOffset; + + if (IsOnScreen(iSamplePos, RenderSize())) + { + UpdateGameMotionVectorField(iSamplePos, packedVectorPrimary); + } + } + } + + // Update secondary vectors + // Main purpose of secondary vectors is to improve quality of inpainted vectors + const FfxBoolean bWriteSecondaryVectors = length(fMotionVectorHalf * RenderSize()) > FFX_FRAMEINTERPOLATION_EPSILON; + if (bWriteSecondaryVectors) + { + FfxBoolean bWriteSecondary = true; + FfxUInt32 uNumPrimaryHits = 0; + const FfxFloat32 fSecondaryStepScale = length(1.0f / RenderSize()); + const FfxFloat32x2 fStepMv = normalize(fGameMotionVector); + const FfxFloat32 fBreakDist = ffxMin(length(fMotionVectorHalf), length(FfxFloat32x2(0.5f, 0.5f))); + + for (FfxFloat32 fMvScale = fSecondaryStepScale; fMvScale <= fBreakDist && bWriteSecondary; fMvScale += fSecondaryStepScale) + { + const FfxFloat32x2 fSecondaryLocationUv = fInterpolatedLocationUv - fStepMv * fMvScale; + BilinearSamplingData bilinearInfo = GetBilinearSamplingData(fSecondaryLocationUv, RenderSize()); + + // Reverse depth prio for secondary vectors + FfxUInt32 uHighPriorityFactorSecondary = ffxMax(1, PRIORITY_HIGH_MAX - uHighPriorityFactorPrimary); + + const FfxFloat32x2 fToCenter = normalize(FfxFloat32x2(0.5f, 0.5f) - fSecondaryLocationUv); + uLowPriorityFactor = FfxUInt32(ffxMax(0.0f, dot(fToCenter, fStepMv)) * PRIORITY_LOW_MAX); + const FfxUInt32x2 packedVectorSecondary = PackVectorFieldEntries(false, uHighPriorityFactorSecondary, uLowPriorityFactor, fMotionVectorHalf); + + // Only write secondary mvs to single bilinear location + for (FfxInt32 iSampleIndex = 0; iSampleIndex < 1; iSampleIndex++) + { + const FfxInt32x2 iOffset = bilinearInfo.iOffsets[iSampleIndex]; + const FfxInt32x2 iSamplePos = bilinearInfo.iBasePos + iOffset; + + bWriteSecondary = bWriteSecondary && IsOnScreen(iSamplePos, RenderSize()); + + if (bWriteSecondary) + { + const FfxUInt32 uExistingVectorFieldEntry = UpdateGameMotionVectorFieldEx(iSamplePos, packedVectorSecondary); + + uNumPrimaryHits += FfxUInt32(PackedVectorFieldEntryIsPrimary(uExistingVectorFieldEntry)); + bWriteSecondary = bWriteSecondary && (uNumPrimaryHits <= 3); + } + } + } + } +} + +#endif // FFX_FRAMEINTERPOLATION_GAME_MOTION_VECTOR_FIELD_H diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/frameinterpolation/ffx_frameinterpolation_inpainting.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/frameinterpolation/ffx_frameinterpolation_inpainting.h new file mode 100644 index 00000000..7ad3630e --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/frameinterpolation/ffx_frameinterpolation_inpainting.h @@ -0,0 +1,150 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#ifndef FFX_FRAMEINTERPOLATION_INPAINTING_H +#define FFX_FRAMEINTERPOLATION_INPAINTING_H + +FfxFloat32x4 ComputeInpaintingLevel(FfxFloat32x2 fUv, const FfxInt32 iMipLevel, const FfxInt32x2 iTexSize) +{ + BilinearSamplingData bilinearInfo = GetBilinearSamplingData(fUv, iTexSize); + + FfxFloat32x4 fColor = FfxFloat32x4(0.0, 0.0, 0.0, 0.0); + + for (FfxInt32 iSampleIndex = 0; iSampleIndex < 4; iSampleIndex++) { + + const FfxInt32x2 iOffset = bilinearInfo.iOffsets[iSampleIndex]; + const FfxInt32x2 iSamplePos = bilinearInfo.iBasePos + iOffset; + + if (IsOnScreen(iSamplePos, iTexSize)) { + + FfxFloat32x4 fSample = LoadInpaintingPyramid(iMipLevel, iSamplePos); + + const FfxFloat32 fWeight = bilinearInfo.fWeights[iSampleIndex] * FfxFloat32(fSample.w > 0.0f); + + fColor += FfxFloat32x4(fSample.rgb * fWeight, fWeight); + } + } + + return fColor; +} + +FfxFloat32x3 ComputeInpainting(FfxInt32x2 iPxPos) +{ + FfxFloat32x2 fUv = (iPxPos + 0.5f) / (DisplaySize()); + + FfxFloat32x4 fColor = FfxFloat32x4(0.0, 0.0, 0.0, 0.0); + FfxFloat32 fWeightSum = 0.0f; + FfxInt32x2 iTexSize = DisplaySize(); + + for (FfxInt32 iMipLevel = 0; iMipLevel < 10; iMipLevel++) { + + iTexSize /= 2; + + FfxFloat32x4 fMipColor = ComputeInpaintingLevel(fUv, iMipLevel, iTexSize); + + if (fMipColor.w > 0.0f) { + const FfxFloat32x3 fNormalizedMipColor = fMipColor.rgb / fMipColor.w; + const FfxFloat32 fMipWeight = ffxPow(1.0f - iMipLevel / 10.0f, 3.0f) * fMipColor.w; + + fColor += FfxFloat32x4(fNormalizedMipColor, 1.0f) * fMipWeight; + } + } + + return fColor.rgb / fColor.w; +} + +void drawDebugTearLines(FfxInt32x2 iPxPos, inout FfxFloat32x3 fColor, inout FfxBoolean bWriteColor) +{ + if (iPxPos.x < 16) + { + fColor.g = 1.f; + bWriteColor = true; + } + else if (iPxPos.x > DisplaySize().x - 16) + { + fColor += GetDebugBarColor(); + bWriteColor = true; + } + +} + +void drawDebugResetIndicators(FfxInt32x2 iPxPos, inout FfxFloat32x3 fColor, inout FfxBoolean bWriteColor) +{ + if (iPxPos.y < 32 && Reset()) + { + fColor.r = 1.f; + bWriteColor = true; + } + else if (iPxPos.y > 32 && iPxPos.y < 64 && HasSceneChanged()) + { + fColor.b = 1.f; + bWriteColor = true; + } +} + +void computeInpainting(FfxInt32x2 iPxPos) +{ + FfxBoolean bWriteColor = false; + FfxFloat32x4 fInterpolatedColor = RWLoadFrameinterpolationOutput(iPxPos); + + const FfxFloat32 fInPaintingWeight = fInterpolatedColor.w; + if (fInPaintingWeight > FFX_FRAMEINTERPOLATION_EPSILON) + { + fInterpolatedColor.rgb = ffxLerp(fInterpolatedColor.rgb, ComputeInpainting(iPxPos) * FfxFloat32(DisplaySize().x > 0), fInPaintingWeight); + bWriteColor = true; + } + + if (GetHUDLessAttachedFactor() == 1) + { + const FfxFloat32x3 fCurrentInterpolationSource = LoadCurrentBackbuffer(iPxPos).rgb; + const FfxFloat32x3 fPresentColor = LoadPresentBackbuffer(iPxPos).rgb; + + if (any(FFX_GREATER_THAN(abs(fCurrentInterpolationSource - fPresentColor), FfxFloat32x3(0.0, 0.0, 0.0)))) + { + const FfxFloat32 fStaticFactor = CalculateStaticContentFactor(RawRGBToLinear(fCurrentInterpolationSource), RawRGBToLinear(fPresentColor)); + + if (fStaticFactor > FFX_FRAMEINTERPOLATION_EPSILON) + { + fInterpolatedColor.rgb = ffxLerp(fInterpolatedColor.rgb, fPresentColor, fStaticFactor); + bWriteColor = true; + } + } + } + + if ((GetDispatchFlags() & FFX_FRAMEINTERPOLATION_DISPATCH_DRAW_DEBUG_TEAR_LINES) != 0) + { + drawDebugTearLines(iPxPos, fInterpolatedColor.rgb, bWriteColor); + } + + if ((GetDispatchFlags() & FFX_FRAMEINTERPOLATION_DISPATCH_DRAW_DEBUG_RESET_INDICATORS) != 0) + { + drawDebugResetIndicators(iPxPos, fInterpolatedColor.rgb, bWriteColor); + } + + if (bWriteColor) + { + StoreFrameinterpolationOutput(iPxPos, FfxFloat32x4(fInterpolatedColor.rgb, 1.0f)); + } + +} + +#endif // FFX_FRAMEINTERPOLATION_INPAINTING_H diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/frameinterpolation/ffx_frameinterpolation_optical_flow_vector_field.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/frameinterpolation/ffx_frameinterpolation_optical_flow_vector_field.h new file mode 100644 index 00000000..84321326 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/frameinterpolation/ffx_frameinterpolation_optical_flow_vector_field.h @@ -0,0 +1,123 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#ifndef FFX_FRAMEINTERPOLATION_OPTICAL_FLOW_VECTOR_FIELD_H +#define FFX_FRAMEINTERPOLATION_OPTICAL_FLOW_VECTOR_FIELD_H + +void computeOpticalFlowFieldMvs(FfxUInt32x2 dtID, FfxFloat32x2 fOpticalFlowVector) +{ + FfxFloat32x2 fUv = FfxFloat32x2(FfxFloat32x2(dtID)+0.5f) / GetOpticalFlowSize2(); + + const FfxFloat32 scaleFactor = 1.0f; + FfxFloat32x2 fMotionVectorHalf = fOpticalFlowVector * 0.5f; + + // pixel position in current frame + fOpticalFlowVector-> pixel position in previous frame + FfxFloat32x3 prevBackbufferCol = SamplePreviousBackbuffer(fUv + fOpticalFlowVector).xyz; // returns previous backbuffer color of current frame pixel position in previous frame + FfxFloat32x3 curBackbufferCol = SampleCurrentBackbuffer(fUv).xyz; // returns current backbuffer color at current frame pixel position + + FfxFloat32 prevLuma = 0.001f + RawRGBToLuminance(prevBackbufferCol); + FfxFloat32 currLuma = 0.001f + RawRGBToLuminance(curBackbufferCol); + + FfxFloat32 fVelocity = length(fOpticalFlowVector * InterpolationRectSize()); + FfxUInt32 uHighPriorityFactor = FfxUInt32(fVelocity > 1.0f) * FfxUInt32(ffxSaturate(fVelocity / length(InterpolationRectSize() * 0.05f)) * PRIORITY_HIGH_MAX); + + if(uHighPriorityFactor > 0) { + FfxUInt32 uLowPriorityFactor = FfxUInt32(ffxRound(ffxPow(MinDividedByMax(prevLuma, currLuma), 1.0f / 1.0f) * PRIORITY_LOW_MAX)) + * FfxUInt32(IsUvInside(fUv + fOpticalFlowVector)); + + // Project current depth into previous frame locations. + // Push to all pixels having some contribution if reprojection is using bilinear logic. + + const FfxUInt32x2 packedVectorPrimary = PackVectorFieldEntries(true, uHighPriorityFactor, uLowPriorityFactor, fMotionVectorHalf); + + BilinearSamplingData bilinearInfo = GetBilinearSamplingData(fUv + fMotionVectorHalf, GetOpticalFlowSize2()); + for (FfxInt32 iSampleIndex = 0; iSampleIndex < 4; iSampleIndex++) + { + const FfxInt32x2 iOffset = bilinearInfo.iOffsets[iSampleIndex]; + const FfxInt32x2 iSamplePos = bilinearInfo.iBasePos + iOffset; + + if (IsOnScreen(iSamplePos, GetOpticalFlowSize2())) + { + UpdateOpticalflowMotionVectorField(iSamplePos, packedVectorPrimary); + } + } + } +} + +void computeOpticalFlowVectorField(FfxInt32x2 iPxPos) +{ + FfxFloat32x2 fOpticalFlowVector = FfxFloat32x2(0.0, 0.0); + FfxFloat32x2 fOpticalFlowVector3x3Avg = FfxFloat32x2(0.0, 0.0); + FfxInt32 size = 1; + FfxFloat32 sw = 0.0f; + + for(FfxInt32 y = -size; y <= size; y++) { + for(FfxInt32 x = -size; x <= size; x++) { + + FfxInt32x2 samplePos = iPxPos + FfxInt32x2(x, y); + + FfxFloat32x2 vs = LoadOpticalFlow(samplePos); + FfxFloat32 fConfidenceFactor = ffxMax(FFX_FRAMEINTERPOLATION_EPSILON, LoadOpticalFlowConfidence(samplePos)); + + + FfxFloat32 len = length(vs * InterpolationRectSize()); + FfxFloat32 len_factor = ffxMax(0.0f, 512.0f - len) * FfxFloat32(len > 1.0f); + FfxFloat32 w = len_factor; + + fOpticalFlowVector3x3Avg += vs * w; + + sw += w; + } + } + + fOpticalFlowVector3x3Avg /= sw; + + + sw = 0.0f; + for(FfxInt32 y = -size; y <= size; y++) { + for(FfxInt32 x = -size; x <= size; x++) { + + FfxInt32x2 samplePos = iPxPos + FfxInt32x2(x, y); + + FfxFloat32x2 vs = LoadOpticalFlow(samplePos); + + FfxFloat32 fConfidenceFactor = ffxMax(FFX_FRAMEINTERPOLATION_EPSILON, LoadOpticalFlowConfidence(samplePos)); + FfxFloat32 len = length(vs * InterpolationRectSize()); + FfxFloat32 len_factor = ffxMax(0.0f, 512.0f - len) * FfxFloat32(len > 1.0f); + + + FfxFloat32 w = ffxMax(0.0f, ffxPow(dot(fOpticalFlowVector3x3Avg, vs), 1.25f)) * len_factor; + + fOpticalFlowVector += vs * w; + sw += w; + } + } + + if (sw > FFX_FRAMEINTERPOLATION_EPSILON) + { + fOpticalFlowVector /= sw; + } + + computeOpticalFlowFieldMvs(iPxPos, fOpticalFlowVector); +} + +#endif // FFX_FRAMEINTERPOLATION_OPTICAL_FLOW_VECTOR_FIELD_H diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/frameinterpolation/ffx_frameinterpolation_reconstruct_dilated_velocity_and_previous_depth.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/frameinterpolation/ffx_frameinterpolation_reconstruct_dilated_velocity_and_previous_depth.h new file mode 100644 index 00000000..e92a5790 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/frameinterpolation/ffx_frameinterpolation_reconstruct_dilated_velocity_and_previous_depth.h @@ -0,0 +1,123 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#ifndef FFX_FRAMEINTERPOLATION_RECONSTRUCT_DILATED_VELOCITY_AND_PREVIOUS_DEPTH_H +#define FFX_FRAMEINTERPOLATION_RECONSTRUCT_DILATED_VELOCITY_AND_PREVIOUS_DEPTH_H + +void ReconstructPrevDepth(FfxInt32x2 iPxPos, FfxFloat32 fDepth, FfxFloat32x2 fMotionVector, FfxInt32x2 iPxDepthSize) +{ + fMotionVector *= FfxFloat32(length(fMotionVector * DisplaySize()) > 0.1f); + + FfxFloat32x2 fUv = (iPxPos + FfxFloat32(0.5)) / iPxDepthSize; + FfxFloat32x2 fReprojectedUv = fUv + fMotionVector; + + BilinearSamplingData bilinearInfo = GetBilinearSamplingData(fReprojectedUv, RenderSize()); + + // Project current depth into previous frame locations. + // Push to all pixels having some contribution if reprojection is using bilinear logic. + for (FfxInt32 iSampleIndex = 0; iSampleIndex < 4; iSampleIndex++) { + + const FfxInt32x2 iOffset = bilinearInfo.iOffsets[iSampleIndex]; + FfxFloat32 fWeight = bilinearInfo.fWeights[iSampleIndex]; + + if (fWeight > fReconstructedDepthBilinearWeightThreshold) { + + FfxInt32x2 iStorePos = bilinearInfo.iBasePos + iOffset; + if (IsOnScreen(iStorePos, iPxDepthSize)) { + UpdateReconstructedDepthPreviousFrame(iStorePos, fDepth); + } + } + } +} + +void FindNearestDepth(FFX_PARAMETER_IN FfxInt32x2 iPxPos, FFX_PARAMETER_IN FfxInt32x2 iPxSize, FFX_PARAMETER_OUT FfxFloat32 fNearestDepth, FFX_PARAMETER_OUT FfxInt32x2 fNearestDepthCoord) +{ + const FfxInt32 iSampleCount = 9; + const FfxInt32x2 iSampleOffsets[iSampleCount] = { + FfxInt32x2(+0, +0), + FfxInt32x2(+1, +0), + FfxInt32x2(+0, +1), + FfxInt32x2(+0, -1), + FfxInt32x2(-1, +0), + FfxInt32x2(-1, +1), + FfxInt32x2(+1, +1), + FfxInt32x2(-1, -1), + FfxInt32x2(+1, -1), + }; + + // pull out the depth loads to allow SC to batch them + FfxFloat32 depth[9]; + FfxInt32 iSampleIndex = 0; + FFX_UNROLL + for (iSampleIndex = 0; iSampleIndex < iSampleCount; ++iSampleIndex) { + + FfxInt32x2 iPos = iPxPos + iSampleOffsets[iSampleIndex]; + depth[iSampleIndex] = LoadInputDepth(iPos); + } + + // find closest depth + fNearestDepthCoord = iPxPos; + fNearestDepth = depth[0]; + FFX_UNROLL + for (iSampleIndex = 1; iSampleIndex < iSampleCount; ++iSampleIndex) { + + FfxInt32x2 iPos = iPxPos + iSampleOffsets[iSampleIndex]; + if (IsOnScreen(iPos, iPxSize)) { + + FfxFloat32 fNdDepth = depth[iSampleIndex]; +#if FFX_FRAMEINTERPOLATION_OPTION_INVERTED_DEPTH + if (fNdDepth > fNearestDepth) { +#else + if (fNdDepth < fNearestDepth) { +#endif + fNearestDepthCoord = iPos; + fNearestDepth = fNdDepth; + } + } + } +} + +void ReconstructAndDilate(FfxInt32x2 iPxLrPos) +{ + FfxFloat32 fDilatedDepth; + FfxInt32x2 iNearestDepthCoord; + + FindNearestDepth(iPxLrPos, RenderSize(), fDilatedDepth, iNearestDepthCoord); + +#if FFX_FRAMEINTERPOLATION_OPTION_LOW_RES_MOTION_VECTORS + FfxInt32x2 iSamplePos = iPxLrPos; + FfxInt32x2 iMotionVectorPos = iNearestDepthCoord; +#else + FfxInt32x2 iSamplePos = ComputeHrPosFromLrPos(iPxLrPos); + FfxInt32x2 iMotionVectorPos = ComputeHrPosFromLrPos(iNearestDepthCoord); +#endif + + FfxFloat32x2 fDilatedMotionVector = LoadInputMotionVector(iMotionVectorPos); + + StoreDilatedDepth(iPxLrPos, fDilatedDepth); + StoreDilatedMotionVectors(iPxLrPos, fDilatedMotionVector); + + ReconstructPrevDepth(iPxLrPos, fDilatedDepth, fDilatedMotionVector, RenderSize()); +} + + +#endif //!defined( FFX_FRAMEINTERPOLATION_RECONSTRUCT_DILATED_VELOCITY_AND_PREVIOUS_DEPTH_H ) diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/frameinterpolation/ffx_frameinterpolation_reconstruct_previous_depth.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/frameinterpolation/ffx_frameinterpolation_reconstruct_previous_depth.h new file mode 100644 index 00000000..d85f6731 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/frameinterpolation/ffx_frameinterpolation_reconstruct_previous_depth.h @@ -0,0 +1,63 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#ifndef FFX_FRAMEINTERPOLATION_RECONSTRUCT_PREVIOUS_DEPTH_H +#define FFX_FRAMEINTERPOLATION_RECONSTRUCT_PREVIOUS_DEPTH_H + +void ReconstructPrevDepth(FfxInt32x2 iPxPos, FfxUInt32 depthTarget, FfxFloat32 fDepth, FfxFloat32x2 fMotionVector, FfxInt32x2 iPxDepthSize) +{ + const FfxFloat32x2 fUv = (iPxPos + FfxFloat32(0.5)) / iPxDepthSize; + + // Project current depth into previous frame locations. + // Push to all pixels having some contribution if reprojection is using bilinear logic. + BilinearSamplingData bilinearInfo = GetBilinearSamplingData(fUv + fMotionVector, RenderSize()); + for (FfxInt32 iSampleIndex = 0; iSampleIndex < 4; iSampleIndex++) + { + const FfxInt32x2 iOffset = bilinearInfo.iOffsets[iSampleIndex]; + const FfxInt32x2 iSamplePos = bilinearInfo.iBasePos + iOffset; + const FfxFloat32 fSampleWeight = bilinearInfo.fWeights[iSampleIndex]; + + if (fSampleWeight > fReconstructedDepthBilinearWeightThreshold) + { + if (IsOnScreen(iSamplePos, RenderSize())) + { + if (depthTarget != 0) { + UpdateReconstructedDepthInterpolatedFrame(iSamplePos, fDepth); + } + } + } + } +} + +void reconstructPreviousDepth(FfxInt32x2 iPxPos) +{ + const FfxFloat32x2 fUv = (iPxPos + FfxFloat32(0.5f)) / RenderSize(); + const FfxFloat32x2 fDistortionFieldUv = SampleDistortionField(fUv); + FfxInt32x2 iDistortionPixelOffset = FfxInt32x2(fDistortionFieldUv.xy * RenderSize()); + + FfxFloat32x2 fMotionVector = LoadDilatedMotionVector(iPxPos + iDistortionPixelOffset); + FfxFloat32 fDilatedDepth = LoadDilatedDepth(iPxPos + iDistortionPixelOffset); + + ReconstructPrevDepth(iPxPos, 1, fDilatedDepth, fMotionVector * 0.5f, RenderSize()); +} + +#endif // FFX_FRAMEINTERPOLATION_RECONSTRUCT_PREVIOUS_DEPTH_H diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/frameinterpolation/ffx_frameinterpolation_resources.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/frameinterpolation/ffx_frameinterpolation_resources.h new file mode 100644 index 00000000..5505f6d1 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/frameinterpolation/ffx_frameinterpolation_resources.h @@ -0,0 +1,95 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#ifndef FFX_FRAMEINTERPOLATION_RESOURCES_H +#define FFX_FRAMEINTERPOLATION_RESOURCES_H + +#if defined(FFX_CPU) || defined(FFX_GPU) +#define FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_NULL 0 +#define FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_OUTPUT 1 +//#define FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_BACKBUFFER 2 +#define FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_PREVIOUS_INTERPOLATION_SOURCE 3 +#define FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_CURRENT_INTERPOLATION_SOURCE 4 + +#define FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_DEPTH 5 +#define FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_MOTION_VECTORS 6 + +#define FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_RESERVED_2 7 +#define FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_RESERVED_3 8 +#define FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_RESERVED_4 9 + +#define FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_DILATED_DEPTH 10 +#define FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_DILATED_MOTION_VECTORS 11 +#define FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_RECONSTRUCTED_DEPTH_PREVIOUS_FRAME 12 +#define FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_RECONSTRUCTED_DEPTH_INTERPOLATED_FRAME 13 +#define FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_DISOCCLUSION_MASK 14 + +#define FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_GAME_MOTION_VECTOR_FIELD_X 15 +#define FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_GAME_MOTION_VECTOR_FIELD_Y 16 + +#define FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_OPTICAL_FLOW_MOTION_VECTOR_FIELD_X 17 +#define FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_OPTICAL_FLOW_MOTION_VECTOR_FIELD_Y 18 + +#define FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_OPTICAL_FLOW_VECTOR 19 +#define FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_RESERVED_5 20 +#define FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_OPTICAL_FLOW_CONFIDENCE 21 +#define FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_OPTICAL_FLOW_GLOBAL_MOTION 22 +#define FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_OPTICAL_FLOW_SCENE_CHANGE_DETECTION 23 + +#define FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_RESERVED_6 25 +#define FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_RESERVED_7 26 + +#define FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_DEBUG_OUTPUT_0 27 +#define FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_DEBUG_OUTPUT_1 28 +#define FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_DEBUG_OUTPUT 29 + +#define FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_INPAINTING_MASK 30 +#define FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_PRESENT_BACKBUFFER 31 + +#define FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_COUNTERS 32 +#define FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_INPAINTING_PYRAMID 33 // same as FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_INPAINTING_PYRAMID_MIPMAP_0 +#define FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_INPAINTING_PYRAMID_MIPMAP_0 33 +#define FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_INPAINTING_PYRAMID_MIPMAP_1 34 +#define FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_INPAINTING_PYRAMID_MIPMAP_2 35 +#define FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_INPAINTING_PYRAMID_MIPMAP_3 36 +#define FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_INPAINTING_PYRAMID_MIPMAP_4 37 +#define FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_INPAINTING_PYRAMID_MIPMAP_5 38 +#define FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_INPAINTING_PYRAMID_MIPMAP_6 39 +#define FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_INPAINTING_PYRAMID_MIPMAP_7 40 +#define FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_INPAINTING_PYRAMID_MIPMAP_8 41 +#define FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_INPAINTING_PYRAMID_MIPMAP_9 42 +#define FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_INPAINTING_PYRAMID_MIPMAP_10 43 +#define FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_INPAINTING_PYRAMID_MIPMAP_11 44 +#define FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_INPAINTING_PYRAMID_MIPMAP_12 45 + +#define FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_DEFAULT_DISTORTION_FIELD 46 +#define FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_DISTORTION_FIELD 47 + +#define FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_COUNT 48 + +#define FFX_FRAMEINTERPOLATION_CONSTANTBUFFER_IDENTIFIER 0 +#define FFX_FRAMEINTERPOLATION_INPAINTING_PYRAMID_CONSTANTBUFFER_IDENTIFIER 1 +#define FFX_FRAMEINTERPOLATION_CONSTANTBUFFER_COUNT 2 + +#endif // #if defined(FFX_CPU) || defined(FFX_GPU) + +#endif //!defined( FFX_FRAMEINTERPOLATION_RESOURCES_H ) diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/frameinterpolation/ffx_frameinterpolation_setup.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/frameinterpolation/ffx_frameinterpolation_setup.h new file mode 100644 index 00000000..60dd3237 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/frameinterpolation/ffx_frameinterpolation_setup.h @@ -0,0 +1,50 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#ifndef FFX_FRAMEINTERPOLATION_SETUP_H +#define FFX_FRAMEINTERPOLATION_SETUP_H + +void setupFrameinterpolationResources(FfxInt32x2 iPxPos) +{ + // Update reset counters + StoreCounter(COUNTER_SPD, 0); + if (all(FFX_EQUAL(iPxPos, FfxInt32x2(0, 0)))) + { + if(Reset() || HasSceneChanged()) { + StoreCounter(COUNTER_FRAME_INDEX_SINCE_LAST_RESET, 0); + } else { + FfxUInt32 counter = RWLoadCounter(COUNTER_FRAME_INDEX_SINCE_LAST_RESET); + StoreCounter(COUNTER_FRAME_INDEX_SINCE_LAST_RESET, counter + 1); + } + } + + // Reset resources + StoreGameMotionVectorFieldX(iPxPos, 0); + StoreGameMotionVectorFieldY(iPxPos, 0); + + StoreOpticalflowMotionVectorFieldX(iPxPos, 0); + StoreOpticalflowMotionVectorFieldY(iPxPos, 0); + + StoreDisocclusionMask(iPxPos, FfxFloat32x2(0.0, 0.0)); +} + +#endif // FFX_FRAMEINTERPOLATION_SETUP_H diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/opticalflow/ffx_opticalflow_callbacks_glsl.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/opticalflow/ffx_opticalflow_callbacks_glsl.h new file mode 100644 index 00000000..da315ec3 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/opticalflow/ffx_opticalflow_callbacks_glsl.h @@ -0,0 +1,578 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#ifndef FFX_OPTICALFLOW_CALLBACKS_HLSL_H +#define FFX_OPTICALFLOW_CALLBACKS_HLSL_H + +#include "opticalflow/ffx_opticalflow_resources.h" + +// no msad4 in glsl +#define FFX_OPTICALFLOW_USE_MSAD4_INSTRUCTION 0 +#define FFX_OPTICALFLOW_FIX_TOP_LEFT_BIAS 1 +#define FFX_OPTICALFLOW_USE_HEURISTICS 1 +#define FFX_OPTICALFLOW_BLOCK_SIZE 8 +#define FFX_LOCAL_SEARCH_FALLBACK 1 + +// perf optimization for h/w not supporting accelerated msad4() +//#if !defined(FFX_PREFER_WAVE64) && defined(FFX_OPTICALFLOW_USE_MSAD4_INSTRUCTION) +//#undef FFX_OPTICALFLOW_USE_MSAD4_INSTRUCTION +//#endif + +#if defined(FFX_GPU) +#include "ffx_core.h" +#endif // #if defined(FFX_GPU) + +#if defined(FFX_GPU) +#ifndef FFX_PREFER_WAVE64 +#define FFX_PREFER_WAVE64 +#endif // #if defined(FFX_GPU) + + +#include "opticalflow/ffx_opticalflow_common.h" + + +#if defined(FFX_OPTICALFLOW_BIND_CB_COMMON) + layout (set = 0, binding = FFX_OPTICALFLOW_BIND_CB_COMMON, std140) uniform cbOF_t + { + FfxInt32x2 iInputLumaResolution; + FfxUInt32 uOpticalFlowPyramidLevel; + FfxUInt32 uOpticalFlowPyramidLevelCount; + + FfxUInt32 iFrameIndex; + FfxUInt32 backbufferTransferFunction; + FfxFloat32x2 minMaxLuminance; + } cbOF; + +FfxInt32x2 DisplaySize() +{ + return cbOF.iInputLumaResolution; +} + +FfxUInt32 FrameIndex() +{ + return cbOF.iFrameIndex; +} + +FfxUInt32 BackbufferTransferFunction() +{ + return cbOF.backbufferTransferFunction; +} + +FfxFloat32x2 MinMaxLuminance() +{ + return cbOF.minMaxLuminance; +} + +FfxBoolean CrossedSceneChangeThreshold(FfxFloat32 sceneChangeValue) +{ + return sceneChangeValue > 0.45f; +} + +FfxUInt32 OpticalFlowPyramidLevel() +{ + return cbOF.uOpticalFlowPyramidLevel; +} + +FfxUInt32 OpticalFlowPyramidLevelCount() +{ + return cbOF.uOpticalFlowPyramidLevelCount; +} + +FfxInt32x2 OpticalFlowHistogramMaxVelocity() +{ + const FfxInt32 searchRadius = 8; + FfxInt32 scale = FfxInt32(1) << (OpticalFlowPyramidLevelCount() - 1 - OpticalFlowPyramidLevel()); + FfxInt32 maxVelocity = searchRadius * scale; + return FfxInt32x2(maxVelocity, maxVelocity); +} +#endif //FFX_OPTICALFLOW_BIND_CB_COMMON + +#if defined(FFX_OPTICALFLOW_BIND_CB_SPD) + layout (set = 0, binding = FFX_OPTICALFLOW_BIND_CB_SPD, std140) uniform cbOF_SPD_t + { + FfxUInt32 mips; + FfxUInt32 numWorkGroups; + FfxUInt32x2 workGroupOffset; + FfxUInt32 numWorkGroupOpticalFlowInputPyramid; + FfxUInt32 pad0_; + FfxUInt32 pad1_; + FfxUInt32 pad2_; + } cbOF_SPD; + +uint NumWorkGroups() +{ + return cbOF_SPD.numWorkGroupOpticalFlowInputPyramid; +} +#endif // defined(FFX_OPTICALFLOW_BIND_CB_SPD) + + #if defined FFX_OPTICALFLOW_BIND_SRV_INPUT_COLOR + layout (set = 0, binding = FFX_OPTICALFLOW_BIND_SRV_INPUT_COLOR) uniform texture2D r_input_color; + #endif + #if defined FFX_OPTICALFLOW_BIND_SRV_INPUT_MOTION_VECTORS + layout (set = 0, binding = FFX_OPTICALFLOW_BIND_SRV_INPUT_MOTION_VECTORS) uniform texture2D r_input_motion_vectors; + #endif + #if defined FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_INPUT + layout (set = 0, binding = FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_INPUT) uniform utexture2D r_optical_flow_input; + #endif + #if defined FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_PREVIOUS_INPUT + layout (set = 0, binding = FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_PREVIOUS_INPUT) uniform utexture2D r_optical_flow_previous_input; + #endif + #if defined FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW + layout (set = 0, binding = FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW) uniform itexture2D r_optical_flow; + #endif + #if defined FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_PREVIOUS + layout (set = 0, binding = FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_PREVIOUS) uniform itexture2D r_optical_flow_previous; + #endif + #if defined FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_ADDITIONAL_INFO + layout (set = 0, binding = FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_ADDITIONAL_INFO) uniform utexture2D r_optical_flow_additional_info; + #endif + #if defined FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_ADDITIONAL_INFO_PREVIOUS + layout (set = 0, binding = FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_ADDITIONAL_INFO_PREVIOUS) uniform utexture2D r_optical_flow_additional_info_previous; + #endif + #if defined FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_HISTOGRAM + layout (set = 0, binding = FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_HISTOGRAM) uniform utexture2D r_optical_flow_histogram; + #endif + #if defined FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_GLOBAL_MOTION_SEARCH + layout (set = 0, binding = FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_GLOBAL_MOTION_SEARCH) uniform utexture2D r_optical_flow_global_motion_search; + #endif + + // UAV declarations + #if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT + layout (set = 0, binding = FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT, r8ui) uniform uimage2D rw_optical_flow_input; + #endif + #if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_1 + layout (set = 0, binding = FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_1, r8ui) uniform uimage2D rw_optical_flow_input_level_1; + #endif + #if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_2 + layout (set = 0, binding = FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_2, r8ui) uniform uimage2D rw_optical_flow_input_level_2; + #endif + #if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_3 + layout (set = 0, binding = FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_3, r8ui) uniform uimage2D rw_optical_flow_input_level_3; + #endif + #if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_4 + layout (set = 0, binding = FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_4, r8ui) uniform uimage2D rw_optical_flow_input_level_4; + #endif + #if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_5 + layout (set = 0, binding = FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_5, r8ui) uniform uimage2D rw_optical_flow_input_level_5; + #endif + #if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_6 + layout (set = 0, binding = FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_6, r8ui) uniform uimage2D rw_optical_flow_input_level_6; + #endif + #if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW + layout (set = 0, binding = FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW, rg16i) uniform iimage2D rw_optical_flow; + #endif + #if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_NEXT_LEVEL + layout (set = 0, binding = FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_NEXT_LEVEL, rg16i) uniform iimage2D rw_optical_flow_next_level; + #endif + //#if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_ADDITIONAL_INFO + // RWTexture2D rw_optical_flow_additional_info : FFX_OPTICALFLOW_DECLARE_UAV(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_ADDITIONAL_INFO); + // layout (set = 0, binding = FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_ADDITIONAL_INFO, r32ui) uniform uimage2D rw_optical_flow_additional_info; + //#endif + //#if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_ADDITIONAL_INFO_NEXT_LEVEL + // RWTexture2D rw_optical_flow_additional_info_next_level : FFX_OPTICALFLOW_DECLARE_UAV(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_ADDITIONAL_INFO_NEXT_LEVEL); + // layout (set = 0, binding = FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_ADDITIONAL_INFO_NEXT_LEVEL, r32ui) uniform uimage2D rw_optical_flow_additional_info_next_level; + //#endif + //#if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_HISTOGRAM + // RWTexture2D rw_optical_flow_histogram : FFX_OPTICALFLOW_DECLARE_UAV(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_HISTOGRAM); + // layout (set = 0, binding = FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_HISTOGRAM, r32ui) uniform uimage2D rw_optical_flow_histogram; + //#endif + //#if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_GLOBAL_MOTION_SEARCH + // globallycoherent RWTexture2D rw_optical_flow_global_motion_search: FFX_OPTICALFLOW_DECLARE_UAV(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_GLOBAL_MOTION_SEARCH); + // layout (set = 0, binding = FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_GLOBAL_MOTION_SEARCH, r32ui) coherent uniform uimage2D rw_optical_flow_global_motion_search; + //#endif + #if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_SCD_HISTOGRAM + layout (set = 0, binding = FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_SCD_HISTOGRAM, r32ui) uniform uimage2D rw_optical_flow_scd_histogram; + #endif + #if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_SCD_PREVIOUS_HISTOGRAM + layout (set = 0, binding = FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_SCD_PREVIOUS_HISTOGRAM, r32f) uniform image2D rw_optical_flow_scd_previous_histogram; + #endif + #if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_SCD_TEMP + layout (set = 0, binding = FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_SCD_TEMP, r32ui) uniform uimage2D rw_optical_flow_scd_temp; + #endif + #if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_SCD_OUTPUT + layout (set = 0, binding = FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_SCD_OUTPUT, r32ui) uniform uimage2D rw_optical_flow_scd_output; + #endif + +#if defined(FFX_OPTICALFLOW_BIND_SRV_INPUT_COLOR) +FfxFloat32x4 LoadInputColor(FfxUInt32x2 iPxHistory) +{ + return texelFetch(r_input_color, FfxInt32x2(iPxHistory), 0); +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_SRV_INPUT_MOTION_VECTORS) +FfxFloat32x2 LoadGameMotionVector(FfxInt32x2 iPxPos) +{ + FfxFloat32x2 positionScale = FfxFloat32x2(RenderSize()) / DisplaySize(); + return texelFetch(r_input_motion_vectors, FfxInt32x2(iPxPos * positionScale), 0).xy * motionVectorScale / positionScale; +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT) +void StoreOpticalFlowInput(FfxInt32x2 iPxPos, FfxUInt32 fLuma) +{ + imageStore(rw_optical_flow_input, iPxPos, FfxUInt32x4(fLuma, 0, 0, 0)); +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_INPUT) +FfxUInt32 LoadOpticalFlowInput(FfxInt32x2 iPxPos) +{ +#if FFX_OPTICALFLOW_USE_MSAD4_INSTRUCTION == 1 + return max(1, texelFetch(r_optical_flow_input, iPxPos, 0).x); +#else + return texelFetch(r_optical_flow_input, iPxPos, 0).x; +#endif +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT) +FfxUInt32 LoadRwOpticalFlowInput(FfxInt32x2 iPxPos) +{ + return imageLoad(rw_optical_flow_input, iPxPos).x; +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_PREVIOUS_INPUT) +FfxUInt32 LoadOpticalFlowPreviousInput(FfxInt32x2 iPxPos) +{ +#if FFX_OPTICALFLOW_USE_MSAD4_INSTRUCTION == 1 + return max(1, texelFetch(r_optical_flow_previous_input, iPxPos, 0).x); +#else + return texelFetch(r_optical_flow_previous_input, iPxPos, 0).x; +#endif +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW) +FfxInt32x2 LoadOpticalFlow(FfxInt32x2 iPxPos) +{ + return texelFetch(r_optical_flow, iPxPos, 0).xy; +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW) +FfxInt32x2 LoadRwOpticalFlow(FfxInt32x2 iPxPos) +{ + return imageLoad(rw_optical_flow, iPxPos).xy; +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_PREVIOUS) +FfxInt32x2 LoadPreviousOpticalFlow(FfxInt32x2 iPxPos) +{ + return texelFetch(r_optical_flow_previous, iPxPos, 0).xy; +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW) +void StoreOpticalFlow(FfxInt32x2 iPxPos, FfxInt32x2 motionVector) +{ + imageStore(rw_optical_flow, iPxPos, FfxInt32x4(motionVector, 0, 0)); +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_NEXT_LEVEL) +void StoreOpticalFlowNextLevel(FfxInt32x2 iPxPos, FfxInt32x2 motionVector) +{ + imageStore(rw_optical_flow_next_level, iPxPos, FfxInt32x4(motionVector, 0, 0)); +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_ADDITIONAL_INFO) +FfxUInt32x2 LoadOpticalFlowAdditionalInfo(FfxInt32x2 iPxPos) +{ + return texelFetch(r_optical_flow_additional_info, iPxPos, 0).xy; +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_ADDITIONAL_INFO) +FfxUInt32x2 LoadRwOpticalFlowAdditionalInfo(FfxInt32x2 iPxPos) +{ + return imageLoad(rw_optical_flow_additional_info, iPxPos).xy; +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_ADDITIONAL_INFO_PREVIOUS) +FfxUInt32x2 LoadPreviousOpticalFlowAdditionalInfo(FfxInt32x2 iPxPos) +{ + return texelFetch(r_optical_flow_additional_info_previous, iPxPos, 0).xy; +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_ADDITIONAL_INFO) +void StoreOpticalFlowAdditionalInfo(FfxInt32x2 iPxPos, FfxUInt32x2 additionalInfo) +{ + imageStore(rw_optical_flow_additional_info, iPxPos, FfxUInt32x4(additionalInfo, 0, 0)); +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_ADDITIONAL_INFO_NEXT_LEVEL) +void StoreOpticalFlowNextLevelAdditionalInfo(FfxInt32x2 iPxPos, FfxUInt32x2 additionalInfo) +{ + imageStore(rw_optical_flow_additional_info_next_level, iPxPos, FfxUInt32x4(additionalInfo, 0, 0)); +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_HISTOGRAM) +FfxUInt32 LoadOpticalFlowHistogram(FfxInt32x2 iBucketId) +{ + return texelFetch(r_optical_flow_histogram, iBucketId, 0).x; +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_HISTOGRAM) +void AtomicIncrementOpticalFlowHistogram(FfxInt32x2 iBucketId) +{ + imageAtomicAdd(rw_optical_flow_histogram, iBucketId, 1); +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_GLOBAL_MOTION_SEARCH) +FfxInt32x2 LoadGlobalMotionVector() +{ + FfxInt32 vx = FfxInt32(texelFetch(r_optical_flow_global_motion_search, FfxInt32x2(0, 0), 0).x); + FfxInt32 vy = FfxInt32(texelFetch(r_optical_flow_global_motion_search, FfxInt32x2(1, 0), 0).x); + return FfxInt32x2(vx, vy); +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_GLOBAL_MOTION_SEARCH) +FfxInt32x2 LoadRwGlobalMotionVector() +{ + FfxInt32 vx = FfxInt32(imageLoad(rw_optical_flow_global_motion_search, FfxInt32x2(0, 0)).x); + FfxInt32 vy = FfxInt32(imageLoad(rw_optical_flow_global_motion_search, FfxInt32x2(1, 0)).x); + return FfxInt32x2(vx, vy); +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_GLOBAL_MOTION_SEARCH) +FfxUInt32 LoadGlobalMotionValue(FfxInt32 index) +{ + return imageLoad(rw_optical_flow_global_motion_search, FfxInt32x2(index, 0)).x; +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_GLOBAL_MOTION_SEARCH) +void StoreGlobalMotionValue(FfxInt32 index, FfxUInt32 value) +{ + imageStore(rw_optical_flow_global_motion_search, FfxInt32x2(index, 0), FfxUInt32x4(value, 0, 0, 0)); +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_GLOBAL_MOTION_SEARCH) +FfxUInt32 AtomicIncrementGlobalMotionValue(FfxInt32 index) +{ + return imageAtomicAdd(rw_optical_flow_global_motion_search, FfxInt32x2(index, 0), 1); +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_SCD_HISTOGRAM) +FfxUInt32 LoadRwSCDHistogram(FfxInt32 iIndex) +{ + return imageLoad(rw_optical_flow_scd_histogram, FfxInt32x2(iIndex, 0)).x; +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_SCD_HISTOGRAM) +void StoreSCDHistogram(FfxInt32 iIndex, FfxUInt32 value) +{ + imageStore(rw_optical_flow_scd_histogram, FfxInt32x2(iIndex, 0), FfxUInt32x4(value, 0, 0, 0)); +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_SCD_HISTOGRAM) +void AtomicIncrementSCDHistogram(FfxInt32 iIndex, FfxUInt32 valueToAdd) +{ + imageAtomicAdd(rw_optical_flow_scd_histogram, FfxInt32x2(iIndex, 0), valueToAdd); +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_SCD_PREVIOUS_HISTOGRAM) +FfxFloat32 LoadRwSCDPreviousHistogram(FfxInt32 iIndex) +{ + return imageLoad(rw_optical_flow_scd_previous_histogram, FfxInt32x2(iIndex, 0)).x; +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_SCD_PREVIOUS_HISTOGRAM) +void StoreSCDPreviousHistogram(FfxInt32 iIndex, FfxFloat32 value) +{ + imageStore(rw_optical_flow_scd_previous_histogram, FfxInt32x2(iIndex, 0), FfxFloat32x4(value, 0.0, 0.0, 0.0)); +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_SCD_TEMP) +FfxUInt32 LoadRwSCDTemp(FfxInt32 iIndex) +{ + return imageLoad(rw_optical_flow_scd_temp, FfxInt32x2(iIndex, 0)).x; +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_SCD_TEMP) +void AtomicIncrementSCDTemp(FfxInt32 iIndex, FfxUInt32 valueToAdd) +{ + imageAtomicAdd(rw_optical_flow_scd_temp, FfxInt32x2(iIndex, 0), valueToAdd); +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_SCD_TEMP) +void ResetSCDTemp() +{ + imageStore(rw_optical_flow_scd_temp, FfxInt32x2(0, 0), FfxUInt32x4(0, 0, 0, 0)); + imageStore(rw_optical_flow_scd_temp, FfxInt32x2(1, 0), FfxUInt32x4(0, 0, 0, 0)); + imageStore(rw_optical_flow_scd_temp, FfxInt32x2(2, 0), FfxUInt32x4(0, 0, 0, 0)); +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_SCD_OUTPUT) +FfxUInt32 LoadRwSCDOutput(FfxInt32 iIndex) +{ + return imageLoad(rw_optical_flow_scd_output, FfxInt32x2(iIndex, 0)).x; +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_SCD_OUTPUT) +void StoreSCDOutput(FfxInt32 iIndex, FfxUInt32 value) +{ + imageStore(rw_optical_flow_scd_output, FfxInt32x2(iIndex, 0), FfxUInt32x4(value, 0, 0, 0)); +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_SCD_OUTPUT) +FfxUInt32 AtomicIncrementSCDOutput(FfxInt32 iIndex, FfxUInt32 valueToAdd) +{ + return imageAtomicAdd(rw_optical_flow_scd_output, FfxInt32x2(iIndex, 0), valueToAdd); +} +#endif + +//#if defined(FFX_OPTICALFLOW_BIND_UAV_DEBUG_VISUALIZATION) +//void StoreDebugVisualization(FfxUInt32x2 iPxPos, FfxFloat32x3 fColor) +//{ +// imageStore(rw_debug_visualization, iPxPos, FfxFloat32x4(fColor, 1.f)); +//} +//#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_SCD_OUTPUT) +FfxFloat32 GetSceneChangeValue() +{ + if (FrameIndex() <= 5) + return 1.0; + else + return ffxAsFloat(LoadRwSCDOutput(SCD_OUTPUT_SCENE_CHANGE_SLOT)); +} + +FfxBoolean IsSceneChanged() +{ + if (FrameIndex() <= 5) + { + return true; + } + else + { + return (LoadRwSCDOutput(SCD_OUTPUT_HISTORY_BITS_SLOT) & 0xfu) != 0; + } +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_INPUT) +FfxUInt32 LoadFirstImagePackedLuma(FfxInt32x2 iPxPos) +{ + const FfxInt32 lumaTextureWidth = DisplaySize().x >> OpticalFlowPyramidLevel(); + const FfxInt32 lumaTextureHeight = DisplaySize().y >> OpticalFlowPyramidLevel(); + + FfxInt32x2 adjustedPos = FfxInt32x2( + ffxClamp(iPxPos.x, 0, lumaTextureWidth - 4), + ffxClamp(iPxPos.y, 0, lumaTextureHeight - 1) + ); + + FfxUInt32 luma0 = LoadOpticalFlowInput(adjustedPos + FfxInt32x2(0, 0)); + FfxUInt32 luma1 = LoadOpticalFlowInput(adjustedPos + FfxInt32x2(1, 0)); + FfxUInt32 luma2 = LoadOpticalFlowInput(adjustedPos + FfxInt32x2(2, 0)); + FfxUInt32 luma3 = LoadOpticalFlowInput(adjustedPos + FfxInt32x2(3, 0)); + + return GetPackedLuma(lumaTextureWidth, iPxPos.x, luma0, luma1, luma2, luma3); +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_PREVIOUS_INPUT) +FfxUInt32 LoadSecondImagePackedLuma(FfxInt32x2 iPxPos) +{ + const FfxInt32 lumaTextureWidth = DisplaySize().x >> OpticalFlowPyramidLevel(); + const FfxInt32 lumaTextureHeight = DisplaySize().y >> OpticalFlowPyramidLevel(); + + FfxInt32x2 adjustedPos = FfxInt32x2( + ffxClamp(iPxPos.x, 0, lumaTextureWidth - 4), + ffxClamp(iPxPos.y, 0, lumaTextureHeight - 1) + ); + + FfxUInt32 luma0 = LoadOpticalFlowPreviousInput(adjustedPos + FfxInt32x2(0, 0)); + FfxUInt32 luma1 = LoadOpticalFlowPreviousInput(adjustedPos + FfxInt32x2(1, 0)); + FfxUInt32 luma2 = LoadOpticalFlowPreviousInput(adjustedPos + FfxInt32x2(2, 0)); + FfxUInt32 luma3 = LoadOpticalFlowPreviousInput(adjustedPos + FfxInt32x2(3, 0)); + + return GetPackedLuma(lumaTextureWidth, iPxPos.x, luma0, luma1, luma2, luma3); +} +#endif + + +void SPD_SetMipmap(FfxInt32x2 iPxPos, FfxUInt32 index, FfxFloat32 value) +{ + FfxUInt32x4 value4 = FfxUInt32x4(value, 0.0, 0.0, 0.0); + switch (index) + { + case 0: +#if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_1 + imageStore(rw_optical_flow_input_level_1, iPxPos, value4); +#endif // #if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_1 + break; + case 1: +#if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_2 + imageStore(rw_optical_flow_input_level_2, iPxPos, value4); +#endif // #if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_2 + break; + case 2: +#if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_3 + imageStore(rw_optical_flow_input_level_3, iPxPos, value4); +#endif // #if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_3 + break; + case 3: +#if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_4 + imageStore(rw_optical_flow_input_level_4, iPxPos, value4); +#endif // #if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_4 + break; + case 4: +#if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_5 + imageStore(rw_optical_flow_input_level_5, iPxPos, value4); +#endif // #if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_5 + break; + case 5: +#if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_6 + imageStore(rw_optical_flow_input_level_6, iPxPos, value4); +#endif // #if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_6 + break; + } +} + +#endif // #if defined(FFX_GPU) + +#endif // FFX_OPTICALFLOW_CALLBACKS_HLSL_H diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/opticalflow/ffx_opticalflow_callbacks_hlsl.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/opticalflow/ffx_opticalflow_callbacks_hlsl.h new file mode 100644 index 00000000..bd1d4849 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/opticalflow/ffx_opticalflow_callbacks_hlsl.h @@ -0,0 +1,634 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#ifndef FFX_OPTICALFLOW_CALLBACKS_HLSL_H +#define FFX_OPTICALFLOW_CALLBACKS_HLSL_H + +#if defined(FFX_GPU) +#ifdef __hlsl_dx_compiler +#pragma dxc diagnostic push +#pragma dxc diagnostic ignored "-Wambig-lit-shift" +#endif //__hlsl_dx_compiler +#include "ffx_core.h" +#ifdef __hlsl_dx_compiler +#pragma dxc diagnostic pop +#endif //__hlsl_dx_compiler + +#define FFX_OPTICALFLOW_USE_MSAD4_INSTRUCTION 1 +#define FFX_OPTICALFLOW_FIX_TOP_LEFT_BIAS 1 +#define FFX_OPTICALFLOW_USE_HEURISTICS 1 +#define FFX_OPTICALFLOW_BLOCK_SIZE 8 +#define FFX_LOCAL_SEARCH_FALLBACK 1 + +// perf optimization for h/w not supporting accelerated msad4() +#if !defined(FFX_PREFER_WAVE64) && defined(FFX_OPTICALFLOW_USE_MSAD4_INSTRUCTION) +#undef FFX_OPTICALFLOW_USE_MSAD4_INSTRUCTION +#endif + +#include "opticalflow/ffx_opticalflow_common.h" + +#ifndef FFX_PREFER_WAVE64 +#define FFX_PREFER_WAVE64 +#endif + + +#pragma warning(disable: 3205) // conversion from larger type to smaller + +#define DECLARE_SRV_REGISTER(regIndex) t##regIndex +#define DECLARE_UAV_REGISTER(regIndex) u##regIndex +#define DECLARE_CB_REGISTER(regIndex) b##regIndex +#define FFX_OPTICALFLOW_DECLARE_SRV(regIndex) register(DECLARE_SRV_REGISTER(regIndex)) +#define FFX_OPTICALFLOW_DECLARE_UAV(regIndex) register(DECLARE_UAV_REGISTER(regIndex)) +#define FFX_OPTICALFLOW_DECLARE_CB(regIndex) register(DECLARE_CB_REGISTER(regIndex)) + +#if defined(FFX_OPTICALFLOW_BIND_CB_COMMON) + cbuffer cbOF : FFX_OPTICALFLOW_DECLARE_CB(FFX_OPTICALFLOW_BIND_CB_COMMON) + { + FfxInt32x2 iInputLumaResolution; + FfxUInt32 uOpticalFlowPyramidLevel; + FfxUInt32 uOpticalFlowPyramidLevelCount; + + FfxUInt32 iFrameIndex; + FfxUInt32 backbufferTransferFunction; + FfxFloat32x2 minMaxLuminance; + }; +#define FFX_OPTICALFLOW_CONSTANT_BUFFER_1_SIZE 8 + +#endif //FFX_OPTICALFLOW_BIND_CB_COMMON + +#if defined(FFX_OPTICALFLOW_BIND_CB_SPD) +cbuffer cbOF_SPD : FFX_OPTICALFLOW_DECLARE_CB(FFX_OPTICALFLOW_BIND_CB_SPD) { + + FfxUInt32 mips; + FfxUInt32 numWorkGroups; + FfxUInt32x2 workGroupOffset; + FfxUInt32 numWorkGroupOpticalFlowInputPyramid; + FfxUInt32 pad0_; + FfxUInt32 pad1_; + FfxUInt32 pad2_; +}; + +FfxUInt32 NumWorkGroups() +{ + return numWorkGroupOpticalFlowInputPyramid; +} +#endif //FFX_OPTICALFLOW_BIND_CB_SPD + +#define FFX_OPTICALFLOW_CONSTANT_BUFFER_2_SIZE 8 + +#define FFX_OPTICALFLOW_DESCRIPTOR_COUNT 32 + +#define FFX_OPTICALFLOW_ROOTSIG_STRINGIFY(p) FFX_OPTICALFLOW_ROOTSIG_STR(p) +#define FFX_OPTICALFLOW_ROOTSIG_STR(p) #p +#define FFX_OPTICALFLOW_ROOTSIG [RootSignature( "DescriptorTable(UAV(u0, numDescriptors = " FFX_OPTICALFLOW_ROOTSIG_STRINGIFY(FFX_OPTICALFLOW_DESCRIPTOR_COUNT) ")), " \ + "DescriptorTable(SRV(t0, numDescriptors = " FFX_OPTICALFLOW_ROOTSIG_STRINGIFY(FFX_OPTICALFLOW_DESCRIPTOR_COUNT) ")), " \ + "CBV(b0), " \ + "StaticSampler(s0, filter = FILTER_MIN_MAG_MIP_POINT, " \ + "addressU = TEXTURE_ADDRESS_CLAMP, " \ + "addressV = TEXTURE_ADDRESS_CLAMP, " \ + "addressW = TEXTURE_ADDRESS_CLAMP, " \ + "comparisonFunc = COMPARISON_NEVER, " \ + "borderColor = STATIC_BORDER_COLOR_TRANSPARENT_BLACK), " \ + "StaticSampler(s1, filter = FILTER_MIN_MAG_MIP_LINEAR, " \ + "addressU = TEXTURE_ADDRESS_CLAMP, " \ + "addressV = TEXTURE_ADDRESS_CLAMP, " \ + "addressW = TEXTURE_ADDRESS_CLAMP, " \ + "comparisonFunc = COMPARISON_NEVER, " \ + "borderColor = STATIC_BORDER_COLOR_TRANSPARENT_BLACK)" )] + +#define FFX_OPTICALFLOW_CB2_ROOTSIG [RootSignature( "DescriptorTable(UAV(u0, numDescriptors = " FFX_OPTICALFLOW_ROOTSIG_STRINGIFY(FFX_OPTICALFLOW_DESCRIPTOR_COUNT) ")), " \ + "DescriptorTable(SRV(t0, numDescriptors = " FFX_OPTICALFLOW_ROOTSIG_STRINGIFY(FFX_OPTICALFLOW_DESCRIPTOR_COUNT) ")), " \ + "CBV(b0), " \ + "StaticSampler(s0, filter = FILTER_MIN_MAG_MIP_POINT, " \ + "addressU = TEXTURE_ADDRESS_CLAMP, " \ + "addressV = TEXTURE_ADDRESS_CLAMP, " \ + "addressW = TEXTURE_ADDRESS_CLAMP, " \ + "comparisonFunc = COMPARISON_NEVER, " \ + "borderColor = STATIC_BORDER_COLOR_TRANSPARENT_BLACK), " \ + "StaticSampler(s1, filter = FILTER_MIN_MAG_MIP_LINEAR, " \ + "addressU = TEXTURE_ADDRESS_CLAMP, " \ + "addressV = TEXTURE_ADDRESS_CLAMP, " \ + "addressW = TEXTURE_ADDRESS_CLAMP, " \ + "comparisonFunc = COMPARISON_NEVER, " \ + "borderColor = STATIC_BORDER_COLOR_TRANSPARENT_BLACK)" )] +#if defined(FFX_OPTICALFLOW_EMBED_ROOTSIG) +#define FFX_OPTICALFLOW_EMBED_ROOTSIG_CONTENT FFX_OPTICALFLOW_ROOTSIG +#define FFX_OPTICALFLOW_EMBED_CB2_ROOTSIG_CONTENT FFX_OPTICALFLOW_CB2_ROOTSIG +#else +#define FFX_OPTICALFLOW_EMBED_ROOTSIG_CONTENT +#define FFX_OPTICALFLOW_EMBED_CB2_ROOTSIG_CONTENT +#endif // #if FFX_OPTICALFLOW_EMBED_ROOTSIG + +FfxInt32x2 DisplaySize() +{ + return iInputLumaResolution; +} + +FfxUInt32 FrameIndex() +{ + return iFrameIndex; +} + +FfxUInt32 BackbufferTransferFunction() +{ + return backbufferTransferFunction; +} + +FfxFloat32x2 MinMaxLuminance() +{ + return minMaxLuminance; +} + +FfxBoolean CrossedSceneChangeThreshold(FfxFloat32 sceneChangeValue) +{ + return sceneChangeValue > 0.45f; +} + +FfxUInt32 OpticalFlowPyramidLevel() +{ + return uOpticalFlowPyramidLevel; +} + +FfxUInt32 OpticalFlowPyramidLevelCount() +{ + return uOpticalFlowPyramidLevelCount; +} + +FfxInt32x2 OpticalFlowHistogramMaxVelocity() +{ + const FfxInt32 searchRadius = 8; + FfxInt32 scale = FfxInt32(1) << (OpticalFlowPyramidLevelCount() - 1 - OpticalFlowPyramidLevel()); + FfxInt32 maxVelocity = searchRadius * scale; + return FfxInt32x2(maxVelocity, maxVelocity); +} + + #if defined FFX_OPTICALFLOW_BIND_SRV_INPUT_COLOR + Texture2D r_input_color : FFX_OPTICALFLOW_DECLARE_SRV(FFX_OPTICALFLOW_BIND_SRV_INPUT_COLOR); + #endif + #if defined FFX_OPTICALFLOW_BIND_SRV_INPUT_MOTION_VECTORS + Texture2D r_input_motion_vectors : FFX_OPTICALFLOW_DECLARE_SRV(FFX_OPTICALFLOW_BIND_SRV_INPUT_MOTION_VECTORS); + #endif + #if defined FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_INPUT + Texture2D r_optical_flow_input : FFX_OPTICALFLOW_DECLARE_SRV(FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_INPUT); + #endif + #if defined FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_PREVIOUS_INPUT + Texture2D r_optical_flow_previous_input : FFX_OPTICALFLOW_DECLARE_SRV(FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_PREVIOUS_INPUT); + #endif + #if defined FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW + Texture2D r_optical_flow : FFX_OPTICALFLOW_DECLARE_SRV(FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW); + #endif + #if defined FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_PREVIOUS + Texture2D r_optical_flow_previous : FFX_OPTICALFLOW_DECLARE_SRV(FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_PREVIOUS); + #endif + #if defined FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_ADDITIONAL_INFO + Texture2D r_optical_flow_additional_info : FFX_OPTICALFLOW_DECLARE_SRV(FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_ADDITIONAL_INFO); + #endif + #if defined FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_ADDITIONAL_INFO_PREVIOUS + Texture2D r_optical_flow_additional_info_previous : FFX_OPTICALFLOW_DECLARE_SRV(FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_ADDITIONAL_INFO_PREVIOUS); + #endif + #if defined FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_HISTOGRAM + Texture2D r_optical_flow_histogram : FFX_OPTICALFLOW_DECLARE_SRV(FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_HISTOGRAM); + #endif + #if defined FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_GLOBAL_MOTION_SEARCH + Texture2D r_optical_flow_global_motion_search : FFX_OPTICALFLOW_DECLARE_SRV(FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_GLOBAL_MOTION_SEARCH); + #endif + + // UAV declarations + #if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT + RWTexture2D rw_optical_flow_input : FFX_OPTICALFLOW_DECLARE_UAV(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT); + #endif + #if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_1 + globallycoherent RWTexture2D rw_optical_flow_input_level_1 : FFX_OPTICALFLOW_DECLARE_UAV(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_1); + #endif + #if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_2 + globallycoherent RWTexture2D rw_optical_flow_input_level_2 : FFX_OPTICALFLOW_DECLARE_UAV(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_2); + #endif + #if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_3 + globallycoherent RWTexture2D rw_optical_flow_input_level_3 : FFX_OPTICALFLOW_DECLARE_UAV(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_3); + #endif + #if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_4 + globallycoherent RWTexture2D rw_optical_flow_input_level_4 : FFX_OPTICALFLOW_DECLARE_UAV(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_4); + #endif + #if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_5 + globallycoherent RWTexture2D rw_optical_flow_input_level_5 : FFX_OPTICALFLOW_DECLARE_UAV(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_5); + #endif + #if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_6 + globallycoherent RWTexture2D rw_optical_flow_input_level_6 : FFX_OPTICALFLOW_DECLARE_UAV(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_6); + #endif + #if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW + RWTexture2D rw_optical_flow : FFX_OPTICALFLOW_DECLARE_UAV(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW); + #endif + #if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_NEXT_LEVEL + RWTexture2D rw_optical_flow_next_level : FFX_OPTICALFLOW_DECLARE_UAV(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_NEXT_LEVEL); + #endif + #if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_ADDITIONAL_INFO + RWTexture2D rw_optical_flow_additional_info : FFX_OPTICALFLOW_DECLARE_UAV(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_ADDITIONAL_INFO); + #endif + #if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_ADDITIONAL_INFO_NEXT_LEVEL + RWTexture2D rw_optical_flow_additional_info_next_level : FFX_OPTICALFLOW_DECLARE_UAV(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_ADDITIONAL_INFO_NEXT_LEVEL); + #endif + #if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_HISTOGRAM + RWTexture2D rw_optical_flow_histogram : FFX_OPTICALFLOW_DECLARE_UAV(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_HISTOGRAM); + #endif + #if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_GLOBAL_MOTION_SEARCH + globallycoherent RWTexture2D rw_optical_flow_global_motion_search: FFX_OPTICALFLOW_DECLARE_UAV(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_GLOBAL_MOTION_SEARCH); + #endif + #if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_SCD_HISTOGRAM + RWTexture2D rw_optical_flow_scd_histogram : FFX_OPTICALFLOW_DECLARE_UAV(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_SCD_HISTOGRAM); + #endif + #if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_SCD_PREVIOUS_HISTOGRAM + RWTexture2D rw_optical_flow_scd_previous_histogram : FFX_OPTICALFLOW_DECLARE_UAV(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_SCD_PREVIOUS_HISTOGRAM); + #endif + #if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_SCD_TEMP + RWTexture2D rw_optical_flow_scd_temp : FFX_OPTICALFLOW_DECLARE_UAV(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_SCD_TEMP); + #endif + #if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_SCD_OUTPUT + RWTexture2D rw_optical_flow_scd_output : FFX_OPTICALFLOW_DECLARE_UAV(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_SCD_OUTPUT); + #endif + +#if defined(FFX_OPTICALFLOW_BIND_SRV_INPUT_COLOR) +FfxFloat32x4 LoadInputColor(FfxUInt32x2 iPxHistory) +{ + return r_input_color[iPxHistory]; +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_SRV_INPUT_MOTION_VECTORS) +FfxFloat32x2 LoadGameMotionVector(FfxInt32x2 iPxPos) +{ + FfxFloat32x2 positionScale = FfxFloat32x2(RenderSize()) / DisplaySize(); + return r_input_motion_vectors[iPxPos * positionScale] * motionVectorScale / positionScale; +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT) +void StoreOpticalFlowInput(FfxInt32x2 iPxPos, FfxUInt32 fLuma) +{ + rw_optical_flow_input[iPxPos] = fLuma; +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_INPUT) +FfxUInt32 LoadOpticalFlowInput(FfxInt32x2 iPxPos) +{ +#if FFX_OPTICALFLOW_USE_MSAD4_INSTRUCTION == 1 + return max(1, r_optical_flow_input[iPxPos]); +#else + return r_optical_flow_input[iPxPos]; +#endif +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT) +FfxUInt32 LoadRwOpticalFlowInput(FfxInt32x2 iPxPos) +{ + return rw_optical_flow_input[iPxPos]; +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_PREVIOUS_INPUT) +FfxUInt32 LoadOpticalFlowPreviousInput(FfxInt32x2 iPxPos) +{ +#if FFX_OPTICALFLOW_USE_MSAD4_INSTRUCTION == 1 + return max(1, r_optical_flow_previous_input[iPxPos]); +#else + return r_optical_flow_previous_input[iPxPos]; +#endif +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW) +FfxInt32x2 LoadOpticalFlow(FfxInt32x2 iPxPos) +{ + return r_optical_flow[iPxPos]; +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW) +FfxInt32x2 LoadRwOpticalFlow(FfxInt32x2 iPxPos) +{ + return rw_optical_flow[iPxPos]; +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_PREVIOUS) +FfxInt32x2 LoadPreviousOpticalFlow(FfxInt32x2 iPxPos) +{ + return r_optical_flow_previous[iPxPos]; +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW) +void StoreOpticalFlow(FfxInt32x2 iPxPos, FfxInt32x2 motionVector) +{ + rw_optical_flow[iPxPos] = motionVector; +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_NEXT_LEVEL) +void StoreOpticalFlowNextLevel(FfxInt32x2 iPxPos, FfxInt32x2 motionVector) +{ + rw_optical_flow_next_level[iPxPos] = motionVector; +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_ADDITIONAL_INFO) +FfxUInt32x2 LoadOpticalFlowAdditionalInfo(FfxInt32x2 iPxPos) +{ + return r_optical_flow_additional_info[iPxPos]; +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_ADDITIONAL_INFO) +FfxUInt32x2 LoadRwOpticalFlowAdditionalInfo(FfxInt32x2 iPxPos) +{ + return rw_optical_flow_additional_info[iPxPos]; +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_ADDITIONAL_INFO_PREVIOUS) +FfxUInt32x2 LoadPreviousOpticalFlowAdditionalInfo(FfxInt32x2 iPxPos) +{ + return r_optical_flow_additional_info_previous[iPxPos]; +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_ADDITIONAL_INFO) +void StoreOpticalFlowAdditionalInfo(FfxInt32x2 iPxPos, FfxUInt32x2 additionalInfo) +{ + rw_optical_flow_additional_info[iPxPos] = additionalInfo; +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_ADDITIONAL_INFO_NEXT_LEVEL) +void StoreOpticalFlowNextLevelAdditionalInfo(FfxInt32x2 iPxPos, FfxUInt32x2 additionalInfo) +{ + rw_optical_flow_additional_info_next_level[iPxPos] = additionalInfo; +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_HISTOGRAM) +FfxUInt32 LoadOpticalFlowHistogram(FfxInt32x2 iBucketId) +{ + return r_optical_flow_histogram[iBucketId]; +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_HISTOGRAM) +void AtomicIncrementOpticalFlowHistogram(FfxInt32x2 iBucketId) +{ + InterlockedAdd(rw_optical_flow_histogram[iBucketId], 1); +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_GLOBAL_MOTION_SEARCH) +FfxInt32x2 LoadGlobalMotionVector() +{ + FfxInt32 vx = FfxInt32(r_optical_flow_global_motion_search[FfxInt32x2(0, 0)]); + FfxInt32 vy = FfxInt32(r_optical_flow_global_motion_search[FfxInt32x2(1, 0)]); + return FfxInt32x2(vx, vy); +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_GLOBAL_MOTION_SEARCH) +FfxInt32x2 LoadRwGlobalMotionVector() +{ + FfxInt32 vx = FfxInt32(rw_optical_flow_global_motion_search[FfxInt32x2(0, 0)]); + FfxInt32 vy = FfxInt32(rw_optical_flow_global_motion_search[FfxInt32x2(1, 0)]); + return FfxInt32x2(vx, vy); +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_GLOBAL_MOTION_SEARCH) +FfxUInt32 LoadGlobalMotionValue(FfxInt32 index) +{ + return rw_optical_flow_global_motion_search[FfxInt32x2(index, 0)]; +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_GLOBAL_MOTION_SEARCH) +void StoreGlobalMotionValue(FfxInt32 index, FfxUInt32 value) +{ + rw_optical_flow_global_motion_search[FfxInt32x2(index, 0)] = value; +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_GLOBAL_MOTION_SEARCH) +FfxUInt32 AtomicIncrementGlobalMotionValue(FfxInt32 index) +{ + FfxUInt32 initialValue; + InterlockedAdd(rw_optical_flow_global_motion_search[FfxInt32x2(index, 0)], 1, initialValue); + return initialValue; +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_SCD_HISTOGRAM) +FfxUInt32 LoadRwSCDHistogram(FfxInt32 iIndex) +{ + return rw_optical_flow_scd_histogram[FfxInt32x2(iIndex, 0)]; +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_SCD_HISTOGRAM) +void StoreSCDHistogram(FfxInt32 iIndex, FfxUInt32 value) +{ + rw_optical_flow_scd_histogram[FfxInt32x2(iIndex, 0)] = value; +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_SCD_HISTOGRAM) +void AtomicIncrementSCDHistogram(FfxInt32 iIndex, FfxUInt32 valueToAdd) +{ + InterlockedAdd(rw_optical_flow_scd_histogram[FfxInt32x2(iIndex, 0)], valueToAdd); +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_SCD_PREVIOUS_HISTOGRAM) +FfxFloat32 LoadRwSCDPreviousHistogram(FfxInt32 iIndex) +{ + return rw_optical_flow_scd_previous_histogram[FfxInt32x2(iIndex, 0)]; +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_SCD_PREVIOUS_HISTOGRAM) +void StoreSCDPreviousHistogram(FfxInt32 iIndex, FfxFloat32 value) +{ + rw_optical_flow_scd_previous_histogram[FfxInt32x2(iIndex, 0)] = value; +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_SCD_TEMP) +FfxUInt32 LoadRwSCDTemp(FfxInt32 iIndex) +{ + return rw_optical_flow_scd_temp[FfxInt32x2(iIndex, 0)]; +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_SCD_TEMP) +void AtomicIncrementSCDTemp(FfxInt32 iIndex, FfxUInt32 valueToAdd) +{ + InterlockedAdd(rw_optical_flow_scd_temp[FfxInt32x2(iIndex, 0)], valueToAdd); +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_SCD_TEMP) +void ResetSCDTemp() +{ + rw_optical_flow_scd_temp[FfxInt32x2(0, 0)] = 0; + rw_optical_flow_scd_temp[FfxInt32x2(1, 0)] = 0; + rw_optical_flow_scd_temp[FfxInt32x2(2, 0)] = 0; +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_SCD_OUTPUT) +FfxUInt32 LoadRwSCDOutput(FfxInt32 iIndex) +{ + return rw_optical_flow_scd_output[FfxInt32x2(iIndex, 0)]; +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_SCD_OUTPUT) +void StoreSCDOutput(FfxInt32 iIndex, FfxUInt32 value) +{ + rw_optical_flow_scd_output[FfxInt32x2(iIndex, 0)] = value; +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_SCD_OUTPUT) +FfxUInt32 AtomicIncrementSCDOutput(FfxInt32 iIndex, FfxUInt32 valueToAdd) +{ + FfxUInt32 initialValue; + InterlockedAdd(rw_optical_flow_scd_output[FfxInt32x2(iIndex, 0)], valueToAdd, initialValue); + return initialValue; +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_DEBUG_VISUALIZATION) +void StoreDebugVisualization(FfxUInt32x2 iPxPos, FfxFloat32x3 fColor) +{ + rw_debug_visualization[iPxPos] = FfxFloat32x4(fColor, 1.f); +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_SCD_OUTPUT) +FfxFloat32 GetSceneChangeValue() +{ + if (FrameIndex() <= 5) + return 1.0; + else + return ffxAsFloat(LoadRwSCDOutput(SCD_OUTPUT_SCENE_CHANGE_SLOT)); +} + +FfxBoolean IsSceneChanged() +{ + if (FrameIndex() <= 5) + { + return 1.0; + } + else + { + return (LoadRwSCDOutput(SCD_OUTPUT_HISTORY_BITS_SLOT) & 0xfu) != 0; + } +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_INPUT) +FfxUInt32 LoadFirstImagePackedLuma(FfxInt32x2 iPxPos) +{ + const FfxInt32 lumaTextureWidth = DisplaySize().x >> OpticalFlowPyramidLevel(); + const FfxInt32 lumaTextureHeight = DisplaySize().y >> OpticalFlowPyramidLevel(); + + FfxInt32x2 adjustedPos = FfxInt32x2( + ffxClamp(iPxPos.x, 0, lumaTextureWidth - 4), + ffxClamp(iPxPos.y, 0, lumaTextureHeight - 1) + ); + + FfxUInt32 luma0 = LoadOpticalFlowInput(adjustedPos + FfxInt32x2(0, 0)); + FfxUInt32 luma1 = LoadOpticalFlowInput(adjustedPos + FfxInt32x2(1, 0)); + FfxUInt32 luma2 = LoadOpticalFlowInput(adjustedPos + FfxInt32x2(2, 0)); + FfxUInt32 luma3 = LoadOpticalFlowInput(adjustedPos + FfxInt32x2(3, 0)); + + return GetPackedLuma(lumaTextureWidth, iPxPos.x, luma0, luma1, luma2, luma3); +} +#endif + +#if defined(FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_PREVIOUS_INPUT) +FfxUInt32 LoadSecondImagePackedLuma(FfxInt32x2 iPxPos) +{ + const FfxInt32 lumaTextureWidth = DisplaySize().x >> OpticalFlowPyramidLevel(); + const FfxInt32 lumaTextureHeight = DisplaySize().y >> OpticalFlowPyramidLevel(); + + FfxInt32x2 adjustedPos = FfxInt32x2( + ffxClamp(iPxPos.x, 0, lumaTextureWidth - 4), + ffxClamp(iPxPos.y, 0, lumaTextureHeight - 1) + ); + + FfxUInt32 luma0 = LoadOpticalFlowPreviousInput(adjustedPos + FfxInt32x2(0, 0)); + FfxUInt32 luma1 = LoadOpticalFlowPreviousInput(adjustedPos + FfxInt32x2(1, 0)); + FfxUInt32 luma2 = LoadOpticalFlowPreviousInput(adjustedPos + FfxInt32x2(2, 0)); + FfxUInt32 luma3 = LoadOpticalFlowPreviousInput(adjustedPos + FfxInt32x2(3, 0)); + + return GetPackedLuma(lumaTextureWidth, iPxPos.x, luma0, luma1, luma2, luma3); +} +#endif + + +void SPD_SetMipmap(int2 iPxPos, int index, float value) +{ + switch (index) + { + case 0: +#if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_1 + rw_optical_flow_input_level_1[iPxPos] = value; +#endif // #if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_1 + break; + case 1: +#if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_2 + rw_optical_flow_input_level_2[iPxPos] = value; +#endif // #if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_2 + break; + case 2: +#if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_3 + rw_optical_flow_input_level_3[iPxPos] = value; +#endif // #if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_3 + break; + case 3: +#if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_4 + rw_optical_flow_input_level_4[iPxPos] = value; +#endif // #if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_4 + break; + case 4: +#if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_5 + rw_optical_flow_input_level_5[iPxPos] = value; +#endif // #if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_5 + break; + case 5: +#if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_6 + rw_optical_flow_input_level_6[iPxPos] = value; +#endif // #if defined FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_6 + break; + } +} + +#endif // #if defined(FFX_GPU) + +#endif // FFX_OPTICALFLOW_CALLBACKS_HLSL_H diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/opticalflow/ffx_opticalflow_common.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/opticalflow/ffx_opticalflow_common.h new file mode 100644 index 00000000..907e7ac7 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/opticalflow/ffx_opticalflow_common.h @@ -0,0 +1,99 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#if !defined(FFX_OPTICALFLOW_COMMON_H) +#define FFX_OPTICALFLOW_COMMON_H + +#if defined(FFX_GPU) + +#define SCD_OUTPUT_SCENE_CHANGE_SLOT 0 +#define SCD_OUTPUT_HISTORY_BITS_SLOT 1 +#define SCD_OUTPUT_COMPLETED_WORKGROUPS_SLOT 2 + + +#define ffxClamp(x, a, b) (ffxMax(a, ffxMin(b, x))) + + +FfxUInt32 GetPackedLuma(FfxInt32 width, FfxInt32 x, FfxUInt32 luma0, FfxUInt32 luma1, FfxUInt32 luma2, FfxUInt32 luma3) +{ + FfxUInt32 packedLuma = luma0 | (luma1 << 8) | (luma2 << 16) | (luma3 << 24); + + if (x < 0) + { + FfxUInt32 outOfScreenFiller = packedLuma & 0xffu; + if (x <= -1) + packedLuma = (packedLuma << 8) | outOfScreenFiller; + if (x <= -2) + packedLuma = (packedLuma << 8) | outOfScreenFiller; + if (x <= -3) + packedLuma = (packedLuma << 8) | outOfScreenFiller; + } + else if (x > width - 4) + { + FfxUInt32 outOfScreenFiller = packedLuma & 0xff000000u; + if (x >= width - 3) + packedLuma = (packedLuma >> 8) | outOfScreenFiller; + if (x >= width - 2) + packedLuma = (packedLuma >> 8) | outOfScreenFiller; + if (x >= width - 1) + packedLuma = (packedLuma >> 8) | outOfScreenFiller; + } + return packedLuma; +} + +FfxUInt32 Sad(FfxUInt32 a, FfxUInt32 b) +{ +#if FFX_OPTICALFLOW_USE_MSAD4_INSTRUCTION == 1 + return msad4(a, FfxUInt32x2(b, 0), FfxUInt32x4(0, 0, 0, 0)).x; +#else + return abs(FfxInt32((a >> 0) & 0xffu) - FfxInt32((b >> 0) & 0xffu)) + + abs(FfxInt32((a >> 8) & 0xffu) - FfxInt32((b >> 8) & 0xffu)) + + abs(FfxInt32((a >> 16) & 0xffu) - FfxInt32((b >> 16) & 0xffu)) + + abs(FfxInt32((a >> 24) & 0xffu) - FfxInt32((b >> 24) & 0xffu)); +#endif +} + +FfxUInt32x4 QSad(FfxUInt32 a0, FfxUInt32 a1, FfxUInt32 b) +{ +#if FFX_OPTICALFLOW_USE_MSAD4_INSTRUCTION == 1 + return msad4(b, FfxUInt32x2(a0, a1), FfxUInt32x4(0, 0, 0, 0)); +#else + FfxUInt32x4 sad; + sad.x = Sad(a0, b); + + a0 = (a0 >> 8) | ((a1 & 0xffu) << 24); + a1 >>= 8; + sad.y = Sad(a0, b); + + a0 = (a0 >> 8) | ((a1 & 0xffu) << 24); + a1 >>= 8; + sad.z = Sad(a0, b); + + a0 = (a0 >> 8) | ((a1 & 0xffu) << 24); + sad.w = Sad(a0, b); + return sad; +#endif +} + +#endif // #if defined(FFX_GPU) + +#endif //!defined(FFX_OPTICALFLOW_COMMON_H) diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/opticalflow/ffx_opticalflow_compute_luminance_pyramid.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/opticalflow/ffx_opticalflow_compute_luminance_pyramid.h new file mode 100644 index 00000000..b83710c9 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/opticalflow/ffx_opticalflow_compute_luminance_pyramid.h @@ -0,0 +1,107 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#ifndef FFX_OPTICALFLOW_COMPUTE_LUMINANCE_PYRAMID_H +#define FFX_OPTICALFLOW_COMPUTE_LUMINANCE_PYRAMID_H + +FFX_GROUPSHARED FfxFloat32 spdIntermediateR[16][16]; +FFX_GROUPSHARED FfxFloat32 spdIntermediateG[16][16]; +FFX_GROUPSHARED FfxFloat32 spdIntermediateB[16][16]; +FFX_GROUPSHARED FfxFloat32 spdIntermediateA[16][16]; + +void SPD_IncreaseAtomicCounter(inout FfxUInt32 spdCounter) +{ +} + +void SPD_ResetAtomicCounter() +{ +} + +FfxFloat32x4 SpdLoadSourceImage(FfxFloat32x2 tex, FfxUInt32 slice) +{ + FfxFloat32 luma = LoadRwOpticalFlowInput(FfxInt32x2(tex)); + return FfxFloat32x4(luma, 0, 0, 0); +} + +FfxFloat32x4 SpdLoad(FfxInt32x2 tex, FfxUInt32 slice) +{ + return FfxFloat32x4(0, 0, 0, 0); +} + +void SpdStore(FfxInt32x2 pix, FfxFloat32x4 outValue, FfxUInt32 index, FfxUInt32 slice) +{ + SPD_SetMipmap(pix, index, outValue.r); +} + +void SpdIncreaseAtomicCounter(FfxUInt32 slice) +{ +} + +FfxUInt32 SpdGetAtomicCounter() +{ + return 0; +} + +void SpdResetAtomicCounter(FfxUInt32 slice) +{ + SPD_ResetAtomicCounter(); +} + +FfxFloat32x4 SpdLoadIntermediate(FfxUInt32 x, FfxUInt32 y) +{ + return FfxFloat32x4( + spdIntermediateR[x][y], + spdIntermediateG[x][y], + spdIntermediateB[x][y], + spdIntermediateA[x][y]); +} +void SpdStoreIntermediate(FfxUInt32 x, FfxUInt32 y, FfxFloat32x4 value) +{ + spdIntermediateR[x][y] = value.x; + spdIntermediateG[x][y] = value.y; + spdIntermediateB[x][y] = value.z; + spdIntermediateA[x][y] = value.w; +} +FfxFloat32x4 SpdReduce4(FfxFloat32x4 v0, FfxFloat32x4 v1, FfxFloat32x4 v2, FfxFloat32x4 v3) +{ + return (v0 + v1 + v2 + v3) * 0.25; +} + +#ifdef FFX_HALF +#undef FFX_HALF +#endif + +// https://github.com/GPUOpen-Effects/FidelityFX-SPD/blob/master/docs/FidelityFX_SPD.pdf +#include "spd/ffx_spd.h" + +void ComputeOpticalFlowInputPyramid(FfxInt32x2 iGroupId, FfxInt32 iLocalIndex) +{ + SpdDownsample( + FfxUInt32x2(iGroupId.xy), + FfxUInt32(iLocalIndex), + 6, // mip levels to generate + FfxUInt32(NumWorkGroups()), + 1 // single slice + ); +} + +#endif // FFX_OPTICALFLOW_COMPUTE_LUMINANCE_PYRAMID_H diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/opticalflow/ffx_opticalflow_compute_optical_flow_v5.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/opticalflow/ffx_opticalflow_compute_optical_flow_v5.h new file mode 100644 index 00000000..9c1b522b --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/opticalflow/ffx_opticalflow_compute_optical_flow_v5.h @@ -0,0 +1,279 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#ifndef FFX_OPTICALFLOW_COMPUTE_OPTICAL_FLOW_V5_H +#define FFX_OPTICALFLOW_COMPUTE_OPTICAL_FLOW_V5_H + +#define CompareSize (4 * 2) +#define BlockSizeY 8 +#define BlockSizeX 8 +#define ThreadCount (4 * 16) +#define SearchRadiusX (8) +#define SearchRadiusY (8) +#define BlockCount 2 + +#define SearchBufferSizeX ((CompareSize + SearchRadiusX*2)/4) +#define SearchBufferSizeY (CompareSize + SearchRadiusY*2) + +FFX_GROUPSHARED FfxUInt32 pixels[CompareSize][CompareSize / 4]; +FFX_GROUPSHARED FfxUInt32 searchBuffer[1][SearchBufferSizeY * SearchBufferSizeX]; +#define bankBreaker 1 +FFX_GROUPSHARED FfxUInt32 sadMapBuffer[4][SearchRadiusY * 2][(SearchRadiusX * 2) / 4 + bankBreaker]; + +#define MaxWaves 2 +FFX_GROUPSHARED FfxUInt32 sWaveSad[MaxWaves]; +FFX_GROUPSHARED FfxUInt32 sWaveMin[MaxWaves]; + +FfxUInt32 BlockSad64(FfxUInt32 blockSadSum, FfxInt32 iLocalIndex, FfxInt32 iLaneToBlockId, FfxInt32 block) +{ + if (iLaneToBlockId != block) + { + blockSadSum = 0u; + } + blockSadSum = ffxWaveSum(blockSadSum); + + if (ffxWaveLaneCount() == 32) + { + FfxInt32 waveId = iLocalIndex >> 5u; + if (ffxWaveIsFirstLane()) + { + sWaveSad[waveId] = blockSadSum; + } + FFX_GROUP_MEMORY_BARRIER; + blockSadSum += sWaveSad[waveId ^ 1]; + } + + return blockSadSum; +} + +FfxUInt32 SadMapMinReduction256(FfxInt32x2 iSearchId, FfxInt32 iLocalIndex) +{ + FfxUInt32 min01 = ffxMin(sadMapBuffer[0][iSearchId.y][iSearchId.x], sadMapBuffer[1][iSearchId.y][iSearchId.x]); + FfxUInt32 min23 = ffxMin(sadMapBuffer[2][iSearchId.y][iSearchId.x], sadMapBuffer[3][iSearchId.y][iSearchId.x]); + FfxUInt32 min0123 = ffxMin(min01, min23); + min0123 = ffxWaveMin(min0123); + + if (ffxWaveLaneCount() == 32) + { + FfxInt32 waveId = iLocalIndex >> 5u; + + if (ffxWaveIsFirstLane()) + { + sWaveMin[waveId] = min0123; + } + FFX_GROUP_MEMORY_BARRIER; + min0123 = ffxMin(min0123, sWaveMin[waveId ^ 1]); + } + + return min0123; +} + +void LoadSearchBuffer(FfxInt32 iLocalIndex, FfxInt32x2 iPxPosShifted) +{ + FfxInt32 baseX = (iPxPosShifted.x - SearchRadiusX); + FfxInt32 baseY = (iPxPosShifted.y - SearchRadiusY); + + for (FfxInt32 id = iLocalIndex; id < SearchBufferSizeX * SearchBufferSizeY; id += ThreadCount) + { + FfxInt32 idx = id % SearchBufferSizeX; + FfxInt32 idy = id / SearchBufferSizeX; + FfxInt32 x = baseX + idx * 4; + FfxInt32 y = baseY + idy; + searchBuffer[0][id] = LoadSecondImagePackedLuma(FfxInt32x2(x, y)); + } + FFX_GROUP_MEMORY_BARRIER; +} + +FfxUInt32x4 CalculateQSads2(FfxInt32x2 iSearchId) +{ + FfxUInt32x4 sad = ffxBroadcast4(0u); + +#if FFX_OPTICALFLOW_USE_MSAD4_INSTRUCTION == 1 + + FfxInt32 idx = iSearchId.y * 6 + iSearchId.x; + + sad = msad4(pixels[0][0], FfxUInt32x2(searchBuffer[0][idx], searchBuffer[0][idx + 1]), sad); + sad = msad4(pixels[0][1], FfxUInt32x2(searchBuffer[0][idx + 1], searchBuffer[0][idx + 2]), sad); + idx += 6; + sad = msad4(pixels[1][0], FfxUInt32x2(searchBuffer[0][idx], searchBuffer[0][idx + 1]), sad); + sad = msad4(pixels[1][1], FfxUInt32x2(searchBuffer[0][idx + 1], searchBuffer[0][idx + 2]), sad); + idx += 6; + sad = msad4(pixels[2][0], FfxUInt32x2(searchBuffer[0][idx], searchBuffer[0][idx + 1]), sad); + sad = msad4(pixels[2][1], FfxUInt32x2(searchBuffer[0][idx + 1], searchBuffer[0][idx + 2]), sad); + idx += 6; + sad = msad4(pixels[3][0], FfxUInt32x2(searchBuffer[0][idx], searchBuffer[0][idx + 1]), sad); + sad = msad4(pixels[3][1], FfxUInt32x2(searchBuffer[0][idx + 1], searchBuffer[0][idx + 2]), sad); + idx += 6; + sad = msad4(pixels[4][0], FfxUInt32x2(searchBuffer[0][idx], searchBuffer[0][idx + 1]), sad); + sad = msad4(pixels[4][1], FfxUInt32x2(searchBuffer[0][idx + 1], searchBuffer[0][idx + 2]), sad); + idx += 6; + sad = msad4(pixels[5][0], FfxUInt32x2(searchBuffer[0][idx], searchBuffer[0][idx + 1]), sad); + sad = msad4(pixels[5][1], FfxUInt32x2(searchBuffer[0][idx + 1], searchBuffer[0][idx + 2]), sad); + idx += 6; + sad = msad4(pixels[6][0], FfxUInt32x2(searchBuffer[0][idx], searchBuffer[0][idx + 1]), sad); + sad = msad4(pixels[6][1], FfxUInt32x2(searchBuffer[0][idx + 1], searchBuffer[0][idx + 2]), sad); + idx += 6; + sad = msad4(pixels[7][0], FfxUInt32x2(searchBuffer[0][idx], searchBuffer[0][idx + 1]), sad); + sad = msad4(pixels[7][1], FfxUInt32x2(searchBuffer[0][idx + 1], searchBuffer[0][idx + 2]), sad); + +#else + for (FfxInt32 dy = 0; dy < CompareSize; dy++) + { + FfxInt32 rowOffset = (iSearchId.y + dy) * SearchBufferSizeX; + FfxUInt32 a0 = searchBuffer[0][rowOffset + iSearchId.x]; + FfxUInt32 a1 = searchBuffer[0][rowOffset + iSearchId.x + 1]; + FfxUInt32 a2 = searchBuffer[0][rowOffset + iSearchId.x + 2]; + sad += QSad(a0, a1, pixels[dy][0]); + sad += QSad(a1, a2, pixels[dy][1]); + } +#endif + + return sad; +} + +FfxUInt32x2 abs_2(FfxInt32x2 val) +{ + FfxInt32x2 tmp = val; + FfxInt32x2 mask = tmp >> 31; + FfxUInt32x2 res = (tmp + mask) ^ mask; + return res; +} + +FfxUInt32 EncodeSearchCoord(FfxInt32x2 coord) +{ +#if FFX_OPTICALFLOW_FIX_TOP_LEFT_BIAS == 1 + FfxUInt32x2 absCoord = FfxUInt32x2(abs_2(coord - 8)); + return FfxUInt32(absCoord.y << 12) | FfxUInt32(absCoord.x << 8) | FfxUInt32(coord.y << 4) | FfxUInt32(coord.x); +#else //FFX_OPTICALFLOW_FIX_TOP_LEFT_BIAS == 1 + return FfxUInt32(coord.y << 8) | FfxUInt32(coord.x); +#endif //FFX_OPTICALFLOW_FIX_TOP_LEFT_BIAS == 1 +} + +FfxInt32x2 DecodeSearchCoord(FfxUInt32 bits) +{ +#if FFX_OPTICALFLOW_FIX_TOP_LEFT_BIAS == 1 + FfxInt32 dx = FfxInt32(bits & 0xfu) - SearchRadiusX; + FfxInt32 dy = FfxInt32((bits >> 4) & 0xfu) - SearchRadiusY; + + return FfxInt32x2(dx, dy); +#else + FfxInt32 dx = FfxInt32(bits & 0xffu) - SearchRadiusX; + FfxInt32 dy = FfxInt32((bits >> 8) & 0xffu) - SearchRadiusY; + + return FfxInt32x2(dx, dy); +#endif +} + +void PrepareSadMap(FfxInt32x2 iSearchId, FfxUInt32x4 qsad) +{ + sadMapBuffer[0][iSearchId.y][iSearchId.x] = (qsad.x << 16) | EncodeSearchCoord(FfxInt32x2(iSearchId.x * 4 + 0, iSearchId.y)); + sadMapBuffer[1][iSearchId.y][iSearchId.x] = (qsad.y << 16) | EncodeSearchCoord(FfxInt32x2(iSearchId.x * 4 + 1, iSearchId.y)); + sadMapBuffer[2][iSearchId.y][iSearchId.x] = (qsad.z << 16) | EncodeSearchCoord(FfxInt32x2(iSearchId.x * 4 + 2, iSearchId.y)); + sadMapBuffer[3][iSearchId.y][iSearchId.x] = (qsad.w << 16) | EncodeSearchCoord(FfxInt32x2(iSearchId.x * 4 + 3, iSearchId.y)); + FFX_GROUP_MEMORY_BARRIER; +} + + +uint ABfe(uint src, uint off, uint bits) { uint mask = (1u << bits) - 1u; return (src >> off) & mask; } +uint ABfi(uint src, uint ins, uint mask) { return (ins & mask) | (src & (~mask)); } +uint ABfiM(uint src, uint ins, uint bits) { uint mask = (1u << bits) - 1u; return (ins & mask) | (src & (~mask)); } +void MapThreads(in FfxInt32x2 iGroupId, in FfxInt32 iLocalIndex, + out FfxInt32x2 iSearchId, out FfxInt32x2 iPxPos, out FfxInt32 iLaneToBlockId) +{ + iSearchId = FfxInt32x2(ABfe(iLocalIndex, 0u, 2u), ABfe(iLocalIndex, 2u, 4u)); + iLaneToBlockId = FfxInt32(ABfe(iLocalIndex, 1u, 1u) | (ABfe(iLocalIndex, 5u, 1u) << 1u)); + iPxPos = (iGroupId << 4u) + iSearchId * FfxInt32x2(4, 1); +} + +void ComputeOpticalFlowAdvanced(FfxInt32x2 iGlobalId, FfxInt32x2 iLocalId, FfxInt32x2 iGroupId, FfxInt32 iLocalIndex) +{ + FfxInt32x2 iSearchId; + FfxInt32x2 iPxPos; + FfxInt32 iLaneToBlockId; + MapThreads(iGroupId, iLocalIndex, iSearchId, iPxPos, iLaneToBlockId); + + FfxInt32x2 currentOFPos = iPxPos >> 3u; + + if (IsSceneChanged()) + { + if ((iSearchId.y & 0x7) == 0 && (iSearchId.x & 0x1) == 0) + { + StoreOpticalFlow(currentOFPos, FfxInt32x2(0, 0)); + } + + return; + } + + const FfxBoolean bUsePredictionFromPreviousLevel = (OpticalFlowPyramidLevel() != OpticalFlowPyramidLevelCount() - 1); + + FfxUInt32 packedLuma_4blocks = LoadFirstImagePackedLuma(iPxPos); + +#if FFX_LOCAL_SEARCH_FALLBACK == 1 + FfxUInt32 prevPackedLuma_4blocks = LoadSecondImagePackedLuma(iPxPos); + FfxUInt32 sad_4blocks = Sad(packedLuma_4blocks, prevPackedLuma_4blocks); +#endif //FFX_LOCAL_SEARCH_FALLBACK + + FfxInt32x2 ofGroupOffset = iGroupId << 1u; + FfxInt32x2 pixelGroupOffset = iGroupId << 4u; + + FfxInt32x2 blockId; + for (blockId.y = 0; blockId.y < BlockCount; blockId.y++) + { + for (blockId.x = 0; blockId.x < BlockCount; blockId.x++) + { + FfxInt32x2 currentVector = LoadRwOpticalFlow(ofGroupOffset + blockId); + if (!bUsePredictionFromPreviousLevel) + { + currentVector = FfxInt32x2(0, 0); + } + + if (iLaneToBlockId == blockId.y * 2 + blockId.x) + { + pixels[iSearchId.y & 0x7][iSearchId.x & 0x1] = packedLuma_4blocks; + } + + LoadSearchBuffer(iLocalIndex, pixelGroupOffset + blockId * 8 + currentVector); + + FfxUInt32x4 qsad = CalculateQSads2(iSearchId); + + PrepareSadMap(iSearchId, qsad); + FfxUInt32 minSad = SadMapMinReduction256(iSearchId, iLocalIndex); + + FfxInt32x2 minSadCoord = DecodeSearchCoord(minSad); + FfxInt32x2 newVector = currentVector + minSadCoord; + +#if FFX_LOCAL_SEARCH_FALLBACK == 1 + FfxUInt32 blockSadSum = BlockSad64(sad_4blocks, iLocalIndex, iLaneToBlockId, blockId.x + blockId.y * 2); + if (OpticalFlowPyramidLevel() == 0 && blockSadSum <= (minSad >> 16u)) + { + newVector = FfxInt32x2(0, 0); + } +#endif //FFX_LOCAL_SEARCH_FALLBACK + + { + StoreOpticalFlow(ofGroupOffset + blockId, newVector); + } + } + } +} + +#endif // FFX_OPTICALFLOW_COMPUTE_OPTICAL_FLOW_V5_H diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/opticalflow/ffx_opticalflow_compute_scd_divergence.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/opticalflow/ffx_opticalflow_compute_scd_divergence.h new file mode 100644 index 00000000..7f473f65 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/opticalflow/ffx_opticalflow_compute_scd_divergence.h @@ -0,0 +1,159 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#ifndef FFX_OPTICALFLOW_COMPUTE_SCD_DIVERGENCE_H +#define FFX_OPTICALFLOW_COMPUTE_SCD_DIVERGENCE_H + +FFX_GROUPSHARED FfxFloat32 sourceHistogram[256]; +FFX_GROUPSHARED FfxFloat32 filteredHistogram[256]; +FFX_GROUPSHARED FfxFloat32 tempBuffer[256]; +FFX_GROUPSHARED FfxFloat32x2 tempBuffer2[256]; + +void ComputeSCDHistogramsDivergence(FfxInt32x3 iGlobalId, FfxInt32x2 iLocalId, FfxInt32 iLocalIndex, FfxInt32x2 iGroupId, FfxInt32x2 iGroupSize) +{ + FFX_STATIC const FfxFloat32 Factor = 1000000.0; + FFX_STATIC const FfxInt32 WhereToStop = 3*9 - 1; + FFX_STATIC const FfxInt32 HistogramCount = 3 * 3; + + FFX_STATIC const FfxFloat32 Kernel[] = { + 0.0088122291, 0.027143577, 0.065114059, 0.12164907, 0.17699835, 0.20056541 + }; + + sourceHistogram[iLocalIndex] = FfxFloat32(LoadRwSCDHistogram(iGlobalId.x)); + FFX_GROUP_MEMORY_BARRIER; + + const FfxInt32 kernelShift = -5; + const FfxInt32 indexToRead = iLocalIndex + kernelShift; + + FfxFloat32 val = 0.0; + val += Kernel[0] * sourceHistogram[ffxClamp(indexToRead + 0, 0, 255)]; + val += Kernel[1] * sourceHistogram[ffxClamp(indexToRead + 1, 0, 255)]; + val += Kernel[2] * sourceHistogram[ffxClamp(indexToRead + 2, 0, 255)]; + val += Kernel[3] * sourceHistogram[ffxClamp(indexToRead + 3, 0, 255)]; + val += Kernel[4] * sourceHistogram[ffxClamp(indexToRead + 4, 0, 255)]; + val += Kernel[5] * sourceHistogram[ffxClamp(indexToRead + 5, 0, 255)]; + val += Kernel[4] * sourceHistogram[ffxClamp(indexToRead + 6, 0, 255)]; + val += Kernel[3] * sourceHistogram[ffxClamp(indexToRead + 7, 0, 255)]; + val += Kernel[2] * sourceHistogram[ffxClamp(indexToRead + 8, 0, 255)]; + val += Kernel[1] * sourceHistogram[ffxClamp(indexToRead + 9, 0, 255)]; + val += Kernel[0] * sourceHistogram[ffxClamp(indexToRead + 10, 0, 255)]; + + val += 1.0; + + if (iGlobalId.y == 0) + { + if (iLocalIndex == 0) + filteredHistogram[255] = 1.0; + else + filteredHistogram[iLocalIndex - 1] = val; + } + else if (iGlobalId.y == 1) + { + filteredHistogram[iLocalIndex] = val; + } + else if (iGlobalId.y == 2) + { + if (iLocalIndex == 255) + filteredHistogram[0] = 1.0; + else + filteredHistogram[iLocalIndex + 1] = val; + } + FFX_GROUP_MEMORY_BARRIER; + + tempBuffer[iLocalIndex] = filteredHistogram[iLocalIndex]; + FFX_GROUP_MEMORY_BARRIER; + + if (iLocalIndex < 128) tempBuffer[iLocalIndex] += tempBuffer[iLocalIndex + 128]; + FFX_GROUP_MEMORY_BARRIER; + + if (iLocalIndex < 64) tempBuffer[iLocalIndex] += tempBuffer[iLocalIndex + 64]; + FFX_GROUP_MEMORY_BARRIER; + + if (iLocalIndex < 32) tempBuffer[iLocalIndex] += tempBuffer[iLocalIndex + 32]; + if (iLocalIndex < 16) tempBuffer[iLocalIndex] += tempBuffer[iLocalIndex + 16]; + if (iLocalIndex < 8 ) tempBuffer[iLocalIndex] += tempBuffer[iLocalIndex + 8]; + if (iLocalIndex < 4 ) tempBuffer[iLocalIndex] += tempBuffer[iLocalIndex + 4]; + if (iLocalIndex < 2 ) tempBuffer[iLocalIndex] += tempBuffer[iLocalIndex + 2]; + if (iLocalIndex < 1 ) tempBuffer[iLocalIndex] += tempBuffer[iLocalIndex + 1]; + FFX_GROUP_MEMORY_BARRIER; + + filteredHistogram[iLocalIndex] /= tempBuffer[0]; + + FfxFloat32 currentFilteredHistogramsValue = filteredHistogram[iLocalIndex]; + FfxFloat32 previousHistogramsValue = LoadRwSCDPreviousHistogram(iGlobalId.x); + + tempBuffer2[iLocalIndex] = FfxFloat32x2( + currentFilteredHistogramsValue * log(currentFilteredHistogramsValue / previousHistogramsValue), + previousHistogramsValue * log(previousHistogramsValue / currentFilteredHistogramsValue) + ); + FFX_GROUP_MEMORY_BARRIER; + + if (iLocalIndex < 128) tempBuffer2[iLocalIndex] += tempBuffer2[iLocalIndex + 128]; + FFX_GROUP_MEMORY_BARRIER; + + if (iLocalIndex < 64) tempBuffer2[iLocalIndex] += tempBuffer2[iLocalIndex + 64]; + FFX_GROUP_MEMORY_BARRIER; + + if (iLocalIndex < 32) tempBuffer2[iLocalIndex] += tempBuffer2[iLocalIndex + 32]; + if (iLocalIndex < 16) tempBuffer2[iLocalIndex] += tempBuffer2[iLocalIndex + 16]; + if (iLocalIndex < 8 ) tempBuffer2[iLocalIndex] += tempBuffer2[iLocalIndex + 8]; + if (iLocalIndex < 4 ) tempBuffer2[iLocalIndex] += tempBuffer2[iLocalIndex + 4]; + if (iLocalIndex < 2 ) tempBuffer2[iLocalIndex] += tempBuffer2[iLocalIndex + 2]; + + if (iLocalIndex == 0) + { + FfxFloat32x2 sum = tempBuffer2[0] + tempBuffer2[1]; + + FfxFloat32 resFloat = 1 - exp(-(abs(sum.x) + abs(sum.y))); + FfxUInt32 resUInt = FfxUInt32((resFloat / FfxFloat32(HistogramCount)) * Factor); + AtomicIncrementSCDTemp(iGlobalId.y, resUInt); + + FfxUInt32 oldFinishedGroupCount = AtomicIncrementSCDOutput(SCD_OUTPUT_COMPLETED_WORKGROUPS_SLOT, 1); + if (oldFinishedGroupCount == WhereToStop) + { + FfxUInt32 res0 = LoadRwSCDTemp(0); + FfxUInt32 res1 = LoadRwSCDTemp(1); + FfxUInt32 res2 = LoadRwSCDTemp(2); + FfxFloat32 sceneChangeValue = ffxMin(res0, ffxMin(res1, res2)) / Factor; + + FfxUInt32 history = LoadRwSCDOutput(SCD_OUTPUT_HISTORY_BITS_SLOT) << 1; + if (CrossedSceneChangeThreshold(sceneChangeValue)) + { + history |= 1; + } + StoreSCDOutput(SCD_OUTPUT_SCENE_CHANGE_SLOT, ffxAsUInt32(sceneChangeValue)); + StoreSCDOutput(SCD_OUTPUT_HISTORY_BITS_SLOT, history); + StoreSCDOutput(SCD_OUTPUT_COMPLETED_WORKGROUPS_SLOT, 0); + + ResetSCDTemp(); + } + } + + if (iGlobalId.y == 1) + { + StoreSCDPreviousHistogram(iGlobalId.x, currentFilteredHistogramsValue); + + StoreSCDHistogram(iGlobalId.x, 0); + } +} + +#endif // FFX_OPTICALFLOW_COMPUTE_SCD_DIVERGENCE_H diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/opticalflow/ffx_opticalflow_filter_optical_flow_v5.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/opticalflow/ffx_opticalflow_filter_optical_flow_v5.h new file mode 100644 index 00000000..8ebf0beb --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/opticalflow/ffx_opticalflow_filter_optical_flow_v5.h @@ -0,0 +1,58 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#ifndef FFX_OPTICALFLOW_FILTER_OPTICAL_FLOW_V5_H +#define FFX_OPTICALFLOW_FILTER_OPTICAL_FLOW_V5_H + +void FilterOpticalFlow(FfxInt32x2 iGlobalId, FfxInt32x2 iLocalId, FfxInt32x2 iGroupId, FfxInt32 iLocalIndex) +{ + FfxInt32x2 tmpMV[9]; + FfxInt32 idx = 0; + for (FfxInt32 xx = -1; xx < 2; xx++) + { + for (FfxInt32 yy = -1; yy < 2; yy++) + { + + tmpMV[idx] = LoadPreviousOpticalFlow(iGlobalId + FfxInt32x2(xx, yy)); + idx++; + } + } + + FfxUInt32 ret = 0xFFFFFFFF; + for (FfxInt32 i = 0; i < 9; ++i) + { + FfxUInt32 tmp = 0; + for (FfxInt32 j = 0; j < 9; ++j) + { + FfxInt32x2 delta = tmpMV[i] - tmpMV[j]; + tmp = delta.x * delta.x + (delta.y * delta.y + tmp); + } + + ret = min(((tmp) << 4) | i, ret); + } + + FfxUInt32 minIdx = ret & 0xF; + + StoreOpticalFlow(iGlobalId, tmpMV[minIdx]); +} + +#endif // FFX_OPTICALFLOW_FILTER_OPTICAL_FLOW_V5_H diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/opticalflow/ffx_opticalflow_generate_scd_histogram.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/opticalflow/ffx_opticalflow_generate_scd_histogram.h new file mode 100644 index 00000000..aead4386 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/opticalflow/ffx_opticalflow_generate_scd_histogram.h @@ -0,0 +1,92 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#ifndef FFX_OPTICALFLOW_GENERATE_SCD_HISTOGRAM_H +#define FFX_OPTICALFLOW_GENERATE_SCD_HISTOGRAM_H + +#define LBASE 10 + +FFX_GROUPSHARED FfxUInt32 scdBuffer[256 * LBASE]; + +void GenerateSceneChangeDetectionHistogram(FfxInt32x3 iGlobalId, FfxInt32x2 iLocalId, FfxInt32 iLocalIndex, FfxInt32x2 iGroupId, FfxInt32x2 iGroupSize) +{ + FFX_STATIC const FfxUInt32 HistogramsPerDim = 3; + + FfxUInt32 divX = DisplaySize().x / HistogramsPerDim; + FfxUInt32 divY = DisplaySize().y / HistogramsPerDim; + + FfxUInt32 nx = iGlobalId.z % HistogramsPerDim; + FfxUInt32 ny = iGlobalId.z / HistogramsPerDim; + FfxUInt32 startX = divX * nx; + FfxUInt32 startY = divY * ny; + FfxUInt32 stopX = startX + divX; + FfxUInt32 stopY = startY + divY; + + const FfxUInt32 bufferOffset = iLocalIndex * LBASE; + + for (FfxInt32 i = 0; i < LBASE; i++) + { + scdBuffer[bufferOffset + i] = 0; + } + FFX_GROUP_MEMORY_BARRIER; + + FfxInt32x2 coord = FfxInt32x2(startX + (4 * iGlobalId.x), startY + iGlobalId.y); + if (coord.x < stopX) + { + for (; coord.y < stopY; coord.y += 128) + { + FfxUInt32x4 color = FfxUInt32x4( + LoadOpticalFlowInput(coord + FfxInt32x2(0, 0)), + LoadOpticalFlowInput(coord + FfxInt32x2(1, 0)), + LoadOpticalFlowInput(coord + FfxInt32x2(2, 0)), + LoadOpticalFlowInput(coord + FfxInt32x2(3, 0)) + ); + color *= LBASE; + + FfxUInt32 scramblingOffset = iLocalIndex % LBASE; + +#if defined(FFX_HLSL) + InterlockedAdd(scdBuffer[color.x + scramblingOffset], 1); + InterlockedAdd(scdBuffer[color.y + scramblingOffset], 1); + InterlockedAdd(scdBuffer[color.z + scramblingOffset], 1); + InterlockedAdd(scdBuffer[color.w + scramblingOffset], 1); +#elif defined(FFX_GLSL) + atomicAdd(scdBuffer[color.x + scramblingOffset], 1); + atomicAdd(scdBuffer[color.y + scramblingOffset], 1); + atomicAdd(scdBuffer[color.z + scramblingOffset], 1); + atomicAdd(scdBuffer[color.w + scramblingOffset], 1); +#endif + } + } + FFX_GROUP_MEMORY_BARRIER; + + FfxUInt32 value = 0; + for (FfxInt32 i = 0; i < LBASE; i++) + { + value += scdBuffer[bufferOffset + i]; + } + + FfxUInt32 histogramStart = (iGroupSize.x * iGroupSize.y) * iGlobalId.z; + AtomicIncrementSCDHistogram(FfxInt32(histogramStart + iLocalIndex), value); +} + +#endif // FFX_OPTICALFLOW_GENERATE_SCD_HISTOGRAM_H diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/opticalflow/ffx_opticalflow_prepare_luma.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/opticalflow/ffx_opticalflow_prepare_luma.h new file mode 100644 index 00000000..57fd8a74 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/opticalflow/ffx_opticalflow_prepare_luma.h @@ -0,0 +1,106 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#ifndef FFX_OPTICALFLOW_PREPARE_LUMA_H +#define FFX_OPTICALFLOW_PREPARE_LUMA_H + +FfxFloat32 LuminanceToPerceivedLuminance(FfxFloat32 fLuminance) +{ + FfxFloat32 fPercievedLuminance = 0; + if (fLuminance <= 216.0f / 24389.0f) { + fPercievedLuminance = fLuminance * (24389.0f / 27.0f); + } + else { + fPercievedLuminance = ffxPow(fLuminance, 1.0f / 3.0f) * 116.0f - 16.0f; + } + + return fPercievedLuminance * 0.01f; +} + +FfxFloat32 LinearLdrToLuminance(FfxFloat32x3 linearRec709RGB) +{ + FfxFloat32 fY = 0.2126 * linearRec709RGB.x + 0.7152 * linearRec709RGB.y + 0.0722 * linearRec709RGB.z; + return fY; +} + +FfxFloat32 LinearRec2020ToLuminance(FfxFloat32x3 linearRec2020RGB) +{ + FfxFloat32 fY = 0.2627 * linearRec2020RGB.x + 0.678 * linearRec2020RGB.y + 0.0593 * linearRec2020RGB.z; + return fY; +} + +FfxFloat32 PQCorrectedHdrToLuminance(FfxFloat32x3 pq, FfxFloat32 maxLuminance) +{ + FfxFloat32 fY = LinearRec2020ToLuminance(ffxLinearFromPQ(pq) * (10000.0f / maxLuminance)); + return fY; +} + +FfxFloat32x3 ffxscRGBToLinear(FfxFloat32x3 value, FfxFloat32 minLuminance, FfxFloat32 maxLuminance) +{ + FfxFloat32x3 p = value - ffxBroadcast3(minLuminance / 80.0f); + return p / ffxBroadcast3((maxLuminance - minLuminance) / 80.0f); +} + +FfxFloat32 SCRGBCorrectedHdrToLuminance(FfxFloat32x3 scRGB, FfxFloat32 minLuminance, FfxFloat32 maxLuminance) +{ + FfxFloat32 fY = LinearLdrToLuminance(ffxscRGBToLinear(scRGB, minLuminance, maxLuminance)); + return fY; +} + +void PrepareLuma(FfxInt32x2 iGlobalId, FfxInt32 iLocalIndex) +{ +#define PixelsPerThreadX 2 +#define PixelsPerThreadY 2 +#pragma unroll + for (FfxInt32 y = 0; y < PixelsPerThreadY; y++) + { +#pragma unroll + for (FfxInt32 x = 0; x < PixelsPerThreadX; x++) + { + FfxInt32x2 pos = iGlobalId * FfxInt32x2(PixelsPerThreadX, PixelsPerThreadY) + FfxInt32x2(x, y); + FfxInt32x2 iPxHrPos = pos; + FfxFloat32 fY = 0.0; + + FfxFloat32x3 inputColor = LoadInputColor(iPxHrPos).rgb; + + FfxUInt32 backbufferTransferFunction = BackbufferTransferFunction(); + if (backbufferTransferFunction == 0) + { + fY = LinearLdrToLuminance(inputColor); + } + else if (backbufferTransferFunction == 1) + { + fY = PQCorrectedHdrToLuminance(inputColor, MinMaxLuminance()[1]); + fY = LuminanceToPerceivedLuminance(fY); + } + else if (backbufferTransferFunction == 2) + { + fY = SCRGBCorrectedHdrToLuminance(inputColor, MinMaxLuminance()[0], MinMaxLuminance()[1]); + fY = LuminanceToPerceivedLuminance(fY); + } + + StoreOpticalFlowInput(pos, FfxUInt32(fY * 255)); + } + } +} + +#endif // FFX_OPTICALFLOW_PREPARE_LUMA_H diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/opticalflow/ffx_opticalflow_resources.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/opticalflow/ffx_opticalflow_resources.h new file mode 100644 index 00000000..4676af40 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/opticalflow/ffx_opticalflow_resources.h @@ -0,0 +1,74 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#ifndef FFX_OPTICALFLOW_RESOURCES_H +#define FFX_OPTICALFLOW_RESOURCES_H + +#if defined(FFX_CPU) || defined(FFX_GPU) + +#define FFX_OF_RESOURCE_IDENTIFIER_NULL 0 + +#define FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_1 1 +#define FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_1_LEVEL_1 2 +#define FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_1_LEVEL_2 3 +#define FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_1_LEVEL_3 4 +#define FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_1_LEVEL_4 5 +#define FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_1_LEVEL_5 6 +#define FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_1_LEVEL_6 7 + +#define FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_2 8 +#define FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_2_LEVEL_1 9 +#define FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_2_LEVEL_2 10 +#define FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_2_LEVEL_3 11 +#define FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_2_LEVEL_4 12 +#define FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_2_LEVEL_5 13 +#define FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_2_LEVEL_6 14 + +#define FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_1 15 +#define FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_1_LEVEL_1 16 +#define FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_1_LEVEL_2 17 +#define FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_1_LEVEL_3 18 +#define FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_1_LEVEL_4 19 +#define FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_1_LEVEL_5 20 +#define FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_1_LEVEL_6 21 + +#define FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_2 22 +#define FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_2_LEVEL_1 23 +#define FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_2_LEVEL_2 24 +#define FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_2_LEVEL_3 25 +#define FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_2_LEVEL_4 26 +#define FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_2_LEVEL_5 27 +#define FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_2_LEVEL_6 28 + +#define FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_SCD_HISTOGRAM 29 +#define FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_SCD_PREVIOUS_HISTOGRAM 30 +#define FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_SCD_TEMP 31 + +#define FFX_OF_RESOURCE_IDENTIFIER_COUNT 32 + +#define FFX_OPTICALFLOW_CONSTANTBUFFER_IDENTIFIER 0 +#define FFX_OPTICALFLOW_CONSTANTBUFFER_IDENTIFIER_SPD 1 +#define FFX_OPTICALFLOW_CONSTANTBUFFER_COUNT 2 + +#endif // #if defined(FFX_CPU) || defined(FFX_GPU) + +#endif //!defined( FFX_OPTICALFLOW_RESOURCES_H ) diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/opticalflow/ffx_opticalflow_scale_optical_flow_advanced_v5.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/opticalflow/ffx_opticalflow_scale_optical_flow_advanced_v5.h new file mode 100644 index 00000000..16238f4e --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/opticalflow/ffx_opticalflow_scale_optical_flow_advanced_v5.h @@ -0,0 +1,99 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#ifndef FFX_OPTICALFLOW_SCALE_OPTICAL_FLOW_ADVANCED_V5_H +#define FFX_OPTICALFLOW_SCALE_OPTICAL_FLOW_ADVANCED_V5_H + +#define WG_WIDTH FFX_OPTICALFLOW_THREAD_GROUP_WIDTH +#define WG_HEIGHT FFX_OPTICALFLOW_THREAD_GROUP_HEIGHT +#define WG_DEPTH FFX_OPTICALFLOW_THREAD_GROUP_DEPTH +FFX_GROUPSHARED FfxInt32x2 nearestVectors[4][WG_HEIGHT][WG_WIDTH]; +FFX_GROUPSHARED FfxUInt32 localRegion[4][WG_HEIGHT][WG_WIDTH]; +FFX_GROUPSHARED FfxUInt32 sads[4][WG_HEIGHT][WG_WIDTH]; + +void ScaleOpticalFlowAdvanced(FfxInt32x3 iGlobalId, FfxInt32x3 iLocalId) +{ + if (IsSceneChanged()) + { + StoreOpticalFlowNextLevel(iGlobalId.xy, FfxInt32x2(0, 0)); + + return; + } + + int xOffset = (iLocalId.z % 2) - 1 + iGlobalId.x % 2; + int yOffset = (iLocalId.z / 2) - 1 + iGlobalId.y % 2; + + FfxInt32x2 srcOFPos = FfxInt32x2( + (iGlobalId.x / 2) + xOffset, + (iGlobalId.y / 2) + yOffset + ); + + FfxInt32x2 nearestVector = LoadOpticalFlow(srcOFPos); + nearestVectors[iLocalId.z][iLocalId.y][iLocalId.x] = nearestVector * 2; + + int maxY = 4; + for (int n = iLocalId.z; n < maxY; n += WG_DEPTH) + { + { + FfxInt32x2 lumaPos = FfxInt32x2((iGlobalId.x) * 4, iGlobalId.y * maxY + n); + FfxUInt32 firstPixel = LoadFirstImagePackedLuma(lumaPos); + localRegion[n][iLocalId.y][iLocalId.x] = firstPixel; + } + } + FFX_GROUP_MEMORY_BARRIER; + + uint sad = 0; + for (int n = 0; n < maxY; n++) + { + { + FfxInt32x2 lumaPos = FfxInt32x2((iGlobalId.x) * 4, (iGlobalId.y * maxY + n)) + nearestVector; + FfxUInt32 secondPixel = LoadSecondImagePackedLuma(lumaPos); + sad += Sad(localRegion[n][iLocalId.y][iLocalId.x], secondPixel); + } + } + sads[iLocalId.z][iLocalId.y][iLocalId.x] = sad; + + FFX_GROUP_MEMORY_BARRIER; + + { + if (iLocalId.z == 0) + { + uint bestSad = 0xffffffff; + uint bestId = 0; + + for (int n = 0; n < 4; n++) + { + if ((sads[n][iLocalId.y][iLocalId.x]) < bestSad) + { + bestSad = sads[n][iLocalId.y][iLocalId.x]; + bestId = n; + } + } + + FfxInt32x2 outputVector = nearestVectors[bestId][iLocalId.y][iLocalId.x]; + + StoreOpticalFlowNextLevel(iGlobalId.xy, outputVector); + } + } +} + +#endif // FFX_OPTICALFLOW_SCALE_OPTICAL_FLOW_ADVANCED_V5_H diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/spd/ffx_spd.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/spd/ffx_spd.h new file mode 100644 index 00000000..c3ee50f0 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/spd/ffx_spd.h @@ -0,0 +1,1014 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +/// @defgroup FfxGPUSpd FidelityFX SPD +/// FidelityFX Single Pass Downsampler 2.0 GPU documentation +/// +/// @ingroup FfxGPUEffects + +/// Setup required constant values for SPD (CPU). +/// +/// @param [out] dispatchThreadGroupCountXY CPU side: dispatch thread group count xy. z is number of slices of the input texture +/// @param [out] workGroupOffset GPU side: pass in as constant +/// @param [out] numWorkGroupsAndMips GPU side: pass in as constant +/// @param [in] rectInfo left, top, width, height +/// @param [in] mips optional: if -1, calculate based on rect width and height +/// +/// @ingroup FfxGPUSpd +#if defined(FFX_CPU) +FFX_STATIC void ffxSpdSetup(FfxUInt32x2 dispatchThreadGroupCountXY, + FfxUInt32x2 workGroupOffset, + FfxUInt32x2 numWorkGroupsAndMips, + FfxUInt32x4 rectInfo, + FfxInt32 mips) +{ + // determines the offset of the first tile to downsample based on + // left (rectInfo[0]) and top (rectInfo[1]) of the subregion. + workGroupOffset[0] = rectInfo[0] / 64; + workGroupOffset[1] = rectInfo[1] / 64; + + FfxUInt32 endIndexX = (rectInfo[0] + rectInfo[2] - 1) / 64; // rectInfo[0] = left, rectInfo[2] = width + FfxUInt32 endIndexY = (rectInfo[1] + rectInfo[3] - 1) / 64; // rectInfo[1] = top, rectInfo[3] = height + + // we only need to dispatch as many thread groups as tiles we need to downsample + // number of tiles per slice depends on the subregion to downsample + dispatchThreadGroupCountXY[0] = endIndexX + 1 - workGroupOffset[0]; + dispatchThreadGroupCountXY[1] = endIndexY + 1 - workGroupOffset[1]; + + // number of thread groups per slice + numWorkGroupsAndMips[0] = (dispatchThreadGroupCountXY[0]) * (dispatchThreadGroupCountXY[1]); + + if (mips >= 0) + { + numWorkGroupsAndMips[1] = FfxUInt32(mips); + } + else + { + // calculate based on rect width and height + FfxUInt32 resolution = ffxMax(rectInfo[2], rectInfo[3]); + numWorkGroupsAndMips[1] = FfxUInt32((ffxMin(floor(log2(FfxFloat32(resolution))), FfxFloat32(12)))); + } +} + +/// Setup required constant values for SPD (CPU). +/// +/// @param [out] dispatchThreadGroupCountXY CPU side: dispatch thread group count xy. z is number of slices of the input texture +/// @param [out] workGroupOffset GPU side: pass in as constant +/// @param [out] numWorkGroupsAndMips GPU side: pass in as constant +/// @param [in] rectInfo left, top, width, height +/// +/// @ingroup FfxGPUSpd +FFX_STATIC void ffxSpdSetup(FfxUInt32x2 dispatchThreadGroupCountXY, + FfxUInt32x2 workGroupOffset, + FfxUInt32x2 numWorkGroupsAndMips, + FfxUInt32x4 rectInfo) +{ + ffxSpdSetup(dispatchThreadGroupCountXY, workGroupOffset, numWorkGroupsAndMips, rectInfo, -1); +} +#endif // #if defined(FFX_CPU) + + +//============================================================================================================================== +// NON-PACKED VERSION +//============================================================================================================================== +#if defined(FFX_GPU) +#if defined(FFX_SPD_PACKED_ONLY) +// Avoid compiler errors by including default implementations of these callbacks. +FfxFloat32x4 SpdLoadSourceImage(FfxInt32x2 p, FfxUInt32 slice) +{ + return FfxFloat32x4(0.0, 0.0, 0.0, 0.0); +} + +FfxFloat32x4 SpdLoad(FfxInt32x2 p, FfxUInt32 slice) +{ + return FfxFloat32x4(0.0, 0.0, 0.0, 0.0); +} +void SpdStore(FfxInt32x2 p, FfxFloat32x4 value, FfxUInt32 mip, FfxUInt32 slice) +{ +} +FfxFloat32x4 SpdLoadIntermediate(FfxUInt32 x, FfxUInt32 y) +{ + return FfxFloat32x4(0.0, 0.0, 0.0, 0.0); +} +void SpdStoreIntermediate(FfxUInt32 x, FfxUInt32 y, FfxFloat32x4 value) +{ +} +FfxFloat32x4 SpdReduce4(FfxFloat32x4 v0, FfxFloat32x4 v1, FfxFloat32x4 v2, FfxFloat32x4 v3) +{ + return FfxFloat32x4(0.0, 0.0, 0.0, 0.0); +} +#endif // #if FFX_SPD_PACKED_ONLY + +//_____________________________________________________________/\_______________________________________________________________ +#if defined(FFX_GLSL) && !defined(FFX_SPD_NO_WAVE_OPERATIONS) +#extension GL_KHR_shader_subgroup_quad:require +#endif + +void ffxSpdWorkgroupShuffleBarrier() +{ + FFX_GROUP_MEMORY_BARRIER; +} + +// Only last active workgroup should proceed +bool SpdExitWorkgroup(FfxUInt32 numWorkGroups, FfxUInt32 localInvocationIndex, FfxUInt32 slice) +{ + // global atomic counter + if (localInvocationIndex == 0) + { + SpdIncreaseAtomicCounter(slice); + } + + ffxSpdWorkgroupShuffleBarrier(); + return (SpdGetAtomicCounter() != (numWorkGroups - 1)); +} + +// User defined: FfxFloat32x4 SpdReduce4(FfxFloat32x4 v0, FfxFloat32x4 v1, FfxFloat32x4 v2, FfxFloat32x4 v3); +FfxFloat32x4 SpdReduceQuad(FfxFloat32x4 v) +{ +#if defined(FFX_GLSL) && !defined(FFX_SPD_NO_WAVE_OPERATIONS) + + FfxFloat32x4 v0 = v; + FfxFloat32x4 v1 = subgroupQuadSwapHorizontal(v); + FfxFloat32x4 v2 = subgroupQuadSwapVertical(v); + FfxFloat32x4 v3 = subgroupQuadSwapDiagonal(v); + return SpdReduce4(v0, v1, v2, v3); + +#elif defined(FFX_HLSL) && !defined(FFX_SPD_NO_WAVE_OPERATIONS) + + // requires SM6.0 + FfxFloat32x4 v0 = v; + FfxFloat32x4 v1 = QuadReadAcrossX(v); + FfxFloat32x4 v2 = QuadReadAcrossY(v); + FfxFloat32x4 v3 = QuadReadAcrossDiagonal(v); + return SpdReduce4(v0, v1, v2, v3); +/* + // if SM6.0 is not available, you can use the AMD shader intrinsics + // the AMD shader intrinsics are available in AMD GPU Services (AGS) library: + // https://gpuopen.com/amd-gpu-services-ags-library/ + // works for DX11 + FfxFloat32x4 v0 = v; + FfxFloat32x4 v1; + v1.x = AmdExtD3DShaderIntrinsics_SwizzleF(v.x, AmdExtD3DShaderIntrinsicsSwizzle_SwapX1); + v1.y = AmdExtD3DShaderIntrinsics_SwizzleF(v.y, AmdExtD3DShaderIntrinsicsSwizzle_SwapX1); + v1.z = AmdExtD3DShaderIntrinsics_SwizzleF(v.z, AmdExtD3DShaderIntrinsicsSwizzle_SwapX1); + v1.w = AmdExtD3DShaderIntrinsics_SwizzleF(v.w, AmdExtD3DShaderIntrinsicsSwizzle_SwapX1); + FfxFloat32x4 v2; + v2.x = AmdExtD3DShaderIntrinsics_SwizzleF(v.x, AmdExtD3DShaderIntrinsicsSwizzle_SwapX2); + v2.y = AmdExtD3DShaderIntrinsics_SwizzleF(v.y, AmdExtD3DShaderIntrinsicsSwizzle_SwapX2); + v2.z = AmdExtD3DShaderIntrinsics_SwizzleF(v.z, AmdExtD3DShaderIntrinsicsSwizzle_SwapX2); + v2.w = AmdExtD3DShaderIntrinsics_SwizzleF(v.w, AmdExtD3DShaderIntrinsicsSwizzle_SwapX2); + FfxFloat32x4 v3; + v3.x = AmdExtD3DShaderIntrinsics_SwizzleF(v.x, AmdExtD3DShaderIntrinsicsSwizzle_ReverseX4); + v3.y = AmdExtD3DShaderIntrinsics_SwizzleF(v.y, AmdExtD3DShaderIntrinsicsSwizzle_ReverseX4); + v3.z = AmdExtD3DShaderIntrinsics_SwizzleF(v.z, AmdExtD3DShaderIntrinsicsSwizzle_ReverseX4); + v3.w = AmdExtD3DShaderIntrinsics_SwizzleF(v.w, AmdExtD3DShaderIntrinsicsSwizzle_ReverseX4); + return SpdReduce4(v0, v1, v2, v3); + */ +#endif + return v; +} + +FfxFloat32x4 SpdReduceIntermediate(FfxUInt32x2 i0, FfxUInt32x2 i1, FfxUInt32x2 i2, FfxUInt32x2 i3) +{ + FfxFloat32x4 v0 = SpdLoadIntermediate(i0.x, i0.y); + FfxFloat32x4 v1 = SpdLoadIntermediate(i1.x, i1.y); + FfxFloat32x4 v2 = SpdLoadIntermediate(i2.x, i2.y); + FfxFloat32x4 v3 = SpdLoadIntermediate(i3.x, i3.y); + return SpdReduce4(v0, v1, v2, v3); +} + +FfxFloat32x4 SpdReduceLoad4(FfxUInt32x2 i0, FfxUInt32x2 i1, FfxUInt32x2 i2, FfxUInt32x2 i3, FfxUInt32 slice) +{ + FfxFloat32x4 v0 = SpdLoad(FfxInt32x2(i0), slice); + FfxFloat32x4 v1 = SpdLoad(FfxInt32x2(i1), slice); + FfxFloat32x4 v2 = SpdLoad(FfxInt32x2(i2), slice); + FfxFloat32x4 v3 = SpdLoad(FfxInt32x2(i3), slice); + return SpdReduce4(v0, v1, v2, v3); +} + +FfxFloat32x4 SpdReduceLoad4(FfxUInt32x2 base, FfxUInt32 slice) +{ + return SpdReduceLoad4(FfxUInt32x2(base + FfxUInt32x2(0, 0)), FfxUInt32x2(base + FfxUInt32x2(0, 1)), FfxUInt32x2(base + FfxUInt32x2(1, 0)), FfxUInt32x2(base + FfxUInt32x2(1, 1)), slice); +} + +FfxFloat32x4 SpdReduceLoadSourceImage4(FfxUInt32x2 i0, FfxUInt32x2 i1, FfxUInt32x2 i2, FfxUInt32x2 i3, FfxUInt32 slice) +{ + FfxFloat32x4 v0 = SpdLoadSourceImage(FfxInt32x2(i0), slice); + FfxFloat32x4 v1 = SpdLoadSourceImage(FfxInt32x2(i1), slice); + FfxFloat32x4 v2 = SpdLoadSourceImage(FfxInt32x2(i2), slice); + FfxFloat32x4 v3 = SpdLoadSourceImage(FfxInt32x2(i3), slice); + return SpdReduce4(v0, v1, v2, v3); +} + +FfxFloat32x4 SpdReduceLoadSourceImage(FfxUInt32x2 base, FfxUInt32 slice) +{ +#if defined(SPD_LINEAR_SAMPLER) + return SpdLoadSourceImage(FfxInt32x2(base), slice); +#else + return SpdReduceLoadSourceImage4(FfxUInt32x2(base + FfxUInt32x2(0, 0)), FfxUInt32x2(base + FfxUInt32x2(0, 1)), FfxUInt32x2(base + FfxUInt32x2(1, 0)), FfxUInt32x2(base + FfxUInt32x2(1, 1)), slice); +#endif +} + +void SpdDownsampleMips_0_1_Intrinsics(FfxUInt32 x, FfxUInt32 y, FfxUInt32x2 workGroupID, FfxUInt32 localInvocationIndex, FfxUInt32 mip, FfxUInt32 slice) +{ + FfxFloat32x4 v[4]; + + FfxInt32x2 tex = FfxInt32x2(workGroupID.xy * 64) + FfxInt32x2(x * 2, y * 2); + FfxInt32x2 pix = FfxInt32x2(workGroupID.xy * 32) + FfxInt32x2(x, y); + v[0] = SpdReduceLoadSourceImage(tex, slice); + SpdStore(pix, v[0], 0, slice); + + tex = FfxInt32x2(workGroupID.xy * 64) + FfxInt32x2(x * 2 + 32, y * 2); + pix = FfxInt32x2(workGroupID.xy * 32) + FfxInt32x2(x + 16, y); + v[1] = SpdReduceLoadSourceImage(tex, slice); + SpdStore(pix, v[1], 0, slice); + + tex = FfxInt32x2(workGroupID.xy * 64) + FfxInt32x2(x * 2, y * 2 + 32); + pix = FfxInt32x2(workGroupID.xy * 32) + FfxInt32x2(x, y + 16); + v[2] = SpdReduceLoadSourceImage(tex, slice); + SpdStore(pix, v[2], 0, slice); + + tex = FfxInt32x2(workGroupID.xy * 64) + FfxInt32x2(x * 2 + 32, y * 2 + 32); + pix = FfxInt32x2(workGroupID.xy * 32) + FfxInt32x2(x + 16, y + 16); + v[3] = SpdReduceLoadSourceImage(tex, slice); + SpdStore(pix, v[3], 0, slice); + + if (mip <= 1) + return; + + v[0] = SpdReduceQuad(v[0]); + v[1] = SpdReduceQuad(v[1]); + v[2] = SpdReduceQuad(v[2]); + v[3] = SpdReduceQuad(v[3]); + + if ((localInvocationIndex % 4) == 0) + { + SpdStore(FfxInt32x2(workGroupID.xy * 16) + FfxInt32x2(x / 2, y / 2), v[0], 1, slice); + SpdStoreIntermediate(x / 2, y / 2, v[0]); + + SpdStore(FfxInt32x2(workGroupID.xy * 16) + FfxInt32x2(x / 2 + 8, y / 2), v[1], 1, slice); + SpdStoreIntermediate(x / 2 + 8, y / 2, v[1]); + + SpdStore(FfxInt32x2(workGroupID.xy * 16) + FfxInt32x2(x / 2, y / 2 + 8), v[2], 1, slice); + SpdStoreIntermediate(x / 2, y / 2 + 8, v[2]); + + SpdStore(FfxInt32x2(workGroupID.xy * 16) + FfxInt32x2(x / 2 + 8, y / 2 + 8), v[3], 1, slice); + SpdStoreIntermediate(x / 2 + 8, y / 2 + 8, v[3]); + } +} + +void SpdDownsampleMips_0_1_LDS(FfxUInt32 x, FfxUInt32 y, FfxUInt32x2 workGroupID, FfxUInt32 localInvocationIndex, FfxUInt32 mip, FfxUInt32 slice) +{ + FfxFloat32x4 v[4]; + + FfxInt32x2 tex = FfxInt32x2(workGroupID.xy * 64) + FfxInt32x2(x * 2, y * 2); + FfxInt32x2 pix = FfxInt32x2(workGroupID.xy * 32) + FfxInt32x2(x, y); + v[0] = SpdReduceLoadSourceImage(tex, slice); + SpdStore(pix, v[0], 0, slice); + + tex = FfxInt32x2(workGroupID.xy * 64) + FfxInt32x2(x * 2 + 32, y * 2); + pix = FfxInt32x2(workGroupID.xy * 32) + FfxInt32x2(x + 16, y); + v[1] = SpdReduceLoadSourceImage(tex, slice); + SpdStore(pix, v[1], 0, slice); + + tex = FfxInt32x2(workGroupID.xy * 64) + FfxInt32x2(x * 2, y * 2 + 32); + pix = FfxInt32x2(workGroupID.xy * 32) + FfxInt32x2(x, y + 16); + v[2] = SpdReduceLoadSourceImage(tex, slice); + SpdStore(pix, v[2], 0, slice); + + tex = FfxInt32x2(workGroupID.xy * 64) + FfxInt32x2(x * 2 + 32, y * 2 + 32); + pix = FfxInt32x2(workGroupID.xy * 32) + FfxInt32x2(x + 16, y + 16); + v[3] = SpdReduceLoadSourceImage(tex, slice); + SpdStore(pix, v[3], 0, slice); + + if (mip <= 1) + return; + + for (FfxUInt32 i = 0; i < 4; i++) + { + SpdStoreIntermediate(x, y, v[i]); + ffxSpdWorkgroupShuffleBarrier(); + if (localInvocationIndex < 64) + { + v[i] = SpdReduceIntermediate(FfxUInt32x2(x * 2 + 0, y * 2 + 0), FfxUInt32x2(x * 2 + 1, y * 2 + 0), FfxUInt32x2(x * 2 + 0, y * 2 + 1), FfxUInt32x2(x * 2 + 1, y * 2 + 1)); + SpdStore(FfxInt32x2(workGroupID.xy * 16) + FfxInt32x2(x + (i % 2) * 8, y + (i / 2) * 8), v[i], 1, slice); + } + ffxSpdWorkgroupShuffleBarrier(); + } + + if (localInvocationIndex < 64) + { + SpdStoreIntermediate(x + 0, y + 0, v[0]); + SpdStoreIntermediate(x + 8, y + 0, v[1]); + SpdStoreIntermediate(x + 0, y + 8, v[2]); + SpdStoreIntermediate(x + 8, y + 8, v[3]); + } +} + +void SpdDownsampleMips_0_1(FfxUInt32 x, FfxUInt32 y, FfxUInt32x2 workGroupID, FfxUInt32 localInvocationIndex, FfxUInt32 mip, FfxUInt32 slice) +{ +#if defined(FFX_SPD_NO_WAVE_OPERATIONS) + SpdDownsampleMips_0_1_LDS(x, y, workGroupID, localInvocationIndex, mip, slice); +#else + SpdDownsampleMips_0_1_Intrinsics(x, y, workGroupID, localInvocationIndex, mip, slice); +#endif +} + + +void SpdDownsampleMip_2(FfxUInt32 x, FfxUInt32 y, FfxUInt32x2 workGroupID, FfxUInt32 localInvocationIndex, FfxUInt32 mip, FfxUInt32 slice) +{ +#if defined(FFX_SPD_NO_WAVE_OPERATIONS) + if (localInvocationIndex < 64) + { + FfxFloat32x4 v = SpdReduceIntermediate(FfxUInt32x2(x * 2 + 0, y * 2 + 0), FfxUInt32x2(x * 2 + 1, y * 2 + 0), FfxUInt32x2(x * 2 + 0, y * 2 + 1), FfxUInt32x2(x * 2 + 1, y * 2 + 1)); + SpdStore(FfxInt32x2(workGroupID.xy * 8) + FfxInt32x2(x, y), v, mip, slice); + // store to LDS, try to reduce bank conflicts + // x 0 x 0 x 0 x 0 x 0 x 0 x 0 x 0 + // 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + // 0 x 0 x 0 x 0 x 0 x 0 x 0 x 0 x + // 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + // x 0 x 0 x 0 x 0 x 0 x 0 x 0 x 0 + // ... + // x 0 x 0 x 0 x 0 x 0 x 0 x 0 x 0 + SpdStoreIntermediate(x * 2 + y % 2, y * 2, v); + } +#else + FfxFloat32x4 v = SpdLoadIntermediate(x, y); + v = SpdReduceQuad(v); + // quad index 0 stores result + if (localInvocationIndex % 4 == 0) + { + SpdStore(FfxInt32x2(workGroupID.xy * 8) + FfxInt32x2(x / 2, y / 2), v, mip, slice); + SpdStoreIntermediate(x + (y / 2) % 2, y, v); + } +#endif +} + +void SpdDownsampleMip_3(FfxUInt32 x, FfxUInt32 y, FfxUInt32x2 workGroupID, FfxUInt32 localInvocationIndex, FfxUInt32 mip, FfxUInt32 slice) +{ +#if defined(FFX_SPD_NO_WAVE_OPERATIONS) + if (localInvocationIndex < 16) + { + // x 0 x 0 + // 0 0 0 0 + // 0 x 0 x + // 0 0 0 0 + FfxFloat32x4 v = + SpdReduceIntermediate(FfxUInt32x2(x * 4 + 0 + 0, y * 4 + 0), FfxUInt32x2(x * 4 + 2 + 0, y * 4 + 0), FfxUInt32x2(x * 4 + 0 + 1, y * 4 + 2), FfxUInt32x2(x * 4 + 2 + 1, y * 4 + 2)); + SpdStore(FfxInt32x2(workGroupID.xy * 4) + FfxInt32x2(x, y), v, mip, slice); + // store to LDS + // x 0 0 0 x 0 0 0 x 0 0 0 x 0 0 0 + // 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + // 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + // 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + // 0 x 0 0 0 x 0 0 0 x 0 0 0 x 0 0 + // ... + // 0 0 x 0 0 0 x 0 0 0 x 0 0 0 x 0 + // ... + // 0 0 0 x 0 0 0 x 0 0 0 x 0 0 0 x + // ... + SpdStoreIntermediate(x * 4 + y, y * 4, v); + } +#else + if (localInvocationIndex < 64) + { + FfxFloat32x4 v = SpdLoadIntermediate(x * 2 + y % 2, y * 2); + v = SpdReduceQuad(v); + // quad index 0 stores result + if (localInvocationIndex % 4 == 0) + { + SpdStore(FfxInt32x2(workGroupID.xy * 4) + FfxInt32x2(x / 2, y / 2), v, mip, slice); + SpdStoreIntermediate(x * 2 + y / 2, y * 2, v); + } + } +#endif +} + +void SpdDownsampleMip_4(FfxUInt32 x, FfxUInt32 y, FfxUInt32x2 workGroupID, FfxUInt32 localInvocationIndex, FfxUInt32 mip, FfxUInt32 slice) +{ +#if defined(FFX_SPD_NO_WAVE_OPERATIONS) + if (localInvocationIndex < 4) + { + // x 0 0 0 x 0 0 0 + // ... + // 0 x 0 0 0 x 0 0 + FfxFloat32x4 v = SpdReduceIntermediate(FfxUInt32x2(x * 8 + 0 + 0 + y * 2, y * 8 + 0), + FfxUInt32x2(x * 8 + 4 + 0 + y * 2, y * 8 + 0), + FfxUInt32x2(x * 8 + 0 + 1 + y * 2, y * 8 + 4), + FfxUInt32x2(x * 8 + 4 + 1 + y * 2, y * 8 + 4)); + SpdStore(FfxInt32x2(workGroupID.xy * 2) + FfxInt32x2(x, y), v, mip, slice); + // store to LDS + // x x x x 0 ... + // 0 ... + SpdStoreIntermediate(x + y * 2, 0, v); + } +#else + if (localInvocationIndex < 16) + { + FfxFloat32x4 v = SpdLoadIntermediate(x * 4 + y, y * 4); + v = SpdReduceQuad(v); + // quad index 0 stores result + if (localInvocationIndex % 4 == 0) + { + SpdStore(FfxInt32x2(workGroupID.xy * 2) + FfxInt32x2(x / 2, y / 2), v, mip, slice); + SpdStoreIntermediate(x / 2 + y, 0, v); + } + } +#endif +} + +void SpdDownsampleMip_5(FfxUInt32x2 workGroupID, FfxUInt32 localInvocationIndex, FfxUInt32 mip, FfxUInt32 slice) +{ +#if defined(FFX_SPD_NO_WAVE_OPERATIONS) + if (localInvocationIndex < 1) + { + // x x x x 0 ... + // 0 ... + FfxFloat32x4 v = SpdReduceIntermediate(FfxUInt32x2(0, 0), FfxUInt32x2(1, 0), FfxUInt32x2(2, 0), FfxUInt32x2(3, 0)); + SpdStore(FfxInt32x2(workGroupID.xy), v, mip, slice); + } +#else + if (localInvocationIndex < 4) + { + FfxFloat32x4 v = SpdLoadIntermediate(localInvocationIndex, 0); + v = SpdReduceQuad(v); + // quad index 0 stores result + if (localInvocationIndex % 4 == 0) + { + SpdStore(FfxInt32x2(workGroupID.xy), v, mip, slice); + } + } +#endif +} + +void SpdDownsampleMips_6_7(FfxUInt32 x, FfxUInt32 y, FfxUInt32 mips, FfxUInt32 slice) +{ + FfxInt32x2 tex = FfxInt32x2(x * 4 + 0, y * 4 + 0); + FfxInt32x2 pix = FfxInt32x2(x * 2 + 0, y * 2 + 0); + FfxFloat32x4 v0 = SpdReduceLoad4(tex, slice); + SpdStore(pix, v0, 6, slice); + + tex = FfxInt32x2(x * 4 + 2, y * 4 + 0); + pix = FfxInt32x2(x * 2 + 1, y * 2 + 0); + FfxFloat32x4 v1 = SpdReduceLoad4(tex, slice); + SpdStore(pix, v1, 6, slice); + + tex = FfxInt32x2(x * 4 + 0, y * 4 + 2); + pix = FfxInt32x2(x * 2 + 0, y * 2 + 1); + FfxFloat32x4 v2 = SpdReduceLoad4(tex, slice); + SpdStore(pix, v2, 6, slice); + + tex = FfxInt32x2(x * 4 + 2, y * 4 + 2); + pix = FfxInt32x2(x * 2 + 1, y * 2 + 1); + FfxFloat32x4 v3 = SpdReduceLoad4(tex, slice); + SpdStore(pix, v3, 6, slice); + + if (mips <= 7) + return; + // no barrier needed, working on values only from the same thread + + FfxFloat32x4 v = SpdReduce4(v0, v1, v2, v3); + SpdStore(FfxInt32x2(x, y), v, 7, slice); + SpdStoreIntermediate(x, y, v); +} + +void SpdDownsampleNextFour(FfxUInt32 x, FfxUInt32 y, FfxUInt32x2 workGroupID, FfxUInt32 localInvocationIndex, FfxUInt32 baseMip, FfxUInt32 mips, FfxUInt32 slice) +{ + if (mips <= baseMip) + return; + ffxSpdWorkgroupShuffleBarrier(); + SpdDownsampleMip_2(x, y, workGroupID, localInvocationIndex, baseMip, slice); + + if (mips <= baseMip + 1) + return; + ffxSpdWorkgroupShuffleBarrier(); + SpdDownsampleMip_3(x, y, workGroupID, localInvocationIndex, baseMip + 1, slice); + + if (mips <= baseMip + 2) + return; + ffxSpdWorkgroupShuffleBarrier(); + SpdDownsampleMip_4(x, y, workGroupID, localInvocationIndex, baseMip + 2, slice); + + if (mips <= baseMip + 3) + return; + ffxSpdWorkgroupShuffleBarrier(); + SpdDownsampleMip_5(workGroupID, localInvocationIndex, baseMip + 3, slice); +} + +/// Downsamples a 64x64 tile based on the work group id. +/// If after downsampling it's the last active thread group, computes the remaining MIP levels. +/// +/// @param [in] workGroupID index of the work group / thread group +/// @param [in] localInvocationIndex index of the thread within the thread group in 1D +/// @param [in] mips the number of total MIP levels to compute for the input texture +/// @param [in] numWorkGroups the total number of dispatched work groups / thread groups for this slice +/// @param [in] slice the slice of the input texture +/// +/// @ingroup FfxGPUSpd +void SpdDownsample(FfxUInt32x2 workGroupID, FfxUInt32 localInvocationIndex, FfxUInt32 mips, FfxUInt32 numWorkGroups, FfxUInt32 slice) +{ + // compute MIP level 0 and 1 + FfxUInt32x2 sub_xy = ffxRemapForWaveReduction(localInvocationIndex % 64); + FfxUInt32 x = sub_xy.x + 8 * ((localInvocationIndex >> 6) % 2); + FfxUInt32 y = sub_xy.y + 8 * ((localInvocationIndex >> 7)); + SpdDownsampleMips_0_1(x, y, workGroupID, localInvocationIndex, mips, slice); + + // compute MIP level 2, 3, 4, 5 + SpdDownsampleNextFour(x, y, workGroupID, localInvocationIndex, 2, mips, slice); + + if (mips <= 6) + return; + + // increase the global atomic counter for the given slice and check if it's the last remaining thread group: + // terminate if not, continue if yes. + if (SpdExitWorkgroup(numWorkGroups, localInvocationIndex, slice)) + return; + + // reset the global atomic counter back to 0 for the next spd dispatch + SpdResetAtomicCounter(slice); + + // After mip 5 there is only a single workgroup left that downsamples the remaining up to 64x64 texels. + // compute MIP level 6 and 7 + SpdDownsampleMips_6_7(x, y, mips, slice); + + // compute MIP level 8, 9, 10, 11 + SpdDownsampleNextFour(x, y, FfxUInt32x2(0, 0), localInvocationIndex, 8, mips, slice); +} +/// Downsamples a 64x64 tile based on the work group id and work group offset. +/// If after downsampling it's the last active thread group, computes the remaining MIP levels. +/// +/// @param [in] workGroupID index of the work group / thread group +/// @param [in] localInvocationIndex index of the thread within the thread group in 1D +/// @param [in] mips the number of total MIP levels to compute for the input texture +/// @param [in] numWorkGroups the total number of dispatched work groups / thread groups for this slice +/// @param [in] slice the slice of the input texture +/// @param [in] workGroupOffset the work group offset. it's (0,0) in case the entire input texture is downsampled. +/// +/// @ingroup FfxGPUSpd +void SpdDownsample(FfxUInt32x2 workGroupID, FfxUInt32 localInvocationIndex, FfxUInt32 mips, FfxUInt32 numWorkGroups, FfxUInt32 slice, FfxUInt32x2 workGroupOffset) +{ + SpdDownsample(workGroupID + workGroupOffset, localInvocationIndex, mips, numWorkGroups, slice); +} + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +//============================================================================================================================== +// PACKED VERSION +//============================================================================================================================== + +#if FFX_HALF + +#if defined(FFX_GLSL) +#extension GL_EXT_shader_subgroup_extended_types_float16:require +#endif + +FfxFloat16x4 SpdReduceQuadH(FfxFloat16x4 v) +{ +#if defined(FFX_GLSL) && !defined(FFX_SPD_NO_WAVE_OPERATIONS) + FfxFloat16x4 v0 = v; + FfxFloat16x4 v1 = subgroupQuadSwapHorizontal(v); + FfxFloat16x4 v2 = subgroupQuadSwapVertical(v); + FfxFloat16x4 v3 = subgroupQuadSwapDiagonal(v); + return SpdReduce4H(v0, v1, v2, v3); +#elif defined(FFX_HLSL) && !defined(FFX_SPD_NO_WAVE_OPERATIONS) + // requires SM6.0 + FfxFloat16x4 v0 = v; + FfxFloat16x4 v1 = QuadReadAcrossX(v); + FfxFloat16x4 v2 = QuadReadAcrossY(v); + FfxFloat16x4 v3 = QuadReadAcrossDiagonal(v); + return SpdReduce4H(v0, v1, v2, v3); +/* + // if SM6.0 is not available, you can use the AMD shader intrinsics + // the AMD shader intrinsics are available in AMD GPU Services (AGS) library: + // https://gpuopen.com/amd-gpu-services-ags-library/ + // works for DX11 + FfxFloat16x4 v0 = v; + FfxFloat16x4 v1; + v1.x = AmdExtD3DShaderIntrinsics_SwizzleF(v.x, AmdExtD3DShaderIntrinsicsSwizzle_SwapX1); + v1.y = AmdExtD3DShaderIntrinsics_SwizzleF(v.y, AmdExtD3DShaderIntrinsicsSwizzle_SwapX1); + v1.z = AmdExtD3DShaderIntrinsics_SwizzleF(v.z, AmdExtD3DShaderIntrinsicsSwizzle_SwapX1); + v1.w = AmdExtD3DShaderIntrinsics_SwizzleF(v.w, AmdExtD3DShaderIntrinsicsSwizzle_SwapX1); + FfxFloat16x4 v2; + v2.x = AmdExtD3DShaderIntrinsics_SwizzleF(v.x, AmdExtD3DShaderIntrinsicsSwizzle_SwapX2); + v2.y = AmdExtD3DShaderIntrinsics_SwizzleF(v.y, AmdExtD3DShaderIntrinsicsSwizzle_SwapX2); + v2.z = AmdExtD3DShaderIntrinsics_SwizzleF(v.z, AmdExtD3DShaderIntrinsicsSwizzle_SwapX2); + v2.w = AmdExtD3DShaderIntrinsics_SwizzleF(v.w, AmdExtD3DShaderIntrinsicsSwizzle_SwapX2); + FfxFloat16x4 v3; + v3.x = AmdExtD3DShaderIntrinsics_SwizzleF(v.x, AmdExtD3DShaderIntrinsicsSwizzle_ReverseX4); + v3.y = AmdExtD3DShaderIntrinsics_SwizzleF(v.y, AmdExtD3DShaderIntrinsicsSwizzle_ReverseX4); + v3.z = AmdExtD3DShaderIntrinsics_SwizzleF(v.z, AmdExtD3DShaderIntrinsicsSwizzle_ReverseX4); + v3.w = AmdExtD3DShaderIntrinsics_SwizzleF(v.w, AmdExtD3DShaderIntrinsicsSwizzle_ReverseX4); + return SpdReduce4H(v0, v1, v2, v3); + */ +#endif + return FfxFloat16x4(0.0, 0.0, 0.0, 0.0); +} + +FfxFloat16x4 SpdReduceIntermediateH(FfxUInt32x2 i0, FfxUInt32x2 i1, FfxUInt32x2 i2, FfxUInt32x2 i3) +{ + FfxFloat16x4 v0 = SpdLoadIntermediateH(i0.x, i0.y); + FfxFloat16x4 v1 = SpdLoadIntermediateH(i1.x, i1.y); + FfxFloat16x4 v2 = SpdLoadIntermediateH(i2.x, i2.y); + FfxFloat16x4 v3 = SpdLoadIntermediateH(i3.x, i3.y); + return SpdReduce4H(v0, v1, v2, v3); +} + +FfxFloat16x4 SpdReduceLoad4H(FfxUInt32x2 i0, FfxUInt32x2 i1, FfxUInt32x2 i2, FfxUInt32x2 i3, FfxUInt32 slice) +{ + FfxFloat16x4 v0 = SpdLoadH(FfxInt32x2(i0), slice); + FfxFloat16x4 v1 = SpdLoadH(FfxInt32x2(i1), slice); + FfxFloat16x4 v2 = SpdLoadH(FfxInt32x2(i2), slice); + FfxFloat16x4 v3 = SpdLoadH(FfxInt32x2(i3), slice); + return SpdReduce4H(v0, v1, v2, v3); +} + +FfxFloat16x4 SpdReduceLoad4H(FfxUInt32x2 base, FfxUInt32 slice) +{ + return SpdReduceLoad4H(FfxUInt32x2(base + FfxUInt32x2(0, 0)), FfxUInt32x2(base + FfxUInt32x2(0, 1)), FfxUInt32x2(base + FfxUInt32x2(1, 0)), FfxUInt32x2(base + FfxUInt32x2(1, 1)), slice); +} + +FfxFloat16x4 SpdReduceLoadSourceImage4H(FfxUInt32x2 i0, FfxUInt32x2 i1, FfxUInt32x2 i2, FfxUInt32x2 i3, FfxUInt32 slice) +{ + FfxFloat16x4 v0 = SpdLoadSourceImageH(FfxInt32x2(i0), slice); + FfxFloat16x4 v1 = SpdLoadSourceImageH(FfxInt32x2(i1), slice); + FfxFloat16x4 v2 = SpdLoadSourceImageH(FfxInt32x2(i2), slice); + FfxFloat16x4 v3 = SpdLoadSourceImageH(FfxInt32x2(i3), slice); + return SpdReduce4H(v0, v1, v2, v3); +} + +FfxFloat16x4 SpdReduceLoadSourceImageH(FfxUInt32x2 base, FfxUInt32 slice) +{ +#if defined(SPD_LINEAR_SAMPLER) + return SpdLoadSourceImageH(FfxInt32x2(base), slice); +#else + return SpdReduceLoadSourceImage4H(FfxUInt32x2(base + FfxUInt32x2(0, 0)), FfxUInt32x2(base + FfxUInt32x2(0, 1)), FfxUInt32x2(base + FfxUInt32x2(1, 0)), FfxUInt32x2(base + FfxUInt32x2(1, 1)), slice); +#endif +} + +void SpdDownsampleMips_0_1_IntrinsicsH(FfxUInt32 x, FfxUInt32 y, FfxUInt32x2 workGroupID, FfxUInt32 localInvocationIndex, FfxUInt32 mips, FfxUInt32 slice) +{ + FfxFloat16x4 v[4]; + + FfxInt32x2 tex = FfxInt32x2(workGroupID.xy * 64) + FfxInt32x2(x * 2, y * 2); + FfxInt32x2 pix = FfxInt32x2(workGroupID.xy * 32) + FfxInt32x2(x, y); + v[0] = SpdReduceLoadSourceImageH(tex, slice); + SpdStoreH(pix, v[0], 0, slice); + + tex = FfxInt32x2(workGroupID.xy * 64) + FfxInt32x2(x * 2 + 32, y * 2); + pix = FfxInt32x2(workGroupID.xy * 32) + FfxInt32x2(x + 16, y); + v[1] = SpdReduceLoadSourceImageH(tex, slice); + SpdStoreH(pix, v[1], 0, slice); + + tex = FfxInt32x2(workGroupID.xy * 64) + FfxInt32x2(x * 2, y * 2 + 32); + pix = FfxInt32x2(workGroupID.xy * 32) + FfxInt32x2(x, y + 16); + v[2] = SpdReduceLoadSourceImageH(tex, slice); + SpdStoreH(pix, v[2], 0, slice); + + tex = FfxInt32x2(workGroupID.xy * 64) + FfxInt32x2(x * 2 + 32, y * 2 + 32); + pix = FfxInt32x2(workGroupID.xy * 32) + FfxInt32x2(x + 16, y + 16); + v[3] = SpdReduceLoadSourceImageH(tex, slice); + SpdStoreH(pix, v[3], 0, slice); + + if (mips <= 1) + return; + + v[0] = SpdReduceQuadH(v[0]); + v[1] = SpdReduceQuadH(v[1]); + v[2] = SpdReduceQuadH(v[2]); + v[3] = SpdReduceQuadH(v[3]); + + if ((localInvocationIndex % 4) == 0) + { + SpdStoreH(FfxInt32x2(workGroupID.xy * 16) + FfxInt32x2(x / 2, y / 2), v[0], 1, slice); + SpdStoreIntermediateH(x / 2, y / 2, v[0]); + + SpdStoreH(FfxInt32x2(workGroupID.xy * 16) + FfxInt32x2(x / 2 + 8, y / 2), v[1], 1, slice); + SpdStoreIntermediateH(x / 2 + 8, y / 2, v[1]); + + SpdStoreH(FfxInt32x2(workGroupID.xy * 16) + FfxInt32x2(x / 2, y / 2 + 8), v[2], 1, slice); + SpdStoreIntermediateH(x / 2, y / 2 + 8, v[2]); + + SpdStoreH(FfxInt32x2(workGroupID.xy * 16) + FfxInt32x2(x / 2 + 8, y / 2 + 8), v[3], 1, slice); + SpdStoreIntermediateH(x / 2 + 8, y / 2 + 8, v[3]); + } +} + +void SpdDownsampleMips_0_1_LDSH(FfxUInt32 x, FfxUInt32 y, FfxUInt32x2 workGroupID, FfxUInt32 localInvocationIndex, FfxUInt32 mips, FfxUInt32 slice) +{ + FfxFloat16x4 v[4]; + + FfxInt32x2 tex = FfxInt32x2(workGroupID.xy * 64) + FfxInt32x2(x * 2, y * 2); + FfxInt32x2 pix = FfxInt32x2(workGroupID.xy * 32) + FfxInt32x2(x, y); + v[0] = SpdReduceLoadSourceImageH(tex, slice); + SpdStoreH(pix, v[0], 0, slice); + + tex = FfxInt32x2(workGroupID.xy * 64) + FfxInt32x2(x * 2 + 32, y * 2); + pix = FfxInt32x2(workGroupID.xy * 32) + FfxInt32x2(x + 16, y); + v[1] = SpdReduceLoadSourceImageH(tex, slice); + SpdStoreH(pix, v[1], 0, slice); + + tex = FfxInt32x2(workGroupID.xy * 64) + FfxInt32x2(x * 2, y * 2 + 32); + pix = FfxInt32x2(workGroupID.xy * 32) + FfxInt32x2(x, y + 16); + v[2] = SpdReduceLoadSourceImageH(tex, slice); + SpdStoreH(pix, v[2], 0, slice); + + tex = FfxInt32x2(workGroupID.xy * 64) + FfxInt32x2(x * 2 + 32, y * 2 + 32); + pix = FfxInt32x2(workGroupID.xy * 32) + FfxInt32x2(x + 16, y + 16); + v[3] = SpdReduceLoadSourceImageH(tex, slice); + SpdStoreH(pix, v[3], 0, slice); + + if (mips <= 1) + return; + + for (FfxInt32 i = 0; i < 4; i++) + { + SpdStoreIntermediateH(x, y, v[i]); + ffxSpdWorkgroupShuffleBarrier(); + if (localInvocationIndex < 64) + { + v[i] = SpdReduceIntermediateH(FfxUInt32x2(x * 2 + 0, y * 2 + 0), FfxUInt32x2(x * 2 + 1, y * 2 + 0), FfxUInt32x2(x * 2 + 0, y * 2 + 1), FfxUInt32x2(x * 2 + 1, y * 2 + 1)); + SpdStoreH(FfxInt32x2(workGroupID.xy * 16) + FfxInt32x2(x + (i % 2) * 8, y + (i / 2) * 8), v[i], 1, slice); + } + ffxSpdWorkgroupShuffleBarrier(); + } + + if (localInvocationIndex < 64) + { + SpdStoreIntermediateH(x + 0, y + 0, v[0]); + SpdStoreIntermediateH(x + 8, y + 0, v[1]); + SpdStoreIntermediateH(x + 0, y + 8, v[2]); + SpdStoreIntermediateH(x + 8, y + 8, v[3]); + } +} + +void SpdDownsampleMips_0_1H(FfxUInt32 x, FfxUInt32 y, FfxUInt32x2 workGroupID, FfxUInt32 localInvocationIndex, FfxUInt32 mips, FfxUInt32 slice) +{ +#if defined(FFX_SPD_NO_WAVE_OPERATIONS) + SpdDownsampleMips_0_1_LDSH(x, y, workGroupID, localInvocationIndex, mips, slice); +#else + SpdDownsampleMips_0_1_IntrinsicsH(x, y, workGroupID, localInvocationIndex, mips, slice); +#endif +} + + +void SpdDownsampleMip_2H(FfxUInt32 x, FfxUInt32 y, FfxUInt32x2 workGroupID, FfxUInt32 localInvocationIndex, FfxUInt32 mip, FfxUInt32 slice) +{ +#if defined(FFX_SPD_NO_WAVE_OPERATIONS) + if (localInvocationIndex < 64) + { + FfxFloat16x4 v = SpdReduceIntermediateH(FfxUInt32x2(x * 2 + 0, y * 2 + 0), FfxUInt32x2(x * 2 + 1, y * 2 + 0), FfxUInt32x2(x * 2 + 0, y * 2 + 1), FfxUInt32x2(x * 2 + 1, y * 2 + 1)); + SpdStoreH(FfxInt32x2(workGroupID.xy * 8) + FfxInt32x2(x, y), v, mip, slice); + // store to LDS, try to reduce bank conflicts + // x 0 x 0 x 0 x 0 x 0 x 0 x 0 x 0 + // 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + // 0 x 0 x 0 x 0 x 0 x 0 x 0 x 0 x + // 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + // x 0 x 0 x 0 x 0 x 0 x 0 x 0 x 0 + // ... + // x 0 x 0 x 0 x 0 x 0 x 0 x 0 x 0 + SpdStoreIntermediateH(x * 2 + y % 2, y * 2, v); + } +#else + FfxFloat16x4 v = SpdLoadIntermediateH(x, y); + v = SpdReduceQuadH(v); + // quad index 0 stores result + if (localInvocationIndex % 4 == 0) + { + SpdStoreH(FfxInt32x2(workGroupID.xy * 8) + FfxInt32x2(x / 2, y / 2), v, mip, slice); + SpdStoreIntermediateH(x + (y / 2) % 2, y, v); + } +#endif +} + +void SpdDownsampleMip_3H(FfxUInt32 x, FfxUInt32 y, FfxUInt32x2 workGroupID, FfxUInt32 localInvocationIndex, FfxUInt32 mip, FfxUInt32 slice) +{ +#if defined(FFX_SPD_NO_WAVE_OPERATIONS) + if (localInvocationIndex < 16) + { + // x 0 x 0 + // 0 0 0 0 + // 0 x 0 x + // 0 0 0 0 + FfxFloat16x4 v = + SpdReduceIntermediateH(FfxUInt32x2(x * 4 + 0 + 0, y * 4 + 0), FfxUInt32x2(x * 4 + 2 + 0, y * 4 + 0), FfxUInt32x2(x * 4 + 0 + 1, y * 4 + 2), FfxUInt32x2(x * 4 + 2 + 1, y * 4 + 2)); + SpdStoreH(FfxInt32x2(workGroupID.xy * 4) + FfxInt32x2(x, y), v, mip, slice); + // store to LDS + // x 0 0 0 x 0 0 0 x 0 0 0 x 0 0 0 + // 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + // 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + // 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + // 0 x 0 0 0 x 0 0 0 x 0 0 0 x 0 0 + // ... + // 0 0 x 0 0 0 x 0 0 0 x 0 0 0 x 0 + // ... + // 0 0 0 x 0 0 0 x 0 0 0 x 0 0 0 x + // ... + SpdStoreIntermediateH(x * 4 + y, y * 4, v); + } +#else + if (localInvocationIndex < 64) + { + FfxFloat16x4 v = SpdLoadIntermediateH(x * 2 + y % 2, y * 2); + v = SpdReduceQuadH(v); + // quad index 0 stores result + if (localInvocationIndex % 4 == 0) + { + SpdStoreH(FfxInt32x2(workGroupID.xy * 4) + FfxInt32x2(x / 2, y / 2), v, mip, slice); + SpdStoreIntermediateH(x * 2 + y / 2, y * 2, v); + } + } +#endif +} + +void SpdDownsampleMip_4H(FfxUInt32 x, FfxUInt32 y, FfxUInt32x2 workGroupID, FfxUInt32 localInvocationIndex, FfxUInt32 mip, FfxUInt32 slice) +{ +#if defined(FFX_SPD_NO_WAVE_OPERATIONS) + if (localInvocationIndex < 4) + { + // x 0 0 0 x 0 0 0 + // ... + // 0 x 0 0 0 x 0 0 + FfxFloat16x4 v = SpdReduceIntermediateH(FfxUInt32x2(x * 8 + 0 + 0 + y * 2, y * 8 + 0), + FfxUInt32x2(x * 8 + 4 + 0 + y * 2, y * 8 + 0), + FfxUInt32x2(x * 8 + 0 + 1 + y * 2, y * 8 + 4), + FfxUInt32x2(x * 8 + 4 + 1 + y * 2, y * 8 + 4)); + SpdStoreH(FfxInt32x2(workGroupID.xy * 2) + FfxInt32x2(x, y), v, mip, slice); + // store to LDS + // x x x x 0 ... + // 0 ... + SpdStoreIntermediateH(x + y * 2, 0, v); + } +#else + if (localInvocationIndex < 16) + { + FfxFloat16x4 v = SpdLoadIntermediateH(x * 4 + y, y * 4); + v = SpdReduceQuadH(v); + // quad index 0 stores result + if (localInvocationIndex % 4 == 0) + { + SpdStoreH(FfxInt32x2(workGroupID.xy * 2) + FfxInt32x2(x / 2, y / 2), v, mip, slice); + SpdStoreIntermediateH(x / 2 + y, 0, v); + } + } +#endif +} + +void SpdDownsampleMip_5H(FfxUInt32x2 workGroupID, FfxUInt32 localInvocationIndex, FfxUInt32 mip, FfxUInt32 slice) +{ +#if defined(FFX_SPD_NO_WAVE_OPERATIONS) + if (localInvocationIndex < 1) + { + // x x x x 0 ... + // 0 ... + FfxFloat16x4 v = SpdReduceIntermediateH(FfxUInt32x2(0, 0), FfxUInt32x2(1, 0), FfxUInt32x2(2, 0), FfxUInt32x2(3, 0)); + SpdStoreH(FfxInt32x2(workGroupID.xy), v, mip, slice); + } +#else + if (localInvocationIndex < 4) + { + FfxFloat16x4 v = SpdLoadIntermediateH(localInvocationIndex, 0); + v = SpdReduceQuadH(v); + // quad index 0 stores result + if (localInvocationIndex % 4 == 0) + { + SpdStoreH(FfxInt32x2(workGroupID.xy), v, mip, slice); + } + } +#endif +} + +void SpdDownsampleMips_6_7H(FfxUInt32 x, FfxUInt32 y, FfxUInt32 mips, FfxUInt32 slice) +{ + FfxInt32x2 tex = FfxInt32x2(x * 4 + 0, y * 4 + 0); + FfxInt32x2 pix = FfxInt32x2(x * 2 + 0, y * 2 + 0); + FfxFloat16x4 v0 = SpdReduceLoad4H(tex, slice); + SpdStoreH(pix, v0, 6, slice); + + tex = FfxInt32x2(x * 4 + 2, y * 4 + 0); + pix = FfxInt32x2(x * 2 + 1, y * 2 + 0); + FfxFloat16x4 v1 = SpdReduceLoad4H(tex, slice); + SpdStoreH(pix, v1, 6, slice); + + tex = FfxInt32x2(x * 4 + 0, y * 4 + 2); + pix = FfxInt32x2(x * 2 + 0, y * 2 + 1); + FfxFloat16x4 v2 = SpdReduceLoad4H(tex, slice); + SpdStoreH(pix, v2, 6, slice); + + tex = FfxInt32x2(x * 4 + 2, y * 4 + 2); + pix = FfxInt32x2(x * 2 + 1, y * 2 + 1); + FfxFloat16x4 v3 = SpdReduceLoad4H(tex, slice); + SpdStoreH(pix, v3, 6, slice); + + if (mips < 8) + return; + // no barrier needed, working on values only from the same thread + + FfxFloat16x4 v = SpdReduce4H(v0, v1, v2, v3); + SpdStoreH(FfxInt32x2(x, y), v, 7, slice); + SpdStoreIntermediateH(x, y, v); +} + +void SpdDownsampleNextFourH(FfxUInt32 x, FfxUInt32 y, FfxUInt32x2 workGroupID, FfxUInt32 localInvocationIndex, FfxUInt32 baseMip, FfxUInt32 mips, FfxUInt32 slice) +{ + if (mips <= baseMip) + return; + ffxSpdWorkgroupShuffleBarrier(); + SpdDownsampleMip_2H(x, y, workGroupID, localInvocationIndex, baseMip, slice); + + if (mips <= baseMip + 1) + return; + ffxSpdWorkgroupShuffleBarrier(); + SpdDownsampleMip_3H(x, y, workGroupID, localInvocationIndex, baseMip + 1, slice); + + if (mips <= baseMip + 2) + return; + ffxSpdWorkgroupShuffleBarrier(); + SpdDownsampleMip_4H(x, y, workGroupID, localInvocationIndex, baseMip + 2, slice); + + if (mips <= baseMip + 3) + return; + ffxSpdWorkgroupShuffleBarrier(); + SpdDownsampleMip_5H(workGroupID, localInvocationIndex, baseMip + 3, slice); +} + +/// Downsamples a 64x64 tile based on the work group id and work group offset. +/// If after downsampling it's the last active thread group, computes the remaining MIP levels. +/// Uses half types. +/// +/// @param [in] workGroupID index of the work group / thread group +/// @param [in] localInvocationIndex index of the thread within the thread group in 1D +/// @param [in] mips the number of total MIP levels to compute for the input texture +/// @param [in] numWorkGroups the total number of dispatched work groups / thread groups for this slice +/// @param [in] slice the slice of the input texture +/// +/// @ingroup FfxGPUSpd +void SpdDownsampleH(FfxUInt32x2 workGroupID, FfxUInt32 localInvocationIndex, FfxUInt32 mips, FfxUInt32 numWorkGroups, FfxUInt32 slice) +{ + FfxUInt32x2 sub_xy = ffxRemapForWaveReduction(localInvocationIndex % 64); + FfxUInt32 x = sub_xy.x + 8 * ((localInvocationIndex >> 6) % 2); + FfxUInt32 y = sub_xy.y + 8 * ((localInvocationIndex >> 7)); + + // compute MIP level 0 and 1 + SpdDownsampleMips_0_1H(x, y, workGroupID, localInvocationIndex, mips, slice); + + // compute MIP level 2, 3, 4, 5 + SpdDownsampleNextFourH(x, y, workGroupID, localInvocationIndex, 2, mips, slice); + + if (mips < 7) + return; + + // increase the global atomic counter for the given slice and check if it's the last remaining thread group: + // terminate if not, continue if yes. + if (SpdExitWorkgroup(numWorkGroups, localInvocationIndex, slice)) + return; + + // reset the global atomic counter back to 0 for the next spd dispatch + SpdResetAtomicCounter(slice); + + // After mip 5 there is only a single workgroup left that downsamples the remaining up to 64x64 texels. + // compute MIP level 6 and 7 + SpdDownsampleMips_6_7H(x, y, mips, slice); + + // compute MIP level 8, 9, 10, 11 + SpdDownsampleNextFourH(x, y, FfxUInt32x2(0, 0), localInvocationIndex, 8, mips, slice); +} + +/// Downsamples a 64x64 tile based on the work group id and work group offset. +/// If after downsampling it's the last active thread group, computes the remaining MIP levels. +/// Uses half types. +/// +/// @param [in] workGroupID index of the work group / thread group +/// @param [in] localInvocationIndex index of the thread within the thread group in 1D +/// @param [in] mips the number of total MIP levels to compute for the input texture +/// @param [in] numWorkGroups the total number of dispatched work groups / thread groups for this slice +/// @param [in] slice the slice of the input texture +/// @param [in] workGroupOffset the work group offset. it's (0,0) in case the entire input texture is downsampled. +/// +/// @ingroup FfxGPUSpd +void SpdDownsampleH(FfxUInt32x2 workGroupID, FfxUInt32 localInvocationIndex, FfxUInt32 mips, FfxUInt32 numWorkGroups, FfxUInt32 slice, FfxUInt32x2 workGroupOffset) +{ + SpdDownsampleH(workGroupID + workGroupOffset, localInvocationIndex, mips, numWorkGroups, slice); +} + +#endif // #if FFX_HALF +#endif // #if defined(FFX_GPU) diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/spd/ffx_spd_callbacks_glsl.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/spd/ffx_spd_callbacks_glsl.h new file mode 100644 index 00000000..55244eb4 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/spd/ffx_spd_callbacks_glsl.h @@ -0,0 +1,181 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#include "ffx_spd_resources.h" + +#if defined(FFX_GPU) +#include "ffx_core.h" + +#ifndef FFX_PREFER_WAVE64 +#define FFX_PREFER_WAVE64 +#endif // #ifndef FFX_PREFER_WAVE64 + +#if defined(FFX_SPD_BIND_CB_SPD) + layout (set = 0, binding = FFX_SPD_BIND_CB_SPD, std140) uniform cbFSR1_t + { + FfxUInt32 mips; + FfxUInt32 numWorkGroups; + FfxUInt32x2 workGroupOffset; + FfxFloat32x2 invInputSize; // Only used for linear sampling mode + FfxFloat32x2 padding; + } cbFSR1; +#endif + + +FfxUInt32 Mips() +{ + return cbFSR1.mips; +} + +FfxUInt32 NumWorkGroups() +{ + return cbFSR1.numWorkGroups; +} + +FfxUInt32x2 WorkGroupOffset() +{ + return cbFSR1.workGroupOffset; +} + +FfxFloat32x2 InvInputSize() +{ + return cbFSR1.invInputSize; +} + +layout (set = 0, binding = 1000) uniform sampler s_LinearClamp; + +// SRVs +#if defined FFX_SPD_BIND_SRV_INPUT_DOWNSAMPLE_SRC + layout (set = 0, binding = FFX_SPD_BIND_SRV_INPUT_DOWNSAMPLE_SRC) uniform texture2DArray r_input_downsample_src; +#endif + +// UAV declarations +#if defined FFX_SPD_BIND_UAV_INTERNAL_GLOBAL_ATOMIC + layout (set = 0, binding = FFX_SPD_BIND_UAV_INTERNAL_GLOBAL_ATOMIC, std430) coherent buffer rw_internal_global_atomic_t + { + FfxUInt32 counter[6]; + } rw_internal_global_atomic; +#endif + +#if defined FFX_SPD_BIND_UAV_INPUT_DOWNSAMPLE_SRC_MID_MIPMAP + layout (set = 0, binding = FFX_SPD_BIND_UAV_INPUT_DOWNSAMPLE_SRC_MID_MIPMAP, rgba32f) coherent uniform image2DArray rw_input_downsample_src_mid_mip; +#endif + +#if defined FFX_SPD_BIND_UAV_INPUT_DOWNSAMPLE_SRC_MIPS + layout (set = 0, binding = FFX_SPD_BIND_UAV_INPUT_DOWNSAMPLE_SRC_MIPS, rgba32f) uniform image2DArray rw_input_downsample_src_mips[SPD_MAX_MIP_LEVELS+1]; +#endif + +#if FFX_HALF + +#if defined(FFX_SPD_BIND_SRV_INPUT_DOWNSAMPLE_SRC) + FfxFloat16x4 SampleSrcImageH(FfxFloat32x2 uv, FfxUInt32 slice) + { + FfxFloat32x2 textureCoord = FfxFloat32x2(uv) * InvInputSize() + InvInputSize(); + FfxFloat32x4 result = textureLod(sampler2DArray(r_input_downsample_src, s_LinearClamp), FfxFloat32x3(textureCoord, slice), 0); + return FfxFloat16x4(ffxSrgbFromLinear(result.x), ffxSrgbFromLinear(result.y), ffxSrgbFromLinear(result.z), result.w); + } +#endif // defined(FFX_SPD_BIND_SRV_INPUT_DOWNSAMPLE_SRC) + +#if defined(FFX_SPD_BIND_UAV_INPUT_DOWNSAMPLE_SRC_MIPS) + FfxFloat16x4 LoadSrcImageH(FfxFloat32x2 uv, FfxUInt32 slice) + { + return FfxFloat16x4(imageLoad(rw_input_downsample_src_mips[0], FfxInt32x3(uv, slice))); + } +#endif // defined(FFX_SPD_BIND_UAV_INPUT_DOWNSAMPLE_SRC_MIPS) + +#if defined(FFX_SPD_BIND_UAV_INPUT_DOWNSAMPLE_SRC_MIPS) + void StoreSrcMipH(FfxFloat16x4 value, FfxInt32x2 uv, FfxUInt32 slice, FfxUInt32 mip) + { + imageStore(rw_input_downsample_src_mips[mip], FfxInt32x3(uv, slice), FfxFloat32x4(value)); + } +#endif // defined(FFX_SPD_BIND_UAV_INPUT_DOWNSAMPLE_SRC_MIPS) + +#if defined(FFX_SPD_BIND_UAV_INPUT_DOWNSAMPLE_SRC_MID_MIPMAP) + FfxFloat16x4 LoadMidMipH(FfxInt32x2 uv, FfxUInt32 slice) + { + return FfxFloat16x4(imageLoad(rw_input_downsample_src_mid_mip, FfxInt32x3(uv, slice))); + } +#endif // defined(FFX_SPD_BIND_UAV_INPUT_DOWNSAMPLE_SRC_MID_MIPMAP) + +#if defined(FFX_SPD_BIND_UAV_INPUT_DOWNSAMPLE_SRC_MID_MIPMAP) + void StoreMidMipH(FfxFloat16x4 value, FfxInt32x2 uv, FfxUInt32 slice) + { + imageStore(rw_input_downsample_src_mid_mip, FfxInt32x3(uv, slice), FfxFloat32x4(value));\ + } +#endif // defined(FFX_SPD_BIND_UAV_INPUT_DOWNSAMPLE_SRC_MID_MIPMAP) + +#else // FFX_HALF + +#if defined(FFX_SPD_BIND_SRV_INPUT_DOWNSAMPLE_SRC) + FfxFloat32x4 SampleSrcImage(FfxInt32x2 uv, FfxUInt32 slice) + { + FfxFloat32x2 textureCoord = FfxFloat32x2(uv) * InvInputSize() + InvInputSize(); + FfxFloat32x4 result = textureLod(sampler2DArray(r_input_downsample_src, s_LinearClamp), FfxFloat32x3(textureCoord, slice), 0); + return FfxFloat32x4(ffxSrgbFromLinear(result.x), ffxSrgbFromLinear(result.y), ffxSrgbFromLinear(result.z), result.w); + } +#endif // defined(FFX_SPD_BIND_SRV_INPUT_DOWNSAMPLE_SRC) + +#if defined(FFX_SPD_BIND_UAV_INPUT_DOWNSAMPLE_SRC_MIPS) + FfxFloat32x4 LoadSrcImage(FfxInt32x2 uv, FfxUInt32 slice) + { + return imageLoad(rw_input_downsample_src_mips[0], FfxInt32x3(uv, slice)); + } +#endif // defined(FFX_SPD_BIND_UAV_INPUT_DOWNSAMPLE_SRC_MIPS) + +#if defined(FFX_SPD_BIND_UAV_INPUT_DOWNSAMPLE_SRC_MIPS) + void StoreSrcMip(FfxFloat32x4 value, FfxInt32x2 uv, FfxUInt32 slice, FfxUInt32 mip) + { + imageStore(rw_input_downsample_src_mips[mip], FfxInt32x3(uv, slice), value); + } +#endif // defined(FFX_SPD_BIND_UAV_INPUT_DOWNSAMPLE_SRC_MIPS) + +#if defined(FFX_SPD_BIND_UAV_INPUT_DOWNSAMPLE_SRC_MID_MIPMAP) + FfxFloat32x4 LoadMidMip(FfxInt32x2 uv, FfxUInt32 slice) + { + return imageLoad(rw_input_downsample_src_mid_mip, FfxInt32x3(uv, slice)); + } +#endif // defined(FFX_SPD_BIND_UAV_INPUT_DOWNSAMPLE_SRC_MID_MIPMAP) + +#if defined(FFX_SPD_BIND_UAV_INPUT_DOWNSAMPLE_SRC_MID_MIPMAP) + void StoreMidMip(FfxFloat32x4 value, FfxInt32x2 uv, FfxUInt32 slice) + { + imageStore(rw_input_downsample_src_mid_mip, FfxInt32x3(uv, slice), value); + } +#endif // defined(FFX_SPD_BIND_UAV_INPUT_DOWNSAMPLE_SRC_MID_MIPMAP) + +#endif // FFX_HALF + +#if defined(FFX_SPD_BIND_UAV_INTERNAL_GLOBAL_ATOMIC) +void IncreaseAtomicCounter(FFX_PARAMETER_IN FfxUInt32 slice, FFX_PARAMETER_INOUT FfxUInt32 counter) +{ + counter = atomicAdd(rw_internal_global_atomic.counter[slice], 1); +} +#endif // defined(FFX_SPD_BIND_UAV_INTERNAL_GLOBAL_ATOMIC) + +#if defined(FFX_SPD_BIND_UAV_INTERNAL_GLOBAL_ATOMIC) +void ResetAtomicCounter(FFX_PARAMETER_IN FfxUInt32 slice) +{ + rw_internal_global_atomic.counter[slice] = 0; +} +#endif // defined(FFX_SPD_BIND_UAV_INTERNAL_GLOBAL_ATOMIC) + +#endif // #if defined(FFX_GPU) diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/spd/ffx_spd_callbacks_hlsl.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/spd/ffx_spd_callbacks_hlsl.h new file mode 100644 index 00000000..d86f66ff --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/spd/ffx_spd_callbacks_hlsl.h @@ -0,0 +1,218 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#include "ffx_spd_resources.h" + +#if defined(FFX_GPU) +#ifdef __hlsl_dx_compiler +#pragma dxc diagnostic push +#pragma dxc diagnostic ignored "-Wambig-lit-shift" +#endif //__hlsl_dx_compiler +#include "ffx_core.h" +#ifdef __hlsl_dx_compiler +#pragma dxc diagnostic pop +#endif //__hlsl_dx_compiler + +#ifndef FFX_PREFER_WAVE64 +#define FFX_PREFER_WAVE64 +#endif // #ifndef FFX_PREFER_WAVE64 + +#pragma warning(disable: 3205) // conversion from larger type to smaller + +#define FFX_DECLARE_SRV_REGISTER(regIndex) t##regIndex +#define FFX_DECLARE_UAV_REGISTER(regIndex) u##regIndex +#define FFX_DECLARE_CB_REGISTER(regIndex) b##regIndex +#define FFX_SPD_DECLARE_SRV(regIndex) register(FFX_DECLARE_SRV_REGISTER(regIndex)) +#define FFX_SPD_DECLARE_UAV(regIndex) register(FFX_DECLARE_UAV_REGISTER(regIndex)) +#define FFX_SPD_DECLARE_CB(regIndex) register(FFX_DECLARE_CB_REGISTER(regIndex)) + +#if defined(FFX_SPD_BIND_CB_SPD) + cbuffer cbSPD : FFX_SPD_DECLARE_CB(FFX_SPD_BIND_CB_SPD) + { + FfxUInt32 mips; + FfxUInt32 numWorkGroups; + FfxUInt32x2 workGroupOffset; + FfxFloat32x2 invInputSize; // Only used for linear sampling mode + FfxFloat32x2 padding; + + #define FFX_SPD_CONSTANT_BUFFER_1_SIZE 8 // Number of 32-bit values. This must be kept in sync with the cbSPD size. + }; +#else + #define mips 0 + #define numWorkGroups 0 + #define workGroupOffset 0 + #define invInputSize 0 + #define padding 0 +#endif + +#define FFX_SPD_ROOTSIG_STRINGIFY(p) FFX_SPD_ROOTSIG_STR(p) +#define FFX_SPD_ROOTSIG_STR(p) #p +#define FFX_SPD_ROOTSIG [RootSignature( "DescriptorTable(UAV(u0, numDescriptors = " FFX_SPD_ROOTSIG_STRINGIFY(FFX_SPD_RESOURCE_IDENTIFIER_COUNT) ")), " \ + "DescriptorTable(SRV(t0, numDescriptors = " FFX_SPD_ROOTSIG_STRINGIFY(FFX_SPD_RESOURCE_IDENTIFIER_COUNT) ")), " \ + "CBV(b0), " \ + "StaticSampler(s0, filter = FILTER_MIN_MAG_LINEAR_MIP_POINT, " \ + "addressU = TEXTURE_ADDRESS_CLAMP, " \ + "addressV = TEXTURE_ADDRESS_CLAMP, " \ + "addressW = TEXTURE_ADDRESS_CLAMP, " \ + "comparisonFunc = COMPARISON_NEVER, " \ + "borderColor = STATIC_BORDER_COLOR_TRANSPARENT_BLACK)" )] + +#if defined(FFX_SPD_EMBED_ROOTSIG) +#define FFX_SPD_EMBED_ROOTSIG_CONTENT FFX_SPD_ROOTSIG +#else +#define FFX_SPD_EMBED_ROOTSIG_CONTENT +#endif // #if FFX_SPD_EMBED_ROOTSIG + +FfxUInt32 Mips() +{ + return mips; +} + +FfxUInt32 NumWorkGroups() +{ + return numWorkGroups; +} + +FfxUInt32x2 WorkGroupOffset() +{ + return workGroupOffset; +} + +FfxFloat32x2 InvInputSize() +{ + return invInputSize; +} + +SamplerState s_LinearClamp : register(s0); + + // SRVs + #if defined(FFX_SPD_BIND_SRV_INPUT_DOWNSAMPLE_SRC) + Texture2DArray r_input_downsample_src : FFX_SPD_DECLARE_SRV(FFX_SPD_BIND_SRV_INPUT_DOWNSAMPLE_SRC); + #endif + + // UAV declarations + #if defined(FFX_SPD_BIND_UAV_INTERNAL_GLOBAL_ATOMIC) + struct SpdGlobalAtomicBuffer { FfxUInt32 counter[6]; }; + globallycoherent RWStructuredBuffer rw_internal_global_atomic : FFX_SPD_DECLARE_UAV(FFX_SPD_BIND_UAV_INTERNAL_GLOBAL_ATOMIC); + #endif + #if defined(FFX_SPD_BIND_UAV_INPUT_DOWNSAMPLE_SRC_MID_MIPMAP) + globallycoherent RWTexture2DArray rw_input_downsample_src_mid_mip : FFX_SPD_DECLARE_UAV(FFX_SPD_BIND_UAV_INPUT_DOWNSAMPLE_SRC_MID_MIPMAP); + #endif + #if defined(FFX_SPD_BIND_UAV_INPUT_DOWNSAMPLE_SRC_MIPS) + RWTexture2DArray rw_input_downsample_src_mips[SPD_MAX_MIP_LEVELS+1] : FFX_SPD_DECLARE_UAV(FFX_SPD_BIND_UAV_INPUT_DOWNSAMPLE_SRC_MIPS); + #endif + +#if FFX_HALF + +#if defined(FFX_SPD_BIND_SRV_INPUT_DOWNSAMPLE_SRC) + FfxFloat16x4 SampleSrcImageH(FfxFloat32x2 uv, FfxUInt32 slice) + { + FfxFloat32x2 textureCoord = FfxFloat32x2(uv) * InvInputSize() + InvInputSize(); + FfxFloat32x4 result = r_input_downsample_src.SampleLevel(s_LinearClamp, FfxFloat32x3(textureCoord, slice), 0); + return FfxFloat16x4(ffxSrgbFromLinear(result.x), ffxSrgbFromLinear(result.y), ffxSrgbFromLinear(result.z), result.w); + } + #endif // defined(FFX_SPD_BIND_SRV_INPUT_DOWNSAMPLE_SRC) + +#if defined(FFX_SPD_BIND_UAV_INPUT_DOWNSAMPLE_SRC_MIPS) + FfxFloat16x4 LoadSrcImageH(FfxFloat32x2 uv, FfxUInt32 slice) + { + return FfxFloat16x4(rw_input_downsample_src_mips[0][FfxUInt32x3(uv, slice)]); + } +#endif // defined(FFX_SPD_BIND_UAV_INPUT_DOWNSAMPLE_SRC_MIPS) + +#if defined(FFX_SPD_BIND_UAV_INPUT_DOWNSAMPLE_SRC_MIPS) + void StoreSrcMipH(FfxFloat16x4 value, FfxInt32x2 uv, FfxUInt32 slice, FfxUInt32 mip) + { + rw_input_downsample_src_mips[mip][FfxUInt32x3(uv, slice)] = FfxFloat32x4(value); + } +#endif // defined(FFX_SPD_BIND_UAV_INPUT_DOWNSAMPLE_SRC_MIPS) + +#if defined(FFX_SPD_BIND_UAV_INPUT_DOWNSAMPLE_SRC_MID_MIPMAP) + FfxFloat16x4 LoadMidMipH(FfxInt32x2 uv, FfxUInt32 slice) + { + return FfxFloat16x4(rw_input_downsample_src_mid_mip[FfxUInt32x3(uv, slice)]); + } +#endif // defined(FFX_SPD_BIND_UAV_INPUT_DOWNSAMPLE_SRC_MID_MIPMAP) + +#if defined(FFX_SPD_BIND_UAV_INPUT_DOWNSAMPLE_SRC_MID_MIPMAP) + void StoreMidMipH(FfxFloat16x4 value, FfxInt32x2 uv, FfxUInt32 slice) + { + rw_input_downsample_src_mid_mip[FfxUInt32x3(uv, slice)] = FfxFloat32x4(value); + } +#endif // defined(FFX_SPD_BIND_UAV_INPUT_DOWNSAMPLE_SRC_MID_MIPMAP) + +#else // FFX_HALF + +#if defined(FFX_SPD_BIND_SRV_INPUT_DOWNSAMPLE_SRC) + FfxFloat32x4 SampleSrcImage(FfxInt32x2 uv, FfxUInt32 slice) + { + FfxFloat32x2 textureCoord = FfxFloat32x2(uv) * InvInputSize() + InvInputSize(); + FfxFloat32x4 result = r_input_downsample_src.SampleLevel(s_LinearClamp, FfxFloat32x3(textureCoord, slice), 0); + return FfxFloat32x4(ffxSrgbFromLinear(result.x), ffxSrgbFromLinear(result.y), ffxSrgbFromLinear(result.z), result.w); + } +#endif // defined(FFX_SPD_BIND_SRV_INPUT_DOWNSAMPLE_SRC) + +#if defined(FFX_SPD_BIND_UAV_INPUT_DOWNSAMPLE_SRC_MIPS) + FfxFloat32x4 LoadSrcImage(FfxInt32x2 uv, FfxUInt32 slice) + { + return rw_input_downsample_src_mips[0][FfxUInt32x3(uv, slice)]; + } +#endif // defined(FFX_SPD_BIND_UAV_INPUT_DOWNSAMPLE_SRC_MIPS) + +#if defined(FFX_SPD_BIND_UAV_INPUT_DOWNSAMPLE_SRC_MIPS) + void StoreSrcMip(FfxFloat32x4 value, FfxInt32x2 uv, FfxUInt32 slice, FfxUInt32 mip) + { + rw_input_downsample_src_mips[mip][FfxUInt32x3(uv, slice)] = value; + } +#endif // defined(FFX_SPD_BIND_UAV_INPUT_DOWNSAMPLE_SRC_MIPS) + +#if defined(FFX_SPD_BIND_UAV_INPUT_DOWNSAMPLE_SRC_MID_MIPMAP) + FfxFloat32x4 LoadMidMip(FfxInt32x2 uv, FfxUInt32 slice) + { + return rw_input_downsample_src_mid_mip[FfxUInt32x3(uv, slice)]; + } +#endif // defined(FFX_SPD_BIND_UAV_INPUT_DOWNSAMPLE_SRC_MID_MIPMAP) + +#if defined(FFX_SPD_BIND_UAV_INPUT_DOWNSAMPLE_SRC_MID_MIPMAP) + void StoreMidMip(FfxFloat32x4 value, FfxInt32x2 uv, FfxUInt32 slice) + { + rw_input_downsample_src_mid_mip[FfxUInt32x3(uv, slice)] = value; + } +#endif // defined(FFX_SPD_BIND_UAV_INPUT_DOWNSAMPLE_SRC_MID_MIPMAP) + +#endif // FFX_HALF + +#if defined(FFX_SPD_BIND_UAV_INTERNAL_GLOBAL_ATOMIC) +void IncreaseAtomicCounter(FFX_PARAMETER_IN FfxUInt32 slice, FFX_PARAMETER_INOUT FfxUInt32 counter) +{ + InterlockedAdd(rw_internal_global_atomic[0].counter[slice], 1, counter); +} +#endif // defined(FFX_SPD_BIND_UAV_INTERNAL_GLOBAL_ATOMIC) + +#if defined(FFX_SPD_BIND_UAV_INTERNAL_GLOBAL_ATOMIC) +void ResetAtomicCounter(FFX_PARAMETER_IN FfxUInt32 slice) +{ + rw_internal_global_atomic[0].counter[slice] = 0; +} +#endif // defined(FFX_SPD_BIND_UAV_INTERNAL_GLOBAL_ATOMIC) + +#endif // #if defined(FFX_GPU) diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/spd/ffx_spd_downsample.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/spd/ffx_spd_downsample.h new file mode 100644 index 00000000..84d40397 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/spd/ffx_spd_downsample.h @@ -0,0 +1,171 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#include "ffx_core.h" + +#if FFX_HALF + #define FFX_SPD_PACKED_ONLY 1 +#endif // FFX_HALF + +#if FFX_SPD_OPTION_LINEAR_SAMPLE + #define SPD_LINEAR_SAMPLER 1 +#endif // FFX_SPD_OPTION_LINEAR_SAMPLE + +#if FFX_SPD_OPTION_WAVE_INTEROP_LDS + #define FFX_SPD_NO_WAVE_OPERATIONS 1 +#endif // FFX_SPD_OPTION_WAVE_INTEROP_LDS + +FFX_GROUPSHARED FfxUInt32 spdCounter; + +void SpdIncreaseAtomicCounter(FfxUInt32 slice) +{ + IncreaseAtomicCounter(slice, spdCounter); +} + +FfxUInt32 SpdGetAtomicCounter() +{ + return spdCounter; +} + +void SpdResetAtomicCounter(FfxUInt32 slice) +{ + ResetAtomicCounter(slice); +} + +#if FFX_HALF + +FFX_GROUPSHARED FfxFloat16x2 spdIntermediateRG[16][16]; +FFX_GROUPSHARED FfxFloat16x2 spdIntermediateBA[16][16]; + +FfxFloat16x4 SpdLoadSourceImageH(FfxInt32x2 tex, FfxUInt32 slice) +{ +#if defined SPD_LINEAR_SAMPLER + return SampleSrcImageH(tex, slice); +#else + return LoadSrcImageH(tex, slice); +#endif // SPD_LINEAR_SAMPLER +} + +FfxFloat16x4 SpdLoadH(FfxInt32x2 p, FfxUInt32 slice) +{ + return LoadMidMipH(p, slice); +} + +void SpdStoreH(FfxInt32x2 pix, FfxFloat16x4 value, FfxUInt32 mip, FfxUInt32 slice) +{ + if (mip == 5) + StoreMidMipH(value, pix, slice); + else + StoreSrcMipH(value, pix, slice, mip + 1); +} + +FfxFloat16x4 SpdLoadIntermediateH(FfxUInt32 x, FfxUInt32 y) +{ + return FfxFloat16x4( + spdIntermediateRG[x][y].x, + spdIntermediateRG[x][y].y, + spdIntermediateBA[x][y].x, + spdIntermediateBA[x][y].y); +} + +void SpdStoreIntermediateH(FfxUInt32 x, FfxUInt32 y, FfxFloat16x4 value) +{ + spdIntermediateRG[x][y] = value.xy; + spdIntermediateBA[x][y] = value.zw; +} + +FfxFloat16x4 SpdReduce4H(FfxFloat16x4 v0, FfxFloat16x4 v1, FfxFloat16x4 v2, FfxFloat16x4 v3) +{ +#if FFX_SPD_OPTION_DOWNSAMPLE_FILTER == 1 + return min(min(v0, v1), min(v2, v3)); +#elif FFX_SPD_OPTION_DOWNSAMPLE_FILTER == 2 + return max(max(v0, v1), max(v2, v3)); +#else + return (v0 + v1 + v2 + v3) * FfxFloat16(0.25); +#endif +} + +#else + +FFX_GROUPSHARED FfxFloat32 spdIntermediateR[16][16]; +FFX_GROUPSHARED FfxFloat32 spdIntermediateG[16][16]; +FFX_GROUPSHARED FfxFloat32 spdIntermediateB[16][16]; +FFX_GROUPSHARED FfxFloat32 spdIntermediateA[16][16]; + +FfxFloat32x4 SpdLoadSourceImage(FfxInt32x2 tex, FfxUInt32 slice) +{ +#if defined SPD_LINEAR_SAMPLER + return SampleSrcImage(tex, slice); +#else + return LoadSrcImage(tex, slice); +#endif // SPD_LINEAR_SAMPLER +} + +FfxFloat32x4 SpdLoad(FfxInt32x2 tex, FfxUInt32 slice) +{ + return LoadMidMip(tex, slice); +} + +void SpdStore(FfxInt32x2 pix, FfxFloat32x4 outValue, FfxUInt32 mip, FfxUInt32 slice) +{ + if (mip == 5) + StoreMidMip(outValue, pix, slice); + else + StoreSrcMip(outValue, pix, slice, mip + 1); +} + +FfxFloat32x4 SpdLoadIntermediate(FfxUInt32 x, FfxUInt32 y) +{ + return FfxFloat32x4(spdIntermediateR[x][y], spdIntermediateG[x][y], spdIntermediateB[x][y], spdIntermediateA[x][y]); +} + +void SpdStoreIntermediate(FfxUInt32 x, FfxUInt32 y, FfxFloat32x4 value) +{ + spdIntermediateR[x][y] = value.x; + spdIntermediateG[x][y] = value.y; + spdIntermediateB[x][y] = value.z; + spdIntermediateA[x][y] = value.w; +} + +FfxFloat32x4 SpdReduce4(FfxFloat32x4 v0, FfxFloat32x4 v1, FfxFloat32x4 v2, FfxFloat32x4 v3) +{ +#if FFX_SPD_OPTION_DOWNSAMPLE_FILTER == 1 + return ffxMin(ffxMin(v0, v1), ffxMin(v2, v3)); +#elif FFX_SPD_OPTION_DOWNSAMPLE_FILTER == 2 + return ffxMax(ffxMax(v0, v1), ffxMax(v2, v3)); +#else + return (v0 + v1 + v2 + v3) * 0.25; +#endif +} + +#endif // FFX_HALF + +#include "spd/ffx_spd.h" + +void DOWNSAMPLE(FfxUInt32 LocalThreadId, FfxUInt32x3 WorkGroupId) +{ +#if FFX_HALF + SpdDownsampleH(WorkGroupId.xy, LocalThreadId, Mips(), NumWorkGroups(), WorkGroupId.z, WorkGroupOffset()); +#else + SpdDownsample(WorkGroupId.xy, LocalThreadId, Mips(), NumWorkGroups(), WorkGroupId.z, WorkGroupOffset()); +#endif // FFX_HALF +} diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/spd/ffx_spd_resources.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/spd/ffx_spd_resources.h new file mode 100644 index 00000000..a346656a --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/gpu/spd/ffx_spd_resources.h @@ -0,0 +1,58 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#ifndef FFX_SPD_RESOURCES_H +#define FFX_SPD_RESOURCES_H + +#if defined(FFX_CPU) || defined(FFX_GPU) + +// Assumes a maximum on 12 mips. If larger base resolution support is added, +// extra mip resources need to also be added +#define SPD_MAX_MIP_LEVELS 12 + +#define FFX_SPD_RESOURCE_IDENTIFIER_NULL 0 +#define FFX_SPD_RESOURCE_IDENTIFIER_INPUT_GLOBAL_ATOMIC 1 +#define FFX_SPD_RESOURCE_IDENTIFIER_INPUT_DOWNSAMPLE_SRC_MID_MIPMAP 2 +#define FFX_SPD_RESOURCE_IDENTIFIER_INPUT_DOWNSAMPLE_SRC 3 // same as FFX_SPD_RESOURCE_DOWNSAMPLE_SRC_MIPMAP_0 +#define FFX_SPD_RESOURCE_IDENTIFIER_INPUT_DOWNSAMPLE_SRC_MIPMAP_0 3 +#define FFX_SPD_RESOURCE_IDENTIFIER_INPUT_DOWNSAMPLE_SRC_MIPMAP_1 4 +#define FFX_SPD_RESOURCE_IDENTIFIER_INPUT_DOWNSAMPLE_SRC_MIPMAP_2 5 +#define FFX_SPD_RESOURCE_IDENTIFIER_INPUT_DOWNSAMPLE_SRC_MIPMAP_3 6 +#define FFX_SPD_RESOURCE_IDENTIFIER_INPUT_DOWNSAMPLE_SRC_MIPMAP_4 7 +#define FFX_SPD_RESOURCE_IDENTIFIER_INPUT_DOWNSAMPLE_SRC_MIPMAP_5 8 +#define FFX_SPD_RESOURCE_IDENTIFIER_INPUT_DOWNSAMPLE_SRC_MIPMAP_6 9 +#define FFX_SPD_RESOURCE_IDENTIFIER_INPUT_DOWNSAMPLE_SRC_MIPMAP_7 10 +#define FFX_SPD_RESOURCE_IDENTIFIER_INPUT_DOWNSAMPLE_SRC_MIPMAP_8 11 +#define FFX_SPD_RESOURCE_IDENTIFIER_INPUT_DOWNSAMPLE_SRC_MIPMAP_9 12 +#define FFX_SPD_RESOURCE_IDENTIFIER_INPUT_DOWNSAMPLE_SRC_MIPMAP_10 13 +#define FFX_SPD_RESOURCE_IDENTIFIER_INPUT_DOWNSAMPLE_SRC_MIPMAP_11 14 +#define FFX_SPD_RESOURCE_IDENTIFIER_INPUT_DOWNSAMPLE_SRC_MIPMAP_12 15 +#define FFX_SPD_RESOURCE_IDENTIFIER_INTERNAL_GLOBAL_ATOMIC 16 + +#define FFX_SPD_RESOURCE_IDENTIFIER_COUNT 17 + +// CBV resource definitions +#define FFX_SPD_CONSTANTBUFFER_IDENTIFIER_SPD 0 + +#endif // #if defined(FFX_CPU) || defined(FFX_GPU) + +#endif // FFX_SPD_RESOURCES_H diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/backends/vk/ffx_vk.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/backends/vk/ffx_vk.h new file mode 100644 index 00000000..b31d5892 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/backends/vk/ffx_vk.h @@ -0,0 +1,370 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +/// @defgroup VKBackend Vulkan Backend +/// FidelityFX SDK native backend implementation for Vulkan. +/// +/// @ingroup Backends + +#pragma once + +#include +#include + +#if defined(__cplusplus) +extern "C" { +#endif // #if defined(__cplusplus) + +/// FFX specific callback type when submitting a command buffer to a queue. +typedef VkResult (*PFN_vkQueueSubmitFFX)(uint32_t submitCount, const VkSubmitInfo* pSubmits, VkFence fence); + +typedef struct VkQueueInfoFFX +{ + VkQueue queue; + uint32_t familyIndex; + PFN_vkQueueSubmitFFX submitFunc; +} VkQueueInfoFFX; + + +typedef enum VkCompositonModeFFX +{ + VK_COMPOSITION_MODE_NOT_FORCED_FFX, + VK_COMPOSITION_MODE_GAME_QUEUE_FFX, + VK_COMPOSITION_MODE_PRESENT_QUEUE_FFX, +} VkCompositonModeFFX; + +/// Structure holding additional information to effectively replace the game swapchain by the frame interpolation one. +/// Some notes on the queues: +/// - please pass the queue, its family (for queue family ownership transfer purposes) and an optional function if you want to control concurrent submissions +/// - game queue: the queue where the replacement of vkQueuePresentKHR is called. This queue should have Graphics and Compute capabilities (Transfer is implied as per Vulkan specification). +/// It can be shared with the engine. No Submit function is necessary. +/// The code assumes that the UI texture is owned by that queue family when present is called. +/// - async compute queue: optional queue with Compute capability (Transfer is implied as per Vulkan specification). If used by the engine, prefer not to enable the async compute path of FSR3 Frame interpolation. +/// - present queue: queue with Graphics, Compute or Transfer capability, and Present support. This queue cannot be used by the engine. Otherwise, some deadlock can occur. +/// - image acquire queue: this one doesn't need any capability. Strongly prefer a queue not used by the engine. The main graphics queue can work too but it might delay the signaling of the semaphore/fence when acquiring a new image, negatively impacting the performance. +typedef struct VkFrameInterpolationInfoFFX +{ + VkPhysicalDevice physicalDevice; + VkDevice device; + VkQueueInfoFFX gameQueue; + VkQueueInfoFFX asyncComputeQueue; + VkQueueInfoFFX presentQueue; + VkQueueInfoFFX imageAcquireQueue; + VkCompositonModeFFX compositionMode; + const VkAllocationCallbacks* pAllocator; +} VkFrameInterpolationInfoFFX; + +/// Query how much memory is required for the Vulkan backend's scratch buffer. +/// +/// @param [in] physicalDevice A pointer to the VkPhysicalDevice device. +/// @param [in] maxContexts The maximum number of simultaneous effect contexts that will share the backend. +/// (Note that some effects contain internal contexts which count towards this maximum) +/// +/// @returns +/// The size (in bytes) of the required scratch memory buffer for the VK backend. +/// +/// @ingroup VKBackend +FFX_API size_t ffxGetScratchMemorySizeVK(VkPhysicalDevice physicalDevice, size_t maxContexts); + +/// Convenience structure to hold all VK-related device information +typedef struct VkDeviceContext { + VkDevice vkDevice; /// The Vulkan device + VkPhysicalDevice vkPhysicalDevice; /// The Vulkan physical device + PFN_vkGetDeviceProcAddr vkDeviceProcAddr; /// The device's function address table +} VkDeviceContext; + +/// Create a FfxDevice from a VkDevice. +/// +/// @param [in] vkDeviceContext A pointer to a VKDeviceContext that holds all needed information +/// +/// @returns +/// An abstract FidelityFX device. +/// +/// @ingroup VKBackend +FFX_API FfxDevice ffxGetDeviceVK(VkDeviceContext* vkDeviceContext); + +/// Populate an interface with pointers for the VK backend. +/// +/// @param [out] backendInterface A pointer to a FfxInterface structure to populate with pointers. +/// @param [in] device A pointer to the VkDevice device. +/// @param [in] scratchBuffer A pointer to a buffer of memory which can be used by the DirectX(R)12 backend. +/// @param [in] scratchBufferSize The size (in bytes) of the buffer pointed to by scratchBuffer. +/// @param [in] maxContexts The maximum number of simultaneous effect contexts that will share the backend. +/// (Note that some effects contain internal contexts which count towards this maximum) +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_INVALID_POINTER The interface pointer was NULL. +/// +/// @ingroup VKBackend +FFX_API FfxErrorCode ffxGetInterfaceVK( + FfxInterface* backendInterface, + FfxDevice device, + void* scratchBuffer, + size_t scratchBufferSize, + size_t maxContexts); + +/// Create a FfxCommandList from a VkCommandBuffer. +/// +/// @param [in] cmdBuf A pointer to the Vulkan command buffer. +/// +/// @returns +/// An abstract FidelityFX command list. +/// +/// @ingroup VKBackend +FFX_API FfxCommandList ffxGetCommandListVK(VkCommandBuffer cmdBuf); + +/// Create a FfxPipeline from a VkPipeline. +/// +/// @param [in] pipeline A pointer to the Vulkan pipeline. +/// +/// @returns +/// An abstract FidelityFX pipeline. +/// +/// @ingroup VKBackend +FFX_API FfxPipeline ffxGetPipelineVK(VkPipeline pipeline); + +/// Fetch a FfxResource from a GPUResource. +/// +/// @param [in] vkResource A pointer to the (agnostic) VK resource. +/// @param [in] ffxResDescription An FfxResourceDescription for the resource representation. +/// @param [in] ffxResName (optional) A name string to identify the resource in debug mode. +/// @param [in] state The state the resource is currently in. +/// +/// @returns +/// An abstract FidelityFX resources. +/// +/// @ingroup VKBackend +FFX_API FfxResource ffxGetResourceVK(void* vkResource, + FfxResourceDescription ffxResDescription, + const wchar_t* ffxResName, + FfxResourceStates state = FFX_RESOURCE_STATE_COMPUTE_READ); + +/// Fetch a FfxSurfaceFormat from a VkFormat. +/// +/// @param [in] format The VkFormat to convert to FfxSurfaceFormat. +/// +/// @returns +/// An FfxSurfaceFormat. +/// +/// @ingroup VKBackend +FFX_API FfxSurfaceFormat ffxGetSurfaceFormatVK(VkFormat format); + +/// Fetch a FfxResourceDescription from an existing VkBuffer. +/// +/// @param [in] buffer The VkBuffer resource to create a FfxResourceDescription for. +/// @param [in] createInfo The VkBufferCreateInfo of the buffer +/// @param [in] additionalUsages Optional FfxResourceUsage flags needed for select resource mapping. +/// +/// @returns +/// An FfxResourceDescription. +/// +/// @ingroup VKBackend +FFX_API FfxResourceDescription ffxGetBufferResourceDescriptionVK(const VkBuffer buffer, + const VkBufferCreateInfo createInfo, + FfxResourceUsage additionalUsages = FFX_RESOURCE_USAGE_READ_ONLY); + +/// Fetch a FfxResourceDescription from an existing VkImage. +/// +/// @param [in] image The VkImage resource to create a FfxResourceDescription for. +/// @param [in] createInfo The VkImageCreateInfo of the buffer +/// @param [in] additionalUsages Optional FfxResourceUsage flags needed for select resource mapping. +/// +/// @returns +/// An FfxResourceDescription. +/// +/// @ingroup VKBackend +FFX_API FfxResourceDescription ffxGetImageResourceDescriptionVK(const VkImage image, + const VkImageCreateInfo createInfo, + FfxResourceUsage additionalUsages = FFX_RESOURCE_USAGE_READ_ONLY); + +/// Fetch a FfxCommandQueue from an existing VkQueue. +/// +/// @param [in] commandQueue The VkQueue to create a FfxCommandQueue from. +/// +/// @returns +/// An FfxCommandQueue. +/// +/// @ingroup VKBackend +FFX_API FfxCommandQueue ffxGetCommandQueueVK(VkQueue commandQueue); + +/// Fetch a FfxSwapchain from an existing VkSwapchainKHR. +/// +/// @param [in] pSwapchain The VkSwapchainKHR to create a FfxSwapchain from. +/// +/// @returns +/// An FfxSwapchain. +/// +/// @ingroup VKBackend +FFX_API FfxSwapchain ffxGetSwapchainVK(VkSwapchainKHR swapchain); + +/// Fetch a VkSwapchainKHR from an existing FfxSwapchain. +/// +/// @param [in] ffxSwapchain The FfxSwapchain to fetch an VkSwapchainKHR from. +/// +/// @returns +/// An VkSwapchainKHR object. +/// +/// @ingroup VKBackend +FFX_API VkSwapchainKHR ffxGetVKSwapchain(FfxSwapchain ffxSwapchain); + +/// Replaces the current swapchain with the provided FfxSwapchain. +/// +/// @param [in] gameQueue The FfxCommandQueue presentation will occur on. +/// @param [in,out] gameSwapChain The current FfxSwapchain to replace, optional. If not NULL, the swapchain will be destroyed. On return, it will hold the FfxSwapchain to use for frame interpolation presentation. +/// @param [in] swapchainCreateInfo The VkSwapchainCreateInfoKHR of the current swapchain. Its oldSwapchain member should be VK_NULL_HANDLE or the same as gameSwapChain. +/// @param [in] frameInterpolationInfo The VkFrameInterpolationInfoFFX containing additional information for swapchain replacement. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_INVALID_ARGUMENT One of the parameters is invalid. If the returned gameSwapChain is NULL, the old swapchain has been destroyed. +/// @retval +/// FFX_ERROR_BACKEND_API_ERROR Internal generic error. If the returned gameSwapChain is NULL, the old swapchain has been destroyed. +/// +/// @ingroup VKFrameInterpolation +FFX_API FfxErrorCode ffxReplaceSwapchainForFrameinterpolationVK(FfxCommandQueue gameQueue, + FfxSwapchain& gameSwapChain, + const VkSwapchainCreateInfoKHR* swapchainCreateInfo, + const VkFrameInterpolationInfoFFX* frameInterpolationInfo); + +/// Waits for the FfxSwapchain to complete presentation. +/// +/// @param [in] gameSwapChain The FfxSwapchain to wait on. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_INVALID_ARGUMENT Could not query the interface for the frame interpolation swap chain. +/// +/// @ingroup VKFrameInterpolation +FFX_API FfxErrorCode ffxWaitForPresents(FfxSwapchain gameSwapChain); + +/// Registers a FfxResource to use for UI with the provided FfxSwapchain. +/// +/// @param [in] gameSwapChain The FfxSwapchain to to register the UI resource with. +/// @param [in] uiResource The FfxResource representing the UI resource. +/// @param [in] flags A set of FfxUiCompositionFlags. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_INVALID_ARGUMENT Could not query the interface for the frame interpolation swap chain. +/// +/// @ingroup VKFrameInterpolation +FFX_API FfxErrorCode ffxRegisterFrameinterpolationUiResourceVK(FfxSwapchain gameSwapChain, FfxResource uiResource, uint32_t flags); + +/// Fetches a FfxCommandList from the FfxSwapchain. +/// +/// @param [in] gameSwapChain The FfxSwapchain to get a FfxCommandList from. +/// @param [out] gameCommandlist The FfxCommandList from the provided FfxSwapchain. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_INVALID_ARGUMENT Could not query the interface for the frame interpolation swap chain. +/// +/// @ingroup VKFrameInterpolation +FFX_API FfxErrorCode ffxGetFrameinterpolationCommandlistVK(FfxSwapchain gameSwapChain, FfxCommandList& gameCommandlist); + +/// Fetches a FfxResource representing the backbuffer from the FfxSwapchain. +/// +/// @param [in] gameSwapChain The FfxSwapchain to get a FfxResource backbuffer from. +/// +/// @returns +/// An abstract FidelityFX resources for the swapchain backbuffer. +/// +/// @ingroup VKFrameInterpolation +FFX_API FfxResource ffxGetFrameinterpolationTextureVK(FfxSwapchain gameSwapChain); + +/// Sets a FfxFrameGenerationConfig to the internal FrameInterpolationSwapChain (in the backend). +/// +/// @param [in] config The FfxFrameGenerationConfig to set. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_INVALID_ARGUMENT Could not query the interface for the frame interpolation swap chain. +/// +/// @ingroup VKFrameInterpolation +FFX_API FfxErrorCode ffxSetFrameGenerationConfigToSwapchainVK(FfxFrameGenerationConfig const* config); + +//enum values should match enum FfxApiConfigureFrameGenerationSwapChainKeyVK +typedef enum FfxFrameInterpolationSwapchainConfigureKey +{ + FFX_FI_SWAPCHAIN_CONFIGURE_KEY_WAITCALLBACK = 0, + FFX_FI_SWAPCHAIN_CONFIGURE_KEY_FRAMEPACINGTUNING = 2, +} FfxFrameInterpolationSwapchainConfigureKey; + +/// Configures FfxSwapchain via KeyValue API post FfxSwapchain context creation +/// +/// @param [in] gameSwapChain The FfxSwapchain to configure via KeyValue API +/// @param [in] key The FfxFrameInterpolationSwapchainConfigureKey is key +/// @param [in] valuePtr The pointer to value. What this pointer deference to depends on key. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_INVALID_ARGUMENT Could not query the interface for the frame interpolation swap chain. +/// +/// @ingroup VKFrameInterpolation +FFX_API FfxErrorCode ffxConfigureFrameInterpolationSwapchainVK(FfxSwapchain gameSwapChain, FfxFrameInterpolationSwapchainConfigureKey key, void* valuePtr); + +/// Query how much GPU memory created by FfxSwapchain. This excludes GPU memory created by the VkSwapchain (ie. size of backbuffers). +/// +/// @param [in] gameSwapChain The FfxSwapchain to configure via KeyValue API +/// @param [in out] vramUsage The FfxEffectMemoryUsage is the GPU memory created by FrameInterpolationSwapchain +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_INVALID_ARGUMENT Could not query the interface for the frame interpolation swap chain. +/// +/// @ingroup VKFrameInterpolation +FFX_API FfxErrorCode ffxFrameInterpolationSwapchainGetGpuMemoryUsageVK(FfxSwapchain gameSwapChain, FfxEffectMemoryUsage* vramUsage); + +typedef VkResult (*PFN_vkCreateSwapchainFFX)(VkDevice device, const VkSwapchainCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSwapchainKHR* pSwapchain, const VkFrameInterpolationInfoFFX* pFrameInterpolationInfo); + +/// Function to get he number of presents. This is useful when using frame interpolation +typedef uint64_t (*PFN_getLastPresentCountFFX)(VkSwapchainKHR); + +/// Structure holding the replacement function pointers for frame interpolation to work +/// Not all extensions are supported for now +/// Regarding specific functions: +/// - queuePresentKHR: when using this one, the presenting image should be in VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL state +/// - getLastPresentCount: this function isn't part of Vulkan but the engine can use it to get the real number of presented frames since the swapchain creation +struct FfxSwapchainReplacementFunctions +{ + PFN_vkCreateSwapchainFFX createSwapchainFFX; + PFN_vkDestroySwapchainKHR destroySwapchainKHR; + PFN_vkGetSwapchainImagesKHR getSwapchainImagesKHR; + PFN_vkAcquireNextImageKHR acquireNextImageKHR; + PFN_vkQueuePresentKHR queuePresentKHR; + PFN_vkSetHdrMetadataEXT setHdrMetadataEXT; + PFN_getLastPresentCountFFX getLastPresentCountFFX; +}; +FFX_API FfxErrorCode ffxGetSwapchainReplacementFunctionsVK(FfxDevice device, FfxSwapchainReplacementFunctions* functions); + +#if defined(__cplusplus) +} +#endif // #if defined(__cplusplus) diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_assert.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_assert.h new file mode 100644 index 00000000..ab554c33 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_assert.h @@ -0,0 +1,151 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#pragma once + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif // #ifdef __cplusplus + +/// @defgroup Asserts Asserts +/// Asserts used by FidelityFX SDK functions +/// +/// @ingroup ffxHost + +#ifdef _DEBUG +#ifdef _WIN32 + +#ifdef DISABLE_FFX_DEBUG_BREAK +#define FFX_DEBUG_BREAK \ + { \ + } +#else +/// Macro to force the debugger to break at this point in the code. +/// +/// @ingroup Asserts +#define FFX_DEBUG_BREAK __debugbreak(); +#endif +#else +#define FFX_DEBUG_BREAK \ + { \ + } +#endif +#else +// don't allow debug break in release builds. +#define FFX_DEBUG_BREAK +#endif + +/// A typedef for the callback function for assert printing. +/// +/// This can be used to re-route printing of assert messages from the FFX backend +/// to another destination. For example instead of the default behaviour of printing +/// the assert messages to the debugger's TTY the message can be re-routed to a +/// MessageBox in a GUI application. +/// +/// @param [in] message The message generated by the assert. +/// +/// @ingroup Asserts +typedef void (*FfxAssertCallback)(const char* message); + +/// Function to report an assert. +/// +/// @param [in] file The name of the file as a string. +/// @param [in] line The index of the line in the file. +/// @param [in] condition The boolean condition that was tested. +/// @param [in] msg The optional message to print. +/// +/// @returns +/// Always returns true. +/// +/// @ingroup Asserts +FFX_API bool ffxAssertReport(const char* file, int32_t line, const char* condition, const char* msg); + +/// Provides the ability to set a callback for assert messages. +/// +/// @param [in] callback The callback function that will receive assert messages. +/// +/// @ingroup Asserts +FFX_API void ffxAssertSetPrintingCallback(FfxAssertCallback callback); + +#ifdef _DEBUG +/// Standard assert macro. +/// +/// @ingroup Asserts +#define FFX_ASSERT(condition) \ + do \ + { \ + if (!(condition) && ffxAssertReport(__FILE__, __LINE__, #condition, NULL)) \ + FFX_DEBUG_BREAK \ + } while (0) + +/// Assert macro with message. +/// +/// @ingroup Asserts +#define FFX_ASSERT_MESSAGE(condition, msg) \ + do \ + { \ + if (!(condition) && ffxAssertReport(__FILE__, __LINE__, #condition, msg)) \ + FFX_DEBUG_BREAK \ + } while (0) + +/// Assert macro that always fails. +/// +/// @ingroup Asserts +#define FFX_ASSERT_FAIL(message) \ + do \ + { \ + ffxAssertReport(__FILE__, __LINE__, NULL, message); \ + FFX_DEBUG_BREAK \ + } while (0) +#else +// asserts disabled +#define FFX_ASSERT(condition) \ + do \ + { \ + FFX_UNUSED(condition); \ + } while (0) + +#define FFX_ASSERT_MESSAGE(condition, message) \ + do \ + { \ + FFX_UNUSED(condition); \ + FFX_UNUSED(message); \ + } while (0) + +#define FFX_ASSERT_FAIL(message) \ + do \ + { \ + FFX_UNUSED(message); \ + } while (0) +#endif // #if _DEBUG + +/// Simple static assert. +/// +/// @ingroup Asserts +#define FFX_STATIC_ASSERT(condition) static_assert(condition, #condition) + +#ifdef __cplusplus +} +#endif // #ifdef __cplusplus diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_blur.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_blur.h new file mode 100644 index 00000000..8012070d --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_blur.h @@ -0,0 +1,200 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +/// @defgroup ffxBlur FidelityFX Blur +/// FidelityFX Blur runtime library +/// +/// @ingroup SDKComponents + +//------------------------------------------------------------------------------------------------------------------------------ +// +// ABOUT +// ===== +// AMD FidelityFX Blur is a collection of blurring effects implemented on compute shaders, hand-optimized for maximum performance. +// FFX-Blur includes +// - Gaussian Blur w/ large kernel support (up to 21x21) +// +//============================================================================================================================== + +#pragma once + +#include + +/// FidelityFX Blur major version. +/// +/// @ingroup ffxBlur +#define FFX_BLUR_VERSION_MAJOR (1) + +/// FidelityFX Blur minor version. +/// +/// @ingroup ffxBlur +#define FFX_BLUR_VERSION_MINOR (1) + +/// FidelityFX Blur patch version. +/// +/// @ingroup ffxBlur +#define FFX_BLUR_VERSION_PATCH (0) + +/// FidelityFX Blur context count +/// +/// Defines the number of internal effect contexts required by Blur +/// +/// @ingroup ffxBlur +#define FFX_BLUR_CONTEXT_COUNT 1 + +/// The size of the context specified in uint32_t units. +/// +/// @ingroup ffxBlur +#define FFX_BLUR_CONTEXT_SIZE (1024) + +#if defined(__cplusplus) +extern "C" { +#endif // #if defined(__cplusplus) + +/// Enum to specify which blur pass (currently only one). +/// +/// @ingroup ffxBlur +typedef enum FfxBlurPass +{ + FFX_BLUR_PASS_BLUR = 0, ///< A pass which which blurs the input + FFX_BLUR_PASS_COUNT ///< The number of passes in the Blur effect +} FfxBlurPass; + +/// Use this macro for FfxBlurContextDescription::kernelSizes to enable all kernel sizes. +/// +/// @ingroup ffxBlur +#define FFX_BLUR_KERNEL_SIZE_ALL ((1 << FFX_BLUR_KERNEL_SIZE_COUNT) - 1) + +typedef enum FfxBlurKernelPermutation +{ + FFX_BLUR_KERNEL_PERMUTATION_0 = (1 << 0), ///< Sigma value of 1.6 used for generation of Gaussian kernel. + FFX_BLUR_KERNEL_PERMUTATION_1 = (1 << 1), ///< Sigma value of 2.8 used for generation of Gaussian kernel. + FFX_BLUR_KERNEL_PERMUTATION_2 = (1 << 2), ///< Sigma value of 4.0 used for generation of Gaussian kernel. +} FfxBlurKernelPermutation; +#define FFX_BLUR_KERNEL_PERMUTATION_COUNT 3 + +/// Use this macro for FfxBlurContextDescription::sigmaPermutations to enable all sigma permutations. +/// +/// @ingroup ffxBlur +#define FFX_BLUR_KERNEL_PERMUTATIONS_ALL ((1 << FFX_BLUR_KERNEL_PERMUTATION_COUNT) - 1) + +/// Enum to specify the size of the blur kernel. Use logical OR to enable multiple kernels +/// when setting the FfxBlurContextDescription::kernelSizes parameter prior to calling +/// ffxBlurContextCreate. +/// +/// @ingroup ffxBlur +typedef enum FfxBlurKernelSize +{ + FFX_BLUR_KERNEL_SIZE_3x3 = (1 << 0), + FFX_BLUR_KERNEL_SIZE_5x5 = (1 << 1), + FFX_BLUR_KERNEL_SIZE_7x7 = (1 << 2), + FFX_BLUR_KERNEL_SIZE_9x9 = (1 << 3), + FFX_BLUR_KERNEL_SIZE_11x11 = (1 << 4), + FFX_BLUR_KERNEL_SIZE_13x13 = (1 << 5), + FFX_BLUR_KERNEL_SIZE_15x15 = (1 << 6), + FFX_BLUR_KERNEL_SIZE_17x17 = (1 << 7), + FFX_BLUR_KERNEL_SIZE_19x19 = (1 << 8), + FFX_BLUR_KERNEL_SIZE_21x21 = (1 << 9) +} FfxBlurKernelSize; +#define FFX_BLUR_KERNEL_SIZE_COUNT 10 + +/// Enum to specify whether to initialize the FP32 or FP16 bit permutation of the blur shader(s). +/// Use this when setting the FfxBlurContextDescription::floatPrecision parameter prior to calling +/// ffxBlurContextCreate. +/// +/// @ingroup ffxBlur +typedef enum FfxBlurFloatPrecision +{ + FFX_BLUR_FLOAT_PRECISION_32BIT = 0, + FFX_BLUR_FLOAT_PRECISION_16BIT = 1, + FFX_BLUR_FLOAT_PRECISION_COUNT = 2 +} FfxBlurFloatPrecision; + +typedef uint32_t FfxBlurKernelPermutations; +typedef uint32_t FfxBlurKernelSizes; + +/// FfxBlurContextDescription struct is used to create/initialize an FfxBlurContext. +/// +/// @ingroup ffxBlur +typedef struct FfxBlurContextDescription +{ + FfxBlurKernelPermutations kernelPermutations; ///< A bit mask of FfxBlurKernelPermutation values to indicate which kernels to enable for use. + FfxBlurKernelSizes kernelSizes; ///< A bit mask of FfxBlurKernelSize values to indicated which kernel sizes to enable for use. + FfxBlurFloatPrecision floatPrecision; ///< A flag indicating the desired floating point precision for use in ffxBlurContextDispatch + FfxInterface backendInterface; ///< A set of pointers to the backend implementation for FidelityFX. +} FfxBlurContextDescription; + +/// FfxBlurContext must be created via ffxBlurContextCreate to use the FFX Blur effect. +/// +/// @ingroup ffxBlur +typedef struct FfxBlurContext +{ + uint32_t data[FFX_BLUR_CONTEXT_SIZE]; ///< An opaque set of uint32_t which contain the data for the context. +} FfxBlurContext; + +/// Create and initialize the FfxBlurContext. +/// +/// @param [out] pContext The FfxBlurContext to create and initialize. +/// @param [in] pContextDescription The initialization configuration parameters. +/// +/// @ingroup ffxBlur +FFX_API FfxErrorCode ffxBlurContextCreate(FfxBlurContext* pContext, const FfxBlurContextDescription* pContextDescription); + +/// Destroy and free resources associated with the FfxBlurContext. +/// +/// @param [inout] pContext The FfxBlurContext to destroy. +/// +/// @ingroup ffxBlur +FFX_API FfxErrorCode ffxBlurContextDestroy(FfxBlurContext* pContext); + +/// FfxBlurDispatchDescription struct defines configuration of a blur dispatch (see ffxBlurContextDispatch). +/// +/// @ingroup ffxBlur +typedef struct FfxBlurDispatchDescription +{ + FfxCommandList commandList; ///< The FfxCommandList to record rendering commands into. + FfxBlurKernelPermutation kernelPermutation; ///< The permutation of the kernel (must be the one specified in FfxBlurContextDescription::kernelPermutations). + FfxBlurKernelSize kernelSize; ///< The kernel size to use for blurring (must be one specified in FfxBlurContextDescription::kernelSizes). + FfxDimensions2D inputAndOutputSize; ///< The width and height in pixels of the input and output resources. + FfxResource input; ///< The FfxResource to blur. + FfxResource output; ///< The FfxResource containing the output buffer for the blurred output. +} FfxBlurDispatchDescription; + +/// Create and initialize the FfxBlurContext. +/// +/// @param [in] pContext The FfxBlurContext to use for the dispatch. +/// @param [in] pDispatchDescription The dispatch configuration parameters (see FfxBlurDispatchDescription). +/// +/// @ingroup ffxBlur +FFX_API FfxErrorCode ffxBlurContextDispatch(FfxBlurContext* pContext, const FfxBlurDispatchDescription* pDispatchDescription); + +/// Queries the effect version number. +/// +/// @returns +/// The SDK version the effect was built with. +/// +/// @ingroup ffxBlur +FFX_API FfxVersionNumber ffxBlurGetEffectVersion(); + +#if defined(__cplusplus) +} +#endif // #if defined(__cplusplus diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_breadcrumbs.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_breadcrumbs.h new file mode 100644 index 00000000..64a4bd5b --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_breadcrumbs.h @@ -0,0 +1,487 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +/// @defgroup ffxBreadcrumbs FidelityFX Breadcrumbs +/// FidelityFX Breadcrumbs runtime library +/// +/// @ingroup SDKComponents + + +#pragma once + +// Include the interface for the backend of the Breadcrumbs API. +#include + +/// FidelityFX Breadcrumbs major version. +/// +/// @ingroup ffxBreadcrumbs +#define FFX_BREADCRUMBS_VERSION_MAJOR (1) + +/// FidelityFX Breadcrumbs minor version. +/// +/// @ingroup ffxBreadcrumbs +#define FFX_BREADCRUMBS_VERSION_MINOR (0) + +/// FidelityFX Breadcrumbs patch version. +/// +/// @ingroup ffxBreadcrumbs +#define FFX_BREADCRUMBS_VERSION_PATCH (1) + +/// FidelityFX Breadcrumbs context count +/// +/// Defines the number of internal effect contexts required by Breadcrumbs +/// +/// @ingroup ffxBreadcrumbs +#define FFX_BREADCRUMBS_CONTEXT_COUNT 1 + +/// The size of the context specified in 32bit values. +/// +/// @ingroup ffxBreadcrumbs +#define FFX_BREADCRUMBS_CONTEXT_SIZE (128) + +/// Maximal number of markers that can be written into single memory block. +/// +/// @ingroup ffxBreadcrumbs +#define FFX_BREADCRUMBS_MAX_MARKERS_PER_BLOCK ((1U << 31) - 1U) + +/// List of marker types to be used in X() macro. +/// +/// @ingroup ffxBreadcrumbs +#define FFX_BREADCRUMBS_MARKER_LIST \ + X(BEGIN_EVENT) \ + X(BEGIN_QUERY) \ + X(CLEAR_DEPTH_STENCIL) \ + X(CLEAR_RENDER_TARGET) \ + X(CLEAR_STATE) \ + X(CLEAR_UNORDERED_ACCESS_FLOAT) \ + X(CLEAR_UNORDERED_ACCESS_UINT) \ + X(CLOSE) \ + X(COPY_BUFFER_REGION) \ + X(COPY_RESOURCE) \ + X(COPY_TEXTURE_REGION) \ + X(COPY_TILES) \ + X(DISCARD_RESOURCE) \ + X(DISPATCH) \ + X(DRAW_INDEXED_INSTANCED) \ + X(DRAW_INSTANCED) \ + X(END_EVENT) \ + X(END_QUERY) \ + X(EXECUTE_BUNDLE) \ + X(EXECUTE_INDIRECT) \ + X(RESET) \ + X(RESOLVE_QUERY_DATA) \ + X(RESOLVE_SUBRESOURCE) \ + X(RESOURCE_BARRIER) \ + X(SET_COMPUTE_ROOT_SIGNATURE) \ + X(SET_DESCRIPTORS_HEAP) \ + X(SET_GRAPHICS_ROOT_SIGNATURE) \ + X(SET_PIPELINE_STATE) \ + X(SET_PREDICATION) \ + X(ATOMIC_COPY_BUFFER_UINT) \ + X(ATOMIC_COPY_BUFFER_UINT64) \ + X(RESOLVE_SUBRESOURCE_REGION) \ + X(SET_SAMPLE_POSITION) \ + X(SET_VIEW_INSTANCE_MASK) \ + X(WRITE_BUFFER_IMMEDIATE) \ + X(SET_PROTECTED_RESOURCE_SESSION) \ + X(BEGIN_RENDER_PASS) \ + X(BUILD_RAY_TRACING_ACCELERATION_STRUCTURE) \ + X(COPY_RAY_TRACING_ACCELERATION_STRUCTURE) \ + X(DISPATCH_RAYS) \ + X(EMIT_RAY_TRACING_ACCELERATION_STRUCTURE_POSTBUILD_INFO) \ + X(END_RENDER_PASS) \ + X(EXECUTE_META_COMMANDS) \ + X(INITIALIZE_META_COMMANDS) \ + X(SET_RAY_TRACING_STATE) \ + X(SET_SHADING_RATE) \ + X(SET_SHADING_RATE_IMAGE) \ + X(BEGIN_CONDITIONAL_RENDERING_EXT) \ + X(BEGIN_DEBUG_UTILS_LABEL_EXT) \ + X(BEGIN_QUERY_INDEXED_EXT) \ + X(BEGIN_RENDER_PASS_2) \ + X(BEGIN_TRANSFORM_FEEDBACK_EXT) \ + X(BIND_DESCRIPTOR_SETS) \ + X(BIND_PIPELINES) \ + X(BIND_SHADING_RATE_IMAGE_NV) \ + X(BLIT_IMAGE) \ + X(BUILD_ACCELERATION_STRUCTURE_NV) \ + X(CLEAR_ATTACHMENTS) \ + X(CLEAR_COLOR_IMAGE) \ + X(CLEAR_DEPTH_STENCIL_IMAGE) \ + X(COPY_ACCELERATION_STRUCTURE_NV) \ + X(COPY_BUFFER) \ + X(COPY_BUFFER_TO_IMAGE) \ + X(COPY_IMAGE) \ + X(COPY_IMAGE_TO_BUFFER) \ + X(DEBUG_MARKER_BEGIN_EXT) \ + X(DEBUG_MARKER_END_EXT) \ + X(DEBUG_MARKER_INSERT_EXT) \ + X(DISPATCH_BASE) \ + X(DISPATCH_INDIRECT) \ + X(DRAW) \ + X(DRAW_INDEXED) \ + X(DRAW_INDEXED_INDIRECT) \ + X(DRAW_INDEXED_INDIRECT_COUNT) \ + X(DRAW_INDIRECT) \ + X(DRAW_INDIRECT_BYTE_COUNT_EXT) \ + X(DRAW_INDIRECT_COUNT) \ + X(DRAW_MESH_TASKS_INDIRECT_COUNT_NV) \ + X(DRAW_MESH_TASKS_INDIRECT_NV) \ + X(DRAW_MESH_TASKS_NV) \ + X(END_CONDITIONAL_RENDERING_EXT) \ + X(END_DEBUG_UTILS_LABEL_EXT) \ + X(END_QUERY_INDEXED_EXT) \ + X(END_RENDER_PASS_2) \ + X(END_TRANSFORM_FEEDBACK_EXT) \ + X(EXECUTE_COMMANDS) \ + X(FILL_BUFFER) \ + X(INSERT_DEBUG_UTILS_LABEL_EXT) \ + X(NEXT_SUBPASS) \ + X(NEXT_SUBPASS_2) \ + X(PIPELINE_BARRIER) \ + X(PROCESS_COMMANDS_NVX) \ + X(RESERVE_SPACE_FOR_COMMANDS_NVX) \ + X(RESET_EVENT) \ + X(RESET_QUERY_POOL) \ + X(RESOLVE_IMAGE) \ + X(SET_CHECKPOINT_NV) \ + X(SET_EVENT) \ + X(SET_PERFORMANCE_MARKER_INTEL) \ + X(SET_PERFORMANCE_OVERRIDE_INTEL) \ + X(SET_PERFORMANCE_STREAM_MARKER_INTEL) \ + X(SET_SAMPLE_LOCATIONS_EXT) \ + X(SET_VIEWPORT_SHADING_RATE_PALETTE_NV) \ + X(TRACE_RAYS_NV) \ + X(UPDATE_BUFFER) \ + X(WAIT_EVENTS) \ + X(WRITE_ACCELERATION_STRUCTURES_PROPERTIES_NV) \ + X(WRITE_BUFFER_MARKER_AMD) \ + X(WRITE_BUFFER_MARKER_2_AMD) \ + X(WRITE_TIMESTAMP) + +#if defined(__cplusplus) +extern "C" { +#endif // #if defined(__cplusplus) + +/// An enumeration of bit flags used when creating a +/// FfxBreadcrumbsContext. See FfxBreadcrumbsContextDescription. +/// +/// @ingroup ffxBreadcrumbs +typedef enum FfxBreadcrumbsInitializationFlagBits { + + FFX_BREADCRUMBS_PRINT_FINISHED_LISTS = (1<<0), ///< A bit indicating that fully finished command lists will be expanded during status printing (otherwise their entries will be collapsed). + FFX_BREADCRUMBS_PRINT_NOT_STARTED_LISTS = (1<<1), ///< A bit indicating that command lists that haven't started execution on GPU yet will be expanded during status printing (otherwise their entries will be collapsed). + FFX_BREADCRUMBS_PRINT_FINISHED_NODES = (1<<3), ///< A bit indicating that nested markers which already have finished execution will be expanded during status printing (otherwise they will merged into top level marker). + FFX_BREADCRUMBS_PRINT_NOT_STARTED_NODES = (1<<4), ///< A bit indicating that nested markers which haven't started execution yet will be expanded during status printing (otherwise they will merged into top level marker). + FFX_BREADCRUMBS_PRINT_EXTENDED_DEVICE_INFO = (1<<5), ///< A bit indicating that additional info about active GPU will be printed into output status. + FFX_BREADCRUMBS_PRINT_SKIP_DEVICE_INFO = (1<<6), ///< A bit indicating that no info about active GPU will be printed into outpus status. + FFX_BREADCRUMBS_PRINT_SKIP_PIPELINE_INFO = (1<<7), ///< A bit indicating no info about pipelines used for commands recorded between markers will be printed into output status. + FFX_BREADCRUMBS_ENABLE_THREAD_SYNCHRONIZATION = (1<<8), ///< A bit indicating if internal synchronization should be applied (when using Breadcrumbs concurrently from multiple threads). +} FfxBreadcrumbsInitializationFlagBits; + +/// Type of currently recorded marker, purely informational. +/// +/// based on available methods of `ID3D12GraphicsCommandListX`, values of `D3D12_AUTO_BREADCRUMB_OP` and Vulkan `vkCmd*()` functions. +/// When using FFX_BREADCRUMBS_MARKER_PASS it is required to supply custom name for recording this type of marker. Otherwise it can +/// be left out as NULL and the Breadcrumbs will use default tag for this marker. It can be useful when recording multiple similar +/// commands in a row. Breadcrumbs will automatically add numbering to them so it's not needed to create your own numbered dynamic string. +/// +/// @ingroup ffxBreadcrumbs +typedef enum FfxBreadcrumbsMarkerType { + + FFX_BREADCRUMBS_MARKER_PASS, ///< Marker for grouping sets of commands. It is required to supply custom name for this type. +#define X(marker) FFX_BREADCRUMBS_MARKER_##marker, + FFX_BREADCRUMBS_MARKER_LIST +#undef X +} FfxBreadcrumbsMarkerType; + +/// A structure encapsulating the parameters required to initialize FidelityFX Breadcrumbs. +/// +/// @ingroup ffxBreadcrumbs +typedef struct FfxBreadcrumbsContextDescription { + + uint32_t flags; ///< A collection of FfxBreadcrumbsInitializationFlagBits. + uint32_t frameHistoryLength; ///< Number of frames to records markers for. Have to be larger than 0. + uint32_t maxMarkersPerMemoryBlock; ///< Controls the number of markers saved in single memory block. Have to be in range of [1..FFX_BREADCRUMBS_MAX_MARKERS_PER_BLOCK]. + uint32_t usedGpuQueuesCount; ///< Number of entries in pUsedGpuQueues. Have to be larger than 0. + uint32_t* pUsedGpuQueues; ///< Pointer to an array of unique indices representing GPU queues used for command lists used with AMD FidelityFX Breadcrumbs Library. + FfxAllocationCallbacks allocCallbacks; ///< Callbacks for managing memory in the library. + FfxInterface backendInterface; ///< A set of pointers to the backend implementation for FidelityFX SDK. +} FfxBreadcrumbsContextDescription; + + +/// Wrapper for custom Breadcrumbs name tags with indicator whether to perform copy on them. +/// +/// When custom name is supplied isNameExternallyOwned field controls whether to perform copy on the string. +/// If string memory is managed by the application (ex. static string) the copy can be omitted to save memory. +/// +/// @ingroup ffxBreadcrumbs +typedef struct FfxBreadcrumbsNameTag +{ + const char* pName; ///< Custom name for the object. By default optional, can be left to NULL. + bool isNameExternallyOwned; ///< Controls if AMD FidelityFX Breadcrumbs Library should copy a custom name with backed-up memory. +} FfxBreadcrumbsNameTag; + +/// Description for new command list to be enabled for writing AMD FidelityFX Breadcrumbs Library markers. +/// +/// @ingroup ffxBreadcrumbs +typedef struct FfxBreadcrumbsCommandListDescription { + + FfxCommandList commandList; ///< Handle to the command list that will be used with breadcrumbs operations. + uint32_t queueType; ///< Type of queue that list is used on. + FfxBreadcrumbsNameTag name; ///< Custom name for the command list. + FfxPipeline pipeline; ///< Optional pipeline state to associate with newly registered command list (can be set later). + uint16_t submissionIndex; ///< Information about submit number that command list is sent to GPU. Purely informational to help in analysing output later. +} FfxBreadcrumbsCommandListDescription; + +/// Description for pipeline state that will be used to tag breadcrumbs markers. +/// +/// @ingroup ffxBreadcrumbs +typedef struct FfxBreadcrumbsPipelineStateDescription +{ + FfxPipeline pipeline; ///< Pipeline state that will be associated with set of Breadcrumbs markers. + FfxBreadcrumbsNameTag name; ///< Custom name for the pipeline state. + FfxBreadcrumbsNameTag vertexShader; ///< Name of used Vertex Shader. Part of classic geometry processing pipeline, cannot be set together with compute, ray tracing or new mesh processing pipeline. + FfxBreadcrumbsNameTag hullShader; ///< Name of used Hull Shader. Part of classic geometry processing pipeline, cannot be set together with compute, ray tracing or new mesh processing pipeline. + FfxBreadcrumbsNameTag domainShader; ///< Name of used Domain Shader. Part of classic geometry processing pipeline, cannot be set together with compute, ray tracing or new mesh processing pipeline. + FfxBreadcrumbsNameTag geometryShader; ///< Name of used Geometry Shader. Part of classic geometry processing pipeline, cannot be set together with compute, ray tracing or new mesh processing pipeline. + FfxBreadcrumbsNameTag meshShader; ///< Name of used Mesh Shader. Part of new mesh processing pipeline, cannot be set together with compute, ray tracing or classic geometry processing pipeline. + FfxBreadcrumbsNameTag amplificationShader; ///< Name of used Amplification Shader. Part of new mesh processing pipeline, cannot be set together with compute, ray tracing or classic geometry processing pipeline. + FfxBreadcrumbsNameTag pixelShader; ///< Name of used Pixel Shader. Cannot be set together with computeShader or rayTracingShader. + FfxBreadcrumbsNameTag computeShader; ///< Name of used Compute Shader. Have to be set exclusively to other shader names (indicates compute pipeline). + FfxBreadcrumbsNameTag rayTracingShader; ///< Name of used Ray Tracing Shader. Have to be set exclusively to other shader names (indicates ray tracing pipeline). +} FfxBreadcrumbsPipelineStateDescription; + +/// Output with current AMD FidelityFX Breadcrumbs Library markers log for post-mortem analysis. +/// +/// @ingroup ffxBreadcrumbs +typedef struct FfxBreadcrumbsMarkersStatus +{ + size_t bufferSize; ///< Size of the status buffer. + char* pBuffer; ///< UTF-8 encoded buffer with log about markers execution. Have to be released with FFX_FREE. +} FfxBreadcrumbsMarkersStatus; + +/// A structure encapsulating the FidelityFX Breadcrumbs context. +/// +/// This sets up an object which contains all persistent internal data and +/// resources that are required by AMD FidelityFX Breadcrumbs Library. +/// +/// The FfxBreadcrumbsContext object should have a lifetime matching +/// your use of Breadcrumbs. Before destroying the Breadcrumbs context care should be taken +/// to ensure the GPU is not accessing the resources created or used by Breadcrumbs. +/// It is therefore recommended that the GPU is idle before destroying the +/// Breadcrumbs context. +/// +/// @ingroup ffxBreadcrumbs +typedef struct FfxBreadcrumbsContext +{ + uint32_t data[FFX_BREADCRUMBS_CONTEXT_SIZE]; ///< An opaque set of uint32_t which contain the data for the context. +} FfxBreadcrumbsContext; + +/// Create a FidelityFX Breadcrumbs context from the parameters +/// programmed to the FfxBreadcrumbsContextDescription structure. +/// +/// The context structure is the main object used to interact with the Breadcrumbs +/// API, and is responsible for the management of the internal buffers used +/// by the Breadcrumbs algorithm. For each provided queue there will be created +/// a buffer that will hold contents of the saved markers, awaiting for retrieval +/// per call to ffxBreadcrumbsPrintStatus() +/// +/// When choosing the number of frames to save markers for, +/// specified in the frameHistoryLength field of +/// FfxBreadcrumbsContextDescription, typically can be set to the number of +/// frames in flight in the application, but for longer history it can be increased. +/// +/// Buffers for markers are allocated at fixed size, allowing for certain +/// number of markers to be saved in them. The size of this buffers are +/// determined by maxMarkersPerMemoryBlock field of +/// FfxBreadcrumbsContextDescription. When needed new ones are created but to avoid +/// multiple allocations you can estimate how many markers will be used in single frame. +/// +/// The FfxBreadcrumbsContext should be destroyed when use of it is +/// completed, typically when an application is unloaded. To destroy the Breadcrumbs context +/// you should call ffxBreadcrumbsContextDestroy. +/// +/// @param [out] pContext A pointer to a FfxBreadcrumbsContext structure to populate. +/// @param [in] pContextDescription A pointer to a FfxBreadcrumbsContextDescription structure. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_INVALID_POINTER The operation failed because either pContext or contextDescription was NULL. +/// @retval +/// FFX_ERROR_INCOMPLETE_INTERFACE The operation failed because the FfxBreadcrumbsContextDescription.backendInterface was not fully specified. +/// @retval +/// FFX_ERROR_BACKEND_API_ERROR The operation failed because of an error returned from the backend. +/// +/// @ingroup ffxBreadcrumbs +FFX_API FfxErrorCode ffxBreadcrumbsContextCreate(FfxBreadcrumbsContext* pContext, const FfxBreadcrumbsContextDescription* pContextDescription); + +/// Destroy the FidelityFX Breadcrumbs context. +/// +/// Should always be called from a single thread for same context. +/// +/// @param [out] pContext A pointer to a FfxBreadcrumbsContext structure to destroy. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_INVALID_POINTER The operation failed because either pContext was NULL. +/// +/// @ingroup ffxBreadcrumbs +FFX_API FfxErrorCode ffxBreadcrumbsContextDestroy(FfxBreadcrumbsContext* pContext); + +/// Begins new frame of execution for FidelityFX Breadcrumbs. +/// +/// Should always be called from a single thread for same context. +/// +/// @param [in] pContext A pointer to a FfxBreadcrumbsContext structure. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_INVALID_POINTER The operation failed because either pContext was NULL. +/// +/// @ingroup ffxBreadcrumbs +FFX_API FfxErrorCode ffxBreadcrumbsStartFrame(FfxBreadcrumbsContext* pContext); + +/// Register new command list for current frame FidelityFX Breadcrumbs operations. +/// +/// After call to ffxBreadcrumbsStartFrame() every previously used list has to be registered again. +/// +/// @param [in] pContext A pointer to a FfxBreadcrumbsContext structure. +/// @param [in] pCommandListDescription A pointer to a FfxBreadcrumbsCommandListDescription structure. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_INVALID_POINTER The operation failed because either pContext or pCommandListDescription was NULL. +/// @retval +/// FFX_ERROR_INVALID_ARGUMENT The operation failed because given command list has been already registered. +/// +/// @ingroup ffxBreadcrumbs +FFX_API FfxErrorCode ffxBreadcrumbsRegisterCommandList(FfxBreadcrumbsContext* pContext, const FfxBreadcrumbsCommandListDescription* pCommandListDescription); + +/// Register new pipeline state to associate later with FidelityFX Breadcrumbs operations. +/// +/// Information about pipeline is preserved across frames so only single call after creation of pipeline is needed. +/// +/// @param [in] pContext A pointer to a FfxBreadcrumbsContext structure. +/// @param [in] pPipelineDescription A pointer to a FfxBreadcrumbsPipelineStateDescription structure. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_INVALID_POINTER The operation failed because either pContext or pPipelineDescription was NULL. +/// @retval +/// FFX_ERROR_INVALID_ARGUMENT The operation failed because given pipeline has been already registered or pPipelineDescription contains incorrect data. +/// +/// @ingroup ffxBreadcrumbs +FFX_API FfxErrorCode ffxBreadcrumbsRegisterPipeline(FfxBreadcrumbsContext* pContext, const FfxBreadcrumbsPipelineStateDescription* pPipelineDescription); + +/// Associate specific pipeline state with following FidelityFX Breadcrumbs markers. +/// +/// When recorded commands use specific pipelines you can save this information, associating said pipelines +/// with recorded markers, so later on additional information can be displayed when using ffxBreadcrumbsPrintStatus(). +/// To reset currently used pipeline just pass NULL as pipeline param. +/// +/// @param [in] pContext A pointer to a FfxBreadcrumbsContext structure. +/// @param [in] commandList Previously registered command list. +/// @param [in] pipeline Previously registered pipeline. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_INVALID_POINTER The operation failed because either context or commandList was NULL. +/// @retval +/// FFX_ERROR_INVALID_ARGUMENT The operation failed because given pipeline or command list has not been registered yet. +/// +/// @ingroup ffxBreadcrumbs +FFX_API FfxErrorCode ffxBreadcrumbsSetPipeline(FfxBreadcrumbsContext* pContext, FfxCommandList commandList, FfxPipeline pipeline); + +/// Begin new FidelityFX Breadcrumbs marker section. +/// +/// New section has to be ended with ffxBreadcrumbsEndMarker() +/// but multiple ffxBreadcrumbsBeginMarker() nesting calls are possible. +/// +/// @param [in] pContext A pointer to a FfxBreadcrumbsContext structure. +/// @param [in] commandList Previously registered command list. +/// @param [in] type Type of the marker section. +/// @param [in] pName Custom name for the marker section. Have to contain correct string if type is FFX_BREADCRUMBS_MARKER_PASS(). +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_INVALID_POINTER The operation failed because either pContext or pName was NULL. +/// @retval +/// FFX_ERROR_INVALID_ARGUMENT The operation failed because given command list has not been registered yet or pName doesn't contain correct string. +/// @retval +/// FFX_ERROR_BACKEND_API_ERROR The operation failed because of an error returned from the backend. +/// +/// @ingroup ffxBreadcrumbs +FFX_API FfxErrorCode ffxBreadcrumbsBeginMarker(FfxBreadcrumbsContext* pContext, FfxCommandList commandList, FfxBreadcrumbsMarkerType type, const FfxBreadcrumbsNameTag* pName); + +/// End FidelityFX Breadcrumbs marker section. +/// +/// Has to be preceeded by ffxBreadcrumbsBeginMarker(). +/// +/// @param [in] pContext A pointer to a FfxBreadcrumbsContext structure. +/// @param [in] commandList Previously registered command list. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_INVALID_POINTER The operation failed because pContext was NULL. +/// @retval +/// FFX_ERROR_INVALID_ARGUMENT The operation failed because given command list has not been registered yet. +/// +/// @ingroup ffxBreadcrumbs +FFX_API FfxErrorCode ffxBreadcrumbsEndMarker(FfxBreadcrumbsContext* pContext, FfxCommandList commandList); + +/// Gather information about current FidelityFX Breadcrumbs markers status. +/// +/// After receiving device lost error on GPU you can use this method to print post-mortem log of markers execution +/// to determine which commands in which frame were in flight during the crash. +/// Should always be called from a single thread. +/// +/// @param [in] pContext A pointer to a FfxBreadcrumbsContext structure. +/// @param [out] pMarkersStatus Buffer with post-mortem log of Breadcrumbs markers. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_INVALID_POINTER The operation failed because either pContext or pMarkersStatus was NULL. +/// +/// @ingroup ffxBreadcrumbs +FFX_API FfxErrorCode ffxBreadcrumbsPrintStatus(FfxBreadcrumbsContext* pContext, FfxBreadcrumbsMarkersStatus* pMarkersStatus); + +/// Queries the effect version number. +/// +/// @returns +/// The SDK version the effect was built with. +/// +/// @ingroup ffxBreadcrumbs +FFX_API FfxVersionNumber ffxBreadcrumbsGetEffectVersion(); + +#if defined(__cplusplus) +} +#endif // #if defined(__cplusplus) diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_brixelizer.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_brixelizer.h new file mode 100644 index 00000000..9860b4cd --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_brixelizer.h @@ -0,0 +1,339 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#pragma once + +#include + +/// The size of the context specified in 32bit values. +/// +/// @ingroup ffxBrixelizer +#define FFX_BRIXELIZER_CONTEXT_SIZE (5938838) + +/// The size of the update description specified in 32bit values. +/// +/// @ingroup ffxBrixelizer +#define FFX_BRIXELIZER_UPDATE_DESCRIPTION_SIZE 2099376 + +#ifdef __cplusplus +extern "C" { +#endif + +/// A structure encapsulating the FidelityFX Brixelizer context. +/// +/// This sets up an object which contains all persistent internal data and +/// resources that are required by Brixelizer. +/// +/// The FfxBrixelizerContext object should have a lifetime matching +/// your use of Brixelizer. Before destroying the Brixelizer context care +/// should be taken to ensure the GPU is not accessing the resources created +/// or used by Brixelizer. It is therefore recommended that the GPU is idle +/// before destroying the Brixelizer context. +/// +/// @ingroup ffxBrixelizer +typedef struct FfxBrixelizerContext { + uint32_t data[FFX_BRIXELIZER_CONTEXT_SIZE]; +} FfxBrixelizerContext; + +/// A structure representing an axis aligned bounding box for use with Brixelizer. +/// +/// @ingroup ffxBrixelizer +typedef struct FfxBrixelizerAABB { + float min[3]; ///< The minimum bounds of the AABB. + float max[3]; ///< The maximum bounds of the AABB. +} FfxBrixelizerAABB; + +/// Flags used for cascade creation. A cascade may be specified +/// as having static geometry, dynamic geometry, or both by combining these flags. +/// +/// @ingroup ffxBrixelizer +typedef enum FfxBrixelizerCascadeFlag { + FFX_BRIXELIZER_CASCADE_STATIC = (1 << 0), + FFX_BRIXELIZER_CASCADE_DYNAMIC = (1 << 1), +} FfxBrixelizerCascadeFlag; + +/// A structure encapsulating the parameters for cascade creation. +/// +/// @ingroup ffxBrixelizer +typedef struct FfxBrixelizerCascadeDescription { + FfxBrixelizerCascadeFlag flags; ///< Flags for cascade creation. See FfxBrixelizerCascadeFlag. + float voxelSize; ///< The edge size of voxels in world space for the cascade. +} FfxBrixelizerCascadeDescription; + +/// A structure encapsulating the parameters for creating a Brixelizer context. +/// +/// @ingroup ffxBrixelizer +typedef struct FfxBrixelizerContextDescription { + float sdfCenter[3]; ///< The point in world space around which to center the cascades. + uint32_t numCascades; ///< The number of cascades managed by the Brixelizer context. + FfxBrixelizerContextFlags flags; ///< A combination of FfxBrixelizerContextFlags specifying options for the context. + FfxBrixelizerCascadeDescription cascadeDescs[FFX_BRIXELIZER_MAX_CASCADES]; ///< Parameters describing each of the cascades, see FfxBrixelizerCascadeDescription. + FfxInterface backendInterface; ///< An implementation of the FidelityFX backend for use with Brixelizer. +} FfxBrixelizerContextDescription; + +/// Flags used for setting which AABBs to draw in a debug visualization of Brixelizer +/// +/// @ingroup ffxBrixelizer +typedef enum FfxBrixelizerPopulateDebugAABBsFlags { + FFX_BRIXELIZER_POPULATE_AABBS_NONE = 0, ///< Draw no AABBs. + FFX_BRIXELIZER_POPULATE_AABBS_STATIC_INSTANCES = 1 << 0, ///< Draw AABBs for all static instances. + FFX_BRIXELIZER_POPULATE_AABBS_DYNAMIC_INSTANCES = 1 << 1, ///< Draw AABBs for all dynamic instances. + FFX_BRIXELIZER_POPULATE_AABBS_INSTANCES = FFX_BRIXELIZER_POPULATE_AABBS_STATIC_INSTANCES | FFX_BRIXELIZER_POPULATE_AABBS_DYNAMIC_INSTANCES, ///< Draw AABBs for all instances. + FFX_BRIXELIZER_POPULATE_AABBS_CASCADE_AABBS = 1 << 2, ///< Draw AABBs for all cascades. +} FfxBrixelizerPopulateDebugAABBsFlags; + +/// A structure containing the statistics for a Brixelizer context readable after an update of the Brixelizer API. +/// +/// @ingroup ffxBrixelizer +typedef struct FfxBrixelizerContextStats { + uint32_t brickAllocationsAttempted; ///< Total number of brick allocations attempted this frame. + uint32_t brickAllocationsSucceeded; ///< Total number of brick allocations succeeded this frame. + uint32_t bricksCleared; ///< Total number of bricks cleared in SDF atlas at the beginning of this frame. + uint32_t bricksMerged; ///< Total number of bricks merged this frame. + uint32_t freeBricks; ///< The number of free bricks in the Brixelizer context. +} FfxBrixelizerContextStats; + +/// A structure containing the statistics for a Brixelizer cascade readable after an update of the Brixelizer API. +/// +/// @ingroup ffxBrixelizer +typedef struct FfxBrixelizerCascadeStats { + uint32_t trianglesAllocated; ///< The number of triangle allocations that were attempted to the cascade in a given frame. + uint32_t referencesAllocated; ///< The number of reference allocations that were attempted to the cascade in a given frame. + uint32_t bricksAllocated; ///< The number of brick allocations that were attempted to the cascade in a given frame. +} FfxBrixelizerCascadeStats; + +/// A structure containing the statistics readable after an update of the Brixelizer API. +/// +/// @ingroup ffxBrixelizer +typedef struct FfxBrixelizerStats { + uint32_t cascadeIndex; ///< The index of the cascade that the statisticss have been collected for. + FfxBrixelizerCascadeStats staticCascadeStats; ///< The statistics for the static cascade. + FfxBrixelizerCascadeStats dynamicCascadeStats; ///< The statistics for the dynamic cascade. + FfxBrixelizerContextStats contextStats; ///< The statistics for the Brixelizer context. +} FfxBrixelizerStats; + +/// A structure encapsulating the parameters used for computing an update by the +/// Brixelizer context. +/// +/// @ingroup ffxBrixelizer +typedef struct FfxBrixelizerUpdateDescription { + FfxBrixelizerResources resources; ///< Structure containing all resources to be used by the Brixelizer context. + uint32_t frameIndex; ///< The index of the current frame. + float sdfCenter[3]; ///< The center of the cascades. + FfxBrixelizerPopulateDebugAABBsFlags populateDebugAABBsFlags; ///< Flags determining which AABBs to draw in a debug visualization. See FfxBrixelizerPopulateDebugAABBsFlag. + FfxBrixelizerDebugVisualizationDescription *debugVisualizationDesc; ///< An optional debug visualization description. If this parameter is set to NULL no debug visualization is drawn. + uint32_t maxReferences; ///< The maximum number of triangle voxel references to be stored in the update. + uint32_t triangleSwapSize; ///< The size of the swap space available to be used for storing triangles in the update. + uint32_t maxBricksPerBake; ///< The maximum number of bricks to be updated. + size_t *outScratchBufferSize; ///< An optional pointer to a size_t to receive the size of the GPU scratch buffer needed to process the update. + FfxBrixelizerStats *outStats; ///< An optional pointer to an FfxBrixelizerStats struct to receive statistics for the update. Note, stats read back after a call to update do not correspond to the same frame that the stats were requested, as reading of stats requires readback from GPU buffers which is performed with a delay. +} FfxBrixelizerUpdateDescription; + +/// A structure generated by Brixelizer from an FfxBrixelizerUpdateDescription structure +/// used for storing parameters necessary for an update with the underlying raw Brixelizer API. +/// +/// @ingroup ffxBrixelizer +typedef struct FfxBrixelizerBakedUpdateDescription { + uint32_t data[FFX_BRIXELIZER_UPDATE_DESCRIPTION_SIZE]; +} FfxBrixelizerBakedUpdateDescription; + +/// Flags used for specifying instance properties. +/// +/// @ingroup ffxBrixelizer +typedef enum FfxBrixelizerInstanceFlags { + FFX_BRIXELIZER_INSTANCE_FLAG_NONE = 0, ///< No instance flags set. + FFX_BRIXELIZER_INSTANCE_FLAG_DYNAMIC = 1 << 0, ///< This flag is set for any instance which should be added to the dynamic cascade. Indicates that this instance will be resubmitted every frame. +} FfxBrixelizerInstanceFlags; + +/// A structure encapsulating the parameters necessary to create an instance with Brixelizer. +/// +/// @ingroup ffxBrixelizer +typedef struct FfxBrixelizerInstanceDescription { + uint32_t maxCascade; ///< The index of the highest cascade this instance will be submitted to. This helps avoid submitting many small objects to least detailed cascades. + FfxBrixelizerAABB aabb; ///< An AABB surrounding the instance. + FfxFloat32x3x4 transform; ///< A transform of the instance into world space. The transform is in row major order. + + FfxIndexFormat indexFormat; ///< The format of the index buffer. Accepted formats are FFX_INDEX_UINT16 or FFX_INDEX_UINT32. + uint32_t indexBuffer; ///< The index of the index buffer set with ffxBrixelizerContextSetBuffer. + uint32_t indexBufferOffset; ///< An offset into the index buffer. + uint32_t triangleCount; ///< The count of triangles in the index buffer. + + uint32_t vertexBuffer; ///< The index of the vertex buffer set with ffxBrixelizerContextSetBuffer. + uint32_t vertexStride; ///< The stride of the vertex buffer in bytes. + uint32_t vertexBufferOffset; ///< An offset into the vertex buffer. + uint32_t vertexCount; ///< The count of vertices in the vertex buffer. + FfxSurfaceFormat vertexFormat; ///< The format of vertices in the vertex buffer. Accepted values are FFX_SURFACE_FORMAT_R16G16B16A16_FLOAT and FFX_SURFACE_FORMAT_R32G32B32_FLOAT. + + FfxBrixelizerInstanceFlags flags; ///< Flags specifying properties of the instance. See FfxBrixelizerInstanceFlags. + + FfxBrixelizerInstanceID *outInstanceID; ///< A pointer to an FfxBrixelizerInstanceID storing the ID of the created instance. +} FfxBrixelizerInstanceDescription; + +/// Get the size in bytes needed for an FfxBrixelizerContext struct. +/// Note that this function is provided for consistency, and the size of the +/// FfxBrixelizerContext is a known compile time value which can be +/// obtained using sizeof(FfxBrixelizerContext). +/// +/// @return The size in bytes of an FfxBrixelizerContext struct. +/// +/// @ingroup ffxBrixelizer +inline size_t ffxBrixelizerGetContextSize() +{ + return sizeof(FfxBrixelizerContext); +} + +/// Create a FidelityFX Brixelizer context from the parameters +/// specified to the FfxBrixelizerContextDesc struct. +/// +/// The context structure is the main object used to interact with the Brixelizer +/// API, and is responsible for the management of the internal resources used by the +/// Brixelizer algorithm. When this API is called, multiple calls will be made via +/// the pointers contained in the backendInterface structure. This +/// backend will attempt to retrieve the device capabilities, and create the internal +/// resources, and pipelines required by Brixelizer. +/// +/// Depending on the parameters passed in via the contextDescription a +/// different set of resources and pipelines may be requested by the callback functions. +/// +/// The FfxBrixelizerContext should be destroyed when use of it is completed. +/// To destroy the context you should call ffxBrixelizerContextDestroy. +/// +/// @param [in] desc An FfxBrixelizerContextDescription structure with the parameters for context creation. +/// @param [out] outContext An FfxBrixelizerContext structure for receiving the initialized Brixelizer context. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// +/// @ingroup ffxBrixelizer +FFX_API FfxErrorCode ffxBrixelizerContextCreate(const FfxBrixelizerContextDescription* desc, FfxBrixelizerContext* outContext); + +/// Delete the Brixelizer context associated with the FfxBrixelizerContext struct. +/// +/// @param [inout] context An FfxBrixelizerContext containing the Brixelizer context. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// +/// @ingroup ffxBrixelizer +FFX_API FfxErrorCode ffxBrixelizerContextDestroy(FfxBrixelizerContext* context); + +/// Fill in an FfxBrixelizerContextInfo struct for necessary for updating a constant buffer for use +/// by Brixelizer when ray marching. +/// +/// @param [inout] context An FfxBrixelizerContext containing the Brixelizer context. +/// @param [out] contextInfo An FfxBrixelizerContextInfo struct to be filled. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// +/// @ingroup ffxBrixelizer +FFX_API FfxErrorCode ffxBrixelizerGetContextInfo(FfxBrixelizerContext* context, FfxBrixelizerContextInfo* contextInfo); + +/// Build an FfxBrixelizerBakedUpdateDescription struct from an FfxBrixelizerUpdateDescription struct +/// for use in doing a Brixelizer update. +/// +/// @param [inout] context An FfxBrixelizerContext containing the Brixelizer context. +/// @param [in] desc An FfxBrixelizerUpdateDescription struct containing the parameters for the update. +/// @param [out] outDesc An FfxBrixelizerBakedUpdateDescription struct to be filled in. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// +/// @ingroup ffxBrixelizer +FFX_API FfxErrorCode ffxBrixelizerBakeUpdate(FfxBrixelizerContext* context, const FfxBrixelizerUpdateDescription* desc, FfxBrixelizerBakedUpdateDescription* outDesc); + +/// Perform an update of Brixelizer, recording GPU commands to a command list. +/// +/// @param [inout] context An FfxBrixelizerContext containing the Brixelizer context. +/// @param [in] desc An FfxBrixelizerBakedUpdateDescription describing the update to compute. +/// @param [out] scratchBuffer An FfxResource to be used as scratch space by the update. +/// @param [out] commandList An FfxCommandList to write GPU commands to. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// +/// @ingroup ffxBrixelizer +FFX_API FfxErrorCode ffxBrixelizerUpdate(FfxBrixelizerContext* context, FfxBrixelizerBakedUpdateDescription* desc, FfxResource scratchBuffer, FfxCommandList commandList); + +/// Register a vertex or index buffer to use with Brixelizer. +/// +/// @param [inout] context An FfxBrixelizerContext containing the Brixelizer context. +/// @param [in] buffer An FfxResource of the vertex or index buffer. +/// @param [out] index The index of the registered buffer. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// +/// @ingroup ffxBrixelizer +FFX_API FfxErrorCode ffxBrixelizerRegisterBuffers(FfxBrixelizerContext* context, const FfxBrixelizerBufferDescription* bufferDescs, uint32_t numBufferDescs); + +/// Unregister a previously registered vertex or index buffer. +/// +/// @param [inout] context An FfxBrixelizerContext containing the Brixelizer context. +/// @param [in] index The index of the buffer to unregister. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// +/// @ingroup ffxBrixelizer +FFX_API FfxErrorCode ffxBrixelizerUnregisterBuffers(FfxBrixelizerContext* context, const uint32_t* indices, uint32_t numIndices); + +/// Create a static instance for a Brixelizer context. +/// +/// @param [inout] context An FfxBrixelizerContext containing the Brixelizer context. +/// @param [in] descs An array of FfxBrixelizerInstanceDescription structs with the parameters for instance creation. +/// @param [in] numDescs The number of entries in the array passed in by descs. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// +/// @ingroup ffxBrixelizer +FFX_API FfxErrorCode ffxBrixelizerCreateInstances(FfxBrixelizerContext* context, const FfxBrixelizerInstanceDescription* descs, uint32_t numDescs); + +/// Delete a static instance from a Brixelizer context. +/// +/// @param [inout] context An FfxBrixelizerContext containing the Brixelizer context. +/// @param [in] instanceIDs An array of FfxBrixelizerInstanceIDs corresponding to instances to be destroyed. +/// @param [in] numInstnaceIDs The number of elements in the array passed in by instanceIDs. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// +/// @ingroup ffxBrixelizer +FFX_API FfxErrorCode ffxBrixelizerDeleteInstances(FfxBrixelizerContext* context, const FfxBrixelizerInstanceID* instanceIDs, uint32_t numInstanceIDs); + +/// Get a pointer to the underlying Brixelizer raw context from a Brixelizer context. +/// +/// @param [inout] context An FfxBrixelizerContext containing the Brixelizer context. +/// @param [out] outContext A FfxBrixelizerRawContext representing the underlying Brixelizer raw context. +/// +/// @return +/// FFX_ERROR_INVALID_POINTER The pointer given was invalid. +/// @return +/// FFX_OK The operation completed successfully. +/// +/// @ingroup ffxBrixelizer +FFX_API FfxErrorCode ffxBrixelizerGetRawContext(FfxBrixelizerContext* context, FfxBrixelizerRawContext** outContext); + +#ifdef __cplusplus +} +#endif diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_brixelizer_raw.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_brixelizer_raw.h new file mode 100644 index 00000000..a6bc500f --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_brixelizer_raw.h @@ -0,0 +1,681 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#pragma once + +/// @defgroup ffxBrixelizer FidelityFX Brixelizer +/// FidelityFX Brixelizer runtime library +/// +/// @ingroup SDKComponents + + +// Include the interface for the backend of the Brixelizer API. +#include +#include + +/// FidelityFX Brixelizer major version. +/// +/// @ingroup ffxBrixelizer +#define FFX_BRIXELIZER_VERSION_MAJOR (1) + +/// FidelityFX Brixelizer minor version. +/// +/// @ingroup ffxBrixelizer +#define FFX_BRIXELIZER_VERSION_MINOR (0) + +/// FidelityFX Brixelizer patch version. +/// +/// @ingroup ffxBrixelizer +#define FFX_BRIXELIZER_VERSION_PATCH (0) + +/// FidelityFX Brixelizer context count +/// +/// Defines the number of internal effect contexts required by Brixelizer +/// +/// @ingroup ffxBrixelizer +#define FFX_BRIXELIZER_CONTEXT_COUNT 1 + +/// The size of the raw context specified in 32bit values. +/// +/// @ingroup ffxBrixelizer +#define FFX_BRIXELIZER_RAW_CONTEXT_SIZE (2924058) + +#ifdef __cplusplus +extern "C" { +#endif + +/// An enumeration of all the passes which constitute the Brixelizer algorithm. +/// +/// Brixelizer is implemented as a composite of several compute passes each +/// computing a key part of the final result. Each call to the +/// FfxBrixelizerScheduleGpuJobFunc callback function will +/// correspond to a single pass included in FfxBrixelizerPass. For a +/// more comprehensive description of each pass, please refer to the Brixelizer +/// reference documentation. +/// +/// @ingroup ffxBrixelizer +typedef enum FfxBrixelizerPass +{ + + FFX_BRIXELIZER_PASS_CONTEXT_CLEAR_COUNTERS, + FFX_BRIXELIZER_PASS_CONTEXT_COLLECT_CLEAR_BRICKS, + FFX_BRIXELIZER_PASS_CONTEXT_PREPARE_CLEAR_BRICKS, + FFX_BRIXELIZER_PASS_CONTEXT_CLEAR_BRICK, + FFX_BRIXELIZER_PASS_CONTEXT_COLLECT_DIRTY_BRICKS, + FFX_BRIXELIZER_PASS_CONTEXT_PREPARE_EIKONAL_ARGS, + FFX_BRIXELIZER_PASS_CONTEXT_EIKONAL, + FFX_BRIXELIZER_PASS_CONTEXT_MERGE_CASCADES, + FFX_BRIXELIZER_PASS_CONTEXT_PREPARE_MERGE_BRICKS_ARGS, + FFX_BRIXELIZER_PASS_CONTEXT_MERGE_BRICKS, + FFX_BRIXELIZER_PASS_CASCADE_CLEAR_BUILD_COUNTERS, + FFX_BRIXELIZER_PASS_CASCADE_RESET_CASCADE, + FFX_BRIXELIZER_PASS_CASCADE_SCROLL_CASCADE, + FFX_BRIXELIZER_PASS_CASCADE_CLEAR_REF_COUNTERS, + FFX_BRIXELIZER_PASS_CASCADE_CLEAR_JOB_COUNTER, + FFX_BRIXELIZER_PASS_CASCADE_INVALIDATE_JOB_AREAS, + FFX_BRIXELIZER_PASS_CASCADE_COARSE_CULLING, + FFX_BRIXELIZER_PASS_CASCADE_SCAN_JOBS, + FFX_BRIXELIZER_PASS_CASCADE_VOXELIZE, + FFX_BRIXELIZER_PASS_CASCADE_SCAN_REFERENCES, + FFX_BRIXELIZER_PASS_CASCADE_COMPACT_REFERENCES, + FFX_BRIXELIZER_PASS_CASCADE_CLEAR_BRICK_STORAGE, + FFX_BRIXELIZER_PASS_CASCADE_EMIT_SDF, + FFX_BRIXELIZER_PASS_CASCADE_COMPRESS_BRICK, + FFX_BRIXELIZER_PASS_CASCADE_INITIALIZE_CASCADE, + FFX_BRIXELIZER_PASS_CASCADE_MARK_UNINITIALIZED, + FFX_BRIXELIZER_PASS_CASCADE_BUILD_TREE_AABB, + FFX_BRIXELIZER_PASS_CASCADE_FREE_CASCADE, + FFX_BRIXELIZER_PASS_DEBUG_VISUALIZATION, + FFX_BRIXELIZER_PASS_DEBUG_INSTANCE_AABBS, + FFX_BRIXELIZER_PASS_DEBUG_AABB_TREE, + + FFX_BRIXELIZER_PASS_COUNT ///< The number of passes performed by Brixelizer. +} FfxBrixelizerPass; + +/// An ID value for an instance created with Brixelizer. +/// +/// @ingroup ffxBrixelizer +typedef uint32_t FfxBrixelizerInstanceID; + +/// A structure representing the external resources needed for a Brixelizer cascade. +/// +/// @ingroup ffxBrixelizer +typedef struct FfxBrixelizerCascadeResources +{ + FfxResource aabbTree; ///< An FfxResource for storing the AABB tree of the cascade. This should be a structured buffer of size FFX_BRIXELIZER_CASCADE_AABB_TREE_SIZE and stride FFX_BRIXELIZER_CASCADE_AABB_TREE_STRIDE. + FfxResource brickMap; ///< An FfxResource for storing the brick map of the cascade. This should be a structured buffer of size FFX_BRIXELIZER_CASCADE_BRICK_MAP_SIZE and stride FFX_BRIXELIZER_CASCADE_BRICK_MAP_STRIDE. +} FfxBrixelizerCascadeResources; + +/// A structure representing all external resources for use with Brixelizer. +/// +/// @ingroup ffxBrixelizer +typedef struct FfxBrixelizerResources +{ + FfxResource sdfAtlas; ///< An FfxResource for storing the SDF atlas. This should be a 512x512x512 3D texture of 8-bit unorm values. + FfxResource brickAABBs; ///< An FfxResource for storing the brick AABBs. This should be a structured buffer containing 64*64*64 32-bit values. + FfxBrixelizerCascadeResources cascadeResources[FFX_BRIXELIZER_MAX_CASCADES]; ///< Cascade resources. +} FfxBrixelizerResources; + +/// A structure encapsulating the parameters necessary to register a buffer with +/// the Brixelizer API. +/// +/// @ingroup ffxBrixelizer +typedef struct FfxBrixelizerBufferDescription { + FfxResource buffer; ///< An FfxResource of the buffer. + uint32_t *outIndex; ///< A pointer to a uint32_t to receive the index assigned to the buffer. +} FfxBrixelizerBufferDescription; + +/// Flags used for specifying debug drawing of AABBs. +/// +/// @ingroup ffxBrixelizer +typedef enum FfxBrixelizerCascadeDebugAABB { + FFX_BRIXELIZER_CASCADE_DEBUG_AABB_NONE, + FFX_BRIXELIZER_CASCADE_DEBUG_AABB_BOUNDING_BOX, + FFX_BRIXELIZER_CASCADE_DEBUG_AABB_AABB_TREE, +} FfxBrixelizerCascadeDebugAABB; + +/// A structure encapsulating the parameters for drawing a debug visualization. +/// +/// @ingroup ffxBrixelizer +typedef struct FfxBrixelizerDebugVisualizationDescription +{ + float inverseViewMatrix[16]; ///< Inverse view matrix for the scene in row major order. + float inverseProjectionMatrix[16]; ///< Inverse projection matrix for the scene in row major order. + FfxBrixelizerTraceDebugModes debugState; ///< An FfxBrixelizerTraceDebugModes determining what kind of debug output to draw. + uint32_t startCascadeIndex; ///< The index of the most detailed cascade in the cascade chain. + uint32_t endCascadeIndex; ///< The index of the least detailed cascade in the cascade chain. + float sdfSolveEps; ///< The epsilon value used in SDF ray marching. + float tMin; ///< The tMin value for minimum ray intersection. + float tMax; ///< The tMax value for maximum ray intersection. + uint32_t renderWidth; ///< The width of the output resource. + uint32_t renderHeight; ///< The height of the output resource. + FfxResource output; ///< An FfxResource to draw the debug visualization to. + + FfxCommandList commandList; ///< An FfxCommandList to write the draw commands to. + uint32_t numDebugAABBInstanceIDs; ///< The number of FfxBrixelizerInstanceIDs in the debugAABBInstanceIDs array. + const FfxBrixelizerInstanceID *debugAABBInstanceIDs; ///< An array of FfxBrixelizerInstanceIDs for instances to draw the bounding boxes of. + FfxBrixelizerCascadeDebugAABB cascadeDebugAABB[FFX_BRIXELIZER_MAX_CASCADES]; ///< An array of flags showing what AABB debug output to draw for each cascade. +} FfxBrixelizerDebugVisualizationDescription; + +/// Flags for options for Brixelizer context creation. +/// +/// @ingroup ffxBrixelizer +typedef enum FfxBrixelizerContextFlags +{ + FFX_BRIXELIZER_CONTEXT_FLAG_DEBUG_CONTEXT_READBACK_BUFFERS = (1 << 0), ///< Create a context with context readback buffers enabled. Needed to use ffxBrixelizerContextGetDebugCounters. + FFX_BRIXELIZER_CONTEXT_FLAG_DEBUG_CASCADE_READBACK_BUFFERS = (1 << 1), ///< Create a context with cascade readback buffers enabled. Needed to use ffxBrixelizerContextGetCascadeCounters. + FFX_BRIXELIZER_CONTEXT_FLAG_DEBUG_AABBS = (1 << 2), ///< Create a context with debug AABBs enabled. + FFX_BRIXELIZER_CONTEXT_FLAG_ALL_DEBUG = FFX_BRIXELIZER_CONTEXT_FLAG_DEBUG_CONTEXT_READBACK_BUFFERS | FFX_BRIXELIZER_CONTEXT_FLAG_DEBUG_CASCADE_READBACK_BUFFERS | FFX_BRIXELIZER_CONTEXT_FLAG_DEBUG_AABBS, ///< Create a context with all debugging features enabled. +} FfxBrixelizerContextFlags; + +/// Flags used for creating Brixelizer jobs. Determines whether a job is a submission of geometry or invalidating +/// an area described by an AABB. +/// +/// @ingroup ffxBrixelizer +typedef enum FfxBrixelizerRawJobFlags { + FFX_BRIXELIZER_RAW_JOB_FLAG_NONE = 0u, + FFX_BRIXELIZER_RAW_JOB_FLAG_INVALIDATE = 1u << 2u, +} FfxBrixelizerRawJobFlags; + +/// Flags used for creating Brixelizer instances. +/// +/// @ingroup ffxBrixelizer +typedef enum FfxBrixelizerRawInstanceFlags { + FFX_BRIXELIZER_RAW_INSTANCE_FLAG_NONE = 0u, + FFX_BRIXELIZER_RAW_INSTANCE_FLAG_USE_INDEXLESS_QUAD_LIST = 1u << 1u, +} FfxBrixelizerRawInstanceFlags; + +/// A structure encapsulating the FidelityFX Brixelizer context. +/// +/// This sets up an object which contains all persistent internal data and +/// resources that are required by Brixelizer. +/// +/// The FfxBrixelizerRawContext object should have a lifetime matching +/// your use of Brixelizer. Before destroying the Brixelizer context care +/// should be taken to ensure the GPU is not accessing the resources created +/// or used by Brixelizer. It is therefore recommended that the GPU is idle +/// before destroying the Brixelizer context. +/// +/// @ingroup ffxBrixelizer +typedef struct FfxBrixelizerRawContext +{ + uint32_t data[FFX_BRIXELIZER_RAW_CONTEXT_SIZE]; +} FfxBrixelizerRawContext; + +/// A structure encapsulating the parameters for creating a Brixelizer context. +/// +/// @ingroup ffxBrixelizer +typedef struct FfxBrixelizerRawContextDescription +{ + size_t maxDebugAABBs; ///< The maximum number of AABBs that can be drawn in debug mode. Note to use debug AABBs the flag FFX_BRIXELIZER_CONTEXT_FLAG must be passed at context creation. + FfxBrixelizerContextFlags flags; ///< A combination of FfxBrixelizerContextFlags specifying options for the context. + FfxInterface backendInterface; ///< An FfxInterface representing the FidelityFX backend interface. + +} FfxBrixelizerRawContextDescription; + +/// A structure encapsulating the parameters for creating a Brixelizer cascade. +/// +/// @ingroup ffxBrixelizer +typedef struct FfxBrixelizerRawCascadeDescription +{ + float brickSize; ///< The edge size of a brick in world units. + float cascadeMin[3]; ///< Corner of the first brick. + uint32_t index; ///< Index of the cascade. +} FfxBrixelizerRawCascadeDescription; + +/// A structure describing a Brixelizer job. +/// +/// @ingroup ffxBrixelizer +typedef struct FfxBrixelizerRawJobDescription +{ + float aabbMin[3]; ///< The mimimum corner of the AABB of the job. + float aabbMax[3]; ///< The maximum corner of the AABB of the job. + uint32_t flags; ///< Flags for the job (to be set from FfxBrixelizerRawJobFlags). + uint32_t instanceIdx; ///< The ID for an instance for the job. +} FfxBrixelizerRawJobDescription; + +/// A structure encapsulating the parameters for updating a Brixelizer cascade. +/// +/// @ingroup ffxBrixelizer +typedef struct FfxBrixelizerRawCascadeUpdateDescription +{ + uint32_t maxReferences; ///< storage for triangle->voxel references + uint32_t triangleSwapSize; ///< scratch storage for triangles + uint32_t maxBricksPerBake; ///< max SDF brick baked per update + int32_t cascadeIndex; ///< Target Cascade + const FfxBrixelizerRawJobDescription *jobs; ///< A pointer to an array of jobs. + size_t numJobs; ///< The number of jobs in the array pointed to by jobs. + float cascadeMin[3]; ///< Lower corner of the first brick in world space. + int32_t clipmapOffset[3]; ///< Changing that invalidates portion of the cascade. it's an offset in the voxel->brick table. + uint32_t flags; ///< See FfxBrixelizerCascadeUpdateFlags. +} FfxBrixelizerRawCascadeUpdateDescription; + +/// A structure encapsulating the parameters for an instance to be added to a +/// Brixelizer context. +/// +/// @ingroup ffxBrixelizer +typedef struct FfxBrixelizerRawInstanceDescription +{ + float aabbMin[3]; ///< The minimum coordinates of an AABB surrounding the instance. + float aabbMax[3]; ///< The maximum coordinates of an AABB surrounding the instance. + FfxFloat32x3x4 transform; ///< A tranform of the instance into world space. The transform is in row major order. + + FfxIndexFormat indexFormat; ///< The format of the index buffer. Accepted formats are FFX_INDEX_UINT16 or FFX_INDEX_UINT32. + uint32_t indexBuffer; ///< The index of the index buffer set with ffxBrixelizerContextSetBuffer. + uint32_t indexBufferOffset; ///< An offset into the index buffer. + uint32_t triangleCount; ///< The count of triangles in the index buffer. + + uint32_t vertexBuffer; ///< The index of the vertex buffer set with ffxBrixelizerContextSetBuffer. + uint32_t vertexStride; ///< The stride of the vertex buffer in bytes. + uint32_t vertexBufferOffset; ///< An offset into the vertex buffer. + uint32_t vertexCount; ///< The count of vertices in the vertex buffer. + FfxSurfaceFormat vertexFormat; ///< The format of vertices in the vertex buffer. Accepted values are FFX_SURFACE_FORMAT_R16G16B16A16_FLOAT and FFX_SURFACE_FORMAT_R32G32B32A32_FLOAT. + + uint32_t flags; ///< Flags for the instance. See FfxBrixelizerRawInstanceFlags. + FfxBrixelizerInstanceID *outInstanceID; ///< A pointer to an FfxBrixelizerInstanceID to be filled with the instance ID assigned for the instance. +} FfxBrixelizerRawInstanceDescription; + + +/// Get the size in bytes needed for an FfxBrixelizerRawContext struct. +/// Note that this function is provided for consistency, and the size of the +/// FfxBrixelizerRawContext is a known compile time value which can be +/// obtained using sizeof(FfxBrixelizerRawContext). +/// +/// @return The size in bytes of an FfxBrixelizerRawContext struct. +/// +/// @ingroup ffxBrixelizer +inline size_t ffxBrixelizerRawGetContextSize() +{ + return sizeof(FfxBrixelizerRawContext); +} + +/// Create a FidelityFX Brixelizer context from the parameters +/// specified to the FfxBrixelizerRawContextDescription struct. +/// +/// The context structure is the main object used to interact with the Brixelizer API, +/// and is responsible for the management of the internal resources used by the +/// Brixelizer algorithm. When this API is called, multiple calls will be made via +/// the pointers contained in the backendInterface structure. This +/// backend will attempt to retrieve the device capabilities, and create the internal +/// resources, and pipelines required by Brixelizer. +/// +/// Depending on the parameters passed in via the contextDescription a +/// different set of resources and pipelines may be requested by the callback functions. +/// +/// The FfxBrixelizerRawContext should be destroyed when use of it is completed. +/// To destroy the context you should call ffxBrixelizerContextDestroy. +/// +/// @param [out] context A pointer to a FfxBrixelizerRawContext to populate. +/// @param [in] contextDescription A pointer to a FfxBrixelizerRawContextDescription specifying the parameters for context creation. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_INVALID_POINTER The operation failed because either context or contextDescription was NULL. +/// @retval +/// FFX_ERROR_INCOMPLETE_INTERFACE The operation failed because contextDescription->backendInterface was not fully specified. +/// @retval +/// FFX_ERROR_BACKEND_API_ERROR The operation failed because of an error from the backend. +/// +/// @ingroup ffxBrixelizer +FFX_API FfxErrorCode ffxBrixelizerRawContextCreate(FfxBrixelizerRawContext* context, const FfxBrixelizerRawContextDescription* contextDescription); + +/// Destroy the FidelityFX Brixelizer context. +/// +/// @param [out] context A pointer to a FfxBrixelizerRawContext structure to destroy. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_INVALID_POINTER The context pointer provided was NULL. +/// +/// @ingroup ffxBrixelizer +FFX_API FfxErrorCode ffxBrixelizerRawContextDestroy(FfxBrixelizerRawContext* context); + +/// Get an FfxBrixelizerContextInfo structure with the details for context. +/// This call is intended to be used to fill in a constant buffer necessary for making ray +/// queries. +/// +/// @param [out] context The FfxBrixelizerRawContext to receive the FfxBrixelizerContextInfo of. +/// @param [out] contextInfo A FfxBrixelizerContextInfo struct to be filled in. +/// +/// @retval +/// FFX_OK The operation was successful. +/// @retval +/// FFX_ERROR_INVALID_POINTER The context pointer provided was NULL. +/// +/// @ingroup ffxBrixelizer +FFX_API FfxErrorCode ffxBrixelizerRawContextGetInfo(FfxBrixelizerRawContext* context, FfxBrixelizerContextInfo* contextInfo); + +/// Create a cascade for use with Brixelizer. +/// +/// @param [out] context The FfxBrixelizerRawContext to create a cascade for. +/// @param [in] cascadeDescription A FfxBrixelizerRawCascadeDescription struct specifying the parameters for cascade creation. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_INVALID_POINTER The operation failed because one of context, cascadeDescription, c>cascadeDescription->aabbTree or c>cascadeDescription->brickMap was NULL. +/// @retval +/// FFX_ERROR_BACKEND_API_ERROR The operation encountered an error in the backend. +/// +/// @ingroup ffxBrixelizer +FFX_API FfxErrorCode ffxBrixelizerRawContextCreateCascade(FfxBrixelizerRawContext* context, const FfxBrixelizerRawCascadeDescription* cascadeDescription); + +/// Destroy a cascade previously created with ffxBrixelizerContextCreateCascade. +/// +/// @param [out] context The FfxBrixelizerRawContext to delete a cascade for. +/// @param [in] cascadeIndex The index of the cascade to delete. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_INVALID_POINTER The operation failed because context was NULL. +/// +/// @ingroup ffxBrixelizer +FFX_API FfxErrorCode ffxBrixelizerRawContextDestroyCascade(FfxBrixelizerRawContext* context, uint32_t cascadeIndex); + +/// Reset a cascade previously created with ffxBrixelizerContextCreateCascade. +/// +/// @param [out] context The FfxBrixelizerRawContext to reset a cascade for. +/// @param [in] cascadeIndex The index of the cascade to reset. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_INVALID_POINTER The operation failed because context was NULL. +/// @retval +/// FFX_ERROR_INVALID_ARGUMENT No cascade with index cascadeIndex exists. +/// +/// @ingroup ffxBrixelizer +FFX_API FfxErrorCode ffxBrixelizerRawContextResetCascade(FfxBrixelizerRawContext* context, uint32_t cascadeIndex); + +/// Begin constructing GPU commands for updating SDF acceleration structures with Brixelizer. +/// Must be called between calls to ffxBrixelizerContextBegin and ffxBrixelizerContextEnd. +/// +/// @param [out] context The FfxBrixelizerRawContext to begin a frame for. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_INVALID_POINTER The operation failed because context was NULL. +/// @retval +/// FFX_ERROR_NULL_DEVICE The operation failed because the FfxDevice provided to the context was NULL. +/// +/// @ingroup ffxBrixelizer +FFX_API FfxErrorCode ffxBrixelizerRawContextBegin(FfxBrixelizerRawContext* context, FfxBrixelizerResources resources); + +/// End construcring GPU commands for updating the SDF acceleration structures with Brixelizer. +/// +/// @param [out] context The FfxBrixelizerRawContext to end a frame for. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_INVALID_POINTER The operation failed because context was NULL. +/// @retval +/// FFX_ERROR_NULL_DEVICE The operation failed because the FfxDevice provided to the context was NULL. +/// +/// @ingroup ffxBrixelizer +FFX_API FfxErrorCode ffxBrixelizerRawContextEnd(FfxBrixelizerRawContext* context); + +/// Record GPU commands to a FfxCommandList for updating acceleration structures with Brixelizer. +/// +/// @param [out] context The FfxBrixelizerRawContext to record GPU commands from. +/// @param [out] cmdList The FfxCommandList to record commands to. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_INVALID_POINTER The operation failed because context was NULL. +/// @retval +/// FFX_ERROR_NULL_DEVICE The operation failed because the FfxDevice provided to the context was NULL. +/// +/// @ingroup ffxBrixelizer +FFX_API FfxErrorCode ffxBrixelizerRawContextSubmit(FfxBrixelizerRawContext* context, FfxCommandList cmdList); + +/// Get the size in bytes needed from a FfxResource to be used as a scratch buffer in a cascade update. +/// +/// @param [out] context The FfxBrixelizerRawContext to calculate the required scratch buffer size for. +/// @param [in] cascadeUpdateDescription A FfxBrixelizerRawCascadeUpdateDescription struct with the parameters for the cascade update. +/// @param [out] size A size_t to store the required scratch buffer size to. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_INVALID_POINTER The operation failed because context or cascadeUpdateDescription was NULL. +/// @retval +/// FFX_ERROR_NULL_DEVICE The operation failed because the FfxDevice provided to the context was NULL. +/// +/// @ingroup ffxBrixelizer +FFX_API FfxErrorCode ffxBrixelizerRawContextGetScratchMemorySize(FfxBrixelizerRawContext* context, const FfxBrixelizerRawCascadeUpdateDescription* cascadeUpdateDescription, size_t* size); + +/// Update a cascade in a Brixelizer context. +/// +/// @param [out] context The FfxBrixelizerRawContext to perform the cascade update on. +/// @param [in] cascadeUpdateDescription A FfxBrixelizerRawCascadeUpdateDescription struct with the parameters for the cascade update. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_INVALID_POINTER The operation failed because context or cascadeUpdateDescription was NULL. +/// @retval +/// FFX_ERROR_NULL_DEVICE The operation failed because the FfxDevice provided to the context was NULL. +/// +/// @ingroup ffxBrixelizer +FFX_API FfxErrorCode ffxBrixelizerRawContextUpdateCascade(FfxBrixelizerRawContext* context, const FfxBrixelizerRawCascadeUpdateDescription* cascadeUpdateDescription); + +/// Merge two cascades in a Brixelizer context. +/// Must be called between calls to ffxBrixelizerRawContextBegin and ffxBrixelizerRawContextEnd. +/// +/// @param [out] context The FfxBrixelizerRawContext to merge cascades for. +/// @param [in] srcCascadeAIdx The index of the first source cascade. +/// @param [in] srcCascadeBIdx A FfxResource to store the required scratch buffer size to. +/// @param [in] dstCascadeIdx A FfxResource to store the required scratch buffer size to. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_INVALID_POINTER The operation failed because context was NULL. +/// @retval +/// FFX_ERROR_NULL_DEVICE The operation failed because the FfxDevice provided to the context was NULL. +/// +/// @ingroup ffxBrixelizer +FFX_API FfxErrorCode ffxBrixelizerRawContextMergeCascades(FfxBrixelizerRawContext* context, uint32_t src_cascade_A_idx, uint32_t src_cascade_B_idx, uint32_t dst_cascade_idx); + +/// Build an AABB tree for a cascade in a Brixelizer context. +/// Must be called between calls to ffxBrixelizerRawContextBegin and ffxBrixelizerRawContextEnd. +/// +/// @param [out] context The FfxBrixelizerRawContext to build an AABB tree for. +/// @param [in] cascadeIndex The index of the cascade to build the AABB tree of. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_INVALID_POINTER The operation failed because context was NULL. +/// @retval +/// FFX_ERROR_NULL_DEVICE The operation failed because the FfxDevice provided to the context was NULL. +/// +/// @ingroup ffxBrixelizer +FFX_API FfxErrorCode ffxBrixelizerRawContextBuildAABBTree(FfxBrixelizerRawContext* context, uint32_t cascadeIndex); + +/// Create a debug visualization output of a Brixelizer context. +/// Must be called between calls to ffxBrixelizerRawContextBegin and ffxBrixelizerRawContextEnd. +/// +/// @param [out] context The FfxBrixelizerRawContext to create a debug visualization for. +/// @param [in] debugVisualizationDescription A FfxBrixelizerDebugVisualizationDescription providing the parameters for the debug visualization. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_INVALID_POINTER The operation failed because context or debugVisualizationDescription was NULL. +/// @retval +/// FFX_ERROR_NULL_DEVICE The operation failed because the FfxDevice provided to the context was NULL. +/// +/// @ingroup ffxBrixelizer +FFX_API FfxErrorCode ffxBrixelizerRawContextDebugVisualization(FfxBrixelizerRawContext* context, const FfxBrixelizerDebugVisualizationDescription* debugVisualizationDescription); + +/// Get the debug counters from a Brixelizer context. +/// Note to use this function the flag FFX_BRIXELIZER_CONTEXT_FLAG_DEBUG_CONTEXT_READBACK_BUFFERS must +/// be passed at context creation. +/// +/// @param [out] context The FfxBrixelizerRawContext to read the debug counters of. +/// @param [out] debugCounters A FfxBrixelizerDebugCounters struct to read the debug counters to. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_INVALID_POINTER The operation failed because context or debugCounters was NULL. +/// +/// @ingroup ffxBrixelizer +FFX_API FfxErrorCode ffxBrixelizerRawContextGetDebugCounters(FfxBrixelizerRawContext* context, FfxBrixelizerDebugCounters* debugCounters); + +/// Get the cascade counters from a Brixelizer context. +/// Note to use this function the flag FFX_BRIXELIZER_CONTEXT_FLAG_DEBUG_CASCADE_READBACK_BUFFERS must +/// be passed at context creation. +/// +/// @param [out] context The FfxBrixelizerRawContext to read the cascade counters of. +/// @param [in] cascadeIndex The index of the cascade to read the cascade counters of. +/// @param [out] counters A FfxBrixelizerScratchCounters struct to read the cascade counters to. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_INVALID_POINTER The operation failed because context or counters was NULL. +/// +/// @ingroup ffxBrixelizer +FFX_API FfxErrorCode ffxBrixelizerRawContextGetCascadeCounters(FfxBrixelizerRawContext* context, uint32_t cascadeIndex, FfxBrixelizerScratchCounters* counters); + +/// Create an instance in a Brixelizer context. +/// +/// @param [out] context The FfxBrixelizerRawContext to create an instance for. +/// @param [in] instanceDescription A FfxBrixelizerRawInstanceDescription struct with the parameters for the instance to create. +/// @param [out] numInstanceDescriptions A FfxBrixelizerInstanceID to read the instance ID to. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_INVALID_POINTER The operation failed because context or instanceDescription was NULL. +/// +/// @ingroup ffxBrixelizer +FFX_API FfxErrorCode ffxBrixelizerRawContextCreateInstances(FfxBrixelizerRawContext* context, const FfxBrixelizerRawInstanceDescription* instanceDescriptions, uint32_t numInstanceDescriptions); + +/// Destroy an instance in a Brixelizer context. +/// +/// @param [out] context The FfxBrixelizerRawContext to delete an instance for. +/// @param [in] instanceId The FfxBrixelizerInstanceID of the instance to delete. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_INVALID_POINTER The operation failed because context was NULL. +/// +/// @ingroup ffxBrixelizer +FFX_API FfxErrorCode ffxBrixelizerRawContextDestroyInstances(FfxBrixelizerRawContext* context, const FfxBrixelizerInstanceID* instanceIDs, uint32_t numInstanceIDs); + +/// Flush all instances added to the Brixelizer context with ffxBrixelizerRawContextCreateInstance to the GPU. +/// +/// @param [out] context The FfxBrixelizerRawContext to flush the instances for. +/// @param [in] cmdList An FfxCommandList to record GPU commands to. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_INVALID_POINTER The operation failed because context was NULL. +/// +/// @ingroup ffxBrixelizer +FFX_API FfxErrorCode ffxBrixelizerRawContextFlushInstances(FfxBrixelizerRawContext* context, FfxCommandList cmdList); + +/// Register a vertex or index buffer for use with Brixelizer. +/// +/// @param [out] context The FfxBrixelizerRawContext to register a buffer for. +/// @param [in] buffer An FfxResource with the buffer to be set. +/// @param [out] index The index of the registered buffer. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_INVALID_POINTER The operation failed because context was NULL. +/// +/// @ingroup ffxBrixelizer +FFX_API FfxErrorCode ffxBrixelizerRawContextRegisterBuffers(FfxBrixelizerRawContext* context, const FfxBrixelizerBufferDescription* bufferDescs, uint32_t numBufferDescs); + +/// Unregister a previously registered vertex or index buffer. +/// +/// @param [out] context The FfxBrixelizerRawContext to unregister the buffer from +/// @param [in] index The index of the buffer to unregister. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_INVALID_POINTER The operation failed because context was NULL. +/// +/// @ingroup ffxBrixelizer +FFX_API FfxErrorCode ffxBrixelizerRawContextUnregisterBuffers(FfxBrixelizerRawContext* context, const uint32_t* indices, uint32_t numIndices); + +/// Get the index of the recommended cascade to update given the total number of cascades and current frame. +/// Follows the pattern 0 1 0 2 0 1 0 3 0 etc. If 0 is the most detailed cascade and maxCascades - 1 +/// is the least detailed cascade this ordering updates more detailed cascades more often. +/// +/// @param [out] context The FfxBrixelizerRawContext to set a buffer for. +/// @param [in] scratchBuffer A FfxResource for use as a scratch buffer. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_INVALID_POINTER The operation failed because context was NULL. +/// +/// @ingroup ffxBrixelizer +FFX_API FfxErrorCode ffxBrixelizerRawContextRegisterScratchBuffer(FfxBrixelizerRawContext* context, FfxResource scratchBuffer); + +/// Get the index of the recommended cascade to update given the total number of cascades and current frame. +/// Follows the pattern 0 1 0 2 0 1 0 3 0 etc. If 0 is the most detailed cascade and maxCascades - 1 +/// is the least detailed cascade this ordering updates more detailed cascades more often. +/// +/// @param [in] frameIndex The current frame index. +/// @param [in] maxCascades The total number of cascades. +/// +/// @retval The index of the cascade to update. +/// +/// @ingroup ffxBrixelizer +FFX_API uint32_t ffxBrixelizerRawGetCascadeToUpdate(uint32_t frameIndex, uint32_t maxCascades); + +/// Check whether an FfxResource is NULL. +/// +/// @param [in] resource An FfxResource to check for nullness. +/// +/// @retval true if resource is NULL else false. +/// +/// @ingroup ffxBrixelizer +FFX_API bool ffxBrixelizerRawResourceIsNull(FfxResource resource); + +/// Queries the effect version number. +/// +/// @returns +/// The SDK version the effect was built with. +/// +/// @ingroup ffxBrixelizer +FFX_API FfxVersionNumber ffxBrixelizerGetEffectVersion(); + +#ifdef __cplusplus +} +#endif diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_brixelizergi.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_brixelizergi.h new file mode 100644 index 00000000..75e63e60 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_brixelizergi.h @@ -0,0 +1,329 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#pragma once + +// Include the interface for the backend of the Brixelizer GI API. +#include +#include + +/// @defgroup ffxBrixgi FidelityFX Brixelizer GI +/// FidelityFX Brixelizer GI runtime library +/// +/// @ingroup SDKComponents + + +/// FidelityFX Brixelizer GI major version. +/// +/// @ingroup ffxBrixgi +#define FFX_BRIXELIZER_GI_VERSION_MAJOR (1) + +/// FidelityFX Brixelizer GI minor version. +/// +/// @ingroup ffxBrixgi +#define FFX_BRIXELIZER_GI_VERSION_MINOR (0) + +/// FidelityFX Brixelizer GI patch version. +/// +/// @ingroup ffxBrixgi +#define FFX_BRIXELIZER_GI_VERSION_PATCH (1) + +/// The size of the context specified in 32bit values. +/// +/// @ingroup ffxBrixgi +#define FFX_BRIXELIZER_GI_CONTEXT_SIZE (210000) + +/// FidelityFX Brixelizer GI context count +/// +/// Defines the number of internal effect contexts required by Brixelizer +/// +/// @ingroup ffxBrixgi +#define FFX_BRIXELIZER_GI_CONTEXT_COUNT 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/// A structure encapsulating the FidelityFX Brixelizer GI context. +/// +/// This sets up an object which contains all persistent internal data and +/// resources that are required by Brixelizer GI. +/// +/// The FfxBrixelizerGIContext object should have a lifetime matching +/// your use of Brixelizer GI. Before destroying the Brixelizer GI context care +/// should be taken to ensure the GPU is not accessing the resources created +/// or used by Brixelizer GI. It is therefore recommended that the GPU is idle +/// before destroying the Brixelizer GI context. +/// +/// @ingroup ffxBrixgi +typedef struct FfxBrixelizerGIContext +{ + uint32_t data[FFX_BRIXELIZER_GI_CONTEXT_SIZE]; +} FfxBrixelizerGIContext; + +/// An enumeration of flag bits used when creating an FfxBrixelizerGIContext. +/// See FfxBrixelizerGIContextDescription. +/// +/// @ingroup ffxBrixgi +typedef enum FfxBrixelizerGIFlags +{ + FFX_BRIXELIZER_GI_FLAG_DEPTH_INVERTED = (1 << 0), ///< Indicates input resources were generated with inverted depth. + FFX_BRIXELIZER_GI_FLAG_DISABLE_SPECULAR = (1 << 1), ///< Disable specular GI. + FFX_BRIXELIZER_GI_FLAG_DISABLE_DENOISER = (1 << 2), ///< Disable denoising. Only allowed at native resolution. +} FfxBrixelizerGIFlags; + +/// An enumeration of the quality modes supported by FidelityFX Brixelizer GI. +/// +/// @ingroup ffxBrixgi +typedef enum FfxBrixelizerGIInternalResolution +{ + FFX_BRIXELIZER_GI_INTERNAL_RESOLUTION_NATIVE, ///< Output GI at native resolution. + FFX_BRIXELIZER_GI_INTERNAL_RESOLUTION_75_PERCENT, ///< Output GI at 75% of native resolution. + FFX_BRIXELIZER_GI_INTERNAL_RESOLUTION_50_PERCENT, ///< Output GI at 50% of native resolution. + FFX_BRIXELIZER_GI_INTERNAL_RESOLUTION_25_PERCENT, ///< Output GI at 25% of native resolution. +} FfxBrixelizerGIInternalResolution; + +/// A structure encapsulating the parameters used for creating an +/// FfxBrixelizerGIContext. +/// +/// @ingroup ffxBrixgi +typedef struct FfxBrixelizerGIContextDescription +{ + FfxBrixelizerGIFlags flags; ///< A bit field representings various options. + FfxBrixelizerGIInternalResolution internalResolution; ///< The scale at which Brixelizer GI will output GI at internally. The output will be internally upscaled to the specified displaySize. + FfxDimensions2D displaySize; ///< The size of the presentation resolution targeted by the upscaling process. + FfxInterface backendInterface; ///< An implementation of the FidelityFX backend for use with Brixelizer. +} FfxBrixelizerGIContextDescription; + +/// A structure encapsulating the parameters used for computing a dispatch by the +/// Brixelizer GI context. +/// +/// @ingroup ffxBrixgi +typedef struct FfxBrixelizerGIDispatchDescription +{ + FfxFloat32x4x4 view; ///< The view matrix for the scene in row major order. + FfxFloat32x4x4 projection; ///< The projection matrix for the scene in row major order. + FfxFloat32x4x4 prevView; ///< The view matrix for the previous frame of the scene in row major order. + FfxFloat32x4x4 prevProjection; ///< The projection matrix for the scene in row major order. + + FfxFloat32x3 cameraPosition; ///< A 3-dimensional vector representing the position of the camera. + FfxUInt32 startCascade; ///< The index of the start cascade for use with ray marching with Brixelizer. + FfxUInt32 endCascade; ///< The index of the end cascade for use with ray marching with Brixelizer. + FfxFloat32 rayPushoff; ///< The distance from a surface along the normal vector to offset the diffuse ray origin. + FfxFloat32 sdfSolveEps; ///< The epsilon value for ray marching to be used with Brixelizer for diffuse rays. + FfxFloat32 specularRayPushoff; ///< The distance from a surface along the normal vector to offset the specular ray origin. + FfxFloat32 specularSDFSolveEps; ///< The epsilon value for ray marching to be used with Brixelizer for specular rays. + FfxFloat32 tMin; ///< The TMin value for use with Brixelizer. + FfxFloat32 tMax; ///< The TMax value for use with Brixelizer. + + FfxResource environmentMap; ///< The environment map. + FfxResource prevLitOutput; ///< The lit output from the previous frame. + FfxResource depth; ///< The input depth buffer. + FfxResource historyDepth; ///< The previous frame input depth buffer. + FfxResource normal; ///< The input normal buffer. + FfxResource historyNormal; ///< The previous frame input normal buffer. + FfxResource roughness; ///< The resource containing roughness information. + FfxResource motionVectors; ///< The input motion vectors texture. + FfxResource noiseTexture; ///< The input blue noise texture. + + FfxFloat32 normalsUnpackMul; ///< A multiply factor to transform the normal to the space expected by Brixelizer GI. + FfxFloat32 normalsUnpackAdd; ///< An offset to transform the normal to the space expected by Brixelizer GI. + FfxBoolean isRoughnessPerceptual; ///< A boolean to describe the space used to store roughness in the materialParameters texture. If false, we assume roughness squared was stored in the Gbuffer. + FfxUInt32 roughnessChannel; ///< The channel to read the roughness from the roughness texture + FfxFloat32 roughnessThreshold; ///< Regions with a roughness value greater than this threshold won't spawn specular rays. + FfxFloat32 environmentMapIntensity;///< The value to scale the contribution from the environment map. + FfxFloatCoords2D motionVectorScale; ///< The scale factor to apply to motion vectors. + + FfxResource sdfAtlas; ///< The SDF Atlas resource used by Brixelizer. + FfxResource bricksAABBs; ///< The brick AABBs resource used by Brixelizer. + FfxResource cascadeAABBTrees[24]; ///< The cascade AABB tree resources used by Brixelizer. + FfxResource cascadeBrickMaps[24]; ///< The cascade brick map resources used by Brixelizer. + + FfxResource outputDiffuseGI; ///< A texture to write the output diffuse GI calculated by Brixelizer GI. + FfxResource outputSpecularGI; ///< A texture to write the output specular GI calculated by Brixelizer GI. + + FfxBrixelizerRawContext *brixelizerContext; ///< A pointer to the Brixelizer context for use with Brixelizer GI. +} FfxBrixelizerGIDispatchDescription; + +/// An enumeration of which output mode to be used by Brixelizer GI debug visualization. +/// See FfxBrixelizerGIDebugDescription. +/// +/// @ingroup ffxBrixgi +typedef enum FfxBrixelizerGIDebugMode +{ + FFX_BRIXELIZER_GI_DEBUG_MODE_RADIANCE_CACHE, ///< Draw the radiance cache. + FFX_BRIXELIZER_GI_DEBUG_MODE_IRRADIANCE_CACHE, ///< Draw the irradiance cache. +} FfxBrixelizerGIDebugMode; + +/// A structure encapsulating the parameters for drawing a debug visualization. +/// +/// @ingroup ffxBrixgi +typedef struct FfxBrixelizerGIDebugDescription +{ + FfxFloat32x4x4 view; ///< The view matrix for the scene in row major order. + FfxFloat32x4x4 projection; ///< The projection matrix for the scene in row major order. + FfxUInt32 startCascade; ///< The index of the start cascade for use with ray marching with Brixelizer. + FfxUInt32 endCascade; ///< The index of the end cascade for use with ray marching with Brixelizer. + FfxUInt32 outputSize[2]; ///< The dimensions of the output texture. + FfxBrixelizerGIDebugMode debugMode; ///< The mode for the debug visualization. See FfxBrixelizerGIDebugMode. + FfxFloat32 normalsUnpackMul; ///< A multiply factor to transform the normal to the space expected by Brixelizer GI. + FfxFloat32 normalsUnpackAdd; ///< An offset to transform the normal to the space expected by Brixelizer GI. + + FfxResource depth; ///< The input depth buffer. + FfxResource normal; ///< The input normal buffer. + + FfxResource sdfAtlas; ///< The SDF Atlas resource used by Brixelizer. + FfxResource bricksAABBs; ///< The brick AABBs resource used by Brixelizer. + FfxResource cascadeAABBTrees[24]; ///< The cascade AABB tree resources used by Brixelizer. + FfxResource cascadeBrickMaps[24]; ///< The cascade brick map resources used by Brixelizer. + + FfxResource outputDebug; ///< The output texture for the debug visualization. + + FfxBrixelizerRawContext* brixelizerContext; ///< A pointer to the Brixelizer context for use with Brixelizer GI. +} FfxBrixelizerGIDebugDescription; + +/// An enumeration of all the passes which constitute the Brixelizer algorithm. +/// +/// Brixelizer GI is implemented as a composite of several compute passes each +/// computing a key part of the final result. Each call to the +/// FfxBrixelizerScheduleGpuJobFunc callback function will +/// correspond to a single pass included in FfxBrixelizerPass. For a +/// more comprehensive description of each pass, please refer to the Brixelizer +/// reference documentation. +/// +/// @ingroup ffxBrixgi +typedef enum FfxBrixelizerGIPass +{ + FFX_BRIXELIZER_GI_PASS_BLUR_X, + FFX_BRIXELIZER_GI_PASS_BLUR_Y, + FFX_BRIXELIZER_GI_PASS_CLEAR_CACHE, + FFX_BRIXELIZER_GI_PASS_EMIT_IRRADIANCE_CACHE, + FFX_BRIXELIZER_GI_PASS_EMIT_PRIMARY_RAY_RADIANCE, + FFX_BRIXELIZER_GI_PASS_FILL_SCREEN_PROBES, + FFX_BRIXELIZER_GI_PASS_INTERPOLATE_SCREEN_PROBES, + FFX_BRIXELIZER_GI_PASS_PREPARE_CLEAR_CACHE, + FFX_BRIXELIZER_GI_PASS_PROJECT_SCREEN_PROBES, + FFX_BRIXELIZER_GI_PASS_PROPAGATE_SH, + FFX_BRIXELIZER_GI_PASS_REPROJECT_GI, + FFX_BRIXELIZER_GI_PASS_REPROJECT_SCREEN_PROBES, + FFX_BRIXELIZER_GI_PASS_SPAWN_SCREEN_PROBES, + FFX_BRIXELIZER_GI_PASS_SPECULAR_PRE_TRACE, + FFX_BRIXELIZER_GI_PASS_SPECULAR_TRACE, + FFX_BRIXELIZER_GI_PASS_DEBUG_VISUALIZATION, + FFX_BRIXELIZER_GI_PASS_GENERATE_DISOCCLUSION_MASK, + FFX_BRIXELIZER_GI_PASS_DOWNSAMPLE, + FFX_BRIXELIZER_GI_PASS_UPSAMPLE, + + FFX_BRIXELIZER_GI_PASS_COUNT ///< The number of passes performed by Brixelizer GI. +} FfxBrixelizerGIPass; + +/// Get the size in bytes needed for an FfxBrixelizerGIContext struct. +/// Note that this function is provided for consistency, and the size of the +/// FfxBrixelizerGIContext is a known compile time value which can be +/// obtained using sizeof(FfxBrixelizerGIContext). +/// +/// @return The size in bytes of an FfxBrixelizerGIContext struct. +/// +/// @ingroup ffxBrixgi +inline size_t ffxBrixelizerGIGetContextSize() +{ + return sizeof(FfxBrixelizerGIContext); +} + +/// Create a FidelityFX Brixelizer GI context from the parameters +/// specified to the FfxBrixelizerGIContextDescription struct. +/// +/// The context structure is the main object used to interact with the Brixelizer GI API, +/// and is responsible for the management of the internal resources used by the +/// Brixelizer GI algorithm. When this API is called, multiple calls will be made via +/// the pointers contained in the backendInterface structure. This +/// backend will attempt to retrieve the device capabilities, and create the internal +/// resources, and pipelines required by Brixelizer GI. +/// +/// Depending on the parameters passed in via the pContextDescription a +/// different set of resources and pipelines may be requested by the callback functions. +/// +/// The FfxBrixelizerGIContext should be destroyed when use of it is completed. +/// To destroy the context you should call ffxBrixelizerGIContextDestroy. +/// +/// @param [out] pContext A pointer to a FfxBrixelizerGIContext to populate. +/// @param [in] pContextDescription A pointer to a FfxBrixelizerGIContextDescription specifying the parameters for context creation. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_INVALID_POINTER The operation failed because either pContext or pContextDescription was NULL. +/// @retval +/// FFX_ERROR_INCOMPLETE_INTERFACE The operation failed because pContextDescription->backendInterface was not fully specified. +/// @retval +/// FFX_ERROR_BACKEND_API_ERROR The operation failed because of an error from the backend. +/// +/// @ingroup ffxBrixgi +FFX_API FfxErrorCode ffxBrixelizerGIContextCreate(FfxBrixelizerGIContext* pContext, const FfxBrixelizerGIContextDescription* pContextDescription); + +/// Destroy the FidelityFX Brixelizer GI context. +/// +/// @param [out] pContext A pointer to a FfxBrixelizerGIContext structure to destroy. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_INVALID_POINTER The pContext pointer provided was NULL. +/// +/// @ingroup ffxBrixgi +FFX_API FfxErrorCode ffxBrixelizerGIContextDestroy(FfxBrixelizerGIContext* pContext); + +/// Perform an update of Brixelizer GI, recording GPU commands to a command list. +/// +/// @param [inout] context An FfxBrixelizerGIContext containing the Brixelizer GI context. +/// @param [in] pDispatchDescription A pointer to a FfxBrixelizerGIDispatchDescription describing the dispatch to compute. +/// @param [inout] pCommandList An FfxCommandList to write GPU commands to. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// +/// @ingroup ffxBrixgi +FFX_API FfxErrorCode ffxBrixelizerGIContextDispatch(FfxBrixelizerGIContext* pContext, const FfxBrixelizerGIDispatchDescription* pDispatchDescription, FfxCommandList pCommandList); + +/// Make a debug visualization from the FfxBrixelizerGIContext. +/// +/// @param [inout] context An FfxBrixelizerGIContext containing the Brixelizer GI context. +/// @param [in] pDebugDescription A pointer to a FfxBrixelizerGIDebugDescription describing the debug visualization to draw. +/// @param [inout] pCommandList An FfxCommandList to write GPU commands to. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// +/// @ingroup ffxBrixgi +FFX_API FfxErrorCode ffxBrixelizerGIContextDebugVisualization(FfxBrixelizerGIContext* pContext, const FfxBrixelizerGIDebugDescription* pDebugDescription, FfxCommandList pCommandList); + +/// Queries the effect version number. +/// +/// @returns +/// The SDK version the effect was built with. +/// +/// @ingroup ffxBrixgi +FFX_API FfxVersionNumber ffxBrixelizerGIGetEffectVersion(); + +#ifdef __cplusplus +} +#endif diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_cacao.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_cacao.h new file mode 100644 index 00000000..c067839e --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_cacao.h @@ -0,0 +1,533 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#pragma once + +#include + +///Include the interface for the backend of the API. +#include +/// @defgroup FfxCacao FidelityFX CACAO +/// FidelityFX Combined Adaptive Compute Ambient Occlusion runtime library. +/// +/// @ingroup SDKComponents + +/// FidelityFX CACAO major version. +/// +/// @ingroup FfxCacao +#define FFX_CACAO_VERSION_MAJOR (1) + +/// FidelityFX CACAO minor version. +/// +/// @ingroup FfxCacao +#define FFX_CACAO_VERSION_MINOR (4) + +/// FidelityFX CACAO patch version. +/// +/// @ingroup FfxCacao +#define FFX_CACAO_VERSION_PATCH (0) + +// ============================================================================ +// Prepare + +/// Width of the PREPARE_DEPTHS_AND_MIPS pass tile size. +/// +/// @ingroup FfxCacao +#define FFX_CACAO_PREPARE_DEPTHS_AND_MIPS_WIDTH 8 +/// Height of the PREPARE_DEPTHS_AND_MIPS pass tile size. +/// +/// @ingroup FfxCacao +#define FFX_CACAO_PREPARE_DEPTHS_AND_MIPS_HEIGHT 8 + +/// Width of the PREPARE_DEPTHS pass tile size. +/// +/// @ingroup FfxCacao +#define FFX_CACAO_PREPARE_DEPTHS_WIDTH 8 +/// Height of the PREPARE_DEPTHS pass tile size. +/// +/// @ingroup FfxCacao +#define FFX_CACAO_PREPARE_DEPTHS_HEIGHT 8 + +/// Width of the PREPARE_DEPTHS_HALF pass tile size. +/// +/// @ingroup FfxCacao +#define FFX_CACAO_PREPARE_DEPTHS_HALF_WIDTH 8 +/// Height of the PREPARE_DEPTHS_HALF pass tile size. +/// +/// @ingroup FfxCacao +#define FFX_CACAO_PREPARE_DEPTHS_HALF_HEIGHT 8 + +/// Width of the PREPARE_NORMALS pass tile size. +/// +/// @ingroup FfxCacao +#define FFX_CACAO_PREPARE_NORMALS_WIDTH 8 +/// Height of the PREPARE_NORMALS pass tile size. +/// +/// @ingroup FfxCacao +#define FFX_CACAO_PREPARE_NORMALS_HEIGHT 8 + +/// Width of the PREPARE_NORMALS_FROM_INPUT_NORMALS pass tile size. +/// +/// @ingroup FfxCacao +#define PREPARE_NORMALS_FROM_INPUT_NORMALS_WIDTH 8 +/// Height of the PREPARE_NORMALS_FROM_INPUT_NORMALS pass tile size. +/// +/// @ingroup FfxCacao +#define PREPARE_NORMALS_FROM_INPUT_NORMALS_HEIGHT 8 + +// ============================================================================ +// SSAO Generation + +/// Width of the GENERATE_SPARSE pass tile size. +/// +/// @ingroup FfxCacao +#define FFX_CACAO_GENERATE_SPARSE_WIDTH 4 +/// Height of the GENERATE_SPARSE pass tile size. +/// +/// @ingroup FfxCacao +#define FFX_CACAO_GENERATE_SPARSE_HEIGHT 16 + +/// Width of the GENERATE pass tile size. +/// +/// @ingroup FfxCacao +#define FFX_CACAO_GENERATE_WIDTH 8 +/// Height of the GENERATE pass tile size. +/// +/// @ingroup FfxCacao +#define FFX_CACAO_GENERATE_HEIGHT 8 + +// ============================================================================ +// Importance Map + +/// Width of the IMPORTANCE_MAP pass tile size. +/// +/// @ingroup FfxCacao +#define IMPORTANCE_MAP_WIDTH 8 +/// Height of the IMPORTANCE_MAP pass tile size. +/// +/// @ingroup FfxCacao +#define IMPORTANCE_MAP_HEIGHT 8 + +/// Width of the IMPORTANCE_MAP_A pass tile size. +/// +/// @ingroup FfxCacao +#define IMPORTANCE_MAP_A_WIDTH 8 +/// Height of the IMPORTANCE_MAP_A pass tile size. +/// +/// @ingroup FfxCacao +#define IMPORTANCE_MAP_A_HEIGHT 8 + +/// Width of the IMPORTANCE_MAP_B pass tile size. +/// +/// @ingroup FfxCacao +#define IMPORTANCE_MAP_B_WIDTH 8 +/// Height of the IMPORTANCE_MAP_B pass tile size. +/// +/// @ingroup FfxCacao +#define IMPORTANCE_MAP_B_HEIGHT 8 + +// ============================================================================ +// Edge Sensitive Blur + +/// Width of the BLUR pass tile size. +/// +/// @ingroup FfxCacao +#define FFX_CACAO_BLUR_WIDTH 16 +/// Height of the BLUR pass tile size. +/// +/// @ingroup FfxCacao +#define FFX_CACAO_BLUR_HEIGHT 16 + +// ============================================================================ +// Apply + +/// Width of the APPLY pass tile size. +/// +/// @ingroup FfxCacao +#define FFX_CACAO_APPLY_WIDTH 8 +/// Height of the APPLY pass tile size. +/// +/// @ingroup FfxCacao +#define FFX_CACAO_APPLY_HEIGHT 8 + +// ============================================================================ +// Bilateral Upscale + +/// Width of the BILATERAL_UPSCALE pass tile size. +/// +/// @ingroup FfxCacao +#define FFX_CACAO_BILATERAL_UPSCALE_WIDTH 8 +/// Height of the BILATERAL_UPSCALE pass tile size. +/// +/// @ingroup FfxCacao +#define FFX_CACAO_BILATERAL_UPSCALE_HEIGHT 8 + +/// The size of the context specified in 32bit values. +/// +/// @ingroup FfxCacao +#define FFX_CACAO_CONTEXT_SIZE (301054) + +/// FidelityFX CACAO context count. +/// +/// Defines the number of internal effect contexts required by CACAO. +/// +/// @ingroup FfxCacao +#define FFX_CACAO_CONTEXT_COUNT 1 + +/// An enumeration of the passes which constitutes the CACAO algorithm. +/// +/// @ingroup FfxCacao +typedef enum FfxCacaoPass +{ + FFX_CACAO_PASS_CLEAR_LOAD_COUNTER = 0, ///< + + FFX_CACAO_PASS_PREPARE_DOWNSAMPLED_DEPTHS = 1, ///< + FFX_CACAO_PASS_PREPARE_NATIVE_DEPTHS = 2, ///< + FFX_CACAO_PASS_PREPARE_DOWNSAMPLED_DEPTHS_AND_MIPS = 3, ///< + FFX_CACAO_PASS_PREPARE_NATIVE_DEPTHS_AND_MIPS = 4, ///< + FFX_CACAO_PASS_PREPARE_DOWNSAMPLED_NORMALS = 5, ///< + FFX_CACAO_PASS_PREPARE_NATIVE_NORMALS = 6, ///< + FFX_CACAO_PASS_PREPARE_DOWNSAMPLED_NORMALS_FROM_INPUT_NORMALS = 7, ///< + FFX_CACAO_PASS_PREPARE_NATIVE_NORMALS_FROM_INPUT_NORMALS = 8, ///< + FFX_CACAO_PASS_PREPARE_DOWNSAMPLED_DEPTHS_HALF = 9, ///< + FFX_CACAO_PASS_PREPARE_NATIVE_DEPTHS_HALF = 10, ///< + + FFX_CACAO_PASS_GENERATE_Q0 = 11, ///< + FFX_CACAO_PASS_GENERATE_Q1 = 12, ///< + FFX_CACAO_PASS_GENERATE_Q2 = 13, ///< + FFX_CACAO_PASS_GENERATE_Q3 = 14, ///< + FFX_CACAO_PASS_GENERATE_Q3_BASE = 15, ///< + + FFX_CACAO_PASS_GENERATE_IMPORTANCE_MAP = 16, ///< + FFX_CACAO_PASS_POST_PROCESS_IMPORTANCE_MAP_A = 17, ///< + FFX_CACAO_PASS_POST_PROCESS_IMPORTANCE_MAP_B = 18, ///< + + FFX_CACAO_PASS_EDGE_SENSITIVE_BLUR_1 = 19, ///< + FFX_CACAO_PASS_EDGE_SENSITIVE_BLUR_2 = 20, ///< + FFX_CACAO_PASS_EDGE_SENSITIVE_BLUR_3 = 21, ///< + FFX_CACAO_PASS_EDGE_SENSITIVE_BLUR_4 = 22, ///< + FFX_CACAO_PASS_EDGE_SENSITIVE_BLUR_5 = 23, ///< + FFX_CACAO_PASS_EDGE_SENSITIVE_BLUR_6 = 24, ///< + FFX_CACAO_PASS_EDGE_SENSITIVE_BLUR_7 = 25, ///< + FFX_CACAO_PASS_EDGE_SENSITIVE_BLUR_8 = 26, ///< + + FFX_CACAO_PASS_APPLY_NON_SMART_HALF = 27, ///< + FFX_CACAO_PASS_APPLY_NON_SMART = 28, ///< + FFX_CACAO_PASS_APPLY = 29, ///< + + FFX_CACAO_PASS_UPSCALE_BILATERAL_5X5 = 30, + + FFX_CACAO_PASS_COUNT ///< The number of passes in CACAO +} FfxCacaoPass; + +/// The quality levels that FidelityFX CACAO can generate SSAO at. This affects the number of samples taken for generating SSAO. +/// +/// @ingroup FfxCacao +typedef enum FfxCacaoQuality { + FFX_CACAO_QUALITY_LOWEST = 0, + FFX_CACAO_QUALITY_LOW = 1, + FFX_CACAO_QUALITY_MEDIUM = 2, + FFX_CACAO_QUALITY_HIGH = 3, + FFX_CACAO_QUALITY_HIGHEST = 4, +} FfxCacaoQuality; + +/// An enumeration of bit flags used when creating a +/// FfxCacaoContext. See FfxCacaoContextDescription. +/// +/// @ingroup FfxCacao +typedef enum FfxCacaoInitializationFlagBits { + FFX_CACAO_ENABLE_APPLY_SMART = (1<<0), ///< A bit indicating to use smart application +} FfxCacaoInitializationFlagBits; + +/// A structure for the settings used by FidelityFX CACAO. These settings may be updated with each draw call. +/// +/// @ingroup FfxCacao +typedef struct FfxCacaoSettings { + float radius; ///< [0.0, ~ ] World (view) space size of the occlusion sphere. + float shadowMultiplier; ///< [0.0, 5.0] Effect strength linear multiplier. + float shadowPower; ///< [0.5, 5.0] Effect strength pow modifier. + float shadowClamp; ///< [0.0, 1.0] Effect max limit (applied after multiplier but before blur). + float horizonAngleThreshold; ///< [0.0, 0.2] Limits self-shadowing (makes the sampling area less of a hemisphere, more of a spherical cone, to avoid self-shadowing and various artifacts due to low tessellation and depth buffer imprecision, etc.). + float fadeOutFrom; ///< [0.0, ~ ] Distance to start fading out the effect. + float fadeOutTo; ///< [0.0, ~ ] Distance at which the effect is faded out. + FfxCacaoQuality qualityLevel; ///< Effect quality, affects number of taps etc. + float adaptiveQualityLimit; ///< [0.0, 1.0] (only for quality level FFX_CACAO_QUALITY_HIGHEST). + uint32_t blurPassCount; ///< [ 0, 8] Number of edge-sensitive smart blur passes to apply. + float sharpness; ///< [0.0, 1.0] How much to bleed over edges; 1: not at all, 0.5: half-half; 0.0: completely ignore edges. + float temporalSupersamplingAngleOffset; ///< [0.0, PI] Used to rotate sampling kernel; If using temporal AA / supersampling, suggested to rotate by ( (frame%3)/3.0*PI ) or similar. Kernel is already symmetrical, which is why we use PI and not 2*PI. + float temporalSupersamplingRadiusOffset; ///< [0.0, 2.0] Used to scale sampling kernel; If using temporal AA / supersampling, suggested to scale by ( 1.0f + (((frame%3)-1.0)/3.0)*0.1 ) or similar. + float detailShadowStrength; ///< [0.0, 5.0] Used for high-res detail AO using neighboring depth pixels: adds a lot of detail but also reduces temporal stability (adds aliasing). + bool generateNormals; ///< This option should be set to FFX_CACAO_TRUE if FidelityFX-CACAO should reconstruct a normal buffer from the depth buffer. It is required to be FFX_CACAO_TRUE if no normal buffer is provided. + float bilateralSigmaSquared; ///< [0.0, ~ ] Sigma squared value for use in bilateral upsampler giving Gaussian blur term. Should be greater than 0.0. + float bilateralSimilarityDistanceSigma; ///< [0.0, ~ ] Sigma squared value for use in bilateral upsampler giving similarity weighting for neighbouring pixels. Should be greater than 0.0. +} FfxCacaoSettings; + +/// The default settings used by FidelityFX CACAO. +/// +/// @ingroup FfxCacao +static const FfxCacaoSettings FFX_CACAO_DEFAULT_SETTINGS = { + /* radius */ 1.2f, + /* shadowMultiplier */ 1.0f, + /* shadowPower */ 1.50f, + /* shadowClamp */ 0.98f, + /* horizonAngleThreshold */ 0.06f, + /* fadeOutFrom */ 50.0f, + /* fadeOutTo */ 300.0f, + /* qualityLevel */ FFX_CACAO_QUALITY_HIGHEST, + /* adaptiveQualityLimit */ 0.45f, + /* blurPassCount */ 2, + /* sharpness */ 0.98f, + /* temporalSupersamplingAngleOffset */ 0.0f, + /* temporalSupersamplingRadiusOffset */ 0.0f, + /* detailShadowStrength */ 0.5f, + /* generateNormals */ false, + /* bilateralSigmaSquared */ 5.0f, + /* bilateralSimilarityDistanceSigma */ 0.01f, +}; + +/// A structure for the constant buffer used by FidelityFX CACAO. +/// +/// @ingroup FfxCacao +typedef struct FfxCacaoConstants { + float DepthUnpackConsts[2]; /// Multiply and add values for clip to view depth conversion. + float CameraTanHalfFOV[2]; /// tan(fov/2) for the x and y dimensions. + + float NDCToViewMul[2]; /// Multiplication value for normalized device coordinates (NDC) to View conversion. + float NDCToViewAdd[2]; /// Addition value for NDC to view conversion. + + float DepthBufferUVToViewMul[2]; /// Multiplication value for the depth buffer's UV to View conversion. + float DepthBufferUVToViewAdd[2]; /// Addition value for the depth buffer's UV to view conversion. + + float EffectRadius; /// The radius in world space of the occlusion sphere. A larger radius will make further objects contribute to the ambient occlusion of a point. + float EffectShadowStrength; /// The linear multiplier for shadows. Higher values intensify the shadow. + float EffectShadowPow; /// The exponent for shadow values. Larger values create darker shadows. + float EffectShadowClamp; /// Clamps the shadow values to be within a certain range. + + float EffectFadeOutMul; /// Multiplication value for effect fade out. + float EffectFadeOutAdd; /// Addition value for effect fade out. + float EffectHorizonAngleThreshold; /// Minimum angle necessary between geometry and a point to create occlusion. Adjusting this value helps reduce self-shadowing. + float EffectSamplingRadiusNearLimitRec; /// Default: EffectRadius*1.2. Used to set limit on the sampling disk size when near. + + float DepthPrecisionOffsetMod; /// Default: 0.9992. Offset used to prevent artifacts due to imprecision. + float NegRecEffectRadius; /// Negative reciprocal of the effect radius. + float LoadCounterAvgDiv; /// Multiplier value to get average from loadcounter value. + float AdaptiveSampleCountLimit; /// Limits the total number of samples taken at adaptive quality levels. + + float InvSharpness; /// The sharpness controls how much blur should bleed over edges. + int BlurNumPasses; /// Number of blur passes. Default uses 4, with lowest quality using 2. + float BilateralSigmaSquared; /// Only affects downsampled SSAO. Higher values create a larger blur. + float BilateralSimilarityDistanceSigma; /// Only affects downsampled SSAO. Lower values create sharper edges. + + float PatternRotScaleMatrices[4][5][4]; /// Sampling pattern rotation/scale matrices. + + float NormalsUnpackMul; /// Multiplication value to unpack normals. Set to 1 if normals are already in [-1,1] range. + float NormalsUnpackAdd; /// Addition value to unpack normals. Set to 0 if normals are already in [-1,1]range. + float DetailAOStrength; /// Adds in more detailed shadows based on edges. These are less temporally stable. + float Dummy0; + + float SSAOBufferDimensions[2]; /// Dimensions of SSAO buffer. + float SSAOBufferInverseDimensions[2]; + + float DepthBufferDimensions[2]; /// Dimensions of the depth buffer. + float DepthBufferInverseDimensions[2]; + + int DepthBufferOffset[2]; /// Default is (0,0). Read offset for depth buffer. + int Pad[2]; + float PerPassFullResUVOffset[4*4]; /// UV Offsets used in adaptive approach. + + float InputOutputBufferDimensions[2]; /// Dimensions of the output AO buffer. + float InputOutputBufferInverseDimensions[2]; + + float ImportanceMapDimensions[2]; /// Dimensions of the importance map. + float ImportanceMapInverseDimensions[2]; + + float DeinterleavedDepthBufferDimensions[2]; /// Dimensions of the deinterleaved depth buffer. + float DeinterleavedDepthBufferInverseDimensions[2]; + + float DeinterleavedDepthBufferOffset[2]; /// Default is (0,0). Read offset for the deinterleaved depth buffer. + float DeinterleavedDepthBufferNormalisedOffset[2]; /// Default is (0,0). Normalized read offset for the deinterleaved depth buffer. + + FfxFloat32x4x4 NormalsWorldToViewspaceMatrix; /// Normal matrix. + +} FfxCacaoConstants; + +/// A structure encapsulating the parameters required to initialize FidelityFX CACAO. +/// +/// @ingroup FfxCacao +typedef struct FfxCacaoContextDescription +{ + + uint32_t width; ///< width of the input/output buffers + uint32_t height; ///< height of the input/output buffers + bool useDownsampledSsao; ///< Whether SSAO should be generated at native resolution or half resolution. It is recommended to enable this setting for improved performance. + FfxInterface backendInterface; +} FfxCacaoContextDescription; + +/// A structure encapsulating the parameters and resources required to dispatch FidelityFX CACAO. +/// +/// @ingroup FfxCacao +typedef struct FfxCacaoDispatchDescription +{ + FfxCommandList commandList; ///< The FfxCommandList to record CACAO rendering commands into. + FfxResource depthBuffer; ///< A FfxResource containing the depth buffer for the current frame. + FfxResource normalBuffer; ///< A FfxResource containing the normal buffer for the current frame. + FfxResource outputBuffer; ///< A FfxResource containing the output color buffer for CACAO. + FfxFloat32x4x4* proj; ///< A FfxFloat32x4x4 containing the projection matrix for the current frame. + FfxFloat32x4x4* normalsToView; ///< A FfxFloat32x4x4 containing the normal matrix for the current frame. + float normalUnpackMul; /// Multiplication value to unpack normals. Set to 1 if normals are already in [-1,1] range. + float normalUnpackAdd; /// Addition value to unpack normals. Set to 0 if normals are already in [-1,1]range. +} FfxCacaoDispatchDescription; + +/// A structure containing sizes of each of the buffers used by FidelityFX CACAO. +/// +/// @ingroup FfxCacao +typedef struct FfxCacaoBufferSizeInfo { + uint32_t inputOutputBufferWidth; ///< width of the input/output buffers + uint32_t inputOutputBufferHeight; ///< height of the input/output buffers + + uint32_t ssaoBufferWidth; ///< width of the ssao buffer + uint32_t ssaoBufferHeight; ///< height of the ssao buffer + + uint32_t depthBufferXOffset; ///< x-offset to use when sampling depth buffer + uint32_t depthBufferYOffset; ///< y-offset to use when sampling depth buffer + + uint32_t depthBufferWidth; ///< width of the passed in depth buffer + uint32_t depthBufferHeight; ///< height of the passed in depth buffer + + uint32_t deinterleavedDepthBufferXOffset; ///< x-offset to use when sampling de-interleaved depth buffer + uint32_t deinterleavedDepthBufferYOffset; ///< y-offset to use when sampling de-interleaved depth buffer + + uint32_t deinterleavedDepthBufferWidth; ///< width of the de-interleaved depth buffer + uint32_t deinterleavedDepthBufferHeight; ///< height of the de-interleaved depth buffer + + uint32_t importanceMapWidth; ///< width of the importance map buffer + uint32_t importanceMapHeight; ///< height of the importance map buffer + + uint32_t downsampledSsaoBufferWidth; ///< width of the downsampled ssao buffer + uint32_t downsampledSsaoBufferHeight; ///< height of the downsampled ssao buffer +} FfxCacaoBufferSizeInfo; + +/// An enumeration of bit flags used when dispatching FidelityFX CACAO +/// +/// @ingroup FfxCacao +typedef enum FfxCacaoDispatchFlagsBits { + + FFX_CACAO_SRV_SSAO_REMAP_TO_PONG = (1<<0), ///< A bit indicating the SRV maps to pong texture + FFX_CACAO_UAV_SSAO_REMAP_TO_PONG = (1<<1), ///< A bit indicating the UAV maps to pong texture +} FfxCacaoDispatchFlagsBits; + +/// A structure encapsulating the FidelityFX CACAO context. +/// +/// This sets up an object which contains all persistent internal data and +/// resources that are required by CACAO. +/// +/// The FfxCacaoContext object should have a lifetime matching +/// your use of CACAO. Before destroying the CACAO context care should be taken +/// to ensure the GPU is not accessing the resources created or used by CACAO. +/// It is therefore recommended that the GPU is idle before destroying the +/// CACAO context. +/// +/// @ingroup FfxCacao +typedef struct FfxCacaoContext +{ + uint32_t data[FFX_CACAO_CONTEXT_SIZE]; ///< An opaque set of uint32_t which contain the data for the context. +} FfxCacaoContext; + +/// Create a FidelityFX CACAO context from the parameters +/// programmed to the FfxCacaoContextDescription structure. +/// +/// The context structure is the main object used to interact with the CACAO +/// API, and is responsible for the management of the internal resources +/// used by the CACAO algorithm. When this API is called, multiple calls +/// will be made via the pointers contained in the backendInterface +/// structure. This backend will attempt to retrieve the device capabilities, +/// and create the internal resources, and pipelines required by CACAO to function. +/// Depending on the precise configuration used when +/// creating the FfxCacaoContext a different set of resources and +/// pipelines might be requested via the callback functions. +/// +/// The FfxCacaoContext should be destroyed when use of it is +/// completed, typically when an application is unloaded or CACAO +/// upscaling is disabled by a user. To destroy the CACAO context you +/// should call ffxCacaoContextDestroy. +/// +/// @param [out] pContext A pointer to a FfxCacaoContext structure to populate. +/// @param [in] pContextDescription A pointer to a FfxCacaoContextDescription structure. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context or contextDescription was NULL. +/// @retval +/// FFX_ERROR_INCOMPLETE_INTERFACE The operation failed because the FfxCacaoContextDescription.callbacks was not fully specified. +/// @retval +/// FFX_ERROR_BACKEND_API_ERROR The operation failed because of an error returned from the backend. +/// +/// @ingroup FfxCacao +FFX_API FfxErrorCode ffxCacaoContextCreate(FfxCacaoContext* context, const FfxCacaoContextDescription* contextDescription); + +/// Dispatches work to the FidelityFX CACAO context +/// +/// @param [out] pContext A pointer to a FfxCacaoContext structure to populate. +/// @param [in] pDispatchDescription A pointer to a FfxCacaoDispatchDescription structure. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context or dispatchDescription was NULL. +/// @retval +/// FFX_ERROR_BACKEND_API_ERROR The operation failed because of an error returned from the backend. +/// +/// @ingroup FfxCacao +FFX_API FfxErrorCode ffxCacaoContextDispatch(FfxCacaoContext* context, const FfxCacaoDispatchDescription* dispatchDescription); + +/// Destroy the FidelityFX CACAO context. +/// +/// @param [out] pContext A pointer to a FfxCacaoContext structure to destroy. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because context was NULL. +/// +/// @ingroup FfxCacao +FFX_API FfxErrorCode ffxCacaoContextDestroy(FfxCacaoContext* context); + +/// Updates the settings used by CACAO. +/// @param [in] context A pointer to a FfxCacaoContext structure to change settings for. +/// @param [in] settings A pointer to a FfxCacaoSettings structure. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context or settings was NULL. +/// +/// @ingroup FfxCacao +FFX_API FfxErrorCode ffxCacaoUpdateSettings(FfxCacaoContext* context, const FfxCacaoSettings* settings, const bool useDownsampledSsao); + +/// Queries the effect version number. +/// +/// @returns +/// The SDK version the effect was built with. +/// +/// @ingroup FfxCacao +FFX_API FfxVersionNumber ffxCacaoGetEffectVersion(); diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_cas.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_cas.h new file mode 100644 index 00000000..872d7d79 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_cas.h @@ -0,0 +1,209 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +// @defgroup CAS + +#pragma once + +// Include the interface for the backend of the CAS API. +#include + +/// @defgroup ffxCas FidelityFX Cas +/// FidelityFX Contrast Adaptive Sharpening runtime library +/// +/// @ingroup SDKComponents + +/// Contrast Adaptive Sharpening major version. +/// +/// @ingroup ffxCas +#define FFX_CAS_VERSION_MAJOR (1) + +/// Contrast Adaptive Sharpening minor version. +/// +/// @ingroup ffxCas +#define FFX_CAS_VERSION_MINOR (2) + +/// Contrast Adaptive Sharpening patch version. +/// +/// @ingroup ffxCas +#define FFX_CAS_VERSION_PATCH (0) + +/// FidelityFX CAS context count +/// +/// Defines the number of internal effect contexts required by CAS +/// +/// @ingroup ffxCas +#define FFX_CAS_CONTEXT_COUNT 1 + +/// The size of the context specified in 32bit values. +/// +/// @ingroup ffxCas +#define FFX_CAS_CONTEXT_SIZE (9206) + +#if defined(__cplusplus) +extern "C" { +#endif // #if defined(__cplusplus) + +/// An enumeration of all the passes which constitute the CAS algorithm. +/// +/// CAS has only one pass. For a more comprehensive description +/// of this pass, please refer to the CAS reference documentation. +/// +/// @ingroup ffxCas +typedef enum FfxCasPass +{ + FFX_CAS_PASS_SHARPEN = 0, ///< A pass which sharpens only or upscales the color buffer. + + FFX_CAS_PASS_COUNT ///< The number of passes performed by CAS. +} FfxCasPass; + +/// An enumeration of color space conversions used when creating a +/// FfxCASContext. See FfxCASContextDescription. +/// +/// @ingroup ffxCas +typedef enum FfxCasColorSpaceConversion +{ + FFX_CAS_COLOR_SPACE_LINEAR = 0, ///< Linear color space, will do nothing. + FFX_CAS_COLOR_SPACE_GAMMA20 = 1, ///< Convert gamma 2.0 to linear for input and linear to gamma 2.0 for output. + FFX_CAS_COLOR_SPACE_GAMMA22 = 2, ///< Convert gamma 2.2 to linear for input and linear to gamma 2.2 for output. + FFX_CAS_COLOR_SPACE_SRGB_OUTPUT = 3, ///< Only do sRGB conversion for output (input conversion will be done automatically). + FFX_CAS_COLOR_SPACE_SRGB_INPUT_OUTPUT = 4 ///< Convert sRGB to linear for input and linear to sRGB for output. +} FfxCasColorSpaceConversion; + +/// An enumeration of bit flags used when creating a +/// FfxCASContext. See FfxCASContextDescription. +/// +/// @ingroup ffxCas +typedef enum FfxCasInitializationFlagBits +{ + FFX_CAS_SHARPEN_ONLY = (1 << 0) ///< A bit indicating if we sharpen only. +} FfxCasInitializationFlagBits; + +/// A structure encapsulating the parameters required to initialize FidelityFX CAS +/// +/// @ingroup ffxCas +typedef struct FfxCasContextDescription +{ + uint32_t flags; ///< A collection of FfxCasInitializationFlagBits. + FfxCasColorSpaceConversion colorSpaceConversion; ///< An enumeration indicates which color space conversion is used. + FfxDimensions2D maxRenderSize; ///< The maximum size that rendering will be performed at. + FfxDimensions2D displaySize; ///< The size of the presentation resolution targeted by the upscaling process. + FfxInterface backendInterface; ///< A set of pointers to the backend implementation for CAS. +} FfxCasContextDescription; + +/// A structure encapsulating the parameters for dispatching the various passes +/// of FidelityFX CAS +/// +/// @ingroup ffxCas +typedef struct FfxCasDispatchDescription +{ + FfxCommandList commandList; ///< The FfxCommandList to record CAS rendering commands into. + FfxResource color; ///< A FfxResource containing the color buffer for the current frame (at render resolution). + FfxResource output; ///< A FfxResource containing the output color buffer for the current frame (at presentation resolution). + FfxDimensions2D renderSize; ///< The resolution that was used for rendering the input resource. + float sharpness; ///< The sharpness value between 0 and 1, where 0 is no additional sharpness and 1 is maximum additional sharpness. +} FfxCasDispatchDescription; + +/// A structure encapsulating the FidelityFX CAS context. +/// +/// This sets up an object which contains all persistent internal data and +/// resources that are required by CAS. +/// +/// The FfxCasContext object should have a lifetime matching +/// your use of CAS. Before destroying the CAS context care should be taken +/// to ensure the GPU is not accessing the resources created or used by CAS. +/// It is therefore recommended that the GPU is idle before destroying the +/// CAS context. +/// +/// @ingroup ffxCas +typedef struct FfxCasContext +{ + uint32_t data[FFX_CAS_CONTEXT_SIZE]; ///< An opaque set of uint32_t which contain the data for the context. +} FfxCasContext; + +/// Create a FidelityFX CAS context from the parameters +/// programmed to the FfxCasContextDescription structure. +/// +/// The context structure is the main object used to interact with the CAS, +/// and is responsible for the management of the internal resources +/// used by the CAS algorithm. When this API is called, multiple calls +/// will be made via the pointers contained in the callbacks +/// structure. These callbacks will attempt to retreive the device capabilities, +/// , and pipelines required by CAS frame-to-frame function. Depending on configuration +/// used when creating the FfxCasContext a different set of pipelines +/// might be requested via the callback functions. +/// +/// The FfxCasContext should be destroyed when use of it is +/// completed, typically when an application is unloaded or CAS is disabled by a user. +/// To destroy the CAS context you should call ffxCasContextDestroy. +/// +/// @param [out] pContext A pointer to a FfxCasContext structure to populate. +/// @param [in] pContextDescription A pointer to a FfxCasContextDescription structure. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context or contextDescription was NULL. +/// @retval +/// FFX_ERROR_INCOMPLETE_INTERFACE The operation failed because the FfxCasContextDescription.callbacks was not fully specified. +/// @retval +/// FFX_ERROR_BACKEND_API_ERROR The operation failed because of an error returned from the backend. +/// +/// @ingroup ffxCas +FFX_API FfxErrorCode ffxCasContextCreate(FfxCasContext* pContext, const FfxCasContextDescription* pContextDescription); + +/// @param [out] pContext A pointer to a FfxCasContext structure to populate. +/// @param [in] pDispatchDescription A pointer to a FfxCasDispatchDescription structure. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context or dispatchDescription was NULL. +/// @retval +/// FFX_ERROR_BACKEND_API_ERROR The operation failed because of an error returned from the backend. +/// +/// @ingroup ffxCas +FFX_API FfxErrorCode ffxCasContextDispatch(FfxCasContext* pContext, const FfxCasDispatchDescription* pDispatchDescription); + +/// Destroy the FidelityFX CAS context. +/// +/// @param [out] pContext A pointer to a FfxCasContext structure to destroy. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context was NULL. +/// +/// @ingroup ffxCas +FFX_API FfxErrorCode ffxCasContextDestroy(FfxCasContext* pContext); + +/// Queries the effect version number. +/// +/// @returns +/// The SDK version the effect was built with. +/// +/// @ingroup ffxCas +FFX_API FfxVersionNumber ffxCasGetEffectVersion(); + +#if defined(__cplusplus) +} +#endif // #if defined(__cplusplus) diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_classifier.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_classifier.h new file mode 100644 index 00000000..267154d6 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_classifier.h @@ -0,0 +1,288 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +// @defgroup Classifier + +#pragma once +#define FFX_CLASSIFIER_MAX_SHADOW_MAP_TEXTURES_COUNT 4 + +// Include the interface for the backend of the FSR2 API. +#include + +/// @defgroup ffxClassifier FidelityFX Classifier +/// FidelityFX Classifier runtime library +/// +/// @ingroup SDKComponents + + +/// FidelityFX Classifier major version. +/// +/// @ingroup ffxClassifier +#define FFX_CLASSIFIER_VERSION_MAJOR (1) + +/// FidelityFX Classifier minor version. +/// +/// @ingroup ffxClassifier +#define FFX_CLASSIFIER_VERSION_MINOR (3) + +/// FidelityFX Classifier patch version. +/// +/// @ingroup ffxClassifier +#define FFX_CLASSIFIER_VERSION_PATCH (0) + +/// FidelityFX Classifier context count +/// +/// Defines the number of internal effect contexts required by Classifier +/// +/// @ingroup ffxClassifier +#define FFX_CLASSIFIER_CONTEXT_COUNT 1 + +/// The size of the context specified in 32bit values. +/// +/// @ingroup ffxClassifier +#define FFX_CLASSIFIER_CONTEXT_SIZE (18500) + +#if defined(__cplusplus) +extern "C" { +#endif // #if defined(__cplusplus) + +/// Enum to specify which blur pass (currently only one). +/// +/// @ffxClassifier +typedef enum FfxClassifierPass +{ + FFX_CLASSIFIER_SHADOW_PASS_CLASSIFIER = 0, ///< The Tile Classification Pass + FFX_CLASSIFIER_REFLECTION_PASS_TILE_CLASSIFIER = 1, ///< Reflections tile classification pass + FFX_CLASSIFIER_PASS_COUNT ///< The number of passes in the Classifier effect +} FfxClassifierPass; + +/// An enumeration of bit flags used when creating a +/// FfxClassifierContext. See FfxClassifierContextDescription. +/// Currently, no flags exist. +/// +/// @ingroup ffxClassifier +typedef enum FfxClassifierInitializationFlagBits { + FFX_CLASSIFIER_SHADOW = (1 << 0), ///< A bit indicating the intent is to classify shadows + FFX_CLASSIFIER_CLASSIFY_BY_NORMALS = (1 << 1), ///< A bit indicating the intent is to classify by normals + FFX_CLASSIFIER_CLASSIFY_BY_CASCADES = (1 << 2), ///< A bit indicating the intent is to classify by cascades + FFX_CLASSIFIER_ENABLE_DEPTH_INVERTED = (1 << 3), ///< A bit indicating that the input depth buffer data provided is inverted [1..0]. + FFX_CLASSIFIER_REFLECTION = (1 << 4), ///< A bit indicating the intent is to classify reflections +} FfxClassifierInitializationFlagBits; + +/// A structure encapsulating the parameters required to initialize FidelityFX +/// Classifier. +/// +/// @ingroup ffxClassifier +typedef struct FfxClassifierContextDescription { + uint32_t flags; ///< A collection of @ref FfxClassifierInitializationFlagBits + FfxDimensions2D resolution; ///< Resolution of the shadow dispatch call + FfxInterface backendInterface; ///< A set of pointers to the backend implementation for FidelityFX Classifier +} FfxClassifierContextDescription; + +/// A structure encapsulating the parameters for dispatching +/// of FidelityFX Classifier for shadows +/// +/// @ingroup ffxClassifier +typedef struct FfxClassifierShadowDispatchDescription { + FfxCommandList commandList; ///< The FfxCommandList to record Classifier rendering commands into. + FfxResource depth; ///< The FfxResource (SRV Texture 0)containing depth information + FfxResource normals; ///< The FfxResource (SRV Texture 1)containing normals information + FfxResource shadowMaps[FFX_CLASSIFIER_MAX_SHADOW_MAP_TEXTURES_COUNT]; ///< The FfxResource (SRV Texture 2)containing shadowMap(s) information + FfxResource workQueue; ///< The FfxResource (UAV Buffer 0)Work Queue: rwsb_tiles. + FfxResource workQueueCount; ///< The FfxResource (UAV Buffer 1)Work Queue Counter: rwb_tileCount + FfxResource rayHitTexture; ///< The FfxResource (UAV Texture 0)Ray Hit Texture + + FfxFloat32 normalsUnPackMul; ///< A multiply factor to transform the normal to the space expected by the Classifier + FfxFloat32 normalsUnPackAdd; ///< An offset to transform the normal to the space expected by the Classifier + + // Constant Data + FfxFloat32x3 lightDir; ///< The light direction + FfxFloat32 sunSizeLightSpace; ///< The sun size + FfxUInt32 tileCutOff; ///< The tile cutoff + + FfxBoolean bRejectLitPixels; ///< UI Setting, selects wheter to reject lit pixels in the shadows maps + FfxUInt32 cascadeCount; ///< The number of cascades + FfxFloat32 blockerOffset; ///< UI Setting, the blocker offsett + + FfxBoolean bUseCascadesForRayT; ///< UI Setting, selects whether to use the classifier to save ray intervals + FfxFloat32 cascadeSize; ///< The cascade size + + FfxFloat32x4 cascadeScale[4]; ///< A multiply factor for each cascade + FfxFloat32x4 cascadeOffset[4]; ///< An offeset factor for each cascade + + // Matrices + FfxFloat32 viewToWorld[16]; + FfxFloat32 lightView[16]; + FfxFloat32 inverseLightView[16]; + +} FfxClassifierShadowDispatchDescription; + +/// A structure encapsulating the parameters for dispatching +/// of FidelityFX Classifier for reflections +/// +/// @ingroup ffxClassifier +typedef struct FfxClassifierReflectionDispatchDescription { + FfxCommandList commandList; ///< The FfxCommandList to record Hybrid Reflections rendering commands into. + FfxResource depth; ///< A FfxResource containing the depth buffer for the current frame (at render resolution). + FfxResource motionVectors; ///< A FfxResource containing the motion vectors buffer for the current frame (at render resolution). + FfxResource normal; ///< A FfxResource containing the normal buffer for the current frame (at render resolution). + FfxResource materialParameters; ///< A FfxResource containing the aoRoughnessMetallic buffer for the current frame (at render resolution). + FfxResource environmentMap; ///< A FfxResource containing the environment map to fallback to when screenspace data is not sufficient + FfxResource radiance; + FfxResource varianceHistory; + FfxResource hitCounter; + FfxResource hitCounterHistory; + FfxResource rayList; + FfxResource rayListHW; + FfxResource extractedRoughness; + FfxResource rayCounter; + FfxResource denoiserTileList; + FfxDimensions2D renderSize; ///< The resolution that was used for rendering the input resources. + float invViewProjection[16]; ///< An array containing the inverse of the view projection matrix in column major layout. + float projection[16]; ///< An array containing the projection matrix in column major layout. + float invProjection[16]; ///< An array containing the inverse of the projection matrix in column major layout. + float view[16]; ///< An array containing the view matrix in column major layout. + float invView[16]; ///< An array containing the inverse of the view matrix in column major layout. + float prevViewProjection[16]; ///< An array containing the previous frame's view projection matrix in column major layout. + float iblFactor; ///< A factor to control the intensity of the image based lighting. Set to 1 for an HDR probe. + uint32_t frameIndex; + uint32_t samplesPerQuad; + uint32_t temporalVarianceGuidedTracingEnabled; + float globalRoughnessThreshold; + float rtRoughnessThreshold; + uint32_t mask; + uint32_t reflectionWidth; + uint32_t reflectionHeight; + float hybridMissWeight; + float hybridSpawnRate; + float vrtVarianceThreshold; + float reflectionsBackfacingThreshold; + uint32_t randomSamplesPerPixel; + float motionVectorScale[2]; + float normalsUnpackMul; + float normalsUnpackAdd; + uint32_t roughnessChannel; + bool isRoughnessPerceptual; +} FfxClassifierReflectionDispatchDescription; + +/// A structure encapsulating the FidelityFX Classifier context. +/// +/// This sets up an object which contains all persistent internal data and +/// resources that are required by the Classifier. +/// +/// The FfxClassifierContext object should have a lifetime matching +/// your use of the Classifier. Before destroying the Classifier context care should be taken +/// to ensure the GPU is not accessing the resources created or used by the Classifier. +/// It is therefore recommended that the GPU is idle before destroying the +/// Classifier context. +/// +/// @ingroup ffxClassifier +typedef struct FfxClassifierContext { + uint32_t data[FFX_CLASSIFIER_CONTEXT_SIZE]; ///< An opaque set of uint32_t which contain the data for the context. +} FfxClassifierContext; + +/// Create a FidelityFX Classifier context from the parameters +/// programmed to the FfxClassifierContextDescription structure. +/// +/// The context structure is the main object used to interact with the Classifier +/// API, and is responsible for the management of the internal resources +/// used by the Classifier. When this API is called, multiple calls +/// will be made via the pointers contained in the backendInterface +/// structure. This backend will attempt to retrieve the device capabilities, +/// and create the internal resources, and pipelines required by the Classifier to function. +/// Depending on the precise configuration used when +/// creating the FfxClassifierContext a different set of resources and +/// pipelines might be requested via the callback functions. +/// +/// The FfxClassifierContext should be destroyed when use of it is +/// completed, typically when an application is unloaded or the Classifier +/// is disabled by a user. To destroy the Classifier context you +/// should call FfxClassifierContextDestroy. +/// +/// @param [out] pContext A pointer to a FfxClassifierContext structure to populate. +/// @param [in] pContextDescription A pointer to a FfxClassifierContextDescription structure. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context or contextDescription was NULL. +/// @retval +/// FFX_ERROR_INCOMPLETE_INTERFACE The operation failed because the FfxClassifierContextDescription.callbacks was not fully specified. +/// @retval +/// FFX_ERROR_BACKEND_API_ERROR The operation failed because of an error returned from the backend. +/// +/// @ingroup ffxClassifier +FFX_API FfxErrorCode ffxClassifierContextCreate(FfxClassifierContext* pContext, const FfxClassifierContextDescription* pContextDescription); + +/// Dispatches work to the FidelityFX Classifier context for shadows +/// +/// @param [in] pContext A pointer to a FfxClassifierContext structure. +/// @param [in] pDispatchDescription A pointer to a FfxClassifierShadowDispatchDescription structure. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context or dispatchDescription was NULL. +/// @retval +/// FFX_ERROR_BACKEND_API_ERROR The operation failed because of an error returned from the backend. +/// +/// @ingroup ffxClassifier +FFX_API FfxErrorCode ffxClassifierContextShadowDispatch(FfxClassifierContext* pContext, const FfxClassifierShadowDispatchDescription* pDispatchDescription); + +/// Dispatches work to the FidelityFX Classifier context for reflections +/// +/// @param [in] pContext A pointer to a FfxClassifierContext structure. +/// @param [in] pDispatchDescription A pointer to a FfxClassifierReflectionDispatchDescription structure. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context or dispatchDescription was NULL. +/// @retval +/// FFX_ERROR_BACKEND_API_ERROR The operation failed because of an error returned from the backend. +/// +/// @ingroup ffxClassifier +FFX_API FfxErrorCode ffxClassifierContextReflectionDispatch(FfxClassifierContext* pContext, const FfxClassifierReflectionDispatchDescription* pDispatchDescription); + +/// Destroy the FidelityFX Classifier context. +/// +/// @param [out] pContext A pointer to a FfxClassifierContext structure to destroy. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because context was NULL. +/// +/// @ingroup ffxClassifier +FFX_API FfxErrorCode ffxClassifierContextDestroy(FfxClassifierContext* pContext); + +/// Queries the effect version number. +/// +/// @returns +/// The SDK version the effect was built with. +/// +/// @ingroup ffxClassifier +FFX_API FfxVersionNumber ffxClassifierGetEffectVersion(); + +#if defined(__cplusplus) +} +#endif // #if defined(__cplusplus) diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_denoiser.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_denoiser.h new file mode 100644 index 00000000..5f9d23d7 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_denoiser.h @@ -0,0 +1,266 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#pragma once + +// Include the interface for the backend of the Denoiser API. +#include + +/// @defgroup FfxDenoiser FidelityFX Denoiser +/// FidelityFX Denoiser runtime library +/// +/// @ingroup SDKComponents + +/// FidelityFX Denoiser major version. +/// +/// @ingroup FfxDenoiser +#define FFX_DENOISER_VERSION_MAJOR (1) + +/// FidelityFX Denoiser minor version. +/// +/// @ingroup FfxDenoiser +#define FFX_DENOISER_VERSION_MINOR (3) + +/// FidelityFX Denoiser patch version. +/// +/// @ingroup FfxDenoiser +#define FFX_DENOISER_VERSION_PATCH (0) + +/// FidelityFX denoiser context count +/// +/// Defines the number of internal effect contexts required by the denoiser +/// +/// @ingroup FfxDenoiser +#define FFX_DENOISER_CONTEXT_COUNT 1 + +/// The size of the context specified in 32bit values. +/// +/// @ingroup Denoiser +#define FFX_DENOISER_CONTEXT_SIZE (73098) + +#if defined(__cplusplus) +extern "C" { +#endif // #if defined(__cplusplus) + +/// An enumeration of the pass which constitutes the Denoiser algorithm. +/// +/// @ingroup Denoiser +typedef enum FfxDenoiserPass +{ + FFX_DENOISER_PASS_PREPARE_SHADOW_MASK = 0, + FFX_DENOISER_PASS_SHADOWS_TILE_CLASSIFICATION = 1, + FFX_DENOISER_PASS_FILTER_SOFT_SHADOWS_0 = 2, + FFX_DENOISER_PASS_FILTER_SOFT_SHADOWS_1 = 3, + FFX_DENOISER_PASS_FILTER_SOFT_SHADOWS_2 = 4, + FFX_DENOISER_PASS_REPROJECT_REFLECTIONS = 5, ///< A pass which reprojects and estimates the variance. + FFX_DENOISER_PASS_PREFILTER_REFLECTIONS = 6, ///< A pass which spatially filters the reflections. + FFX_DENOISER_PASS_RESOLVE_TEMPORAL_REFLECTIONS = 7, ///< A pass which temporally filters the reflections. + + FFX_DENOISER_PASS_COUNT ///< The number of passes in Denoiser +} FfxDenoiserPass; + +/// An enumeration of bit flags used when creating a +/// FfxDenoiserContext. See FfxDenoiserContextDescription. +/// +/// @ingroup FfxDenoiser +typedef enum FfxDenoiserInitializationFlagBits { + + FFX_DENOISER_SHADOWS = (1 << 0), ///< A bit indicating that the denoiser is used for denoising shadows + FFX_DENOISER_REFLECTIONS = (1 << 1), ///< A bit indicating that the denoiser is used for denoising reflections + FFX_DENOISER_ENABLE_DEPTH_INVERTED = (1 << 2), ///< A bit indicating that the input depth buffer data provided is inverted [1..0]. +} FfxDenoiserInitializationFlagBits; + +/// A structure encapsulating the parameters required to initialize FidelityFX Denoiser +/// +/// @ingroup FfxDenoiser +typedef struct FfxDenoiserContextDescription { + + uint32_t flags; ///< A collection of FfxDenoiserInitializationFlagBits + FfxDimensions2D windowSize; ///< The resolution that was used for rendering the input resource. + FfxSurfaceFormat normalsHistoryBufferFormat; ///< The format used by the reflections denoiser to store the normals buffer history + FfxInterface backendInterface; ///< A set of pointers to the backend implementation for FidelityFX. +} FfxDenoiserContextDescription; + +/// A structure encapsulating the parameters for dispatching +/// of FidelityFX Denoiser +/// +/// @ingroup FfxDenoiser +typedef struct FfxDenoiserShadowsDispatchDescription { + + FfxCommandList commandList; ///< The FfxCommandList to record Denoiser rendering commands into. + FfxResource hitMaskResults; ///< A FfxResource containing the raytracing results where every pixel represents a 8x4 tile. + FfxResource depth; ///< A FfxResource containing 32bit depth values for the current frame. + FfxResource velocity; ///< A FfxResource containing 2-dimensional motion vectors. + FfxResource normal; ///< A FfxResource containing the normals. + FfxResource shadowMaskOutput; ///< A FfxResource which is used to store the fullscreen raytracing output. + + FfxFloat32x2 motionVectorScale; ///< A multiply factor to transform the motion vectors to the space expected by the shadow denoiser. + FfxFloat32 normalsUnpackMul; ///< A multiply factor to transform the normal to the space expected by the shadow denoiser. + FfxFloat32 normalsUnpackAdd; ///< An offset to transform the normal to the space expected by the shadow denoiser. + + FfxFloat32x3 eye; ///< The camera position + uint32_t frameIndex; ///< The current frame index + FfxFloat32 projectionInverse[16]; ///< The inverse of the camera projection matrix + FfxFloat32 reprojectionMatrix[16]; ///< The result of multiplying the projection matrix of the current frame by the result of the multiplication between the camera previous's frame view matrix by the inverse of the view-projection matrix + FfxFloat32 viewProjectionInverse[16]; ///< The inverse of the camera view-projection matrix + + FfxFloat32 depthSimilaritySigma; ///< A constant factor used in the denoising filters, defaults to 1.0f + +} FfxDenoiserShadowsDispatchDescription; + +/// A structure encapsulating the parameters for dispatching +/// of FidelityFX Denoiser +/// +/// @ingroup FfxDenoiser +typedef struct FfxDenoiserReflectionsDispatchDescription { + + FfxCommandList commandList; ///< The FfxCommandList to record Denoiser rendering commands into. + FfxResource depthHierarchy; ///< A FfxResource containing the depth buffer with full mip maps for the current frame. + FfxResource motionVectors; ///< A FfxResource containing the motion vectors buffer for the current frame. + FfxResource normal; ///< A FfxResource containing the normal buffer for the current frame. + FfxResource radianceA; ///< A FfxResource containing the ping-pong radiance buffers to filter. + FfxResource radianceB; ///< A FfxResource containing the ping-pong radiance buffers to filter. + FfxResource varianceA; ///< A FfxResource containing the ping-pong variance buffers used to filter and guide reflections. + FfxResource varianceB; ///< A FfxResource containing the ping-pong variance buffers used to filter and guide reflections. + FfxResource extractedRoughness; ///< A FfxResource containing the roughness of the current frame. + FfxResource denoiserTileList; ///< A FfxResource containing the tiles to be denoised. + FfxResource indirectArgumentsBuffer; ///< A FfxResource containing the indirect arguments used by the indirect dispatch calls tha compose the denoiser. + FfxResource output; ///< A FfxResource to store the denoised reflections. + FfxDimensions2D renderSize; ///< The resolution that was used for rendering the input resources. + FfxFloatCoords2D motionVectorScale; ///< The scale factor to apply to motion vectors. + float invProjection[16]; ///< An array containing the inverse of the projection matrix in column major layout. + float invView[16]; ///< An array containing the inverse of the view matrix in column major layout. + float prevViewProjection[16]; ///< An array containing the view projection matrix of the previous frame in column major layout. + float normalsUnpackMul; ///< A multiply factor to transform the normal to the space expected by SSSR. + float normalsUnpackAdd; ///< An offset to transform the normal to the space expected by SSSR. + bool isRoughnessPerceptual; ///< A boolean to describe the space used to store roughness in the materialParameters texture. If false, we assume roughness squared was stored in the Gbuffer. + uint32_t roughnessChannel; ///< The channel to read the roughness from the materialParameters texture + float temporalStabilityFactor; ///< A boolean to describe the space used to store roughness in the materialParameters texture. If false, we assume roughness squared was stored in the Gbuffer. + float roughnessThreshold; ///< Regions with a roughness value greater than this threshold won't spawn rays. + uint32_t frameIndex; ///< The index of the current frame. + bool reset; +} FfxDenoiserReflectionsDispatchDescription; + + +/// A structure encapsulating the FidelityFX denoiser context. +/// +/// This sets up an object which contains all persistent internal data and +/// resources that are required by Denoiser. +/// +/// The FfxDenoiserContext object should have a lifetime matching +/// your use of Denoiser. Before destroying the Denoiser context care should be taken +/// to ensure the GPU is not accessing the resources created or used by Denoiser. +/// It is therefore recommended that the GPU is idle before destroying the +/// Denoiser context. +/// +/// @ingroup FfxDenoiser +typedef struct FfxDenoiserContext { + + uint32_t data[FFX_DENOISER_CONTEXT_SIZE]; ///< An opaque set of uint32_t which contain the data for the context. +} FfxDenoiserContext; + +/// Create a FidelityFX Denoiser context from the parameters +/// programmed to the FfxDenoiserContextDescription structure. +/// +/// The context structure is the main object used to interact with the +/// Denoiser API, and is responsible for the management of the internal resources +/// used by the Denoiser algorithm. When this API is called, multiple calls +/// will be made via the pointers contained in the backendInterface +/// structure. This backend will attempt to retrieve the device capabilities, +/// and create the internal resources, and pipelines required by Denoiser to function. +/// Depending on the precise configuration used when +/// creating the FfxDenoiserContext a different set of resources and +/// pipelines might be requested via the callback functions. +/// +/// The FfxDenoiserContext should be destroyed when use of it is +/// completed, typically when an application is unloaded or shadow +/// denoising is disabled by a user. To destroy the Denoiser context you +/// should call ffxDenoiserContextDestroy. +/// +/// @param [out] context A pointer to a FfxDenoiserContext structure to populate. +/// @param [in] contextDescription A pointer to a FfxDenoiserContextDescription structure. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context or contextDescription was NULL. +/// @retval +/// FFX_ERROR_INCOMPLETE_INTERFACE The operation failed because the FfxDenoiserContextDescription.callbacks was not fully specified. +/// @retval +/// FFX_ERROR_BACKEND_API_ERROR The operation failed because of an error returned from the backend. +/// +/// @ingroup FfxDenoiser +FFX_API FfxErrorCode ffxDenoiserContextCreate(FfxDenoiserContext* pContext, const FfxDenoiserContextDescription* pContextDescription); + +/// Dispatches work to the FidelityFX Denoiser context +/// +/// @param [out] context A pointer to a FfxDenoiserContext structure to populate. +/// @param [in] dispatchDescription A pointer to a FfxDenoiserShadowsDispatchDescription structure. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context or dispatchDescription was NULL. +/// @retval +/// FFX_ERROR_BACKEND_API_ERROR The operation failed because of an error returned from the backend. +/// +/// @ingroup FfxDenoiser +FFX_API FfxErrorCode ffxDenoiserContextDispatchShadows(FfxDenoiserContext* context, const FfxDenoiserShadowsDispatchDescription* dispatchDescription); + +/// Dispatches work to the FidelityFX Denoiser context +/// +/// @param [out] context A pointer to a FfxDenoiserContext structure to populate. +/// @param [in] dispatchDescription A pointer to a FfxDenoiserReflectionsDispatchDescription structure. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context or dispatchDescription was NULL. +/// @retval +/// FFX_ERROR_BACKEND_API_ERROR The operation failed because of an error returned from the backend. +/// +/// @ingroup FfxDenoiser +FFX_API FfxErrorCode ffxDenoiserContextDispatchReflections(FfxDenoiserContext* context, const FfxDenoiserReflectionsDispatchDescription* dispatchDescription); + +/// Destroy the FidelityFX Denoiser context. +/// +/// @param [out] context A pointer to a FfxDenoiserContext structure to destroy. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context was NULL. +/// +/// @ingroup FfxDenoiser +FFX_API FfxErrorCode ffxDenoiserContextDestroy(FfxDenoiserContext* context); + +/// Queries the effect version number. +/// +/// @returns +/// The SDK version the effect was built with. +/// +/// @ingroup FfxDenoiser +FFX_API FfxVersionNumber ffxDenoiserGetEffectVersion(); + +#if defined(__cplusplus) +} +#endif // #if defined(__cplusplus) diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_dof.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_dof.h new file mode 100644 index 00000000..58ac2f4c --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_dof.h @@ -0,0 +1,263 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +// @defgroup DOF + +#pragma once + +// Include the interface for the backend of the FSR2 API. +#include + +/// @defgroup ffxDof FidelityFX DoF +/// FidelityFX Depth of Field runtime library +/// +/// @ingroup SDKComponents + + +/// FidelityFX DOF major version. +/// +/// @ingroup ffxDof +#define FFX_DOF_VERSION_MAJOR (1) + +/// FidelityFX DOF minor version. +/// +/// @ingroup ffxDof +#define FFX_DOF_VERSION_MINOR (1) + +/// FidelityFX DOF patch version. +/// +/// @ingroup ffxDof +#define FFX_DOF_VERSION_PATCH (0) + +/// FidelityFX DOF context count +/// +/// Defines the number of internal effect contexts required by DOF +/// +/// @ingroup ffxDof +#define FFX_DOF_CONTEXT_COUNT 1 + +/// The size of the context specified in 32bit values. +/// +/// @ingroup ffxDof +#define FFX_DOF_CONTEXT_SIZE (45674) + +#if defined(__cplusplus) +extern "C" { +#endif // #if defined(__cplusplus) + +/// An enumeration of the passes which constitute the DoF algorithm. +/// +/// DOF is implemented as a composite of several compute passes each +/// computing a key part of the final result. Each call to the +/// FfxDofScheduleGpuJobFunc callback function will +/// correspond to a single pass included in FfxDofPass. For a +/// more comprehensive description of each pass, please refer to the DoF +/// reference documentation. +/// +/// @ingroup ffxDof +typedef enum FfxDofPass { + FFX_DOF_PASS_DOWNSAMPLE_DEPTH = 0, ///< A pass which downsamples the depth buffer + FFX_DOF_PASS_DOWNSAMPLE_COLOR = 1, ///< A pass which downsamples the color buffer + FFX_DOF_PASS_DILATE = 2, ///< A pass which dilates the depth tile buffer + FFX_DOF_PASS_BLUR = 3, ///< A pass which performs the depth of field blur + FFX_DOF_PASS_COMPOSITE = 4, ///< A pass which combines the blurred images with the sharp input + FFX_DOF_PASS_COUNT ///< The number of passes in DOF +} FfxDofPass; + +/// An enumeration of bit flags used when creating a +/// FfxDofContext. See FfxDofContextDescription. +/// Curently, no flags exist. +/// +/// @ingroup ffxDof +typedef enum FfxDofInitializationFlagBits { + FFX_DOF_REVERSE_DEPTH = (1 << 0), ///< A bit indicating whether input depth is reversed (1 is closest) + FFX_DOF_OUTPUT_PRE_INIT = (1 << 1), ///< A bit indicating whether the output is pre-initialized with the input color (e.g. it is the same texture) + FFX_DOF_DISABLE_RING_MERGE = (1 << 2), ///< A bit indicating whether to disable merging kernel rings +} FfxDofInitializationFlagBits; + +/// A structure encapsulating the parameters required to initialize FidelityFX +/// Depth of Field. +/// +/// @ingroup ffxDof +typedef struct FfxDofContextDescription { + uint32_t flags; ///< A collection of @ref FfxDofInitializationFlagBits + uint32_t quality; ///< The number of rings to be used in the DoF blur kernel + FfxDimensions2D resolution; ///< Resolution of the input and output textures + FfxInterface backendInterface; ///< A set of pointers to the backend implementation for FidelityFX + float cocLimitFactor; ///< The limit to apply to circle of confusion size as a factor for resolution height +} FfxDofContextDescription; + +/// A structure encapsulating the parameters for dispatching +/// of FidelityFX Depth of Field +/// +/// @ingroup ffxDof +typedef struct FfxDofDispatchDescription { + FfxCommandList commandList; ///< The FfxCommandList to record DoF rendering commands into. + FfxResource color; ///< The FfxResource containing color information + FfxResource depth; ///< The FfxResource containing depth information + FfxResource output; ///< The FfxResource to output into. Can be the same as the color input. + float cocScale; ///< The factor converting depth to circle of confusion size. Can be calculated using ffxDofCalculateCocScale. + float cocBias; ///< The bias to apply to circle of confusion size. Can be calculated using ffxDofCalculateCocBias. +} FfxDofDispatchDescription; + +/// A structure encapsulating the FidelityFX Depth of Field context. +/// +/// This sets up an object which contains all persistent internal data and +/// resources that are required by DoF. +/// +/// The FfxDofContext object should have a lifetime matching +/// your use of DoF. Before destroying the DoF context care should be taken +/// to ensure the GPU is not accessing the resources created or used by DoF. +/// It is therefore recommended that the GPU is idle before destroying the +/// DoF context. +/// +/// @ingroup ffxDof +typedef struct FfxDofContext { + uint32_t data[FFX_DOF_CONTEXT_SIZE]; ///< An opaque set of uint32_t which contain the data for the context. +} FfxDofContext; + +/// Create a FidelityFX Depth of Field context from the parameters +/// programmed to the FfxDofContextDescription structure. +/// +/// The context structure is the main object used to interact with the Depth of +/// Field API, and is responsible for the management of the internal resources +/// used by the DoF algorithm. When this API is called, multiple calls +/// will be made via the pointers contained in the backendInterface +/// structure. This backend will attempt to retrieve the device capabilities, +/// and create the internal resources, and pipelines required by DoF to function. +/// Depending on the precise configuration used when +/// creating the FfxDofContext a different set of resources and +/// pipelines might be requested via the callback functions. +/// +/// The FfxDofContext should be destroyed when use of it is +/// completed, typically when an application is unloaded or DoF +/// is disabled by a user. To destroy the DoF context you +/// should call ffxDofContextDestroy. +/// +/// @param [out] pContext A pointer to a FfxDofContext structure to populate. +/// @param [in] pContextDescription A pointer to a FfxDofContextDescription structure. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context or contextDescription was NULL. +/// @retval +/// FFX_ERROR_INCOMPLETE_INTERFACE The operation failed because the FfxDofContextDescription.callbacks was not fully specified. +/// @retval +/// FFX_ERROR_BACKEND_API_ERROR The operation failed because of an error returned from the backend. +/// +/// @ingroup ffxDof +FFX_API FfxErrorCode ffxDofContextCreate(FfxDofContext* pContext, const FfxDofContextDescription* pContextDescription); + +/// Dispatches work to the FidelityFX DoF context +/// +/// @param [in] pContext A pointer to a FfxDofContext structure. +/// @param [in] pDispatchDescription A pointer to a FfxDofDispatchDescription structure. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context or dispatchDescription was NULL. +/// @retval +/// FFX_ERROR_BACKEND_API_ERROR The operation failed because of an error returned from the backend. +/// +/// @ingroup ffxDof +FFX_API FfxErrorCode ffxDofContextDispatch(FfxDofContext* pContext, const FfxDofDispatchDescription* pDispatchDescription); + +/// Destroy the FidelityFX DoF context. +/// +/// @param [out] pContext A pointer to a FfxDofContext structure to destroy. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because context was NULL. +/// +/// @ingroup ffxDof +FFX_API FfxErrorCode ffxDofContextDestroy(FfxDofContext* pContext); + +/// Queries the effect version number. +/// +/// @returns +/// The SDK version the effect was built with. +/// +/// @ingroup ffxDof +FFX_API FfxVersionNumber ffxDofGetEffectVersion(); + +#if defined(__cplusplus) +} +#endif // #if defined(__cplusplus) + + +/// Calculates the scale parameter in the thin lens model according to lens and projection parameters. +/// @param aperture Aperture radius in view space units +/// @param focus Distance to focus plane in view space units +/// @param focalLength Lens focal length in view space units +/// @param conversion Conversion factor for view units to pixels (i.e. image width in pixels / sensor size) +/// @param proj33 Element (3,3) of the projection matrix (z range scale) +/// @param proj34 Element (3,4) of the projection matrix (z range offset) +/// @param proj43 Element (4,3) of the projection matrix (typically 1 or -1) +/// +/// @ingroup ffxDof +static inline float ffxDofCalculateCocScale(float aperture, float focus, float focalLength, float conversion, + float proj33, float proj34, float proj43) +{ + (void)proj33; + // z = (vd * proj33 + proj34) / (vd * proj43) = proj33/proj43 + proj34/(vd*proj43) + // => view depth = proj34 / (z*proj43 - proj33) + // C = (A * L * (F - D)) / (D * (F - L)) + // = AL/(F-L) * (F/D - 1) + // = AL/(F-L) * (F(z*p43-p33)/p34 - 1) ignore non-factor terms + // = AL/(F-L) * (F(z*p43-.)/p34 - .) + // = AL/(F-L) * (F(z*p43-.)/p34 - .) + // = AL/(F-L) * F*z*p43/p34 + . + // = z * AL/(F-L) * F*p43/p34 + . + float absFocus = focus < 0 ? -focus : focus; + float commonFactor = conversion * aperture * focalLength / (absFocus - focalLength); + return commonFactor * focus * (proj43 / proj34); +} + +/// Calculates the bias parameter in the thin lens model according to lens and projection parameters. +/// @param aperture Aperture radius in view space units +/// @param focus Distance to focus plane in view space units +/// @param focalLength Lens focal length in view space units +/// @param conversion Conversion factor for view units to pixels (i.e. image width in pixels / sensor size) +/// @param proj33 Element (3,3) of the projection matrix (a.k.a. z range scale) +/// @param proj34 Element (3,4) of the projection matrix (a.k.a. z range offset) +/// @param proj43 Element (4,3) of the projection matrix (typically 1 or -1) +/// +/// @ingroup ffxDof +static inline float ffxDofCalculateCocBias(float aperture, float focus, float focalLength, float conversion, + float proj33, float proj34, float proj43) +{ + (void)proj43; + // z = (D * proj33 + proj34) / (D * proj43) = proj33/proj43 + proj34/(D*proj43) + // => view depth D = proj34 / (z*proj43 - proj33) + // C = (A * L * (F - D)) / (D * (F - L)) + // = AL/(F-L) * (F/D - 1) + // = AL/(F-L) * (F(z*p43-p33)/p34 - 1) ignore factor terms + // = AL/(F-L) * (F(0*p43-p33)/p34 - 1) + // = AL/(F-L) * (-F*p33/p34 - 1) + float absFocus = focus < 0 ? -focus : focus; + float commonFactor = conversion * aperture * focalLength / (absFocus - focalLength); + return commonFactor * (-focus * (proj33 / proj34) - 1); +} diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_error.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_error.h new file mode 100644 index 00000000..381621d8 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_error.h @@ -0,0 +1,79 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#pragma once + +#include + +/// @defgroup Errors Error Codes +/// Error codes returned from FidelityFX SDK functions +/// +/// @ingroup ffxHost + +/// Typedef for error codes returned from functions in the FidelityFX SDK. +/// +/// @ingroup Errors +typedef int32_t FfxErrorCode; + +/// Error codes and their meaning +/// +/// @ingroup Errors +typedef enum FfxErrorCodes { + + FFX_OK = 0, ///< The operation completed successfully. + FFX_ERROR_INVALID_POINTER = 0x80000000, ///< The operation failed due to an invalid pointer. + FFX_ERROR_INVALID_ALIGNMENT = 0x80000001, ///< The operation failed due to an invalid alignment. + FFX_ERROR_INVALID_SIZE = 0x80000002, ///< The operation failed due to an invalid size. + FFX_EOF = 0x80000003, ///< The end of the file was encountered. + FFX_ERROR_INVALID_PATH = 0x80000004, ///< The operation failed because the specified path was invalid. + FFX_ERROR_EOF = 0x80000005, ///< The operation failed because end of file was reached. + FFX_ERROR_MALFORMED_DATA = 0x80000006, ///< The operation failed because of some malformed data. + FFX_ERROR_OUT_OF_MEMORY = 0x80000007, ///< The operation failed because it ran out memory. + FFX_ERROR_INCOMPLETE_INTERFACE = 0x80000008, ///< The operation failed because the interface was not fully configured. + FFX_ERROR_INVALID_ENUM = 0x80000009, ///< The operation failed because of an invalid enumeration value. + FFX_ERROR_INVALID_ARGUMENT = 0x8000000a, ///< The operation failed because an argument was invalid. + FFX_ERROR_OUT_OF_RANGE = 0x8000000b, ///< The operation failed because a value was out of range. + FFX_ERROR_NULL_DEVICE = 0x8000000c, ///< The operation failed because a device was null. + FFX_ERROR_BACKEND_API_ERROR = 0x8000000d, ///< The operation failed because the backend API returned an error code. + FFX_ERROR_INSUFFICIENT_MEMORY = 0x8000000e, ///< The operation failed because there was not enough memory. + FFX_ERROR_INVALID_VERSION = 0x8000000f, ///< The operation failed because the wrong backend was linked. + FFX_ERROR_ACCESS_DENIED = 0x80000010, ///< The operation failed because access to the resource was denied. + +}FfxErrorCodes; + +/// Helper macro to return error code y from a function when a specific condition, x, is not met. +/// +/// @ingroup Errors +#define FFX_RETURN_ON_ERROR(x, y) \ + if (!(x)) \ + { \ + return (y); \ + } + +/// Helper macro to return error code x from a function when it is not FFX_OK. +/// +/// @ingroup Errors +#define FFX_VALIDATE(x) \ + { \ + FfxErrorCode ret = x; \ + FFX_RETURN_ON_ERROR(ret == FFX_OK, ret); \ + } diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_frameinterpolation.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_frameinterpolation.h new file mode 100644 index 00000000..2340d044 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_frameinterpolation.h @@ -0,0 +1,316 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +// @defgroup FRAMEINTERPOLATION + +#pragma once + +// Include the interface for the backend of the Frameinterpolation API. +#include + +/// FidelityFX Frameinterpolation major version. +/// +/// @ingroup FRAMEINTERPOLATIONFRAMEINTERPOLATION +#define FFX_FRAMEINTERPOLATION_VERSION_MAJOR (1) + +/// FidelityFX Frameinterpolation minor version. +/// +/// @ingroup FRAMEINTERPOLATIONFRAMEINTERPOLATION +#define FFX_FRAMEINTERPOLATION_VERSION_MINOR (1) + +/// FidelityFX Frameinterpolation patch version. +/// +/// @ingroup FRAMEINTERPOLATIONFRAMEINTERPOLATION +#define FFX_FRAMEINTERPOLATION_VERSION_PATCH (3) + +/// FidelityFX Frame Interpolation context count +/// +/// Defines the number of internal effect contexts required by Frame Interpolation +/// +/// @ingroup ffxFrameInterpolation +#define FFX_FRAMEINTERPOLATION_CONTEXT_COUNT (1) + +/// The size of the context specified in 32bit values. +/// +/// @ingroup FRAMEINTERPOLATIONFRAMEINTERPOLATION +#define FFX_FRAMEINTERPOLATION_CONTEXT_SIZE (FFX_SDK_DEFAULT_CONTEXT_SIZE) + +#if defined(__cplusplus) +extern "C" { +#endif // #if defined(__cplusplus) + +/// An enumeration of all the passes which constitute the FSR3 algorithm. +/// +/// FSR3 is implemented as a composite of several compute passes each +/// computing a key part of the final result. Each call to the +/// FfxFsr3ScheduleGpuJobFunc callback function will +/// correspond to a single pass included in FfxFsr3Pass. For a +/// more comprehensive description of each pass, please refer to the FSR3 +/// reference documentation. +/// +/// Please note in some cases e.g.: FFX_FSR3_PASS_ACCUMULATE +/// and FFX_FSR3_PASS_ACCUMULATE_SHARPEN either one pass or the +/// other will be used (they are mutually exclusive). The choice of which will +/// depend on the way the FfxFsr3Context is created and the +/// precise contents of FfxFsr3DispatchParamters each time a call +/// is made to ffxFsr3ContextDispatch. +/// +/// @ingroup FRAMEINTERPOLATIONFRAMEINTERPOLATION +typedef enum FfxFrameInterpolationPass +{ + FFX_FRAMEINTERPOLATION_PASS_RECONSTRUCT_AND_DILATE, + FFX_FRAMEINTERPOLATION_PASS_SETUP, + FFX_FRAMEINTERPOLATION_PASS_RECONSTRUCT_PREV_DEPTH, + FFX_FRAMEINTERPOLATION_PASS_GAME_MOTION_VECTOR_FIELD, + FFX_FRAMEINTERPOLATION_PASS_OPTICAL_FLOW_VECTOR_FIELD, + FFX_FRAMEINTERPOLATION_PASS_DISOCCLUSION_MASK, + FFX_FRAMEINTERPOLATION_PASS_INTERPOLATION, + FFX_FRAMEINTERPOLATION_PASS_INPAINTING_PYRAMID, + FFX_FRAMEINTERPOLATION_PASS_INPAINTING, + FFX_FRAMEINTERPOLATION_PASS_GAME_VECTOR_FIELD_INPAINTING_PYRAMID, + FFX_FRAMEINTERPOLATION_PASS_DEBUG_VIEW, + FFX_FRAMEINTERPOLATION_PASS_COUNT ///< The number of passes performed by FrameInterpolation. +} FfxFrameInterpolationPass; + +// forward declarations +struct FfxFrameInterpolationContext; + +/// An enumeration of bit flags used when creating a +/// FfxFrameInterpolationContext. See FfxFrameInterpolationContextDescription. +/// +/// @ingroup FRAMEINTERPOLATIONFRAMEINTERPOLATION +typedef enum FfxFrameInterpolationInitializationFlagBits { + + FFX_FRAMEINTERPOLATION_ENABLE_DEPTH_INVERTED = (1<<0), ///< A bit indicating that the input depth buffer data provided is inverted [1..0]. + FFX_FRAMEINTERPOLATION_ENABLE_DEPTH_INFINITE = (1<<1), ///< A bit indicating that the input depth buffer data provided is using an infinite far plane. + FFX_FRAMEINTERPOLATION_ENABLE_TEXTURE1D_USAGE = (1<<2), ///< A bit indicating that the backend should use 1D textures. + FFX_FRAMEINTERPOLATION_ENABLE_HDR_COLOR_INPUT = (1<<3), ///< A bit indicating that HDR values are present in the imaging pipeline. + FFX_FRAMEINTERPOLATION_ENABLE_DISPLAY_RESOLUTION_MOTION_VECTORS = (1<<4), ///< A bit indicating if the motion vectors are rendered at display resolution. + FFX_FRAMEINTERPOLATION_ENABLE_JITTER_MOTION_VECTORS = (1<<5), + FFX_FRAMEINTERPOLATION_ENABLE_ASYNC_SUPPORT = (1<<6), + FFX_FRAMEINTERPOLATION_ENABLE_DEBUG_CHECKING = (1<<7), ///< A bit indicating that the runtime should check some API values and report issues. +} FfxFrameInterpolationInitializationFlagBits; + +/// A structure encapsulating the parameters required to initialize +/// FidelityFX Frameinterpolation. +/// +/// @ingroup FRAMEINTERPOLATION +typedef struct FfxFrameInterpolationContextDescription { + uint32_t flags; ///< A collection of FfxFrameInterpolationInitializationFlagBits. + FfxDimensions2D maxRenderSize; ///< The maximum size that rendering will be performed at. + FfxDimensions2D displaySize; ///< The size of the presentation resolution + FfxSurfaceFormat backBufferFormat; ///< the format of the backbuffer + FfxSurfaceFormat previousInterpolationSourceFormat; ///< the format of the texture that will store the interpolation source for the next frame. Can be different than the backbuffer one, especially when using hudless + FfxInterface backendInterface; ///< A set of pointers to the backend implementation for FidelityFX SDK +} FfxFrameInterpolationContextDescription; + +/// A structure encapsulating the resource descriptions for shared resources for this effect. +/// +/// @ingroup FRAMEINTERPOLATION +typedef struct FfxFrameInterpolationSharedResourceDescriptions +{ + FfxCreateResourceDescription reconstructedPrevNearestDepth; ///< The FfxCreateResourceDescription for allocating the reconstructedPrevNearestDepth shared resource. + FfxCreateResourceDescription dilatedDepth; ///< The FfxCreateResourceDescription for allocating the dilatedDepth shared resource. + FfxCreateResourceDescription dilatedMotionVectors; ///< The FfxCreateResourceDescription for allocating the dilatedMotionVectors shared resource. +} FfxFrameInterpolationSharedResourceDescriptions; + +/// A structure encapsulating the FidelityFX Super Resolution 2 context. +/// +/// This sets up an object which contains all persistent internal data and +/// resources that are required by FSR3. +/// +/// The FfxFsr3Context object should have a lifetime matching +/// your use of FSR3. Before destroying the FSR3 context care should be taken +/// to ensure the GPU is not accessing the resources created or used by FSR3. +/// It is therefore recommended that the GPU is idle before destroying the +/// FSR3 context. +/// +/// @ingroup FRAMEINTERPOLATION +typedef struct FfxFrameInterpolationContext +{ + uint32_t data[FFX_FRAMEINTERPOLATION_CONTEXT_SIZE]; ///< An opaque set of uint32_t which contain the data for the context. +} FfxFrameInterpolationContext; + + +/// Create a FidelityFX Super Resolution 2 context from the parameters +/// programmed to the FfxFsr3CreateParams structure. +/// +/// The context structure is the main object used to interact with the FSR3 +/// API, and is responsible for the management of the internal resources used +/// by the FSR3 algorithm. When this API is called, multiple calls will be +/// made via the pointers contained in the callbacks structure. +/// These callbacks will attempt to retreive the device capabilities, and +/// create the internal resources, and pipelines required by FSR3's +/// frame-to-frame function. Depending on the precise configuration used when +/// creating the FfxFsr3Context a different set of resources and +/// pipelines might be requested via the callback functions. +/// +/// The flags included in the flags field of +/// FfxFsr3Context how match the configuration of your +/// application as well as the intended use of FSR3. It is important that these +/// flags are set correctly (as well as a correct programmed +/// FfxFsr3DispatchDescription) to ensure correct operation. It is +/// recommended to consult the overview documentation for further details on +/// how FSR3 should be integerated into an application. +/// +/// When the FfxFsr3Context is created, you should use the +/// ffxFsr3ContextDispatch function each frame where FSR3 +/// upscaling should be applied. See the documentation of +/// ffxFsr3ContextDispatch for more details. +/// +/// The FfxFsr3Context should be destroyed when use of it is +/// completed, typically when an application is unloaded or FSR3 upscaling is +/// disabled by a user. To destroy the FSR3 context you should call +/// ffxFsr3ContextDestroy. +/// +/// @param [out] context A pointer to a FfxFsr3Context structure to populate. +/// @param [in] contextDescription A pointer to a FfxFsr3ContextDescription structure. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context or contextDescription was NULL. +/// @retval +/// FFX_ERROR_INCOMPLETE_INTERFACE The operation failed because the FfxFsr3ContextDescription.callbacks was not fully specified. +/// @retval +/// FFX_ERROR_BACKEND_API_ERROR The operation failed because of an error returned from the backend. +/// +/// @ingroup FRAMEINTERPOLATION +FFX_API FfxErrorCode ffxFrameInterpolationContextCreate(FfxFrameInterpolationContext* context, FfxFrameInterpolationContextDescription* contextDescription); + +FFX_API FfxErrorCode ffxFrameInterpolationContextGetGpuMemoryUsage(FfxFrameInterpolationContext* pContext, FfxEffectMemoryUsage* vramUsage); + +FFX_API FfxErrorCode ffxFrameInterpolationGetSharedResourceDescriptions(FfxFrameInterpolationContext* pContext, FfxFrameInterpolationSharedResourceDescriptions* SharedResources); + +FFX_API FfxErrorCode ffxSharedContextGetGpuMemoryUsage(FfxInterface* backendInterfaceShared, FfxEffectMemoryUsage* vramUsage); + +typedef struct FfxFrameInterpolationPrepareDescription +{ + uint32_t flags; ///< combination of FfxFrameInterpolationDispatchFlags + FfxCommandList commandList; ///< The FfxCommandList to record frame interpolation commands into. + FfxDimensions2D renderSize; ///< The dimensions used to render game content, dilatedDepth, dilatedMotionVectors are expected to be of ths size. + FfxFloatCoords2D jitterOffset; ///< The subpixel jitter offset applied to the camera. jitter; + FfxFloatCoords2D motionVectorScale; ///< The scale factor to apply to motion vectors. motionVectorScale; + + float frameTimeDelta; + float cameraNear; + float cameraFar; + float viewSpaceToMetersFactor; + float cameraFovAngleVertical; + + FfxResource depth; ///< The depth buffer data + FfxResource motionVectors; ///< The motion vector data + uint64_t frameID; + + FfxResource dilatedDepth; ///< The dilated depth buffer data + FfxResource dilatedMotionVectors; ///< The dilated motion vector data + FfxResource reconstructedPrevDepth; ///< The reconstructed depth buffer data + + FfxFloat32x3 cameraPosition; ///< The camera position in world space + FfxFloat32x3 cameraUp; ///< The camera up normalized vector in world space. + FfxFloat32x3 cameraRight; ///< The camera right normalized vector in world space. + FfxFloat32x3 cameraForward; ///< The camera forward normalized vector in world space. + +} FfxFrameInterpolationPrepareDescription; + +FFX_API FfxErrorCode ffxFrameInterpolationPrepare(FfxFrameInterpolationContext* context, const FfxFrameInterpolationPrepareDescription* params); + +typedef enum FfxFrameInterpolationDispatchFlags +{ + FFX_FRAMEINTERPOLATION_DISPATCH_DRAW_DEBUG_TEAR_LINES = (1 << 0), ///< A bit indicating that the debug tear lines will be drawn to the interpolated output. + FFX_FRAMEINTERPOLATION_DISPATCH_DRAW_DEBUG_RESET_INDICATORS = (1 << 1), ///< A bit indicating that the debug reset indicators will be drawn to the generated output. + FFX_FRAMEINTERPOLATION_DISPATCH_DRAW_DEBUG_VIEW = (1 << 2), ///< A bit indicating that the interpolated output resource will contain debug views with relevant information. + FFX_FRAMEINTERPOLATION_DISPATCH_DRAW_DEBUG_PACING_LINES = (1 << 3), ///< A bit indicating that the debug pacing lines will be drawn to the generated output. + FFX_FRAMEINTERPOLATION_DISPATCH_RESERVED_1 = (1 << 4), + FFX_FRAMEINTERPOLATION_DISPATCH_RESERVED_2 = (1 << 5), +} FfxFrameInterpolationDispatchFlags; + +typedef struct FfxFrameInterpolationDispatchDescription { + + uint32_t flags; ///< combination of FfxFrameInterpolationDispatchFlags + FfxCommandList commandList; ///< The FfxCommandList to record frame interpolation commands into. + FfxDimensions2D displaySize; ///< The destination output dimensions + FfxDimensions2D renderSize; ///< The dimensions used to render game content, dilatedDepth, dilatedMotionVectors are expected to be of ths size. + FfxResource currentBackBuffer; ///< The current presentation color, if currentBackBuffer_HUDLess is not used, this will be used as interpolation source data. + FfxResource currentBackBuffer_HUDLess; ///< The current presentation color without HUD content, when use it will be used as interpolation source data. + FfxResource output; ///< The output resource where to store the interpolated result. + + FfxRect2D interpolationRect; ///< The area of the backbuffer that should be used for interpolation in case only a part of the screen is used e.g. due to movie bars + + FfxResource opticalFlowVector; ///< The optical flow motion vectors (see example computation in the FfxOpticalFlow effect) + FfxResource opticalFlowSceneChangeDetection; ///< The optical flow scene change detection data + FfxDimensions2D opticalFlowBufferSize; ///< The optical flow motion vector resource dimensions + FfxFloatCoords2D opticalFlowScale; ///< The optical flow motion vector scale factor, used to scale resoure values into [0.0,1.0] range. + int opticalFlowBlockSize; ///< The optical flow block dimension size + + float cameraNear; ///< The distance to the near plane of the camera. + float cameraFar; ///< The distance to the far plane of the camera. This is used only used in case of non infinite depth. + float cameraFovAngleVertical; ///< The camera angle field of view in the vertical direction (expressed in radians). + float viewSpaceToMetersFactor; ///< The unit to scale view space coordinates to meters. + + float frameTimeDelta; ///< The time elapsed since the last frame (expressed in milliseconds). + bool reset; ///< A boolean value which when set to true, indicates the camera has moved discontinuously. + + FfxBackbufferTransferFunction backBufferTransferFunction; ///< The transfer function use to convert interpolation source color data to linear RGB. + float minMaxLuminance[2]; ///< Min and max luminance values, used when converting HDR colors to linear RGB + uint64_t frameID; ///< Identifier used to select internal resources when async support is enabled. Must increment by exactly one (1) for each frame. Any non-exactly-one difference will reset the frame generation logic. + + FfxResource dilatedDepth; ///< The dilated depth buffer data + FfxResource dilatedMotionVectors; ///< The dilated motion vector data + FfxResource reconstructedPrevDepth; ///< The reconstructed depth buffer data + + FfxResource distortionField; ///< A resource containing distortion offset data used when distortion post effects are enabled. +} FfxFrameInterpolationDispatchDescription; + +FFX_API FfxErrorCode ffxFrameInterpolationDispatch(FfxFrameInterpolationContext* context, const FfxFrameInterpolationDispatchDescription* params); + +/// Destroy the FidelityFX Super Resolution context. +/// +/// @param [out] context A pointer to a FfxFsr3Context structure to destroy. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context was NULL. +/// +/// @ingroup FRAMEINTERPOLATION +FFX_API FfxErrorCode ffxFrameInterpolationContextDestroy(FfxFrameInterpolationContext* context); + +/// Queries the effect version number. +/// +/// @returns +/// The SDK version the effect was built with. +/// +/// @ingroup FRAMEINTERPOLATION +FFX_API FfxVersionNumber ffxFrameInterpolationGetEffectVersion(); + +/// Set global debug message settings +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// +/// @ingroup FRAMEINTERPOLATION +FFX_API FfxErrorCode ffxFrameInterpolationSetGlobalDebugMessage(ffxMessageCallback fpMessage, uint32_t debugLevel); + +#if defined(__cplusplus) +} +#endif // #if defined(__cplusplus) diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_fsr1.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_fsr1.h new file mode 100644 index 00000000..0ac7c96f --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_fsr1.h @@ -0,0 +1,297 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +/// @defgroup ffxFsr1 FidelityFX FSR1 +/// FidelityFX Super Resolution 1 runtime library +/// +/// @ingroup SDKComponents + +#pragma once + +/// Include the interface for the backend of the FSR 1.0 API. +/// +/// @ingroup ffxFsr1 +#include + +/// FidelityFX Super Resolution 1.0 major version. +/// +/// @ingroup ffxFsr1 +#define FFX_FSR1_VERSION_MAJOR (1) + +/// FidelityFX Super Resolution 1.0 minor version. +/// +/// @ingroup ffxFsr1 +#define FFX_FSR1_VERSION_MINOR (2) + +/// FidelityFX Super Resolution 1.0 patch version. +/// +/// @ingroup ffxFsr1 +#define FFX_FSR1_VERSION_PATCH (0) + +/// FidelityFX Super Resolution 1.0 context count +/// +/// Defines the number of internal effect contexts required by FSR1 +/// +/// @ingroup ffxFsr1 +#define FFX_FSR1_CONTEXT_COUNT 2 + +/// The size of the context specified in 32bit values. +/// +/// @ingroup ffxFsr1 +#define FFX_FSR1_CONTEXT_SIZE (27448) + +#if defined(__cplusplus) +extern "C" { +#endif // #if defined(__cplusplus) + +/// An enumeration of all the passes which constitute the FSR1 algorithm. +/// +/// FSR1 is implemented as a composite of several compute passes each +/// computing a key part of the final result. Each call to the +/// FfxFsr1ScheduleGpuJobFunc callback function will +/// correspond to a single pass included in FfxFsr1Pass. For a +/// more comprehensive description of each pass, please refer to the FSR1 +/// reference documentation. +/// +/// @ingroup ffxFsr1 +typedef enum FfxFsr1Pass +{ + FFX_FSR1_PASS_EASU = 0, ///< A pass which upscales the color buffer using easu. + FFX_FSR1_PASS_EASU_RCAS = 1, ///< A pass which upscales the color buffer in preparation for rcas + FFX_FSR1_PASS_RCAS = 2, ///< A pass which performs rcas sharpening on the upscaled image. + + FFX_FSR1_PASS_COUNT ///< The number of passes performed by FSR2. +} FfxFsr1Pass; + +/// An enumeration of all the quality modes supported by FidelityFX Super +/// Resolution 1 upscaling. +/// +/// In order to provide a consistent user experience across multiple +/// applications which implement FSR1. It is strongly recommended that the +/// following preset scaling factors are made available through your +/// application's user interface. +/// +/// If your application does not expose the notion of preset scaling factors +/// for upscaling algorithms (perhaps instead implementing a fixed ratio which +/// is immutable) or implementing a more dynamic scaling scheme (such as +/// dynamic resolution scaling), then there is no need to use these presets. +/// +/// @ingroup ffxFsr1 +typedef enum FfxFsr1QualityMode { + + FFX_FSR1_QUALITY_MODE_ULTRA_QUALITY = 0, ///< Perform upscaling with a per-dimension upscaling ratio of 1.3x. + FFX_FSR1_QUALITY_MODE_QUALITY = 1, ///< Perform upscaling with a per-dimension upscaling ratio of 1.5x. + FFX_FSR1_QUALITY_MODE_BALANCED = 2, ///< Perform upscaling with a per-dimension upscaling ratio of 1.7x. + FFX_FSR1_QUALITY_MODE_PERFORMANCE = 3 ///< Perform upscaling with a per-dimension upscaling ratio of 2.0x. +} FfxFsr1QualityMode; + +/// An enumeration of bit flags used when creating a +/// FfxFsr1Context. See FfxFsr1ContextDescription. +/// +/// @ingroup ffxFsr1 +typedef enum FfxFsr1InitializationFlagBits { + + FFX_FSR1_ENABLE_RCAS = (1 << 0), ///< A bit indicating if we should use rcas. + FFX_FSR1_RCAS_PASSTHROUGH_ALPHA = (1 << 1), ///< A bit indicating if we should use passthrough alpha during rcas. + FFX_FSR1_RCAS_DENOISE = (1 << 2), ///< A bit indicating if denoising is invoked during rcas. + FFX_FSR1_ENABLE_HIGH_DYNAMIC_RANGE = (1 << 3), ///< A bit indicating if the input color data provided is using a high-dynamic range. + FFX_FSR1_ENABLE_SRGB_CONVERSIONS = (1 << 4), ///< A bit indicating that input/output resources require gamma conversions + +} FfxFsr1InitializationFlagBits; + +/// A structure encapsulating the parameters required to initialize FidelityFX +/// Super Resolution 1.0 +/// +/// @ingroup ffxFsr1 +typedef struct FfxFsr1ContextDescription { + + uint32_t flags; ///< A collection of FfxFsr1InitializationFlagBits. + FfxSurfaceFormat outputFormat; ///< Format of the output target used for creation of the internal upscale resource + FfxDimensions2D maxRenderSize; ///< The maximum size that rendering will be performed at. + FfxDimensions2D displaySize; ///< The size of the presentation resolution targeted by the upscaling process. + FfxInterface backendInterface; ///< A set of pointers to the backend implementation for FSR1. +} FfxFsr1ContextDescription; + +/// A structure encapsulating the parameters for dispatching the various passes +/// of FidelityFX Super Resolution 1.0 +/// +/// @ingroup ffxFsr1 +typedef struct FfxFsr1DispatchDescription { + + FfxCommandList commandList; ///< The FfxCommandList to record FSR1 rendering commands into. + FfxResource color; ///< A FfxResource containing the color buffer for the current frame (at render resolution). + FfxResource output; ///< A FfxResource containing the output color buffer for the current frame (at presentation resolution). + FfxDimensions2D renderSize; ///< The resolution that was used for rendering the input resource. + bool enableSharpening; ///< Enable an additional sharpening pass. + float sharpness; ///< The sharpness value between 0 and 1, where 0 is no additional sharpness and 1 is maximum additional sharpness. +} FfxFsr1DispatchDescription; + +/// A structure encapsulating the FidelityFX Super Resolution 1.0 context. +/// +/// This sets up an object which contains all persistent internal data and +/// resources that are required by FSR1. +/// +/// The FfxFsr1Context object should have a lifetime matching +/// your use of FSR1. Before destroying the FSR1 context care should be taken +/// to ensure the GPU is not accessing the resources created or used by FSR1. +/// It is therefore recommended that the GPU is idle before destroying the +/// FSR1 context. +/// +/// @ingroup ffxFsr1 +typedef struct FfxFsr1Context { + + uint32_t data[FFX_FSR1_CONTEXT_SIZE]; ///< An opaque set of uint32_t which contain the data for the context. +} FfxFsr1Context; + + +/// Create a FidelityFX Super Resolution 1.0 context from the parameters +/// programmed to the FfxFsr1ContextDescription structure. +/// +/// The context structure is the main object used to interact with the Super +/// Resoution 1.0 API, and is responsible for the management of the internal resources +/// used by the FSR1 algorithm. When this API is called, multiple calls +/// will be made via the pointers contained in the callbacks +/// structure. These callbacks will attempt to retreive the device capabilities, +/// and create the internal resources, and pipelines required by FSR1 +/// frame-to-frame function. Depending on the precise configuration used when +/// creating the FfxFsr1Context a different set of resources and +/// pipelines might be requested via the callback functions. +/// +/// The FfxParallelSortContext should be destroyed when use of it is +/// completed, typically when an application is unloaded or FSR1 +/// upscaling is disabled by a user. To destroy the FSR1 context you +/// should call ffxFsr1ContextDestroy. +/// +/// @param [out] pContext A pointer to a FfxFsr1Context structure to populate. +/// @param [in] pContextDescription A pointer to a FfxFsr1ContextDescription structure. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context or contextDescription was NULL. +/// @retval +/// FFX_ERROR_INCOMPLETE_INTERFACE The operation failed because the FfxFsr1ContextDescription.callbacks was not fully specified. +/// @retval +/// FFX_ERROR_BACKEND_API_ERROR The operation failed because of an error returned from the backend. +/// +/// @ingroup ffxFsr1 +FFX_API FfxErrorCode ffxFsr1ContextCreate(FfxFsr1Context* pContext, const FfxFsr1ContextDescription* pContextDescription); + +/// Get GPU memory usage of the FidelityFX Super Resolution context. +/// +/// @param [in] pContext A pointer to a FfxFsr1Context structure. +/// @param [out] pVramUsage A pointer to a FfxEffectMemoryUsage structure. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context or vramUsage were NULL. +/// +/// @ingroup ffxFsr1 +FFX_API FfxErrorCode ffxFsr1ContextGetGpuMemoryUsage(FfxFsr1Context* pContext, FfxEffectMemoryUsage* pVramUsage); + +/// @param [out] pContext A pointer to a FfxFsr1Context structure to populate. +/// @param [in] pDispatchDescription A pointer to a FfxFsr1DispatchDescription structure. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context or dispatchDescription was NULL. +/// @retval +/// FFX_ERROR_BACKEND_API_ERROR The operation failed because of an error returned from the backend. +/// +/// @ingroup ffxFsr1 +FFX_API FfxErrorCode ffxFsr1ContextDispatch(FfxFsr1Context* pContext, const FfxFsr1DispatchDescription* pDispatchDescription); + +/// Destroy the FidelityFX FSR 1 context. +/// +/// @param [out] pContext A pointer to a FfxFsr1Context structure to destroy. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context was NULL. +/// +/// @ingroup ffxFsr1 +FFX_API FfxErrorCode ffxFsr1ContextDestroy(FfxFsr1Context* pContext); + +/// Get the upscale ratio from the quality mode. +/// +/// The following table enumerates the mapping of the quality modes to +/// per-dimension scaling ratios. +/// +/// Quality preset | Scale factor +/// ----------------------------------------------------- | ------------- +/// FFX_FSR1_QUALITY_MODE_ULTRA_QUALITY | 1.3x +/// FFX_FSR1_QUALITY_MODE_QUALITY | 1.5x +/// FFX_FSR1_QUALITY_MODE_BALANCED | 1.7x +/// FFX_FSR1_QUALITY_MODE_PERFORMANCE | 2.0x +/// +/// Passing an invalid qualityMode will return 0.0f. +/// +/// @param [in] qualityMode The quality mode preset. +/// +/// @returns +/// The upscaling the per-dimension upscaling ratio for +/// qualityMode according to the table above. +/// +/// @ingroup ffxFsr1 +FFX_API float ffxFsr1GetUpscaleRatioFromQualityMode(FfxFsr1QualityMode qualityMode); + +/// A helper function to calculate the rendering resolution from a target +/// resolution and desired quality level. +/// +/// This function applies the scaling factor returned by +/// ffxFsr1GetUpscaleRatioFromQualityMode to each dimension. +/// +/// @param [out] pRenderWidth A pointer to a uint32_t which will hold the calculated render resolution width. +/// @param [out] pRenderHeight A pointer to a uint32_t which will hold the calculated render resolution height. +/// @param [in] displayWidth The target display resolution width. +/// @param [in] displayHeight The target display resolution height. +/// @param [in] qualityMode The desired quality mode for FSR1 upscaling. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_INVALID_POINTER Either renderWidth or renderHeight was NULL. +/// @retval +/// FFX_ERROR_INVALID_ENUM An invalid quality mode was specified. +/// +/// @ingroup ffxFsr1 +FFX_API FfxErrorCode ffxFsr1GetRenderResolutionFromQualityMode( + uint32_t* pRenderWidth, + uint32_t* pRenderHeight, + uint32_t displayWidth, + uint32_t displayHeight, + FfxFsr1QualityMode qualityMode); + +/// Queries the effect version number. +/// +/// @returns +/// The SDK version the effect was built with. +/// +/// @ingroup ffxFsr1 +FFX_API FfxVersionNumber ffxFsr1GetEffectVersion(); + +#if defined(__cplusplus) +} +#endif // #if defined(__cplusplus) diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_fsr2.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_fsr2.h new file mode 100644 index 00000000..dc15d175 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_fsr2.h @@ -0,0 +1,539 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#pragma once + +// Include the interface for the backend of the FSR2 API. +#include + +/// @defgroup ffxFsr2 FidelityFX FSR2 +/// FidelityFX Super Resolution 2 runtime library +/// +/// @ingroup SDKComponents + +/// FidelityFX Super Resolution 2 major version. +/// +/// @ingroup ffxFsr2 +#define FFX_FSR2_VERSION_MAJOR (2) + +/// FidelityFX Super Resolution 2 minor version. +/// +/// @ingroup ffxFsr2 +#define FFX_FSR2_VERSION_MINOR (3) + +/// FidelityFX Super Resolution 2 patch version. +/// +/// @ingroup ffxFsr2 +#define FFX_FSR2_VERSION_PATCH (3) + +/// FidelityFX Super Resolution 2 context count +/// +/// Defines the number of internal effect contexts required by FSR2 +/// +/// @ingroup ffxFsr2 +#define FFX_FSR2_CONTEXT_COUNT 1 + +/// The size of the context specified in 32bit values. +/// +/// @ingroup ffxFsr2 +#define FFX_FSR2_CONTEXT_SIZE (FFX_SDK_DEFAULT_CONTEXT_SIZE) + +#if defined(__cplusplus) +extern "C" { +#endif // #if defined(__cplusplus) + +/// An enumeration of all the passes which constitute the FSR2 algorithm. +/// +/// FSR2 is implemented as a composite of several compute passes each +/// computing a key part of the final result. Each call to the +/// FfxFsr2ScheduleGpuJobFunc callback function will +/// correspond to a single pass included in FfxFsr2Pass. For a +/// more comprehensive description of each pass, please refer to the FSR2 +/// reference documentation. +/// +/// Please note in some cases e.g.: FFX_FSR2_PASS_ACCUMULATE +/// and FFX_FSR2_PASS_ACCUMULATE_SHARPEN either one pass or the +/// other will be used (they are mutually exclusive). The choice of which will +/// depend on the way the FfxFsr2Context is created and the +/// precise contents of FfxFsr2DispatchParamters each time a call +/// is made to ffxFsr2ContextDispatch. +/// +/// @ingroup ffxFsr2 +typedef enum FfxFsr2Pass +{ + + FFX_FSR2_PASS_DEPTH_CLIP = 0, ///< A pass which performs depth clipping. + FFX_FSR2_PASS_RECONSTRUCT_PREVIOUS_DEPTH = 1, ///< A pass which performs reconstruction of previous frame's depth. + FFX_FSR2_PASS_LOCK = 2, ///< A pass which calculates pixel locks. + FFX_FSR2_PASS_ACCUMULATE = 3, ///< A pass which performs upscaling. + FFX_FSR2_PASS_ACCUMULATE_SHARPEN = 4, ///< A pass which performs upscaling when sharpening is used. + FFX_FSR2_PASS_RCAS = 5, ///< A pass which performs sharpening. + FFX_FSR2_PASS_COMPUTE_LUMINANCE_PYRAMID = 6, ///< A pass which generates the luminance mipmap chain for the current frame. + FFX_FSR2_PASS_GENERATE_REACTIVE = 7, ///< An optional pass to generate a reactive mask. + FFX_FSR2_PASS_TCR_AUTOGENERATE = 8, ///< An optional pass to automatically generate transparency/composition and reactive masks. + + FFX_FSR2_PASS_COUNT ///< The number of passes performed by FSR2. +} FfxFsr2Pass; + +/// An enumeration of all the quality modes supported by FidelityFX Super +/// Resolution 2 upscaling. +/// +/// In order to provide a consistent user experience across multiple +/// applications which implement FSR2. It is strongly recommended that the +/// following preset scaling factors are made available through your +/// application's user interface. +/// +/// If your application does not expose the notion of preset scaling factors +/// for upscaling algorithms (perhaps instead implementing a fixed ratio which +/// is immutable) or implementing a more dynamic scaling scheme (such as +/// dynamic resolution scaling), then there is no need to use these presets. +/// +/// Please note that FFX_FSR2_QUALITY_MODE_ULTRA_PERFORMANCE is +/// an optional mode which may introduce significant quality degradation in the +/// final image. As such it is recommended that you evaluate the final results +/// of using this scaling mode before deciding if you should include it in your +/// application. +/// +/// @ingroup ffxFsr2 +typedef enum FfxFsr2QualityMode { + + FFX_FSR2_QUALITY_MODE_QUALITY = 1, ///< Perform upscaling with a per-dimension upscaling ratio of 1.5x. + FFX_FSR2_QUALITY_MODE_BALANCED = 2, ///< Perform upscaling with a per-dimension upscaling ratio of 1.7x. + FFX_FSR2_QUALITY_MODE_PERFORMANCE = 3, ///< Perform upscaling with a per-dimension upscaling ratio of 2.0x. + FFX_FSR2_QUALITY_MODE_ULTRA_PERFORMANCE = 4 ///< Perform upscaling with a per-dimension upscaling ratio of 3.0x. +} FfxFsr2QualityMode; + +/// An enumeration of bit flags used when creating a +/// FfxFsr2Context. See FfxFsr2ContextDescription. +/// +/// @ingroup ffxFsr2 +typedef enum FfxFsr2InitializationFlagBits { + + FFX_FSR2_ENABLE_HIGH_DYNAMIC_RANGE = (1<<0), ///< A bit indicating if the input color data provided is using a high-dynamic range. + FFX_FSR2_ENABLE_DISPLAY_RESOLUTION_MOTION_VECTORS = (1<<1), ///< A bit indicating if the motion vectors are rendered at display resolution. + FFX_FSR2_ENABLE_MOTION_VECTORS_JITTER_CANCELLATION = (1<<2), ///< A bit indicating that the motion vectors have the jittering pattern applied to them. + FFX_FSR2_ENABLE_DEPTH_INVERTED = (1<<3), ///< A bit indicating that the input depth buffer data provided is inverted [1..0]. + FFX_FSR2_ENABLE_DEPTH_INFINITE = (1<<4), ///< A bit indicating that the input depth buffer data provided is using an infinite far plane. + FFX_FSR2_ENABLE_AUTO_EXPOSURE = (1<<5), ///< A bit indicating if automatic exposure should be applied to input color data. + FFX_FSR2_ENABLE_DYNAMIC_RESOLUTION = (1<<6), ///< A bit indicating that the application uses dynamic resolution scaling. + FFX_FSR2_ENABLE_TEXTURE1D_USAGE = (1<<7), ///< A bit indicating that the backend should use 1D textures. + FFX_FSR2_ENABLE_DEBUG_CHECKING = (1<<8), ///< A bit indicating that the runtime should check some API values and report issues. +} FfxFsr2InitializationFlagBits; + +/// Pass a string message +/// +/// Used for debug messages. +/// +/// @param [in] type The type of message. +/// @param [in] message A string message to pass. +/// +/// +/// @ingroup ffxFsr2 +typedef void(*FfxFsr2Message)( + FfxMsgType type, + const wchar_t* message); + +/// A structure encapsulating the parameters required to initialize FidelityFX +/// Super Resolution 2 upscaling. +/// +/// @ingroup ffxFsr2 +typedef struct FfxFsr2ContextDescription { + + uint32_t flags; ///< A collection of FfxFsr2InitializationFlagBits. + FfxDimensions2D maxRenderSize; ///< The maximum size that rendering will be performed at. + FfxDimensions2D displaySize; ///< The size of the presentation resolution targeted by the upscaling process. + FfxFsr2Message fpMessage; ///< A pointer to a function that can receive messages from the runtime. + FfxInterface backendInterface; ///< A set of pointers to the backend implementation for FidelityFX SDK +} FfxFsr2ContextDescription; + +/// A structure encapsulating the parameters for dispatching the various passes +/// of FidelityFX Super Resolution 2. +/// +/// @ingroup ffxFsr2 +typedef struct FfxFsr2DispatchDescription { + + FfxCommandList commandList; ///< The FfxCommandList to record FSR2 rendering commands into. + FfxResource color; ///< A FfxResource containing the color buffer for the current frame (at render resolution). + FfxResource depth; ///< A FfxResource containing 32bit depth values for the current frame (at render resolution). + FfxResource motionVectors; ///< A FfxResource containing 2-dimensional motion vectors (at render resolution if FFX_FSR2_ENABLE_DISPLAY_RESOLUTION_MOTION_VECTORS is not set). + FfxResource exposure; ///< A optional FfxResource containing a 1x1 exposure value. + FfxResource reactive; ///< A optional FfxResource containing alpha value of reactive objects in the scene. + FfxResource transparencyAndComposition; ///< A optional FfxResource containing alpha value of special objects in the scene. + FfxResource output; ///< A FfxResource containing the output color buffer for the current frame (at presentation resolution). + FfxFloatCoords2D jitterOffset; ///< The subpixel jitter offset applied to the camera. + FfxFloatCoords2D motionVectorScale; ///< The scale factor to apply to motion vectors. + FfxDimensions2D renderSize; ///< The resolution that was used for rendering the input resources. + bool enableSharpening; ///< Enable an additional sharpening pass. + float sharpness; ///< The sharpness value between 0 and 1, where 0 is no additional sharpness and 1 is maximum additional sharpness. + float frameTimeDelta; ///< The time elapsed since the last frame (expressed in milliseconds). + float preExposure; ///< The pre exposure value (must be > 0.0f) + bool reset; ///< A boolean value which when set to true, indicates the camera has moved discontinuously. + float cameraNear; ///< The distance to the near plane of the camera. + float cameraFar; ///< The distance to the far plane of the camera. + float cameraFovAngleVertical; ///< The camera angle field of view in the vertical direction (expressed in radians). + float viewSpaceToMetersFactor; ///< The scale factor to convert view space units to meters + + // EXPERIMENTAL reactive mask generation parameters + bool enableAutoReactive; ///< A boolean value to indicate internal reactive autogeneration should be used + FfxResource colorOpaqueOnly; ///< A FfxResource containing the opaque only color buffer for the current frame (at render resolution). + float autoTcThreshold; ///< Cutoff value for TC + float autoTcScale; ///< A value to scale the transparency and composition mask + float autoReactiveScale; ///< A value to scale the reactive mask + float autoReactiveMax; ///< A value to clamp the reactive mask + +} FfxFsr2DispatchDescription; + +/// A structure encapsulating the parameters for automatic generation of a reactive mask +/// +/// @ingroup ffxFsr2 +typedef struct FfxFsr2GenerateReactiveDescription { + + FfxCommandList commandList; ///< The FfxCommandList to record FSR2 rendering commands into. + FfxResource colorOpaqueOnly; ///< A FfxResource containing the opaque only color buffer for the current frame (at render resolution). + FfxResource colorPreUpscale; ///< A FfxResource containing the opaque+translucent color buffer for the current frame (at render resolution). + FfxResource outReactive; ///< A FfxResource containing the surface to generate the reactive mask into. + FfxDimensions2D renderSize; ///< The resolution that was used for rendering the input resources. + float scale; ///< A value to scale the output + float cutoffThreshold; ///< A threshold value to generate a binary reactive mask + float binaryValue; ///< A value to set for the binary reactive mask + uint32_t flags; ///< Flags to determine how to generate the reactive mask +} FfxFsr2GenerateReactiveDescription; + +/// A structure encapsulating the FidelityFX Super Resolution 2 context. +/// +/// This sets up an object which contains all persistent internal data and +/// resources that are required by FSR2. +/// +/// The FfxFsr2Context object should have a lifetime matching +/// your use of FSR2. Before destroying the FSR2 context care should be taken +/// to ensure the GPU is not accessing the resources created or used by FSR2. +/// It is therefore recommended that the GPU is idle before destroying the +/// FSR2 context. +/// +/// @ingroup ffxFsr2 +typedef struct FfxFsr2Context +{ + uint32_t data[FFX_FSR2_CONTEXT_SIZE]; ///< An opaque set of uint32_t which contain the data for the context. +} FfxFsr2Context; + + +/// Create a FidelityFX Super Resolution 2 context from the parameters +/// programmed to the FfxFsr2CreateParams structure. +/// +/// The context structure is the main object used to interact with the FSR2 +/// API, and is responsible for the management of the internal resources used +/// by the FSR2 algorithm. When this API is called, multiple calls will be +/// made via the pointers contained in the callbacks structure. +/// These callbacks will attempt to retreive the device capabilities, and +/// create the internal resources, and pipelines required by FSR2's +/// frame-to-frame function. Depending on the precise configuration used when +/// creating the FfxFsr2Context a different set of resources and +/// pipelines might be requested via the callback functions. +/// +/// The flags included in the flags field of +/// FfxFsr2Context how match the configuration of your +/// application as well as the intended use of FSR2. It is important that these +/// flags are set correctly (as well as a correct programmed +/// FfxFsr2DispatchDescription) to ensure correct operation. It is +/// recommended to consult the overview documentation for further details on +/// how FSR2 should be integerated into an application. +/// +/// When the FfxFsr2Context is created, you should use the +/// ffxFsr2ContextDispatch function each frame where FSR2 +/// upscaling should be applied. See the documentation of +/// ffxFsr2ContextDispatch for more details. +/// +/// The FfxFsr2Context should be destroyed when use of it is +/// completed, typically when an application is unloaded or FSR2 upscaling is +/// disabled by a user. To destroy the FSR2 context you should call +/// ffxFsr2ContextDestroy. +/// +/// @param [out] pContext A pointer to a FfxFsr2Context structure to populate. +/// @param [in] pContextDescription A pointer to a FfxFsr2ContextDescription structure. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context or contextDescription was NULL. +/// @retval +/// FFX_ERROR_INCOMPLETE_INTERFACE The operation failed because the FfxFsr2ContextDescription.callbacks was not fully specified. +/// @retval +/// FFX_ERROR_BACKEND_API_ERROR The operation failed because of an error returned from the backend. +/// +/// @ingroup ffxFsr2 +FFX_API FfxErrorCode ffxFsr2ContextCreate(FfxFsr2Context* pContext, const FfxFsr2ContextDescription* pContextDescription); + +/// Get GPU memory usage of the FidelityFX Super Resolution context. +/// +/// @param [in] pContext A pointer to a FfxFsr2Context structure. +/// @param [out] pVramUsage A pointer to a FfxEffectMemoryUsage structure. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context or vramUsage were NULL. +/// +/// @ingroup ffxFsr2 +FFX_API FfxErrorCode ffxFsr2ContextGetGpuMemoryUsage(FfxFsr2Context* pContext, FfxEffectMemoryUsage* pVramUsage); + +/// Dispatch the various passes that constitute FidelityFX Super Resolution 2. +/// +/// FSR2 is a composite effect, meaning that it is compromised of multiple +/// constituent passes (implemented as one or more clears, copies and compute +/// dispatches). The ffxFsr2ContextDispatch function is the +/// function which (via the use of the functions contained in the +/// callbacks field of the FfxFsr2Context +/// structure) utlimately generates the sequence of graphics API calls required +/// each frame. +/// +/// As with the creation of the FfxFsr2Context correctly +/// programming the FfxFsr2DispatchDescription is key to ensuring +/// the correct operation of FSR2. It is particularly important to ensure that +/// camera jitter is correctly applied to your application's projection matrix +/// (or camera origin for raytraced applications). FSR2 provides the +/// ffxFsr2GetJitterPhaseCount and +/// ffxFsr2GetJitterOffset entry points to help applications +/// correctly compute the camera jitter. Whatever jitter pattern is used by the +/// application it should be correctly programmed to the +/// jitterOffset field of the dispatchDescription +/// structure. For more guidance on camera jitter please consult the +/// documentation for ffxFsr2GetJitterOffset as well as the +/// accompanying overview documentation for FSR2. +/// +/// @param [in] pContext A pointer to a FfxFsr2Context structure. +/// @param [in] pDispatchDescription A pointer to a FfxFsr2DispatchDescription structure. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context or dispatchDescription was NULL. +/// @retval +/// FFX_ERROR_OUT_OF_RANGE The operation failed because dispatchDescription.renderSize was larger than the maximum render resolution. +/// @retval +/// FFX_ERROR_NULL_DEVICE The operation failed because the device inside the context was NULL. +/// @retval +/// FFX_ERROR_BACKEND_API_ERROR The operation failed because of an error returned from the backend. +/// +/// @ingroup ffxFsr2 +FFX_API FfxErrorCode ffxFsr2ContextDispatch(FfxFsr2Context* pContext, const FfxFsr2DispatchDescription* pDispatchDescription); + +/// A helper function generate a Reactive mask from an opaque only texure and one containing translucent objects. +/// +/// @param [in] pContext A pointer to a FfxFsr2Context structure. +/// @param [in] pParams A pointer to a FfxFsr2GenerateReactiveDescription structure +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// +/// @ingroup ffxFsr2 +FFX_API FfxErrorCode ffxFsr2ContextGenerateReactiveMask(FfxFsr2Context* pContext, const FfxFsr2GenerateReactiveDescription* pParams); + +/// Destroy the FidelityFX Super Resolution context. +/// +/// @param [out] pContext A pointer to a FfxFsr2Context structure to destroy. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context was NULL. +/// +/// @ingroup ffxFsr2 +FFX_API FfxErrorCode ffxFsr2ContextDestroy(FfxFsr2Context* pContext); + +/// Get the upscale ratio from the quality mode. +/// +/// The following table enumerates the mapping of the quality modes to +/// per-dimension scaling ratios. +/// +/// Quality preset | Scale factor +/// ----------------------------------------------------- | ------------- +/// FFX_FSR2_QUALITY_MODE_QUALITY | 1.5x +/// FFX_FSR2_QUALITY_MODE_BALANCED | 1.7x +/// FFX_FSR2_QUALITY_MODE_PERFORMANCE | 2.0x +/// FFX_FSR2_QUALITY_MODE_ULTRA_PERFORMANCE | 3.0x +/// +/// Passing an invalid qualityMode will return 0.0f. +/// +/// @param [in] qualityMode The quality mode preset. +/// +/// @returns +/// The upscaling the per-dimension upscaling ratio for +/// qualityMode according to the table above. +/// +/// @ingroup ffxFsr2 +FFX_API float ffxFsr2GetUpscaleRatioFromQualityMode(FfxFsr2QualityMode qualityMode); + +/// A helper function to calculate the rendering resolution from a target +/// resolution and desired quality level. +/// +/// This function applies the scaling factor returned by +/// ffxFsr2GetUpscaleRatioFromQualityMode to each dimension. +/// +/// @param [out] pRenderWidth A pointer to a uint32_t which will hold the calculated render resolution width. +/// @param [out] pRenderHeight A pointer to a uint32_t which will hold the calculated render resolution height. +/// @param [in] displayWidth The target display resolution width. +/// @param [in] displayHeight The target display resolution height. +/// @param [in] qualityMode The desired quality mode for FSR 2 upscaling. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_INVALID_POINTER Either renderWidth or renderHeight was NULL. +/// @retval +/// FFX_ERROR_INVALID_ENUM An invalid quality mode was specified. +/// +/// @ingroup ffxFsr2 +FFX_API FfxErrorCode ffxFsr2GetRenderResolutionFromQualityMode( + uint32_t* pRenderWidth, + uint32_t* pRenderHeight, + uint32_t displayWidth, + uint32_t displayHeight, + FfxFsr2QualityMode qualityMode); + +/// A helper function to calculate the jitter phase count from display +/// resolution. +/// +/// For more detailed information about the application of camera jitter to +/// your application's rendering please refer to the +/// ffxFsr2GetJitterOffset function. +/// +/// The table below shows the jitter phase count which this function +/// would return for each of the quality presets. +/// +/// Quality preset | Scale factor | Phase count +/// ----------------------------------------------------- | ------------- | --------------- +/// FFX_FSR2_QUALITY_MODE_QUALITY | 1.5x | 18 +/// FFX_FSR2_QUALITY_MODE_BALANCED | 1.7x | 23 +/// FFX_FSR2_QUALITY_MODE_PERFORMANCE | 2.0x | 32 +/// FFX_FSR2_QUALITY_MODE_ULTRA_PERFORMANCE | 3.0x | 72 +/// Custom | [1..n]x | ceil(8*n^2) +/// +/// @param [in] renderWidth The render resolution width. +/// @param [in] displayWidth The display resolution width. +/// +/// @returns +/// The jitter phase count for the scaling factor between renderWidth and displayWidth. +/// +/// @ingroup ffxFsr2 +FFX_API int32_t ffxFsr2GetJitterPhaseCount(int32_t renderWidth, int32_t displayWidth); + +/// A helper function to calculate the subpixel jitter offset. +/// +/// FSR2 relies on the application to apply sub-pixel jittering while rendering. +/// This is typically included in the projection matrix of the camera. To make +/// the application of camera jitter simple, the FSR2 API provides a small set +/// of utility function which computes the sub-pixel jitter offset for a +/// particular frame within a sequence of separate jitter offsets. To begin, the +/// index within the jitter phase must be computed. To calculate the +/// sequence's length, you can call the ffxFsr2GetJitterPhaseCount +/// function. The index should be a value which is incremented each frame modulo +/// the length of the sequence computed by ffxFsr2GetJitterPhaseCount. +/// The index within the jitter phase is passed to +/// ffxFsr2GetJitterOffset via the index parameter. +/// +/// This function uses a Halton(2,3) sequence to compute the jitter offset. +/// The ultimate index used for the sequence is index % +/// phaseCount. +/// +/// It is important to understand that the values returned from the +/// ffxFsr2GetJitterOffset function are in unit pixel space, and +/// in order to composite this correctly into a projection matrix we must +/// convert them into projection offsets. This is done as per the pseudo code +/// listing which is shown below. +/// +/// const int32_t jitterPhaseCount = ffxFsr2GetJitterPhaseCount(renderWidth, displayWidth); +/// +/// float jitterX = 0; +/// float jitterY = 0; +/// ffxFsr2GetJitterOffset(&jitterX, &jitterY, index, jitterPhaseCount); +/// +/// const float jitterX = 2.0f * jitterX / (float)renderWidth; +/// const float jitterY = -2.0f * jitterY / (float)renderHeight; +/// const Matrix4 jitterTranslationMatrix = translateMatrix(Matrix3::identity, Vector3(jitterX, jitterY, 0)); +/// const Matrix4 jitteredProjectionMatrix = jitterTranslationMatrix * projectionMatrix; +/// +/// Jitter should be applied to all rendering. This includes opaque, alpha +/// transparent, and raytraced objects. For rasterized objects, the sub-pixel +/// jittering values calculated by the iffxFsr2GetJitterOffset +/// function can be applied to the camera projection matrix which is ultimately +/// used to perform transformations during vertex shading. For raytraced +/// rendering, the sub-pixel jitter should be applied to the ray's origin, +/// often the camera's position. +/// +/// Whether you elect to use the ffxFsr2GetJitterOffset function +/// or your own sequence generator, you must program the +/// jitterOffset field of the +/// FfxFsr2DispatchParameters structure in order to inform FSR2 +/// of the jitter offset that has been applied in order to render each frame. +/// +/// If not using the recommended ffxFsr2GetJitterOffset function, +/// care should be taken that your jitter sequence never generates a null vector; +/// that is value of 0 in both the X and Y dimensions. +/// +/// @param [out] pOutX A pointer to a float which will contain the subpixel jitter offset for the x dimension. +/// @param [out] pOutY A pointer to a float which will contain the subpixel jitter offset for the y dimension. +/// @param [in] index The index within the jitter sequence. +/// @param [in] phaseCount The length of jitter phase. See ffxFsr2GetJitterPhaseCount. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_INVALID_POINTER Either outX or outY was NULL. +/// @retval +/// FFX_ERROR_INVALID_ARGUMENT Argument phaseCount must be greater than 0. +/// +/// @ingroup ffxFsr2 +FFX_API FfxErrorCode ffxFsr2GetJitterOffset(float* pOutX, float* pOutY, int32_t index, int32_t phaseCount); + +/// A helper function to check if a resource is +/// FFX_FSR2_RESOURCE_IDENTIFIER_NULL. +/// +/// @param [in] resource A FfxResource. +/// +/// @returns +/// true The resource was not FFX_FSR2_RESOURCE_IDENTIFIER_NULL. +/// @returns +/// false The resource was FFX_FSR2_RESOURCE_IDENTIFIER_NULL. +/// +/// @ingroup ffxFsr2 +FFX_API bool ffxFsr2ResourceIsNull(FfxResource resource); + +/// Queries the effect version number. +/// +/// @returns +/// The SDK version the effect was built with. +/// +/// @ingroup ffxFsr2 +FFX_API FfxVersionNumber ffxFsr2GetEffectVersion(); + +/// Set global debug message settings +/// +/// @param [in] fpMessage A ffxMessageCallback +/// @param [in] debugLevel An unsigned integer. Unimplemented. +/// @retval +/// FFX_OK The operation completed successfully. +/// +/// @ingroup FRAMEINTERPOLATION +FFX_API FfxErrorCode ffxFsr2SetGlobalDebugMessage(ffxMessageCallback fpMessage, uint32_t debugLevel); +#if defined(__cplusplus) +} +#endif // #if defined(__cplusplus) diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_fsr3.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_fsr3.h new file mode 100644 index 00000000..5a734d3f --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_fsr3.h @@ -0,0 +1,540 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +// @defgroup FSR3 + +#pragma once + +// Include the interface for the backend of the FSR3 API. +#include +#include +#include +#include + +/// FidelityFX Super Resolution 3 major version. +/// +/// @ingroup FSR3 +#define FFX_FSR3_VERSION_MAJOR (3) + +/// FidelityFX Super Resolution 3 minor version. +/// +/// @ingroup FSR3 +#define FFX_FSR3_VERSION_MINOR (1) + +/// FidelityFX Super Resolution 3 patch version. +/// +/// @ingroup FSR3 +#define FFX_FSR3_VERSION_PATCH (4) + +/// FidelityFX Super Resolution 3 context count +/// +/// Defines the number of internal effect contexts required by FSR3 (+1 for proxy swapchain) +/// +/// @ingroup ffxFsr3 +#define FFX_FSR3_CONTEXT_COUNT (FFX_FSR3UPSCALER_CONTEXT_COUNT + FFX_OPTICALFLOW_CONTEXT_COUNT + FFX_FRAMEINTERPOLATION_CONTEXT_COUNT + 1) + +/// The size of the context specified in 32bit values. +/// +/// @ingroup FSR3 +#define FFX_FSR3_CONTEXT_SIZE (FFX_FSR3UPSCALER_CONTEXT_SIZE + FFX_OPTICALFLOW_CONTEXT_SIZE + FFX_FRAMEINTERPOLATION_CONTEXT_SIZE + FFX_SDK_DEFAULT_CONTEXT_SIZE) + +#if defined(__cplusplus) +extern "C" { +#endif // #if defined(__cplusplus) + +///// An enumeration of all the passes which constitute the FSR3 algorithm. +///// +///// FSR3 is implemented as a composite of several compute passes each +///// computing a key part of the final result. Each call to the +///// FfxFsr3ScheduleGpuJobFunc callback function will +///// correspond to a single pass included in FfxFsr3Pass. For a +///// more comprehensive description of each pass, please refer to the FSR3 +///// reference documentation. +///// +///// Please note in some cases e.g.: FFX_FSR3_PASS_ACCUMULATE +///// and FFX_FSR3_PASS_ACCUMULATE_SHARPEN either one pass or the +///// other will be used (they are mutually exclusive). The choice of which will +///// depend on the way the FfxFsr3Context is created and the +///// precise contents of FfxFsr3DispatchParamters each time a call +///// is made to ffxFsr3ContextDispatch. +///// +///// @ingroup FSR3 +//typedef enum FfxFsr3Pass +//{ +// // no special FSR3 pipelines +// +// FFX_FSR3_PASS_COUNT ///< The number of passes performed by FSR3. +//} FfxFsr3Pass; + +/// An enumeration of all the quality modes supported by FidelityFX Super +/// Resolution 2 upscaling. +/// +/// In order to provide a consistent user experience across multiple +/// applications which implement FSR3. It is strongly recommended that the +/// following preset scaling factors are made available through your +/// application's user interface. +/// +/// If your application does not expose the notion of preset scaling factors +/// for upscaling algorithms (perhaps instead implementing a fixed ratio which +/// is immutable) or implementing a more dynamic scaling scheme (such as +/// dynamic resolution scaling), then there is no need to use these presets. +/// +/// Please note that FFX_FSR3_QUALITY_MODE_ULTRA_PERFORMANCE is +/// an optional mode which may introduce significant quality degradation in the +/// final image. As such it is recommended that you evaluate the final results +/// of using this scaling mode before deciding if you should include it in your +/// application. +/// +/// @ingroup FSR3 +typedef enum FfxFsr3QualityMode { + + FFX_FSR3_QUALITY_MODE_QUALITY = 1, ///< Perform upscaling with a per-dimension upscaling ratio of 1.5x. + FFX_FSR3_QUALITY_MODE_BALANCED = 2, ///< Perform upscaling with a per-dimension upscaling ratio of 1.7x. + FFX_FSR3_QUALITY_MODE_PERFORMANCE = 3, ///< Perform upscaling with a per-dimension upscaling ratio of 2.0x. + FFX_FSR3_QUALITY_MODE_ULTRA_PERFORMANCE = 4 ///< Perform upscaling with a per-dimension upscaling ratio of 3.0x. +} FfxFsr3QualityMode; + +/// An enumeration of bit flags used when creating a +/// FfxFsr3Context. See FfxFsr3ContextDescription. +/// +/// @ingroup FSR3 +typedef enum FfxFsr3InitializationFlagBits { + + FFX_FSR3_ENABLE_HIGH_DYNAMIC_RANGE = (1<<0), ///< A bit indicating if the input color data provided to all inputs is using a high-dynamic range. + FFX_FSR3_ENABLE_DISPLAY_RESOLUTION_MOTION_VECTORS = (1<<1), ///< A bit indicating if the motion vectors are rendered at display resolution. + FFX_FSR3_ENABLE_MOTION_VECTORS_JITTER_CANCELLATION = (1<<2), ///< A bit indicating that the motion vectors have the jittering pattern applied to them. + FFX_FSR3_ENABLE_DEPTH_INVERTED = (1<<3), ///< A bit indicating that the input depth buffer data provided is inverted [1..0]. + FFX_FSR3_ENABLE_DEPTH_INFINITE = (1<<4), ///< A bit indicating that the input depth buffer data provided is using an infinite far plane. + FFX_FSR3_ENABLE_AUTO_EXPOSURE = (1<<5), ///< A bit indicating if automatic exposure should be applied to input color data. + FFX_FSR3_ENABLE_DYNAMIC_RESOLUTION = (1<<6), ///< A bit indicating that the application uses dynamic resolution scaling. + FFX_FSR3_ENABLE_TEXTURE1D_USAGE = (1<<7), ///< This value is deprecated, but remains in order to aid upgrading from older versions of FSR3. + FFX_FSR3_ENABLE_DEBUG_CHECKING = (1<<8), ///< A bit indicating that the runtime should check some API values and report issues. + FFX_FSR3_ENABLE_UPSCALING_ONLY = (1<<9), ///, A bit indicating that the context will only be used for upscaling + FFX_FSR3_ENABLE_HDR_UPSCALE_SDR_FINALOUTPUT = (1<<10), ///, A bit indicating if the input color data provided to UPSCALE is using a high-dynamic range, final output SDR. + FFX_FSR3_ENABLE_SDR_UPSCALE_HDR_FINALOUTPUT = (1<<11), ///, A bit indicating if the input color data provided to UPSCALE is using SDR, final output is high-dynamic range. + FFX_FSR3_ENABLE_ASYNC_WORKLOAD_SUPPORT = (1<<12), + FFX_FSR3_ENABLE_INTERPOLATION_ONLY = (1<<13), +} FfxFsr3InitializationFlagBits; + +typedef enum FfxFsr3FrameGenerationFlags +{ + FFX_FSR3_FRAME_GENERATION_FLAG_DRAW_DEBUG_TEAR_LINES = FFX_FRAMEINTERPOLATION_DISPATCH_DRAW_DEBUG_TEAR_LINES, ///< A bit indicating that the debug tear lines will be drawn to the interpolated output. + FFX_FSR3_FRAME_GENERATION_FLAG_DRAW_DEBUG_VIEW = FFX_FRAMEINTERPOLATION_DISPATCH_DRAW_DEBUG_VIEW, ///< A bit indicating that the interpolated output resource will contain debug views with relevant information. + FFX_FSR3_FRAME_GENERATION_FLAG_DRAW_DEBUG_PACING_LINES = FFX_FRAMEINTERPOLATION_DISPATCH_DRAW_DEBUG_PACING_LINES ///< A bit indicating that the debug pacing lines will be drawn to the generated output. +} FfxFsr3FrameGenerationFlags; + +typedef enum FfxFsr3UpscalingFlags +{ + FFX_FSR3_UPSCALER_FLAG_DRAW_DEBUG_VIEW = FFX_FSR3UPSCALER_DISPATCH_DRAW_DEBUG_VIEW, ///< A bit indicating that the upscaled output resource will contain debug views with relevant information. +} FfxFsr3UpscalingFlags; + +/// A structure encapsulating the parameters required to initialize FidelityFX +/// Super Resolution 3 upscaling. +/// +/// @ingroup FSR3 +typedef struct FfxFsr3ContextDescription { + uint32_t flags; ///< A collection of FfxFsr3InitializationFlagBits. + FfxDimensions2D maxRenderSize; ///< The maximum size that rendering will be performed at. + FfxDimensions2D maxUpscaleSize; ///< The size of the presentation resolution targeted by the upscaling process. + FfxDimensions2D displaySize; ///< The size of the presentation resolution targeted by the frame interpolation process. + FfxInterface backendInterfaceSharedResources; ///< A set of pointers to the backend implementation for FidelityFX SDK + FfxInterface backendInterfaceUpscaling; ///< A set of pointers to the backend implementation for FidelityFX SDK + FfxInterface backendInterfaceFrameInterpolation; ///< A set of pointers to the backend implementation for FidelityFX SDK + FfxFsr3UpscalerMessage fpMessage; ///< A pointer to a function that can receive messages from the runtime. + FfxSurfaceFormat backBufferFormat; ///< The format of the swapchain surface + +} FfxFsr3ContextDescription; + +/// A structure encapsulating the parameters for dispatching the various passes +/// of FidelityFX Super Resolution 3. +/// +/// @ingroup FSR3 +typedef struct FfxFsr3DispatchUpscaleDescription { + + FfxCommandList commandList; ///< The FfxCommandList to record FSR2 rendering commands into. + FfxResource color; ///< A FfxResource containing the color buffer for the current frame (at render resolution). + FfxResource depth; ///< A FfxResource containing 32bit depth values for the current frame (at render resolution). + FfxResource motionVectors; ///< A FfxResource containing 2-dimensional motion vectors (at render resolution if FFX_FSR2_ENABLE_DISPLAY_RESOLUTION_MOTION_VECTORS is not set). + FfxResource exposure; ///< A optional FfxResource containing a 1x1 exposure value. + FfxResource reactive; ///< A optional FfxResource containing alpha value of reactive objects in the scene. + FfxResource transparencyAndComposition; ///< A optional FfxResource containing alpha value of special objects in the scene. + FfxResource upscaleOutput; ///< A FfxResource containing the output color buffer for the current frame (at presentation resolution). + FfxFloatCoords2D jitterOffset; ///< The subpixel jitter offset applied to the camera. + FfxFloatCoords2D motionVectorScale; ///< The scale factor to apply to motion vectors. + FfxDimensions2D renderSize; ///< The resolution that was used for rendering the input resources. + FfxDimensions2D upscaleSize; ///< The resolution that the upscaler will output. + bool enableSharpening; ///< Enable an additional sharpening pass. + float sharpness; ///< The sharpness value between 0 and 1, where 0 is no additional sharpness and 1 is maximum additional sharpness. + float frameTimeDelta; ///< The time elapsed since the last frame (expressed in milliseconds). + float preExposure; ///< The pre exposure value (must be > 0.0f) + bool reset; ///< A boolean value which when set to true, indicates the camera has moved discontinuously. + float cameraNear; ///< The distance to the near plane of the camera. + float cameraFar; ///< The distance to the far plane of the camera. This is used only used in case of non infinite depth. + float cameraFovAngleVertical; ///< The camera angle field of view in the vertical direction (expressed in radians). + float viewSpaceToMetersFactor; ///< The scale factor to convert view space units to meters + uint32_t flags; ///< combination of FfxFsr3UpscalingFlags + uint64_t frameID; +} FfxFsr3DispatchUpscaleDescription; + +typedef struct FfxFsr3DispatchFrameGenerationPrepareDescription +{ + FfxCommandList commandList; ///< The FfxCommandList to record FSR2 rendering commands into. + FfxResource depth; ///< A FfxResource containing 32bit depth values for the current frame (at render resolution). + FfxResource motionVectors; ///< A FfxResource containing 2-dimensional motion vectors (at render resolution if FFX_FSR2_ENABLE_DISPLAY_RESOLUTION_MOTION_VECTORS is not set). + FfxFloatCoords2D jitterOffset; ///< The subpixel jitter offset applied to the camera. + FfxFloatCoords2D motionVectorScale; ///< The scale factor to apply to motion vectors. + FfxDimensions2D renderSize; ///< The resolution that was used for rendering the input resources. + + float frameTimeDelta; + float cameraNear; + float cameraFar; + float viewSpaceToMetersFactor; + float cameraFovAngleVertical; + + uint64_t frameID; +} FfxFsr3DispatchFrameGenerationPrepareDescription; + +FFX_API FfxErrorCode ffxFsr3DispatchFrameGeneration(const FfxFrameGenerationDispatchDescription* desc); + +/// A structure encapsulating the parameters for automatic generation of a reactive mask +/// +/// @ingroup FSR3 +typedef struct FfxFsr3GenerateReactiveDescription { + + FfxCommandList commandList; ///< The FfxCommandList to record FSR3 rendering commands into. + FfxResource colorOpaqueOnly; ///< A FfxResource containing the opaque only color buffer for the current frame (at render resolution). + FfxResource colorPreUpscale; ///< A FfxResource containing the opaque+translucent color buffer for the current frame (at render resolution). + FfxResource outReactive; ///< A FfxResource containing the surface to generate the reactive mask into. + FfxDimensions2D renderSize; ///< The resolution that was used for rendering the input resources. + float scale; ///< A value to scale the output + float cutoffThreshold; ///< A threshold value to generate a binary reactive mask + float binaryValue; + uint32_t flags; ///< Flags to determine how to generate the reactive mask +} FfxFsr3GenerateReactiveDescription; + +/// A structure encapsulating the FidelityFX Super Resolution 3 context. +/// +/// This sets up an object which contains all persistent internal data and +/// resources that are required by FSR3. +/// +/// The FfxFsr3Context object should have a lifetime matching +/// your use of FSR3. Before destroying the FSR3 context care should be taken +/// to ensure the GPU is not accessing the resources created or used by FSR3. +/// It is therefore recommended that the GPU is idle before destroying the +/// FSR3 context. +/// +/// @ingroup FSR3 +typedef struct FfxFsr3Context +{ + uint32_t data[FFX_FSR3_CONTEXT_SIZE]; ///< An opaque set of uint32_t which contain the data for the context. +} FfxFsr3Context; + +/// Create a FidelityFX Super Resolution 3 context from the parameters +/// programmed to the FfxFsr3CreateParams structure. +/// +/// The context structure is the main object used to interact with the FSR3 +/// API, and is responsible for the management of the internal resources used +/// by the FSR3 algorithm. When this API is called, multiple calls will be +/// made via the pointers contained in the callbacks structure. +/// These callbacks will attempt to retreive the device capabilities, and +/// create the internal resources, and pipelines required by FSR3's +/// frame-to-frame function. Depending on the precise configuration used when +/// creating the FfxFsr3Context a different set of resources and +/// pipelines might be requested via the callback functions. +/// +/// The flags included in the flags field of +/// FfxFsr3Context how match the configuration of your +/// application as well as the intended use of FSR3. It is important that these +/// flags are set correctly (as well as a correct programmed +/// FfxFsr3DispatchDescription) to ensure correct operation. It is +/// recommended to consult the overview documentation for further details on +/// how FSR3 should be integerated into an application. +/// +/// When the FfxFsr3Context is created, you should use the +/// ffxFsr3ContextDispatch function each frame where FSR3 +/// upscaling should be applied. See the documentation of +/// ffxFsr3ContextDispatch for more details. +/// +/// The FfxFsr3Context should be destroyed when use of it is +/// completed, typically when an application is unloaded or FSR3 upscaling is +/// disabled by a user. To destroy the FSR3 context you should call +/// ffxFsr3ContextDestroy. +/// +/// @param [out] context A pointer to a FfxFsr3Context structure to populate. +/// @param [in] contextDescription A pointer to a FfxFsr3ContextDescription structure. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context or contextDescription was NULL. +/// @retval +/// FFX_ERROR_INCOMPLETE_INTERFACE The operation failed because the FfxFsr3ContextDescription.callbacks was not fully specified. +/// @retval +/// FFX_ERROR_BACKEND_API_ERROR The operation failed because of an error returned from the backend. +/// +/// @ingroup FSR3 +FFX_API FfxErrorCode ffxFsr3ContextCreate(FfxFsr3Context* context, FfxFsr3ContextDescription* contextDescription); + +FFX_API FfxErrorCode ffxFsr3ContextGetGpuMemoryUsage(FfxFsr3Context* pContext, + FfxEffectMemoryUsage* pUpscalerUsage, + FfxEffectMemoryUsage* pOpticalFlowUsage, + FfxEffectMemoryUsage* pFrameGenerationUsage); + +/// Dispatch the various passes that constitute FidelityFX Super Resolution 3 Upscaling. +/// +/// FSR3 is a composite effect, meaning that it is compromised of multiple +/// constituent passes (implemented as one or more clears, copies and compute +/// dispatches). The ffxFsr3ContextDispatchUpscale function is the +/// function which (via the use of the functions contained in the +/// callbacks field of the FfxFsr3Context +/// structure) utlimately generates the sequence of graphics API calls required +/// each frame. +/// +/// As with the creation of the FfxFsr3Context correctly +/// programming the dispatchParams is key to ensuring +/// the correct operation of FSR3. It is particularly important to ensure that +/// camera jitter is correctly applied to your application's projection matrix +/// (or camera origin for raytraced applications). FSR3 provides the +/// ffxFsr3GetJitterPhaseCount and +/// ffxFsr3GetJitterOffset entry points to help applications +/// correctly compute the camera jitter. Whatever jitter pattern is used by the +/// application it should be correctly programmed to the +/// jitterOffset field of the dispatchParams +/// structure. For more guidance on camera jitter please consult the +/// documentation for ffxFsr3GetJitterOffset as well as the +/// accompanying overview documentation for FSR3. +/// +/// @param [in] context A pointer to a FfxFsr3Context structure. +/// @param [in] dispatchParams A pointer to a FfxFsr3DispatchUpscaleDescription structure. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context or dispatchParams was NULL. +/// @retval +/// FFX_ERROR_OUT_OF_RANGE The operation failed because dispatchParams.renderSize was larger than the maximum render resolution. +/// @retval +/// FFX_ERROR_NULL_DEVICE The operation failed because the device inside the context was NULL. +/// @retval +/// FFX_ERROR_BACKEND_API_ERROR The operation failed because of an error returned from the backend. +/// +/// @ingroup FSR3 +FFX_API FfxErrorCode ffxFsr3ContextDispatchUpscale(FfxFsr3Context* context, const FfxFsr3DispatchUpscaleDescription* dispatchParams); +FFX_API FfxErrorCode ffxFsr3ContextDispatchFrameGenerationPrepare(FfxFsr3Context* context, const FfxFsr3DispatchFrameGenerationPrepareDescription* dispatchParams); + +FFX_API FfxErrorCode ffxFsr3SkipPresent(FfxFsr3Context* context); + +/// A helper function generate a Reactive mask from an opaque only texure and one containing translucent objects. +/// +/// @param [in] context A pointer to a FfxFsr3Context structure. +/// @param [in] params A pointer to a FfxFsr3GenerateReactiveDescription structure +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// +/// @ingroup FSR3 +FFX_API FfxErrorCode ffxFsr3ContextGenerateReactiveMask(FfxFsr3Context* context, const FfxFsr3GenerateReactiveDescription* params); + +FFX_API FfxErrorCode ffxFsr3ConfigureFrameGeneration(FfxFsr3Context* context, const FfxFrameGenerationConfig* config); + +/// Destroy the FidelityFX Super Resolution context. +/// +/// @param [out] context A pointer to a FfxFsr3Context structure to destroy. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context was NULL. +/// +/// @ingroup FSR3 +FFX_API FfxErrorCode ffxFsr3ContextDestroy(FfxFsr3Context* context); + +/// Get the upscale ratio from the quality mode. +/// +/// The following table enumerates the mapping of the quality modes to +/// per-dimension scaling ratios. +/// +/// Quality preset | Scale factor +/// ----------------------------------------------------- | ------------- +/// FFX_FSR3_QUALITY_MODE_NATIVEAA | 1.0x +/// FFX_FSR3_QUALITY_MODE_QUALITY | 1.5x +/// FFX_FSR3_QUALITY_MODE_BALANCED | 1.7x +/// FFX_FSR3_QUALITY_MODE_PERFORMANCE | 2.0x +/// FFX_FSR3_QUALITY_MODE_ULTRA_PERFORMANCE | 3.0x +/// +/// Passing an invalid qualityMode will return 0.0f. +/// +/// @param [in] qualityMode The quality mode preset. +/// +/// @returns +/// The upscaling the per-dimension upscaling ratio for +/// qualityMode according to the table above. +/// +/// @ingroup FSR3 +FFX_API float ffxFsr3GetUpscaleRatioFromQualityMode(FfxFsr3QualityMode qualityMode); + +/// A helper function to calculate the rendering resolution from a target +/// resolution and desired quality level. +/// +/// This function applies the scaling factor returned by +/// ffxFsr3GetUpscaleRatioFromQualityMode to each dimension. +/// +/// @param [out] renderWidth A pointer to a uint32_t which will hold the calculated render resolution width. +/// @param [out] renderHeight A pointer to a uint32_t which will hold the calculated render resolution height. +/// @param [in] displayWidth The target display resolution width. +/// @param [in] displayHeight The target display resolution height. +/// @param [in] qualityMode The desired quality mode for FSR 2 upscaling. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_INVALID_POINTER Either renderWidth or renderHeight was NULL. +/// @retval +/// FFX_ERROR_INVALID_ENUM An invalid quality mode was specified. +/// +/// @ingroup FSR3 +FFX_API FfxErrorCode ffxFsr3GetRenderResolutionFromQualityMode( + uint32_t* renderWidth, + uint32_t* renderHeight, + uint32_t displayWidth, + uint32_t displayHeight, + FfxFsr3QualityMode qualityMode); + +/// A helper function to calculate the jitter phase count from display +/// resolution. +/// +/// For more detailed information about the application of camera jitter to +/// your application's rendering please refer to the +/// ffxFsr3GetJitterOffset function. +/// +/// The table below shows the jitter phase count which this function +/// would return for each of the quality presets. +/// +/// Quality preset | Scale factor | Phase count +/// ----------------------------------------------------- | ------------- | --------------- +/// FFX_FSR3_QUALITY_MODE_QUALITY | 1.5x | 18 +/// FFX_FSR3_QUALITY_MODE_BALANCED | 1.7x | 23 +/// FFX_FSR3_QUALITY_MODE_PERFORMANCE | 2.0x | 32 +/// FFX_FSR3_QUALITY_MODE_ULTRA_PERFORMANCE | 3.0x | 72 +/// Custom | [1..n]x | ceil(8*n^2) +/// +/// @param [in] renderWidth The render resolution width. +/// @param [in] displayWidth The display resolution width. +/// +/// @returns +/// The jitter phase count for the scaling factor between renderWidth and displayWidth. +/// +/// @ingroup FSR3 +FFX_API int32_t ffxFsr3GetJitterPhaseCount(int32_t renderWidth, int32_t displayWidth); + +/// A helper function to calculate the subpixel jitter offset. +/// +/// FSR3 relies on the application to apply sub-pixel jittering while rendering. +/// This is typically included in the projection matrix of the camera. To make +/// the application of camera jitter simple, the FSR3 API provides a small set +/// of utility function which computes the sub-pixel jitter offset for a +/// particular frame within a sequence of separate jitter offsets. To begin, the +/// index within the jitter phase must be computed. To calculate the +/// sequence's length, you can call the ffxFsr3GetJitterPhaseCount +/// function. The index should be a value which is incremented each frame modulo +/// the length of the sequence computed by ffxFsr3GetJitterPhaseCount. +/// The index within the jitter phase is passed to +/// ffxFsr3GetJitterOffset via the index parameter. +/// +/// This function uses a Halton(2,3) sequence to compute the jitter offset. +/// The ultimate index used for the sequence is index % +/// phaseCount. +/// +/// It is important to understand that the values returned from the +/// ffxFsr3GetJitterOffset function are in unit pixel space, and +/// in order to composite this correctly into a projection matrix we must +/// convert them into projection offsets. This is done as per the pseudo code +/// listing which is shown below. +/// +/// const int32_t jitterPhaseCount = ffxFsr3GetJitterPhaseCount(renderWidth, displayWidth); +/// +/// float jitterX = 0; +/// float jitterY = 0; +/// ffxFsr3GetJitterOffset(&jitterX, &jitterY, index, jitterPhaseCount); +/// +/// const float jitterX = 2.0f * jitterX / (float)renderWidth; +/// const float jitterY = -2.0f * jitterY / (float)renderHeight; +/// const Matrix4 jitterTranslationMatrix = translateMatrix(Matrix3::identity, Vector3(jitterX, jitterY, 0)); +/// const Matrix4 jitteredProjectionMatrix = jitterTranslationMatrix * projectionMatrix; +/// +/// Jitter should be applied to all rendering. This includes opaque, alpha +/// transparent, and raytraced objects. For rasterized objects, the sub-pixel +/// jittering values calculated by the iffxFsr3GetJitterOffset +/// function can be applied to the camera projection matrix which is ultimately +/// used to perform transformations during vertex shading. For raytraced +/// rendering, the sub-pixel jitter should be applied to the ray's origin, +/// often the camera's position. +/// +/// Whether you elect to use the ffxFsr3GetJitterOffset function +/// or your own sequence generator, you must program the +/// jitterOffset field of the +/// FfxFsr3DispatchParameters structure in order to inform FSR3 +/// of the jitter offset that has been applied in order to render each frame. +/// +/// If not using the recommended ffxFsr3GetJitterOffset function, +/// care should be taken that your jitter sequence never generates a null vector; +/// that is value of 0 in both the X and Y dimensions. +/// +/// @param [out] outX A pointer to a float which will contain the subpixel jitter offset for the x dimension. +/// @param [out] outY A pointer to a float which will contain the subpixel jitter offset for the y dimension. +/// @param [in] index The index within the jitter sequence. +/// @param [in] phaseCount The length of jitter phase. See ffxFsr3GetJitterPhaseCount. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_INVALID_POINTER Either outX or outY was NULL. +/// @retval +/// FFX_ERROR_INVALID_ARGUMENT Argument phaseCount must be greater than 0. +/// +/// @ingroup FSR3 +FFX_API FfxErrorCode ffxFsr3GetJitterOffset(float* outX, float* outY, int32_t index, int32_t phaseCount); + +/// A helper function to check if a resource is +/// FFX_FSR3_RESOURCE_IDENTIFIER_NULL. +/// +/// @param [in] resource A FfxResource. +/// +/// @returns +/// true The resource was not FFX_FSR3_RESOURCE_IDENTIFIER_NULL. +/// @returns +/// false The resource was FFX_FSR3_RESOURCE_IDENTIFIER_NULL. +/// +/// @ingroup FSR3 +FFX_API bool ffxFsr3ResourceIsNull(FfxResource resource); + +/// Queries the effect version number. +/// +/// @returns +/// The SDK version the effect was built with. +/// +/// @ingroup FSR3 +FFX_API FfxVersionNumber ffxFsr3GetEffectVersion(); + +#if defined(__cplusplus) +} +#endif // #if defined(__cplusplus) diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_fsr3upscaler.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_fsr3upscaler.h new file mode 100644 index 00000000..25cbef55 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_fsr3upscaler.h @@ -0,0 +1,592 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#pragma once + +// Include the interface for the backend of the FSR3 API. +#include + +/// @defgroup ffxFsr3Upscaler FidelityFX FSR3 +/// FidelityFX Super Resolution 3 runtime library +/// +/// @ingroup SDKComponents + +/// FidelityFX Super Resolution 3 major version. +/// +/// @ingroup ffxFsr3Upscaler +#define FFX_FSR3UPSCALER_VERSION_MAJOR (3) + +/// FidelityFX Super Resolution 3 minor version. +/// +/// @ingroup ffxFsr3Upscaler +#define FFX_FSR3UPSCALER_VERSION_MINOR (1) + +/// FidelityFX Super Resolution 3 patch version. +/// +/// @ingroup ffxFsr3Upscaler +#define FFX_FSR3UPSCALER_VERSION_PATCH (4) + +/// FidelityFX Super Resolution 3 context count +/// +/// Defines the number of internal effect contexts required by FSR3 +/// +/// @ingroup ffxFsr3Upscaler +#define FFX_FSR3UPSCALER_CONTEXT_COUNT 1 + +/// The size of the context specified in 32bit values. +/// +/// @ingroup ffxFsr3Upscaler +#define FFX_FSR3UPSCALER_CONTEXT_SIZE (FFX_SDK_DEFAULT_CONTEXT_SIZE) + +#if defined(__cplusplus) +extern "C" { +#endif // #if defined(__cplusplus) + +/// An enumeration of all the passes which constitute the FSR3 algorithm. +/// +/// FSR3 is implemented as a composite of several compute passes each +/// computing a key part of the final result. Each call to the +/// FfxFsr3UpscalerScheduleGpuJobFunc callback function will +/// correspond to a single pass included in FfxFsr3UpscalerPass. For a +/// more comprehensive description of each pass, please refer to the FSR3 +/// reference documentation. +/// +/// Please note in some cases e.g.: FFX_FSR3UPSCALER_PASS_ACCUMULATE +/// and FFX_FSR3UPSCALER_PASS_ACCUMULATE_SHARPEN either one pass or the +/// other will be used (they are mutually exclusive). The choice of which will +/// depend on the way the FfxFsr3UpscalerContext is created and the +/// precise contents of FfxFsr3UpscalerDispatchParamters each time a call +/// is made to ffxFsr3UpscalerContextDispatch. +/// +/// @ingroup ffxFsr3Upscaler +typedef enum FfxFsr3UpscalerPass +{ + FFX_FSR3UPSCALER_PASS_PREPARE_INPUTS, ///< A pass which prepares game inputs for later passes + FFX_FSR3UPSCALER_PASS_LUMA_PYRAMID, ///< A pass which generates the luminance mipmap chain for the current frame. + FFX_FSR3UPSCALER_PASS_SHADING_CHANGE_PYRAMID, ///< A pass which generates the shading change detection mipmap chain for the current frame. + FFX_FSR3UPSCALER_PASS_SHADING_CHANGE, ///< A pass which estimates shading changes for the current frame + FFX_FSR3UPSCALER_PASS_PREPARE_REACTIVITY, ///< A pass which prepares accumulation relevant information + FFX_FSR3UPSCALER_PASS_LUMA_INSTABILITY, ///< A pass which estimates temporal instability of the luminance changes. + FFX_FSR3UPSCALER_PASS_ACCUMULATE, ///< A pass which performs upscaling. + FFX_FSR3UPSCALER_PASS_ACCUMULATE_SHARPEN, ///< A pass which performs upscaling when sharpening is used. + FFX_FSR3UPSCALER_PASS_RCAS, ///< A pass which performs sharpening. + FFX_FSR3UPSCALER_PASS_DEBUG_VIEW, ///< A pass which draws some internal resources, for debugging purposes + + FFX_FSR3UPSCALER_PASS_GENERATE_REACTIVE, ///< An optional pass to generate a reactive mask. + FFX_FSR3UPSCALER_PASS_TCR_AUTOGENERATE, ///< DEPRECATED - NO LONGER SUPPORTED + FFX_FSR3UPSCALER_PASS_COUNT ///< The number of passes performed by FSR3. +} FfxFsr3UpscalerPass; + +/// An enumeration of all the quality modes supported by FidelityFX Super +/// Resolution 3 upscaling. +/// +/// In order to provide a consistent user experience across multiple +/// applications which implement FSR3. It is strongly recommended that the +/// following preset scaling factors are made available through your +/// application's user interface. +/// +/// If your application does not expose the notion of preset scaling factors +/// for upscaling algorithms (perhaps instead implementing a fixed ratio which +/// is immutable) or implementing a more dynamic scaling scheme (such as +/// dynamic resolution scaling), then there is no need to use these presets. +/// +/// Please note that FFX_FSR3UPSCALER_QUALITY_MODE_ULTRA_PERFORMANCE is +/// an optional mode which may introduce significant quality degradation in the +/// final image. As such it is recommended that you evaluate the final results +/// of using this scaling mode before deciding if you should include it in your +/// application. +/// +/// @ingroup ffxFsr3Upscaler +typedef enum FfxFsr3UpscalerQualityMode { + FFX_FSR3UPSCALER_QUALITY_MODE_NATIVEAA = 0, ///< Perform upscaling with a per-dimension upscaling ratio of 1.0x. + FFX_FSR3UPSCALER_QUALITY_MODE_QUALITY = 1, ///< Perform upscaling with a per-dimension upscaling ratio of 1.5x. + FFX_FSR3UPSCALER_QUALITY_MODE_BALANCED = 2, ///< Perform upscaling with a per-dimension upscaling ratio of 1.7x. + FFX_FSR3UPSCALER_QUALITY_MODE_PERFORMANCE = 3, ///< Perform upscaling with a per-dimension upscaling ratio of 2.0x. + FFX_FSR3UPSCALER_QUALITY_MODE_ULTRA_PERFORMANCE = 4 ///< Perform upscaling with a per-dimension upscaling ratio of 3.0x. +} FfxFsr3UpscalerQualityMode; + +/// An enumeration of bit flags used when creating a +/// FfxFsr3UpscalerContext. See FfxFsr3UpscalerContextDescription. +/// +/// @ingroup ffxFsr3Upscaler +typedef enum FfxFsr3UpscalerInitializationFlagBits { + + FFX_FSR3UPSCALER_ENABLE_HIGH_DYNAMIC_RANGE = (1<<0), ///< A bit indicating if the input color data provided is using a high-dynamic range. + FFX_FSR3UPSCALER_ENABLE_DISPLAY_RESOLUTION_MOTION_VECTORS = (1<<1), ///< A bit indicating if the motion vectors are rendered at display resolution. + FFX_FSR3UPSCALER_ENABLE_MOTION_VECTORS_JITTER_CANCELLATION = (1<<2), ///< A bit indicating that the motion vectors have the jittering pattern applied to them. + FFX_FSR3UPSCALER_ENABLE_DEPTH_INVERTED = (1<<3), ///< A bit indicating that the input depth buffer data provided is inverted [1..0]. + FFX_FSR3UPSCALER_ENABLE_DEPTH_INFINITE = (1<<4), ///< A bit indicating that the input depth buffer data provided is using an infinite far plane. + FFX_FSR3UPSCALER_ENABLE_AUTO_EXPOSURE = (1<<5), ///< A bit indicating if automatic exposure should be applied to input color data. + FFX_FSR3UPSCALER_ENABLE_DYNAMIC_RESOLUTION = (1<<6), ///< A bit indicating that the application uses dynamic resolution scaling. + FFX_FSR3UPSCALER_ENABLE_TEXTURE1D_USAGE = (1<<7), ///< This value is deprecated, but remains in order to aid upgrading from older versions of FSR3. + FFX_FSR3UPSCALER_ENABLE_DEBUG_CHECKING = (1<<8), ///< A bit indicating that the runtime should check some API values and report issues. +} FfxFsr3UpscalerInitializationFlagBits; + +/// Pass a string message +/// +/// Used for debug messages. +/// +/// @param [in] type The type of message. +/// @param [in] message A string message to pass. +/// +/// +/// @ingroup ffxFsr3Upscaler +typedef void(*FfxFsr3UpscalerMessage)( + FfxMsgType type, + const wchar_t* message); + +/// A structure encapsulating the parameters required to initialize FidelityFX +/// Super Resolution 3 upscaling. +/// +/// @ingroup ffxFsr3Upscaler +typedef struct FfxFsr3UpscalerContextDescription { + + uint32_t flags; ///< A collection of FfxFsr3UpscalerInitializationFlagBits. + FfxDimensions2D maxRenderSize; ///< The maximum size that rendering will be performed at. + FfxDimensions2D maxUpscaleSize; ///< The size of the output resolution targeted by the upscaling process. + FfxFsr3UpscalerMessage fpMessage; ///< A pointer to a function that can receive messages from the runtime. + FfxInterface backendInterface; ///< A set of pointers to the backend implementation for FidelityFX SDK + +} FfxFsr3UpscalerContextDescription; + +typedef enum FfxFsr3UpscalerDispatchFlags +{ + FFX_FSR3UPSCALER_DISPATCH_DRAW_DEBUG_VIEW = (1 << 0), ///< A bit indicating that the interpolated output resource will contain debug views with relevant information. +} FfxFsr3UpscalerDispatchFlags; + +typedef enum FfxFsr3UpscalerConfigureKey +{ + FFX_FSR3UPSCALER_CONFIGURE_UPSCALE_KEY_FVELOCITYFACTOR = 0, //Override constant buffer fVelocityFactor. The float value is casted from void * ptr. Value of 0.0f can improve temporal stability of bright pixels. Default value is 1.0f. Value is clamped to [0.0f, 1.0f]. + FFX_FSR3UPSCALER_CONFIGURE_UPSCALE_KEY_FREACTIVENESSSCALE = 1, //Override constant buffer fReactivenessScale. The float value is casted from void * ptr. Meant for development purpose to test if writing a larger value to reactive mask, reduces ghosting. Default value is 1.0f. Value is clamped to [0.0f, +infinity]. + FFX_FSR3UPSCALER_CONFIGURE_UPSCALE_KEY_FSHADINGCHANGESCALE =2, //Override fShadingChangeScale. Increasing this scales fsr3.1 computed shading change value at read to have higher reactiveness. Default value is 1.0f. Value is clamped to [0.0f, +infinity]. + FFX_FSR3UPSCALER_CONFIGURE_UPSCALE_KEY_FACCUMULATIONADDEDPERFRAME = 3, // Override constant buffer fAccumulationAddedPerFrame. Corresponds to amount of accumulation added per frame at pixel coordinate where disocclusion occured or when reactive mask value is > 0.0f. Decreasing this and drawing the ghosting object (IE no mv) to reactive mask with value close to 1.0f can decrease temporal ghosting. Decreasing this value could result in more thin feature pixels flickering. Default value is 0.333. Value is clamped to [0.0f, 1.0f]. + FFX_FSR3UPSCALER_CONFIGURE_UPSCALE_KEY_FMINDISOCCLUSIONACCUMULATION = 4, //Override constant buffer fMinDisocclusionAccumulation. Increasing this value may reduce white pixel temporal flickering around swaying thin objects that are disoccluding one another often. Too high value may increase ghosting. Default value is -0.333. A sufficiently negative value means for pixel coordinate at frame N that is disoccluded, add fAccumulationAddedPerFrame starting at frame N+2. Default value is -0.333. Value is clamped to [-1.0f, 1.0f]. +} FfxFsr3UpscalerConfigureKey; + +/// A structure encapsulating the parameters for dispatching the various passes +/// of FidelityFX Super Resolution 3. +/// +/// @ingroup ffxFsr3Upscaler +typedef struct FfxFsr3UpscalerDispatchDescription { + + FfxCommandList commandList; ///< The FfxCommandList to record FSR3 rendering commands into. + FfxResource color; ///< A FfxResource containing the color buffer for the current frame (at render resolution). + FfxResource depth; ///< A FfxResource containing 32bit depth values for the current frame (at render resolution). + FfxResource motionVectors; ///< A FfxResource containing 2-dimensional motion vectors (at render resolution if FFX_FSR3UPSCALER_ENABLE_DISPLAY_RESOLUTION_MOTION_VECTORS is not set). + FfxResource exposure; ///< A optional FfxResource containing a 1x1 exposure value. + FfxResource reactive; ///< A optional FfxResource containing alpha value of reactive objects in the scene. + FfxResource transparencyAndComposition; ///< A optional FfxResource containing alpha value of special objects in the scene. + FfxResource dilatedDepth; ///< A FfxResource allocated as described in FfxFsr3UpscalerSharedResourceDescriptions that is used to emit dilated depth and share with following effects. + FfxResource dilatedMotionVectors; ///< A FfxResource allocated as described in FfxFsr3UpscalerSharedResourceDescriptions that is used to emit dilated motion vectors and share with following effects. + FfxResource reconstructedPrevNearestDepth; ///< A FfxResource allocated as described in FfxFsr3UpscalerSharedResourceDescriptions that is used to emit reconstructed previous nearest depth and share with following effects. + FfxResource output; ///< A FfxResource containing the output color buffer for the current frame (at presentation resolution). + FfxFloatCoords2D jitterOffset; ///< The subpixel jitter offset applied to the camera. + FfxFloatCoords2D motionVectorScale; ///< The scale factor to apply to motion vectors. + FfxDimensions2D renderSize; ///< The resolution that was used for rendering the input resources. + FfxDimensions2D upscaleSize; ///< The resolution that the upscaler will output. + bool enableSharpening; ///< Enable an additional sharpening pass. + float sharpness; ///< The sharpness value between 0 and 1, where 0 is no additional sharpness and 1 is maximum additional sharpness. + float frameTimeDelta; ///< The time elapsed since the last frame (expressed in milliseconds). + float preExposure; ///< The pre exposure value (must be > 0.0f) + bool reset; ///< A boolean value which when set to true, indicates the camera has moved discontinuously. + float cameraNear; ///< The distance to the near plane of the camera. + float cameraFar; ///< The distance to the far plane of the camera. + float cameraFovAngleVertical; ///< The camera angle field of view in the vertical direction (expressed in radians). + float viewSpaceToMetersFactor; ///< The scale factor to convert view space units to meters + uint32_t flags; ///< combination of FfxFsr3UpscalerDispatchFlags +} FfxFsr3UpscalerDispatchDescription; + +/// A structure encapsulating the parameters for automatic generation of a reactive mask +/// +/// @ingroup ffxFsr3Upscaler +typedef struct FfxFsr3UpscalerGenerateReactiveDescription { + + FfxCommandList commandList; ///< The FfxCommandList to record FSR3 rendering commands into. + FfxResource colorOpaqueOnly; ///< A FfxResource containing the opaque only color buffer for the current frame (at render resolution). + FfxResource colorPreUpscale; ///< A FfxResource containing the opaque+translucent color buffer for the current frame (at render resolution). + FfxResource outReactive; ///< A FfxResource containing the surface to generate the reactive mask into. + FfxDimensions2D renderSize; ///< The resolution that was used for rendering the input resources. + float scale; ///< A value to scale the output + float cutoffThreshold; ///< A threshold value to generate a binary reactive mask + float binaryValue; ///< A value to set for the binary reactive mask + uint32_t flags; ///< Flags to determine how to generate the reactive mask +} FfxFsr3UpscalerGenerateReactiveDescription; + +/// A structure encapsulating the resource descriptions for shared resources for this effect. +/// +/// @ingroup ffxFsr3Upscaler +typedef struct FfxFsr3UpscalerSharedResourceDescriptions { + + FfxCreateResourceDescription reconstructedPrevNearestDepth; ///< The FfxCreateResourceDescription for allocating the reconstructedPrevNearestDepth shared resource. + FfxCreateResourceDescription dilatedDepth; ///< The FfxCreateResourceDescription for allocating the dilatedDepth shared resource. + FfxCreateResourceDescription dilatedMotionVectors; ///< The FfxCreateResourceDescription for allocating the dilatedMotionVectors shared resource. +} FfxFsr3UpscalerSharedResourceDescriptions; + +/// A structure encapsulating the FidelityFX Super Resolution 3 context. +/// +/// This sets up an object which contains all persistent internal data and +/// resources that are required by FSR3. +/// +/// The FfxFsr3UpscalerContext object should have a lifetime matching +/// your use of FSR3. Before destroying the FSR3 context care should be taken +/// to ensure the GPU is not accessing the resources created or used by FSR3. +/// It is therefore recommended that the GPU is idle before destroying the +/// FSR3 context. +/// +/// @ingroup ffxFsr3Upscaler +typedef struct FfxFsr3UpscalerContext +{ + uint32_t data[FFX_FSR3UPSCALER_CONTEXT_SIZE]; ///< An opaque set of uint32_t which contain the data for the context. +} FfxFsr3UpscalerContext; + + +/// Create a FidelityFX Super Resolution 3 context from the parameters +/// programmed to the FfxFsr3UpscalerCreateParams structure. +/// +/// The context structure is the main object used to interact with the FSR3 +/// API, and is responsible for the management of the internal resources used +/// by the FSR3 algorithm. When this API is called, multiple calls will be +/// made via the pointers contained in the callbacks structure. +/// These callbacks will attempt to retreive the device capabilities, and +/// create the internal resources, and pipelines required by FSR3's +/// frame-to-frame function. Depending on the precise configuration used when +/// creating the FfxFsr3UpscalerContext a different set of resources and +/// pipelines might be requested via the callback functions. +/// +/// The flags included in the flags field of +/// FfxFsr3UpscalerContext how match the configuration of your +/// application as well as the intended use of FSR3. It is important that these +/// flags are set correctly (as well as a correct programmed +/// FfxFsr3UpscalerDispatchDescription) to ensure correct operation. It is +/// recommended to consult the overview documentation for further details on +/// how FSR3 should be integerated into an application. +/// +/// When the FfxFsr3UpscalerContext is created, you should use the +/// ffxFsr3UpscalerContextDispatch function each frame where FSR3 +/// upscaling should be applied. See the documentation of +/// ffxFsr3UpscalerContextDispatch for more details. +/// +/// The FfxFsr3UpscalerContext should be destroyed when use of it is +/// completed, typically when an application is unloaded or FSR3 upscaling is +/// disabled by a user. To destroy the FSR3 context you should call +/// ffxFsr3UpscalerContextDestroy. +/// +/// @param [out] pContext A pointer to a FfxFsr3UpscalerContext structure to populate. +/// @param [in] pContextDescription A pointer to a FfxFsr3UpscalerContextDescription structure. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context or contextDescription was NULL. +/// @retval +/// FFX_ERROR_INCOMPLETE_INTERFACE The operation failed because the FfxFsr3UpscalerContextDescription.callbacks was not fully specified. +/// @retval +/// FFX_ERROR_BACKEND_API_ERROR The operation failed because of an error returned from the backend. +/// +/// @ingroup ffxFsr3Upscaler +FFX_API FfxErrorCode ffxFsr3UpscalerContextCreate(FfxFsr3UpscalerContext* pContext, const FfxFsr3UpscalerContextDescription* pContextDescription); + +/// Provides the descriptions for shared resources that must be allocated for this effect. +/// +/// @param [in] context A pointer to a FfxFsr3UpscalerContext structure. +/// @param [out] SharedResources A pointer to a FfxFsr3UpscalerSharedResourceDescriptions to populate. +/// +/// @returns +/// FFX_OK The operation completed successfully. +/// @returns +/// Anything else The operation failed. +/// +/// @ingroup ffxFsr3Upscaler +FFX_API FfxErrorCode ffxFsr3UpscalerGetSharedResourceDescriptions(FfxFsr3UpscalerContext* context, FfxFsr3UpscalerSharedResourceDescriptions* SharedResources); + +/// Get GPU memory usage of the FidelityFX Super Resolution context. +/// +/// @param [in] pContext A pointer to a FfxFsr3UpscalerContext structure. +/// @param [out] pVramUsage A pointer to a FfxEffectMemoryUsage structure. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context or vramUsage were NULL. +/// +/// @ingroup ffxFsr3Upscaler +FFX_API FfxErrorCode ffxFsr3UpscalerContextGetGpuMemoryUsage(FfxFsr3UpscalerContext* pContext, FfxEffectMemoryUsage* pVramUsage); + +/// Dispatch the various passes that constitute FidelityFX Super Resolution 3. +/// +/// FSR3 is a composite effect, meaning that it is compromised of multiple +/// constituent passes (implemented as one or more clears, copies and compute +/// dispatches). The ffxFsr3UpscalerContextDispatch function is the +/// function which (via the use of the functions contained in the +/// callbacks field of the FfxFsr3UpscalerContext +/// structure) utlimately generates the sequence of graphics API calls required +/// each frame. +/// +/// As with the creation of the FfxFsr3UpscalerContext correctly +/// programming the FfxFsr3UpscalerDispatchDescription is key to ensuring +/// the correct operation of FSR3. It is particularly important to ensure that +/// camera jitter is correctly applied to your application's projection matrix +/// (or camera origin for raytraced applications). FSR3 provides the +/// ffxFsr3UpscalerGetJitterPhaseCount and +/// ffxFsr3UpscalerGetJitterOffset entry points to help applications +/// correctly compute the camera jitter. Whatever jitter pattern is used by the +/// application it should be correctly programmed to the +/// jitterOffset field of the dispatchDescription +/// structure. For more guidance on camera jitter please consult the +/// documentation for ffxFsr3UpscalerGetJitterOffset as well as the +/// accompanying overview documentation for FSR3. +/// +/// @param [in] pContext A pointer to a FfxFsr3UpscalerContext structure. +/// @param [in] pDispatchDescription A pointer to a FfxFsr3UpscalerDispatchDescription structure. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context or dispatchDescription was NULL. +/// @retval +/// FFX_ERROR_OUT_OF_RANGE The operation failed because dispatchDescription.renderSize was larger than the maximum render resolution. +/// @retval +/// FFX_ERROR_NULL_DEVICE The operation failed because the device inside the context was NULL. +/// @retval +/// FFX_ERROR_BACKEND_API_ERROR The operation failed because of an error returned from the backend. +/// +/// @ingroup ffxFsr3Upscaler +FFX_API FfxErrorCode ffxFsr3UpscalerContextDispatch(FfxFsr3UpscalerContext* pContext, const FfxFsr3UpscalerDispatchDescription* pDispatchDescription); + +/// A helper function generate a Reactive mask from an opaque only texure and one containing translucent objects. +/// +/// @param [in] pContext A pointer to a FfxFsr3UpscalerContext structure. +/// @param [in] pParams A pointer to a FfxFsr3UpscalerGenerateReactiveDescription structure +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// +/// @ingroup ffxFsr3Upscaler +FFX_API FfxErrorCode ffxFsr3UpscalerContextGenerateReactiveMask(FfxFsr3UpscalerContext* pContext, const FfxFsr3UpscalerGenerateReactiveDescription* pParams); + +/// Destroy the FidelityFX Super Resolution context. +/// +/// @param [out] pContext A pointer to a FfxFsr3UpscalerContext structure to destroy. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context was NULL. +/// +/// @ingroup ffxFsr3Upscaler +FFX_API FfxErrorCode ffxFsr3UpscalerContextDestroy(FfxFsr3UpscalerContext* pContext); + +/// Get the upscale ratio from the quality mode. +/// +/// The following table enumerates the mapping of the quality modes to +/// per-dimension scaling ratios. +/// +/// Quality preset | Scale factor +/// ----------------------------------------------------- | ------------- +/// FFX_FSR3UPSCALER_QUALITY_MODE_QUALITY | 1.5x +/// FFX_FSR3UPSCALER_QUALITY_MODE_BALANCED | 1.7x +/// FFX_FSR3UPSCALER_QUALITY_MODE_PERFORMANCE | 2.0x +/// FFX_FSR3UPSCALER_QUALITY_MODE_ULTRA_PERFORMANCE | 3.0x +/// +/// Passing an invalid qualityMode will return 0.0f. +/// +/// @param [in] qualityMode The quality mode preset. +/// +/// @returns +/// The upscaling the per-dimension upscaling ratio for +/// qualityMode according to the table above. +/// +/// @ingroup ffxFsr3Upscaler +FFX_API float ffxFsr3UpscalerGetUpscaleRatioFromQualityMode(FfxFsr3UpscalerQualityMode qualityMode); + +/// A helper function to calculate the rendering resolution from a target +/// resolution and desired quality level. +/// +/// This function applies the scaling factor returned by +/// ffxFsr3UpscalerGetUpscaleRatioFromQualityMode to each dimension. +/// +/// @param [out] pRenderWidth A pointer to a uint32_t which will hold the calculated render resolution width. +/// @param [out] pRenderHeight A pointer to a uint32_t which will hold the calculated render resolution height. +/// @param [in] displayWidth The target display resolution width. +/// @param [in] displayHeight The target display resolution height. +/// @param [in] qualityMode The desired quality mode for FSR 2 upscaling. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_INVALID_POINTER Either renderWidth or renderHeight was NULL. +/// @retval +/// FFX_ERROR_INVALID_ENUM An invalid quality mode was specified. +/// +/// @ingroup ffxFsr3Upscaler +FFX_API FfxErrorCode ffxFsr3UpscalerGetRenderResolutionFromQualityMode( + uint32_t* pRenderWidth, + uint32_t* pRenderHeight, + uint32_t displayWidth, + uint32_t displayHeight, + FfxFsr3UpscalerQualityMode qualityMode); + +/// A helper function to calculate the jitter phase count from display +/// resolution. +/// +/// For more detailed information about the application of camera jitter to +/// your application's rendering please refer to the +/// ffxFsr3UpscalerGetJitterOffset function. +/// +/// The table below shows the jitter phase count which this function +/// would return for each of the quality presets. +/// +/// Quality preset | Scale factor | Phase count +/// ----------------------------------------------------- | ------------- | --------------- +/// FFX_FSR3UPSCALER_QUALITY_MODE_QUALITY | 1.5x | 18 +/// FFX_FSR3UPSCALER_QUALITY_MODE_BALANCED | 1.7x | 23 +/// FFX_FSR3UPSCALER_QUALITY_MODE_PERFORMANCE | 2.0x | 32 +/// FFX_FSR3UPSCALER_QUALITY_MODE_ULTRA_PERFORMANCE | 3.0x | 72 +/// Custom | [1..n]x | ceil(8*n^2) +/// +/// @param [in] renderWidth The render resolution width. +/// @param [in] displayWidth The display resolution width. +/// +/// @returns +/// The jitter phase count for the scaling factor between renderWidth and displayWidth. +/// +/// @ingroup ffxFsr3Upscaler +FFX_API int32_t ffxFsr3UpscalerGetJitterPhaseCount(int32_t renderWidth, int32_t displayWidth); + +/// A helper function to calculate the subpixel jitter offset. +/// +/// FSR3 relies on the application to apply sub-pixel jittering while rendering. +/// This is typically included in the projection matrix of the camera. To make +/// the application of camera jitter simple, the FSR3 API provides a small set +/// of utility function which computes the sub-pixel jitter offset for a +/// particular frame within a sequence of separate jitter offsets. To begin, the +/// index within the jitter phase must be computed. To calculate the +/// sequence's length, you can call the ffxFsr3UpscalerGetJitterPhaseCount +/// function. The index should be a value which is incremented each frame modulo +/// the length of the sequence computed by ffxFsr3UpscalerGetJitterPhaseCount. +/// The index within the jitter phase is passed to +/// ffxFsr3UpscalerGetJitterOffset via the index parameter. +/// +/// This function uses a Halton(2,3) sequence to compute the jitter offset. +/// The ultimate index used for the sequence is index % +/// phaseCount. +/// +/// It is important to understand that the values returned from the +/// ffxFsr3UpscalerGetJitterOffset function are in unit pixel space, and +/// in order to composite this correctly into a projection matrix we must +/// convert them into projection offsets. This is done as per the pseudo code +/// listing which is shown below. +/// +/// const int32_t jitterPhaseCount = ffxFsr3UpscalerGetJitterPhaseCount(renderWidth, displayWidth); +/// +/// float jitterX = 0; +/// float jitterY = 0; +/// ffxFsr3UpscalerGetJitterOffset(&jitterX, &jitterY, index, jitterPhaseCount); +/// +/// const float jitterX = 2.0f * jitterX / (float)renderWidth; +/// const float jitterY = -2.0f * jitterY / (float)renderHeight; +/// const Matrix4 jitterTranslationMatrix = translateMatrix(Matrix3::identity, Vector3(jitterX, jitterY, 0)); +/// const Matrix4 jitteredProjectionMatrix = jitterTranslationMatrix * projectionMatrix; +/// +/// Jitter should be applied to all rendering. This includes opaque, alpha +/// transparent, and raytraced objects. For rasterized objects, the sub-pixel +/// jittering values calculated by the iffxFsr3UpscalerGetJitterOffset +/// function can be applied to the camera projection matrix which is ultimately +/// used to perform transformations during vertex shading. For raytraced +/// rendering, the sub-pixel jitter should be applied to the ray's origin, +/// often the camera's position. +/// +/// Whether you elect to use the ffxFsr3UpscalerGetJitterOffset function +/// or your own sequence generator, you must program the +/// jitterOffset field of the +/// FfxFsr3UpscalerDispatchParameters structure in order to inform FSR3 +/// of the jitter offset that has been applied in order to render each frame. +/// +/// If not using the recommended ffxFsr3UpscalerGetJitterOffset function, +/// care should be taken that your jitter sequence never generates a null vector; +/// that is value of 0 in both the X and Y dimensions. +/// +/// @param [out] pOutX A pointer to a float which will contain the subpixel jitter offset for the x dimension. +/// @param [out] pOutY A pointer to a float which will contain the subpixel jitter offset for the y dimension. +/// @param [in] index The index within the jitter sequence. +/// @param [in] phaseCount The length of jitter phase. See ffxFsr3UpscalerGetJitterPhaseCount. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_INVALID_POINTER Either outX or outY was NULL. +/// @retval +/// FFX_ERROR_INVALID_ARGUMENT Argument phaseCount must be greater than 0. +/// +/// @ingroup ffxFsr3Upscaler +FFX_API FfxErrorCode ffxFsr3UpscalerGetJitterOffset(float* pOutX, float* pOutY, int32_t index, int32_t phaseCount); + +/// A helper function to check if a resource is +/// FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_NULL. +/// +/// @param [in] resource A FfxResource. +/// +/// @returns +/// true The resource was not FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_NULL. +/// @returns +/// false The resource was FFX_FSR3UPSCALER_RESOURCE_IDENTIFIER_NULL. +/// +/// @ingroup ffxFsr3Upscaler +FFX_API bool ffxFsr3UpscalerResourceIsNull(FfxResource resource); + +/// Queries the effect version number. +/// +/// @returns +/// The SDK version the effect was built with. +/// +/// @ingroup ffxFsr3Upscaler +FFX_API FfxVersionNumber ffxFsr3UpscalerGetEffectVersion(); + +/// Override upscaler constant buffer value after upscaler context creation. +/// +/// @param [in] context A pointer to a FfxFsr3UpscalerContext structure. +/// @param [in] key A key from FfxFsr3UpscalerConfigureKey enum +/// @param [in] valuePtr A pointer to value to pass to shader in Constant Buffer. See Fsr3UpscalerConstants +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_INVALID_ENUM An invalid FfxFsr3UpscalerConfigureKey was specified. +/// @retval +/// FFX_ERROR_INVALID_POINTER pContext was NULL. +/// +/// @ingroup ffxFsr3Upscaler +FFX_API FfxErrorCode ffxFsr3UpscalerSetConstant(FfxFsr3UpscalerContext* context, FfxFsr3UpscalerConfigureKey key, void* valuePtr); + +/// Set global debug message settings +/// +/// @param [in] fpMessage A ffxMessageCallback +/// @param [in] debugLevel An unsigned integer. Unimplemented. +/// @retval +/// FFX_OK The operation completed successfully. +/// +/// @ingroup FRAMEINTERPOLATION +FFX_API FfxErrorCode ffxFsr3UpscalerSetGlobalDebugMessage(ffxMessageCallback fpMessage, uint32_t debugLevel); + +#if defined(__cplusplus) +} +#endif // #if defined(__cplusplus) diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_fx.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_fx.h new file mode 100644 index 00000000..c8b65f52 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_fx.h @@ -0,0 +1,44 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#pragma once + +/// @defgroup SDKComponents Effect Components +/// Runtime FidelityFX Effect Components that compile and link to calling effect libraries +/// +/// @ingroup ffxSDK +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_interface.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_interface.h new file mode 100644 index 00000000..d7ba8acb --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_interface.h @@ -0,0 +1,664 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#pragma once + +#include +#include +#include +#include + +#if defined(__cplusplus) +#define FFX_CPU +extern "C" { +#endif // #if defined(__cplusplus) + +/// @defgroup Backends Backends +/// Core interface declarations and natively supported backends +/// +/// @ingroup ffxSDK + +/// @defgroup FfxInterface FfxInterface +/// FidelityFX SDK function signatures and core defines requiring +/// overrides for backend implementation. +/// +/// @ingroup Backends +FFX_FORWARD_DECLARE(FfxInterface); + +/// FidelityFX SDK major version. +/// +/// @ingroup FfxInterface +#define FFX_SDK_VERSION_MAJOR (1) + +/// FidelityFX SDK minor version. +/// +/// @ingroup FfxInterface +#define FFX_SDK_VERSION_MINOR (1) + +/// FidelityFX SDK patch version. +/// +/// @ingroup FfxInterface +#define FFX_SDK_VERSION_PATCH (4) + +/// Macro to pack a FidelityFX SDK version id together. +/// +/// @ingroup FfxInterface +#define FFX_SDK_MAKE_VERSION( major, minor, patch ) ( ( major << 22 ) | ( minor << 12 ) | patch ) + +/// Stand in type for FfxPass +/// +/// These will be defined for each effect individually (i.e. FfxFsr2Pass). +/// They are used to fetch the proper blob index to build effect shaders +/// +/// @ingroup FfxInterface +typedef uint32_t FfxPass; + +/// Get the SDK version of the backend context. +/// +/// @param [in] backendInterface A pointer to the backend interface. +/// +/// @returns +/// The SDK version a backend was built with. +/// +/// @ingroup FfxInterface +typedef FfxVersionNumber(*FfxGetSDKVersionFunc)( + FfxInterface* backendInterface); + +/// Get effect VRAM usage. +/// +/// Newer effects may require support that legacy versions of the SDK will not be +/// able to provide. A version query is thus required to ensure an effect component +/// will always be paired with a backend which will support all needed functionality. +/// +/// @param [in] backendInterface A pointer to the backend interface. +/// @param [in] effectContextId The context space to be used for the effect in question. +/// @param [out] outVramUsage The effect memory usage structure to fill out. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// Anything else The operation failed. +/// +/// @ingroup FfxInterface +typedef FfxErrorCode (*FfxGetEffectGpuMemoryUsageFunc)(FfxInterface* backendInterface, FfxUInt32 effectContextId, FfxEffectMemoryUsage* outVramUsage); + +/// Create and initialize the backend context. +/// +/// The callback function sets up the backend context for rendering. +/// It will create or reference the device and create required internal data structures. +/// +/// @param [in] backendInterface A pointer to the backend interface. +/// @param [in] effect The effect the context is being created for +/// @param [in] bindlessConfig A pointer to the bindless configuration, if required by the effect. +/// @param [out] effectContextId The context space to be used for the effect in question. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// Anything else The operation failed. +/// +/// @ingroup FfxInterface +typedef FfxErrorCode (*FfxCreateBackendContextFunc)( + FfxInterface* backendInterface, + FfxEffect effect, + FfxEffectBindlessConfig* bindlessConfig, + FfxUInt32* effectContextId); + +/// Get a list of capabilities of the device. +/// +/// When creating an FfxEffectContext it is desirable for the FFX +/// core implementation to be aware of certain characteristics of the platform +/// that is being targetted. This is because some optimizations which FFX SDK +/// attempts to perform are more effective on certain classes of hardware than +/// others, or are not supported by older hardware. In order to avoid cases +/// where optimizations actually have the effect of decreasing performance, or +/// reduce the breadth of support provided by FFX SDK, the FFX interface queries the +/// capabilities of the device to make such decisions. +/// +/// For target platforms with fixed hardware support you need not implement +/// this callback function by querying the device, but instead may hardcore +/// what features are available on the platform. +/// +/// @param [in] backendInterface A pointer to the backend interface. +/// @param [out] outDeviceCapabilities The device capabilities structure to fill out. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// Anything else The operation failed. +/// +/// @ingroup FfxInterface +typedef FfxErrorCode(*FfxGetDeviceCapabilitiesFunc)( + FfxInterface* backendInterface, + FfxDeviceCapabilities* outDeviceCapabilities); + +/// Destroy the backend context and dereference the device. +/// +/// This function is called when the FfxEffectContext is destroyed. +/// +/// @param [in] backendInterface A pointer to the backend interface. +/// @param [in] effectContextId The context space to be used for the effect in question. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// Anything else The operation failed. +/// +/// @ingroup FfxInterface +typedef FfxErrorCode(*FfxDestroyBackendContextFunc)( + FfxInterface* backendInterface, + FfxUInt32 effectContextId); + +/// Create a resource. +/// +/// This callback is intended for the backend to create internal resources. +/// +/// Please note: It is also possible that the creation of resources might +/// itself cause additional resources to be created by simply calling the +/// FfxCreateResourceFunc function pointer again. This is +/// useful when handling the initial creation of resources which must be +/// initialized. The flow in such a case would be an initial call to create the +/// CPU-side resource, another to create the GPU-side resource, and then a call +/// to schedule a copy render job to move the data between the two. Typically +/// this type of function call flow is only seen during the creation of an +/// FfxEffectContext. +/// +/// @param [in] backendInterface A pointer to the backend interface. +/// @param [in] createResourceDescription A pointer to a FfxCreateResourceDescription. +/// @param [in] effectContextId The context space to be used for the effect in question. +/// @param [out] outResource A pointer to a FfxResource object. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// Anything else The operation failed. +/// +/// @ingroup FfxInterface +typedef FfxErrorCode (*FfxCreateResourceFunc)( + FfxInterface* backendInterface, + const FfxCreateResourceDescription* createResourceDescription, + FfxUInt32 effectContextId, + FfxResourceInternal* outResource); + +/// Register a resource in the backend for the current frame. +/// +/// Since the FfxInterface and the backends are not aware how many different +/// resources will get passed in over time, it's not safe +/// to register all resources simultaneously in the backend. +/// Also passed resources may not be valid after the dispatch call. +/// As a result it's safest to register them as FfxResourceInternal +/// and clear them at the end of the dispatch call. +/// +/// @param [in] backendInterface A pointer to the backend interface. +/// @param [in] inResource A pointer to a FfxResource. +/// @param [in] effectContextId The context space to be used for the effect in question. +/// @param [out] outResource A pointer to a FfxResourceInternal object. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// Anything else The operation failed. +/// +/// @ingroup FfxInterface +typedef FfxErrorCode(*FfxRegisterResourceFunc)( + FfxInterface* backendInterface, + const FfxResource* inResource, + FfxUInt32 effectContextId, + FfxResourceInternal* outResource); + + +/// Get an FfxResource from an FfxResourceInternal resource. +/// +/// At times it is necessary to create an FfxResource representation +/// of an internally created resource in order to register it with a +/// child effect context. This function sets up the FfxResource needed +/// to register. +/// +/// @param [in] backendInterface A pointer to the backend interface. +/// @param [in] resource The FfxResourceInternal for which to setup an FfxResource. +/// +/// @returns +/// An FfxResource built from the internal resource +/// +/// @ingroup FfxInterface +typedef FfxResource(*FfxGetResourceFunc)( + FfxInterface* backendInterface, + FfxResourceInternal resource); + +/// Unregister all temporary FfxResourceInternal from the backend. +/// +/// Unregister FfxResourceInternal referencing resources passed to +/// a function as a parameter. +/// +/// @param [in] backendInterface A pointer to the backend interface. +/// @param [in] commandList A pointer to a FfxCommandList structure. +/// @param [in] effectContextId The context space to be used for the effect in question. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// Anything else The operation failed. +/// +/// @ingroup FfxInterface +typedef FfxErrorCode(*FfxUnregisterResourcesFunc)( + FfxInterface* backendInterface, + FfxCommandList commandList, + FfxUInt32 effectContextId); + +/// Register a resource in the static bindless table of the backend. +/// +/// A static resource will persist in their respective bindless table until it is +/// overwritten by a different resource at the same index. +/// The calling code must take care not to immediately register a new resource at an index +/// that might be in use by an in-flight frame. +/// +/// @param [in] backendInterface A pointer to the backend interface. +/// @param [in] desc A pointer to an FfxStaticResourceDescription. +/// @param [in] effectContextId The context space to be used for the effect in question. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// Anything else The operation failed. +/// +/// @ingroup FfxInterface +typedef FfxErrorCode (*FfxRegisterStaticResourceFunc)(FfxInterface* backendInterface, + const FfxStaticResourceDescription* desc, + FfxUInt32 effectContextId); + +/// Retrieve a FfxResourceDescription matching a +/// FfxResource structure. +/// +/// @param [in] backendInterface A pointer to the backend interface. +/// @param [in] resource A pointer to a FfxResource object. +/// +/// @returns +/// A description of the resource. +/// +/// @ingroup FfxInterface +typedef FfxResourceDescription (*FfxGetResourceDescriptionFunc)( + FfxInterface* backendInterface, + FfxResourceInternal resource); + +/// Destroy a resource +/// +/// This callback is intended for the backend to release an internal resource. +/// +/// @param [in] backendInterface A pointer to the backend interface. +/// @param [in] resource A pointer to a FfxResource object. +/// @param [in] effectContextId The context space to be used for the effect in question. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// Anything else The operation failed. +/// +/// @ingroup FfxInterface +typedef FfxErrorCode (*FfxDestroyResourceFunc)( + FfxInterface* backendInterface, + FfxResourceInternal resource, + FfxUInt32 effectContextId); + +/// Map resource memory +/// +/// Maps the memory of the resource to a pointer and returns it. +/// +/// @param [in] backendInterface A pointer to the backend interface. +/// @param [in] resource A pointer to a FfxResource object. +/// @param [out] ptr A pointer to the mapped memory. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// Anything else The operation failed. +/// +/// @ingroup FfxInterface +typedef FfxErrorCode (*FfxMapResourceFunc)(FfxInterface* backendInterface, FfxResourceInternal resource, void** ptr); + +/// Unmap resource memory +/// +/// Unmaps previously mapped memory of a resource. +/// +/// @param [in] backendInterface A pointer to the backend interface. +/// @param [in] resource A pointer to a FfxResource object. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// Anything else The operation failed. +/// +/// @ingroup FfxInterface +typedef FfxErrorCode (*FfxUnmapResourceFunc)(FfxInterface* backendInterface, FfxResourceInternal resource); + +/// Destroy a resource +/// +/// This callback is intended for the backend to release an internal resource. +/// +/// @param [in] backendInterface A pointer to the backend interface. +/// @param [in] resource A pointer to a FfxResource object. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// Anything else The operation failed. +/// +/// @ingroup FfxInterface +typedef FfxErrorCode (*FfxStageConstantBufferDataFunc)( + FfxInterface* backendInterface, + void* data, + FfxUInt32 size, + FfxConstantBuffer* constantBuffer); + +/// Create a render pipeline. +/// +/// A rendering pipeline contains the shader as well as resource bindpoints +/// and samplers. +/// +/// @param [in] backendInterface A pointer to the backend interface. +/// @param [in] pass The identifier for the pass. +/// @param [in] pipelineDescription A pointer to a FfxPipelineDescription describing the pipeline to be created. +/// @param [in] effectContextId The context space to be used for the effect in question. +/// @param [out] outPipeline A pointer to a FfxPipelineState structure which should be populated. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// Anything else The operation failed. +/// +/// @ingroup FfxInterface +typedef FfxErrorCode (*FfxCreatePipelineFunc)( + FfxInterface* backendInterface, + FfxEffect effect, + FfxPass pass, + uint32_t permutationOptions, + const FfxPipelineDescription* pipelineDescription, + FfxUInt32 effectContextId, + FfxPipelineState* outPipeline); + +typedef FfxErrorCode(*FfxGetPermutationBlobByIndexFunc)(FfxEffect effectId, + FfxPass passId, + FfxBindStage bindStage, + uint32_t permutationOptions, + FfxShaderBlob* outBlob); + +/// Destroy a render pipeline. +/// +/// @param [in] backendInterface A pointer to the backend interface. +/// @param [in] effectContextId The context space to be used for the effect in question. +/// @param [out] pipeline A pointer to a FfxPipelineState structure which should be released. +/// @param [in] effectContextId The context space to be used for the effect in question. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// Anything else The operation failed. +/// +/// @ingroup FfxInterface +typedef FfxErrorCode (*FfxDestroyPipelineFunc)( + FfxInterface* backendInterface, + FfxPipelineState* pipeline, + FfxUInt32 effectContextId); + +/// Schedule a render job to be executed on the next call of +/// FfxExecuteGpuJobsFunc. +/// +/// Render jobs can perform one of three different tasks: clear, copy or +/// compute dispatches. +/// +/// @param [in] backendInterface A pointer to the backend interface. +/// @param [in] job A pointer to a FfxGpuJobDescription structure. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// Anything else The operation failed. +/// +/// @ingroup FfxInterface +typedef FfxErrorCode (*FfxScheduleGpuJobFunc)( + FfxInterface* backendInterface, + const FfxGpuJobDescription* job); + +/// Execute scheduled render jobs on the comandList provided. +/// +/// The recording of the graphics API commands should take place in this +/// callback function, the render jobs which were previously enqueued (via +/// callbacks made to FfxScheduleGpuJobFunc) should be +/// processed in the order they were received. Advanced users might choose to +/// reorder the rendering jobs, but should do so with care to respect the +/// resource dependencies. +/// +/// Depending on the precise contents of FfxDispatchDescription a +/// different number of render jobs might have previously been enqueued (for +/// example if sharpening is toggled on and off). +/// +/// @param [in] backendInterface A pointer to the backend interface. +/// @param [in] commandList A pointer to a FfxCommandList structure. +/// @param [in] effectContextId The context space to be used for the effect in question. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// Anything else The operation failed. +/// +/// @ingroup FfxInterface +typedef FfxErrorCode (*FfxExecuteGpuJobsFunc)( + FfxInterface* backendInterface, + FfxCommandList commandList, + FfxUInt32 effectContextId); + +typedef enum FfxUiCompositionFlags +{ + FFX_UI_COMPOSITION_FLAG_USE_PREMUL_ALPHA = (1 << 0), ///< A bit indicating that we use premultiplied alpha for UI composition + FFX_UI_COMPOSITION_FLAG_ENABLE_INTERNAL_UI_DOUBLE_BUFFERING = (1 << 1), ///< A bit indicating that the swapchain should doublebuffer the UI resource +} FfxUiCompositionFlags; + +typedef FfxErrorCode(*FfxPresentCallbackFunc)(const FfxPresentCallbackDescription* params, void*); +typedef FfxErrorCode(*FfxFrameGenerationDispatchFunc)(const FfxFrameGenerationDispatchDescription* params, void*); +typedef FfxErrorCode(*FfxWaitCallbackFunc)(wchar_t* fenceName, uint64_t fenceValueToWaitFor); + +/// A structure representing the configuration options to pass to FrameInterpolationSwapChain +/// +/// @ingroup FfxInterface +typedef struct FfxFrameGenerationConfig +{ + FfxSwapchain swapChain; ///< The FfxSwapchain to use with frame interpolation + FfxPresentCallbackFunc presentCallback; ///< A UI composition callback to call when finalizing the frame image + void* presentCallbackContext; ///< A pointer to be passed to the UI composition callback + FfxFrameGenerationDispatchFunc frameGenerationCallback; ///< The frame generation callback to use to generate the interpolated frame + void* frameGenerationCallbackContext; ///< A pointer to be passed to the frame generation callback + bool frameGenerationEnabled; ///< Sets the state of frame generation. Set to false to disable frame generation + bool allowAsyncWorkloads; ///< Sets the state of async workloads. Set to true to enable interpolation work on async compute + bool allowAsyncPresent; ///< Sets the state of async presentation (console only). Set to true to enable present from async command queue + FfxResource HUDLessColor; ///< The hudless back buffer image to use for UI extraction from backbuffer resource + FfxUInt32 flags; ///< Flags + bool onlyPresentInterpolated; ///< Set to true to only present interpolated frame + FfxRect2D interpolationRect; ///< Set the area in the backbuffer that will be interpolated + uint64_t frameID; ///< A frame identifier used to synchronize resource usage in workloads + bool drawDebugPacingLines; ///< Sets the state of pacing debug lines. Set to true to display debug lines +} FfxFrameGenerationConfig; + +typedef FfxErrorCode (*FfxSwapChainConfigureFrameGenerationFunc)(FfxFrameGenerationConfig const* config); + +/// Allocate AMD FidelityFX Breadcrumbs Library markers buffer. +/// +/// @param [in] backendInterface A pointer to the backend interface. +/// @param [in] blockBytes Size in bytes of the buffer to be allocated. +/// @param [out] blockData Output information about allocated AMD FidelityFX Breadcrumbs Library buffer. Filled only on success of operation. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// Anything else The operation failed. +/// +/// @ingroup FfxInterface +typedef FfxErrorCode (*FfxBreadcrumbsAllocBlockFunc)( + FfxInterface* backendInterface, + uint64_t blockBytes, + FfxBreadcrumbsBlockData* blockData + ); + +/// Deallocate AMD FidelityFX Breadcrumbs Library markers buffer. +/// +/// @param [in] backendInterface A pointer to the backend interface. +/// @param [out] blockData Information about buffer to be freed. All resource handles are cleared after this operation. +/// +/// @ingroup FfxInterface +typedef void (*FfxBreadcrumbsFreeBlockFunc)( + FfxInterface* backendInterface, + FfxBreadcrumbsBlockData* blockData + ); + +/// Write marker to AMD FidelityFX Breadcrumbs Library buffer on the comandList provided. +/// +/// @param [in] backendInterface A pointer to the backend interface. +/// @param [in] commandList GPU command list to record marker writing command. +/// @param [in] value Marker value to be written. +/// @param [in] gpuLocation GPU destination address where marker will be written. +/// @param [in] gpuBuffer Destination AMD FidelityFX Breadcrumbs Library buffer. +/// @param [in] isBegin true for writing opening marker and false for ending marker. +/// +/// @ingroup FfxInterface +typedef void (*FfxBreadcrumbsWriteFunc)( + FfxInterface* backendInterface, + FfxCommandList commandList, + uint32_t value, + uint64_t gpuLocation, + void* gpuBuffer, + bool isBegin + ); + +/// Printing GPU specific info to the AMD FidelityFX Breadcrumbs Library status buffer. +/// +/// @param [in] backendInterface A pointer to the backend interface. +/// @param [in] allocs A pointer to the allocation callbacks. +/// @param [in] extendedInfo true if should print more verbose device info and false for standard output. +/// @param [out] printBuffer String buffer for writing GPU info. +/// @param [out] printSize Size of string buffer for writing GPU info. +/// +/// @ingroup FfxInterface +typedef void (*FfxBreadcrumbsPrintDeviceInfoFunc)( + FfxInterface* backendInterface, + FfxAllocationCallbacks* allocs, + bool extendedInfo, + char** printBuffer, + size_t* printSize + ); + +/// Register a Thread Safe constant buffer allocator to be used by the backend. +/// +/// @param [in] backendInterface A pointer to the backend interface. +/// @param [in] constantAllocator An FfxConstantBufferAllocator callback to be used by the backend. +/// +/// @ingroup FfxInterface +typedef void(*FfxRegisterConstantBufferAllocatorFunc)(FfxInterface* backendInterface, + FfxConstantBufferAllocator constantAllocator); + +/// A structure encapsulating the interface between the core implementation of +/// the FfxInterface and any graphics API that it should ultimately call. +/// +/// This set of functions serves as an abstraction layer between FfxInterfae and the +/// API used to implement it. While the FidelityFX SDK ships with backends for DirectX12 and +/// Vulkan, it is possible to implement your own backend for other platforms +/// which sit on top of your engine's own abstraction layer. For details on the +/// expectations of what each function should do you should refer the +/// description of the following function pointer types: +/// - FfxCreateDeviceFunc +/// - FfxGetDeviceCapabilitiesFunc +/// - FfxDestroyDeviceFunc +/// - FfxCreateResourceFunc +/// - FfxRegisterResourceFunc +/// - FfxGetResourceFunc +/// - FfxUnregisterResourcesFunc +/// - FfxGetResourceDescriptionFunc +/// - FfxDestroyResourceFunc +/// - FfxCreatePipelineFunc +/// - FfxDestroyPipelineFunc +/// - FfxScheduleGpuJobFunc +/// - FfxExecuteGpuJobsFunc +/// - FfxBeginMarkerFunc +/// - FfxEndMarkerFunc +/// - FfxRegisterConstantBufferAllocatorFunc +/// +/// Depending on the graphics API that is abstracted by the backend, it may be +/// required that the backend is to some extent stateful. To ensure that +/// applications retain full control to manage the memory used by the FidelityFX SDK, the +/// scratchBuffer and scratchBufferSize fields are +/// provided. A backend should provide a means of specifying how much scratch +/// memory is required for its internal implementation (e.g: via a function +/// or constant value). The application is then responsible for allocating that +/// memory and providing it when setting up the SDK backend. Backends provided +/// with the FidelityFX SDK do not perform dynamic memory allocations, and instead +/// sub-allocate all memory from the scratch buffers provided. +/// +/// The scratchBuffer and scratchBufferSize fields +/// should be populated according to the requirements of each backend. For +/// example, if using the DirectX 12 backend you should call the +/// ffxGetScratchMemorySizeDX12 function. It is not required +/// that custom backend implementations use a scratch buffer. +/// +/// Any functional addition to this interface mandates a version +/// bump to ensure full functionality across effects and backends. +/// +/// @ingroup FfxInterface +typedef struct FfxInterface { + + // FidelityFX SDK 1.0 callback handles + FfxGetSDKVersionFunc fpGetSDKVersion; ///< A callback function to query the SDK version. + FfxGetEffectGpuMemoryUsageFunc fpGetEffectGpuMemoryUsage; ///< A callback function to query effect Gpu memory usage + FfxCreateBackendContextFunc fpCreateBackendContext; ///< A callback function to create and initialize the backend context. + FfxGetDeviceCapabilitiesFunc fpGetDeviceCapabilities; ///< A callback function to query device capabilites. + FfxDestroyBackendContextFunc fpDestroyBackendContext; ///< A callback function to destroy the backendcontext. This also dereferences the device. + FfxCreateResourceFunc fpCreateResource; ///< A callback function to create a resource. + FfxRegisterResourceFunc fpRegisterResource; ///< A callback function to register an external resource. + FfxGetResourceFunc fpGetResource; ///< A callback function to convert an internal resource to external resource type + FfxUnregisterResourcesFunc fpUnregisterResources; ///< A callback function to unregister external resource. + FfxRegisterStaticResourceFunc fpRegisterStaticResource; ///< A callback function to register a static resource. + FfxGetResourceDescriptionFunc fpGetResourceDescription; ///< A callback function to retrieve a resource description. + FfxDestroyResourceFunc fpDestroyResource; ///< A callback function to destroy a resource. + FfxMapResourceFunc fpMapResource; ///< A callback function to map a resource. + FfxUnmapResourceFunc fpUnmapResource; ///< A callback function to unmap a resource. + FfxStageConstantBufferDataFunc fpStageConstantBufferDataFunc; ///< A callback function to copy constant buffer data into staging memory. + FfxCreatePipelineFunc fpCreatePipeline; ///< A callback function to create a render or compute pipeline. + FfxDestroyPipelineFunc fpDestroyPipeline; ///< A callback function to destroy a render or compute pipeline. + FfxScheduleGpuJobFunc fpScheduleGpuJob; ///< A callback function to schedule a render job. + FfxExecuteGpuJobsFunc fpExecuteGpuJobs; ///< A callback function to execute all queued render jobs. + + // FidelityFX SDK 1.1 callback handles + FfxBreadcrumbsAllocBlockFunc fpBreadcrumbsAllocBlock; ///< A callback function to allocate block of memory for AMD FidelityFX Breadcrumbs Library buffer. + FfxBreadcrumbsFreeBlockFunc fpBreadcrumbsFreeBlock; ///< A callback function to free AMD FidelityFX Breadcrumbs Library buffer. + FfxBreadcrumbsWriteFunc fpBreadcrumbsWrite; ///< A callback function to write marker into AMD FidelityFX Breadcrumbs Library. + FfxBreadcrumbsPrintDeviceInfoFunc fpBreadcrumbsPrintDeviceInfo; ///< A callback function to print active GPU info for AMD FidelityFX Breadcrumbs Library log. + + FfxGetPermutationBlobByIndexFunc fpGetPermutationBlobByIndex; + FfxSwapChainConfigureFrameGenerationFunc fpSwapChainConfigureFrameGeneration; ///< A callback function to configure swap chain present callback. + + FfxRegisterConstantBufferAllocatorFunc fpRegisterConstantBufferAllocator; ///< A callback function to register a custom Thread Safe constant buffer allocator. + + void* scratchBuffer; ///< A preallocated buffer for memory utilized internally by the backend. + size_t scratchBufferSize; ///< Size of the buffer pointed to by scratchBuffer. + FfxDevice device; ///< A backend specific device + +} FfxInterface; + +#if defined(__cplusplus) +} +#endif // #if defined(__cplusplus) diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_lens.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_lens.h new file mode 100644 index 00000000..bb111697 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_lens.h @@ -0,0 +1,216 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +// @defgroup Lens + +#pragma once + +// Include the interface for the backend of the Lens API. +#include + +/// @defgroup FfxLens FidelityFX Lens +/// FidelityFX Lens runtime library +/// +/// @ingroup SDKComponents + +/// FidelityFX Lens major version. +/// +/// @ingroup FfxLens +#define FFX_LENS_VERSION_MAJOR (1) + +/// FidelityFX Lens minor version. +/// +/// @ingroup FfxLens +#define FFX_LENS_VERSION_MINOR (1) + +/// FidelityFX Lens patch version. +/// +/// @ingroup FfxLens +#define FFX_LENS_VERSION_PATCH (0) + +/// FidelityFX Lens context count +/// +/// Defines the number of internal effect contexts required by Lens +/// +/// @ingroup FfxLens +#define FFX_LENS_CONTEXT_COUNT 1 + +/// The size of the context specified in 32bit values. +/// +/// @ingroup FfxLens +#define FFX_LENS_CONTEXT_SIZE (9200) + +#if defined(__cplusplus) +extern "C" { +#endif // #if defined(__cplusplus) + +/// An enumeration of the pass which constitutes the Lens algorithm. +/// +/// Lens is implemented as a single pass algorithm. Each call to the +/// FfxLensScheduleGpuJobFunc callback function will +/// correspond to a single lens effect compute job. For a +/// more comprehensive description of Lens's inner workings, please +/// refer to the Lens reference documentation. +/// +/// @ingroup FfxLens +typedef enum FfxLensPass +{ + FFX_LENS_PASS_MAIN_PASS = 0, ///< A pass which which applies the lens effect + FFX_LENS_PASS_COUNT ///< The number of passes in Lens +} FfxLensPass; + +typedef enum FfxLensFloatPrecision +{ + FFX_LENS_FLOAT_PRECISION_32BIT = 0, + FFX_LENS_FLOAT_PRECISION_16BIT = 1, + FFX_LENS_FLOAT_PRECISION_COUNT = 2 +} FfxLensFloatPrecision; + +/// An enumeration of bit flags used when creating a +/// FfxLensContext. See FfxLensContextDescription. +/// +/// @ingroup FfxLens +typedef enum FfxLensInitializationFlagBits { + + FFX_LENS_MATH_NONPACKED = (1 << 0), ///< A bit indicating if we should use floating point math + FFX_LENS_MATH_PACKED = (1 << 1) ///< A bit indicating if we should use 16-bit half precision floating point math (favored) + +} FfxLensInitializationFlagBits; + +/// A structure encapsulating the parameters required to initialize FidelityFX +/// Lens. +/// +/// @ingroup FfxLens +typedef struct FfxLensContextDescription { + + uint32_t flags; ///< A collection of FfxLensInitializationFlagBits + FfxSurfaceFormat outputFormat; ///< Format of the output target used for creation of output resource. + FfxLensFloatPrecision floatPrecision; ///< A flag indicating the desired floating point precision for use in ffxBlurContextDispatch + FfxInterface backendInterface; ///< A set of pointers to the backend implementation for FidelityFX. + +} FfxLensContextDescription; + +/// A structure encapsulating the parameters for dispatching +/// of FidelityFX Lens +/// +/// @ingroup FfxLens +typedef struct FfxLensDispatchDescription { + + FfxCommandList commandList; ///< The FfxCommandList to record Lens rendering commands into. + FfxResource resource; ///< The FfxResource to run Lens on. + FfxResource resourceOutput; ///< The FfxResource to write Lens output to. + FfxDimensions2D renderSize; ///< The resolution used for rendering the scene. + float grainScale; ///< Artistic tweaking constant for grain scale.. + float grainAmount; ///< Artistic tweaking constant for how intense the grain is. + uint32_t grainSeed; ///< The seed for grain RNG. + float chromAb; ///< Artistic tweaking constant for chromatic aberration intensity. + float vignette; ///< Artistic tweaking constant for vignette intensity. + +} FfxLensDispatchDescription; + +/// A structure encapsulating the FidelityFX Lens context. +/// +/// This sets up an object which contains all persistent internal data and +/// resources that are required by Lens. +/// +/// The FfxLensContext object should have a lifetime matching +/// your use of Lens. Before destroying the Lens context care should be taken +/// to ensure the GPU is not accessing the resources created or used by Lens. +/// It is therefore recommended that the GPU is idle before destroying the +/// Lens context. +/// +/// @ingroup FfxLens +typedef struct FfxLensContext { + uint32_t data[FFX_LENS_CONTEXT_SIZE]; ///< An opaque set of uint32_t which contain the data for the context. +} FfxLensContext; + +/// Create a FidelityFX Lens Downsampler context from the parameters +/// programmed to the FfxLensContextDescription structure. +/// +/// The context structure is the main object used to interact with the Lens +/// API, and is responsible for the management of the internal resources +/// used by the Lens algorithm. When this API is called, multiple calls +/// will be made via the pointers contained in the backendInterface +/// structure. This backend will attempt to retrieve the device capabilities, +/// and create the internal resources, and pipelines required by Lens to function. +/// Depending on the precise configuration used when +/// creating the FfxLensContext a different set of resources and +/// pipelines might be requested via the callback functions. +/// +/// The FfxLensContext should be destroyed when use of it is +/// completed, typically when an application is unloaded or Lens +/// upscaling is disabled by a user. To destroy the Lens context you +/// should call ffxLensContextDestroy. +/// +/// @param [out] pContext A pointer to a FfxLensContext structure to populate. +/// @param [in] pContextDescription A pointer to a FfxLensContextDescription structure. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context or contextDescription was NULL. +/// @retval +/// FFX_ERROR_INCOMPLETE_INTERFACE The operation failed because the FfxLensContextDescription.callbacks was not fully specified. +/// @retval +/// FFX_ERROR_BACKEND_API_ERROR The operation failed because of an error returned from the backend. +/// +/// @ingroup FfxLens +FFX_API FfxErrorCode ffxLensContextCreate(FfxLensContext* pContext, const FfxLensContextDescription* pContextDescription); + +/// Dispatches work to the FidelityFX Lens context +/// +/// @param [out] pContext A pointer to a FfxLensContext structure to populate. +/// @param [in] pDispatchDescription A pointer to a FfxLensDispatchDescription structure. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context or dispatchDescription was NULL. +/// @retval +/// FFX_ERROR_BACKEND_API_ERROR The operation failed because of an error returned from the backend. +/// +/// @ingroup FfxLens +FFX_API FfxErrorCode ffxLensContextDispatch(FfxLensContext* pContext, const FfxLensDispatchDescription* pDispatchDescription); + +/// Destroy the FidelityFX Lens context. +/// +/// @param [out] pContext A pointer to a FfxLensContext structure to destroy. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context was NULL. +/// +/// @ingroup FfxLens +FFX_API FfxErrorCode ffxLensContextDestroy(FfxLensContext* pContext); + +/// Queries the effect version number. +/// +/// @returns +/// The SDK version the effect was built with. +/// +/// @ingroup FfxLens +FFX_API FfxVersionNumber ffxLensGetEffectVersion(); + +#if defined(__cplusplus) +} +#endif // #if defined(__cplusplus) diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_lpm.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_lpm.h new file mode 100644 index 00000000..14f65f62 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_lpm.h @@ -0,0 +1,273 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +// @defgroup LPM + +#pragma once + +// Include the interface for the backend of the LPM 1.0 API. +#include + +/// @defgroup FfxLpm FidelityFX LPM +/// FidelityFX Luma Preserving Mapper runtime library +/// +/// @ingroup SDKComponents + +/// FidelityFX Luma Preserving Mapper 1.3 major version. +/// +/// @ingroup FfxLpm +#define FFX_LPM_VERSION_MAJOR (1) + +/// FidelityFX Luma Preserving Mapper 1.3 minor version. +/// +/// @ingroup FfxLpm +#define FFX_LPM_VERSION_MINOR (4) + +/// FidelityFX Luma Preserving Mapper 1.3 patch version. +/// +/// @ingroup FfxLpm +#define FFX_LPM_VERSION_PATCH (0) + +/// FidelityFX Luma Preserving Mapper context count +/// +/// Defines the number of internal effect contexts required by LPM +/// +/// @ingroup FfxLpm +#define FFX_LPM_CONTEXT_COUNT 1 + +/// The size of the context specified in 32bit values. +/// +/// @ingroup FfxLpm +#define FFX_LPM_CONTEXT_SIZE (9300) + +#if defined(__cplusplus) +extern "C" { +#endif // #if defined(__cplusplus) + +/// An enumeration of all the passes which constitute the LPM algorithm. +/// +/// LPM is implemented as a composite of several compute passes each +/// computing a key part of the final result. Each call to the +/// FfxLPMScheduleGpuJobFunc callback function will +/// correspond to a single pass included in FfxLPMPass. For a +/// more comprehensive description of each pass, please refer to the LPM +/// reference documentation. +/// +/// @ingroup FfxLpm +typedef enum FfxLpmPass +{ + + FFX_LPM_PASS_FILTER = 0, ///< A pass which filters the color buffer using LPM's tone and gamut mapping solution. + + FFX_LPM_PASS_COUNT ///< The number of passes performed by LPM. +} FfxLpmPass; + +/// An enumeration of monitor display modes supported by LPM +/// FFX_LPM_DISPLAYMODE_LDR tagets low or standard dynamic range monitor using 8bit back buffer +/// FFX_LPM_DISPLAYMODE_HDR10_2084 targets HDR10 perceptual quantizer (PQ) transfer function using 10bit backbuffer +/// FFX_LPM_DISPLAYMODE_HDR10_SCRGB targets HDR10 linear output with no transfer function using 16bit backbuffer +/// FFX_LPM_DISPLAYMODE_FSHDR_2084 targets freesync premium pro hdr thorugh PQ transfer function using 10bit backbuffer +/// FFX_LPM_DISPLAYMODE_FSHDR_SCRGB targets linear output with no transfer function using 16bit backbuffer +/// @ingroup LPM +typedef enum class FfxLpmDisplayMode +{ + FFX_LPM_DISPLAYMODE_LDR = 0, + FFX_LPM_DISPLAYMODE_HDR10_2084 = 1, + FFX_LPM_DISPLAYMODE_HDR10_SCRGB = 2, + FFX_LPM_DISPLAYMODE_FSHDR_2084 = 3, + FFX_LPM_DISPLAYMODE_FSHDR_SCRGB = 4 +} FfxLpmDisplayMode; + +/// An enumeration of colourspaces supported by LPM +/// FFX_LPM_ColorSpace_REC709 uses rec709 colour primaries used for FFX_LPM_DISPLAYMODE_LDR, FFX_LPM_DISPLAYMODE_HDR10_SCRGB and FFX_LPM_DISPLAYMODE_FSHDR_SCRGB modes +/// FFX_LPM_ColorSpace_P3 uses P3 colour primaries +/// FFX_LPM_ColorSpace_REC2020 uses rec2020 colour primaries used for FFX_LPM_DISPLAYMODE_HDR10_2084 and FFX_LPM_DISPLAYMODE_FSHDR_2084 modes +/// FFX_LPM_ColorSapce_Display uses custom primaries queried from display +/// @ingroup LPM +typedef enum class FfxLpmColorSpace +{ + FFX_LPM_ColorSpace_REC709 = 0, + FFX_LPM_ColorSpace_P3 = 1, + FFX_LPM_ColorSpace_REC2020 = 2, + FFX_LPM_ColorSapce_Display = 3, +} FfxLpmColorSpace; + +/// An enumeration of bit flags used when creating a +/// FfxLpmContext. See FfxLpmContextDescription. +/// +/// @ingroup FfxLpm +typedef enum FfxLpmInitializationFlagBits +{ +} FfxLpmInitializationFlagBits; + +/// A structure encapsulating the parameters required to initialize FidelityFX +/// Luma Preserving Mapper +/// +/// @ingroup FfxLpm +typedef struct FfxLpmContextDescription +{ + uint32_t flags; + FfxInterface backendInterface; ///< A set of pointers to the backend implementation for LPM. +} FfxLpmContextDescription; + +/// A structure encapsulating the parameters for dispatching the various passes +/// of FidelityFX Luma Preserving Mapper 1.0 +/// +/// @ingroup FfxLpm +typedef struct FfxLpmDispatchDescription +{ + FfxCommandList commandList; ///< The FfxCommandList to record LPM rendering commands into. + FfxResource inputColor; ///< A FfxResource containing the color buffer for the current frame. + FfxResource outputColor; ///< A FfxResource containing the tone and gamut mapped output color buffer for the current frame. + bool shoulder; + float softGap; + float hdrMax; + float lpmExposure; + float contrast; + float shoulderContrast; + float saturation[3]; + float crosstalk[3]; + FfxLpmColorSpace colorSpace; + FfxLpmDisplayMode displayMode; + float displayRedPrimary[2]; + float displayGreenPrimary[2]; + float displayBluePrimary[2]; + float displayWhitePoint[2]; + float displayMinLuminance; + float displayMaxLuminance; +} FfxLpmDispatchDescription; + +/// A structure encapsulating the FidelityFX Luma Preserving 1.0 context. +/// +/// This sets up an object which contains all persistent internal data and +/// resources that are required by LPM. +/// +/// The FfxLpmContext object should have a lifetime matching +/// your use of LPM. Before destroying the LPM context care should be taken +/// to ensure the GPU is not accessing the resources created or used by LPM. +/// It is therefore recommended that the GPU is idle before destroying the +/// LPM context. +/// +/// @ingroup FfxLpm +typedef struct FfxLpmContext +{ + uint32_t data[FFX_LPM_CONTEXT_SIZE]; ///< An opaque set of uint32_t which contain the data for the context. +} FfxLpmContext; + +/// Create a FidelityFX Luma Preserving 1.0 context from the parameters +/// programmed to the FfxLpmContextDescription structure. +/// +/// The context structure is the main object used to interact with the Luma Preserving +/// Mapper 1.0 API, and is responsible for the management of the internal resources +/// used by the LPM algorithm. When this API is called, multiple calls +/// will be made via the pointers contained in the callbacks +/// structure. These callbacks will attempt to retreive the device capabilities, +/// and create the internal resources, and pipelines required by LPM +/// frame-to-frame function. Depending on the precise configuration used when +/// creating the FfxLpmContext a different set of resources and +/// pipelines might be requested via the callback functions. +/// +/// The FfxLpmContext should be destroyed when use of it is +/// completed, typically when an application is unloaded or LPM +/// tone and gamut mapping is disabled by a user. To destroy the LPM context you +/// should call ffxLpmContextDestroy. +/// +/// @param [out] pContext A pointer to a FfxLpmContext structure to populate. +/// @param [in] pContextDescription A pointer to a FfxLpmContextDescription structure. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context or contextDescription was NULL. +/// @retval +/// FFX_ERROR_INCOMPLETE_INTERFACE The operation failed because the FfxLpmContextDescription.callbacks was not fully specified. +/// @retval +/// FFX_ERROR_BACKEND_API_ERROR The operation failed because of an error returned from the backend. +/// +/// @ingroup FfxLpm +FFX_API FfxErrorCode ffxLpmContextCreate(FfxLpmContext* pContext, const FfxLpmContextDescription* pContextDescription); + +/// Dispatches work to the FidelityFX LPM context +/// @param [out] pContext A pointer to a FfxLpmContext structure to populate. +/// @param [in] pDispatchDescription A pointer to a FfxLpmDispatchDescription structure. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context or dispatchDescription was NULL. +/// @retval +/// FFX_ERROR_BACKEND_API_ERROR The operation failed because of an error returned from the backend. +/// +/// @ingroup FfxLpm +FFX_API FfxErrorCode ffxLpmContextDispatch(FfxLpmContext* pContext, const FfxLpmDispatchDescription* pDispatchDescription); + +/// Destroy the FidelityFX LPM context. +/// +/// @param [out] pContext A pointer to a FfxLpmContext structure to destroy. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context was NULL. +/// +/// @ingroup FfxLpm +FFX_API FfxErrorCode ffxLpmContextDestroy(FfxLpmContext* pContext); + +/// Sets up the constant buffer data necessary for LPM compute +/// +/// @param [in] incon +/// @param [in] insoft +/// @param [in] incon2 +/// @param [in] inclip +/// @param [in] inscaleOnly +/// @param [out] outcon +/// @param [out] outsoft +/// @param [out] outcon2 +/// @param [out] outclip +/// @param [out] outscaleOnly +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// +/// @ingroup FfxLpm +FFX_API FfxErrorCode FfxPopulateLpmConsts(bool incon, + bool insoft, + bool incon2, + bool inclip, + bool inscaleOnly, + uint32_t& outcon, + uint32_t& outsoft, + uint32_t& outcon2, + uint32_t& outclip, + uint32_t& outscaleOnly); + +/// Queries the effect version number. +/// +/// @returns +/// The SDK version the effect was built with. +/// +/// @ingroup FfxLpm +FFX_API FfxVersionNumber ffxLpmGetEffectVersion(); + +#if defined(__cplusplus) +} +#endif // #if defined(__cplusplus) diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_message.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_message.h new file mode 100644 index 00000000..aa15ca6f --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_message.h @@ -0,0 +1,63 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#pragma once + +#include + +#ifdef __cplusplus +extern "C" { +#endif // #ifdef __cplusplus + +/// @defgroup Messages Messages +/// Messages used by FidelityFX SDK functions +/// +/// @ingroup ffxHost + +/// Provides the ability to set a callback for print messages. +/// +/// @param [in] callback The callback function that will receive assert messages. +/// +/// @ingroup Messages +FFX_API void ffxSetPrintMessageCallback(ffxMessageCallback callback, uint32_t debugLevel); + +/// Function to print a message. +/// +/// @param [in] type See FfxMsgType +/// @param [in] message The message to print. +/// +/// @ingroup Messages +FFX_API void ffxPrintMessage(uint32_t type, const wchar_t* message); + +/// Macro to print message +/// by calling application registered callback, +/// otherwise to debugger's TTY +/// +/// @ingroup Messages +#define FFX_PRINT_MESSAGE( type, msg) \ + do \ + { \ + ffxPrintMessage( type, msg); \ + } while (0) +#ifdef __cplusplus +} +#endif // #ifdef __cplusplus \ No newline at end of file diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_opticalflow.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_opticalflow.h new file mode 100644 index 00000000..20f388d0 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_opticalflow.h @@ -0,0 +1,212 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +// @defgroup OpticalFlow + +#pragma once + +// Include the interface for the backend of the OpticalFlow API. +#include + +/// FidelityFX OpticalFlow major version. +/// +/// @ingroup ffxOpticalflow +#define FFX_OPTICALFLOW_VERSION_MAJOR (1) + +/// FidelityFX OpticalFlow minor version. +/// +/// @ingroup ffxOpticalflow +#define FFX_OPTICALFLOW_VERSION_MINOR (1) + +/// FidelityFX OpticalFlow patch version. +/// +/// @ingroup ffxOpticalflow +#define FFX_OPTICALFLOW_VERSION_PATCH (2) + +/// FidelityFX Optical Flow context count +/// +/// Defines the number of internal effect contexts required by Optical Flow +/// +/// @ingroup ffxOpticalFlow +#define FFX_OPTICALFLOW_CONTEXT_COUNT (1) + +/// The size of the context specified in 32bit size units. +/// +/// @ingroup ffxOpticalflow +#define FFX_OPTICALFLOW_CONTEXT_SIZE (FFX_SDK_DEFAULT_CONTEXT_SIZE) + +#if defined(__cplusplus) +extern "C" { +#endif // #if defined(__cplusplus) + +/// An enumeration of all the passes which constitute the OpticalFlow algorithm. +/// +/// @ingroup ffxOpticalflow +typedef enum FfxOpticalflowPass +{ + FFX_OPTICALFLOW_PASS_PREPARE_LUMA = 0, + FFX_OPTICALFLOW_PASS_GENERATE_OPTICAL_FLOW_INPUT_PYRAMID, + FFX_OPTICALFLOW_PASS_GENERATE_SCD_HISTOGRAM, + FFX_OPTICALFLOW_PASS_COMPUTE_SCD_DIVERGENCE, + FFX_OPTICALFLOW_PASS_COMPUTE_OPTICAL_FLOW_ADVANCED_V5, + FFX_OPTICALFLOW_PASS_FILTER_OPTICAL_FLOW_V5, + FFX_OPTICALFLOW_PASS_SCALE_OPTICAL_FLOW_ADVANCED_V5, + + FFX_OPTICALFLOW_PASS_COUNT +} FfxOpticalflowPass; + +/// An enumeration of bit flags used when creating a +/// FfxOpticalflowContext. See FfxOpticalflowDispatchDescription. +/// +/// @ingroup ffxOpticalflow +typedef enum FfxOpticalflowInitializationFlagBits +{ + FFX_OPTICALFLOW_ENABLE_TEXTURE1D_USAGE = (1 << 0), + +} FfxOpticalflowInitializationFlagBits; + +/// A structure encapsulating the parameters required to initialize +/// FidelityFX OpticalFlow. +/// +/// @ingroup ffxOpticalflow +typedef struct FfxOpticalflowContextDescription { + + FfxInterface backendInterface; ///< A set of pointers to the backend implementation for FidelityFX SDK + uint32_t flags; ///< A collection of FfxOpticalflowInitializationFlagBits. + FfxDimensions2D resolution; +} FfxOpticalflowContextDescription; + +/// A structure encapsulating the parameters for dispatching the various passes +/// of FidelityFX Opticalflow. +/// +/// @ingroup ffxOpticalflow +typedef struct FfxOpticalflowDispatchDescription +{ + FfxCommandList commandList; ///< The FfxCommandList to record rendering commands into. + FfxResource color; ///< A FfxResource containing the input color buffer + FfxResource opticalFlowVector; ///< A FfxResource containing the output motion buffer + FfxResource opticalFlowSCD; ///< A FfxResource containing the output scene change detection buffer + bool reset; ///< A boolean value which when set to true, indicates the camera has moved discontinuously. + int backbufferTransferFunction; + FfxFloatCoords2D minMaxLuminance; +} FfxOpticalflowDispatchDescription; + +typedef struct FfxOpticalflowSharedResourceDescriptions { + + FfxCreateResourceDescription opticalFlowVector; + FfxCreateResourceDescription opticalFlowSCD; + +} FfxOpticalflowSharedResourceDescriptions; + +/// A structure encapsulating the FidelityFX OpticalFlow context. +/// +/// This sets up an object which contains all persistent internal data and +/// resources that are required by OpticalFlow. +/// +/// The FfxOpticalflowContext object should have a lifetime matching +/// your use of OpticalFlow. Before destroying the OpticalFlow context care should be taken +/// to ensure the GPU is not accessing the resources created or used by OpticalFlow. +/// It is therefore recommended that the GPU is idle before destroying OpticalFlow +/// OpticalFlow context. +/// +/// @ingroup ffxOpticalflow +typedef struct FfxOpticalflowContext +{ + uint32_t data[FFX_OPTICALFLOW_CONTEXT_SIZE]; ///< An opaque set of uint32_t which contain the data for the context. +} FfxOpticalflowContext; + + +/// Create a FidelityFX OpticalFlow context from the parameters +/// programmed to the FfxOpticalflowContextDescription structure. +/// +/// The context structure is the main object used to interact with the OpticalFlow +/// API, and is responsible for the management of the internal resources used +/// by the OpticalFlow algorithm. When this API is called, multiple calls will be +/// made via the pointers contained in the callbacks structure. +/// These callbacks will attempt to retreive the device capabilities, and +/// create the internal resources, and pipelines required by OpticalFlow's +/// frame-to-frame function. Depending on the precise configuration used when +/// creating the FfxOpticalflowContext a different set of resources and +/// pipelines might be requested via the callback functions. +/// +/// The flags included in the flags field of +/// FfxOpticalflowContext how match the configuration of your +/// application as well as the intended use of OpticalFlow. It is important that these +/// flags are set correctly (as well as a correct programmed +/// FfxOpticalflowContextDescription) to ensure correct operation. It is +/// recommended to consult the overview documentation for further details on +/// how OpticalFlow should be integerated into an application. +/// +/// When the FfxOpticalflowContext is created, you should use the +/// ffxOpticalflowContextDispatch function each frame where FSR3 +/// upscaling should be applied. See the documentation of +/// ffxOpticalflowContextDispatch for more details. +/// +/// The FfxOpticalflowContext should be destroyed when use of it is +/// completed, typically when an application is unloaded or OpticalFlow is +/// disabled by a user. To destroy the OpticalFlow context you should call +/// ffxOpticalflowContextDestroy. +/// +/// @param [out] context A pointer to a FfxOpticalflowContext structure to populate. +/// @param [in] contextDescription A pointer to a FfxOpticalflowContextDescription structure. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context or contextDescription was NULL. +/// @retval +/// FFX_ERROR_INCOMPLETE_INTERFACE The operation failed because the FfxOpticalflowContextDescription.callbacks was not fully specified. +/// @retval +/// FFX_ERROR_BACKEND_API_ERROR The operation failed because of an error returned from the backend. +/// +/// @ingroup ffxOpticalflow +FFX_API FfxErrorCode ffxOpticalflowContextCreate(FfxOpticalflowContext* context, FfxOpticalflowContextDescription* contextDescription); + +FFX_API FfxErrorCode ffxOpticalflowContextGetGpuMemoryUsage(FfxOpticalflowContext* pContext, FfxEffectMemoryUsage* vramUsage); + +FFX_API FfxErrorCode ffxOpticalflowGetSharedResourceDescriptions(FfxOpticalflowContext* context, FfxOpticalflowSharedResourceDescriptions* SharedResources); + +FFX_API FfxErrorCode ffxOpticalflowContextDispatch(FfxOpticalflowContext* context, const FfxOpticalflowDispatchDescription* dispatchDescription); + +/// Destroy the FidelityFX OpticalFlow context. +/// +/// @param [out] context A pointer to a FfxOpticalflowContext structure to destroy. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context was NULL. +/// +/// @ingroup ffxOpticalflow +FFX_API FfxErrorCode ffxOpticalflowContextDestroy(FfxOpticalflowContext* context); + +/// Queries the effect version number. +/// +/// @returns +/// The SDK version the effect was built with. +/// +/// @ingroup ffxOpticalflow +FFX_API FfxVersionNumber ffxOpticalflowGetEffectVersion(); + +#if defined(__cplusplus) +} +#endif // #if defined(__cplusplus) diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_parallelsort.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_parallelsort.h new file mode 100644 index 00000000..f74b3598 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_parallelsort.h @@ -0,0 +1,210 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +// @defgroup PARALLEL_SORT + +#pragma once + +// Include the interface for the backend of the FSR2 API. +#include + +/// @defgroup FfxParallelSort FidelityFX Parallel Sort +/// FidelityFX Single Pass Downsampler runtime library +/// +/// @ingroup SDKComponents + +/// FidelityFX Parallel Sort major version. +/// +/// @ingroup FfxParallelSort +#define FFX_PARALLELSORT_VERSION_MAJOR (1) + +/// FidelityFX Parallel Sort minor version. +/// +/// @ingroup FfxParallelSort +#define FFX_PARALLELSORT_VERSION_MINOR (3) + +/// FidelityFX Parallel Sort patch version. +/// +/// @ingroup FfxParallelSort +#define FFX_PARALLELSORT_VERSION_PATCH (0) + +/// FidelityFX SPD context count +/// +/// Defines the number of internal effect contexts required by SPD +/// +/// @ingroup FfxParallelSort +#define FFX_PARALLELSORT_CONTEXT_COUNT 1 + +/// The size of the context specified in 32bit values. +/// +/// @ingroup FfxParallelSort +#define FFX_PARALLELSORT_CONTEXT_SIZE (373794) + +#if defined(__cplusplus) +extern "C" { +#endif // #if defined(__cplusplus) + +/// An enumeration of the passes which constitute the Parallel Sort algorithm. +/// +/// Parallel Sort is implemented as a multi-pass algorithm that is invoked over +/// a number of successive iterations until all bits in the key are sorted. +/// For a more comprehensive description of Parallel Sort's inner workings, please +/// refer to the Parallel Sort reference documentation. +/// +/// @ingroup FfxParallelSort +typedef enum FfxParallelSortPass +{ + + FFX_PARALLELSORT_PASS_SETUP_INDIRECT_ARGS = 0, ///< A pass which sets up indirect params to invoke sorting when FFX_PARALLEL_SORT_INDIRECT flag bit is set. + FFX_PARALLELSORT_PASS_SUM, ///< A pass which counts the number of occurrences of each value in the data set. + FFX_PARALLELSORT_PASS_REDUCE, ///< A pass which further reduces the counts across thread groups for faster offset calculations in large data sets. + FFX_PARALLELSORT_PASS_SCAN, ///< A pass which prefixes the count totals into global offsets. + FFX_PARALLELSORT_PASS_SCAN_ADD, ///< A pass which does a second prefix add the global offsets to each local thread group offset. + FFX_PARALLELSORT_PASS_SCATTER, ///< A pass which performs a local sort of all values in the thread group and outputs to new global offset + + FFX_PARALLELSORT_PASS_COUNT ///< The number of passes in Parallel Sort +} FfxParallelSortPass; + +/// An enumeration of bit flags used when creating a +/// FfxParallelSortContextDescription. See FfxParallelSortContextDescription. +/// +/// @ingroup FfxParallelSort +typedef enum FfxParallelSortInitializationFlagBits { + + FFX_PARALLELSORT_INDIRECT_SORT = (1 << 0), ///< A bit indicating if we should use indirect version of sort algorithm + FFX_PARALLELSORT_PAYLOAD_SORT = (1 << 1), ///< A bit indicating if we should sort a payload buffer + +} FfxParallelSortInitializationFlagBits; + +/// A structure encapsulating the parameters required to initialize FidelityFX +/// Parallel Sort. +/// +/// @ingroup FfxParallelSort +typedef struct FfxParallelSortContextDescription { + + uint32_t flags; ///< A collection of FfxParallelSortInitializationFlagBits. + uint32_t maxEntries; ///< Maximum number of entries to sort + FfxInterface backendInterface; ///< A set of pointers to the backend implementation for FidelityFX. +} FfxParallelSortContextDescription; + +/// A structure encapsulating the parameters needed to sort +/// the buffer(s) provided +/// +/// @ingroup FfxParallelSort +typedef struct FfxParallelSortDispatchDescription { + + FfxCommandList commandList; ///< The FfxCommandList to record parallel sort compute commands into. + FfxResource keyBuffer; ///< The buffer resource containing the keys to sort + FfxResource payloadBuffer; ///< The (optional) payload buffer to sort (requires FFX_PARALLELSORT_PAYLOAD_SORT be set) + uint32_t numKeysToSort; ///< The number of keys in the buffer requiring sorting +} FfxParallelSortDispatchDescription; + +/// A structure encapsulating the FidelityFX Parallel Sort context. +/// +/// This sets up an object which contains all persistent internal data and +/// resources that are required by parallel sort. +/// +/// The FfxParallelSortContext object should have a lifetime matching +/// your use of parallel sort. Before destroying the parallel sort context care +/// should be taken to ensure the GPU is not accessing the resources created or +/// used by parallel sort. It is therefore recommended that the GPU is idle +/// before destroying the parallel sort context. +/// +/// @ingroup FfxParallelSort +typedef struct FfxParallelSortContext { + + uint32_t data[FFX_PARALLELSORT_CONTEXT_SIZE]; ///< An opaque set of uint32_t which contain the data for the context. +} FfxParallelSortContext; + + +/// Create a FidelityFX Parallel Sort context from the parameters +/// programmed to the FfxParallelSortContextDescription structure. +/// +/// The context structure is the main object used to interact with the parallel +/// sort API, and is responsible for the management of the internal resources +/// used by the parallel sort algorithm. When this API is called, multiple calls +/// will be made via the pointers contained in the callbacks +/// structure. These callbacks will attempt to retreive the device capabilities, +/// and create the internal resources, and pipelines required by parallel sorts' +/// frame-to-frame function. Depending on the precise configuration used when +/// creating the FfxParallelSortContext a different set of resources and +/// pipelines might be requested via the callback functions. +/// +/// The FfxParallelSortContext should be destroyed when use of it is +/// completed, typically when an application is unloaded or parallel sort +/// upscaling is disabled by a user. To destroy the parallel sort context you +/// should call ffxParallelSortContextDestroy. +/// +/// @param [out] pContext A pointer to a FfxParallelSortContext structure to populate. +/// @param [in] pContextDescription A pointer to a FfxParallelSortContextDescription structure. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context or contextDescription was NULL. +/// @retval +/// FFX_ERROR_INCOMPLETE_INTERFACE The operation failed because the FfxFsr2ContextDescription.callbacks was not fully specified. +/// @retval +/// FFX_ERROR_BACKEND_API_ERROR The operation failed because of an error returned from the backend. +/// +/// @ingroup FfxParallelSort +FFX_API FfxErrorCode ffxParallelSortContextCreate(FfxParallelSortContext* pContext, const FfxParallelSortContextDescription* pContextDescription); + +/// Execute a FidelityFX Parallel Sort context to sort the provided data +/// according to the passed in dispatch description. +/// +/// @param [out] pContext A pointer to a FfxParallelSortContext structure to populate. +/// @param [in] pDispatchDescription A pointer to a FfxParallelSortDispatchDescription structure. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context or sortDescription was NULL. +/// @retval +/// FFX_ERROR_BACKEND_API_ERROR The operation failed because of an error returned from the backend. +/// +/// @ingroup FfxParallelSort +FFX_API FfxErrorCode ffxParallelSortContextDispatch(FfxParallelSortContext* pContext, const FfxParallelSortDispatchDescription* pDispatchDescription); + +/// Destroy the FidelityFX Parallel Sort context. +/// +/// @param [out] pContext A pointer to a FfxParallelSortContext structure to destroy. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context was NULL. +/// +/// @ingroup FfxParallelSort +FFX_API FfxErrorCode ffxParallelSortContextDestroy(FfxParallelSortContext* pContext); + +/// Queries the effect version number. +/// +/// @returns +/// The SDK version the effect was built with. +/// +/// @ingroup FfxParallelSort +FFX_API FfxVersionNumber ffxParallelSortGetEffectVersion(); + +#if defined(__cplusplus) +} +#endif // #if defined(__cplusplus) diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_spd.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_spd.h new file mode 100644 index 00000000..14e3230e --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_spd.h @@ -0,0 +1,222 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +// @defgroup FSR2 + +#pragma once + +// Include the interface for the backend of the FSR2 API. +#include + +/// @defgroup FfxSpd FidelityFX SPD +/// FidelityFX Single Pass Downsampler runtime library +/// +/// @ingroup SDKComponents + +/// FidelityFX SPD major version. +/// +/// @ingroup FfxSpd +#define FFX_SPD_VERSION_MAJOR (2) + +/// FidelityFX SPD minor version. +/// +/// @ingroup FfxSpd +#define FFX_SPD_VERSION_MINOR (2) + +/// FidelityFX SPD patch version. +/// +/// @ingroup FfxSpd +#define FFX_SPD_VERSION_PATCH (0) + +/// FidelityFX SPD context count +/// +/// Defines the number of internal effect contexts required by SPD +/// +/// @ingroup FfxSpd +#define FFX_SPD_CONTEXT_COUNT 1 + +/// The size of the context specified in 32bit values. +/// +/// @ingroup FfxSpd +#define FFX_SPD_CONTEXT_SIZE (9300) + +/// If this ever changes, need to also reflect a change in number +/// of resources in ffx_spd_resources.h +/// +/// @ingroup FfxSpd +#define SPD_MAX_MIP_LEVELS 12 + +#if defined(__cplusplus) +extern "C" { +#endif // #if defined(__cplusplus) + +/// An enumeration of the pass which constitutes the SPD algorithm. +/// +/// SPD is implemented as a single pass algorithm. Each call to the +/// FfxSPDScheduleGpuJobFunc callback function will +/// correspond to a single downsample job. For a +/// more comprehensive description of SPD's inner workings, please +/// refer to the SPD reference documentation. +/// +/// @ingroup FfxSpd +typedef enum FfxSpdPass +{ + + FFX_SPD_PASS_DOWNSAMPLE = 0, ///< A pass which which downsamples all mips + + FFX_SPD_PASS_COUNT ///< The number of passes in SPD +} FfxSpdPass; + +typedef enum FfxSpdDownsampleFilter +{ + FFX_SPD_DOWNSAMPLE_FILTER_MEAN = 0, + FFX_SPD_DOWNSAMPLE_FILTER_MIN, + FFX_SPD_DOWNSAMPLE_FILTER_MAX, + FFX_SPD_DOWNSAMPLE_FILTER_COUNT +} FfxSpdDownsampleFilter; + +/// An enumeration of bit flags used when creating a +/// FfxSpdContext. See FfxSpdContextDescription. +/// +/// @ingroup FfxSpd +typedef enum FfxSpdInitializationFlagBits { + + FFX_SPD_SAMPLER_LOAD = (1 << 0), ///< A bit indicating if we should use resource loads (favor loads over sampler) + FFX_SPD_SAMPLER_LINEAR = (1 << 1), ///< A bit indicating if we should use sampler to load resources. + FFX_SPD_WAVE_INTEROP_LDS = (1 << 2), ///< A bit indicating if we should use LDS + FFX_SPD_WAVE_INTEROP_WAVE_OPS = (1 << 3), ///< A bit indicating if we should use WAVE OPS (favor wave ops over LDS) + FFX_SPD_MATH_NONPACKED = (1 << 4), ///< A bit indicating if we should use floating point math + FFX_SPD_MATH_PACKED = (1 << 5) ///< A bit indicating if we should use 16-bit half precision floating point math (favored) + +} FfxSpdInitializationFlagBits; + +/// A structure encapsulating the parameters required to initialize FidelityFX +/// Single Pass Downsampler. +/// +/// @ingroup FfxSpd +typedef struct FfxSpdContextDescription { + + uint32_t flags; ///< A collection of FfxSpdInitializationFlagBits + FfxSpdDownsampleFilter downsampleFilter; + FfxInterface backendInterface; ///< A set of pointers to the backend implementation for FidelityFX. + +} FfxSpdContextDescription; + +/// A structure encapsulating the parameters for dispatching +/// of FidelityFX Single Pass Downsampler +/// +/// @ingroup FfxSpd +typedef struct FfxSpdDispatchDescription { + + FfxCommandList commandList; ///< The FfxCommandList to record rendering commands into. + FfxResource resource; ///< The FfxResource to downsample + +} FfxSpdDispatchDescription; + +/// A structure encapsulating the FidelityFX single pass downsampler context. +/// +/// This sets up an object which contains all persistent internal data and +/// resources that are required by SPD. +/// +/// The FfxSpdContext object should have a lifetime matching +/// your use of FSR1. Before destroying the SPD context care should be taken +/// to ensure the GPU is not accessing the resources created or used by SPD. +/// It is therefore recommended that the GPU is idle before destroying the +/// SPD context. +/// +/// @ingroup FfxSpd +typedef struct FfxSpdContext { + + uint32_t data[FFX_SPD_CONTEXT_SIZE]; ///< An opaque set of uint32_t which contain the data for the context. +} FfxSpdContext; + +/// Create a FidelityFX Single Pass Downsampler context from the parameters +/// programmed to the FfxSpdContextDescription structure. +/// +/// The context structure is the main object used to interact with the Single +/// Pass Downsampler API, and is responsible for the management of the internal resources +/// used by the SPD algorithm. When this API is called, multiple calls +/// will be made via the pointers contained in the backendInterface +/// structure. This backend will attempt to retrieve the device capabilities, +/// and create the internal resources, and pipelines required by SPD to function. +/// Depending on the precise configuration used when +/// creating the FfxSpdContext a different set of resources and +/// pipelines might be requested via the callback functions. +/// +/// The FfxSpdContext should be destroyed when use of it is +/// completed, typically when an application is unloaded or SPD +/// upscaling is disabled by a user. To destroy the SPD context you +/// should call ffxSpdContextDestroy. +/// +/// @param [out] pContext A pointer to a FfxSpdContext structure to populate. +/// @param [in] pContextDescription A pointer to a FfxSpdContextDescription structure. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context or contextDescription was NULL. +/// @retval +/// FFX_ERROR_INCOMPLETE_INTERFACE The operation failed because the FfxSpdContextDescription.callbacks was not fully specified. +/// @retval +/// FFX_ERROR_BACKEND_API_ERROR The operation failed because of an error returned from the backend. +/// +/// @ingroup FfxSpd +FFX_API FfxErrorCode ffxSpdContextCreate(FfxSpdContext* pContext, const FfxSpdContextDescription* pContextDescription); + +/// Dispatches work to the FidelityFX SPD context +/// +/// @param [out] pContext A pointer to a FfxSpdContext structure to populate. +/// @param [in] pDispatchDescription A pointer to a FfxSpdDispatchDescription structure. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context or dispatchDescription was NULL. +/// @retval +/// FFX_ERROR_BACKEND_API_ERROR The operation failed because of an error returned from the backend. +/// +/// @ingroup FfxSpd +FFX_API FfxErrorCode ffxSpdContextDispatch(FfxSpdContext* pContext, const FfxSpdDispatchDescription* pDispatchDescription); + +/// Destroy the FidelityFX SPD context. +/// +/// @param [out] pContext A pointer to a FfxSpdContext structure to destroy. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context was NULL. +/// +/// @ingroup FfxSpd +FFX_API FfxErrorCode ffxSpdContextDestroy(FfxSpdContext* pContext); + +/// Queries the effect version number. +/// +/// @returns +/// The SDK version the effect was built with. +/// +/// @ingroup FfxSpd +FFX_API FfxVersionNumber ffxSpdGetEffectVersion(); + +#if defined(__cplusplus) +} +#endif // #if defined(__cplusplus) diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_sssr.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_sssr.h new file mode 100644 index 00000000..0083eb8e --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_sssr.h @@ -0,0 +1,260 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#pragma once + +// Include the interface for the backend of the SSSR API. +#include + +/// @defgroup FfxSssr FidelityFX SSSR +/// FidelityFX Stochastic Screen Space Reflections runtime library +/// +/// @ingroup SDKComponents + +/// FidelityFX Stochastic Screen Space Reflections major version. +/// +/// @ingroup FfxSssr +#define FFX_SSSR_VERSION_MAJOR (1) + +/// FidelityFX Stochastic Screen Space Reflections minor version. +/// +/// @ingroup FfxSssr +#define FFX_SSSR_VERSION_MINOR (5) + +/// FidelityFX Stochastic Screen Space Reflections patch version. +/// +/// @ingroup FfxSssr +#define FFX_SSSR_VERSION_PATCH (0) + +/// FidelityFX SSSR context count +/// +/// Defines the number of internal effect contexts required by SSSR +/// We need 2, one for the SSSR context and one for the FidelityFX Denoiser +/// +/// @ingroup FfxSssr +#define FFX_SSSR_CONTEXT_COUNT 2 + +/// The size of the context specified in 32bit values. +/// +/// @ingroup FfxSssr +#define FFX_SSSR_CONTEXT_SIZE (118914) + +#if defined(__cplusplus) +extern "C" { +#endif // #if defined(__cplusplus) + +/// An enumeration of all the passes which constitute the SSSR algorithm. +/// +/// SSSR is implemented as a composite of several compute passes each +/// computing a key part of the final result. Each call to the +/// FfxSssrScheduleGpuJobFunc callback function will +/// correspond to a single pass included in FfxSssrPass. For a +/// more comprehensive description of each pass, please refer to the SSSR +/// reference documentation. +/// +/// @ingroup FfxSssr +typedef enum FfxSssrPass +{ + FFX_SSSR_PASS_DEPTH_DOWNSAMPLE = 0, ///< A pass which performs the hierarchical depth buffer generation + FFX_SSSR_PASS_CLASSIFY_TILES = 1, ///< A pass which classifies which pixels require screen space ray marching + FFX_SSSR_PASS_PREPARE_BLUE_NOISE_TEXTURE = 2, ///< A pass which generates an optimized blue noise texture + FFX_SSSR_PASS_PREPARE_INDIRECT_ARGS = 3, ///< A pass which generates the indirect arguments for the intersection pass. + FFX_SSSR_PASS_INTERSECTION = 4, ///< A pass which performs the actual hierarchical depth ray marching. + FFX_SSSR_PASS_COUNT +} FfxSssrPass; + +/// An enumeration of bit flags used when creating a +/// FfxSssrContext. See FfxSssrContextDescription. +/// +/// @ingroup FfxSssr +typedef enum FfxSssrInitializationFlagBits { + + FFX_SSSR_ENABLE_DEPTH_INVERTED = (1 << 0) ///< A bit indicating that the input depth buffer data provided is inverted [1..0]. +} FfxSssrInitializationFlagBits; + +/// A structure encapsulating the parameters required to initialize FidelityFX +/// Stochastic Screen Space Reflections. +/// +/// @ingroup ffxSssr +typedef struct FfxSssrContextDescription +{ + uint32_t flags; ///< A collection of FfxSssrInitializationFlagBits. + FfxDimensions2D renderSize; ///< The resolution we are currently rendering at + FfxSurfaceFormat normalsHistoryBufferFormat; ///< The format used by the reflections denoiser to store the normals buffer history + FfxInterface backendInterface; ///< A set of pointers to the backend implementation for FidelityFX SDK +} FfxSssrContextDescription; + +/// A structure encapsulating the parameters for dispatching the various passes +/// of FidelityFX Stochastic Screen Space Reflections. +/// +/// @ingroup ffxSssr +typedef struct FfxSssrDispatchDescription { + + FfxCommandList commandList; ///< The FfxCommandList to record SSSR rendering commands into. + FfxResource color; ///< A FfxResource containing the color buffer for the current frame. + FfxResource depth; ///< A FfxResource containing the depth buffer for the current frame. + FfxResource motionVectors; ///< A FfxResource containing the motion vectors buffer for the current frame. + FfxResource normal; ///< A FfxResource containing the normal buffer for the current frame. + FfxResource materialParameters; ///< A FfxResource containing the roughness buffer for the current frame. + FfxResource environmentMap; ///< A FfxResource containing the environment map to fallback to when screenspace data is not sufficient. + FfxResource brdfTexture; ///< A FfxResource containing the precomputed brdf LUT. + FfxResource output; ///< A FfxResource to store the result of the SSSR algorithm into. + float invViewProjection[16]; ///< An array containing the inverse of the view projection matrix in column major layout. + float projection[16]; ///< An array containing the projection matrix in column major layout. + float invProjection[16]; ///< An array containing the inverse of the projection matrix in column major layout. + float view[16]; ///< An array containing the view matrix in column major layout. + float invView[16]; ///< An array containing the inverse of the view matrix in column major layout. + float prevViewProjection[16]; ///< An array containing the previous frame's view projection matrix in column major layout. + FfxDimensions2D renderSize; ///< The resolution that was used for rendering the input resources. + FfxFloatCoords2D motionVectorScale; ///< The scale factor to apply to motion vectors. + float iblFactor; ///< A factor to control the intensity of the image based lighting. Set to 1 for an HDR probe. + float normalUnPackMul; ///< A multiply factor to transform the normal to the space expected by SSSR. + float normalUnPackAdd; ///< An offset to transform the normal to the space expected by SSSR. + uint32_t roughnessChannel; ///< The channel to read the roughness from the materialParameters texture + bool isRoughnessPerceptual; ///< A boolean to describe the space used to store roughness in the materialParameters texture. If false, we assume roughness squared was stored in the Gbuffer. + float temporalStabilityFactor; ///< A factor to control the accmulation of history values. Higher values reduce noise, but are more likely to exhibit ghosting artefacts. + float depthBufferThickness; ///< A bias for accepting hits. Larger values can cause streaks, lower values can cause holes. + float roughnessThreshold; ///< Regions with a roughness value greater than this threshold won't spawn rays. + float varianceThreshold; ///< Luminance differences between history results will trigger an additional ray if they are greater than this threshold value. + uint32_t maxTraversalIntersections; ///< Caps the maximum number of lookups that are performed from the depth buffer hierarchy. Most rays should terminate after approximately 20 lookups. + uint32_t minTraversalOccupancy; ///< Exit the core loop early if less than this number of threads are running. + uint32_t mostDetailedMip; ///< The most detailed MIP map level in the depth hierarchy. Perfect mirrors always use 0 as the most detailed level. + uint32_t samplesPerQuad; ///< The minimum number of rays per quad. Variance guided tracing can increase this up to a maximum of 4. + uint32_t temporalVarianceGuidedTracingEnabled; ///< A boolean controlling whether a ray should be spawned on pixels where a temporal variance is detected or not. +} FfxSssrDispatchDescription; + +/// A structure encapsulating the FidelityFX Stochastic Screen Space Reflections context. +/// +/// This sets up an object which contains all persistent internal data and +/// resources that are required by SSSR. +/// +/// The FfxSssrContext object should have a lifetime matching +/// your use of SSSR. Before destroying the SSSR context care should be taken +/// to ensure the GPU is not accessing the resources created or used by SSSR. +/// It is therefore recommended that the GPU is idle before destroying the +/// SSSR context. +/// +/// @ingroup ffxSssr +typedef struct FfxSssrContext +{ + uint32_t data[FFX_SSSR_CONTEXT_SIZE]; ///< An opaque set of uint32_t which contain the data for the context. +} FfxSssrContext; + +/// Create a FidelityFX Stochastic Screen Space Reflections context from the parameters +/// programmed to the FfxSssrCreateParams structure. +/// +/// The context structure is the main object used to interact with the SSSR +/// API, and is responsible for the management of the internal resources used +/// by the SSSR algorithm. When this API is called, multiple calls will be +/// made via the pointers contained in the callbacks structure. +/// These callbacks will attempt to retreive the device capabilities, and +/// create the internal resources, and pipelines required by SSSR's +/// frame-to-frame function. Depending on the precise configuration used when +/// creating the FfxSssrContext a different set of resources and +/// pipelines might be requested via the callback functions. +/// +/// The flags included in the flags field of +/// FfxSssrContext how match the configuration of your +/// application as well as the intended use of SSSR. It is important that these +/// flags are set correctly (as well as a correct programmed +/// FfxSssrDispatchDescription) to ensure correct operation. It is +/// recommended to consult the overview documentation for further details on +/// how SSSR should be integerated into an application. +/// +/// When the FfxSssrContext is created, you should use the +/// ffxSssrContextDispatch function each frame where SSSR +/// algorithm should be applied. See the documentation of +/// ffxSssrContextDispatch for more details. +/// +/// The FfxSssrContext should be destroyed when use of it is +/// completed, typically when an application is unloaded or SSSR upscaling is +/// disabled by a user. To destroy the SSSR context you should call +/// ffxSssrContextDestroy. +/// +/// @param [out] pContext A pointer to a FfxSssrContext structure to populate. +/// @param [in] pContextDescription A pointer to a FfxSssrContextDescription structure. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context or contextDescription was NULL. +/// @retval +/// FFX_ERROR_INCOMPLETE_INTERFACE The operation failed because the FfxSssrContextDescription.callbacks was not fully specified. +/// @retval +/// FFX_ERROR_BACKEND_API_ERROR The operation failed because of an error returned from the backend. +/// +/// @ingroup ffxSssr +FFX_API FfxErrorCode ffxSssrContextCreate(FfxSssrContext* context, const FfxSssrContextDescription* contextDescription); + +/// Dispatch the various passes that constitute the FidelityFX Stochastic Screen Space Reflections. +/// +/// SSSR is a composite effect, meaning that it is compromised of multiple +/// constituent passes (implemented as one or more clears, copies and compute +/// dispatches). The ffxSssrContextDispatch function is the +/// function which (via the use of the functions contained in the +/// callbacks field of the FfxSssrContext +/// structure) utlimately generates the sequence of graphics API calls required +/// each frame. +/// +/// As with the creation of the FfxSssrContext correctly +/// programming the FfxSssrDispatchDescription is key to ensuring +/// the correct operation of SSSR. +/// +/// @param [in] pContext A pointer to a FfxSssrContext structure. +/// @param [in] pDispatchDescription A pointer to a FfxSssrDispatchDescription structure. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context or dispatchDescription was NULL. +/// @retval +/// FFX_ERROR_NULL_DEVICE The operation failed because the device inside the context was NULL. +/// @retval +/// FFX_ERROR_BACKEND_API_ERROR The operation failed because of an error returned from the backend. +/// +/// @ingroup ffxSssr +FFX_API FfxErrorCode ffxSssrContextDispatch(FfxSssrContext* context, const FfxSssrDispatchDescription* dispatchDescription); + + +/// Destroy the FidelityFX Stochastic Screen Space Reflections context. +/// +/// @param [out] pContext A pointer to a FfxSssrContext structure to destroy. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context was NULL. +/// +/// @ingroup ffxSssr +FFX_API FfxErrorCode ffxSssrContextDestroy(FfxSssrContext* context); + +/// Queries the effect version number. +/// +/// @returns +/// The SDK version the effect was built with. +/// +/// @ingroup ffxSssr +FFX_API FfxVersionNumber ffxSssrGetEffectVersion(); + +#if defined(__cplusplus) +} +#endif // #if defined(__cplusplus) diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_types.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_types.h new file mode 100644 index 00000000..732a0ad1 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_types.h @@ -0,0 +1,1309 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#pragma once + +#include + +/// +/// @defgroup ffxSDK SDK +/// The SDK module provides detailed descriptions of the various class, structs, and function which comprise the FidelityFX SDK. It is divided into several sub-modules. +/// + +/// @defgroup ffxHost Host +/// The FidelityFX SDK host (CPU-side) references +/// +/// @ingroup ffxSDK + +/// @defgroup Defines Defines +/// Top level defines used by the FidelityFX SDK +/// +/// @ingroup ffxHost + +// When defining custom mutex you have to also define: +// FFX_MUTEX_LOCK - for exclusive locking of mutex +// FFX_MUTEX_LOCK_SHARED - for shared locking of mutex +// FFX_MUTEX_UNLOCK - for exclusive unlocking of mutex +// FFX_MUTEX_UNLOCK_SHARED - for shared unlocking of mutex +// +// If your mutex type doesn't support shared locking mechanism you can rely +// on exclusive locks only (define _SHARED variants to the same exclusive operation). +#ifndef FFX_MUTEX +#if __cplusplus >= 201703L +#include +/// FidelityFX mutex wrapper. +/// +/// @ingroup SDKTypes +#define FFX_MUTEX std::shared_mutex +#define FFX_MUTEX_IMPL_SHARED +#else +#include +/// FidelityFX mutex wrapper. +/// +/// @ingroup SDKTypes +#define FFX_MUTEX std::mutex +#define FFX_MUTEX_IMPL_STANDARD +#endif // #if __cplusplus >= 201703L +#endif // #ifndef FFX_MUTEX + +#if defined(FFX_GCC) || !defined(FFX_BUILD_AS_DLL) +/// FidelityFX exported functions +/// +/// @ingroup Defines +#define FFX_API +#else +/// FidelityFX exported functions +/// +/// @ingroup Defines +#define FFX_API __declspec(dllexport) +#endif // #if defined (FFX_GCC) + +// Savage Wind: the contexts hold their resources' wide-string debug names, sized for Windows' 2-byte wchar_t; with +// Linux's 4-byte one they outgrew this (ffx_frameinterpolation.cpp's static_assert), so twice the room there. +#if defined(_WIN32) +#define FFX_SDK_DEFAULT_CONTEXT_SIZE (1024 * 128) +#else +#define FFX_SDK_DEFAULT_CONTEXT_SIZE (1024 * 128 * 2) +#endif + +/// Maximum supported number of simultaneously bound SRVs. +/// +/// @ingroup Defines +#define FFX_MAX_NUM_SRVS 64 + +/// Maximum supported number of simultaneously bound UAVs. +/// +/// @ingroup Defines +#define FFX_MAX_NUM_UAVS 64 + +/// Maximum number of constant buffers bound. +/// +/// @ingroup Defines +#define FFX_MAX_NUM_CONST_BUFFERS 3 + +/// Maximum number of characters in a resource name +/// +/// @ingroup Defines +#define FFX_RESOURCE_NAME_SIZE 64 + +/// Maximum number of queued frames in the backend +/// +/// @ingroup Defines +#define FFX_MAX_QUEUED_FRAMES (4) + +/// Maximum number of resources per effect context +/// +/// @ingroup Defines +#define FFX_MAX_RESOURCE_COUNT (512) + +/// Maximum number of passes per effect component +/// +/// @ingroup Defines +#define FFX_MAX_PASS_COUNT (50) + +/// Total number of descriptors in ring buffer needed for a single effect context +/// +/// @ingroup Defines +#define FFX_RING_BUFFER_DESCRIPTOR_COUNT (FFX_MAX_QUEUED_FRAMES * FFX_MAX_PASS_COUNT * FFX_MAX_RESOURCE_COUNT) + +/// Size of constant buffer entry in the ring buffer table +/// +/// @ingroup Defines +#define FFX_BUFFER_SIZE (4096) + +/// Total constant buffer ring buffer size for a single effect context +/// +/// @ingroup Defines +#define FFX_CONSTANT_BUFFER_RING_BUFFER_SIZE (FFX_MAX_QUEUED_FRAMES * FFX_MAX_PASS_COUNT * FFX_BUFFER_SIZE) + +/// Maximum number of barriers per flush +/// +/// @ingroup Defines +#define FFX_MAX_BARRIERS (128) + +/// Maximum number of GPU jobs per submission +/// +/// @ingroup Defines +#define FFX_MAX_GPU_JOBS (256) + +/// Maximum number of samplers supported +/// +/// @ingroup Defines +#define FFX_MAX_SAMPLERS (16) + +/// Maximum number of simultaneous upload jobs +/// +/// @ingroup Defines +#define UPLOAD_JOB_COUNT (16) + +// Off by default warnings +#pragma warning(disable : 4365 4710 4820 5039) + +#ifdef __cplusplus +extern "C" { +#endif // #ifdef __cplusplus + +/// @defgroup CPUTypes CPU Types +/// CPU side type defines for all commonly used variables +/// +/// @ingroup ffxHost + +/// A typedef for version numbers returned from functions in the FidelityFX SDK. +/// +/// @ingroup CPUTypes + typedef uint32_t FfxVersionNumber; + +/// A typedef for a boolean value. +/// +/// @ingroup CPUTypes +typedef bool FfxBoolean; + +/// A typedef for a unsigned 8bit integer. +/// +/// @ingroup CPUTypes +typedef uint8_t FfxUInt8; + +/// A typedef for a unsigned 16bit integer. +/// +/// @ingroup CPUTypes +typedef uint16_t FfxUInt16; + +/// A typedef for a unsigned 32bit integer. +/// +/// @ingroup CPUTypes +typedef uint32_t FfxUInt32; + +/// A typedef for a unsigned 64bit integer. +/// +/// @ingroup CPUTypes +typedef uint64_t FfxUInt64; + +/// A typedef for a signed 8bit integer. +/// +/// @ingroup CPUTypes +typedef int8_t FfxInt8; + +/// A typedef for a signed 16bit integer. +/// +/// @ingroup CPUTypes +typedef int16_t FfxInt16; + +/// A typedef for a signed 32bit integer. +/// +/// @ingroup CPUTypes +typedef int32_t FfxInt32; + +/// A typedef for a signed 64bit integer. +/// +/// @ingroup CPUTypes +typedef int64_t FfxInt64; + +/// A typedef for a floating point value. +/// +/// @ingroup CPUTypes +typedef float FfxFloat32; + +/// A typedef for a 2-dimensional floating point value. +/// +/// @ingroup CPUTypes +typedef float FfxFloat32x2[2]; + +/// A typedef for a 3-dimensional floating point value. +/// +/// @ingroup CPUTypes +typedef float FfxFloat32x3[3]; + +/// A typedef for a 4-dimensional floating point value. +/// +/// @ingroup CPUTypes +typedef float FfxFloat32x4[4]; + +/// A typedef for a 4x4 floating point matrix. +/// +/// @ingroup CPUTypes +typedef float FfxFloat32x4x4[16]; + +/// A typedef for a 2-dimensional 32bit unsigned integer. +/// +/// @ingroup CPUTypes +typedef uint32_t FfxUInt32x2[2]; + +/// A typedef for a 3-dimensional 32bit unsigned integer. +/// +/// @ingroup CPUTypes +typedef uint32_t FfxUInt32x3[3]; + +/// A typedef for a 4-dimensional 32bit unsigned integer. +/// +/// @ingroup CPUTypes +typedef uint32_t FfxUInt32x4[4]; + +/// A typedef for a 2-dimensional 32bit signed integer. +/// +/// @ingroup CPUTypes +typedef int32_t FfxInt32x2[2]; + +/// A typedef for a 3-dimensional 32bit signed integer. +/// +/// @ingroup CPUTypes +typedef int32_t FfxInt32x3[3]; + +/// A typedef for a 4-dimensional 32bit signed integer. +/// +/// @ingroup CPUTypes +typedef int32_t FfxInt32x4[4]; + +/// @defgroup SDKTypes SDK Types +/// Structure and enumeration definitions used by the FidelityFX SDK +/// +/// @ingroup ffxHost + + +/// An enumeration of surface formats. Needs to match enum FfxApiSurfaceFormat +/// +/// @ingroup SDKTypes +typedef enum FfxSurfaceFormat { + + FFX_SURFACE_FORMAT_UNKNOWN, ///< Unknown format + FFX_SURFACE_FORMAT_R32G32B32A32_TYPELESS, ///< 32 bit per channel, 4 channel typeless format + FFX_SURFACE_FORMAT_R32G32B32A32_UINT, ///< 32 bit per channel, 4 channel uint format + FFX_SURFACE_FORMAT_R32G32B32A32_FLOAT, ///< 32 bit per channel, 4 channel float format + FFX_SURFACE_FORMAT_R16G16B16A16_FLOAT, ///< 16 bit per channel, 4 channel float format + FFX_SURFACE_FORMAT_R32G32B32_FLOAT, ///< 32 bit per channel, 3 channel float format + FFX_SURFACE_FORMAT_R32G32_FLOAT, ///< 32 bit per channel, 2 channel float format + FFX_SURFACE_FORMAT_R8_UINT, ///< 8 bit per channel, 1 channel float format + FFX_SURFACE_FORMAT_R32_UINT, ///< 32 bit per channel, 1 channel float format + FFX_SURFACE_FORMAT_R8G8B8A8_TYPELESS, ///< 8 bit per channel, 4 channel typeless format + FFX_SURFACE_FORMAT_R8G8B8A8_UNORM, ///< 8 bit per channel, 4 channel unsigned normalized format + FFX_SURFACE_FORMAT_R8G8B8A8_SNORM, ///< 8 bit per channel, 4 channel signed normalized format + FFX_SURFACE_FORMAT_R8G8B8A8_SRGB, ///< 8 bit per channel, 4 channel srgb normalized + FFX_SURFACE_FORMAT_B8G8R8A8_TYPELESS, ///< 8 bit per channel, 4 channel typeless format + FFX_SURFACE_FORMAT_B8G8R8A8_UNORM, ///< 8 bit per channel, 4 channel unsigned normalized format + FFX_SURFACE_FORMAT_B8G8R8A8_SRGB, ///< 8 bit per channel, 4 channel srgb normalized + FFX_SURFACE_FORMAT_R11G11B10_FLOAT, ///< 32 bit 3 channel float format + FFX_SURFACE_FORMAT_R10G10B10A2_UNORM, ///< 10 bit per 3 channel, 2 bit for 1 channel normalized format + FFX_SURFACE_FORMAT_R16G16_FLOAT, ///< 16 bit per channel, 2 channel float format + FFX_SURFACE_FORMAT_R16G16_UINT, ///< 16 bit per channel, 2 channel unsigned int format + FFX_SURFACE_FORMAT_R16G16_SINT, ///< 16 bit per channel, 2 channel signed int format + FFX_SURFACE_FORMAT_R16_FLOAT, ///< 16 bit per channel, 1 channel float format + FFX_SURFACE_FORMAT_R16_UINT, ///< 16 bit per channel, 1 channel unsigned int format + FFX_SURFACE_FORMAT_R16_UNORM, ///< 16 bit per channel, 1 channel unsigned normalized format + FFX_SURFACE_FORMAT_R16_SNORM, ///< 16 bit per channel, 1 channel signed normalized format + FFX_SURFACE_FORMAT_R8_UNORM, ///< 8 bit per channel, 1 channel unsigned normalized format + FFX_SURFACE_FORMAT_R8G8_UNORM, ///< 8 bit per channel, 2 channel unsigned normalized format + FFX_SURFACE_FORMAT_R8G8_UINT, ///< 8 bit per channel, 2 channel unsigned integer format + FFX_SURFACE_FORMAT_R32_FLOAT, ///< 32 bit per channel, 1 channel float format + FFX_SURFACE_FORMAT_R9G9B9E5_SHAREDEXP, ///< 9 bit per channel, 5 bit exponent format + + FFX_SURFACE_FORMAT_R16G16B16A16_TYPELESS, ///< 16 bit per channel, 4 channel typeless format + FFX_SURFACE_FORMAT_R32G32_TYPELESS, ///< 32 bit per channel, 2 channel typeless format + FFX_SURFACE_FORMAT_R10G10B10A2_TYPELESS, ///< 10 bit per 3 channel, 2 bit for 1 channel typeless format + FFX_SURFACE_FORMAT_R16G16_TYPELESS, ///< 16 bit per channel, 2 channel typeless format + FFX_SURFACE_FORMAT_R16_TYPELESS, ///< 16 bit per channel, 1 channel typeless format + FFX_SURFACE_FORMAT_R8_TYPELESS, ///< 8 bit per channel, 1 channel typeless format + FFX_SURFACE_FORMAT_R8G8_TYPELESS, ///< 8 bit per channel, 2 channel typeless format + FFX_SURFACE_FORMAT_R32_TYPELESS, ///< 32 bit per channel, 1 channel typeless format +} FfxSurfaceFormat; + +typedef enum FfxIndexFormat +{ + FFX_INDEX_TYPE_UINT32, + FFX_INDEX_TYPE_UINT16 +} FfxIndexFormat; + +/// An enumeration of resource usage. +/// +/// @ingroup SDKTypes +typedef enum FfxResourceUsage { + + FFX_RESOURCE_USAGE_READ_ONLY = 0, ///< No usage flags indicate a resource is read only. + FFX_RESOURCE_USAGE_RENDERTARGET = (1<<0), ///< Indicates a resource will be used as render target. + FFX_RESOURCE_USAGE_UAV = (1<<1), ///< Indicates a resource will be used as UAV. + FFX_RESOURCE_USAGE_DEPTHTARGET = (1<<2), ///< Indicates a resource will be used as depth target. + FFX_RESOURCE_USAGE_INDIRECT = (1<<3), ///< Indicates a resource will be used as indirect argument buffer + FFX_RESOURCE_USAGE_ARRAYVIEW = (1<<4), ///< Indicates a resource that will generate array views. Works on 2D and cubemap textures + FFX_RESOURCE_USAGE_STENCILTARGET = (1<<5), ///< Indicates a resource will be used as stencil target. + FFX_RESOURCE_USAGE_DCC_RENDERTARGET = (1<<15), ///< Indicates a resource that should specify optimal render target memory access flags (for console use) +} FfxResourceUsage; + +/// An enumeration of resource states. +/// +/// @ingroup SDKTypes +typedef enum FfxResourceStates { + + FFX_RESOURCE_STATE_COMMON = (1 << 0), + FFX_RESOURCE_STATE_UNORDERED_ACCESS = (1 << 1), ///< Indicates a resource is in the state to be used as UAV. + FFX_RESOURCE_STATE_COMPUTE_READ = (1 << 2), ///< Indicates a resource is in the state to be read by compute shaders. + FFX_RESOURCE_STATE_PIXEL_READ = (1 << 3), ///< Indicates a resource is in the state to be read by pixel shaders. + FFX_RESOURCE_STATE_PIXEL_COMPUTE_READ = (FFX_RESOURCE_STATE_PIXEL_READ | FFX_RESOURCE_STATE_COMPUTE_READ), ///< Indicates a resource is in the state to be read by pixel or compute shaders. + FFX_RESOURCE_STATE_COPY_SRC = (1 << 4), ///< Indicates a resource is in the state to be used as source in a copy command. + FFX_RESOURCE_STATE_COPY_DEST = (1 << 5), ///< Indicates a resource is in the state to be used as destination in a copy command. + FFX_RESOURCE_STATE_GENERIC_READ = (FFX_RESOURCE_STATE_COPY_SRC | FFX_RESOURCE_STATE_COMPUTE_READ), ///< Indicates a resource is in generic (slow) read state. + FFX_RESOURCE_STATE_INDIRECT_ARGUMENT = (1 << 6), ///< Indicates a resource is in the state to be used as an indirect command argument + FFX_RESOURCE_STATE_PRESENT = (1 << 7), ///< Indicates a resource is in the state to be used to present to the swap chain + FFX_RESOURCE_STATE_RENDER_TARGET = (1 << 8), ///< Indicates a resource is in the state to be used as render target + FFX_RESOURCE_STATE_DEPTH_ATTACHEMENT = (1 << 9), ///< Indicates a resource is in the state to be used as depth attachment +} FfxResourceStates; + +/// An enumeration of surface dimensions. +/// +/// @ingroup SDKTypes +typedef enum FfxResourceDimension { + + FFX_RESOURCE_DIMENSION_TEXTURE_1D, ///< A resource with a single dimension. + FFX_RESOURCE_DIMENSION_TEXTURE_2D, ///< A resource with two dimensions. +} FfxResourceDimension; + +/// An enumeration of resource view dimensions. +/// +/// @ingroup SDKTypes +typedef enum FfxResourceViewDimension +{ + FFX_RESOURCE_VIEW_DIMENSION_BUFFER, ///< A resource view on a buffer. + FFX_RESOURCE_VIEW_DIMENSION_TEXTURE_1D, ///< A resource view on a single dimension. + FFX_RESOURCE_VIEW_DIMENSION_TEXTURE_1D_ARRAY, ///< A resource view on a single dimensional array. + FFX_RESOURCE_VIEW_DIMENSION_TEXTURE_2D, ///< A resource view on two dimensions. + FFX_RESOURCE_VIEW_DIMENSION_TEXTURE_2D_ARRAY, ///< A resource view on two dimensional array. + FFX_RESOURCE_VIEW_DIMENSION_TEXTURE_3D, ///< A resource view on three dimensions. +} FfxResourceViewDimension; + +/// An enumeration of surface dimensions. +/// +/// @ingroup SDKTypes +typedef enum FfxResourceFlags { + + FFX_RESOURCE_FLAGS_NONE = 0, ///< No flags. + FFX_RESOURCE_FLAGS_ALIASABLE = (1 << 0), ///< A bit indicating a resource does not need to persist across frames. + FFX_RESOURCE_FLAGS_UNDEFINED = (1 << 1), ///< Special case flag used internally when importing resources that require additional setup +} FfxResourceFlags; + +/// An enumeration of all resource view types. +/// +/// @ingroup SDKTypes +typedef enum FfxResourceViewType { + + FFX_RESOURCE_VIEW_UNORDERED_ACCESS, ///< The resource view is an unordered access view (UAV). + FFX_RESOURCE_VIEW_SHADER_READ, ///< The resource view is a shader resource view (SRV). +} FfxResourceViewType; + +/// The type of filtering to perform when reading a texture. +/// +/// @ingroup SDKTypes +typedef enum FfxFilterType { + + FFX_FILTER_TYPE_MINMAGMIP_POINT, ///< Point sampling. + FFX_FILTER_TYPE_MINMAGMIP_LINEAR, ///< Sampling with interpolation. + FFX_FILTER_TYPE_MINMAGLINEARMIP_POINT, ///< Use linear interpolation for minification and magnification; use point sampling for mip-level sampling. +} FfxFilterType; + +/// The address mode used when reading a texture. +/// +/// @ingroup SDKTypes +typedef enum FfxAddressMode { + + FFX_ADDRESS_MODE_WRAP, ///< Wrap when reading texture. + FFX_ADDRESS_MODE_MIRROR, ///< Mirror when reading texture. + FFX_ADDRESS_MODE_CLAMP, ///< Clamp when reading texture. + FFX_ADDRESS_MODE_BORDER, ///< Border color when reading texture. + FFX_ADDRESS_MODE_MIRROR_ONCE, ///< Mirror once when reading texture. +} FfxAddressMode; + +/// An enumeration of all supported shader models. +/// +/// @ingroup SDKTypes +typedef enum FfxShaderModel { + + FFX_SHADER_MODEL_5_1, ///< Shader model 5.1. + FFX_SHADER_MODEL_6_0, ///< Shader model 6.0. + FFX_SHADER_MODEL_6_1, ///< Shader model 6.1. + FFX_SHADER_MODEL_6_2, ///< Shader model 6.2. + FFX_SHADER_MODEL_6_3, ///< Shader model 6.3. + FFX_SHADER_MODEL_6_4, ///< Shader model 6.4. + FFX_SHADER_MODEL_6_5, ///< Shader model 6.5. + FFX_SHADER_MODEL_6_6, ///< Shader model 6.6. + FFX_SHADER_MODEL_6_7, ///< Shader model 6.7. +} FfxShaderModel; + +// An enumeration for different resource types +/// +/// @ingroup SDKTypes +typedef enum FfxResourceType { + + FFX_RESOURCE_TYPE_BUFFER, ///< The resource is a buffer. + FFX_RESOURCE_TYPE_TEXTURE1D, ///< The resource is a 1-dimensional texture. + FFX_RESOURCE_TYPE_TEXTURE2D, ///< The resource is a 2-dimensional texture. + FFX_RESOURCE_TYPE_TEXTURE_CUBE, ///< The resource is a cube map. + FFX_RESOURCE_TYPE_TEXTURE3D, ///< The resource is a 3-dimensional texture. +} FfxResourceType; + +/// An enumeration for different heap types +/// +/// @ingroup SDKTypes +typedef enum FfxHeapType { + + FFX_HEAP_TYPE_DEFAULT = 0, ///< Local memory. + FFX_HEAP_TYPE_UPLOAD, ///< Heap used for uploading resources. + FFX_HEAP_TYPE_READBACK ///< Heap used for reading back resources. +} FfxHeapType; + +/// An enumeration for different render job types +/// +/// @ingroup SDKTypes +typedef enum FfxGpuJobType { + + FFX_GPU_JOB_CLEAR_FLOAT = 0, ///< The GPU job is performing a floating-point clear. + FFX_GPU_JOB_COPY = 1, ///< The GPU job is performing a copy. + FFX_GPU_JOB_COMPUTE = 2, ///< The GPU job is performing a compute dispatch. + FFX_GPU_JOB_BARRIER = 3, ///< The GPU job is performing a barrier. + + FFX_GPU_JOB_DISCARD = 4, ///< The GPU job is performing a floating-point clear. + +} FfxGpuJobType; + +/// An enumeration for various descriptor types +/// +/// @ingroup SDKTypes +typedef enum FfxDescriptorType { + + //FFX_DESCRIPTOR_CBV = 0, // All CBVs currently mapped to root signature + //FFX_DESCRIPTOR_SAMPLER, // All samplers currently static + FFX_DESCRIPTOR_TEXTURE_SRV = 0, + FFX_DESCRIPTOR_BUFFER_SRV, + FFX_DESCRIPTOR_TEXTURE_UAV, + FFX_DESCRIPTOR_BUFFER_UAV, +} FfxDescriptiorType; + +/// An enumeration for view binding stages +/// +/// @ingroup SDKTypes +typedef enum FfxBindStage { + + FFX_BIND_PIXEL_SHADER_STAGE = 1 << 0, + FFX_BIND_VERTEX_SHADER_STAGE = 1 << 1, + FFX_BIND_COMPUTE_SHADER_STAGE = 1 << 2, + +} FfxBindStage; + +/// An enumeration for barrier types +/// +/// @ingroup SDKTypes +typedef enum FfxBarrierType +{ + FFX_BARRIER_TYPE_TRANSITION = 0, + FFX_BARRIER_TYPE_UAV, +} FfxBarrierType; + +typedef void (*ffxMessageCallback)(uint32_t type, const wchar_t* message); + +/// An enumeration for message types that can be passed +/// +/// @ingroup SDKTypes +typedef enum FfxMsgType { + FFX_MESSAGE_TYPE_ERROR = 0, + FFX_MESSAGE_TYPE_WARNING = 1, + FFX_MESSAGE_TYPE_COUNT +} FfxMsgType; + +/// An enumeration of all the effects which constitute the FidelityFX SDK. +/// +/// Dictates what effect shader blobs to fetch for pipeline creation +/// +/// @ingroup SDKTypes +typedef enum FfxEffect +{ + + FFX_EFFECT_FSR2 = 0, ///< FidelityFX Super Resolution v2 + FFX_EFFECT_FSR1, ///< FidelityFX Super Resolution + FFX_EFFECT_SPD, ///< FidelityFX Single Pass Downsampler + FFX_EFFECT_BLUR, ///< FidelityFX Blur + FFX_EFFECT_BREADCRUMBS, ///< FidelityFX Breadcrumbs + FFX_EFFECT_BRIXELIZER, ///< FidelityFX Brixelizer + FFX_EFFECT_BRIXELIZER_GI, ///< FidelityFX Brixelizer GI + FFX_EFFECT_CACAO, ///< FidelityFX Combined Adaptive Compute Ambient Occlusion + FFX_EFFECT_CAS, ///< FidelityFX Contrast Adaptive Sharpening + FFX_EFFECT_DENOISER, ///< FidelityFX Denoiser + FFX_EFFECT_LENS, ///< FidelityFX Lens + FFX_EFFECT_PARALLEL_SORT, ///< FidelityFX Parallel Sort + FFX_EFFECT_SSSR, ///< FidelityFX Stochastic Screen Space Reflections + FFX_EFFECT_VARIABLE_SHADING, ///< FidelityFX Variable Shading + FFX_EFFECT_LPM, ///< FidelityFX Luma Preserving Mapper + FFX_EFFECT_DOF, ///< FidelityFX Depth of Field + FFX_EFFECT_CLASSIFIER, ///< FidelityFX Classifier + FFX_EFFECT_FSR3UPSCALER, ///< FidelityFX Super Resolution v3 + FFX_EFFECT_FRAMEINTERPOLATION, ///< FidelityFX Frame Interpolation, part of FidelityFX Super Resolution v3 + FFX_EFFECT_OPTICALFLOW, ///< FidelityFX Optical Flow, part of FidelityFX Super Resolution v3 + + FFX_EFFECT_SHAREDRESOURCES = 127, ///< FidelityFX Shared resources effect ID + FFX_EFFECT_SHAREDAPIBACKEND = 128 ///< FidelityFX Shared backend context used with DLL API +} FfxEffect; + +typedef enum FfxBackbufferTransferFunction { + FFX_BACKBUFFER_TRANSFER_FUNCTION_SRGB, + FFX_BACKBUFFER_TRANSFER_FUNCTION_PQ, + FFX_BACKBUFFER_TRANSFER_FUNCTION_SCRGB +} FfxBackbufferTransferFunction; + +/// A typedef representing the graphics device. +/// +/// @ingroup SDKTypes +typedef void* FfxDevice; + +typedef void* FfxCommandQueue; + +typedef void* FfxSwapchain; + +/// A typedef representing a command list or command buffer. +/// +/// @ingroup SDKTypes +typedef void* FfxCommandList; + +/// A typedef for a root signature. +/// +/// @ingroup SDKTypes +typedef void* FfxRootSignature; + +/// A typedef for a command signature, used for indirect workloads +/// +/// @ingroup SDKTypes +typedef void* FfxCommandSignature; + +/// A typedef for a pipeline state object. +/// +/// @ingroup SDKTypes +typedef void* FfxPipeline; + +/// Allocate block of memory. +/// +/// The callback function for requesting memory of provided size. +/// size cannot be 0. +/// +/// @param [in] size Size in bytes of memory to allocate. +/// +/// @retval +/// NULL The operation failed. +/// @retval +/// Anything else The operation completed successfully. +/// +/// @ingroup SDKTypes +typedef void* (*FfxAllocFunc)( + size_t size); + +/// Reallocate block of memory. +/// +/// The callback function for reallocating provided block of memory to new location +/// with specified size. When provided with NULL as ptr +/// then it should behave as FfxBreadcrumbsAllocFunc. +/// If the operation failed then contents of ptr +/// cannot be changed. size cannot be 0. +/// +/// @param [in] ptr A pointer to previous block of memory. +/// @param [in] size Size in bytes of memory to allocate. +/// +/// @retval +/// NULL The operation failed. +/// @retval +/// Anything else The operation completed successfully. +/// +/// @ingroup SDKTypes +typedef void* (*FfxReallocFunc)( + void* ptr, + size_t size); + +/// Free block of memory. +/// +/// The callback function for freeing provided block of memory. +/// ptr cannot be NULL. +/// +/// @param [in] ptr A pointer to block of memory. +/// +/// @ingroup SDKTypes +typedef void (*FfxFreeFunc)( + void* ptr); + +/// A structure encapsulating a set of allocation callbacks. +/// +/// @ingroup SDKTypes +typedef struct FfxAllocationCallbacks { + + FfxAllocFunc fpAlloc; ///< Callback for allocating memory in the library. + FfxReallocFunc fpRealloc; ///< Callback for reallocating memory in the library. + FfxFreeFunc fpFree; ///< Callback for freeing allocated memory in the library. +} FfxAllocationCallbacks; + +/// A structure encapsulating the bindless descriptor configuration of an effect. +/// +/// @ingroup SDKTypes +typedef struct FfxEffectBindlessConfig { + uint32_t maxTextureSrvs; ///< Maximum number of texture SRVs needed in the bindless table. + uint32_t maxBufferSrvs; ///< Maximum number of buffer SRVs needed in the bindless table. + uint32_t maxTextureUavs; ///< Maximum number of texture UAVs needed in the bindless table. + uint32_t maxBufferUavs; ///< Maximum number of buffer UAVs needed in the bindless table. +} FfxEffectBindlessConfig; + +/// A structure encapsulating a collection of device capabilities. +/// +/// @ingroup SDKTypes +typedef struct FfxDeviceCapabilities { + + FfxShaderModel maximumSupportedShaderModel; ///< The maximum shader model supported by the device. + uint32_t waveLaneCountMin; ///< The minimum supported wavefront width. + uint32_t waveLaneCountMax; ///< The maximum supported wavefront width. + bool fp16Supported; ///< The device supports FP16 in hardware. + bool raytracingSupported; ///< The device supports ray tracing. + bool deviceCoherentMemorySupported; ///< The device supports AMD coherent memory. + bool dedicatedAllocationSupported; ///< The device supports dedicated allocations for resources. + bool bufferMarkerSupported; ///< The device supports AMD buffer markers. + bool extendedSynchronizationSupported; ///< The device supports extended synchronization mechanism. + bool shaderStorageBufferArrayNonUniformIndexing; ///< The device supports shader storage buffer array non uniform indexing. +} FfxDeviceCapabilities; + +/// A structure encapsulating a 2-dimensional point, using 32bit unsigned integers. +/// +/// @ingroup SDKTypes +typedef struct FfxDimensions2D { + + uint32_t width; ///< The width of a 2-dimensional range. + uint32_t height; ///< The height of a 2-dimensional range. +} FfxDimensions2D; + +/// A structure encapsulating a 2-dimensional point. +/// +/// @ingroup SDKTypes +typedef struct FfxIntCoords2D { + + int32_t x; ///< The x coordinate of a 2-dimensional point. + int32_t y; ///< The y coordinate of a 2-dimensional point. +} FfxIntCoords2D; + +/// A structure encapsulating a 2-dimensional rect. +/// +/// @ingroup SDKTypes +typedef struct FfxRect2D +{ + int32_t left; ///< Left most coordinate + int32_t top; ///< Top most coordinate + int32_t width; ///< Rect width + int32_t height; ///< Rect height +} FfxRect2D; + +/// A structure encapsulating a 2-dimensional set of floating point coordinates. +/// +/// @ingroup SDKTypes +typedef struct FfxFloatCoords2D { + + float x; ///< The x coordinate of a 2-dimensional point. + float y; ///< The y coordinate of a 2-dimensional point. +} FfxFloatCoords2D; + +/// A structure describing a resource. +/// +/// @ingroup SDKTypes +typedef struct FfxResourceDescription { + + FfxResourceType type; ///< The type of the resource. + FfxSurfaceFormat format; ///< The surface format. + union { + uint32_t width; ///< The width of the texture resource. + uint32_t size; ///< The size of the buffer resource. + }; + + union { + uint32_t height; ///< The height of the texture resource. + uint32_t stride; ///< The stride of the buffer resource. + }; + + union { + uint32_t depth; ///< The depth of the texture resource. + uint32_t alignment; ///< The alignment of the buffer resource. + }; + + uint32_t mipCount; ///< Number of mips (or 0 for full mipchain). + FfxResourceFlags flags; ///< A set of FfxResourceFlags flags. + FfxResourceUsage usage; ///< Resource usage flags. +} FfxResourceDescription; + +/// An outward facing structure containing a resource +/// +/// @ingroup SDKTypes +typedef struct FfxResource { + void* resource; ///< pointer to the resource. + FfxResourceDescription description; + FfxResourceStates state; + wchar_t name[FFX_RESOURCE_NAME_SIZE]; ///< (optional) Resource name. +} FfxResource; + +/// A structure describing a static resource. +/// +/// @ingroup SDKTypes +typedef struct FfxStaticResourceDescription +{ + const FfxResource* resource; ///< The resource to register. + FfxDescriptorType descriptorType; ///< The type of descriptor to create. + uint32_t descriptorIndex; ///< The destination index of the descriptor within the static table. + + union + { + uint32_t bufferOffset; ///< The buffer offset in bytes. + uint32_t textureUavMip; ///< The mip of the texture resource to create a UAV for. + }; + + uint32_t bufferSize; ///< The buffer size in bytes. + uint32_t bufferStride; ///< The buffer stride in bytes. +} FfxStaticResourceDescription; + +/// A structure describing a constant buffer allocation. +/// +/// @ingroup SDKTypes +typedef struct FfxConstantAllocation +{ + FfxResource resource; ///< The resource representing the constant buffer resource. + FfxUInt64 handle; ///< The binding handle for the constant buffer + +} FfxRootConstantAllocation; + +/// A function definition for a constant buffer allocation callback +/// +/// Used to provide a constant buffer allocator to the calling backend +/// +/// @param [in] data The constant buffer data. +/// @param [in] dataSize The size of the constant buffer data. +/// +/// +/// @ingroup SDKTypes +typedef FfxConstantAllocation(*FfxConstantBufferAllocator)( + void* data, + const FfxUInt64 dataSize); + +/// Information about single AMD FidelityFX Breadcrumbs Library GPU memory block. +/// +/// @ingroup SDKTypes +typedef struct FfxBreadcrumbsBlockData { + void* memory; ///< Pointer to CPU mapped GPU buffer memory. + void* heap; ///< GPU memory block handle. + void* buffer; ///< GPU buffer handle for memory block. + uint64_t baseAddress; ///< GPU address of memory block. + uint32_t nextMarker; ///< Index of next marker to be saved in memory block. +} FfxBreadcrumbsBlockData; + +/// An internal structure containing a handle to a resource and resource views +/// +/// @ingroup SDKTypes +typedef struct FfxResourceInternal { + int32_t internalIndex; ///< The index of the resource. +} FfxResourceInternal; + +/// An enumeration for resource init data types that can be passed +/// +/// @ingroup SDKTypes +typedef enum FfxResourceInitDataType { + FFX_RESOURCE_INIT_DATA_TYPE_INVALID = 0, + FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED, + FFX_RESOURCE_INIT_DATA_TYPE_BUFFER, + FFX_RESOURCE_INIT_DATA_TYPE_VALUE, +} FfxResourceInitDataType; + +/// An structure housing all that is needed for resource initialization +/// +/// @ingroup SDKTypes +typedef struct FfxResourceInitData +{ + FfxResourceInitDataType type; ///< Indicates that the resource will be initialized from a buffer or a value, or stay uninitialized. + size_t size; ///< The size, in bytes, of the resource that needed be initialized. + union + { + void* buffer; ///< The buffer used to initialize the resource. + unsigned char value; ///< Indicates that the resource will be filled up with this value. + }; + + static FfxResourceInitData FfxResourceInitValue(size_t dataSize, uint8_t initVal) + { + FfxResourceInitData initData = { FFX_RESOURCE_INIT_DATA_TYPE_VALUE }; + initData.size = dataSize; + initData.value = initVal; + return initData; + } + + static FfxResourceInitData FfxResourceInitBuffer(size_t dataSize, void* pInitData) + { + FfxResourceInitData initData = { FFX_RESOURCE_INIT_DATA_TYPE_BUFFER }; + initData.size = dataSize; + initData.buffer = pInitData; + return initData; + } + +} FfxResourceInitData; + +/// An internal structure housing all that is needed for backend resource descriptions +/// +/// @ingroup SDKTypes +typedef struct FfxInternalResourceDescription { + + uint32_t id; ///< Resource identifier + const wchar_t* name; ///< Name to set to the resource for easier debugging + FfxResourceType type; ///< The type of resource (see FfxResourceType) + FfxResourceUsage usage; ///< Resource usage flags (see FfxResourceUsage) + FfxSurfaceFormat format; ///< The resource format to use + uint32_t width; ///< The width (textures) or size (buffers) of the resource + uint32_t height; ///< The height (textures) or stride (buffers) of the resource + uint32_t mipCount; ///< Mip count (textures) of the resource + FfxResourceFlags flags; ///< Resource flags (see FfxResourceFlags) + FfxResourceInitData initData; ///< Resource initialization definition (see FfxResourceInitData) +} FfxInternalResourceDescription; + +/// A structure defining the view to create +/// +/// @ingroup SDKTypes +typedef struct FfxViewDescription +{ + bool uavView; ///< Indicates that the view is a UAV. + FfxResourceViewDimension viewDimension; ///< The view dimension to map + union { + int32_t mipLevel; ///< The mip level of the view, (-1) for default + int32_t firstElement; ///< The first element of a buffer view, (-1) for default + }; + + union { + int32_t arraySize; ///< The array size of the view, (-1) for full depth/array size + int32_t elementCount; ///< The number of elements in a buffer view, (-1) for full depth/array size + }; + + int32_t firstSlice; ///< The first slice to map to, (-1) for default first slice + wchar_t name[FFX_RESOURCE_NAME_SIZE]; +} FfxViewDescription; + +static FfxViewDescription s_FfxViewDescInit = { false, FFX_RESOURCE_VIEW_DIMENSION_TEXTURE_2D, -1, -1, -1, L"" }; + +/// A structure defining a resource bind point +/// +/// @ingroup SDKTypes +typedef struct FfxResourceBinding +{ + uint32_t slotIndex; ///< The slot into which to bind the resource + uint32_t arrayIndex; ///< The resource offset for mip/array access + uint32_t resourceIdentifier; ///< A unique resource identifier representing an internal resource index + wchar_t name[FFX_RESOURCE_NAME_SIZE]; ///< A debug name to help track the resource binding +}FfxResourceBinding; + +/// A structure encapsulating a single pass of an algorithm. +/// +/// @ingroup SDKTypes +typedef struct FfxPipelineState { + + FfxRootSignature rootSignature; ///< The pipelines rootSignature + uint32_t passId; ///< The id of the effect pass this pipeline corresponds to + FfxCommandSignature cmdSignature; ///< The command signature used for indirect workloads + FfxPipeline pipeline; ///< The pipeline object + uint32_t uavTextureCount; ///< Count of Texture UAVs used in this pipeline + uint32_t srvTextureCount; ///< Count of Texture SRVs used in this pipeline + uint32_t srvBufferCount; ///< Count of Buffer SRV used in this pipeline + uint32_t uavBufferCount; ///< Count of Buffer UAVs used in this pipeline + uint32_t staticTextureSrvCount; ///< Count of static Texture SRVs used in this pipeline + uint32_t staticBufferSrvCount; ///< Count of static Buffer SRVs used in this pipeline + uint32_t staticTextureUavCount; ///< Count of static Texture UAVs used in this pipeline + uint32_t staticBufferUavCount; ///< Count of static Buffer UAVs used in this pipeline + uint32_t constCount; ///< Count of constant buffers used in this pipeline + + FfxResourceBinding uavTextureBindings[FFX_MAX_NUM_UAVS]; ///< Array of ResourceIdentifiers bound as texture UAVs + FfxResourceBinding srvTextureBindings[FFX_MAX_NUM_SRVS]; ///< Array of ResourceIdentifiers bound as texture SRVs + FfxResourceBinding srvBufferBindings[FFX_MAX_NUM_SRVS]; ///< Array of ResourceIdentifiers bound as buffer SRVs + FfxResourceBinding uavBufferBindings[FFX_MAX_NUM_UAVS]; ///< Array of ResourceIdentifiers bound as buffer UAVs + FfxResourceBinding constantBufferBindings[FFX_MAX_NUM_CONST_BUFFERS]; ///< Array of ResourceIdentifiers bound as CBs + + wchar_t name[FFX_RESOURCE_NAME_SIZE]; ///< Pipeline name for debugging/profiling purposes +} FfxPipelineState; + +/// A structure containing the data required to create a resource. +/// +/// @ingroup SDKTypes +typedef struct FfxCreateResourceDescription { + + FfxHeapType heapType; ///< The heap type to hold the resource, typically FFX_HEAP_TYPE_DEFAULT. + FfxResourceDescription resourceDescription; ///< A resource description. + FfxResourceStates initialState; ///< The initial resource state. + const wchar_t* name; ///< Name of the resource. + uint32_t id; ///< Internal resource ID. + FfxResourceInitData initData; ///< A struct used to initialize the resource. +} FfxCreateResourceDescription; + +/// A structure containing the data required to create sampler mappings +/// +/// @ingroup SDKTypes +typedef struct FfxSamplerDescription { + + FfxFilterType filter; + FfxAddressMode addressModeU; + FfxAddressMode addressModeV; + FfxAddressMode addressModeW; + FfxBindStage stage; +} FfxSamplerDescription; + +/// A structure containing the data required to create root constant buffer mappings +/// +/// @ingroup SDKTypes +typedef struct FfxRootConstantDescription +{ + uint32_t size; + FfxBindStage stage; +} FfxRootConstantDescription; + +/// A structure containing the description used to create a +/// FfxPipeline structure. +/// +/// A pipeline is the name given to a shader and the collection of state that +/// is required to dispatch it. In the context of the FidelityFX SDK and its architecture +/// this means that a FfxPipelineDescription will map to either a +/// monolithic object in an explicit API (such as a +/// PipelineStateObject in DirectX 12). Or a shader and some +/// ancillary API objects (in something like DirectX 11). +/// +/// The contextFlags field contains a copy of the flags passed +/// to ffxContextCreate via the flags field of +/// the FfxInitializationParams structure. These flags are +/// used to determine which permutation of a pipeline for a specific +/// FfxPass should be used to implement the features required +/// by each application, as well as to achieve the best performance on specific +/// target hardware configurations. +/// +/// When using one of the provided backends for FidelityFX SDK (such as DirectX 12 or +/// Vulkan) the data required to create a pipeline is compiled off line and +/// included into the backend library that you are using. For cases where the +/// backend interface is overridden by providing custom callback function +/// implementations care should be taken to respect the contents of the +/// contextFlags field in order to correctly support the options +/// provided by the FidelityFX SDK, and achieve best performance. +/// /// +/// @ingroup SDKTypes +typedef struct FfxPipelineDescription { + + uint32_t contextFlags; ///< A collection of FfxInitializationFlagBits which were passed to the context. + const FfxSamplerDescription* samplers; ///< A collection of samplers to use when building the root signature for the pipeline + size_t samplerCount; ///< Number of samplers to create for the pipeline + const FfxRootConstantDescription* rootConstants; ///< A collection of root constant descriptions to use when building the root signature for the pipeline + uint32_t rootConstantBufferCount; ///< Number of root constant buffers to create for the pipeline + wchar_t name[64]; ///< Pipeline name with which to name the pipeline object + FfxBindStage stage; ///< The stage(s) for which this pipeline is being built + uint32_t indirectWorkload; ///< Whether this pipeline has an indirect workload + FfxSurfaceFormat backbufferFormat; ///< For raster pipelines this contains the backbuffer format +} FfxPipelineDescription; + +/// A structure containing the data required to create a barrier +/// +/// @ingroup SDKTypes +typedef struct FfxBarrierDescription +{ + FfxResourceInternal resource; ///< The resource representation + FfxBarrierType barrierType; ///< The type of barrier to execute + FfxResourceStates currentState; ///< The initial state of the resource + FfxResourceStates newState; ///< The new state of the resource after barrier + uint32_t subResourceID; ///< The subresource id to apply barrier operation to +} FfxBarrierDescription; + + +/// A structure containing a constant buffer. +/// +/// @ingroup SDKTypes +typedef struct FfxConstantBuffer { + + uint32_t num32BitEntries; ///< The size (expressed in 32-bit chunks) stored in data. + uint32_t* data; ///< Pointer to constant buffer data +}FfxConstantBuffer; + +/// A structure containing a shader resource view. +typedef struct FfxTextureSRV +{ + FfxResourceInternal resource; ///< Resource corresponding to the shader resource view. +#ifdef FFX_DEBUG + wchar_t name[FFX_RESOURCE_NAME_SIZE]; +#endif +} FfxTextureSRV; + +/// A structure containing a shader resource view. +typedef struct FfxBufferSRV +{ + uint32_t offset; ///< Offset of resource to bind in bytes. + uint32_t size; ///< Size of resource to bind in bytes. + uint32_t stride; ///< Size of resource to bind in bytes. + FfxResourceInternal resource; ///< Resource corresponding to the shader resource view. +#ifdef FFX_DEBUG + wchar_t name[FFX_RESOURCE_NAME_SIZE]; +#endif +} FfxBufferSRV; + +/// A structure containing a unordered access view. +typedef struct FfxTextureUAV +{ + uint32_t mip; ///< Mip level of resource to bind. + FfxResourceInternal resource; ///< Resource corresponding to the unordered access view. +#ifdef FFX_DEBUG + wchar_t name[FFX_RESOURCE_NAME_SIZE]; +#endif +} FfxTextureUAV; + +/// A structure containing a unordered access view. +typedef struct FfxBufferUAV +{ + uint32_t offset; ///< Offset of resource to bind in bytes. + uint32_t size; ///< Size of resource to bind in bytes. + uint32_t stride; ///< Size of resource to bind in bytes. + FfxResourceInternal resource; ///< Resource corresponding to the unordered access view. +#ifdef FFX_DEBUG + wchar_t name[FFX_RESOURCE_NAME_SIZE]; +#endif +} FfxBufferUAV; + +/// A structure describing a clear render job. +/// +/// @ingroup SDKTypes +typedef struct FfxClearFloatJobDescription { + + float color[4]; ///< The clear color of the resource. + FfxResourceInternal target; ///< The resource to be cleared. +} FfxClearFloatJobDescription; + +/// A structure describing a compute render job. +/// +/// @ingroup SDKTypes +typedef struct FfxComputeJobDescription { + + FfxPipelineState pipeline; ///< Compute pipeline for the render job. + uint32_t dimensions[3]; ///< Dispatch dimensions. + FfxResourceInternal cmdArgument; ///< Dispatch indirect cmd argument buffer + uint32_t cmdArgumentOffset; ///< Dispatch indirect offset within the cmd argument buffer + FfxTextureSRV srvTextures[FFX_MAX_NUM_SRVS]; ///< SRV texture resources to be bound in the compute job. + FfxBufferSRV srvBuffers[FFX_MAX_NUM_SRVS]; ///< SRV buffer resources to be bound in the compute job. + FfxTextureUAV uavTextures[FFX_MAX_NUM_UAVS]; ///< UAV texture resources to be bound in the compute job. + FfxBufferUAV uavBuffers[FFX_MAX_NUM_UAVS]; ///< UAV buffer resources to be bound in the compute job. + + FfxConstantBuffer cbs[FFX_MAX_NUM_CONST_BUFFERS]; ///< Constant buffers to be bound in the compute job. +#ifdef FFX_DEBUG + wchar_t cbNames[FFX_MAX_NUM_CONST_BUFFERS][FFX_RESOURCE_NAME_SIZE]; +#endif +} FfxComputeJobDescription; + +typedef struct FfxRasterJobDescription +{ + FfxPipelineState pipeline; ///< Raster pipeline for the render job. + uint32_t numVertices; + FfxResourceInternal renderTarget; + FfxTextureSRV srvTextures[FFX_MAX_NUM_SRVS]; ///< SRV texture resources to be bound in the compute job. + FfxTextureUAV uavTextures[FFX_MAX_NUM_UAVS]; ///< UAV texture resources to be bound in the compute job. + + FfxConstantBuffer cbs[FFX_MAX_NUM_CONST_BUFFERS]; ///< Constant buffers to be bound in the compute job. +#ifdef FFX_DEBUG + wchar_t cbNames[FFX_MAX_NUM_CONST_BUFFERS][FFX_RESOURCE_NAME_SIZE]; +#endif +} FfxRasterJobDescription; + +/// A structure describing a copy render job. +/// +/// @ingroup SDKTypes +typedef struct FfxCopyJobDescription +{ + FfxResourceInternal src; ///< Source resource for the copy. + uint32_t srcOffset; ///< Offset into the source buffer in bytes. + FfxResourceInternal dst; ///< Destination resource for the copy. + uint32_t dstOffset; ///< Offset into the destination buffer in bytes. + uint32_t size; ///< Number of bytes to copy (Set to 0 to copy entire buffer). +} FfxCopyJobDescription; + +typedef struct FfxDiscardJobDescription { + + FfxResourceInternal target; ///< The resource to be discarded. +} FfxDiscardJobDescription; + +/// A structure describing a single render job. +/// +/// @ingroup SDKTypes +typedef struct FfxGpuJobDescription{ + + FfxGpuJobType jobType; ///< Type of the job. + wchar_t jobLabel[FFX_RESOURCE_NAME_SIZE]; ///< Job label for markers + + union { + FfxClearFloatJobDescription clearJobDescriptor; ///< Clear job descriptor. Valid when jobType is FFX_RENDER_JOB_CLEAR_FLOAT. + FfxCopyJobDescription copyJobDescriptor; ///< Copy job descriptor. Valid when jobType is FFX_RENDER_JOB_COPY. + FfxComputeJobDescription computeJobDescriptor; ///< Compute job descriptor. Valid when jobType is FFX_RENDER_JOB_COMPUTE. + FfxRasterJobDescription rasterJobDescriptor; + FfxBarrierDescription barrierDescriptor; + FfxDiscardJobDescription discardJobDescriptor; + }; +} FfxGpuJobDescription; + +#if defined(POPULATE_SHADER_BLOB_FFX) +#undef POPULATE_SHADER_BLOB_FFX +#endif // #if defined(POPULATE_SHADER_BLOB_FFX) + +/// Macro definition to copy header shader blob information into its SDK structural representation +/// +/// @ingroup SDKTypes +#define POPULATE_SHADER_BLOB_FFX(info, index) \ + { \ + info[index].blobData, \ + info[index].blobSize, \ + info[index].numConstantBuffers, \ + info[index].numSRVTextures, \ + info[index].numUAVTextures, \ + info[index].numSRVBuffers, \ + info[index].numUAVBuffers, \ + info[index].numSamplers, \ + info[index].numRTAccelerationStructures, \ + info[index].constantBufferNames, \ + info[index].constantBufferBindings, \ + info[index].constantBufferCounts, \ + info[index].constantBufferSpaces, \ + info[index].srvTextureNames, \ + info[index].srvTextureBindings, \ + info[index].srvTextureCounts, \ + info[index].srvTextureSpaces, \ + info[index].uavTextureNames, \ + info[index].uavTextureBindings, \ + info[index].uavTextureCounts, \ + info[index].uavTextureSpaces, \ + info[index].srvBufferNames, \ + info[index].srvBufferBindings, \ + info[index].srvBufferCounts, \ + info[index].srvBufferSpaces, \ + info[index].uavBufferNames, \ + info[index].uavBufferBindings, \ + info[index].uavBufferCounts, \ + info[index].uavBufferSpaces, \ + info[index].samplerNames, \ + info[index].samplerBindings, \ + info[index].samplerCounts, \ + info[index].samplerSpaces, \ + info[index].rtAccelerationStructureNames, \ + info[index].rtAccelerationStructureBindings, \ + info[index].rtAccelerationStructureCounts, \ + info[index].rtAccelerationStructureSpaces \ + } + +/// A single shader blob and a description of its resources. +/// +/// @ingroup SDKTypes +typedef struct FfxShaderBlob { + + const uint8_t* data; ///< A pointer to the blob + const uint32_t size; ///< Size in bytes. + + const uint32_t cbvCount; ///< Number of CBs. + const uint32_t srvTextureCount; ///< Number of SRV Textures. + const uint32_t uavTextureCount; ///< Number of UAV Textures. + const uint32_t srvBufferCount; ///< Number of SRV Buffers. + const uint32_t uavBufferCount; ///< Number of UAV Buffers. + const uint32_t samplerCount; ///< Number of Samplers. + const uint32_t rtAccelStructCount; ///< Number of RT Acceleration structures. + + // constant buffers + const char** boundConstantBufferNames; + const uint32_t* boundConstantBuffers; ///< Pointer to an array of bound ConstantBuffers. + const uint32_t* boundConstantBufferCounts; ///< Pointer to an array of bound ConstantBuffer resource counts + const uint32_t* boundConstantBufferSpaces; ///< Pointer to an array of bound ConstantBuffer resource spaces + + // srv textures + const char** boundSRVTextureNames; + const uint32_t* boundSRVTextures; ///< Pointer to an array of bound SRV resources. + const uint32_t* boundSRVTextureCounts; ///< Pointer to an array of bound SRV resource counts + const uint32_t* boundSRVTextureSpaces; ///< Pointer to an array of bound SRV resource spaces + + // uav textures + const char** boundUAVTextureNames; + const uint32_t* boundUAVTextures; ///< Pointer to an array of bound UAV texture resources. + const uint32_t* boundUAVTextureCounts; ///< Pointer to an array of bound UAV texture resource counts + const uint32_t* boundUAVTextureSpaces; ///< Pointer to an array of bound UAV texture resource spaces + + // srv buffers + const char** boundSRVBufferNames; + const uint32_t* boundSRVBuffers; ///< Pointer to an array of bound SRV buffer resources. + const uint32_t* boundSRVBufferCounts; ///< Pointer to an array of bound SRV buffer resource counts + const uint32_t* boundSRVBufferSpaces; ///< Pointer to an array of bound SRV buffer resource spaces + + // uav buffers + const char** boundUAVBufferNames; + const uint32_t* boundUAVBuffers; ///< Pointer to an array of bound UAV buffer resources. + const uint32_t* boundUAVBufferCounts; ///< Pointer to an array of bound UAV buffer resource counts + const uint32_t* boundUAVBufferSpaces; ///< Pointer to an array of bound UAV buffer resource spaces + + // samplers + const char** boundSamplerNames; + const uint32_t* boundSamplers; ///< Pointer to an array of bound sampler resources. + const uint32_t* boundSamplerCounts; ///< Pointer to an array of bound sampler resource counts + const uint32_t* boundSamplerSpaces; ///< Pointer to an array of bound sampler resource spaces + + // rt acceleration structures + const char** boundRTAccelerationStructureNames; + const uint32_t* boundRTAccelerationStructures; ///< Pointer to an array of bound UAV buffer resources. + const uint32_t* boundRTAccelerationStructureCounts; ///< Pointer to an array of bound UAV buffer resource counts + const uint32_t* boundRTAccelerationStructureSpaces; ///< Pointer to an array of bound UAV buffer resource spaces + +} FfxShaderBlob; + +/// A structure describing the parameters passed from the +/// presentation thread to the ui composition callback function. +/// +/// @ingroup SDKTypes +typedef struct FfxPresentCallbackDescription +{ + FfxDevice device; ///< The active device + FfxCommandList commandList; ///< The command list on which to register render commands + FfxResource currentBackBuffer; ///< The backbuffer resource with scene information + FfxResource currentUI; ///< Optional UI texture (when doing backbuffer + ui blend) + FfxResource outputSwapChainBuffer; ///< The swapchain target into which to render ui composition + bool isInterpolatedFrame; ///< Whether this is an interpolated or real frame + bool usePremulAlpha; ///< Toggles whether UI gets premultiplied alpha blending or not + uint64_t frameID; +} FfxPresentCallbackDescription; + +/// A structure describing the parameters to pass to frame generation passes. +/// +/// @ingroup SDKTypes +typedef struct FfxFrameGenerationDispatchDescription { + FfxCommandList commandList; ///< The command list on which to register render commands + FfxResource presentColor; ///< The current presentation color, this will be used as interpolation source data. + FfxResource outputs[4]; ///< Interpolation destination targets (1 for each frame in numInterpolatedFrames) + uint32_t numInterpolatedFrames; ///< The number of frames to interpolate from the passed in color target + bool reset; ///< A boolean value which when set to true, indicates the camera has moved discontinuously. + FfxBackbufferTransferFunction backBufferTransferFunction; ///< The transfer function use to convert interpolation source color data to linear RGB. + float minMaxLuminance[2]; ///< Min and max luminance values, used when converting HDR colors to linear RGB + FfxRect2D interpolationRect; ///< The area of the backbuffer that should be used for interpolation in case only a part of the screen is used e.g. due to movie bars + uint64_t frameID; +} FfxFrameGenerationDispatchDescription; + +//struct definition matches FfxApiEffectMemoryUsage +typedef struct FfxEffectMemoryUsage +{ + uint64_t totalUsageInBytes; + uint64_t aliasableUsageInBytes; +} FfxEffectMemoryUsage; + +//struct definition matches FfxApiSwapchainFramePacingTuning +typedef struct FfxSwapchainFramePacingTuning +{ + float safetyMarginInMs; // in Millisecond + float varianceFactor; // valid range [0.0,1.0] + bool allowHybridSpin; //Allows pacing spinlock to sleep. + uint32_t hybridSpinTime; //How long to spin when hybridSpin is enabled. Measured in timer resolution units. Not recommended to go below 2. Will result in frequent overshoots. + bool allowWaitForSingleObjectOnFence; //Allows to call WaitForSingleObject() instead of spinning for fence value. +} FfxSwapchainFramePacingTuning; + +#ifdef __cplusplus +} +#endif // #ifdef __cplusplus diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_util.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_util.h new file mode 100644 index 00000000..f06a368d --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_util.h @@ -0,0 +1,190 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#pragma once + +#include + +/// @defgroup Utils Utilities +/// Utility Macros used by the FidelityFX SDK +/// +/// @ingroup ffxHost + +/// The value of Pi. +/// +/// @ingroup Utils +const float FFX_PI = 3.141592653589793f; + +/// An epsilon value for floating point numbers. +/// +/// @ingroup Utils +const float FFX_EPSILON = 1e-06f; + +/// Helper macro to create the version number. +/// +/// @ingroup Utils +#define FFX_MAKE_VERSION(major, minor, patch) ((major << 22) | (minor << 12) | patch) + +///< Use this to specify no version. +/// +/// @ingroup Utils +#define FFX_UNSPECIFIED_VERSION 0xFFFFAD00 + +/// Helper macro to avoid warnings about unused variables. +/// +/// @ingroup Utils +#define FFX_UNUSED(x) ((void)(x)) + +/// Helper macro to align an integer to the specified power of 2 boundary +/// +/// @ingroup Utils +#define FFX_ALIGN_UP(x, y) (((x) + ((y)-1)) & ~((y)-1)) + +/// Helper macro to check if a value is aligned. +/// +/// @ingroup Utils +#define FFX_IS_ALIGNED(x) (((x) != 0) && ((x) & ((x)-1))) + +/// Helper macro to compute the rounded-up integer division of two unsigned integers +/// +/// @ingroup Utils +#define FFX_DIVIDE_ROUNDING_UP(x, y) ((x + y - 1) / y) + +/// Helper macro to stringify a value. +/// +/// @ingroup Utils +#define FFX_STR(s) FFX_XSTR(s) +#define FFX_XSTR(s) #s + +/// Helper macro to forward declare a structure. +/// +/// @ingroup Utils +#define FFX_FORWARD_DECLARE(x) typedef struct x x + +/// Helper macro to return the maximum of two values. +/// +/// @ingroup Utils +#define FFX_MAXIMUM(x, y) (((x) > (y)) ? (x) : (y)) + +/// Helper macro to return the minimum of two values. +/// +/// @ingroup Utils +#define FFX_MINIMUM(x, y) (((x) < (y)) ? (x) : (y)) + +/// Helper macro to do safe free on a pointer. +/// +/// @ingroup Utils +#define FFX_SAFE_FREE(x, freeFunc) \ + do { \ + if (x) \ + { \ + freeFunc(x); \ + x = nullptr; \ + } \ + } while (false) + +/// Helper macro to return the abs of an integer value. +/// +/// @ingroup Utils +#define FFX_ABSOLUTE(x) (((x) < 0) ? (-(x)) : (x)) + +/// Helper macro to return sign of a value. +/// +/// @ingroup Utils +#define FFX_SIGN(x) (((x) < 0) ? -1 : 1) + +/// Helper macro to work out the number of elements in an array. +/// +/// @ingroup Utils +#define FFX_ARRAY_ELEMENTS(x) (int32_t)((sizeof(x) / sizeof(0 [x])) / ((size_t)(!(sizeof(x) % sizeof(0 [x]))))) + +/// The maximum length of a path that can be specified to the FidelityFX API. +/// +/// @ingroup Utils +#define FFX_MAXIMUM_PATH (260) + +/// Helper macro to check if the specified key is set in a bitfield. +/// +/// @ingroup Utils +#define FFX_CONTAINS_FLAG(options, key) (((options) & key) == key) + +#if defined(FFX_MUTEX_IMPL_SHARED) +/// Lock mutex exclusively. +/// +/// @ingroup Utils +#define FFX_MUTEX_LOCK(x) x.lock() +/// Lock mutex for shared access. +/// +/// @ingroup Utils +#define FFX_MUTEX_LOCK_SHARED(x) x.lock_shared() +/// Unlock exclusive mutex lock. +/// +/// @ingroup Utils +#define FFX_MUTEX_UNLOCK(x) x.unlock() +/// Unlock shared mutex lock. +/// +/// @ingroup Utils +#define FFX_MUTEX_UNLOCK_SHARED(x) x.unlock_shared() +#elif defined(FFX_MUTEX_IMPL_STANDARD) +/// Lock mutex exclusively. +/// +/// @ingroup Utils +#define FFX_MUTEX_LOCK(x) x.lock() +/// Lock mutex for shared access. +/// +/// @ingroup Utils +#define FFX_MUTEX_LOCK_SHARED(x) FFX_MUTEX_LOCK(x) +/// Unlock exclusive mutex lock. +/// +/// @ingroup Utils +#define FFX_MUTEX_UNLOCK(x) x.unlock() +/// Unlock shared mutex lock. +/// +/// @ingroup Utils +#define FFX_MUTEX_UNLOCK_SHARED(x) FFX_MUTEX_UNLOCK(x) +#elif !defined(FFX_MUTEX_LOCK) || !defined(FFX_MUTEX_LOCK_SHARED) || !defined(FFX_MUTEX_UNLOCK) || !defined(FFX_MUTEX_UNLOCK_SHARED) +#error When using custom mutex you have to provide all following operations too: FFX_MUTEX_LOCK, FFX_MUTEX_LOCK_SHARED, FFX_MUTEX_UNLOCK, FFX_MUTEX_UNLOCK_SHARED! +#endif // #if defined(FFX_MUTEX_IMPL_SHARED) + +/// Computes the number of bits set to 1 in a integer. +/// +/// @param [in] val Integer mask. +/// +/// @return Number of bits set to 1 in provided val. +/// +/// @ingroup Utils +inline uint8_t ffxCountBitsSet(uint32_t val) noexcept +{ +#if __cplusplus >= 202002L + return static_cast(std::popcount(val)); +#elif defined(_MSVC_LANG) + return static_cast(__popcnt(val)); +#elif defined(__GNUC__) || defined(__clang__) + return static_cast(__builtin_popcount(val)); +#else + uint32_t c = val - ((val >> 1) & 0x55555555); + c = ((c >> 2) & 0x33333333) + (c & 0x33333333); + c = ((c >> 4) + c) & 0x0F0F0F0F; + c = ((c >> 8) + c) & 0x00FF00FF; + return static_cast(((c >> 16) + c) & 0x0000FFFF); +#endif +} diff --git a/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_vrs.h b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_vrs.h new file mode 100644 index 00000000..3533976f --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/include/FidelityFX/host/ffx_vrs.h @@ -0,0 +1,224 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +// @defgroup VRS + +#pragma once + +// Include the interface for the backend of the FSR 2.0 API. +#include + +/// @defgroup FfxVrs FidelityFX VRS +/// FidelityFX Variable Rate Shading runtime library +/// +/// @ingroup SDKComponents + +/// FidelityFX VRS major version. +/// +/// @ingroup FfxVrs +#define FFX_VRS_VERSION_MAJOR (1) + +/// FidelityFX VRS minor version. +/// +/// @ingroup FfxVrs +#define FFX_VRS_VERSION_MINOR (2) + +/// FidelityFX VRS patch version. +/// +/// @ingroup FfxVrs +#define FFX_VRS_VERSION_PATCH (0) + +/// FidelityFX VRS context count +/// +/// Defines the number of internal effect contexts required by VRS +/// +/// @ingroup FfxVrs +#define FFX_VRS_CONTEXT_COUNT 1 + +/// The size of the context specified in 32bit values. +/// +/// @ingroup FfxVrs +#define FFX_VRS_CONTEXT_SIZE (16536) + +#if defined(__cplusplus) +extern "C" { +#endif // #if defined(__cplusplus) + +/// An enumeration of the pass which constitutes the ShadingRateImage +/// generation algorithm. +/// +/// VRS is implemented as a single pass algorithm. Each call to the +/// FfxScheduleGpuJobFunc callback function will +/// correspond to a single image generation job. For a +/// more comprehensive description of VRS's inner workings, please +/// refer to the VRS reference documentation. +/// +/// @ingroup FfxVrs +typedef enum FfxVrsPass +{ + FFX_VRS_PASS_IMAGEGEN = 0, ///< A pass which generates a ShadingRateImage. + FFX_VRS_PASS_COUNT ///< The number of passes performed by VRS. +} FfxVrsPass; + +/// An enumeration of bit flags used when creating a +/// FfxVrsContext. See FfxVrsContextDescription. +/// +/// @ingroup FfxVrs +typedef enum FfxVrsInitializationFlagBits +{ + FFX_VRS_ALLOW_ADDITIONAL_SHADING_RATES = (1 << 0), ///< A bit indicating if we should enable additional shading rates. +} FfxVrsInitializationFlagBits; + +/// A structure encapsulating the parameters required to initialize FidelityFX +/// Variable Shading +/// +/// @ingroup FfxVrs +typedef struct FfxVrsContextDescription +{ + uint32_t flags; ///< A collection of FfxVrsInitializationFlagBits + uint32_t shadingRateImageTileSize; ///< ShadingRateImage tile size. + FfxInterface backendInterface; ///< A set of pointers to the backend implementation for FidelityFX. +} FfxVrsContextDescription; + +/// A structure encapsulating the parameters for dispatching the various passes +/// of FidelityFX Variable Shading +/// +/// @ingroup FfxVrs +typedef struct FfxVrsDispatchDescription +{ + FfxCommandList commandList; ///< The FfxCommandList to record VRS rendering commands into. + FfxResource historyColor; ///< A FfxResource containing the color buffer for the previous frame (at presentation resolution). + FfxResource motionVectors; ///< A FfxResource containing the velocity buffer for the current frame (at presentation resolution). + FfxResource output; ///< A FfxResource containing the ShadingRateImage buffer for the current frame. + FfxDimensions2D renderSize; ///< The resolution that was used for rendering the input resource. + float varianceCutoff; ///< This value specifies how much variance in luminance is acceptable to reduce shading rate. + float motionFactor; ///< The lower this value, the faster a pixel has to move to get the shading rate reduced. + uint32_t tileSize; ///< ShadingRateImage tile size. + FfxFloatCoords2D motionVectorScale; ///< Scale motion vectors to different format +} FfxVrsDispatchDescription; + +/// A structure encapsulating the FidelityFX Variable Shading context. +/// +/// This sets up an object which contains all persistent internal data and +/// resources that are required by VRS. +/// +/// The FfxVrsContext object should have a lifetime matching +/// your use of VRS. Before destroying the VRS context care should be taken +/// to ensure the GPU is not accessing the resources created or used by VRS. +/// It is therefore recommended that the GPU is idle before destroying the +/// VRS context. +/// +/// @ingroup FfxVrs +typedef struct FfxVrsContext +{ + uint32_t data[FFX_VRS_CONTEXT_SIZE]; ///< An opaque set of uint32_t which contain the data for the context. +} FfxVrsContext; + +/// Create a FidelityFX Variable Shading context from the parameters +/// programmed to the FfxVrsContextDescription structure. +/// +/// The context structure is the main object used to interact with the Variable +/// Shading API, and is responsible for the management of the internal resources +/// used by the VRS algorithm. When this API is called, multiple calls +/// will be made via the pointers contained in the backendInterface +/// structure. This backend will attempt to retrieve the device capabilities, +/// and create the internal resources, and pipelines required by VRS to function. +/// Depending on the precise configuration used when +/// creating the FfxVrsContext a different set of resources and +/// pipelines might be requested via the callback functions. +/// +/// The FfxVrsContext should be destroyed when use of it is +/// completed, typically when an application is unloaded or Variable +/// Shading is disabled by a user. To destroy the VRS context you +/// should call ffxVrsContextDestroy. +/// +/// @param [out] pContext A pointer to a FfxVrsContext structure to populate. +/// @param [in] pContextDescription A pointer to a FfxVrsContextDescription structure. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context or contextDescription was NULL. +/// @retval +/// FFX_ERROR_INCOMPLETE_INTERFACE The operation failed because the FfxVrsContextDescription.callbacks was not fully specified. +/// @retval +/// FFX_ERROR_BACKEND_API_ERROR The operation failed because of an error returned from the backend. +/// +/// @ingroup FfxVrs +FFX_API FfxErrorCode ffxVrsContextCreate(FfxVrsContext* pContext, const FfxVrsContextDescription* pContextDescription); + +/// Dispatches work to the FidelityFX VRS context +/// +/// @param [in] pContext A pointer to a FfxVrsContext structure to populate. +/// @param [in] pDispatchDescription A pointer to a FfxVrsDispatchDescription structure. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context or dispatchDescription was NULL. +/// @retval +/// FFX_ERROR_BACKEND_API_ERROR The operation failed because of an error returned from the backend. +/// +/// @ingroup FfxVrs +FFX_API FfxErrorCode ffxVrsContextDispatch(FfxVrsContext* pContext, const FfxVrsDispatchDescription* pDispatchDescription); + +/// Destroy the FidelityFX VRS context. +/// +/// @param [in] pContext A pointer to a FfxVrsContext structure to destroy. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_CODE_NULL_POINTER The operation failed because either context was NULL. +/// +/// @ingroup FfxVrs +FFX_API FfxErrorCode ffxVrsContextDestroy(FfxVrsContext* pContext); + +/// A helper function to calculate the ShadingRateImage size from a target +/// resolution. +/// +/// +/// @param [out] pImageWidth A pointer to a uint32_t which will hold the calculated image width. +/// @param [out] pImageHeight A pointer to a uint32_t which will hold the calculated image height. +/// @param [in] renderWidth The render resolution width. +/// @param [in] renderHeight The render resolution height. +/// @param [in] shadingRateImageTileSize The ShadingRateImage tile size. +/// +/// @retval +/// FFX_OK The operation completed successfully. +/// @retval +/// FFX_ERROR_INVALID_POINTER Either imageWidth or imageHeight was NULL. +/// +/// @ingroup FfxVrs +FFX_API FfxErrorCode ffxVrsGetImageSizeFromeRenderResolution(uint32_t* pImageWidth, uint32_t* pImageHeight, uint32_t renderWidth, uint32_t renderHeight, uint32_t shadingRateImageTileSize); + +/// Queries the effect version number. +/// +/// @returns +/// The SDK version the effect was built with. +/// +/// @ingroup FfxVrs +FFX_API FfxVersionNumber ffxVrsGetEffectVersion(); + +#if defined(__cplusplus) +} +#endif // #if defined(__cplusplus) diff --git a/runtime/third_party/FidelityFX/sdk/src/backends/shared/ffx_shader_blobs.h b/runtime/third_party/FidelityFX/sdk/src/backends/shared/ffx_shader_blobs.h new file mode 100644 index 00000000..aab037a6 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/src/backends/shared/ffx_shader_blobs.h @@ -0,0 +1,46 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#pragma once + +#include +#include + +#if defined(__cplusplus) +extern "C" { +#endif // #if defined(__cplusplus) + +struct FfxShaderBlob; + +// Get a shader blob for the specified effect, pass, and permutation index. +FfxErrorCode ffxGetPermutationBlobByIndex(FfxEffect effectId, + FfxPass passId, + FfxBindStage bindStage, + uint32_t permutationOptions, + FfxShaderBlob* outBlob); + +// Check is Wave64 is requested on this permutation +FfxErrorCode ffxIsWave64(FfxEffect effectId, uint32_t permutationOptions, bool& isWave64); + +#if defined(__cplusplus) +} +#endif // #if defined(__cplusplus) diff --git a/runtime/third_party/FidelityFX/sdk/src/backends/vk/ffx_vk.cpp b/runtime/third_party/FidelityFX/sdk/src/backends/vk/ffx_vk.cpp new file mode 100644 index 00000000..c3e5032f --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/src/backends/vk/ffx_vk.cpp @@ -0,0 +1,4692 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#include +#include +#include +#include +#include +#include + +#ifdef _WIN32 +#include +#else +#include // this is deprecated so it's just a fallback solution +#endif // _WIN32 + +#include + +// prototypes for functions in the interface +FfxVersionNumber GetSDKVersionVK(FfxInterface* backendInterface); +FfxErrorCode GetEffectGpuMemoryUsageVK(FfxInterface* backendInterface, FfxUInt32 effectContextId, FfxEffectMemoryUsage* outVramUsage); +FfxErrorCode CreateBackendContextVK(FfxInterface* backendInterface, FfxEffect effect, FfxEffectBindlessConfig* bindlessConfig, FfxUInt32* effectContextId); +FfxErrorCode GetDeviceCapabilitiesVK(FfxInterface* backendInterface, FfxDeviceCapabilities* deviceCapabilities); +FfxErrorCode DestroyBackendContextVK(FfxInterface* backendInterface, FfxUInt32 effectContextId); +FfxErrorCode CreateResourceVK(FfxInterface* backendInterface, const FfxCreateResourceDescription* desc, FfxUInt32 effectContextId, FfxResourceInternal* outTexture); +FfxErrorCode DestroyResourceVK(FfxInterface* backendInterface, FfxResourceInternal resource, FfxUInt32 effectContextId); +FfxErrorCode MapResourceVK(FfxInterface* backendInterface, FfxResourceInternal resource, void** ptr); +FfxErrorCode UnmapResourceVK(FfxInterface* backendInterface, FfxResourceInternal resource); +FfxErrorCode RegisterResourceVK(FfxInterface* backendInterface, const FfxResource* inResource, FfxUInt32 effectContextId, FfxResourceInternal* outResourceInternal); +FfxResource GetResourceVK(FfxInterface* backendInterface, FfxResourceInternal resource); +FfxErrorCode UnregisterResourcesVK(FfxInterface* backendInterface, FfxCommandList commandList, FfxUInt32 effectContextId); +FfxErrorCode RegisterStaticResourceVK(FfxInterface* backendInterface, const FfxStaticResourceDescription* desc, FfxUInt32 effectContextId); +FfxResourceDescription GetResourceDescriptionVK(FfxInterface* backendInterface, FfxResourceInternal resource); +FfxErrorCode StageConstantBufferDataVK(FfxInterface* backendInterface, void* data, FfxUInt32 size, FfxConstantBuffer* constantBuffer); +FfxErrorCode CreatePipelineVK(FfxInterface* backendInterface, FfxEffect effect, FfxPass passId, uint32_t permutationOptions, const FfxPipelineDescription* desc, FfxUInt32 effectContextId, FfxPipelineState* outPass); +FfxErrorCode DestroyPipelineVK(FfxInterface* backendInterface, FfxPipelineState* pipeline, FfxUInt32 effectContextId); +FfxErrorCode ScheduleGpuJobVK(FfxInterface* backendInterface, const FfxGpuJobDescription* job); +FfxErrorCode ExecuteGpuJobsVK(FfxInterface* backendInterface, FfxCommandList commandList, FfxUInt32 effectContextId); +FfxErrorCode BreadcrumbsAllocBlockVK(FfxInterface* backendInterface, uint64_t blockBytes, FfxBreadcrumbsBlockData* blockData); +void BreadcrumbsFreeBlockVK(FfxInterface* backendInterface, FfxBreadcrumbsBlockData* blockData); +void BreadcrumbsWriteVK(FfxInterface* backendInterface, FfxCommandList commandList, uint32_t value, uint64_t gpuLocation, void* gpuBuffer, bool isBegin); +void BreadcrumbsPrintDeviceInfoVK(FfxInterface* backendInterface, FfxAllocationCallbacks* allocs, bool extendedInfo, char** printBuffer, size_t* printSize); +void RegisterConstantBufferAllocatorVK(FfxInterface* backendInterface, FfxConstantBufferAllocator fpConstantAllocator); + + +static VkDeviceContext sVkDeviceContext = { VK_NULL_HANDLE, VK_NULL_HANDLE, VK_NULL_HANDLE }; + +#define MAX_PIPELINE_USAGE_PER_FRAME (10) // Required to make sure passes that are called more than once per-frame don't have their descriptors overwritten. +#define MAX_DESCRIPTOR_SET_LAYOUTS (64) +#define FFX_MAX_BINDLESS_DESCRIPTOR_COUNT (65536) + +// Constant buffer allocation callback +static FfxConstantBufferAllocator s_fpConstantAllocator = nullptr; + +// Offset the binding of samplers to avoid collisions +constexpr uint32_t SAMPLER_BINDING_SHIFT = 1000; + +typedef struct BackendContext_VK { + + // store for resources and resourceViews + typedef struct Resource + { +#ifdef _DEBUG + char resourceName[64] = {}; +#endif + union { + VkImage imageResource; + VkBuffer bufferResource; + }; + + FfxResourceDescription resourceDescription; + FfxResourceStates initialState; + FfxResourceStates currentState; + int32_t srvViewIndex; + int32_t uavViewIndex; + uint32_t uavViewCount; + + VkDeviceMemory deviceMemory; + VkDeviceSize allocationSize; + VkMemoryPropertyFlags memoryProperties; + + bool undefined; + bool dynamic; + + } Resource; + + typedef struct PipelineLayout { + + VkSampler samplers[FFX_MAX_SAMPLERS]; + VkDescriptorSetLayout descriptorSetLayout; + VkDescriptorSet descriptorSets[FFX_MAX_QUEUED_FRAMES * MAX_PIPELINE_USAGE_PER_FRAME]; + uint32_t descriptorSetIndex; + VkPipelineLayout pipelineLayout; + int32_t staticTextureSrvSet; + int32_t staticBufferSrvSet; + int32_t staticTextureUavSet; + int32_t staticBufferUavSet; + } PipelineLayout; + + typedef struct VKFunctionTable + { + PFN_vkGetDeviceProcAddr vkGetDeviceProcAddr = 0; + PFN_vkSetDebugUtilsObjectNameEXT vkSetDebugUtilsObjectNameEXT = 0; + PFN_vkCreateDescriptorPool vkCreateDescriptorPool = 0; + PFN_vkCreateSampler vkCreateSampler = 0; + PFN_vkCreateDescriptorSetLayout vkCreateDescriptorSetLayout = 0; + PFN_vkCreateBuffer vkCreateBuffer = 0; + PFN_vkCreateBufferView vkCreateBufferView = 0; + PFN_vkCreateImage vkCreateImage = 0; + PFN_vkCreateImageView vkCreateImageView = 0; + PFN_vkCreateShaderModule vkCreateShaderModule = 0; + PFN_vkCreatePipelineLayout vkCreatePipelineLayout = 0; + PFN_vkCreateComputePipelines vkCreateComputePipelines = 0; + PFN_vkDestroyPipelineLayout vkDestroyPipelineLayout = 0; + PFN_vkDestroyPipeline vkDestroyPipeline = 0; + PFN_vkDestroyImage vkDestroyImage = 0; + PFN_vkDestroyImageView vkDestroyImageView = 0; + PFN_vkDestroyBuffer vkDestroyBuffer = 0; + PFN_vkDestroyBufferView vkDestroyBufferView = 0; + PFN_vkDestroyDescriptorSetLayout vkDestroyDescriptorSetLayout = 0; + PFN_vkDestroyDescriptorPool vkDestroyDescriptorPool = 0; + PFN_vkDestroySampler vkDestroySampler = 0; + PFN_vkDestroyShaderModule vkDestroyShaderModule = 0; + PFN_vkGetBufferMemoryRequirements vkGetBufferMemoryRequirements = 0; + PFN_vkGetBufferMemoryRequirements2KHR vkGetBufferMemoryRequirements2KHR = 0; + PFN_vkGetImageMemoryRequirements vkGetImageMemoryRequirements = 0; + PFN_vkAllocateDescriptorSets vkAllocateDescriptorSets = 0; + PFN_vkFreeDescriptorSets vkFreeDescriptorSets = 0; + PFN_vkAllocateMemory vkAllocateMemory = 0; + PFN_vkFreeMemory vkFreeMemory = 0; + PFN_vkMapMemory vkMapMemory = 0; + PFN_vkUnmapMemory vkUnmapMemory = 0; + PFN_vkBindBufferMemory vkBindBufferMemory = 0; + PFN_vkBindImageMemory vkBindImageMemory = 0; + PFN_vkUpdateDescriptorSets vkUpdateDescriptorSets = 0; + PFN_vkFlushMappedMemoryRanges vkFlushMappedMemoryRanges = 0; + PFN_vkCmdPipelineBarrier vkCmdPipelineBarrier = 0; + PFN_vkCmdBindPipeline vkCmdBindPipeline = 0; + PFN_vkCmdBindDescriptorSets vkCmdBindDescriptorSets = 0; + PFN_vkCmdDispatch vkCmdDispatch = 0; + PFN_vkCmdDispatchIndirect vkCmdDispatchIndirect = 0; + PFN_vkCmdCopyBuffer vkCmdCopyBuffer = 0; + PFN_vkCmdCopyImage vkCmdCopyImage = 0; + PFN_vkCmdCopyBufferToImage vkCmdCopyBufferToImage = 0; + PFN_vkCmdClearColorImage vkCmdClearColorImage = 0; + PFN_vkCmdFillBuffer vkCmdFillBuffer = 0; + PFN_vkCmdWriteBufferMarkerAMD vkCmdWriteBufferMarkerAMD = 0; + PFN_vkCmdWriteBufferMarker2AMD vkCmdWriteBufferMarker2AMD = 0; + PFN_vkCmdBeginDebugUtilsLabelEXT vkCmdBeginDebugUtilsLabelEXT = 0; + PFN_vkCmdEndDebugUtilsLabelEXT vkCmdEndDebugUtilsLabelEXT = 0; + + } VkFunctionTable; + + uint32_t refCount; + uint32_t maxEffectContexts; + + VkDevice device = VK_NULL_HANDLE; + VkPhysicalDevice physicalDevice = VK_NULL_HANDLE; + VkFunctionTable vkFunctionTable = {}; + + FfxGpuJobDescription* pGpuJobs; + uint32_t gpuJobCount = 0; + + typedef struct VkResourceView { + VkImageView imageView; + } VkResourceView; + VkResourceView* pResourceViews; + + uint8_t* pStagingRingBuffer; + uint32_t stagingRingBufferBase = 0; + + PipelineLayout* pPipelineLayouts; + + VkDescriptorPool descriptorPool; + uint32_t bindlessBase; + + VkImageMemoryBarrier imageMemoryBarriers[FFX_MAX_BARRIERS] = {}; + VkBufferMemoryBarrier bufferMemoryBarriers[FFX_MAX_BARRIERS] = {}; + uint32_t scheduledImageBarrierCount = 0; + uint32_t scheduledBufferBarrierCount = 0; + VkPipelineStageFlags srcStageMask = 0; + VkPipelineStageFlags dstStageMask = 0; + + typedef struct alignas(32) EffectContext { + + // Effect identifier -- used for various resource callbacks to application + FfxEffect effectId; + + // Resource allocation + uint32_t nextStaticResource; + uint32_t nextDynamicResource; + + // UAV offsets + uint32_t nextStaticResourceView; + uint32_t nextDynamicResourceView[FFX_MAX_QUEUED_FRAMES]; + + // Bindless descriptors + uint32_t bindlessTextureSrvHeapStart; + uint32_t bindlessTextureSrvHeapSize; + uint32_t bindlessBufferSrvHeapSize; + uint32_t bindlessTextureUavHeapStart; + uint32_t bindlessTextureUavHeapSize; + uint32_t bindlessBufferUavHeapSize; + VkDescriptorPool bindlessDescriptorPool; + VkDescriptorSetLayout bindlessTextureSrvDescriptorSetLayout; + VkDescriptorSetLayout bindlessBufferSrvDescriptorSetLayout; + VkDescriptorSetLayout bindlessTextureUavDescriptorSetLayout; + VkDescriptorSetLayout bindlessBufferUavDescriptorSetLayout; + VkDescriptorSet bindlessTextureSrvDescriptorSet; + VkDescriptorSet bindlessBufferSrvDescriptorSet; + VkDescriptorSet bindlessTextureUavDescriptorSet; + VkDescriptorSet bindlessBufferUavDescriptorSet; + + // Pipeline layout + uint32_t nextPipelineLayout; + + // the frame index for the context + uint32_t frameIndex; + + // Usage + bool active; + + // VRAM usage + FfxEffectMemoryUsage vramUsage; + + } EffectContext; + + Resource* pResources; + EffectContext* pEffectContexts; + + // Allocation defaults + FfxConstantAllocation FallbackConstantAllocator(void* data, FfxUInt64 dataSize); + VkDeviceMemory uniformBufferMemory = VK_NULL_HANDLE; + VkMemoryPropertyFlags uniformBufferMemoryProperties; + VkDeviceSize uniformBufferAlignment = 0; + void* uniformBufferMem = nullptr; + VkBuffer uniformBuffer = VK_NULL_HANDLE; + VkDeviceSize uniformBufferSize = 0; + VkDeviceSize uniformBufferOffset = 0; + std::mutex uniformBufferMutex; + + uint32_t numDeviceExtensions = 0; + VkExtensionProperties* extensionProperties = nullptr; + + typedef enum BreadcrumbsFlags + { + BREADCRUMBS_DEDICATED_MEMORY_ENABLED = 0x01, + BREADCRUMBS_BUFFER_MARKER_ENABLED = 0x02, + BREADCRUMBS_SYNCHRONIZATION2_ENABLED = 0x04, + } BreadcrumbsFlags; + uint8_t breadcrumbsFlags = 0; + uint32_t breadcrumbsMemoryIndex = 0; + +} BackendContext_VK; + +FFX_API size_t ffxGetScratchMemorySizeVK(VkPhysicalDevice physicalDevice, size_t maxContexts) +{ + uint32_t numExtensions = 0; + + if (physicalDevice) + vkEnumerateDeviceExtensionProperties(physicalDevice, nullptr, &numExtensions, nullptr); + + uint32_t extensionPropArraySize = sizeof(VkExtensionProperties) * numExtensions; + uint32_t gpuJobDescArraySize = FFX_ALIGN_UP(maxContexts * FFX_MAX_GPU_JOBS * sizeof(FfxGpuJobDescription), 64); // Savage Wind: was sizeof(uint32_t) (clang aligns the members: movdqa) + uint32_t resourceViewArraySize = FFX_ALIGN_UP(((maxContexts * FFX_MAX_QUEUED_FRAMES * FFX_MAX_RESOURCE_COUNT * 2) + FFX_MAX_BINDLESS_DESCRIPTOR_COUNT) * sizeof(BackendContext_VK::VkResourceView), 64); // Savage Wind: was sizeof(uint32_t) (clang aligns the members: movdqa) + uint32_t stagingRingBufferArraySize = FFX_ALIGN_UP(maxContexts * FFX_CONSTANT_BUFFER_RING_BUFFER_SIZE, 64); // Savage Wind: was sizeof(uint32_t) (clang aligns the members: movdqa) + uint32_t pipelineArraySize = FFX_ALIGN_UP(maxContexts * FFX_MAX_PASS_COUNT * sizeof(BackendContext_VK::PipelineLayout), 64); // Savage Wind: was sizeof(uint32_t) (clang aligns the members: movdqa) + uint32_t resourceArraySize = FFX_ALIGN_UP(maxContexts * FFX_MAX_RESOURCE_COUNT * sizeof(BackendContext_VK::Resource), 64); // Savage Wind: was sizeof(uint32_t) (clang aligns the members: movdqa) + uint32_t contextArraySize = FFX_ALIGN_UP(maxContexts * sizeof(BackendContext_VK::EffectContext), 64); // Savage Wind: was sizeof(uint32_t) (clang aligns the members: movdqa) + + return FFX_ALIGN_UP(64 + sizeof(BackendContext_VK) + extensionPropArraySize /* Savage Wind: + 64 */ + gpuJobDescArraySize + resourceViewArraySize + stagingRingBufferArraySize + + pipelineArraySize + resourceArraySize + contextArraySize, + sizeof(uint64_t)); +} + +// Create a FfxDevice from a VkDevice +FfxDevice ffxGetDeviceVK(VkDeviceContext* vkDeviceContext) +{ + sVkDeviceContext = *vkDeviceContext; + return reinterpret_cast(&sVkDeviceContext); +} + +FfxErrorCode ffxGetInterfaceVK( + FfxInterface* backendInterface, + FfxDevice device, + void* scratchBuffer, + size_t scratchBufferSize, + size_t maxContexts) +{ + FFX_RETURN_ON_ERROR( + backendInterface, + FFX_ERROR_INVALID_POINTER); + FFX_RETURN_ON_ERROR( + scratchBuffer, + FFX_ERROR_INVALID_POINTER); + FFX_RETURN_ON_ERROR( + scratchBufferSize >= ffxGetScratchMemorySizeVK(((VkDeviceContext*)device)->vkPhysicalDevice, maxContexts), + FFX_ERROR_INSUFFICIENT_MEMORY); + + backendInterface->fpGetSDKVersion = GetSDKVersionVK; + backendInterface->fpGetEffectGpuMemoryUsage = GetEffectGpuMemoryUsageVK; + backendInterface->fpCreateBackendContext = CreateBackendContextVK; + backendInterface->fpGetDeviceCapabilities = GetDeviceCapabilitiesVK; + backendInterface->fpDestroyBackendContext = DestroyBackendContextVK; + backendInterface->fpCreateResource = CreateResourceVK; + backendInterface->fpDestroyResource = DestroyResourceVK; + backendInterface->fpMapResource = MapResourceVK; + backendInterface->fpUnmapResource = UnmapResourceVK; + backendInterface->fpRegisterResource = RegisterResourceVK; + backendInterface->fpGetResource = GetResourceVK; + backendInterface->fpUnregisterResources = UnregisterResourcesVK; + backendInterface->fpRegisterStaticResource = RegisterStaticResourceVK; + backendInterface->fpGetResourceDescription = GetResourceDescriptionVK; + backendInterface->fpStageConstantBufferDataFunc = StageConstantBufferDataVK; + backendInterface->fpCreatePipeline = CreatePipelineVK; + backendInterface->fpDestroyPipeline = DestroyPipelineVK; + backendInterface->fpGetPermutationBlobByIndex = ffxGetPermutationBlobByIndex; + backendInterface->fpScheduleGpuJob = ScheduleGpuJobVK; + backendInterface->fpExecuteGpuJobs = ExecuteGpuJobsVK; + backendInterface->fpBreadcrumbsAllocBlock = BreadcrumbsAllocBlockVK; + backendInterface->fpBreadcrumbsFreeBlock = BreadcrumbsFreeBlockVK; + backendInterface->fpBreadcrumbsWrite = BreadcrumbsWriteVK; + backendInterface->fpBreadcrumbsPrintDeviceInfo = BreadcrumbsPrintDeviceInfoVK; + backendInterface->fpRegisterConstantBufferAllocator = RegisterConstantBufferAllocatorVK; + backendInterface->fpSwapChainConfigureFrameGeneration = ffxSetFrameGenerationConfigToSwapchainVK; + + // Memory assignments + backendInterface->scratchBuffer = scratchBuffer; + backendInterface->scratchBufferSize = scratchBufferSize; + + BackendContext_VK* backendContext = (BackendContext_VK*)backendInterface->scratchBuffer; + + FFX_RETURN_ON_ERROR(!backendContext->refCount, FFX_ERROR_BACKEND_API_ERROR); + + // Clear everything out + memset(backendContext, 0, sizeof(*backendContext)); + + // Map the device + backendInterface->device = device; + + // Assign the max number of contexts we'll be using + backendContext->maxEffectContexts = (uint32_t)maxContexts; + + return FFX_OK; +} + +FfxCommandList ffxGetCommandListVK(VkCommandBuffer cmdBuf) +{ + FFX_ASSERT(NULL != cmdBuf); + return reinterpret_cast(cmdBuf); +} + +FfxPipeline ffxGetPipelineVK(VkPipeline pipeline) +{ + FFX_ASSERT(NULL != pipeline); + return reinterpret_cast(pipeline); +} + +FfxResource ffxGetResourceVK(void* vkResource, + FfxResourceDescription ffxResDescription, + const wchar_t* ffxResName, + FfxResourceStates state /*=FFX_RESOURCE_STATE_COMPUTE_READ*/) +{ + FfxResource resource = {}; + resource.resource = vkResource; + resource.state = state; + resource.description = ffxResDescription; + +#ifdef _DEBUG + if (ffxResName) { + wcscpy_s(resource.name, ffxResName); + } +#endif + + return resource; +} + +uint32_t findMemoryTypeIndex(VkPhysicalDevice physicalDevice, VkMemoryRequirements memRequirements, VkMemoryPropertyFlags requestedProperties, VkMemoryPropertyFlags& outProperties) +{ + FFX_ASSERT(NULL != physicalDevice); + + VkPhysicalDeviceMemoryProperties memProperties; + vkGetPhysicalDeviceMemoryProperties(physicalDevice, &memProperties); + + uint32_t bestCandidate = UINT32_MAX; + + for (uint32_t i = 0; i < memProperties.memoryTypeCount; i++) { + if ((memRequirements.memoryTypeBits & (1 << i)) && (memProperties.memoryTypes[i].propertyFlags & requestedProperties)) { + + // if just device-local memory is requested, make sure this is the invisible heap to prevent over-subscribing the local heap + if (requestedProperties == VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT && (memProperties.memoryTypes[i].propertyFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT)) + continue; + + bestCandidate = i; + outProperties = memProperties.memoryTypes[i].propertyFlags; + + // if host-visible memory is requested, check for host coherency as well and if available, return immediately + if ((requestedProperties & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) && (memProperties.memoryTypes[i].propertyFlags & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT)) + return bestCandidate; + } + } + + return bestCandidate; +} + +VkBufferUsageFlags ffxGetVKBufferUsageFlagsFromResourceUsage(FfxResourceUsage flags) +{ + VkBufferUsageFlags indirectBit = 0; + + if (FFX_CONTAINS_FLAG(flags, FFX_RESOURCE_USAGE_INDIRECT)) + indirectBit = VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT; + + if (FFX_CONTAINS_FLAG(flags, FFX_RESOURCE_USAGE_UAV)) + return indirectBit | VK_BUFFER_USAGE_STORAGE_BUFFER_BIT; + else + return indirectBit | VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT; +} + +VkImageType ffxGetVKImageTypeFromResourceType(FfxResourceType type) +{ + switch (type) { + case(FFX_RESOURCE_TYPE_TEXTURE1D): + return VK_IMAGE_TYPE_1D; + case(FFX_RESOURCE_TYPE_TEXTURE2D): + return VK_IMAGE_TYPE_2D; + case(FFX_RESOURCE_TYPE_TEXTURE_CUBE): + case(FFX_RESOURCE_TYPE_TEXTURE3D): + return VK_IMAGE_TYPE_3D; + default: + return VK_IMAGE_TYPE_MAX_ENUM; + } +} + +bool ffxIsSurfaceFormatSRGB(FfxSurfaceFormat fmt) +{ + switch (fmt) + { + case (FFX_SURFACE_FORMAT_R8G8B8A8_SRGB): + case (FFX_SURFACE_FORMAT_B8G8R8A8_SRGB): + return true; + case (FFX_SURFACE_FORMAT_R32G32B32A32_TYPELESS): + case (FFX_SURFACE_FORMAT_R32G32B32A32_UINT): + case (FFX_SURFACE_FORMAT_R32G32B32A32_FLOAT): + case (FFX_SURFACE_FORMAT_R16G16B16A16_FLOAT): + case (FFX_SURFACE_FORMAT_R32G32B32_FLOAT): + case (FFX_SURFACE_FORMAT_R32G32_FLOAT): + case (FFX_SURFACE_FORMAT_R8_UINT): + case (FFX_SURFACE_FORMAT_R32_UINT): + case (FFX_SURFACE_FORMAT_R8G8B8A8_TYPELESS): + case (FFX_SURFACE_FORMAT_R8G8B8A8_UNORM): + case (FFX_SURFACE_FORMAT_R8G8B8A8_SNORM): + case (FFX_SURFACE_FORMAT_B8G8R8A8_TYPELESS): + case (FFX_SURFACE_FORMAT_B8G8R8A8_UNORM): + case (FFX_SURFACE_FORMAT_R11G11B10_FLOAT): + case (FFX_SURFACE_FORMAT_R10G10B10A2_UNORM): + case (FFX_SURFACE_FORMAT_R16G16_FLOAT): + case (FFX_SURFACE_FORMAT_R16G16_UINT): + case (FFX_SURFACE_FORMAT_R16G16_SINT): + case (FFX_SURFACE_FORMAT_R16_FLOAT): + case (FFX_SURFACE_FORMAT_R16_UINT): + case (FFX_SURFACE_FORMAT_R16_UNORM): + case (FFX_SURFACE_FORMAT_R16_SNORM): + case (FFX_SURFACE_FORMAT_R8_UNORM): + case (FFX_SURFACE_FORMAT_R8G8_UNORM): + case (FFX_SURFACE_FORMAT_R8G8_UINT): + case (FFX_SURFACE_FORMAT_R32_FLOAT): + case (FFX_SURFACE_FORMAT_R9G9B9E5_SHAREDEXP): + case (FFX_SURFACE_FORMAT_UNKNOWN): + return false; + default: + FFX_ASSERT_MESSAGE(false, "Format not yet supported"); + return false; + } +} + +FfxSurfaceFormat ffxGetSurfaceFormatFromGamma(FfxSurfaceFormat fmt) +{ + switch (fmt) + { + case (FFX_SURFACE_FORMAT_R8G8B8A8_SRGB): + return FFX_SURFACE_FORMAT_R8G8B8A8_UNORM; + case (FFX_SURFACE_FORMAT_B8G8R8A8_SRGB): + return FFX_SURFACE_FORMAT_B8G8R8A8_UNORM; + default: + return fmt; + } +} + +FfxSurfaceFormat ffxGetSurfaceFormatToGamma(FfxSurfaceFormat fmt) +{ + switch (fmt) + { + case (FFX_SURFACE_FORMAT_R8G8B8A8_UNORM): + return FFX_SURFACE_FORMAT_R8G8B8A8_SRGB; + case (FFX_SURFACE_FORMAT_B8G8R8A8_UNORM): + return FFX_SURFACE_FORMAT_B8G8R8A8_SRGB; + default: + return fmt; + } +} + +VkFormat ffxGetVkFormatFromSurfaceFormat(FfxSurfaceFormat fmt) +{ + switch (fmt) + { + case(FFX_SURFACE_FORMAT_UNKNOWN): + return VK_FORMAT_UNDEFINED; + case(FFX_SURFACE_FORMAT_R32G32B32A32_TYPELESS): + return VK_FORMAT_R32G32B32A32_SFLOAT; + case(FFX_SURFACE_FORMAT_R32G32B32A32_UINT): + return VK_FORMAT_R32G32B32A32_UINT; + case(FFX_SURFACE_FORMAT_R32G32B32A32_FLOAT): + return VK_FORMAT_R32G32B32A32_SFLOAT; + case(FFX_SURFACE_FORMAT_R16G16B16A16_FLOAT): + return VK_FORMAT_R16G16B16A16_SFLOAT; + case (FFX_SURFACE_FORMAT_R32G32B32_FLOAT): + return VK_FORMAT_R32G32B32_SFLOAT; + case(FFX_SURFACE_FORMAT_R32G32_FLOAT): + return VK_FORMAT_R32G32_SFLOAT; + case(FFX_SURFACE_FORMAT_R8_UINT): + return VK_FORMAT_R8_UINT; + case(FFX_SURFACE_FORMAT_R32_UINT): + return VK_FORMAT_R32_UINT; + case(FFX_SURFACE_FORMAT_R8G8B8A8_TYPELESS): + return VK_FORMAT_R8G8B8A8_UNORM; + case(FFX_SURFACE_FORMAT_R8G8B8A8_UNORM): + return VK_FORMAT_R8G8B8A8_UNORM; + case (FFX_SURFACE_FORMAT_R8G8B8A8_SNORM): + return VK_FORMAT_R8G8B8A8_SNORM; + case(FFX_SURFACE_FORMAT_R8G8B8A8_SRGB): + return VK_FORMAT_R8G8B8A8_SRGB; + case(FFX_SURFACE_FORMAT_B8G8R8A8_TYPELESS): + return VK_FORMAT_B8G8R8A8_UNORM; + case(FFX_SURFACE_FORMAT_B8G8R8A8_UNORM): + return VK_FORMAT_B8G8R8A8_UNORM; + case (FFX_SURFACE_FORMAT_B8G8R8A8_SRGB): + return VK_FORMAT_B8G8R8A8_SRGB; + case(FFX_SURFACE_FORMAT_R11G11B10_FLOAT): + return VK_FORMAT_B10G11R11_UFLOAT_PACK32; + case (FFX_SURFACE_FORMAT_R10G10B10A2_UNORM): + return VK_FORMAT_A2B10G10R10_UNORM_PACK32; + case(FFX_SURFACE_FORMAT_R16G16_FLOAT): + return VK_FORMAT_R16G16_SFLOAT; + case(FFX_SURFACE_FORMAT_R16G16_UINT): + return VK_FORMAT_R16G16_UINT; + case(FFX_SURFACE_FORMAT_R16G16_SINT): + return VK_FORMAT_R16G16_SINT; + case(FFX_SURFACE_FORMAT_R16_FLOAT): + return VK_FORMAT_R16_SFLOAT; + case(FFX_SURFACE_FORMAT_R16_UINT): + return VK_FORMAT_R16_UINT; + case(FFX_SURFACE_FORMAT_R16_UNORM): + return VK_FORMAT_R16_UNORM; + case(FFX_SURFACE_FORMAT_R16_SNORM): + return VK_FORMAT_R16_SNORM; + case(FFX_SURFACE_FORMAT_R8_UNORM): + return VK_FORMAT_R8_UNORM; + case(FFX_SURFACE_FORMAT_R8G8_UNORM): + return VK_FORMAT_R8G8_UNORM; + case(FFX_SURFACE_FORMAT_R8G8_UINT): + return VK_FORMAT_R8G8_UINT; + case(FFX_SURFACE_FORMAT_R32_FLOAT): + return VK_FORMAT_R32_SFLOAT; + case(FFX_SURFACE_FORMAT_R9G9B9E5_SHAREDEXP): + return VK_FORMAT_E5B9G9R9_UFLOAT_PACK32; + + default: + FFX_ASSERT_MESSAGE(false, "Format not yet supported"); + return VK_FORMAT_UNDEFINED; + } +} + +VkFormat ffxGetVKUAVFormatFromSurfaceFormat(FfxSurfaceFormat fmt) +{ + switch (fmt) + { + case(FFX_SURFACE_FORMAT_UNKNOWN): + return VK_FORMAT_UNDEFINED; + case(FFX_SURFACE_FORMAT_R32G32B32A32_TYPELESS): + return VK_FORMAT_R32G32B32A32_SFLOAT; + case(FFX_SURFACE_FORMAT_R32G32B32A32_UINT): + return VK_FORMAT_R32G32B32A32_UINT; + case(FFX_SURFACE_FORMAT_R32G32B32A32_FLOAT): + return VK_FORMAT_R32G32B32A32_SFLOAT; + case(FFX_SURFACE_FORMAT_R16G16B16A16_FLOAT): + return VK_FORMAT_R16G16B16A16_SFLOAT; + case(FFX_SURFACE_FORMAT_R32G32B32_FLOAT): + return VK_FORMAT_R32G32B32_SFLOAT; + case(FFX_SURFACE_FORMAT_R32G32_FLOAT): + return VK_FORMAT_R32G32_SFLOAT; + case(FFX_SURFACE_FORMAT_R8_UINT): + return VK_FORMAT_R8_UINT; + case(FFX_SURFACE_FORMAT_R32_UINT): + return VK_FORMAT_R32_UINT; + case(FFX_SURFACE_FORMAT_R8G8B8A8_TYPELESS): + case(FFX_SURFACE_FORMAT_R8G8B8A8_UNORM): + case(FFX_SURFACE_FORMAT_R8G8B8A8_SRGB): + return VK_FORMAT_R8G8B8A8_UNORM; + case(FFX_SURFACE_FORMAT_R8G8B8A8_SNORM): + return VK_FORMAT_R8G8B8A8_SNORM; + case(FFX_SURFACE_FORMAT_B8G8R8A8_TYPELESS): + case(FFX_SURFACE_FORMAT_B8G8R8A8_UNORM): + case (FFX_SURFACE_FORMAT_B8G8R8A8_SRGB): + return VK_FORMAT_B8G8R8A8_UNORM; + case(FFX_SURFACE_FORMAT_R11G11B10_FLOAT): + return VK_FORMAT_B10G11R11_UFLOAT_PACK32; + case (FFX_SURFACE_FORMAT_R10G10B10A2_UNORM): + return VK_FORMAT_A2B10G10R10_UNORM_PACK32; + case(FFX_SURFACE_FORMAT_R16G16_FLOAT): + return VK_FORMAT_R16G16_SFLOAT; + case(FFX_SURFACE_FORMAT_R16G16_UINT): + return VK_FORMAT_R16G16_UINT; + case(FFX_SURFACE_FORMAT_R16G16_SINT): + return VK_FORMAT_R16G16_SINT; + case(FFX_SURFACE_FORMAT_R16_FLOAT): + return VK_FORMAT_R16_SFLOAT; + case(FFX_SURFACE_FORMAT_R16_UINT): + return VK_FORMAT_R16_UINT; + case(FFX_SURFACE_FORMAT_R16_UNORM): + return VK_FORMAT_R16_UNORM; + case(FFX_SURFACE_FORMAT_R16_SNORM): + return VK_FORMAT_R16_SNORM; + case(FFX_SURFACE_FORMAT_R8_UNORM): + return VK_FORMAT_R8_UNORM; + case(FFX_SURFACE_FORMAT_R8G8_UNORM): + return VK_FORMAT_R8G8_UNORM; + case(FFX_SURFACE_FORMAT_R8G8_UINT): + return VK_FORMAT_R8G8_UINT; + case(FFX_SURFACE_FORMAT_R32_FLOAT): + return VK_FORMAT_R32_SFLOAT; + case(FFX_SURFACE_FORMAT_R9G9B9E5_SHAREDEXP): + return VK_FORMAT_E5B9G9R9_UFLOAT_PACK32; + + default: + FFX_ASSERT_MESSAGE(false, "Format not yet supported"); + return VK_FORMAT_UNDEFINED; + } +} + +FfxSurfaceFormat ffxGetSurfaceFormatVK(VkFormat fmt) +{ + switch (fmt) + { + case VK_FORMAT_R32G32B32A32_SFLOAT: + return FFX_SURFACE_FORMAT_R32G32B32A32_FLOAT; + case VK_FORMAT_R32G32B32A32_UINT: + return FFX_SURFACE_FORMAT_R32G32B32A32_UINT; + case VK_FORMAT_R16G16B16A16_SFLOAT: + return FFX_SURFACE_FORMAT_R16G16B16A16_FLOAT; + case VK_FORMAT_R32G32_SFLOAT: + return FFX_SURFACE_FORMAT_R32G32_FLOAT; + case VK_FORMAT_R32_UINT: + case VK_FORMAT_D24_UNORM_S8_UINT: + case VK_FORMAT_X8_D24_UNORM_PACK32: + return FFX_SURFACE_FORMAT_R32_UINT; + case VK_FORMAT_R8G8B8A8_UNORM: + return FFX_SURFACE_FORMAT_R8G8B8A8_UNORM; + case VK_FORMAT_R8G8B8A8_SNORM: + return FFX_SURFACE_FORMAT_R8G8B8A8_SNORM; + case VK_FORMAT_R8G8B8A8_SRGB: + return FFX_SURFACE_FORMAT_R8G8B8A8_SRGB; + case VK_FORMAT_B8G8R8A8_UNORM: + return FFX_SURFACE_FORMAT_B8G8R8A8_UNORM; + case VK_FORMAT_B8G8R8A8_SRGB: + return FFX_SURFACE_FORMAT_B8G8R8A8_SRGB; + case VK_FORMAT_B10G11R11_UFLOAT_PACK32: + return FFX_SURFACE_FORMAT_R11G11B10_FLOAT; + case VK_FORMAT_A2B10G10R10_UNORM_PACK32: + return FFX_SURFACE_FORMAT_R10G10B10A2_UNORM; + case VK_FORMAT_R16G16_SFLOAT: + return FFX_SURFACE_FORMAT_R16G16_FLOAT; + case VK_FORMAT_R16G16_UINT: + return FFX_SURFACE_FORMAT_R16G16_UINT; + case VK_FORMAT_R16G16_SINT: + return FFX_SURFACE_FORMAT_R16G16_SINT; + case VK_FORMAT_R16_SFLOAT: + return FFX_SURFACE_FORMAT_R16_FLOAT; + case VK_FORMAT_R16_UINT: + return FFX_SURFACE_FORMAT_R16_UINT; + case VK_FORMAT_R16_UNORM: + case VK_FORMAT_D16_UNORM: + case VK_FORMAT_D16_UNORM_S8_UINT: + return FFX_SURFACE_FORMAT_R16_UNORM; + case VK_FORMAT_R16_SNORM: + return FFX_SURFACE_FORMAT_R16_SNORM; + case VK_FORMAT_R8_UNORM: + return FFX_SURFACE_FORMAT_R8_UNORM; + case VK_FORMAT_R8_UINT: + case VK_FORMAT_S8_UINT: + return FFX_SURFACE_FORMAT_R8_UINT; + case VK_FORMAT_R8G8_UNORM: + return FFX_SURFACE_FORMAT_R8G8_UNORM; + case VK_FORMAT_R8G8_UINT: + return FFX_SURFACE_FORMAT_R8G8_UINT; + case VK_FORMAT_R32_SFLOAT: + case VK_FORMAT_D32_SFLOAT: + case VK_FORMAT_D32_SFLOAT_S8_UINT: + return FFX_SURFACE_FORMAT_R32_FLOAT; + case VK_FORMAT_E5B9G9R9_UFLOAT_PACK32: + return FFX_SURFACE_FORMAT_R9G9B9E5_SHAREDEXP; + case VK_FORMAT_UNDEFINED: + return FFX_SURFACE_FORMAT_UNKNOWN; + + default: + // NOTE: we do not support typeless formats here + FFX_ASSERT_MESSAGE(false, "Format not yet supported"); + return FFX_SURFACE_FORMAT_UNKNOWN; + } +} + +bool isDepthFormat(VkFormat format) +{ + switch (format) + { + case VK_FORMAT_D16_UNORM: + case VK_FORMAT_X8_D24_UNORM_PACK32: + case VK_FORMAT_D32_SFLOAT: + case VK_FORMAT_D16_UNORM_S8_UINT: + case VK_FORMAT_D24_UNORM_S8_UINT: + case VK_FORMAT_D32_SFLOAT_S8_UINT: + return true; + + default: + return false; + } +} + +bool isStencilFormat(VkFormat format) +{ + switch (format) + { + case VK_FORMAT_S8_UINT: + case VK_FORMAT_D16_UNORM_S8_UINT: + case VK_FORMAT_D24_UNORM_S8_UINT: + case VK_FORMAT_D32_SFLOAT_S8_UINT: + return true; + + default: + return false; + } +} + +VkImageAspectFlags getImageAspect(FfxResourceUsage usage) +{ + // No VK_IMAGE_ASPECT_STENCIL_BIT support for now + if (FFX_CONTAINS_FLAG(usage, FFX_RESOURCE_USAGE_DEPTHTARGET)) + return VK_IMAGE_ASPECT_DEPTH_BIT; + else + return VK_IMAGE_ASPECT_COLOR_BIT; +} + +VkFormat getVkFormatFromSurfaceFormatAndUsage(FfxSurfaceFormat fmt, FfxResourceUsage usage) +{ + VkFormat format = ffxGetVkFormatFromSurfaceFormat(fmt); + bool hasDepth = FFX_CONTAINS_FLAG(usage, FFX_RESOURCE_USAGE_DEPTHTARGET); + bool hasStencil = FFX_CONTAINS_FLAG(usage, FFX_RESOURCE_USAGE_STENCILTARGET); + if (hasDepth || hasStencil) + { + switch (fmt) + { + case FFX_SURFACE_FORMAT_R16_UNORM: + { + if (hasDepth && hasStencil) + return VK_FORMAT_D16_UNORM_S8_UINT; + else if (hasDepth) + return VK_FORMAT_D16_UNORM; + // stencil only doesn't exist + break; + } + case FFX_SURFACE_FORMAT_R32_FLOAT: + { + if (hasDepth && hasStencil) + return VK_FORMAT_D32_SFLOAT_S8_UINT; + else if (hasDepth) + return VK_FORMAT_D32_SFLOAT; + // stencil only doesn't exist + break; + } + case FFX_SURFACE_FORMAT_R32_UINT: + { + if (hasDepth && hasStencil) + return VK_FORMAT_D24_UNORM_S8_UINT; + else if (hasDepth) + return VK_FORMAT_X8_D24_UNORM_PACK32; + // stencil only doesn't exist + break; + } + case FFX_SURFACE_FORMAT_R8_UINT: + { + if (hasStencil) + return VK_FORMAT_S8_UINT; + break; + } + default: + break; + } + } + + return format; +} + + +VkImageUsageFlags getVKImageUsageFlagsFromResourceUsage(FfxResourceUsage flags) +{ + VkImageUsageFlags ret = VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT; + if (FFX_CONTAINS_FLAG(flags, FFX_RESOURCE_USAGE_RENDERTARGET)) ret |= VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT; + if (FFX_CONTAINS_FLAG(flags, FFX_RESOURCE_USAGE_UAV)) ret |= (VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT); + return ret; +} + +FfxResourceDescription ffxGetBufferResourceDescriptionVK(const VkBuffer buffer, const VkBufferCreateInfo createInfo, FfxResourceUsage additionalUsages /*=FFX_RESOURCE_USAGE_READ_ONLY*/) +{ + FfxResourceDescription resourceDescription = {}; + + // This is valid + if (buffer == VK_NULL_HANDLE) + return resourceDescription; + + resourceDescription.flags = FFX_RESOURCE_FLAGS_NONE; + resourceDescription.usage = additionalUsages; + resourceDescription.size = (uint32_t)createInfo.size; + resourceDescription.stride = 0; + resourceDescription.format = FFX_SURFACE_FORMAT_UNKNOWN; + + if (FFX_CONTAINS_FLAG(createInfo.usage, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT)) + resourceDescription.usage = (FfxResourceUsage)(resourceDescription.usage | FFX_RESOURCE_USAGE_UAV); + if (FFX_CONTAINS_FLAG(createInfo.usage, VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT)) + resourceDescription.usage = (FfxResourceUsage)(resourceDescription.usage | FFX_RESOURCE_USAGE_INDIRECT); + + // What should we initialize this to?? No case for this yet + resourceDescription.depth = 0; + resourceDescription.mipCount = 0; + + // Set the type + resourceDescription.type = FFX_RESOURCE_TYPE_BUFFER; + + return resourceDescription; +} + +FfxResourceDescription ffxGetImageResourceDescriptionVK(const VkImage image, + const VkImageCreateInfo createInfo, + FfxResourceUsage additionalUsages /*=FFX_RESOURCE_USAGE_READ_ONLY*/) +{ + FfxResourceDescription resourceDescription = {}; + + // This is valid + if (image == VK_NULL_HANDLE) + return resourceDescription; + + // Set flags properly for resource registration + resourceDescription.flags = FFX_RESOURCE_FLAGS_NONE; + resourceDescription.usage = FFX_RESOURCE_USAGE_READ_ONLY; + + // Check for depth and stencil use + if (isDepthFormat(createInfo.format)) + resourceDescription.usage = (FfxResourceUsage)(resourceDescription.usage | FFX_RESOURCE_USAGE_DEPTHTARGET); + if (isStencilFormat(createInfo.format)) + resourceDescription.usage = (FfxResourceUsage)(resourceDescription.usage | FFX_RESOURCE_USAGE_STENCILTARGET); + + // Unordered access use + if (FFX_CONTAINS_FLAG(createInfo.usage, VK_IMAGE_USAGE_STORAGE_BIT)) + resourceDescription.usage = (FfxResourceUsage)(resourceDescription.usage | FFX_RESOURCE_USAGE_UAV); + + // Resource-specific supplemental use flags + resourceDescription.usage = (FfxResourceUsage)(resourceDescription.usage | additionalUsages); + + resourceDescription.width = createInfo.extent.width; + resourceDescription.height = createInfo.extent.height; + resourceDescription.mipCount = createInfo.mipLevels; + resourceDescription.format = ffxGetSurfaceFormatVK(createInfo.format); + + // if the mutable flag is present, assume that the real format is sRGB + if (FFX_CONTAINS_FLAG(createInfo.flags, VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT)) + resourceDescription.format = ffxGetSurfaceFormatToGamma(resourceDescription.format); + + switch (createInfo.imageType) + { + case VK_IMAGE_TYPE_1D: + resourceDescription.type = FFX_RESOURCE_TYPE_TEXTURE1D; + break; + case VK_IMAGE_TYPE_2D: + resourceDescription.depth = createInfo.arrayLayers; + if (FFX_CONTAINS_FLAG(additionalUsages, FFX_RESOURCE_USAGE_ARRAYVIEW)) + resourceDescription.type = FFX_RESOURCE_TYPE_TEXTURE2D; + else if (FFX_CONTAINS_FLAG(createInfo.flags, VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT)) + resourceDescription.type = FFX_RESOURCE_TYPE_TEXTURE_CUBE; + else + resourceDescription.type = FFX_RESOURCE_TYPE_TEXTURE2D; + break; + case VK_IMAGE_TYPE_3D: + resourceDescription.depth = createInfo.extent.depth; + resourceDescription.type = FFX_RESOURCE_TYPE_TEXTURE3D; + break; + default: + FFX_ASSERT_MESSAGE(false, "FFXInterface: VK: Unsupported texture dimension requested. Please implement."); + break; + } + + return resourceDescription; +} + +FfxErrorCode allocateDeviceMemory(BackendContext_VK* backendContext, VkMemoryRequirements memRequirements, VkMemoryPropertyFlags requiredMemoryProperties, BackendContext_VK::Resource* backendResource) +{ + VkMemoryAllocateInfo allocInfo{}; + allocInfo.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO; + allocInfo.allocationSize = memRequirements.size; + allocInfo.memoryTypeIndex = findMemoryTypeIndex(backendContext->physicalDevice, memRequirements, requiredMemoryProperties, backendResource->memoryProperties); + + if (allocInfo.memoryTypeIndex == UINT32_MAX) { + return FFX_ERROR_BACKEND_API_ERROR; + } + + VkResult result = backendContext->vkFunctionTable.vkAllocateMemory(backendContext->device, &allocInfo, nullptr, &backendResource->deviceMemory); + + if (result != VK_SUCCESS) { + switch (result) { + case(VK_ERROR_OUT_OF_HOST_MEMORY): + case(VK_ERROR_OUT_OF_DEVICE_MEMORY): + return FFX_ERROR_OUT_OF_MEMORY; + default: + return FFX_ERROR_BACKEND_API_ERROR; + } + } + + return FFX_OK; +} + +void setVKObjectName(BackendContext_VK::VKFunctionTable& vkFunctionTable, VkDevice device, VkObjectType objectType, uint64_t object, char* name) +{ + VkDebugUtilsObjectNameInfoEXT s{ VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT, nullptr, objectType, object, name }; + + if (vkFunctionTable.vkSetDebugUtilsObjectNameEXT) + vkFunctionTable.vkSetDebugUtilsObjectNameEXT(device, &s); +} + +uint32_t getDynamicResourcesStartIndex(uint32_t effectContextId) +{ + // dynamic resources are tracked from the max index + return (effectContextId * FFX_MAX_RESOURCE_COUNT) + FFX_MAX_RESOURCE_COUNT - 1; +} +uint32_t getDynamicResourceViewsStartIndex(uint32_t effectContextId, uint32_t frameIndex) +{ + // dynamic resource views are tracked from the max index + return (effectContextId * FFX_MAX_QUEUED_FRAMES * FFX_MAX_RESOURCE_COUNT * 2) + (frameIndex * FFX_MAX_RESOURCE_COUNT * 2) + (FFX_MAX_RESOURCE_COUNT * 2) - 1; +} + +void destroyDynamicViews(BackendContext_VK* backendContext, uint32_t effectContextId, uint32_t frameIndex) +{ + BackendContext_VK::EffectContext& effectContext = backendContext->pEffectContexts[effectContextId]; + + // Release image views for dynamic resources + const uint32_t dynamicResourceViewIndexStart = getDynamicResourceViewsStartIndex(effectContextId, frameIndex); + for (uint32_t dynamicViewIndex = effectContext.nextDynamicResourceView[frameIndex] + 1; dynamicViewIndex <= dynamicResourceViewIndexStart; + ++dynamicViewIndex) + { + backendContext->vkFunctionTable.vkDestroyImageView(backendContext->device, backendContext->pResourceViews[dynamicViewIndex].imageView, VK_NULL_HANDLE); + backendContext->pResourceViews[dynamicViewIndex].imageView = VK_NULL_HANDLE; + } + effectContext.nextDynamicResourceView[frameIndex] = dynamicResourceViewIndexStart; +} + +VkAccessFlags getVKAccessFlagsFromResourceState(FfxResourceStates state) +{ + switch (state) { + + case(FFX_RESOURCE_STATE_COMMON): + return VK_ACCESS_NONE; + case(FFX_RESOURCE_STATE_GENERIC_READ): + return VK_ACCESS_SHADER_READ_BIT; + case(FFX_RESOURCE_STATE_UNORDERED_ACCESS): + return VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT; + case(FFX_RESOURCE_STATE_COMPUTE_READ): + case(FFX_RESOURCE_STATE_PIXEL_READ): + case(FFX_RESOURCE_STATE_PIXEL_COMPUTE_READ): + return VK_ACCESS_SHADER_READ_BIT; + case FFX_RESOURCE_STATE_COPY_SRC: + return VK_ACCESS_TRANSFER_READ_BIT; + case FFX_RESOURCE_STATE_COPY_DEST: + return VK_ACCESS_TRANSFER_WRITE_BIT; + case FFX_RESOURCE_STATE_INDIRECT_ARGUMENT: + return VK_ACCESS_INDIRECT_COMMAND_READ_BIT; + case FFX_RESOURCE_STATE_PRESENT: + return VK_ACCESS_NONE; + case FFX_RESOURCE_STATE_RENDER_TARGET: + return VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT | VK_ACCESS_COLOR_ATTACHMENT_READ_BIT; + case FFX_RESOURCE_STATE_DEPTH_ATTACHEMENT: + return VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT | VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT; + default: + FFX_ASSERT_MESSAGE(false, "State flag not yet supported"); + return VK_ACCESS_SHADER_READ_BIT; + } +} + +VkPipelineStageFlags getVKPipelineStageFlagsFromResourceState(FfxResourceStates state) +{ + switch (state) { + + case(FFX_RESOURCE_STATE_COMMON): + case(FFX_RESOURCE_STATE_GENERIC_READ): + case(FFX_RESOURCE_STATE_UNORDERED_ACCESS): + case(FFX_RESOURCE_STATE_COMPUTE_READ): + case(FFX_RESOURCE_STATE_PIXEL_READ): + case(FFX_RESOURCE_STATE_PIXEL_COMPUTE_READ): + return VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT; + case(FFX_RESOURCE_STATE_INDIRECT_ARGUMENT): + return VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT; + case FFX_RESOURCE_STATE_COPY_SRC: + case FFX_RESOURCE_STATE_COPY_DEST: + return VK_PIPELINE_STAGE_TRANSFER_BIT; + case FFX_RESOURCE_STATE_PRESENT: + return VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT; + case FFX_RESOURCE_STATE_RENDER_TARGET: + return VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT; + case FFX_RESOURCE_STATE_DEPTH_ATTACHEMENT: + return VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT | VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT; + default: + FFX_ASSERT_MESSAGE(false, "Pipeline stage flag not yet supported"); + return VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT; + } +} + +VkImageLayout getVKImageLayoutFromResourceState(FfxResourceStates state) +{ + switch (state) { + + case(FFX_RESOURCE_STATE_COMMON): + return VK_IMAGE_LAYOUT_GENERAL; + case(FFX_RESOURCE_STATE_GENERIC_READ): + return VK_IMAGE_LAYOUT_GENERAL; + case(FFX_RESOURCE_STATE_UNORDERED_ACCESS): + return VK_IMAGE_LAYOUT_GENERAL; + case(FFX_RESOURCE_STATE_COMPUTE_READ): + case(FFX_RESOURCE_STATE_PIXEL_COMPUTE_READ): + case(FFX_RESOURCE_STATE_PIXEL_READ): + return VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; + case FFX_RESOURCE_STATE_COPY_SRC: + return VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL; + case FFX_RESOURCE_STATE_COPY_DEST: + return VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL; + case FFX_RESOURCE_STATE_PRESENT: + return VK_IMAGE_LAYOUT_PRESENT_SRC_KHR; + case FFX_RESOURCE_STATE_RENDER_TARGET: + return VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL; + case FFX_RESOURCE_STATE_DEPTH_ATTACHEMENT: + return VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL; + case FFX_RESOURCE_STATE_INDIRECT_ARGUMENT: + // this case is for buffers + default: + FFX_ASSERT_MESSAGE(false, "Image layout flag not yet supported"); + return VK_IMAGE_LAYOUT_GENERAL; + } +} + +void addMutableViewForSRV(VkImageViewCreateInfo& imageViewCreateInfo, VkImageViewUsageCreateInfo& imageViewUsageCreateInfo, FfxResourceDescription resourceDescription) +{ + if (ffxIsSurfaceFormatSRGB(resourceDescription.format) && FFX_CONTAINS_FLAG(resourceDescription.usage, FFX_RESOURCE_USAGE_UAV)) + { + // mutable is only for sRGB textures that will need a storage + imageViewUsageCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO; + imageViewUsageCreateInfo.pNext = nullptr; + imageViewUsageCreateInfo.usage = getVKImageUsageFlagsFromResourceUsage(FFX_RESOURCE_USAGE_READ_ONLY); // we can assume that SRV is enough + imageViewCreateInfo.pNext = &imageViewUsageCreateInfo; + } +} + +void copyResourceState(BackendContext_VK::Resource* backendResource, const FfxResource* inFfxResource) +{ + FfxResourceStates state = inFfxResource->state; + + // copy the new states + backendResource->initialState = state; + backendResource->currentState = state; + backendResource->undefined = false; + backendResource->dynamic = true; + + // If the internal resource state is undefined, that means we are importing a resource that + // has not yet been initialized, so tag the resource as undefined so we can transition it accordingly. + if (backendResource->resourceDescription.flags & FFX_RESOURCE_FLAGS_UNDEFINED) + { + backendResource->undefined = true; + backendResource->resourceDescription.flags = (FfxResourceFlags)((int)backendResource->resourceDescription.flags & ~FFX_RESOURCE_FLAGS_UNDEFINED); + } +} + +#ifdef _WIN32 +void ConvertUTF8ToUTF16(const char* inputName, wchar_t* outputBuffer, size_t outputLen) +{ + if (MultiByteToWideChar(CP_UTF8, 0, inputName, -1, outputBuffer, static_cast(outputLen)) == 0) + { + memset(outputBuffer, 0, outputLen * sizeof(wchar_t)); + } +} +void ConvertUTF16ToUTF8(const wchar_t* inputName, char* outputBuffer, size_t outputLen) +{ + if (WideCharToMultiByte(CP_UTF8, 0, inputName, -1, outputBuffer, static_cast(outputLen * sizeof(char)), NULL, NULL) == 0) + { + memset(outputBuffer, 0, outputLen * sizeof(char)); + } +} +#else +void ConvertUTF8ToUTF16(const char* inputName, wchar_t* outputBuffer, size_t outputLen) +{ + memset(outputBuffer, 0, outputLen * sizeof(wchar_t)); + std::wstring_convert, wchar_t> converter; + wcscpy_s(outputBuffer, outputLen, converter.from_bytes(inputName).c_str()); +} +void ConvertUTF16ToUTF8(const wchar_t* inputName, char* outputBuffer, size_t outputLen) +{ + memset(outputBuffer, 0, outputLen * sizeof(char)); + std::wstring_convert, wchar_t> converter; + strcpy_s(outputBuffer, outputLen, converter.to_bytes(inputName).c_str()); +} +#endif // _WIN32 + +void beginMarkerVK(BackendContext_VK* backendContext, VkCommandBuffer commandBuffer, const wchar_t* label) +{ + if(backendContext->vkFunctionTable.vkCmdBeginDebugUtilsLabelEXT == nullptr) + { + return; + } + + constexpr size_t strLen = 64; + char strLabel[strLen]; + ConvertUTF16ToUTF8(label, strLabel, strLen); + + VkDebugUtilsLabelEXT debugLabel = {}; + debugLabel.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT; + debugLabel.pNext = nullptr; + debugLabel.pLabelName = strLabel; + + // not to saturated red + debugLabel.color[0] = 1.0f; + debugLabel.color[1] = 0.14f; + debugLabel.color[2] = 0.14f; + debugLabel.color[3] = 1.0f; + backendContext->vkFunctionTable.vkCmdBeginDebugUtilsLabelEXT(commandBuffer, &debugLabel); +} + +void endMarkerVK(BackendContext_VK* backendContext, VkCommandBuffer commandBuffer) +{ + if(backendContext->vkFunctionTable.vkCmdBeginDebugUtilsLabelEXT != nullptr) + { + backendContext->vkFunctionTable.vkCmdEndDebugUtilsLabelEXT(commandBuffer); + } +} + +void addBarrier(BackendContext_VK* backendContext, FfxResourceInternal* resource, FfxResourceStates newState) +{ + FFX_ASSERT(NULL != backendContext); + FFX_ASSERT(NULL != resource); + + BackendContext_VK::Resource& ffxResource = backendContext->pResources[resource->internalIndex]; + + if (ffxResource.resourceDescription.type == FFX_RESOURCE_TYPE_BUFFER) + { + VkBuffer vkResource = ffxResource.bufferResource; + VkBufferMemoryBarrier* barrier = &backendContext->bufferMemoryBarriers[backendContext->scheduledBufferBarrierCount]; + + FfxResourceStates& curState = backendContext->pResources[resource->internalIndex].currentState; + + barrier->sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER; + barrier->pNext = nullptr; + barrier->srcAccessMask = getVKAccessFlagsFromResourceState(curState); + barrier->dstAccessMask = getVKAccessFlagsFromResourceState(newState); + barrier->srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barrier->dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barrier->buffer = vkResource; + barrier->offset = 0; + barrier->size = VK_WHOLE_SIZE; + + backendContext->srcStageMask |= getVKPipelineStageFlagsFromResourceState(curState); + backendContext->dstStageMask |= getVKPipelineStageFlagsFromResourceState(newState); + + curState = newState; + + ++backendContext->scheduledBufferBarrierCount; + } + else + { + VkImage vkResource = ffxResource.imageResource; + VkImageMemoryBarrier* barrier = &backendContext->imageMemoryBarriers[backendContext->scheduledImageBarrierCount]; + + FfxResourceStates& curState = backendContext->pResources[resource->internalIndex].currentState; + + VkImageSubresourceRange range; + range.aspectMask = getImageAspect(ffxResource.resourceDescription.usage); + range.baseMipLevel = 0; + range.levelCount = VK_REMAINING_MIP_LEVELS; + range.baseArrayLayer = 0; + range.layerCount = VK_REMAINING_ARRAY_LAYERS; + + barrier->sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; + barrier->pNext = nullptr; + barrier->srcAccessMask = getVKAccessFlagsFromResourceState(curState); + barrier->dstAccessMask = getVKAccessFlagsFromResourceState(newState); + barrier->oldLayout = ffxResource.undefined ? VK_IMAGE_LAYOUT_UNDEFINED : getVKImageLayoutFromResourceState(curState); + barrier->newLayout = getVKImageLayoutFromResourceState(newState); + barrier->srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barrier->dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barrier->image = vkResource; + barrier->subresourceRange = range; + + backendContext->srcStageMask |= getVKPipelineStageFlagsFromResourceState(curState); + backendContext->dstStageMask |= getVKPipelineStageFlagsFromResourceState(newState); + + curState = newState; + + ++backendContext->scheduledImageBarrierCount; + } + + if (ffxResource.undefined) + ffxResource.undefined = false; +} + +void flushBarriers(BackendContext_VK* backendContext, VkCommandBuffer vkCommandBuffer) +{ + FFX_ASSERT(NULL != backendContext); + FFX_ASSERT(NULL != vkCommandBuffer); + + if (backendContext->scheduledImageBarrierCount > 0 || backendContext->scheduledBufferBarrierCount > 0) + { + backendContext->vkFunctionTable.vkCmdPipelineBarrier(vkCommandBuffer, backendContext->srcStageMask, backendContext->dstStageMask, VK_DEPENDENCY_BY_REGION_BIT, 0, nullptr, backendContext->scheduledBufferBarrierCount, backendContext->bufferMemoryBarriers, backendContext->scheduledImageBarrierCount, backendContext->imageMemoryBarriers); + backendContext->scheduledImageBarrierCount = 0; + backendContext->scheduledBufferBarrierCount = 0; + backendContext->srcStageMask = 0; + backendContext->dstStageMask = 0; + } +} + +FfxConstantAllocation BackendContext_VK::FallbackConstantAllocator(void* data, FfxUInt64 dataSize) +{ + FfxConstantAllocation allocation; + std::lock_guard cbLock{uniformBufferMutex}; + + if (!uniformBufferMem) + { + // allocate dynamic uniform buffer + + // get alignment + VkPhysicalDeviceProperties physicalDeviceProperties = {}; + vkGetPhysicalDeviceProperties(physicalDevice, &physicalDeviceProperties); + uniformBufferAlignment = physicalDeviceProperties.limits.minUniformBufferOffsetAlignment; + + uniformBufferSize = FFX_ALIGN_UP(FFX_BUFFER_SIZE, uniformBufferAlignment) * maxEffectContexts * FFX_MAX_PASS_COUNT * FFX_MAX_QUEUED_FRAMES; + + VkBufferCreateInfo bufferInfo = {}; + bufferInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO; + bufferInfo.size = static_cast(uniformBufferSize); + bufferInfo.usage = VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT; + bufferInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE; + + VkResult res = vkFunctionTable.vkCreateBuffer(device, &bufferInfo, NULL, &uniformBuffer); + FFX_ASSERT(res == VK_SUCCESS); + + VkMemoryAllocateInfo allocInfo = {}; + if (res == VK_SUCCESS) + { + // allocate memory block for all uniform buffers + VkMemoryRequirements memRequirements = {}; + vkFunctionTable.vkGetBufferMemoryRequirements(device, uniformBuffer, &memRequirements); + + // this is the real alignment + uniformBufferAlignment = memRequirements.alignment; + + VkMemoryPropertyFlags requiredMemoryProperties = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT; + + allocInfo.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO; + allocInfo.allocationSize = uniformBufferSize; + allocInfo.memoryTypeIndex = findMemoryTypeIndex(physicalDevice, memRequirements, requiredMemoryProperties, uniformBufferMemoryProperties); + + if (allocInfo.memoryTypeIndex == UINT32_MAX) + { + requiredMemoryProperties = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT; + allocInfo.memoryTypeIndex = findMemoryTypeIndex(physicalDevice, memRequirements, requiredMemoryProperties, uniformBufferMemoryProperties); + + if (allocInfo.memoryTypeIndex == UINT32_MAX) + res = VK_ERROR_INITIALIZATION_FAILED; + } + } + + if (res == VK_SUCCESS) + res = vkFunctionTable.vkAllocateMemory(device, &allocInfo, nullptr, &uniformBufferMemory); + FFX_ASSERT(res == VK_SUCCESS); + + if (res == VK_SUCCESS) + res = vkFunctionTable.vkBindBufferMemory(device, uniformBuffer, uniformBufferMemory, 0); + FFX_ASSERT(res == VK_SUCCESS); + + // map the memory block + if (res == VK_SUCCESS) + res = vkFunctionTable.vkMapMemory(device, uniformBufferMemory, 0, uniformBufferSize, 0, &uniformBufferMem); + FFX_ASSERT(res == VK_SUCCESS); + } + + FFX_ASSERT(uniformBufferMem); + + allocation.resource.resource = uniformBuffer; + allocation.handle = 0; + + if (data) + { + if (uniformBufferOffset + dataSize >= uniformBufferSize) + uniformBufferOffset = 0; + + allocation.handle = static_cast(uniformBufferOffset); + + void* pBuffer = (void*)((uint8_t*)(uniformBufferMem) + uniformBufferOffset); + memcpy(pBuffer, data, dataSize); + + // TODO: ensure that we aren't writing on some used memory + + // flush mapped range if memory type is not coherent + if ((uniformBufferMemoryProperties & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT) == 0) + { + VkMappedMemoryRange memoryRange; + memset(&memoryRange, 0, sizeof(memoryRange)); + + memoryRange.sType = VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE; + memoryRange.memory = uniformBufferMemory; + memoryRange.offset = uniformBufferOffset; + memoryRange.size = dataSize; + + vkFunctionTable.vkFlushMappedMemoryRanges(device, 1, &memoryRange); + } + + uniformBufferOffset += FFX_ALIGN_UP(dataSize, uniformBufferAlignment); + if (uniformBufferOffset > uniformBufferSize) + uniformBufferOffset = 0; + } + + return allocation; +} + +void resetBackendContext(BackendContext_VK* backendContext) +{ + // reset the context except the maxEffectContexts in case the memory is reused for a new context + uint32_t maxEffectContexts = backendContext->maxEffectContexts; + + memset(backendContext, 0, sizeof(BackendContext_VK)); + + // restore the maxEffectContexts + backendContext->maxEffectContexts = maxEffectContexts; +} + +////////////////////////////////////////////////////////////////////////// +// VK back end implementation + +FfxVersionNumber GetSDKVersionVK(FfxInterface* backendInterface) +{ + return FFX_SDK_MAKE_VERSION(FFX_SDK_VERSION_MAJOR, FFX_SDK_VERSION_MINOR, FFX_SDK_VERSION_PATCH); +} + +FfxErrorCode GetEffectGpuMemoryUsageVK(FfxInterface* backendInterface, FfxUInt32 effectContextId, FfxEffectMemoryUsage* outVramUsage) +{ + FFX_ASSERT(NULL != backendInterface); + FFX_ASSERT(NULL != outVramUsage); + + BackendContext_VK* backendContext = (BackendContext_VK*)backendInterface->scratchBuffer; + BackendContext_VK::EffectContext& effectContext = backendContext->pEffectContexts[effectContextId]; + + *outVramUsage = effectContext.vramUsage; + + return FFX_OK; +} + +FfxErrorCode CreateBackendContextVK(FfxInterface* backendInterface, FfxEffect effect, FfxEffectBindlessConfig* bindlessConfig, FfxUInt32* effectContextId) +{ + VkDeviceContext* vkDeviceContext = reinterpret_cast(backendInterface->device); + + FFX_ASSERT(NULL != backendInterface); + FFX_ASSERT(NULL != vkDeviceContext); + FFX_ASSERT(VK_NULL_HANDLE != vkDeviceContext->vkDevice); + FFX_ASSERT(VK_NULL_HANDLE != vkDeviceContext->vkPhysicalDevice); + + // set up some internal resources we need (space for resource views and constant buffers) + BackendContext_VK* backendContext = (BackendContext_VK*)backendInterface->scratchBuffer; + + // Set things up if this is the first invocation + if (!backendContext->refCount) { + + resetBackendContext(backendContext); + + new (&backendContext->uniformBufferMutex) std::mutex(); + + // Map all of our pointers + uint32_t gpuJobDescArraySize = FFX_ALIGN_UP(backendContext->maxEffectContexts * FFX_MAX_GPU_JOBS * sizeof(FfxGpuJobDescription), 64); // Savage Wind: was sizeof(uint32_t) + uint32_t resourceViewArraySize = FFX_ALIGN_UP(((backendContext->maxEffectContexts * FFX_MAX_QUEUED_FRAMES * FFX_MAX_RESOURCE_COUNT * 2) + FFX_MAX_BINDLESS_DESCRIPTOR_COUNT) * sizeof(BackendContext_VK::VkResourceView), 64); // Savage Wind: was sizeof(uint32_t) + uint32_t stagingRingBufferArraySize = FFX_ALIGN_UP(backendContext->maxEffectContexts * FFX_CONSTANT_BUFFER_RING_BUFFER_SIZE, 64); // Savage Wind: was sizeof(uint32_t) + uint32_t pipelineArraySize = FFX_ALIGN_UP(backendContext->maxEffectContexts * FFX_MAX_PASS_COUNT * sizeof(BackendContext_VK::PipelineLayout), 64); // Savage Wind: was sizeof(uint32_t) + uint32_t resourceArraySize = FFX_ALIGN_UP(backendContext->maxEffectContexts * FFX_MAX_RESOURCE_COUNT * sizeof(BackendContext_VK::Resource), 64); // Savage Wind: was sizeof(uint32_t) + uint32_t contextArraySize = FFX_ALIGN_UP(backendContext->maxEffectContexts * sizeof(BackendContext_VK::EffectContext), 64); // Savage Wind: was sizeof(uint32_t) + uint8_t* pMem = (uint8_t*)FFX_ALIGN_UP((uintptr_t)(backendContext + 1), 64); // Savage Wind: was backendContext + 1 (8-aligned) + + // Map gpu job array + backendContext->pGpuJobs = (FfxGpuJobDescription*)pMem; + memset(backendContext->pGpuJobs, 0, gpuJobDescArraySize); + pMem += gpuJobDescArraySize; + + // Map the resource view array + backendContext->pResourceViews = (BackendContext_VK::VkResourceView*)(pMem); + memset(backendContext->pResourceViews, 0, resourceViewArraySize); + pMem += resourceViewArraySize; + + // Map the staging ring buffer array + backendContext->pStagingRingBuffer = (uint8_t*)pMem; + memset(backendContext->pStagingRingBuffer, 0, stagingRingBufferArraySize); + pMem += stagingRingBufferArraySize; + + // Map pipeline array + backendContext->pPipelineLayouts = (BackendContext_VK::PipelineLayout*)pMem; + memset(backendContext->pPipelineLayouts, 0, pipelineArraySize); + pMem += pipelineArraySize; + + // Map resource array + backendContext->pResources = (BackendContext_VK::Resource*)pMem; + memset(backendContext->pResources, 0, resourceArraySize); + pMem += resourceArraySize; + + // Clear out all resource mappings + for (uint32_t i = 0; i < backendContext->maxEffectContexts * FFX_MAX_RESOURCE_COUNT; ++i) { + backendContext->pResources[i].uavViewIndex = backendContext->pResources[i].srvViewIndex = -1; + } + + // Map context array + backendContext->pEffectContexts = (BackendContext_VK::EffectContext*)pMem; + memset(backendContext->pEffectContexts, 0, contextArraySize); + pMem += contextArraySize; + + // Map extension array + backendContext->extensionProperties = (VkExtensionProperties*)pMem; + + // if vkGetDeviceProcAddr is NULL, use the one from the vulkan header + if (vkDeviceContext->vkDeviceProcAddr == NULL) + vkDeviceContext->vkDeviceProcAddr = vkGetDeviceProcAddr; + + if (vkDeviceContext->vkDevice != VK_NULL_HANDLE) { + backendContext->device = vkDeviceContext->vkDevice; + } + + if (vkDeviceContext->vkPhysicalDevice != VK_NULL_HANDLE) { + backendContext->physicalDevice = vkDeviceContext->vkPhysicalDevice; + } + + // load vulkan functions + backendContext->vkFunctionTable.vkSetDebugUtilsObjectNameEXT = (PFN_vkSetDebugUtilsObjectNameEXT)vkDeviceContext->vkDeviceProcAddr(backendContext->device, "vkSetDebugUtilsObjectNameEXT"); + backendContext->vkFunctionTable.vkFlushMappedMemoryRanges = (PFN_vkFlushMappedMemoryRanges)vkDeviceContext->vkDeviceProcAddr(backendContext->device, "vkFlushMappedMemoryRanges"); + backendContext->vkFunctionTable.vkCreateDescriptorPool = (PFN_vkCreateDescriptorPool)vkDeviceContext->vkDeviceProcAddr(backendContext->device, "vkCreateDescriptorPool"); + backendContext->vkFunctionTable.vkCreateSampler = (PFN_vkCreateSampler)vkDeviceContext->vkDeviceProcAddr(backendContext->device, "vkCreateSampler"); + backendContext->vkFunctionTable.vkCreateDescriptorSetLayout = (PFN_vkCreateDescriptorSetLayout)vkDeviceContext->vkDeviceProcAddr(backendContext->device, "vkCreateDescriptorSetLayout"); + backendContext->vkFunctionTable.vkCreateBuffer = (PFN_vkCreateBuffer)vkDeviceContext->vkDeviceProcAddr(backendContext->device, "vkCreateBuffer"); + backendContext->vkFunctionTable.vkCreateBufferView = (PFN_vkCreateBufferView)vkDeviceContext->vkDeviceProcAddr(backendContext->device, "vkCreateBufferView"); + backendContext->vkFunctionTable.vkCreateImage = (PFN_vkCreateImage)vkDeviceContext->vkDeviceProcAddr(backendContext->device, "vkCreateImage"); + backendContext->vkFunctionTable.vkCreateImageView = (PFN_vkCreateImageView)vkDeviceContext->vkDeviceProcAddr(backendContext->device, "vkCreateImageView"); + backendContext->vkFunctionTable.vkCreateShaderModule = (PFN_vkCreateShaderModule)vkDeviceContext->vkDeviceProcAddr(backendContext->device, "vkCreateShaderModule"); + backendContext->vkFunctionTable.vkCreatePipelineLayout = (PFN_vkCreatePipelineLayout)vkDeviceContext->vkDeviceProcAddr(backendContext->device, "vkCreatePipelineLayout"); + backendContext->vkFunctionTable.vkCreateComputePipelines = (PFN_vkCreateComputePipelines)vkDeviceContext->vkDeviceProcAddr(backendContext->device, "vkCreateComputePipelines"); + backendContext->vkFunctionTable.vkDestroyPipelineLayout = (PFN_vkDestroyPipelineLayout)vkDeviceContext->vkDeviceProcAddr(backendContext->device, "vkDestroyPipelineLayout"); + backendContext->vkFunctionTable.vkDestroyPipeline = (PFN_vkDestroyPipeline)vkDeviceContext->vkDeviceProcAddr(backendContext->device, "vkDestroyPipeline"); + backendContext->vkFunctionTable.vkDestroyImage = (PFN_vkDestroyImage)vkDeviceContext->vkDeviceProcAddr(backendContext->device, "vkDestroyImage"); + backendContext->vkFunctionTable.vkDestroyImageView = (PFN_vkDestroyImageView)vkDeviceContext->vkDeviceProcAddr(backendContext->device, "vkDestroyImageView"); + backendContext->vkFunctionTable.vkDestroyBuffer = (PFN_vkDestroyBuffer)vkDeviceContext->vkDeviceProcAddr(backendContext->device, "vkDestroyBuffer"); + backendContext->vkFunctionTable.vkDestroyBufferView = (PFN_vkDestroyBufferView)vkDeviceContext->vkDeviceProcAddr(backendContext->device, "vkDestroyBufferView"); + backendContext->vkFunctionTable.vkDestroyDescriptorSetLayout = (PFN_vkDestroyDescriptorSetLayout)vkDeviceContext->vkDeviceProcAddr(backendContext->device, "vkDestroyDescriptorSetLayout"); + backendContext->vkFunctionTable.vkDestroyDescriptorPool = (PFN_vkDestroyDescriptorPool)vkDeviceContext->vkDeviceProcAddr(backendContext->device, "vkDestroyDescriptorPool"); + backendContext->vkFunctionTable.vkDestroySampler = (PFN_vkDestroySampler)vkDeviceContext->vkDeviceProcAddr(backendContext->device, "vkDestroySampler"); + backendContext->vkFunctionTable.vkDestroyShaderModule = (PFN_vkDestroyShaderModule)vkDeviceContext->vkDeviceProcAddr(backendContext->device, "vkDestroyShaderModule"); + backendContext->vkFunctionTable.vkGetBufferMemoryRequirements = (PFN_vkGetBufferMemoryRequirements)vkDeviceContext->vkDeviceProcAddr(backendContext->device, "vkGetBufferMemoryRequirements"); + backendContext->vkFunctionTable.vkGetBufferMemoryRequirements2KHR = (PFN_vkGetBufferMemoryRequirements2KHR)vkDeviceContext->vkDeviceProcAddr(backendContext->device, "vkGetBufferMemoryRequirements2KHR"); + backendContext->vkFunctionTable.vkGetImageMemoryRequirements = (PFN_vkGetImageMemoryRequirements)vkDeviceContext->vkDeviceProcAddr(backendContext->device, "vkGetImageMemoryRequirements"); + backendContext->vkFunctionTable.vkAllocateDescriptorSets = (PFN_vkAllocateDescriptorSets)vkDeviceContext->vkDeviceProcAddr(backendContext->device, "vkAllocateDescriptorSets"); + backendContext->vkFunctionTable.vkFreeDescriptorSets = (PFN_vkFreeDescriptorSets)vkDeviceContext->vkDeviceProcAddr(backendContext->device, "vkFreeDescriptorSets"); + backendContext->vkFunctionTable.vkAllocateMemory = (PFN_vkAllocateMemory)vkDeviceContext->vkDeviceProcAddr(backendContext->device, "vkAllocateMemory"); + backendContext->vkFunctionTable.vkFreeMemory = (PFN_vkFreeMemory)vkDeviceContext->vkDeviceProcAddr(backendContext->device, "vkFreeMemory"); + backendContext->vkFunctionTable.vkMapMemory = (PFN_vkMapMemory)vkDeviceContext->vkDeviceProcAddr(backendContext->device, "vkMapMemory"); + backendContext->vkFunctionTable.vkUnmapMemory = (PFN_vkUnmapMemory)vkDeviceContext->vkDeviceProcAddr(backendContext->device, "vkUnmapMemory"); + backendContext->vkFunctionTable.vkBindBufferMemory = (PFN_vkBindBufferMemory)vkDeviceContext->vkDeviceProcAddr(backendContext->device, "vkBindBufferMemory"); + backendContext->vkFunctionTable.vkBindImageMemory = (PFN_vkBindImageMemory)vkDeviceContext->vkDeviceProcAddr(backendContext->device, "vkBindImageMemory"); + backendContext->vkFunctionTable.vkUpdateDescriptorSets = (PFN_vkUpdateDescriptorSets)vkDeviceContext->vkDeviceProcAddr(backendContext->device, "vkUpdateDescriptorSets"); + backendContext->vkFunctionTable.vkCmdPipelineBarrier = (PFN_vkCmdPipelineBarrier)vkDeviceContext->vkDeviceProcAddr(backendContext->device, "vkCmdPipelineBarrier"); + backendContext->vkFunctionTable.vkCmdBindPipeline = (PFN_vkCmdBindPipeline)vkDeviceContext->vkDeviceProcAddr(backendContext->device, "vkCmdBindPipeline"); + backendContext->vkFunctionTable.vkCmdBindDescriptorSets = (PFN_vkCmdBindDescriptorSets)vkDeviceContext->vkDeviceProcAddr(backendContext->device, "vkCmdBindDescriptorSets"); + backendContext->vkFunctionTable.vkCmdDispatch = (PFN_vkCmdDispatch)vkDeviceContext->vkDeviceProcAddr(backendContext->device, "vkCmdDispatch"); + backendContext->vkFunctionTable.vkCmdDispatchIndirect = (PFN_vkCmdDispatchIndirect)vkDeviceContext->vkDeviceProcAddr(backendContext->device, "vkCmdDispatchIndirect"); + backendContext->vkFunctionTable.vkCmdCopyBuffer = (PFN_vkCmdCopyBuffer)vkDeviceContext->vkDeviceProcAddr(backendContext->device, "vkCmdCopyBuffer"); + backendContext->vkFunctionTable.vkCmdCopyImage = (PFN_vkCmdCopyImage)vkDeviceContext->vkDeviceProcAddr(backendContext->device, "vkCmdCopyImage"); + backendContext->vkFunctionTable.vkCmdCopyBufferToImage = (PFN_vkCmdCopyBufferToImage)vkDeviceContext->vkDeviceProcAddr(backendContext->device, "vkCmdCopyBufferToImage"); + backendContext->vkFunctionTable.vkCmdClearColorImage = (PFN_vkCmdClearColorImage)vkDeviceContext->vkDeviceProcAddr(backendContext->device, "vkCmdClearColorImage"); + backendContext->vkFunctionTable.vkCmdFillBuffer = (PFN_vkCmdFillBuffer)vkDeviceContext->vkDeviceProcAddr(backendContext->device, "vkCmdFillBuffer"); + backendContext->vkFunctionTable.vkCmdWriteBufferMarkerAMD = (PFN_vkCmdWriteBufferMarkerAMD)vkDeviceContext->vkDeviceProcAddr(backendContext->device, "vkCmdWriteBufferMarkerAMD"); + backendContext->vkFunctionTable.vkCmdWriteBufferMarker2AMD = (PFN_vkCmdWriteBufferMarker2AMD)vkDeviceContext->vkDeviceProcAddr(backendContext->device, "vkCmdWriteBufferMarker2AMD"); + backendContext->vkFunctionTable.vkCmdBeginDebugUtilsLabelEXT = (PFN_vkCmdBeginDebugUtilsLabelEXT)vkDeviceContext->vkDeviceProcAddr(backendContext->device, "vkCmdBeginDebugUtilsLabelEXT"); + backendContext->vkFunctionTable.vkCmdEndDebugUtilsLabelEXT = (PFN_vkCmdEndDebugUtilsLabelEXT)vkDeviceContext->vkDeviceProcAddr(backendContext->device, "vkCmdEndDebugUtilsLabelEXT"); + + // enumerate all the device extensions + backendContext->numDeviceExtensions = 0; + vkEnumerateDeviceExtensionProperties(backendContext->physicalDevice, nullptr, &backendContext->numDeviceExtensions, nullptr); + vkEnumerateDeviceExtensionProperties(backendContext->physicalDevice, nullptr, &backendContext->numDeviceExtensions, backendContext->extensionProperties); + + // create a global descriptor pool to hold all descriptors we'll need + VkDescriptorPoolCreateInfo descriptorPoolCreateInfo = {}; + VkDescriptorPoolSize poolSizes[] = { + { VK_DESCRIPTOR_TYPE_SAMPLER, backendContext->maxEffectContexts * FFX_MAX_RESOURCE_COUNT * FFX_MAX_PASS_COUNT * FFX_MAX_QUEUED_FRAMES * MAX_PIPELINE_USAGE_PER_FRAME }, + { VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, backendContext->maxEffectContexts * FFX_MAX_RESOURCE_COUNT * FFX_MAX_PASS_COUNT * FFX_MAX_QUEUED_FRAMES * MAX_PIPELINE_USAGE_PER_FRAME }, + { VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, backendContext->maxEffectContexts * FFX_MAX_RESOURCE_COUNT * FFX_MAX_PASS_COUNT * FFX_MAX_QUEUED_FRAMES * MAX_PIPELINE_USAGE_PER_FRAME }, + { VK_DESCRIPTOR_TYPE_SAMPLER, backendContext->maxEffectContexts * FFX_MAX_RESOURCE_COUNT * FFX_MAX_PASS_COUNT * FFX_MAX_QUEUED_FRAMES * MAX_PIPELINE_USAGE_PER_FRAME }, + { VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, backendContext->maxEffectContexts * FFX_MAX_RESOURCE_COUNT * FFX_MAX_PASS_COUNT * FFX_MAX_QUEUED_FRAMES * MAX_PIPELINE_USAGE_PER_FRAME }, + { VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, backendContext->maxEffectContexts * FFX_MAX_RESOURCE_COUNT * FFX_MAX_PASS_COUNT * FFX_MAX_QUEUED_FRAMES * MAX_PIPELINE_USAGE_PER_FRAME }, + }; + + descriptorPoolCreateInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO; + descriptorPoolCreateInfo.pNext = nullptr; + descriptorPoolCreateInfo.flags = VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT; + descriptorPoolCreateInfo.poolSizeCount = 6; // Savage Wind: was 5, leaving out the storage buffers FSR 3's passes use + descriptorPoolCreateInfo.pPoolSizes = poolSizes; + descriptorPoolCreateInfo.maxSets = backendContext->maxEffectContexts * FFX_MAX_PASS_COUNT * MAX_PIPELINE_USAGE_PER_FRAME * FFX_MAX_QUEUED_FRAMES; + + if (backendContext->vkFunctionTable.vkCreateDescriptorPool(backendContext->device, &descriptorPoolCreateInfo, nullptr, &backendContext->descriptorPool) != VK_SUCCESS) { + return FFX_ERROR_BACKEND_API_ERROR; + } + + // set bindless resource view to base + backendContext->bindlessBase = (backendContext->maxEffectContexts * FFX_MAX_QUEUED_FRAMES * FFX_MAX_RESOURCE_COUNT * 2); + + // allocate dynamic uniform buffer + { + // get alignment + VkPhysicalDeviceProperties physicalDeviceProperties = {}; + vkGetPhysicalDeviceProperties(backendContext->physicalDevice, &physicalDeviceProperties); + backendContext->uniformBufferAlignment = physicalDeviceProperties.limits.minUniformBufferOffsetAlignment; + + backendContext->uniformBufferSize = + FFX_ALIGN_UP(FFX_BUFFER_SIZE, backendContext->uniformBufferAlignment) * backendContext->maxEffectContexts * FFX_MAX_PASS_COUNT * FFX_MAX_QUEUED_FRAMES; + + VkBufferCreateInfo bufferInfo = {}; + bufferInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO; + bufferInfo.size = static_cast(backendContext->uniformBufferSize); + bufferInfo.usage = VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT; + bufferInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE; + + if (backendContext->vkFunctionTable.vkCreateBuffer(backendContext->device, &bufferInfo, NULL, &backendContext->uniformBuffer) != VK_SUCCESS) + { + return FFX_ERROR_BACKEND_API_ERROR; + } + + // allocate memory block for all uniform buffers + VkMemoryRequirements memRequirements = {}; + backendContext->vkFunctionTable.vkGetBufferMemoryRequirements(backendContext->device, backendContext->uniformBuffer, &memRequirements); + + // this is the real alignment + backendContext->uniformBufferAlignment = memRequirements.alignment; + + VkMemoryPropertyFlags requiredMemoryProperties = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT; + + VkMemoryAllocateInfo allocInfo{}; + allocInfo.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO; + allocInfo.allocationSize = backendContext->uniformBufferSize; + allocInfo.memoryTypeIndex = + findMemoryTypeIndex(backendContext->physicalDevice, memRequirements, requiredMemoryProperties, backendContext->uniformBufferMemoryProperties); + + if (allocInfo.memoryTypeIndex == UINT32_MAX) + { + requiredMemoryProperties = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT; + allocInfo.memoryTypeIndex = findMemoryTypeIndex( + backendContext->physicalDevice, memRequirements, requiredMemoryProperties, backendContext->uniformBufferMemoryProperties); + + if (allocInfo.memoryTypeIndex == UINT32_MAX) + { + return FFX_ERROR_BACKEND_API_ERROR; + } + } + + VkResult result = backendContext->vkFunctionTable.vkAllocateMemory(backendContext->device, &allocInfo, nullptr, &backendContext->uniformBufferMemory); + + if (result != VK_SUCCESS) + { + switch (result) + { + case (VK_ERROR_OUT_OF_HOST_MEMORY): + case (VK_ERROR_OUT_OF_DEVICE_MEMORY): + return FFX_ERROR_OUT_OF_MEMORY; + default: + return FFX_ERROR_BACKEND_API_ERROR; + } + } + + // map the memory block + if (backendContext->vkFunctionTable.vkMapMemory( + backendContext->device, backendContext->uniformBufferMemory, 0, backendContext->uniformBufferSize, 0, &backendContext->uniformBufferMem) != + VK_SUCCESS) + { + return FFX_ERROR_BACKEND_API_ERROR; + } + + if (backendContext->vkFunctionTable.vkBindBufferMemory( + backendContext->device, backendContext->uniformBuffer, backendContext->uniformBufferMemory, 0) != VK_SUCCESS) + { + return FFX_ERROR_BACKEND_API_ERROR; + } + } + + // Setup Breadcrumbs data + { + FfxDeviceCapabilities devCaps = {}; + if (GetDeviceCapabilitiesVK(backendInterface, &devCaps) != FFX_OK) + return FFX_ERROR_BACKEND_API_ERROR; + + // Get info for memory used as Breadcrumbs buffer + VkBufferCreateInfo bufferInfo = {}; + bufferInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO; + bufferInfo.pNext = nullptr; + bufferInfo.flags = 0; + bufferInfo.size = 256; + bufferInfo.usage = VK_BUFFER_USAGE_TRANSFER_DST_BIT; + bufferInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE; + bufferInfo.queueFamilyIndexCount = 0; + bufferInfo.pQueueFamilyIndices = nullptr; + + VkBuffer testBuffer = VK_NULL_HANDLE; + if (vkCreateBuffer(backendContext->device, &bufferInfo, nullptr, &testBuffer) != VK_SUCCESS) + { + FFX_ASSERT_FAIL("Cannot create test Breadcrumbs buffer to find memory requirements!"); + return FFX_ERROR_BACKEND_API_ERROR; + } + + uint32_t memoryTypeBits = 0; + /// Enable usage of dedicated memory for Breadcrumbs buffers only when is required by the implementation + if (devCaps.dedicatedAllocationSupported) + { + // Decide whether use dedicated memory or not + VkBufferMemoryRequirementsInfo2 bufferReq = {}; + bufferReq.sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2; + bufferReq.pNext = nullptr; + bufferReq.buffer = testBuffer; + + VkMemoryDedicatedRequirements dedicatedMemoryReq = {}; + dedicatedMemoryReq.sType = VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS; + dedicatedMemoryReq.pNext = nullptr; + dedicatedMemoryReq.requiresDedicatedAllocation = VK_FALSE; + + VkMemoryRequirements2 memoryReq2 = {}; + memoryReq2.sType = VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2; + memoryReq2.pNext = &dedicatedMemoryReq; + + backendContext->vkFunctionTable.vkGetBufferMemoryRequirements2KHR(backendContext->device, &bufferReq, &memoryReq2); + if (dedicatedMemoryReq.requiresDedicatedAllocation) + backendContext->breadcrumbsFlags |= BackendContext_VK::BREADCRUMBS_DEDICATED_MEMORY_ENABLED; + memoryTypeBits = memoryReq2.memoryRequirements.memoryTypeBits; + } + else + { + VkMemoryRequirements memoryReq = {}; + backendContext->vkFunctionTable.vkGetBufferMemoryRequirements(backendContext->device, testBuffer, &memoryReq); + memoryTypeBits = memoryReq.memoryTypeBits; + } + backendContext->vkFunctionTable.vkDestroyBuffer(backendContext->device, testBuffer, nullptr); + + // Find proper memory index for created buffers + VkPhysicalDeviceMemoryProperties memoryProps = {}; + vkGetPhysicalDeviceMemoryProperties(backendContext->physicalDevice, &memoryProps); + + const VkMemoryPropertyFlags requiredMemoryFlags = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT; + VkMemoryPropertyFlags preferredFlags = VK_MEMORY_PROPERTY_HOST_CACHED_BIT; + // When choosing between HOST_CACHED and AMD specific memory, AMD will take precedence as better guarantee of visible writes + if (devCaps.deviceCoherentMemorySupported) + preferredFlags |= VK_MEMORY_PROPERTY_DEVICE_COHERENT_BIT_AMD | VK_MEMORY_PROPERTY_DEVICE_UNCACHED_BIT_AMD; + + backendContext->breadcrumbsMemoryIndex = UINT32_MAX; + uint32_t memoryCost = UINT32_MAX; + for (uint32_t i = 0, memoryBit = 1; i < memoryProps.memoryTypeCount; ++i, memoryBit <<= 1) + { + if (memoryTypeBits & memoryBit) + { + const VkMemoryPropertyFlags memFlags = memoryProps.memoryTypes[i].propertyFlags; + if ((memFlags & requiredMemoryFlags) == requiredMemoryFlags) + { + const uint32_t cost = ffxCountBitsSet(preferredFlags & ~memFlags); + if (cost < memoryCost) + { + backendContext->breadcrumbsMemoryIndex = i; + if (cost == 0) + break; + memoryCost = cost; + } + } + } + } + + if (backendContext->breadcrumbsMemoryIndex == UINT32_MAX) + { + FFX_ASSERT_FAIL("No memory that satisfies requirements requested by Breadcrumbs buffer type!"); + return FFX_ERROR_BACKEND_API_ERROR; + } + + // Will switch to use vkCmdWriteBufferMarkerAMD() to write breadcrumbs into the buffer instead of vkCmdFillBuffer() for ensuring proper ordering of writes + if (devCaps.bufferMarkerSupported) + backendContext->breadcrumbsFlags |= BackendContext_VK::BREADCRUMBS_BUFFER_MARKER_ENABLED; + + // Together with BREADCRUMBS_BUFFER_MARKER_ENABLED flag will switch to vkCmdWriteBufferMarker2AMD() to use new synchronization facilities + if (devCaps.extendedSynchronizationSupported) + backendContext->breadcrumbsFlags |= BackendContext_VK::BREADCRUMBS_SYNCHRONIZATION2_ENABLED; + } + } + + // Increment the ref count + ++backendContext->refCount; + + // Get an available context id + for (uint32_t i = 0; i < backendContext->maxEffectContexts; ++i) { + if (!backendContext->pEffectContexts[i].active) { + *effectContextId = i; + + // Reset everything accordingly + BackendContext_VK::EffectContext& effectContext = backendContext->pEffectContexts[i]; + effectContext.active = true; + effectContext.effectId = effect; + + effectContext.nextStaticResource = (i * FFX_MAX_RESOURCE_COUNT) + 1; + effectContext.nextDynamicResource = getDynamicResourcesStartIndex(i); + effectContext.nextStaticResourceView = (i * FFX_MAX_QUEUED_FRAMES * FFX_MAX_RESOURCE_COUNT * 2); + for (uint32_t frameIndex = 0; frameIndex < FFX_MAX_QUEUED_FRAMES; ++frameIndex) + { + effectContext.nextDynamicResourceView[frameIndex] = getDynamicResourceViewsStartIndex(i, frameIndex); + } + effectContext.nextPipelineLayout = (i * FFX_MAX_PASS_COUNT); + effectContext.frameIndex = 0; + + if (bindlessConfig) + { + effectContext.bindlessTextureSrvHeapStart = backendContext->bindlessBase; + effectContext.bindlessTextureSrvHeapSize = bindlessConfig->maxTextureSrvs; + + backendContext->bindlessBase += bindlessConfig->maxTextureSrvs; + + effectContext.bindlessBufferSrvHeapSize = bindlessConfig->maxBufferSrvs; + + effectContext.bindlessTextureUavHeapStart = backendContext->bindlessBase; + effectContext.bindlessTextureUavHeapSize = bindlessConfig->maxTextureUavs; + + backendContext->bindlessBase += bindlessConfig->maxTextureUavs; + + effectContext.bindlessBufferUavHeapSize = bindlessConfig->maxBufferUavs; + + + // create a bindless descriptor pool local to the current effect + VkDescriptorPoolCreateInfo descriptorPoolCreateInfo = {}; + VkDescriptorPoolSize poolSizes[3]; + + uint32_t poolSizeCount = 0; + + if (bindlessConfig->maxTextureSrvs > 0) + { + VkDescriptorPoolSize& poolSize = poolSizes[poolSizeCount++]; + + poolSize.type = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE; + poolSize.descriptorCount = bindlessConfig->maxTextureSrvs; + } + + if (bindlessConfig->maxTextureUavs > 0) + { + VkDescriptorPoolSize& poolSize = poolSizes[poolSizeCount++]; + + poolSize.type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE; + poolSize.descriptorCount = bindlessConfig->maxTextureUavs; + } + + if (bindlessConfig->maxBufferSrvs > 0 || bindlessConfig->maxBufferUavs > 0) + { + VkDescriptorPoolSize& poolSize = poolSizes[poolSizeCount++]; + + poolSize.type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER; + poolSize.descriptorCount = bindlessConfig->maxBufferSrvs + bindlessConfig->maxBufferUavs; + } + + descriptorPoolCreateInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO; + descriptorPoolCreateInfo.pNext = nullptr; + descriptorPoolCreateInfo.flags = 0; + descriptorPoolCreateInfo.poolSizeCount = poolSizeCount; + descriptorPoolCreateInfo.pPoolSizes = poolSizes; + descriptorPoolCreateInfo.maxSets = poolSizeCount; + + if (backendContext->vkFunctionTable.vkCreateDescriptorPool( + backendContext->device, &descriptorPoolCreateInfo, nullptr, &effectContext.bindlessDescriptorPool) != VK_SUCCESS) + { + return FFX_ERROR_BACKEND_API_ERROR; + } + + // create the descriptor layout for bindless texture srv buffers + if (bindlessConfig->maxTextureSrvs > 0) + { + VkDescriptorSetLayoutBinding binding = { + 0, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, bindlessConfig->maxTextureSrvs, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}; + + VkDescriptorBindingFlags bindingFlags[] = {VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}; + + VkDescriptorSetLayoutBindingFlagsCreateInfo setLayoutBindingFlags = {}; + + setLayoutBindingFlags.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO; + setLayoutBindingFlags.bindingCount = 1; + setLayoutBindingFlags.pBindingFlags = bindingFlags; + + VkDescriptorSetLayoutCreateInfo layoutInfo = {}; + layoutInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO; + layoutInfo.pNext = &setLayoutBindingFlags; + layoutInfo.bindingCount = 1; + layoutInfo.pBindings = &binding; + + if (backendContext->vkFunctionTable.vkCreateDescriptorSetLayout( + backendContext->device, &layoutInfo, nullptr, &effectContext.bindlessTextureSrvDescriptorSetLayout) != VK_SUCCESS) + { + + return FFX_ERROR_BACKEND_API_ERROR; + } + + // allocate descriptor set + VkDescriptorSetAllocateInfo setAllocateInfo = {}; + setAllocateInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO; + setAllocateInfo.descriptorPool = effectContext.bindlessDescriptorPool; + setAllocateInfo.descriptorSetCount = 1; + setAllocateInfo.pSetLayouts = &effectContext.bindlessTextureSrvDescriptorSetLayout; + + backendContext->vkFunctionTable.vkAllocateDescriptorSets( + backendContext->device, &setAllocateInfo, &effectContext.bindlessTextureSrvDescriptorSet); + } + + // create the descriptor layout for bindless buffer srv buffers + if (bindlessConfig->maxBufferSrvs > 0) + { + VkDescriptorSetLayoutBinding binding = { + 0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, bindlessConfig->maxBufferSrvs, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}; + + VkDescriptorBindingFlags bindingFlags[] = {VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}; + + VkDescriptorSetLayoutBindingFlagsCreateInfo setLayoutBindingFlags = {}; + + setLayoutBindingFlags.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO; + setLayoutBindingFlags.bindingCount = 1; + setLayoutBindingFlags.pBindingFlags = bindingFlags; + + VkDescriptorSetLayoutCreateInfo layoutInfo = {}; + layoutInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO; + layoutInfo.pNext = &setLayoutBindingFlags; + layoutInfo.bindingCount = 1; + layoutInfo.pBindings = &binding; + + if (backendContext->vkFunctionTable.vkCreateDescriptorSetLayout( + backendContext->device, &layoutInfo, nullptr, &effectContext.bindlessBufferSrvDescriptorSetLayout) != VK_SUCCESS) + { + return FFX_ERROR_BACKEND_API_ERROR; + } + + // allocate descriptor set + VkDescriptorSetAllocateInfo setAllocateInfo = {}; + setAllocateInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO; + setAllocateInfo.descriptorPool = effectContext.bindlessDescriptorPool; + setAllocateInfo.descriptorSetCount = 1; + setAllocateInfo.pSetLayouts = &effectContext.bindlessBufferSrvDescriptorSetLayout; + + backendContext->vkFunctionTable.vkAllocateDescriptorSets( + backendContext->device, &setAllocateInfo, &effectContext.bindlessBufferSrvDescriptorSet); + } + + // create the descriptor layout for bindless texture uav buffers + if (bindlessConfig->maxTextureUavs > 0) + { + VkDescriptorSetLayoutBinding binding = { + 0, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, bindlessConfig->maxTextureUavs, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}; + + VkDescriptorBindingFlags bindingFlags[] = {VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}; + + VkDescriptorSetLayoutBindingFlagsCreateInfo setLayoutBindingFlags = {}; + + setLayoutBindingFlags.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO; + setLayoutBindingFlags.bindingCount = 1; + setLayoutBindingFlags.pBindingFlags = bindingFlags; + + VkDescriptorSetLayoutCreateInfo layoutInfo = {}; + layoutInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO; + layoutInfo.pNext = &setLayoutBindingFlags; + layoutInfo.bindingCount = 1; + layoutInfo.pBindings = &binding; + + if (backendContext->vkFunctionTable.vkCreateDescriptorSetLayout( + backendContext->device, &layoutInfo, nullptr, &effectContext.bindlessTextureUavDescriptorSetLayout) != VK_SUCCESS) + { + return FFX_ERROR_BACKEND_API_ERROR; + } + + // allocate descriptor set + VkDescriptorSetAllocateInfo setAllocateInfo = {}; + setAllocateInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO; + setAllocateInfo.descriptorPool = effectContext.bindlessDescriptorPool; + setAllocateInfo.descriptorSetCount = 1; + setAllocateInfo.pSetLayouts = &effectContext.bindlessTextureUavDescriptorSetLayout; + + backendContext->vkFunctionTable.vkAllocateDescriptorSets( + backendContext->device, &setAllocateInfo, &effectContext.bindlessTextureUavDescriptorSet); + } + + // create the descriptor layout for bindless buffer uav buffers + if (bindlessConfig->maxBufferUavs > 0) + { + VkDescriptorSetLayoutBinding binding = { + 0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, bindlessConfig->maxBufferUavs, VK_SHADER_STAGE_COMPUTE_BIT, nullptr}; + + VkDescriptorBindingFlags bindingFlags[] = {VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT}; + + VkDescriptorSetLayoutBindingFlagsCreateInfo setLayoutBindingFlags = {}; + + setLayoutBindingFlags.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO; + setLayoutBindingFlags.bindingCount = 1; + setLayoutBindingFlags.pBindingFlags = bindingFlags; + + VkDescriptorSetLayoutCreateInfo layoutInfo = {}; + layoutInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO; + layoutInfo.pNext = &setLayoutBindingFlags; + layoutInfo.bindingCount = 1; + layoutInfo.pBindings = &binding; + + if (backendContext->vkFunctionTable.vkCreateDescriptorSetLayout( + backendContext->device, &layoutInfo, nullptr, &effectContext.bindlessBufferUavDescriptorSetLayout) != VK_SUCCESS) + { + return FFX_ERROR_BACKEND_API_ERROR; + } + + // allocate descriptor set + VkDescriptorSetAllocateInfo setAllocateInfo = {}; + setAllocateInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO; + setAllocateInfo.descriptorPool = effectContext.bindlessDescriptorPool; + setAllocateInfo.descriptorSetCount = 1; + setAllocateInfo.pSetLayouts = &effectContext.bindlessBufferUavDescriptorSetLayout; + + backendContext->vkFunctionTable.vkAllocateDescriptorSets( + backendContext->device, &setAllocateInfo, &effectContext.bindlessBufferUavDescriptorSet); + } + } + else + { + effectContext.bindlessTextureSrvHeapStart = 0; + effectContext.bindlessTextureSrvHeapSize = 0; + effectContext.bindlessBufferSrvHeapSize = 0; + effectContext.bindlessTextureUavHeapStart = 0; + effectContext.bindlessTextureUavHeapSize = 0; + effectContext.bindlessBufferUavHeapSize = 0; + } + + break; + } + } + + return FFX_OK; +} + +FfxErrorCode GetDeviceCapabilitiesVK(FfxInterface* backendInterface, FfxDeviceCapabilities* deviceCapabilities) +{ + BackendContext_VK* backendContext = (BackendContext_VK*)backendInterface->scratchBuffer; + + // no shader model in vulkan so assume the minimum + deviceCapabilities->maximumSupportedShaderModel = FFX_SHADER_MODEL_5_1; + deviceCapabilities->waveLaneCountMin = 32; + deviceCapabilities->waveLaneCountMax = 32; + deviceCapabilities->fp16Supported = false; + deviceCapabilities->raytracingSupported = false; + deviceCapabilities->deviceCoherentMemorySupported = false; + deviceCapabilities->dedicatedAllocationSupported = false; + deviceCapabilities->bufferMarkerSupported = false; + deviceCapabilities->extendedSynchronizationSupported = false; + deviceCapabilities->shaderStorageBufferArrayNonUniformIndexing = false; + + BackendContext_VK* context = (BackendContext_VK*)backendInterface->scratchBuffer; + + // check if extensions are enabled + + for (uint32_t i = 0; i < backendContext->numDeviceExtensions; i++) + { + if (strcmp(backendContext->extensionProperties[i].extensionName, VK_EXT_SUBGROUP_SIZE_CONTROL_EXTENSION_NAME) == 0) + { + // check if we the max subgroup size allows us to use wave64 + VkPhysicalDeviceSubgroupSizeControlProperties subgroupSizeControlProperties = {}; + subgroupSizeControlProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_PROPERTIES; + + VkPhysicalDeviceProperties2 deviceProperties2 = {}; + deviceProperties2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2; + deviceProperties2.pNext = &subgroupSizeControlProperties; + vkGetPhysicalDeviceProperties2(context->physicalDevice, &deviceProperties2); + + deviceCapabilities->waveLaneCountMin = subgroupSizeControlProperties.minSubgroupSize; + deviceCapabilities->waveLaneCountMax = subgroupSizeControlProperties.maxSubgroupSize; + } + else if (strcmp(backendContext->extensionProperties[i].extensionName, VK_KHR_SHADER_FLOAT16_INT8_EXTENSION_NAME) == 0) + { + // check for fp16 support + VkPhysicalDeviceShaderFloat16Int8Features shaderFloat18Int8Features = {}; + shaderFloat18Int8Features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES; + + VkPhysicalDeviceFeatures2 physicalDeviceFeatures2 = {}; + physicalDeviceFeatures2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2; + physicalDeviceFeatures2.pNext = &shaderFloat18Int8Features; + + vkGetPhysicalDeviceFeatures2(context->physicalDevice, &physicalDeviceFeatures2); + + deviceCapabilities->fp16Supported = (bool)shaderFloat18Int8Features.shaderFloat16; + } + else if (strcmp(backendContext->extensionProperties[i].extensionName, VK_KHR_ACCELERATION_STRUCTURE_EXTENSION_NAME) == 0) + { + // check for ray tracing support + VkPhysicalDeviceAccelerationStructureFeaturesKHR accelerationStructureFeatures = {}; + accelerationStructureFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ACCELERATION_STRUCTURE_FEATURES_KHR; + + VkPhysicalDeviceFeatures2 physicalDeviceFeatures2 = {}; + physicalDeviceFeatures2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2; + physicalDeviceFeatures2.pNext = &accelerationStructureFeatures; + + vkGetPhysicalDeviceFeatures2(context->physicalDevice, &physicalDeviceFeatures2); + + deviceCapabilities->raytracingSupported = (bool)accelerationStructureFeatures.accelerationStructure; + } + else if (strcmp(backendContext->extensionProperties[i].extensionName, VK_AMD_DEVICE_COHERENT_MEMORY_EXTENSION_NAME) == 0) + { + // check for coherent memory support + VkPhysicalDeviceCoherentMemoryFeaturesAMD coherentMemoryFeatures = {}; + coherentMemoryFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COHERENT_MEMORY_FEATURES_AMD; + + VkPhysicalDeviceFeatures2 physicalDeviceFeatures2 = {}; + physicalDeviceFeatures2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2; + physicalDeviceFeatures2.pNext = &coherentMemoryFeatures; + + vkGetPhysicalDeviceFeatures2(context->physicalDevice, &physicalDeviceFeatures2); + + deviceCapabilities->deviceCoherentMemorySupported = (bool)coherentMemoryFeatures.deviceCoherentMemory; + } + else if (strcmp(backendContext->extensionProperties[i].extensionName, VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME) == 0) + { + // no features structure so extension name is enough + deviceCapabilities->dedicatedAllocationSupported = true; + } + else if (strcmp(backendContext->extensionProperties[i].extensionName, VK_AMD_BUFFER_MARKER_EXTENSION_NAME) == 0) + { + // no features structure so extension name is enough + deviceCapabilities->bufferMarkerSupported = true; + } + else if (strcmp(backendContext->extensionProperties[i].extensionName, VK_KHR_SYNCHRONIZATION_2_EXTENSION_NAME) == 0) + { + // check for extended synchronization support + VkPhysicalDeviceSynchronization2FeaturesKHR synchronizationFeatures = {}; + synchronizationFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SYNCHRONIZATION_2_FEATURES_KHR; + + VkPhysicalDeviceFeatures2 physicalDeviceFeatures2 = {}; + physicalDeviceFeatures2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2; + physicalDeviceFeatures2.pNext = &synchronizationFeatures; + + vkGetPhysicalDeviceFeatures2(context->physicalDevice, &physicalDeviceFeatures2); + + deviceCapabilities->extendedSynchronizationSupported = (bool)synchronizationFeatures.synchronization2; + } + else if (strcmp(backendContext->extensionProperties[i].extensionName, VK_EXT_DESCRIPTOR_INDEXING_EXTENSION_NAME) == 0) + { + // check for coherent memory support + VkPhysicalDeviceDescriptorIndexingFeatures descriptorIndexingFeatures = {}; + descriptorIndexingFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES; + + VkPhysicalDeviceFeatures2 physicalDeviceFeatures2 = {}; + physicalDeviceFeatures2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2; + physicalDeviceFeatures2.pNext = &descriptorIndexingFeatures; + + vkGetPhysicalDeviceFeatures2(context->physicalDevice, &physicalDeviceFeatures2); + + deviceCapabilities->shaderStorageBufferArrayNonUniformIndexing = (bool)descriptorIndexingFeatures.shaderStorageBufferArrayNonUniformIndexing; + } + } + + return FFX_OK; +} + +FfxErrorCode DestroyBackendContextVK(FfxInterface* backendInterface, FfxUInt32 effectContextId) +{ + FFX_ASSERT(NULL != backendInterface); + BackendContext_VK* backendContext = (BackendContext_VK*)backendInterface->scratchBuffer; + FFX_ASSERT(backendContext->refCount > 0); + + // Delete any resources allocated by this context + BackendContext_VK::EffectContext& effectContext = backendContext->pEffectContexts[effectContextId]; + for (uint32_t currentStaticResourceIndex = effectContextId * FFX_MAX_RESOURCE_COUNT; currentStaticResourceIndex < effectContext.nextStaticResource; ++currentStaticResourceIndex) { + + if (backendContext->pResources[currentStaticResourceIndex].imageResource != VK_NULL_HANDLE) { + FFX_ASSERT_MESSAGE(false, "FFXInterface: Vulkan: SDK Resource was not destroyed prior to destroying the backend context. There is a resource leak."); + FfxResourceInternal internalResource = { static_cast(currentStaticResourceIndex) }; + DestroyResourceVK(backendInterface, internalResource, effectContextId); + } + } + + for (uint32_t frameIndex = 0; frameIndex < FFX_MAX_QUEUED_FRAMES; ++frameIndex) + destroyDynamicViews(backendContext, effectContextId, frameIndex); + + // clean up descriptor set layouts + if (effectContext.bindlessTextureSrvDescriptorSetLayout) + { + backendContext->vkFunctionTable.vkFreeDescriptorSets(backendContext->device, effectContext.bindlessDescriptorPool, 1, &effectContext.bindlessTextureSrvDescriptorSet); + backendContext->vkFunctionTable.vkDestroyDescriptorSetLayout( + backendContext->device, effectContext.bindlessTextureSrvDescriptorSetLayout, VK_NULL_HANDLE); + effectContext.bindlessTextureSrvDescriptorSetLayout = VK_NULL_HANDLE; + } + + if (effectContext.bindlessBufferSrvDescriptorSetLayout) + { + backendContext->vkFunctionTable.vkFreeDescriptorSets(backendContext->device, effectContext.bindlessDescriptorPool, 1, &effectContext.bindlessBufferSrvDescriptorSet); + backendContext->vkFunctionTable.vkDestroyDescriptorSetLayout( + backendContext->device, effectContext.bindlessBufferSrvDescriptorSetLayout, VK_NULL_HANDLE); + effectContext.bindlessBufferSrvDescriptorSetLayout = VK_NULL_HANDLE; + } + + if (effectContext.bindlessTextureUavDescriptorSetLayout) + { + backendContext->vkFunctionTable.vkFreeDescriptorSets(backendContext->device, effectContext.bindlessDescriptorPool, 1, &effectContext.bindlessTextureUavDescriptorSet); + backendContext->vkFunctionTable.vkDestroyDescriptorSetLayout( + backendContext->device, effectContext.bindlessTextureUavDescriptorSetLayout, VK_NULL_HANDLE); + effectContext.bindlessTextureUavDescriptorSetLayout = VK_NULL_HANDLE; + } + + if (effectContext.bindlessBufferUavDescriptorSetLayout) + { + backendContext->vkFunctionTable.vkFreeDescriptorSets(backendContext->device, effectContext.bindlessDescriptorPool, 1, &effectContext.bindlessBufferUavDescriptorSet); + backendContext->vkFunctionTable.vkDestroyDescriptorSetLayout( + backendContext->device, effectContext.bindlessBufferUavDescriptorSetLayout, VK_NULL_HANDLE); + effectContext.bindlessBufferUavDescriptorSetLayout = VK_NULL_HANDLE; + } + + if (effectContext.bindlessDescriptorPool) + { + backendContext->vkFunctionTable.vkDestroyDescriptorPool(backendContext->device, effectContext.bindlessDescriptorPool, VK_NULL_HANDLE); + effectContext.bindlessTextureSrvDescriptorSetLayout = VK_NULL_HANDLE; + } + + // Free up for use by another context + effectContext.nextStaticResource = 0; + effectContext.active = false; + + // Decrement ref count + --backendContext->refCount; + + if (!backendContext->refCount) { + + // clean up descriptor pool + backendContext->vkFunctionTable.vkDestroyDescriptorPool(backendContext->device, backendContext->descriptorPool, VK_NULL_HANDLE); + backendContext->descriptorPool = VK_NULL_HANDLE; + + // clean up dynamic uniform buffer & memory + backendContext->vkFunctionTable.vkUnmapMemory(backendContext->device, backendContext->uniformBufferMemory); + backendContext->vkFunctionTable.vkFreeMemory(backendContext->device, backendContext->uniformBufferMemory, VK_NULL_HANDLE); + backendContext->vkFunctionTable.vkDestroyBuffer(backendContext->device, backendContext->uniformBuffer, VK_NULL_HANDLE); + + backendContext->device = VK_NULL_HANDLE; + backendContext->physicalDevice = VK_NULL_HANDLE; + + resetBackendContext(backendContext); + } + + return FFX_OK; +} + +// create a internal resource that will stay alive until effect gets shut down +FfxErrorCode CreateResourceVK( + FfxInterface* backendInterface, + const FfxCreateResourceDescription* createResourceDescription, + FfxUInt32 effectContextId, + FfxResourceInternal* outResource) +{ + FFX_ASSERT(NULL != backendInterface); + FFX_ASSERT(NULL != createResourceDescription); + FFX_ASSERT(NULL != outResource); + FFX_ASSERT_MESSAGE(createResourceDescription->initData.type != FFX_RESOURCE_INIT_DATA_TYPE_INVALID, + "InitData type cannot be FFX_RESOURCE_INIT_DATA_TYPE_INVALID. Please explicitly specify the resource initialization type."); + + + BackendContext_VK* backendContext = (BackendContext_VK*)backendInterface->scratchBuffer; + BackendContext_VK::EffectContext& effectContext = backendContext->pEffectContexts[effectContextId]; + VkDevice vkDevice = backendContext->device; + + FFX_ASSERT(VK_NULL_HANDLE != vkDevice); + + VkMemoryPropertyFlags requiredMemoryProperties; + + switch (createResourceDescription->heapType) + { + case FFX_HEAP_TYPE_DEFAULT: + requiredMemoryProperties = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT; + break; + case FFX_HEAP_TYPE_UPLOAD: + case FFX_HEAP_TYPE_READBACK: + requiredMemoryProperties = VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT; + break; + default: + requiredMemoryProperties = VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT; + break; + } + + // Setup the resource description + FfxResourceDescription resourceDesc = createResourceDescription->resourceDescription; + + if (resourceDesc.mipCount == 0) { + resourceDesc.mipCount = (uint32_t)(1 + floor(log2(FFX_MAXIMUM(FFX_MAXIMUM(createResourceDescription->resourceDescription.width, + createResourceDescription->resourceDescription.height), createResourceDescription->resourceDescription.depth)))); + } + + FFX_ASSERT(effectContext.nextStaticResource + 1 < effectContext.nextDynamicResource); + outResource->internalIndex = effectContext.nextStaticResource++; + BackendContext_VK::Resource* backendResource = &backendContext->pResources[outResource->internalIndex]; + backendResource->undefined = true; // A flag to make sure the first barrier for this image resource always uses an src layout of undefined + backendResource->dynamic = false; // Not a dynamic resource (need to track them separately for image views) + backendResource->resourceDescription = resourceDesc; + backendResource->allocationSize = 0; + + const auto& initData = createResourceDescription->initData; + + const FfxResourceStates resourceState = + ((initData.type != FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED) && (createResourceDescription->heapType != FFX_HEAP_TYPE_UPLOAD)) + ? FFX_RESOURCE_STATE_COPY_DEST + : createResourceDescription->initialState; + backendResource->initialState = resourceState; + backendResource->currentState = resourceState; + +#ifdef _DEBUG + size_t retval = 0; + wcstombs_s(&retval, backendResource->resourceName, sizeof(backendResource->resourceName), createResourceDescription->name, sizeof(backendResource->resourceName)); + if (retval >= 64) backendResource->resourceName[63] = '\0'; +#endif + + VkMemoryRequirements memRequirements = {}; + + switch (createResourceDescription->resourceDescription.type) + { + case FFX_RESOURCE_TYPE_BUFFER: + { + VkBufferCreateInfo bufferInfo = {}; + bufferInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO; + bufferInfo.size = createResourceDescription->resourceDescription.width; + bufferInfo.usage = ffxGetVKBufferUsageFlagsFromResourceUsage(resourceDesc.usage); + bufferInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE; + + if (initData.type != FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED) + bufferInfo.usage |= VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT; + + if (resourceState == FFX_RESOURCE_STATE_COPY_SRC) + bufferInfo.usage |= VK_BUFFER_USAGE_TRANSFER_SRC_BIT; + + if (resourceState == FFX_RESOURCE_STATE_COPY_DEST) + bufferInfo.usage |= VK_BUFFER_USAGE_TRANSFER_DST_BIT; + + if (backendContext->vkFunctionTable.vkCreateBuffer(backendContext->device, &bufferInfo, NULL, &backendResource->bufferResource) != VK_SUCCESS) { + return FFX_ERROR_BACKEND_API_ERROR; + } + +#ifdef _DEBUG + setVKObjectName(backendContext->vkFunctionTable, backendContext->device, VK_OBJECT_TYPE_BUFFER, (uint64_t)backendResource->bufferResource, backendResource->resourceName); +#endif + + backendContext->vkFunctionTable.vkGetBufferMemoryRequirements(backendContext->device, backendResource->bufferResource, &memRequirements); + + // allocate the memory + FfxErrorCode errorCode = allocateDeviceMemory(backendContext, memRequirements, requiredMemoryProperties, backendResource); + if (FFX_OK != errorCode) + return errorCode; + + if (backendContext->vkFunctionTable.vkBindBufferMemory(backendContext->device, backendResource->bufferResource, backendResource->deviceMemory, 0) != VK_SUCCESS) { + return FFX_ERROR_BACKEND_API_ERROR; + } + + // if this is an upload buffer (currently only support upload buffers), copy the data and return + if (createResourceDescription->heapType == FFX_HEAP_TYPE_UPLOAD && initData.size > 0) + { + // only allow copies directly into mapped memory for buffer resources since all texture resources are in optimal tiling + void* data = NULL; + + if (backendContext->vkFunctionTable.vkMapMemory(backendContext->device, backendResource->deviceMemory, 0, initData.size, 0, &data) != VK_SUCCESS) { + return FFX_ERROR_BACKEND_API_ERROR; + } + + if (initData.type == FFX_RESOURCE_INIT_DATA_TYPE_BUFFER) + memcpy(data, initData.buffer, initData.size); + else if (initData.type == FFX_RESOURCE_INIT_DATA_TYPE_VALUE) + memset(data, initData.value, initData.size); + + // flush mapped range if memory type is not coherant + if ((backendResource->memoryProperties & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT) == 0) + { + VkMappedMemoryRange memoryRange = {}; + memoryRange.sType = VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE; + memoryRange.memory = backendResource->deviceMemory; + memoryRange.size = initData.size; + + backendContext->vkFunctionTable.vkFlushMappedMemoryRanges(backendContext->device, 1, &memoryRange); + } + + backendContext->vkFunctionTable.vkUnmapMemory(backendContext->device, backendResource->deviceMemory); + return FFX_OK; + } + + break; + } + case FFX_RESOURCE_TYPE_TEXTURE1D: + case FFX_RESOURCE_TYPE_TEXTURE2D: + case FFX_RESOURCE_TYPE_TEXTURE_CUBE: + case FFX_RESOURCE_TYPE_TEXTURE3D: + { + VkImageCreateInfo imageInfo = {}; + imageInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO; + imageInfo.imageType = ffxGetVKImageTypeFromResourceType(createResourceDescription->resourceDescription.type); + imageInfo.extent.width = createResourceDescription->resourceDescription.width; + imageInfo.extent.height = createResourceDescription->resourceDescription.type == FFX_RESOURCE_TYPE_TEXTURE1D ? 1 : createResourceDescription->resourceDescription.height; + imageInfo.extent.depth = ( createResourceDescription->resourceDescription.type == FFX_RESOURCE_TYPE_TEXTURE3D || createResourceDescription->resourceDescription.type == FFX_RESOURCE_TYPE_TEXTURE_CUBE ) ? + createResourceDescription->resourceDescription.depth : 1; + imageInfo.mipLevels = backendResource->resourceDescription.mipCount; + imageInfo.arrayLayers = (createResourceDescription->resourceDescription.type == + FFX_RESOURCE_TYPE_TEXTURE1D || createResourceDescription->resourceDescription.type == FFX_RESOURCE_TYPE_TEXTURE2D) + ? createResourceDescription->resourceDescription.depth : 1; + imageInfo.format = getVkFormatFromSurfaceFormatAndUsage(createResourceDescription->resourceDescription.format, resourceDesc.usage); + imageInfo.tiling = VK_IMAGE_TILING_OPTIMAL; + imageInfo.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; + imageInfo.usage = getVKImageUsageFlagsFromResourceUsage(resourceDesc.usage); + imageInfo.samples = VK_SAMPLE_COUNT_1_BIT; + imageInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE; + + if (FFX_CONTAINS_FLAG(resourceDesc.usage, FFX_RESOURCE_USAGE_UAV) && ffxIsSurfaceFormatSRGB(createResourceDescription->resourceDescription.format)) + { + imageInfo.flags |= VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT; + imageInfo.format = ffxGetVkFormatFromSurfaceFormat(ffxGetSurfaceFormatFromGamma(createResourceDescription->resourceDescription.format)); + } + + if (backendContext->vkFunctionTable.vkCreateImage(backendContext->device, &imageInfo, nullptr, &backendResource->imageResource) != VK_SUCCESS) { + return FFX_ERROR_BACKEND_API_ERROR; + } + +#ifdef _DEBUG + setVKObjectName(backendContext->vkFunctionTable, backendContext->device, VK_OBJECT_TYPE_IMAGE, (uint64_t)backendResource->imageResource, backendResource->resourceName); +#endif + + backendContext->vkFunctionTable.vkGetImageMemoryRequirements(backendContext->device, backendResource->imageResource, &memRequirements); + + // allocate the memory + FfxErrorCode errorCode = allocateDeviceMemory(backendContext, memRequirements, requiredMemoryProperties, backendResource); + if (FFX_OK != errorCode) + return errorCode; + + if (backendContext->vkFunctionTable.vkBindImageMemory(backendContext->device, backendResource->imageResource, backendResource->deviceMemory, 0) != VK_SUCCESS) { + return FFX_ERROR_BACKEND_API_ERROR; + } + + break; + } + default: + FFX_ASSERT_MESSAGE(false, "FFXInterface: Vulkan: Unsupported resource type creation requested."); + break; + } + + // Create SRVs and UAVs + switch (createResourceDescription->resourceDescription.type) + { + case FFX_RESOURCE_TYPE_BUFFER: + break; + case FFX_RESOURCE_TYPE_TEXTURE1D: + case FFX_RESOURCE_TYPE_TEXTURE2D: + case FFX_RESOURCE_TYPE_TEXTURE_CUBE: + case FFX_RESOURCE_TYPE_TEXTURE3D: + { + FFX_ASSERT_MESSAGE(effectContext.nextStaticResourceView + 1 < effectContext.nextDynamicResourceView[0], + "FFXInterface: Vulkan: We've run out of resource views. Please increase the size."); + backendResource->srvViewIndex = effectContext.nextStaticResourceView++; + + FfxResourceType type = createResourceDescription->resourceDescription.type; + VkImageViewCreateInfo imageViewCreateInfo = {}; + imageViewCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO; + imageViewCreateInfo.pNext = nullptr; + + bool requestArrayView = FFX_CONTAINS_FLAG(backendResource->resourceDescription.usage, FFX_RESOURCE_USAGE_ARRAYVIEW); + + switch (type) + { + case FFX_RESOURCE_TYPE_TEXTURE1D: + imageViewCreateInfo.viewType = (backendResource->resourceDescription.depth > 1 || requestArrayView) ? VK_IMAGE_VIEW_TYPE_1D_ARRAY : VK_IMAGE_VIEW_TYPE_1D; + break; + default: + case FFX_RESOURCE_TYPE_TEXTURE2D: + imageViewCreateInfo.viewType = (backendResource->resourceDescription.depth > 1 || requestArrayView) ? VK_IMAGE_VIEW_TYPE_2D_ARRAY : VK_IMAGE_VIEW_TYPE_2D; + break; + case FFX_RESOURCE_TYPE_TEXTURE_CUBE: + imageViewCreateInfo.viewType = VK_IMAGE_VIEW_TYPE_CUBE; + break; + case FFX_RESOURCE_TYPE_TEXTURE3D: + imageViewCreateInfo.viewType = VK_IMAGE_VIEW_TYPE_3D; + break; + } + + imageViewCreateInfo.image = backendResource->imageResource; + imageViewCreateInfo.format = getVkFormatFromSurfaceFormatAndUsage(createResourceDescription->resourceDescription.format, backendResource->resourceDescription.usage); + imageViewCreateInfo.components.r = VK_COMPONENT_SWIZZLE_IDENTITY; + imageViewCreateInfo.components.g = VK_COMPONENT_SWIZZLE_IDENTITY; + imageViewCreateInfo.components.b = VK_COMPONENT_SWIZZLE_IDENTITY; + imageViewCreateInfo.components.a = VK_COMPONENT_SWIZZLE_IDENTITY; + imageViewCreateInfo.subresourceRange.aspectMask = getImageAspect(backendResource->resourceDescription.usage); + imageViewCreateInfo.subresourceRange.baseMipLevel = 0; + imageViewCreateInfo.subresourceRange.levelCount = backendResource->resourceDescription.mipCount; + imageViewCreateInfo.subresourceRange.baseArrayLayer = 0; + imageViewCreateInfo.subresourceRange.layerCount = VK_REMAINING_ARRAY_LAYERS; + + VkImageViewUsageCreateInfo imageViewUsageCreateInfo = {}; + addMutableViewForSRV(imageViewCreateInfo, imageViewUsageCreateInfo, backendResource->resourceDescription); + + // create an image view containing all mip levels for use as an srv + if (backendContext->vkFunctionTable.vkCreateImageView(backendContext->device, &imageViewCreateInfo, NULL, &backendContext->pResourceViews[backendResource->srvViewIndex].imageView) != VK_SUCCESS) { + return FFX_ERROR_BACKEND_API_ERROR; + } +#ifdef _DEBUG + setVKObjectName(backendContext->vkFunctionTable, backendContext->device, VK_OBJECT_TYPE_IMAGE_VIEW, (uint64_t)backendContext->pResourceViews[backendResource->srvViewIndex].imageView, backendResource->resourceName); +#endif + + // create image views of individual mip levels for use as a uav + if (FFX_CONTAINS_FLAG(backendResource->resourceDescription.usage, FFX_RESOURCE_USAGE_UAV)) + { + const int32_t uavResourceViewCount = backendResource->resourceDescription.mipCount; + FFX_ASSERT(effectContext.nextStaticResourceView + uavResourceViewCount < effectContext.nextDynamicResourceView[0]); + + backendResource->uavViewIndex = effectContext.nextStaticResourceView; + backendResource->uavViewCount = uavResourceViewCount; + + imageViewCreateInfo.format = FFX_CONTAINS_FLAG(backendResource->resourceDescription.usage, FFX_RESOURCE_USAGE_DEPTHTARGET) ? VK_FORMAT_D32_SFLOAT : ffxGetVKUAVFormatFromSurfaceFormat(createResourceDescription->resourceDescription.format); + + for (uint32_t mip = 0; mip < backendResource->resourceDescription.mipCount; ++mip) + { + imageViewCreateInfo.subresourceRange.levelCount = 1; + imageViewCreateInfo.subresourceRange.baseMipLevel = mip; + + if (backendContext->vkFunctionTable.vkCreateImageView(backendContext->device, &imageViewCreateInfo, NULL, &backendContext->pResourceViews[backendResource->uavViewIndex + mip].imageView) != VK_SUCCESS) { + return FFX_ERROR_BACKEND_API_ERROR; + } +#ifdef _DEBUG + setVKObjectName(backendContext->vkFunctionTable, backendContext->device, VK_OBJECT_TYPE_IMAGE_VIEW, (uint64_t)backendContext->pResourceViews[backendResource->uavViewIndex + mip].imageView, backendResource->resourceName); +#endif + } + + effectContext.nextStaticResourceView += uavResourceViewCount; + } + break; + } + default: + FFX_ASSERT_MESSAGE(false, "FFXInterface: Vulkan: Unsupported resource view type creation requested."); + break; + } + + // create upload resource and upload job if needed + if (initData.type != FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED) + { + FfxResourceInternal copySrc; + FfxCreateResourceDescription uploadDesc = { *createResourceDescription }; + uploadDesc.heapType = FFX_HEAP_TYPE_UPLOAD; + uploadDesc.resourceDescription.type = FFX_RESOURCE_TYPE_BUFFER; + uploadDesc.resourceDescription.width = static_cast(initData.size); + uploadDesc.resourceDescription.usage = FFX_RESOURCE_USAGE_READ_ONLY; + uploadDesc.initialState = FFX_RESOURCE_STATE_GENERIC_READ; + uploadDesc.initData = createResourceDescription->initData; + + backendInterface->fpCreateResource(backendInterface, &uploadDesc, effectContextId, ©Src); + + // setup the upload job + FfxGpuJobDescription copyJob = { FFX_GPU_JOB_COPY, L"Resource Initialization Copy" }; + copyJob.copyJobDescriptor.src = copySrc; + copyJob.copyJobDescriptor.dst = *outResource; + copyJob.copyJobDescriptor.srcOffset = 0; + copyJob.copyJobDescriptor.dstOffset = 0; + copyJob.copyJobDescriptor.size = 0; + + backendInterface->fpScheduleGpuJob(backendInterface, ©Job); + } + + backendResource->allocationSize = memRequirements.size; + effectContext.vramUsage.totalUsageInBytes += static_cast(backendResource->allocationSize); + if ((createResourceDescription->resourceDescription.flags & FFX_RESOURCE_FLAGS_ALIASABLE) == FFX_RESOURCE_FLAGS_ALIASABLE) + { + effectContext.vramUsage.aliasableUsageInBytes += static_cast(backendResource->allocationSize); + } + + return FFX_OK; +} + +FfxErrorCode DestroyResourceVK(FfxInterface* backendInterface, FfxResourceInternal resource, FfxUInt32 effectContextId) +{ + FFX_ASSERT(backendInterface != nullptr); + BackendContext_VK* backendContext = (BackendContext_VK*)backendInterface->scratchBuffer; + BackendContext_VK::EffectContext& effectContext = backendContext->pEffectContexts[effectContextId]; + + if ((resource.internalIndex >= int32_t(effectContextId * FFX_MAX_RESOURCE_COUNT)) && (resource.internalIndex < int32_t(effectContext.nextStaticResource))) + { + BackendContext_VK::Resource& backgroundResource = backendContext->pResources[resource.internalIndex]; + + if (backgroundResource.resourceDescription.type == FFX_RESOURCE_TYPE_BUFFER) + { + // Destroy the resource + if (backgroundResource.bufferResource != VK_NULL_HANDLE) + { + backendContext->vkFunctionTable.vkDestroyBuffer(backendContext->device, backgroundResource.bufferResource, nullptr); + backgroundResource.bufferResource = VK_NULL_HANDLE; + } + } + else + { + // Destroy SRV + if (backgroundResource.srvViewIndex >= 0) + { + backendContext->vkFunctionTable.vkDestroyImageView(backendContext->device, backendContext->pResourceViews[backgroundResource.srvViewIndex].imageView, nullptr); + backendContext->pResourceViews[backgroundResource.srvViewIndex].imageView = VK_NULL_HANDLE; + backgroundResource.srvViewIndex = 0; + } + + // And UAVs + if (FFX_CONTAINS_FLAG(backgroundResource.resourceDescription.usage, FFX_RESOURCE_USAGE_UAV)) + { + for (uint32_t i = 0; i < backgroundResource.uavViewCount; ++i) + { + if (backendContext->pResourceViews[backgroundResource.uavViewIndex + i].imageView != VK_NULL_HANDLE) + { + backendContext->vkFunctionTable.vkDestroyImageView(backendContext->device, backendContext->pResourceViews[backgroundResource.uavViewIndex + i].imageView, nullptr); + backendContext->pResourceViews[backgroundResource.uavViewIndex + i].imageView = VK_NULL_HANDLE; + } + } + } + + // Reset indices to resource views + backgroundResource.uavViewIndex = backgroundResource.srvViewIndex = -1; + backgroundResource.uavViewCount = 0; + + // Destroy the resource + if (backgroundResource.imageResource != VK_NULL_HANDLE) + { + backendContext->vkFunctionTable.vkDestroyImage(backendContext->device, backgroundResource.imageResource, nullptr); + backgroundResource.imageResource = VK_NULL_HANDLE; + } + } + + if (backgroundResource.deviceMemory) + { + backendContext->vkFunctionTable.vkFreeMemory(backendContext->device, backgroundResource.deviceMemory, nullptr); + backgroundResource.deviceMemory = VK_NULL_HANDLE; + + effectContext.vramUsage.totalUsageInBytes -= static_cast(backgroundResource.allocationSize); + if ((backendContext->pResources[resource.internalIndex].resourceDescription.flags & FFX_RESOURCE_FLAGS_ALIASABLE) == FFX_RESOURCE_FLAGS_ALIASABLE) + { + effectContext.vramUsage.aliasableUsageInBytes -= static_cast(backgroundResource.allocationSize); + } + backgroundResource.allocationSize = 0; + } + } + + return FFX_OK; +} + +FfxErrorCode MapResourceVK(FfxInterface* backendInterface, FfxResourceInternal resource, void** ptr) +{ + FFX_ASSERT(NULL != backendInterface); + + BackendContext_VK* backendContext = (BackendContext_VK*)backendInterface->scratchBuffer; + + BackendContext_VK::Resource* res = &backendContext->pResources[resource.internalIndex]; + + if ((backendContext->vkFunctionTable.vkMapMemory(backendContext->device, res->deviceMemory, 0, res->resourceDescription.size, 0, ptr) != VK_SUCCESS)) + return FFX_ERROR_BACKEND_API_ERROR; + + return FFX_OK; +} + +FfxErrorCode UnmapResourceVK(FfxInterface* backendInterface, FfxResourceInternal resource) +{ + FFX_ASSERT(NULL != backendInterface); + + BackendContext_VK* backendContext = (BackendContext_VK*)backendInterface->scratchBuffer; + + BackendContext_VK::Resource* res = &backendContext->pResources[resource.internalIndex]; + + backendContext->vkFunctionTable.vkUnmapMemory(backendContext->device, res->deviceMemory); + + return FFX_OK; +} + +FfxErrorCode RegisterResourceVK( + FfxInterface* backendInterface, + const FfxResource* inFfxResource, + FfxUInt32 effectContextId, + FfxResourceInternal* outFfxResourceInternal +) +{ + FFX_ASSERT(NULL != backendInterface); + BackendContext_VK* backendContext = (BackendContext_VK*)(backendInterface->scratchBuffer); + BackendContext_VK::EffectContext& effectContext = backendContext->pEffectContexts[effectContextId]; + + if (inFfxResource->resource == nullptr) { + + outFfxResourceInternal->internalIndex = 0; // Always maps to FFX__RESOURCE_IDENTIFIER_NULL; + return FFX_OK; + } + + // In vulkan we need to treat dynamic resources a little differently due to needing views to live as long as the GPU needs them. + // We will treat them more like static resources and use the nextDynamicResource as a "hint" for where it should be. + // Failure to find the pre-existing resource at the expected location will force a search until the resource is found. + // If it is not found, a new entry will be created + FFX_ASSERT(effectContext.nextDynamicResource > effectContext.nextStaticResource); + outFfxResourceInternal->internalIndex = effectContext.nextDynamicResource--; + + //bool setupDynamicResource = false; + BackendContext_VK::Resource* backendResource = &backendContext->pResources[outFfxResourceInternal->internalIndex]; + + // Start by seeing if this entry is empty, as that triggers an automatic setup of a new dynamic resource + /*if (backendResource->uavViewIndex < 0 && backendResource->srvViewIndex < 0) + { + setupDynamicResource = true; + } + + // If not a new resource, does it match what's current slotted for this dynamic resource + if (!setupDynamicResource) + { + // If this is us, just return as everything is setup as needed + if ((backendResource->resourceDescription.type == FFX_RESOURCE_TYPE_BUFFER && backendResource->bufferResource == (VkBuffer)inFfxResource->resource) || + (backendResource->resourceDescription.type != FFX_RESOURCE_TYPE_BUFFER && backendResource->imageResource == (VkImage)inFfxResource->resource)) + return FFX_OK; + + // If this isn't us, search until we either find our entry or an empty resource + outFfxResourceInternal->internalIndex = (effectContextId * FFX_MAX_RESOURCE_COUNT) + FFX_MAX_RESOURCE_COUNT - 1; + while (!setupDynamicResource) + { + FFX_ASSERT(outFfxResourceInternal->internalIndex > effectContext.nextStaticResource); // Safety check while iterating + backendResource = &backendContext->pResources[outFfxResourceInternal->internalIndex]; + + // Is this us? + if ((backendResource->resourceDescription.type == FFX_RESOURCE_TYPE_BUFFER && backendResource->bufferResource == (VkBuffer)inFfxResource->resource) || + (backendResource->resourceDescription.type != FFX_RESOURCE_TYPE_BUFFER && backendResource->imageResource == (VkImage)inFfxResource->resource)) + { + copyResourceState(backendResource, inFfxResource); + return FFX_OK; + } + + // Empty? + if (backendResource->uavViewIndex == -1 && backendResource->srvViewIndex == -1) + { + setupDynamicResource = true; + break; + } + + --outFfxResourceInternal->internalIndex; + } + }*/ + + // If we got here, we are setting up a new dynamic entry + backendResource->resourceDescription = inFfxResource->description; + if (inFfxResource->description.type == FFX_RESOURCE_TYPE_BUFFER) + backendResource->bufferResource = reinterpret_cast(inFfxResource->resource); + else + backendResource->imageResource = reinterpret_cast(inFfxResource->resource); + + copyResourceState(backendResource, inFfxResource); + +#ifdef _DEBUG + size_t retval = 0; + wcstombs_s(&retval, backendResource->resourceName, sizeof(backendResource->resourceName), inFfxResource->name, sizeof(backendResource->resourceName)); + if (retval >= 64) backendResource->resourceName[63] = '\0'; +#endif + + // the first call of RegisterResource can be identified because + + + ////////////////////////////////////////////////////////////////////////// + // Create SRVs and UAVs + switch (backendResource->resourceDescription.type) + { + case FFX_RESOURCE_TYPE_BUFFER: + break; + case FFX_RESOURCE_TYPE_TEXTURE1D: + case FFX_RESOURCE_TYPE_TEXTURE2D: + case FFX_RESOURCE_TYPE_TEXTURE_CUBE: + case FFX_RESOURCE_TYPE_TEXTURE3D: + { + FfxResourceType type = backendResource->resourceDescription.type; + VkImageViewCreateInfo imageViewCreateInfo = {}; + imageViewCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO; + imageViewCreateInfo.pNext = nullptr; + + bool requestArrayView = FFX_CONTAINS_FLAG(backendResource->resourceDescription.usage, FFX_RESOURCE_USAGE_ARRAYVIEW); + + switch (type) + { + case FFX_RESOURCE_TYPE_TEXTURE1D: + imageViewCreateInfo.viewType = (backendResource->resourceDescription.depth > 1 || requestArrayView) ? VK_IMAGE_VIEW_TYPE_1D_ARRAY : VK_IMAGE_VIEW_TYPE_1D; + break; + default: + case FFX_RESOURCE_TYPE_TEXTURE2D: + imageViewCreateInfo.viewType = (backendResource->resourceDescription.depth > 1 || requestArrayView) ? VK_IMAGE_VIEW_TYPE_2D_ARRAY : VK_IMAGE_VIEW_TYPE_2D; + break; + case FFX_RESOURCE_TYPE_TEXTURE_CUBE: + imageViewCreateInfo.viewType = VK_IMAGE_VIEW_TYPE_CUBE; + break; + case FFX_RESOURCE_TYPE_TEXTURE3D: + imageViewCreateInfo.viewType = VK_IMAGE_VIEW_TYPE_3D; + break; + } + + imageViewCreateInfo.image = backendResource->imageResource; + imageViewCreateInfo.format = getVkFormatFromSurfaceFormatAndUsage(backendResource->resourceDescription.format, backendResource->resourceDescription.usage); + imageViewCreateInfo.components.r = VK_COMPONENT_SWIZZLE_IDENTITY; + imageViewCreateInfo.components.g = VK_COMPONENT_SWIZZLE_IDENTITY; + imageViewCreateInfo.components.b = VK_COMPONENT_SWIZZLE_IDENTITY; + imageViewCreateInfo.components.a = VK_COMPONENT_SWIZZLE_IDENTITY; + imageViewCreateInfo.subresourceRange.aspectMask = getImageAspect(backendResource->resourceDescription.usage); + imageViewCreateInfo.subresourceRange.baseMipLevel = 0; + imageViewCreateInfo.subresourceRange.levelCount = backendResource->resourceDescription.mipCount; + imageViewCreateInfo.subresourceRange.baseArrayLayer = 0; + imageViewCreateInfo.subresourceRange.layerCount = VK_REMAINING_ARRAY_LAYERS; + + // create an image view containing all mip levels for use as an srv + FFX_ASSERT(effectContext.nextDynamicResourceView[effectContext.frameIndex] > ((effectContext.frameIndex == 0) ? effectContext.nextStaticResourceView : getDynamicResourceViewsStartIndex(effectContextId, effectContext.frameIndex - 1))); + backendResource->srvViewIndex = effectContext.nextDynamicResourceView[effectContext.frameIndex]--; + + VkImageViewUsageCreateInfo imageViewUsageCreateInfo = {}; + addMutableViewForSRV(imageViewCreateInfo, imageViewUsageCreateInfo, backendResource->resourceDescription); + + if (backendContext->vkFunctionTable.vkCreateImageView(backendContext->device, &imageViewCreateInfo, NULL, &backendContext->pResourceViews[backendResource->srvViewIndex].imageView) != VK_SUCCESS) { + return FFX_ERROR_BACKEND_API_ERROR; + } +#ifdef _DEBUG + setVKObjectName(backendContext->vkFunctionTable, backendContext->device, VK_OBJECT_TYPE_IMAGE_VIEW, (uint64_t)backendContext->pResourceViews[backendResource->srvViewIndex].imageView, backendResource->resourceName); +#endif + + // create image views of individual mip levels for use as a uav + if (FFX_CONTAINS_FLAG(backendResource->resourceDescription.usage, FFX_RESOURCE_USAGE_UAV)) + { + const int32_t uavResourceViewCount = backendResource->resourceDescription.mipCount; + FFX_ASSERT(effectContext.nextDynamicResourceView[effectContext.frameIndex] - uavResourceViewCount + 1 > ((effectContext.frameIndex == 0) ? effectContext.nextStaticResourceView : getDynamicResourceViewsStartIndex(effectContextId, effectContext.frameIndex - 1))); + backendResource->uavViewIndex = effectContext.nextDynamicResourceView[effectContext.frameIndex] - uavResourceViewCount + 1; + backendResource->uavViewCount = uavResourceViewCount; + + imageViewCreateInfo.format = FFX_CONTAINS_FLAG(backendResource->resourceDescription.usage, FFX_RESOURCE_USAGE_DEPTHTARGET) ? VK_FORMAT_D32_SFLOAT : ffxGetVKUAVFormatFromSurfaceFormat(backendResource->resourceDescription.format); + imageViewCreateInfo.pNext = nullptr; + + for (uint32_t mip = 0; mip < backendResource->resourceDescription.mipCount; ++mip) + { + imageViewCreateInfo.subresourceRange.levelCount = 1; + imageViewCreateInfo.subresourceRange.baseMipLevel = mip; + + if (backendContext->vkFunctionTable.vkCreateImageView(backendContext->device, &imageViewCreateInfo, NULL, &backendContext->pResourceViews[backendResource->uavViewIndex + mip].imageView) != VK_SUCCESS) { + return FFX_ERROR_BACKEND_API_ERROR; + } +#ifdef _DEBUG + setVKObjectName(backendContext->vkFunctionTable, backendContext->device, VK_OBJECT_TYPE_IMAGE_VIEW, (uint64_t)backendContext->pResourceViews[backendResource->uavViewIndex + mip].imageView, backendResource->resourceName); +#endif + } + effectContext.nextDynamicResourceView[effectContext.frameIndex] -= uavResourceViewCount; + } + break; + } + default: + FFX_ASSERT_MESSAGE(false, "FFXInterface: Vulkan: Unsupported resource view type creation requested."); + break; + } + + return FFX_OK; +} + +FfxResource GetResourceVK(FfxInterface* backendInterface, FfxResourceInternal inResource) +{ + FFX_ASSERT(nullptr != backendInterface); + BackendContext_VK* backendContext = (BackendContext_VK*)backendInterface->scratchBuffer; + + FfxResourceDescription ffxResDescription = backendInterface->fpGetResourceDescription(backendInterface, inResource); + + FfxResource resource = {}; + resource.resource = reinterpret_cast(backendContext->pResources[inResource.internalIndex].imageResource); + // If the internal resource state is undefined, that means we are importing a resource that + // has not yet been initialized, so we will flag it as such to finish initializing it later + // before it is used. + if (backendContext->pResources[inResource.internalIndex].undefined) { + ffxResDescription.flags = (FfxResourceFlags)((int)ffxResDescription.flags | FFX_RESOURCE_FLAGS_UNDEFINED); + // Flag it as no longer being undefined as it will no longer be after workload + // execution + backendContext->pResources[inResource.internalIndex].undefined = false; + } + resource.state = backendContext->pResources[inResource.internalIndex].currentState; + resource.description = ffxResDescription; + +#ifdef _DEBUG + if (backendContext->pResources[inResource.internalIndex].resourceName) + { + ConvertUTF8ToUTF16(backendContext->pResources[inResource.internalIndex].resourceName, resource.name, 64); + } +#endif + + return resource; +} + +// dispose dynamic resources: This should be called at the end of the frame +FfxErrorCode UnregisterResourcesVK(FfxInterface* backendInterface, FfxCommandList commandList, FfxUInt32 effectContextId) +{ + FFX_ASSERT(NULL != backendInterface); + BackendContext_VK* backendContext = (BackendContext_VK*)(backendInterface->scratchBuffer); + BackendContext_VK::EffectContext& effectContext = backendContext->pEffectContexts[effectContextId]; + + // Walk back all the resources that don't belong to us and reset them to their initial state + const uint32_t dynamicResourceIndexStart = getDynamicResourcesStartIndex(effectContextId); + for (uint32_t resourceIndex = ++effectContext.nextDynamicResource; resourceIndex <= dynamicResourceIndexStart; ++resourceIndex) + { + FfxResourceInternal internalResource; + internalResource.internalIndex = resourceIndex; + + BackendContext_VK::Resource* backendResource = &backendContext->pResources[resourceIndex]; + + // Also clear out their srv/uav indices so they are regenerated each frame + backendResource->uavViewIndex = -1; + backendResource->srvViewIndex = -1; + + // Add the barrier + addBarrier(backendContext, &internalResource, backendResource->initialState); + } + + FFX_ASSERT(nullptr != commandList); + VkCommandBuffer pCmdList = reinterpret_cast(commandList); + + flushBarriers(backendContext, pCmdList); + + // Just reset the dynamic resource index, but leave the images views. + // They will be deleted in the first pipeline destroy call as they need to live until then + effectContext.nextDynamicResource = dynamicResourceIndexStart; + + // destroy the views of the next frame + effectContext.frameIndex = (effectContext.frameIndex + 1) % FFX_MAX_QUEUED_FRAMES; + destroyDynamicViews(backendContext, effectContextId, effectContext.frameIndex); + + return FFX_OK; +} + +FfxErrorCode registerStaticTextureSrv(BackendContext_VK* backendContext, const FfxResource* inResource, uint32_t index, FfxUInt32 effectContextId) +{ + BackendContext_VK::EffectContext& effectContext = backendContext->pEffectContexts[effectContextId]; + + if (effectContext.bindlessTextureSrvHeapSize <= index) + { + FFX_ASSERT(false); + return FFX_ERROR_INSUFFICIENT_MEMORY; + } + + VkImage vkImage = reinterpret_cast(inResource->resource); + + // Create SRVs and UAVs + switch (inResource->description.type) + { + case FFX_RESOURCE_TYPE_BUFFER: + { + FFX_ASSERT_MESSAGE(false, "FFXInterface: Vulkan: Attempting to register a Buffer as a Texture SRV."); + break; + } + case FFX_RESOURCE_TYPE_TEXTURE1D: + case FFX_RESOURCE_TYPE_TEXTURE2D: + case FFX_RESOURCE_TYPE_TEXTURE_CUBE: + case FFX_RESOURCE_TYPE_TEXTURE3D: + { + FfxResourceType type = inResource->description.type; + VkImageViewCreateInfo imageViewCreateInfo = {}; + imageViewCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO; + imageViewCreateInfo.pNext = nullptr; + + bool requestArrayView = FFX_CONTAINS_FLAG(inResource->description.usage, FFX_RESOURCE_USAGE_ARRAYVIEW); + + switch (type) + { + case FFX_RESOURCE_TYPE_TEXTURE1D: + imageViewCreateInfo.viewType = (inResource->description.depth > 1 || requestArrayView) ? VK_IMAGE_VIEW_TYPE_1D_ARRAY : VK_IMAGE_VIEW_TYPE_1D; + break; + default: + case FFX_RESOURCE_TYPE_TEXTURE2D: + imageViewCreateInfo.viewType = (inResource->description.depth > 1 || requestArrayView) ? VK_IMAGE_VIEW_TYPE_2D_ARRAY : VK_IMAGE_VIEW_TYPE_2D; + break; + case FFX_RESOURCE_TYPE_TEXTURE_CUBE: + imageViewCreateInfo.viewType = VK_IMAGE_VIEW_TYPE_CUBE; + break; + case FFX_RESOURCE_TYPE_TEXTURE3D: + imageViewCreateInfo.viewType = VK_IMAGE_VIEW_TYPE_3D; + break; + } + + imageViewCreateInfo.image = vkImage; + imageViewCreateInfo.format = getVkFormatFromSurfaceFormatAndUsage(inResource->description.format, inResource->description.usage); + imageViewCreateInfo.components.r = VK_COMPONENT_SWIZZLE_IDENTITY; + imageViewCreateInfo.components.g = VK_COMPONENT_SWIZZLE_IDENTITY; + imageViewCreateInfo.components.b = VK_COMPONENT_SWIZZLE_IDENTITY; + imageViewCreateInfo.components.a = VK_COMPONENT_SWIZZLE_IDENTITY; + imageViewCreateInfo.subresourceRange.aspectMask = getImageAspect(inResource->description.usage); + imageViewCreateInfo.subresourceRange.baseMipLevel = 0; + imageViewCreateInfo.subresourceRange.levelCount = inResource->description.mipCount; + imageViewCreateInfo.subresourceRange.baseArrayLayer = 0; + imageViewCreateInfo.subresourceRange.layerCount = VK_REMAINING_ARRAY_LAYERS; + + uint32_t imageViewIndex = effectContext.bindlessTextureSrvHeapStart + index; + + if (backendContext->pResourceViews[imageViewIndex].imageView) + backendContext->vkFunctionTable.vkDestroyImageView(backendContext->device, backendContext->pResourceViews[imageViewIndex].imageView, nullptr); + + if (backendContext->vkFunctionTable.vkCreateImageView( + backendContext->device, &imageViewCreateInfo, NULL, &backendContext->pResourceViews[imageViewIndex].imageView) != VK_SUCCESS) + { + return FFX_ERROR_BACKEND_API_ERROR; + } + +#ifdef _DEBUG + size_t retval = 0; + char resourceName[64]; + wcstombs_s(&retval, resourceName, sizeof(resourceName), inResource->name, sizeof(resourceName)); + if (retval >= 64) resourceName[63] = '\0'; + + setVKObjectName(backendContext->vkFunctionTable, + backendContext->device, + VK_OBJECT_TYPE_IMAGE_VIEW, + (uint64_t)backendContext->pResourceViews[imageViewIndex].imageView, + resourceName); +#endif + + VkWriteDescriptorSet writeDescriptorSet = {}; + VkDescriptorImageInfo imageDescriptorInfo = {VK_NULL_HANDLE, VK_NULL_HANDLE, VK_IMAGE_LAYOUT_UNDEFINED}; + + writeDescriptorSet.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; + writeDescriptorSet.dstSet = effectContext.bindlessTextureSrvDescriptorSet; + writeDescriptorSet.descriptorCount = 1; + writeDescriptorSet.descriptorType = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE; + writeDescriptorSet.pImageInfo = &imageDescriptorInfo; + writeDescriptorSet.dstBinding = 0; + writeDescriptorSet.dstArrayElement = index; + + imageDescriptorInfo.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; + imageDescriptorInfo.imageView = backendContext->pResourceViews[imageViewIndex].imageView; + + backendContext->vkFunctionTable.vkUpdateDescriptorSets(backendContext->device, 1, &writeDescriptorSet, 0, nullptr); + + return FFX_OK; + + break; + } + default: + break; + } + + return FFX_ERROR_INVALID_ARGUMENT; +} + +FfxErrorCode registerStaticBufferSrv(BackendContext_VK* backendContext, const FfxResource* inResource, uint32_t offset, uint32_t size, uint32_t stride, uint32_t index, FfxUInt32 effectContextId) +{ + BackendContext_VK::EffectContext& effectContext = backendContext->pEffectContexts[effectContextId]; + + if (effectContext.bindlessBufferSrvHeapSize <= index) + { + FFX_ASSERT(false); + return FFX_ERROR_INSUFFICIENT_MEMORY; + } + + if (inResource->description.type == FFX_RESOURCE_TYPE_BUFFER) + { + VkBuffer buffer = reinterpret_cast(inResource->resource); + + VkWriteDescriptorSet writeDescriptorSet = {}; + VkDescriptorBufferInfo bufferDescriptorInfo = {VK_NULL_HANDLE, 0, VK_WHOLE_SIZE}; + + writeDescriptorSet.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; + writeDescriptorSet.dstSet = effectContext.bindlessBufferSrvDescriptorSet; + writeDescriptorSet.descriptorCount = 1; + writeDescriptorSet.descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER; + writeDescriptorSet.pBufferInfo = &bufferDescriptorInfo; + writeDescriptorSet.dstBinding = 0; + writeDescriptorSet.dstArrayElement = index; + + bufferDescriptorInfo.buffer = buffer; + bufferDescriptorInfo.offset = offset; + bufferDescriptorInfo.range = size > 0 ? size : VK_WHOLE_SIZE; + + backendContext->vkFunctionTable.vkUpdateDescriptorSets(backendContext->device, 1, &writeDescriptorSet, 0, nullptr); + + return FFX_OK; + } + else + FFX_ASSERT_MESSAGE(false, "FFXInterface: Vulkan: Attempting to register a Texture as a Buffer SRV."); + + return FFX_ERROR_INVALID_ARGUMENT; +} + +FfxErrorCode registerStaticTextureUav(BackendContext_VK* backendContext, const FfxResource* inResource, uint32_t mip, uint32_t index, FfxUInt32 effectContextId) +{ + BackendContext_VK::EffectContext& effectContext = backendContext->pEffectContexts[effectContextId]; + + if (effectContext.bindlessTextureUavHeapSize <= index) + { + FFX_ASSERT(false); + return FFX_ERROR_INSUFFICIENT_MEMORY; + } + + VkImage vkImage = reinterpret_cast(inResource->resource); + + // Create SRVs and UAVs + switch (inResource->description.type) + { + case FFX_RESOURCE_TYPE_BUFFER: + { + FFX_ASSERT_MESSAGE(false, "FFXInterface: Vulkan: Attempting to register a Buffer as a Texture UAV."); + break; + } + case FFX_RESOURCE_TYPE_TEXTURE1D: + case FFX_RESOURCE_TYPE_TEXTURE2D: + case FFX_RESOURCE_TYPE_TEXTURE_CUBE: + case FFX_RESOURCE_TYPE_TEXTURE3D: + { + FfxResourceType type = inResource->description.type; + VkImageViewCreateInfo imageViewCreateInfo = {}; + imageViewCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO; + imageViewCreateInfo.pNext = nullptr; + + bool requestArrayView = FFX_CONTAINS_FLAG(inResource->description.usage, FFX_RESOURCE_USAGE_ARRAYVIEW); + + switch (type) + { + case FFX_RESOURCE_TYPE_TEXTURE1D: + imageViewCreateInfo.viewType = (inResource->description.depth > 1 || requestArrayView) ? VK_IMAGE_VIEW_TYPE_1D_ARRAY : VK_IMAGE_VIEW_TYPE_1D; + break; + default: + case FFX_RESOURCE_TYPE_TEXTURE2D: + imageViewCreateInfo.viewType = (inResource->description.depth > 1 || requestArrayView) ? VK_IMAGE_VIEW_TYPE_2D_ARRAY : VK_IMAGE_VIEW_TYPE_2D; + break; + case FFX_RESOURCE_TYPE_TEXTURE_CUBE: + imageViewCreateInfo.viewType = VK_IMAGE_VIEW_TYPE_CUBE; + break; + case FFX_RESOURCE_TYPE_TEXTURE3D: + imageViewCreateInfo.viewType = VK_IMAGE_VIEW_TYPE_3D; + break; + } + + imageViewCreateInfo.image = vkImage; + imageViewCreateInfo.format = getVkFormatFromSurfaceFormatAndUsage(inResource->description.format, inResource->description.usage); + imageViewCreateInfo.components.r = VK_COMPONENT_SWIZZLE_IDENTITY; + imageViewCreateInfo.components.g = VK_COMPONENT_SWIZZLE_IDENTITY; + imageViewCreateInfo.components.b = VK_COMPONENT_SWIZZLE_IDENTITY; + imageViewCreateInfo.components.a = VK_COMPONENT_SWIZZLE_IDENTITY; + imageViewCreateInfo.subresourceRange.aspectMask = getImageAspect(inResource->description.usage); + imageViewCreateInfo.subresourceRange.baseMipLevel = 0; + imageViewCreateInfo.subresourceRange.levelCount = inResource->description.mipCount; + imageViewCreateInfo.subresourceRange.baseArrayLayer = 0; + imageViewCreateInfo.subresourceRange.layerCount = VK_REMAINING_ARRAY_LAYERS; + + uint32_t imageViewIndex = effectContext.bindlessTextureUavHeapStart + index; + + if (backendContext->pResourceViews[imageViewIndex].imageView) + backendContext->vkFunctionTable.vkDestroyImageView(backendContext->device, backendContext->pResourceViews[imageViewIndex].imageView, nullptr); + + if (backendContext->vkFunctionTable.vkCreateImageView( + backendContext->device, &imageViewCreateInfo, NULL, &backendContext->pResourceViews[imageViewIndex].imageView) != VK_SUCCESS) + { + return FFX_ERROR_BACKEND_API_ERROR; + } + +#ifdef _DEBUG + size_t retval = 0; + char resourceName[64]; + wcstombs_s(&retval, resourceName, sizeof(resourceName), inResource->name, sizeof(resourceName)); + if (retval >= 64) resourceName[63] = '\0'; + + setVKObjectName(backendContext->vkFunctionTable, + backendContext->device, + VK_OBJECT_TYPE_IMAGE_VIEW, + (uint64_t)backendContext->pResourceViews[imageViewIndex].imageView, + resourceName); +#endif + + VkWriteDescriptorSet writeDescriptorSet = {}; + VkDescriptorImageInfo imageDescriptorInfo = {VK_NULL_HANDLE, VK_NULL_HANDLE, VK_IMAGE_LAYOUT_UNDEFINED}; + + writeDescriptorSet.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; + writeDescriptorSet.dstSet = effectContext.bindlessTextureUavDescriptorSet; + writeDescriptorSet.descriptorCount = 1; + writeDescriptorSet.descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE; + writeDescriptorSet.pImageInfo = &imageDescriptorInfo; + writeDescriptorSet.dstBinding = 0; + writeDescriptorSet.dstArrayElement = index; + + imageDescriptorInfo.imageLayout = VK_IMAGE_LAYOUT_GENERAL; + imageDescriptorInfo.imageView = backendContext->pResourceViews[imageViewIndex].imageView; + + backendContext->vkFunctionTable.vkUpdateDescriptorSets(backendContext->device, 1, &writeDescriptorSet, 0, nullptr); + + return FFX_OK; + + break; + } + default: + break; + } + + return FFX_ERROR_INVALID_ARGUMENT; +} + +FfxErrorCode registerStaticBufferUav(BackendContext_VK* backendContext, const FfxResource* inResource, uint32_t offset, uint32_t size, uint32_t stride, uint32_t index, FfxUInt32 effectContextId) +{ + BackendContext_VK::EffectContext& effectContext = backendContext->pEffectContexts[effectContextId]; + + if (effectContext.bindlessBufferUavHeapSize <= index) + { + FFX_ASSERT(false); + return FFX_ERROR_INSUFFICIENT_MEMORY; + } + + if (inResource->description.type == FFX_RESOURCE_TYPE_BUFFER) + { + VkBuffer buffer = reinterpret_cast(inResource->resource); + + VkWriteDescriptorSet writeDescriptorSet = {}; + VkDescriptorBufferInfo bufferDescriptorInfo = {VK_NULL_HANDLE, 0, VK_WHOLE_SIZE}; + + writeDescriptorSet.sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; + writeDescriptorSet.dstSet = effectContext.bindlessBufferUavDescriptorSet; + writeDescriptorSet.descriptorCount = 1; + writeDescriptorSet.descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER; + writeDescriptorSet.pBufferInfo = &bufferDescriptorInfo; + writeDescriptorSet.dstBinding = 0; + writeDescriptorSet.dstArrayElement = index; + + bufferDescriptorInfo.buffer = buffer; + bufferDescriptorInfo.offset = offset; + bufferDescriptorInfo.range = size > 0 ? size : VK_WHOLE_SIZE; + + backendContext->vkFunctionTable.vkUpdateDescriptorSets(backendContext->device, 1, &writeDescriptorSet, 0, nullptr); + + return FFX_OK; + } + else + FFX_ASSERT_MESSAGE(false, "FFXInterface: Vulkan: Attempting to register a Texture as a Buffer UAV."); + + return FFX_ERROR_INVALID_ARGUMENT; +} + +FfxErrorCode RegisterStaticResourceVK(FfxInterface* backendInterface, const FfxStaticResourceDescription* desc, FfxUInt32 effectContextId) +{ + FFX_ASSERT(NULL != backendInterface); + FFX_ASSERT(NULL != desc); + + BackendContext_VK* backendContext = (BackendContext_VK*)backendInterface->scratchBuffer; + + switch (desc->descriptorType) + { + case FFX_DESCRIPTOR_TEXTURE_SRV: + return registerStaticTextureSrv(backendContext, desc->resource, desc->descriptorIndex, effectContextId); + case FFX_DESCRIPTOR_BUFFER_SRV: + return registerStaticBufferSrv( + backendContext, desc->resource, desc->bufferOffset, desc->bufferSize, desc->bufferStride, desc->descriptorIndex, effectContextId); + case FFX_DESCRIPTOR_TEXTURE_UAV: + return registerStaticTextureUav(backendContext, desc->resource, desc->textureUavMip, desc->descriptorIndex, effectContextId); + case FFX_DESCRIPTOR_BUFFER_UAV: + return registerStaticBufferUav( + backendContext, desc->resource, desc->bufferOffset, desc->bufferSize, desc->bufferStride, desc->descriptorIndex, effectContextId); + default: + return FFX_ERROR_INVALID_ARGUMENT; + } +} + +FfxResourceDescription GetResourceDescriptionVK(FfxInterface* backendInterface, FfxResourceInternal resource) +{ + FFX_ASSERT(NULL != backendInterface); + BackendContext_VK* backendContext = (BackendContext_VK*)backendInterface->scratchBuffer; + + FfxResourceDescription resourceDescription = backendContext->pResources[resource.internalIndex].resourceDescription; + return resourceDescription; +} + +FfxErrorCode StageConstantBufferDataVK(FfxInterface* backendInterface, void* data, FfxUInt32 size, FfxConstantBuffer* constantBuffer) +{ + FFX_ASSERT(NULL != backendInterface); + BackendContext_VK* backendContext = (BackendContext_VK*)backendInterface->scratchBuffer; + + if (data && constantBuffer) + { + if ((backendContext->stagingRingBufferBase + FFX_ALIGN_UP(size, 256)) >= FFX_CONSTANT_BUFFER_RING_BUFFER_SIZE) + backendContext->stagingRingBufferBase = 0; + + uint32_t* dstPtr = (uint32_t*)(backendContext->pStagingRingBuffer + backendContext->stagingRingBufferBase); + + memcpy(dstPtr, data, size); + + constantBuffer->data = dstPtr; + constantBuffer->num32BitEntries = size / sizeof(uint32_t); + + backendContext->stagingRingBufferBase += FFX_ALIGN_UP(size, 256); + + return FFX_OK; + } + else + return FFX_ERROR_INVALID_POINTER; +} + +VkSamplerAddressMode FfxGetAddressModeVK(const FfxAddressMode& addressMode) +{ + switch (addressMode) + { + case FFX_ADDRESS_MODE_WRAP: + return VK_SAMPLER_ADDRESS_MODE_REPEAT; + case FFX_ADDRESS_MODE_MIRROR: + return VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT; + case FFX_ADDRESS_MODE_CLAMP: + return VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE; + case FFX_ADDRESS_MODE_BORDER: + return VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER; + case FFX_ADDRESS_MODE_MIRROR_ONCE: + return VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE; + default: + FFX_ASSERT_MESSAGE(false, "Unsupported addressing mode requested. Please implement"); + return VK_SAMPLER_ADDRESS_MODE_REPEAT; + break; + } +} + +FfxErrorCode CreatePipelineVK(FfxInterface* backendInterface, + FfxEffect effect, + FfxPass pass, + uint32_t permutationOptions, + const FfxPipelineDescription* pipelineDescription, + FfxUInt32 effectContextId, + FfxPipelineState* outPipeline) +{ + FFX_ASSERT(NULL != backendInterface); + FFX_ASSERT(NULL != pipelineDescription); + + BackendContext_VK* backendContext = (BackendContext_VK*)backendInterface->scratchBuffer; + BackendContext_VK::EffectContext& effectContext = backendContext->pEffectContexts[effectContextId]; + + // start by fetching the shader blob + FfxShaderBlob shaderBlob = { }; + // WON'T WORK WITH FSR3!! + backendInterface->fpGetPermutationBlobByIndex(effect, pass, FFX_BIND_COMPUTE_SHADER_STAGE, permutationOptions, &shaderBlob); + FFX_ASSERT(shaderBlob.data && shaderBlob.size); + + ////////////////////////////////////////////////////////////////////////// + // One root signature (or pipeline layout) per pipeline + FFX_ASSERT_MESSAGE(effectContext.nextPipelineLayout < (effectContextId * FFX_MAX_PASS_COUNT) + FFX_MAX_PASS_COUNT, "FFXInterface: Vulkan: Ran out of pipeline layouts. Please increase FFX_MAX_PASS_COUNT"); + BackendContext_VK::PipelineLayout* pPipelineLayout = &backendContext->pPipelineLayouts[effectContext.nextPipelineLayout++]; + + // Start by creating samplers + FFX_ASSERT(pipelineDescription->samplerCount <= FFX_MAX_SAMPLERS); + const size_t samplerCount = pipelineDescription->samplerCount; + for (uint32_t currentSamplerIndex = 0; currentSamplerIndex < samplerCount; ++currentSamplerIndex) + { + VkSamplerCreateInfo createInfo = {}; + createInfo.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO; + createInfo.pNext = nullptr; + createInfo.flags = 0; + createInfo.minLod = 0.f; + createInfo.maxLod = VK_LOD_CLAMP_NONE; + createInfo.anisotropyEnable = false; // TODO: Do a check for anisotropy once it's an available filter option + createInfo.compareEnable = false; + createInfo.compareOp = VK_COMPARE_OP_NEVER; + createInfo.borderColor = VK_BORDER_COLOR_INT_TRANSPARENT_BLACK; + createInfo.unnormalizedCoordinates = VK_FALSE; + createInfo.addressModeU = FfxGetAddressModeVK(pipelineDescription->samplers[currentSamplerIndex].addressModeU); + createInfo.addressModeV = FfxGetAddressModeVK(pipelineDescription->samplers[currentSamplerIndex].addressModeV); + createInfo.addressModeW = FfxGetAddressModeVK(pipelineDescription->samplers[currentSamplerIndex].addressModeW); + + // Set the right filter + switch (pipelineDescription->samplers[currentSamplerIndex].filter) + { + case FFX_FILTER_TYPE_MINMAGMIP_POINT: + createInfo.minFilter = VK_FILTER_NEAREST; + createInfo.magFilter = VK_FILTER_NEAREST; + createInfo.mipmapMode = VK_SAMPLER_MIPMAP_MODE_NEAREST; + break; + case FFX_FILTER_TYPE_MINMAGMIP_LINEAR: + createInfo.minFilter = VK_FILTER_LINEAR; + createInfo.magFilter = VK_FILTER_LINEAR; + createInfo.mipmapMode = VK_SAMPLER_MIPMAP_MODE_LINEAR; + break; + case FFX_FILTER_TYPE_MINMAGLINEARMIP_POINT: + createInfo.minFilter = VK_FILTER_LINEAR; + createInfo.magFilter = VK_FILTER_LINEAR; + createInfo.mipmapMode = VK_SAMPLER_MIPMAP_MODE_NEAREST; + break; + + default: + FFX_ASSERT_MESSAGE(false, "FFXInterface: Vulkan: Unsupported filter type requested. Please implement"); + break; + } + + if (backendContext->vkFunctionTable.vkCreateSampler(backendContext->device, &createInfo, nullptr, &pPipelineLayout->samplers[currentSamplerIndex]) != VK_SUCCESS) { + return FFX_ERROR_BACKEND_API_ERROR; + } + } + + int32_t staticTextureSrvCount = 0; + int32_t staticBufferSrvCount = 0; + int32_t staticTextureUavCount = 0; + int32_t staticBufferUavCount = 0; + + pPipelineLayout->staticTextureSrvSet = -1; + pPipelineLayout->staticBufferSrvSet = -1; + pPipelineLayout->staticTextureUavSet = -1; + pPipelineLayout->staticBufferUavSet = -1; + + // Setup descriptor sets + VkDescriptorSetLayoutBinding layoutBindings[MAX_DESCRIPTOR_SET_LAYOUTS]; + uint32_t numLayoutBindings = 0; + + // Support more when needed + VkShaderStageFlags shaderStageFlags = VK_SHADER_STAGE_COMPUTE_BIT; + + // Samplers - just the static ones for now + for (uint32_t currentSamplerIndex = 0; currentSamplerIndex < samplerCount; ++currentSamplerIndex) + layoutBindings[numLayoutBindings++] = { + currentSamplerIndex + SAMPLER_BINDING_SHIFT, VK_DESCRIPTOR_TYPE_SAMPLER, 1, shaderStageFlags, &pPipelineLayout->samplers[currentSamplerIndex]}; + + // Texture SRVs + for (uint32_t srvIndex = 0; srvIndex < shaderBlob.srvTextureCount; ++srvIndex) + { + // count static srvs separately. + if (shaderBlob.boundSRVTextureSpaces[srvIndex] != 0) + { + if (staticTextureSrvCount > 0) + FFX_ASSERT(pPipelineLayout->staticTextureSrvSet != shaderBlob.boundSRVTextureSpaces[srvIndex]); + + staticTextureSrvCount += shaderBlob.boundSRVTextureCounts[srvIndex]; + pPipelineLayout->staticTextureSrvSet = shaderBlob.boundSRVTextureSpaces[srvIndex]; + continue; + } + + layoutBindings[numLayoutBindings++] = { shaderBlob.boundSRVTextures[srvIndex], VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE, + shaderBlob.boundSRVTextureCounts[srvIndex], shaderStageFlags, nullptr }; + } + + // Buffer SRVs + for (uint32_t srvIndex = 0; srvIndex < shaderBlob.srvBufferCount; ++srvIndex) + { + // count static srvs separately. + if (shaderBlob.boundSRVBufferSpaces[srvIndex] != 0) + { + if (staticBufferSrvCount > 0) + FFX_ASSERT(pPipelineLayout->staticBufferSrvSet != shaderBlob.boundSRVBufferSpaces[srvIndex]); + + staticBufferSrvCount += shaderBlob.boundSRVBufferCounts[srvIndex]; + pPipelineLayout->staticBufferSrvSet = shaderBlob.boundSRVBufferSpaces[srvIndex]; + continue; + } + + layoutBindings[numLayoutBindings++] = { shaderBlob.boundSRVBuffers[srvIndex], VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, + shaderBlob.boundSRVBufferCounts[srvIndex], shaderStageFlags, nullptr}; + } + + // Texture UAVs + for (uint32_t uavIndex = 0; uavIndex < shaderBlob.uavTextureCount; ++uavIndex) + { + // count static uavs separately. + if (shaderBlob.boundUAVTextureSpaces[uavIndex] != 0) + { + if (staticTextureUavCount > 0) + FFX_ASSERT(pPipelineLayout->staticTextureUavSet != shaderBlob.boundUAVTextureSpaces[uavIndex]); + + staticTextureUavCount += shaderBlob.boundUAVTextureCounts[uavIndex]; + pPipelineLayout->staticTextureUavSet = shaderBlob.boundUAVTextureSpaces[uavIndex]; + continue; + } + + layoutBindings[numLayoutBindings++] = { shaderBlob.boundUAVTextures[uavIndex], VK_DESCRIPTOR_TYPE_STORAGE_IMAGE, + shaderBlob.boundUAVTextureCounts[uavIndex], shaderStageFlags, nullptr }; + } + + // Buffer UAVs + for (uint32_t uavIndex = 0; uavIndex < shaderBlob.uavBufferCount; ++uavIndex) + { + // count static uavs separately. + if (shaderBlob.boundUAVBufferSpaces[uavIndex] != 0) + { + if (staticBufferUavCount > 0) + FFX_ASSERT(pPipelineLayout->staticBufferUavSet != shaderBlob.boundUAVBufferSpaces[uavIndex]); + + staticBufferUavCount += shaderBlob.boundUAVBufferCounts[uavIndex]; + pPipelineLayout->staticBufferUavSet = shaderBlob.boundUAVBufferSpaces[uavIndex]; + continue; + } + + layoutBindings[numLayoutBindings++] = { shaderBlob.boundUAVBuffers[uavIndex], VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, + shaderBlob.boundUAVBufferCounts[uavIndex], shaderStageFlags, nullptr }; + } + + // Constant buffers (uniforms) + for (uint32_t cbIndex = 0; cbIndex < shaderBlob.cbvCount; ++cbIndex) + { + layoutBindings[numLayoutBindings++] = { shaderBlob.boundConstantBuffers[cbIndex], VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER, + shaderBlob.boundConstantBufferCounts[cbIndex], shaderStageFlags, nullptr }; + } + + // Create the descriptor layout + VkDescriptorSetLayoutCreateInfo layoutInfo = {}; + layoutInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO; + layoutInfo.bindingCount = numLayoutBindings; + layoutInfo.pBindings = layoutBindings; + + if (backendContext->vkFunctionTable.vkCreateDescriptorSetLayout(backendContext->device, &layoutInfo, nullptr, &pPipelineLayout->descriptorSetLayout) != VK_SUCCESS) { + return FFX_ERROR_BACKEND_API_ERROR; + } + + // allocate descriptor sets + pPipelineLayout->descriptorSetIndex = 0; + for (uint32_t i = 0; i < (FFX_MAX_QUEUED_FRAMES * MAX_PIPELINE_USAGE_PER_FRAME); i++) + { + VkDescriptorSetAllocateInfo allocateInfo = {}; + allocateInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO; + allocateInfo.descriptorPool = backendContext->descriptorPool; + allocateInfo.descriptorSetCount = 1; + allocateInfo.pSetLayouts = &pPipelineLayout->descriptorSetLayout; + + if (backendContext->vkFunctionTable.vkAllocateDescriptorSets(backendContext->device, &allocateInfo, &pPipelineLayout->descriptorSets[i]) != VK_SUCCESS) + { + return FFX_ERROR_BACKEND_API_ERROR; + } + } + + uint32_t setCount = 0; + + VkDescriptorSetLayout layouts[5]; + + layouts[setCount++] = pPipelineLayout->descriptorSetLayout; + + if (staticTextureSrvCount > 0) + { + layouts[pPipelineLayout->staticTextureSrvSet] = effectContext.bindlessTextureSrvDescriptorSetLayout; + setCount++; + } + + if (staticBufferSrvCount > 0) + { + layouts[pPipelineLayout->staticBufferSrvSet] = effectContext.bindlessBufferSrvDescriptorSetLayout; + setCount++; + } + + if (staticTextureUavCount > 0) + { + layouts[pPipelineLayout->staticTextureUavSet] = effectContext.bindlessTextureUavDescriptorSetLayout; + setCount++; + } + + if (staticBufferUavCount > 0) + { + layouts[pPipelineLayout->staticBufferUavSet] = effectContext.bindlessBufferUavDescriptorSetLayout; + setCount++; + } + + // create the pipeline layout + VkPipelineLayoutCreateInfo pipelineLayoutInfo{}; + pipelineLayoutInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO; + pipelineLayoutInfo.setLayoutCount = setCount; + pipelineLayoutInfo.pSetLayouts = layouts; + pipelineLayoutInfo.pushConstantRangeCount = 0; + pipelineLayoutInfo.pPushConstantRanges = nullptr; + + if (backendContext->vkFunctionTable.vkCreatePipelineLayout(backendContext->device, &pipelineLayoutInfo, nullptr, &pPipelineLayout->pipelineLayout) != VK_SUCCESS) { + return FFX_ERROR_BACKEND_API_ERROR; + } + + // set the root signature to pipeline + outPipeline->rootSignature = reinterpret_cast(pPipelineLayout); + + // Only set the command signature if this is setup as an indirect workload + if (pipelineDescription->indirectWorkload) + { + // Only need the stride ahead of time in Vulkan + outPipeline->cmdSignature = reinterpret_cast(sizeof(VkDispatchIndirectCommand)); + } + else + { + outPipeline->cmdSignature = nullptr; + } + + uint32_t flattenedSrvTextureCount = 0; + + for (uint32_t srvIndex = 0; srvIndex < shaderBlob.srvTextureCount; ++srvIndex) + { + uint32_t slotIndex = shaderBlob.boundSRVTextures[srvIndex]; + uint32_t bindCount = shaderBlob.boundSRVTextureCounts[srvIndex]; + + for (uint32_t arrayIndex = 0; arrayIndex < bindCount; arrayIndex++) + { + uint32_t bindingIndex = flattenedSrvTextureCount++; + + outPipeline->srvTextureBindings[bindingIndex].slotIndex = slotIndex; + outPipeline->srvTextureBindings[bindingIndex].arrayIndex = arrayIndex; + ConvertUTF8ToUTF16(shaderBlob.boundSRVTextureNames[srvIndex], outPipeline->srvTextureBindings[bindingIndex].name, FFX_RESOURCE_NAME_SIZE); + } + } + + outPipeline->srvTextureCount = flattenedSrvTextureCount; + FFX_ASSERT(outPipeline->srvTextureCount < FFX_MAX_NUM_SRVS); + + uint32_t flattenedUavTextureCount = 0; + + for (uint32_t uavIndex = 0; uavIndex < shaderBlob.uavTextureCount; ++uavIndex) + { + uint32_t slotIndex = shaderBlob.boundUAVTextures[uavIndex]; + uint32_t bindCount = shaderBlob.boundUAVTextureCounts[uavIndex]; + + for (uint32_t arrayIndex = 0; arrayIndex < bindCount; arrayIndex++) + { + uint32_t bindingIndex = flattenedUavTextureCount++; + + outPipeline->uavTextureBindings[bindingIndex].slotIndex = slotIndex; + outPipeline->uavTextureBindings[bindingIndex].arrayIndex = arrayIndex; + ConvertUTF8ToUTF16(shaderBlob.boundUAVTextureNames[uavIndex], outPipeline->uavTextureBindings[bindingIndex].name, FFX_RESOURCE_NAME_SIZE); + } + } + + outPipeline->uavTextureCount = flattenedUavTextureCount; + FFX_ASSERT(outPipeline->uavTextureCount < FFX_MAX_NUM_UAVS); + + uint32_t flattenedSrvBufferCount = 0; + + for (uint32_t srvIndex = 0; srvIndex < shaderBlob.srvBufferCount; ++srvIndex) + { + uint32_t slotIndex = shaderBlob.boundSRVBuffers[srvIndex]; + uint32_t spaceIndex = shaderBlob.boundSRVBufferSpaces[srvIndex]; + uint32_t bindCount = shaderBlob.boundSRVBufferCounts[srvIndex]; + + // Skip static resources + if (spaceIndex == 1) + continue; + + for (uint32_t arrayIndex = 0; arrayIndex < bindCount; arrayIndex++) + { + uint32_t bindingIndex = flattenedSrvBufferCount++; + + outPipeline->srvBufferBindings[bindingIndex].slotIndex = slotIndex; + outPipeline->srvBufferBindings[bindingIndex].arrayIndex = arrayIndex; + ConvertUTF8ToUTF16(shaderBlob.boundSRVBufferNames[srvIndex], outPipeline->srvBufferBindings[bindingIndex].name, FFX_RESOURCE_NAME_SIZE); + } + } + + outPipeline->srvBufferCount = flattenedSrvBufferCount; + FFX_ASSERT(outPipeline->srvBufferCount < FFX_MAX_NUM_SRVS); + + uint32_t flattenedUavBufferCount = 0; + + for (uint32_t uavIndex = 0; uavIndex < shaderBlob.uavBufferCount; ++uavIndex) + { + uint32_t slotIndex = shaderBlob.boundUAVBuffers[uavIndex]; + uint32_t bindCount = shaderBlob.boundUAVBufferCounts[uavIndex]; + + for (uint32_t arrayIndex = 0; arrayIndex < bindCount; arrayIndex++) + { + uint32_t bindingIndex = flattenedUavBufferCount++; + + outPipeline->uavBufferBindings[bindingIndex].slotIndex = slotIndex; + outPipeline->uavBufferBindings[bindingIndex].arrayIndex = arrayIndex; + ConvertUTF8ToUTF16(shaderBlob.boundUAVBufferNames[uavIndex], outPipeline->uavBufferBindings[bindingIndex].name, FFX_RESOURCE_NAME_SIZE); + } + } + + outPipeline->uavBufferCount = flattenedUavBufferCount; + FFX_ASSERT(outPipeline->uavBufferCount < FFX_MAX_NUM_UAVS); + + for (uint32_t cbIndex = 0; cbIndex < shaderBlob.cbvCount; ++cbIndex) + { + outPipeline->constantBufferBindings[cbIndex].slotIndex = shaderBlob.boundConstantBuffers[cbIndex]; + outPipeline->constantBufferBindings[cbIndex].arrayIndex = 1; + ConvertUTF8ToUTF16(shaderBlob.boundConstantBufferNames[cbIndex], outPipeline->constantBufferBindings[cbIndex].name, FFX_RESOURCE_NAME_SIZE); + } + + outPipeline->constCount = shaderBlob.cbvCount; + FFX_ASSERT(outPipeline->constCount < FFX_MAX_NUM_CONST_BUFFERS); + + outPipeline->staticTextureSrvCount = staticTextureSrvCount; + FFX_ASSERT(outPipeline->staticTextureSrvCount <= effectContext.bindlessTextureSrvHeapSize); + + outPipeline->staticBufferSrvCount = staticBufferSrvCount; + FFX_ASSERT(outPipeline->staticBufferSrvCount <= effectContext.bindlessBufferSrvHeapSize); + + outPipeline->staticTextureUavCount = staticTextureUavCount; + FFX_ASSERT(outPipeline->staticTextureUavCount <= effectContext.bindlessTextureUavHeapSize); + + outPipeline->staticBufferUavCount = staticBufferUavCount; + FFX_ASSERT(outPipeline->staticBufferUavCount <= effectContext.bindlessBufferUavHeapSize); + + // Todo when needed + //outPipeline->samplerCount = shaderBlob.samplerCount; + //outPipeline->rtAccelStructCount= shaderBlob.rtAccelStructCount; + + ////////////////////////////////////////////////////////////////////////// + // pipeline creation + FfxDeviceCapabilities capabilities; + backendInterface->fpGetDeviceCapabilities(backendInterface, &capabilities); + + // shader module + VkShaderModule shaderModule = VK_NULL_HANDLE; + VkShaderModuleCreateInfo shaderModuleCreateInfo = {}; + shaderModuleCreateInfo.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO; + shaderModuleCreateInfo.pCode = (uint32_t*)shaderBlob.data; + shaderModuleCreateInfo.codeSize = shaderBlob.size; + + if (backendContext->vkFunctionTable.vkCreateShaderModule(backendContext->device, &shaderModuleCreateInfo, nullptr, &shaderModule) != VK_SUCCESS) { + return FFX_ERROR_BACKEND_API_ERROR; + } + + // fill out shader stage create info + VkPipelineShaderStageCreateInfo shaderStageCreateInfo = {}; + shaderStageCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO; + shaderStageCreateInfo.stage = VK_SHADER_STAGE_COMPUTE_BIT; + shaderStageCreateInfo.pName = "main"; + shaderStageCreateInfo.module = shaderModule; + + // check if wave64 is requested + bool isWave64 = false; + ffxIsWave64(effect, permutationOptions, isWave64); + VkPipelineShaderStageRequiredSubgroupSizeCreateInfoEXT subgroupSizeCreateInfo = {}; + if (isWave64 && (capabilities.waveLaneCountMin <= 64 && capabilities.waveLaneCountMax >= 64)) + { + subgroupSizeCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_REQUIRED_SUBGROUP_SIZE_CREATE_INFO_EXT; + subgroupSizeCreateInfo.requiredSubgroupSize = 64; + shaderStageCreateInfo.pNext = &subgroupSizeCreateInfo; + } + + // create the compute pipeline + VkComputePipelineCreateInfo pipelineCreateInfo = {}; + pipelineCreateInfo.sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO; + pipelineCreateInfo.stage = shaderStageCreateInfo; + pipelineCreateInfo.layout = pPipelineLayout->pipelineLayout; + + VkPipeline computePipeline = VK_NULL_HANDLE; + if (backendContext->vkFunctionTable.vkCreateComputePipelines(backendContext->device, nullptr, 1, &pipelineCreateInfo, nullptr, &computePipeline) != VK_SUCCESS) { + return FFX_ERROR_BACKEND_API_ERROR; + } + + // done with shader module, so clean up + backendContext->vkFunctionTable.vkDestroyShaderModule(backendContext->device, shaderModule, nullptr); + + // set the pipeline + outPipeline->pipeline = reinterpret_cast(computePipeline); + + // Setup the pipeline name + wcscpy_s(outPipeline->name, pipelineDescription->name); + + return FFX_OK; +} + +FfxErrorCode DestroyPipelineVK(FfxInterface* backendInterface, FfxPipelineState* pipeline, FfxUInt32 effectContextId) +{ + FFX_ASSERT(backendInterface != nullptr); + BackendContext_VK* backendContext = (BackendContext_VK*)backendInterface->scratchBuffer; + BackendContext_VK::EffectContext& effectContext = backendContext->pEffectContexts[effectContextId]; + + if (!pipeline) + return FFX_OK; + + // Destroy the pipeline + VkPipeline vkPipeline = reinterpret_cast(pipeline->pipeline); + if (vkPipeline != VK_NULL_HANDLE) { + backendContext->vkFunctionTable.vkDestroyPipeline(backendContext->device, vkPipeline, VK_NULL_HANDLE); + pipeline->pipeline = VK_NULL_HANDLE; + } + + // Zero out the cmd signature + pipeline->cmdSignature = nullptr; + + // Destroy the pipeline layout + BackendContext_VK::PipelineLayout* pPipelineLayout = reinterpret_cast(pipeline->rootSignature); + + if (pPipelineLayout) + { + // Descriptor set layout + if (pPipelineLayout->pipelineLayout != VK_NULL_HANDLE) { + backendContext->vkFunctionTable.vkDestroyPipelineLayout(backendContext->device, pPipelineLayout->pipelineLayout, VK_NULL_HANDLE); + pPipelineLayout->pipelineLayout = VK_NULL_HANDLE; + } + + // Descriptor sets + for (uint32_t i = 0; i < FFX_MAX_QUEUED_FRAMES * MAX_PIPELINE_USAGE_PER_FRAME; i++) { + backendContext->vkFunctionTable.vkFreeDescriptorSets(backendContext->device, backendContext->descriptorPool, 1, &pPipelineLayout->descriptorSets[i]); + pPipelineLayout->descriptorSets[i] = VK_NULL_HANDLE; + } + + // Descriptor set layout + if (pPipelineLayout->descriptorSetLayout != VK_NULL_HANDLE) { + backendContext->vkFunctionTable.vkDestroyDescriptorSetLayout(backendContext->device, pPipelineLayout->descriptorSetLayout, VK_NULL_HANDLE); + pPipelineLayout->descriptorSetLayout = VK_NULL_HANDLE; + } + + // Samplers + for (uint32_t currentSamplerIndex = 0; currentSamplerIndex < FFX_MAX_SAMPLERS; ++currentSamplerIndex) + { + if (pPipelineLayout->samplers[currentSamplerIndex] != VK_NULL_HANDLE) { + backendContext->vkFunctionTable.vkDestroySampler(backendContext->device, pPipelineLayout->samplers[currentSamplerIndex], VK_NULL_HANDLE); + pPipelineLayout->samplers[currentSamplerIndex] = VK_NULL_HANDLE; + } + } + } + + return FFX_OK; +} + +FfxErrorCode ScheduleGpuJobVK(FfxInterface* backendInterface, const FfxGpuJobDescription* job) +{ + FFX_ASSERT(NULL != backendInterface); + FFX_ASSERT(NULL != job); + + BackendContext_VK* backendContext = (BackendContext_VK*)backendInterface->scratchBuffer; + + FFX_ASSERT(backendContext->gpuJobCount < FFX_MAX_GPU_JOBS); + + backendContext->pGpuJobs[backendContext->gpuJobCount] = *job; + backendContext->gpuJobCount++; + + return FFX_OK; +} + +static FfxErrorCode executeGpuJobCompute(BackendContext_VK* backendContext, + FfxGpuJobDescription* job, + VkCommandBuffer vkCommandBuffer, + FfxUInt32 effectContextId) +{ + BackendContext_VK::PipelineLayout* pipelineLayout = reinterpret_cast(job->computeJobDescriptor.pipeline.rootSignature); + + // bind texture & buffer UAVs (note the binding order here MUST match the root signature mapping order from CreatePipeline!) + uint32_t descriptorWriteIndex = 0; + VkWriteDescriptorSet writeDescriptorSets[FFX_MAX_RESOURCE_COUNT]; + + // These MUST be initialized + uint32_t imageDescriptorIndex = 0; + VkDescriptorImageInfo imageDescriptorInfos[FFX_MAX_RESOURCE_COUNT]; + for (int i = 0; i < FFX_MAX_RESOURCE_COUNT; ++i) + imageDescriptorInfos[i] = { VK_NULL_HANDLE, VK_NULL_HANDLE, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL }; + + // These MUST be initialized + uint32_t bufferDescriptorIndex = 0; + VkDescriptorBufferInfo bufferDescriptorInfos[FFX_MAX_RESOURCE_COUNT]; + for (int i = 0; i < FFX_MAX_RESOURCE_COUNT; ++i) + bufferDescriptorInfos[i] = { VK_NULL_HANDLE, 0, VK_WHOLE_SIZE }; + + // bind texture UAVs + for (uint32_t currentPipelineUavIndex = 0; currentPipelineUavIndex < job->computeJobDescriptor.pipeline.uavTextureCount; ++currentPipelineUavIndex) + { + FfxTextureUAV& textureUAV = job->computeJobDescriptor.uavTextures[currentPipelineUavIndex]; + + // continue if this is a null resource. + if (job->computeJobDescriptor.uavTextures[currentPipelineUavIndex].resource.internalIndex == 0) + continue; + + addBarrier(backendContext, &textureUAV.resource, FFX_RESOURCE_STATE_UNORDERED_ACCESS); + + const FfxResourceBinding binding = job->computeJobDescriptor.pipeline.uavTextureBindings[currentPipelineUavIndex]; + + // where to bind it + const uint32_t currentUavResourceIndex = job->computeJobDescriptor.pipeline.uavTextureBindings[currentPipelineUavIndex].slotIndex; + + // source: UAV of resource to bind + const uint32_t resourceIndex = textureUAV.resource.internalIndex; + uint32_t mipOffset = textureUAV.mip; + if (textureUAV.mip >= backendContext->pResources[resourceIndex].resourceDescription.mipCount) + mipOffset = backendContext->pResources[resourceIndex].resourceDescription.mipCount - 1; + const uint32_t uavViewIndex = backendContext->pResources[resourceIndex].uavViewIndex + mipOffset; + + writeDescriptorSets[descriptorWriteIndex] = {}; + writeDescriptorSets[descriptorWriteIndex].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; + writeDescriptorSets[descriptorWriteIndex].dstSet = pipelineLayout->descriptorSets[pipelineLayout->descriptorSetIndex]; + writeDescriptorSets[descriptorWriteIndex].descriptorCount = 1; + writeDescriptorSets[descriptorWriteIndex].descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE; + writeDescriptorSets[descriptorWriteIndex].pImageInfo = &imageDescriptorInfos[imageDescriptorIndex]; + writeDescriptorSets[descriptorWriteIndex].dstBinding = binding.slotIndex; + writeDescriptorSets[descriptorWriteIndex].dstArrayElement = binding.arrayIndex; + + imageDescriptorInfos[imageDescriptorIndex] = {}; + imageDescriptorInfos[imageDescriptorIndex].imageLayout = VK_IMAGE_LAYOUT_GENERAL; + imageDescriptorInfos[imageDescriptorIndex].imageView = backendContext->pResourceViews[uavViewIndex].imageView; + + imageDescriptorIndex++; + descriptorWriteIndex++; + } + + // bind buffer UAVs + for (uint32_t currentPipelineUavIndex = 0; currentPipelineUavIndex < job->computeJobDescriptor.pipeline.uavBufferCount; ++currentPipelineUavIndex) + { + FfxBufferUAV& bufferUAV = job->computeJobDescriptor.uavBuffers[currentPipelineUavIndex]; + + // continue if this is a null resource. + if (job->computeJobDescriptor.uavBuffers[currentPipelineUavIndex].resource.internalIndex == 0) + continue; + + addBarrier(backendContext, &bufferUAV.resource, FFX_RESOURCE_STATE_UNORDERED_ACCESS); + + const FfxResourceBinding binding = job->computeJobDescriptor.pipeline.uavBufferBindings[currentPipelineUavIndex]; + + // source: UAV of buffer to bind + const uint32_t resourceIndex = bufferUAV.resource.internalIndex; + + // where to bind it + const uint32_t currentUavResourceIndex = job->computeJobDescriptor.pipeline.uavBufferBindings[currentPipelineUavIndex].slotIndex; + + writeDescriptorSets[descriptorWriteIndex] = {}; + writeDescriptorSets[descriptorWriteIndex].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; + writeDescriptorSets[descriptorWriteIndex].dstSet = pipelineLayout->descriptorSets[pipelineLayout->descriptorSetIndex]; + writeDescriptorSets[descriptorWriteIndex].descriptorCount = 1; + writeDescriptorSets[descriptorWriteIndex].descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER; + writeDescriptorSets[descriptorWriteIndex].pBufferInfo = &bufferDescriptorInfos[bufferDescriptorIndex]; + writeDescriptorSets[descriptorWriteIndex].dstBinding = binding.slotIndex; + writeDescriptorSets[descriptorWriteIndex].dstArrayElement = binding.arrayIndex; + + bufferDescriptorInfos[bufferDescriptorIndex] = {}; + bufferDescriptorInfos[bufferDescriptorIndex].buffer = backendContext->pResources[resourceIndex].bufferResource; + bufferDescriptorInfos[bufferDescriptorIndex].offset = bufferUAV.offset; + bufferDescriptorInfos[bufferDescriptorIndex].range = bufferUAV.size > 0 ? bufferUAV.size : VK_WHOLE_SIZE; + + bufferDescriptorIndex++; + descriptorWriteIndex++; + } + + // bind texture SRVs + for (uint32_t currentPipelineSrvIndex = 0; currentPipelineSrvIndex < job->computeJobDescriptor.pipeline.srvTextureCount; ++currentPipelineSrvIndex) + { + FfxTextureSRV& textureSRV = job->computeJobDescriptor.srvTextures[currentPipelineSrvIndex]; + + // continue if this is a null resource. + if (job->computeJobDescriptor.srvTextures[currentPipelineSrvIndex].resource.internalIndex == 0) + continue; + + addBarrier(backendContext, &textureSRV.resource, FFX_RESOURCE_STATE_COMPUTE_READ); + + const FfxResourceBinding binding = job->computeJobDescriptor.pipeline.srvTextureBindings[currentPipelineSrvIndex]; + + // where to bind it + const uint32_t currentSrvResourceIndex = job->computeJobDescriptor.pipeline.srvTextureBindings[currentPipelineSrvIndex].slotIndex; + + writeDescriptorSets[descriptorWriteIndex] = {}; + writeDescriptorSets[descriptorWriteIndex].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; + writeDescriptorSets[descriptorWriteIndex].dstSet = pipelineLayout->descriptorSets[pipelineLayout->descriptorSetIndex]; + writeDescriptorSets[descriptorWriteIndex].descriptorCount = 1; + writeDescriptorSets[descriptorWriteIndex].descriptorType = VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE; + writeDescriptorSets[descriptorWriteIndex].pImageInfo = &imageDescriptorInfos[imageDescriptorIndex]; + writeDescriptorSets[descriptorWriteIndex].dstBinding = binding.slotIndex; + writeDescriptorSets[descriptorWriteIndex].dstArrayElement = binding.arrayIndex; + + const uint32_t resourceIndex = textureSRV.resource.internalIndex; + const uint32_t srvViewIndex = backendContext->pResources[resourceIndex].srvViewIndex; + + imageDescriptorInfos[imageDescriptorIndex] = {}; + imageDescriptorInfos[imageDescriptorIndex].imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; + imageDescriptorInfos[imageDescriptorIndex].imageView = backendContext->pResourceViews[srvViewIndex].imageView; + + imageDescriptorIndex++; + descriptorWriteIndex++; + } + + // bind buffer SRVs + for (uint32_t currentPipelineSrvIndex = 0; currentPipelineSrvIndex < job->computeJobDescriptor.pipeline.srvBufferCount; ++currentPipelineSrvIndex) + { + FfxBufferSRV& bufferSRV = job->computeJobDescriptor.srvBuffers[currentPipelineSrvIndex]; + + // continue if this is a null resource. + if (job->computeJobDescriptor.srvBuffers[currentPipelineSrvIndex].resource.internalIndex == 0) + continue; + + addBarrier(backendContext, &bufferSRV.resource, FFX_RESOURCE_STATE_COMPUTE_READ); + + const FfxResourceBinding binding = job->computeJobDescriptor.pipeline.srvBufferBindings[currentPipelineSrvIndex]; + + // source: SRV of buffer to bind + const uint32_t resourceIndex = bufferSRV.resource.internalIndex; + + // where to bind it + const uint32_t currentSrvResourceIndex = job->computeJobDescriptor.pipeline.srvBufferBindings[currentPipelineSrvIndex].slotIndex; + + writeDescriptorSets[descriptorWriteIndex] = {}; + writeDescriptorSets[descriptorWriteIndex].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; + writeDescriptorSets[descriptorWriteIndex].dstSet = pipelineLayout->descriptorSets[pipelineLayout->descriptorSetIndex]; + writeDescriptorSets[descriptorWriteIndex].descriptorCount = 1; + writeDescriptorSets[descriptorWriteIndex].descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER; + writeDescriptorSets[descriptorWriteIndex].pBufferInfo = &bufferDescriptorInfos[bufferDescriptorIndex]; + writeDescriptorSets[descriptorWriteIndex].dstBinding = binding.slotIndex; + writeDescriptorSets[descriptorWriteIndex].dstArrayElement = binding.arrayIndex; + + bufferDescriptorInfos[bufferDescriptorIndex] = {}; + bufferDescriptorInfos[bufferDescriptorIndex].buffer = backendContext->pResources[resourceIndex].bufferResource; + bufferDescriptorInfos[bufferDescriptorIndex].offset = bufferSRV.offset; + bufferDescriptorInfos[bufferDescriptorIndex].range = bufferSRV.size > 0 ? bufferSRV.size : VK_WHOLE_SIZE; + + bufferDescriptorIndex++; + descriptorWriteIndex++; + } + + // update uniform buffers + for (uint32_t currentRootConstantIndex = 0; currentRootConstantIndex < job->computeJobDescriptor.pipeline.constCount; ++currentRootConstantIndex) + { + uint32_t dataSize = job->computeJobDescriptor.cbs[currentRootConstantIndex].num32BitEntries * sizeof(uint32_t); + + // If we have a constant buffer allocator, use that, otherwise use the default backend allocator + FfxConstantAllocation allocation; + if (s_fpConstantAllocator) + allocation = s_fpConstantAllocator(job->computeJobDescriptor.cbs[currentRootConstantIndex].data, dataSize); + else + allocation = backendContext->FallbackConstantAllocator(job->computeJobDescriptor.cbs[currentRootConstantIndex].data, dataSize); + + writeDescriptorSets[descriptorWriteIndex] = {}; + writeDescriptorSets[descriptorWriteIndex].sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET; + writeDescriptorSets[descriptorWriteIndex].dstSet = pipelineLayout->descriptorSets[pipelineLayout->descriptorSetIndex]; + writeDescriptorSets[descriptorWriteIndex].descriptorCount = 1; + writeDescriptorSets[descriptorWriteIndex].descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER; + writeDescriptorSets[descriptorWriteIndex].pBufferInfo = &bufferDescriptorInfos[bufferDescriptorIndex]; + writeDescriptorSets[descriptorWriteIndex].dstBinding = + job->computeJobDescriptor.pipeline.constantBufferBindings[currentRootConstantIndex].slotIndex; + writeDescriptorSets[descriptorWriteIndex].dstArrayElement = 0; + + bufferDescriptorInfos[bufferDescriptorIndex].buffer = static_cast(allocation.resource.resource); + bufferDescriptorInfos[bufferDescriptorIndex].offset = static_cast(allocation.handle); + bufferDescriptorInfos[bufferDescriptorIndex].range = dataSize; + + bufferDescriptorIndex++; + descriptorWriteIndex++; + } + + // If we are dispatching indirectly, transition the argument resource to indirect argument + if (job->computeJobDescriptor.pipeline.cmdSignature) + { + addBarrier(backendContext, &job->computeJobDescriptor.cmdArgument, FFX_RESOURCE_STATE_INDIRECT_ARGUMENT); + } + + // insert all the barriers + flushBarriers(backendContext, vkCommandBuffer); + + // update all uavs and srvs + backendContext->vkFunctionTable.vkUpdateDescriptorSets(backendContext->device, descriptorWriteIndex, writeDescriptorSets, 0, nullptr); + + // bind pipeline + backendContext->vkFunctionTable.vkCmdBindPipeline(vkCommandBuffer, VK_PIPELINE_BIND_POINT_COMPUTE, reinterpret_cast(job->computeJobDescriptor.pipeline.pipeline)); + + // bind descriptor sets + { + backendContext->vkFunctionTable.vkCmdBindDescriptorSets(vkCommandBuffer, VK_PIPELINE_BIND_POINT_COMPUTE, pipelineLayout->pipelineLayout, 0, 1, &pipelineLayout->descriptorSets[pipelineLayout->descriptorSetIndex], 0, nullptr); + + BackendContext_VK::EffectContext& effectContext = backendContext->pEffectContexts[effectContextId]; + + if (job->computeJobDescriptor.pipeline.staticTextureSrvCount > 0) + backendContext->vkFunctionTable.vkCmdBindDescriptorSets(vkCommandBuffer, VK_PIPELINE_BIND_POINT_COMPUTE, pipelineLayout->pipelineLayout, pipelineLayout->staticTextureSrvSet, 1, &effectContext.bindlessTextureSrvDescriptorSet, 0, nullptr); + + if (job->computeJobDescriptor.pipeline.staticBufferSrvCount > 0) + backendContext->vkFunctionTable.vkCmdBindDescriptorSets(vkCommandBuffer, VK_PIPELINE_BIND_POINT_COMPUTE, pipelineLayout->pipelineLayout, pipelineLayout->staticBufferSrvSet, 1, &effectContext.bindlessBufferSrvDescriptorSet, 0, nullptr); + + if (job->computeJobDescriptor.pipeline.staticTextureUavCount > 0) + backendContext->vkFunctionTable.vkCmdBindDescriptorSets(vkCommandBuffer, VK_PIPELINE_BIND_POINT_COMPUTE, pipelineLayout->pipelineLayout, pipelineLayout->staticTextureUavSet, 1, &effectContext.bindlessTextureUavDescriptorSet, 0, nullptr); + + if (job->computeJobDescriptor.pipeline.staticBufferUavCount > 0) + backendContext->vkFunctionTable.vkCmdBindDescriptorSets(vkCommandBuffer, VK_PIPELINE_BIND_POINT_COMPUTE, pipelineLayout->pipelineLayout, pipelineLayout->staticBufferUavSet, 1, &effectContext.bindlessBufferUavDescriptorSet, 0, nullptr); + } + + // Dispatch (or dispatch indirect) + if (job->computeJobDescriptor.pipeline.cmdSignature) + { + const uint32_t resourceIndex = job->computeJobDescriptor.cmdArgument.internalIndex; + VkBuffer buffer = backendContext->pResources[resourceIndex].bufferResource; + backendContext->vkFunctionTable.vkCmdDispatchIndirect(vkCommandBuffer, buffer, job->computeJobDescriptor.cmdArgumentOffset); + } + else + { + backendContext->vkFunctionTable.vkCmdDispatch(vkCommandBuffer, job->computeJobDescriptor.dimensions[0], job->computeJobDescriptor.dimensions[1], job->computeJobDescriptor.dimensions[2]); + } + + // move to another descriptor set for the next compute render job so that we don't overwrite descriptors in-use + ++pipelineLayout->descriptorSetIndex; + if (pipelineLayout->descriptorSetIndex >= (FFX_MAX_QUEUED_FRAMES * MAX_PIPELINE_USAGE_PER_FRAME)) + pipelineLayout->descriptorSetIndex = 0; + + return FFX_OK; +} + +static FfxErrorCode executeGpuJobCopy(BackendContext_VK* backendContext, FfxGpuJobDescription* job, VkCommandBuffer vkCommandBuffer) +{ + BackendContext_VK::Resource ffxResourceSrc = backendContext->pResources[job->copyJobDescriptor.src.internalIndex]; + BackendContext_VK::Resource ffxResourceDst = backendContext->pResources[job->copyJobDescriptor.dst.internalIndex]; + + addBarrier(backendContext, &job->copyJobDescriptor.src, FFX_RESOURCE_STATE_COPY_SRC); + addBarrier(backendContext, &job->copyJobDescriptor.dst, FFX_RESOURCE_STATE_COPY_DEST); + flushBarriers(backendContext, vkCommandBuffer); + + if (ffxResourceSrc.resourceDescription.type == FFX_RESOURCE_TYPE_BUFFER && ffxResourceDst.resourceDescription.type == FFX_RESOURCE_TYPE_BUFFER) + { + VkBuffer vkResourceSrc = ffxResourceSrc.bufferResource; + VkBuffer vkResourceDst = ffxResourceDst.bufferResource; + + VkBufferCopy bufferCopy = {}; + + bufferCopy.dstOffset = job->copyJobDescriptor.dstOffset; + bufferCopy.srcOffset = job->copyJobDescriptor.srcOffset; + bufferCopy.size = job->copyJobDescriptor.size > 0 ? job->copyJobDescriptor.size : ffxResourceSrc.resourceDescription.width; + + backendContext->vkFunctionTable.vkCmdCopyBuffer(vkCommandBuffer, vkResourceSrc, vkResourceDst, 1, &bufferCopy); + } + else if (ffxResourceSrc.resourceDescription.type == FFX_RESOURCE_TYPE_BUFFER && ffxResourceDst.resourceDescription.type != FFX_RESOURCE_TYPE_BUFFER) + { + VkBuffer vkResourceSrc = ffxResourceSrc.bufferResource; + VkImage vkResourceDst = ffxResourceDst.imageResource; + + VkImageSubresourceLayers subresourceLayers = {}; + + subresourceLayers.aspectMask = getImageAspect(ffxResourceDst.resourceDescription.usage); + subresourceLayers.baseArrayLayer = 0; + subresourceLayers.layerCount = 1; + subresourceLayers.mipLevel = 0; + + VkOffset3D offset = {}; + + offset.x = 0; + offset.y = 0; + offset.z = 0; + + VkExtent3D extent = {}; + + extent.width = ffxResourceDst.resourceDescription.width; + extent.height = ffxResourceDst.resourceDescription.height; + extent.depth = ffxResourceDst.resourceDescription.depth; + + // TODO: account for source buffer offset + VkBufferImageCopy bufferImageCopy = {}; + + bufferImageCopy.bufferOffset = 0; + bufferImageCopy.bufferRowLength = 0; + bufferImageCopy.bufferImageHeight = 0; + bufferImageCopy.imageSubresource = subresourceLayers; + bufferImageCopy.imageOffset = offset; + bufferImageCopy.imageExtent = extent; + + backendContext->vkFunctionTable.vkCmdCopyBufferToImage(vkCommandBuffer, vkResourceSrc, vkResourceDst, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, 1, &bufferImageCopy); + } + else + { + bool isSrcDepth = FFX_CONTAINS_FLAG(ffxResourceSrc.resourceDescription.usage, FFX_RESOURCE_USAGE_DEPTHTARGET); + bool isDstDepth = FFX_CONTAINS_FLAG(ffxResourceDst.resourceDescription.usage, FFX_RESOURCE_USAGE_DEPTHTARGET); + FFX_ASSERT_MESSAGE(isSrcDepth == isDstDepth, "Copy operations aren't allowed between depth and color textures in the vulkan backend of the FFX SDK."); + + #define FFX_MAX_IMAGE_COPY_MIPS 14 // Will handle 4k down to 1x1 + VkImageCopy imageCopies[FFX_MAX_IMAGE_COPY_MIPS]; + VkImage vkResourceSrc = ffxResourceSrc.imageResource; + VkImage vkResourceDst = ffxResourceDst.imageResource; + + uint32_t numMipsToCopy = FFX_MINIMUM(ffxResourceSrc.resourceDescription.mipCount, ffxResourceDst.resourceDescription.mipCount); + + for (uint32_t mip = 0; mip < numMipsToCopy; mip++) + { + VkImageSubresourceLayers srcSubresourceLayers = {}; + + srcSubresourceLayers.aspectMask = getImageAspect(ffxResourceSrc.resourceDescription.usage); + srcSubresourceLayers.baseArrayLayer = 0; + srcSubresourceLayers.layerCount = 1; + srcSubresourceLayers.mipLevel = mip; + + VkImageSubresourceLayers dstSubresourceLayers = {}; + + dstSubresourceLayers.aspectMask = getImageAspect(ffxResourceDst.resourceDescription.usage); + dstSubresourceLayers.baseArrayLayer = 0; + dstSubresourceLayers.layerCount = 1; + dstSubresourceLayers.mipLevel = mip; + + VkOffset3D offset = {}; + + offset.x = 0; + offset.y = 0; + offset.z = 0; + + VkExtent3D extent = {}; + + extent.width = ffxResourceSrc.resourceDescription.width / (mip + 1); + extent.height = ffxResourceSrc.resourceDescription.height / (mip + 1); + extent.depth = ffxResourceSrc.resourceDescription.depth / (mip + 1); + + VkImageCopy& copyRegion = imageCopies[mip]; + + copyRegion.srcSubresource = srcSubresourceLayers; + copyRegion.srcOffset = offset; + copyRegion.dstSubresource = dstSubresourceLayers; + copyRegion.dstOffset = offset; + copyRegion.extent = extent; + } + + backendContext->vkFunctionTable.vkCmdCopyImage(vkCommandBuffer, vkResourceSrc, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, vkResourceDst, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, numMipsToCopy, imageCopies); + } + + return FFX_OK; +} + +static FfxErrorCode executeGpuJobBarrier(BackendContext_VK* backendContext, FfxGpuJobDescription* job, VkCommandBuffer vkCommandBuffer) +{ + addBarrier(backendContext, &job->barrierDescriptor.resource, job->barrierDescriptor.newState); + flushBarriers(backendContext, vkCommandBuffer); + + return FFX_OK; +} + +static FfxErrorCode executeGpuJobTimestamp(BackendContext_VK* backendContext, FfxGpuJobDescription* job, VkCommandBuffer vkCommandBuffer) +{ + return FFX_OK; +} + +static FfxErrorCode executeGpuJobClearFloat(BackendContext_VK* backendContext, FfxGpuJobDescription* job, VkCommandBuffer vkCommandBuffer) +{ + uint32_t idx = job->clearJobDescriptor.target.internalIndex; + BackendContext_VK::Resource ffxResource = backendContext->pResources[idx]; + + if (ffxResource.resourceDescription.type == FFX_RESOURCE_TYPE_BUFFER) + { + addBarrier(backendContext, &job->clearJobDescriptor.target, FFX_RESOURCE_STATE_COPY_DEST); + flushBarriers(backendContext, vkCommandBuffer); + + VkBuffer vkResource = ffxResource.bufferResource; + + backendContext->vkFunctionTable.vkCmdFillBuffer(vkCommandBuffer, vkResource, 0, VK_WHOLE_SIZE, (uint32_t)job->clearJobDescriptor.color[0]); + } + else + { + addBarrier(backendContext, &job->clearJobDescriptor.target, FFX_RESOURCE_STATE_COPY_DEST); + flushBarriers(backendContext, vkCommandBuffer); + + VkImage vkResource = ffxResource.imageResource; + + VkClearColorValue clearColorValue = {}; + + clearColorValue.float32[0] = job->clearJobDescriptor.color[0]; + clearColorValue.float32[1] = job->clearJobDescriptor.color[1]; + clearColorValue.float32[2] = job->clearJobDescriptor.color[2]; + clearColorValue.float32[3] = job->clearJobDescriptor.color[3]; + + VkImageSubresourceRange range; + range.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + range.baseMipLevel = 0; + range.levelCount = ffxResource.resourceDescription.mipCount; + range.baseArrayLayer = 0; + if (ffxResource.resourceDescription.type == FFX_RESOURCE_TYPE_TEXTURE3D) + range.layerCount = 1; + else + range.layerCount = ffxResource.resourceDescription.depth; // in that case depth is the number of layers + + backendContext->vkFunctionTable.vkCmdClearColorImage(vkCommandBuffer, vkResource, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &clearColorValue, 1, &range); + } + + return FFX_OK; +} + +FfxErrorCode ExecuteGpuJobsVK(FfxInterface* backendInterface, FfxCommandList commandList, FfxUInt32 effectContextId) +{ + FFX_ASSERT(nullptr != backendInterface); + BackendContext_VK* backendContext = (BackendContext_VK*)backendInterface->scratchBuffer; + + FFX_ASSERT(nullptr != commandList); + VkCommandBuffer vkCommandBuffer = reinterpret_cast(commandList); + + FfxErrorCode errorCode = FFX_OK; + + // execute all renderjobs + for (uint32_t i = 0; i < backendContext->gpuJobCount; ++i) + { + FfxGpuJobDescription* gpuJob = &backendContext->pGpuJobs[i]; + + // If we have a label for the job, drop a marker for it + if (gpuJob->jobLabel[0]) { + beginMarkerVK(backendContext, vkCommandBuffer, gpuJob->jobLabel); + } + + + switch (gpuJob->jobType) + { + case FFX_GPU_JOB_CLEAR_FLOAT: + { + errorCode = executeGpuJobClearFloat(backendContext, gpuJob, vkCommandBuffer); + break; + } + case FFX_GPU_JOB_COPY: + { + errorCode = executeGpuJobCopy(backendContext, gpuJob, vkCommandBuffer); + break; + } + case FFX_GPU_JOB_COMPUTE: + { + errorCode = executeGpuJobCompute(backendContext, gpuJob, vkCommandBuffer, effectContextId); + break; + } + case FFX_GPU_JOB_BARRIER: + { + errorCode = executeGpuJobBarrier(backendContext, gpuJob, vkCommandBuffer); + break; + } + default:; + } + + if (gpuJob->jobLabel[0]) { + endMarkerVK(backendContext, vkCommandBuffer); + } + } + + // check the execute function returned cleanly. + FFX_RETURN_ON_ERROR( + errorCode == FFX_OK, + FFX_ERROR_BACKEND_API_ERROR); + + backendContext->gpuJobCount = 0; + + return FFX_OK; +} + +FfxErrorCode BreadcrumbsAllocBlockVK( + FfxInterface* backendInterface, + uint64_t blockBytes, + FfxBreadcrumbsBlockData* blockData) +{ + FFX_ASSERT(NULL != backendInterface); + FFX_ASSERT(NULL != blockData); + + BackendContext_VK* backendContext = (BackendContext_VK*)backendInterface->scratchBuffer; + void* mappedMemory = nullptr; + uint64_t baseAddress = 0; + + VkBufferCreateInfo bufferInfo = {}; + bufferInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO; + bufferInfo.pNext = nullptr; + bufferInfo.flags = 0; + bufferInfo.size = blockBytes; + bufferInfo.usage = VK_BUFFER_USAGE_TRANSFER_DST_BIT; + bufferInfo.sharingMode = VK_SHARING_MODE_EXCLUSIVE; + bufferInfo.queueFamilyIndexCount = 0; + bufferInfo.pQueueFamilyIndices = nullptr; + + VkBuffer buffer = VK_NULL_HANDLE; + if (backendContext->vkFunctionTable.vkCreateBuffer(backendContext->device, &bufferInfo, nullptr, &buffer) == VK_SUCCESS) + { + VkMemoryAllocateInfo allocInfo = { VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO, nullptr }; + allocInfo.allocationSize = blockBytes; + allocInfo.memoryTypeIndex = backendContext->breadcrumbsMemoryIndex; + + VkMemoryDedicatedAllocateInfo dedicatedAlloc = { VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO, nullptr }; + if (FFX_CONTAINS_FLAG(backendContext->breadcrumbsFlags, BackendContext_VK::BREADCRUMBS_DEDICATED_MEMORY_ENABLED)) + { + dedicatedAlloc.image = VK_NULL_HANDLE; + dedicatedAlloc.buffer = buffer; + dedicatedAlloc.pNext = allocInfo.pNext; + allocInfo.pNext = &dedicatedAlloc; + } + + VkDeviceMemory memory = VK_NULL_HANDLE; + if (backendContext->vkFunctionTable.vkAllocateMemory(backendContext->device, &allocInfo, nullptr, &memory) == VK_SUCCESS) + { + if (backendContext->vkFunctionTable.vkBindBufferMemory(backendContext->device, buffer, memory, 0) == VK_SUCCESS) + { + if (mappedMemory || backendContext->vkFunctionTable.vkMapMemory(backendContext->device, memory, 0, blockBytes, 0, &mappedMemory) == VK_SUCCESS) + { + blockData->memory = mappedMemory; + blockData->heap = (void*)memory; + blockData->buffer = (void*)buffer; + blockData->baseAddress = baseAddress; + return FFX_OK; + } + } + backendContext->vkFunctionTable.vkFreeMemory(backendContext->device, memory, nullptr); + } + } + backendContext->vkFunctionTable.vkDestroyBuffer(backendContext->device, buffer, nullptr); + return FFX_ERROR_BACKEND_API_ERROR; +} + +void BreadcrumbsFreeBlockVK( + FfxInterface* backendInterface, + FfxBreadcrumbsBlockData* blockData) +{ + FFX_ASSERT(NULL != backendInterface); + FFX_ASSERT(NULL != blockData); + + BackendContext_VK* backendContext = (BackendContext_VK*)backendInterface->scratchBuffer; + if (blockData->memory && blockData->baseAddress == 0) + { + backendContext->vkFunctionTable.vkUnmapMemory(backendContext->device, (VkDeviceMemory)blockData->heap); + blockData->memory = nullptr; + } + if (blockData->buffer) + { + backendContext->vkFunctionTable.vkDestroyBuffer(backendContext->device, (VkBuffer)blockData->buffer, nullptr); + blockData->buffer = nullptr; + } + if (blockData->heap) + { + backendContext->vkFunctionTable.vkFreeMemory(backendContext->device, (VkDeviceMemory)blockData->heap, nullptr); + blockData->heap = nullptr; + } +} + +void BreadcrumbsWriteVK( + FfxInterface* backendInterface, + FfxCommandList commandList, + uint32_t value, + uint64_t gpuLocation, + void* gpuBuffer, + bool isBegin) +{ + FFX_ASSERT(NULL != backendInterface); + FFX_ASSERT(NULL != gpuBuffer); + + BackendContext_VK* backendContext = (BackendContext_VK*)backendInterface->scratchBuffer; + if (FFX_CONTAINS_FLAG(backendContext->breadcrumbsFlags, BackendContext_VK::BREADCRUMBS_BUFFER_MARKER_ENABLED)) + { + if (FFX_CONTAINS_FLAG(backendContext->breadcrumbsFlags, BackendContext_VK::BREADCRUMBS_SYNCHRONIZATION2_ENABLED)) + { + backendContext->vkFunctionTable.vkCmdWriteBufferMarker2AMD((VkCommandBuffer)commandList, + isBegin ? VK_PIPELINE_STAGE_2_NONE_KHR : VK_PIPELINE_STAGE_2_ALL_GRAPHICS_BIT_KHR, + (VkBuffer)gpuBuffer, gpuLocation, value); + } + else + { + backendContext->vkFunctionTable.vkCmdWriteBufferMarkerAMD((VkCommandBuffer)commandList, + isBegin ? VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT : VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT, + (VkBuffer)gpuBuffer, gpuLocation, value); + } + } + else + { + backendContext->vkFunctionTable.vkCmdFillBuffer((VkCommandBuffer)commandList, (VkBuffer)gpuBuffer, gpuLocation, sizeof(uint32_t), value); + } +} + +void BreadcrumbsPrintDeviceInfoVK( + FfxInterface* backendInterface, + FfxAllocationCallbacks* allocs, + bool extendedInfo, + char** printBuffer, + size_t* printSize) +{ + FFX_ASSERT(NULL != backendInterface); + FFX_ASSERT(NULL != allocs); + FFX_ASSERT(NULL != printBuffer); + FFX_ASSERT(NULL != printSize); + + BackendContext_VK* backendContext = (BackendContext_VK*)backendInterface->scratchBuffer; + char* buff = *printBuffer; + size_t buffSize = *printSize; + + VkPhysicalDeviceProperties devProps = {}; + VkPhysicalDeviceFeatures devFeatures = {}; + vkGetPhysicalDeviceProperties(backendContext->physicalDevice, &devProps); + vkGetPhysicalDeviceFeatures(backendContext->physicalDevice, &devFeatures); + + FFX_BREADCRUMBS_APPEND_STRING(buff, buffSize, "[VkPhysicalDeviceProperties]\n" FFX_BREADCRUMBS_PRINTING_INDENT "apiVersion: "); + FFX_BREADCRUMBS_APPEND_UINT(buff, buffSize, VK_API_VERSION_MAJOR(devProps.apiVersion)); + FFX_BREADCRUMBS_APPEND_STRING(buff, buffSize, "."); + FFX_BREADCRUMBS_APPEND_UINT(buff, buffSize, VK_API_VERSION_MINOR(devProps.apiVersion)); + FFX_BREADCRUMBS_APPEND_STRING(buff, buffSize, "."); + FFX_BREADCRUMBS_APPEND_UINT(buff, buffSize, VK_API_VERSION_PATCH(devProps.apiVersion)); + FFX_BREADCRUMBS_APPEND_STRING(buff, buffSize, "\n"); + + FFX_BREADCRUMBS_PRINT_HEX32(buff, buffSize, devProps, driverVersion); + FFX_BREADCRUMBS_PRINT_HEX32(buff, buffSize, devProps, vendorID); + FFX_BREADCRUMBS_PRINT_HEX32(buff, buffSize, devProps, deviceID); + + FFX_BREADCRUMBS_APPEND_STRING(buff, buffSize, FFX_BREADCRUMBS_PRINTING_INDENT "deviceType: "); + switch (devProps.deviceType) + { + case VK_PHYSICAL_DEVICE_TYPE_OTHER: + { + FFX_BREADCRUMBS_APPEND_STRING(buff, buffSize, "OTHER\n"); + break; + } + case VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU: + { + FFX_BREADCRUMBS_APPEND_STRING(buff, buffSize, "INTEGRATED_GPU\n"); + break; + } + case VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU: + { + FFX_BREADCRUMBS_APPEND_STRING(buff, buffSize, "DISCRETE_GPU\n"); + break; + } + case VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU: + { + FFX_BREADCRUMBS_APPEND_STRING(buff, buffSize, "VIRTUAL_GPU\n"); + break; + } + case VK_PHYSICAL_DEVICE_TYPE_CPU: + { + FFX_BREADCRUMBS_APPEND_STRING(buff, buffSize, "CPU\n"); + break; + } + default: + { + FFX_BREADCRUMBS_APPEND_UINT(buff, buffSize, devProps.deviceType); + FFX_BREADCRUMBS_APPEND_STRING(buff, buffSize, "\n"); + break; + } + } + + FFX_BREADCRUMBS_PRINT_STRING(buff, buffSize, devProps, deviceName); + FFX_BREADCRUMBS_APPEND_STRING(buff, buffSize, FFX_BREADCRUMBS_PRINTING_INDENT "pipelineCacheUUID: "); + FFX_BREADCRUMBS_PRINT_HEX_BYTE(buff, buffSize, devProps.pipelineCacheUUID[0]); + FFX_BREADCRUMBS_PRINT_HEX_BYTE(buff, buffSize, devProps.pipelineCacheUUID[1]); + FFX_BREADCRUMBS_PRINT_HEX_BYTE(buff, buffSize, devProps.pipelineCacheUUID[2]); + FFX_BREADCRUMBS_PRINT_HEX_BYTE(buff, buffSize, devProps.pipelineCacheUUID[3]); + + for (uint8_t i = 4; i < 12; i += 2) + { + FFX_BREADCRUMBS_APPEND_STRING(buff, buffSize, "-"); + FFX_BREADCRUMBS_PRINT_HEX_BYTE(buff, buffSize, devProps.pipelineCacheUUID[i]); + FFX_BREADCRUMBS_PRINT_HEX_BYTE(buff, buffSize, devProps.pipelineCacheUUID[i + 1]); + } + + FFX_BREADCRUMBS_PRINT_HEX_BYTE(buff, buffSize, devProps.pipelineCacheUUID[12]); + FFX_BREADCRUMBS_PRINT_HEX_BYTE(buff, buffSize, devProps.pipelineCacheUUID[13]); + FFX_BREADCRUMBS_PRINT_HEX_BYTE(buff, buffSize, devProps.pipelineCacheUUID[14]); + FFX_BREADCRUMBS_PRINT_HEX_BYTE(buff, buffSize, devProps.pipelineCacheUUID[15]); + + // Helper for printing device limits uint32_t. +#define BREAD_PRINT_LIMIT(name) \ + FFX_BREADCRUMBS_APPEND_STRING(buff, buffSize, FFX_BREADCRUMBS_PRINTING_INDENT); \ + FFX_BREADCRUMBS_PRINT_UINT(buff, buffSize, devProps.limits, name) + // Helper for printing device limits uint64_t. +#define BREAD_PRINT_LIMIT64(name) \ + FFX_BREADCRUMBS_APPEND_STRING(buff, buffSize, FFX_BREADCRUMBS_PRINTING_INDENT); \ + FFX_BREADCRUMBS_PRINT_UINT64(buff, buffSize, devProps.limits, name) + // Helper for printing device limits uint64_t. +#define BREAD_PRINT_LIMIT_FLOAT(name) \ + FFX_BREADCRUMBS_APPEND_STRING(buff, buffSize, FFX_BREADCRUMBS_PRINTING_INDENT); \ + FFX_BREADCRUMBS_PRINT_FLOAT(buff, buffSize, devProps.limits, name) + // Helper for printing device limits as 32bit hexadecimal. +#define BREAD_PRINT_LIMIT_HEX(name) \ + FFX_BREADCRUMBS_APPEND_STRING(buff, buffSize, FFX_BREADCRUMBS_PRINTING_INDENT); \ + FFX_BREADCRUMBS_PRINT_HEX32(buff, buffSize, devProps.limits, name) + + FFX_BREADCRUMBS_APPEND_STRING(buff, buffSize, "\n" FFX_BREADCRUMBS_PRINTING_INDENT "limits: [VkPhysicalDeviceLimits]\n"); + BREAD_PRINT_LIMIT(maxImageDimension1D); + BREAD_PRINT_LIMIT(maxImageDimension2D); + BREAD_PRINT_LIMIT(maxImageDimension3D); + BREAD_PRINT_LIMIT(maxImageDimensionCube); + BREAD_PRINT_LIMIT(maxImageArrayLayers); + BREAD_PRINT_LIMIT(maxTexelBufferElements); + BREAD_PRINT_LIMIT(maxUniformBufferRange); + BREAD_PRINT_LIMIT(maxStorageBufferRange); + BREAD_PRINT_LIMIT(maxPushConstantsSize); + BREAD_PRINT_LIMIT(maxMemoryAllocationCount); + BREAD_PRINT_LIMIT(maxSamplerAllocationCount); + BREAD_PRINT_LIMIT64(bufferImageGranularity); + BREAD_PRINT_LIMIT64(sparseAddressSpaceSize); + + if (extendedInfo) + { + BREAD_PRINT_LIMIT(maxBoundDescriptorSets); + BREAD_PRINT_LIMIT(maxPerStageDescriptorSamplers); + BREAD_PRINT_LIMIT(maxPerStageDescriptorUniformBuffers); + BREAD_PRINT_LIMIT(maxPerStageDescriptorStorageBuffers); + BREAD_PRINT_LIMIT(maxPerStageDescriptorSampledImages); + BREAD_PRINT_LIMIT(maxPerStageDescriptorStorageImages); + BREAD_PRINT_LIMIT(maxPerStageDescriptorInputAttachments); + BREAD_PRINT_LIMIT(maxPerStageResources); + BREAD_PRINT_LIMIT(maxDescriptorSetSamplers); + BREAD_PRINT_LIMIT(maxDescriptorSetUniformBuffers); + BREAD_PRINT_LIMIT(maxDescriptorSetUniformBuffersDynamic); + BREAD_PRINT_LIMIT(maxDescriptorSetStorageBuffers); + BREAD_PRINT_LIMIT(maxDescriptorSetStorageBuffersDynamic); + BREAD_PRINT_LIMIT(maxDescriptorSetSampledImages); + BREAD_PRINT_LIMIT(maxDescriptorSetStorageImages); + BREAD_PRINT_LIMIT(maxDescriptorSetInputAttachments); + BREAD_PRINT_LIMIT(maxVertexInputAttributes); + BREAD_PRINT_LIMIT(maxVertexInputBindings); + BREAD_PRINT_LIMIT(maxVertexInputAttributeOffset); + BREAD_PRINT_LIMIT(maxVertexInputBindingStride); + BREAD_PRINT_LIMIT(maxVertexOutputComponents); + BREAD_PRINT_LIMIT(maxTessellationGenerationLevel); + BREAD_PRINT_LIMIT(maxTessellationPatchSize); + BREAD_PRINT_LIMIT(maxTessellationControlPerVertexInputComponents); + BREAD_PRINT_LIMIT(maxTessellationControlPerVertexOutputComponents); + BREAD_PRINT_LIMIT(maxTessellationControlPerPatchOutputComponents); + BREAD_PRINT_LIMIT(maxTessellationControlTotalOutputComponents); + BREAD_PRINT_LIMIT(maxTessellationEvaluationInputComponents); + BREAD_PRINT_LIMIT(maxTessellationEvaluationOutputComponents); + BREAD_PRINT_LIMIT(maxGeometryShaderInvocations); + BREAD_PRINT_LIMIT(maxGeometryInputComponents); + BREAD_PRINT_LIMIT(maxGeometryOutputComponents); + BREAD_PRINT_LIMIT(maxGeometryTotalOutputComponents); + BREAD_PRINT_LIMIT(maxFragmentInputComponents); + BREAD_PRINT_LIMIT(maxFragmentOutputAttachments); + BREAD_PRINT_LIMIT(maxFragmentDualSrcAttachments); + BREAD_PRINT_LIMIT(maxFragmentCombinedOutputResources); + BREAD_PRINT_LIMIT(maxComputeSharedMemorySize); + + FFX_BREADCRUMBS_APPEND_STRING(buff, buffSize, FFX_BREADCRUMBS_PRINTING_INDENT FFX_BREADCRUMBS_PRINTING_INDENT "maxComputeWorkGroupCount: [ "); + FFX_BREADCRUMBS_APPEND_UINT(buff, buffSize, devProps.limits.maxComputeWorkGroupCount[0]); + FFX_BREADCRUMBS_APPEND_STRING(buff, buffSize, ", "); + FFX_BREADCRUMBS_APPEND_UINT(buff, buffSize, devProps.limits.maxComputeWorkGroupCount[1]); + FFX_BREADCRUMBS_APPEND_STRING(buff, buffSize, ", "); + FFX_BREADCRUMBS_APPEND_UINT(buff, buffSize, devProps.limits.maxComputeWorkGroupCount[2]); + FFX_BREADCRUMBS_APPEND_STRING(buff, buffSize, " ]\n"); + + BREAD_PRINT_LIMIT(maxComputeWorkGroupInvocations); + + FFX_BREADCRUMBS_APPEND_STRING(buff, buffSize, FFX_BREADCRUMBS_PRINTING_INDENT FFX_BREADCRUMBS_PRINTING_INDENT "maxComputeWorkGroupSize: [ "); + FFX_BREADCRUMBS_APPEND_UINT(buff, buffSize, devProps.limits.maxComputeWorkGroupSize[0]); + FFX_BREADCRUMBS_APPEND_STRING(buff, buffSize, ", "); + FFX_BREADCRUMBS_APPEND_UINT(buff, buffSize, devProps.limits.maxComputeWorkGroupSize[1]); + FFX_BREADCRUMBS_APPEND_STRING(buff, buffSize, ", "); + FFX_BREADCRUMBS_APPEND_UINT(buff, buffSize, devProps.limits.maxComputeWorkGroupSize[2]); + FFX_BREADCRUMBS_APPEND_STRING(buff, buffSize, " ]\n"); + + BREAD_PRINT_LIMIT(subPixelPrecisionBits); + BREAD_PRINT_LIMIT(subTexelPrecisionBits); + BREAD_PRINT_LIMIT(mipmapPrecisionBits); + BREAD_PRINT_LIMIT(maxDrawIndexedIndexValue); + BREAD_PRINT_LIMIT(maxDrawIndirectCount); + BREAD_PRINT_LIMIT_FLOAT(maxSamplerLodBias); + BREAD_PRINT_LIMIT_FLOAT(maxSamplerAnisotropy); + BREAD_PRINT_LIMIT(maxViewports); + + FFX_BREADCRUMBS_APPEND_STRING(buff, buffSize, FFX_BREADCRUMBS_PRINTING_INDENT FFX_BREADCRUMBS_PRINTING_INDENT "maxViewportDimensions: [ "); + FFX_BREADCRUMBS_APPEND_UINT(buff, buffSize, devProps.limits.maxViewportDimensions[0]); + FFX_BREADCRUMBS_APPEND_STRING(buff, buffSize, ", "); + FFX_BREADCRUMBS_APPEND_UINT(buff, buffSize, devProps.limits.maxViewportDimensions[1]); + FFX_BREADCRUMBS_APPEND_STRING(buff, buffSize, " ]\n" FFX_BREADCRUMBS_PRINTING_INDENT FFX_BREADCRUMBS_PRINTING_INDENT "viewportBoundsRange: [ "); + FFX_BREADCRUMBS_APPEND_FLOAT(buff, buffSize, devProps.limits.viewportBoundsRange[0]); + FFX_BREADCRUMBS_APPEND_STRING(buff, buffSize, ", "); + FFX_BREADCRUMBS_APPEND_FLOAT(buff, buffSize, devProps.limits.viewportBoundsRange[1]); + FFX_BREADCRUMBS_APPEND_STRING(buff, buffSize, " ]\n"); + + BREAD_PRINT_LIMIT(viewportSubPixelBits); + BREAD_PRINT_LIMIT64(minMemoryMapAlignment); + BREAD_PRINT_LIMIT64(minMemoryMapAlignment); + BREAD_PRINT_LIMIT64(minTexelBufferOffsetAlignment); + BREAD_PRINT_LIMIT64(minUniformBufferOffsetAlignment); + BREAD_PRINT_LIMIT64(minStorageBufferOffsetAlignment); + BREAD_PRINT_LIMIT(minTexelOffset); + BREAD_PRINT_LIMIT(maxTexelOffset); + BREAD_PRINT_LIMIT(minTexelGatherOffset); + BREAD_PRINT_LIMIT(maxTexelGatherOffset); + BREAD_PRINT_LIMIT_FLOAT(minInterpolationOffset); + BREAD_PRINT_LIMIT_FLOAT(maxInterpolationOffset); + BREAD_PRINT_LIMIT(subPixelInterpolationOffsetBits); + BREAD_PRINT_LIMIT(maxFramebufferWidth); + BREAD_PRINT_LIMIT(maxFramebufferHeight); + BREAD_PRINT_LIMIT(maxFramebufferLayers); + BREAD_PRINT_LIMIT_HEX(framebufferColorSampleCounts); + BREAD_PRINT_LIMIT_HEX(framebufferDepthSampleCounts); + BREAD_PRINT_LIMIT_HEX(framebufferStencilSampleCounts); + BREAD_PRINT_LIMIT_HEX(framebufferNoAttachmentsSampleCounts); + BREAD_PRINT_LIMIT(maxColorAttachments); + BREAD_PRINT_LIMIT_HEX(sampledImageColorSampleCounts); + BREAD_PRINT_LIMIT_HEX(sampledImageIntegerSampleCounts); + BREAD_PRINT_LIMIT_HEX(sampledImageDepthSampleCounts); + BREAD_PRINT_LIMIT_HEX(sampledImageStencilSampleCounts); + BREAD_PRINT_LIMIT_HEX(storageImageSampleCounts); + BREAD_PRINT_LIMIT(maxSampleMaskWords); + + FFX_BREADCRUMBS_APPEND_STRING(buff, buffSize, FFX_BREADCRUMBS_PRINTING_INDENT); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devProps.limits, timestampComputeAndGraphics); + + BREAD_PRINT_LIMIT_FLOAT(timestampPeriod); + BREAD_PRINT_LIMIT(maxClipDistances); + BREAD_PRINT_LIMIT(maxCullDistances); + BREAD_PRINT_LIMIT(maxCombinedClipAndCullDistances); + BREAD_PRINT_LIMIT(discreteQueuePriorities); + + FFX_BREADCRUMBS_APPEND_STRING(buff, buffSize, FFX_BREADCRUMBS_PRINTING_INDENT FFX_BREADCRUMBS_PRINTING_INDENT "pointSizeRange: [ "); + FFX_BREADCRUMBS_APPEND_FLOAT(buff, buffSize, devProps.limits.pointSizeRange[0]); + FFX_BREADCRUMBS_APPEND_STRING(buff, buffSize, ", "); + FFX_BREADCRUMBS_APPEND_FLOAT(buff, buffSize, devProps.limits.pointSizeRange[1]); + FFX_BREADCRUMBS_APPEND_STRING(buff, buffSize, " ]\n" FFX_BREADCRUMBS_PRINTING_INDENT FFX_BREADCRUMBS_PRINTING_INDENT "lineWidthRange: [ "); + FFX_BREADCRUMBS_APPEND_FLOAT(buff, buffSize, devProps.limits.lineWidthRange[0]); + FFX_BREADCRUMBS_APPEND_STRING(buff, buffSize, ", "); + FFX_BREADCRUMBS_APPEND_FLOAT(buff, buffSize, devProps.limits.lineWidthRange[1]); + FFX_BREADCRUMBS_APPEND_STRING(buff, buffSize, " ]\n"); + + BREAD_PRINT_LIMIT_FLOAT(pointSizeGranularity); + BREAD_PRINT_LIMIT_FLOAT(lineWidthGranularity); + + FFX_BREADCRUMBS_APPEND_STRING(buff, buffSize, FFX_BREADCRUMBS_PRINTING_INDENT); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devProps.limits, strictLines); + FFX_BREADCRUMBS_APPEND_STRING(buff, buffSize, FFX_BREADCRUMBS_PRINTING_INDENT); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devProps.limits, standardSampleLocations); + + BREAD_PRINT_LIMIT64(optimalBufferCopyOffsetAlignment); + BREAD_PRINT_LIMIT64(optimalBufferCopyRowPitchAlignment); + BREAD_PRINT_LIMIT64(nonCoherentAtomSize); + } +#undef BREAD_PRINT_LIMIT +#undef BREAD_PRINT_LIMIT64 +#undef BREAD_PRINT_LIMIT_HEX + + FFX_BREADCRUMBS_APPEND_STRING(buff, buffSize, FFX_BREADCRUMBS_PRINTING_INDENT "sparseProperties: [VkPhysicalDeviceSparseProperties]\n" FFX_BREADCRUMBS_PRINTING_INDENT); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devProps.sparseProperties, residencyStandard2DBlockShape); + FFX_BREADCRUMBS_APPEND_STRING(buff, buffSize, FFX_BREADCRUMBS_PRINTING_INDENT); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devProps.sparseProperties, residencyStandard2DMultisampleBlockShape); + FFX_BREADCRUMBS_APPEND_STRING(buff, buffSize, FFX_BREADCRUMBS_PRINTING_INDENT); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devProps.sparseProperties, residencyStandard3DBlockShape); + FFX_BREADCRUMBS_APPEND_STRING(buff, buffSize, FFX_BREADCRUMBS_PRINTING_INDENT); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devProps.sparseProperties, residencyAlignedMipSize); + FFX_BREADCRUMBS_APPEND_STRING(buff, buffSize, FFX_BREADCRUMBS_PRINTING_INDENT); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devProps.sparseProperties, residencyNonResidentStrict); + + FFX_BREADCRUMBS_APPEND_STRING(buff, buffSize, "[VkPhysicalDeviceFeatures]\n"); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, robustBufferAccess); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, fullDrawIndexUint32); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, imageCubeArray); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, independentBlend); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, geometryShader); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, tessellationShader); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, sampleRateShading); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, dualSrcBlend); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, logicOp); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, multiDrawIndirect); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, drawIndirectFirstInstance); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, depthClamp); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, depthBiasClamp); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, fillModeNonSolid); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, depthBounds); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, wideLines); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, largePoints); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, alphaToOne); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, multiViewport); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, samplerAnisotropy); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, textureCompressionETC2); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, textureCompressionASTC_LDR); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, textureCompressionBC); + + if (extendedInfo) + { + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, occlusionQueryPrecise); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, pipelineStatisticsQuery); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, vertexPipelineStoresAndAtomics); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, fragmentStoresAndAtomics); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, shaderTessellationAndGeometryPointSize); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, shaderImageGatherExtended); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, shaderStorageImageExtendedFormats); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, shaderStorageImageMultisample); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, shaderStorageImageReadWithoutFormat); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, shaderStorageImageWriteWithoutFormat); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, shaderUniformBufferArrayDynamicIndexing); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, shaderSampledImageArrayDynamicIndexing); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, shaderStorageBufferArrayDynamicIndexing); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, shaderStorageImageArrayDynamicIndexing); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, shaderClipDistance); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, shaderCullDistance); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, shaderFloat64); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, shaderInt64); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, shaderInt16); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, shaderResourceResidency); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, shaderResourceMinLod); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, sparseBinding); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, sparseResidencyBuffer); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, sparseResidencyImage2D); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, sparseResidencyImage3D); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, sparseResidency2Samples); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, sparseResidency4Samples); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, sparseResidency8Samples); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, sparseResidency16Samples); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, sparseResidencyAliased); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, variableMultisampleRate); + FFX_BREADCRUMBS_PRINT_BOOL(buff, buffSize, devFeatures, inheritedQueries); + } + + FFX_BREADCRUMBS_APPEND_STRING(buff, buffSize, "\n"); + *printBuffer = buff; + *printSize = buffSize; +} + +void RegisterConstantBufferAllocatorVK(FfxInterface*, FfxConstantBufferAllocator fpConstantAllocator) +{ + s_fpConstantAllocator = fpConstantAllocator; +} + +FfxCommandQueue ffxGetCommandQueueVK(VkQueue commandQueue) +{ + FFX_ASSERT(commandQueue != VK_NULL_HANDLE); + return reinterpret_cast(commandQueue); +} + +FfxSwapchain ffxGetSwapchainVK(VkSwapchainKHR swapchain) +{ + FFX_ASSERT(swapchain != VK_NULL_HANDLE); + return reinterpret_cast(swapchain); +} + +VkSwapchainKHR ffxGetVKSwapchain(FfxSwapchain ffxSwapchain) +{ + return reinterpret_cast(ffxSwapchain); +} diff --git a/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/frameinterpolation/ffx_frameinterpolation_compute_game_vector_field_inpainting_pyramid_pass.glsl b/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/frameinterpolation/ffx_frameinterpolation_compute_game_vector_field_inpainting_pyramid_pass.glsl new file mode 100644 index 00000000..5ece11ae --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/frameinterpolation/ffx_frameinterpolation_compute_game_vector_field_inpainting_pyramid_pass.glsl @@ -0,0 +1,75 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#version 450 + +#extension GL_GOOGLE_include_directive : require +#extension GL_EXT_samplerless_texture_functions : require + +#define FFX_FRAMEINTERPOLATION_BIND_SRV_GAME_MOTION_VECTOR_FIELD_X 0 +#define FFX_FRAMEINTERPOLATION_BIND_SRV_GAME_MOTION_VECTOR_FIELD_Y 1 + +#define FFX_FRAMEINTERPOLATION_BIND_UAV_COUNTERS 2 +#define FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_0 3 +#define FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_1 4 +#define FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_2 5 +#define FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_3 6 +#define FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_4 7 +#define FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_5 8 +#define FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_6 9 +#define FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_7 10 +#define FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_8 11 +#define FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_9 12 +#define FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_10 13 +#define FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_11 14 +#define FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_12 15 + +#define FFX_FRAMEINTERPOLATION_BIND_CB_FRAMEINTERPOLATION 16 +#define FFX_FRAMEINTERPOLATION_BIND_CB_INPAINTING_PYRAMID 17 + +#ifdef FFX_HALF + #undef FFX_HALF + #define FFX_HALF 0 +#endif + +#include "frameinterpolation/ffx_frameinterpolation_callbacks_glsl.h" +#include "frameinterpolation/ffx_frameinterpolation_common.h" +#include "frameinterpolation/ffx_frameinterpolation_compute_game_vector_field_inpainting_pyramid.h" + +#ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_WIDTH +#define FFX_FRAMEINTERPOLATION_THREAD_GROUP_WIDTH 256 +#endif // #ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_WIDTH +#ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_HEIGHT +#define FFX_FRAMEINTERPOLATION_THREAD_GROUP_HEIGHT 1 +#endif // #ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_HEIGHT +#ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_DEPTH +#define FFX_FRAMEINTERPOLATION_THREAD_GROUP_DEPTH 1 +#endif // #ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_DEPTH +#ifndef FFX_FRAMEINTERPOLATION_NUM_THREADS +#define FFX_FRAMEINTERPOLATION_NUM_THREADS layout (local_size_x = FFX_FRAMEINTERPOLATION_THREAD_GROUP_WIDTH, local_size_y = FFX_FRAMEINTERPOLATION_THREAD_GROUP_HEIGHT, local_size_z = FFX_FRAMEINTERPOLATION_THREAD_GROUP_DEPTH) in; +#endif // #ifndef FFX_FRAMEINTERPOLATION_NUM_THREADS + +FFX_FRAMEINTERPOLATION_NUM_THREADS +void main() +{ + computeFrameinterpolationGameVectorFieldInpaintingPyramid(FfxInt32x3(gl_WorkGroupID), FfxInt32(gl_LocalInvocationIndex)); +} diff --git a/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/frameinterpolation/ffx_frameinterpolation_compute_inpainting_pyramid_pass.glsl b/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/frameinterpolation/ffx_frameinterpolation_compute_inpainting_pyramid_pass.glsl new file mode 100644 index 00000000..cdb7bde4 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/frameinterpolation/ffx_frameinterpolation_compute_inpainting_pyramid_pass.glsl @@ -0,0 +1,74 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#version 450 + +#extension GL_GOOGLE_include_directive : require +#extension GL_EXT_samplerless_texture_functions : require + +#define FFX_FRAMEINTERPOLATION_BIND_SRV_OUTPUT 0 + +#define FFX_FRAMEINTERPOLATION_BIND_UAV_COUNTERS 1 +#define FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_0 2 +#define FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_1 3 +#define FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_2 4 +#define FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_3 5 +#define FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_4 6 +#define FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_5 7 +#define FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_6 8 +#define FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_7 9 +#define FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_8 10 +#define FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_9 11 +#define FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_10 12 +#define FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_11 13 +#define FFX_FRAMEINTERPOLATION_BIND_UAV_INPAINTING_PYRAMID_MIPMAP_12 14 + +#define FFX_FRAMEINTERPOLATION_BIND_CB_FRAMEINTERPOLATION 15 +#define FFX_FRAMEINTERPOLATION_BIND_CB_INPAINTING_PYRAMID 16 + +#ifdef FFX_HALF + #undef FFX_HALF + #define FFX_HALF 0 +#endif + +#include "frameinterpolation/ffx_frameinterpolation_callbacks_glsl.h" +#include "frameinterpolation/ffx_frameinterpolation_common.h" +#include "frameinterpolation/ffx_frameinterpolation_compute_inpainting_pyramid.h" + +#ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_WIDTH +#define FFX_FRAMEINTERPOLATION_THREAD_GROUP_WIDTH 256 +#endif // #ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_WIDTH +#ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_HEIGHT +#define FFX_FRAMEINTERPOLATION_THREAD_GROUP_HEIGHT 1 +#endif // #ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_HEIGHT +#ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_DEPTH +#define FFX_FRAMEINTERPOLATION_THREAD_GROUP_DEPTH 1 +#endif // #ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_DEPTH +#ifndef FFX_FRAMEINTERPOLATION_NUM_THREADS +#define FFX_FRAMEINTERPOLATION_NUM_THREADS layout (local_size_x = FFX_FRAMEINTERPOLATION_THREAD_GROUP_WIDTH, local_size_y = FFX_FRAMEINTERPOLATION_THREAD_GROUP_HEIGHT, local_size_z = FFX_FRAMEINTERPOLATION_THREAD_GROUP_DEPTH) in; +#endif // #ifndef FFX_FRAMEINTERPOLATION_NUM_THREADS + +FFX_FRAMEINTERPOLATION_NUM_THREADS +void main() +{ + computeFrameinterpolationInpaintingPyramid(FfxInt32x3(gl_WorkGroupID), FfxInt32(gl_LocalInvocationIndex)); +} diff --git a/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/frameinterpolation/ffx_frameinterpolation_debug_view_pass.glsl b/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/frameinterpolation/ffx_frameinterpolation_debug_view_pass.glsl new file mode 100644 index 00000000..a089510f --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/frameinterpolation/ffx_frameinterpolation_debug_view_pass.glsl @@ -0,0 +1,65 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#version 450 + +#extension GL_GOOGLE_include_directive : require +#extension GL_EXT_samplerless_texture_functions : require +// Needed for rw_output declaration +#extension GL_EXT_shader_image_load_formatted : require + +#define FFX_FRAMEINTERPOLATION_BIND_SRV_GAME_MOTION_VECTOR_FIELD_X 0 +#define FFX_FRAMEINTERPOLATION_BIND_SRV_GAME_MOTION_VECTOR_FIELD_Y 1 +#define FFX_FRAMEINTERPOLATION_BIND_SRV_OPTICAL_FLOW_MOTION_VECTOR_FIELD_X 2 +#define FFX_FRAMEINTERPOLATION_BIND_SRV_OPTICAL_FLOW_MOTION_VECTOR_FIELD_Y 3 +#define FFX_FRAMEINTERPOLATION_BIND_SRV_DISOCCLUSION_MASK 4 +#define FFX_FRAMEINTERPOLATION_BIND_SRV_PRESENT_BACKBUFFER 5 +#define FFX_FRAMEINTERPOLATION_BIND_SRV_INPAINTING_PYRAMID 6 +#define FFX_FRAMEINTERPOLATION_BIND_SRV_CURRENT_INTERPOLATION_SOURCE 7 +#define FFX_FRAMEINTERPOLATION_BIND_SRV_DISTORTION_FIELD 8 + +#define FFX_FRAMEINTERPOLATION_BIND_UAV_OUTPUT 9 + +#define FFX_FRAMEINTERPOLATION_BIND_CB_FRAMEINTERPOLATION 10 + +#include "frameinterpolation/ffx_frameinterpolation_callbacks_glsl.h" +#include "frameinterpolation/ffx_frameinterpolation_common.h" +#include "frameinterpolation/ffx_frameinterpolation_debug_view.h" + +#ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_WIDTH +#define FFX_FRAMEINTERPOLATION_THREAD_GROUP_WIDTH 8 +#endif // #ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_WIDTH +#ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_HEIGHT +#define FFX_FRAMEINTERPOLATION_THREAD_GROUP_HEIGHT 8 +#endif // #ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_HEIGHT +#ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_DEPTH +#define FFX_FRAMEINTERPOLATION_THREAD_GROUP_DEPTH 1 +#endif // #ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_DEPTH +#ifndef FFX_FRAMEINTERPOLATION_NUM_THREADS +#define FFX_FRAMEINTERPOLATION_NUM_THREADS layout (local_size_x = FFX_FRAMEINTERPOLATION_THREAD_GROUP_WIDTH, local_size_y = FFX_FRAMEINTERPOLATION_THREAD_GROUP_HEIGHT, local_size_z = FFX_FRAMEINTERPOLATION_THREAD_GROUP_DEPTH) in; +#endif // #ifndef FFX_FRAMEINTERPOLATION_NUM_THREADS + +FFX_FRAMEINTERPOLATION_NUM_THREADS +void main() +{ + computeDebugView(FfxInt32x2(gl_GlobalInvocationID.xy)); +} diff --git a/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/frameinterpolation/ffx_frameinterpolation_disocclusion_mask_pass.glsl b/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/frameinterpolation/ffx_frameinterpolation_disocclusion_mask_pass.glsl new file mode 100644 index 00000000..40bb7356 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/frameinterpolation/ffx_frameinterpolation_disocclusion_mask_pass.glsl @@ -0,0 +1,61 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#version 450 + +#extension GL_GOOGLE_include_directive : require +#extension GL_EXT_samplerless_texture_functions : require + +#define FFX_FRAMEINTERPOLATION_BIND_SRV_GAME_MOTION_VECTOR_FIELD_X 0 +#define FFX_FRAMEINTERPOLATION_BIND_SRV_GAME_MOTION_VECTOR_FIELD_Y 1 +#define FFX_FRAMEINTERPOLATION_BIND_SRV_RECONSTRUCTED_DEPTH_PREVIOUS_FRAME 2 +#define FFX_FRAMEINTERPOLATION_BIND_SRV_DILATED_DEPTH 3 +#define FFX_FRAMEINTERPOLATION_BIND_SRV_RECONSTRUCTED_DEPTH_INTERPOLATED_FRAME 4 +#define FFX_FRAMEINTERPOLATION_BIND_SRV_INPAINTING_PYRAMID 5 +#define FFX_FRAMEINTERPOLATION_BIND_SRV_DISTORTION_FIELD 6 + +#define FFX_FRAMEINTERPOLATION_BIND_UAV_DISOCCLUSION_MASK 7 + +#define FFX_FRAMEINTERPOLATION_BIND_CB_FRAMEINTERPOLATION 8 + +#include "frameinterpolation/ffx_frameinterpolation_callbacks_glsl.h" +#include "frameinterpolation/ffx_frameinterpolation_common.h" +#include "frameinterpolation/ffx_frameinterpolation_disocclusion_mask.h" + +#ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_WIDTH +#define FFX_FRAMEINTERPOLATION_THREAD_GROUP_WIDTH 8 +#endif // #ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_WIDTH +#ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_HEIGHT +#define FFX_FRAMEINTERPOLATION_THREAD_GROUP_HEIGHT 8 +#endif // #ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_HEIGHT +#ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_DEPTH +#define FFX_FRAMEINTERPOLATION_THREAD_GROUP_DEPTH 1 +#endif // #ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_DEPTH +#ifndef FFX_FRAMEINTERPOLATION_NUM_THREADS +#define FFX_FRAMEINTERPOLATION_NUM_THREADS layout (local_size_x = FFX_FRAMEINTERPOLATION_THREAD_GROUP_WIDTH, local_size_y = FFX_FRAMEINTERPOLATION_THREAD_GROUP_HEIGHT, local_size_z = FFX_FRAMEINTERPOLATION_THREAD_GROUP_DEPTH) in; +#endif // #ifndef FFX_FRAMEINTERPOLATION_NUM_THREADS + +FFX_FRAMEINTERPOLATION_NUM_THREADS +void main() +{ + computeDisocclusionMask(FfxInt32x2(gl_GlobalInvocationID.xy)); +} diff --git a/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/frameinterpolation/ffx_frameinterpolation_game_motion_vector_field_pass.glsl b/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/frameinterpolation/ffx_frameinterpolation_game_motion_vector_field_pass.glsl new file mode 100644 index 00000000..1071d629 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/frameinterpolation/ffx_frameinterpolation_game_motion_vector_field_pass.glsl @@ -0,0 +1,60 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#version 450 + +#extension GL_GOOGLE_include_directive : require +#extension GL_EXT_samplerless_texture_functions : require + +#define FFX_FRAMEINTERPOLATION_BIND_SRV_DILATED_MOTION_VECTORS 0 +#define FFX_FRAMEINTERPOLATION_BIND_SRV_DILATED_DEPTH 1 +#define FFX_FRAMEINTERPOLATION_BIND_SRV_PREVIOUS_INTERPOLATION_SOURCE 2 +#define FFX_FRAMEINTERPOLATION_BIND_SRV_CURRENT_INTERPOLATION_SOURCE 3 +#define FFX_FRAMEINTERPOLATION_BIND_SRV_DISTORTION_FIELD 4 + +#define FFX_FRAMEINTERPOLATION_BIND_UAV_GAME_MOTION_VECTOR_FIELD_X 5 +#define FFX_FRAMEINTERPOLATION_BIND_UAV_GAME_MOTION_VECTOR_FIELD_Y 6 + +#define FFX_FRAMEINTERPOLATION_BIND_CB_FRAMEINTERPOLATION 7 + +#include "frameinterpolation/ffx_frameinterpolation_callbacks_glsl.h" +#include "frameinterpolation/ffx_frameinterpolation_common.h" +#include "frameinterpolation/ffx_frameinterpolation_game_motion_vector_field.h" + +#ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_WIDTH +#define FFX_FRAMEINTERPOLATION_THREAD_GROUP_WIDTH 8 +#endif // #ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_WIDTH +#ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_HEIGHT +#define FFX_FRAMEINTERPOLATION_THREAD_GROUP_HEIGHT 8 +#endif // #ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_HEIGHT +#ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_DEPTH +#define FFX_FRAMEINTERPOLATION_THREAD_GROUP_DEPTH 1 +#endif // #ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_DEPTH +#ifndef FFX_FRAMEINTERPOLATION_NUM_THREADS +#define FFX_FRAMEINTERPOLATION_NUM_THREADS layout (local_size_x = FFX_FRAMEINTERPOLATION_THREAD_GROUP_WIDTH, local_size_y = FFX_FRAMEINTERPOLATION_THREAD_GROUP_HEIGHT, local_size_z = FFX_FRAMEINTERPOLATION_THREAD_GROUP_DEPTH) in; +#endif // #ifndef FFX_FRAMEINTERPOLATION_NUM_THREADS + +FFX_FRAMEINTERPOLATION_NUM_THREADS +void main() +{ + computeGameFieldMvs(FfxInt32x2(gl_GlobalInvocationID.xy)); +} diff --git a/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/frameinterpolation/ffx_frameinterpolation_inpainting_pass.glsl b/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/frameinterpolation/ffx_frameinterpolation_inpainting_pass.glsl new file mode 100644 index 00000000..facfca25 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/frameinterpolation/ffx_frameinterpolation_inpainting_pass.glsl @@ -0,0 +1,60 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#version 450 + +#extension GL_GOOGLE_include_directive : require +#extension GL_EXT_samplerless_texture_functions : require +// Needed for rw_output declaration +#extension GL_EXT_shader_image_load_formatted : require + +#define FFX_FRAMEINTERPOLATION_BIND_SRV_OPTICAL_FLOW_SCENE_CHANGE_DETECTION 0 +#define FFX_FRAMEINTERPOLATION_BIND_SRV_INPAINTING_PYRAMID 1 +#define FFX_FRAMEINTERPOLATION_BIND_SRV_PRESENT_BACKBUFFER 2 +#define FFX_FRAMEINTERPOLATION_BIND_SRV_CURRENT_INTERPOLATION_SOURCE 3 + +#define FFX_FRAMEINTERPOLATION_BIND_UAV_OUTPUT 7 + +#define FFX_FRAMEINTERPOLATION_BIND_CB_FRAMEINTERPOLATION 8 + +#include "frameinterpolation/ffx_frameinterpolation_callbacks_glsl.h" +#include "frameinterpolation/ffx_frameinterpolation_common.h" +#include "frameinterpolation/ffx_frameinterpolation_inpainting.h" + +#ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_WIDTH +#define FFX_FRAMEINTERPOLATION_THREAD_GROUP_WIDTH 8 +#endif // #ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_WIDTH +#ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_HEIGHT +#define FFX_FRAMEINTERPOLATION_THREAD_GROUP_HEIGHT 8 +#endif // #ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_HEIGHT +#ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_DEPTH +#define FFX_FRAMEINTERPOLATION_THREAD_GROUP_DEPTH 1 +#endif // #ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_DEPTH +#ifndef FFX_FRAMEINTERPOLATION_NUM_THREADS +#define FFX_FRAMEINTERPOLATION_NUM_THREADS layout (local_size_x = FFX_FRAMEINTERPOLATION_THREAD_GROUP_WIDTH, local_size_y = FFX_FRAMEINTERPOLATION_THREAD_GROUP_HEIGHT, local_size_z = FFX_FRAMEINTERPOLATION_THREAD_GROUP_DEPTH) in; +#endif // #ifndef FFX_FRAMEINTERPOLATION_NUM_THREADS + +FFX_FRAMEINTERPOLATION_NUM_THREADS +void main() +{ + computeInpainting(FfxInt32x2(gl_GlobalInvocationID.xy)); +} diff --git a/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/frameinterpolation/ffx_frameinterpolation_optical_flow_vector_field_pass.glsl b/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/frameinterpolation/ffx_frameinterpolation_optical_flow_vector_field_pass.glsl new file mode 100644 index 00000000..0de21e29 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/frameinterpolation/ffx_frameinterpolation_optical_flow_vector_field_pass.glsl @@ -0,0 +1,60 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#version 450 + +#extension GL_GOOGLE_include_directive : require +#extension GL_EXT_samplerless_texture_functions : require + +#define FFX_FRAMEINTERPOLATION_BIND_SRV_OPTICAL_FLOW 0 +#define FFX_FRAMEINTERPOLATION_BIND_SRV_OPTICAL_FLOW_CONFIDENCE 1 +#define FFX_FRAMEINTERPOLATION_BIND_SRV_DILATED_DEPTH 2 +#define FFX_FRAMEINTERPOLATION_BIND_SRV_PREVIOUS_INTERPOLATION_SOURCE 3 +#define FFX_FRAMEINTERPOLATION_BIND_SRV_CURRENT_INTERPOLATION_SOURCE 4 + +#define FFX_FRAMEINTERPOLATION_BIND_UAV_OPTICAL_FLOW_MOTION_VECTOR_FIELD_X 6 +#define FFX_FRAMEINTERPOLATION_BIND_UAV_OPTICAL_FLOW_MOTION_VECTOR_FIELD_Y 7 + +#define FFX_FRAMEINTERPOLATION_BIND_CB_FRAMEINTERPOLATION 8 + +#include "frameinterpolation/ffx_frameinterpolation_callbacks_glsl.h" +#include "frameinterpolation/ffx_frameinterpolation_common.h" +#include "frameinterpolation/ffx_frameinterpolation_optical_flow_vector_field.h" + +#ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_WIDTH +#define FFX_FRAMEINTERPOLATION_THREAD_GROUP_WIDTH 8 +#endif // #ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_WIDTH +#ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_HEIGHT +#define FFX_FRAMEINTERPOLATION_THREAD_GROUP_HEIGHT 8 +#endif // #ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_HEIGHT +#ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_DEPTH +#define FFX_FRAMEINTERPOLATION_THREAD_GROUP_DEPTH 1 +#endif // #ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_DEPTH +#ifndef FFX_FRAMEINTERPOLATION_NUM_THREADS +#define FFX_FRAMEINTERPOLATION_NUM_THREADS layout (local_size_x = FFX_FRAMEINTERPOLATION_THREAD_GROUP_WIDTH, local_size_y = FFX_FRAMEINTERPOLATION_THREAD_GROUP_HEIGHT, local_size_z = FFX_FRAMEINTERPOLATION_THREAD_GROUP_DEPTH) in; +#endif // #ifndef FFX_FRAMEINTERPOLATION_NUM_THREADS + +FFX_FRAMEINTERPOLATION_NUM_THREADS +void main() +{ + computeOpticalFlowVectorField(FfxInt32x2(gl_GlobalInvocationID.xy)); +} diff --git a/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/frameinterpolation/ffx_frameinterpolation_pass.glsl b/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/frameinterpolation/ffx_frameinterpolation_pass.glsl new file mode 100644 index 00000000..733bd396 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/frameinterpolation/ffx_frameinterpolation_pass.glsl @@ -0,0 +1,65 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#version 450 + +#extension GL_GOOGLE_include_directive : require +#extension GL_EXT_samplerless_texture_functions : require +// Needed for rw_output declaration +#extension GL_EXT_shader_image_load_formatted : require + +#define FFX_FRAMEINTERPOLATION_BIND_SRV_GAME_MOTION_VECTOR_FIELD_X 0 +#define FFX_FRAMEINTERPOLATION_BIND_SRV_GAME_MOTION_VECTOR_FIELD_Y 1 +#define FFX_FRAMEINTERPOLATION_BIND_SRV_OPTICAL_FLOW_MOTION_VECTOR_FIELD_X 2 +#define FFX_FRAMEINTERPOLATION_BIND_SRV_OPTICAL_FLOW_MOTION_VECTOR_FIELD_Y 3 +#define FFX_FRAMEINTERPOLATION_BIND_SRV_PREVIOUS_INTERPOLATION_SOURCE 4 +#define FFX_FRAMEINTERPOLATION_BIND_SRV_CURRENT_INTERPOLATION_SOURCE 5 +#define FFX_FRAMEINTERPOLATION_BIND_SRV_DISOCCLUSION_MASK 6 +#define FFX_FRAMEINTERPOLATION_BIND_SRV_INPAINTING_PYRAMID 7 +#define FFX_FRAMEINTERPOLATION_BIND_SRV_COUNTERS 8 + +#define FFX_FRAMEINTERPOLATION_BIND_UAV_OUTPUT 9 + +#define FFX_FRAMEINTERPOLATION_BIND_CB_FRAMEINTERPOLATION 10 + +#include "frameinterpolation/ffx_frameinterpolation_callbacks_glsl.h" +#include "frameinterpolation/ffx_frameinterpolation_common.h" +#include "frameinterpolation/ffx_frameinterpolation.h" + +#ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_WIDTH +#define FFX_FRAMEINTERPOLATION_THREAD_GROUP_WIDTH 8 +#endif // #ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_WIDTH +#ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_HEIGHT +#define FFX_FRAMEINTERPOLATION_THREAD_GROUP_HEIGHT 8 +#endif // #ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_HEIGHT +#ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_DEPTH +#define FFX_FRAMEINTERPOLATION_THREAD_GROUP_DEPTH 1 +#endif // #ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_DEPTH +#ifndef FFX_FRAMEINTERPOLATION_NUM_THREADS +#define FFX_FRAMEINTERPOLATION_NUM_THREADS layout (local_size_x = FFX_FRAMEINTERPOLATION_THREAD_GROUP_WIDTH, local_size_y = FFX_FRAMEINTERPOLATION_THREAD_GROUP_HEIGHT, local_size_z = FFX_FRAMEINTERPOLATION_THREAD_GROUP_DEPTH) in; +#endif // #ifndef FFX_FRAMEINTERPOLATION_NUM_THREADS + +FFX_FRAMEINTERPOLATION_NUM_THREADS +void main() +{ + computeFrameinterpolation(ivec2(gl_GlobalInvocationID.xy)); +} diff --git a/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/frameinterpolation/ffx_frameinterpolation_reconstruct_and_dilate_pass.glsl b/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/frameinterpolation/ffx_frameinterpolation_reconstruct_and_dilate_pass.glsl new file mode 100644 index 00000000..d29bddd1 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/frameinterpolation/ffx_frameinterpolation_reconstruct_and_dilate_pass.glsl @@ -0,0 +1,58 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#version 450 + +#extension GL_GOOGLE_include_directive : require +#extension GL_EXT_samplerless_texture_functions : require + +#define FFX_FRAMEINTERPOLATION_BIND_SRV_INPUT_MOTION_VECTORS 0 +#define FFX_FRAMEINTERPOLATION_BIND_SRV_INPUT_DEPTH 1 + +#define FFX_FRAMEINTERPOLATION_BIND_UAV_RECONSTRUCTED_DEPTH_PREVIOUS_FRAME 2 +#define FFX_FRAMEINTERPOLATION_BIND_UAV_DILATED_MOTION_VECTORS 3 +#define FFX_FRAMEINTERPOLATION_BIND_UAV_DILATED_DEPTH 4 + +#define FFX_FRAMEINTERPOLATION_BIND_CB_FRAMEINTERPOLATION 5 + +#include "frameinterpolation/ffx_frameinterpolation_callbacks_glsl.h" +#include "frameinterpolation/ffx_frameinterpolation_common.h" +#include "frameinterpolation/ffx_frameinterpolation_reconstruct_dilated_velocity_and_previous_depth.h" + +#ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_WIDTH +#define FFX_FRAMEINTERPOLATION_THREAD_GROUP_WIDTH 8 +#endif // #ifndef FFX_FSR3UPSCALER_THREAD_GROUP_WIDTH +#ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_HEIGHT +#define FFX_FRAMEINTERPOLATION_THREAD_GROUP_HEIGHT 8 +#endif // #ifndef FFX_FSR3UPSCALER_THREAD_GROUP_HEIGHT +#ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_DEPTH +#define FFX_FRAMEINTERPOLATION_THREAD_GROUP_DEPTH 1 +#endif // #ifndef FFX_FSR3UPSCALER_THREAD_GROUP_DEPTH +#ifndef FFX_FRAMEINTERPOLATION_NUM_THREADS +#define FFX_FRAMEINTERPOLATION_NUM_THREADS layout (local_size_x = FFX_FRAMEINTERPOLATION_THREAD_GROUP_WIDTH, local_size_y = FFX_FRAMEINTERPOLATION_THREAD_GROUP_HEIGHT, local_size_z = FFX_FRAMEINTERPOLATION_THREAD_GROUP_DEPTH) in; +#endif // #ifndef FFX_FSR3UPSCALER_NUM_THREADS + +FFX_FRAMEINTERPOLATION_NUM_THREADS +void main() +{ + ReconstructAndDilate(FfxInt32x2(gl_GlobalInvocationID.xy)); +} diff --git a/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/frameinterpolation/ffx_frameinterpolation_reconstruct_previous_depth_pass.glsl b/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/frameinterpolation/ffx_frameinterpolation_reconstruct_previous_depth_pass.glsl new file mode 100644 index 00000000..3608a62e --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/frameinterpolation/ffx_frameinterpolation_reconstruct_previous_depth_pass.glsl @@ -0,0 +1,58 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#version 450 + +#extension GL_GOOGLE_include_directive : require +#extension GL_EXT_samplerless_texture_functions : require + +#define FFX_FRAMEINTERPOLATION_BIND_SRV_DILATED_MOTION_VECTORS 0 +#define FFX_FRAMEINTERPOLATION_BIND_SRV_DILATED_DEPTH 1 +#define FFX_FRAMEINTERPOLATION_BIND_SRV_CURRENT_INTERPOLATION_SOURCE 2 +#define FFX_FRAMEINTERPOLATION_BIND_SRV_DISTORTION_FIELD 3 + +#define FFX_FRAMEINTERPOLATION_BIND_UAV_RECONSTRUCTED_DEPTH_INTERPOLATED_FRAME 4 + +#define FFX_FRAMEINTERPOLATION_BIND_CB_FRAMEINTERPOLATION 5 + +#include "frameinterpolation/ffx_frameinterpolation_callbacks_glsl.h" +#include "frameinterpolation/ffx_frameinterpolation_common.h" +#include "frameinterpolation/ffx_frameinterpolation_reconstruct_previous_depth.h" + +#ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_WIDTH +#define FFX_FRAMEINTERPOLATION_THREAD_GROUP_WIDTH 8 +#endif // #ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_WIDTH +#ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_HEIGHT +#define FFX_FRAMEINTERPOLATION_THREAD_GROUP_HEIGHT 8 +#endif // #ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_HEIGHT +#ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_DEPTH +#define FFX_FRAMEINTERPOLATION_THREAD_GROUP_DEPTH 1 +#endif // #ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_DEPTH +#ifndef FFX_FRAMEINTERPOLATION_NUM_THREADS +#define FFX_FRAMEINTERPOLATION_NUM_THREADS layout (local_size_x = FFX_FRAMEINTERPOLATION_THREAD_GROUP_WIDTH, local_size_y = FFX_FRAMEINTERPOLATION_THREAD_GROUP_HEIGHT, local_size_z = FFX_FRAMEINTERPOLATION_THREAD_GROUP_DEPTH) in; +#endif // #ifndef FFX_FRAMEINTERPOLATION_NUM_THREADS + +FFX_FRAMEINTERPOLATION_NUM_THREADS +void main() +{ + reconstructPreviousDepth(FfxInt32x2(gl_GlobalInvocationID.xy)); +} diff --git a/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/frameinterpolation/ffx_frameinterpolation_setup_pass.glsl b/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/frameinterpolation/ffx_frameinterpolation_setup_pass.glsl new file mode 100644 index 00000000..eaf18634 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/frameinterpolation/ffx_frameinterpolation_setup_pass.glsl @@ -0,0 +1,60 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#version 450 + +#extension GL_GOOGLE_include_directive : require +#extension GL_EXT_samplerless_texture_functions : require + +#define FFX_FRAMEINTERPOLATION_BIND_SRV_OPTICAL_FLOW_SCENE_CHANGE_DETECTION 0 + +#define FFX_FRAMEINTERPOLATION_BIND_UAV_GAME_MOTION_VECTOR_FIELD_X 1 +#define FFX_FRAMEINTERPOLATION_BIND_UAV_GAME_MOTION_VECTOR_FIELD_Y 2 +#define FFX_FRAMEINTERPOLATION_BIND_UAV_OPTICAL_FLOW_MOTION_VECTOR_FIELD_X 3 +#define FFX_FRAMEINTERPOLATION_BIND_UAV_OPTICAL_FLOW_MOTION_VECTOR_FIELD_Y 4 +#define FFX_FRAMEINTERPOLATION_BIND_UAV_DISOCCLUSION_MASK 5 +#define FFX_FRAMEINTERPOLATION_BIND_UAV_COUNTERS 6 + +#define FFX_FRAMEINTERPOLATION_BIND_CB_FRAMEINTERPOLATION 7 + +#include "frameinterpolation/ffx_frameinterpolation_callbacks_glsl.h" +#include "frameinterpolation/ffx_frameinterpolation_common.h" +#include "frameinterpolation/ffx_frameinterpolation_setup.h" + +#ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_WIDTH +#define FFX_FRAMEINTERPOLATION_THREAD_GROUP_WIDTH 8 +#endif // #ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_WIDTH +#ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_HEIGHT +#define FFX_FRAMEINTERPOLATION_THREAD_GROUP_HEIGHT 8 +#endif // #ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_HEIGHT +#ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_DEPTH +#define FFX_FRAMEINTERPOLATION_THREAD_GROUP_DEPTH 1 +#endif // #ifndef FFX_FRAMEINTERPOLATION_THREAD_GROUP_DEPTH +#ifndef FFX_FRAMEINTERPOLATION_NUM_THREADS +#define FFX_FRAMEINTERPOLATION_NUM_THREADS layout (local_size_x = FFX_FRAMEINTERPOLATION_THREAD_GROUP_WIDTH, local_size_y = FFX_FRAMEINTERPOLATION_THREAD_GROUP_HEIGHT, local_size_z = FFX_FRAMEINTERPOLATION_THREAD_GROUP_DEPTH) in; +#endif // #ifndef FFX_FRAMEINTERPOLATION_NUM_THREADS + +FFX_FRAMEINTERPOLATION_NUM_THREADS +void main() +{ + setupFrameinterpolationResources(FfxInt32x2(gl_GlobalInvocationID.xy)); +} diff --git a/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/opticalflow/ffx_opticalflow_compute_luminance_pyramid_pass.glsl b/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/opticalflow/ffx_opticalflow_compute_luminance_pyramid_pass.glsl new file mode 100644 index 00000000..7713dcdd --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/opticalflow/ffx_opticalflow_compute_luminance_pyramid_pass.glsl @@ -0,0 +1,60 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#version 450 + +#extension GL_GOOGLE_include_directive : require +#extension GL_EXT_samplerless_texture_functions : require + +#define FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT 0 +#define FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_1 1 +#define FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_2 2 +#define FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_3 3 +#define FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_4 4 +#define FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_5 5 +#define FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT_LEVEL_6 6 + +#define FFX_OPTICALFLOW_BIND_CB_COMMON 7 +#define FFX_OPTICALFLOW_BIND_CB_SPD 8 + +#include "opticalflow/ffx_opticalflow_callbacks_glsl.h" +#include "opticalflow/ffx_opticalflow_common.h" +#include "opticalflow/ffx_opticalflow_compute_luminance_pyramid.h" + +#ifndef FFX_OPTICALFLOW_THREAD_GROUP_WIDTH +#define FFX_OPTICALFLOW_THREAD_GROUP_WIDTH 256 +#endif // #ifndef FFX_OPTICALFLOW_THREAD_GROUP_WIDTH +#ifndef FFX_OPTICALFLOW_THREAD_GROUP_HEIGHT +#define FFX_OPTICALFLOW_THREAD_GROUP_HEIGHT 1 +#endif // #ifndef FFX_OPTICALFLOW_THREAD_GROUP_HEIGHT +#ifndef FFX_OPTICALFLOW_THREAD_GROUP_DEPTH +#define FFX_OPTICALFLOW_THREAD_GROUP_DEPTH 1 +#endif // #ifndef FFX_OPTICALFLOW_THREAD_GROUP_DEPTH +#ifndef FFX_OPTICALFLOW_NUM_THREADS +#define FFX_OPTICALFLOW_NUM_THREADS layout (local_size_x = FFX_OPTICALFLOW_THREAD_GROUP_WIDTH, local_size_y = FFX_OPTICALFLOW_THREAD_GROUP_HEIGHT, local_size_z = FFX_OPTICALFLOW_THREAD_GROUP_DEPTH) in; +#endif // #ifndef FFX_OPTICALFLOW_NUM_THREADS + +FFX_OPTICALFLOW_NUM_THREADS +void main() +{ + ComputeOpticalFlowInputPyramid(FfxInt32x2(gl_WorkGroupID.xy), FfxInt32(gl_LocalInvocationIndex)); +} diff --git a/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/opticalflow/ffx_opticalflow_compute_optical_flow_advanced_pass_v5.glsl b/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/opticalflow/ffx_opticalflow_compute_optical_flow_advanced_pass_v5.glsl new file mode 100644 index 00000000..8844c2ae --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/opticalflow/ffx_opticalflow_compute_optical_flow_advanced_pass_v5.glsl @@ -0,0 +1,66 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#version 450 + +#extension GL_GOOGLE_include_directive : require +#extension GL_EXT_samplerless_texture_functions : require + +#define FFX_WAVE 1 +#extension GL_KHR_shader_subgroup_basic : require + +#define FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_INPUT 0 +#define FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_PREVIOUS_INPUT 1 + +#define FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW 2 +#define FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_SCD_OUTPUT 3 + +#define FFX_OPTICALFLOW_BIND_CB_COMMON 4 + + +#include "opticalflow/ffx_opticalflow_callbacks_glsl.h" +#include "opticalflow/ffx_opticalflow_common.h" + +#ifndef FFX_OPTICALFLOW_BLOCK_SIZE +#define FFX_OPTICALFLOW_BLOCK_SIZE 8 +#endif // #ifndef FFX_OPTICALFLOW_BLOCK_SIZE +#ifndef FFX_OPTICALFLOW_THREAD_GROUP_WIDTH +#define FFX_OPTICALFLOW_THREAD_GROUP_WIDTH 64 +#endif // #ifndef FFX_OPTICALFLOW_THREAD_GROUP_WIDTH +#ifndef FFX_OPTICALFLOW_THREAD_GROUP_HEIGHT +#define FFX_OPTICALFLOW_THREAD_GROUP_HEIGHT 1 +#endif // #ifndef FFX_OPTICALFLOW_THREAD_GROUP_HEIGHT +#ifndef FFX_OPTICALFLOW_THREAD_GROUP_DEPTH +#define FFX_OPTICALFLOW_THREAD_GROUP_DEPTH 1 +#endif // #ifndef FFX_OPTICALFLOW_THREAD_GROUP_DEPTH + +#include "opticalflow/ffx_opticalflow_compute_optical_flow_v5.h" + +#ifndef FFX_OPTICALFLOW_NUM_THREADS +#define FFX_OPTICALFLOW_NUM_THREADS layout (local_size_x = FFX_OPTICALFLOW_THREAD_GROUP_WIDTH, local_size_y = FFX_OPTICALFLOW_THREAD_GROUP_HEIGHT, local_size_z = FFX_OPTICALFLOW_THREAD_GROUP_DEPTH) in; +#endif // #ifndef FFX_OPTICALFLOW_NUM_THREADS + +FFX_OPTICALFLOW_NUM_THREADS +void main() +{ + ComputeOpticalFlowAdvanced(FfxInt32x2(gl_GlobalInvocationID.xy), FfxInt32x2(gl_LocalInvocationID.xy), FfxInt32x2(gl_WorkGroupID.xy), FfxInt32(gl_LocalInvocationIndex)); +} diff --git a/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/opticalflow/ffx_opticalflow_compute_scd_divergence_pass.glsl b/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/opticalflow/ffx_opticalflow_compute_scd_divergence_pass.glsl new file mode 100644 index 00000000..0df8d985 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/opticalflow/ffx_opticalflow_compute_scd_divergence_pass.glsl @@ -0,0 +1,57 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#version 450 + +#extension GL_GOOGLE_include_directive : require +#extension GL_EXT_samplerless_texture_functions : require + +#define FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_SCD_HISTOGRAM 0 +#define FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_SCD_PREVIOUS_HISTOGRAM 1 +#define FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_SCD_TEMP 2 +#define FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_SCD_OUTPUT 3 + +#define FFX_OPTICALFLOW_BIND_CB_COMMON 4 + +#include "opticalflow/ffx_opticalflow_callbacks_glsl.h" +#include "opticalflow/ffx_opticalflow_common.h" +#include "opticalflow/ffx_opticalflow_compute_scd_divergence.h" + +#ifndef FFX_OPTICALFLOW_THREAD_GROUP_WIDTH +#define FFX_OPTICALFLOW_THREAD_GROUP_WIDTH 256 +#endif // #ifndef FFX_OPTICALFLOW_THREAD_GROUP_WIDTH +#ifndef FFX_OPTICALFLOW_THREAD_GROUP_HEIGHT +#define FFX_OPTICALFLOW_THREAD_GROUP_HEIGHT 1 +#endif // #ifndef FFX_OPTICALFLOW_THREAD_GROUP_HEIGHT +#ifndef FFX_OPTICALFLOW_THREAD_GROUP_DEPTH +#define FFX_OPTICALFLOW_THREAD_GROUP_DEPTH 1 +#endif // #ifndef FFX_OPTICALFLOW_THREAD_GROUP_DEPTH +#ifndef FFX_OPTICALFLOW_NUM_THREADS +#define FFX_OPTICALFLOW_NUM_THREADS layout (local_size_x = FFX_OPTICALFLOW_THREAD_GROUP_WIDTH, local_size_y = FFX_OPTICALFLOW_THREAD_GROUP_HEIGHT, local_size_z = FFX_OPTICALFLOW_THREAD_GROUP_DEPTH) in; +#endif // #ifndef FFX_OPTICALFLOW_NUM_THREADS + +FFX_OPTICALFLOW_NUM_THREADS +void main() +{ + FfxInt32x2 iGroupSize = FfxInt32x2(FFX_OPTICALFLOW_THREAD_GROUP_WIDTH, FFX_OPTICALFLOW_THREAD_GROUP_HEIGHT); + ComputeSCDHistogramsDivergence(FfxInt32x3(gl_GlobalInvocationID.xyz), FfxInt32x2(gl_LocalInvocationID.xy), FfxInt32(gl_LocalInvocationIndex), FfxInt32x2(gl_WorkGroupID.xy), iGroupSize); +} diff --git a/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/opticalflow/ffx_opticalflow_filter_optical_flow_pass_v5.glsl b/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/opticalflow/ffx_opticalflow_filter_optical_flow_pass_v5.glsl new file mode 100644 index 00000000..01bb11a4 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/opticalflow/ffx_opticalflow_filter_optical_flow_pass_v5.glsl @@ -0,0 +1,57 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#version 450 + +#extension GL_GOOGLE_include_directive : require +#extension GL_EXT_samplerless_texture_functions : require + +#define FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_PREVIOUS 0 + +#define FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW 1 + +#define FFX_OPTICALFLOW_BIND_CB_COMMON 2 + +#include "opticalflow/ffx_opticalflow_callbacks_glsl.h" +#include "opticalflow/ffx_opticalflow_common.h" + +#ifndef FFX_OPTICALFLOW_THREAD_GROUP_WIDTH +#define FFX_OPTICALFLOW_THREAD_GROUP_WIDTH 16 +#endif // #ifndef FFX_OPTICALFLOW_THREAD_GROUP_WIDTH +#ifndef FFX_OPTICALFLOW_THREAD_GROUP_HEIGHT +#define FFX_OPTICALFLOW_THREAD_GROUP_HEIGHT 4 +#endif // #ifndef FFX_OPTICALFLOW_THREAD_GROUP_HEIGHT +#ifndef FFX_OPTICALFLOW_THREAD_GROUP_DEPTH +#define FFX_OPTICALFLOW_THREAD_GROUP_DEPTH 1 +#endif // #ifndef FFX_OPTICALFLOW_THREAD_GROUP_DEPTH + +#include "opticalflow/ffx_opticalflow_filter_optical_flow_v5.h" + +#ifndef FFX_OPTICALFLOW_NUM_THREADS +#define FFX_OPTICALFLOW_NUM_THREADS layout (local_size_x = FFX_OPTICALFLOW_THREAD_GROUP_WIDTH, local_size_y = FFX_OPTICALFLOW_THREAD_GROUP_HEIGHT, local_size_z = FFX_OPTICALFLOW_THREAD_GROUP_DEPTH) in; +#endif // #ifndef FFX_OPTICALFLOW_NUM_THREADS + +FFX_OPTICALFLOW_NUM_THREADS +void main() +{ + FilterOpticalFlow(FfxInt32x2(gl_GlobalInvocationID.xy), FfxInt32x2(gl_LocalInvocationID.xy), FfxInt32x2(gl_WorkGroupID.xy), FfxInt32(gl_LocalInvocationIndex)); +} diff --git a/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/opticalflow/ffx_opticalflow_generate_scd_histogram_pass.glsl b/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/opticalflow/ffx_opticalflow_generate_scd_histogram_pass.glsl new file mode 100644 index 00000000..0462ef15 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/opticalflow/ffx_opticalflow_generate_scd_histogram_pass.glsl @@ -0,0 +1,55 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#version 450 + +#extension GL_GOOGLE_include_directive : require +#extension GL_EXT_samplerless_texture_functions : require + +#define FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_INPUT 0 +#define FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_SCD_HISTOGRAM 1 + +#define FFX_OPTICALFLOW_BIND_CB_COMMON 2 + +#include "opticalflow/ffx_opticalflow_callbacks_glsl.h" +#include "opticalflow/ffx_opticalflow_common.h" +#include "opticalflow/ffx_opticalflow_generate_scd_histogram.h" + +#ifndef FFX_OPTICALFLOW_THREAD_GROUP_WIDTH +#define FFX_OPTICALFLOW_THREAD_GROUP_WIDTH 32 +#endif // #ifndef FFX_OPTICALFLOW_THREAD_GROUP_WIDTH +#ifndef FFX_OPTICALFLOW_THREAD_GROUP_HEIGHT +#define FFX_OPTICALFLOW_THREAD_GROUP_HEIGHT 8 +#endif // #ifndef FFX_OPTICALFLOW_THREAD_GROUP_HEIGHT +#ifndef FFX_OPTICALFLOW_THREAD_GROUP_DEPTH +#define FFX_OPTICALFLOW_THREAD_GROUP_DEPTH 1 +#endif // #ifndef FFX_OPTICALFLOW_THREAD_GROUP_DEPTH +#ifndef FFX_OPTICALFLOW_NUM_THREADS +#define FFX_OPTICALFLOW_NUM_THREADS layout (local_size_x = FFX_OPTICALFLOW_THREAD_GROUP_WIDTH, local_size_y = FFX_OPTICALFLOW_THREAD_GROUP_HEIGHT, local_size_z = FFX_OPTICALFLOW_THREAD_GROUP_DEPTH) in; +#endif // #ifndef FFX_OPTICALFLOW_NUM_THREADS + +FFX_OPTICALFLOW_NUM_THREADS +void main() +{ + FfxInt32x2 iGroupSize = FfxInt32x2(FFX_OPTICALFLOW_THREAD_GROUP_WIDTH, FFX_OPTICALFLOW_THREAD_GROUP_HEIGHT); + GenerateSceneChangeDetectionHistogram(FfxInt32x3(gl_GlobalInvocationID.xyz), FfxInt32x2(gl_LocalInvocationID.xy), FfxInt32(gl_LocalInvocationIndex), FfxInt32x2(gl_WorkGroupID.xy), iGroupSize); +} diff --git a/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/opticalflow/ffx_opticalflow_prepare_luma_pass.glsl b/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/opticalflow/ffx_opticalflow_prepare_luma_pass.glsl new file mode 100644 index 00000000..bb37011e --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/opticalflow/ffx_opticalflow_prepare_luma_pass.glsl @@ -0,0 +1,55 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#version 450 + +#extension GL_GOOGLE_include_directive : require +#extension GL_EXT_samplerless_texture_functions : require + +#define FFX_OPTICALFLOW_BIND_SRV_INPUT_COLOR 0 +#define FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_INPUT 1 + +#define FFX_OPTICALFLOW_BIND_CB_COMMON 2 + +#include "opticalflow/ffx_opticalflow_callbacks_glsl.h" +#include "opticalflow/ffx_opticalflow_common.h" + +#ifndef FFX_OPTICALFLOW_THREAD_GROUP_WIDTH +#define FFX_OPTICALFLOW_THREAD_GROUP_WIDTH 16 +#endif // #ifndef FFX_OPTICALFLOW_THREAD_GROUP_WIDTH +#ifndef FFX_OPTICALFLOW_THREAD_GROUP_HEIGHT +#define FFX_OPTICALFLOW_THREAD_GROUP_HEIGHT 16 +#endif // #ifndef FFX_OPTICALFLOW_THREAD_GROUP_HEIGHT +#ifndef FFX_OPTICALFLOW_THREAD_GROUP_DEPTH +#define FFX_OPTICALFLOW_THREAD_GROUP_DEPTH 1 +#endif // #ifndef FFX_OPTICALFLOW_THREAD_GROUP_DEPTH +#ifndef FFX_OPTICALFLOW_NUM_THREADS +#define FFX_OPTICALFLOW_NUM_THREADS layout (local_size_x = FFX_OPTICALFLOW_THREAD_GROUP_WIDTH, local_size_y = FFX_OPTICALFLOW_THREAD_GROUP_HEIGHT, local_size_z = FFX_OPTICALFLOW_THREAD_GROUP_DEPTH) in; +#endif // #ifndef FFX_OPTICALFLOW_NUM_THREADS + +#include "opticalflow/ffx_opticalflow_prepare_luma.h" + +FFX_OPTICALFLOW_NUM_THREADS +void main() +{ + PrepareLuma(FfxInt32x2(gl_GlobalInvocationID.xy), FfxInt32(gl_LocalInvocationIndex)); +} diff --git a/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/opticalflow/ffx_opticalflow_scale_optical_flow_advanced_pass_v5.glsl b/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/opticalflow/ffx_opticalflow_scale_optical_flow_advanced_pass_v5.glsl new file mode 100644 index 00000000..70142c25 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/src/backends/vk/shaders/opticalflow/ffx_opticalflow_scale_optical_flow_advanced_pass_v5.glsl @@ -0,0 +1,66 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#version 450 + +#extension GL_GOOGLE_include_directive : require +#extension GL_EXT_samplerless_texture_functions : require + +#define FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_INPUT 0 +#define FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW_PREVIOUS_INPUT 1 +#define FFX_OPTICALFLOW_BIND_SRV_OPTICAL_FLOW 2 + +#define FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_NEXT_LEVEL 3 +#define FFX_OPTICALFLOW_BIND_UAV_OPTICAL_FLOW_SCD_OUTPUT 4 + +#define FFX_OPTICALFLOW_BIND_CB_COMMON 5 + +#include "opticalflow/ffx_opticalflow_callbacks_glsl.h" +#include "opticalflow/ffx_opticalflow_common.h" + +#ifndef FFX_OPTICALFLOW_BLOCK_SIZE +#define FFX_OPTICALFLOW_BLOCK_SIZE 8 +#endif // #ifndef FFX_OPTICALFLOW_BLOCK_SIZE + +#ifndef FFX_OPTICALFLOW_THREAD_GROUP_WIDTH +#define FFX_OPTICALFLOW_THREAD_GROUP_WIDTH 4 +#endif // #ifndef FFX_OPTICALFLOW_THREAD_GROUP_WIDTH + +#ifndef FFX_OPTICALFLOW_THREAD_GROUP_HEIGHT +#define FFX_OPTICALFLOW_THREAD_GROUP_HEIGHT 4 +#endif // #ifndef FFX_OPTICALFLOW_THREAD_GROUP_HEIGHT + +#ifndef FFX_OPTICALFLOW_THREAD_GROUP_DEPTH +#define FFX_OPTICALFLOW_THREAD_GROUP_DEPTH 4 +#endif // #ifndef FFX_OPTICALFLOW_THREAD_GROUP_DEPTH + +#include "opticalflow/ffx_opticalflow_scale_optical_flow_advanced_v5.h" + +#ifndef FFX_OPTICALFLOW_NUM_THREADS +#define FFX_OPTICALFLOW_NUM_THREADS layout (local_size_x = FFX_OPTICALFLOW_THREAD_GROUP_WIDTH, local_size_y = FFX_OPTICALFLOW_THREAD_GROUP_HEIGHT, local_size_z = FFX_OPTICALFLOW_THREAD_GROUP_DEPTH) in; +#endif // #ifndef FFX_OPTICALFLOW_NUM_THREADS + +FFX_OPTICALFLOW_NUM_THREADS +void main() +{ + ScaleOpticalFlowAdvanced(FfxInt32x3(gl_GlobalInvocationID.xyz), FfxInt32x3(gl_LocalInvocationID.xyz)); +} diff --git a/runtime/third_party/FidelityFX/sdk/src/components/frameinterpolation/ffx_frameinterpolation.cpp b/runtime/third_party/FidelityFX/sdk/src/components/frameinterpolation/ffx_frameinterpolation.cpp new file mode 100644 index 00000000..a60ff6a5 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/src/components/frameinterpolation/ffx_frameinterpolation.cpp @@ -0,0 +1,1265 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#include // for max used inside SPD CPU code. +#include // for fabs, abs, sinf, sqrt, etc. +#include // for memset +#include // for FLT_EPSILON +#include + +#define FFX_CPU + +#ifdef __clang__ +#pragma clang diagnostic ignored "-Wunused-function" +#pragma clang diagnostic ignored "-Wsign-compare" +#endif + +#include +#include +#include + +#include "ffx_frameinterpolation_private.h" + +// lists to map shader resource bindpoint name to resource identifier +typedef struct ResourceBinding +{ + uint32_t index; + wchar_t name[64]; +}ResourceBinding; + +static const ResourceBinding srvResourceBindingTable[] = +{ + // Frame Interpolation textures + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_DEPTH, L"r_input_depth"}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_MOTION_VECTORS, L"r_input_motion_vectors"}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_DISTORTION_FIELD, L"r_input_distortion_field"}, + + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_DILATED_DEPTH, L"r_dilated_depth"}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_DILATED_MOTION_VECTORS, L"r_dilated_motion_vectors"}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_RECONSTRUCTED_DEPTH_PREVIOUS_FRAME, L"r_reconstructed_depth_previous_frame"}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_RECONSTRUCTED_DEPTH_INTERPOLATED_FRAME, L"r_reconstructed_depth_interpolated_frame"}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_PREVIOUS_INTERPOLATION_SOURCE, L"r_previous_interpolation_source"}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_CURRENT_INTERPOLATION_SOURCE, L"r_current_interpolation_source"}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_DISOCCLUSION_MASK, L"r_disocclusion_mask"}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_GAME_MOTION_VECTOR_FIELD_X, L"r_game_motion_vector_field_x"}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_GAME_MOTION_VECTOR_FIELD_Y, L"r_game_motion_vector_field_y"}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_OPTICAL_FLOW_MOTION_VECTOR_FIELD_X, L"r_optical_flow_motion_vector_field_x"}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_OPTICAL_FLOW_MOTION_VECTOR_FIELD_Y, L"r_optical_flow_motion_vector_field_y"}, + + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_OPTICAL_FLOW_VECTOR, L"r_optical_flow"}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_OPTICAL_FLOW_CONFIDENCE, L"r_optical_flow_confidence"}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_OPTICAL_FLOW_GLOBAL_MOTION, L"r_optical_flow_global_motion"}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_OPTICAL_FLOW_SCENE_CHANGE_DETECTION, L"r_optical_flow_scd"}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_OUTPUT, L"r_output"}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_INPAINTING_MASK, L"r_inpainting_mask"}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_INPAINTING_PYRAMID, L"r_inpainting_pyramid"}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_PRESENT_BACKBUFFER, L"r_present_backbuffer"}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_COUNTERS, L"r_counters"}, +}; + +static const ResourceBinding uavResourceBindingTable[] = +{ + // Frame Interpolation textures + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_DILATED_DEPTH, L"rw_dilated_depth"}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_DILATED_MOTION_VECTORS, L"rw_dilated_motion_vectors"}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_RECONSTRUCTED_DEPTH_PREVIOUS_FRAME, L"rw_reconstructed_depth_previous_frame"}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_RECONSTRUCTED_DEPTH_INTERPOLATED_FRAME, L"rw_reconstructed_depth_interpolated_frame"}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_OUTPUT, L"rw_output"}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_DISOCCLUSION_MASK, L"rw_disocclusion_mask"}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_GAME_MOTION_VECTOR_FIELD_X, L"rw_game_motion_vector_field_x"}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_GAME_MOTION_VECTOR_FIELD_Y, L"rw_game_motion_vector_field_y"}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_OPTICAL_FLOW_MOTION_VECTOR_FIELD_X, L"rw_optical_flow_motion_vector_field_x"}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_OPTICAL_FLOW_MOTION_VECTOR_FIELD_Y, L"rw_optical_flow_motion_vector_field_y"}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_INPAINTING_MASK, L"rw_inpainting_mask"}, + + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_COUNTERS, L"rw_counters"}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_INPAINTING_PYRAMID_MIPMAP_0, L"rw_inpainting_pyramid0"}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_INPAINTING_PYRAMID_MIPMAP_1, L"rw_inpainting_pyramid1"}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_INPAINTING_PYRAMID_MIPMAP_2, L"rw_inpainting_pyramid2"}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_INPAINTING_PYRAMID_MIPMAP_3, L"rw_inpainting_pyramid3"}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_INPAINTING_PYRAMID_MIPMAP_4, L"rw_inpainting_pyramid4"}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_INPAINTING_PYRAMID_MIPMAP_5, L"rw_inpainting_pyramid5"}, // extra declaration, as this is globallycoherent + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_INPAINTING_PYRAMID_MIPMAP_6, L"rw_inpainting_pyramid6"}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_INPAINTING_PYRAMID_MIPMAP_7, L"rw_inpainting_pyramid7"}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_INPAINTING_PYRAMID_MIPMAP_8, L"rw_inpainting_pyramid8"}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_INPAINTING_PYRAMID_MIPMAP_9, L"rw_inpainting_pyramid9"}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_INPAINTING_PYRAMID_MIPMAP_10, L"rw_inpainting_pyramid10"}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_INPAINTING_PYRAMID_MIPMAP_11, L"rw_inpainting_pyramid11"}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_INPAINTING_PYRAMID_MIPMAP_12, L"rw_inpainting_pyramid12"}, +}; + +static const ResourceBinding cbResourceBindingTable[] = +{ + {FFX_FRAMEINTERPOLATION_CONSTANTBUFFER_IDENTIFIER, L"cbFI"}, + {FFX_FRAMEINTERPOLATION_INPAINTING_PYRAMID_CONSTANTBUFFER_IDENTIFIER, L"cbInpaintingPyramid"}, +}; + +// Broad structure of the root signature. +typedef enum FrameInterpolationRootSignatureLayout { + + FRAMEINTERPOLATION_ROOT_SIGNATURE_LAYOUT_UAVS, + FRAMEINTERPOLATION_ROOT_SIGNATURE_LAYOUT_SRVS, + FRAMEINTERPOLATION_ROOT_SIGNATURE_LAYOUT_CONSTANTS, + FRAMEINTERPOLATION_ROOT_SIGNATURE_LAYOUT_CONSTANTS_REGISTER_1, + FRAMEINTERPOLATION_ROOT_SIGNATURE_LAYOUT_PARAMETER_COUNT +} FrameInterpolationRootSignatureLayout; + +typedef union FrameInterpolationSecondaryUnion +{ + InpaintingPyramidConstants inpaintingPyramidConstants; +} FrameInterpolationSecondaryUnion; + +// Lanczos +static float lanczos2(float value) +{ + return abs(value) < FFX_EPSILON ? 1.f : (sinf(FFX_PI * value) / (FFX_PI * value)) * (sinf(0.5f * FFX_PI * value) / (0.5f * FFX_PI * value)); +} + +// Calculate halton number for index and base. +static float halton(int32_t index, int32_t base) +{ + float f = 1.0f, result = 0.0f; + + for (int32_t currentIndex = index; currentIndex > 0;) { + + f /= (float)base; + result = result + f * (float)(currentIndex % base); + currentIndex = (uint32_t)(floorf((float)(currentIndex) / (float)(base))); + } + + return result; +} + +static FfxErrorCode patchResourceBindings(FfxPipelineState* inoutPipeline) +{ + for (uint32_t srvIndex = 0; srvIndex < inoutPipeline->srvTextureCount; ++srvIndex) + { + int32_t mapIndex = 0; + for (mapIndex = 0; mapIndex < _countof(srvResourceBindingTable); ++mapIndex) + { + if (0 == wcscmp(srvResourceBindingTable[mapIndex].name, inoutPipeline->srvTextureBindings[srvIndex].name)) + break; + } + if (mapIndex == _countof(srvResourceBindingTable)) + return FFX_ERROR_INVALID_ARGUMENT; + + inoutPipeline->srvTextureBindings[srvIndex].resourceIdentifier = srvResourceBindingTable[mapIndex].index; + } + + // check for UAVs where mip chains are to be bound + for (uint32_t uavIndex = 0; uavIndex < inoutPipeline->uavTextureCount; ++uavIndex) + { + int32_t mapIndex = 0; + for (mapIndex = 0; mapIndex < _countof(uavResourceBindingTable); ++mapIndex) + { + if (0 == wcscmp(uavResourceBindingTable[mapIndex].name, inoutPipeline->uavTextureBindings[uavIndex].name)) + break; + } + if (mapIndex == _countof(uavResourceBindingTable)) + return FFX_ERROR_INVALID_ARGUMENT; + + inoutPipeline->uavTextureBindings[uavIndex].resourceIdentifier = uavResourceBindingTable[mapIndex].index; + } + + for (uint32_t cbIndex = 0; cbIndex < inoutPipeline->constCount; ++cbIndex) + { + int32_t mapIndex = 0; + for (mapIndex = 0; mapIndex < _countof(cbResourceBindingTable); ++mapIndex) + { + if (0 == wcscmp(cbResourceBindingTable[mapIndex].name, inoutPipeline->constantBufferBindings[cbIndex].name)) + break; + } + if (mapIndex == _countof(cbResourceBindingTable)) + return FFX_ERROR_INVALID_ARGUMENT; + + inoutPipeline->constantBufferBindings[cbIndex].resourceIdentifier = cbResourceBindingTable[mapIndex].index; + } + + for (uint32_t uavBufferIndex = 0; uavBufferIndex < inoutPipeline->uavBufferCount; ++uavBufferIndex) + { + int32_t mapIndex = 0; + for (mapIndex = 0; mapIndex < _countof(uavResourceBindingTable); ++mapIndex) + { + if (0 == wcscmp(uavResourceBindingTable[mapIndex].name, inoutPipeline->uavBufferBindings[uavBufferIndex].name)) + break; + } + if (mapIndex == _countof(uavResourceBindingTable)) + return FFX_ERROR_INVALID_ARGUMENT; + + inoutPipeline->uavBufferBindings[uavBufferIndex].resourceIdentifier = uavResourceBindingTable[mapIndex].index; + } + + for (uint32_t srvBufferIndex = 0; srvBufferIndex < inoutPipeline->srvBufferCount; ++srvBufferIndex) + { + int32_t mapIndex = 0; + for (mapIndex = 0; mapIndex < _countof(srvResourceBindingTable); ++mapIndex) + { + if (0 == wcscmp(srvResourceBindingTable[mapIndex].name, inoutPipeline->srvBufferBindings[srvBufferIndex].name)) + break; + } + if (mapIndex == _countof(srvResourceBindingTable)) + return FFX_ERROR_INVALID_ARGUMENT; + + inoutPipeline->srvBufferBindings[srvBufferIndex].resourceIdentifier = srvResourceBindingTable[mapIndex].index; + } + + + return FFX_OK; +} + +static uint32_t getPipelinePermutationFlags(uint32_t contextFlags, FfxPass, bool fp16, bool force64, bool) +{ + // work out what permutation to load. + uint32_t flags = 0; + flags |= (contextFlags & FFX_FRAMEINTERPOLATION_ENABLE_DISPLAY_RESOLUTION_MOTION_VECTORS) ? 0 : FRAMEINTERPOLATION_SHADER_PERMUTATION_LOW_RES_MOTION_VECTORS; + flags |= (contextFlags & FFX_FRAMEINTERPOLATION_ENABLE_JITTER_MOTION_VECTORS) ? FRAMEINTERPOLATION_SHADER_PERMUTATION_JITTER_MOTION_VECTORS : 0; + flags |= (contextFlags & FFX_FRAMEINTERPOLATION_ENABLE_DEPTH_INVERTED) ? FRAMEINTERPOLATION_SHADER_PERMUTATION_DEPTH_INVERTED : 0; + flags |= (force64) ? FRAMEINTERPOLATION_SHADER_PERMUTATION_FORCE_WAVE64 : 0; + flags |= (fp16) ? FRAMEINTERPOLATION_SHADER_PERMUTATION_ALLOW_FP16 : 0; + return flags; +} + +static FfxErrorCode createPipelineStates(FfxFrameInterpolationContext_Private* context) +{ + FFX_ASSERT(context); + + FfxPipelineDescription pipelineDescription = {}; + pipelineDescription.contextFlags = context->contextDescription.flags; + pipelineDescription.stage = FFX_BIND_COMPUTE_SHADER_STAGE; + + // Samplers + pipelineDescription.samplerCount = 2; + FfxSamplerDescription samplerDescs[2] = { + {FFX_FILTER_TYPE_MINMAGMIP_POINT, FFX_ADDRESS_MODE_CLAMP, FFX_ADDRESS_MODE_CLAMP, FFX_ADDRESS_MODE_CLAMP, FFX_BIND_COMPUTE_SHADER_STAGE}, + {FFX_FILTER_TYPE_MINMAGMIP_LINEAR, FFX_ADDRESS_MODE_CLAMP, FFX_ADDRESS_MODE_CLAMP, FFX_ADDRESS_MODE_CLAMP, FFX_BIND_COMPUTE_SHADER_STAGE}}; + pipelineDescription.samplers = samplerDescs; + + // Root constants + pipelineDescription.rootConstantBufferCount = 2; + FfxRootConstantDescription rootConstantDescs[2] = + { + {sizeof(FrameInterpolationConstants) / sizeof(uint32_t), FFX_BIND_COMPUTE_SHADER_STAGE}, + {sizeof(InpaintingPyramidConstants) / sizeof(uint32_t), FFX_BIND_COMPUTE_SHADER_STAGE} + }; + pipelineDescription.rootConstants = rootConstantDescs; + + // Query device capabilities + FfxDeviceCapabilities capabilities; + context->contextDescription.backendInterface.fpGetDeviceCapabilities(&context->contextDescription.backendInterface, &capabilities); + + // Setup a few options used to determine permutation flags + bool haveShaderModel66 = capabilities.maximumSupportedShaderModel >= FFX_SHADER_MODEL_6_6; + bool supportedFP16 = capabilities.fp16Supported; + bool canForceWave64 = false; + bool useLut = false; + + const uint32_t waveLaneCountMin = capabilities.waveLaneCountMin; + const uint32_t waveLaneCountMax = capabilities.waveLaneCountMax; + if (waveLaneCountMin == 32 && waveLaneCountMax == 64) + { + useLut = true; + canForceWave64 = haveShaderModel66; + } + else + canForceWave64 = false; + + // Work out what permutation to load. + uint32_t contextFlags = context->contextDescription.flags; + + // Set up pipeline descriptor (basically RootSignature and binding) + auto CreateComputePipeline = [&](FfxPass pass, const wchar_t* name, FfxPipelineState* pipeline) -> FfxErrorCode { + ffxSafeReleasePipeline(&context->contextDescription.backendInterface, pipeline, context->effectContextId); + wcscpy_s(pipelineDescription.name, name); + FFX_VALIDATE(context->contextDescription.backendInterface.fpCreatePipeline( + &context->contextDescription.backendInterface, + FFX_EFFECT_FRAMEINTERPOLATION, + pass, + getPipelinePermutationFlags(contextFlags, pass, supportedFP16, canForceWave64, useLut), + &pipelineDescription, + context->effectContextId, + pipeline)); + patchResourceBindings(pipeline); + + return FFX_OK; + }; + + auto CreateRasterPipeline = [&](FfxPass pass, const wchar_t* name, FfxPipelineState* pipeline) -> FfxErrorCode { + wcscpy_s(pipelineDescription.name, name); + pipelineDescription.stage = (FfxBindStage)(FFX_BIND_VERTEX_SHADER_STAGE | FFX_BIND_PIXEL_SHADER_STAGE); + pipelineDescription.backbufferFormat = context->contextDescription.backBufferFormat; + FFX_VALIDATE(context->contextDescription.backendInterface.fpCreatePipeline( + &context->contextDescription.backendInterface, + FFX_EFFECT_FRAMEINTERPOLATION, + pass, + getPipelinePermutationFlags(contextFlags, pass, supportedFP16, canForceWave64, useLut), + &pipelineDescription, + context->effectContextId, + pipeline)); + + return FFX_OK; + }; + + // Frame Interpolation Pipelines + CreateComputePipeline(FFX_FRAMEINTERPOLATION_PASS_RECONSTRUCT_AND_DILATE, L"RECONSTRUCT_AND_DILATE", &context->pipelineFiReconstructAndDilate); + CreateComputePipeline(FFX_FRAMEINTERPOLATION_PASS_SETUP, L"SETUP", &context->pipelineFiSetup); + CreateComputePipeline(FFX_FRAMEINTERPOLATION_PASS_RECONSTRUCT_PREV_DEPTH, L"RECONSTRUCT_PREV_DEPTH", &context->pipelineFiReconstructPreviousDepth); + CreateComputePipeline(FFX_FRAMEINTERPOLATION_PASS_GAME_MOTION_VECTOR_FIELD, L"GAME_MOTION_VECTOR_FIELD", &context->pipelineFiGameMotionVectorField); + CreateComputePipeline(FFX_FRAMEINTERPOLATION_PASS_OPTICAL_FLOW_VECTOR_FIELD, L"OPTICAL_FLOW_VECTOR_FIELD", &context->pipelineFiOpticalFlowVectorField); + CreateComputePipeline(FFX_FRAMEINTERPOLATION_PASS_DISOCCLUSION_MASK, L"DISOCCLUSION_MASK", &context->pipelineFiDisocclusionMask); + CreateComputePipeline(FFX_FRAMEINTERPOLATION_PASS_INTERPOLATION, L"INTERPOLATION", &context->pipelineFiScfi); + CreateComputePipeline(FFX_FRAMEINTERPOLATION_PASS_INPAINTING_PYRAMID, L"INPAINTING_PYRAMID", &context->pipelineInpaintingPyramid); + CreateComputePipeline(FFX_FRAMEINTERPOLATION_PASS_INPAINTING, L"INPAINTING", &context->pipelineInpainting); + CreateComputePipeline(FFX_FRAMEINTERPOLATION_PASS_GAME_VECTOR_FIELD_INPAINTING_PYRAMID, L"GAME_VECTOR_FIELD_INPAINTING_PYRAMID", & context->pipelineGameVectorFieldInpaintingPyramid); + CreateComputePipeline(FFX_FRAMEINTERPOLATION_PASS_DEBUG_VIEW, L"DEBUG_VIEW", &context->pipelineDebugView); + + return FFX_OK; +} + + +// Format precision group for HUDless. +// Also format needs at least the 3 RGB channels to be valid +// int formats aren't accepted. +int GetFormatPrecisionGroup(FfxSurfaceFormat format) +{ + switch (format) + { + case FFX_SURFACE_FORMAT_R32G32B32A32_TYPELESS: + case FFX_SURFACE_FORMAT_R32G32B32A32_FLOAT: + case FFX_SURFACE_FORMAT_R32G32B32_FLOAT: + return 0; + + case FFX_SURFACE_FORMAT_R16G16B16A16_TYPELESS: + case FFX_SURFACE_FORMAT_R16G16B16A16_FLOAT: + return 1; + + case FFX_SURFACE_FORMAT_R8G8B8A8_TYPELESS: + case FFX_SURFACE_FORMAT_R8G8B8A8_UNORM: + case FFX_SURFACE_FORMAT_B8G8R8A8_TYPELESS: + case FFX_SURFACE_FORMAT_B8G8R8A8_UNORM: + return 2; + + case FFX_SURFACE_FORMAT_R8G8B8A8_SNORM: + return 3; + + case FFX_SURFACE_FORMAT_R8G8B8A8_SRGB: + case FFX_SURFACE_FORMAT_B8G8R8A8_SRGB: + return 4; + + case FFX_SURFACE_FORMAT_R11G11B10_FLOAT: + return 5; + + case FFX_SURFACE_FORMAT_R10G10B10A2_TYPELESS: + case FFX_SURFACE_FORMAT_R10G10B10A2_UNORM: + return 6; + + case FFX_SURFACE_FORMAT_R9G9B9E5_SHAREDEXP: + return 7; + + // we don't accept the following formats + case FFX_SURFACE_FORMAT_R32G32B32A32_UINT: + case FFX_SURFACE_FORMAT_R32G32_FLOAT: + case FFX_SURFACE_FORMAT_R8_UINT: + case FFX_SURFACE_FORMAT_R32_UINT: + case FFX_SURFACE_FORMAT_R16G16_UINT: + case FFX_SURFACE_FORMAT_R16G16_SINT: + case FFX_SURFACE_FORMAT_R16G16_FLOAT: + case FFX_SURFACE_FORMAT_R16_FLOAT: + case FFX_SURFACE_FORMAT_R16_UINT: + case FFX_SURFACE_FORMAT_R16_UNORM: + case FFX_SURFACE_FORMAT_R16_SNORM: + case FFX_SURFACE_FORMAT_R8_UNORM: + case FFX_SURFACE_FORMAT_R8G8_UNORM: + case FFX_SURFACE_FORMAT_R8G8_UINT: + case FFX_SURFACE_FORMAT_R32_FLOAT: + case FFX_SURFACE_FORMAT_UNKNOWN: + default: + return -1; + } +} + +static FfxErrorCode frameinterpolationCreate(FfxFrameInterpolationContext_Private* context, const FfxFrameInterpolationContextDescription* contextDescription) +{ + FFX_ASSERT(context); + FFX_ASSERT(contextDescription); + + // validate compatibility between backbuffer and hudless formats + int backBufferGroup = GetFormatPrecisionGroup(contextDescription->backBufferFormat); + int previousInterpolationSourceGroup = GetFormatPrecisionGroup(contextDescription->previousInterpolationSourceFormat); + FFX_RETURN_ON_ERROR(backBufferGroup >= 0 && previousInterpolationSourceGroup >= 0 && backBufferGroup == previousInterpolationSourceGroup, FFX_ERROR_INVALID_ARGUMENT); + + // Setup the data for implementation. + memset(context, 0, sizeof(FfxFrameInterpolationContext_Private)); + context->device = contextDescription->backendInterface.device; + + memcpy(&context->contextDescription, contextDescription, sizeof(FfxFrameInterpolationContextDescription)); + + // Check version info - make sure we are linked with the right backend version + FfxVersionNumber version = context->contextDescription.backendInterface.fpGetSDKVersion(&context->contextDescription.backendInterface); + FFX_RETURN_ON_ERROR(version == FFX_SDK_MAKE_VERSION(1, 1, 4), FFX_ERROR_INVALID_VERSION); + + // Create the context. + FfxErrorCode errorCode = context->contextDescription.backendInterface.fpCreateBackendContext(&context->contextDescription.backendInterface, FFX_EFFECT_FRAMEINTERPOLATION, nullptr, &context->effectContextId); + FFX_RETURN_ON_ERROR(errorCode == FFX_OK, errorCode); + + // call out for device caps. + errorCode = context->contextDescription.backendInterface.fpGetDeviceCapabilities(&context->contextDescription.backendInterface, &context->deviceCapabilities); + FFX_RETURN_ON_ERROR(errorCode == FFX_OK, errorCode); + + // set defaults + context->firstExecution = true; + + context->asyncSupported = (contextDescription->flags & FFX_FRAMEINTERPOLATION_ENABLE_ASYNC_SUPPORT) == FFX_FRAMEINTERPOLATION_ENABLE_ASYNC_SUPPORT; + context->constants.maxRenderSize[0] = contextDescription->maxRenderSize.width; + context->constants.maxRenderSize[1] = contextDescription->maxRenderSize.height; + context->constants.displaySize[0] = contextDescription->displaySize.width; + context->constants.displaySize[1] = contextDescription->displaySize.height; + context->constants.displaySizeRcp[0] = 1.0f / contextDescription->displaySize.width; + context->constants.displaySizeRcp[1] = 1.0f / contextDescription->displaySize.height; + context->constants.interpolationRectBase[0] = 0; + context->constants.interpolationRectBase[1] = 0; + context->constants.interpolationRectSize[0] = contextDescription->displaySize.width; + context->constants.interpolationRectSize[1] = contextDescription->displaySize.height; + + // generate the data for the LUT. + const uint32_t lanczos2LutWidth = 128; + int16_t lanczos2Weights[lanczos2LutWidth] = { }; + + for (uint32_t currentLanczosWidthIndex = 0; currentLanczosWidthIndex < lanczos2LutWidth; currentLanczosWidthIndex++) { + + const float x = 2.0f * currentLanczosWidthIndex / float(lanczos2LutWidth - 1); + const float y = lanczos2(x); + lanczos2Weights[currentLanczosWidthIndex] = int16_t(roundf(y * 32767.0f)); + } + + uint8_t defaultDistortionFieldData[2] = { 0, 0 }; + uint32_t atomicInitData[2] = { 0, 0 }; + float defaultExposure[] = { 0.0f, 0.0f }; + const FfxResourceType texture1dResourceType = (context->contextDescription.flags & FFX_FRAMEINTERPOLATION_ENABLE_TEXTURE1D_USAGE) ? FFX_RESOURCE_TYPE_TEXTURE1D : FFX_RESOURCE_TYPE_TEXTURE2D; + + // declare internal resources needed + const FfxInternalResourceDescription internalSurfaceDesc[] = { + + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_RECONSTRUCTED_DEPTH_INTERPOLATED_FRAME, L"FI_ReconstructedDepthInterpolatedFrame", FFX_RESOURCE_TYPE_TEXTURE2D, FFX_RESOURCE_USAGE_UAV, + FFX_SURFACE_FORMAT_R32_UINT, contextDescription->maxRenderSize.width, contextDescription->maxRenderSize.height, 1, FFX_RESOURCE_FLAGS_ALIASABLE, {FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED}}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_GAME_MOTION_VECTOR_FIELD_X, L"FI_GameMotionVectorFieldX", FFX_RESOURCE_TYPE_TEXTURE2D, FFX_RESOURCE_USAGE_UAV, + FFX_SURFACE_FORMAT_R32_UINT, contextDescription->maxRenderSize.width, contextDescription->maxRenderSize.height, 1, FFX_RESOURCE_FLAGS_ALIASABLE, {FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED}}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_GAME_MOTION_VECTOR_FIELD_Y, L"FI_GameMotionVectorFieldY", FFX_RESOURCE_TYPE_TEXTURE2D, FFX_RESOURCE_USAGE_UAV, + FFX_SURFACE_FORMAT_R32_UINT, contextDescription->maxRenderSize.width, contextDescription->maxRenderSize.height, 1, FFX_RESOURCE_FLAGS_ALIASABLE, {FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED}}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_INPAINTING_PYRAMID, L"FI_InpaintingPyramid", FFX_RESOURCE_TYPE_TEXTURE2D, FFX_RESOURCE_USAGE_UAV, + FFX_SURFACE_FORMAT_R16G16B16A16_FLOAT, contextDescription->displaySize.width / 2, contextDescription->displaySize.height / 2, 0, FFX_RESOURCE_FLAGS_ALIASABLE, {FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED}}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_COUNTERS, L"FI_Counters", FFX_RESOURCE_TYPE_BUFFER, FFX_RESOURCE_USAGE_UAV, + FFX_SURFACE_FORMAT_UNKNOWN, 8, 4, 1, FFX_RESOURCE_FLAGS_NONE, {FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED}}, // structured buffer contraining 2 UINT values + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_OPTICAL_FLOW_MOTION_VECTOR_FIELD_X, L"FI_OpticalFlowMotionVectorFieldX", FFX_RESOURCE_TYPE_TEXTURE2D, FFX_RESOURCE_USAGE_UAV, + FFX_SURFACE_FORMAT_R32_UINT, contextDescription->maxRenderSize.width, contextDescription->maxRenderSize.height, 1, FFX_RESOURCE_FLAGS_ALIASABLE, {FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED}}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_OPTICAL_FLOW_MOTION_VECTOR_FIELD_Y, L"FI_OpticalFlowMotionVectorFieldY", FFX_RESOURCE_TYPE_TEXTURE2D, FFX_RESOURCE_USAGE_UAV, + FFX_SURFACE_FORMAT_R32_UINT, contextDescription->maxRenderSize.width, contextDescription->maxRenderSize.height, 1, FFX_RESOURCE_FLAGS_ALIASABLE, {FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED}}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_PREVIOUS_INTERPOLATION_SOURCE, L"FI_PreviousInterpolationSouce", FFX_RESOURCE_TYPE_TEXTURE2D, FFX_RESOURCE_USAGE_UAV, + contextDescription->previousInterpolationSourceFormat, contextDescription->displaySize.width, contextDescription->displaySize.height, 1, FFX_RESOURCE_FLAGS_NONE, {FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED}}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_INPAINTING_MASK, L"FI_InpaintingMask", FFX_RESOURCE_TYPE_TEXTURE2D, FFX_RESOURCE_USAGE_UAV, + FFX_SURFACE_FORMAT_R8_UNORM, contextDescription->displaySize.width, contextDescription->displaySize.height, 1, FFX_RESOURCE_FLAGS_ALIASABLE, {FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED}}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_DISOCCLUSION_MASK, L"FI_DisocclusionMask", FFX_RESOURCE_TYPE_TEXTURE2D, FFX_RESOURCE_USAGE_UAV, + FFX_SURFACE_FORMAT_R8G8_UNORM, contextDescription->maxRenderSize.width, contextDescription->maxRenderSize.height, 1, FFX_RESOURCE_FLAGS_ALIASABLE, {FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED}}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_DEFAULT_DISTORTION_FIELD, L"FI_DefaultDistortionField", FFX_RESOURCE_TYPE_TEXTURE2D, FFX_RESOURCE_USAGE_READ_ONLY, + FFX_SURFACE_FORMAT_R8G8_UNORM, 1, 1, 1, FFX_RESOURCE_FLAGS_NONE, FfxResourceInitData::FfxResourceInitBuffer(sizeof(defaultDistortionFieldData), defaultDistortionFieldData) }, + + }; + + // clear the SRV resources to NULL. + memset(context->srvResources, 0, sizeof(context->srvResources)); + + for (int32_t currentSurfaceIndex = 0; currentSurfaceIndex < FFX_ARRAY_ELEMENTS(internalSurfaceDesc); ++currentSurfaceIndex) { + + const FfxInternalResourceDescription* currentSurfaceDescription = &internalSurfaceDesc[currentSurfaceIndex]; + const FfxResourceDescription resourceDescription = {currentSurfaceDescription->type, + currentSurfaceDescription->format, + currentSurfaceDescription->width, + currentSurfaceDescription->height, + 1, + currentSurfaceDescription->mipCount, + currentSurfaceDescription->flags, + currentSurfaceDescription->usage}; + FfxResourceStates initialState = FFX_RESOURCE_STATE_UNORDERED_ACCESS; + if (currentSurfaceDescription->usage == FFX_RESOURCE_USAGE_READ_ONLY) initialState = FFX_RESOURCE_STATE_COMPUTE_READ; + if (currentSurfaceDescription->usage == FFX_RESOURCE_USAGE_RENDERTARGET) initialState = FFX_RESOURCE_STATE_RENDER_TARGET; + + const FfxCreateResourceDescription createResourceDescription = { FFX_HEAP_TYPE_DEFAULT, resourceDescription, initialState, currentSurfaceDescription->name, currentSurfaceDescription->id, currentSurfaceDescription->initData }; + + FFX_VALIDATE(context->contextDescription.backendInterface.fpCreateResource(&context->contextDescription.backendInterface, &createResourceDescription, context->effectContextId, &context->srvResources[currentSurfaceDescription->id])); + } + + // copy resources to uavResrouces list + memcpy(context->uavResources, context->srvResources, sizeof(context->srvResources)); + + // avoid compiling pipelines on first render + { + context->refreshPipelineStates = false; + errorCode = createPipelineStates(context); + FFX_RETURN_ON_ERROR(errorCode == FFX_OK, errorCode); + } + + return FFX_OK; +} + +static FfxErrorCode frameinterpolationRelease(FfxFrameInterpolationContext_Private* context) +{ + FFX_ASSERT(context); + + ffxSafeReleasePipeline(&context->contextDescription.backendInterface, &context->pipelineFiReconstructAndDilate, context->effectContextId); + ffxSafeReleasePipeline(&context->contextDescription.backendInterface, &context->pipelineFiSetup, context->effectContextId); + ffxSafeReleasePipeline(&context->contextDescription.backendInterface, &context->pipelineFiReconstructPreviousDepth, context->effectContextId); + ffxSafeReleasePipeline(&context->contextDescription.backendInterface, &context->pipelineFiGameMotionVectorField, context->effectContextId); + ffxSafeReleasePipeline(&context->contextDescription.backendInterface, &context->pipelineFiOpticalFlowVectorField, context->effectContextId); + ffxSafeReleasePipeline(&context->contextDescription.backendInterface, &context->pipelineFiDisocclusionMask, context->effectContextId); + ffxSafeReleasePipeline(&context->contextDescription.backendInterface, &context->pipelineFiScfi, context->effectContextId); + ffxSafeReleasePipeline(&context->contextDescription.backendInterface, &context->pipelineInpaintingPyramid, context->effectContextId); + ffxSafeReleasePipeline(&context->contextDescription.backendInterface, &context->pipelineInpainting, context->effectContextId); + ffxSafeReleasePipeline(&context->contextDescription.backendInterface, &context->pipelineGameVectorFieldInpaintingPyramid, context->effectContextId); + ffxSafeReleasePipeline(&context->contextDescription.backendInterface, &context->pipelineDebugView, context->effectContextId); + + // unregister resources not created internally + context->srvResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_CURRENT_INTERPOLATION_SOURCE] = {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_NULL}; + context->srvResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_OPTICAL_FLOW_VECTOR] = {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_NULL}; + context->srvResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_OPTICAL_FLOW_CONFIDENCE] = {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_NULL}; + context->srvResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_OPTICAL_FLOW_GLOBAL_MOTION] = {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_NULL}; + context->srvResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_OPTICAL_FLOW_SCENE_CHANGE_DETECTION] = {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_NULL}; + context->srvResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_OUTPUT] = {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_NULL}; + context->uavResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_OUTPUT] = {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_NULL}; + context->srvResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_DILATED_DEPTH] = {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_NULL}; + context->uavResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_DILATED_DEPTH] = {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_NULL}; + context->srvResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_DILATED_MOTION_VECTORS] = {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_NULL}; + context->uavResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_DILATED_MOTION_VECTORS] = {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_NULL}; + context->srvResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_RECONSTRUCTED_DEPTH_PREVIOUS_FRAME] = {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_NULL}; + context->uavResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_RECONSTRUCTED_DEPTH_PREVIOUS_FRAME] = {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_NULL}; + context->srvResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_DISTORTION_FIELD] = {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_NULL}; + + // Release the copy resources for those that had init data + ffxSafeReleaseCopyResource(&context->contextDescription.backendInterface, context->srvResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_COUNTERS], context->effectContextId); + ffxSafeReleaseCopyResource(&context->contextDescription.backendInterface, context->srvResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_DEFAULT_DISTORTION_FIELD], context->effectContextId); + + // release internal resources + for (int32_t currentResourceIndex = 0; currentResourceIndex < FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_COUNT; ++currentResourceIndex) { + + ffxSafeReleaseResource(&context->contextDescription.backendInterface, context->srvResources[currentResourceIndex], context->effectContextId); + } + + // Destroy the context + context->contextDescription.backendInterface.fpDestroyBackendContext(&context->contextDescription.backendInterface, context->effectContextId); + + return FFX_OK; +} + +static void scheduleDispatch(FfxFrameInterpolationContext_Private* context, const FfxPipelineState* pipeline, uint32_t dispatchX, uint32_t dispatchY) +{ + FfxComputeJobDescription jobDescriptor = {}; + + for (uint32_t currentShaderResourceViewIndex = 0; currentShaderResourceViewIndex < pipeline->srvTextureCount; ++currentShaderResourceViewIndex) + { + const uint32_t currentResourceId = pipeline->srvTextureBindings[currentShaderResourceViewIndex].resourceIdentifier; + const FfxResourceInternal currentResource = context->srvResources[currentResourceId]; + jobDescriptor.srvTextures[currentShaderResourceViewIndex].resource = currentResource; +#ifdef FFX_DEBUG + wcscpy_s(jobDescriptor.srvTextures[currentShaderResourceViewIndex].name, pipeline->srvTextureBindings[currentShaderResourceViewIndex].name); +#endif + } + + for (uint32_t currentUnorderedAccessViewIndex = 0; currentUnorderedAccessViewIndex < pipeline->uavTextureCount; ++currentUnorderedAccessViewIndex) { + + const uint32_t currentResourceId = pipeline->uavTextureBindings[currentUnorderedAccessViewIndex].resourceIdentifier; +#ifdef FFX_DEBUG + wcscpy_s(jobDescriptor.uavTextures[currentUnorderedAccessViewIndex].name, pipeline->uavTextureBindings[currentUnorderedAccessViewIndex].name); +#endif + + if (currentResourceId >= FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_INPAINTING_PYRAMID_MIPMAP_0 && currentResourceId <= FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_INPAINTING_PYRAMID_MIPMAP_12) + { + const FfxResourceInternal currentResource = context->uavResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_INPAINTING_PYRAMID]; + jobDescriptor.uavTextures[currentUnorderedAccessViewIndex].resource = currentResource; + jobDescriptor.uavTextures[currentUnorderedAccessViewIndex].mip = currentResourceId - FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_INPAINTING_PYRAMID_MIPMAP_0; + } + else + { + const FfxResourceInternal currentResource = context->uavResources[currentResourceId]; + jobDescriptor.uavTextures[currentUnorderedAccessViewIndex].resource = currentResource; + jobDescriptor.uavTextures[currentUnorderedAccessViewIndex].mip = 0; + } + } + + jobDescriptor.dimensions[0] = dispatchX; + jobDescriptor.dimensions[1] = dispatchY; + jobDescriptor.dimensions[2] = 1; + jobDescriptor.pipeline = *pipeline; + + for (uint32_t currentRootConstantIndex = 0; currentRootConstantIndex < pipeline->constCount; ++currentRootConstantIndex) { +#ifdef FFX_DEBUG + wcscpy_s(jobDescriptor.cbNames[currentRootConstantIndex], pipeline->constantBufferBindings[currentRootConstantIndex].name); +#endif + jobDescriptor.cbs[currentRootConstantIndex] = context->constantBuffers[pipeline->constantBufferBindings[currentRootConstantIndex].resourceIdentifier]; + } + + for (uint32_t currentUnorderedAccessViewIndex = 0; currentUnorderedAccessViewIndex < pipeline->uavBufferCount; ++currentUnorderedAccessViewIndex) + { + const uint32_t currentResourceId = pipeline->uavBufferBindings[currentUnorderedAccessViewIndex].resourceIdentifier; + jobDescriptor.uavBuffers[currentUnorderedAccessViewIndex].resource = context->uavResources[currentResourceId]; +#ifdef FFX_DEBUG + wcscpy_s(jobDescriptor.uavBuffers[currentUnorderedAccessViewIndex].name, pipeline->uavBufferBindings[currentUnorderedAccessViewIndex].name); +#endif + } + + for (uint32_t currentShaderResourceViewIndex = 0; currentShaderResourceViewIndex < pipeline->srvBufferCount; ++currentShaderResourceViewIndex) + { + const uint32_t currentResourceId = pipeline->srvBufferBindings[currentShaderResourceViewIndex].resourceIdentifier; + jobDescriptor.srvBuffers[currentShaderResourceViewIndex].resource = context->srvResources[currentResourceId]; +#ifdef FFX_DEBUG + wcscpy_s(jobDescriptor.srvBuffers[currentShaderResourceViewIndex].name, pipeline->srvBufferBindings[currentShaderResourceViewIndex].name); +#endif + } + + FfxGpuJobDescription dispatchJob = { FFX_GPU_JOB_COMPUTE }; + wcscpy_s(dispatchJob.jobLabel, pipeline->name); + dispatchJob.computeJobDescriptor = jobDescriptor; + + context->contextDescription.backendInterface.fpScheduleGpuJob(&context->contextDescription.backendInterface, &dispatchJob); +} + +FFX_API FfxErrorCode ffxFrameInterpolationGetSharedResourceDescriptions(FfxFrameInterpolationContext* context, FfxFrameInterpolationSharedResourceDescriptions* SharedResources) +{ + FFX_RETURN_ON_ERROR( + context, + FFX_ERROR_INVALID_POINTER); + FFX_RETURN_ON_ERROR( + SharedResources, + FFX_ERROR_INVALID_POINTER); + + FfxFrameInterpolationContext_Private* contextPrivate = (FfxFrameInterpolationContext_Private*)(context); + SharedResources->dilatedDepth = { FFX_HEAP_TYPE_DEFAULT, { FFX_RESOURCE_TYPE_TEXTURE2D, FFX_SURFACE_FORMAT_R32_FLOAT, contextPrivate->contextDescription.maxRenderSize.width, contextPrivate->contextDescription.maxRenderSize.height, 1, 1, FFX_RESOURCE_FLAGS_NONE, (FfxResourceUsage)(FFX_RESOURCE_USAGE_RENDERTARGET | FFX_RESOURCE_USAGE_UAV | FFX_RESOURCE_USAGE_DCC_RENDERTARGET) }, + FFX_RESOURCE_STATE_UNORDERED_ACCESS, L"FISHARED_DilatedDepth", FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_DILATED_DEPTH, {FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED} }; + SharedResources->dilatedMotionVectors = { FFX_HEAP_TYPE_DEFAULT, { FFX_RESOURCE_TYPE_TEXTURE2D, FFX_SURFACE_FORMAT_R16G16_FLOAT, contextPrivate->contextDescription.maxRenderSize.width, contextPrivate->contextDescription.maxRenderSize.height, 1, 1, FFX_RESOURCE_FLAGS_NONE, (FfxResourceUsage)(FFX_RESOURCE_USAGE_RENDERTARGET | FFX_RESOURCE_USAGE_UAV | FFX_RESOURCE_USAGE_DCC_RENDERTARGET) }, + FFX_RESOURCE_STATE_UNORDERED_ACCESS, L"FISHARED_DilatedVelocity", FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_DILATED_MOTION_VECTORS, {FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED} }; + SharedResources->reconstructedPrevNearestDepth = { FFX_HEAP_TYPE_DEFAULT, { FFX_RESOURCE_TYPE_TEXTURE2D, FFX_SURFACE_FORMAT_R32_UINT, contextPrivate->contextDescription.maxRenderSize.width, contextPrivate->contextDescription.maxRenderSize.height, 1, 1, FFX_RESOURCE_FLAGS_NONE, (FfxResourceUsage)(FFX_RESOURCE_USAGE_UAV) }, + FFX_RESOURCE_STATE_UNORDERED_ACCESS, L"FISHARED_ReconstructedPrevNearestDepth", FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_RECONSTRUCTED_DEPTH_PREVIOUS_FRAME, {FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED} }; + + return FFX_OK; +} + +FfxErrorCode ffxFrameInterpolationContextCreate(FfxFrameInterpolationContext* context, FfxFrameInterpolationContextDescription* contextDescription) +{ + // zero context memory + //memset(context, 0, sizeof(FfxFrameinterpolationContext)); + + // check pointers are valid. + FFX_RETURN_ON_ERROR( + context, + FFX_ERROR_INVALID_POINTER); + FFX_RETURN_ON_ERROR( + contextDescription, + FFX_ERROR_INVALID_POINTER); + + // validate that all callbacks are set for the interface + FFX_RETURN_ON_ERROR(contextDescription->backendInterface.fpGetSDKVersion, FFX_ERROR_INCOMPLETE_INTERFACE); + FFX_RETURN_ON_ERROR(contextDescription->backendInterface.fpGetDeviceCapabilities, FFX_ERROR_INCOMPLETE_INTERFACE); + FFX_RETURN_ON_ERROR(contextDescription->backendInterface.fpCreateBackendContext, FFX_ERROR_INCOMPLETE_INTERFACE); + FFX_RETURN_ON_ERROR(contextDescription->backendInterface.fpDestroyBackendContext, FFX_ERROR_INCOMPLETE_INTERFACE); + + // if a scratch buffer is declared, then we must have a size + if (contextDescription->backendInterface.scratchBuffer) { + + FFX_RETURN_ON_ERROR(contextDescription->backendInterface.scratchBufferSize, FFX_ERROR_INCOMPLETE_INTERFACE); + } + + // ensure the context is large enough for the internal context. + FFX_STATIC_ASSERT(sizeof(FfxFrameInterpolationContext) >= sizeof(FfxFrameInterpolationContext_Private)); + + // create the context. + FfxFrameInterpolationContext_Private* contextPrivate = (FfxFrameInterpolationContext_Private*)(context); + FfxErrorCode errorCode = frameinterpolationCreate(contextPrivate, contextDescription); + + return errorCode; +} + +FFX_API FfxErrorCode ffxFrameInterpolationContextGetGpuMemoryUsage(FfxFrameInterpolationContext* context, FfxEffectMemoryUsage* vramUsage) +{ + FFX_RETURN_ON_ERROR(context, FFX_ERROR_INVALID_POINTER); + FFX_RETURN_ON_ERROR(vramUsage, FFX_ERROR_INVALID_POINTER); + FfxFrameInterpolationContext_Private* contextPrivate = (FfxFrameInterpolationContext_Private*)(context); + + FFX_RETURN_ON_ERROR(contextPrivate->device, FFX_ERROR_NULL_DEVICE); + + FfxErrorCode errorCode = contextPrivate->contextDescription.backendInterface.fpGetEffectGpuMemoryUsage( + &contextPrivate->contextDescription.backendInterface, contextPrivate->effectContextId, vramUsage); + FFX_RETURN_ON_ERROR(errorCode == FFX_OK, errorCode); + + return FFX_OK; +} + +FFX_API FfxErrorCode ffxSharedContextGetGpuMemoryUsage(FfxInterface* backendInterfaceShared, FfxEffectMemoryUsage* vramUsage) +{ + FFX_RETURN_ON_ERROR(backendInterfaceShared, FFX_ERROR_INVALID_POINTER); + FFX_RETURN_ON_ERROR(vramUsage, FFX_ERROR_INVALID_POINTER); + + FfxErrorCode errorCode = backendInterfaceShared->fpGetEffectGpuMemoryUsage( + backendInterfaceShared, 0, vramUsage); + FFX_RETURN_ON_ERROR(errorCode == FFX_OK, errorCode); + + return FFX_OK; +} + +FfxErrorCode ffxFrameInterpolationContextDestroy(FfxFrameInterpolationContext* context) +{ + FFX_RETURN_ON_ERROR( + context, + FFX_ERROR_INVALID_POINTER); + + // destroy the context. + FfxFrameInterpolationContext_Private* contextPrivate = (FfxFrameInterpolationContext_Private*)(context); + const FfxErrorCode errorCode = frameinterpolationRelease(contextPrivate); + + return errorCode; +} + +FfxErrorCode ffxFrameInterpolationContextEnqueueRefreshPipelineRequest(FfxFrameInterpolationContext* context) +{ + FFX_RETURN_ON_ERROR( + context, + FFX_ERROR_INVALID_POINTER); + + FfxFrameInterpolationContext_Private* contextPrivate = (FfxFrameInterpolationContext_Private*)context; + contextPrivate->refreshPipelineStates = true; + + return FFX_OK; +} + +static void setupDeviceDepthToViewSpaceDepthParams(FfxFrameInterpolationContext_Private* context, const FfxFrameInterpolationRenderDescription* params, FrameInterpolationConstants* constants) +{ + const bool bInverted = (context->contextDescription.flags & FFX_FRAMEINTERPOLATION_ENABLE_DEPTH_INVERTED) == FFX_FRAMEINTERPOLATION_ENABLE_DEPTH_INVERTED; + const bool bInfinite = (context->contextDescription.flags & FFX_FRAMEINTERPOLATION_ENABLE_DEPTH_INFINITE) == FFX_FRAMEINTERPOLATION_ENABLE_DEPTH_INFINITE; + + // make sure it has no impact if near and far plane values are swapped in dispatch params + // the flags "inverted" and "infinite" will decide what transform to use + float fMin = FFX_MINIMUM(params->cameraNear, params->cameraFar); + float fMax = FFX_MAXIMUM(params->cameraNear, params->cameraFar); + + if (bInverted) { + float tmp = fMin; + fMin = fMax; + fMax = tmp; + } + + // a 0 0 0 x + // 0 b 0 0 y + // 0 0 c d z + // 0 0 e 0 1 + + const float fQ = fMax / (fMin - fMax); + const float d = -1.0f; // for clarity + + const float matrix_elem_c[2][2] = { + fQ, // non reversed, non infinite + -1.0f - FLT_EPSILON, // non reversed, infinite + fQ, // reversed, non infinite + 0.0f + FLT_EPSILON // reversed, infinite + }; + + const float matrix_elem_e[2][2] = { + fQ * fMin, // non reversed, non infinite + -fMin - FLT_EPSILON, // non reversed, infinite + fQ * fMin, // reversed, non infinite + fMax, // reversed, infinite + }; + + constants->deviceToViewDepth[0] = d * matrix_elem_c[bInverted][bInfinite]; + constants->deviceToViewDepth[1] = matrix_elem_e[bInverted][bInfinite] * params->viewSpaceToMetersFactor; + + // revert x and y coords + const float aspect = params->renderSize.width / float(params->renderSize.height); + const float cotHalfFovY = cosf(0.5f * params->cameraFovAngleVertical) / sinf(0.5f * params->cameraFovAngleVertical); + const float a = cotHalfFovY / aspect; + const float b = cotHalfFovY; + + constants->deviceToViewDepth[2] = (1.0f / a); + constants->deviceToViewDepth[3] = (1.0f / b); + +} + +FFX_API bool ffxFrameInterpolationResourceIsNull(FfxResource resource) +{ + return resource.resource == NULL; +} + +static const float debugBarColorSequence[] = { + 0.0f, 1.0f, 1.0f, // teal + 1.0f, 0.42f, 0.0f, // orange + 0.0f, 0.16f, 1.0f, // blue + 0.74f, 1.0f, 0.0f, // lime + 0.68f, 0.0f, 1.0f, // purple + 0.0f, 1.0f, 0.1f, // green + 1.0f, 1.0f, 0.48f // bright yellow +}; +const size_t debugBarColorSequenceLength = 7; + +static void fsr3FrameInterpolationDebugCheckPrepare(FfxFrameInterpolationContext_Private* context, const FfxFrameInterpolationPrepareDescription* params) +{ + + static const FfxFloat32x3 zeroVector3D = { 0.f,0.f,0.f }; + if ((memcmp(params->cameraPosition, zeroVector3D, sizeof(FfxFloat32x3)) == 0) && + (memcmp(params->cameraUp, zeroVector3D, sizeof(FfxFloat32x3)) == 0) && + (memcmp(params->cameraRight, zeroVector3D, sizeof(FfxFloat32x3)) == 0) && + (memcmp(params->cameraForward, zeroVector3D, sizeof(FfxFloat32x3)) == 0)) + { + FFX_PRINT_MESSAGE(FFX_MESSAGE_TYPE_WARNING, L"ffxDispatchDescFrameGenerationPrepareCameraInfo needs to be passed as linked struct. This is a required input to FSR3.1.4 and onwards for best quality."); + } +} + +FFX_API FfxErrorCode ffxFrameInterpolationPrepare(FfxFrameInterpolationContext* context, + const FfxFrameInterpolationPrepareDescription* params) +{ + FfxFrameInterpolationContext_Private* contextPrivate = (FfxFrameInterpolationContext_Private*)(context); + + if ((contextPrivate->contextDescription.flags & FFX_FRAMEINTERPOLATION_ENABLE_DEBUG_CHECKING) == FFX_FRAMEINTERPOLATION_ENABLE_DEBUG_CHECKING) + { + fsr3FrameInterpolationDebugCheckPrepare(contextPrivate, params); + } + + contextPrivate->constants.renderSize[0] = params->renderSize.width; + contextPrivate->constants.renderSize[1] = params->renderSize.height; + contextPrivate->constants.jitter[0] = params->jitterOffset.x; + contextPrivate->constants.jitter[1] = params->jitterOffset.y; + + const int32_t* motionVectorsTargetSize = (contextPrivate->contextDescription.flags & FFX_FRAMEINTERPOLATION_ENABLE_DISPLAY_RESOLUTION_MOTION_VECTORS) + ? contextPrivate->constants.displaySize + : contextPrivate->constants.renderSize; + contextPrivate->constants.motionVectorScale[0] = (params->motionVectorScale.x / motionVectorsTargetSize[0]); + contextPrivate->constants.motionVectorScale[1] = (params->motionVectorScale.y / motionVectorsTargetSize[1]); + + contextPrivate->contextDescription.backendInterface.fpStageConstantBufferDataFunc( + &contextPrivate->contextDescription.backendInterface, + &contextPrivate->constants, + sizeof(contextPrivate->constants), + &contextPrivate->constantBuffers[FFX_FRAMEINTERPOLATION_CONSTANTBUFFER_IDENTIFIER]); + + FFX_ASSERT(!ffxFrameInterpolationResourceIsNull(params->depth)); + FFX_ASSERT(!ffxFrameInterpolationResourceIsNull(params->motionVectors)); + + contextPrivate->contextDescription.backendInterface.fpRegisterResource( + &contextPrivate->contextDescription.backendInterface, + ¶ms->depth, + contextPrivate->effectContextId, + &contextPrivate->srvResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_DEPTH]); + + contextPrivate->contextDescription.backendInterface.fpRegisterResource( + &contextPrivate->contextDescription.backendInterface, + ¶ms->motionVectors, + contextPrivate->effectContextId, + &contextPrivate->srvResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_MOTION_VECTORS]); + + contextPrivate->contextDescription.backendInterface.fpRegisterResource( + &contextPrivate->contextDescription.backendInterface, + ¶ms->dilatedDepth, + contextPrivate->effectContextId, + &contextPrivate->uavResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_DILATED_DEPTH]); + contextPrivate->contextDescription.backendInterface.fpRegisterResource( + &contextPrivate->contextDescription.backendInterface, + ¶ms->dilatedMotionVectors, + contextPrivate->effectContextId, + &contextPrivate->uavResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_DILATED_MOTION_VECTORS]); + contextPrivate->contextDescription.backendInterface.fpRegisterResource( + &contextPrivate->contextDescription.backendInterface, + ¶ms->reconstructedPrevDepth, + contextPrivate->effectContextId, + &contextPrivate->uavResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_RECONSTRUCTED_DEPTH_PREVIOUS_FRAME]); + + // clear estimated depth resources + { + FfxGpuJobDescription clearJob = {FFX_GPU_JOB_CLEAR_FLOAT}; + const bool bInverted = (contextPrivate->contextDescription.flags & FFX_FRAMEINTERPOLATION_ENABLE_DEPTH_INVERTED) == FFX_FRAMEINTERPOLATION_ENABLE_DEPTH_INVERTED; + const float clearDepthValue[]{bInverted ? 0.f : 1.f, bInverted ? 0.f : 1.f, bInverted ? 0.f : 1.f, bInverted ? 0.f : 1.f}; + memcpy(clearJob.clearJobDescriptor.color, clearDepthValue, 4 * sizeof(float)); + wcscpy_s(clearJob.jobLabel, L"Clear Reconstructed Previous Nearest Depth"); + clearJob.clearJobDescriptor.target = contextPrivate->uavResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_RECONSTRUCTED_DEPTH_PREVIOUS_FRAME]; + contextPrivate->contextDescription.backendInterface.fpScheduleGpuJob(&contextPrivate->contextDescription.backendInterface, &clearJob); + } + + uint32_t renderDispatchSizeX = uint32_t(params->renderSize.width + 7) / 8; + uint32_t renderDispatchSizeY = uint32_t(params->renderSize.height + 7) / 8; + + scheduleDispatch(contextPrivate, &contextPrivate->pipelineFiReconstructAndDilate, renderDispatchSizeX, renderDispatchSizeY); + + contextPrivate->contextDescription.backendInterface.fpExecuteGpuJobs(&contextPrivate->contextDescription.backendInterface, params->commandList, contextPrivate->effectContextId); + + // release dynamic resources + contextPrivate->contextDescription.backendInterface.fpUnregisterResources(&contextPrivate->contextDescription.backendInterface, + params->commandList, + contextPrivate->effectContextId); + + contextPrivate->srvResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_DEPTH] = {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_NULL}; + contextPrivate->srvResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_MOTION_VECTORS] = {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_NULL}; + contextPrivate->uavResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_DILATED_DEPTH] = {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_NULL}; + contextPrivate->uavResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_DILATED_MOTION_VECTORS] = {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_NULL}; + contextPrivate->uavResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_RECONSTRUCTED_DEPTH_PREVIOUS_FRAME] = {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_NULL}; + + return FFX_OK; +} + +FFX_API FfxErrorCode ffxFrameInterpolationDispatch(FfxFrameInterpolationContext* context, const FfxFrameInterpolationDispatchDescription* params) +{ + FfxFrameInterpolationContext_Private* contextPrivate = (FfxFrameInterpolationContext_Private*)(context); + const FfxFrameInterpolationRenderDescription* renderDesc = &contextPrivate->renderDescription; + + if (contextPrivate->refreshPipelineStates) { + + createPipelineStates(contextPrivate); + contextPrivate->refreshPipelineStates = false; + } + + const bool bReset = (contextPrivate->dispatchCount == 0) || params->reset; + + FFX_ASSERT_MESSAGE(!contextPrivate->asyncSupported || bReset || (params->frameID > contextPrivate->previousFrameID), + "When async support is enabled, and the reset flag is not set, frame ID must increment in each dispatch"); + + // Detect disjoint frameID values + const bool bFrameID_Decreased = params->frameID < contextPrivate->previousFrameID; + const bool bFrameID_Skipped = (params->frameID - contextPrivate->previousFrameID) > 1; + const bool bDisjointFrameID = bFrameID_Decreased || bFrameID_Skipped; + contextPrivate->previousFrameID = params->frameID; + contextPrivate->dispatchCount++; + + contextPrivate->constants.renderSize[0] = params->renderSize.width; + contextPrivate->constants.renderSize[1] = params->renderSize.height; + contextPrivate->constants.displaySize[0] = params->displaySize.width; + contextPrivate->constants.displaySize[1] = params->displaySize.height; + contextPrivate->constants.displaySizeRcp[0] = 1.0f / params->displaySize.width; + contextPrivate->constants.displaySizeRcp[1] = 1.0f / params->displaySize.height; + contextPrivate->constants.upscalerTargetSize[0] = params->interpolationRect.width; + contextPrivate->constants.upscalerTargetSize[1] = params->interpolationRect.height; + contextPrivate->constants.Mode = 0; + contextPrivate->constants.Reset = bReset || bDisjointFrameID; + contextPrivate->constants.deltaTime = params->frameTimeDelta; + contextPrivate->constants.HUDLessAttachedFactor = params->currentBackBuffer_HUDLess.resource ? 1 : 0; + + contextPrivate->constants.opticalFlowScale[0] = params->opticalFlowScale.x; + contextPrivate->constants.opticalFlowScale[1] = params->opticalFlowScale.y; + contextPrivate->constants.opticalFlowBlockSize = params->opticalFlowBlockSize;// displaySize.width / params->opticalFlowBufferSize.width; + contextPrivate->constants.dispatchFlags = params->flags; + + contextPrivate->constants.cameraNear = params->cameraNear; + contextPrivate->constants.cameraFar = params->cameraFar; + + contextPrivate->constants.interpolationRectBase[0] = params->interpolationRect.left; + contextPrivate->constants.interpolationRectBase[1] = params->interpolationRect.top; + contextPrivate->constants.interpolationRectSize[0] = params->interpolationRect.width; + contextPrivate->constants.interpolationRectSize[1] = params->interpolationRect.height; + + // Debug bar + static size_t dbgIdx = 0; + memcpy(contextPrivate->constants.debugBarColor, &debugBarColorSequence[dbgIdx * 3], 3 * sizeof(float)); + dbgIdx = (dbgIdx + 1) % debugBarColorSequenceLength; + + contextPrivate->constants.backBufferTransferFunction = params->backBufferTransferFunction; + contextPrivate->constants.minMaxLuminance[0] = params->minMaxLuminance[0]; + contextPrivate->constants.minMaxLuminance[1] = params->minMaxLuminance[1]; + + const float aspectRatio = (float)params->renderSize.width / (float)params->renderSize.height; + const float cameraAngleHorizontal = atan(tan(params->cameraFovAngleVertical / 2) * aspectRatio) * 2; + contextPrivate->constants.fTanHalfFOV = tanf(cameraAngleHorizontal * 0.5f); + + const bool bUseExternalDistortionFieldResource = !ffxFrameInterpolationResourceIsNull(params->distortionField); + if (bUseExternalDistortionFieldResource) + { + contextPrivate->constants.distortionFieldSize[0] = params->distortionField.description.width; + contextPrivate->constants.distortionFieldSize[1] = params->distortionField.description.height; + } + else + { + contextPrivate->constants.distortionFieldSize[0] = 1; + contextPrivate->constants.distortionFieldSize[1] = 1; + } + + contextPrivate->renderDescription.cameraFar = params->cameraFar; + contextPrivate->renderDescription.cameraNear = params->cameraNear; + contextPrivate->renderDescription.viewSpaceToMetersFactor = (params->viewSpaceToMetersFactor > 0.0f) ? params->viewSpaceToMetersFactor : 1.0f; + contextPrivate->renderDescription.cameraFovAngleVertical = params->cameraFovAngleVertical; + contextPrivate->renderDescription.renderSize = params->renderSize; + contextPrivate->renderDescription.upscaleSize = params->displaySize; + setupDeviceDepthToViewSpaceDepthParams(contextPrivate, renderDesc, &contextPrivate->constants); + + contextPrivate->contextDescription.backendInterface.fpStageConstantBufferDataFunc( + &contextPrivate->contextDescription.backendInterface, + &contextPrivate->constants, + sizeof(contextPrivate->constants), + &contextPrivate->constantBuffers[FFX_FRAMEINTERPOLATION_CONSTANTBUFFER_IDENTIFIER]); + + if (contextPrivate->constants.HUDLessAttachedFactor == 1) { + + FFX_ASSERT_MESSAGE(contextPrivate->contextDescription.previousInterpolationSourceFormat == params->currentBackBuffer_HUDLess.description.format, + "Dispatch FI param currentBackBuffer_HUDLess format and Create FG Context's hudlessBackBufferFormat have to be identical. Otherwise, CopyTextureRegion from FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_CURRENT_INTERPOLATION_SOURCE to FI_PreviousInterpolationSource would fail"); + + contextPrivate->contextDescription.backendInterface.fpRegisterResource(&contextPrivate->contextDescription.backendInterface, ¶ms->currentBackBuffer, contextPrivate->effectContextId, &contextPrivate->srvResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_PRESENT_BACKBUFFER]); + contextPrivate->contextDescription.backendInterface.fpRegisterResource(&contextPrivate->contextDescription.backendInterface, ¶ms->currentBackBuffer_HUDLess, contextPrivate->effectContextId, &contextPrivate->srvResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_CURRENT_INTERPOLATION_SOURCE]); + } + else { + FFX_ASSERT_MESSAGE(contextPrivate->contextDescription.previousInterpolationSourceFormat == params->currentBackBuffer.description.format, + "Dispatch FI param currentBackBuffer format and Create FG Context's backBufferFormat have to be identical. This assert can also be triggered if create FG Context with optional hudlessBackBufferFormat that is different from backBufferFormat and Dispatch FI param's currentBackBuffer_HUDLess is null."); + contextPrivate->contextDescription.backendInterface.fpRegisterResource(&contextPrivate->contextDescription.backendInterface, ¶ms->currentBackBuffer, contextPrivate->effectContextId, &contextPrivate->srvResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_CURRENT_INTERPOLATION_SOURCE]); + contextPrivate->srvResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_PRESENT_BACKBUFFER] = contextPrivate->srvResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_CURRENT_INTERPOLATION_SOURCE]; + } + + if (!ffxFrameInterpolationResourceIsNull(params->dilatedDepth)) + { + contextPrivate->contextDescription.backendInterface.fpRegisterResource( + &contextPrivate->contextDescription.backendInterface, + ¶ms->dilatedDepth, + contextPrivate->effectContextId, + &contextPrivate->srvResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_DILATED_DEPTH]); + } + if (!ffxFrameInterpolationResourceIsNull(params->dilatedMotionVectors)) + { + contextPrivate->contextDescription.backendInterface.fpRegisterResource( + &contextPrivate->contextDescription.backendInterface, + ¶ms->dilatedMotionVectors, + contextPrivate->effectContextId, + &contextPrivate->srvResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_DILATED_MOTION_VECTORS]); + } + if (!ffxFrameInterpolationResourceIsNull(params->reconstructedPrevDepth)) + { + contextPrivate->contextDescription.backendInterface.fpRegisterResource( + &contextPrivate->contextDescription.backendInterface, + ¶ms->reconstructedPrevDepth, + contextPrivate->effectContextId, + &contextPrivate->srvResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_RECONSTRUCTED_DEPTH_PREVIOUS_FRAME]); + } + + // Register output as SRV and UAV + contextPrivate->contextDescription.backendInterface.fpRegisterResource(&contextPrivate->contextDescription.backendInterface, ¶ms->output, contextPrivate->effectContextId, &contextPrivate->uavResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_OUTPUT]); + contextPrivate->srvResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_OUTPUT] = contextPrivate->uavResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_OUTPUT]; + + // set optical flow buffers + if (params->opticalFlowScale.x > 0) + { + contextPrivate->contextDescription.backendInterface.fpRegisterResource(&contextPrivate->contextDescription.backendInterface, ¶ms->opticalFlowVector, contextPrivate->effectContextId, &contextPrivate->srvResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_OPTICAL_FLOW_VECTOR]); + contextPrivate->contextDescription.backendInterface.fpRegisterResource(&contextPrivate->contextDescription.backendInterface, ¶ms->opticalFlowSceneChangeDetection, contextPrivate->effectContextId, &contextPrivate->srvResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_OPTICAL_FLOW_SCENE_CHANGE_DETECTION]); + } + else + { + contextPrivate->srvResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_OPTICAL_FLOW_CONFIDENCE] = {}; + contextPrivate->srvResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_OPTICAL_FLOW_GLOBAL_MOTION] = {}; + contextPrivate->srvResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_OPTICAL_FLOW_SCENE_CHANGE_DETECTION] = {}; + contextPrivate->srvResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_OPTICAL_FLOW_VECTOR] = {}; + } + + if (bUseExternalDistortionFieldResource) + { + contextPrivate->contextDescription.backendInterface.fpRegisterResource( + &contextPrivate->contextDescription.backendInterface, + ¶ms->distortionField, + contextPrivate->effectContextId, + &contextPrivate->srvResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_DISTORTION_FIELD]); + } + else + { + contextPrivate->srvResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_DISTORTION_FIELD] = contextPrivate->srvResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_DEFAULT_DISTORTION_FIELD]; + } + + uint32_t displayDispatchSizeX = uint32_t(params->displaySize.width + 7) / 8; + uint32_t displayDispatchSizeY = uint32_t(params->displaySize.height + 7) / 8; + + uint32_t renderDispatchSizeX = uint32_t(params->renderSize.width + 7) / 8; + uint32_t renderDispatchSizeY = uint32_t(params->renderSize.height + 7) / 8; + + uint32_t opticalFlowDispatchSizeX = uint32_t(params->displaySize.width / float(params->opticalFlowBlockSize) + 7) / 8; + uint32_t opticalFlowDispatchSizeY = uint32_t(params->displaySize.height / float(params->opticalFlowBlockSize) + 7) / 8; + + const bool bExecutePreparationPasses = (false == contextPrivate->constants.Reset); + + // Schedule work for the interpolation command list + { + FfxResourceInternal aliasableResources[] = { + contextPrivate->uavResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_RECONSTRUCTED_DEPTH_INTERPOLATED_FRAME], + contextPrivate->uavResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_GAME_MOTION_VECTOR_FIELD_X], + contextPrivate->uavResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_GAME_MOTION_VECTOR_FIELD_Y], + contextPrivate->uavResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_INPAINTING_PYRAMID], + contextPrivate->uavResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_OPTICAL_FLOW_MOTION_VECTOR_FIELD_X], + contextPrivate->uavResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_OPTICAL_FLOW_MOTION_VECTOR_FIELD_Y], + contextPrivate->uavResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_INPAINTING_MASK], + contextPrivate->uavResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_DISOCCLUSION_MASK] + }; + for (int i = 0; i < _countof(aliasableResources); ++i) + { + FfxGpuJobDescription discardJob = {FFX_GPU_JOB_DISCARD}; + discardJob.discardJobDescriptor.target = aliasableResources[i]; + contextPrivate->contextDescription.backendInterface.fpScheduleGpuJob(&contextPrivate->contextDescription.backendInterface, &discardJob); + } + + scheduleDispatch(contextPrivate, &contextPrivate->pipelineFiSetup, renderDispatchSizeX, renderDispatchSizeY); + + // game vector field inpainting pyramid + auto scheduleDispatchGameVectorFieldInpaintingPyramid = [&]() { + // Auto exposure + uint32_t dispatchThreadGroupCountXY[2]; + uint32_t workGroupOffset[2]; + uint32_t numWorkGroupsAndMips[2]; + uint32_t rectInfo[4] = {0, 0, params->renderSize.width, params->renderSize.height}; + ffxSpdSetup(dispatchThreadGroupCountXY, workGroupOffset, numWorkGroupsAndMips, rectInfo); + + // downsample + contextPrivate->inpaintingPyramidContants.numworkGroups = numWorkGroupsAndMips[0]; + contextPrivate->inpaintingPyramidContants.mips = numWorkGroupsAndMips[1]; + contextPrivate->inpaintingPyramidContants.workGroupOffset[0] = workGroupOffset[0]; + contextPrivate->inpaintingPyramidContants.workGroupOffset[1] = workGroupOffset[1]; + + contextPrivate->contextDescription.backendInterface.fpStageConstantBufferDataFunc( + &contextPrivate->contextDescription.backendInterface, + &contextPrivate->inpaintingPyramidContants, + sizeof(contextPrivate->inpaintingPyramidContants), + &contextPrivate->constantBuffers[FFX_FRAMEINTERPOLATION_INPAINTING_PYRAMID_CONSTANTBUFFER_IDENTIFIER]); + + scheduleDispatch( + contextPrivate, &contextPrivate->pipelineGameVectorFieldInpaintingPyramid, dispatchThreadGroupCountXY[0], dispatchThreadGroupCountXY[1]); + }; + + // only execute FG data preparation passes when reset wasnt triggered + if (bExecutePreparationPasses) + { + // clear estimated depth resources + { + FfxGpuJobDescription clearJob = {FFX_GPU_JOB_CLEAR_FLOAT}; + + const bool bInverted = + (contextPrivate->contextDescription.flags & FFX_FRAMEINTERPOLATION_ENABLE_DEPTH_INVERTED) == FFX_FRAMEINTERPOLATION_ENABLE_DEPTH_INVERTED; + const float clearDepthValue[]{bInverted ? 0.f : 1.f, bInverted ? 0.f : 1.f, bInverted ? 0.f : 1.f, bInverted ? 0.f : 1.f}; + memcpy(clearJob.clearJobDescriptor.color, clearDepthValue, 4 * sizeof(float)); + + wcscpy_s(clearJob.jobLabel, L"Clear Reconstructed Depth Interpolated Frame"); + clearJob.clearJobDescriptor.target = + contextPrivate->uavResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_RECONSTRUCTED_DEPTH_INTERPOLATED_FRAME]; + contextPrivate->contextDescription.backendInterface.fpScheduleGpuJob(&contextPrivate->contextDescription.backendInterface, &clearJob); + } + + scheduleDispatch(contextPrivate, &contextPrivate->pipelineFiReconstructPreviousDepth, renderDispatchSizeX, renderDispatchSizeY); + scheduleDispatch(contextPrivate, &contextPrivate->pipelineFiGameMotionVectorField, renderDispatchSizeX, renderDispatchSizeY); + + scheduleDispatchGameVectorFieldInpaintingPyramid(); + + scheduleDispatch(contextPrivate, &contextPrivate->pipelineFiOpticalFlowVectorField, opticalFlowDispatchSizeX, opticalFlowDispatchSizeY); + + scheduleDispatch(contextPrivate, &contextPrivate->pipelineFiDisocclusionMask, renderDispatchSizeX, renderDispatchSizeY); + } + + scheduleDispatch(contextPrivate, &contextPrivate->pipelineFiScfi, displayDispatchSizeX, displayDispatchSizeY); + + // inpainting pyramid + { + // Auto exposure + uint32_t dispatchThreadGroupCountXY[2]; + uint32_t workGroupOffset[2]; + uint32_t numWorkGroupsAndMips[2]; + uint32_t rectInfo[4] = { 0, 0, params->displaySize.width, params->displaySize.height }; + ffxSpdSetup(dispatchThreadGroupCountXY, workGroupOffset, numWorkGroupsAndMips, rectInfo); + + // downsample + contextPrivate->inpaintingPyramidContants.numworkGroups = numWorkGroupsAndMips[0]; + contextPrivate->inpaintingPyramidContants.mips = numWorkGroupsAndMips[1]; + contextPrivate->inpaintingPyramidContants.workGroupOffset[0] = workGroupOffset[0]; + contextPrivate->inpaintingPyramidContants.workGroupOffset[1] = workGroupOffset[1]; + + contextPrivate->contextDescription.backendInterface.fpStageConstantBufferDataFunc( + &contextPrivate->contextDescription.backendInterface, + &contextPrivate->inpaintingPyramidContants, + sizeof(contextPrivate->inpaintingPyramidContants), + &contextPrivate->constantBuffers[FFX_FRAMEINTERPOLATION_INPAINTING_PYRAMID_CONSTANTBUFFER_IDENTIFIER]); + + scheduleDispatch(contextPrivate, &contextPrivate->pipelineInpaintingPyramid, dispatchThreadGroupCountXY[0], dispatchThreadGroupCountXY[1]); + } + + scheduleDispatch(contextPrivate, &contextPrivate->pipelineInpainting, displayDispatchSizeX, displayDispatchSizeY); + + if (params->flags & FFX_FRAMEINTERPOLATION_DISPATCH_DRAW_DEBUG_VIEW) + { + scheduleDispatchGameVectorFieldInpaintingPyramid(); + scheduleDispatch(contextPrivate, &contextPrivate->pipelineDebugView, displayDispatchSizeX, displayDispatchSizeY); + } + + // store current buffer + { + FfxGpuJobDescription copyJobs[] = { {FFX_GPU_JOB_COPY} }; + FfxResourceInternal copySources[_countof(copyJobs)] = { contextPrivate->srvResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_CURRENT_INTERPOLATION_SOURCE] }; + FfxResourceInternal destSources[_countof(copyJobs)] = { contextPrivate->uavResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_PREVIOUS_INTERPOLATION_SOURCE] }; + + for (int i = 0; i < _countof(copyJobs); ++i) + { + copyJobs[i].copyJobDescriptor.src = copySources[i]; + copyJobs[i].copyJobDescriptor.dst = destSources[i]; + contextPrivate->contextDescription.backendInterface.fpScheduleGpuJob(&contextPrivate->contextDescription.backendInterface, ©Jobs[i]); + } + } + + // declare internal resources needed + struct FfxInternalResourceStates + { + FfxUInt32 id; + FfxResourceUsage usage; + }; + const FfxInternalResourceStates internalSurfaceDesc[] = { + + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_RECONSTRUCTED_DEPTH_INTERPOLATED_FRAME, FFX_RESOURCE_USAGE_UAV}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_GAME_MOTION_VECTOR_FIELD_X, FFX_RESOURCE_USAGE_UAV}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_GAME_MOTION_VECTOR_FIELD_Y, FFX_RESOURCE_USAGE_UAV}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_INPAINTING_PYRAMID, FFX_RESOURCE_USAGE_UAV}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_COUNTERS, FFX_RESOURCE_USAGE_UAV}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_OPTICAL_FLOW_MOTION_VECTOR_FIELD_X, FFX_RESOURCE_USAGE_UAV}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_OPTICAL_FLOW_MOTION_VECTOR_FIELD_Y, FFX_RESOURCE_USAGE_UAV}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_PREVIOUS_INTERPOLATION_SOURCE, FFX_RESOURCE_USAGE_UAV}, + {FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_DISOCCLUSION_MASK, FFX_RESOURCE_USAGE_UAV}, + }; + + for (int32_t currentSurfaceIndex = 0; currentSurfaceIndex < FFX_ARRAY_ELEMENTS(internalSurfaceDesc); ++currentSurfaceIndex) { + + const FfxInternalResourceStates* currentSurfaceDescription = &internalSurfaceDesc[currentSurfaceIndex]; + FfxResourceStates initialState = FFX_RESOURCE_STATE_UNORDERED_ACCESS; + if (currentSurfaceDescription->usage == FFX_RESOURCE_USAGE_READ_ONLY) initialState = FFX_RESOURCE_STATE_COMPUTE_READ; + if (currentSurfaceDescription->usage == FFX_RESOURCE_USAGE_RENDERTARGET) initialState = FFX_RESOURCE_STATE_RENDER_TARGET; + + FfxGpuJobDescription barrier = {FFX_GPU_JOB_BARRIER}; + barrier.barrierDescriptor.resource = contextPrivate->srvResources[currentSurfaceDescription->id]; + barrier.barrierDescriptor.subResourceID = 0; + barrier.barrierDescriptor.newState = (currentSurfaceDescription->id == FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_COUNTERS) ? FFX_RESOURCE_STATE_COPY_DEST : initialState; + barrier.barrierDescriptor.barrierType = FFX_BARRIER_TYPE_TRANSITION; + contextPrivate->contextDescription.backendInterface.fpScheduleGpuJob(&contextPrivate->contextDescription.backendInterface, &barrier); + } + + // schedule optical flow and frame interpolation + contextPrivate->contextDescription.backendInterface.fpExecuteGpuJobs(&contextPrivate->contextDescription.backendInterface, params->commandList, contextPrivate->effectContextId); + } + + // release dynamic resources + contextPrivate->contextDescription.backendInterface.fpUnregisterResources(&contextPrivate->contextDescription.backendInterface, params->commandList, contextPrivate->effectContextId); + + return FFX_OK; +} + +FFX_API FfxVersionNumber ffxFrameInterpolationGetEffectVersion() +{ + return FFX_SDK_MAKE_VERSION(FFX_FRAMEINTERPOLATION_VERSION_MAJOR, FFX_FRAMEINTERPOLATION_VERSION_MINOR, FFX_FRAMEINTERPOLATION_VERSION_PATCH); +} + +FFX_API FfxErrorCode ffxFrameInterpolationSetGlobalDebugMessage(ffxMessageCallback fpMessage, uint32_t debugLevel) +{ + ffxSetPrintMessageCallback(fpMessage, debugLevel); + return FFX_OK; +} diff --git a/runtime/third_party/FidelityFX/sdk/src/components/frameinterpolation/ffx_frameinterpolation_private.h b/runtime/third_party/FidelityFX/sdk/src/components/frameinterpolation/ffx_frameinterpolation_private.h new file mode 100644 index 00000000..e4c67e89 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/src/components/frameinterpolation/ffx_frameinterpolation_private.h @@ -0,0 +1,147 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#pragma once + +#include + +/// An enumeration of all the permutations that can be passed to the FSR3 algorithm. +/// +/// FSR3 features are organized through a set of pre-defined compile +/// permutation options that need to be specified. Which shader blob +/// is returned for pipeline creation will be determined by what combination +/// of shader permutations are enabled. +/// +/// @ingroup FRAMEINTERPOLATION +typedef enum FrameInterpolationShaderPermutationOptions +{ + FRAMEINTERPOLATION_SHADER_PERMUTATION_LOW_RES_MOTION_VECTORS = (1 << 0), + FRAMEINTERPOLATION_SHADER_PERMUTATION_JITTER_MOTION_VECTORS = (1 << 1), + FRAMEINTERPOLATION_SHADER_PERMUTATION_DEPTH_INVERTED = (1 << 2), ///< Indicates input resources were generated with inverted depth + FRAMEINTERPOLATION_SHADER_PERMUTATION_FORCE_WAVE64 = (1 << 3), ///< doesn't map to a define, selects different table + FRAMEINTERPOLATION_SHADER_PERMUTATION_ALLOW_FP16 = (1 << 4), ///< Enables fast math computations where possible +} FrameInterpolationShaderPermutationOptions; + +typedef struct FrameInterpolationConstants +{ + int32_t renderSize[2]; + int32_t displaySize[2]; + + float displaySizeRcp[2]; + float cameraNear; + float cameraFar; + + int32_t upscalerTargetSize[2]; // how is that different from display size? + int Mode; + int Reset; + + float deviceToViewDepth[4]; + + float deltaTime; + int HUDLessAttachedFactor; + int32_t distortionFieldSize[2]; + + float opticalFlowScale[2]; + int32_t opticalFlowBlockSize; + uint32_t dispatchFlags; + + int32_t maxRenderSize[2]; + int opticalFlowHalfResMode; + int numInstances; + + int32_t interpolationRectBase[2]; + int32_t interpolationRectSize[2]; + + float debugBarColor[3]; + uint32_t backBufferTransferFunction; + + float minMaxLuminance[2]; + float fTanHalfFOV; + float _pad1; + + float jitter[2]; + float motionVectorScale[2]; +} FrameInterpolationConstants; + +typedef struct InpaintingPyramidConstants { + + uint32_t mips; + uint32_t numworkGroups; + uint32_t workGroupOffset[2]; +} InpaintingPyramidConstants; + +struct FfxDeviceCapabilities; +struct FfxPipelineState; +struct FfxResource; + +typedef struct FfxFrameInterpolationRenderDescription +{ + FfxDimensions2D renderSize; + FfxDimensions2D upscaleSize; + + float cameraNear; + float cameraFar; + float cameraFovAngleVertical; + float viewSpaceToMetersFactor; + + FfxFloatCoords2D motionVectorScale; ///< The scale factor to apply to motion vectors. +} FfxFrameInterpolationRenderDescription; + +// FfxFsr3Context_Private +// The private implementation of the FSR3 context. +typedef struct FfxFrameInterpolationContext_Private { + + FfxFrameInterpolationContextDescription contextDescription; + FfxUInt32 effectContextId; + FfxFrameInterpolationRenderDescription renderDescription; + FrameInterpolationConstants constants; + InpaintingPyramidConstants inpaintingPyramidContants; + FfxDevice device; + FfxDeviceCapabilities deviceCapabilities; + + // FrameInterpolation Pipelines + FfxPipelineState pipelineFiReconstructAndDilate; + FfxPipelineState pipelineFiSetup; + FfxPipelineState pipelineFiReconstructPreviousDepth; + FfxPipelineState pipelineFiGameMotionVectorField; + FfxPipelineState pipelineFiOpticalFlowVectorField; + FfxPipelineState pipelineFiDisocclusionMask; + FfxPipelineState pipelineFiScfi; + FfxPipelineState pipelineInpaintingPyramid; + FfxPipelineState pipelineInpainting; + FfxPipelineState pipelineGameVectorFieldInpaintingPyramid; + FfxPipelineState pipelineDebugView; + + FfxConstantBuffer constantBuffers[FFX_FRAMEINTERPOLATION_CONSTANTBUFFER_COUNT]; + + // 2 arrays of resources, as e.g. FFX_FSR3_RESOURCE_IDENTIFIER_LOCK_STATUS will use different resources when bound as SRV vs when bound as UAV + FfxResourceInternal srvResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_COUNT]; + FfxResourceInternal uavResources[FFX_FRAMEINTERPOLATION_RESOURCE_IDENTIFIER_COUNT]; + + bool firstExecution; + bool refreshPipelineStates; + + bool asyncSupported; + uint64_t previousFrameID; + uint64_t dispatchCount; + +} FfxFrameInterpolationContext_Private; diff --git a/runtime/third_party/FidelityFX/sdk/src/components/opticalflow/ffx_opticalflow.cpp b/runtime/third_party/FidelityFX/sdk/src/components/opticalflow/ffx_opticalflow.cpp new file mode 100644 index 00000000..ae94c2d0 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/src/components/opticalflow/ffx_opticalflow.cpp @@ -0,0 +1,987 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#include // for max used inside SPD CPU code. +#include // for fabs, abs, sinf, sqrt, etc. +#include // for memset +#include // for FLT_EPSILON +#include "FidelityFX/host/ffx_opticalflow.h" + +#ifdef __clang__ +#pragma clang diagnostic ignored "-Wunused-function" +#pragma clang diagnostic ignored "-Wsign-compare" +#endif + +#define FFX_CPU +#include +#include +#include +#include + +#define FFX_OPTICALFLOW_MAX_QUEUED_FRAMES 16 + +#include "ffx_opticalflow_private.h" + +typedef struct Binding +{ + uint32_t index; + wchar_t name[64]; +}Binding; + +static const Binding srvBindingNames[] = +{ + {FFX_OF_BINDING_IDENTIFIER_INPUT_COLOR, L"r_input_color"}, + {FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_INPUT, L"r_optical_flow_input"}, + {FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_PREVIOUS_INPUT, L"r_optical_flow_previous_input"}, + {FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW, L"r_optical_flow"}, + {FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_PREVIOUS, L"r_optical_flow_previous"}, +}; + +static const Binding uavBindingNames[] = +{ + {FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_INPUT, L"rw_optical_flow_input"}, + {FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_INPUT_LEVEL_1, L"rw_optical_flow_input_level_1"}, + {FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_INPUT_LEVEL_2, L"rw_optical_flow_input_level_2"}, + {FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_INPUT_LEVEL_3, L"rw_optical_flow_input_level_3"}, + {FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_INPUT_LEVEL_4, L"rw_optical_flow_input_level_4"}, + {FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_INPUT_LEVEL_5, L"rw_optical_flow_input_level_5"}, + {FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_INPUT_LEVEL_6, L"rw_optical_flow_input_level_6"}, + {FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW, L"rw_optical_flow"}, + {FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_NEXT_LEVEL, L"rw_optical_flow_next_level"}, + {FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_SCD_HISTOGRAM, L"rw_optical_flow_scd_histogram"}, // scene change detection histogram + {FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_SCD_PREVIOUS_HISTOGRAM, L"rw_optical_flow_scd_previous_histogram"}, + {FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_SCD_TEMP, L"rw_optical_flow_scd_temp"}, + {FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_SCD_OUTPUT, L"rw_optical_flow_scd_output"}, +}; + +static const Binding cbBindingNames[] = +{ + {FFX_OPTICALFLOW_CONSTANTBUFFER_IDENTIFIER, L"cbOF"}, + {FFX_OPTICALFLOW_CONSTANTBUFFER_IDENTIFIER_SPD, L"cbOF_SPD"} +}; + +// Broad structure of the root signature. +typedef enum OpticalFlowRootSignatureLayout { + + OPTICALFLOW_ROOT_SIGNATURE_LAYOUT_UAVS, + OPTICALFLOW_ROOT_SIGNATURE_LAYOUT_SRVS, + OPTICALFLOW_ROOT_SIGNATURE_LAYOUT_CONSTANTS, + OPTICALFLOW_ROOT_SIGNATURE_LAYOUT_CONSTANTS_REGISTER_1, + OPTICALFLOW_ROOT_SIGNATURE_LAYOUT_PARAMETER_COUNT +} OpticalFlowRootSignatureLayout; + +typedef struct OpticalFlowSpdConstants +{ + uint32_t mips; + uint32_t numworkGroups; + uint32_t workGroupOffset[2]; + + uint32_t numworkGroupsOpticalFlowInputPyramid; + uint32_t pad0_; + uint32_t pad1_; + uint32_t pad2_; + +} OpticalFlowSpdConstants; + +static FfxErrorCode patchResourceBindings(FfxPipelineState* inoutPipeline) +{ + for (uint32_t srvIndex = 0; srvIndex < inoutPipeline->srvTextureCount; ++srvIndex) + { + int32_t mapIndex = 0; + for (mapIndex = 0; mapIndex < _countof(srvBindingNames); ++mapIndex) + { + if (0 == wcscmp(srvBindingNames[mapIndex].name, inoutPipeline->srvTextureBindings[srvIndex].name)) + break; + } + FFX_ASSERT(mapIndex < _countof(srvBindingNames)); + if (mapIndex == _countof(srvBindingNames)) + return FFX_ERROR_INVALID_ARGUMENT; + + inoutPipeline->srvTextureBindings[srvIndex].resourceIdentifier = srvBindingNames[mapIndex].index; + } + + for (uint32_t uavIndex = 0; uavIndex < inoutPipeline->uavTextureCount; ++uavIndex) + { + int32_t mapIndex = 0; + for (mapIndex = 0; mapIndex < _countof(uavBindingNames); ++mapIndex) + { + if (0 == wcscmp(uavBindingNames[mapIndex].name, inoutPipeline->uavTextureBindings[uavIndex].name)) + break; + } + FFX_ASSERT(mapIndex < _countof(uavBindingNames)); + if (mapIndex == _countof(uavBindingNames)) + return FFX_ERROR_INVALID_ARGUMENT; + + inoutPipeline->uavTextureBindings[uavIndex].resourceIdentifier = uavBindingNames[mapIndex].index; + } + + for (uint32_t cbIndex = 0; cbIndex < inoutPipeline->constCount; ++cbIndex) + { + int32_t mapIndex = 0; + for (mapIndex = 0; mapIndex < _countof(cbBindingNames); ++mapIndex) + { + if (0 == wcscmp(cbBindingNames[mapIndex].name, inoutPipeline->constantBufferBindings[cbIndex].name)) + break; + } + FFX_ASSERT(mapIndex < _countof(cbBindingNames)); + if (mapIndex == _countof(cbBindingNames)) + return FFX_ERROR_INVALID_ARGUMENT; + + inoutPipeline->constantBufferBindings[cbIndex].resourceIdentifier = cbBindingNames[mapIndex].index; + } + + return FFX_OK; +} + +static uint32_t getPipelinePermutationFlags(uint32_t, FfxPass, bool fp16, bool force64, bool) +{ + uint32_t flags = 0; + flags |= (force64) ? OPTICALFLOW_SHADER_PERMUTATION_FORCE_WAVE64 : 0; + flags |= (fp16) ? OPTICALFLOW_SHADER_PERMUTATION_ALLOW_FP16 : 0; + return flags; +} + +static FfxErrorCode createPipelineStates(FfxOpticalflowContext_Private* context) +{ + FFX_ASSERT(context); + + constexpr size_t samplerCount = 2; + FfxSamplerDescription samplerDescs[samplerCount] = { + {FFX_FILTER_TYPE_MINMAGMIP_POINT, FFX_ADDRESS_MODE_CLAMP, FFX_ADDRESS_MODE_CLAMP, FFX_ADDRESS_MODE_CLAMP, FFX_BIND_COMPUTE_SHADER_STAGE}, + {FFX_FILTER_TYPE_MINMAGMIP_LINEAR, FFX_ADDRESS_MODE_CLAMP, FFX_ADDRESS_MODE_CLAMP, FFX_ADDRESS_MODE_CLAMP, FFX_BIND_COMPUTE_SHADER_STAGE} }; + + const size_t rootConstantCount = 2; + FfxRootConstantDescription rootConstantDescs[2] = { {sizeof(OpticalflowConstants) / sizeof(uint32_t), FFX_BIND_COMPUTE_SHADER_STAGE}, + {sizeof(OpticalFlowSpdConstants) / sizeof(uint32_t), FFX_BIND_COMPUTE_SHADER_STAGE} }; + FfxPipelineDescription pipelineDescription = {}; + pipelineDescription.stage = FFX_BIND_COMPUTE_SHADER_STAGE; + pipelineDescription.contextFlags = context->contextDescription.flags; + pipelineDescription.samplerCount = samplerCount; + pipelineDescription.samplers = samplerDescs; + pipelineDescription.rootConstantBufferCount = rootConstantCount; + pipelineDescription.rootConstants = rootConstantDescs; + + FfxDeviceCapabilities capabilities; + context->contextDescription.backendInterface.fpGetDeviceCapabilities(&context->contextDescription.backendInterface, &capabilities); + + bool haveShaderModel66 = capabilities.maximumSupportedShaderModel >= FFX_SHADER_MODEL_6_6; + bool supportedFP16 = capabilities.fp16Supported; + bool canForceWave64 = false; + bool useLut = false; + + const uint32_t waveLaneCountMin = capabilities.waveLaneCountMin; + const uint32_t waveLaneCountMax = capabilities.waveLaneCountMax; + if (waveLaneCountMin == 32 && waveLaneCountMax == 64) + { + useLut = true; + canForceWave64 = haveShaderModel66; + } + else + canForceWave64 = false; + + uint32_t contextFlags = context->contextDescription.flags; + + auto CreateComputePipeline = [&](FfxPass pass, const wchar_t* name, FfxPipelineState* pipeline) -> FfxErrorCode { + ffxSafeReleasePipeline(&context->contextDescription.backendInterface, pipeline, context->effectContextId); + wcscpy_s(pipelineDescription.name, name); + FFX_VALIDATE(context->contextDescription.backendInterface.fpCreatePipeline( + &context->contextDescription.backendInterface, + FFX_EFFECT_OPTICALFLOW, + pass, + getPipelinePermutationFlags(contextFlags, pass, supportedFP16, canForceWave64, useLut), + &pipelineDescription, + context->effectContextId, + pipeline)); + + patchResourceBindings(pipeline); + return FFX_OK; + }; + + CreateComputePipeline(FFX_OPTICALFLOW_PASS_GENERATE_OPTICAL_FLOW_INPUT_PYRAMID, L"Opticalflow_InputPyramid", & context->pipelineGenerateOpticalFlowInputPyramid); + pipelineDescription.rootConstantBufferCount = 1; + CreateComputePipeline(FFX_OPTICALFLOW_PASS_PREPARE_LUMA, L"Opticalflow_Luma", &context->pipelinePrepareLuma); + CreateComputePipeline(FFX_OPTICALFLOW_PASS_GENERATE_SCD_HISTOGRAM, L"Opticalflow_SCD_Histogram", &context->pipelineGenerateSCDHistogram); + CreateComputePipeline(FFX_OPTICALFLOW_PASS_COMPUTE_SCD_DIVERGENCE, L"Opticalflow_SCD_Divergence", &context->pipelineComputeSCDDivergence); + CreateComputePipeline(FFX_OPTICALFLOW_PASS_COMPUTE_OPTICAL_FLOW_ADVANCED_V5, L"Opticalflow_Search", &context->pipelineComputeOpticalFlowAdvancedV5); + CreateComputePipeline(FFX_OPTICALFLOW_PASS_FILTER_OPTICAL_FLOW_V5, L"Opticalflow_Filter", &context->pipelineFilterOpticalFlowV5); + CreateComputePipeline(FFX_OPTICALFLOW_PASS_SCALE_OPTICAL_FLOW_ADVANCED_V5, L"Opticalflow_Upscale", &context->pipelineScaleOpticalFlowAdvancedV5); + + return FFX_OK; +} + +constexpr uint32_t OpticalFlowMaxPyramidLevels = 7; +constexpr uint32_t HistogramBins = 256; +constexpr uint32_t HistogramsPerDim = 3; +constexpr uint32_t HistogramShifts = 3; + +static FfxDimensions2D GetOpticalFlowTextureSize(const FfxDimensions2D& displaySize, const uint32_t opticalFlowBlockSize) +{ + uint32_t width = (displaySize.width + opticalFlowBlockSize - 1) / opticalFlowBlockSize; + uint32_t height = (displaySize.height + opticalFlowBlockSize - 1) / opticalFlowBlockSize; + return { width, height }; +} + +static FfxDimensions2D GetOpticalFlowHistogramSize(int level) +{ + const uint32_t searchRadius = 8; + uint32_t maxVelocity = searchRadius * (1 << (OpticalFlowMaxPyramidLevels - 1 - level)); + uint32_t binsPerDimension = 2 * maxVelocity + 1; + return { binsPerDimension, binsPerDimension }; +} + +static FfxDimensions2D GetGlobalMotionSearchDispatchSize(int level) +{ + const uint32_t threadGroupSizeX = 16; + const uint32_t threadGroupSizeY = 16; + const FfxDimensions2D opticalFlowHistogramSize = GetOpticalFlowHistogramSize(level); + const uint32_t additionalElementsDueToShiftsX = opticalFlowHistogramSize.width / threadGroupSizeX; + const uint32_t additionalElementsDueToShiftsY = opticalFlowHistogramSize.height / threadGroupSizeY; + const uint32_t dispatchX = (opticalFlowHistogramSize.width + additionalElementsDueToShiftsX + threadGroupSizeX - 1) / threadGroupSizeX; + const uint32_t dispatchY = (opticalFlowHistogramSize.height + additionalElementsDueToShiftsY + threadGroupSizeY - 1) / threadGroupSizeY; + return { dispatchX, dispatchY }; +} + +static uint32_t GetSCDHistogramTextureWidth() +{ + return HistogramBins * (HistogramsPerDim * HistogramsPerDim); +} + +static FfxErrorCode opticalflowCreate(FfxOpticalflowContext_Private* context, const FfxOpticalflowContextDescription* contextDescription) +{ + FFX_ASSERT(context); + FFX_ASSERT(contextDescription); + FfxErrorCode errorCode = FFX_OK; + + memset(context, 0, sizeof(FfxOpticalflowContext_Private)); + context->device = contextDescription->backendInterface.device; + + memcpy(&context->contextDescription, contextDescription, sizeof(FfxOpticalflowContextDescription)); + + // Check version info - make sure we are linked with the right backend version + FfxVersionNumber version = context->contextDescription.backendInterface.fpGetSDKVersion(&context->contextDescription.backendInterface); + FFX_RETURN_ON_ERROR(version == FFX_SDK_MAKE_VERSION(1, 1, 4), FFX_ERROR_INVALID_VERSION); + + errorCode = context->contextDescription.backendInterface.fpCreateBackendContext(&context->contextDescription.backendInterface, FFX_EFFECT_OPTICALFLOW, nullptr, &context->effectContextId); + FFX_RETURN_ON_ERROR(errorCode == FFX_OK, errorCode); + + errorCode = context->contextDescription.backendInterface.fpGetDeviceCapabilities(&context->contextDescription.backendInterface, &context->deviceCapabilities); + FFX_RETURN_ON_ERROR(errorCode == FFX_OK, errorCode); + + context->firstExecution = true; + context->resourceFrameIndex = 0; + + context->constants.inputLumaResolution[0] = context->contextDescription.resolution.width; + context->constants.inputLumaResolution[1] = context->contextDescription.resolution.height; + + FfxDimensions2D opticalFlowInputTextureSize = context->contextDescription.resolution; + + const FfxResourceType texture1dResourceType = (context->contextDescription.flags & FFX_OPTICALFLOW_ENABLE_TEXTURE1D_USAGE) ? FFX_RESOURCE_TYPE_TEXTURE1D : FFX_RESOURCE_TYPE_TEXTURE2D; + + uint32_t minBlockSize = 8; + const FfxDimensions2D opticalFlowTextureSize = GetOpticalFlowTextureSize(contextDescription->resolution, minBlockSize); + + const FfxDimensions2D opticalFlowLevel1TextureSize = { FFX_ALIGN_UP(opticalFlowTextureSize.width, 2) / 2, FFX_ALIGN_UP(opticalFlowTextureSize.height, 2) / 2 }; + const FfxDimensions2D opticalFlowLevel2TextureSize = { FFX_ALIGN_UP(opticalFlowLevel1TextureSize.width, 2) / 2, FFX_ALIGN_UP(opticalFlowLevel1TextureSize.height, 2) / 2 }; + const FfxDimensions2D opticalFlowLevel3TextureSize = { FFX_ALIGN_UP(opticalFlowLevel2TextureSize.width, 2) / 2, FFX_ALIGN_UP(opticalFlowLevel2TextureSize.height, 2) / 2 }; + const FfxDimensions2D opticalFlowLevel4TextureSize = { FFX_ALIGN_UP(opticalFlowLevel3TextureSize.width, 2) / 2, FFX_ALIGN_UP(opticalFlowLevel3TextureSize.height, 2) / 2 }; + const FfxDimensions2D opticalFlowLevel5TextureSize = { FFX_ALIGN_UP(opticalFlowLevel4TextureSize.width, 2) / 2, FFX_ALIGN_UP(opticalFlowLevel4TextureSize.height, 2) / 2 }; + const FfxDimensions2D opticalFlowLevel6TextureSize = { FFX_ALIGN_UP(opticalFlowLevel5TextureSize.width, 2) / 2, FFX_ALIGN_UP(opticalFlowLevel5TextureSize.height, 2) / 2 }; + const FfxDimensions2D opticalFlowLevel7TextureSize = { FFX_ALIGN_UP(opticalFlowLevel6TextureSize.width, 2) / 2, FFX_ALIGN_UP(opticalFlowLevel6TextureSize.height, 2) / 2 }; + + const FfxDimensions2D opticalFlowHistogramTextureSize = GetOpticalFlowHistogramSize(0); + + const FfxDimensions2D globalMotionSearchMaxDispatchSize = GetGlobalMotionSearchDispatchSize(0); + const uint32_t globalMotionSearchTextureWidth = 4 + (globalMotionSearchMaxDispatchSize.width * globalMotionSearchMaxDispatchSize.height); + + const FfxInternalResourceDescription internalSurfaceDesc[] = { + { FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_1, L"OPTICALFLOW_OpticalFlowInput1", FFX_RESOURCE_TYPE_TEXTURE2D, FFX_RESOURCE_USAGE_UAV, + FFX_SURFACE_FORMAT_R8_UINT, opticalFlowInputTextureSize.width, opticalFlowInputTextureSize.height, 1, FFX_RESOURCE_FLAGS_NONE, {FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED} }, + + { FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_1_LEVEL_1, L"OPTICALFLOW_OpticalFlowInput1Level1", FFX_RESOURCE_TYPE_TEXTURE2D, FFX_RESOURCE_USAGE_UAV, + FFX_SURFACE_FORMAT_R8_UINT, opticalFlowInputTextureSize.width >> 1, opticalFlowInputTextureSize.height >> 1, 1, FFX_RESOURCE_FLAGS_NONE, {FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED} }, + + { FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_1_LEVEL_2, L"OPTICALFLOW_OpticalFlowInput1Level2", FFX_RESOURCE_TYPE_TEXTURE2D, FFX_RESOURCE_USAGE_UAV, + FFX_SURFACE_FORMAT_R8_UINT, opticalFlowInputTextureSize.width >> 2, opticalFlowInputTextureSize.height >> 2, 1, FFX_RESOURCE_FLAGS_NONE, {FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED} }, + + { FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_1_LEVEL_3, L"OPTICALFLOW_OpticalFlowInput1Level3", FFX_RESOURCE_TYPE_TEXTURE2D, FFX_RESOURCE_USAGE_UAV, + FFX_SURFACE_FORMAT_R8_UINT, opticalFlowInputTextureSize.width >> 3, opticalFlowInputTextureSize.height >> 3, 1, FFX_RESOURCE_FLAGS_NONE, {FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED} }, + + { FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_1_LEVEL_4, L"OPTICALFLOW_OpticalFlowInput1Level4", FFX_RESOURCE_TYPE_TEXTURE2D, FFX_RESOURCE_USAGE_UAV, + FFX_SURFACE_FORMAT_R8_UINT, opticalFlowInputTextureSize.width >> 4, opticalFlowInputTextureSize.height >> 4, 1, FFX_RESOURCE_FLAGS_NONE, {FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED} }, + + { FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_1_LEVEL_5, L"OPTICALFLOW_OpticalFlowInput1Level5", FFX_RESOURCE_TYPE_TEXTURE2D, FFX_RESOURCE_USAGE_UAV, + FFX_SURFACE_FORMAT_R8_UINT, opticalFlowInputTextureSize.width >> 5, opticalFlowInputTextureSize.height >> 5, 1, FFX_RESOURCE_FLAGS_NONE, {FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED} }, + + { FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_1_LEVEL_6, L"OPTICALFLOW_OpticalFlowInput1Level6", FFX_RESOURCE_TYPE_TEXTURE2D, FFX_RESOURCE_USAGE_UAV, + FFX_SURFACE_FORMAT_R8_UINT, opticalFlowInputTextureSize.width >> 6, opticalFlowInputTextureSize.height >> 6, 1, FFX_RESOURCE_FLAGS_NONE, {FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED} }, + + { FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_2, L"OPTICALFLOW_OpticalFlowInput2", FFX_RESOURCE_TYPE_TEXTURE2D, FFX_RESOURCE_USAGE_UAV, + FFX_SURFACE_FORMAT_R8_UINT, opticalFlowInputTextureSize.width, opticalFlowInputTextureSize.height, 1, FFX_RESOURCE_FLAGS_NONE, {FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED} }, + + { FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_2_LEVEL_1, L"OPTICALFLOW_OpticalFlowInput2Level1", FFX_RESOURCE_TYPE_TEXTURE2D, FFX_RESOURCE_USAGE_UAV, + FFX_SURFACE_FORMAT_R8_UINT, opticalFlowInputTextureSize.width >> 1, opticalFlowInputTextureSize.height >> 1, 1, FFX_RESOURCE_FLAGS_NONE, {FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED} }, + + { FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_2_LEVEL_2, L"OPTICALFLOW_OpticalFlowInput2Level2", FFX_RESOURCE_TYPE_TEXTURE2D, FFX_RESOURCE_USAGE_UAV, + FFX_SURFACE_FORMAT_R8_UINT, opticalFlowInputTextureSize.width >> 2, opticalFlowInputTextureSize.height >> 2, 1, FFX_RESOURCE_FLAGS_NONE, {FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED} }, + + { FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_2_LEVEL_3, L"OPTICALFLOW_OpticalFlowInput2Level3", FFX_RESOURCE_TYPE_TEXTURE2D, FFX_RESOURCE_USAGE_UAV, + FFX_SURFACE_FORMAT_R8_UINT, opticalFlowInputTextureSize.width >> 3, opticalFlowInputTextureSize.height >> 3, 1, FFX_RESOURCE_FLAGS_NONE, {FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED} }, + + { FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_2_LEVEL_4, L"OPTICALFLOW_OpticalFlowInput2Level4", FFX_RESOURCE_TYPE_TEXTURE2D, FFX_RESOURCE_USAGE_UAV, + FFX_SURFACE_FORMAT_R8_UINT, opticalFlowInputTextureSize.width >> 4, opticalFlowInputTextureSize.height >> 4, 1, FFX_RESOURCE_FLAGS_NONE, {FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED} }, + + { FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_2_LEVEL_5, L"OPTICALFLOW_OpticalFlowInput2Level5", FFX_RESOURCE_TYPE_TEXTURE2D, FFX_RESOURCE_USAGE_UAV, + FFX_SURFACE_FORMAT_R8_UINT, opticalFlowInputTextureSize.width >> 5, opticalFlowInputTextureSize.height >> 5, 1, FFX_RESOURCE_FLAGS_NONE, {FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED} }, + + { FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_2_LEVEL_6, L"OPTICALFLOW_OpticalFlowInput2Level6", FFX_RESOURCE_TYPE_TEXTURE2D, FFX_RESOURCE_USAGE_UAV, + FFX_SURFACE_FORMAT_R8_UINT, opticalFlowInputTextureSize.width >> 6, opticalFlowInputTextureSize.height >> 6, 1, FFX_RESOURCE_FLAGS_NONE, {FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED} }, + + { FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_1, L"OPTICALFLOW_OpticalFlow1", FFX_RESOURCE_TYPE_TEXTURE2D, FFX_RESOURCE_USAGE_UAV, + FFX_SURFACE_FORMAT_R16G16_SINT, opticalFlowTextureSize.width, opticalFlowTextureSize.height, 1, FFX_RESOURCE_FLAGS_NONE, {FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED} }, + + { FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_1_LEVEL_1, L"OPTICALFLOW_OpticalFlow1Level1", FFX_RESOURCE_TYPE_TEXTURE2D, FFX_RESOURCE_USAGE_UAV, + FFX_SURFACE_FORMAT_R16G16_SINT, opticalFlowLevel1TextureSize.width, opticalFlowLevel1TextureSize.height, 1, FFX_RESOURCE_FLAGS_NONE, {FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED} }, + + { FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_1_LEVEL_2, L"OPTICALFLOW_OpticalFlow1Level2", FFX_RESOURCE_TYPE_TEXTURE2D, FFX_RESOURCE_USAGE_UAV, + FFX_SURFACE_FORMAT_R16G16_SINT, opticalFlowLevel2TextureSize.width, opticalFlowLevel2TextureSize.height, 1, FFX_RESOURCE_FLAGS_NONE, {FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED} }, + + { FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_1_LEVEL_3, L"OPTICALFLOW_OpticalFlow1Level3", FFX_RESOURCE_TYPE_TEXTURE2D, FFX_RESOURCE_USAGE_UAV, + FFX_SURFACE_FORMAT_R16G16_SINT, opticalFlowLevel3TextureSize.width, opticalFlowLevel3TextureSize.height, 1, FFX_RESOURCE_FLAGS_NONE, {FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED} }, + + { FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_1_LEVEL_4, L"OPTICALFLOW_OpticalFlow1Level4", FFX_RESOURCE_TYPE_TEXTURE2D, FFX_RESOURCE_USAGE_UAV, + FFX_SURFACE_FORMAT_R16G16_SINT, opticalFlowLevel4TextureSize.width, opticalFlowLevel4TextureSize.height, 1, FFX_RESOURCE_FLAGS_NONE, {FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED} }, + + { FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_1_LEVEL_5, L"OPTICALFLOW_OpticalFlow1Level5", FFX_RESOURCE_TYPE_TEXTURE2D, FFX_RESOURCE_USAGE_UAV, + FFX_SURFACE_FORMAT_R16G16_SINT, opticalFlowLevel5TextureSize.width, opticalFlowLevel5TextureSize.height, 1, FFX_RESOURCE_FLAGS_NONE, {FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED} }, + + { FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_1_LEVEL_6, L"OPTICALFLOW_OpticalFlow1Level6", FFX_RESOURCE_TYPE_TEXTURE2D, FFX_RESOURCE_USAGE_UAV, + FFX_SURFACE_FORMAT_R16G16_SINT, opticalFlowLevel6TextureSize.width, opticalFlowLevel6TextureSize.height, 1, FFX_RESOURCE_FLAGS_NONE, {FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED} }, + + { FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_2, L"OPTICALFLOW_OpticalFlow2", FFX_RESOURCE_TYPE_TEXTURE2D, FFX_RESOURCE_USAGE_UAV, + FFX_SURFACE_FORMAT_R16G16_SINT, opticalFlowTextureSize.width, opticalFlowTextureSize.height, 1, FFX_RESOURCE_FLAGS_NONE, {FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED} }, + + { FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_2_LEVEL_1, L"OPTICALFLOW_OpticalFlow2Level1", FFX_RESOURCE_TYPE_TEXTURE2D, FFX_RESOURCE_USAGE_UAV, + FFX_SURFACE_FORMAT_R16G16_SINT, opticalFlowLevel1TextureSize.width, opticalFlowLevel1TextureSize.height, 1, FFX_RESOURCE_FLAGS_NONE, {FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED} }, + + { FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_2_LEVEL_2, L"OPTICALFLOW_OpticalFlow2Level2", FFX_RESOURCE_TYPE_TEXTURE2D, FFX_RESOURCE_USAGE_UAV, + FFX_SURFACE_FORMAT_R16G16_SINT, opticalFlowLevel2TextureSize.width, opticalFlowLevel2TextureSize.height, 1, FFX_RESOURCE_FLAGS_NONE, {FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED} }, + + { FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_2_LEVEL_3, L"OPTICALFLOW_OpticalFlow2Level3", FFX_RESOURCE_TYPE_TEXTURE2D, FFX_RESOURCE_USAGE_UAV, + FFX_SURFACE_FORMAT_R16G16_SINT, opticalFlowLevel3TextureSize.width, opticalFlowLevel3TextureSize.height, 1, FFX_RESOURCE_FLAGS_NONE, {FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED} }, + + { FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_2_LEVEL_4, L"OPTICALFLOW_OpticalFlow2Level4", FFX_RESOURCE_TYPE_TEXTURE2D, FFX_RESOURCE_USAGE_UAV, + FFX_SURFACE_FORMAT_R16G16_SINT, opticalFlowLevel4TextureSize.width, opticalFlowLevel4TextureSize.height, 1, FFX_RESOURCE_FLAGS_NONE, {FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED} }, + + { FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_2_LEVEL_5, L"OPTICALFLOW_OpticalFlow2Level5", FFX_RESOURCE_TYPE_TEXTURE2D, FFX_RESOURCE_USAGE_UAV, + FFX_SURFACE_FORMAT_R16G16_SINT, opticalFlowLevel5TextureSize.width, opticalFlowLevel5TextureSize.height, 1, FFX_RESOURCE_FLAGS_NONE, {FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED} }, + + { FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_2_LEVEL_6, L"OPTICALFLOW_OpticalFlow2Level6", FFX_RESOURCE_TYPE_TEXTURE2D, FFX_RESOURCE_USAGE_UAV, + FFX_SURFACE_FORMAT_R16G16_SINT, opticalFlowLevel6TextureSize.width, opticalFlowLevel6TextureSize.height, 1, FFX_RESOURCE_FLAGS_NONE, {FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED} }, + + { FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_SCD_HISTOGRAM, L"OPTICALFLOW_OpticalFlowSCDHistogram", FFX_RESOURCE_TYPE_TEXTURE2D, FFX_RESOURCE_USAGE_UAV, + FFX_SURFACE_FORMAT_R32_UINT, GetSCDHistogramTextureWidth(), 1, 1, FFX_RESOURCE_FLAGS_NONE, {FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED} }, + + { FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_SCD_PREVIOUS_HISTOGRAM, L"OPTICALFLOW_OpticalFlowSCDPreviousHistogram", FFX_RESOURCE_TYPE_TEXTURE2D, FFX_RESOURCE_USAGE_UAV, + FFX_SURFACE_FORMAT_R32_FLOAT, GetSCDHistogramTextureWidth(), 1, 1, FFX_RESOURCE_FLAGS_NONE, {FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED} }, + + { FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_SCD_TEMP, L"OPTICALFLOW_OpticalFlowSCDTemp", FFX_RESOURCE_TYPE_TEXTURE2D, FFX_RESOURCE_USAGE_UAV, + FFX_SURFACE_FORMAT_R32_UINT, 3, 1, 1, FFX_RESOURCE_FLAGS_NONE, {FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED} }, + }; + + memset(context->resources, 0, sizeof(context->resources)); + + for (int32_t currentSurfaceIndex = 0; currentSurfaceIndex < FFX_ARRAY_ELEMENTS(internalSurfaceDesc); ++currentSurfaceIndex) { + + const FfxInternalResourceDescription* currentSurfaceDescription = &internalSurfaceDesc[currentSurfaceIndex]; + const FfxResourceType resourceType = currentSurfaceDescription->height > 1 ? FFX_RESOURCE_TYPE_TEXTURE2D : texture1dResourceType; + const FfxResourceDescription resourceDescription = { + resourceType, currentSurfaceDescription->format, + currentSurfaceDescription->width, currentSurfaceDescription->height, 1, + currentSurfaceDescription->mipCount, FFX_RESOURCE_FLAGS_NONE, currentSurfaceDescription->usage }; + const FfxResourceStates initialState = FFX_RESOURCE_STATE_UNORDERED_ACCESS; + const FfxCreateResourceDescription createResourceDescription = { + FFX_HEAP_TYPE_DEFAULT, resourceDescription, initialState, currentSurfaceDescription->name, currentSurfaceDescription->id, currentSurfaceDescription->initData }; + + FFX_VALIDATE(context->contextDescription.backendInterface.fpCreateResource( + &context->contextDescription.backendInterface, + &createResourceDescription, + context->effectContextId, + &context->resources[currentSurfaceDescription->id])); + } + + memset(context->srvBindings, 0, sizeof(context->srvBindings)); + memset(context->uavBindings, 0, sizeof(context->uavBindings)); + + { + context->refreshPipelineStates = false; + errorCode = createPipelineStates(context); + FFX_RETURN_ON_ERROR(errorCode == FFX_OK, errorCode); + } + + return FFX_OK; +} + +static FfxErrorCode opticalflowRelease(FfxOpticalflowContext_Private* context) +{ + FFX_ASSERT(context); + + ffxSafeReleasePipeline(&context->contextDescription.backendInterface, &context->pipelinePrepareLuma, context->effectContextId); + ffxSafeReleasePipeline(&context->contextDescription.backendInterface, &context->pipelineGenerateOpticalFlowInputPyramid, context->effectContextId); + ffxSafeReleasePipeline(&context->contextDescription.backendInterface, &context->pipelineGenerateSCDHistogram, context->effectContextId); + ffxSafeReleasePipeline(&context->contextDescription.backendInterface, &context->pipelineComputeSCDDivergence, context->effectContextId); + ffxSafeReleasePipeline(&context->contextDescription.backendInterface, &context->pipelineComputeOpticalFlowAdvancedV5, context->effectContextId); + ffxSafeReleasePipeline(&context->contextDescription.backendInterface, &context->pipelineFilterOpticalFlowV5, context->effectContextId); + ffxSafeReleasePipeline(&context->contextDescription.backendInterface, &context->pipelineScaleOpticalFlowAdvancedV5, context->effectContextId); + + for (int32_t currentResourceIndex = 0; currentResourceIndex < FFX_OF_RESOURCE_IDENTIFIER_COUNT; ++currentResourceIndex) { + + ffxSafeReleaseResource(&context->contextDescription.backendInterface, context->resources[currentResourceIndex], context->effectContextId); + } + + context->contextDescription.backendInterface.fpDestroyBackendContext(&context->contextDescription.backendInterface, context->effectContextId); + + return FFX_OK; +} + +static void scheduleDispatch(FfxOpticalflowContext_Private* context, const FfxPipelineState* pipeline, const wchar_t* pipelineName, uint32_t dispatchX, uint32_t dispatchY, uint32_t dispatchZ = 1) +{ + FfxComputeJobDescription jobDescriptor = {}; + + for (uint32_t currentShaderResourceViewIndex = 0; currentShaderResourceViewIndex < pipeline->srvTextureCount; ++currentShaderResourceViewIndex) { + + const uint32_t bindingIdentifier = pipeline->srvTextureBindings[currentShaderResourceViewIndex].resourceIdentifier; + const FfxResourceInternal currentResource = context->srvBindings[bindingIdentifier]; + jobDescriptor.srvTextures[currentShaderResourceViewIndex].resource = currentResource; +#ifdef FFX_DEBUG + wcscpy_s(jobDescriptor.srvTextures[currentShaderResourceViewIndex].name, pipeline->srvTextureBindings[currentShaderResourceViewIndex].name); +#endif + + FFX_ASSERT(bindingIdentifier != FFX_OF_BINDING_IDENTIFIER_NULL); + FFX_ASSERT(bindingIdentifier < FFX_OF_BINDING_IDENTIFIER_COUNT); + } + + for (uint32_t currentUnorderedAccessViewIndex = 0; currentUnorderedAccessViewIndex < pipeline->uavTextureCount; ++currentUnorderedAccessViewIndex) { + + const uint32_t bindingIdentifier = pipeline->uavTextureBindings[currentUnorderedAccessViewIndex].resourceIdentifier; + const FfxResourceInternal currentResource = context->uavBindings[bindingIdentifier]; + jobDescriptor.uavTextures[currentUnorderedAccessViewIndex].resource = currentResource; + jobDescriptor.uavTextures[currentUnorderedAccessViewIndex].mip = 0; +#ifdef FFX_DEBUG + wcscpy_s(jobDescriptor.uavTextures[currentUnorderedAccessViewIndex].name, pipeline->uavTextureBindings[currentUnorderedAccessViewIndex].name); +#endif + + FFX_ASSERT(bindingIdentifier != FFX_OF_BINDING_IDENTIFIER_NULL); + FFX_ASSERT(bindingIdentifier < FFX_OF_BINDING_IDENTIFIER_COUNT); + } + + jobDescriptor.dimensions[0] = dispatchX; + jobDescriptor.dimensions[1] = dispatchY; + jobDescriptor.dimensions[2] = dispatchZ; + jobDescriptor.pipeline = *pipeline; + + for (uint32_t currentRootConstantIndex = 0; currentRootConstantIndex < pipeline->constCount; ++currentRootConstantIndex) { +#ifdef FFX_DEBUG + wcscpy_s(jobDescriptor.cbNames[currentRootConstantIndex], pipeline->constantBufferBindings[currentRootConstantIndex].name); +#endif + jobDescriptor.cbs[currentRootConstantIndex] = context->constantBuffers[pipeline->constantBufferBindings[currentRootConstantIndex].resourceIdentifier]; + } + + FfxGpuJobDescription dispatchJob = { FFX_GPU_JOB_COMPUTE }; + wcscpy_s(dispatchJob.jobLabel, pipelineName); + dispatchJob.computeJobDescriptor = jobDescriptor; + + context->contextDescription.backendInterface.fpScheduleGpuJob(&context->contextDescription.backendInterface, &dispatchJob); +} + +static FfxErrorCode dispatch(FfxOpticalflowContext_Private* context, const FfxOpticalflowDispatchDescription* params) +{ + context->contextDescription.backendInterface.fpRegisterResource( + &context->contextDescription.backendInterface, + ¶ms->opticalFlowVector, + context->effectContextId, + &context->uavBindings[FFX_OF_BINDING_IDENTIFIER_SHARED_OPTICAL_FLOW_VECTOR]); + context->contextDescription.backendInterface.fpRegisterResource( + &context->contextDescription.backendInterface, + ¶ms->opticalFlowSCD, + context->effectContextId, + &context->uavBindings[FFX_OF_BINDING_IDENTIFIER_SHARED_OPTICAL_FLOW_SCD_OUTPUT]); + + context->contextDescription.backendInterface.fpRegisterResource( + &context->contextDescription.backendInterface, + ¶ms->color, + context->effectContextId, + &context->srvBindings[FFX_OF_BINDING_IDENTIFIER_INPUT_COLOR]); + + FfxCommandList commandList = params->commandList; + int advancedAlgorithmIterations = 7; + uint32_t opticalFlowBlockSize = 8; + + if (context->refreshPipelineStates) { + + context->refreshPipelineStates = false; + + const FfxErrorCode errorCode = createPipelineStates(context); + FFX_RETURN_ON_ERROR(errorCode == FFX_OK, errorCode); + } + + const FfxResourceDescription resourceDescInputColor = context->contextDescription.backendInterface.fpGetResourceDescription( + &context->contextDescription.backendInterface, + context->srvBindings[FFX_OF_BINDING_IDENTIFIER_INPUT_COLOR]); + FFX_ASSERT(resourceDescInputColor.type == FFX_RESOURCE_TYPE_TEXTURE2D); + + context->constants.backbufferTransferFunction = params->backbufferTransferFunction; + context->constants.minMaxLuminance[0] = params->minMaxLuminance.x; + context->constants.minMaxLuminance[1] = params->minMaxLuminance.y; + + const bool resetAccumulation = params->reset || context->firstExecution; + context->firstExecution = false; + + if (resetAccumulation) { + context->constants.frameIndex = 0; + } + else { + context->constants.frameIndex++; + } + + if (resetAccumulation) + { + const float clearValuesToZeroFloat[]{ 0.f, 0.f, 0.f, 0.f }; + FfxGpuJobDescription clearJob = { FFX_GPU_JOB_CLEAR_FLOAT }; + memcpy(clearJob.clearJobDescriptor.color, clearValuesToZeroFloat, 4 * sizeof(float)); + + wcscpy_s(clearJob.jobLabel, L"Clear Optical Flow SCD Temp"); + clearJob.clearJobDescriptor.target = context->resources[FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_SCD_TEMP]; + context->contextDescription.backendInterface.fpScheduleGpuJob(&context->contextDescription.backendInterface, &clearJob); + clearJob.clearJobDescriptor.target = context->uavBindings[FFX_OF_BINDING_IDENTIFIER_SHARED_OPTICAL_FLOW_SCD_OUTPUT]; + context->contextDescription.backendInterface.fpScheduleGpuJob(&context->contextDescription.backendInterface, &clearJob); + wcscpy_s(clearJob.jobLabel, L"Clear Optical Flow SCD Histogram"); + clearJob.clearJobDescriptor.target = context->resources[FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_SCD_HISTOGRAM]; + context->contextDescription.backendInterface.fpScheduleGpuJob(&context->contextDescription.backendInterface, &clearJob); + wcscpy_s(clearJob.jobLabel, L"Clear Optical Flow SCD Previous histogram"); + clearJob.clearJobDescriptor.target = context->resources[FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_SCD_PREVIOUS_HISTOGRAM]; + context->contextDescription.backendInterface.fpScheduleGpuJob(&context->contextDescription.backendInterface, &clearJob); + wcscpy_s(clearJob.jobLabel, L"Clear Optical Flow Input 1"); + clearJob.clearJobDescriptor.target = context->resources[FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_1]; + context->contextDescription.backendInterface.fpScheduleGpuJob(&context->contextDescription.backendInterface, &clearJob); + wcscpy_s(clearJob.jobLabel, L"Clear Optical Flow Input 1 Level 1"); + clearJob.clearJobDescriptor.target = context->resources[FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_1_LEVEL_1]; + context->contextDescription.backendInterface.fpScheduleGpuJob(&context->contextDescription.backendInterface, &clearJob); + wcscpy_s(clearJob.jobLabel, L"Clear Optical Flow Input 1 Level 2"); + clearJob.clearJobDescriptor.target = context->resources[FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_1_LEVEL_2]; + context->contextDescription.backendInterface.fpScheduleGpuJob(&context->contextDescription.backendInterface, &clearJob); + wcscpy_s(clearJob.jobLabel, L"Clear Optical Flow Input 1 Level 3"); + clearJob.clearJobDescriptor.target = context->resources[FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_1_LEVEL_3]; + context->contextDescription.backendInterface.fpScheduleGpuJob(&context->contextDescription.backendInterface, &clearJob); + wcscpy_s(clearJob.jobLabel, L"Clear Optical Flow Input 1 Level 4"); + clearJob.clearJobDescriptor.target = context->resources[FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_1_LEVEL_4]; + context->contextDescription.backendInterface.fpScheduleGpuJob(&context->contextDescription.backendInterface, &clearJob); + wcscpy_s(clearJob.jobLabel, L"Clear Optical Flow Input 1 Level 5"); + clearJob.clearJobDescriptor.target = context->resources[FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_1_LEVEL_5]; + context->contextDescription.backendInterface.fpScheduleGpuJob(&context->contextDescription.backendInterface, &clearJob); + wcscpy_s(clearJob.jobLabel, L"Clear Optical Flow Input 1 Level 6"); + clearJob.clearJobDescriptor.target = context->resources[FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_1_LEVEL_6]; + context->contextDescription.backendInterface.fpScheduleGpuJob(&context->contextDescription.backendInterface, &clearJob); + wcscpy_s(clearJob.jobLabel, L"Clear Optical Flow Input 2"); + clearJob.clearJobDescriptor.target = context->resources[FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_2]; + context->contextDescription.backendInterface.fpScheduleGpuJob(&context->contextDescription.backendInterface, &clearJob); + wcscpy_s(clearJob.jobLabel, L"Clear Optical Flow Input 2 Level 1"); + clearJob.clearJobDescriptor.target = context->resources[FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_2_LEVEL_1]; + context->contextDescription.backendInterface.fpScheduleGpuJob(&context->contextDescription.backendInterface, &clearJob); + wcscpy_s(clearJob.jobLabel, L"Clear Optical Flow Input 2 Level 2"); + clearJob.clearJobDescriptor.target = context->resources[FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_2_LEVEL_2]; + context->contextDescription.backendInterface.fpScheduleGpuJob(&context->contextDescription.backendInterface, &clearJob); + wcscpy_s(clearJob.jobLabel, L"Clear Optical Flow Input 2 Level 3"); + clearJob.clearJobDescriptor.target = context->resources[FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_2_LEVEL_3]; + context->contextDescription.backendInterface.fpScheduleGpuJob(&context->contextDescription.backendInterface, &clearJob); + wcscpy_s(clearJob.jobLabel, L"Clear Optical Flow Input 2 Level 4"); + clearJob.clearJobDescriptor.target = context->resources[FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_2_LEVEL_4]; + context->contextDescription.backendInterface.fpScheduleGpuJob(&context->contextDescription.backendInterface, &clearJob); + wcscpy_s(clearJob.jobLabel, L"Clear Optical Flow Input 2 Level 5"); + clearJob.clearJobDescriptor.target = context->resources[FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_2_LEVEL_5]; + context->contextDescription.backendInterface.fpScheduleGpuJob(&context->contextDescription.backendInterface, &clearJob); + wcscpy_s(clearJob.jobLabel, L"Clear Optical Flow Input 2 Level 6"); + clearJob.clearJobDescriptor.target = context->resources[FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_2_LEVEL_6]; + context->contextDescription.backendInterface.fpScheduleGpuJob(&context->contextDescription.backendInterface, &clearJob); + } + + uint32_t resolutionMultiplier = 1; + + FfxUInt32x2 threadGroupSizeOpticalFlowInputPyramid; + FfxUInt32x2 workGroupOffset; + FfxUInt32x2 numWorkGroupsAndMips; + FfxUInt32x4 rectInfo = { 0, 0, + context->contextDescription.resolution.width * resolutionMultiplier, + context->contextDescription.resolution.height * resolutionMultiplier }; + ffxSpdSetup(threadGroupSizeOpticalFlowInputPyramid, workGroupOffset, numWorkGroupsAndMips, rectInfo, 4); + + OpticalFlowSpdConstants luminancePyramidConstants; + luminancePyramidConstants.numworkGroups = numWorkGroupsAndMips[0]; + luminancePyramidConstants.mips = numWorkGroupsAndMips[1]; + luminancePyramidConstants.workGroupOffset[0] = workGroupOffset[0]; + luminancePyramidConstants.workGroupOffset[1] = workGroupOffset[1]; + luminancePyramidConstants.numworkGroupsOpticalFlowInputPyramid = numWorkGroupsAndMips[0]; + + context->contextDescription.backendInterface.fpStageConstantBufferDataFunc(&context->contextDescription.backendInterface, &context->constants, sizeof(context->constants), &context->constantBuffers[FFX_OPTICALFLOW_CONSTANTBUFFER_IDENTIFIER]); + context->contextDescription.backendInterface.fpStageConstantBufferDataFunc(&context->contextDescription.backendInterface, &luminancePyramidConstants, sizeof(luminancePyramidConstants), &context->constantBuffers[FFX_OPTICALFLOW_CONSTANTBUFFER_IDENTIFIER_SPD]); + + { + context->uavBindings[FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_SCD_HISTOGRAM] = context->resources[FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_SCD_HISTOGRAM]; + context->uavBindings[FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_SCD_PREVIOUS_HISTOGRAM] = context->resources[FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_SCD_PREVIOUS_HISTOGRAM]; + context->uavBindings[FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_SCD_TEMP] = context->resources[FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_SCD_TEMP]; + context->uavBindings[FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_SCD_OUTPUT] = context->uavBindings[FFX_OF_BINDING_IDENTIFIER_SHARED_OPTICAL_FLOW_SCD_OUTPUT]; + + const bool isOddFrame = !!(context->resourceFrameIndex & 1); + + uint32_t opticalFlowInputResourceIndex = isOddFrame ? FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_2 : FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_1; + uint32_t opticalFlowPreviousInputResourceIndex = isOddFrame ? FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_1 : FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_2; + + uint32_t opticalFlowResourceIndex = isOddFrame ? FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_2 : FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_1; + uint32_t opticalFlowPreviousResourceIndex = isOddFrame ? FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_1 : FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_2; + + context->uavBindings[FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_INPUT] = context->resources[opticalFlowInputResourceIndex]; + context->uavBindings[FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_INPUT_LEVEL_1] = context->resources[opticalFlowInputResourceIndex + 1]; + context->uavBindings[FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_INPUT_LEVEL_2] = context->resources[opticalFlowInputResourceIndex + 2]; + context->uavBindings[FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_INPUT_LEVEL_3] = context->resources[opticalFlowInputResourceIndex + 3]; + context->uavBindings[FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_INPUT_LEVEL_4] = context->resources[opticalFlowInputResourceIndex + 4]; + context->uavBindings[FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_INPUT_LEVEL_5] = context->resources[opticalFlowInputResourceIndex + 5]; + context->uavBindings[FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_INPUT_LEVEL_6] = context->resources[opticalFlowInputResourceIndex + 6]; + + context->srvBindings[FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_INPUT] = context->resources[opticalFlowInputResourceIndex]; + context->srvBindings[FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_PREVIOUS_INPUT] = context->resources[opticalFlowPreviousInputResourceIndex]; + + context->srvBindings[FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW] = context->resources[opticalFlowResourceIndex]; + context->uavBindings[FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW] = context->resources[opticalFlowResourceIndex]; + context->srvBindings[FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_PREVIOUS] = context->resources[opticalFlowPreviousResourceIndex]; + + { + int32_t threadGroupSizeX = 16; + int32_t threadGroupSizeY = 16; + uint32_t threadPixelsX = 2; + uint32_t threadPixelsY = 2; + int32_t dispatchX = ((context->contextDescription.resolution.width + (threadPixelsX - 1)) / threadPixelsX + (threadGroupSizeX - 1)) / threadGroupSizeX; + int32_t dispatchY = ((context->contextDescription.resolution.height + (threadPixelsY - 1)) / threadPixelsY + (threadGroupSizeY - 1)) / threadGroupSizeY; + scheduleDispatch(context, &context->pipelinePrepareLuma, L"OF PrepareLuma", dispatchX, dispatchY); + } + + { + { + scheduleDispatch(context, + &context->pipelineGenerateOpticalFlowInputPyramid, + L"OF GenerateOpticalFlowInputPyramid", + threadGroupSizeOpticalFlowInputPyramid[0], + threadGroupSizeOpticalFlowInputPyramid[1] + ); + } + + { + { + const uint32_t threadGroupSizeX = 32; + const uint32_t threadGroupSizeY = 8; + const uint32_t strataWidth = (context->contextDescription.resolution.width / 4) / HistogramsPerDim; + const uint32_t strataHeight = context->contextDescription.resolution.height / HistogramsPerDim; + const uint32_t dispatchX = (strataWidth + threadGroupSizeX - 1) / threadGroupSizeX; + const uint32_t dispatchY = 16; + const uint32_t dispatchZ = HistogramsPerDim * HistogramsPerDim; + scheduleDispatch(context, &context->pipelineGenerateSCDHistogram, L"OF GenerateSCDHistogram", dispatchX, dispatchY, dispatchZ); + } + { + const uint32_t dispatchX = HistogramsPerDim * HistogramsPerDim; + const uint32_t dispatchY = HistogramShifts; + scheduleDispatch(context, &context->pipelineComputeSCDDivergence, L"OF ComputeSCDDivergence", dispatchX, dispatchY); + } + } + + FfxDimensions2D opticalFlowTextureSizes[OpticalFlowMaxPyramidLevels]; + const int pyramidMaxIterations = advancedAlgorithmIterations; + FFX_ASSERT(pyramidMaxIterations <= OpticalFlowMaxPyramidLevels); + + opticalFlowTextureSizes[0] = GetOpticalFlowTextureSize(context->contextDescription.resolution, opticalFlowBlockSize); + for (int i = 1; i < pyramidMaxIterations; i++) + { + opticalFlowTextureSizes[i] = { + (opticalFlowTextureSizes[i - 1].width + 1) / 2, + (opticalFlowTextureSizes[i - 1].height + 1) / 2 + }; + } + + for (int level = pyramidMaxIterations - 1; level >= 0; level--) + { + bool isOddLevel = !!(level & 1); + + uint32_t opticalFlowInputResourceIndexA = isOddFrame ? FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_2 : FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_1; + uint32_t opticalFlowInputResourceIndexB = isOddFrame ? FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_1 : FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_2; + uint32_t opticalFlowResourceIndexA = (isOddFrame != isOddLevel) ? FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_2 : FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_1; + uint32_t opticalFlowResourceIndexB = (isOddFrame != isOddLevel) ? FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_1 : FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_2; + context->constants.opticalFlowPyramidLevel = level; + context->constants.opticalFlowPyramidLevelCount = pyramidMaxIterations; + + context->contextDescription.backendInterface.fpStageConstantBufferDataFunc(&context->contextDescription.backendInterface, &context->constants, sizeof(context->constants), &context->constantBuffers[FFX_OPTICALFLOW_CONSTANTBUFFER_IDENTIFIER]); + + context->srvBindings[FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_INPUT] = context->resources[opticalFlowInputResourceIndexA + level]; + context->srvBindings[FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_PREVIOUS_INPUT] = context->resources[opticalFlowInputResourceIndexB + level]; + context->uavBindings[FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW] = context->resources[opticalFlowResourceIndexA + level]; + + context->srvBindings[FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_PREVIOUS] = context->resources[opticalFlowResourceIndexB + level]; + + { + const FfxUInt32 inputLumaWidth = ffxMax(context->contextDescription.resolution.width >> level, 1); + const FfxUInt32 inputLumaHeight = ffxMax(context->contextDescription.resolution.height >> level, 1); + std::wstring pipelineName = L"OF " + std::to_wstring(level) + L" Search"; + + { + uint32_t threadPixels = 4; + FFX_ASSERT(opticalFlowBlockSize >= threadPixels); + uint32_t threadGroupSizeY = 16; + uint32_t threadGroupSize = 64; + uint32_t dispatchX = ((inputLumaWidth + threadPixels - 1) / threadPixels * threadGroupSizeY + (threadGroupSize - 1)) / threadGroupSize; + uint32_t dispatchY = (inputLumaHeight + (threadGroupSizeY - 1)) / threadGroupSizeY; + scheduleDispatch(context, &context->pipelineComputeOpticalFlowAdvancedV5, pipelineName.c_str(), dispatchX, dispatchY); + } + } + + { + context->srvBindings[FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_PREVIOUS] = context->resources[opticalFlowResourceIndexA + level]; + context->uavBindings[FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW] = context->resources[opticalFlowResourceIndexB + level]; + } + + { + if (level == 0) + { + context->uavBindings[FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW] = context->uavBindings[FFX_OF_BINDING_IDENTIFIER_SHARED_OPTICAL_FLOW_VECTOR]; + } + + const uint32_t levelWidth = opticalFlowTextureSizes[level].width; + const uint32_t levelHeight = opticalFlowTextureSizes[level].height; + + const uint32_t threadGroupSizeX = 16; + const uint32_t threadGroupSizeY = 4; + const uint32_t dispatchX = (levelWidth + threadGroupSizeX - 1) / threadGroupSizeX; + const uint32_t dispatchY = (levelHeight + threadGroupSizeY - 1) / threadGroupSizeY; + std::wstring pipelineName = L"OF " + std::to_wstring(level) + L" Filter"; + + { + scheduleDispatch(context, &context->pipelineFilterOpticalFlowV5, pipelineName.c_str(), dispatchX, dispatchY); + } + } + + if (level > 0) + { + context->srvBindings[FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_ALIAS_LEVEL_1 + level - 1] = context->uavBindings[FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW]; + } + + if (level > 0) + { + { + context->srvBindings[FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW] = context->resources[opticalFlowResourceIndexB + level]; + context->uavBindings[FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_NEXT_LEVEL] = level > 0 ? context->resources[opticalFlowResourceIndexB + level - 1] : FfxResourceInternal{ FFX_OF_RESOURCE_IDENTIFIER_NULL }; + } + + FFX_ASSERT(opticalFlowBlockSize >= 2); + const uint32_t nextLevelWidth = opticalFlowTextureSizes[level - 1].width; + const uint32_t nextLevelHeight = opticalFlowTextureSizes[level - 1].height; + + const uint32_t threadGroupSizeX = opticalFlowBlockSize / 2; + const uint32_t threadGroupSizeY = opticalFlowBlockSize / 2; + const uint32_t threadGroupSizeZ = 4; + const uint32_t dispatchX = (nextLevelWidth + threadGroupSizeX - 1) / threadGroupSizeX; + const uint32_t dispatchY = (nextLevelHeight + threadGroupSizeY - 1) / threadGroupSizeY; + const uint32_t dispatchZ = 1; + std::wstring pipelineName = L"OF " + std::to_wstring(level) + L" Scale"; + + { + const uint32_t dispatchX = (nextLevelWidth + 3) / 4; + const uint32_t dispatchY = (nextLevelHeight + 3) / 4; + scheduleDispatch(context, &context->pipelineScaleOpticalFlowAdvancedV5, pipelineName.c_str(), dispatchX, dispatchY, dispatchZ); + } + + { + FfxGpuJobDescription barrierJob = {FFX_GPU_JOB_BARRIER}; + barrierJob.barrierDescriptor = { context->srvBindings[FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW], FFX_BARRIER_TYPE_TRANSITION, FFX_RESOURCE_STATE_COMPUTE_READ, FFX_RESOURCE_STATE_UNORDERED_ACCESS, 0}; + context->contextDescription.backendInterface.fpScheduleGpuJob(&context->contextDescription.backendInterface, &barrierJob); + } + } + + { + FfxGpuJobDescription barrierJob = {FFX_GPU_JOB_BARRIER}; + barrierJob.barrierDescriptor = { context->srvBindings[FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_PREVIOUS], FFX_BARRIER_TYPE_TRANSITION, FFX_RESOURCE_STATE_COMPUTE_READ, FFX_RESOURCE_STATE_UNORDERED_ACCESS, 0}; + context->contextDescription.backendInterface.fpScheduleGpuJob(&context->contextDescription.backendInterface, &barrierJob); + } + } + } + } + + { + FfxGpuJobDescription barrierJob = {FFX_GPU_JOB_BARRIER}; + + wcscpy_s(barrierJob.jobLabel, L"Transition Optical Flow Input 1"); + barrierJob.barrierDescriptor = { context->resources[FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_1], FFX_BARRIER_TYPE_TRANSITION, FFX_RESOURCE_STATE_COMPUTE_READ, FFX_RESOURCE_STATE_UNORDERED_ACCESS, 0}; + context->contextDescription.backendInterface.fpScheduleGpuJob(&context->contextDescription.backendInterface, &barrierJob); + wcscpy_s(barrierJob.jobLabel, L"Transition Optical Flow Input 1 Level 1"); + barrierJob.barrierDescriptor = { context->resources[FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_1_LEVEL_1], FFX_BARRIER_TYPE_TRANSITION, FFX_RESOURCE_STATE_COMPUTE_READ, FFX_RESOURCE_STATE_UNORDERED_ACCESS, 0}; + context->contextDescription.backendInterface.fpScheduleGpuJob(&context->contextDescription.backendInterface, &barrierJob); + wcscpy_s(barrierJob.jobLabel, L"Transition Optical Flow Input 1 Level 2"); + barrierJob.barrierDescriptor = { context->resources[FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_1_LEVEL_2], FFX_BARRIER_TYPE_TRANSITION, FFX_RESOURCE_STATE_COMPUTE_READ, FFX_RESOURCE_STATE_UNORDERED_ACCESS, 0}; + context->contextDescription.backendInterface.fpScheduleGpuJob(&context->contextDescription.backendInterface, &barrierJob); + wcscpy_s(barrierJob.jobLabel, L"Transition Optical Flow Input 1 Level 3"); + barrierJob.barrierDescriptor = { context->resources[FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_1_LEVEL_3], FFX_BARRIER_TYPE_TRANSITION, FFX_RESOURCE_STATE_COMPUTE_READ, FFX_RESOURCE_STATE_UNORDERED_ACCESS, 0}; + context->contextDescription.backendInterface.fpScheduleGpuJob(&context->contextDescription.backendInterface, &barrierJob); + wcscpy_s(barrierJob.jobLabel, L"Transition Optical Flow Input 1 Level 4"); + barrierJob.barrierDescriptor = { context->resources[FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_1_LEVEL_4], FFX_BARRIER_TYPE_TRANSITION, FFX_RESOURCE_STATE_COMPUTE_READ, FFX_RESOURCE_STATE_UNORDERED_ACCESS, 0}; + context->contextDescription.backendInterface.fpScheduleGpuJob(&context->contextDescription.backendInterface, &barrierJob); + wcscpy_s(barrierJob.jobLabel, L"Transition Optical Flow Input 1 Level 5"); + barrierJob.barrierDescriptor = { context->resources[FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_1_LEVEL_5], FFX_BARRIER_TYPE_TRANSITION, FFX_RESOURCE_STATE_COMPUTE_READ, FFX_RESOURCE_STATE_UNORDERED_ACCESS, 0}; + context->contextDescription.backendInterface.fpScheduleGpuJob(&context->contextDescription.backendInterface, &barrierJob); + wcscpy_s(barrierJob.jobLabel, L"Transition Optical Flow Input 1 Level 6"); + barrierJob.barrierDescriptor = { context->resources[FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_1_LEVEL_6], FFX_BARRIER_TYPE_TRANSITION, FFX_RESOURCE_STATE_COMPUTE_READ, FFX_RESOURCE_STATE_UNORDERED_ACCESS, 0}; + context->contextDescription.backendInterface.fpScheduleGpuJob(&context->contextDescription.backendInterface, &barrierJob); + wcscpy_s(barrierJob.jobLabel, L"Transition Optical Flow Input 2"); + barrierJob.barrierDescriptor = { context->resources[FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_2], FFX_BARRIER_TYPE_TRANSITION, FFX_RESOURCE_STATE_COMPUTE_READ, FFX_RESOURCE_STATE_UNORDERED_ACCESS, 0}; + context->contextDescription.backendInterface.fpScheduleGpuJob(&context->contextDescription.backendInterface, &barrierJob); + wcscpy_s(barrierJob.jobLabel, L"Transition Optical Flow Input 2 Level 1"); + barrierJob.barrierDescriptor = { context->resources[FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_2_LEVEL_1], FFX_BARRIER_TYPE_TRANSITION, FFX_RESOURCE_STATE_COMPUTE_READ, FFX_RESOURCE_STATE_UNORDERED_ACCESS, 0}; + context->contextDescription.backendInterface.fpScheduleGpuJob(&context->contextDescription.backendInterface, &barrierJob); + wcscpy_s(barrierJob.jobLabel, L"Transition Optical Flow Input 2 Level 2"); + barrierJob.barrierDescriptor = { context->resources[FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_2_LEVEL_2], FFX_BARRIER_TYPE_TRANSITION, FFX_RESOURCE_STATE_COMPUTE_READ, FFX_RESOURCE_STATE_UNORDERED_ACCESS, 0}; + context->contextDescription.backendInterface.fpScheduleGpuJob(&context->contextDescription.backendInterface, &barrierJob); + wcscpy_s(barrierJob.jobLabel, L"Transition Optical Flow Input 2 Level 3"); + barrierJob.barrierDescriptor = { context->resources[FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_2_LEVEL_3], FFX_BARRIER_TYPE_TRANSITION, FFX_RESOURCE_STATE_COMPUTE_READ, FFX_RESOURCE_STATE_UNORDERED_ACCESS, 0}; + context->contextDescription.backendInterface.fpScheduleGpuJob(&context->contextDescription.backendInterface, &barrierJob); + wcscpy_s(barrierJob.jobLabel, L"Transition Optical Flow Input 2 Level 4"); + barrierJob.barrierDescriptor = { context->resources[FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_2_LEVEL_4], FFX_BARRIER_TYPE_TRANSITION, FFX_RESOURCE_STATE_COMPUTE_READ, FFX_RESOURCE_STATE_UNORDERED_ACCESS, 0}; + context->contextDescription.backendInterface.fpScheduleGpuJob(&context->contextDescription.backendInterface, &barrierJob); + wcscpy_s(barrierJob.jobLabel, L"Transition Optical Flow Input 2 Level 5"); + barrierJob.barrierDescriptor = { context->resources[FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_2_LEVEL_5], FFX_BARRIER_TYPE_TRANSITION, FFX_RESOURCE_STATE_COMPUTE_READ, FFX_RESOURCE_STATE_UNORDERED_ACCESS, 0}; + context->contextDescription.backendInterface.fpScheduleGpuJob(&context->contextDescription.backendInterface, &barrierJob); + wcscpy_s(barrierJob.jobLabel, L"Transition Optical Flow Input 2 Level 6"); + barrierJob.barrierDescriptor = { context->resources[FFX_OF_RESOURCE_IDENTIFIER_OPTICAL_FLOW_INPUT_2_LEVEL_6], FFX_BARRIER_TYPE_TRANSITION, FFX_RESOURCE_STATE_COMPUTE_READ, FFX_RESOURCE_STATE_UNORDERED_ACCESS, 0}; + context->contextDescription.backendInterface.fpScheduleGpuJob(&context->contextDescription.backendInterface, &barrierJob); + } + + context->resourceFrameIndex = (context->resourceFrameIndex + 1) % FFX_OPTICALFLOW_MAX_QUEUED_FRAMES; + + FFX_VALIDATE(context->contextDescription.backendInterface.fpExecuteGpuJobs(&context->contextDescription.backendInterface, commandList, context->effectContextId)); + + context->contextDescription.backendInterface.fpUnregisterResources(&context->contextDescription.backendInterface, commandList, context->effectContextId); + + return FFX_OK; +} + +FfxErrorCode ffxOpticalflowContextCreate(FfxOpticalflowContext* context, FfxOpticalflowContextDescription* contextDescription) +{ + FFX_RETURN_ON_ERROR(context, FFX_ERROR_INVALID_POINTER); + FFX_RETURN_ON_ERROR(contextDescription, FFX_ERROR_INVALID_POINTER); + + FFX_RETURN_ON_ERROR(contextDescription->backendInterface.fpGetSDKVersion, FFX_ERROR_INCOMPLETE_INTERFACE); + FFX_RETURN_ON_ERROR(contextDescription->backendInterface.fpGetDeviceCapabilities, FFX_ERROR_INCOMPLETE_INTERFACE); + FFX_RETURN_ON_ERROR(contextDescription->backendInterface.fpCreateBackendContext, FFX_ERROR_INCOMPLETE_INTERFACE); + FFX_RETURN_ON_ERROR(contextDescription->backendInterface.fpDestroyBackendContext, FFX_ERROR_INCOMPLETE_INTERFACE); + + if (contextDescription->backendInterface.scratchBuffer) { + + FFX_RETURN_ON_ERROR(contextDescription->backendInterface.scratchBufferSize, FFX_ERROR_INCOMPLETE_INTERFACE); + } + + FFX_STATIC_ASSERT(sizeof(FfxOpticalflowContext) >= sizeof(FfxOpticalflowContext_Private)); + + FfxOpticalflowContext_Private* contextPrivate = (FfxOpticalflowContext_Private*)(context); + FfxErrorCode errorCode = opticalflowCreate(contextPrivate, contextDescription); + + return errorCode; +} + +FFX_API FfxErrorCode ffxOpticalflowContextGetGpuMemoryUsage(FfxOpticalflowContext* context, FfxEffectMemoryUsage* vramUsage) +{ + FFX_RETURN_ON_ERROR(context, FFX_ERROR_INVALID_POINTER); + FFX_RETURN_ON_ERROR(vramUsage, FFX_ERROR_INVALID_POINTER); + FfxOpticalflowContext_Private* contextPrivate = (FfxOpticalflowContext_Private*)(context); + + FFX_RETURN_ON_ERROR(contextPrivate->device, FFX_ERROR_NULL_DEVICE); + + FfxErrorCode errorCode = contextPrivate->contextDescription.backendInterface.fpGetEffectGpuMemoryUsage( + &contextPrivate->contextDescription.backendInterface, contextPrivate->effectContextId, vramUsage); + FFX_RETURN_ON_ERROR(errorCode == FFX_OK, errorCode); + + return FFX_OK; +} + +FfxErrorCode ffxOpticalflowContextDestroy(FfxOpticalflowContext* context) +{ + FFX_RETURN_ON_ERROR(context, FFX_ERROR_INVALID_POINTER); + + FfxOpticalflowContext_Private* contextPrivate = (FfxOpticalflowContext_Private*)(context); + const FfxErrorCode errorCode = opticalflowRelease(contextPrivate); + + return errorCode; +} + +FFX_API bool ffxOpticalflowResourceIsNull(FfxResource resource) +{ + return resource.resource == NULL; +} + +FFX_API FfxErrorCode ffxOpticalflowGetSharedResourceDescriptions(FfxOpticalflowContext* context, FfxOpticalflowSharedResourceDescriptions* SharedResources) +{ + FFX_RETURN_ON_ERROR(context, FFX_ERROR_INVALID_POINTER); + FFX_RETURN_ON_ERROR(SharedResources, FFX_ERROR_INVALID_POINTER); + + FfxOpticalflowContext_Private* contextPrivate = (FfxOpticalflowContext_Private*)(context); + const FfxDimensions2D opticalFlowTextureSize = GetOpticalFlowTextureSize(contextPrivate->contextDescription.resolution, 8); + const FfxDimensions2D globalMotionSearchMaxDispatchSize = GetGlobalMotionSearchDispatchSize(0); + const uint32_t globalMotionSearchTextureWidth = 4 /* predefined slots */ + (globalMotionSearchMaxDispatchSize.width * globalMotionSearchMaxDispatchSize.height); + + SharedResources->opticalFlowVector = { + FFX_HEAP_TYPE_DEFAULT, + { FFX_RESOURCE_TYPE_TEXTURE2D, FFX_SURFACE_FORMAT_R16G16_SINT, opticalFlowTextureSize.width, opticalFlowTextureSize.height, 1, 1, FFX_RESOURCE_FLAGS_NONE, FFX_RESOURCE_USAGE_UAV }, + FFX_RESOURCE_STATE_UNORDERED_ACCESS, L"OPTICALFLOW_Result", 0, {FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED} }; + + SharedResources->opticalFlowSCD = { + FFX_HEAP_TYPE_DEFAULT, + { FFX_RESOURCE_TYPE_TEXTURE2D, FFX_SURFACE_FORMAT_R32_UINT, 3, 1, 1, 1, FFX_RESOURCE_FLAGS_NONE, FFX_RESOURCE_USAGE_UAV }, + FFX_RESOURCE_STATE_UNORDERED_ACCESS, L"OPTICALFLOW_SCDOutput", 0, {FFX_RESOURCE_INIT_DATA_TYPE_UNINITIALIZED} }; + + return FFX_OK; +} + +FfxErrorCode ffxOpticalflowContextDispatch(FfxOpticalflowContext* context, const FfxOpticalflowDispatchDescription* dispatchParams) +{ + FFX_RETURN_ON_ERROR(context, FFX_ERROR_INVALID_POINTER); + FFX_RETURN_ON_ERROR(dispatchParams, FFX_ERROR_INVALID_POINTER); + FFX_RETURN_ON_ERROR(dispatchParams->commandList, FFX_ERROR_INVALID_POINTER); + FFX_RETURN_ON_ERROR(!ffxOpticalflowResourceIsNull(dispatchParams->color), FFX_ERROR_INVALID_POINTER); + FFX_RETURN_ON_ERROR(dispatchParams->color.description.type == FFX_RESOURCE_TYPE_TEXTURE2D, FFX_ERROR_INVALID_ARGUMENT); + FFX_RETURN_ON_ERROR(!ffxOpticalflowResourceIsNull(dispatchParams->opticalFlowVector), FFX_ERROR_INVALID_POINTER); + FFX_RETURN_ON_ERROR(!ffxOpticalflowResourceIsNull(dispatchParams->opticalFlowSCD), FFX_ERROR_INVALID_POINTER); + + FfxOpticalflowContext_Private* contextPrivate = (FfxOpticalflowContext_Private*)(context); + + FFX_RETURN_ON_ERROR(contextPrivate->device, FFX_ERROR_NULL_DEVICE); + FFX_RETURN_ON_ERROR(dispatchParams->color.description.width <= contextPrivate->contextDescription.resolution.width, FFX_ERROR_INVALID_ARGUMENT); + FFX_RETURN_ON_ERROR(dispatchParams->color.description.height <= contextPrivate->contextDescription.resolution.height, FFX_ERROR_INVALID_ARGUMENT); + + const FfxErrorCode errorCode = dispatch(contextPrivate, dispatchParams); + return errorCode; +} + +FFX_API FfxVersionNumber ffxOpticalflowGetEffectVersion() +{ + return FFX_SDK_MAKE_VERSION(FFX_OPTICALFLOW_VERSION_MAJOR, FFX_OPTICALFLOW_VERSION_MINOR, FFX_OPTICALFLOW_VERSION_PATCH); +} diff --git a/runtime/third_party/FidelityFX/sdk/src/components/opticalflow/ffx_opticalflow_private.h b/runtime/third_party/FidelityFX/sdk/src/components/opticalflow/ffx_opticalflow_private.h new file mode 100644 index 00000000..bfea4c4f --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/src/components/opticalflow/ffx_opticalflow_private.h @@ -0,0 +1,108 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#pragma once + +#define FFX_CPU +#include + +typedef enum OpticalFlowBindingIdentifiers +{ + FFX_OF_BINDING_IDENTIFIER_NULL = 0, + FFX_OF_BINDING_IDENTIFIER_INPUT_COLOR, + + FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_INPUT, + FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_INPUT_LEVEL_1, + FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_INPUT_LEVEL_2, + FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_INPUT_LEVEL_3, + FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_INPUT_LEVEL_4, + FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_INPUT_LEVEL_5, + FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_INPUT_LEVEL_6, + + FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_PREVIOUS_INPUT, + + FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_SCD_HISTOGRAM, + FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_SCD_PREVIOUS_HISTOGRAM, + FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_SCD_TEMP, + FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_SCD_OUTPUT, + + FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW, + FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_NEXT_LEVEL, + FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_PREVIOUS, + + FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_ALIAS_LEVEL_1, + FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_ALIAS_LEVEL_2, + FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_ALIAS_LEVEL_3, + FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_ALIAS_LEVEL_4, + FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_ALIAS_LEVEL_5, + FFX_OF_BINDING_IDENTIFIER_OPTICAL_FLOW_ALIAS_LEVEL_6, + + FFX_OF_BINDING_IDENTIFIER_SHARED_OPTICAL_FLOW_VECTOR, + FFX_OF_BINDING_IDENTIFIER_SHARED_OPTICAL_FLOW_SCD_OUTPUT, + + FFX_OF_BINDING_IDENTIFIER_COUNT +} OpticalFlowBindingIdentifiers; + +typedef enum OpticalflowShaderPermutationOptions +{ + OPTICALFLOW_SHADER_PERMUTATION_FORCE_WAVE64 = (1 << 0), ///< doesn't map to a define, selects different table + OPTICALFLOW_SHADER_PERMUTATION_ALLOW_FP16 = (1 << 1), ///< Enables fast math computations where possible + OPTICALFLOW_HDR_COLOR_INPUT = (1 << 2), +} OpticalflowShaderPermutationOptions; + +typedef struct OpticalflowConstants +{ + int32_t inputLumaResolution[2]; + uint32_t opticalFlowPyramidLevel; + uint32_t opticalFlowPyramidLevelCount; + + int32_t frameIndex; + uint32_t backbufferTransferFunction; + float minMaxLuminance[2]; +} OpticalflowConstants; + +typedef struct FfxOpticalflowContext_Private +{ + FfxOpticalflowContextDescription contextDescription; + FfxUInt32 effectContextId; + OpticalflowConstants constants; + FfxDevice device; + FfxDeviceCapabilities deviceCapabilities; + + FfxPipelineState pipelinePrepareLuma; + FfxPipelineState pipelineGenerateOpticalFlowInputPyramid; + FfxPipelineState pipelineGenerateSCDHistogram; + FfxPipelineState pipelineComputeSCDDivergence; + FfxPipelineState pipelineComputeOpticalFlowAdvancedV5; + FfxPipelineState pipelineFilterOpticalFlowV5; + FfxPipelineState pipelineScaleOpticalFlowAdvancedV5; + + FfxResourceInternal resources[FFX_OF_RESOURCE_IDENTIFIER_COUNT]; + FfxResourceInternal srvBindings[FFX_OF_BINDING_IDENTIFIER_COUNT]; + FfxResourceInternal uavBindings[FFX_OF_BINDING_IDENTIFIER_COUNT]; + + FfxConstantBuffer constantBuffers[FFX_OPTICALFLOW_CONSTANTBUFFER_COUNT]; + + bool firstExecution; + bool refreshPipelineStates; + uint32_t resourceFrameIndex; +} FfxOpticalflowContext_Private; diff --git a/runtime/third_party/FidelityFX/sdk/src/shared/ffx_assert.cpp b/runtime/third_party/FidelityFX/sdk/src/shared/ffx_assert.cpp new file mode 100644 index 00000000..ab24ef1a --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/src/shared/ffx_assert.cpp @@ -0,0 +1,82 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#include +#include // for malloc() + +#ifdef _WIN32 +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include // required for OutputDebugString() +#include // required for sprintf_s +#endif // #ifndef _WIN32 + +static FfxAssertCallback s_assertCallback; + +// set the printing callback function +void ffxAssertSetPrintingCallback(FfxAssertCallback callback) +{ + s_assertCallback = callback; + return; +} + +// implementation of assert reporting +bool ffxAssertReport(const char* file, int32_t line, const char* condition, const char* message) +{ + if (!file) { + + return true; + } + +#ifdef _WIN32 + // form the final assertion string and output to the TTY. + const size_t bufferSize = snprintf(NULL, 0, "%s(%d): ASSERTION FAILED. %s\n", file, line, message ? message : condition) + 1; + char* tempBuf = (char*)malloc(bufferSize); + if (!tempBuf) { + + return true; + } + + if (!message) { + sprintf_s(tempBuf, bufferSize, "%s(%d): ASSERTION FAILED. %s\n", file, line, condition); + } else { + sprintf_s(tempBuf, bufferSize, "%s(%d): ASSERTION FAILED. %s\n", file, line, message); + } + + if (!s_assertCallback) { + OutputDebugStringA(tempBuf); + } else { + s_assertCallback(tempBuf); + } + + // free the buffer. + free(tempBuf); + +#else + FFX_UNUSED(line); + FFX_UNUSED(condition); + FFX_UNUSED(message); +#endif + + return true; +} diff --git a/runtime/third_party/FidelityFX/sdk/src/shared/ffx_breadcrumbs_list.cpp b/runtime/third_party/FidelityFX/sdk/src/shared/ffx_breadcrumbs_list.cpp new file mode 100644 index 00000000..c1491bf0 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/src/shared/ffx_breadcrumbs_list.cpp @@ -0,0 +1,49 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#include "ffx_breadcrumbs_list.h" + +void* ffxBreadcrumbsAppendList(void* src, size_t currentCount, size_t elementSize, size_t appendCount, FfxAllocationCallbacks* callbacks) +{ + FFX_ASSERT(src ? currentCount > 0 : currentCount == 0); + + void* dst = callbacks->fpRealloc(src, elementSize * (currentCount + appendCount)); + FFX_ASSERT(dst); + + return dst; +} + +void* ffxBreadcrumbsPopList(void* src, size_t newCount, size_t elementSize, FfxAllocationCallbacks* callbacks) +{ + FFX_ASSERT(src); + + void* dst = nullptr; + if (newCount > 0) + { + dst = callbacks->fpRealloc(src, elementSize * newCount); + FFX_ASSERT(dst); + } + else + callbacks->fpFree(src); + + return dst; +} diff --git a/runtime/third_party/FidelityFX/sdk/src/shared/ffx_breadcrumbs_list.h b/runtime/third_party/FidelityFX/sdk/src/shared/ffx_breadcrumbs_list.h new file mode 100644 index 00000000..facc77ef --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/src/shared/ffx_breadcrumbs_list.h @@ -0,0 +1,150 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#pragma once + +#include +#include // sprintf_s +#include + +#define FFX_BREADCRUMBS_APPEND_STRING(buff, count, str) \ + do \ + { \ + buff = (char*)ffxBreadcrumbsAppendList(buff, count, 1, sizeof(str) - 1, allocs); \ + memcpy(buff + count, str, sizeof(str) - 1); \ + count += sizeof(str) - 1; \ + } while (false) + +#define FFX_BREADCRUMBS_APPEND_STRING_DYNAMIC(buff, count, src) \ + do \ + { \ + const char* _str = src; \ + const size_t _length = strlen(_str); \ + buff = (char*)ffxBreadcrumbsAppendList(buff, count, 1, _length, allocs); \ + memcpy(buff + count, _str, _length); \ + count += _length; \ + } while (false) + +#define FFX_BREADCRUMBS_APPEND_NUMBER(buff, count, number, maxLength, format) \ + do \ + { \ + char _numberStr[maxLength]; \ + const size_t _length = sprintf_s(_numberStr, maxLength, format, number); \ + buff = (char*)ffxBreadcrumbsAppendList(buff, count, 1, _length, allocs); \ + memcpy(buff + count, _numberStr, _length); \ + count += _length; \ + } while (false) + +#define FFX_BREADCRUMBS_APPEND_UINT(buff, count, number) \ + FFX_BREADCRUMBS_APPEND_NUMBER(buff, count, number, 11, "%u") + +#define FFX_BREADCRUMBS_APPEND_UINT64(buff, count, number) \ + FFX_BREADCRUMBS_APPEND_NUMBER(buff, count, number, 21, "%zu") + +#define FFX_BREADCRUMBS_APPEND_FLOAT(buff, count, number) \ + FFX_BREADCRUMBS_APPEND_NUMBER(buff, count, number, 18, "%.3f") + +#define FFX_BREADCRUMBS_PRINTING_INDENT " " + +#define FFX_BREADCRUMBS_PRINT_STRING(buff, count, baseStruct, member) \ + do \ + { \ + FFX_BREADCRUMBS_APPEND_STRING(buff, count, FFX_BREADCRUMBS_PRINTING_INDENT #member ": "); \ + FFX_BREADCRUMBS_APPEND_STRING_DYNAMIC(buff, count, baseStruct.member); \ + FFX_BREADCRUMBS_APPEND_STRING(buff, count, "\n"); \ + } while (false) + +#define FFX_BREADCRUMBS_PRINT_UINT(buff, count, baseStruct, member) \ + do \ + { \ + FFX_BREADCRUMBS_APPEND_STRING(buff, count, FFX_BREADCRUMBS_PRINTING_INDENT #member ": "); \ + FFX_BREADCRUMBS_APPEND_UINT(buff, count, baseStruct.member); \ + FFX_BREADCRUMBS_APPEND_STRING(buff, count, "\n"); \ + } while (false) + +#define FFX_BREADCRUMBS_PRINT_UINT64(buff, count, baseStruct, member) \ + do \ + { \ + FFX_BREADCRUMBS_APPEND_STRING(buff, count, FFX_BREADCRUMBS_PRINTING_INDENT #member ": "); \ + FFX_BREADCRUMBS_APPEND_UINT64(buff, count, baseStruct.member); \ + FFX_BREADCRUMBS_APPEND_STRING(buff, count, "\n"); \ + } while (false) + +#define FFX_BREADCRUMBS_PRINT_FLOAT(buff, count, baseStruct, member) \ + do \ + { \ + FFX_BREADCRUMBS_APPEND_STRING(buff, count, FFX_BREADCRUMBS_PRINTING_INDENT #member ": "); \ + FFX_BREADCRUMBS_APPEND_FLOAT(buff, count, baseStruct.member); \ + FFX_BREADCRUMBS_APPEND_STRING(buff, count, "\n"); \ + } while (false) + +#define FFX_BREADCRUMBS_PRINT_BOOL(buff, count, baseStruct, member) \ + do \ + { \ + FFX_BREADCRUMBS_APPEND_STRING(buff, count, FFX_BREADCRUMBS_PRINTING_INDENT #member ": "); \ + if (baseStruct.member) \ + { \ + FFX_BREADCRUMBS_APPEND_STRING(buff, count, "True\n"); \ + } \ + else \ + { \ + FFX_BREADCRUMBS_APPEND_STRING(buff, count, "False\n"); \ + } \ + } while (false) + +#define FFX_BREADCRUMBS_PRINT_HEX_NUMBER(buff, count, baseStruct, member, maxLength, format) \ + do \ + { \ + FFX_BREADCRUMBS_APPEND_STRING(buff, count, FFX_BREADCRUMBS_PRINTING_INDENT #member ": 0x"); \ + char _hexStr[maxLength]; \ + const size_t _length = sprintf_s(_hexStr, maxLength, format, baseStruct.member); \ + buff = (char*)ffxBreadcrumbsAppendList(buff, count, 1, _length + 1, allocs); \ + memcpy(buff + count, _hexStr, _length); \ + count += _length; \ + buff[count++] = '\n'; \ + } while (false) + +#define FFX_BREADCRUMBS_PRINT_HEX32(buff, count, baseStruct, member) \ + FFX_BREADCRUMBS_PRINT_HEX_NUMBER(buff, count, baseStruct, member, 9, "%X") + +#define FFX_BREADCRUMBS_PRINT_HEX64(buff, count, baseStruct, member) \ + FFX_BREADCRUMBS_PRINT_HEX_NUMBER(buff, count, baseStruct, member, 17, "%zX") + +#define FFX_BREADCRUMBS_PRINT_HEX_BYTE(buff, count, val) \ + do \ + { \ + buff = (char*)ffxBreadcrumbsAppendList(buff, count, 1, 2, allocs); \ + buff[count++] = (char)((val >> 4) + ((val >> 4) >= 10 ? '7' : '0')); \ + buff[count++] = (char)((val & 0x0F) + ((val & 0x0F) >= 10 ? '7' : '0')); \ + } while (false) + +#if defined(__cplusplus) +extern "C" { +#endif // #if defined(__cplusplus) + + FFX_API void* ffxBreadcrumbsAppendList(void* src, size_t currentCount, size_t elementSize, size_t appendCount, FfxAllocationCallbacks* callbacks); + + FFX_API void* ffxBreadcrumbsPopList(void* src, size_t newCount, size_t elementSize, FfxAllocationCallbacks* callbacks); + +#if defined(__cplusplus) +} +#endif // #if defined(__cplusplus) diff --git a/runtime/third_party/FidelityFX/sdk/src/shared/ffx_message.cpp b/runtime/third_party/FidelityFX/sdk/src/shared/ffx_message.cpp new file mode 100644 index 00000000..7dd5127d --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/src/shared/ffx_message.cpp @@ -0,0 +1,64 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2025 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#include + +#ifdef _WIN32 +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include // required for OutputDebugString() +#endif // #ifdef _WIN32 + +static ffxMessageCallback s_messageCallback; +static uint32_t s_debugLevel; + +// set the printing callback function +void ffxSetPrintMessageCallback(ffxMessageCallback callback, uint32_t debugLevel) +{ + s_messageCallback = callback; + s_debugLevel = debugLevel; + return; +} + +void ffxPrintMessage(uint32_t type, const wchar_t* message) +{ +#ifdef _WIN32 + if (!s_messageCallback) { + // Format the message string + wchar_t buffer[512]; + if (type == FFX_MESSAGE_TYPE_ERROR) { + swprintf_s(buffer, 512, L"FSR_API_DEBUG_ERROR: %ls\n", message); + } + else if (type == FFX_MESSAGE_TYPE_WARNING) { + swprintf_s(buffer, 512, L"FSR_API_DEBUG_WARNING: %ls\n", message); + } + OutputDebugStringW(buffer); + } else { + s_messageCallback(type, message); + } +#else + FFX_UNUSED(type); + FFX_UNUSED(message); +#endif + return; +} \ No newline at end of file diff --git a/runtime/third_party/FidelityFX/sdk/src/shared/ffx_object_management.cpp b/runtime/third_party/FidelityFX/sdk/src/shared/ffx_object_management.cpp new file mode 100644 index 00000000..03fc3b7b --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/src/shared/ffx_object_management.cpp @@ -0,0 +1,48 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#include +#include "ffx_object_management.h" + +void ffxSafeReleasePipeline(FfxInterface* backendInterface, FfxPipelineState* pipeline, FfxUInt32 effectContextId) +{ + FFX_ASSERT(pipeline); + FFX_ASSERT(backendInterface->fpDestroyPipeline); + + backendInterface->fpDestroyPipeline(backendInterface, pipeline, effectContextId); +} + +void ffxSafeReleaseCopyResource(FfxInterface* backendInterface, FfxResourceInternal resource, FfxUInt32 effectContextId) +{ + FFX_ASSERT(backendInterface->fpDestroyResource); + + FfxResourceInternal copyResource; + copyResource.internalIndex = resource.internalIndex + 1; + backendInterface->fpDestroyResource(backendInterface, copyResource, effectContextId); +} + +void ffxSafeReleaseResource(FfxInterface* backendInterface, FfxResourceInternal resource, FfxUInt32 effectContextId) +{ + FFX_ASSERT(backendInterface->fpDestroyResource); + + backendInterface->fpDestroyResource(backendInterface, resource, effectContextId); +} diff --git a/runtime/third_party/FidelityFX/sdk/src/shared/ffx_object_management.h b/runtime/third_party/FidelityFX/sdk/src/shared/ffx_object_management.h new file mode 100644 index 00000000..7c4e0f27 --- /dev/null +++ b/runtime/third_party/FidelityFX/sdk/src/shared/ffx_object_management.h @@ -0,0 +1,38 @@ +// This file is part of the FidelityFX SDK. +// +// Copyright (C) 2024 Advanced Micro Devices, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files(the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions : +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#pragma once + +#include +#include + +#if defined(__cplusplus) +extern "C" { +#endif // #if defined(__cplusplus) + +FFX_API void ffxSafeReleasePipeline(FfxInterface* backendInterface, FfxPipelineState* pipeline, FfxUInt32 effectContextId); +FFX_API void ffxSafeReleaseCopyResource(FfxInterface* backendInterface, FfxResourceInternal resource, FfxUInt32 effectContextId); +FFX_API void ffxSafeReleaseResource(FfxInterface* backendInterface, FfxResourceInternal resource, FfxUInt32 effectContextId); + +#if defined(__cplusplus) +} +#endif // #if defined(__cplusplus) diff --git a/runtime/third_party/FidelityFX/spirv/ffx_shaders_vk.h b/runtime/third_party/FidelityFX/spirv/ffx_shaders_vk.h new file mode 100644 index 00000000..edbf8380 --- /dev/null +++ b/runtime/third_party/FidelityFX/spirv/ffx_shaders_vk.h @@ -0,0 +1,8979 @@ +// Generated by tools/ffx_shaders.py from the AMD FidelityFX SDK (MIT, see runtime/third_party/FidelityFX/LICENSE.txt). +// Do not edit. +#pragma once +#include + +static const uint32_t fi_reconstruct_and_dilate_pass_0_spv[1193] = { + 0x7230203,0x10500,0x8000b,0x36a,0x0,0x20011,0x1,0x20011,0x31,0x6000b,0x1,0x4c534c47, + 0x6474732e,0x3035342e,0x0,0x3000e,0x0,0x1,0xc000f,0x5,0x4,0x6e69616d,0x0,0x61, + 0x75,0x7e,0x8c,0x96,0xa2,0x1a6,0x60010,0x4,0x11,0x8,0x8,0x1, + 0x30003,0x2,0x1c2,0xb0004,0x455f4c47,0x735f5458,0x6c706d61,0x656c7265,0x745f7373,0x75747865,0x665f6572,0x74636e75, + 0x736e6f69,0x0,0xb0004,0x455f4c47,0x735f5458,0x65646168,0x78655f72,0x63696c70,0x615f7469,0x68746972,0x6974656d,0x79745f63, + 0x736570,0xa0004,0x475f4c47,0x4c474f4f,0x70635f45,0x74735f70,0x5f656c79,0x656e696c,0x7269645f,0x69746365,0x6576,0x80004, + 0x475f4c47,0x4c474f4f,0x6e695f45,0x64756c63,0x69645f65,0x74636572,0x657669,0x40005,0x4,0x6e69616d,0x0,0x40005, + 0x5f,0x49466263,0x745f,0x60006,0x5f,0x0,0x646e6572,0x69537265,0x657a,0x60006,0x5f,0x1, + 0x70736964,0x5379616c,0x657a69,0x80006,0x5f,0x2,0x746f4d66,0x566e6f69,0x6f746365,0x61635372,0x656c,0x40005, + 0x61,0x49466263,0x0,0x60005,0x75,0x6e695f72,0x5f747570,0x74706564,0x68,0x80005,0x7e,0x6e695f72, + 0x5f747570,0x69746f6d,0x765f6e6f,0x6f746365,0x7372,0x90005,0x8c,0x645f7772,0x74616c69,0x6d5f6465,0x6f69746f,0x65765f6e, + 0x726f7463,0x73,0x70005,0x96,0x645f7772,0x74616c69,0x645f6465,0x68747065,0x0,0xc0005,0xa2,0x725f7772, + 0x6e6f6365,0x75727473,0x64657463,0x7065645f,0x705f6874,0x69766572,0x5f73756f,0x6d617266,0x65,0x80005,0x1a6,0x475f6c67, + 0x61626f6c,0x766e496c,0x7461636f,0x496e6f69,0x44,0x30047,0x5f,0x2,0x50048,0x5f,0x0,0x23, + 0x0,0x50048,0x5f,0x1,0x23,0x8,0x50048,0x5f,0x2,0x23,0xa8,0x40047, + 0x61,0x21,0x5,0x40047,0x61,0x22,0x0,0x40047,0x75,0x21,0x1,0x40047, + 0x75,0x22,0x0,0x40047,0x7e,0x21,0x0,0x40047,0x7e,0x22,0x0,0x40047, + 0x8c,0x21,0x3,0x40047,0x8c,0x22,0x0,0x40047,0x96,0x21,0x4,0x40047, + 0x96,0x22,0x0,0x40047,0xa2,0x21,0x2,0x40047,0xa2,0x22,0x0,0x40047, + 0x1a6,0xb,0x1c,0x40047,0x1bd,0xb,0x19,0x30047,0x1eb,0x18,0x30047,0x1ef, + 0x18,0x20013,0x2,0x30021,0x3,0x2,0x30016,0x6,0x20,0x40020,0x7,0x7, + 0x6,0x40015,0x8,0x20,0x0,0x40017,0xd,0x6,0x2,0x40015,0x16,0x20, + 0x1,0x40017,0x17,0x16,0x2,0x40020,0x1d,0x7,0x17,0x4002b,0x8,0x34, + 0x4,0x4001c,0x35,0x17,0x34,0x4001c,0x36,0x6,0x34,0x20014,0x3d,0x40017, + 0x5d,0x6,0x4,0x5001e,0x5f,0x17,0x17,0xd,0x40020,0x60,0x2,0x5f, + 0x4003b,0x60,0x61,0x2,0x40020,0x63,0x2,0xd,0x4002b,0x16,0x68,0x0, + 0x40020,0x69,0x2,0x17,0x4002b,0x16,0x6e,0x1,0x90019,0x73,0x6,0x1, + 0x0,0x0,0x0,0x1,0x0,0x40020,0x74,0x0,0x73,0x4003b,0x74,0x75, + 0x0,0x4002b,0x8,0x79,0x0,0x4003b,0x74,0x7e,0x0,0x90019,0x8a,0x6, + 0x1,0x0,0x0,0x0,0x2,0x7,0x40020,0x8b,0x0,0x8a,0x4003b,0x8b, + 0x8c,0x0,0x4002b,0x6,0x90,0x0,0x90019,0x94,0x6,0x1,0x0,0x0, + 0x0,0x2,0x3,0x40020,0x95,0x0,0x94,0x4003b,0x95,0x96,0x0,0x90019, + 0xa0,0x8,0x1,0x0,0x0,0x0,0x2,0x21,0x40020,0xa1,0x0,0xa0, + 0x4003b,0xa1,0xa2,0x0,0x40020,0xa5,0xb,0x8,0x4002b,0x8,0xa7,0x1, + 0x4002b,0x6,0xae,0x3f000000,0x5002c,0xd,0xaf,0xae,0xae,0x5002c,0x17,0xbc, + 0x68,0x68,0x5002c,0x17,0xbe,0x6e,0x68,0x5002c,0x17,0xc0,0x68,0x6e, + 0x5002c,0x17,0xc3,0x6e,0x6e,0x4002b,0x6,0xc5,0x3f800000,0x40017,0xe6,0x8, + 0x2,0x40017,0xea,0x3d,0x2,0x4002b,0x6,0xf4,0x3dcccccd,0x4002b,0x16,0x113, + 0x4,0x4002b,0x6,0x11e,0x3a83126f,0x4002b,0x16,0x13c,0x9,0x4002b,0x8,0x140, + 0x9,0x4001c,0x141,0x17,0x140,0x4002b,0x16,0x142,0xffffffff,0x5002c,0x17,0x143, + 0x68,0x142,0x5002c,0x17,0x144,0x142,0x68,0x5002c,0x17,0x145,0x142,0x6e, + 0x5002c,0x17,0x146,0x142,0x142,0x5002c,0x17,0x147,0x6e,0x142,0xc002c,0x141, + 0x148,0xbc,0xbe,0xc0,0x143,0x144,0x145,0xc3,0x146,0x147,0x40020,0x14a, + 0x7,0x141,0x4001c,0x14f,0x6,0x140,0x40020,0x150,0x7,0x14f,0x40017,0x1a4, + 0x8,0x3,0x40020,0x1a5,0x1,0x1a4,0x4003b,0x1a5,0x1a6,0x1,0x4002b,0x8, + 0x1bc,0x8,0x6002c,0x1a4,0x1bd,0x1bc,0x1bc,0xa7,0x40020,0x2eb,0x7,0x35, + 0x40020,0x2ed,0x7,0x36,0x7002c,0x35,0x35d,0xbc,0xbe,0xc0,0xc3,0x4002b, + 0x8,0x369,0x2,0x50036,0x2,0x4,0x0,0x3,0x200f8,0x5,0x4003b,0x2ed, + 0x307,0x7,0x4003b,0x2eb,0x306,0x7,0x5003b,0x14a,0x1eb,0x7,0x148,0x4003b, + 0x150,0x1ec,0x7,0x5003b,0x14a,0x1ef,0x7,0x148,0x4003d,0x1a4,0x1a7,0x1a6, + 0x7004f,0xe6,0x1a8,0x1a7,0x1a7,0x0,0x1,0x4007c,0x17,0x1a9,0x1a8,0x50041, + 0x69,0x1e7,0x61,0x68,0x4003d,0x17,0x1e8,0x1e7,0x3003e,0x1eb,0x148,0x3003e, + 0x1ef,0x148,0x200f9,0x1f4,0x200f8,0x1f4,0x700f5,0x16,0x33a,0x68,0x5,0x204, + 0x1f8,0x500b1,0x3d,0x1f7,0x33a,0x13c,0x400f6,0x205,0x1f8,0x0,0x400fa,0x1f7, + 0x1f8,0x205,0x200f8,0x1f8,0x50041,0x1d,0x1fb,0x1eb,0x33a,0x4003d,0x17,0x1fc, + 0x1fb,0x50080,0x17,0x1fd,0x1a9,0x1fc,0x4003d,0x73,0x228,0x75,0x7005f,0x5d, + 0x22a,0x228,0x1fd,0x2,0x68,0x50051,0x6,0x22b,0x22a,0x0,0x50041,0x7, + 0x201,0x1ec,0x33a,0x3003e,0x201,0x22b,0x50080,0x16,0x204,0x33a,0x6e,0x200f9, + 0x1f4,0x200f8,0x205,0x50041,0x7,0x207,0x1ec,0x68,0x4003d,0x6,0x208,0x207, + 0x200f9,0x209,0x200f8,0x209,0x700f5,0x17,0x33e,0x1a9,0x205,0x34e,0x222,0x700f5, + 0x6,0x33d,0x208,0x205,0x34c,0x222,0x700f5,0x16,0x33c,0x6e,0x205,0x224, + 0x222,0x500b1,0x3d,0x20c,0x33c,0x13c,0x400f6,0x225,0x222,0x0,0x400fa,0x20c, + 0x20d,0x225,0x200f8,0x20d,0x50041,0x1d,0x210,0x1ef,0x33c,0x4003d,0x17,0x211, + 0x210,0x50080,0x17,0x212,0x1a9,0x211,0x4007c,0xe6,0x230,0x212,0x4007c,0xe6, + 0x232,0x1e8,0x500b0,0xea,0x233,0x230,0x232,0x4009b,0x3d,0x234,0x233,0x300f7, + 0x221,0x0,0x400fa,0x234,0x216,0x221,0x200f8,0x216,0x50041,0x7,0x218,0x1ec, + 0x33c,0x4003d,0x6,0x219,0x218,0x500b8,0x3d,0x21c,0x219,0x33d,0x50050,0xea, + 0x35e,0x21c,0x21c,0x600a9,0x17,0x35f,0x35e,0x212,0x33e,0x600a9,0x6,0x360, + 0x21c,0x219,0x33d,0x200f9,0x221,0x200f8,0x221,0x700f5,0x17,0x34e,0x33e,0x20d, + 0x35f,0x216,0x700f5,0x6,0x34c,0x33d,0x20d,0x360,0x216,0x200f9,0x222,0x200f8, + 0x222,0x50080,0x16,0x224,0x33c,0x6e,0x200f9,0x209,0x200f8,0x225,0x4003d,0x73, + 0x239,0x7e,0x7005f,0x5d,0x23b,0x239,0x33e,0x2,0x68,0x7004f,0xd,0x23c, + 0x23b,0x23b,0x0,0x1,0x50041,0x63,0x243,0x61,0x369,0x4003d,0xd,0x244, + 0x243,0x50085,0xd,0x23f,0x23c,0x244,0x4003d,0x94,0x246,0x96,0x70050,0x5d, + 0x249,0x33d,0x90,0x90,0x90,0x40063,0x246,0x1a9,0x249,0x4003d,0x8a,0x24b, + 0x8c,0x50051,0x6,0x24e,0x23f,0x0,0x50051,0x6,0x24f,0x23f,0x1,0x70050, + 0x5d,0x250,0x24e,0x24f,0x90,0x90,0x40063,0x24b,0x1a9,0x250,0x50041,0x69, + 0x29a,0x61,0x6e,0x4003d,0x17,0x29b,0x29a,0x4006f,0xd,0x265,0x29b,0x50085, + 0xd,0x266,0x23f,0x265,0x6000c,0x6,0x267,0x1,0x42,0x266,0x500ba,0x3d, + 0x268,0x267,0xf4,0x600a9,0x6,0x269,0x268,0xc5,0x90,0x5008e,0xd,0x26b, + 0x23f,0x269,0x4006f,0xd,0x26d,0x1a9,0x50081,0xd,0x26f,0x26d,0xaf,0x4006f, + 0xd,0x271,0x1e8,0x50088,0xd,0x272,0x26f,0x271,0x50081,0xd,0x275,0x272, + 0x26b,0x50085,0xd,0x2a9,0x275,0x271,0x50083,0xd,0x2aa,0x2a9,0xaf,0x6000c, + 0xd,0x2ac,0x1,0x8,0x2aa,0x4006e,0x17,0x2ad,0x2ac,0x6000c,0xd,0x2d5, + 0x1,0xa,0x2aa,0x50051,0x6,0x2b6,0x2d5,0x0,0x50083,0x6,0x2b7,0xc5, + 0x2b6,0x50051,0x6,0x2b9,0x2d5,0x1,0x50083,0x6,0x2ba,0xc5,0x2b9,0x50085, + 0x6,0x2bb,0x2b7,0x2ba,0x50085,0x6,0x2c2,0x2b6,0x2ba,0x50085,0x6,0x2c9, + 0x2b7,0x2b9,0x50085,0x6,0x2cf,0x2b6,0x2b9,0x70050,0x36,0x339,0x2bb,0x2c2, + 0x2c9,0x2cf,0x3003e,0x306,0x35d,0x3003e,0x307,0x339,0x200f9,0x279,0x200f8,0x279, + 0x700f5,0x16,0x341,0x68,0x225,0x296,0x294,0x500b1,0x3d,0x27c,0x341,0x113, + 0x400f6,0x297,0x294,0x0,0x400fa,0x27c,0x27d,0x297,0x200f8,0x27d,0x50041,0x1d, + 0x30c,0x306,0x341,0x4003d,0x17,0x280,0x30c,0x50041,0x7,0x30d,0x307,0x341, + 0x4003d,0x6,0x283,0x30d,0x500ba,0x3d,0x285,0x283,0x11e,0x300f7,0x293,0x0, + 0x400fa,0x285,0x286,0x293,0x200f8,0x286,0x50080,0x17,0x28a,0x2ad,0x280,0x4007c, + 0xe6,0x2d9,0x28a,0x4007c,0xe6,0x2db,0x1e8,0x500b0,0xea,0x2dc,0x2d9,0x2db, + 0x4009b,0x3d,0x2dd,0x2dc,0x300f7,0x292,0x0,0x400fa,0x2dd,0x28e,0x292,0x200f8, + 0x28e,0x4007c,0x8,0x2ea,0x33d,0x6003c,0xa5,0x2e5,0xa2,0x28a,0x79,0x700ed, + 0x8,0x2e6,0x2e5,0xa7,0x79,0x2ea,0x200f9,0x292,0x200f8,0x292,0x200f9,0x293, + 0x200f8,0x293,0x200f9,0x294,0x200f8,0x294,0x50080,0x16,0x296,0x341,0x6e,0x200f9, + 0x279,0x200f8,0x297,0x100fd,0x10038, +}; +static const char *fi_reconstruct_and_dilate_pass_0_cb_names[] = {"cbFI"}; +static const uint32_t fi_reconstruct_and_dilate_pass_0_cb_bind[] = {5}; +static const uint32_t fi_reconstruct_and_dilate_pass_0_cb_count[] = {1}; +static const uint32_t fi_reconstruct_and_dilate_pass_0_cb_space[] = {0}; +static const char *fi_reconstruct_and_dilate_pass_0_srv_tex_names[] = {"r_input_motion_vectors", "r_input_depth"}; +static const uint32_t fi_reconstruct_and_dilate_pass_0_srv_tex_bind[] = {0, 1}; +static const uint32_t fi_reconstruct_and_dilate_pass_0_srv_tex_count[] = {1, 1}; +static const uint32_t fi_reconstruct_and_dilate_pass_0_srv_tex_space[] = {0, 0}; +static const char *fi_reconstruct_and_dilate_pass_0_uav_tex_names[] = {"rw_reconstructed_depth_previous_frame", "rw_dilated_motion_vectors", "rw_dilated_depth"}; +static const uint32_t fi_reconstruct_and_dilate_pass_0_uav_tex_bind[] = {2, 3, 4}; +static const uint32_t fi_reconstruct_and_dilate_pass_0_uav_tex_count[] = {1, 1, 1}; +static const uint32_t fi_reconstruct_and_dilate_pass_0_uav_tex_space[] = {0, 0, 0}; + +static const uint32_t fi_setup_pass_0_spv[695] = { + 0x7230203,0x10500,0x8000b,0x140,0x0,0x20011,0x1,0x20011,0x31,0x6000b,0x1,0x4c534c47, + 0x6474732e,0x3035342e,0x0,0x3000e,0x0,0x1,0xe000f,0x5,0x4,0x6e69616d,0x0,0x3c, + 0x47,0x56,0x60,0x65,0x6a,0x6f,0x77,0xb7,0x60010,0x4,0x11,0x8, + 0x8,0x1,0x30003,0x2,0x1c2,0xb0004,0x455f4c47,0x735f5458,0x6c706d61,0x656c7265,0x745f7373,0x75747865, + 0x665f6572,0x74636e75,0x736e6f69,0x0,0xb0004,0x455f4c47,0x735f5458,0x65646168,0x78655f72,0x63696c70,0x615f7469,0x68746972, + 0x6974656d,0x79745f63,0x736570,0xa0004,0x475f4c47,0x4c474f4f,0x70635f45,0x74735f70,0x5f656c79,0x656e696c,0x7269645f,0x69746365, + 0x6576,0x80004,0x475f4c47,0x4c474f4f,0x6e695f45,0x64756c63,0x69645f65,0x74636572,0x657669,0x40005,0x4,0x6e69616d, + 0x0,0x40005,0x3a,0x49466263,0x745f,0x50006,0x3a,0x0,0x65736572,0x74,0x40005,0x3c, + 0x49466263,0x0,0x70005,0x47,0x706f5f72,0x61636974,0x6c665f6c,0x735f776f,0x6463,0x80005,0x56,0x645f7772, + 0x636f7369,0x73756c63,0x5f6e6f69,0x6b73616d,0x0,0xa0005,0x60,0x675f7772,0x5f656d61,0x69746f6d,0x765f6e6f,0x6f746365, + 0x69665f72,0x5f646c65,0x78,0xa0005,0x65,0x675f7772,0x5f656d61,0x69746f6d,0x765f6e6f,0x6f746365,0x69665f72,0x5f646c65, + 0x79,0xc0005,0x6a,0x6f5f7772,0x63697470,0x665f6c61,0x5f776f6c,0x69746f6d,0x765f6e6f,0x6f746365,0x69665f72,0x5f646c65, + 0x78,0xc0005,0x6f,0x6f5f7772,0x63697470,0x665f6c61,0x5f776f6c,0x69746f6d,0x765f6e6f,0x6f746365,0x69665f72,0x5f646c65, + 0x79,0xa0005,0x75,0x6d617246,0x746e4965,0x6f707265,0x6974616c,0x57526e6f,0x6e756f43,0x73726574,0x745f,0x50006, + 0x75,0x0,0x61746164,0x0,0x50005,0x77,0x635f7772,0x746e756f,0x737265,0x80005,0xb7,0x475f6c67, + 0x61626f6c,0x766e496c,0x7461636f,0x496e6f69,0x44,0x30047,0x3a,0x2,0x50048,0x3a,0x0,0x23, + 0x2c,0x40047,0x3c,0x21,0x7,0x40047,0x3c,0x22,0x0,0x40047,0x47,0x21, + 0x0,0x40047,0x47,0x22,0x0,0x40047,0x56,0x21,0x5,0x40047,0x56,0x22, + 0x0,0x40047,0x60,0x21,0x1,0x40047,0x60,0x22,0x0,0x40047,0x65,0x21, + 0x2,0x40047,0x65,0x22,0x0,0x40047,0x6a,0x21,0x3,0x40047,0x6a,0x22, + 0x0,0x40047,0x6f,0x21,0x4,0x40047,0x6f,0x22,0x0,0x40047,0x74,0x6, + 0x4,0x30047,0x75,0x2,0x40048,0x75,0x0,0x17,0x50048,0x75,0x0,0x23, + 0x0,0x30047,0x77,0x17,0x40047,0x77,0x21,0x6,0x40047,0x77,0x22,0x0, + 0x40047,0xb7,0xb,0x1c,0x40047,0xd0,0xb,0x19,0x20013,0x2,0x30021,0x3, + 0x2,0x20014,0x6,0x40015,0xc,0x20,0x1,0x40017,0xd,0xc,0x2,0x30016, + 0xf,0x20,0x40015,0x17,0x20,0x0,0x40017,0x38,0xf,0x4,0x3001e,0x3a, + 0xc,0x40020,0x3b,0x2,0x3a,0x4003b,0x3b,0x3c,0x2,0x40020,0x3e,0x2, + 0xc,0x4002b,0xc,0x41,0x1,0x90019,0x45,0x17,0x1,0x0,0x0,0x0, + 0x1,0x0,0x40020,0x46,0x0,0x45,0x4003b,0x46,0x47,0x0,0x4002b,0xc, + 0x49,0x0,0x5002c,0xd,0x4a,0x41,0x49,0x40017,0x4b,0x17,0x4,0x4002b, + 0x17,0x4d,0x0,0x4002b,0x17,0x4f,0xf,0x90019,0x54,0xf,0x1,0x0, + 0x0,0x0,0x2,0xd,0x40020,0x55,0x0,0x54,0x4003b,0x55,0x56,0x0, + 0x4002b,0xf,0x5a,0x0,0x90019,0x5e,0x17,0x1,0x0,0x0,0x0,0x2, + 0x21,0x40020,0x5f,0x0,0x5e,0x4003b,0x5f,0x60,0x0,0x4003b,0x5f,0x65, + 0x0,0x4003b,0x5f,0x6a,0x0,0x4003b,0x5f,0x6f,0x0,0x3001d,0x74,0x17, + 0x3001e,0x75,0x74,0x40020,0x76,0xc,0x75,0x4003b,0x76,0x77,0xc,0x40020, + 0x79,0xc,0x17,0x5002c,0xd,0x85,0x49,0x49,0x40017,0x86,0x6,0x2, + 0x4002b,0x17,0x9b,0x1,0x40017,0xb5,0x17,0x3,0x40020,0xb6,0x1,0xb5, + 0x4003b,0xb6,0xb7,0x1,0x40017,0xb8,0x17,0x2,0x4002b,0x17,0xcf,0x8, + 0x6002c,0xb5,0xd0,0xcf,0xcf,0x9b,0x7002c,0x4b,0x13e,0x4d,0x4d,0x4d, + 0x4d,0x7002c,0x38,0x13f,0x5a,0x5a,0x5a,0x5a,0x50036,0x2,0x4,0x0, + 0x3,0x200f8,0x5,0x4003d,0xb5,0xb9,0xb7,0x7004f,0xb8,0xba,0xb9,0xb9, + 0x0,0x1,0x4007c,0xd,0xbb,0xba,0x60041,0x79,0x105,0x77,0x49,0x49, + 0x3003e,0x105,0x4d,0x500aa,0x86,0xe6,0xbb,0x85,0x4009b,0x6,0xe7,0xe6, + 0x300f7,0xf7,0x0,0x400fa,0xe7,0xe8,0xf7,0x200f8,0xe8,0x50041,0x3e,0x109, + 0x3c,0x4d,0x4003d,0xc,0x10a,0x109,0x500aa,0x6,0x10b,0x10a,0x41,0x400a8, + 0x6,0xea,0x10b,0x300f7,0xed,0x0,0x400fa,0xea,0xeb,0xed,0x200f8,0xeb, + 0x4003d,0x45,0x10e,0x47,0x7005f,0x4b,0x10f,0x10e,0x4a,0x2002,0x49,0x50051, + 0x17,0x110,0x10f,0x0,0x500c7,0x17,0x111,0x110,0x4f,0x500ab,0x6,0x112, + 0x111,0x4d,0x200f9,0xed,0x200f8,0xed,0x700f5,0x6,0xee,0x10b,0xe8,0x112, + 0xeb,0x300f7,0xf6,0x0,0x400fa,0xee,0xef,0xf1,0x200f8,0xef,0x60041,0x79, + 0x116,0x77,0x49,0x41,0x3003e,0x116,0x4d,0x200f9,0xf6,0x200f8,0xf1,0x60041, + 0x79,0x11a,0x77,0x49,0x41,0x4003d,0x17,0x11b,0x11a,0x50080,0x17,0xf4, + 0x11b,0x9b,0x3003e,0x11a,0xf4,0x200f9,0xf6,0x200f8,0xf6,0x200f9,0xf7,0x200f8, + 0xf7,0x4003d,0x5e,0x121,0x60,0x50063,0x121,0xbb,0x13e,0x2000,0x4003d,0x5e, + 0x126,0x65,0x50063,0x126,0xbb,0x13e,0x2000,0x4003d,0x5e,0x12b,0x6a,0x50063, + 0x12b,0xbb,0x13e,0x2000,0x4003d,0x5e,0x130,0x6f,0x50063,0x130,0xbb,0x13e, + 0x2000,0x4003d,0x54,0x135,0x56,0x40063,0x135,0xbb,0x13f,0x100fd,0x10038, +}; +static const char *fi_setup_pass_0_cb_names[] = {"cbFI"}; +static const uint32_t fi_setup_pass_0_cb_bind[] = {7}; +static const uint32_t fi_setup_pass_0_cb_count[] = {1}; +static const uint32_t fi_setup_pass_0_cb_space[] = {0}; +static const char *fi_setup_pass_0_srv_tex_names[] = {"r_optical_flow_scd"}; +static const uint32_t fi_setup_pass_0_srv_tex_bind[] = {0}; +static const uint32_t fi_setup_pass_0_srv_tex_count[] = {1}; +static const uint32_t fi_setup_pass_0_srv_tex_space[] = {0}; +static const char *fi_setup_pass_0_uav_tex_names[] = {"rw_game_motion_vector_field_x", "rw_game_motion_vector_field_y", "rw_optical_flow_motion_vector_field_x", "rw_optical_flow_motion_vector_field_y", "rw_disocclusion_mask"}; +static const uint32_t fi_setup_pass_0_uav_tex_bind[] = {1, 2, 3, 4, 5}; +static const uint32_t fi_setup_pass_0_uav_tex_count[] = {1, 1, 1, 1, 1}; +static const uint32_t fi_setup_pass_0_uav_tex_space[] = {0, 0, 0, 0, 0}; +static const char *fi_setup_pass_0_uav_buf_names[] = {"rw_counters"}; +static const uint32_t fi_setup_pass_0_uav_buf_bind[] = {6}; +static const uint32_t fi_setup_pass_0_uav_buf_count[] = {1}; +static const uint32_t fi_setup_pass_0_uav_buf_space[] = {0}; + +static const uint32_t fi_reconstruct_previous_depth_pass_0_spv[790] = { + 0x7230203,0x10500,0x8000b,0x284,0x0,0x20011,0x1,0x6000b,0x1,0x4c534c47,0x6474732e,0x3035342e, + 0x0,0x3000e,0x0,0x1,0xc000f,0x5,0x4,0x6e69616d,0x0,0x51,0x5a,0x61, + 0x69,0x6d,0x7d,0x134,0x60010,0x4,0x11,0x8,0x8,0x1,0x30003,0x2, + 0x1c2,0xb0004,0x455f4c47,0x735f5458,0x6c706d61,0x656c7265,0x745f7373,0x75747865,0x665f6572,0x74636e75,0x736e6f69,0x0, + 0xb0004,0x455f4c47,0x735f5458,0x65646168,0x78655f72,0x63696c70,0x615f7469,0x68746972,0x6974656d,0x79745f63,0x736570,0xa0004, + 0x475f4c47,0x4c474f4f,0x70635f45,0x74735f70,0x5f656c79,0x656e696c,0x7269645f,0x69746365,0x6576,0x80004,0x475f4c47,0x4c474f4f, + 0x6e695f45,0x64756c63,0x69645f65,0x74636572,0x657669,0x40005,0x4,0x6e69616d,0x0,0x40005,0x4f,0x49466263, + 0x745f,0x60006,0x4f,0x0,0x646e6572,0x69537265,0x657a,0x40005,0x51,0x49466263,0x0,0x90005, + 0x5a,0x69645f72,0x6574616c,0x6f6d5f64,0x6e6f6974,0x6365765f,0x73726f74,0x0,0x60005,0x61,0x69645f72,0x6574616c, + 0x65645f64,0x687470,0x90005,0x69,0x6e695f72,0x5f747570,0x74736964,0x6974726f,0x665f6e6f,0x646c6569,0x0,0x60005, + 0x6d,0x694c5f73,0x7261656e,0x6d616c43,0x70,0xd0005,0x7d,0x725f7772,0x6e6f6365,0x75727473,0x64657463,0x7065645f, + 0x695f6874,0x7265746e,0x616c6f70,0x5f646574,0x6d617266,0x65,0x80005,0x134,0x475f6c67,0x61626f6c,0x766e496c,0x7461636f, + 0x496e6f69,0x44,0x30047,0x4f,0x2,0x50048,0x4f,0x0,0x23,0x0,0x40047,0x51, + 0x21,0x5,0x40047,0x51,0x22,0x0,0x40047,0x5a,0x21,0x0,0x40047,0x5a, + 0x22,0x0,0x40047,0x61,0x21,0x1,0x40047,0x61,0x22,0x0,0x40047,0x69, + 0x21,0x3,0x40047,0x69,0x22,0x0,0x40047,0x6d,0x21,0x3e8,0x40047,0x6d, + 0x22,0x0,0x40047,0x7d,0x21,0x4,0x40047,0x7d,0x22,0x0,0x40047,0x134, + 0xb,0x1c,0x40047,0x149,0xb,0x19,0x20013,0x2,0x30021,0x3,0x2,0x30016, + 0x6,0x20,0x40020,0x7,0x7,0x6,0x40015,0x8,0x20,0x0,0x40017,0xd, + 0x6,0x2,0x40015,0x13,0x20,0x1,0x40017,0x14,0x13,0x2,0x40020,0x18, + 0x7,0x14,0x4002b,0x8,0x29,0x4,0x4001c,0x2a,0x14,0x29,0x4001c,0x2b, + 0x6,0x29,0x20014,0x32,0x40017,0x4d,0x6,0x4,0x3001e,0x4f,0x14,0x40020, + 0x50,0x2,0x4f,0x4003b,0x50,0x51,0x2,0x4002b,0x13,0x52,0x0,0x40020, + 0x53,0x2,0x14,0x90019,0x58,0x6,0x1,0x0,0x0,0x0,0x1,0x0, + 0x40020,0x59,0x0,0x58,0x4003b,0x59,0x5a,0x0,0x4003b,0x59,0x61,0x0, + 0x4002b,0x8,0x65,0x0,0x4003b,0x59,0x69,0x0,0x2001a,0x6b,0x40020,0x6c, + 0x0,0x6b,0x4003b,0x6c,0x6d,0x0,0x3001b,0x6f,0x58,0x4002b,0x6,0x72, + 0x0,0x90019,0x7b,0x8,0x1,0x0,0x0,0x0,0x2,0x21,0x40020,0x7c, + 0x0,0x7b,0x4003b,0x7c,0x7d,0x0,0x40020,0x80,0xb,0x8,0x4002b,0x8, + 0x82,0x1,0x4002b,0x6,0x89,0x3f000000,0x5002c,0xd,0x8a,0x89,0x89,0x5002c, + 0x14,0x97,0x52,0x52,0x4002b,0x13,0x99,0x1,0x5002c,0x14,0x9a,0x99, + 0x52,0x5002c,0x14,0x9c,0x52,0x99,0x5002c,0x14,0x9f,0x99,0x99,0x4002b, + 0x6,0xa1,0x3f800000,0x40017,0xc2,0x8,0x2,0x40017,0xc6,0x32,0x2,0x4002b, + 0x13,0xe3,0x4,0x4002b,0x6,0xf3,0x3a83126f,0x40017,0x132,0x8,0x3,0x40020, + 0x133,0x1,0x132,0x4003b,0x133,0x134,0x1,0x4002b,0x8,0x148,0x8,0x6002c, + 0x132,0x149,0x148,0x148,0x82,0x40020,0x224,0x7,0x2a,0x40020,0x226,0x7, + 0x2b,0x7002c,0x2a,0x283,0x97,0x9a,0x9c,0x9f,0x50036,0x2,0x4,0x0, + 0x3,0x200f8,0x5,0x4003b,0x226,0x240,0x7,0x4003b,0x224,0x23f,0x7,0x4003d, + 0x132,0x135,0x134,0x7004f,0xc2,0x136,0x135,0x135,0x0,0x1,0x4007c,0x14, + 0x137,0x136,0x4006f,0xd,0x159,0x137,0x50081,0xd,0x15b,0x159,0x8a,0x50041, + 0x53,0x176,0x51,0x52,0x4003d,0x14,0x177,0x176,0x4006f,0xd,0x15d,0x177, + 0x50088,0xd,0x15e,0x15b,0x15d,0x4003d,0x58,0x17a,0x69,0x4003d,0x6b,0x17b, + 0x6d,0x50056,0x6f,0x17c,0x17a,0x17b,0x70058,0x4d,0x17e,0x17c,0x15e,0x2, + 0x72,0x7004f,0xd,0x17f,0x17e,0x17e,0x0,0x1,0x50085,0xd,0x164,0x17f, + 0x15d,0x4006e,0x14,0x165,0x164,0x50080,0x14,0x168,0x137,0x165,0x4003d,0x58, + 0x186,0x5a,0x7005f,0x4d,0x188,0x186,0x168,0x2,0x52,0x7004f,0xd,0x189, + 0x188,0x188,0x0,0x1,0x4003d,0x58,0x18c,0x61,0x7005f,0x4d,0x18e,0x18c, + 0x168,0x2,0x52,0x50051,0x6,0x18f,0x18e,0x0,0x5008e,0xd,0x16f,0x189, + 0x89,0x50081,0xd,0x1aa,0x15e,0x16f,0x50085,0xd,0x1dd,0x1aa,0x15d,0x50083, + 0xd,0x1de,0x1dd,0x8a,0x6000c,0xd,0x1e0,0x1,0x8,0x1de,0x4006e,0x14, + 0x1e1,0x1e0,0x6000c,0xd,0x209,0x1,0xa,0x1de,0x50051,0x6,0x1ea,0x209, + 0x0,0x50083,0x6,0x1eb,0xa1,0x1ea,0x50051,0x6,0x1ed,0x209,0x1,0x50083, + 0x6,0x1ee,0xa1,0x1ed,0x50085,0x6,0x1ef,0x1eb,0x1ee,0x50085,0x6,0x1f6, + 0x1ea,0x1ee,0x50085,0x6,0x1fd,0x1eb,0x1ed,0x50085,0x6,0x203,0x1ea,0x1ed, + 0x70050,0x2b,0x272,0x1ef,0x1f6,0x1fd,0x203,0x3003e,0x23f,0x283,0x3003e,0x240, + 0x272,0x200f9,0x1ad,0x200f8,0x1ad,0x700f5,0x13,0x273,0x52,0x5,0x1ce,0x1cc, + 0x500b1,0x32,0x1b0,0x273,0xe3,0x400f6,0x1cf,0x1cc,0x0,0x400fa,0x1b0,0x1b1, + 0x1cf,0x200f8,0x1b1,0x50041,0x18,0x245,0x23f,0x273,0x4003d,0x14,0x1b4,0x245, + 0x50080,0x14,0x1b8,0x1e1,0x1b4,0x50041,0x7,0x246,0x240,0x273,0x4003d,0x6, + 0x1bb,0x246,0x500ba,0x32,0x1bd,0x1bb,0xf3,0x300f7,0x1cb,0x0,0x400fa,0x1bd, + 0x1be,0x1cb,0x200f8,0x1be,0x4007c,0xc2,0x212,0x1b8,0x4007c,0xc2,0x214,0x177, + 0x500b0,0xc6,0x215,0x212,0x214,0x4009b,0x32,0x216,0x215,0x300f7,0x1ca,0x0, + 0x400fa,0x216,0x1c2,0x1ca,0x200f8,0x1c2,0x4007c,0x8,0x223,0x18f,0x6003c,0x80, + 0x21e,0x7d,0x1b8,0x65,0x700ed,0x8,0x21f,0x21e,0x82,0x65,0x223,0x200f9, + 0x1ca,0x200f8,0x1ca,0x200f9,0x1cb,0x200f8,0x1cb,0x200f9,0x1cc,0x200f8,0x1cc,0x50080, + 0x13,0x1ce,0x273,0x99,0x200f9,0x1ad,0x200f8,0x1cf,0x100fd,0x10038, +}; +static const char *fi_reconstruct_previous_depth_pass_0_cb_names[] = {"cbFI"}; +static const uint32_t fi_reconstruct_previous_depth_pass_0_cb_bind[] = {5}; +static const uint32_t fi_reconstruct_previous_depth_pass_0_cb_count[] = {1}; +static const uint32_t fi_reconstruct_previous_depth_pass_0_cb_space[] = {0}; +static const char *fi_reconstruct_previous_depth_pass_0_srv_tex_names[] = {"r_dilated_motion_vectors", "r_dilated_depth", "r_input_distortion_field"}; +static const uint32_t fi_reconstruct_previous_depth_pass_0_srv_tex_bind[] = {0, 1, 3}; +static const uint32_t fi_reconstruct_previous_depth_pass_0_srv_tex_count[] = {1, 1, 1}; +static const uint32_t fi_reconstruct_previous_depth_pass_0_srv_tex_space[] = {0, 0, 0}; +static const char *fi_reconstruct_previous_depth_pass_0_uav_tex_names[] = {"rw_reconstructed_depth_interpolated_frame"}; +static const uint32_t fi_reconstruct_previous_depth_pass_0_uav_tex_bind[] = {4}; +static const uint32_t fi_reconstruct_previous_depth_pass_0_uav_tex_count[] = {1}; +static const uint32_t fi_reconstruct_previous_depth_pass_0_uav_tex_space[] = {0}; +static const char *fi_reconstruct_previous_depth_pass_0_sampler_names[] = {"s_LinearClamp"}; +static const uint32_t fi_reconstruct_previous_depth_pass_0_sampler_bind[] = {1000}; +static const uint32_t fi_reconstruct_previous_depth_pass_0_sampler_count[] = {1}; +static const uint32_t fi_reconstruct_previous_depth_pass_0_sampler_space[] = {0}; + +static const uint32_t fi_game_motion_vector_field_pass_0_spv[3471] = { + 0x7230203,0x10500,0x8000b,0xd73,0x0,0x20011,0x1,0x6000b,0x1,0x4c534c47,0x6474732e,0x3035342e, + 0x0,0x3000e,0x0,0x1,0xf000f,0x5,0x4,0x6e69616d,0x0,0x14c,0x17c,0x180, + 0x189,0x192,0x199,0x1a0,0x1ab,0x1b2,0x40c,0x60010,0x4,0x11,0x8,0x8, + 0x1,0x30003,0x2,0x1c2,0xb0004,0x455f4c47,0x735f5458,0x6c706d61,0x656c7265,0x745f7373,0x75747865,0x665f6572, + 0x74636e75,0x736e6f69,0x0,0xb0004,0x455f4c47,0x735f5458,0x65646168,0x78655f72,0x63696c70,0x615f7469,0x68746972,0x6974656d, + 0x79745f63,0x736570,0xa0004,0x475f4c47,0x4c474f4f,0x70635f45,0x74735f70,0x5f656c79,0x656e696c,0x7269645f,0x69746365,0x6576, + 0x80004,0x475f4c47,0x4c474f4f,0x6e695f45,0x64756c63,0x69645f65,0x74636572,0x657669,0x40005,0x4,0x6e69616d,0x0, + 0x40005,0x14a,0x49466263,0x745f,0x60006,0x14a,0x0,0x646e6572,0x69537265,0x657a,0x60006,0x14a, + 0x1,0x70736964,0x5379616c,0x657a69,0x80006,0x14a,0x2,0x76654466,0x54656369,0x6569566f,0x70654477,0x6874, + 0x90006,0x14a,0x3,0x65746e69,0x6c6f7072,0x6f697461,0x6365526e,0x73614274,0x65,0x90006,0x14a,0x4, + 0x65746e69,0x6c6f7072,0x6f697461,0x6365526e,0x7a695374,0x65,0xa0006,0x14a,0x5,0x6b636162,0x66667542,0x72547265, + 0x66736e61,0x75467265,0x6974636e,0x6e6f,0x70006,0x14a,0x6,0x4d6e696d,0x754c7861,0x616e696d,0x65636e,0x40005, + 0x14c,0x49466263,0x0,0xa0005,0x17c,0x72705f72,0x6f697665,0x695f7375,0x7265746e,0x616c6f70,0x6e6f6974,0x756f735f, + 0x656372,0x60005,0x180,0x694c5f73,0x7261656e,0x6d616c43,0x70,0xa0005,0x189,0x75635f72,0x6e657272,0x6e695f74, + 0x70726574,0x74616c6f,0x5f6e6f69,0x72756f73,0x6563,0x90005,0x192,0x69645f72,0x6574616c,0x6f6d5f64,0x6e6f6974,0x6365765f, + 0x73726f74,0x0,0x60005,0x199,0x69645f72,0x6574616c,0x65645f64,0x687470,0x90005,0x1a0,0x6e695f72,0x5f747570, + 0x74736964,0x6974726f,0x665f6e6f,0x646c6569,0x0,0xa0005,0x1ab,0x675f7772,0x5f656d61,0x69746f6d,0x765f6e6f,0x6f746365, + 0x69665f72,0x5f646c65,0x78,0xa0005,0x1b2,0x675f7772,0x5f656d61,0x69746f6d,0x765f6e6f,0x6f746365,0x69665f72,0x5f646c65, + 0x79,0x80005,0x40c,0x475f6c67,0x61626f6c,0x766e496c,0x7461636f,0x496e6f69,0x44,0x30047,0x14a,0x2, + 0x50048,0x14a,0x0,0x23,0x0,0x50048,0x14a,0x1,0x23,0x8,0x50048,0x14a, + 0x2,0x23,0x30,0x50048,0x14a,0x3,0x23,0x70,0x50048,0x14a,0x4,0x23, + 0x78,0x50048,0x14a,0x5,0x23,0x8c,0x50048,0x14a,0x6,0x23,0x90,0x40047, + 0x14c,0x21,0x7,0x40047,0x14c,0x22,0x0,0x40047,0x17c,0x21,0x2,0x40047, + 0x17c,0x22,0x0,0x40047,0x180,0x21,0x3e8,0x40047,0x180,0x22,0x0,0x40047, + 0x189,0x21,0x3,0x40047,0x189,0x22,0x0,0x40047,0x192,0x21,0x0,0x40047, + 0x192,0x22,0x0,0x40047,0x199,0x21,0x1,0x40047,0x199,0x22,0x0,0x40047, + 0x1a0,0x21,0x4,0x40047,0x1a0,0x22,0x0,0x40047,0x1ab,0x21,0x5,0x40047, + 0x1ab,0x22,0x0,0x40047,0x1b2,0x21,0x6,0x40047,0x1b2,0x22,0x0,0x40047, + 0x40c,0xb,0x1c,0x40047,0x41b,0xb,0x19,0x20013,0x2,0x30021,0x3,0x2, + 0x40015,0x6,0x20,0x0,0x30016,0x8,0x20,0x40017,0x12,0x8,0x3,0x40017, + 0x1c,0x8,0x2,0x40015,0x47,0x20,0x1,0x40017,0x48,0x47,0x2,0x40017, + 0x52,0x8,0x4,0x40020,0x65,0x7,0x48,0x40017,0x71,0x6,0x2,0x4002b, + 0x6,0x90,0x4,0x4001c,0x91,0x48,0x90,0x20014,0x9c,0x4002b,0x8,0xc3, + 0x0,0x4002b,0x8,0xcf,0x3f800000,0x4002b,0x8,0x10c,0x3c4fcd9e,0x4002b,0x8,0x111, + 0x3f560008,0x4002b,0x8,0x117,0x4196d014,0x4002b,0x8,0x11a,0x41958000,0x4002b,0x8,0x121, + 0x40c8e061,0x4002b,0x8,0x128,0x3d25aee6,0x4002b,0x8,0x129,0x3d9e8391,0x4002b,0x8,0x12a, + 0x4019999a,0x4002b,0x8,0x12d,0x3f72a76e,0x4002b,0x8,0x12e,0x3d558919,0x9001e,0x14a,0x48, + 0x48,0x52,0x48,0x48,0x6,0x1c,0x40020,0x14b,0x2,0x14a,0x4003b,0x14b, + 0x14c,0x2,0x40020,0x14e,0x2,0x48,0x4002b,0x47,0x158,0x0,0x4002b,0x47, + 0x15d,0x1,0x40020,0x163,0x2,0x52,0x40020,0x169,0x2,0x6,0x4002b,0x6, + 0x16f,0x0,0x40020,0x170,0x2,0x8,0x4002b,0x6,0x175,0x1,0x90019,0x17a, + 0x8,0x1,0x0,0x0,0x0,0x1,0x0,0x40020,0x17b,0x0,0x17a,0x4003b, + 0x17b,0x17c,0x0,0x2001a,0x17e,0x40020,0x17f,0x0,0x17e,0x4003b,0x17f,0x180, + 0x0,0x3001b,0x182,0x17a,0x4003b,0x17b,0x189,0x0,0x4003b,0x17b,0x192,0x0, + 0x4003b,0x17b,0x199,0x0,0x4003b,0x17b,0x1a0,0x0,0x90019,0x1a9,0x6,0x1, + 0x0,0x0,0x0,0x2,0x21,0x40020,0x1aa,0x0,0x1a9,0x4003b,0x1aa,0x1ab, + 0x0,0x40020,0x1af,0xb,0x6,0x4003b,0x1aa,0x1b2,0x0,0x4002b,0x8,0x1ce, + 0x3e59b3d0,0x4002b,0x8,0x1cf,0x3f371759,0x4002b,0x8,0x1d0,0x3d93dd98,0x6002c,0x12,0x1d1, + 0x1ce,0x1cf,0x1d0,0x4002b,0x8,0x1d6,0x3e86809d,0x4002b,0x8,0x1da,0x3f2d9168,0x4002b, + 0x8,0x1df,0x3d72e48f,0x4002b,0x8,0x207,0x461c4000,0x4002b,0x8,0x239,0x3f000000,0x5002c, + 0x1c,0x23a,0x239,0x239,0x5002c,0x48,0x247,0x158,0x158,0x5002c,0x48,0x249, + 0x15d,0x158,0x5002c,0x48,0x24b,0x158,0x15d,0x5002c,0x48,0x24e,0x15d,0x15d, + 0x40017,0x27f,0x9c,0x2,0x4002b,0x6,0x2ae,0x80000000,0x4002b,0x6,0x2b8,0x3ff, + 0x4002b,0x6,0x2ba,0x15,0x4002b,0x6,0x2be,0x1f,0x4002b,0x6,0x2c0,0x10, + 0x4002b,0x8,0x2d6,0x3ea8f5c3,0x4002b,0x8,0x2e2,0x447fc000,0x4002b,0x8,0x337,0x3a83126f, + 0x4002b,0x8,0x348,0x41f80000,0x30029,0x9c,0x357,0x4002b,0x47,0x36e,0x4,0x4002b, + 0x8,0x39f,0x3f3504f3,0x4002b,0x6,0x402,0x3,0x40017,0x40a,0x6,0x3,0x40020, + 0x40b,0x1,0x40a,0x4003b,0x40b,0x40c,0x1,0x4002b,0x6,0x41a,0x8,0x6002c, + 0x40a,0x41b,0x41a,0x41a,0x175,0x40020,0xc19,0x7,0x91,0x30001,0x12,0xcb1, + 0x6002c,0x12,0xd4b,0x128,0x128,0x128,0x6002c,0x12,0xd4c,0xc3,0xc3,0xc3, + 0x6002c,0x12,0xd4d,0xcf,0xcf,0xcf,0x6002c,0x12,0xd4e,0x129,0x129,0x129, + 0x6002c,0x12,0xd4f,0x12d,0x12d,0x12d,0x6002c,0x12,0xd50,0x12e,0x12e,0x12e, + 0x6002c,0x12,0xd51,0x12a,0x12a,0x12a,0x6002c,0x12,0xd52,0x10c,0x10c,0x10c, + 0x6002c,0x12,0xd53,0x111,0x111,0x111,0x6002c,0x12,0xd54,0x117,0x117,0x117, + 0x6002c,0x12,0xd55,0x11a,0x11a,0x11a,0x6002c,0x12,0xd56,0x121,0x121,0x121, + 0x7002c,0x91,0xd57,0x247,0x249,0x24b,0x24e,0x5002c,0x1c,0xd58,0xcf,0xcf, + 0x4002b,0x8,0xd59,0x3c4ccccd,0x4002b,0x8,0xd5a,0xff800000,0x6002c,0x12,0xd5b,0xd5a, + 0xd5a,0xd5a,0x4002b,0x6,0xd70,0x2,0x4002b,0x6,0xd71,0x5,0x4002b,0x6, + 0xd72,0x6,0x50036,0x2,0x4,0x0,0x3,0x200f8,0x5,0x4003b,0xc19,0xc53, + 0x7,0x4003b,0xc19,0xc4d,0x7,0x4003d,0x40a,0x40d,0x40c,0x7004f,0x71,0x40e, + 0x40d,0x40d,0x0,0x1,0x4007c,0x48,0x40f,0x40e,0x4006f,0x1c,0x46c,0x40f, + 0x50081,0x1c,0x46e,0x46c,0x23a,0x50041,0x14e,0x536,0x14c,0x158,0x4003d,0x48, + 0x537,0x536,0x4006f,0x1c,0x470,0x537,0x50088,0x1c,0x471,0x46e,0x470,0x4003d, + 0x17a,0x53a,0x1a0,0x4003d,0x17e,0x53b,0x180,0x50056,0x182,0x53c,0x53a,0x53b, + 0x70058,0x52,0x53e,0x53c,0x471,0x2,0xc3,0x7004f,0x1c,0x53f,0x53e,0x53e, + 0x0,0x1,0x50085,0x1c,0x477,0x53f,0x470,0x4006e,0x48,0x478,0x477,0x50041, + 0x14e,0x546,0x14c,0x402,0x4003d,0x48,0x547,0x546,0x4006f,0x1c,0x47a,0x547, + 0x50041,0x14e,0x54a,0x14c,0x15d,0x4003d,0x48,0x54b,0x54a,0x4006f,0x1c,0x47c, + 0x54b,0x50088,0x1c,0x47d,0x47a,0x47c,0x50041,0x14e,0x54e,0x14c,0x90,0x4003d, + 0x48,0x54f,0x54e,0x4006f,0x1c,0x47f,0x54f,0x50088,0x1c,0x482,0x47f,0x47c, + 0x50085,0x1c,0x486,0x471,0x482,0x50081,0x1c,0x487,0x47d,0x486,0x50080,0x48, + 0x48a,0x40f,0x478,0x4003d,0x17a,0x556,0x199,0x7005f,0x52,0x558,0x556,0x48a, + 0x2,0x158,0x50051,0x8,0x559,0x558,0x0,0x4003d,0x17a,0x55c,0x192,0x7005f, + 0x52,0x55e,0x55c,0x48a,0x2,0x158,0x7004f,0x1c,0x55f,0x55e,0x55e,0x0, + 0x1,0x5008e,0x1c,0x491,0x55f,0x239,0x50081,0x1c,0x494,0x471,0x491,0x50041, + 0x163,0x56d,0x14c,0xd70,0x4003d,0x52,0x56e,0x56d,0x50051,0x8,0x565,0x56e, + 0x1,0x50051,0x8,0x568,0x56e,0x0,0x50083,0x8,0x569,0x559,0x568,0x50088, + 0x8,0x56a,0x565,0x569,0x7000c,0x8,0x586,0x1,0x1a,0x56a,0x2d6,0x50081, + 0x8,0x57a,0xcf,0x586,0x50088,0x8,0x57b,0xcf,0x57a,0x50085,0x8,0x57c, + 0x586,0x57b,0x50083,0x8,0x57d,0xcf,0x57c,0x50085,0x8,0x57e,0x57d,0x2e2, + 0x4006d,0x6,0x57f,0x57e,0x7000c,0x6,0x58b,0x1,0x29,0x175,0x57f,0x50085, + 0x1c,0x49c,0x55f,0x482,0x50081,0x1c,0x49d,0x487,0x49c,0x4003d,0x17a,0x58e, + 0x17c,0x4003d,0x17e,0x58f,0x180,0x50056,0x182,0x590,0x58e,0x58f,0x70058,0x52, + 0x592,0x590,0x49d,0x2,0xc3,0x8004f,0x12,0x593,0x592,0x592,0x0,0x1, + 0x2,0x4003d,0x17a,0x596,0x189,0x4003d,0x17e,0x597,0x180,0x50056,0x182,0x598, + 0x596,0x597,0x70058,0x52,0x59a,0x598,0x487,0x2,0xc3,0x8004f,0x12,0x59b, + 0x59a,0x59a,0x0,0x1,0x2,0x50041,0x169,0x5b6,0x14c,0xd71,0x4003d,0x6, + 0x5b7,0x5b6,0x300f7,0x5b2,0x0,0x900fb,0x5b7,0x5b2,0x0,0x5a6,0x1,0x5aa, + 0x2,0x5ae,0x200f8,0x5a6,0x300f7,0x5cf,0x0,0x900fb,0x5b7,0x5cf,0x0,0x5c1, + 0x1,0x5c4,0x2,0x5ca,0x200f8,0x5c1,0x50083,0x12,0x5e0,0x593,0xd4b,0x50085, + 0x12,0x5f9,0x5e0,0xd5b,0x8000c,0x12,0x60a,0x1,0x2b,0x5f9,0xd4c,0xd4d, + 0x50085,0x12,0x5e5,0x593,0xd4e,0x50085,0x12,0x5e9,0x593,0xd4f,0x50081,0x12, + 0x5ec,0x5e9,0xd50,0x7000c,0x12,0x5ef,0x1,0x1a,0x5ec,0xd51,0x4007f,0x12, + 0x617,0x60a,0x50085,0x12,0x619,0x617,0x5ef,0x50081,0x12,0x61b,0x619,0x5ef, + 0x50085,0x12,0x61e,0x60a,0x5e5,0x50081,0x12,0x620,0x61e,0x61b,0x200f9,0x5cf, + 0x200f8,0x5c4,0x7000c,0x12,0x62c,0x1,0x1a,0x593,0xd52,0x50083,0x12,0x62f, + 0x62c,0xd53,0x8000c,0x12,0x648,0x1,0x2b,0x62f,0xd4c,0xd4d,0x50085,0x12, + 0x634,0xd55,0x62c,0x50083,0x12,0x635,0xd54,0x634,0x50088,0x12,0x636,0x648, + 0x635,0x7000c,0x12,0x638,0x1,0x1a,0x636,0xd56,0x60041,0x170,0x65f,0x14c, + 0xd72,0x175,0x4003d,0x8,0x660,0x65f,0x50088,0x8,0x5c8,0x207,0x660,0x5008e, + 0x12,0x5c9,0x638,0x5c8,0x200f9,0x5cf,0x200f8,0x5ca,0x60041,0x170,0x663,0x14c, + 0xd72,0x16f,0x4003d,0x8,0x664,0x663,0x60041,0x170,0x667,0x14c,0xd72,0x175, + 0x4003d,0x8,0x668,0x667,0x50085,0x8,0x670,0x664,0xd59,0x60050,0x12,0x67d, + 0x670,0x670,0x670,0x50083,0x12,0x672,0x593,0x67d,0x50083,0x8,0x676,0x668, + 0x664,0x50085,0x8,0x677,0x676,0xd59,0x60050,0x12,0x681,0x677,0x677,0x677, + 0x50088,0x12,0x679,0x672,0x681,0x200f9,0x5cf,0x200f8,0x5cf,0xb00f5,0x12,0xcb3, + 0xcb1,0x5a6,0x620,0x5c1,0x5c9,0x5c4,0x679,0x5ca,0x50094,0x8,0x685,0xcb3, + 0x1d1,0x200f9,0x5b2,0x200f8,0x5aa,0x300f7,0x69d,0x0,0x900fb,0x5b7,0x69d,0x0, + 0x68f,0x1,0x692,0x2,0x698,0x200f8,0x68f,0x50083,0x12,0x6ae,0x593,0xd4b, + 0x50085,0x12,0x6c7,0x6ae,0xd5b,0x8000c,0x12,0x6d8,0x1,0x2b,0x6c7,0xd4c, + 0xd4d,0x50085,0x12,0x6b3,0x593,0xd4e,0x50085,0x12,0x6b7,0x593,0xd4f,0x50081, + 0x12,0x6ba,0x6b7,0xd50,0x7000c,0x12,0x6bd,0x1,0x1a,0x6ba,0xd51,0x4007f, + 0x12,0x6e5,0x6d8,0x50085,0x12,0x6e7,0x6e5,0x6bd,0x50081,0x12,0x6e9,0x6e7, + 0x6bd,0x50085,0x12,0x6ec,0x6d8,0x6b3,0x50081,0x12,0x6ee,0x6ec,0x6e9,0x200f9, + 0x69d,0x200f8,0x692,0x7000c,0x12,0x6fa,0x1,0x1a,0x593,0xd52,0x50083,0x12, + 0x6fd,0x6fa,0xd53,0x8000c,0x12,0x716,0x1,0x2b,0x6fd,0xd4c,0xd4d,0x50085, + 0x12,0x702,0xd55,0x6fa,0x50083,0x12,0x703,0xd54,0x702,0x50088,0x12,0x704, + 0x716,0x703,0x7000c,0x12,0x706,0x1,0x1a,0x704,0xd56,0x60041,0x170,0x72d, + 0x14c,0xd72,0x175,0x4003d,0x8,0x72e,0x72d,0x50088,0x8,0x696,0x207,0x72e, + 0x5008e,0x12,0x697,0x706,0x696,0x200f9,0x69d,0x200f8,0x698,0x60041,0x170,0x731, + 0x14c,0xd72,0x16f,0x4003d,0x8,0x732,0x731,0x60041,0x170,0x735,0x14c,0xd72, + 0x175,0x4003d,0x8,0x736,0x735,0x50085,0x8,0x73e,0x732,0xd59,0x60050,0x12, + 0x74b,0x73e,0x73e,0x73e,0x50083,0x12,0x740,0x593,0x74b,0x50083,0x8,0x744, + 0x736,0x732,0x50085,0x8,0x745,0x744,0xd59,0x60050,0x12,0x74f,0x745,0x745, + 0x745,0x50088,0x12,0x747,0x740,0x74f,0x200f9,0x69d,0x200f8,0x69d,0xb00f5,0x12, + 0xcb2,0xcb1,0x5aa,0x6ee,0x68f,0x697,0x692,0x747,0x698,0x50051,0x8,0x754, + 0xcb2,0x0,0x50085,0x8,0x755,0x1d6,0x754,0x50051,0x8,0x757,0xcb2,0x1, + 0x50085,0x8,0x758,0x1da,0x757,0x50081,0x8,0x759,0x755,0x758,0x50051,0x8, + 0x75b,0xcb2,0x2,0x50085,0x8,0x75c,0x1df,0x75b,0x50081,0x8,0x75d,0x759, + 0x75c,0x200f9,0x5b2,0x200f8,0x5ae,0x300f7,0x776,0x0,0x900fb,0x5b7,0x776,0x0, + 0x768,0x1,0x76b,0x2,0x771,0x200f8,0x768,0x50083,0x12,0x787,0x593,0xd4b, + 0x50085,0x12,0x7a0,0x787,0xd5b,0x8000c,0x12,0x7b1,0x1,0x2b,0x7a0,0xd4c, + 0xd4d,0x50085,0x12,0x78c,0x593,0xd4e,0x50085,0x12,0x790,0x593,0xd4f,0x50081, + 0x12,0x793,0x790,0xd50,0x7000c,0x12,0x796,0x1,0x1a,0x793,0xd51,0x4007f, + 0x12,0x7be,0x7b1,0x50085,0x12,0x7c0,0x7be,0x796,0x50081,0x12,0x7c2,0x7c0, + 0x796,0x50085,0x12,0x7c5,0x7b1,0x78c,0x50081,0x12,0x7c7,0x7c5,0x7c2,0x200f9, + 0x776,0x200f8,0x76b,0x7000c,0x12,0x7d3,0x1,0x1a,0x593,0xd52,0x50083,0x12, + 0x7d6,0x7d3,0xd53,0x8000c,0x12,0x7ef,0x1,0x2b,0x7d6,0xd4c,0xd4d,0x50085, + 0x12,0x7db,0xd55,0x7d3,0x50083,0x12,0x7dc,0xd54,0x7db,0x50088,0x12,0x7dd, + 0x7ef,0x7dc,0x7000c,0x12,0x7df,0x1,0x1a,0x7dd,0xd56,0x60041,0x170,0x806, + 0x14c,0xd72,0x175,0x4003d,0x8,0x807,0x806,0x50088,0x8,0x76f,0x207,0x807, + 0x5008e,0x12,0x770,0x7df,0x76f,0x200f9,0x776,0x200f8,0x771,0x60041,0x170,0x80a, + 0x14c,0xd72,0x16f,0x4003d,0x8,0x80b,0x80a,0x60041,0x170,0x80e,0x14c,0xd72, + 0x175,0x4003d,0x8,0x80f,0x80e,0x50085,0x8,0x817,0x80b,0xd59,0x60050,0x12, + 0x824,0x817,0x817,0x817,0x50083,0x12,0x819,0x593,0x824,0x50083,0x8,0x81d, + 0x80f,0x80b,0x50085,0x8,0x81e,0x81d,0xd59,0x60050,0x12,0x828,0x81e,0x81e, + 0x81e,0x50088,0x12,0x820,0x819,0x828,0x200f9,0x776,0x200f8,0x776,0xb00f5,0x12, + 0xcb0,0xcb1,0x5ae,0x7c7,0x768,0x770,0x76b,0x820,0x771,0x50094,0x8,0x82c, + 0xcb0,0x1d1,0x200f9,0x5b2,0x200f8,0x5b2,0xb00f5,0x8,0xcb4,0xc3,0x5,0x685, + 0x5cf,0x75d,0x69d,0x82c,0x776,0x50081,0x8,0x4a3,0x337,0xcb4,0x300f7,0x843, + 0x0,0x900fb,0x5b7,0x843,0x0,0x837,0x1,0x83b,0x2,0x83f,0x200f8,0x837, + 0x300f7,0x860,0x0,0x900fb,0x5b7,0x860,0x0,0x852,0x1,0x855,0x2,0x85b, + 0x200f8,0x852,0x50083,0x12,0x871,0x59b,0xd4b,0x50085,0x12,0x88a,0x871,0xd5b, + 0x8000c,0x12,0x89b,0x1,0x2b,0x88a,0xd4c,0xd4d,0x50085,0x12,0x876,0x59b, + 0xd4e,0x50085,0x12,0x87a,0x59b,0xd4f,0x50081,0x12,0x87d,0x87a,0xd50,0x7000c, + 0x12,0x880,0x1,0x1a,0x87d,0xd51,0x4007f,0x12,0x8a8,0x89b,0x50085,0x12, + 0x8aa,0x8a8,0x880,0x50081,0x12,0x8ac,0x8aa,0x880,0x50085,0x12,0x8af,0x89b, + 0x876,0x50081,0x12,0x8b1,0x8af,0x8ac,0x200f9,0x860,0x200f8,0x855,0x7000c,0x12, + 0x8bd,0x1,0x1a,0x59b,0xd52,0x50083,0x12,0x8c0,0x8bd,0xd53,0x8000c,0x12, + 0x8d9,0x1,0x2b,0x8c0,0xd4c,0xd4d,0x50085,0x12,0x8c5,0xd55,0x8bd,0x50083, + 0x12,0x8c6,0xd54,0x8c5,0x50088,0x12,0x8c7,0x8d9,0x8c6,0x7000c,0x12,0x8c9, + 0x1,0x1a,0x8c7,0xd56,0x60041,0x170,0x8f0,0x14c,0xd72,0x175,0x4003d,0x8, + 0x8f1,0x8f0,0x50088,0x8,0x859,0x207,0x8f1,0x5008e,0x12,0x85a,0x8c9,0x859, + 0x200f9,0x860,0x200f8,0x85b,0x60041,0x170,0x8f4,0x14c,0xd72,0x16f,0x4003d,0x8, + 0x8f5,0x8f4,0x60041,0x170,0x8f8,0x14c,0xd72,0x175,0x4003d,0x8,0x8f9,0x8f8, + 0x50085,0x8,0x901,0x8f5,0xd59,0x60050,0x12,0x90e,0x901,0x901,0x901,0x50083, + 0x12,0x903,0x59b,0x90e,0x50083,0x8,0x907,0x8f9,0x8f5,0x50085,0x8,0x908, + 0x907,0xd59,0x60050,0x12,0x912,0x908,0x908,0x908,0x50088,0x12,0x90a,0x903, + 0x912,0x200f9,0x860,0x200f8,0x860,0xb00f5,0x12,0xcc3,0xcb1,0x837,0x8b1,0x852, + 0x85a,0x855,0x90a,0x85b,0x50094,0x8,0x916,0xcc3,0x1d1,0x200f9,0x843,0x200f8, + 0x83b,0x300f7,0x92e,0x0,0x900fb,0x5b7,0x92e,0x0,0x920,0x1,0x923,0x2, + 0x929,0x200f8,0x920,0x50083,0x12,0x93f,0x59b,0xd4b,0x50085,0x12,0x958,0x93f, + 0xd5b,0x8000c,0x12,0x969,0x1,0x2b,0x958,0xd4c,0xd4d,0x50085,0x12,0x944, + 0x59b,0xd4e,0x50085,0x12,0x948,0x59b,0xd4f,0x50081,0x12,0x94b,0x948,0xd50, + 0x7000c,0x12,0x94e,0x1,0x1a,0x94b,0xd51,0x4007f,0x12,0x976,0x969,0x50085, + 0x12,0x978,0x976,0x94e,0x50081,0x12,0x97a,0x978,0x94e,0x50085,0x12,0x97d, + 0x969,0x944,0x50081,0x12,0x97f,0x97d,0x97a,0x200f9,0x92e,0x200f8,0x923,0x7000c, + 0x12,0x98b,0x1,0x1a,0x59b,0xd52,0x50083,0x12,0x98e,0x98b,0xd53,0x8000c, + 0x12,0x9a7,0x1,0x2b,0x98e,0xd4c,0xd4d,0x50085,0x12,0x993,0xd55,0x98b, + 0x50083,0x12,0x994,0xd54,0x993,0x50088,0x12,0x995,0x9a7,0x994,0x7000c,0x12, + 0x997,0x1,0x1a,0x995,0xd56,0x60041,0x170,0x9be,0x14c,0xd72,0x175,0x4003d, + 0x8,0x9bf,0x9be,0x50088,0x8,0x927,0x207,0x9bf,0x5008e,0x12,0x928,0x997, + 0x927,0x200f9,0x92e,0x200f8,0x929,0x60041,0x170,0x9c2,0x14c,0xd72,0x16f,0x4003d, + 0x8,0x9c3,0x9c2,0x60041,0x170,0x9c6,0x14c,0xd72,0x175,0x4003d,0x8,0x9c7, + 0x9c6,0x50085,0x8,0x9cf,0x9c3,0xd59,0x60050,0x12,0x9dc,0x9cf,0x9cf,0x9cf, + 0x50083,0x12,0x9d1,0x59b,0x9dc,0x50083,0x8,0x9d5,0x9c7,0x9c3,0x50085,0x8, + 0x9d6,0x9d5,0xd59,0x60050,0x12,0x9e0,0x9d6,0x9d6,0x9d6,0x50088,0x12,0x9d8, + 0x9d1,0x9e0,0x200f9,0x92e,0x200f8,0x92e,0xb00f5,0x12,0xcbe,0xcb1,0x83b,0x97f, + 0x920,0x928,0x923,0x9d8,0x929,0x50051,0x8,0x9e5,0xcbe,0x0,0x50085,0x8, + 0x9e6,0x1d6,0x9e5,0x50051,0x8,0x9e8,0xcbe,0x1,0x50085,0x8,0x9e9,0x1da, + 0x9e8,0x50081,0x8,0x9ea,0x9e6,0x9e9,0x50051,0x8,0x9ec,0xcbe,0x2,0x50085, + 0x8,0x9ed,0x1df,0x9ec,0x50081,0x8,0x9ee,0x9ea,0x9ed,0x200f9,0x843,0x200f8, + 0x83f,0x300f7,0xa07,0x0,0x900fb,0x5b7,0xa07,0x0,0x9f9,0x1,0x9fc,0x2, + 0xa02,0x200f8,0x9f9,0x50083,0x12,0xa18,0x59b,0xd4b,0x50085,0x12,0xa31,0xa18, + 0xd5b,0x8000c,0x12,0xa42,0x1,0x2b,0xa31,0xd4c,0xd4d,0x50085,0x12,0xa1d, + 0x59b,0xd4e,0x50085,0x12,0xa21,0x59b,0xd4f,0x50081,0x12,0xa24,0xa21,0xd50, + 0x7000c,0x12,0xa27,0x1,0x1a,0xa24,0xd51,0x4007f,0x12,0xa4f,0xa42,0x50085, + 0x12,0xa51,0xa4f,0xa27,0x50081,0x12,0xa53,0xa51,0xa27,0x50085,0x12,0xa56, + 0xa42,0xa1d,0x50081,0x12,0xa58,0xa56,0xa53,0x200f9,0xa07,0x200f8,0x9fc,0x7000c, + 0x12,0xa64,0x1,0x1a,0x59b,0xd52,0x50083,0x12,0xa67,0xa64,0xd53,0x8000c, + 0x12,0xa80,0x1,0x2b,0xa67,0xd4c,0xd4d,0x50085,0x12,0xa6c,0xd55,0xa64, + 0x50083,0x12,0xa6d,0xd54,0xa6c,0x50088,0x12,0xa6e,0xa80,0xa6d,0x7000c,0x12, + 0xa70,0x1,0x1a,0xa6e,0xd56,0x60041,0x170,0xa97,0x14c,0xd72,0x175,0x4003d, + 0x8,0xa98,0xa97,0x50088,0x8,0xa00,0x207,0xa98,0x5008e,0x12,0xa01,0xa70, + 0xa00,0x200f9,0xa07,0x200f8,0xa02,0x60041,0x170,0xa9b,0x14c,0xd72,0x16f,0x4003d, + 0x8,0xa9c,0xa9b,0x60041,0x170,0xa9f,0x14c,0xd72,0x175,0x4003d,0x8,0xaa0, + 0xa9f,0x50085,0x8,0xaa8,0xa9c,0xd59,0x60050,0x12,0xab5,0xaa8,0xaa8,0xaa8, + 0x50083,0x12,0xaaa,0x59b,0xab5,0x50083,0x8,0xaae,0xaa0,0xa9c,0x50085,0x8, + 0xaaf,0xaae,0xd59,0x60050,0x12,0xab9,0xaaf,0xaaf,0xaaf,0x50088,0x12,0xab1, + 0xaaa,0xab9,0x200f9,0xa07,0x200f8,0xa07,0xb00f5,0x12,0xcb9,0xcb1,0x83f,0xa58, + 0x9f9,0xa01,0x9fc,0xab1,0xa02,0x50094,0x8,0xabd,0xcb9,0x1d1,0x200f9,0x843, + 0x200f8,0x843,0xb00f5,0x8,0xcc8,0xc3,0x5b2,0x916,0x860,0x9ee,0x92e,0xabd, + 0xa07,0x50081,0x8,0x4a6,0x337,0xcc8,0x7000c,0x8,0xad4,0x1,0x28,0x4a3, + 0x4a6,0x500b7,0x9c,0xac8,0xad4,0xc3,0x300f7,0xace,0x0,0x400fa,0xac8,0xac9, + 0xacd,0x200f8,0xac9,0x7000c,0x8,0xad9,0x1,0x25,0x4a3,0x4a6,0x50088,0x8, + 0xacc,0xad9,0xad4,0x200f9,0xace,0x200f8,0xacd,0x200f9,0xace,0x200f8,0xace,0x700f5, + 0x8,0xccd,0xacc,0xac9,0xc3,0xacd,0x7000c,0x8,0xade,0x1,0x1a,0xccd, + 0xcf,0x50085,0x8,0x4ab,0xade,0x348,0x6000c,0x8,0xae2,0x1,0x2,0x4ab, + 0x4006d,0x6,0x4ad,0xae2,0x50051,0x8,0xae6,0x49d,0x0,0x500ba,0x9c,0xae7, + 0xae6,0xc3,0x300f7,0xaec,0x0,0x400fa,0xae7,0xae8,0xaec,0x200f8,0xae8,0x500b8, + 0x9c,0xaeb,0xae6,0xcf,0x200f9,0xaec,0x200f8,0xaec,0x700f5,0x9c,0xaed,0xae7, + 0xace,0xaeb,0xae8,0x300f7,0xaf8,0x0,0x400fa,0xaed,0xaee,0xaf8,0x200f8,0xaee, + 0x50051,0x8,0xaf0,0x49d,0x1,0x500ba,0x9c,0xaf1,0xaf0,0xc3,0x300f7,0xaf6, + 0x0,0x400fa,0xaf1,0xaf2,0xaf6,0x200f8,0xaf2,0x500b8,0x9c,0xaf5,0xaf0,0xcf, + 0x200f9,0xaf6,0x200f8,0xaf6,0x700f5,0x9c,0xaf7,0xaf1,0xaee,0xaf5,0xaf2,0x200f9, + 0xaf8,0x200f8,0xaf8,0x700f5,0x9c,0xaf9,0xaed,0xaec,0xaf7,0xaf6,0x600a9,0x6, + 0x4b4,0xaf9,0x175,0x16f,0x50084,0x6,0x4b5,0x4ad,0x4b4,0x500c7,0x6,0xb05, + 0x58b,0x2b8,0x500c4,0x6,0xb06,0xb05,0x2ba,0x500c5,0x6,0xb07,0x2ae,0xb06, + 0x500c7,0x6,0xb09,0x4b5,0x2be,0x500c4,0x6,0xb0a,0xb09,0x2c0,0x500c5,0x6, + 0xb0b,0xb07,0xb0a,0x50051,0x8,0xb0e,0x491,0x0,0x50050,0x1c,0xb1c,0xb0e, + 0xc3,0x6000c,0x6,0xb1d,0x1,0x3a,0xb1c,0x500c5,0x6,0xb10,0xb0b,0xb1d, + 0x50051,0x8,0xb13,0x491,0x1,0x50050,0x1c,0xb21,0xb13,0xc3,0x6000c,0x6, + 0xb22,0x1,0x3a,0xb21,0x500c5,0x6,0xb15,0xb0b,0xb22,0x50085,0x1c,0xb30, + 0x494,0x470,0x50083,0x1c,0xb31,0xb30,0x23a,0x6000c,0x1c,0xb33,0x1,0x8, + 0xb31,0x4006e,0x48,0xb34,0xb33,0x3003e,0xc4d,0xd57,0x200f9,0x4bd,0x200f8,0x4bd, + 0x700f5,0x47,0xd0d,0x158,0xaf8,0x4d3,0x4d1,0x500b1,0x9c,0x4c0,0xd0d,0x36e, + 0x400f6,0x4d4,0x4d1,0x0,0x400fa,0x4c0,0x4c1,0x4d4,0x200f8,0x4c1,0x50041,0x65, + 0xc52,0xc4d,0xd0d,0x4003d,0x48,0x4c4,0xc52,0x50080,0x48,0x4c8,0xb34,0x4c4, + 0x4007c,0x71,0xb64,0x4c8,0x4007c,0x71,0xb66,0x537,0x500b0,0x27f,0xb67,0xb64, + 0xb66,0x4009b,0x9c,0xb68,0xb67,0x300f7,0x4d0,0x0,0x400fa,0xb68,0x4cc,0x4d0, + 0x200f8,0x4cc,0x6003c,0x1af,0xb6d,0x1ab,0x4c8,0x16f,0x700ef,0x6,0xb6e,0xb6d, + 0x175,0x16f,0xb10,0x6003c,0x1af,0xb72,0x1b2,0x4c8,0x16f,0x700ef,0x6,0xb73, + 0xb72,0x175,0x16f,0xb15,0x200f9,0x4d0,0x200f8,0x4d0,0x200f9,0x4d1,0x200f8,0x4d1, + 0x50080,0x47,0x4d3,0xd0d,0x15d,0x200f9,0x4bd,0x200f8,0x4d4,0x50085,0x1c,0x4d8, + 0x491,0x470,0x6000c,0x8,0x4d9,0x1,0x42,0x4d8,0x500ba,0x9c,0x4da,0x4d9, + 0x337,0x300f7,0x533,0x0,0x400fa,0x4da,0x4dc,0x533,0x200f8,0x4dc,0x50088,0x1c, + 0x4e0,0xd58,0x470,0x6000c,0x8,0x4e1,0x1,0x42,0x4e0,0x6000c,0x1c,0x4e3, + 0x1,0x45,0x55f,0x6000c,0x8,0x4e5,0x1,0x42,0x491,0x7000c,0x8,0xb80, + 0x1,0x25,0x4e5,0x39f,0x200f9,0x4e8,0x200f8,0x4e8,0x700f5,0x9c,0xd15,0x357, + 0x4dc,0xd21,0x52e,0x700f5,0x8,0xd13,0x4e1,0x4dc,0x531,0x52e,0x700f5,0x6, + 0xd27,0x16f,0x4dc,0xd26,0x52e,0x500bc,0x9c,0x4ec,0xd13,0xb80,0x500a7,0x9c, + 0x4ee,0x4ec,0xd15,0x400f6,0x532,0x52e,0x0,0x400fa,0x4ee,0x4ef,0x532,0x200f8, + 0x4ef,0x5008e,0x1c,0x4f3,0x4e3,0xd13,0x50083,0x1c,0x4f4,0x494,0x4f3,0x50085, + 0x1c,0xb8e,0x4f4,0x470,0x50083,0x1c,0xb8f,0xb8e,0x23a,0x6000c,0x1c,0xb91, + 0x1,0x8,0xb8f,0x4006e,0x48,0xb92,0xb91,0x3003e,0xc53,0xd57,0x50082,0x6, + 0x4f9,0x2b8,0x58b,0x7000c,0x6,0xbbf,0x1,0x29,0x175,0x4f9,0x50083,0x1c, + 0x4fc,0x23a,0x4f4,0x6000c,0x1c,0x4fd,0x1,0x45,0x4fc,0x50094,0x8,0x500, + 0x4fd,0x4e3,0x7000c,0x8,0xbc4,0x1,0x28,0xc3,0x500,0x50085,0x8,0x502, + 0xbc4,0x348,0x4006d,0x6,0x503,0x502,0x500c7,0x6,0xbd0,0xbbf,0x2b8,0x500c4, + 0x6,0xbd1,0xbd0,0x2ba,0x500c7,0x6,0xbd4,0x503,0x2be,0x500c4,0x6,0xbd5, + 0xbd4,0x2c0,0x500c5,0x6,0xbd6,0xbd1,0xbd5,0x500c5,0x6,0xbdb,0xbd6,0xb1d, + 0x500c5,0x6,0xbe0,0xbd6,0xb22,0x200f9,0x508,0x200f8,0x508,0x700f5,0x6,0xd26, + 0xd27,0x4ef,0xd48,0x52a,0x700f5,0x9c,0xd21,0xd15,0x4ef,0xd46,0x52a,0x700f5, + 0x47,0xd1c,0x158,0x4ef,0x52c,0x52a,0x500b1,0x9c,0x50b,0xd1c,0x15d,0x400f6, + 0x52d,0x52a,0x0,0x400fa,0x50b,0x50c,0x52d,0x200f8,0x50c,0x50041,0x65,0xc57, + 0xc53,0xd1c,0x4003d,0x48,0x50f,0xc57,0x50080,0x48,0x513,0xb92,0x50f,0x300f7, + 0x519,0x0,0x400fa,0xd21,0x515,0x519,0x200f8,0x515,0x4007c,0x71,0xbf5,0x513, + 0x4007c,0x71,0xbf7,0x537,0x500b0,0x27f,0xbf8,0xbf5,0xbf7,0x4009b,0x9c,0xbf9, + 0xbf8,0x200f9,0x519,0x200f8,0x519,0x700f5,0x9c,0x51a,0xd21,0x50c,0xbf9,0x515, + 0x300f7,0x529,0x0,0x400fa,0x51a,0x51c,0x529,0x200f8,0x51c,0x6003c,0x1af,0xc04, + 0x1ab,0x513,0x16f,0x700ef,0x6,0xc05,0xc04,0x175,0x16f,0xbdb,0x6003c,0x1af, + 0xc09,0x1b2,0x513,0x16f,0x700ef,0x6,0xc0a,0xc09,0x175,0x16f,0xbe0,0x7000c, + 0x6,0xc13,0x1,0x29,0xc05,0xc0a,0x500c7,0x6,0xc17,0xc13,0x2ae,0x500ab, + 0x9c,0xc18,0xc17,0x16f,0x600a9,0x6,0x522,0xc18,0x175,0x16f,0x50080,0x6, + 0x524,0xd26,0x522,0x500b2,0x9c,0x527,0x524,0x402,0x500a7,0x9c,0x528,0x51a, + 0x527,0x200f9,0x529,0x200f8,0x529,0x700f5,0x6,0xd48,0xd26,0x519,0x524,0x51c, + 0x700f5,0x9c,0xd46,0x51a,0x519,0x528,0x51c,0x200f9,0x52a,0x200f8,0x52a,0x50080, + 0x47,0x52c,0xd1c,0x15d,0x200f9,0x508,0x200f8,0x52d,0x200f9,0x52e,0x200f8,0x52e, + 0x50081,0x8,0x531,0xd13,0x4e1,0x200f9,0x4e8,0x200f8,0x532,0x200f9,0x533,0x200f8, + 0x533,0x100fd,0x10038, +}; +static const char *fi_game_motion_vector_field_pass_0_cb_names[] = {"cbFI"}; +static const uint32_t fi_game_motion_vector_field_pass_0_cb_bind[] = {7}; +static const uint32_t fi_game_motion_vector_field_pass_0_cb_count[] = {1}; +static const uint32_t fi_game_motion_vector_field_pass_0_cb_space[] = {0}; +static const char *fi_game_motion_vector_field_pass_0_srv_tex_names[] = {"r_dilated_motion_vectors", "r_dilated_depth", "r_previous_interpolation_source", "r_current_interpolation_source", "r_input_distortion_field"}; +static const uint32_t fi_game_motion_vector_field_pass_0_srv_tex_bind[] = {0, 1, 2, 3, 4}; +static const uint32_t fi_game_motion_vector_field_pass_0_srv_tex_count[] = {1, 1, 1, 1, 1}; +static const uint32_t fi_game_motion_vector_field_pass_0_srv_tex_space[] = {0, 0, 0, 0, 0}; +static const char *fi_game_motion_vector_field_pass_0_uav_tex_names[] = {"rw_game_motion_vector_field_x", "rw_game_motion_vector_field_y"}; +static const uint32_t fi_game_motion_vector_field_pass_0_uav_tex_bind[] = {5, 6}; +static const uint32_t fi_game_motion_vector_field_pass_0_uav_tex_count[] = {1, 1}; +static const uint32_t fi_game_motion_vector_field_pass_0_uav_tex_space[] = {0, 0}; +static const char *fi_game_motion_vector_field_pass_0_sampler_names[] = {"s_LinearClamp"}; +static const uint32_t fi_game_motion_vector_field_pass_0_sampler_bind[] = {1000}; +static const uint32_t fi_game_motion_vector_field_pass_0_sampler_count[] = {1}; +static const uint32_t fi_game_motion_vector_field_pass_0_sampler_space[] = {0}; + +static const uint32_t fi_optical_flow_vector_field_pass_0_spv[3418] = { + 0x7230203,0x10500,0x8000b,0xc74,0x0,0x20011,0x1,0x6000b,0x1,0x4c534c47,0x6474732e,0x3035342e, + 0x0,0x3000e,0x0,0x1,0xd000f,0x5,0x4,0x6e69616d,0x0,0x13a,0x171,0x175, + 0x17e,0x189,0x1a2,0x1a9,0x3d7,0x60010,0x4,0x11,0x8,0x8,0x1,0x30003, + 0x2,0x1c2,0xb0004,0x455f4c47,0x735f5458,0x6c706d61,0x656c7265,0x745f7373,0x75747865,0x665f6572,0x74636e75,0x736e6f69, + 0x0,0xb0004,0x455f4c47,0x735f5458,0x65646168,0x78655f72,0x63696c70,0x615f7469,0x68746972,0x6974656d,0x79745f63,0x736570, + 0xa0004,0x475f4c47,0x4c474f4f,0x70635f45,0x74735f70,0x5f656c79,0x656e696c,0x7269645f,0x69746365,0x6576,0x80004,0x475f4c47, + 0x4c474f4f,0x6e695f45,0x64756c63,0x69645f65,0x74636572,0x657669,0x40005,0x4,0x6e69616d,0x0,0x40005,0x138, + 0x49466263,0x745f,0x80006,0x138,0x0,0x6974706f,0x466c6163,0x53776f6c,0x656c6163,0x0,0x90006,0x138, + 0x1,0x6974706f,0x466c6163,0x42776f6c,0x6b636f6c,0x657a6953,0x0,0x90006,0x138,0x2,0x65746e69,0x6c6f7072, + 0x6f697461,0x6365526e,0x7a695374,0x65,0xa0006,0x138,0x3,0x6b636162,0x66667542,0x72547265,0x66736e61,0x75467265, + 0x6974636e,0x6e6f,0x70006,0x138,0x4,0x4d6e696d,0x754c7861,0x616e696d,0x65636e,0x40005,0x13a,0x49466263, + 0x0,0xa0005,0x171,0x72705f72,0x6f697665,0x695f7375,0x7265746e,0x616c6f70,0x6e6f6974,0x756f735f,0x656372,0x60005, + 0x175,0x694c5f73,0x7261656e,0x6d616c43,0x70,0xa0005,0x17e,0x75635f72,0x6e657272,0x6e695f74,0x70726574,0x74616c6f, + 0x5f6e6f69,0x72756f73,0x6563,0x60005,0x189,0x706f5f72,0x61636974,0x6c665f6c,0x776f,0xc0005,0x1a2,0x6f5f7772, + 0x63697470,0x665f6c61,0x5f776f6c,0x69746f6d,0x765f6e6f,0x6f746365,0x69665f72,0x5f646c65,0x78,0xc0005,0x1a9,0x6f5f7772, + 0x63697470,0x665f6c61,0x5f776f6c,0x69746f6d,0x765f6e6f,0x6f746365,0x69665f72,0x5f646c65,0x79,0x80005,0x3d7,0x475f6c67, + 0x61626f6c,0x766e496c,0x7461636f,0x496e6f69,0x44,0x30047,0x138,0x2,0x50048,0x138,0x0,0x23, + 0x50,0x50048,0x138,0x1,0x23,0x58,0x50048,0x138,0x2,0x23,0x78,0x50048, + 0x138,0x3,0x23,0x8c,0x50048,0x138,0x4,0x23,0x90,0x40047,0x13a,0x21, + 0x8,0x40047,0x13a,0x22,0x0,0x40047,0x171,0x21,0x3,0x40047,0x171,0x22, + 0x0,0x40047,0x175,0x21,0x3e8,0x40047,0x175,0x22,0x0,0x40047,0x17e,0x21, + 0x4,0x40047,0x17e,0x22,0x0,0x40047,0x189,0x21,0x0,0x40047,0x189,0x22, + 0x0,0x40047,0x1a2,0x21,0x6,0x40047,0x1a2,0x22,0x0,0x40047,0x1a9,0x21, + 0x7,0x40047,0x1a9,0x22,0x0,0x40047,0x3d7,0xb,0x1c,0x40047,0x3e7,0xb, + 0x19,0x20013,0x2,0x30021,0x3,0x2,0x40015,0x6,0x20,0x0,0x30016,0x8, + 0x20,0x40017,0x12,0x8,0x3,0x40017,0x20,0x8,0x2,0x40015,0x45,0x20, + 0x1,0x40017,0x46,0x45,0x2,0x40020,0x60,0x7,0x46,0x40017,0x69,0x6, + 0x2,0x4002b,0x6,0x83,0x4,0x4001c,0x84,0x46,0x83,0x20014,0x8c,0x4002b, + 0x8,0xb1,0x0,0x4002b,0x8,0xbb,0x3f800000,0x4002b,0x8,0xf9,0x3c4fcd9e,0x4002b, + 0x8,0xfe,0x3f560008,0x4002b,0x8,0x104,0x4196d014,0x4002b,0x8,0x107,0x41958000,0x4002b, + 0x8,0x10e,0x40c8e061,0x4002b,0x8,0x115,0x3d25aee6,0x4002b,0x8,0x116,0x3d9e8391,0x4002b, + 0x8,0x117,0x4019999a,0x4002b,0x8,0x11a,0x3f72a76e,0x4002b,0x8,0x11b,0x3d558919,0x40017, + 0x137,0x8,0x4,0x7001e,0x138,0x20,0x45,0x46,0x6,0x20,0x40020,0x139, + 0x2,0x138,0x4003b,0x139,0x13a,0x2,0x40020,0x13c,0x2,0x46,0x40020,0x143, + 0x2,0x20,0x40020,0x149,0x2,0x45,0x4002b,0x45,0x154,0x1,0x40020,0x15e, + 0x2,0x6,0x4002b,0x6,0x164,0x0,0x40020,0x165,0x2,0x8,0x4002b,0x6, + 0x16a,0x1,0x90019,0x16f,0x8,0x1,0x0,0x0,0x0,0x1,0x0,0x40020, + 0x170,0x0,0x16f,0x4003b,0x170,0x171,0x0,0x2001a,0x173,0x40020,0x174,0x0, + 0x173,0x4003b,0x174,0x175,0x0,0x3001b,0x177,0x16f,0x4003b,0x170,0x17e,0x0, + 0x90019,0x187,0x45,0x1,0x0,0x0,0x0,0x1,0x0,0x40020,0x188,0x0, + 0x187,0x4003b,0x188,0x189,0x0,0x4002b,0x45,0x18c,0x0,0x40017,0x18d,0x45, + 0x4,0x90019,0x1a0,0x6,0x1,0x0,0x0,0x0,0x2,0x21,0x40020,0x1a1, + 0x0,0x1a0,0x4003b,0x1a1,0x1a2,0x0,0x40020,0x1a6,0xb,0x6,0x4003b,0x1a1, + 0x1a9,0x0,0x4002b,0x8,0x1b0,0x3e59b3d0,0x4002b,0x8,0x1b1,0x3f371759,0x4002b,0x8, + 0x1b2,0x3d93dd98,0x6002c,0x12,0x1b3,0x1b0,0x1b1,0x1b2,0x4002b,0x8,0x1b8,0x3e86809d, + 0x4002b,0x8,0x1bc,0x3f2d9168,0x4002b,0x8,0x1c1,0x3d72e48f,0x4002b,0x8,0x1e9,0x461c4000, + 0x4002b,0x8,0x21b,0x3f000000,0x5002c,0x20,0x21c,0x21b,0x21b,0x5002c,0x46,0x229, + 0x18c,0x18c,0x5002c,0x46,0x22b,0x154,0x18c,0x5002c,0x46,0x22d,0x18c,0x154, + 0x5002c,0x46,0x230,0x154,0x154,0x40017,0x255,0x8c,0x2,0x4002b,0x6,0x286, + 0x80000000,0x4002b,0x6,0x289,0x3ff,0x4002b,0x6,0x28b,0x15,0x4002b,0x6,0x28f, + 0x1f,0x4002b,0x6,0x291,0x10,0x4002b,0x8,0x2bd,0x3a83126f,0x4002b,0x8,0x2d4, + 0x3d4ccccd,0x4002b,0x8,0x2da,0x447fc000,0x4002b,0x8,0x2e9,0x41f80000,0x4002b,0x45,0x30f, + 0x4,0x5002c,0x20,0x329,0xb1,0xb1,0x4002b,0x8,0x35b,0x44000000,0x4002b,0x8, + 0x3b2,0x3fa00000,0x40017,0x3d5,0x6,0x3,0x40020,0x3d6,0x1,0x3d5,0x4003b,0x3d6, + 0x3d7,0x1,0x4002b,0x6,0x3e6,0x8,0x6002c,0x3d5,0x3e7,0x3e6,0x3e6,0x16a, + 0x40020,0xb81,0x7,0x84,0x30001,0x12,0xbdf,0x4002b,0x45,0xc51,0xffffffff,0x5002c, + 0x20,0xc53,0xbb,0xbb,0x6002c,0x12,0xc54,0x115,0x115,0x115,0x6002c,0x12, + 0xc55,0xb1,0xb1,0xb1,0x6002c,0x12,0xc56,0xbb,0xbb,0xbb,0x6002c,0x12, + 0xc57,0x116,0x116,0x116,0x6002c,0x12,0xc58,0x11a,0x11a,0x11a,0x6002c,0x12, + 0xc59,0x11b,0x11b,0x11b,0x6002c,0x12,0xc5a,0x117,0x117,0x117,0x6002c,0x12, + 0xc5b,0xf9,0xf9,0xf9,0x6002c,0x12,0xc5c,0xfe,0xfe,0xfe,0x6002c,0x12, + 0xc5d,0x104,0x104,0x104,0x6002c,0x12,0xc5e,0x107,0x107,0x107,0x6002c,0x12, + 0xc5f,0x10e,0x10e,0x10e,0x7002c,0x84,0xc60,0x229,0x22b,0x22d,0x230,0x4002b, + 0x8,0xc61,0x3c4ccccd,0x4002b,0x8,0xc62,0xff800000,0x6002c,0x12,0xc63,0xc62,0xc62, + 0xc62,0x4002b,0x6,0xc72,0x2,0x4002b,0x6,0xc73,0x3,0x50036,0x2,0x4, + 0x0,0x3,0x200f8,0x5,0x4003b,0xb81,0xb9c,0x7,0x4003d,0x3d5,0x3d8,0x3d7, + 0x7004f,0x69,0x3d9,0x3d8,0x3d8,0x0,0x1,0x4007c,0x46,0x3da,0x3d9,0x200f9, + 0x411,0x200f8,0x411,0x700f5,0x20,0xbd1,0x329,0x5,0xc40,0x442,0x700f5,0x8, + 0xbd0,0xb1,0x5,0xc41,0x442,0x700f5,0x45,0xbce,0xc51,0x5,0x444,0x442, + 0x500b3,0x8c,0x415,0xbce,0x154,0x400f6,0x445,0x442,0x0,0x400fa,0x415,0x416, + 0x445,0x200f8,0x416,0x200f9,0x419,0x200f8,0x419,0x700f5,0x8,0xc41,0xbd0,0x416, + 0x43d,0x41e,0x700f5,0x20,0xc40,0xbd1,0x416,0x43a,0x41e,0x700f5,0x45,0xc3c, + 0xc51,0x416,0x440,0x41e,0x500b3,0x8c,0x41d,0xc3c,0x154,0x400f6,0x441,0x41e, + 0x0,0x400fa,0x41d,0x41e,0x441,0x200f8,0x41e,0x50050,0x46,0x422,0xc3c,0xbce, + 0x50080,0x46,0x423,0x3da,0x422,0x4003d,0x187,0x495,0x189,0x7005f,0x18d,0x497, + 0x495,0x423,0x1002,0x18c,0x7004f,0x46,0x498,0x497,0x497,0x0,0x1,0x4006f, + 0x20,0x499,0x498,0x50041,0x143,0x49e,0x13a,0x164,0x4003d,0x20,0x49f,0x49e, + 0x50085,0x20,0x49b,0x499,0x49f,0x50041,0x13c,0x4ae,0x13a,0xc72,0x4003d,0x46, + 0x4af,0x4ae,0x4006f,0x20,0x42b,0x4af,0x50085,0x20,0x42c,0x49b,0x42b,0x6000c, + 0x8,0x42d,0x1,0x42,0x42c,0x50083,0x8,0x42f,0x35b,0x42d,0x7000c,0x8, + 0x4b4,0x1,0x28,0xb1,0x42f,0x500ba,0x8c,0x432,0x42d,0xbb,0x600a9,0x8, + 0x433,0x432,0xbb,0xb1,0x50085,0x8,0x434,0x4b4,0x433,0x5008e,0x20,0x438, + 0x49b,0x434,0x50081,0x20,0x43a,0xc40,0x438,0x50081,0x8,0x43d,0xc41,0x434, + 0x50080,0x45,0x440,0xc3c,0x154,0x200f9,0x419,0x200f8,0x441,0x200f9,0x442,0x200f8, + 0x442,0x50080,0x45,0x444,0xbce,0x154,0x200f9,0x411,0x200f8,0x445,0x50050,0x20, + 0x448,0xbd0,0xbd0,0x50088,0x20,0x449,0xbd1,0x448,0x200f9,0x44c,0x200f8,0x44c, + 0x700f5,0x20,0xbd5,0x329,0x445,0xc3a,0x483,0x700f5,0x8,0xbd4,0xb1,0x445, + 0xc3b,0x483,0x700f5,0x45,0xbd2,0xc51,0x445,0x485,0x483,0x500b3,0x8c,0x450, + 0xbd2,0x154,0x400f6,0x486,0x483,0x0,0x400fa,0x450,0x451,0x486,0x200f8,0x451, + 0x200f9,0x454,0x200f8,0x454,0x700f5,0x8,0xc3b,0xbd4,0x451,0x47e,0x459,0x700f5, + 0x20,0xc3a,0xbd5,0x451,0x47b,0x459,0x700f5,0x45,0xc34,0xc51,0x451,0x481, + 0x459,0x500b3,0x8c,0x458,0xc34,0x154,0x400f6,0x482,0x459,0x0,0x400fa,0x458, + 0x459,0x482,0x200f8,0x459,0x50050,0x46,0x45d,0xc34,0xbd2,0x50080,0x46,0x45e, + 0x3da,0x45d,0x4003d,0x187,0x4b7,0x189,0x7005f,0x18d,0x4b9,0x4b7,0x45e,0x1002, + 0x18c,0x7004f,0x46,0x4ba,0x4b9,0x4b9,0x0,0x1,0x4006f,0x20,0x4bb,0x4ba, + 0x50041,0x143,0x4c0,0x13a,0x164,0x4003d,0x20,0x4c1,0x4c0,0x50085,0x20,0x4bd, + 0x4bb,0x4c1,0x50041,0x13c,0x4d0,0x13a,0xc72,0x4003d,0x46,0x4d1,0x4d0,0x4006f, + 0x20,0x466,0x4d1,0x50085,0x20,0x467,0x4bd,0x466,0x6000c,0x8,0x468,0x1, + 0x42,0x467,0x50083,0x8,0x46a,0x35b,0x468,0x7000c,0x8,0x4d6,0x1,0x28, + 0xb1,0x46a,0x500ba,0x8c,0x46d,0x468,0xbb,0x600a9,0x8,0x46e,0x46d,0xbb, + 0xb1,0x50085,0x8,0x46f,0x4d6,0x46e,0x50094,0x8,0x472,0x449,0x4bd,0x7000c, + 0x8,0x4db,0x1,0x1a,0x472,0x3b2,0x7000c,0x8,0x4e0,0x1,0x28,0xb1, + 0x4db,0x50085,0x8,0x476,0x4e0,0x46f,0x5008e,0x20,0x479,0x4bd,0x476,0x50081, + 0x20,0x47b,0xc3a,0x479,0x50081,0x8,0x47e,0xc3b,0x476,0x50080,0x45,0x481, + 0xc34,0x154,0x200f9,0x454,0x200f8,0x482,0x200f9,0x483,0x200f8,0x483,0x50080,0x45, + 0x485,0xbd2,0x154,0x200f9,0x44c,0x200f8,0x486,0x500ba,0x8c,0x488,0xbd4,0x2bd, + 0x300f7,0x48e,0x0,0x400fa,0x488,0x489,0x48e,0x200f8,0x489,0x50050,0x20,0x48c, + 0xbd4,0xbd4,0x50088,0x20,0x48d,0xbd5,0x48c,0x200f9,0x48e,0x200f8,0x48e,0x700f5, + 0x20,0xbda,0xbd5,0x486,0x48d,0x489,0x40070,0x20,0x504,0x3d9,0x50081,0x20, + 0x506,0x504,0x21c,0x50041,0x143,0x564,0x13a,0x164,0x4003d,0x20,0x565,0x564, + 0x50088,0x20,0x567,0xc53,0x565,0x50041,0x149,0x568,0x13a,0x16a,0x4003d,0x45, + 0x569,0x568,0x50050,0x46,0x56a,0x569,0x569,0x4006f,0x20,0x56b,0x56a,0x50088, + 0x20,0x56c,0x567,0x56b,0x4006e,0x46,0x56d,0x56c,0x50084,0x46,0x560,0x56d, + 0x230,0x4006f,0x20,0x508,0x560,0x50088,0x20,0x509,0x506,0x508,0x5008e,0x20, + 0x50b,0xbda,0x21b,0x50081,0x20,0x50e,0x509,0xbda,0x4003d,0x16f,0x571,0x171, + 0x4003d,0x173,0x572,0x175,0x50056,0x177,0x573,0x571,0x572,0x70058,0x137,0x575, + 0x573,0x50e,0x2,0xb1,0x8004f,0x12,0x576,0x575,0x575,0x0,0x1,0x2, + 0x4003d,0x16f,0x579,0x17e,0x4003d,0x173,0x57a,0x175,0x50056,0x177,0x57b,0x579, + 0x57a,0x70058,0x137,0x57d,0x57b,0x509,0x2,0xb1,0x8004f,0x12,0x57e,0x57d, + 0x57d,0x0,0x1,0x2,0x50041,0x15e,0x599,0x13a,0xc73,0x4003d,0x6,0x59a, + 0x599,0x300f7,0x595,0x0,0x900fb,0x59a,0x595,0x0,0x589,0x1,0x58d,0x2, + 0x591,0x200f8,0x589,0x300f7,0x5b2,0x0,0x900fb,0x59a,0x5b2,0x0,0x5a4,0x1, + 0x5a7,0x2,0x5ad,0x200f8,0x5a4,0x50083,0x12,0x5c3,0x576,0xc54,0x50085,0x12, + 0x5dc,0x5c3,0xc63,0x8000c,0x12,0x5ed,0x1,0x2b,0x5dc,0xc55,0xc56,0x50085, + 0x12,0x5c8,0x576,0xc57,0x50085,0x12,0x5cc,0x576,0xc58,0x50081,0x12,0x5cf, + 0x5cc,0xc59,0x7000c,0x12,0x5d2,0x1,0x1a,0x5cf,0xc5a,0x4007f,0x12,0x5fa, + 0x5ed,0x50085,0x12,0x5fc,0x5fa,0x5d2,0x50081,0x12,0x5fe,0x5fc,0x5d2,0x50085, + 0x12,0x601,0x5ed,0x5c8,0x50081,0x12,0x603,0x601,0x5fe,0x200f9,0x5b2,0x200f8, + 0x5a7,0x7000c,0x12,0x60f,0x1,0x1a,0x576,0xc5b,0x50083,0x12,0x612,0x60f, + 0xc5c,0x8000c,0x12,0x62b,0x1,0x2b,0x612,0xc55,0xc56,0x50085,0x12,0x617, + 0xc5e,0x60f,0x50083,0x12,0x618,0xc5d,0x617,0x50088,0x12,0x619,0x62b,0x618, + 0x7000c,0x12,0x61b,0x1,0x1a,0x619,0xc5f,0x60041,0x165,0x642,0x13a,0x83, + 0x16a,0x4003d,0x8,0x643,0x642,0x50088,0x8,0x5ab,0x1e9,0x643,0x5008e,0x12, + 0x5ac,0x61b,0x5ab,0x200f9,0x5b2,0x200f8,0x5ad,0x60041,0x165,0x646,0x13a,0x83, + 0x164,0x4003d,0x8,0x647,0x646,0x60041,0x165,0x64a,0x13a,0x83,0x16a,0x4003d, + 0x8,0x64b,0x64a,0x50085,0x8,0x653,0x647,0xc61,0x60050,0x12,0x660,0x653, + 0x653,0x653,0x50083,0x12,0x655,0x576,0x660,0x50083,0x8,0x659,0x64b,0x647, + 0x50085,0x8,0x65a,0x659,0xc61,0x60050,0x12,0x664,0x65a,0x65a,0x65a,0x50088, + 0x12,0x65c,0x655,0x664,0x200f9,0x5b2,0x200f8,0x5b2,0xb00f5,0x12,0xbe4,0xbdf, + 0x589,0x603,0x5a4,0x5ac,0x5a7,0x65c,0x5ad,0x50094,0x8,0x668,0xbe4,0x1b3, + 0x200f9,0x595,0x200f8,0x58d,0x300f7,0x680,0x0,0x900fb,0x59a,0x680,0x0,0x672, + 0x1,0x675,0x2,0x67b,0x200f8,0x672,0x50083,0x12,0x691,0x576,0xc54,0x50085, + 0x12,0x6aa,0x691,0xc63,0x8000c,0x12,0x6bb,0x1,0x2b,0x6aa,0xc55,0xc56, + 0x50085,0x12,0x696,0x576,0xc57,0x50085,0x12,0x69a,0x576,0xc58,0x50081,0x12, + 0x69d,0x69a,0xc59,0x7000c,0x12,0x6a0,0x1,0x1a,0x69d,0xc5a,0x4007f,0x12, + 0x6c8,0x6bb,0x50085,0x12,0x6ca,0x6c8,0x6a0,0x50081,0x12,0x6cc,0x6ca,0x6a0, + 0x50085,0x12,0x6cf,0x6bb,0x696,0x50081,0x12,0x6d1,0x6cf,0x6cc,0x200f9,0x680, + 0x200f8,0x675,0x7000c,0x12,0x6dd,0x1,0x1a,0x576,0xc5b,0x50083,0x12,0x6e0, + 0x6dd,0xc5c,0x8000c,0x12,0x6f9,0x1,0x2b,0x6e0,0xc55,0xc56,0x50085,0x12, + 0x6e5,0xc5e,0x6dd,0x50083,0x12,0x6e6,0xc5d,0x6e5,0x50088,0x12,0x6e7,0x6f9, + 0x6e6,0x7000c,0x12,0x6e9,0x1,0x1a,0x6e7,0xc5f,0x60041,0x165,0x710,0x13a, + 0x83,0x16a,0x4003d,0x8,0x711,0x710,0x50088,0x8,0x679,0x1e9,0x711,0x5008e, + 0x12,0x67a,0x6e9,0x679,0x200f9,0x680,0x200f8,0x67b,0x60041,0x165,0x714,0x13a, + 0x83,0x164,0x4003d,0x8,0x715,0x714,0x60041,0x165,0x718,0x13a,0x83,0x16a, + 0x4003d,0x8,0x719,0x718,0x50085,0x8,0x721,0x715,0xc61,0x60050,0x12,0x72e, + 0x721,0x721,0x721,0x50083,0x12,0x723,0x576,0x72e,0x50083,0x8,0x727,0x719, + 0x715,0x50085,0x8,0x728,0x727,0xc61,0x60050,0x12,0x732,0x728,0x728,0x728, + 0x50088,0x12,0x72a,0x723,0x732,0x200f9,0x680,0x200f8,0x680,0xb00f5,0x12,0xbe0, + 0xbdf,0x58d,0x6d1,0x672,0x67a,0x675,0x72a,0x67b,0x50051,0x8,0x737,0xbe0, + 0x0,0x50085,0x8,0x738,0x1b8,0x737,0x50051,0x8,0x73a,0xbe0,0x1,0x50085, + 0x8,0x73b,0x1bc,0x73a,0x50081,0x8,0x73c,0x738,0x73b,0x50051,0x8,0x73e, + 0xbe0,0x2,0x50085,0x8,0x73f,0x1c1,0x73e,0x50081,0x8,0x740,0x73c,0x73f, + 0x200f9,0x595,0x200f8,0x591,0x300f7,0x759,0x0,0x900fb,0x59a,0x759,0x0,0x74b, + 0x1,0x74e,0x2,0x754,0x200f8,0x74b,0x50083,0x12,0x76a,0x576,0xc54,0x50085, + 0x12,0x783,0x76a,0xc63,0x8000c,0x12,0x794,0x1,0x2b,0x783,0xc55,0xc56, + 0x50085,0x12,0x76f,0x576,0xc57,0x50085,0x12,0x773,0x576,0xc58,0x50081,0x12, + 0x776,0x773,0xc59,0x7000c,0x12,0x779,0x1,0x1a,0x776,0xc5a,0x4007f,0x12, + 0x7a1,0x794,0x50085,0x12,0x7a3,0x7a1,0x779,0x50081,0x12,0x7a5,0x7a3,0x779, + 0x50085,0x12,0x7a8,0x794,0x76f,0x50081,0x12,0x7aa,0x7a8,0x7a5,0x200f9,0x759, + 0x200f8,0x74e,0x7000c,0x12,0x7b6,0x1,0x1a,0x576,0xc5b,0x50083,0x12,0x7b9, + 0x7b6,0xc5c,0x8000c,0x12,0x7d2,0x1,0x2b,0x7b9,0xc55,0xc56,0x50085,0x12, + 0x7be,0xc5e,0x7b6,0x50083,0x12,0x7bf,0xc5d,0x7be,0x50088,0x12,0x7c0,0x7d2, + 0x7bf,0x7000c,0x12,0x7c2,0x1,0x1a,0x7c0,0xc5f,0x60041,0x165,0x7e9,0x13a, + 0x83,0x16a,0x4003d,0x8,0x7ea,0x7e9,0x50088,0x8,0x752,0x1e9,0x7ea,0x5008e, + 0x12,0x753,0x7c2,0x752,0x200f9,0x759,0x200f8,0x754,0x60041,0x165,0x7ed,0x13a, + 0x83,0x164,0x4003d,0x8,0x7ee,0x7ed,0x60041,0x165,0x7f1,0x13a,0x83,0x16a, + 0x4003d,0x8,0x7f2,0x7f1,0x50085,0x8,0x7fa,0x7ee,0xc61,0x60050,0x12,0x807, + 0x7fa,0x7fa,0x7fa,0x50083,0x12,0x7fc,0x576,0x807,0x50083,0x8,0x800,0x7f2, + 0x7ee,0x50085,0x8,0x801,0x800,0xc61,0x60050,0x12,0x80b,0x801,0x801,0x801, + 0x50088,0x12,0x803,0x7fc,0x80b,0x200f9,0x759,0x200f8,0x759,0xb00f5,0x12,0xbdb, + 0xbdf,0x591,0x7aa,0x74b,0x753,0x74e,0x803,0x754,0x50094,0x8,0x80f,0xbdb, + 0x1b3,0x200f9,0x595,0x200f8,0x595,0xb00f5,0x8,0xbe8,0xb1,0x48e,0x668,0x5b2, + 0x740,0x680,0x80f,0x759,0x50081,0x8,0x514,0x2bd,0xbe8,0x300f7,0x826,0x0, + 0x900fb,0x59a,0x826,0x0,0x81a,0x1,0x81e,0x2,0x822,0x200f8,0x81a,0x300f7, + 0x843,0x0,0x900fb,0x59a,0x843,0x0,0x835,0x1,0x838,0x2,0x83e,0x200f8, + 0x835,0x50083,0x12,0x854,0x57e,0xc54,0x50085,0x12,0x86d,0x854,0xc63,0x8000c, + 0x12,0x87e,0x1,0x2b,0x86d,0xc55,0xc56,0x50085,0x12,0x859,0x57e,0xc57, + 0x50085,0x12,0x85d,0x57e,0xc58,0x50081,0x12,0x860,0x85d,0xc59,0x7000c,0x12, + 0x863,0x1,0x1a,0x860,0xc5a,0x4007f,0x12,0x88b,0x87e,0x50085,0x12,0x88d, + 0x88b,0x863,0x50081,0x12,0x88f,0x88d,0x863,0x50085,0x12,0x892,0x87e,0x859, + 0x50081,0x12,0x894,0x892,0x88f,0x200f9,0x843,0x200f8,0x838,0x7000c,0x12,0x8a0, + 0x1,0x1a,0x57e,0xc5b,0x50083,0x12,0x8a3,0x8a0,0xc5c,0x8000c,0x12,0x8bc, + 0x1,0x2b,0x8a3,0xc55,0xc56,0x50085,0x12,0x8a8,0xc5e,0x8a0,0x50083,0x12, + 0x8a9,0xc5d,0x8a8,0x50088,0x12,0x8aa,0x8bc,0x8a9,0x7000c,0x12,0x8ac,0x1, + 0x1a,0x8aa,0xc5f,0x60041,0x165,0x8d3,0x13a,0x83,0x16a,0x4003d,0x8,0x8d4, + 0x8d3,0x50088,0x8,0x83c,0x1e9,0x8d4,0x5008e,0x12,0x83d,0x8ac,0x83c,0x200f9, + 0x843,0x200f8,0x83e,0x60041,0x165,0x8d7,0x13a,0x83,0x164,0x4003d,0x8,0x8d8, + 0x8d7,0x60041,0x165,0x8db,0x13a,0x83,0x16a,0x4003d,0x8,0x8dc,0x8db,0x50085, + 0x8,0x8e4,0x8d8,0xc61,0x60050,0x12,0x8f1,0x8e4,0x8e4,0x8e4,0x50083,0x12, + 0x8e6,0x57e,0x8f1,0x50083,0x8,0x8ea,0x8dc,0x8d8,0x50085,0x8,0x8eb,0x8ea, + 0xc61,0x60050,0x12,0x8f5,0x8eb,0x8eb,0x8eb,0x50088,0x12,0x8ed,0x8e6,0x8f5, + 0x200f9,0x843,0x200f8,0x843,0xb00f5,0x12,0xbfd,0xbdf,0x81a,0x894,0x835,0x83d, + 0x838,0x8ed,0x83e,0x50094,0x8,0x8f9,0xbfd,0x1b3,0x200f9,0x826,0x200f8,0x81e, + 0x300f7,0x911,0x0,0x900fb,0x59a,0x911,0x0,0x903,0x1,0x906,0x2,0x90c, + 0x200f8,0x903,0x50083,0x12,0x922,0x57e,0xc54,0x50085,0x12,0x93b,0x922,0xc63, + 0x8000c,0x12,0x94c,0x1,0x2b,0x93b,0xc55,0xc56,0x50085,0x12,0x927,0x57e, + 0xc57,0x50085,0x12,0x92b,0x57e,0xc58,0x50081,0x12,0x92e,0x92b,0xc59,0x7000c, + 0x12,0x931,0x1,0x1a,0x92e,0xc5a,0x4007f,0x12,0x959,0x94c,0x50085,0x12, + 0x95b,0x959,0x931,0x50081,0x12,0x95d,0x95b,0x931,0x50085,0x12,0x960,0x94c, + 0x927,0x50081,0x12,0x962,0x960,0x95d,0x200f9,0x911,0x200f8,0x906,0x7000c,0x12, + 0x96e,0x1,0x1a,0x57e,0xc5b,0x50083,0x12,0x971,0x96e,0xc5c,0x8000c,0x12, + 0x98a,0x1,0x2b,0x971,0xc55,0xc56,0x50085,0x12,0x976,0xc5e,0x96e,0x50083, + 0x12,0x977,0xc5d,0x976,0x50088,0x12,0x978,0x98a,0x977,0x7000c,0x12,0x97a, + 0x1,0x1a,0x978,0xc5f,0x60041,0x165,0x9a1,0x13a,0x83,0x16a,0x4003d,0x8, + 0x9a2,0x9a1,0x50088,0x8,0x90a,0x1e9,0x9a2,0x5008e,0x12,0x90b,0x97a,0x90a, + 0x200f9,0x911,0x200f8,0x90c,0x60041,0x165,0x9a5,0x13a,0x83,0x164,0x4003d,0x8, + 0x9a6,0x9a5,0x60041,0x165,0x9a9,0x13a,0x83,0x16a,0x4003d,0x8,0x9aa,0x9a9, + 0x50085,0x8,0x9b2,0x9a6,0xc61,0x60050,0x12,0x9bf,0x9b2,0x9b2,0x9b2,0x50083, + 0x12,0x9b4,0x57e,0x9bf,0x50083,0x8,0x9b8,0x9aa,0x9a6,0x50085,0x8,0x9b9, + 0x9b8,0xc61,0x60050,0x12,0x9c3,0x9b9,0x9b9,0x9b9,0x50088,0x12,0x9bb,0x9b4, + 0x9c3,0x200f9,0x911,0x200f8,0x911,0xb00f5,0x12,0xbf5,0xbdf,0x81e,0x962,0x903, + 0x90b,0x906,0x9bb,0x90c,0x50051,0x8,0x9c8,0xbf5,0x0,0x50085,0x8,0x9c9, + 0x1b8,0x9c8,0x50051,0x8,0x9cb,0xbf5,0x1,0x50085,0x8,0x9cc,0x1bc,0x9cb, + 0x50081,0x8,0x9cd,0x9c9,0x9cc,0x50051,0x8,0x9cf,0xbf5,0x2,0x50085,0x8, + 0x9d0,0x1c1,0x9cf,0x50081,0x8,0x9d1,0x9cd,0x9d0,0x200f9,0x826,0x200f8,0x822, + 0x300f7,0x9ea,0x0,0x900fb,0x59a,0x9ea,0x0,0x9dc,0x1,0x9df,0x2,0x9e5, + 0x200f8,0x9dc,0x50083,0x12,0x9fb,0x57e,0xc54,0x50085,0x12,0xa14,0x9fb,0xc63, + 0x8000c,0x12,0xa25,0x1,0x2b,0xa14,0xc55,0xc56,0x50085,0x12,0xa00,0x57e, + 0xc57,0x50085,0x12,0xa04,0x57e,0xc58,0x50081,0x12,0xa07,0xa04,0xc59,0x7000c, + 0x12,0xa0a,0x1,0x1a,0xa07,0xc5a,0x4007f,0x12,0xa32,0xa25,0x50085,0x12, + 0xa34,0xa32,0xa0a,0x50081,0x12,0xa36,0xa34,0xa0a,0x50085,0x12,0xa39,0xa25, + 0xa00,0x50081,0x12,0xa3b,0xa39,0xa36,0x200f9,0x9ea,0x200f8,0x9df,0x7000c,0x12, + 0xa47,0x1,0x1a,0x57e,0xc5b,0x50083,0x12,0xa4a,0xa47,0xc5c,0x8000c,0x12, + 0xa63,0x1,0x2b,0xa4a,0xc55,0xc56,0x50085,0x12,0xa4f,0xc5e,0xa47,0x50083, + 0x12,0xa50,0xc5d,0xa4f,0x50088,0x12,0xa51,0xa63,0xa50,0x7000c,0x12,0xa53, + 0x1,0x1a,0xa51,0xc5f,0x60041,0x165,0xa7a,0x13a,0x83,0x16a,0x4003d,0x8, + 0xa7b,0xa7a,0x50088,0x8,0x9e3,0x1e9,0xa7b,0x5008e,0x12,0x9e4,0xa53,0x9e3, + 0x200f9,0x9ea,0x200f8,0x9e5,0x60041,0x165,0xa7e,0x13a,0x83,0x164,0x4003d,0x8, + 0xa7f,0xa7e,0x60041,0x165,0xa82,0x13a,0x83,0x16a,0x4003d,0x8,0xa83,0xa82, + 0x50085,0x8,0xa8b,0xa7f,0xc61,0x60050,0x12,0xa98,0xa8b,0xa8b,0xa8b,0x50083, + 0x12,0xa8d,0x57e,0xa98,0x50083,0x8,0xa91,0xa83,0xa7f,0x50085,0x8,0xa92, + 0xa91,0xc61,0x60050,0x12,0xa9c,0xa92,0xa92,0xa92,0x50088,0x12,0xa94,0xa8d, + 0xa9c,0x200f9,0x9ea,0x200f8,0x9ea,0xb00f5,0x12,0xbed,0xbdf,0x822,0xa3b,0x9dc, + 0x9e4,0x9df,0xa94,0x9e5,0x50094,0x8,0xaa0,0xbed,0x1b3,0x200f9,0x826,0x200f8, + 0x826,0xb00f5,0x8,0xc05,0xb1,0x595,0x8f9,0x843,0x9d1,0x911,0xaa0,0x9ea, + 0x50081,0x8,0x517,0x2bd,0xc05,0x50041,0x13c,0xaa3,0x13a,0xc72,0x4003d,0x46, + 0xaa4,0xaa3,0x4006f,0x20,0x51a,0xaa4,0x50085,0x20,0x51b,0xbda,0x51a,0x6000c, + 0x8,0x51c,0x1,0x42,0x51b,0x500ba,0x8c,0x51e,0x51c,0xbb,0x600a9,0x6, + 0x51f,0x51e,0x16a,0x164,0x5008e,0x20,0x523,0x51a,0x2d4,0x6000c,0x8,0x524, + 0x1,0x42,0x523,0x50088,0x8,0x525,0x51c,0x524,0x8000c,0x8,0xaac,0x1, + 0x2b,0x525,0xb1,0xbb,0x50085,0x8,0x527,0xaac,0x2da,0x4006d,0x6,0x528, + 0x527,0x50084,0x6,0x529,0x51f,0x528,0x500ac,0x8c,0x52b,0x529,0x164,0x300f7, + 0x55b,0x0,0x400fa,0x52b,0x52c,0x55b,0x200f8,0x52c,0x7000c,0x8,0xac3,0x1, + 0x28,0x514,0x517,0x500b7,0x8c,0xab7,0xac3,0xb1,0x300f7,0xabd,0x0,0x400fa, + 0xab7,0xab8,0xabc,0x200f8,0xab8,0x7000c,0x8,0xac8,0x1,0x25,0x514,0x517, + 0x50088,0x8,0xabb,0xac8,0xac3,0x200f9,0xabd,0x200f8,0xabc,0x200f9,0xabd,0x200f8, + 0xabd,0x700f5,0x8,0xc12,0xabb,0xab8,0xb1,0xabc,0x7000c,0x8,0xacd,0x1, + 0x1a,0xc12,0xbb,0x50085,0x8,0x531,0xacd,0x2e9,0x6000c,0x8,0xad1,0x1, + 0x2,0x531,0x4006d,0x6,0x533,0xad1,0x50051,0x8,0xad5,0x50e,0x0,0x500ba, + 0x8c,0xad6,0xad5,0xb1,0x300f7,0xadb,0x0,0x400fa,0xad6,0xad7,0xadb,0x200f8, + 0xad7,0x500b8,0x8c,0xada,0xad5,0xbb,0x200f9,0xadb,0x200f8,0xadb,0x700f5,0x8c, + 0xadc,0xad6,0xabd,0xada,0xad7,0x300f7,0xae7,0x0,0x400fa,0xadc,0xadd,0xae7, + 0x200f8,0xadd,0x50051,0x8,0xadf,0x50e,0x1,0x500ba,0x8c,0xae0,0xadf,0xb1, + 0x300f7,0xae5,0x0,0x400fa,0xae0,0xae1,0xae5,0x200f8,0xae1,0x500b8,0x8c,0xae4, + 0xadf,0xbb,0x200f9,0xae5,0x200f8,0xae5,0x700f5,0x8c,0xae6,0xae0,0xadd,0xae4, + 0xae1,0x200f9,0xae7,0x200f8,0xae7,0x700f5,0x8c,0xae8,0xadc,0xadb,0xae6,0xae5, + 0x600a9,0x6,0x538,0xae8,0x16a,0x164,0x50084,0x6,0x539,0x533,0x538,0x500c7, + 0x6,0xaf4,0x529,0x289,0x500c4,0x6,0xaf5,0xaf4,0x28b,0x500c5,0x6,0xaf6, + 0x286,0xaf5,0x500c7,0x6,0xaf8,0x539,0x28f,0x500c4,0x6,0xaf9,0xaf8,0x291, + 0x500c5,0x6,0xafa,0xaf6,0xaf9,0x50051,0x8,0xafd,0x50b,0x0,0x50050,0x20, + 0xb0b,0xafd,0xb1,0x6000c,0x6,0xb0c,0x1,0x3a,0xb0b,0x500c5,0x6,0xaff, + 0xafa,0xb0c,0x50051,0x8,0xb02,0x50b,0x1,0x50050,0x20,0xb10,0xb02,0xb1, + 0x6000c,0x6,0xb11,0x1,0x3a,0xb10,0x500c5,0x6,0xb04,0xafa,0xb11,0x50081, + 0x20,0x540,0x509,0x50b,0x50085,0x20,0xb2e,0x540,0x508,0x50083,0x20,0xb2f, + 0xb2e,0x21c,0x6000c,0x20,0xb31,0x1,0x8,0xb2f,0x4006e,0x46,0xb32,0xb31, + 0x3003e,0xb9c,0xc60,0x200f9,0x543,0x200f8,0x543,0x700f5,0x45,0xc30,0x18c,0xae7, + 0x559,0x557,0x500b1,0x8c,0x546,0xc30,0x30f,0x400f6,0x55a,0x557,0x0,0x400fa, + 0x546,0x547,0x55a,0x200f8,0x547,0x50041,0x60,0xba1,0xb9c,0xc30,0x4003d,0x46, + 0x54a,0xba1,0x50080,0x46,0x54e,0xb32,0x54a,0x4007c,0x69,0xb71,0x54e,0x4007c, + 0x69,0xb73,0x560,0x500b0,0x255,0xb74,0xb71,0xb73,0x4009b,0x8c,0xb75,0xb74, + 0x300f7,0x556,0x0,0x400fa,0xb75,0x552,0x556,0x200f8,0x552,0x6003c,0x1a6,0xb7a, + 0x1a2,0x54e,0x164,0x700ef,0x6,0xb7b,0xb7a,0x16a,0x164,0xaff,0x6003c,0x1a6, + 0xb7f,0x1a9,0x54e,0x164,0x700ef,0x6,0xb80,0xb7f,0x16a,0x164,0xb04,0x200f9, + 0x556,0x200f8,0x556,0x200f9,0x557,0x200f8,0x557,0x50080,0x45,0x559,0xc30,0x154, + 0x200f9,0x543,0x200f8,0x55a,0x200f9,0x55b,0x200f8,0x55b,0x100fd,0x10038, +}; +static const char *fi_optical_flow_vector_field_pass_0_cb_names[] = {"cbFI"}; +static const uint32_t fi_optical_flow_vector_field_pass_0_cb_bind[] = {8}; +static const uint32_t fi_optical_flow_vector_field_pass_0_cb_count[] = {1}; +static const uint32_t fi_optical_flow_vector_field_pass_0_cb_space[] = {0}; +static const char *fi_optical_flow_vector_field_pass_0_srv_tex_names[] = {"r_optical_flow", "r_previous_interpolation_source", "r_current_interpolation_source"}; +static const uint32_t fi_optical_flow_vector_field_pass_0_srv_tex_bind[] = {0, 3, 4}; +static const uint32_t fi_optical_flow_vector_field_pass_0_srv_tex_count[] = {1, 1, 1}; +static const uint32_t fi_optical_flow_vector_field_pass_0_srv_tex_space[] = {0, 0, 0}; +static const char *fi_optical_flow_vector_field_pass_0_uav_tex_names[] = {"rw_optical_flow_motion_vector_field_x", "rw_optical_flow_motion_vector_field_y"}; +static const uint32_t fi_optical_flow_vector_field_pass_0_uav_tex_bind[] = {6, 7}; +static const uint32_t fi_optical_flow_vector_field_pass_0_uav_tex_count[] = {1, 1}; +static const uint32_t fi_optical_flow_vector_field_pass_0_uav_tex_space[] = {0, 0}; +static const char *fi_optical_flow_vector_field_pass_0_sampler_names[] = {"s_LinearClamp"}; +static const uint32_t fi_optical_flow_vector_field_pass_0_sampler_bind[] = {1000}; +static const uint32_t fi_optical_flow_vector_field_pass_0_sampler_count[] = {1}; +static const uint32_t fi_optical_flow_vector_field_pass_0_sampler_space[] = {0}; + +static const uint32_t fi_disocclusion_mask_pass_0_spv[2587] = { + 0x7230203,0x10500,0x8000b,0xc53,0x0,0x20011,0x1,0x20011,0x31,0x6000b,0x1,0x4c534c47, + 0x6474732e,0x3035342e,0x0,0x3000e,0x0,0x1,0x10000f,0x5,0x4,0x6e69616d,0x0,0xc6, + 0xd5,0xdf,0xe9,0xf3,0xf9,0x103,0x10b,0x10f,0x11a,0x3cf,0x60010,0x4, + 0x11,0x8,0x8,0x1,0x30003,0x2,0x1c2,0xb0004,0x455f4c47,0x735f5458,0x6c706d61,0x656c7265, + 0x745f7373,0x75747865,0x665f6572,0x74636e75,0x736e6f69,0x0,0xb0004,0x455f4c47,0x735f5458,0x65646168,0x78655f72,0x63696c70, + 0x615f7469,0x68746972,0x6974656d,0x79745f63,0x736570,0xa0004,0x475f4c47,0x4c474f4f,0x70635f45,0x74735f70,0x5f656c79,0x656e696c, + 0x7269645f,0x69746365,0x6576,0x80004,0x475f4c47,0x4c474f4f,0x6e695f45,0x64756c63,0x69645f65,0x74636572,0x657669,0x40005, + 0x4,0x6e69616d,0x0,0x40005,0xc4,0x49466263,0x745f,0x60006,0xc4,0x0,0x646e6572,0x69537265, + 0x657a,0x80006,0xc4,0x1,0x76654466,0x54656369,0x6569566f,0x70654477,0x6874,0x40005,0xc6,0x49466263, + 0x0,0x60005,0xd5,0x69645f72,0x6574616c,0x65645f64,0x687470,0xc0005,0xdf,0x65725f72,0x736e6f63,0x63757274, + 0x5f646574,0x74706564,0x72705f68,0x6f697665,0x665f7375,0x656d6172,0x0,0xd0005,0xe9,0x65725f72,0x736e6f63,0x63757274, + 0x5f646574,0x74706564,0x6e695f68,0x70726574,0x74616c6f,0x665f6465,0x656d6172,0x0,0xa0005,0xf3,0x61675f72,0x6d5f656d, + 0x6f69746f,0x65765f6e,0x726f7463,0x6569665f,0x785f646c,0x0,0xa0005,0xf9,0x61675f72,0x6d5f656d,0x6f69746f,0x65765f6e, + 0x726f7463,0x6569665f,0x795f646c,0x0,0x80005,0x103,0x6e695f72,0x6e696170,0x676e6974,0x7279705f,0x64696d61,0x0, + 0x90005,0x10b,0x6e695f72,0x5f747570,0x74736964,0x6974726f,0x665f6e6f,0x646c6569,0x0,0x60005,0x10f,0x694c5f73, + 0x7261656e,0x6d616c43,0x70,0x80005,0x11a,0x645f7772,0x636f7369,0x73756c63,0x5f6e6f69,0x6b73616d,0x0,0x80005, + 0x3cf,0x475f6c67,0x61626f6c,0x766e496c,0x7461636f,0x496e6f69,0x44,0x30047,0xc4,0x2,0x50048,0xc4, + 0x0,0x23,0x0,0x50048,0xc4,0x1,0x23,0x30,0x40047,0xc6,0x21,0x8, + 0x40047,0xc6,0x22,0x0,0x40047,0xd5,0x21,0x3,0x40047,0xd5,0x22,0x0, + 0x40047,0xdf,0x21,0x2,0x40047,0xdf,0x22,0x0,0x40047,0xe9,0x21,0x4, + 0x40047,0xe9,0x22,0x0,0x40047,0xf3,0x21,0x0,0x40047,0xf3,0x22,0x0, + 0x40047,0xf9,0x21,0x1,0x40047,0xf9,0x22,0x0,0x40047,0x103,0x21,0x5, + 0x40047,0x103,0x22,0x0,0x40047,0x10b,0x21,0x6,0x40047,0x10b,0x22,0x0, + 0x40047,0x10f,0x21,0x3e8,0x40047,0x10f,0x22,0x0,0x40047,0x11a,0x21,0x7, + 0x40047,0x11a,0x22,0x0,0x40047,0x3cf,0xb,0x1c,0x40047,0x3de,0xb,0x19, + 0x20013,0x2,0x30021,0x3,0x2,0x40015,0x6,0x20,0x0,0x30016,0x8,0x20, + 0x40020,0xd,0x7,0x8,0x40017,0xe,0x8,0x2,0x40015,0x2f,0x20,0x1, + 0x40017,0x30,0x2f,0x2,0x40017,0x34,0x8,0x4,0x40020,0x38,0x7,0x30, + 0x40017,0x43,0x6,0x2,0x4002b,0x6,0x57,0x4,0x4001c,0x58,0x30,0x57, + 0x4001c,0x59,0x8,0x57,0x40017,0x68,0x8,0x3,0x20014,0x6f,0x4002b,0x8, + 0xad,0x0,0x4002b,0x8,0xae,0x3f800000,0x4001e,0xc4,0x30,0x34,0x40020,0xc5, + 0x2,0xc4,0x4003b,0xc5,0xc6,0x2,0x4002b,0x2f,0xc7,0x0,0x40020,0xc8, + 0x2,0x30,0x40020,0xce,0x2,0x34,0x90019,0xd3,0x8,0x1,0x0,0x0, + 0x0,0x1,0x0,0x40020,0xd4,0x0,0xd3,0x4003b,0xd4,0xd5,0x0,0x90019, + 0xdd,0x6,0x1,0x0,0x0,0x0,0x1,0x0,0x40020,0xde,0x0,0xdd, + 0x4003b,0xde,0xdf,0x0,0x40017,0xe2,0x6,0x4,0x4003b,0xde,0xe9,0x0, + 0x4003b,0xde,0xf3,0x0,0x4003b,0xde,0xf9,0x0,0x4003b,0xd4,0x103,0x0, + 0x4003b,0xd4,0x10b,0x0,0x2001a,0x10d,0x40020,0x10e,0x0,0x10d,0x4003b,0x10e, + 0x10f,0x0,0x3001b,0x111,0xd3,0x90019,0x118,0x8,0x1,0x0,0x0,0x0, + 0x2,0xd,0x40020,0x119,0x0,0x118,0x4003b,0x119,0x11a,0x0,0x4002b,0x8, + 0x126,0x3f000000,0x5002c,0xe,0x127,0x126,0x126,0x4002b,0x2f,0x12b,0x2,0x5002c, + 0x30,0x134,0xc7,0xc7,0x4002b,0x2f,0x136,0x1,0x5002c,0x30,0x137,0x136, + 0xc7,0x5002c,0x30,0x139,0xc7,0x136,0x5002c,0x30,0x13c,0x136,0x136,0x4002b, + 0x6,0x141,0x1,0x4002b,0x8,0x16e,0x40000000,0x4002b,0x8,0x16f,0xc0000000,0x5002c, + 0xe,0x170,0x16e,0x16f,0x4002b,0x8,0x172,0xbf800000,0x5002c,0xe,0x173,0x172, + 0xae,0x40017,0x1a0,0x6f,0x2,0x4002b,0x6,0x1c4,0x15,0x4002b,0x6,0x1c6, + 0x3ff,0x4002b,0x2f,0x1d6,0x4,0x7002c,0x34,0x209,0xad,0xad,0xad,0xad, + 0x4002b,0x2f,0x26a,0xb,0x4002b,0x8,0x2f0,0x3a83126f,0x4002b,0x8,0x330,0x3765d90d, + 0x5002c,0xe,0x397,0xad,0xad,0x5002c,0xe,0x398,0xae,0xae,0x40017,0x3cd, + 0x6,0x3,0x40020,0x3ce,0x1,0x3cd,0x4003b,0x3ce,0x3cf,0x1,0x4002b,0x6, + 0x3dd,0x8,0x6002c,0x3cd,0x3de,0x3dd,0x3dd,0x141,0x40020,0x9e7,0x7,0x58, + 0x40020,0x9e9,0x7,0x59,0x7002c,0x58,0xbfa,0x134,0x137,0x139,0x13c,0x5002c, + 0x30,0xbfb,0x12b,0x12b,0x5002c,0xe,0xbfc,0x2f0,0x2f0,0x4002b,0x8,0xbfd, + 0x3a802008,0x50036,0x2,0x4,0x0,0x3,0x200f8,0x5,0x4003b,0x9e9,0xa45,0x7, + 0x4003b,0x9e7,0xa44,0x7,0x4003b,0x9e9,0xa24,0x7,0x4003b,0x9e7,0xa23,0x7, + 0x4003b,0x9e9,0xa03,0x7,0x4003b,0x9e7,0xa02,0x7,0x4003d,0x3cd,0x3d0,0x3cf, + 0x7004f,0x43,0x3d1,0x3d0,0x3d0,0x0,0x1,0x4007c,0x30,0x3d2,0x3d1,0x4003d, + 0xdd,0x450,0xe9,0x7005f,0xe2,0x452,0x450,0x3d2,0x2002,0xc7,0x50051,0x6, + 0x453,0x452,0x0,0x4007c,0x8,0x458,0x453,0x4006f,0xe,0x405,0x3d2,0x50081, + 0xe,0x407,0x405,0x127,0x50041,0xc8,0x45b,0xc6,0xc7,0x4003d,0x30,0x45c, + 0x45b,0x4006f,0xe,0x409,0x45c,0x50088,0xe,0x40a,0x407,0x409,0x4006e,0x30, + 0x47c,0x407,0x4003d,0xdd,0x4c2,0xf3,0x7005f,0xe2,0x4c4,0x4c2,0x47c,0x2002, + 0xc7,0x50051,0x6,0x4c5,0x4c4,0x0,0x4003d,0xdd,0x4c6,0xf9,0x7005f,0xe2, + 0x4c8,0x4c6,0x47c,0x2002,0xc7,0x50051,0x6,0x4c9,0x4c8,0x0,0x500c2,0x6, + 0x4d3,0x4c5,0x1c4,0x500c7,0x6,0x4d4,0x4d3,0x1c6,0x40070,0x8,0x4d5,0x4d4, + 0x50085,0x8,0x4d6,0x4d5,0xbfd,0x6000c,0xe,0x50b,0x1,0x3e,0x4c5,0x50051, + 0x8,0x4fb,0x50b,0x0,0x6000c,0xe,0x50f,0x1,0x3e,0x4c9,0x50051,0x8, + 0x500,0x50f,0x0,0x50050,0xe,0xc52,0x4fb,0x500,0x500bd,0x6f,0x484,0x4d6, + 0xad,0x300f7,0x4a7,0x0,0x400fa,0x484,0x485,0x4a7,0x200f8,0x485,0x200f9,0x487, + 0x200f8,0x487,0x700f5,0x34,0xc4e,0x209,0x485,0x55b,0x499,0x700f5,0x30,0xb9c, + 0x45c,0x485,0x494,0x499,0x700f5,0x2f,0xb15,0xc7,0x485,0x49b,0x499,0x400f6, + 0x49c,0x499,0x0,0x200f9,0x488,0x200f8,0x488,0x500b1,0x6f,0x48a,0xb15,0x26a, + 0x300f7,0x48f,0x0,0x400fa,0x48a,0x48b,0x48f,0x200f8,0x48b,0x50051,0x8,0x48d, + 0xc4e,0x3,0x500b4,0x6f,0x48e,0x48d,0xad,0x200f9,0x48f,0x200f8,0x48f,0x700f5, + 0x6f,0x490,0x48a,0x488,0x48e,0x48b,0x400fa,0x490,0x491,0x49c,0x200f8,0x491, + 0x50087,0x30,0x494,0xb9c,0xbfb,0x4006f,0xe,0x565,0x494,0x50085,0xe,0x566, + 0x40a,0x565,0x50083,0xe,0x567,0x566,0x127,0x6000c,0xe,0x569,0x1,0x8, + 0x567,0x4006e,0x30,0x56a,0x569,0x6000c,0xe,0x592,0x1,0xa,0x567,0x50051, + 0x8,0x573,0x592,0x0,0x50083,0x8,0x574,0xae,0x573,0x50051,0x8,0x576, + 0x592,0x1,0x50083,0x8,0x577,0xae,0x576,0x50085,0x8,0x578,0x574,0x577, + 0x50085,0x8,0x57f,0x573,0x577,0x50085,0x8,0x586,0x574,0x576,0x50085,0x8, + 0x58c,0x573,0x576,0x70050,0x59,0xb03,0x578,0x57f,0x586,0x58c,0x3003e,0xa44, + 0xbfa,0x3003e,0xa45,0xb03,0x200f9,0x529,0x200f8,0x529,0x700f5,0x34,0xc50,0x209, + 0x491,0xc51,0x551,0x700f5,0x8,0xb9f,0xad,0x491,0xbf7,0x551,0x700f5,0x2f, + 0xb9e,0xc7,0x491,0x553,0x551,0x500b1,0x6f,0x52c,0xb9e,0x1d6,0x400f6,0x554, + 0x551,0x0,0x400fa,0x52c,0x52d,0x554,0x200f8,0x52d,0x50041,0x38,0xa4a,0xa44, + 0xb9e,0x4003d,0x30,0x530,0xa4a,0x50080,0x30,0x534,0x56a,0x530,0x4007c,0x43, + 0x596,0x534,0x4007c,0x43,0x598,0x494,0x500b0,0x1a0,0x599,0x596,0x598,0x4009b, + 0x6f,0x59a,0x599,0x300f7,0x550,0x0,0x400fa,0x59a,0x537,0x550,0x200f8,0x537, + 0x4003d,0xd3,0x59d,0x103,0x7005f,0x34,0x5a1,0x59d,0x534,0x2,0xb15,0x50051, + 0x8,0x53c,0x5a1,0x2,0x500ba,0x6f,0x53f,0x53c,0xad,0x600a9,0x8,0x540, + 0x53f,0xae,0xad,0x50041,0xd,0xa4b,0xa45,0xb9e,0x4003d,0x8,0x543,0xa4b, + 0x50085,0x8,0x545,0x543,0x540,0x50085,0x8,0x547,0x545,0x53c,0x50081,0x8, + 0x54a,0xb9f,0x547,0x5008e,0x34,0x54d,0x5a1,0x547,0x50081,0x34,0x54f,0xc50, + 0x54d,0x200f9,0x550,0x200f8,0x550,0x700f5,0x34,0xc51,0xc50,0x52d,0x54f,0x537, + 0x700f5,0x8,0xbf7,0xb9f,0x52d,0x54a,0x537,0x200f9,0x551,0x200f8,0x551,0x50080, + 0x2f,0x553,0xb9e,0x136,0x200f9,0x529,0x200f8,0x554,0x500ba,0x6f,0x556,0xb9f, + 0xad,0x600a9,0x8,0x558,0x556,0xb9f,0xae,0x70050,0x34,0x55a,0x558,0x558, + 0x558,0x558,0x50088,0x34,0x55b,0xc50,0x55a,0x200f9,0x499,0x200f8,0x499,0x50080, + 0x2f,0x49b,0xb15,0x136,0x200f9,0x487,0x200f8,0x49c,0x7004f,0xe,0x49e,0xc4e, + 0xc4e,0x0,0x1,0x200f9,0x4a7,0x200f8,0x4a7,0x700f5,0xe,0xb1b,0xc52,0x5, + 0x49e,0x49c,0x50081,0xe,0x413,0x40a,0xb1b,0x50041,0xce,0x675,0xc6,0x141, + 0x4003d,0x34,0x676,0x675,0x50051,0x8,0x66d,0x676,0x1,0x50051,0x8,0x670, + 0x676,0x0,0x50083,0x8,0x671,0x458,0x670,0x50088,0x8,0x672,0x66d,0x671, + 0x50085,0xe,0x684,0x413,0x409,0x50083,0xe,0x685,0x684,0x127,0x6000c,0xe, + 0x687,0x1,0x8,0x685,0x4006e,0x30,0x688,0x687,0x6000c,0xe,0x6b0,0x1, + 0xa,0x685,0x50051,0x8,0x691,0x6b0,0x0,0x50083,0x8,0x692,0xae,0x691, + 0x50051,0x8,0x694,0x6b0,0x1,0x50083,0x8,0x695,0xae,0x694,0x50085,0x8, + 0x696,0x692,0x695,0x50085,0x8,0x69d,0x691,0x695,0x50085,0x8,0x6a4,0x692, + 0x694,0x50085,0x8,0x6aa,0x691,0x694,0x70050,0x59,0xad7,0x696,0x69d,0x6a4, + 0x6aa,0x3003e,0xa23,0xbfa,0x3003e,0xa24,0xad7,0x200f9,0x604,0x200f8,0x604,0x700f5, + 0x8,0xb5e,0xad,0x4a7,0xbae,0x659,0x700f5,0x8,0xb5d,0xad,0x4a7,0xbab, + 0x659,0x700f5,0x2f,0xb5c,0xc7,0x4a7,0x65b,0x659,0x500b1,0x6f,0x607,0xb5c, + 0x1d6,0x400f6,0x65c,0x659,0x0,0x400fa,0x607,0x608,0x65c,0x200f8,0x608,0x50041, + 0x38,0xa29,0xa23,0xb5c,0x4003d,0x30,0x60b,0xa29,0x50080,0x30,0x60f,0x688, + 0x60b,0x4007c,0x43,0x6b8,0x60f,0x4007c,0x43,0x6ba,0x45c,0x500b0,0x1a0,0x6bb, + 0x6b8,0x6ba,0x4009b,0x6f,0x6bc,0x6bb,0x300f7,0x658,0x0,0x400fa,0x6bc,0x613, + 0x658,0x200f8,0x613,0x50041,0xd,0xa2a,0xa24,0xb5c,0x4003d,0x8,0x616,0xa2a, + 0x500ba,0x6f,0x618,0x616,0x2f0,0x300f7,0x657,0x0,0x400fa,0x618,0x619,0x657, + 0x200f8,0x619,0x4006f,0xe,0x6c9,0x60f,0x50081,0xe,0x6cb,0x6c9,0x127,0x50088, + 0xe,0x6ce,0x6cb,0x409,0x4003d,0xd3,0x6ef,0x10b,0x4003d,0x10d,0x6f0,0x10f, + 0x50056,0x111,0x6f1,0x6ef,0x6f0,0x70058,0x34,0x6f3,0x6f1,0x6ce,0x2,0xad, + 0x7004f,0xe,0x6f4,0x6f3,0x6f3,0x0,0x1,0x50085,0xe,0x6d4,0x6f4,0x409, + 0x4006e,0x30,0x6d5,0x6d4,0x50080,0x30,0x6db,0x60f,0x6d5,0x4003d,0xdd,0x6fc, + 0xdf,0x7005f,0xe2,0x6fe,0x6fc,0x6db,0x2002,0xc7,0x50051,0x6,0x6ff,0x6fe, + 0x0,0x4007c,0x8,0x704,0x6ff,0x50083,0x8,0x714,0x704,0x670,0x50088,0x8, + 0x715,0x66d,0x714,0x50083,0x8,0x621,0x672,0x715,0x500ba,0x6f,0x623,0x621, + 0xad,0x300f7,0x656,0x0,0x400fa,0x623,0x624,0x656,0x200f8,0x624,0x7000c,0x8, + 0x71e,0x1,0x28,0x704,0x458,0x5008e,0xe,0x62a,0x409,0x126,0x4006e,0x30, + 0x62b,0x62a,0x50083,0x8,0x757,0x71e,0x670,0x50088,0x8,0x758,0x66d,0x757, + 0x4006f,0xe,0x735,0x62b,0x50088,0xe,0x762,0x735,0x409,0x50085,0xe,0x763, + 0x762,0x170,0x50081,0xe,0x764,0x763,0x173,0x50051,0x8,0x739,0x676,0x2, + 0x50051,0x8,0x73b,0x764,0x0,0x50085,0x8,0x73c,0x739,0x73b,0x50085,0x8, + 0x73e,0x73c,0x758,0x50051,0x8,0x740,0x676,0x3,0x50051,0x8,0x742,0x764, + 0x1,0x50085,0x8,0x743,0x740,0x742,0x50085,0x8,0x745,0x743,0x758,0x60050, + 0x68,0x749,0x73e,0x745,0x758,0x50085,0x8,0x77e,0x739,0x172,0x50085,0x8, + 0x780,0x77e,0x758,0x50085,0x8,0x787,0x740,0x758,0x60050,0x68,0x78b,0x780, + 0x787,0x758,0x6000c,0x8,0x634,0x1,0x42,0x409,0x7000c,0x8,0x7af,0x1, + 0x25,0x672,0x715,0x6000c,0x8,0x639,0x1,0x42,0x78b,0x6000c,0x8,0x63b, + 0x1,0x42,0x749,0x50088,0x8,0x63c,0x639,0x63b,0x50085,0x8,0x63e,0x330, + 0x63c,0x50085,0x8,0x640,0x63e,0x634,0x50085,0x8,0x642,0x640,0x7af,0x50088, + 0x8,0x64c,0x642,0x621,0x500be,0x6f,0x64d,0x64c,0xae,0x600a9,0x8,0x64e, + 0x64d,0xae,0xad,0x50085,0x8,0x650,0x64e,0x616,0x50081,0x8,0x652,0xb5e, + 0x650,0x50081,0x8,0x655,0xb5d,0x616,0x200f9,0x656,0x200f8,0x656,0x700f5,0x8, + 0xbb0,0xb5e,0x619,0x652,0x624,0x700f5,0x8,0xbad,0xb5d,0x619,0x655,0x624, + 0x200f9,0x657,0x200f8,0x657,0x700f5,0x8,0xbaf,0xb5e,0x613,0xbb0,0x656,0x700f5, + 0x8,0xbac,0xb5d,0x613,0xbad,0x656,0x200f9,0x658,0x200f8,0x658,0x700f5,0x8, + 0xbae,0xb5e,0x608,0xbaf,0x657,0x700f5,0x8,0xbab,0xb5d,0x608,0xbac,0x657, + 0x200f9,0x659,0x200f8,0x659,0x50080,0x2f,0x65b,0xb5c,0x136,0x200f9,0x604,0x200f8, + 0x65c,0x500ba,0x6f,0x65e,0xb5d,0xad,0x300f7,0x666,0x0,0x400fa,0x65e,0x65f, + 0x665,0x200f8,0x665,0x200f9,0x666,0x200f8,0x65f,0x50088,0x8,0x662,0xb5e,0xb5d, + 0x50083,0x8,0x663,0xae,0x662,0x8000c,0x8,0x7c1,0x1,0x2b,0x663,0xad, + 0xae,0x200f9,0x666,0x200f8,0x666,0x700f5,0x8,0xb5f,0x7c1,0x65f,0xad,0x665, + 0x50083,0x8,0x416,0xae,0xb5f,0x50083,0xe,0x41a,0x40a,0xb1b,0x50085,0xe, + 0x876,0x41a,0x409,0x50083,0xe,0x877,0x876,0x127,0x6000c,0xe,0x879,0x1, + 0x8,0x877,0x4006e,0x30,0x87a,0x879,0x6000c,0xe,0x8a2,0x1,0xa,0x877, + 0x50051,0x8,0x883,0x8a2,0x0,0x50083,0x8,0x884,0xae,0x883,0x50051,0x8, + 0x886,0x8a2,0x1,0x50083,0x8,0x887,0xae,0x886,0x50085,0x8,0x888,0x884, + 0x887,0x50085,0x8,0x88f,0x883,0x887,0x50085,0x8,0x896,0x884,0x886,0x50085, + 0x8,0x89c,0x883,0x886,0x70050,0x59,0xaab,0x888,0x88f,0x896,0x89c,0x3003e, + 0xa02,0xbfa,0x3003e,0xa03,0xaab,0x200f9,0x7f6,0x200f8,0x7f6,0x700f5,0x8,0xb68, + 0xad,0x666,0xbc0,0x84b,0x700f5,0x8,0xb67,0xad,0x666,0xbbd,0x84b,0x700f5, + 0x2f,0xb66,0xc7,0x666,0x84d,0x84b,0x500b1,0x6f,0x7f9,0xb66,0x1d6,0x400f6, + 0x84e,0x84b,0x0,0x400fa,0x7f9,0x7fa,0x84e,0x200f8,0x7fa,0x50041,0x38,0xa08, + 0xa02,0xb66,0x4003d,0x30,0x7fd,0xa08,0x50080,0x30,0x801,0x87a,0x7fd,0x4007c, + 0x43,0x8aa,0x801,0x4007c,0x43,0x8ac,0x45c,0x500b0,0x1a0,0x8ad,0x8aa,0x8ac, + 0x4009b,0x6f,0x8ae,0x8ad,0x300f7,0x84a,0x0,0x400fa,0x8ae,0x805,0x84a,0x200f8, + 0x805,0x50041,0xd,0xa09,0xa03,0xb66,0x4003d,0x8,0x808,0xa09,0x500ba,0x6f, + 0x80a,0x808,0x2f0,0x300f7,0x849,0x0,0x400fa,0x80a,0x80b,0x849,0x200f8,0x80b, + 0x4006f,0xe,0x8bb,0x801,0x50081,0xe,0x8bd,0x8bb,0x127,0x50088,0xe,0x8c0, + 0x8bd,0x409,0x4003d,0xd3,0x8e1,0x10b,0x4003d,0x10d,0x8e2,0x10f,0x50056,0x111, + 0x8e3,0x8e1,0x8e2,0x70058,0x34,0x8e5,0x8e3,0x8c0,0x2,0xad,0x7004f,0xe, + 0x8e6,0x8e5,0x8e5,0x0,0x1,0x50085,0xe,0x8c6,0x8e6,0x409,0x4006e,0x30, + 0x8c7,0x8c6,0x50080,0x30,0x8d5,0x801,0x8c7,0x4003d,0xd3,0x8f9,0xd5,0x7005f, + 0x34,0x8fb,0x8f9,0x8d5,0x2,0xc7,0x50051,0x8,0x8fc,0x8fb,0x0,0x50083, + 0x8,0x906,0x8fc,0x670,0x50088,0x8,0x907,0x66d,0x906,0x50083,0x8,0x813, + 0x672,0x907,0x500ba,0x6f,0x815,0x813,0xad,0x300f7,0x848,0x0,0x400fa,0x815, + 0x816,0x848,0x200f8,0x816,0x7000c,0x8,0x910,0x1,0x28,0x8fc,0x458,0x5008e, + 0xe,0x81c,0x409,0x126,0x4006e,0x30,0x81d,0x81c,0x50083,0x8,0x949,0x910, + 0x670,0x50088,0x8,0x94a,0x66d,0x949,0x4006f,0xe,0x927,0x81d,0x50088,0xe, + 0x954,0x927,0x409,0x50085,0xe,0x955,0x954,0x170,0x50081,0xe,0x956,0x955, + 0x173,0x50051,0x8,0x92b,0x676,0x2,0x50051,0x8,0x92d,0x956,0x0,0x50085, + 0x8,0x92e,0x92b,0x92d,0x50085,0x8,0x930,0x92e,0x94a,0x50051,0x8,0x932, + 0x676,0x3,0x50051,0x8,0x934,0x956,0x1,0x50085,0x8,0x935,0x932,0x934, + 0x50085,0x8,0x937,0x935,0x94a,0x60050,0x68,0x93b,0x930,0x937,0x94a,0x50085, + 0x8,0x970,0x92b,0x172,0x50085,0x8,0x972,0x970,0x94a,0x50085,0x8,0x979, + 0x932,0x94a,0x60050,0x68,0x97d,0x972,0x979,0x94a,0x6000c,0x8,0x826,0x1, + 0x42,0x409,0x7000c,0x8,0x9a1,0x1,0x25,0x672,0x907,0x6000c,0x8,0x82b, + 0x1,0x42,0x97d,0x6000c,0x8,0x82d,0x1,0x42,0x93b,0x50088,0x8,0x82e, + 0x82b,0x82d,0x50085,0x8,0x830,0x330,0x82e,0x50085,0x8,0x832,0x830,0x826, + 0x50085,0x8,0x834,0x832,0x9a1,0x50088,0x8,0x83e,0x834,0x813,0x500be,0x6f, + 0x83f,0x83e,0xae,0x600a9,0x8,0x840,0x83f,0xae,0xad,0x50085,0x8,0x842, + 0x840,0x808,0x50081,0x8,0x844,0xb68,0x842,0x50081,0x8,0x847,0xb67,0x808, + 0x200f9,0x848,0x200f8,0x848,0x700f5,0x8,0xbc2,0xb68,0x80b,0x844,0x816,0x700f5, + 0x8,0xbbf,0xb67,0x80b,0x847,0x816,0x200f9,0x849,0x200f8,0x849,0x700f5,0x8, + 0xbc1,0xb68,0x805,0xbc2,0x848,0x700f5,0x8,0xbbe,0xb67,0x805,0xbbf,0x848, + 0x200f9,0x84a,0x200f8,0x84a,0x700f5,0x8,0xbc0,0xb68,0x7fa,0xbc1,0x849,0x700f5, + 0x8,0xbbd,0xb67,0x7fa,0xbbe,0x849,0x200f9,0x84b,0x200f8,0x84b,0x50080,0x2f, + 0x84d,0xb66,0x136,0x200f9,0x7f6,0x200f8,0x84e,0x500ba,0x6f,0x850,0xb67,0xad, + 0x300f7,0x858,0x0,0x400fa,0x850,0x851,0x857,0x200f8,0x857,0x200f9,0x858,0x200f8, + 0x851,0x50088,0x8,0x854,0xb68,0xb67,0x50083,0x8,0x855,0xae,0x854,0x8000c, + 0x8,0x9b3,0x1,0x2b,0x855,0xad,0xae,0x200f9,0x858,0x200f8,0x858,0x700f5, + 0x8,0xb69,0x9b3,0x851,0xad,0x857,0x50083,0x8,0x41d,0xae,0xb69,0x50050, + 0xe,0x420,0x416,0x41d,0x500be,0x1a0,0x423,0x420,0xbfc,0x600a9,0xe,0x424, + 0x423,0x398,0x397,0x5008e,0xe,0x427,0xb1b,0x16e,0x50081,0xe,0x42a,0x40a, + 0x427,0x50085,0xe,0x42d,0x42a,0x409,0x4006e,0x30,0x42e,0x42d,0x50051,0x8, + 0x430,0x424,0x0,0x4007c,0x43,0x9c3,0x42e,0x4007c,0x43,0x9c5,0x45c,0x500b0, + 0x1a0,0x9c6,0x9c3,0x9c5,0x4009b,0x6f,0x9c7,0x9c6,0x400a8,0x6f,0x434,0x9c7, + 0x600a9,0x8,0x435,0x434,0xae,0xad,0x50081,0x8,0x436,0x430,0x435,0x8000c, + 0x8,0x9cb,0x1,0x2b,0x436,0xad,0xae,0x50083,0xe,0x43b,0x40a,0x427, + 0x50085,0xe,0x43e,0x43b,0x409,0x4006e,0x30,0x43f,0x43e,0x50051,0x8,0x441, + 0x424,0x1,0x4007c,0x43,0x9d7,0x43f,0x500b0,0x1a0,0x9da,0x9d7,0x9c5,0x4009b, + 0x6f,0x9db,0x9da,0x400a8,0x6f,0x445,0x9db,0x600a9,0x8,0x446,0x445,0xae, + 0xad,0x50081,0x8,0x447,0x441,0x446,0x8000c,0x8,0x9df,0x1,0x2b,0x447, + 0xad,0xae,0x4003d,0x118,0x9e1,0x11a,0x70050,0x34,0x9e6,0x9cb,0x9df,0xad, + 0xad,0x40063,0x9e1,0x3d2,0x9e6,0x100fd,0x10038, +}; +static const char *fi_disocclusion_mask_pass_0_cb_names[] = {"cbFI"}; +static const uint32_t fi_disocclusion_mask_pass_0_cb_bind[] = {8}; +static const uint32_t fi_disocclusion_mask_pass_0_cb_count[] = {1}; +static const uint32_t fi_disocclusion_mask_pass_0_cb_space[] = {0}; +static const char *fi_disocclusion_mask_pass_0_srv_tex_names[] = {"r_game_motion_vector_field_x", "r_game_motion_vector_field_y", "r_reconstructed_depth_previous_frame", "r_dilated_depth", "r_reconstructed_depth_interpolated_frame", "r_inpainting_pyramid", "r_input_distortion_field"}; +static const uint32_t fi_disocclusion_mask_pass_0_srv_tex_bind[] = {0, 1, 2, 3, 4, 5, 6}; +static const uint32_t fi_disocclusion_mask_pass_0_srv_tex_count[] = {1, 1, 1, 1, 1, 1, 1}; +static const uint32_t fi_disocclusion_mask_pass_0_srv_tex_space[] = {0, 0, 0, 0, 0, 0, 0}; +static const char *fi_disocclusion_mask_pass_0_uav_tex_names[] = {"rw_disocclusion_mask"}; +static const uint32_t fi_disocclusion_mask_pass_0_uav_tex_bind[] = {7}; +static const uint32_t fi_disocclusion_mask_pass_0_uav_tex_count[] = {1}; +static const uint32_t fi_disocclusion_mask_pass_0_uav_tex_space[] = {0}; +static const char *fi_disocclusion_mask_pass_0_sampler_names[] = {"s_LinearClamp"}; +static const uint32_t fi_disocclusion_mask_pass_0_sampler_bind[] = {1000}; +static const uint32_t fi_disocclusion_mask_pass_0_sampler_count[] = {1}; +static const uint32_t fi_disocclusion_mask_pass_0_sampler_space[] = {0}; + +static const uint32_t fi_pass_0_spv[4444] = { + 0x7230203,0x10500,0x8000b,0x1a02,0x0,0x20011,0x1,0x20011,0x38,0x6000b,0x1,0x4c534c47, + 0x6474732e,0x3035342e,0x0,0x3000e,0x0,0x1,0x12000f,0x5,0x4,0x6e69616d,0x0,0x196, + 0x1dc,0x1e3,0x1ea,0x1ee,0x1f9,0x200,0x20b,0x211,0x21b,0x226,0x233,0x613, + 0x60010,0x4,0x11,0x8,0x8,0x1,0x30003,0x2,0x1c2,0xb0004,0x455f4c47,0x735f5458, + 0x6c706d61,0x656c7265,0x745f7373,0x75747865,0x665f6572,0x74636e75,0x736e6f69,0x0,0xb0004,0x455f4c47,0x735f5458,0x65646168, + 0x78655f72,0x63696c70,0x615f7469,0x68746972,0x6974656d,0x79745f63,0x736570,0xa0004,0x455f4c47,0x735f5458,0x65646168,0x6d695f72, + 0x5f656761,0x64616f6c,0x726f665f,0x7474616d,0x6465,0xa0004,0x475f4c47,0x4c474f4f,0x70635f45,0x74735f70,0x5f656c79,0x656e696c, + 0x7269645f,0x69746365,0x6576,0x80004,0x475f4c47,0x4c474f4f,0x6e695f45,0x64756c63,0x69645f65,0x74636572,0x657669,0x40005, + 0x4,0x6e69616d,0x0,0x40005,0x194,0x49466263,0x745f,0x60006,0x194,0x0,0x646e6572,0x69537265, + 0x657a,0x60006,0x194,0x1,0x70736964,0x5379616c,0x657a69,0x80006,0x194,0x2,0x6974706f,0x466c6163, + 0x53776f6c,0x656c6163,0x0,0x90006,0x194,0x3,0x6974706f,0x466c6163,0x42776f6c,0x6b636f6c,0x657a6953,0x0, + 0x70006,0x194,0x4,0x5278616d,0x65646e65,0x7a695372,0x65,0x90006,0x194,0x5,0x65746e69,0x6c6f7072, + 0x6f697461,0x6365526e,0x73614274,0x65,0x90006,0x194,0x6,0x65746e69,0x6c6f7072,0x6f697461,0x6365526e,0x7a695374, + 0x65,0x40005,0x196,0x49466263,0x0,0xa0005,0x1dc,0x72705f72,0x6f697665,0x695f7375,0x7265746e,0x616c6f70, + 0x6e6f6974,0x756f735f,0x656372,0xa0005,0x1e3,0x75635f72,0x6e657272,0x6e695f74,0x70726574,0x74616c6f,0x5f6e6f69,0x72756f73, + 0x6563,0x70005,0x1ea,0x69645f72,0x63636f73,0x6973756c,0x6d5f6e6f,0x6b7361,0x60005,0x1ee,0x694c5f73,0x7261656e, + 0x6d616c43,0x70,0xa0005,0x1f9,0x61675f72,0x6d5f656d,0x6f69746f,0x65765f6e,0x726f7463,0x6569665f,0x785f646c,0x0, + 0xa0005,0x200,0x61675f72,0x6d5f656d,0x6f69746f,0x65765f6e,0x726f7463,0x6569665f,0x795f646c,0x0,0xc0005,0x20b, + 0x706f5f72,0x61636974,0x6c665f6c,0x6d5f776f,0x6f69746f,0x65765f6e,0x726f7463,0x6569665f,0x785f646c,0x0,0xc0005,0x211, + 0x706f5f72,0x61636974,0x6c665f6c,0x6d5f776f,0x6f69746f,0x65765f6e,0x726f7463,0x6569665f,0x795f646c,0x0,0x80005,0x21b, + 0x6e695f72,0x6e696170,0x676e6974,0x7279705f,0x64696d61,0x0,0xa0005,0x224,0x6d617246,0x746e4965,0x6f707265,0x6974616c, + 0x6f436e6f,0x65746e75,0x745f7372,0x0,0x50006,0x224,0x0,0x61746164,0x0,0x50005,0x226,0x6f635f72, + 0x65746e75,0x7372,0x50005,0x233,0x6f5f7772,0x75707475,0x74,0x80005,0x613,0x475f6c67,0x61626f6c,0x766e496c, + 0x7461636f,0x496e6f69,0x44,0x30047,0x194,0x2,0x50048,0x194,0x0,0x23,0x0,0x50048, + 0x194,0x1,0x23,0x8,0x50048,0x194,0x2,0x23,0x50,0x50048,0x194,0x3, + 0x23,0x58,0x50048,0x194,0x4,0x23,0x60,0x50048,0x194,0x5,0x23,0x70, + 0x50048,0x194,0x6,0x23,0x78,0x40047,0x196,0x21,0xa,0x40047,0x196,0x22, + 0x0,0x40047,0x1dc,0x21,0x4,0x40047,0x1dc,0x22,0x0,0x40047,0x1e3,0x21, + 0x5,0x40047,0x1e3,0x22,0x0,0x40047,0x1ea,0x21,0x6,0x40047,0x1ea,0x22, + 0x0,0x40047,0x1ee,0x21,0x3e8,0x40047,0x1ee,0x22,0x0,0x40047,0x1f9,0x21, + 0x0,0x40047,0x1f9,0x22,0x0,0x40047,0x200,0x21,0x1,0x40047,0x200,0x22, + 0x0,0x40047,0x20b,0x21,0x2,0x40047,0x20b,0x22,0x0,0x40047,0x211,0x21, + 0x3,0x40047,0x211,0x22,0x0,0x40047,0x21b,0x21,0x7,0x40047,0x21b,0x22, + 0x0,0x40047,0x223,0x6,0x4,0x30047,0x224,0x2,0x40048,0x224,0x0,0x18, + 0x50048,0x224,0x0,0x23,0x0,0x30047,0x226,0x18,0x40047,0x226,0x21,0x8, + 0x40047,0x226,0x22,0x0,0x40047,0x233,0x21,0x9,0x40047,0x233,0x22,0x0, + 0x40047,0x613,0xb,0x1c,0x40047,0x621,0xb,0x19,0x20013,0x2,0x30021,0x3, + 0x2,0x40015,0x6,0x20,0x0,0x30016,0x8,0x20,0x40020,0xd,0x7,0x8, + 0x40017,0xe,0x8,0x2,0x40017,0x13,0x8,0x3,0x40015,0x55,0x20,0x1, + 0x40017,0x56,0x55,0x2,0x40020,0x6e,0x7,0x56,0x40017,0x76,0x8,0x4, + 0x40017,0x7b,0x6,0x2,0x4002b,0x6,0x9f,0x4,0x4001c,0xa0,0x56,0x9f, + 0x4001c,0xa1,0x8,0x9f,0x20014,0xa8,0x4002b,0x8,0x10f,0x0,0x4002b,0x8, + 0x110,0x3f800000,0x9001e,0x194,0x56,0x56,0xe,0x55,0x56,0x56,0x56,0x40020, + 0x195,0x2,0x194,0x4003b,0x195,0x196,0x2,0x40020,0x198,0x2,0x56,0x4002b, + 0x55,0x1a2,0x0,0x4002b,0x55,0x1a7,0x1,0x40020,0x1ae,0x2,0xe,0x40020, + 0x1b4,0x2,0x55,0x4002b,0x6,0x1cf,0x0,0x4002b,0x6,0x1d5,0x1,0x90019, + 0x1da,0x8,0x1,0x0,0x0,0x0,0x1,0x0,0x40020,0x1db,0x0,0x1da, + 0x4003b,0x1db,0x1dc,0x0,0x4003b,0x1db,0x1e3,0x0,0x4003b,0x1db,0x1ea,0x0, + 0x2001a,0x1ec,0x40020,0x1ed,0x0,0x1ec,0x4003b,0x1ed,0x1ee,0x0,0x3001b,0x1f0, + 0x1da,0x90019,0x1f7,0x6,0x1,0x0,0x0,0x0,0x1,0x0,0x40020,0x1f8, + 0x0,0x1f7,0x4003b,0x1f8,0x1f9,0x0,0x40017,0x1fc,0x6,0x4,0x4003b,0x1f8, + 0x200,0x0,0x4003b,0x1f8,0x20b,0x0,0x4003b,0x1f8,0x211,0x0,0x4003b,0x1db, + 0x21b,0x0,0x3001d,0x223,0x6,0x3001e,0x224,0x223,0x40020,0x225,0xc,0x224, + 0x4003b,0x225,0x226,0xc,0x40020,0x228,0xc,0x6,0x90019,0x231,0x8,0x1, + 0x0,0x0,0x0,0x2,0x0,0x40020,0x232,0x0,0x231,0x4003b,0x232,0x233, + 0x0,0x4002b,0x8,0x26c,0x3f000000,0x5002c,0xe,0x26d,0x26c,0x26c,0x4002b,0x55, + 0x271,0x2,0x5002c,0x56,0x27a,0x1a2,0x1a2,0x5002c,0x56,0x27c,0x1a7,0x1a2, + 0x5002c,0x56,0x27e,0x1a2,0x1a7,0x5002c,0x56,0x281,0x1a7,0x1a7,0x40017,0x2a6, + 0xa8,0x2,0x5002c,0xe,0x2fe,0x10f,0x10f,0x4002b,0x55,0x304,0x4,0x4002b, + 0x6,0x31b,0x15,0x4002b,0x6,0x31d,0x3ff,0x7002c,0x76,0x35b,0x10f,0x10f, + 0x10f,0x10f,0x4002b,0x55,0x3bd,0xb,0x6002c,0x13,0x46d,0x10f,0x10f,0x10f, + 0x5002c,0xe,0x508,0x110,0x110,0x4002b,0x8,0x550,0x3a83126f,0x4002b,0x6,0x5d6, + 0xa,0x40017,0x611,0x6,0x3,0x40020,0x612,0x1,0x611,0x4003b,0x612,0x613, + 0x1,0x4002b,0x6,0x620,0x8,0x6002c,0x611,0x621,0x620,0x620,0x1d5,0x40020, + 0x11bf,0x7,0xa0,0x40020,0x11c1,0x7,0xa1,0x7002c,0xa0,0x1928,0x27a,0x27c, + 0x27e,0x281,0x5002c,0x56,0x192a,0x271,0x271,0x4002b,0x8,0x1938,0x3a802008,0x40017, + 0x193e,0xa8,0x3,0x4002b,0x6,0x19c9,0x5,0x4002b,0x6,0x19ca,0x6,0x4002b, + 0x6,0x19cb,0x2,0x4002b,0x6,0x19cc,0x3,0x50036,0x2,0x4,0x0,0x3, + 0x200f8,0x5,0x4003b,0x11c1,0x1398,0x7,0x4003b,0x11bf,0x1397,0x7,0x4003b,0x11c1, + 0x135b,0x7,0x4003b,0x11bf,0x135a,0x7,0x4003b,0x11c1,0x12c8,0x7,0x4003b,0x11bf, + 0x12c7,0x7,0x4003b,0x11c1,0x1282,0x7,0x4003b,0x11bf,0x1281,0x7,0x4003b,0x11c1, + 0x123c,0x7,0x4003b,0x11bf,0x123b,0x7,0x4003b,0x11c1,0x11f6,0x7,0x4003b,0x11bf, + 0x11f5,0x7,0x4003d,0x611,0x614,0x613,0x7004f,0x7b,0x615,0x614,0x614,0x0, + 0x1,0x4007c,0x56,0x616,0x615,0x50041,0x198,0x64e,0x196,0x19c9,0x4003d,0x56, + 0x64f,0x64e,0x50041,0x198,0x652,0x196,0x19ca,0x4003d,0x56,0x653,0x652,0x50051, + 0x55,0x657,0x616,0x0,0x50051,0x55,0x659,0x64f,0x0,0x500af,0xa8,0x65a, + 0x657,0x659,0x300f7,0x664,0x0,0x400fa,0x65a,0x65b,0x664,0x200f8,0x65b,0x50051, + 0x55,0x65f,0x653,0x0,0x50080,0x55,0x662,0x65f,0x659,0x500b1,0xa8,0x663, + 0x657,0x662,0x200f9,0x664,0x200f8,0x664,0x700f5,0xa8,0x665,0x65a,0x5,0x663, + 0x65b,0x300f7,0x66c,0x0,0x400fa,0x665,0x666,0x66c,0x200f8,0x666,0x50051,0x55, + 0x668,0x616,0x1,0x50051,0x55,0x66a,0x64f,0x1,0x500af,0xa8,0x66b,0x668, + 0x66a,0x200f9,0x66c,0x200f8,0x66c,0x700f5,0xa8,0x66d,0x665,0x664,0x66b,0x666, + 0x300f7,0x677,0x0,0x400fa,0x66d,0x66e,0x677,0x200f8,0x66e,0x50051,0x55,0x670, + 0x616,0x1,0x50051,0x55,0x672,0x653,0x1,0x50051,0x55,0x674,0x64f,0x1, + 0x50080,0x55,0x675,0x672,0x674,0x500b1,0xa8,0x676,0x670,0x675,0x200f9,0x677, + 0x200f8,0x677,0x700f5,0xa8,0x678,0x66d,0x66c,0x676,0x66e,0x400a8,0xa8,0x632, + 0x678,0x300f7,0x637,0x0,0x400fa,0x678,0x634,0x637,0x200f8,0x634,0x60041,0x228, + 0x680,0x226,0x1a2,0x1a7,0x4003d,0x6,0x681,0x680,0x500aa,0xa8,0x636,0x681, + 0x1cf,0x200f9,0x637,0x200f8,0x637,0x700f5,0xa8,0x638,0x632,0x677,0x636,0x634, + 0x300f7,0x643,0x0,0x400fa,0x638,0x639,0x63c,0x200f8,0x63c,0x4007c,0x7b,0x6d2, + 0x64f,0x50082,0x7b,0x6d3,0x615,0x6d2,0x40070,0xe,0x6d4,0x6d3,0x50081,0xe, + 0x6d6,0x6d4,0x26d,0x4006f,0xe,0x6d8,0x653,0x50088,0xe,0x6d9,0x6d6,0x6d8, + 0x40070,0xe,0x6db,0x615,0x50081,0xe,0x6dd,0x6db,0x26d,0x50041,0x198,0x7a4, + 0x196,0x1a7,0x4003d,0x56,0x7a5,0x7a4,0x4006f,0xe,0x6df,0x7a5,0x50088,0xe, + 0x6e0,0x6dd,0x6df,0x50041,0x198,0x7a8,0x196,0x1a2,0x4003d,0x56,0x7a9,0x7a8, + 0x4006f,0xe,0x6e3,0x7a9,0x50041,0x198,0x7ac,0x196,0x9f,0x4003d,0x56,0x7ad, + 0x7ac,0x4006f,0xe,0x6e5,0x7ad,0x50088,0xe,0x6e6,0x6e3,0x6e5,0x50085,0xe, + 0x6e7,0x6d9,0x6e6,0x50088,0xe,0x6ec,0x6d8,0x6df,0x50085,0xe,0x7c5,0x6d9, + 0x6e3,0x4006e,0x56,0x7c6,0x7c5,0x4003d,0x1f7,0x80c,0x1f9,0x7005f,0x1fc,0x80e, + 0x80c,0x7c6,0x2002,0x1a2,0x50051,0x6,0x80f,0x80e,0x0,0x4003d,0x1f7,0x810, + 0x200,0x7005f,0x1fc,0x812,0x810,0x7c6,0x2002,0x1a2,0x50051,0x6,0x813,0x812, + 0x0,0x500c2,0x6,0x81d,0x80f,0x31b,0x500c7,0x6,0x81e,0x81d,0x31d,0x40070, + 0x8,0x81f,0x81e,0x50085,0x8,0x820,0x81f,0x1938,0x6000c,0xe,0x855,0x1, + 0x3e,0x80f,0x50051,0x8,0x845,0x855,0x0,0x6000c,0xe,0x859,0x1,0x3e, + 0x813,0x50051,0x8,0x84a,0x859,0x0,0x50050,0xe,0x19ff,0x845,0x84a,0x500bd, + 0xa8,0x7ce,0x820,0x10f,0x300f7,0x7f1,0x0,0x400fa,0x7ce,0x7cf,0x7f1,0x200f8, + 0x7cf,0x200f9,0x7d1,0x200f8,0x7d1,0x700f5,0x76,0x19d2,0x35b,0x7cf,0x8a5,0x7e3, + 0x700f5,0x56,0x1795,0x7a9,0x7cf,0x7de,0x7e3,0x700f5,0x55,0x1528,0x1a2,0x7cf, + 0x7e5,0x7e3,0x400f6,0x7e6,0x7e3,0x0,0x200f9,0x7d2,0x200f8,0x7d2,0x500b1,0xa8, + 0x7d4,0x1528,0x3bd,0x300f7,0x7d9,0x0,0x400fa,0x7d4,0x7d5,0x7d9,0x200f8,0x7d5, + 0x50051,0x8,0x7d7,0x19d2,0x3,0x500b4,0xa8,0x7d8,0x7d7,0x10f,0x200f9,0x7d9, + 0x200f8,0x7d9,0x700f5,0xa8,0x7da,0x7d4,0x7d2,0x7d8,0x7d5,0x400fa,0x7da,0x7db, + 0x7e6,0x200f8,0x7db,0x50087,0x56,0x7de,0x1795,0x192a,0x4006f,0xe,0x8af,0x7de, + 0x50085,0xe,0x8b0,0x6d9,0x8af,0x50083,0xe,0x8b1,0x8b0,0x26d,0x6000c,0xe, + 0x8b3,0x1,0x8,0x8b1,0x4006e,0x56,0x8b4,0x8b3,0x6000c,0xe,0x8dc,0x1, + 0xa,0x8b1,0x50051,0x8,0x8bd,0x8dc,0x0,0x50083,0x8,0x8be,0x110,0x8bd, + 0x50051,0x8,0x8c0,0x8dc,0x1,0x50083,0x8,0x8c1,0x110,0x8c0,0x50085,0x8, + 0x8c2,0x8be,0x8c1,0x50085,0x8,0x8c9,0x8bd,0x8c1,0x50085,0x8,0x8d0,0x8be, + 0x8c0,0x50085,0x8,0x8d6,0x8bd,0x8c0,0x70050,0xa1,0x1502,0x8c2,0x8c9,0x8d0, + 0x8d6,0x3003e,0x1397,0x1928,0x3003e,0x1398,0x1502,0x200f9,0x873,0x200f8,0x873,0x700f5, + 0x76,0x19ea,0x35b,0x7db,0x19fe,0x89b,0x700f5,0x8,0x1798,0x10f,0x7db,0x1925, + 0x89b,0x700f5,0x55,0x1797,0x1a2,0x7db,0x89d,0x89b,0x500b1,0xa8,0x876,0x1797, + 0x304,0x400f6,0x89e,0x89b,0x0,0x400fa,0x876,0x877,0x89e,0x200f8,0x877,0x50041, + 0x6e,0x139d,0x1397,0x1797,0x4003d,0x56,0x87a,0x139d,0x50080,0x56,0x87e,0x8b4, + 0x87a,0x4007c,0x7b,0x8e0,0x87e,0x4007c,0x7b,0x8e2,0x7de,0x500b0,0x2a6,0x8e3, + 0x8e0,0x8e2,0x4009b,0xa8,0x8e4,0x8e3,0x300f7,0x89a,0x0,0x400fa,0x8e4,0x881, + 0x89a,0x200f8,0x881,0x4003d,0x1da,0x8e7,0x21b,0x7005f,0x76,0x8eb,0x8e7,0x87e, + 0x2,0x1528,0x50051,0x8,0x886,0x8eb,0x2,0x500ba,0xa8,0x889,0x886,0x10f, + 0x600a9,0x8,0x88a,0x889,0x110,0x10f,0x50041,0xd,0x139e,0x1398,0x1797,0x4003d, + 0x8,0x88d,0x139e,0x50085,0x8,0x88f,0x88d,0x88a,0x50085,0x8,0x891,0x88f, + 0x886,0x50081,0x8,0x894,0x1798,0x891,0x5008e,0x76,0x897,0x8eb,0x891,0x50081, + 0x76,0x899,0x19ea,0x897,0x200f9,0x89a,0x200f8,0x89a,0x700f5,0x76,0x19fe,0x19ea, + 0x877,0x899,0x881,0x700f5,0x8,0x1925,0x1798,0x877,0x894,0x881,0x200f9,0x89b, + 0x200f8,0x89b,0x50080,0x55,0x89d,0x1797,0x1a7,0x200f9,0x873,0x200f8,0x89e,0x500ba, + 0xa8,0x8a0,0x1798,0x10f,0x600a9,0x8,0x8a2,0x8a0,0x1798,0x110,0x70050,0x76, + 0x8a4,0x8a2,0x8a2,0x8a2,0x8a2,0x50088,0x76,0x8a5,0x19ea,0x8a4,0x200f9,0x7e3, + 0x200f8,0x7e3,0x50080,0x55,0x7e5,0x1528,0x1a7,0x200f9,0x7d1,0x200f8,0x7e6,0x7004f, + 0xe,0x7e8,0x19d2,0x19d2,0x0,0x1,0x200f9,0x7f1,0x200f8,0x7f1,0x700f5,0xe, + 0x152e,0x19ff,0x63c,0x7e8,0x7e6,0x50083,0xe,0x7f5,0x6d9,0x152e,0x50051,0x8, + 0x8ef,0x7f5,0x0,0x500ba,0xa8,0x8f0,0x8ef,0x10f,0x300f7,0x8f5,0x0,0x400fa, + 0x8f0,0x8f1,0x8f5,0x200f8,0x8f1,0x500b8,0xa8,0x8f4,0x8ef,0x110,0x200f9,0x8f5, + 0x200f8,0x8f5,0x700f5,0xa8,0x8f6,0x8f0,0x7f1,0x8f4,0x8f1,0x300f7,0x901,0x0, + 0x400fa,0x8f6,0x8f7,0x901,0x200f8,0x8f7,0x50051,0x8,0x8f9,0x7f5,0x1,0x500ba, + 0xa8,0x8fa,0x8f9,0x10f,0x300f7,0x8ff,0x0,0x400fa,0x8fa,0x8fb,0x8ff,0x200f8, + 0x8fb,0x500b8,0xa8,0x8fe,0x8f9,0x110,0x200f9,0x8ff,0x200f8,0x8ff,0x700f5,0xa8, + 0x900,0x8fa,0x8f7,0x8fe,0x8fb,0x200f9,0x901,0x200f8,0x901,0x700f5,0xa8,0x902, + 0x8f6,0x8f5,0x900,0x8ff,0x50081,0xe,0x7fc,0x6d9,0x152e,0x50051,0x8,0x906, + 0x7fc,0x0,0x500ba,0xa8,0x907,0x906,0x10f,0x300f7,0x90c,0x0,0x400fa,0x907, + 0x908,0x90c,0x200f8,0x908,0x500b8,0xa8,0x90b,0x906,0x110,0x200f9,0x90c,0x200f8, + 0x90c,0x700f5,0xa8,0x90d,0x907,0x901,0x90b,0x908,0x300f7,0x918,0x0,0x400fa, + 0x90d,0x90e,0x918,0x200f8,0x90e,0x50051,0x8,0x910,0x7fc,0x1,0x500ba,0xa8, + 0x911,0x910,0x10f,0x300f7,0x916,0x0,0x400fa,0x911,0x912,0x916,0x200f8,0x912, + 0x500b8,0xa8,0x915,0x910,0x110,0x200f9,0x916,0x200f8,0x916,0x700f5,0xa8,0x917, + 0x911,0x90e,0x915,0x912,0x200f9,0x918,0x200f8,0x918,0x700f5,0xa8,0x919,0x90d, + 0x90c,0x917,0x916,0x50041,0x1ae,0x99f,0x196,0x19cb,0x4003d,0xe,0x9a0,0x99f, + 0x50088,0xe,0x9a2,0x508,0x9a0,0x50041,0x1b4,0x9a3,0x196,0x19cc,0x4003d,0x55, + 0x9a4,0x9a3,0x50050,0x56,0x9a5,0x9a4,0x9a4,0x4006f,0xe,0x9a6,0x9a5,0x50088, + 0xe,0x9a7,0x9a2,0x9a6,0x4006e,0x56,0x9a8,0x9a7,0x50084,0x56,0x99b,0x9a8, + 0x281,0x4006f,0xe,0x92d,0x99b,0x5008e,0xe,0x92e,0x92d,0x110,0x4006e,0x56, + 0x92f,0x92e,0x4006f,0xe,0x9b2,0x92f,0x50085,0xe,0x9b3,0x6e0,0x9b2,0x50083, + 0xe,0x9b4,0x9b3,0x26d,0x6000c,0xe,0x9b6,0x1,0x8,0x9b4,0x4006e,0x56, + 0x9b7,0x9b6,0x6000c,0xe,0x9df,0x1,0xa,0x9b4,0x50051,0x8,0x9c0,0x9df, + 0x0,0x50083,0x8,0x9c1,0x110,0x9c0,0x50051,0x8,0x9c3,0x9df,0x1,0x50083, + 0x8,0x9c4,0x110,0x9c3,0x50085,0x8,0x9c5,0x9c1,0x9c4,0x50085,0x8,0x9cc, + 0x9c0,0x9c4,0x50085,0x8,0x9d3,0x9c1,0x9c3,0x50085,0x8,0x9d9,0x9c0,0x9c3, + 0x70050,0xa1,0x14d6,0x9c5,0x9cc,0x9d3,0x9d9,0x3003e,0x135a,0x1928,0x3003e,0x135b, + 0x14d6,0x200f9,0x933,0x200f8,0x933,0x700f5,0xe,0x1566,0x2fe,0x918,0x17e7,0x96d, + 0x700f5,0x8,0x1565,0x10f,0x918,0x17e6,0x96d,0x700f5,0x55,0x1564,0x1a2,0x918, + 0x96f,0x96d,0x500b1,0xa8,0x936,0x1564,0x304,0x400f6,0x970,0x96d,0x0,0x400fa, + 0x936,0x937,0x970,0x200f8,0x937,0x50041,0x6e,0x1360,0x135a,0x1564,0x4003d,0x56, + 0x93a,0x1360,0x50080,0x56,0x93e,0x9b7,0x93a,0x4007c,0x7b,0xa04,0x93e,0x4007c, + 0x7b,0xa06,0x92f,0x500b0,0x2a6,0xa07,0xa04,0xa06,0x4009b,0xa8,0xa08,0xa07, + 0x300f7,0x96c,0x0,0x400fa,0xa08,0x945,0x96c,0x200f8,0x945,0x50041,0xd,0x1361, + 0x135b,0x1564,0x4003d,0x8,0x948,0x1361,0x4003d,0x1f7,0xa1b,0x20b,0x7005f,0x1fc, + 0xa1d,0xa1b,0x93e,0x2002,0x1a2,0x50051,0x6,0xa1e,0xa1d,0x0,0x4003d,0x1f7, + 0xa1f,0x211,0x7005f,0x1fc,0xa21,0xa1f,0x93e,0x2002,0x1a2,0x50051,0x6,0xa22, + 0xa21,0x0,0x6000c,0xe,0xa64,0x1,0x3e,0xa1e,0x50051,0x8,0xa54,0xa64, + 0x0,0x6000c,0xe,0xa68,0x1,0x3e,0xa22,0x50051,0x8,0xa59,0xa68,0x0, + 0x50050,0xe,0x1a01,0xa54,0xa59,0x5008e,0xe,0x954,0x1a01,0x948,0x50081,0xe, + 0x957,0x1566,0x954,0x50081,0x8,0x96b,0x1565,0x948,0x200f9,0x96c,0x200f8,0x96c, + 0x700f5,0xe,0x17e7,0x1566,0x937,0x957,0x945,0x700f5,0x8,0x17e6,0x1565,0x937, + 0x96b,0x945,0x200f9,0x96d,0x200f8,0x96d,0x50080,0x55,0x96f,0x1564,0x1a7,0x200f9, + 0x933,0x200f8,0x970,0x500ba,0xa8,0x972,0x1565,0x10f,0x300f7,0x984,0x0,0x400fa, + 0x972,0x973,0x984,0x200f8,0x973,0x50050,0xe,0x977,0x1565,0x1565,0x50088,0xe, + 0x978,0x1566,0x977,0x200f9,0x984,0x200f8,0x984,0x700f5,0xe,0x156b,0x1566,0x970, + 0x978,0x973,0x4003d,0x1da,0xa99,0x1ea,0x4003d,0x1ec,0xa9a,0x1ee,0x50056,0x1f0, + 0xa9b,0xa99,0xa9a,0x70058,0x76,0xa9d,0xa9b,0x6e7,0x2,0x10f,0x7004f,0xe, + 0x6f5,0xa9d,0xa9d,0x0,0x1,0x8000c,0xe,0xaa5,0x1,0x2b,0x6f5,0x2fe, + 0x508,0x500b4,0x2a6,0x6f7,0xaa5,0x508,0x600a9,0xe,0x6f8,0x6f7,0x508,0x2fe, + 0x50085,0xe,0x6fc,0x152e,0x6ec,0x50081,0xe,0xac9,0x6e0,0x6fc,0x50085,0xe, + 0xb1b,0xac9,0x6df,0x50083,0xe,0xb1c,0xb1b,0x26d,0x6000c,0xe,0xb1e,0x1, + 0x8,0xb1c,0x4006e,0x56,0xb1f,0xb1e,0x6000c,0xe,0xb47,0x1,0xa,0xb1c, + 0x50051,0x8,0xb28,0xb47,0x0,0x50083,0x8,0xb29,0x110,0xb28,0x50051,0x8, + 0xb2b,0xb47,0x1,0x50083,0x8,0xb2c,0x110,0xb2b,0x50085,0x8,0xb2d,0xb29, + 0xb2c,0x50085,0x8,0xb34,0xb28,0xb2c,0x50085,0x8,0xb3b,0xb29,0xb2b,0x50085, + 0x8,0xb41,0xb28,0xb2b,0x70050,0xa1,0x14aa,0xb2d,0xb34,0xb3b,0xb41,0x3003e, + 0x12c7,0x1928,0x3003e,0x12c8,0x14aa,0x200f9,0xacd,0x200f8,0xacd,0x700f5,0x13,0x15be, + 0x46d,0x984,0x17fe,0xaf5,0x700f5,0x8,0x15bd,0x10f,0x984,0x17fd,0xaf5,0x700f5, + 0x55,0x15bc,0x1a2,0x984,0xaf7,0xaf5,0x500b1,0xa8,0xad0,0x15bc,0x304,0x400f6, + 0xaf8,0xaf5,0x0,0x400fa,0xad0,0xad1,0xaf8,0x200f8,0xad1,0x50041,0x6e,0x12cd, + 0x12c7,0x15bc,0x4003d,0x56,0xad4,0x12cd,0x50080,0x56,0xad8,0xb1f,0xad4,0x50051, + 0x55,0xb53,0xad8,0x0,0x500af,0xa8,0xb56,0xb53,0x659,0x300f7,0xb60,0x0, + 0x400fa,0xb56,0xb57,0xb60,0x200f8,0xb57,0x50051,0x55,0xb5b,0x653,0x0,0x50080, + 0x55,0xb5e,0xb5b,0x659,0x500b1,0xa8,0xb5f,0xb53,0xb5e,0x200f9,0xb60,0x200f8, + 0xb60,0x700f5,0xa8,0xb61,0xb56,0xad1,0xb5f,0xb57,0x300f7,0xb68,0x0,0x400fa, + 0xb61,0xb62,0xb68,0x200f8,0xb62,0x50051,0x55,0xb64,0xad8,0x1,0x50051,0x55, + 0xb66,0x64f,0x1,0x500af,0xa8,0xb67,0xb64,0xb66,0x200f9,0xb68,0x200f8,0xb68, + 0x700f5,0xa8,0xb69,0xb61,0xb60,0xb67,0xb62,0x300f7,0xb73,0x0,0x400fa,0xb69, + 0xb6a,0xb73,0x200f8,0xb6a,0x50051,0x55,0xb6c,0xad8,0x1,0x50051,0x55,0xb6e, + 0x653,0x1,0x50051,0x55,0xb70,0x64f,0x1,0x50080,0x55,0xb71,0xb6e,0xb70, + 0x500b1,0xa8,0xb72,0xb6c,0xb71,0x200f9,0xb73,0x200f8,0xb73,0x700f5,0xa8,0xb74, + 0xb69,0xb68,0xb72,0xb6a,0x300f7,0xaf4,0x0,0x400fa,0xb74,0xadd,0xaf4,0x200f8, + 0xadd,0x50041,0xd,0x12ce,0x12c8,0x15bc,0x4003d,0x8,0xae0,0x12ce,0x4003d,0x1da, + 0xb7d,0x1dc,0x7005f,0x76,0xb7f,0xb7d,0xad8,0x2,0x1a2,0x8004f,0x13,0xb80, + 0xb7f,0xb7f,0x0,0x1,0x2,0x5008e,0x13,0xaed,0xb80,0xae0,0x50081,0x13, + 0xaef,0x15be,0xaed,0x50081,0x8,0xaf3,0x15bd,0xae0,0x200f9,0xaf4,0x200f8,0xaf4, + 0x700f5,0x13,0x17fe,0x15be,0xb73,0xaef,0xadd,0x700f5,0x8,0x17fd,0x15bd,0xb73, + 0xaf3,0xadd,0x200f9,0xaf5,0x200f8,0xaf5,0x50080,0x55,0xaf7,0x15bc,0x1a7,0x200f9, + 0xacd,0x200f8,0xaf8,0x500b7,0xa8,0xafa,0x15bd,0x10f,0x300f7,0xb01,0x0,0x400fa, + 0xafa,0xafb,0xb00,0x200f8,0xb00,0x200f9,0xb01,0x200f8,0xafb,0x60050,0x13,0xafe, + 0x15bd,0x15bd,0x15bd,0x50088,0x13,0xaff,0x15be,0xafe,0x200f9,0xb01,0x200f8,0xb01, + 0x700f5,0x13,0x15bf,0xaff,0xafb,0x46d,0xb00,0x4007f,0xe,0x702,0x152e,0x50085, + 0xe,0x704,0x702,0x6ec,0x50081,0xe,0xc66,0x6e0,0x704,0x50085,0xe,0xcb8, + 0xc66,0x6df,0x50083,0xe,0xcb9,0xcb8,0x26d,0x6000c,0xe,0xcbb,0x1,0x8, + 0xcb9,0x4006e,0x56,0xcbc,0xcbb,0x6000c,0xe,0xce4,0x1,0xa,0xcb9,0x50051, + 0x8,0xcc5,0xce4,0x0,0x50083,0x8,0xcc6,0x110,0xcc5,0x50051,0x8,0xcc8, + 0xce4,0x1,0x50083,0x8,0xcc9,0x110,0xcc8,0x50085,0x8,0xcca,0xcc6,0xcc9, + 0x50085,0x8,0xcd1,0xcc5,0xcc9,0x50085,0x8,0xcd8,0xcc6,0xcc8,0x50085,0x8, + 0xcde,0xcc5,0xcc8,0x70050,0xa1,0x147e,0xcca,0xcd1,0xcd8,0xcde,0x3003e,0x1281, + 0x1928,0x3003e,0x1282,0x147e,0x200f9,0xc6a,0x200f8,0xc6a,0x700f5,0x13,0x15e9,0x46d, + 0xb01,0x181a,0xc92,0x700f5,0x8,0x15e8,0x10f,0xb01,0x1819,0xc92,0x700f5,0x55, + 0x15e7,0x1a2,0xb01,0xc94,0xc92,0x500b1,0xa8,0xc6d,0x15e7,0x304,0x400f6,0xc95, + 0xc92,0x0,0x400fa,0xc6d,0xc6e,0xc95,0x200f8,0xc6e,0x50041,0x6e,0x1287,0x1281, + 0x15e7,0x4003d,0x56,0xc71,0x1287,0x50080,0x56,0xc75,0xcbc,0xc71,0x50051,0x55, + 0xcf0,0xc75,0x0,0x500af,0xa8,0xcf3,0xcf0,0x659,0x300f7,0xcfd,0x0,0x400fa, + 0xcf3,0xcf4,0xcfd,0x200f8,0xcf4,0x50051,0x55,0xcf8,0x653,0x0,0x50080,0x55, + 0xcfb,0xcf8,0x659,0x500b1,0xa8,0xcfc,0xcf0,0xcfb,0x200f9,0xcfd,0x200f8,0xcfd, + 0x700f5,0xa8,0xcfe,0xcf3,0xc6e,0xcfc,0xcf4,0x300f7,0xd05,0x0,0x400fa,0xcfe, + 0xcff,0xd05,0x200f8,0xcff,0x50051,0x55,0xd01,0xc75,0x1,0x50051,0x55,0xd03, + 0x64f,0x1,0x500af,0xa8,0xd04,0xd01,0xd03,0x200f9,0xd05,0x200f8,0xd05,0x700f5, + 0xa8,0xd06,0xcfe,0xcfd,0xd04,0xcff,0x300f7,0xd10,0x0,0x400fa,0xd06,0xd07, + 0xd10,0x200f8,0xd07,0x50051,0x55,0xd09,0xc75,0x1,0x50051,0x55,0xd0b,0x653, + 0x1,0x50051,0x55,0xd0d,0x64f,0x1,0x50080,0x55,0xd0e,0xd0b,0xd0d,0x500b1, + 0xa8,0xd0f,0xd09,0xd0e,0x200f9,0xd10,0x200f8,0xd10,0x700f5,0xa8,0xd11,0xd06, + 0xd05,0xd0f,0xd07,0x300f7,0xc91,0x0,0x400fa,0xd11,0xc7a,0xc91,0x200f8,0xc7a, + 0x50041,0xd,0x1288,0x1282,0x15e7,0x4003d,0x8,0xc7d,0x1288,0x4003d,0x1da,0xd14, + 0x1e3,0x7005f,0x76,0xd16,0xd14,0xc75,0x2,0x1a2,0x8004f,0x13,0xd17,0xd16, + 0xd16,0x0,0x1,0x2,0x5008e,0x13,0xc83,0xd17,0xc7d,0x50081,0x13,0xc85, + 0x15e9,0xc83,0x50081,0x8,0xc90,0x15e8,0xc7d,0x200f9,0xc91,0x200f8,0xc91,0x700f5, + 0x13,0x181a,0x15e9,0xd10,0xc85,0xc7a,0x700f5,0x8,0x1819,0x15e8,0xd10,0xc90, + 0xc7a,0x200f9,0xc92,0x200f8,0xc92,0x50080,0x55,0xc94,0x15e7,0x1a7,0x200f9,0xc6a, + 0x200f8,0xc95,0x500b7,0xa8,0xc97,0x15e8,0x10f,0x300f7,0xc9e,0x0,0x400fa,0xc97, + 0xc98,0xc9d,0x200f8,0xc9d,0x200f9,0xc9e,0x200f8,0xc98,0x60050,0x13,0xc9b,0x15e8, + 0x15e8,0x15e8,0x50088,0x13,0xc9c,0x15e9,0xc9b,0x200f9,0xc9e,0x200f8,0xc9e,0x700f5, + 0x13,0x15ea,0xc9c,0xc98,0x46d,0xc9d,0x50085,0xe,0x70b,0x156b,0x6ec,0x50081, + 0xe,0xe03,0x6e0,0x70b,0x50085,0xe,0xe55,0xe03,0x6df,0x50083,0xe,0xe56, + 0xe55,0x26d,0x6000c,0xe,0xe58,0x1,0x8,0xe56,0x4006e,0x56,0xe59,0xe58, + 0x6000c,0xe,0xe81,0x1,0xa,0xe56,0x50051,0x8,0xe62,0xe81,0x0,0x50083, + 0x8,0xe63,0x110,0xe62,0x50051,0x8,0xe65,0xe81,0x1,0x50083,0x8,0xe66, + 0x110,0xe65,0x50085,0x8,0xe67,0xe63,0xe66,0x50085,0x8,0xe6e,0xe62,0xe66, + 0x50085,0x8,0xe75,0xe63,0xe65,0x50085,0x8,0xe7b,0xe62,0xe65,0x70050,0xa1, + 0x1452,0xe67,0xe6e,0xe75,0xe7b,0x3003e,0x123b,0x1928,0x3003e,0x123c,0x1452,0x200f9, + 0xe07,0x200f8,0xe07,0x700f5,0x13,0x1619,0x46d,0xc9e,0x1840,0xe2f,0x700f5,0x8, + 0x1618,0x10f,0xc9e,0x183f,0xe2f,0x700f5,0x55,0x1617,0x1a2,0xc9e,0xe31,0xe2f, + 0x500b1,0xa8,0xe0a,0x1617,0x304,0x400f6,0xe32,0xe2f,0x0,0x400fa,0xe0a,0xe0b, + 0xe32,0x200f8,0xe0b,0x50041,0x6e,0x1241,0x123b,0x1617,0x4003d,0x56,0xe0e,0x1241, + 0x50080,0x56,0xe12,0xe59,0xe0e,0x50051,0x55,0xe8d,0xe12,0x0,0x500af,0xa8, + 0xe90,0xe8d,0x659,0x300f7,0xe9a,0x0,0x400fa,0xe90,0xe91,0xe9a,0x200f8,0xe91, + 0x50051,0x55,0xe95,0x653,0x0,0x50080,0x55,0xe98,0xe95,0x659,0x500b1,0xa8, + 0xe99,0xe8d,0xe98,0x200f9,0xe9a,0x200f8,0xe9a,0x700f5,0xa8,0xe9b,0xe90,0xe0b, + 0xe99,0xe91,0x300f7,0xea2,0x0,0x400fa,0xe9b,0xe9c,0xea2,0x200f8,0xe9c,0x50051, + 0x55,0xe9e,0xe12,0x1,0x50051,0x55,0xea0,0x64f,0x1,0x500af,0xa8,0xea1, + 0xe9e,0xea0,0x200f9,0xea2,0x200f8,0xea2,0x700f5,0xa8,0xea3,0xe9b,0xe9a,0xea1, + 0xe9c,0x300f7,0xead,0x0,0x400fa,0xea3,0xea4,0xead,0x200f8,0xea4,0x50051,0x55, + 0xea6,0xe12,0x1,0x50051,0x55,0xea8,0x653,0x1,0x50051,0x55,0xeaa,0x64f, + 0x1,0x50080,0x55,0xeab,0xea8,0xeaa,0x500b1,0xa8,0xeac,0xea6,0xeab,0x200f9, + 0xead,0x200f8,0xead,0x700f5,0xa8,0xeae,0xea3,0xea2,0xeac,0xea4,0x300f7,0xe2e, + 0x0,0x400fa,0xeae,0xe17,0xe2e,0x200f8,0xe17,0x50041,0xd,0x1242,0x123c,0x1617, + 0x4003d,0x8,0xe1a,0x1242,0x4003d,0x1da,0xeb7,0x1dc,0x7005f,0x76,0xeb9,0xeb7, + 0xe12,0x2,0x1a2,0x8004f,0x13,0xeba,0xeb9,0xeb9,0x0,0x1,0x2,0x5008e, + 0x13,0xe27,0xeba,0xe1a,0x50081,0x13,0xe29,0x1619,0xe27,0x50081,0x8,0xe2d, + 0x1618,0xe1a,0x200f9,0xe2e,0x200f8,0xe2e,0x700f5,0x13,0x1840,0x1619,0xead,0xe29, + 0xe17,0x700f5,0x8,0x183f,0x1618,0xead,0xe2d,0xe17,0x200f9,0xe2f,0x200f8,0xe2f, + 0x50080,0x55,0xe31,0x1617,0x1a7,0x200f9,0xe07,0x200f8,0xe32,0x500b7,0xa8,0xe34, + 0x1618,0x10f,0x300f7,0xe3b,0x0,0x400fa,0xe34,0xe35,0xe3a,0x200f8,0xe3a,0x200f9, + 0xe3b,0x200f8,0xe35,0x60050,0x13,0xe38,0x1618,0x1618,0x1618,0x50088,0x13,0xe39, + 0x1619,0xe38,0x200f9,0xe3b,0x200f8,0xe3b,0x700f5,0x13,0x161a,0xe39,0xe35,0x46d, + 0xe3a,0x4007f,0xe,0x711,0x156b,0x50085,0xe,0x713,0x711,0x6ec,0x50081,0xe, + 0xfa0,0x6e0,0x713,0x50085,0xe,0xff2,0xfa0,0x6df,0x50083,0xe,0xff3,0xff2, + 0x26d,0x6000c,0xe,0xff5,0x1,0x8,0xff3,0x4006e,0x56,0xff6,0xff5,0x6000c, + 0xe,0x101e,0x1,0xa,0xff3,0x50051,0x8,0xfff,0x101e,0x0,0x50083,0x8, + 0x1000,0x110,0xfff,0x50051,0x8,0x1002,0x101e,0x1,0x50083,0x8,0x1003,0x110, + 0x1002,0x50085,0x8,0x1004,0x1000,0x1003,0x50085,0x8,0x100b,0xfff,0x1003,0x50085, + 0x8,0x1012,0x1000,0x1002,0x50085,0x8,0x1018,0xfff,0x1002,0x70050,0xa1,0x1426, + 0x1004,0x100b,0x1012,0x1018,0x3003e,0x11f5,0x1928,0x3003e,0x11f6,0x1426,0x200f9,0xfa4, + 0x200f8,0xfa4,0x700f5,0x13,0x1649,0x46d,0xe3b,0x1866,0xfcc,0x700f5,0x8,0x1648, + 0x10f,0xe3b,0x1865,0xfcc,0x700f5,0x55,0x1647,0x1a2,0xe3b,0xfce,0xfcc,0x500b1, + 0xa8,0xfa7,0x1647,0x304,0x400f6,0xfcf,0xfcc,0x0,0x400fa,0xfa7,0xfa8,0xfcf, + 0x200f8,0xfa8,0x50041,0x6e,0x11fb,0x11f5,0x1647,0x4003d,0x56,0xfab,0x11fb,0x50080, + 0x56,0xfaf,0xff6,0xfab,0x50051,0x55,0x102a,0xfaf,0x0,0x500af,0xa8,0x102d, + 0x102a,0x659,0x300f7,0x1037,0x0,0x400fa,0x102d,0x102e,0x1037,0x200f8,0x102e,0x50051, + 0x55,0x1032,0x653,0x0,0x50080,0x55,0x1035,0x1032,0x659,0x500b1,0xa8,0x1036, + 0x102a,0x1035,0x200f9,0x1037,0x200f8,0x1037,0x700f5,0xa8,0x1038,0x102d,0xfa8,0x1036, + 0x102e,0x300f7,0x103f,0x0,0x400fa,0x1038,0x1039,0x103f,0x200f8,0x1039,0x50051,0x55, + 0x103b,0xfaf,0x1,0x50051,0x55,0x103d,0x64f,0x1,0x500af,0xa8,0x103e,0x103b, + 0x103d,0x200f9,0x103f,0x200f8,0x103f,0x700f5,0xa8,0x1040,0x1038,0x1037,0x103e,0x1039, + 0x300f7,0x104a,0x0,0x400fa,0x1040,0x1041,0x104a,0x200f8,0x1041,0x50051,0x55,0x1043, + 0xfaf,0x1,0x50051,0x55,0x1045,0x653,0x1,0x50051,0x55,0x1047,0x64f,0x1, + 0x50080,0x55,0x1048,0x1045,0x1047,0x500b1,0xa8,0x1049,0x1043,0x1048,0x200f9,0x104a, + 0x200f8,0x104a,0x700f5,0xa8,0x104b,0x1040,0x103f,0x1049,0x1041,0x300f7,0xfcb,0x0, + 0x400fa,0x104b,0xfb4,0xfcb,0x200f8,0xfb4,0x50041,0xd,0x11fc,0x11f6,0x1647,0x4003d, + 0x8,0xfb7,0x11fc,0x4003d,0x1da,0x104e,0x1e3,0x7005f,0x76,0x1050,0x104e,0xfaf, + 0x2,0x1a2,0x8004f,0x13,0x1051,0x1050,0x1050,0x0,0x1,0x2,0x5008e,0x13, + 0xfbd,0x1051,0xfb7,0x50081,0x13,0xfbf,0x1649,0xfbd,0x50081,0x8,0xfca,0x1648, + 0xfb7,0x200f9,0xfcb,0x200f8,0xfcb,0x700f5,0x13,0x1866,0x1649,0x104a,0xfbf,0xfb4, + 0x700f5,0x8,0x1865,0x1648,0x104a,0xfca,0xfb4,0x200f9,0xfcc,0x200f8,0xfcc,0x50080, + 0x55,0xfce,0x1647,0x1a7,0x200f9,0xfa4,0x200f8,0xfcf,0x500b7,0xa8,0xfd1,0x1648, + 0x10f,0x300f7,0xfd8,0x0,0x400fa,0xfd1,0xfd2,0xfd7,0x200f8,0xfd7,0x200f9,0xfd8, + 0x200f8,0xfd2,0x60050,0x13,0xfd5,0x1648,0x1648,0x1648,0x50088,0x13,0xfd6,0x1649, + 0xfd5,0x200f9,0xfd8,0x200f8,0xfd8,0x700f5,0x13,0x164a,0xfd6,0xfd2,0x46d,0xfd7, + 0x600a9,0x8,0x71a,0x919,0x110,0x10f,0x50051,0x8,0x71c,0x6f8,0x0,0x50085, + 0x8,0x71d,0x71c,0x71a,0x600a9,0x8,0x722,0x902,0x110,0x10f,0x50051,0x8, + 0x724,0x6f8,0x1,0x50085,0x8,0x725,0x724,0x722,0x50050,0xe,0x1a00,0x71d, + 0x725,0x6000c,0x8,0x728,0x1,0x42,0x1a00,0x500bc,0xa8,0x729,0x728,0x550, + 0x600a9,0x8,0x72a,0x729,0x110,0x10f,0x7000c,0x8,0x112e,0x1,0x28,0x10f, + 0x72a,0x8000c,0x8,0x1132,0x1,0x2b,0x112e,0x10f,0x110,0x50083,0x8,0x730, + 0x110,0x71d,0x50085,0x8,0x731,0x26c,0x730,0x50081,0x8,0x733,0x26c,0x731, + 0x50083,0x8,0x736,0x110,0x725,0x50085,0x8,0x737,0x26c,0x736,0x50083,0x8, + 0x739,0x733,0x737,0x8000c,0x8,0x1136,0x1,0x2b,0x739,0x10f,0x110,0x60050, + 0x13,0x113c,0x1136,0x1136,0x1136,0x8000c,0x13,0x113d,0x1,0x2e,0x15bf,0x15ea, + 0x113c,0x7000c,0x8,0x1142,0x1,0x25,0x71d,0x725,0x50083,0x8,0x746,0x110, + 0x1142,0x8000c,0x8,0x1146,0x1,0x2b,0x746,0x10f,0x110,0x500b4,0xa8,0x74a, + 0x15bd,0x10f,0x300f7,0x756,0x0,0x400fa,0x74a,0x74b,0x74e,0x200f8,0x74e,0x500b4, + 0xa8,0x751,0x15e8,0x10f,0x60050,0x193e,0x193f,0x751,0x751,0x751,0x600a9,0x13, + 0x1940,0x193f,0x15bf,0x113d,0x200f9,0x756,0x200f8,0x74b,0x200f9,0x756,0x200f8,0x756, + 0x700f5,0x13,0x171d,0x15ea,0x74b,0x1940,0x74e,0x300f7,0x75e,0x0,0x400fa,0x74a, + 0x75a,0x75e,0x200f8,0x75a,0x500b4,0xa8,0x75d,0x15e8,0x10f,0x200f9,0x75e,0x200f8, + 0x75e,0x700f5,0xa8,0x75f,0x74a,0x756,0x75d,0x75a,0x600a9,0x8,0x1941,0x75f, + 0x110,0x1132,0x500ba,0xa8,0x764,0x1618,0x10f,0x300f7,0x769,0x0,0x400fa,0x764, + 0x765,0x769,0x200f8,0x765,0x500ba,0xa8,0x768,0x1648,0x10f,0x200f9,0x769,0x200f8, + 0x769,0x700f5,0xa8,0x76a,0x764,0x75e,0x768,0x765,0x300f7,0x773,0x0,0x400fa, + 0x76a,0x76b,0x76c,0x200f8,0x76c,0x600a9,0x8,0x1942,0x764,0x10f,0x110,0x200f9, + 0x773,0x200f8,0x76b,0x200f9,0x773,0x200f8,0x773,0x700f5,0x8,0x16f7,0x26c,0x76b, + 0x1942,0x76c,0x60050,0x13,0x114c,0x16f7,0x16f7,0x16f7,0x8000c,0x13,0x114d,0x1, + 0x2e,0x161a,0x164a,0x114c,0x6000c,0x8,0x1154,0x1,0x42,0x161a,0x6000c,0x8, + 0x1155,0x1,0x42,0x164a,0x7000c,0x8,0x1168,0x1,0x28,0x1154,0x1155,0x500ba, + 0xa8,0x1158,0x1168,0x10f,0x300f7,0x1162,0x0,0x400fa,0x1158,0x1159,0x1161,0x200f8, + 0x1161,0x200f9,0x1162,0x200f8,0x1159,0x60050,0x13,0x115b,0x1168,0x1168,0x1168,0x50088, + 0x13,0x115c,0x161a,0x115b,0x50088,0x13,0x115f,0x164a,0x115b,0x50094,0x8,0x1160, + 0x115c,0x115f,0x200f9,0x1162,0x200f8,0x1162,0x700f5,0x8,0x16f9,0x1160,0x1159,0x110, + 0x1161,0x6000c,0x8,0x116f,0x1,0x42,0x15bf,0x6000c,0x8,0x1170,0x1,0x42, + 0x15ea,0x7000c,0x8,0x1183,0x1,0x28,0x116f,0x1170,0x500ba,0xa8,0x1173,0x1183, + 0x10f,0x300f7,0x117d,0x0,0x400fa,0x1173,0x1174,0x117c,0x200f8,0x117c,0x200f9,0x117d, + 0x200f8,0x1174,0x60050,0x13,0x1176,0x1183,0x1183,0x1183,0x50088,0x13,0x1177,0x15bf, + 0x1176,0x50088,0x13,0x117a,0x15ea,0x1176,0x50094,0x8,0x117b,0x1177,0x117a,0x200f9, + 0x117d,0x200f8,0x117d,0x700f5,0x8,0x170a,0x117b,0x1174,0x110,0x117c,0x7000c,0x8, + 0x1188,0x1,0x28,0x550,0x170a,0x8000c,0x8,0x118c,0x1,0x2b,0x1146,0x10f, + 0x110,0x8000c,0x8,0x1192,0x1,0x2e,0x1188,0x110,0x118c,0x7000c,0x8,0x1197, + 0x1,0x28,0x550,0x16f9,0x50088,0x8,0x78c,0x1192,0x1197,0x8000c,0x8,0x119b, + 0x1,0x2b,0x78c,0x10f,0x110,0x7000c,0x8,0x11a0,0x1,0x1a,0x119b,0x110, + 0x60041,0x228,0x11a8,0x226,0x1a2,0x1a7,0x4003d,0x6,0x11a9,0x11a8,0x500b0,0xa8, + 0x790,0x11a9,0x5d6,0x600a9,0x8,0x791,0x790,0x110,0x10f,0x8000c,0x8,0x11af, + 0x1,0x2e,0x11a0,0x110,0x791,0x8000c,0x8,0x11b3,0x1,0x2b,0x11af,0x10f, + 0x110,0x60050,0x13,0x11b9,0x11b3,0x11b3,0x11b3,0x8000c,0x13,0x11ba,0x1,0x2e, + 0x114d,0x171d,0x11b9,0x200f9,0x643,0x200f8,0x639,0x4003d,0x1da,0x684,0x1e3,0x7005f, + 0x76,0x686,0x684,0x616,0x2,0x1a2,0x8004f,0x13,0x687,0x686,0x686,0x0, + 0x1,0x2,0x200f9,0x643,0x200f8,0x643,0x700f5,0x8,0x17df,0x10f,0x639,0x1941, + 0x117d,0x700f5,0x13,0x17de,0x687,0x639,0x11ba,0x117d,0x50051,0x8,0x647,0x17de, + 0x0,0x50051,0x8,0x648,0x17de,0x1,0x50051,0x8,0x649,0x17de,0x2,0x70050, + 0x76,0x64a,0x647,0x648,0x649,0x17df,0x4003d,0x231,0x11bc,0x233,0x40063,0x11bc, + 0x616,0x64a,0x100fd,0x10038, +}; +static const char *fi_pass_0_cb_names[] = {"cbFI"}; +static const uint32_t fi_pass_0_cb_bind[] = {10}; +static const uint32_t fi_pass_0_cb_count[] = {1}; +static const uint32_t fi_pass_0_cb_space[] = {0}; +static const char *fi_pass_0_srv_tex_names[] = {"r_game_motion_vector_field_x", "r_game_motion_vector_field_y", "r_optical_flow_motion_vector_field_x", "r_optical_flow_motion_vector_field_y", "r_previous_interpolation_source", "r_current_interpolation_source", "r_disocclusion_mask", "r_inpainting_pyramid"}; +static const uint32_t fi_pass_0_srv_tex_bind[] = {0, 1, 2, 3, 4, 5, 6, 7}; +static const uint32_t fi_pass_0_srv_tex_count[] = {1, 1, 1, 1, 1, 1, 1, 1}; +static const uint32_t fi_pass_0_srv_tex_space[] = {0, 0, 0, 0, 0, 0, 0, 0}; +static const char *fi_pass_0_uav_tex_names[] = {"rw_output"}; +static const uint32_t fi_pass_0_uav_tex_bind[] = {9}; +static const uint32_t fi_pass_0_uav_tex_count[] = {1}; +static const uint32_t fi_pass_0_uav_tex_space[] = {0}; +static const char *fi_pass_0_srv_buf_names[] = {"r_counters"}; +static const uint32_t fi_pass_0_srv_buf_bind[] = {8}; +static const uint32_t fi_pass_0_srv_buf_count[] = {1}; +static const uint32_t fi_pass_0_srv_buf_space[] = {0}; +static const char *fi_pass_0_sampler_names[] = {"s_LinearClamp"}; +static const uint32_t fi_pass_0_sampler_bind[] = {1000}; +static const uint32_t fi_pass_0_sampler_count[] = {1}; +static const uint32_t fi_pass_0_sampler_space[] = {0}; + +static const uint32_t fi_compute_inpainting_pyramid_pass_0_spv[10127] = { + 0x7230203,0x10500,0x8000b,0x42d7,0x0,0x20011,0x1,0x20011,0x3d,0x20011,0x44,0x6000b, + 0x1,0x4c534c47,0x6474732e,0x3035342e,0x0,0x3000e,0x0,0x1,0x1c000f,0x5,0x4,0x6e69616d, + 0x0,0x12c,0x13f,0x151,0x15a,0x169,0x172,0x17b,0x184,0x18e,0x198,0x1a2, + 0x1ac,0x1b6,0x1c0,0x1ca,0x1d4,0x28a,0x299,0x29f,0x2a4,0x2a9,0x70d,0x711, + 0x60010,0x4,0x11,0x100,0x1,0x1,0x30003,0x2,0x1c2,0xb0004,0x455f4c47,0x735f5458, + 0x6c706d61,0x656c7265,0x745f7373,0x75747865,0x665f6572,0x74636e75,0x736e6f69,0x0,0xb0004,0x455f4c47,0x735f5458,0x65646168, + 0x78655f72,0x63696c70,0x615f7469,0x68746972,0x6974656d,0x79745f63,0x736570,0xa0004,0x475f4c47,0x4c474f4f,0x70635f45,0x74735f70, + 0x5f656c79,0x656e696c,0x7269645f,0x69746365,0x6576,0x80004,0x475f4c47,0x4c474f4f,0x6e695f45,0x64756c63,0x69645f65,0x74636572, + 0x657669,0x90004,0x4b5f4c47,0x735f5248,0x65646168,0x75735f72,0x6f726762,0x625f7075,0x63697361,0x0,0x80004,0x4b5f4c47, + 0x735f5248,0x65646168,0x75735f72,0x6f726762,0x715f7075,0x646175,0x40005,0x4,0x6e69616d,0x0,0x40005,0x12a, + 0x49466263,0x745f,0x60006,0x12a,0x0,0x70736964,0x5379616c,0x657a69,0x90006,0x12a,0x1,0x65746e69, + 0x6c6f7072,0x6f697461,0x6365526e,0x73614274,0x65,0x90006,0x12a,0x2,0x65746e69,0x6c6f7072,0x6f697461,0x6365526e, + 0x7a695374,0x65,0x40005,0x12c,0x49466263,0x0,0x80005,0x13d,0x6e496263,0x6e696170,0x676e6974,0x61727950, + 0x5f64696d,0x74,0x50006,0x13d,0x0,0x7370696d,0x0,0x70006,0x13d,0x1,0x576d756e,0x476b726f, + 0x70756f72,0x73,0x70006,0x13d,0x2,0x6b726f77,0x756f7247,0x66664f70,0x746573,0x70005,0x13f,0x6e496263, + 0x6e696170,0x676e6974,0x61727950,0x64696d,0x50005,0x151,0x756f5f72,0x74757074,0x0,0xa0005,0x158,0x6d617246, + 0x746e4965,0x6f707265,0x6974616c,0x57526e6f,0x6e756f43,0x73726574,0x745f,0x50006,0x158,0x0,0x61746164,0x0, + 0x50005,0x15a,0x635f7772,0x746e756f,0x737265,0x80005,0x169,0x695f7772,0x6961706e,0x6e69746e,0x79705f67,0x696d6172, + 0x3064,0x80005,0x172,0x695f7772,0x6961706e,0x6e69746e,0x79705f67,0x696d6172,0x3164,0x80005,0x17b,0x695f7772, + 0x6961706e,0x6e69746e,0x79705f67,0x696d6172,0x3264,0x80005,0x184,0x695f7772,0x6961706e,0x6e69746e,0x79705f67,0x696d6172, + 0x3364,0x80005,0x18e,0x695f7772,0x6961706e,0x6e69746e,0x79705f67,0x696d6172,0x3464,0x80005,0x198,0x695f7772, + 0x6961706e,0x6e69746e,0x79705f67,0x696d6172,0x3564,0x80005,0x1a2,0x695f7772,0x6961706e,0x6e69746e,0x79705f67,0x696d6172, + 0x3664,0x80005,0x1ac,0x695f7772,0x6961706e,0x6e69746e,0x79705f67,0x696d6172,0x3764,0x80005,0x1b6,0x695f7772, + 0x6961706e,0x6e69746e,0x79705f67,0x696d6172,0x3864,0x80005,0x1c0,0x695f7772,0x6961706e,0x6e69746e,0x79705f67,0x696d6172, + 0x3964,0x80005,0x1ca,0x695f7772,0x6961706e,0x6e69746e,0x79705f67,0x696d6172,0x303164,0x80005,0x1d4,0x695f7772, + 0x6961706e,0x6e69746e,0x79705f67,0x696d6172,0x313164,0x50005,0x28a,0x43647073,0x746e756f,0x7265,0x70005,0x299, + 0x49647073,0x7265746e,0x6964656d,0x52657461,0x0,0x70005,0x29f,0x49647073,0x7265746e,0x6964656d,0x47657461,0x0, + 0x70005,0x2a4,0x49647073,0x7265746e,0x6964656d,0x42657461,0x0,0x70005,0x2a9,0x49647073,0x7265746e,0x6964656d, + 0x41657461,0x0,0x60005,0x70d,0x575f6c67,0x476b726f,0x70756f72,0x4449,0x80005,0x711,0x4c5f6c67,0x6c61636f, + 0x6f766e49,0x69746163,0x6e496e6f,0x786564,0x30047,0x12a,0x2,0x50048,0x12a,0x0,0x23,0x8, + 0x50048,0x12a,0x1,0x23,0x70,0x50048,0x12a,0x2,0x23,0x78,0x40047,0x12c, + 0x21,0xf,0x40047,0x12c,0x22,0x0,0x30047,0x13d,0x2,0x50048,0x13d,0x0, + 0x23,0x0,0x50048,0x13d,0x1,0x23,0x4,0x50048,0x13d,0x2,0x23,0x8, + 0x40047,0x13f,0x21,0x10,0x40047,0x13f,0x22,0x0,0x40047,0x151,0x21,0x0, + 0x40047,0x151,0x22,0x0,0x40047,0x157,0x6,0x4,0x30047,0x158,0x2,0x40048, + 0x158,0x0,0x17,0x50048,0x158,0x0,0x23,0x0,0x30047,0x15a,0x17,0x40047, + 0x15a,0x21,0x1,0x40047,0x15a,0x22,0x0,0x40047,0x169,0x21,0x2,0x40047, + 0x169,0x22,0x0,0x40047,0x172,0x21,0x3,0x40047,0x172,0x22,0x0,0x40047, + 0x17b,0x21,0x4,0x40047,0x17b,0x22,0x0,0x40047,0x184,0x21,0x5,0x40047, + 0x184,0x22,0x0,0x40047,0x18e,0x21,0x6,0x40047,0x18e,0x22,0x0,0x30047, + 0x198,0x17,0x40047,0x198,0x21,0x7,0x40047,0x198,0x22,0x0,0x40047,0x1a2, + 0x21,0x8,0x40047,0x1a2,0x22,0x0,0x40047,0x1ac,0x21,0x9,0x40047,0x1ac, + 0x22,0x0,0x40047,0x1b6,0x21,0xa,0x40047,0x1b6,0x22,0x0,0x40047,0x1c0, + 0x21,0xb,0x40047,0x1c0,0x22,0x0,0x40047,0x1ca,0x21,0xc,0x40047,0x1ca, + 0x22,0x0,0x40047,0x1d4,0x21,0xd,0x40047,0x1d4,0x22,0x0,0x40047,0x70d, + 0xb,0x1a,0x40047,0x711,0xb,0x1d,0x40047,0x725,0xb,0x19,0x20013,0x2, + 0x30021,0x3,0x2,0x40015,0x6,0x20,0x0,0x30016,0x13,0x20,0x40017,0x19, + 0x6,0x2,0x40015,0x1e,0x20,0x1,0x40017,0x1f,0x1e,0x2,0x40017,0x30, + 0x13,0x4,0x20014,0x77,0x40017,0xed,0x1e,0x3,0x4002b,0x1e,0xfe,0x0, + 0x4002b,0x13,0x105,0x0,0x4002b,0x13,0x106,0x3f800000,0x4002b,0x6,0x10a,0x2, + 0x4002b,0x6,0x10b,0x3,0x4002b,0x6,0x111,0x1,0x5001e,0x12a,0x1f,0x1f, + 0x1f,0x40020,0x12b,0x2,0x12a,0x4003b,0x12b,0x12c,0x2,0x40020,0x12e,0x2, + 0x1f,0x4002b,0x1e,0x138,0x1,0x5001e,0x13d,0x6,0x6,0x19,0x40020,0x13e, + 0x2,0x13d,0x4003b,0x13e,0x13f,0x2,0x40020,0x140,0x2,0x6,0x4002b,0x1e, + 0x149,0x2,0x40020,0x14a,0x2,0x19,0x90019,0x14f,0x13,0x1,0x0,0x0, + 0x0,0x1,0x0,0x40020,0x150,0x0,0x14f,0x4003b,0x150,0x151,0x0,0x3001d, + 0x157,0x6,0x3001e,0x158,0x157,0x40020,0x159,0xc,0x158,0x4003b,0x159,0x15a, + 0xc,0x40020,0x15d,0xc,0x6,0x4002b,0x6,0x161,0x0,0x90019,0x167,0x13, + 0x1,0x0,0x0,0x0,0x2,0x2,0x40020,0x168,0x0,0x167,0x4003b,0x168, + 0x169,0x0,0x4003b,0x168,0x172,0x0,0x4003b,0x168,0x17b,0x0,0x4003b,0x168, + 0x184,0x0,0x4002b,0x6,0x18a,0x4,0x4003b,0x168,0x18e,0x0,0x4002b,0x6, + 0x194,0x5,0x4003b,0x168,0x198,0x0,0x4002b,0x6,0x19e,0x6,0x4003b,0x168, + 0x1a2,0x0,0x4002b,0x6,0x1a8,0x7,0x4003b,0x168,0x1ac,0x0,0x4002b,0x6, + 0x1b2,0x8,0x4003b,0x168,0x1b6,0x0,0x4002b,0x6,0x1bc,0x9,0x4003b,0x168, + 0x1c0,0x0,0x4002b,0x6,0x1c6,0xa,0x4003b,0x168,0x1ca,0x0,0x4002b,0x6, + 0x1d0,0xb,0x4003b,0x168,0x1d4,0x0,0x7002c,0x30,0x1e3,0x105,0x105,0x105, + 0x105,0x40020,0x289,0x4,0x6,0x4003b,0x289,0x28a,0x4,0x4002b,0x6,0x295, + 0x10,0x4001c,0x296,0x13,0x295,0x4001c,0x297,0x296,0x295,0x40020,0x298,0x4, + 0x297,0x4003b,0x298,0x299,0x4,0x40020,0x29c,0x4,0x13,0x4003b,0x298,0x29f, + 0x4,0x4003b,0x298,0x2a4,0x4,0x4003b,0x298,0x2a9,0x4,0x4002b,0x6,0x2f8, + 0xd48,0x4002b,0x6,0x2f9,0x108,0x5002c,0x19,0x34b,0x161,0x111,0x5002c,0x19, + 0x34e,0x111,0x161,0x5002c,0x19,0x351,0x111,0x111,0x4002b,0x6,0x396,0x40, + 0x4002b,0x6,0x3a4,0x20,0x4002b,0x1e,0x42b,0x3,0x4002b,0x1e,0x69c,0x6, + 0x4002b,0x1e,0x6a5,0x7,0x40017,0x70b,0x6,0x3,0x40020,0x70c,0x1,0x70b, + 0x4003b,0x70c,0x70d,0x1,0x40020,0x710,0x1,0x6,0x4003b,0x710,0x711,0x1, + 0x4002b,0x6,0x724,0x100,0x6002c,0x70b,0x725,0x724,0x111,0x111,0x5002c,0x19, + 0x40d6,0x396,0x396,0x5002c,0x19,0x40d7,0x3a4,0x3a4,0x5002c,0x19,0x40d8,0x1b2, + 0x1b2,0x5002c,0x19,0x40d9,0x18a,0x18a,0x5002c,0x19,0x40da,0x295,0x295,0x5002c, + 0x19,0x40db,0x10a,0x10a,0x5002c,0x1f,0x40dc,0xfe,0xfe,0x50036,0x2,0x4, + 0x0,0x3,0x200f8,0x5,0x4003d,0x70b,0x70e,0x70d,0x4007c,0xed,0x70f,0x70e, + 0x4003d,0x6,0x712,0x711,0x7004f,0x1f,0x747,0x70f,0x70f,0x0,0x1,0x4007c, + 0x19,0x748,0x747,0x50041,0x140,0x754,0x13f,0xfe,0x4003d,0x6,0x755,0x754, + 0x50041,0x140,0x758,0x13f,0x138,0x4003d,0x6,0x759,0x758,0x50041,0x14a,0x75c, + 0x13f,0x149,0x4003d,0x19,0x75d,0x75c,0x50080,0x19,0x766,0x748,0x75d,0x300f7, + 0x7c4,0x0,0x300fb,0x161,0x78e,0x200f8,0x78e,0x50089,0x6,0x790,0x712,0x396, + 0x600cb,0x6,0x7e7,0x790,0x149,0x42b,0x700c9,0x6,0x7ee,0x7e7,0x790,0xfe, + 0x138,0x600cb,0x6,0x7f6,0x790,0x42b,0x42b,0x600cb,0x6,0x7fe,0x790,0x138, + 0x149,0x700c9,0x6,0x805,0x7f6,0x7fe,0xfe,0x149,0x500c2,0x6,0x795,0x712, + 0x69c,0x50089,0x6,0x796,0x795,0x10a,0x50084,0x6,0x797,0x1b2,0x796,0x50080, + 0x6,0x798,0x7ee,0x797,0x500c2,0x6,0x79c,0x712,0x6a5,0x50084,0x6,0x79d, + 0x1b2,0x79c,0x50080,0x6,0x79e,0x805,0x79d,0x300f7,0x957,0x0,0x300fb,0x161, + 0x851,0x200f8,0x851,0x50084,0x19,0x854,0x766,0x40d6,0x4007c,0x1f,0x855,0x854, + 0x50084,0x6,0x857,0x798,0x10a,0x4007c,0x1e,0x858,0x857,0x50084,0x6,0x85a, + 0x79e,0x10a,0x4007c,0x1e,0x85b,0x85a,0x50050,0x1f,0x85c,0x858,0x85b,0x50080, + 0x1f,0x85d,0x855,0x85c,0x50084,0x19,0x860,0x766,0x40d7,0x4007c,0x1f,0x861, + 0x860,0x4007c,0x1e,0x863,0x798,0x4007c,0x1e,0x865,0x79e,0x50050,0x1f,0x866, + 0x863,0x865,0x50080,0x1f,0x867,0x861,0x866,0x4007c,0x19,0x869,0x85d,0x50080, + 0x19,0x962,0x869,0x34b,0x50080,0x19,0x964,0x869,0x34e,0x50080,0x19,0x966, + 0x869,0x351,0x4003d,0x14f,0x9cd,0x151,0x7005f,0x30,0x9cf,0x9cd,0x85d,0x2, + 0xfe,0x50041,0x12e,0x9d2,0x12c,0x161,0x4003d,0x1f,0x9d3,0x9d2,0x50051,0x1e, + 0x998,0x9d3,0x0,0x500ad,0x77,0x999,0x998,0xfe,0x600a9,0x13,0x99a,0x999, + 0x106,0x105,0x5008e,0x30,0x99b,0x9cf,0x99a,0x50051,0x13,0x99d,0x99b,0x3, + 0x50083,0x13,0x99e,0x106,0x99d,0x8000c,0x13,0x9d7,0x1,0x2b,0x99e,0x105, + 0x106,0x60052,0x30,0x40e1,0x9d7,0x99b,0x3,0x50051,0x1e,0x9a2,0x85d,0x0, + 0x50041,0x12e,0x9da,0x12c,0x111,0x4003d,0x1f,0x9db,0x9da,0x50051,0x1e,0x9a4, + 0x9db,0x0,0x500b1,0x77,0x9a5,0x9a2,0x9a4,0x400a8,0x77,0x9a6,0x9a5,0x300f7, + 0x9b0,0x0,0x400fa,0x9a6,0x9a7,0x9b0,0x200f8,0x9a7,0x50041,0x12e,0x9de,0x12c, + 0x10a,0x4003d,0x1f,0x9df,0x9de,0x50051,0x1e,0x9ab,0x9df,0x0,0x50080,0x1e, + 0x9ae,0x9ab,0x9a4,0x500af,0x77,0x9af,0x9a2,0x9ae,0x200f9,0x9b0,0x200f8,0x9b0, + 0x700f5,0x77,0x9b1,0x9a5,0x851,0x9af,0x9a7,0x400a8,0x77,0x9b2,0x9b1,0x300f7, + 0x9b9,0x0,0x400fa,0x9b2,0x9b3,0x9b9,0x200f8,0x9b3,0x50051,0x1e,0x9b5,0x85d, + 0x1,0x50051,0x1e,0x9b7,0x9db,0x1,0x500b1,0x77,0x9b8,0x9b5,0x9b7,0x200f9, + 0x9b9,0x200f8,0x9b9,0x700f5,0x77,0x9ba,0x9b1,0x9b0,0x9b8,0x9b3,0x400a8,0x77, + 0x9bb,0x9ba,0x300f7,0x9c5,0x0,0x400fa,0x9bb,0x9bc,0x9c5,0x200f8,0x9bc,0x50051, + 0x1e,0x9be,0x85d,0x1,0x50041,0x12e,0x9ea,0x12c,0x10a,0x4003d,0x1f,0x9eb, + 0x9ea,0x50051,0x1e,0x9c0,0x9eb,0x1,0x50051,0x1e,0x9c2,0x9db,0x1,0x50080, + 0x1e,0x9c3,0x9c0,0x9c2,0x500af,0x77,0x9c4,0x9be,0x9c3,0x200f9,0x9c5,0x200f8, + 0x9c5,0x700f5,0x77,0x9c6,0x9ba,0x9b9,0x9c4,0x9bc,0x300f7,0x9c9,0x0,0x400fa, + 0x9c6,0x9c7,0x9c9,0x200f8,0x9c7,0x60052,0x30,0x40e7,0x105,0x40e1,0x3,0x200f9, + 0x9c9,0x200f8,0x9c9,0x700f5,0x30,0x429a,0x40e1,0x9c5,0x40e7,0x9c7,0x4007c,0x1f, + 0x980,0x962,0x4003d,0x14f,0xa2d,0x151,0x7005f,0x30,0xa2f,0xa2d,0x980,0x2, + 0xfe,0x5008e,0x30,0x9fb,0xa2f,0x99a,0x50051,0x13,0x9fd,0x9fb,0x3,0x50083, + 0x13,0x9fe,0x106,0x9fd,0x8000c,0x13,0xa37,0x1,0x2b,0x9fe,0x105,0x106, + 0x60052,0x30,0x40ea,0xa37,0x9fb,0x3,0x50051,0x1e,0xa02,0x980,0x0,0x500b1, + 0x77,0xa05,0xa02,0x9a4,0x400a8,0x77,0xa06,0xa05,0x300f7,0xa10,0x0,0x400fa, + 0xa06,0xa07,0xa10,0x200f8,0xa07,0x50041,0x12e,0xa3e,0x12c,0x10a,0x4003d,0x1f, + 0xa3f,0xa3e,0x50051,0x1e,0xa0b,0xa3f,0x0,0x50080,0x1e,0xa0e,0xa0b,0x9a4, + 0x500af,0x77,0xa0f,0xa02,0xa0e,0x200f9,0xa10,0x200f8,0xa10,0x700f5,0x77,0xa11, + 0xa05,0x9c9,0xa0f,0xa07,0x400a8,0x77,0xa12,0xa11,0x300f7,0xa19,0x0,0x400fa, + 0xa12,0xa13,0xa19,0x200f8,0xa13,0x50051,0x1e,0xa15,0x980,0x1,0x50051,0x1e, + 0xa17,0x9db,0x1,0x500b1,0x77,0xa18,0xa15,0xa17,0x200f9,0xa19,0x200f8,0xa19, + 0x700f5,0x77,0xa1a,0xa11,0xa10,0xa18,0xa13,0x400a8,0x77,0xa1b,0xa1a,0x300f7, + 0xa25,0x0,0x400fa,0xa1b,0xa1c,0xa25,0x200f8,0xa1c,0x50051,0x1e,0xa1e,0x980, + 0x1,0x50041,0x12e,0xa4a,0x12c,0x10a,0x4003d,0x1f,0xa4b,0xa4a,0x50051,0x1e, + 0xa20,0xa4b,0x1,0x50051,0x1e,0xa22,0x9db,0x1,0x50080,0x1e,0xa23,0xa20, + 0xa22,0x500af,0x77,0xa24,0xa1e,0xa23,0x200f9,0xa25,0x200f8,0xa25,0x700f5,0x77, + 0xa26,0xa1a,0xa19,0xa24,0xa1c,0x300f7,0xa29,0x0,0x400fa,0xa26,0xa27,0xa29, + 0x200f8,0xa27,0x60052,0x30,0x40f0,0x105,0x40ea,0x3,0x200f9,0xa29,0x200f8,0xa29, + 0x700f5,0x30,0x429e,0x40ea,0xa25,0x40f0,0xa27,0x4007c,0x1f,0x984,0x964,0x4003d, + 0x14f,0xa8d,0x151,0x7005f,0x30,0xa8f,0xa8d,0x984,0x2,0xfe,0x5008e,0x30, + 0xa5b,0xa8f,0x99a,0x50051,0x13,0xa5d,0xa5b,0x3,0x50083,0x13,0xa5e,0x106, + 0xa5d,0x8000c,0x13,0xa97,0x1,0x2b,0xa5e,0x105,0x106,0x60052,0x30,0x40f3, + 0xa97,0xa5b,0x3,0x50051,0x1e,0xa62,0x984,0x0,0x500b1,0x77,0xa65,0xa62, + 0x9a4,0x400a8,0x77,0xa66,0xa65,0x300f7,0xa70,0x0,0x400fa,0xa66,0xa67,0xa70, + 0x200f8,0xa67,0x50041,0x12e,0xa9e,0x12c,0x10a,0x4003d,0x1f,0xa9f,0xa9e,0x50051, + 0x1e,0xa6b,0xa9f,0x0,0x50080,0x1e,0xa6e,0xa6b,0x9a4,0x500af,0x77,0xa6f, + 0xa62,0xa6e,0x200f9,0xa70,0x200f8,0xa70,0x700f5,0x77,0xa71,0xa65,0xa29,0xa6f, + 0xa67,0x400a8,0x77,0xa72,0xa71,0x300f7,0xa79,0x0,0x400fa,0xa72,0xa73,0xa79, + 0x200f8,0xa73,0x50051,0x1e,0xa75,0x984,0x1,0x50051,0x1e,0xa77,0x9db,0x1, + 0x500b1,0x77,0xa78,0xa75,0xa77,0x200f9,0xa79,0x200f8,0xa79,0x700f5,0x77,0xa7a, + 0xa71,0xa70,0xa78,0xa73,0x400a8,0x77,0xa7b,0xa7a,0x300f7,0xa85,0x0,0x400fa, + 0xa7b,0xa7c,0xa85,0x200f8,0xa7c,0x50051,0x1e,0xa7e,0x984,0x1,0x50041,0x12e, + 0xaaa,0x12c,0x10a,0x4003d,0x1f,0xaab,0xaaa,0x50051,0x1e,0xa80,0xaab,0x1, + 0x50051,0x1e,0xa82,0x9db,0x1,0x50080,0x1e,0xa83,0xa80,0xa82,0x500af,0x77, + 0xa84,0xa7e,0xa83,0x200f9,0xa85,0x200f8,0xa85,0x700f5,0x77,0xa86,0xa7a,0xa79, + 0xa84,0xa7c,0x300f7,0xa89,0x0,0x400fa,0xa86,0xa87,0xa89,0x200f8,0xa87,0x60052, + 0x30,0x40f9,0x105,0x40f3,0x3,0x200f9,0xa89,0x200f8,0xa89,0x700f5,0x30,0x42a2, + 0x40f3,0xa85,0x40f9,0xa87,0x4007c,0x1f,0x988,0x966,0x4003d,0x14f,0xaed,0x151, + 0x7005f,0x30,0xaef,0xaed,0x988,0x2,0xfe,0x5008e,0x30,0xabb,0xaef,0x99a, + 0x50051,0x13,0xabd,0xabb,0x3,0x50083,0x13,0xabe,0x106,0xabd,0x8000c,0x13, + 0xaf7,0x1,0x2b,0xabe,0x105,0x106,0x60052,0x30,0x40fc,0xaf7,0xabb,0x3, + 0x50051,0x1e,0xac2,0x988,0x0,0x500b1,0x77,0xac5,0xac2,0x9a4,0x400a8,0x77, + 0xac6,0xac5,0x300f7,0xad0,0x0,0x400fa,0xac6,0xac7,0xad0,0x200f8,0xac7,0x50041, + 0x12e,0xafe,0x12c,0x10a,0x4003d,0x1f,0xaff,0xafe,0x50051,0x1e,0xacb,0xaff, + 0x0,0x50080,0x1e,0xace,0xacb,0x9a4,0x500af,0x77,0xacf,0xac2,0xace,0x200f9, + 0xad0,0x200f8,0xad0,0x700f5,0x77,0xad1,0xac5,0xa89,0xacf,0xac7,0x400a8,0x77, + 0xad2,0xad1,0x300f7,0xad9,0x0,0x400fa,0xad2,0xad3,0xad9,0x200f8,0xad3,0x50051, + 0x1e,0xad5,0x988,0x1,0x50051,0x1e,0xad7,0x9db,0x1,0x500b1,0x77,0xad8, + 0xad5,0xad7,0x200f9,0xad9,0x200f8,0xad9,0x700f5,0x77,0xada,0xad1,0xad0,0xad8, + 0xad3,0x400a8,0x77,0xadb,0xada,0x300f7,0xae5,0x0,0x400fa,0xadb,0xadc,0xae5, + 0x200f8,0xadc,0x50051,0x1e,0xade,0x988,0x1,0x50041,0x12e,0xb0a,0x12c,0x10a, + 0x4003d,0x1f,0xb0b,0xb0a,0x50051,0x1e,0xae0,0xb0b,0x1,0x50051,0x1e,0xae2, + 0x9db,0x1,0x50080,0x1e,0xae3,0xae0,0xae2,0x500af,0x77,0xae4,0xade,0xae3, + 0x200f9,0xae5,0x200f8,0xae5,0x700f5,0x77,0xae6,0xada,0xad9,0xae4,0xadc,0x300f7, + 0xae9,0x0,0x400fa,0xae6,0xae7,0xae9,0x200f8,0xae7,0x60052,0x30,0x4102,0x105, + 0x40fc,0x3,0x200f9,0xae9,0x200f8,0xae9,0x700f5,0x30,0x42a6,0x40fc,0xae5,0x4102, + 0xae7,0x300f7,0xb45,0x0,0x300fb,0x161,0xb16,0x200f8,0xb16,0x50051,0x13,0xb18, + 0x429a,0x3,0x50051,0x13,0xb1a,0x429e,0x3,0x50051,0x13,0xb1c,0x42a2,0x3, + 0x50051,0x13,0xb1e,0x42a6,0x3,0x50081,0x13,0xb24,0xb18,0xb1a,0x50081,0x13, + 0xb27,0xb24,0xb1c,0x50081,0x13,0xb2a,0xb27,0xb1e,0x500b4,0x77,0xb2c,0xb2a, + 0x105,0x300f7,0xb2e,0x0,0x400fa,0xb2c,0xb2d,0xb2e,0x200f8,0xb2d,0x200f9,0xb45, + 0x200f8,0xb2e,0x5008e,0x30,0xb32,0x429a,0xb18,0x5008e,0x30,0xb36,0x429e,0xb1a, + 0x50081,0x30,0xb37,0xb32,0xb36,0x5008e,0x30,0xb3b,0x42a2,0xb1c,0x50081,0x30, + 0xb3c,0xb37,0xb3b,0x5008e,0x30,0xb40,0x42a6,0xb1e,0x50081,0x30,0xb41,0xb3c, + 0xb40,0x70050,0x30,0xb43,0xb2a,0xb2a,0xb2a,0xb2a,0x50088,0x30,0xb44,0xb41, + 0xb43,0x200f9,0xb45,0x200f8,0xb45,0x700f5,0x30,0x29fc,0x1e3,0xb2d,0xb44,0xb2e, + 0x4003d,0x167,0xb53,0x169,0x40063,0xb53,0x867,0x29fc,0x50080,0x6,0x878,0x857, + 0x3a4,0x4007c,0x1e,0x879,0x878,0x50050,0x1f,0x87d,0x879,0x85b,0x50080,0x1f, + 0x87e,0x855,0x87d,0x50080,0x6,0x884,0x798,0x295,0x4007c,0x1e,0x885,0x884, + 0x50050,0x1f,0x888,0x885,0x865,0x50080,0x1f,0x889,0x861,0x888,0x4007c,0x19, + 0x88b,0x87e,0x50080,0x19,0xbb5,0x88b,0x34b,0x50080,0x19,0xbb7,0x88b,0x34e, + 0x50080,0x19,0xbb9,0x88b,0x351,0x4003d,0x14f,0xc20,0x151,0x7005f,0x30,0xc22, + 0xc20,0x87e,0x2,0xfe,0x5008e,0x30,0xbee,0xc22,0x99a,0x50051,0x13,0xbf0, + 0xbee,0x3,0x50083,0x13,0xbf1,0x106,0xbf0,0x8000c,0x13,0xc2a,0x1,0x2b, + 0xbf1,0x105,0x106,0x60052,0x30,0x4111,0xc2a,0xbee,0x3,0x50051,0x1e,0xbf5, + 0x87e,0x0,0x500b1,0x77,0xbf8,0xbf5,0x9a4,0x400a8,0x77,0xbf9,0xbf8,0x300f7, + 0xc03,0x0,0x400fa,0xbf9,0xbfa,0xc03,0x200f8,0xbfa,0x50041,0x12e,0xc31,0x12c, + 0x10a,0x4003d,0x1f,0xc32,0xc31,0x50051,0x1e,0xbfe,0xc32,0x0,0x50080,0x1e, + 0xc01,0xbfe,0x9a4,0x500af,0x77,0xc02,0xbf5,0xc01,0x200f9,0xc03,0x200f8,0xc03, + 0x700f5,0x77,0xc04,0xbf8,0xb45,0xc02,0xbfa,0x400a8,0x77,0xc05,0xc04,0x300f7, + 0xc0c,0x0,0x400fa,0xc05,0xc06,0xc0c,0x200f8,0xc06,0x50051,0x1e,0xc08,0x87e, + 0x1,0x50051,0x1e,0xc0a,0x9db,0x1,0x500b1,0x77,0xc0b,0xc08,0xc0a,0x200f9, + 0xc0c,0x200f8,0xc0c,0x700f5,0x77,0xc0d,0xc04,0xc03,0xc0b,0xc06,0x400a8,0x77, + 0xc0e,0xc0d,0x300f7,0xc18,0x0,0x400fa,0xc0e,0xc0f,0xc18,0x200f8,0xc0f,0x50051, + 0x1e,0xc11,0x87e,0x1,0x50041,0x12e,0xc3d,0x12c,0x10a,0x4003d,0x1f,0xc3e, + 0xc3d,0x50051,0x1e,0xc13,0xc3e,0x1,0x50051,0x1e,0xc15,0x9db,0x1,0x50080, + 0x1e,0xc16,0xc13,0xc15,0x500af,0x77,0xc17,0xc11,0xc16,0x200f9,0xc18,0x200f8, + 0xc18,0x700f5,0x77,0xc19,0xc0d,0xc0c,0xc17,0xc0f,0x300f7,0xc1c,0x0,0x400fa, + 0xc19,0xc1a,0xc1c,0x200f8,0xc1a,0x60052,0x30,0x4117,0x105,0x4111,0x3,0x200f9, + 0xc1c,0x200f8,0xc1c,0x700f5,0x30,0x42aa,0x4111,0xc18,0x4117,0xc1a,0x4007c,0x1f, + 0xbd3,0xbb5,0x4003d,0x14f,0xc80,0x151,0x7005f,0x30,0xc82,0xc80,0xbd3,0x2, + 0xfe,0x5008e,0x30,0xc4e,0xc82,0x99a,0x50051,0x13,0xc50,0xc4e,0x3,0x50083, + 0x13,0xc51,0x106,0xc50,0x8000c,0x13,0xc8a,0x1,0x2b,0xc51,0x105,0x106, + 0x60052,0x30,0x411a,0xc8a,0xc4e,0x3,0x50051,0x1e,0xc55,0xbd3,0x0,0x500b1, + 0x77,0xc58,0xc55,0x9a4,0x400a8,0x77,0xc59,0xc58,0x300f7,0xc63,0x0,0x400fa, + 0xc59,0xc5a,0xc63,0x200f8,0xc5a,0x50041,0x12e,0xc91,0x12c,0x10a,0x4003d,0x1f, + 0xc92,0xc91,0x50051,0x1e,0xc5e,0xc92,0x0,0x50080,0x1e,0xc61,0xc5e,0x9a4, + 0x500af,0x77,0xc62,0xc55,0xc61,0x200f9,0xc63,0x200f8,0xc63,0x700f5,0x77,0xc64, + 0xc58,0xc1c,0xc62,0xc5a,0x400a8,0x77,0xc65,0xc64,0x300f7,0xc6c,0x0,0x400fa, + 0xc65,0xc66,0xc6c,0x200f8,0xc66,0x50051,0x1e,0xc68,0xbd3,0x1,0x50051,0x1e, + 0xc6a,0x9db,0x1,0x500b1,0x77,0xc6b,0xc68,0xc6a,0x200f9,0xc6c,0x200f8,0xc6c, + 0x700f5,0x77,0xc6d,0xc64,0xc63,0xc6b,0xc66,0x400a8,0x77,0xc6e,0xc6d,0x300f7, + 0xc78,0x0,0x400fa,0xc6e,0xc6f,0xc78,0x200f8,0xc6f,0x50051,0x1e,0xc71,0xbd3, + 0x1,0x50041,0x12e,0xc9d,0x12c,0x10a,0x4003d,0x1f,0xc9e,0xc9d,0x50051,0x1e, + 0xc73,0xc9e,0x1,0x50051,0x1e,0xc75,0x9db,0x1,0x50080,0x1e,0xc76,0xc73, + 0xc75,0x500af,0x77,0xc77,0xc71,0xc76,0x200f9,0xc78,0x200f8,0xc78,0x700f5,0x77, + 0xc79,0xc6d,0xc6c,0xc77,0xc6f,0x300f7,0xc7c,0x0,0x400fa,0xc79,0xc7a,0xc7c, + 0x200f8,0xc7a,0x60052,0x30,0x4120,0x105,0x411a,0x3,0x200f9,0xc7c,0x200f8,0xc7c, + 0x700f5,0x30,0x42ae,0x411a,0xc78,0x4120,0xc7a,0x4007c,0x1f,0xbd7,0xbb7,0x4003d, + 0x14f,0xce0,0x151,0x7005f,0x30,0xce2,0xce0,0xbd7,0x2,0xfe,0x5008e,0x30, + 0xcae,0xce2,0x99a,0x50051,0x13,0xcb0,0xcae,0x3,0x50083,0x13,0xcb1,0x106, + 0xcb0,0x8000c,0x13,0xcea,0x1,0x2b,0xcb1,0x105,0x106,0x60052,0x30,0x4123, + 0xcea,0xcae,0x3,0x50051,0x1e,0xcb5,0xbd7,0x0,0x500b1,0x77,0xcb8,0xcb5, + 0x9a4,0x400a8,0x77,0xcb9,0xcb8,0x300f7,0xcc3,0x0,0x400fa,0xcb9,0xcba,0xcc3, + 0x200f8,0xcba,0x50041,0x12e,0xcf1,0x12c,0x10a,0x4003d,0x1f,0xcf2,0xcf1,0x50051, + 0x1e,0xcbe,0xcf2,0x0,0x50080,0x1e,0xcc1,0xcbe,0x9a4,0x500af,0x77,0xcc2, + 0xcb5,0xcc1,0x200f9,0xcc3,0x200f8,0xcc3,0x700f5,0x77,0xcc4,0xcb8,0xc7c,0xcc2, + 0xcba,0x400a8,0x77,0xcc5,0xcc4,0x300f7,0xccc,0x0,0x400fa,0xcc5,0xcc6,0xccc, + 0x200f8,0xcc6,0x50051,0x1e,0xcc8,0xbd7,0x1,0x50051,0x1e,0xcca,0x9db,0x1, + 0x500b1,0x77,0xccb,0xcc8,0xcca,0x200f9,0xccc,0x200f8,0xccc,0x700f5,0x77,0xccd, + 0xcc4,0xcc3,0xccb,0xcc6,0x400a8,0x77,0xcce,0xccd,0x300f7,0xcd8,0x0,0x400fa, + 0xcce,0xccf,0xcd8,0x200f8,0xccf,0x50051,0x1e,0xcd1,0xbd7,0x1,0x50041,0x12e, + 0xcfd,0x12c,0x10a,0x4003d,0x1f,0xcfe,0xcfd,0x50051,0x1e,0xcd3,0xcfe,0x1, + 0x50051,0x1e,0xcd5,0x9db,0x1,0x50080,0x1e,0xcd6,0xcd3,0xcd5,0x500af,0x77, + 0xcd7,0xcd1,0xcd6,0x200f9,0xcd8,0x200f8,0xcd8,0x700f5,0x77,0xcd9,0xccd,0xccc, + 0xcd7,0xccf,0x300f7,0xcdc,0x0,0x400fa,0xcd9,0xcda,0xcdc,0x200f8,0xcda,0x60052, + 0x30,0x4129,0x105,0x4123,0x3,0x200f9,0xcdc,0x200f8,0xcdc,0x700f5,0x30,0x42b2, + 0x4123,0xcd8,0x4129,0xcda,0x4007c,0x1f,0xbdb,0xbb9,0x4003d,0x14f,0xd40,0x151, + 0x7005f,0x30,0xd42,0xd40,0xbdb,0x2,0xfe,0x5008e,0x30,0xd0e,0xd42,0x99a, + 0x50051,0x13,0xd10,0xd0e,0x3,0x50083,0x13,0xd11,0x106,0xd10,0x8000c,0x13, + 0xd4a,0x1,0x2b,0xd11,0x105,0x106,0x60052,0x30,0x412c,0xd4a,0xd0e,0x3, + 0x50051,0x1e,0xd15,0xbdb,0x0,0x500b1,0x77,0xd18,0xd15,0x9a4,0x400a8,0x77, + 0xd19,0xd18,0x300f7,0xd23,0x0,0x400fa,0xd19,0xd1a,0xd23,0x200f8,0xd1a,0x50041, + 0x12e,0xd51,0x12c,0x10a,0x4003d,0x1f,0xd52,0xd51,0x50051,0x1e,0xd1e,0xd52, + 0x0,0x50080,0x1e,0xd21,0xd1e,0x9a4,0x500af,0x77,0xd22,0xd15,0xd21,0x200f9, + 0xd23,0x200f8,0xd23,0x700f5,0x77,0xd24,0xd18,0xcdc,0xd22,0xd1a,0x400a8,0x77, + 0xd25,0xd24,0x300f7,0xd2c,0x0,0x400fa,0xd25,0xd26,0xd2c,0x200f8,0xd26,0x50051, + 0x1e,0xd28,0xbdb,0x1,0x50051,0x1e,0xd2a,0x9db,0x1,0x500b1,0x77,0xd2b, + 0xd28,0xd2a,0x200f9,0xd2c,0x200f8,0xd2c,0x700f5,0x77,0xd2d,0xd24,0xd23,0xd2b, + 0xd26,0x400a8,0x77,0xd2e,0xd2d,0x300f7,0xd38,0x0,0x400fa,0xd2e,0xd2f,0xd38, + 0x200f8,0xd2f,0x50051,0x1e,0xd31,0xbdb,0x1,0x50041,0x12e,0xd5d,0x12c,0x10a, + 0x4003d,0x1f,0xd5e,0xd5d,0x50051,0x1e,0xd33,0xd5e,0x1,0x50051,0x1e,0xd35, + 0x9db,0x1,0x50080,0x1e,0xd36,0xd33,0xd35,0x500af,0x77,0xd37,0xd31,0xd36, + 0x200f9,0xd38,0x200f8,0xd38,0x700f5,0x77,0xd39,0xd2d,0xd2c,0xd37,0xd2f,0x300f7, + 0xd3c,0x0,0x400fa,0xd39,0xd3a,0xd3c,0x200f8,0xd3a,0x60052,0x30,0x4132,0x105, + 0x412c,0x3,0x200f9,0xd3c,0x200f8,0xd3c,0x700f5,0x30,0x42b6,0x412c,0xd38,0x4132, + 0xd3a,0x300f7,0xd98,0x0,0x300fb,0x161,0xd69,0x200f8,0xd69,0x50051,0x13,0xd6b, + 0x42aa,0x3,0x50051,0x13,0xd6d,0x42ae,0x3,0x50051,0x13,0xd6f,0x42b2,0x3, + 0x50051,0x13,0xd71,0x42b6,0x3,0x50081,0x13,0xd77,0xd6b,0xd6d,0x50081,0x13, + 0xd7a,0xd77,0xd6f,0x50081,0x13,0xd7d,0xd7a,0xd71,0x500b4,0x77,0xd7f,0xd7d, + 0x105,0x300f7,0xd81,0x0,0x400fa,0xd7f,0xd80,0xd81,0x200f8,0xd80,0x200f9,0xd98, + 0x200f8,0xd81,0x5008e,0x30,0xd85,0x42aa,0xd6b,0x5008e,0x30,0xd89,0x42ae,0xd6d, + 0x50081,0x30,0xd8a,0xd85,0xd89,0x5008e,0x30,0xd8e,0x42b2,0xd6f,0x50081,0x30, + 0xd8f,0xd8a,0xd8e,0x5008e,0x30,0xd93,0x42b6,0xd71,0x50081,0x30,0xd94,0xd8f, + 0xd93,0x70050,0x30,0xd96,0xd7d,0xd7d,0xd7d,0xd7d,0x50088,0x30,0xd97,0xd94, + 0xd96,0x200f9,0xd98,0x200f8,0xd98,0x700f5,0x30,0x2ae6,0x1e3,0xd80,0xd97,0xd81, + 0x4003d,0x167,0xda6,0x169,0x40063,0xda6,0x889,0x2ae6,0x50080,0x6,0x89d,0x85a, + 0x3a4,0x4007c,0x1e,0x89e,0x89d,0x50050,0x1f,0x89f,0x858,0x89e,0x50080,0x1f, + 0x8a0,0x855,0x89f,0x50080,0x6,0x8a8,0x79e,0x295,0x4007c,0x1e,0x8a9,0x8a8, + 0x50050,0x1f,0x8aa,0x863,0x8a9,0x50080,0x1f,0x8ab,0x861,0x8aa,0x4007c,0x19, + 0x8ad,0x8a0,0x50080,0x19,0xe08,0x8ad,0x34b,0x50080,0x19,0xe0a,0x8ad,0x34e, + 0x50080,0x19,0xe0c,0x8ad,0x351,0x4003d,0x14f,0xe73,0x151,0x7005f,0x30,0xe75, + 0xe73,0x8a0,0x2,0xfe,0x5008e,0x30,0xe41,0xe75,0x99a,0x50051,0x13,0xe43, + 0xe41,0x3,0x50083,0x13,0xe44,0x106,0xe43,0x8000c,0x13,0xe7d,0x1,0x2b, + 0xe44,0x105,0x106,0x60052,0x30,0x4141,0xe7d,0xe41,0x3,0x50051,0x1e,0xe48, + 0x8a0,0x0,0x500b1,0x77,0xe4b,0xe48,0x9a4,0x400a8,0x77,0xe4c,0xe4b,0x300f7, + 0xe56,0x0,0x400fa,0xe4c,0xe4d,0xe56,0x200f8,0xe4d,0x50041,0x12e,0xe84,0x12c, + 0x10a,0x4003d,0x1f,0xe85,0xe84,0x50051,0x1e,0xe51,0xe85,0x0,0x50080,0x1e, + 0xe54,0xe51,0x9a4,0x500af,0x77,0xe55,0xe48,0xe54,0x200f9,0xe56,0x200f8,0xe56, + 0x700f5,0x77,0xe57,0xe4b,0xd98,0xe55,0xe4d,0x400a8,0x77,0xe58,0xe57,0x300f7, + 0xe5f,0x0,0x400fa,0xe58,0xe59,0xe5f,0x200f8,0xe59,0x50051,0x1e,0xe5b,0x8a0, + 0x1,0x50051,0x1e,0xe5d,0x9db,0x1,0x500b1,0x77,0xe5e,0xe5b,0xe5d,0x200f9, + 0xe5f,0x200f8,0xe5f,0x700f5,0x77,0xe60,0xe57,0xe56,0xe5e,0xe59,0x400a8,0x77, + 0xe61,0xe60,0x300f7,0xe6b,0x0,0x400fa,0xe61,0xe62,0xe6b,0x200f8,0xe62,0x50051, + 0x1e,0xe64,0x8a0,0x1,0x50041,0x12e,0xe90,0x12c,0x10a,0x4003d,0x1f,0xe91, + 0xe90,0x50051,0x1e,0xe66,0xe91,0x1,0x50051,0x1e,0xe68,0x9db,0x1,0x50080, + 0x1e,0xe69,0xe66,0xe68,0x500af,0x77,0xe6a,0xe64,0xe69,0x200f9,0xe6b,0x200f8, + 0xe6b,0x700f5,0x77,0xe6c,0xe60,0xe5f,0xe6a,0xe62,0x300f7,0xe6f,0x0,0x400fa, + 0xe6c,0xe6d,0xe6f,0x200f8,0xe6d,0x60052,0x30,0x4147,0x105,0x4141,0x3,0x200f9, + 0xe6f,0x200f8,0xe6f,0x700f5,0x30,0x42ba,0x4141,0xe6b,0x4147,0xe6d,0x4007c,0x1f, + 0xe26,0xe08,0x4003d,0x14f,0xed3,0x151,0x7005f,0x30,0xed5,0xed3,0xe26,0x2, + 0xfe,0x5008e,0x30,0xea1,0xed5,0x99a,0x50051,0x13,0xea3,0xea1,0x3,0x50083, + 0x13,0xea4,0x106,0xea3,0x8000c,0x13,0xedd,0x1,0x2b,0xea4,0x105,0x106, + 0x60052,0x30,0x414a,0xedd,0xea1,0x3,0x50051,0x1e,0xea8,0xe26,0x0,0x500b1, + 0x77,0xeab,0xea8,0x9a4,0x400a8,0x77,0xeac,0xeab,0x300f7,0xeb6,0x0,0x400fa, + 0xeac,0xead,0xeb6,0x200f8,0xead,0x50041,0x12e,0xee4,0x12c,0x10a,0x4003d,0x1f, + 0xee5,0xee4,0x50051,0x1e,0xeb1,0xee5,0x0,0x50080,0x1e,0xeb4,0xeb1,0x9a4, + 0x500af,0x77,0xeb5,0xea8,0xeb4,0x200f9,0xeb6,0x200f8,0xeb6,0x700f5,0x77,0xeb7, + 0xeab,0xe6f,0xeb5,0xead,0x400a8,0x77,0xeb8,0xeb7,0x300f7,0xebf,0x0,0x400fa, + 0xeb8,0xeb9,0xebf,0x200f8,0xeb9,0x50051,0x1e,0xebb,0xe26,0x1,0x50051,0x1e, + 0xebd,0x9db,0x1,0x500b1,0x77,0xebe,0xebb,0xebd,0x200f9,0xebf,0x200f8,0xebf, + 0x700f5,0x77,0xec0,0xeb7,0xeb6,0xebe,0xeb9,0x400a8,0x77,0xec1,0xec0,0x300f7, + 0xecb,0x0,0x400fa,0xec1,0xec2,0xecb,0x200f8,0xec2,0x50051,0x1e,0xec4,0xe26, + 0x1,0x50041,0x12e,0xef0,0x12c,0x10a,0x4003d,0x1f,0xef1,0xef0,0x50051,0x1e, + 0xec6,0xef1,0x1,0x50051,0x1e,0xec8,0x9db,0x1,0x50080,0x1e,0xec9,0xec6, + 0xec8,0x500af,0x77,0xeca,0xec4,0xec9,0x200f9,0xecb,0x200f8,0xecb,0x700f5,0x77, + 0xecc,0xec0,0xebf,0xeca,0xec2,0x300f7,0xecf,0x0,0x400fa,0xecc,0xecd,0xecf, + 0x200f8,0xecd,0x60052,0x30,0x4150,0x105,0x414a,0x3,0x200f9,0xecf,0x200f8,0xecf, + 0x700f5,0x30,0x42be,0x414a,0xecb,0x4150,0xecd,0x4007c,0x1f,0xe2a,0xe0a,0x4003d, + 0x14f,0xf33,0x151,0x7005f,0x30,0xf35,0xf33,0xe2a,0x2,0xfe,0x5008e,0x30, + 0xf01,0xf35,0x99a,0x50051,0x13,0xf03,0xf01,0x3,0x50083,0x13,0xf04,0x106, + 0xf03,0x8000c,0x13,0xf3d,0x1,0x2b,0xf04,0x105,0x106,0x60052,0x30,0x4153, + 0xf3d,0xf01,0x3,0x50051,0x1e,0xf08,0xe2a,0x0,0x500b1,0x77,0xf0b,0xf08, + 0x9a4,0x400a8,0x77,0xf0c,0xf0b,0x300f7,0xf16,0x0,0x400fa,0xf0c,0xf0d,0xf16, + 0x200f8,0xf0d,0x50041,0x12e,0xf44,0x12c,0x10a,0x4003d,0x1f,0xf45,0xf44,0x50051, + 0x1e,0xf11,0xf45,0x0,0x50080,0x1e,0xf14,0xf11,0x9a4,0x500af,0x77,0xf15, + 0xf08,0xf14,0x200f9,0xf16,0x200f8,0xf16,0x700f5,0x77,0xf17,0xf0b,0xecf,0xf15, + 0xf0d,0x400a8,0x77,0xf18,0xf17,0x300f7,0xf1f,0x0,0x400fa,0xf18,0xf19,0xf1f, + 0x200f8,0xf19,0x50051,0x1e,0xf1b,0xe2a,0x1,0x50051,0x1e,0xf1d,0x9db,0x1, + 0x500b1,0x77,0xf1e,0xf1b,0xf1d,0x200f9,0xf1f,0x200f8,0xf1f,0x700f5,0x77,0xf20, + 0xf17,0xf16,0xf1e,0xf19,0x400a8,0x77,0xf21,0xf20,0x300f7,0xf2b,0x0,0x400fa, + 0xf21,0xf22,0xf2b,0x200f8,0xf22,0x50051,0x1e,0xf24,0xe2a,0x1,0x50041,0x12e, + 0xf50,0x12c,0x10a,0x4003d,0x1f,0xf51,0xf50,0x50051,0x1e,0xf26,0xf51,0x1, + 0x50051,0x1e,0xf28,0x9db,0x1,0x50080,0x1e,0xf29,0xf26,0xf28,0x500af,0x77, + 0xf2a,0xf24,0xf29,0x200f9,0xf2b,0x200f8,0xf2b,0x700f5,0x77,0xf2c,0xf20,0xf1f, + 0xf2a,0xf22,0x300f7,0xf2f,0x0,0x400fa,0xf2c,0xf2d,0xf2f,0x200f8,0xf2d,0x60052, + 0x30,0x4159,0x105,0x4153,0x3,0x200f9,0xf2f,0x200f8,0xf2f,0x700f5,0x30,0x42c2, + 0x4153,0xf2b,0x4159,0xf2d,0x4007c,0x1f,0xe2e,0xe0c,0x4003d,0x14f,0xf93,0x151, + 0x7005f,0x30,0xf95,0xf93,0xe2e,0x2,0xfe,0x5008e,0x30,0xf61,0xf95,0x99a, + 0x50051,0x13,0xf63,0xf61,0x3,0x50083,0x13,0xf64,0x106,0xf63,0x8000c,0x13, + 0xf9d,0x1,0x2b,0xf64,0x105,0x106,0x60052,0x30,0x415c,0xf9d,0xf61,0x3, + 0x50051,0x1e,0xf68,0xe2e,0x0,0x500b1,0x77,0xf6b,0xf68,0x9a4,0x400a8,0x77, + 0xf6c,0xf6b,0x300f7,0xf76,0x0,0x400fa,0xf6c,0xf6d,0xf76,0x200f8,0xf6d,0x50041, + 0x12e,0xfa4,0x12c,0x10a,0x4003d,0x1f,0xfa5,0xfa4,0x50051,0x1e,0xf71,0xfa5, + 0x0,0x50080,0x1e,0xf74,0xf71,0x9a4,0x500af,0x77,0xf75,0xf68,0xf74,0x200f9, + 0xf76,0x200f8,0xf76,0x700f5,0x77,0xf77,0xf6b,0xf2f,0xf75,0xf6d,0x400a8,0x77, + 0xf78,0xf77,0x300f7,0xf7f,0x0,0x400fa,0xf78,0xf79,0xf7f,0x200f8,0xf79,0x50051, + 0x1e,0xf7b,0xe2e,0x1,0x50051,0x1e,0xf7d,0x9db,0x1,0x500b1,0x77,0xf7e, + 0xf7b,0xf7d,0x200f9,0xf7f,0x200f8,0xf7f,0x700f5,0x77,0xf80,0xf77,0xf76,0xf7e, + 0xf79,0x400a8,0x77,0xf81,0xf80,0x300f7,0xf8b,0x0,0x400fa,0xf81,0xf82,0xf8b, + 0x200f8,0xf82,0x50051,0x1e,0xf84,0xe2e,0x1,0x50041,0x12e,0xfb0,0x12c,0x10a, + 0x4003d,0x1f,0xfb1,0xfb0,0x50051,0x1e,0xf86,0xfb1,0x1,0x50051,0x1e,0xf88, + 0x9db,0x1,0x50080,0x1e,0xf89,0xf86,0xf88,0x500af,0x77,0xf8a,0xf84,0xf89, + 0x200f9,0xf8b,0x200f8,0xf8b,0x700f5,0x77,0xf8c,0xf80,0xf7f,0xf8a,0xf82,0x300f7, + 0xf8f,0x0,0x400fa,0xf8c,0xf8d,0xf8f,0x200f8,0xf8d,0x60052,0x30,0x4162,0x105, + 0x415c,0x3,0x200f9,0xf8f,0x200f8,0xf8f,0x700f5,0x30,0x42c6,0x415c,0xf8b,0x4162, + 0xf8d,0x300f7,0xfeb,0x0,0x300fb,0x161,0xfbc,0x200f8,0xfbc,0x50051,0x13,0xfbe, + 0x42ba,0x3,0x50051,0x13,0xfc0,0x42be,0x3,0x50051,0x13,0xfc2,0x42c2,0x3, + 0x50051,0x13,0xfc4,0x42c6,0x3,0x50081,0x13,0xfca,0xfbe,0xfc0,0x50081,0x13, + 0xfcd,0xfca,0xfc2,0x50081,0x13,0xfd0,0xfcd,0xfc4,0x500b4,0x77,0xfd2,0xfd0, + 0x105,0x300f7,0xfd4,0x0,0x400fa,0xfd2,0xfd3,0xfd4,0x200f8,0xfd3,0x200f9,0xfeb, + 0x200f8,0xfd4,0x5008e,0x30,0xfd8,0x42ba,0xfbe,0x5008e,0x30,0xfdc,0x42be,0xfc0, + 0x50081,0x30,0xfdd,0xfd8,0xfdc,0x5008e,0x30,0xfe1,0x42c2,0xfc2,0x50081,0x30, + 0xfe2,0xfdd,0xfe1,0x5008e,0x30,0xfe6,0x42c6,0xfc4,0x50081,0x30,0xfe7,0xfe2, + 0xfe6,0x70050,0x30,0xfe9,0xfd0,0xfd0,0xfd0,0xfd0,0x50088,0x30,0xfea,0xfe7, + 0xfe9,0x200f9,0xfeb,0x200f8,0xfeb,0x700f5,0x30,0x2bd0,0x1e3,0xfd3,0xfea,0xfd4, + 0x4003d,0x167,0xff9,0x169,0x40063,0xff9,0x8ab,0x2bd0,0x50050,0x1f,0x8c2,0x879, + 0x89e,0x50080,0x1f,0x8c3,0x855,0x8c2,0x50050,0x1f,0x8ce,0x885,0x8a9,0x50080, + 0x1f,0x8cf,0x861,0x8ce,0x4007c,0x19,0x8d1,0x8c3,0x50080,0x19,0x105b,0x8d1, + 0x34b,0x50080,0x19,0x105d,0x8d1,0x34e,0x50080,0x19,0x105f,0x8d1,0x351,0x4003d, + 0x14f,0x10c6,0x151,0x7005f,0x30,0x10c8,0x10c6,0x8c3,0x2,0xfe,0x5008e,0x30, + 0x1094,0x10c8,0x99a,0x50051,0x13,0x1096,0x1094,0x3,0x50083,0x13,0x1097,0x106, + 0x1096,0x8000c,0x13,0x10d0,0x1,0x2b,0x1097,0x105,0x106,0x60052,0x30,0x4171, + 0x10d0,0x1094,0x3,0x50051,0x1e,0x109b,0x8c3,0x0,0x500b1,0x77,0x109e,0x109b, + 0x9a4,0x400a8,0x77,0x109f,0x109e,0x300f7,0x10a9,0x0,0x400fa,0x109f,0x10a0,0x10a9, + 0x200f8,0x10a0,0x50041,0x12e,0x10d7,0x12c,0x10a,0x4003d,0x1f,0x10d8,0x10d7,0x50051, + 0x1e,0x10a4,0x10d8,0x0,0x50080,0x1e,0x10a7,0x10a4,0x9a4,0x500af,0x77,0x10a8, + 0x109b,0x10a7,0x200f9,0x10a9,0x200f8,0x10a9,0x700f5,0x77,0x10aa,0x109e,0xfeb,0x10a8, + 0x10a0,0x400a8,0x77,0x10ab,0x10aa,0x300f7,0x10b2,0x0,0x400fa,0x10ab,0x10ac,0x10b2, + 0x200f8,0x10ac,0x50051,0x1e,0x10ae,0x8c3,0x1,0x50051,0x1e,0x10b0,0x9db,0x1, + 0x500b1,0x77,0x10b1,0x10ae,0x10b0,0x200f9,0x10b2,0x200f8,0x10b2,0x700f5,0x77,0x10b3, + 0x10aa,0x10a9,0x10b1,0x10ac,0x400a8,0x77,0x10b4,0x10b3,0x300f7,0x10be,0x0,0x400fa, + 0x10b4,0x10b5,0x10be,0x200f8,0x10b5,0x50051,0x1e,0x10b7,0x8c3,0x1,0x50041,0x12e, + 0x10e3,0x12c,0x10a,0x4003d,0x1f,0x10e4,0x10e3,0x50051,0x1e,0x10b9,0x10e4,0x1, + 0x50051,0x1e,0x10bb,0x9db,0x1,0x50080,0x1e,0x10bc,0x10b9,0x10bb,0x500af,0x77, + 0x10bd,0x10b7,0x10bc,0x200f9,0x10be,0x200f8,0x10be,0x700f5,0x77,0x10bf,0x10b3,0x10b2, + 0x10bd,0x10b5,0x300f7,0x10c2,0x0,0x400fa,0x10bf,0x10c0,0x10c2,0x200f8,0x10c0,0x60052, + 0x30,0x4177,0x105,0x4171,0x3,0x200f9,0x10c2,0x200f8,0x10c2,0x700f5,0x30,0x42ca, + 0x4171,0x10be,0x4177,0x10c0,0x4007c,0x1f,0x1079,0x105b,0x4003d,0x14f,0x1126,0x151, + 0x7005f,0x30,0x1128,0x1126,0x1079,0x2,0xfe,0x5008e,0x30,0x10f4,0x1128,0x99a, + 0x50051,0x13,0x10f6,0x10f4,0x3,0x50083,0x13,0x10f7,0x106,0x10f6,0x8000c,0x13, + 0x1130,0x1,0x2b,0x10f7,0x105,0x106,0x60052,0x30,0x417a,0x1130,0x10f4,0x3, + 0x50051,0x1e,0x10fb,0x1079,0x0,0x500b1,0x77,0x10fe,0x10fb,0x9a4,0x400a8,0x77, + 0x10ff,0x10fe,0x300f7,0x1109,0x0,0x400fa,0x10ff,0x1100,0x1109,0x200f8,0x1100,0x50041, + 0x12e,0x1137,0x12c,0x10a,0x4003d,0x1f,0x1138,0x1137,0x50051,0x1e,0x1104,0x1138, + 0x0,0x50080,0x1e,0x1107,0x1104,0x9a4,0x500af,0x77,0x1108,0x10fb,0x1107,0x200f9, + 0x1109,0x200f8,0x1109,0x700f5,0x77,0x110a,0x10fe,0x10c2,0x1108,0x1100,0x400a8,0x77, + 0x110b,0x110a,0x300f7,0x1112,0x0,0x400fa,0x110b,0x110c,0x1112,0x200f8,0x110c,0x50051, + 0x1e,0x110e,0x1079,0x1,0x50051,0x1e,0x1110,0x9db,0x1,0x500b1,0x77,0x1111, + 0x110e,0x1110,0x200f9,0x1112,0x200f8,0x1112,0x700f5,0x77,0x1113,0x110a,0x1109,0x1111, + 0x110c,0x400a8,0x77,0x1114,0x1113,0x300f7,0x111e,0x0,0x400fa,0x1114,0x1115,0x111e, + 0x200f8,0x1115,0x50051,0x1e,0x1117,0x1079,0x1,0x50041,0x12e,0x1143,0x12c,0x10a, + 0x4003d,0x1f,0x1144,0x1143,0x50051,0x1e,0x1119,0x1144,0x1,0x50051,0x1e,0x111b, + 0x9db,0x1,0x50080,0x1e,0x111c,0x1119,0x111b,0x500af,0x77,0x111d,0x1117,0x111c, + 0x200f9,0x111e,0x200f8,0x111e,0x700f5,0x77,0x111f,0x1113,0x1112,0x111d,0x1115,0x300f7, + 0x1122,0x0,0x400fa,0x111f,0x1120,0x1122,0x200f8,0x1120,0x60052,0x30,0x4180,0x105, + 0x417a,0x3,0x200f9,0x1122,0x200f8,0x1122,0x700f5,0x30,0x42ce,0x417a,0x111e,0x4180, + 0x1120,0x4007c,0x1f,0x107d,0x105d,0x4003d,0x14f,0x1186,0x151,0x7005f,0x30,0x1188, + 0x1186,0x107d,0x2,0xfe,0x5008e,0x30,0x1154,0x1188,0x99a,0x50051,0x13,0x1156, + 0x1154,0x3,0x50083,0x13,0x1157,0x106,0x1156,0x8000c,0x13,0x1190,0x1,0x2b, + 0x1157,0x105,0x106,0x60052,0x30,0x4183,0x1190,0x1154,0x3,0x50051,0x1e,0x115b, + 0x107d,0x0,0x500b1,0x77,0x115e,0x115b,0x9a4,0x400a8,0x77,0x115f,0x115e,0x300f7, + 0x1169,0x0,0x400fa,0x115f,0x1160,0x1169,0x200f8,0x1160,0x50041,0x12e,0x1197,0x12c, + 0x10a,0x4003d,0x1f,0x1198,0x1197,0x50051,0x1e,0x1164,0x1198,0x0,0x50080,0x1e, + 0x1167,0x1164,0x9a4,0x500af,0x77,0x1168,0x115b,0x1167,0x200f9,0x1169,0x200f8,0x1169, + 0x700f5,0x77,0x116a,0x115e,0x1122,0x1168,0x1160,0x400a8,0x77,0x116b,0x116a,0x300f7, + 0x1172,0x0,0x400fa,0x116b,0x116c,0x1172,0x200f8,0x116c,0x50051,0x1e,0x116e,0x107d, + 0x1,0x50051,0x1e,0x1170,0x9db,0x1,0x500b1,0x77,0x1171,0x116e,0x1170,0x200f9, + 0x1172,0x200f8,0x1172,0x700f5,0x77,0x1173,0x116a,0x1169,0x1171,0x116c,0x400a8,0x77, + 0x1174,0x1173,0x300f7,0x117e,0x0,0x400fa,0x1174,0x1175,0x117e,0x200f8,0x1175,0x50051, + 0x1e,0x1177,0x107d,0x1,0x50041,0x12e,0x11a3,0x12c,0x10a,0x4003d,0x1f,0x11a4, + 0x11a3,0x50051,0x1e,0x1179,0x11a4,0x1,0x50051,0x1e,0x117b,0x9db,0x1,0x50080, + 0x1e,0x117c,0x1179,0x117b,0x500af,0x77,0x117d,0x1177,0x117c,0x200f9,0x117e,0x200f8, + 0x117e,0x700f5,0x77,0x117f,0x1173,0x1172,0x117d,0x1175,0x300f7,0x1182,0x0,0x400fa, + 0x117f,0x1180,0x1182,0x200f8,0x1180,0x60052,0x30,0x4189,0x105,0x4183,0x3,0x200f9, + 0x1182,0x200f8,0x1182,0x700f5,0x30,0x42d2,0x4183,0x117e,0x4189,0x1180,0x4007c,0x1f, + 0x1081,0x105f,0x4003d,0x14f,0x11e6,0x151,0x7005f,0x30,0x11e8,0x11e6,0x1081,0x2, + 0xfe,0x5008e,0x30,0x11b4,0x11e8,0x99a,0x50051,0x13,0x11b6,0x11b4,0x3,0x50083, + 0x13,0x11b7,0x106,0x11b6,0x8000c,0x13,0x11f0,0x1,0x2b,0x11b7,0x105,0x106, + 0x60052,0x30,0x418c,0x11f0,0x11b4,0x3,0x50051,0x1e,0x11bb,0x1081,0x0,0x500b1, + 0x77,0x11be,0x11bb,0x9a4,0x400a8,0x77,0x11bf,0x11be,0x300f7,0x11c9,0x0,0x400fa, + 0x11bf,0x11c0,0x11c9,0x200f8,0x11c0,0x50041,0x12e,0x11f7,0x12c,0x10a,0x4003d,0x1f, + 0x11f8,0x11f7,0x50051,0x1e,0x11c4,0x11f8,0x0,0x50080,0x1e,0x11c7,0x11c4,0x9a4, + 0x500af,0x77,0x11c8,0x11bb,0x11c7,0x200f9,0x11c9,0x200f8,0x11c9,0x700f5,0x77,0x11ca, + 0x11be,0x1182,0x11c8,0x11c0,0x400a8,0x77,0x11cb,0x11ca,0x300f7,0x11d2,0x0,0x400fa, + 0x11cb,0x11cc,0x11d2,0x200f8,0x11cc,0x50051,0x1e,0x11ce,0x1081,0x1,0x50051,0x1e, + 0x11d0,0x9db,0x1,0x500b1,0x77,0x11d1,0x11ce,0x11d0,0x200f9,0x11d2,0x200f8,0x11d2, + 0x700f5,0x77,0x11d3,0x11ca,0x11c9,0x11d1,0x11cc,0x400a8,0x77,0x11d4,0x11d3,0x300f7, + 0x11de,0x0,0x400fa,0x11d4,0x11d5,0x11de,0x200f8,0x11d5,0x50051,0x1e,0x11d7,0x1081, + 0x1,0x50041,0x12e,0x1203,0x12c,0x10a,0x4003d,0x1f,0x1204,0x1203,0x50051,0x1e, + 0x11d9,0x1204,0x1,0x50051,0x1e,0x11db,0x9db,0x1,0x50080,0x1e,0x11dc,0x11d9, + 0x11db,0x500af,0x77,0x11dd,0x11d7,0x11dc,0x200f9,0x11de,0x200f8,0x11de,0x700f5,0x77, + 0x11df,0x11d3,0x11d2,0x11dd,0x11d5,0x300f7,0x11e2,0x0,0x400fa,0x11df,0x11e0,0x11e2, + 0x200f8,0x11e0,0x60052,0x30,0x4192,0x105,0x418c,0x3,0x200f9,0x11e2,0x200f8,0x11e2, + 0x700f5,0x30,0x42d6,0x418c,0x11de,0x4192,0x11e0,0x300f7,0x123e,0x0,0x300fb,0x161, + 0x120f,0x200f8,0x120f,0x50051,0x13,0x1211,0x42ca,0x3,0x50051,0x13,0x1213,0x42ce, + 0x3,0x50051,0x13,0x1215,0x42d2,0x3,0x50051,0x13,0x1217,0x42d6,0x3,0x50081, + 0x13,0x121d,0x1211,0x1213,0x50081,0x13,0x1220,0x121d,0x1215,0x50081,0x13,0x1223, + 0x1220,0x1217,0x500b4,0x77,0x1225,0x1223,0x105,0x300f7,0x1227,0x0,0x400fa,0x1225, + 0x1226,0x1227,0x200f8,0x1226,0x200f9,0x123e,0x200f8,0x1227,0x5008e,0x30,0x122b,0x42ca, + 0x1211,0x5008e,0x30,0x122f,0x42ce,0x1213,0x50081,0x30,0x1230,0x122b,0x122f,0x5008e, + 0x30,0x1234,0x42d2,0x1215,0x50081,0x30,0x1235,0x1230,0x1234,0x5008e,0x30,0x1239, + 0x42d6,0x1217,0x50081,0x30,0x123a,0x1235,0x1239,0x70050,0x30,0x123c,0x1223,0x1223, + 0x1223,0x1223,0x50088,0x30,0x123d,0x123a,0x123c,0x200f9,0x123e,0x200f8,0x123e,0x700f5, + 0x30,0x2cba,0x1e3,0x1226,0x123d,0x1227,0x4003d,0x167,0x124c,0x169,0x40063,0x124c, + 0x8cf,0x2cba,0x500b2,0x77,0x8db,0x755,0x111,0x300f7,0x8dd,0x0,0x400fa,0x8db, + 0x8dc,0x8dd,0x200f8,0x8dc,0x200f9,0x957,0x200f8,0x8dd,0x6016e,0x30,0x12b0,0x10b, + 0x29fc,0x161,0x6016e,0x30,0x12b2,0x10b,0x29fc,0x111,0x6016e,0x30,0x12b4,0x10b, + 0x29fc,0x10a,0x300f7,0x12ef,0x0,0x300fb,0x161,0x12c0,0x200f8,0x12c0,0x50051,0x13, + 0x12c2,0x29fc,0x3,0x50051,0x13,0x12c4,0x12b0,0x3,0x50051,0x13,0x12c6,0x12b2, + 0x3,0x50051,0x13,0x12c8,0x12b4,0x3,0x50081,0x13,0x12ce,0x12c2,0x12c4,0x50081, + 0x13,0x12d1,0x12ce,0x12c6,0x50081,0x13,0x12d4,0x12d1,0x12c8,0x500b4,0x77,0x12d6, + 0x12d4,0x105,0x300f7,0x12d8,0x0,0x400fa,0x12d6,0x12d7,0x12d8,0x200f8,0x12d7,0x200f9, + 0x12ef,0x200f8,0x12d8,0x5008e,0x30,0x12dc,0x29fc,0x12c2,0x5008e,0x30,0x12e0,0x12b0, + 0x12c4,0x50081,0x30,0x12e1,0x12dc,0x12e0,0x5008e,0x30,0x12e5,0x12b2,0x12c6,0x50081, + 0x30,0x12e6,0x12e1,0x12e5,0x5008e,0x30,0x12ea,0x12b4,0x12c8,0x50081,0x30,0x12eb, + 0x12e6,0x12ea,0x70050,0x30,0x12ed,0x12d4,0x12d4,0x12d4,0x12d4,0x50088,0x30,0x12ee, + 0x12eb,0x12ed,0x200f9,0x12ef,0x200f8,0x12ef,0x700f5,0x30,0x2de0,0x1e3,0x12d7,0x12ee, + 0x12d8,0x6016e,0x30,0x12fd,0x10b,0x2ae6,0x161,0x6016e,0x30,0x12ff,0x10b,0x2ae6, + 0x111,0x6016e,0x30,0x1301,0x10b,0x2ae6,0x10a,0x300f7,0x133c,0x0,0x300fb,0x161, + 0x130d,0x200f8,0x130d,0x50051,0x13,0x130f,0x2ae6,0x3,0x50051,0x13,0x1311,0x12fd, + 0x3,0x50051,0x13,0x1313,0x12ff,0x3,0x50051,0x13,0x1315,0x1301,0x3,0x50081, + 0x13,0x131b,0x130f,0x1311,0x50081,0x13,0x131e,0x131b,0x1313,0x50081,0x13,0x1321, + 0x131e,0x1315,0x500b4,0x77,0x1323,0x1321,0x105,0x300f7,0x1325,0x0,0x400fa,0x1323, + 0x1324,0x1325,0x200f8,0x1324,0x200f9,0x133c,0x200f8,0x1325,0x5008e,0x30,0x1329,0x2ae6, + 0x130f,0x5008e,0x30,0x132d,0x12fd,0x1311,0x50081,0x30,0x132e,0x1329,0x132d,0x5008e, + 0x30,0x1332,0x12ff,0x1313,0x50081,0x30,0x1333,0x132e,0x1332,0x5008e,0x30,0x1337, + 0x1301,0x1315,0x50081,0x30,0x1338,0x1333,0x1337,0x70050,0x30,0x133a,0x1321,0x1321, + 0x1321,0x1321,0x50088,0x30,0x133b,0x1338,0x133a,0x200f9,0x133c,0x200f8,0x133c,0x700f5, + 0x30,0x2e2b,0x1e3,0x1324,0x133b,0x1325,0x6016e,0x30,0x134a,0x10b,0x2bd0,0x161, + 0x6016e,0x30,0x134c,0x10b,0x2bd0,0x111,0x6016e,0x30,0x134e,0x10b,0x2bd0,0x10a, + 0x300f7,0x1389,0x0,0x300fb,0x161,0x135a,0x200f8,0x135a,0x50051,0x13,0x135c,0x2bd0, + 0x3,0x50051,0x13,0x135e,0x134a,0x3,0x50051,0x13,0x1360,0x134c,0x3,0x50051, + 0x13,0x1362,0x134e,0x3,0x50081,0x13,0x1368,0x135c,0x135e,0x50081,0x13,0x136b, + 0x1368,0x1360,0x50081,0x13,0x136e,0x136b,0x1362,0x500b4,0x77,0x1370,0x136e,0x105, + 0x300f7,0x1372,0x0,0x400fa,0x1370,0x1371,0x1372,0x200f8,0x1371,0x200f9,0x1389,0x200f8, + 0x1372,0x5008e,0x30,0x1376,0x2bd0,0x135c,0x5008e,0x30,0x137a,0x134a,0x135e,0x50081, + 0x30,0x137b,0x1376,0x137a,0x5008e,0x30,0x137f,0x134c,0x1360,0x50081,0x30,0x1380, + 0x137b,0x137f,0x5008e,0x30,0x1384,0x134e,0x1362,0x50081,0x30,0x1385,0x1380,0x1384, + 0x70050,0x30,0x1387,0x136e,0x136e,0x136e,0x136e,0x50088,0x30,0x1388,0x1385,0x1387, + 0x200f9,0x1389,0x200f8,0x1389,0x700f5,0x30,0x2e59,0x1e3,0x1371,0x1388,0x1372,0x6016e, + 0x30,0x1397,0x10b,0x2cba,0x161,0x6016e,0x30,0x1399,0x10b,0x2cba,0x111,0x6016e, + 0x30,0x139b,0x10b,0x2cba,0x10a,0x300f7,0x13d6,0x0,0x300fb,0x161,0x13a7,0x200f8, + 0x13a7,0x50051,0x13,0x13a9,0x2cba,0x3,0x50051,0x13,0x13ab,0x1397,0x3,0x50051, + 0x13,0x13ad,0x1399,0x3,0x50051,0x13,0x13af,0x139b,0x3,0x50081,0x13,0x13b5, + 0x13a9,0x13ab,0x50081,0x13,0x13b8,0x13b5,0x13ad,0x50081,0x13,0x13bb,0x13b8,0x13af, + 0x500b4,0x77,0x13bd,0x13bb,0x105,0x300f7,0x13bf,0x0,0x400fa,0x13bd,0x13be,0x13bf, + 0x200f8,0x13be,0x200f9,0x13d6,0x200f8,0x13bf,0x5008e,0x30,0x13c3,0x2cba,0x13a9,0x5008e, + 0x30,0x13c7,0x1397,0x13ab,0x50081,0x30,0x13c8,0x13c3,0x13c7,0x5008e,0x30,0x13cc, + 0x1399,0x13ad,0x50081,0x30,0x13cd,0x13c8,0x13cc,0x5008e,0x30,0x13d1,0x139b,0x13af, + 0x50081,0x30,0x13d2,0x13cd,0x13d1,0x70050,0x30,0x13d4,0x13bb,0x13bb,0x13bb,0x13bb, + 0x50088,0x30,0x13d5,0x13d2,0x13d4,0x200f9,0x13d6,0x200f8,0x13d6,0x700f5,0x30,0x2e6a, + 0x1e3,0x13be,0x13d5,0x13bf,0x50089,0x6,0x8ef,0x712,0x18a,0x500aa,0x77,0x8f0, + 0x8ef,0x161,0x300f7,0x956,0x0,0x400fa,0x8f0,0x8f1,0x956,0x200f8,0x8f1,0x50084, + 0x19,0x8f4,0x766,0x40da,0x4007c,0x1f,0x8f5,0x8f4,0x50086,0x6,0x8f7,0x798, + 0x10a,0x4007c,0x1e,0x8f8,0x8f7,0x50086,0x6,0x8fa,0x79e,0x10a,0x4007c,0x1e, + 0x8fb,0x8fa,0x50050,0x1f,0x8fc,0x8f8,0x8fb,0x50080,0x1f,0x8fd,0x8f5,0x8fc, + 0x4003d,0x167,0x13eb,0x172,0x40063,0x13eb,0x8fd,0x2de0,0x50051,0x13,0x1440,0x2de0, + 0x0,0x60041,0x29c,0x1441,0x299,0x8f7,0x8fa,0x3003e,0x1441,0x1440,0x50051,0x13, + 0x1445,0x2de0,0x1,0x60041,0x29c,0x1446,0x29f,0x8f7,0x8fa,0x3003e,0x1446,0x1445, + 0x50051,0x13,0x144a,0x2de0,0x2,0x60041,0x29c,0x144b,0x2a4,0x8f7,0x8fa,0x3003e, + 0x144b,0x144a,0x50051,0x13,0x144f,0x2de0,0x3,0x60041,0x29c,0x1450,0x2a9,0x8f7, + 0x8fa,0x3003e,0x1450,0x144f,0x50080,0x6,0x90f,0x8f7,0x1b2,0x4007c,0x1e,0x910, + 0x90f,0x50050,0x1f,0x914,0x910,0x8fb,0x50080,0x1f,0x915,0x8f5,0x914,0x4003d, + 0x167,0x1464,0x172,0x40063,0x1464,0x915,0x2e2b,0x50051,0x13,0x14b9,0x2e2b,0x0, + 0x60041,0x29c,0x14ba,0x299,0x90f,0x8fa,0x3003e,0x14ba,0x14b9,0x50051,0x13,0x14be, + 0x2e2b,0x1,0x60041,0x29c,0x14bf,0x29f,0x90f,0x8fa,0x3003e,0x14bf,0x14be,0x50051, + 0x13,0x14c3,0x2e2b,0x2,0x60041,0x29c,0x14c4,0x2a4,0x90f,0x8fa,0x3003e,0x14c4, + 0x14c3,0x50051,0x13,0x14c8,0x2e2b,0x3,0x60041,0x29c,0x14c9,0x2a9,0x90f,0x8fa, + 0x3003e,0x14c9,0x14c8,0x50080,0x6,0x92b,0x8fa,0x1b2,0x4007c,0x1e,0x92c,0x92b, + 0x50050,0x1f,0x92d,0x8f8,0x92c,0x50080,0x1f,0x92e,0x8f5,0x92d,0x4003d,0x167, + 0x14dd,0x172,0x40063,0x14dd,0x92e,0x2e59,0x50051,0x13,0x1532,0x2e59,0x0,0x60041, + 0x29c,0x1533,0x299,0x8f7,0x92b,0x3003e,0x1533,0x1532,0x50051,0x13,0x1537,0x2e59, + 0x1,0x60041,0x29c,0x1538,0x29f,0x8f7,0x92b,0x3003e,0x1538,0x1537,0x50051,0x13, + 0x153c,0x2e59,0x2,0x60041,0x29c,0x153d,0x2a4,0x8f7,0x92b,0x3003e,0x153d,0x153c, + 0x50051,0x13,0x1541,0x2e59,0x3,0x60041,0x29c,0x1542,0x2a9,0x8f7,0x92b,0x3003e, + 0x1542,0x1541,0x50050,0x1f,0x947,0x910,0x92c,0x50080,0x1f,0x948,0x8f5,0x947, + 0x4003d,0x167,0x1556,0x172,0x40063,0x1556,0x948,0x2e6a,0x50051,0x13,0x15ab,0x2e6a, + 0x0,0x60041,0x29c,0x15ac,0x299,0x90f,0x92b,0x3003e,0x15ac,0x15ab,0x50051,0x13, + 0x15b0,0x2e6a,0x1,0x60041,0x29c,0x15b1,0x29f,0x90f,0x92b,0x3003e,0x15b1,0x15b0, + 0x50051,0x13,0x15b5,0x2e6a,0x2,0x60041,0x29c,0x15b6,0x2a4,0x90f,0x92b,0x3003e, + 0x15b6,0x15b5,0x50051,0x13,0x15ba,0x2e6a,0x3,0x60041,0x29c,0x15bb,0x2a9,0x90f, + 0x92b,0x3003e,0x15bb,0x15ba,0x200f9,0x956,0x200f8,0x956,0x200f9,0x957,0x200f8,0x957, + 0x300f7,0x160d,0x0,0x300fb,0x161,0x15d4,0x200f8,0x15d4,0x500b2,0x77,0x15d7,0x755, + 0x10a,0x300f7,0x15d9,0x0,0x400fa,0x15d7,0x15d8,0x15d9,0x200f8,0x15d8,0x200f9,0x160d, + 0x200f8,0x15d9,0x300e1,0x10a,0x2f8,0x400e0,0x10a,0x10a,0x2f9,0x60041,0x29c,0x1641, + 0x299,0x798,0x79e,0x4003d,0x13,0x1642,0x1641,0x60041,0x29c,0x1645,0x29f,0x798, + 0x79e,0x4003d,0x13,0x1646,0x1645,0x60041,0x29c,0x1649,0x2a4,0x798,0x79e,0x4003d, + 0x13,0x164a,0x1649,0x60041,0x29c,0x164d,0x2a9,0x798,0x79e,0x4003d,0x13,0x164e, + 0x164d,0x70050,0x30,0x164f,0x1642,0x1646,0x164a,0x164e,0x6016e,0x30,0x165c,0x10b, + 0x164f,0x161,0x6016e,0x30,0x165e,0x10b,0x164f,0x111,0x6016e,0x30,0x1660,0x10b, + 0x164f,0x10a,0x300f7,0x169b,0x0,0x300fb,0x161,0x166c,0x200f8,0x166c,0x50051,0x13, + 0x1670,0x165c,0x3,0x50051,0x13,0x1672,0x165e,0x3,0x50051,0x13,0x1674,0x1660, + 0x3,0x50081,0x13,0x167a,0x164e,0x1670,0x50081,0x13,0x167d,0x167a,0x1672,0x50081, + 0x13,0x1680,0x167d,0x1674,0x500b4,0x77,0x1682,0x1680,0x105,0x300f7,0x1684,0x0, + 0x400fa,0x1682,0x1683,0x1684,0x200f8,0x1683,0x200f9,0x169b,0x200f8,0x1684,0x5008e,0x30, + 0x1688,0x164f,0x164e,0x5008e,0x30,0x168c,0x165c,0x1670,0x50081,0x30,0x168d,0x1688, + 0x168c,0x5008e,0x30,0x1691,0x165e,0x1672,0x50081,0x30,0x1692,0x168d,0x1691,0x5008e, + 0x30,0x1696,0x1660,0x1674,0x50081,0x30,0x1697,0x1692,0x1696,0x70050,0x30,0x1699, + 0x1680,0x1680,0x1680,0x1680,0x50088,0x30,0x169a,0x1697,0x1699,0x200f9,0x169b,0x200f8, + 0x169b,0x700f5,0x30,0x3558,0x1e3,0x1683,0x169a,0x1684,0x50089,0x6,0x1621,0x712, + 0x18a,0x500aa,0x77,0x1622,0x1621,0x161,0x300f7,0x163c,0x0,0x400fa,0x1622,0x1623, + 0x163c,0x200f8,0x1623,0x50084,0x19,0x1626,0x766,0x40d8,0x4007c,0x1f,0x1627,0x1626, + 0x50086,0x6,0x1629,0x798,0x10a,0x4007c,0x1e,0x162a,0x1629,0x50086,0x6,0x162c, + 0x79e,0x10a,0x4007c,0x1e,0x162d,0x162c,0x50050,0x1f,0x162e,0x162a,0x162d,0x50080, + 0x1f,0x162f,0x1627,0x162e,0x4003d,0x167,0x16b7,0x17b,0x40063,0x16b7,0x162f,0x3558, + 0x50089,0x6,0x1637,0x162c,0x10a,0x50080,0x6,0x1638,0x798,0x1637,0x50051,0x13, + 0x1705,0x3558,0x0,0x60041,0x29c,0x1706,0x299,0x1638,0x79e,0x3003e,0x1706,0x1705, + 0x50051,0x13,0x170a,0x3558,0x1,0x60041,0x29c,0x170b,0x29f,0x1638,0x79e,0x3003e, + 0x170b,0x170a,0x50051,0x13,0x170f,0x3558,0x2,0x60041,0x29c,0x1710,0x2a4,0x1638, + 0x79e,0x3003e,0x1710,0x170f,0x50051,0x13,0x1714,0x3558,0x3,0x60041,0x29c,0x1715, + 0x2a9,0x1638,0x79e,0x3003e,0x1715,0x1714,0x200f9,0x163c,0x200f8,0x163c,0x500b2,0x77, + 0x15e5,0x755,0x10b,0x300f7,0x15e7,0x0,0x400fa,0x15e5,0x15e6,0x15e7,0x200f8,0x15e6, + 0x200f9,0x160d,0x200f8,0x15e7,0x300e1,0x10a,0x2f8,0x400e0,0x10a,0x10a,0x2f9,0x500b0, + 0x77,0x1724,0x712,0x396,0x300f7,0x174e,0x0,0x400fa,0x1724,0x1725,0x174e,0x200f8, + 0x1725,0x50089,0x6,0x1729,0x79e,0x10a,0x50080,0x6,0x172a,0x857,0x1729,0x60041, + 0x29c,0x1753,0x299,0x172a,0x85a,0x4003d,0x13,0x1754,0x1753,0x60041,0x29c,0x1757, + 0x29f,0x172a,0x85a,0x4003d,0x13,0x1758,0x1757,0x60041,0x29c,0x175b,0x2a4,0x172a, + 0x85a,0x4003d,0x13,0x175c,0x175b,0x60041,0x29c,0x175f,0x2a9,0x172a,0x85a,0x4003d, + 0x13,0x1760,0x175f,0x70050,0x30,0x1761,0x1754,0x1758,0x175c,0x1760,0x6016e,0x30, + 0x176e,0x10b,0x1761,0x161,0x6016e,0x30,0x1770,0x10b,0x1761,0x111,0x6016e,0x30, + 0x1772,0x10b,0x1761,0x10a,0x300f7,0x17ad,0x0,0x300fb,0x161,0x177e,0x200f8,0x177e, + 0x50051,0x13,0x1782,0x176e,0x3,0x50051,0x13,0x1784,0x1770,0x3,0x50051,0x13, + 0x1786,0x1772,0x3,0x50081,0x13,0x178c,0x1760,0x1782,0x50081,0x13,0x178f,0x178c, + 0x1784,0x50081,0x13,0x1792,0x178f,0x1786,0x500b4,0x77,0x1794,0x1792,0x105,0x300f7, + 0x1796,0x0,0x400fa,0x1794,0x1795,0x1796,0x200f8,0x1795,0x200f9,0x17ad,0x200f8,0x1796, + 0x5008e,0x30,0x179a,0x1761,0x1760,0x5008e,0x30,0x179e,0x176e,0x1782,0x50081,0x30, + 0x179f,0x179a,0x179e,0x5008e,0x30,0x17a3,0x1770,0x1784,0x50081,0x30,0x17a4,0x179f, + 0x17a3,0x5008e,0x30,0x17a8,0x1772,0x1786,0x50081,0x30,0x17a9,0x17a4,0x17a8,0x70050, + 0x30,0x17ab,0x1792,0x1792,0x1792,0x1792,0x50088,0x30,0x17ac,0x17a9,0x17ab,0x200f9, + 0x17ad,0x200f8,0x17ad,0x700f5,0x30,0x3613,0x1e3,0x1795,0x17ac,0x1796,0x300f7,0x174d, + 0x0,0x400fa,0x1622,0x1733,0x174d,0x200f8,0x1733,0x50084,0x19,0x1736,0x766,0x40d9, + 0x4007c,0x1f,0x1737,0x1736,0x50086,0x6,0x1739,0x798,0x10a,0x4007c,0x1e,0x173a, + 0x1739,0x50086,0x6,0x173c,0x79e,0x10a,0x4007c,0x1e,0x173d,0x173c,0x50050,0x1f, + 0x173e,0x173a,0x173d,0x50080,0x1f,0x173f,0x1737,0x173e,0x4003d,0x167,0x17d0,0x184, + 0x40063,0x17d0,0x173f,0x3613,0x50080,0x6,0x1748,0x857,0x173c,0x50051,0x13,0x1817, + 0x3613,0x0,0x60041,0x29c,0x1818,0x299,0x1748,0x85a,0x3003e,0x1818,0x1817,0x50051, + 0x13,0x181c,0x3613,0x1,0x60041,0x29c,0x181d,0x29f,0x1748,0x85a,0x3003e,0x181d, + 0x181c,0x50051,0x13,0x1821,0x3613,0x2,0x60041,0x29c,0x1822,0x2a4,0x1748,0x85a, + 0x3003e,0x1822,0x1821,0x50051,0x13,0x1826,0x3613,0x3,0x60041,0x29c,0x1827,0x2a9, + 0x1748,0x85a,0x3003e,0x1827,0x1826,0x200f9,0x174d,0x200f8,0x174d,0x200f9,0x174e,0x200f8, + 0x174e,0x500b2,0x77,0x15f4,0x755,0x18a,0x300f7,0x15f6,0x0,0x400fa,0x15f4,0x15f5, + 0x15f6,0x200f8,0x15f5,0x200f9,0x160d,0x200f8,0x15f6,0x300e1,0x10a,0x2f8,0x400e0,0x10a, + 0x10a,0x2f9,0x500b0,0x77,0x1836,0x712,0x295,0x300f7,0x185c,0x0,0x400fa,0x1836, + 0x1837,0x185c,0x200f8,0x1837,0x50084,0x6,0x1839,0x798,0x18a,0x50080,0x6,0x183b, + 0x1839,0x79e,0x50084,0x6,0x183d,0x79e,0x18a,0x60041,0x29c,0x1861,0x299,0x183b, + 0x183d,0x4003d,0x13,0x1862,0x1861,0x60041,0x29c,0x1865,0x29f,0x183b,0x183d,0x4003d, + 0x13,0x1866,0x1865,0x60041,0x29c,0x1869,0x2a4,0x183b,0x183d,0x4003d,0x13,0x186a, + 0x1869,0x60041,0x29c,0x186d,0x2a9,0x183b,0x183d,0x4003d,0x13,0x186e,0x186d,0x70050, + 0x30,0x186f,0x1862,0x1866,0x186a,0x186e,0x6016e,0x30,0x187c,0x10b,0x186f,0x161, + 0x6016e,0x30,0x187e,0x10b,0x186f,0x111,0x6016e,0x30,0x1880,0x10b,0x186f,0x10a, + 0x300f7,0x18bb,0x0,0x300fb,0x161,0x188c,0x200f8,0x188c,0x50051,0x13,0x1890,0x187c, + 0x3,0x50051,0x13,0x1892,0x187e,0x3,0x50051,0x13,0x1894,0x1880,0x3,0x50081, + 0x13,0x189a,0x186e,0x1890,0x50081,0x13,0x189d,0x189a,0x1892,0x50081,0x13,0x18a0, + 0x189d,0x1894,0x500b4,0x77,0x18a2,0x18a0,0x105,0x300f7,0x18a4,0x0,0x400fa,0x18a2, + 0x18a3,0x18a4,0x200f8,0x18a3,0x200f9,0x18bb,0x200f8,0x18a4,0x5008e,0x30,0x18a8,0x186f, + 0x186e,0x5008e,0x30,0x18ac,0x187c,0x1890,0x50081,0x30,0x18ad,0x18a8,0x18ac,0x5008e, + 0x30,0x18b1,0x187e,0x1892,0x50081,0x30,0x18b2,0x18ad,0x18b1,0x5008e,0x30,0x18b6, + 0x1880,0x1894,0x50081,0x30,0x18b7,0x18b2,0x18b6,0x70050,0x30,0x18b9,0x18a0,0x18a0, + 0x18a0,0x18a0,0x50088,0x30,0x18ba,0x18b7,0x18b9,0x200f9,0x18bb,0x200f8,0x18bb,0x700f5, + 0x30,0x36d5,0x1e3,0x18a3,0x18ba,0x18a4,0x300f7,0x185b,0x0,0x400fa,0x1622,0x1844, + 0x185b,0x200f8,0x1844,0x50084,0x19,0x1847,0x766,0x40db,0x4007c,0x1f,0x1848,0x1847, + 0x50086,0x6,0x184a,0x798,0x10a,0x4007c,0x1e,0x184b,0x184a,0x50086,0x6,0x184d, + 0x79e,0x10a,0x4007c,0x1e,0x184e,0x184d,0x50050,0x1f,0x184f,0x184b,0x184e,0x50080, + 0x1f,0x1850,0x1848,0x184f,0x4003d,0x167,0x18e5,0x18e,0x40063,0x18e5,0x1850,0x36d5, + 0x50080,0x6,0x1858,0x184a,0x79e,0x50051,0x13,0x1925,0x36d5,0x0,0x60041,0x29c, + 0x1926,0x299,0x1858,0x161,0x3003e,0x1926,0x1925,0x50051,0x13,0x192a,0x36d5,0x1, + 0x60041,0x29c,0x192b,0x29f,0x1858,0x161,0x3003e,0x192b,0x192a,0x50051,0x13,0x192f, + 0x36d5,0x2,0x60041,0x29c,0x1930,0x2a4,0x1858,0x161,0x3003e,0x1930,0x192f,0x50051, + 0x13,0x1934,0x36d5,0x3,0x60041,0x29c,0x1935,0x2a9,0x1858,0x161,0x3003e,0x1935, + 0x1934,0x200f9,0x185b,0x200f8,0x185b,0x200f9,0x185c,0x200f8,0x185c,0x500b2,0x77,0x1603, + 0x755,0x194,0x300f7,0x1605,0x0,0x400fa,0x1603,0x1604,0x1605,0x200f8,0x1604,0x200f9, + 0x160d,0x200f8,0x1605,0x300e1,0x10a,0x2f8,0x400e0,0x10a,0x10a,0x2f9,0x500b0,0x77, + 0x1941,0x712,0x18a,0x300f7,0x1952,0x0,0x400fa,0x1941,0x1942,0x1952,0x200f8,0x1942, + 0x60041,0x29c,0x1957,0x299,0x712,0x161,0x4003d,0x13,0x1958,0x1957,0x60041,0x29c, + 0x195b,0x29f,0x712,0x161,0x4003d,0x13,0x195c,0x195b,0x60041,0x29c,0x195f,0x2a4, + 0x712,0x161,0x4003d,0x13,0x1960,0x195f,0x60041,0x29c,0x1963,0x2a9,0x712,0x161, + 0x4003d,0x13,0x1964,0x1963,0x70050,0x30,0x1965,0x1958,0x195c,0x1960,0x1964,0x6016e, + 0x30,0x1972,0x10b,0x1965,0x161,0x6016e,0x30,0x1974,0x10b,0x1965,0x111,0x6016e, + 0x30,0x1976,0x10b,0x1965,0x10a,0x300f7,0x19b1,0x0,0x300fb,0x161,0x1982,0x200f8, + 0x1982,0x50051,0x13,0x1986,0x1972,0x3,0x50051,0x13,0x1988,0x1974,0x3,0x50051, + 0x13,0x198a,0x1976,0x3,0x50081,0x13,0x1990,0x1964,0x1986,0x50081,0x13,0x1993, + 0x1990,0x1988,0x50081,0x13,0x1996,0x1993,0x198a,0x500b4,0x77,0x1998,0x1996,0x105, + 0x300f7,0x199a,0x0,0x400fa,0x1998,0x1999,0x199a,0x200f8,0x1999,0x200f9,0x19b1,0x200f8, + 0x199a,0x5008e,0x30,0x199e,0x1965,0x1964,0x5008e,0x30,0x19a2,0x1972,0x1986,0x50081, + 0x30,0x19a3,0x199e,0x19a2,0x5008e,0x30,0x19a7,0x1974,0x1988,0x50081,0x30,0x19a8, + 0x19a3,0x19a7,0x5008e,0x30,0x19ac,0x1976,0x198a,0x50081,0x30,0x19ad,0x19a8,0x19ac, + 0x70050,0x30,0x19af,0x1996,0x1996,0x1996,0x1996,0x50088,0x30,0x19b0,0x19ad,0x19af, + 0x200f9,0x19b1,0x200f8,0x19b1,0x700f5,0x30,0x3777,0x1e3,0x1999,0x19b0,0x199a,0x300f7, + 0x1951,0x0,0x400fa,0x1622,0x194a,0x1951,0x200f8,0x194a,0x4007c,0x1f,0x194c,0x766, + 0x4003d,0x167,0x19e2,0x198,0x40063,0x19e2,0x194c,0x3777,0x200f9,0x1951,0x200f8,0x1951, + 0x200f9,0x1952,0x200f8,0x1952,0x200f9,0x160d,0x200f8,0x160d,0x500b2,0x77,0x7ae,0x755, + 0x19e,0x300f7,0x7b0,0x0,0x400fa,0x7ae,0x7af,0x7b0,0x200f8,0x7af,0x200f9,0x7c4, + 0x200f8,0x7b0,0x500aa,0x77,0x1a1b,0x712,0x161,0x300f7,0x1a1f,0x0,0x400fa,0x1a1b, + 0x1a1c,0x1a1f,0x200f8,0x1a1c,0x60041,0x15d,0x1a2c,0x15a,0xfe,0xfe,0x700ea,0x6, + 0x1a2d,0x1a2c,0x111,0x161,0x111,0x3003e,0x28a,0x1a2d,0x200f9,0x1a1f,0x200f8,0x1a1f, + 0x300e1,0x10a,0x2f8,0x400e0,0x10a,0x10a,0x2f9,0x4003d,0x6,0x1a31,0x28a,0x50082, + 0x6,0x1a23,0x759,0x111,0x500ab,0x77,0x1a24,0x1a31,0x1a23,0x300f7,0x7b6,0x0, + 0x400fa,0x1a24,0x7b5,0x7b6,0x200f8,0x7b5,0x200f9,0x7c4,0x200f8,0x7b6,0x60041,0x15d, + 0x1a39,0x15a,0xfe,0xfe,0x3003e,0x1a39,0x161,0x300f7,0x1ae4,0x0,0x300fb,0x161, + 0x1a66,0x200f8,0x1a66,0x50084,0x6,0x1a68,0x798,0x18a,0x4007c,0x1e,0x1a6a,0x1a68, + 0x50084,0x6,0x1a6c,0x79e,0x18a,0x4007c,0x1e,0x1a6e,0x1a6c,0x50050,0x1f,0x1a6f, + 0x1a6a,0x1a6e,0x4007c,0x19,0x1a7a,0x1a6f,0x50080,0x19,0x1aef,0x1a7a,0x34b,0x50080, + 0x19,0x1af1,0x1a7a,0x34e,0x50080,0x19,0x1af3,0x1a7a,0x351,0x4003d,0x167,0x1b4e, + 0x198,0x50062,0x30,0x1b50,0x1b4e,0x1a6f,0x4007c,0x1f,0x1b0d,0x1aef,0x4003d,0x167, + 0x1bb6,0x198,0x50062,0x30,0x1bb8,0x1bb6,0x1b0d,0x4007c,0x1f,0x1b11,0x1af1,0x4003d, + 0x167,0x1c1e,0x198,0x50062,0x30,0x1c20,0x1c1e,0x1b11,0x4007c,0x1f,0x1b15,0x1af3, + 0x4003d,0x167,0x1c86,0x198,0x50062,0x30,0x1c88,0x1c86,0x1b15,0x300f7,0x1cf2,0x0, + 0x300fb,0x161,0x1cc3,0x200f8,0x1cc3,0x50051,0x13,0x1cc5,0x1b50,0x3,0x50051,0x13, + 0x1cc7,0x1bb8,0x3,0x50051,0x13,0x1cc9,0x1c20,0x3,0x50051,0x13,0x1ccb,0x1c88, + 0x3,0x50081,0x13,0x1cd1,0x1cc5,0x1cc7,0x50081,0x13,0x1cd4,0x1cd1,0x1cc9,0x50081, + 0x13,0x1cd7,0x1cd4,0x1ccb,0x500b4,0x77,0x1cd9,0x1cd7,0x105,0x300f7,0x1cdb,0x0, + 0x400fa,0x1cd9,0x1cda,0x1cdb,0x200f8,0x1cda,0x200f9,0x1cf2,0x200f8,0x1cdb,0x5008e,0x30, + 0x1cdf,0x1b50,0x1cc5,0x5008e,0x30,0x1ce3,0x1bb8,0x1cc7,0x50081,0x30,0x1ce4,0x1cdf, + 0x1ce3,0x5008e,0x30,0x1ce8,0x1c20,0x1cc9,0x50081,0x30,0x1ce9,0x1ce4,0x1ce8,0x5008e, + 0x30,0x1ced,0x1c88,0x1ccb,0x50081,0x30,0x1cee,0x1ce9,0x1ced,0x70050,0x30,0x1cf0, + 0x1cd7,0x1cd7,0x1cd7,0x1cd7,0x50088,0x30,0x1cf1,0x1cee,0x1cf0,0x200f9,0x1cf2,0x200f8, + 0x1cf2,0x700f5,0x30,0x39ea,0x1e3,0x1cda,0x1cf1,0x1cdb,0x4003d,0x167,0x1d2a,0x1a2, + 0x40063,0x1d2a,0x85c,0x39ea,0x50080,0x6,0x1a83,0x1a68,0x10a,0x4007c,0x1e,0x1a84, + 0x1a83,0x50050,0x1f,0x1a89,0x1a84,0x1a6e,0x50080,0x6,0x1a8c,0x857,0x111,0x4007c, + 0x1e,0x1a8d,0x1a8c,0x50050,0x1f,0x1a92,0x1a8d,0x85b,0x4007c,0x19,0x1a94,0x1a89, + 0x50080,0x19,0x1d62,0x1a94,0x34b,0x50080,0x19,0x1d64,0x1a94,0x34e,0x50080,0x19, + 0x1d66,0x1a94,0x351,0x4003d,0x167,0x1dc1,0x198,0x50062,0x30,0x1dc3,0x1dc1,0x1a89, + 0x4007c,0x1f,0x1d80,0x1d62,0x4003d,0x167,0x1e29,0x198,0x50062,0x30,0x1e2b,0x1e29, + 0x1d80,0x4007c,0x1f,0x1d84,0x1d64,0x4003d,0x167,0x1e91,0x198,0x50062,0x30,0x1e93, + 0x1e91,0x1d84,0x4007c,0x1f,0x1d88,0x1d66,0x4003d,0x167,0x1ef9,0x198,0x50062,0x30, + 0x1efb,0x1ef9,0x1d88,0x300f7,0x1f65,0x0,0x300fb,0x161,0x1f36,0x200f8,0x1f36,0x50051, + 0x13,0x1f38,0x1dc3,0x3,0x50051,0x13,0x1f3a,0x1e2b,0x3,0x50051,0x13,0x1f3c, + 0x1e93,0x3,0x50051,0x13,0x1f3e,0x1efb,0x3,0x50081,0x13,0x1f44,0x1f38,0x1f3a, + 0x50081,0x13,0x1f47,0x1f44,0x1f3c,0x50081,0x13,0x1f4a,0x1f47,0x1f3e,0x500b4,0x77, + 0x1f4c,0x1f4a,0x105,0x300f7,0x1f4e,0x0,0x400fa,0x1f4c,0x1f4d,0x1f4e,0x200f8,0x1f4d, + 0x200f9,0x1f65,0x200f8,0x1f4e,0x5008e,0x30,0x1f52,0x1dc3,0x1f38,0x5008e,0x30,0x1f56, + 0x1e2b,0x1f3a,0x50081,0x30,0x1f57,0x1f52,0x1f56,0x5008e,0x30,0x1f5b,0x1e93,0x1f3c, + 0x50081,0x30,0x1f5c,0x1f57,0x1f5b,0x5008e,0x30,0x1f60,0x1efb,0x1f3e,0x50081,0x30, + 0x1f61,0x1f5c,0x1f60,0x70050,0x30,0x1f63,0x1f4a,0x1f4a,0x1f4a,0x1f4a,0x50088,0x30, + 0x1f64,0x1f61,0x1f63,0x200f9,0x1f65,0x200f8,0x1f65,0x700f5,0x30,0x3a5d,0x1e3,0x1f4d, + 0x1f64,0x1f4e,0x4003d,0x167,0x1f9d,0x1a2,0x40063,0x1f9d,0x1a92,0x3a5d,0x50080,0x6, + 0x1aa1,0x1a6c,0x10a,0x4007c,0x1e,0x1aa2,0x1aa1,0x50050,0x1f,0x1aa3,0x1a6a,0x1aa2, + 0x50080,0x6,0x1aaa,0x85a,0x111,0x4007c,0x1e,0x1aab,0x1aaa,0x50050,0x1f,0x1aac, + 0x858,0x1aab,0x4007c,0x19,0x1aae,0x1aa3,0x50080,0x19,0x1fd5,0x1aae,0x34b,0x50080, + 0x19,0x1fd7,0x1aae,0x34e,0x50080,0x19,0x1fd9,0x1aae,0x351,0x4003d,0x167,0x2034, + 0x198,0x50062,0x30,0x2036,0x2034,0x1aa3,0x4007c,0x1f,0x1ff3,0x1fd5,0x4003d,0x167, + 0x209c,0x198,0x50062,0x30,0x209e,0x209c,0x1ff3,0x4007c,0x1f,0x1ff7,0x1fd7,0x4003d, + 0x167,0x2104,0x198,0x50062,0x30,0x2106,0x2104,0x1ff7,0x4007c,0x1f,0x1ffb,0x1fd9, + 0x4003d,0x167,0x216c,0x198,0x50062,0x30,0x216e,0x216c,0x1ffb,0x300f7,0x21d8,0x0, + 0x300fb,0x161,0x21a9,0x200f8,0x21a9,0x50051,0x13,0x21ab,0x2036,0x3,0x50051,0x13, + 0x21ad,0x209e,0x3,0x50051,0x13,0x21af,0x2106,0x3,0x50051,0x13,0x21b1,0x216e, + 0x3,0x50081,0x13,0x21b7,0x21ab,0x21ad,0x50081,0x13,0x21ba,0x21b7,0x21af,0x50081, + 0x13,0x21bd,0x21ba,0x21b1,0x500b4,0x77,0x21bf,0x21bd,0x105,0x300f7,0x21c1,0x0, + 0x400fa,0x21bf,0x21c0,0x21c1,0x200f8,0x21c0,0x200f9,0x21d8,0x200f8,0x21c1,0x5008e,0x30, + 0x21c5,0x2036,0x21ab,0x5008e,0x30,0x21c9,0x209e,0x21ad,0x50081,0x30,0x21ca,0x21c5, + 0x21c9,0x5008e,0x30,0x21ce,0x2106,0x21af,0x50081,0x30,0x21cf,0x21ca,0x21ce,0x5008e, + 0x30,0x21d3,0x216e,0x21b1,0x50081,0x30,0x21d4,0x21cf,0x21d3,0x70050,0x30,0x21d6, + 0x21bd,0x21bd,0x21bd,0x21bd,0x50088,0x30,0x21d7,0x21d4,0x21d6,0x200f9,0x21d8,0x200f8, + 0x21d8,0x700f5,0x30,0x3ad0,0x1e3,0x21c0,0x21d7,0x21c1,0x4003d,0x167,0x2210,0x1a2, + 0x40063,0x2210,0x1aac,0x3ad0,0x50050,0x1f,0x1abd,0x1a84,0x1aa2,0x50050,0x1f,0x1ac6, + 0x1a8d,0x1aab,0x4007c,0x19,0x1ac8,0x1abd,0x50080,0x19,0x2248,0x1ac8,0x34b,0x50080, + 0x19,0x224a,0x1ac8,0x34e,0x50080,0x19,0x224c,0x1ac8,0x351,0x4003d,0x167,0x22a7, + 0x198,0x50062,0x30,0x22a9,0x22a7,0x1abd,0x4007c,0x1f,0x2266,0x2248,0x4003d,0x167, + 0x230f,0x198,0x50062,0x30,0x2311,0x230f,0x2266,0x4007c,0x1f,0x226a,0x224a,0x4003d, + 0x167,0x2377,0x198,0x50062,0x30,0x2379,0x2377,0x226a,0x4007c,0x1f,0x226e,0x224c, + 0x4003d,0x167,0x23df,0x198,0x50062,0x30,0x23e1,0x23df,0x226e,0x300f7,0x244b,0x0, + 0x300fb,0x161,0x241c,0x200f8,0x241c,0x50051,0x13,0x241e,0x22a9,0x3,0x50051,0x13, + 0x2420,0x2311,0x3,0x50051,0x13,0x2422,0x2379,0x3,0x50051,0x13,0x2424,0x23e1, + 0x3,0x50081,0x13,0x242a,0x241e,0x2420,0x50081,0x13,0x242d,0x242a,0x2422,0x50081, + 0x13,0x2430,0x242d,0x2424,0x500b4,0x77,0x2432,0x2430,0x105,0x300f7,0x2434,0x0, + 0x400fa,0x2432,0x2433,0x2434,0x200f8,0x2433,0x200f9,0x244b,0x200f8,0x2434,0x5008e,0x30, + 0x2438,0x22a9,0x241e,0x5008e,0x30,0x243c,0x2311,0x2420,0x50081,0x30,0x243d,0x2438, + 0x243c,0x5008e,0x30,0x2441,0x2379,0x2422,0x50081,0x30,0x2442,0x243d,0x2441,0x5008e, + 0x30,0x2446,0x23e1,0x2424,0x50081,0x30,0x2447,0x2442,0x2446,0x70050,0x30,0x2449, + 0x2430,0x2430,0x2430,0x2430,0x50088,0x30,0x244a,0x2447,0x2449,0x200f9,0x244b,0x200f8, + 0x244b,0x700f5,0x30,0x3b43,0x1e3,0x2433,0x244a,0x2434,0x4003d,0x167,0x2483,0x1a2, + 0x40063,0x2483,0x1ac6,0x3b43,0x500b2,0x77,0x1ad0,0x755,0x1a8,0x300f7,0x1ad2,0x0, + 0x400fa,0x1ad0,0x1ad1,0x1ad2,0x200f8,0x1ad1,0x200f9,0x1ae4,0x200f8,0x1ad2,0x300f7,0x24e6, + 0x0,0x300fb,0x161,0x24b7,0x200f8,0x24b7,0x50051,0x13,0x24b9,0x39ea,0x3,0x50051, + 0x13,0x24bb,0x3a5d,0x3,0x50051,0x13,0x24bd,0x3ad0,0x3,0x50051,0x13,0x24bf, + 0x3b43,0x3,0x50081,0x13,0x24c5,0x24b9,0x24bb,0x50081,0x13,0x24c8,0x24c5,0x24bd, + 0x50081,0x13,0x24cb,0x24c8,0x24bf,0x500b4,0x77,0x24cd,0x24cb,0x105,0x300f7,0x24cf, + 0x0,0x400fa,0x24cd,0x24ce,0x24cf,0x200f8,0x24ce,0x200f9,0x24e6,0x200f8,0x24cf,0x5008e, + 0x30,0x24d3,0x39ea,0x24b9,0x5008e,0x30,0x24d7,0x3a5d,0x24bb,0x50081,0x30,0x24d8, + 0x24d3,0x24d7,0x5008e,0x30,0x24dc,0x3ad0,0x24bd,0x50081,0x30,0x24dd,0x24d8,0x24dc, + 0x5008e,0x30,0x24e1,0x3b43,0x24bf,0x50081,0x30,0x24e2,0x24dd,0x24e1,0x70050,0x30, + 0x24e4,0x24cb,0x24cb,0x24cb,0x24cb,0x50088,0x30,0x24e5,0x24e2,0x24e4,0x200f9,0x24e6, + 0x200f8,0x24e6,0x700f5,0x30,0x3c5a,0x1e3,0x24ce,0x24e5,0x24cf,0x4003d,0x167,0x2525, + 0x1ac,0x40063,0x2525,0x866,0x3c5a,0x50051,0x13,0x2550,0x3c5a,0x0,0x60041,0x29c, + 0x2551,0x299,0x798,0x79e,0x3003e,0x2551,0x2550,0x50051,0x13,0x2555,0x3c5a,0x1, + 0x60041,0x29c,0x2556,0x29f,0x798,0x79e,0x3003e,0x2556,0x2555,0x50051,0x13,0x255a, + 0x3c5a,0x2,0x60041,0x29c,0x255b,0x2a4,0x798,0x79e,0x3003e,0x255b,0x255a,0x50051, + 0x13,0x255f,0x3c5a,0x3,0x60041,0x29c,0x2560,0x2a9,0x798,0x79e,0x3003e,0x2560, + 0x255f,0x200f9,0x1ae4,0x200f8,0x1ae4,0x300f7,0x25b2,0x0,0x300fb,0x161,0x2579,0x200f8, + 0x2579,0x500b2,0x77,0x257c,0x755,0x1b2,0x300f7,0x257e,0x0,0x400fa,0x257c,0x257d, + 0x257e,0x200f8,0x257d,0x200f9,0x25b2,0x200f8,0x257e,0x300e1,0x10a,0x2f8,0x400e0,0x10a, + 0x10a,0x2f9,0x60041,0x29c,0x25e6,0x299,0x798,0x79e,0x4003d,0x13,0x25e7,0x25e6, + 0x60041,0x29c,0x25ea,0x29f,0x798,0x79e,0x4003d,0x13,0x25eb,0x25ea,0x60041,0x29c, + 0x25ee,0x2a4,0x798,0x79e,0x4003d,0x13,0x25ef,0x25ee,0x60041,0x29c,0x25f2,0x2a9, + 0x798,0x79e,0x4003d,0x13,0x25f3,0x25f2,0x70050,0x30,0x25f4,0x25e7,0x25eb,0x25ef, + 0x25f3,0x6016e,0x30,0x2601,0x10b,0x25f4,0x161,0x6016e,0x30,0x2603,0x10b,0x25f4, + 0x111,0x6016e,0x30,0x2605,0x10b,0x25f4,0x10a,0x300f7,0x2640,0x0,0x300fb,0x161, + 0x2611,0x200f8,0x2611,0x50051,0x13,0x2615,0x2601,0x3,0x50051,0x13,0x2617,0x2603, + 0x3,0x50051,0x13,0x2619,0x2605,0x3,0x50081,0x13,0x261f,0x25f3,0x2615,0x50081, + 0x13,0x2622,0x261f,0x2617,0x50081,0x13,0x2625,0x2622,0x2619,0x500b4,0x77,0x2627, + 0x2625,0x105,0x300f7,0x2629,0x0,0x400fa,0x2627,0x2628,0x2629,0x200f8,0x2628,0x200f9, + 0x2640,0x200f8,0x2629,0x5008e,0x30,0x262d,0x25f4,0x25f3,0x5008e,0x30,0x2631,0x2601, + 0x2615,0x50081,0x30,0x2632,0x262d,0x2631,0x5008e,0x30,0x2636,0x2603,0x2617,0x50081, + 0x30,0x2637,0x2632,0x2636,0x5008e,0x30,0x263b,0x2605,0x2619,0x50081,0x30,0x263c, + 0x2637,0x263b,0x70050,0x30,0x263e,0x2625,0x2625,0x2625,0x2625,0x50088,0x30,0x263f, + 0x263c,0x263e,0x200f9,0x2640,0x200f8,0x2640,0x700f5,0x30,0x3e8e,0x1e3,0x2628,0x263f, + 0x2629,0x50089,0x6,0x25c6,0x712,0x18a,0x500aa,0x77,0x25c7,0x25c6,0x161,0x300f7, + 0x25e1,0x0,0x400fa,0x25c7,0x25c8,0x25e1,0x200f8,0x25c8,0x50086,0x6,0x25ce,0x798, + 0x10a,0x4007c,0x1e,0x25cf,0x25ce,0x50086,0x6,0x25d1,0x79e,0x10a,0x4007c,0x1e, + 0x25d2,0x25d1,0x50050,0x1f,0x25d3,0x25cf,0x25d2,0x4003d,0x167,0x2686,0x1b6,0x40063, + 0x2686,0x25d3,0x3e8e,0x50089,0x6,0x25dc,0x25d1,0x10a,0x50080,0x6,0x25dd,0x798, + 0x25dc,0x50051,0x13,0x26aa,0x3e8e,0x0,0x60041,0x29c,0x26ab,0x299,0x25dd,0x79e, + 0x3003e,0x26ab,0x26aa,0x50051,0x13,0x26af,0x3e8e,0x1,0x60041,0x29c,0x26b0,0x29f, + 0x25dd,0x79e,0x3003e,0x26b0,0x26af,0x50051,0x13,0x26b4,0x3e8e,0x2,0x60041,0x29c, + 0x26b5,0x2a4,0x25dd,0x79e,0x3003e,0x26b5,0x26b4,0x50051,0x13,0x26b9,0x3e8e,0x3, + 0x60041,0x29c,0x26ba,0x2a9,0x25dd,0x79e,0x3003e,0x26ba,0x26b9,0x200f9,0x25e1,0x200f8, + 0x25e1,0x500b2,0x77,0x258a,0x755,0x1bc,0x300f7,0x258c,0x0,0x400fa,0x258a,0x258b, + 0x258c,0x200f8,0x258b,0x200f9,0x25b2,0x200f8,0x258c,0x300e1,0x10a,0x2f8,0x400e0,0x10a, + 0x10a,0x2f9,0x500b0,0x77,0x26c9,0x712,0x396,0x300f7,0x26f3,0x0,0x400fa,0x26c9, + 0x26ca,0x26f3,0x200f8,0x26ca,0x50089,0x6,0x26ce,0x79e,0x10a,0x50080,0x6,0x26cf, + 0x857,0x26ce,0x60041,0x29c,0x26f8,0x299,0x26cf,0x85a,0x4003d,0x13,0x26f9,0x26f8, + 0x60041,0x29c,0x26fc,0x29f,0x26cf,0x85a,0x4003d,0x13,0x26fd,0x26fc,0x60041,0x29c, + 0x2700,0x2a4,0x26cf,0x85a,0x4003d,0x13,0x2701,0x2700,0x60041,0x29c,0x2704,0x2a9, + 0x26cf,0x85a,0x4003d,0x13,0x2705,0x2704,0x70050,0x30,0x2706,0x26f9,0x26fd,0x2701, + 0x2705,0x6016e,0x30,0x2713,0x10b,0x2706,0x161,0x6016e,0x30,0x2715,0x10b,0x2706, + 0x111,0x6016e,0x30,0x2717,0x10b,0x2706,0x10a,0x300f7,0x2752,0x0,0x300fb,0x161, + 0x2723,0x200f8,0x2723,0x50051,0x13,0x2727,0x2713,0x3,0x50051,0x13,0x2729,0x2715, + 0x3,0x50051,0x13,0x272b,0x2717,0x3,0x50081,0x13,0x2731,0x2705,0x2727,0x50081, + 0x13,0x2734,0x2731,0x2729,0x50081,0x13,0x2737,0x2734,0x272b,0x500b4,0x77,0x2739, + 0x2737,0x105,0x300f7,0x273b,0x0,0x400fa,0x2739,0x273a,0x273b,0x200f8,0x273a,0x200f9, + 0x2752,0x200f8,0x273b,0x5008e,0x30,0x273f,0x2706,0x2705,0x5008e,0x30,0x2743,0x2713, + 0x2727,0x50081,0x30,0x2744,0x273f,0x2743,0x5008e,0x30,0x2748,0x2715,0x2729,0x50081, + 0x30,0x2749,0x2744,0x2748,0x5008e,0x30,0x274d,0x2717,0x272b,0x50081,0x30,0x274e, + 0x2749,0x274d,0x70050,0x30,0x2750,0x2737,0x2737,0x2737,0x2737,0x50088,0x30,0x2751, + 0x274e,0x2750,0x200f9,0x2752,0x200f8,0x2752,0x700f5,0x30,0x3f49,0x1e3,0x273a,0x2751, + 0x273b,0x300f7,0x26f2,0x0,0x400fa,0x25c7,0x26d8,0x26f2,0x200f8,0x26d8,0x50086,0x6, + 0x26de,0x798,0x10a,0x4007c,0x1e,0x26df,0x26de,0x50086,0x6,0x26e1,0x79e,0x10a, + 0x4007c,0x1e,0x26e2,0x26e1,0x50050,0x1f,0x26e3,0x26df,0x26e2,0x4003d,0x167,0x279f, + 0x1c0,0x40063,0x279f,0x26e3,0x3f49,0x50080,0x6,0x26ed,0x857,0x26e1,0x50051,0x13, + 0x27bc,0x3f49,0x0,0x60041,0x29c,0x27bd,0x299,0x26ed,0x85a,0x3003e,0x27bd,0x27bc, + 0x50051,0x13,0x27c1,0x3f49,0x1,0x60041,0x29c,0x27c2,0x29f,0x26ed,0x85a,0x3003e, + 0x27c2,0x27c1,0x50051,0x13,0x27c6,0x3f49,0x2,0x60041,0x29c,0x27c7,0x2a4,0x26ed, + 0x85a,0x3003e,0x27c7,0x27c6,0x50051,0x13,0x27cb,0x3f49,0x3,0x60041,0x29c,0x27cc, + 0x2a9,0x26ed,0x85a,0x3003e,0x27cc,0x27cb,0x200f9,0x26f2,0x200f8,0x26f2,0x200f9,0x26f3, + 0x200f8,0x26f3,0x500b2,0x77,0x2599,0x755,0x1c6,0x300f7,0x259b,0x0,0x400fa,0x2599, + 0x259a,0x259b,0x200f8,0x259a,0x200f9,0x25b2,0x200f8,0x259b,0x300e1,0x10a,0x2f8,0x400e0, + 0x10a,0x10a,0x2f9,0x500b0,0x77,0x27db,0x712,0x295,0x300f7,0x2801,0x0,0x400fa, + 0x27db,0x27dc,0x2801,0x200f8,0x27dc,0x50080,0x6,0x27e0,0x1a68,0x79e,0x60041,0x29c, + 0x2806,0x299,0x27e0,0x1a6c,0x4003d,0x13,0x2807,0x2806,0x60041,0x29c,0x280a,0x29f, + 0x27e0,0x1a6c,0x4003d,0x13,0x280b,0x280a,0x60041,0x29c,0x280e,0x2a4,0x27e0,0x1a6c, + 0x4003d,0x13,0x280f,0x280e,0x60041,0x29c,0x2812,0x2a9,0x27e0,0x1a6c,0x4003d,0x13, + 0x2813,0x2812,0x70050,0x30,0x2814,0x2807,0x280b,0x280f,0x2813,0x6016e,0x30,0x2821, + 0x10b,0x2814,0x161,0x6016e,0x30,0x2823,0x10b,0x2814,0x111,0x6016e,0x30,0x2825, + 0x10b,0x2814,0x10a,0x300f7,0x2860,0x0,0x300fb,0x161,0x2831,0x200f8,0x2831,0x50051, + 0x13,0x2835,0x2821,0x3,0x50051,0x13,0x2837,0x2823,0x3,0x50051,0x13,0x2839, + 0x2825,0x3,0x50081,0x13,0x283f,0x2813,0x2835,0x50081,0x13,0x2842,0x283f,0x2837, + 0x50081,0x13,0x2845,0x2842,0x2839,0x500b4,0x77,0x2847,0x2845,0x105,0x300f7,0x2849, + 0x0,0x400fa,0x2847,0x2848,0x2849,0x200f8,0x2848,0x200f9,0x2860,0x200f8,0x2849,0x5008e, + 0x30,0x284d,0x2814,0x2813,0x5008e,0x30,0x2851,0x2821,0x2835,0x50081,0x30,0x2852, + 0x284d,0x2851,0x5008e,0x30,0x2856,0x2823,0x2837,0x50081,0x30,0x2857,0x2852,0x2856, + 0x5008e,0x30,0x285b,0x2825,0x2839,0x50081,0x30,0x285c,0x2857,0x285b,0x70050,0x30, + 0x285e,0x2845,0x2845,0x2845,0x2845,0x50088,0x30,0x285f,0x285c,0x285e,0x200f9,0x2860, + 0x200f8,0x2860,0x700f5,0x30,0x400b,0x1e3,0x2848,0x285f,0x2849,0x300f7,0x2800,0x0, + 0x400fa,0x25c7,0x27e9,0x2800,0x200f8,0x27e9,0x50086,0x6,0x27ef,0x798,0x10a,0x4007c, + 0x1e,0x27f0,0x27ef,0x50086,0x6,0x27f2,0x79e,0x10a,0x4007c,0x1e,0x27f3,0x27f2, + 0x50050,0x1f,0x27f4,0x27f0,0x27f3,0x4003d,0x167,0x28b4,0x1ca,0x40063,0x28b4,0x27f4, + 0x400b,0x50080,0x6,0x27fd,0x27ef,0x79e,0x50051,0x13,0x28ca,0x400b,0x0,0x60041, + 0x29c,0x28cb,0x299,0x27fd,0x161,0x3003e,0x28cb,0x28ca,0x50051,0x13,0x28cf,0x400b, + 0x1,0x60041,0x29c,0x28d0,0x29f,0x27fd,0x161,0x3003e,0x28d0,0x28cf,0x50051,0x13, + 0x28d4,0x400b,0x2,0x60041,0x29c,0x28d5,0x2a4,0x27fd,0x161,0x3003e,0x28d5,0x28d4, + 0x50051,0x13,0x28d9,0x400b,0x3,0x60041,0x29c,0x28da,0x2a9,0x27fd,0x161,0x3003e, + 0x28da,0x28d9,0x200f9,0x2800,0x200f8,0x2800,0x200f9,0x2801,0x200f8,0x2801,0x500b2,0x77, + 0x25a8,0x755,0x1d0,0x300f7,0x25aa,0x0,0x400fa,0x25a8,0x25a9,0x25aa,0x200f8,0x25a9, + 0x200f9,0x25b2,0x200f8,0x25aa,0x300e1,0x10a,0x2f8,0x400e0,0x10a,0x10a,0x2f9,0x500b0, + 0x77,0x28e6,0x712,0x18a,0x300f7,0x28f7,0x0,0x400fa,0x28e6,0x28e7,0x28f7,0x200f8, + 0x28e7,0x60041,0x29c,0x28fc,0x299,0x712,0x161,0x4003d,0x13,0x28fd,0x28fc,0x60041, + 0x29c,0x2900,0x29f,0x712,0x161,0x4003d,0x13,0x2901,0x2900,0x60041,0x29c,0x2904, + 0x2a4,0x712,0x161,0x4003d,0x13,0x2905,0x2904,0x60041,0x29c,0x2908,0x2a9,0x712, + 0x161,0x4003d,0x13,0x2909,0x2908,0x70050,0x30,0x290a,0x28fd,0x2901,0x2905,0x2909, + 0x6016e,0x30,0x2917,0x10b,0x290a,0x161,0x6016e,0x30,0x2919,0x10b,0x290a,0x111, + 0x6016e,0x30,0x291b,0x10b,0x290a,0x10a,0x300f7,0x2956,0x0,0x300fb,0x161,0x2927, + 0x200f8,0x2927,0x50051,0x13,0x292b,0x2917,0x3,0x50051,0x13,0x292d,0x2919,0x3, + 0x50051,0x13,0x292f,0x291b,0x3,0x50081,0x13,0x2935,0x2909,0x292b,0x50081,0x13, + 0x2938,0x2935,0x292d,0x50081,0x13,0x293b,0x2938,0x292f,0x500b4,0x77,0x293d,0x293b, + 0x105,0x300f7,0x293f,0x0,0x400fa,0x293d,0x293e,0x293f,0x200f8,0x293e,0x200f9,0x2956, + 0x200f8,0x293f,0x5008e,0x30,0x2943,0x290a,0x2909,0x5008e,0x30,0x2947,0x2917,0x292b, + 0x50081,0x30,0x2948,0x2943,0x2947,0x5008e,0x30,0x294c,0x2919,0x292d,0x50081,0x30, + 0x294d,0x2948,0x294c,0x5008e,0x30,0x2951,0x291b,0x292f,0x50081,0x30,0x2952,0x294d, + 0x2951,0x70050,0x30,0x2954,0x293b,0x293b,0x293b,0x293b,0x50088,0x30,0x2955,0x2952, + 0x2954,0x200f9,0x2956,0x200f8,0x2956,0x700f5,0x30,0x40ad,0x1e3,0x293e,0x2955,0x293f, + 0x300f7,0x28f6,0x0,0x400fa,0x25c7,0x28ef,0x28f6,0x200f8,0x28ef,0x4003d,0x167,0x29b1, + 0x1d4,0x40063,0x29b1,0x40dc,0x40ad,0x200f9,0x28f6,0x200f8,0x28f6,0x200f9,0x28f7,0x200f8, + 0x28f7,0x200f9,0x25b2,0x200f8,0x25b2,0x200f9,0x7c4,0x200f8,0x7c4,0x100fd,0x10038, +}; +static const char *fi_compute_inpainting_pyramid_pass_0_cb_names[] = {"cbFI", "cbInpaintingPyramid"}; +static const uint32_t fi_compute_inpainting_pyramid_pass_0_cb_bind[] = {15, 16}; +static const uint32_t fi_compute_inpainting_pyramid_pass_0_cb_count[] = {1, 1}; +static const uint32_t fi_compute_inpainting_pyramid_pass_0_cb_space[] = {0, 0}; +static const char *fi_compute_inpainting_pyramid_pass_0_srv_tex_names[] = {"r_output"}; +static const uint32_t fi_compute_inpainting_pyramid_pass_0_srv_tex_bind[] = {0}; +static const uint32_t fi_compute_inpainting_pyramid_pass_0_srv_tex_count[] = {1}; +static const uint32_t fi_compute_inpainting_pyramid_pass_0_srv_tex_space[] = {0}; +static const char *fi_compute_inpainting_pyramid_pass_0_uav_tex_names[] = {"rw_inpainting_pyramid0", "rw_inpainting_pyramid1", "rw_inpainting_pyramid2", "rw_inpainting_pyramid3", "rw_inpainting_pyramid4", "rw_inpainting_pyramid5", "rw_inpainting_pyramid6", "rw_inpainting_pyramid7", "rw_inpainting_pyramid8", "rw_inpainting_pyramid9", "rw_inpainting_pyramid10", "rw_inpainting_pyramid11"}; +static const uint32_t fi_compute_inpainting_pyramid_pass_0_uav_tex_bind[] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}; +static const uint32_t fi_compute_inpainting_pyramid_pass_0_uav_tex_count[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; +static const uint32_t fi_compute_inpainting_pyramid_pass_0_uav_tex_space[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +static const char *fi_compute_inpainting_pyramid_pass_0_uav_buf_names[] = {"rw_counters"}; +static const uint32_t fi_compute_inpainting_pyramid_pass_0_uav_buf_bind[] = {1}; +static const uint32_t fi_compute_inpainting_pyramid_pass_0_uav_buf_count[] = {1}; +static const uint32_t fi_compute_inpainting_pyramid_pass_0_uav_buf_space[] = {0}; + +static const uint32_t fi_inpainting_pass_0_spv[2822] = { + 0x7230203,0x10500,0x8000b,0x8c1,0x0,0x20011,0x1,0x20011,0x37,0x20011,0x38,0x6000b, + 0x1,0x4c534c47,0x6474732e,0x3035342e,0x0,0x3000e,0x0,0x1,0xc000f,0x5,0x4,0x6e69616d, + 0x0,0x13f,0x171,0x17b,0x186,0x18e,0x196,0x397,0x60010,0x4,0x11,0x8, + 0x8,0x1,0x30003,0x2,0x1c2,0xb0004,0x455f4c47,0x735f5458,0x6c706d61,0x656c7265,0x745f7373,0x75747865, + 0x665f6572,0x74636e75,0x736e6f69,0x0,0xb0004,0x455f4c47,0x735f5458,0x65646168,0x78655f72,0x63696c70,0x615f7469,0x68746972, + 0x6974656d,0x79745f63,0x736570,0xa0004,0x455f4c47,0x735f5458,0x65646168,0x6d695f72,0x5f656761,0x64616f6c,0x726f665f,0x7474616d, + 0x6465,0xa0004,0x475f4c47,0x4c474f4f,0x70635f45,0x74735f70,0x5f656c79,0x656e696c,0x7269645f,0x69746365,0x6576,0x80004, + 0x475f4c47,0x4c474f4f,0x6e695f45,0x64756c63,0x69645f65,0x74636572,0x657669,0x40005,0x4,0x6e69616d,0x0,0x40005, + 0x13d,0x49466263,0x745f,0x60006,0x13d,0x0,0x70736964,0x5379616c,0x657a69,0x50006,0x13d,0x1, + 0x65736572,0x74,0x90006,0x13d,0x2,0x4c445548,0x41737365,0x63617474,0x46646568,0x6f746361,0x72,0x70006, + 0x13d,0x3,0x70736964,0x68637461,0x67616c46,0x73,0x70006,0x13d,0x4,0x75626564,0x72614267,0x6f6c6f43, + 0x72,0xa0006,0x13d,0x5,0x6b636162,0x66667542,0x72547265,0x66736e61,0x75467265,0x6974636e,0x6e6f,0x70006, + 0x13d,0x6,0x4d6e696d,0x754c7861,0x616e696d,0x65636e,0x40005,0x13f,0x49466263,0x0,0xa0005,0x171, + 0x75635f72,0x6e657272,0x6e695f74,0x70726574,0x74616c6f,0x5f6e6f69,0x72756f73,0x6563,0x70005,0x17b,0x706f5f72,0x61636974, + 0x6c665f6c,0x735f776f,0x6463,0x80005,0x186,0x6e695f72,0x6e696170,0x676e6974,0x7279705f,0x64696d61,0x0,0x80005, + 0x18e,0x72705f72,0x6e657365,0x61625f74,0x75626b63,0x72656666,0x0,0x50005,0x196,0x6f5f7772,0x75707475,0x74, + 0x80005,0x397,0x475f6c67,0x61626f6c,0x766e496c,0x7461636f,0x496e6f69,0x44,0x30047,0x13d,0x2,0x50048, + 0x13d,0x0,0x23,0x8,0x50048,0x13d,0x1,0x23,0x2c,0x50048,0x13d,0x2, + 0x23,0x44,0x50048,0x13d,0x3,0x23,0x5c,0x50048,0x13d,0x4,0x23,0x80, + 0x50048,0x13d,0x5,0x23,0x8c,0x50048,0x13d,0x6,0x23,0x90,0x40047,0x13f, + 0x21,0x8,0x40047,0x13f,0x22,0x0,0x40047,0x171,0x21,0x3,0x40047,0x171, + 0x22,0x0,0x40047,0x17b,0x21,0x0,0x40047,0x17b,0x22,0x0,0x40047,0x186, + 0x21,0x1,0x40047,0x186,0x22,0x0,0x40047,0x18e,0x21,0x2,0x40047,0x18e, + 0x22,0x0,0x40047,0x196,0x21,0x7,0x40047,0x196,0x22,0x0,0x40047,0x397, + 0xb,0x1c,0x40047,0x3ae,0xb,0x19,0x20013,0x2,0x30021,0x3,0x2,0x40015, + 0x6,0x20,0x0,0x30016,0x8,0x20,0x40020,0xd,0x7,0x8,0x40017,0xe, + 0x8,0x3,0x40017,0x22,0x8,0x2,0x40015,0x44,0x20,0x1,0x40017,0x45, + 0x44,0x2,0x20014,0x49,0x40020,0x5d,0x7,0x45,0x40017,0x65,0x6,0x2, + 0x40017,0x67,0x8,0x4,0x4002b,0x6,0x83,0x4,0x4001c,0x84,0x45,0x83, + 0x4001c,0x85,0x8,0x83,0x4002b,0x8,0xc4,0x0,0x4002b,0x8,0xc5,0x3f800000, + 0x4002b,0x8,0xff,0x3c4fcd9e,0x4002b,0x8,0x104,0x3f560008,0x4002b,0x8,0x10a,0x4196d014, + 0x4002b,0x8,0x10d,0x41958000,0x4002b,0x8,0x114,0x40c8e061,0x4002b,0x8,0x11b,0x3d25aee6, + 0x4002b,0x8,0x11c,0x3d9e8391,0x4002b,0x8,0x11d,0x4019999a,0x4002b,0x8,0x120,0x3f72a76e, + 0x4002b,0x8,0x121,0x3d558919,0x9001e,0x13d,0x45,0x44,0x44,0x6,0xe,0x6, + 0x22,0x40020,0x13e,0x2,0x13d,0x4003b,0x13e,0x13f,0x2,0x4002b,0x44,0x140, + 0x1,0x40020,0x141,0x2,0x45,0x40020,0x147,0x2,0x44,0x4002b,0x44,0x14d, + 0xa,0x40020,0x153,0x2,0x6,0x40020,0x159,0x2,0xe,0x4002b,0x6,0x164, + 0x0,0x40020,0x165,0x2,0x8,0x4002b,0x6,0x16a,0x1,0x90019,0x16f,0x8, + 0x1,0x0,0x0,0x0,0x1,0x0,0x40020,0x170,0x0,0x16f,0x4003b,0x170, + 0x171,0x0,0x4002b,0x44,0x174,0x0,0x90019,0x179,0x6,0x1,0x0,0x0, + 0x0,0x1,0x0,0x40020,0x17a,0x0,0x179,0x4003b,0x17a,0x17b,0x0,0x5002c, + 0x45,0x17d,0x140,0x174,0x40017,0x17e,0x6,0x4,0x4002b,0x6,0x181,0xf, + 0x4003b,0x170,0x186,0x0,0x4003b,0x170,0x18e,0x0,0x90019,0x194,0x8,0x1, + 0x0,0x0,0x0,0x2,0x0,0x40020,0x195,0x0,0x194,0x4003b,0x195,0x196, + 0x0,0x4002b,0x8,0x1be,0x461c4000,0x4002b,0x8,0x1d4,0x3f000000,0x5002c,0x22,0x1d5, + 0x1d4,0x1d4,0x4002b,0x44,0x1d9,0x2,0x5002c,0x45,0x1e2,0x174,0x174,0x5002c, + 0x45,0x1e5,0x174,0x140,0x5002c,0x45,0x1e8,0x140,0x140,0x40017,0x20d,0x49, + 0x2,0x4002b,0x8,0x22b,0x3dcccccd,0x4002b,0x6,0x238,0x2,0x7002c,0x67,0x255, + 0xc4,0xc4,0xc4,0xc4,0x4002b,0x44,0x25d,0x4,0x4002b,0x8,0x2ba,0x41200000, + 0x4002b,0x8,0x2bd,0x40400000,0x4002b,0x44,0x2d9,0x10,0x30029,0x49,0x2de,0x4002b, + 0x44,0x2ed,0x20,0x4002b,0x44,0x2fe,0x40,0x4002b,0x8,0x312,0x3a83126f,0x6002c, + 0xe,0x33c,0xc4,0xc4,0xc4,0x40017,0x33d,0x49,0x3,0x40017,0x395,0x6, + 0x3,0x40020,0x396,0x1,0x395,0x4003b,0x396,0x397,0x1,0x4002b,0x6,0x3ad, + 0x8,0x6002c,0x395,0x3ae,0x3ad,0x3ad,0x16a,0x40020,0x7b0,0x7,0x84,0x40020, + 0x7b2,0x7,0x85,0x30001,0xe,0x805,0x5002c,0x45,0x853,0x1d9,0x1d9,0x7002c, + 0x84,0x854,0x1e2,0x17d,0x1e5,0x1e8,0x6002c,0xe,0x855,0x11b,0x11b,0x11b, + 0x6002c,0xe,0x856,0xc5,0xc5,0xc5,0x6002c,0xe,0x857,0x11c,0x11c,0x11c, + 0x6002c,0xe,0x858,0x120,0x120,0x120,0x6002c,0xe,0x859,0x121,0x121,0x121, + 0x6002c,0xe,0x85a,0x11d,0x11d,0x11d,0x6002c,0xe,0x85b,0xff,0xff,0xff, + 0x6002c,0xe,0x85c,0x104,0x104,0x104,0x6002c,0xe,0x85d,0x10a,0x10a,0x10a, + 0x6002c,0xe,0x85e,0x10d,0x10d,0x10d,0x6002c,0xe,0x85f,0x114,0x114,0x114, + 0x4002b,0x8,0x860,0x3c4ccccd,0x4002b,0x8,0x861,0xff800000,0x6002c,0xe,0x862,0x861, + 0x861,0x861,0x4002b,0x6,0x8a1,0x5,0x4002b,0x6,0x8a2,0x6,0x4002b,0x6, + 0x8a3,0x3,0x50036,0x2,0x4,0x0,0x3,0x200f8,0x5,0x4003b,0x7b2,0x7cc, + 0x7,0x4003b,0x7b0,0x7cb,0x7,0x4003d,0x395,0x398,0x397,0x7004f,0x65,0x399, + 0x398,0x398,0x0,0x1,0x4007c,0x45,0x39a,0x399,0x4003d,0x194,0x43b,0x196, + 0x50062,0x67,0x43d,0x43b,0x39a,0x50051,0x8,0x3cf,0x43d,0x3,0x500ba,0x49, + 0x3d1,0x3cf,0x312,0x300f7,0x3e4,0x0,0x400fa,0x3d1,0x3d2,0x3e4,0x200f8,0x3d2, + 0x4006f,0x22,0x44c,0x39a,0x50081,0x22,0x44e,0x44c,0x1d5,0x50041,0x141,0x487, + 0x13f,0x164,0x4003d,0x45,0x488,0x487,0x4006f,0x22,0x450,0x488,0x50088,0x22, + 0x451,0x44e,0x450,0x200f9,0x453,0x200f8,0x453,0x700f5,0x67,0x8a4,0x255,0x3d2, + 0x8c0,0x47b,0x700f5,0x45,0x836,0x488,0x3d2,0x45a,0x47b,0x700f5,0x44,0x7ff, + 0x174,0x3d2,0x47d,0x47b,0x500b1,0x49,0x456,0x7ff,0x14d,0x400f6,0x47e,0x47b, + 0x0,0x400fa,0x456,0x457,0x47e,0x200f8,0x457,0x50087,0x45,0x45a,0x836,0x853, + 0x4006f,0x22,0x4d1,0x45a,0x50085,0x22,0x4d2,0x451,0x4d1,0x50083,0x22,0x4d3, + 0x4d2,0x1d5,0x6000c,0x22,0x4d5,0x1,0x8,0x4d3,0x4006e,0x45,0x4d6,0x4d5, + 0x6000c,0x22,0x4fe,0x1,0xa,0x4d3,0x50051,0x8,0x4df,0x4fe,0x0,0x50083, + 0x8,0x4e0,0xc5,0x4df,0x50051,0x8,0x4e2,0x4fe,0x1,0x50083,0x8,0x4e3, + 0xc5,0x4e2,0x50085,0x8,0x4e4,0x4e0,0x4e3,0x50085,0x8,0x4eb,0x4df,0x4e3, + 0x50085,0x8,0x4f2,0x4e0,0x4e2,0x50085,0x8,0x4f8,0x4df,0x4e2,0x70050,0x85, + 0x7fe,0x4e4,0x4eb,0x4f2,0x4f8,0x3003e,0x7cb,0x854,0x3003e,0x7cc,0x7fe,0x200f9, + 0x49e,0x200f8,0x49e,0x700f5,0x67,0x839,0x255,0x457,0x850,0x4c4,0x700f5,0x44, + 0x838,0x174,0x457,0x4c6,0x4c4,0x500b1,0x49,0x4a1,0x838,0x25d,0x400f6,0x4c7, + 0x4c4,0x0,0x400fa,0x4a1,0x4a2,0x4c7,0x200f8,0x4a2,0x50041,0x5d,0x7d1,0x7cb, + 0x838,0x4003d,0x45,0x4a5,0x7d1,0x50080,0x45,0x4a9,0x4d6,0x4a5,0x4007c,0x65, + 0x502,0x4a9,0x4007c,0x65,0x504,0x45a,0x500b0,0x20d,0x505,0x502,0x504,0x4009b, + 0x49,0x506,0x505,0x300f7,0x4c3,0x0,0x400fa,0x506,0x4ac,0x4c3,0x200f8,0x4ac, + 0x4003d,0x16f,0x509,0x186,0x7005f,0x67,0x50d,0x509,0x4a9,0x2,0x7ff,0x50041, + 0xd,0x7d2,0x7cc,0x838,0x4003d,0x8,0x4b2,0x7d2,0x50051,0x8,0x4b4,0x50d, + 0x3,0x500ba,0x49,0x4b5,0x4b4,0xc4,0x600a9,0x8,0x4b6,0x4b5,0xc5,0xc4, + 0x50085,0x8,0x4b7,0x4b2,0x4b6,0x8004f,0xe,0x4b9,0x50d,0x50d,0x0,0x1, + 0x2,0x5008e,0xe,0x4bb,0x4b9,0x4b7,0x50051,0x8,0x4bd,0x4bb,0x0,0x50051, + 0x8,0x4be,0x4bb,0x1,0x50051,0x8,0x4bf,0x4bb,0x2,0x70050,0x67,0x4c0, + 0x4bd,0x4be,0x4bf,0x4b7,0x50081,0x67,0x4c2,0x839,0x4c0,0x200f9,0x4c3,0x200f8, + 0x4c3,0x700f5,0x67,0x850,0x839,0x4a2,0x4c2,0x4ac,0x200f9,0x4c4,0x200f8,0x4c4, + 0x50080,0x44,0x4c6,0x838,0x140,0x200f9,0x49e,0x200f8,0x4c7,0x50051,0x8,0x460, + 0x839,0x3,0x500ba,0x49,0x461,0x460,0xc4,0x300f7,0x47a,0x0,0x400fa,0x461, + 0x462,0x47a,0x200f8,0x462,0x8004f,0xe,0x464,0x839,0x839,0x0,0x1,0x2, + 0x60050,0xe,0x467,0x460,0x460,0x460,0x50088,0xe,0x468,0x464,0x467,0x4006f, + 0x8,0x46a,0x7ff,0x50085,0x8,0x46b,0x46a,0x22b,0x50083,0x8,0x46c,0xc5, + 0x46b,0x7000c,0x8,0x512,0x1,0x1a,0x46c,0x2bd,0x50085,0x8,0x470,0x512, + 0x460,0x50051,0x8,0x472,0x468,0x0,0x50051,0x8,0x473,0x468,0x1,0x50051, + 0x8,0x474,0x468,0x2,0x70050,0x67,0x475,0x472,0x473,0x474,0xc5,0x5008e, + 0x67,0x477,0x475,0x470,0x50081,0x67,0x479,0x8a4,0x477,0x200f9,0x47a,0x200f8, + 0x47a,0x700f5,0x67,0x8c0,0x8a4,0x4c7,0x479,0x462,0x200f9,0x47b,0x200f8,0x47b, + 0x50080,0x44,0x47d,0x7ff,0x140,0x200f9,0x453,0x200f8,0x47e,0x8004f,0xe,0x480, + 0x8a4,0x8a4,0x0,0x1,0x2,0x50051,0x8,0x482,0x8a4,0x3,0x60050,0xe, + 0x483,0x482,0x482,0x482,0x50088,0xe,0x484,0x480,0x483,0x50051,0x44,0x3d6, + 0x488,0x0,0x500ad,0x49,0x3d7,0x3d6,0x174,0x600a9,0x8,0x3d8,0x3d7,0xc5, + 0xc4,0x5008e,0xe,0x3d9,0x484,0x3d8,0x8004f,0xe,0x3db,0x43d,0x43d,0x0, + 0x1,0x2,0x60050,0xe,0x51c,0x3cf,0x3cf,0x3cf,0x8000c,0xe,0x51d,0x1, + 0x2e,0x3db,0x3d9,0x51c,0x50051,0x8,0x3df,0x51d,0x0,0x60052,0x67,0x876, + 0x3df,0x43d,0x0,0x50051,0x8,0x3e1,0x51d,0x1,0x60052,0x67,0x878,0x3e1, + 0x876,0x1,0x50051,0x8,0x3e3,0x51d,0x2,0x60052,0x67,0x87a,0x3e3,0x878, + 0x2,0x200f9,0x3e4,0x200f8,0x3e4,0x700f5,0x67,0x8ab,0x43d,0x5,0x87a,0x47e, + 0x50041,0x147,0x520,0x13f,0x238,0x4003d,0x44,0x521,0x520,0x500aa,0x49,0x3e6, + 0x521,0x140,0x300f7,0x409,0x0,0x400fa,0x3e6,0x3e7,0x409,0x200f8,0x3e7,0x4003d, + 0x16f,0x524,0x171,0x7005f,0x67,0x526,0x524,0x39a,0x2,0x174,0x8004f,0xe, + 0x527,0x526,0x526,0x0,0x1,0x2,0x4003d,0x16f,0x52a,0x18e,0x7005f,0x67, + 0x52c,0x52a,0x39a,0x2,0x174,0x8004f,0xe,0x3ec,0x52c,0x52c,0x0,0x1, + 0x2,0x50083,0xe,0x3ef,0x527,0x3ec,0x6000c,0xe,0x3f0,0x1,0x4,0x3ef, + 0x500ba,0x33d,0x3f1,0x3f0,0x33c,0x4009a,0x49,0x3f2,0x3f1,0x300f7,0x408,0x0, + 0x400fa,0x3f2,0x3f3,0x408,0x200f8,0x3f3,0x50041,0x153,0x548,0x13f,0x8a1,0x4003d, + 0x6,0x549,0x548,0x300f7,0x544,0x0,0x900fb,0x549,0x544,0x0,0x536,0x1, + 0x539,0x2,0x53f,0x200f8,0x536,0x50083,0xe,0x555,0x527,0x855,0x50085,0xe, + 0x56e,0x555,0x862,0x8000c,0xe,0x57f,0x1,0x2b,0x56e,0x33c,0x856,0x50085, + 0xe,0x55a,0x527,0x857,0x50085,0xe,0x55e,0x527,0x858,0x50081,0xe,0x561, + 0x55e,0x859,0x7000c,0xe,0x564,0x1,0x1a,0x561,0x85a,0x4007f,0xe,0x58c, + 0x57f,0x50085,0xe,0x58e,0x58c,0x564,0x50081,0xe,0x590,0x58e,0x564,0x50085, + 0xe,0x593,0x57f,0x55a,0x50081,0xe,0x595,0x593,0x590,0x200f9,0x544,0x200f8, + 0x539,0x7000c,0xe,0x5a1,0x1,0x1a,0x527,0x85b,0x50083,0xe,0x5a4,0x5a1, + 0x85c,0x8000c,0xe,0x5bd,0x1,0x2b,0x5a4,0x33c,0x856,0x50085,0xe,0x5a9, + 0x85e,0x5a1,0x50083,0xe,0x5aa,0x85d,0x5a9,0x50088,0xe,0x5ab,0x5bd,0x5aa, + 0x7000c,0xe,0x5ad,0x1,0x1a,0x5ab,0x85f,0x60041,0x165,0x5d4,0x13f,0x8a2, + 0x16a,0x4003d,0x8,0x5d5,0x5d4,0x50088,0x8,0x53d,0x1be,0x5d5,0x5008e,0xe, + 0x53e,0x5ad,0x53d,0x200f9,0x544,0x200f8,0x53f,0x60041,0x165,0x5d8,0x13f,0x8a2, + 0x164,0x4003d,0x8,0x5d9,0x5d8,0x60041,0x165,0x5dc,0x13f,0x8a2,0x16a,0x4003d, + 0x8,0x5dd,0x5dc,0x50085,0x8,0x5e5,0x5d9,0x860,0x60050,0xe,0x5f2,0x5e5, + 0x5e5,0x5e5,0x50083,0xe,0x5e7,0x527,0x5f2,0x50083,0x8,0x5eb,0x5dd,0x5d9, + 0x50085,0x8,0x5ec,0x5eb,0x860,0x60050,0xe,0x5f6,0x5ec,0x5ec,0x5ec,0x50088, + 0xe,0x5ee,0x5e7,0x5f6,0x200f9,0x544,0x200f8,0x544,0xb00f5,0xe,0x803,0x805, + 0x3f3,0x595,0x536,0x53e,0x539,0x5ee,0x53f,0x300f7,0x60e,0x0,0x900fb,0x549, + 0x60e,0x0,0x600,0x1,0x603,0x2,0x609,0x200f8,0x600,0x50083,0xe,0x61f, + 0x3ec,0x855,0x50085,0xe,0x638,0x61f,0x862,0x8000c,0xe,0x649,0x1,0x2b, + 0x638,0x33c,0x856,0x50085,0xe,0x624,0x3ec,0x857,0x50085,0xe,0x628,0x3ec, + 0x858,0x50081,0xe,0x62b,0x628,0x859,0x7000c,0xe,0x62e,0x1,0x1a,0x62b, + 0x85a,0x4007f,0xe,0x656,0x649,0x50085,0xe,0x658,0x656,0x62e,0x50081,0xe, + 0x65a,0x658,0x62e,0x50085,0xe,0x65d,0x649,0x624,0x50081,0xe,0x65f,0x65d, + 0x65a,0x200f9,0x60e,0x200f8,0x603,0x7000c,0xe,0x66b,0x1,0x1a,0x3ec,0x85b, + 0x50083,0xe,0x66e,0x66b,0x85c,0x8000c,0xe,0x687,0x1,0x2b,0x66e,0x33c, + 0x856,0x50085,0xe,0x673,0x85e,0x66b,0x50083,0xe,0x674,0x85d,0x673,0x50088, + 0xe,0x675,0x687,0x674,0x7000c,0xe,0x677,0x1,0x1a,0x675,0x85f,0x60041, + 0x165,0x69e,0x13f,0x8a2,0x16a,0x4003d,0x8,0x69f,0x69e,0x50088,0x8,0x607, + 0x1be,0x69f,0x5008e,0xe,0x608,0x677,0x607,0x200f9,0x60e,0x200f8,0x609,0x60041, + 0x165,0x6a2,0x13f,0x8a2,0x164,0x4003d,0x8,0x6a3,0x6a2,0x60041,0x165,0x6a6, + 0x13f,0x8a2,0x16a,0x4003d,0x8,0x6a7,0x6a6,0x50085,0x8,0x6af,0x6a3,0x860, + 0x60050,0xe,0x6bc,0x6af,0x6af,0x6af,0x50083,0xe,0x6b1,0x3ec,0x6bc,0x50083, + 0x8,0x6b5,0x6a7,0x6a3,0x50085,0x8,0x6b6,0x6b5,0x860,0x60050,0xe,0x6c0, + 0x6b6,0x6b6,0x6b6,0x50088,0xe,0x6b8,0x6b1,0x6c0,0x200f9,0x60e,0x200f8,0x60e, + 0xb00f5,0xe,0x808,0x805,0x544,0x65f,0x600,0x608,0x603,0x6b8,0x609,0x50051, + 0x8,0x6c9,0x803,0x0,0x50051,0x8,0x6cb,0x808,0x0,0x7000c,0x8,0x700, + 0x1,0x28,0x6c9,0x6cb,0x500b7,0x49,0x6f4,0x700,0xc4,0x300f7,0x6fa,0x0, + 0x400fa,0x6f4,0x6f5,0x6f9,0x200f8,0x6f5,0x7000c,0x8,0x705,0x1,0x25,0x6c9, + 0x6cb,0x50088,0x8,0x6f8,0x705,0x700,0x200f9,0x6fa,0x200f8,0x6f9,0x200f9,0x6fa, + 0x200f8,0x6fa,0x700f5,0x8,0x80c,0x6f8,0x6f5,0xc4,0x6f9,0x50083,0x8,0x6cd, + 0xc5,0x80c,0x50085,0x8,0x6ce,0x6cd,0x2ba,0x8000c,0x8,0x709,0x1,0x2b, + 0x6ce,0xc4,0xc5,0x50051,0x8,0x6d1,0x803,0x1,0x50051,0x8,0x6d3,0x808, + 0x1,0x7000c,0x8,0x720,0x1,0x28,0x6d1,0x6d3,0x500b7,0x49,0x714,0x720, + 0xc4,0x300f7,0x71a,0x0,0x400fa,0x714,0x715,0x719,0x200f8,0x715,0x7000c,0x8, + 0x725,0x1,0x25,0x6d1,0x6d3,0x50088,0x8,0x718,0x725,0x720,0x200f9,0x71a, + 0x200f8,0x719,0x200f9,0x71a,0x200f8,0x71a,0x700f5,0x8,0x80d,0x718,0x715,0xc4, + 0x719,0x50083,0x8,0x6d5,0xc5,0x80d,0x50085,0x8,0x6d6,0x6d5,0x2ba,0x8000c, + 0x8,0x729,0x1,0x2b,0x6d6,0xc4,0xc5,0x50051,0x8,0x6d9,0x803,0x2, + 0x50051,0x8,0x6db,0x808,0x2,0x7000c,0x8,0x740,0x1,0x28,0x6d9,0x6db, + 0x500b7,0x49,0x734,0x740,0xc4,0x300f7,0x73a,0x0,0x400fa,0x734,0x735,0x739, + 0x200f8,0x735,0x7000c,0x8,0x745,0x1,0x25,0x6d9,0x6db,0x50088,0x8,0x738, + 0x745,0x740,0x200f9,0x73a,0x200f8,0x739,0x200f9,0x73a,0x200f8,0x73a,0x700f5,0x8, + 0x80e,0x738,0x735,0xc4,0x739,0x50083,0x8,0x6dd,0xc5,0x80e,0x50085,0x8, + 0x6de,0x6dd,0x2ba,0x8000c,0x8,0x749,0x1,0x2b,0x6de,0xc4,0xc5,0x60050, + 0xe,0x6e0,0x709,0x729,0x749,0x8000c,0xe,0x751,0x1,0x2b,0x6e0,0x33c, + 0x856,0x50051,0x8,0x6e3,0x751,0x0,0x50051,0x8,0x6e5,0x751,0x1,0x50051, + 0x8,0x6e7,0x751,0x2,0x7000c,0x8,0x6e8,0x1,0x28,0x6e5,0x6e7,0x7000c, + 0x8,0x6e9,0x1,0x28,0x6e3,0x6e8,0x500ba,0x49,0x3fa,0x6e9,0x312,0x300f7, + 0x407,0x0,0x400fa,0x3fa,0x3fb,0x407,0x200f8,0x3fb,0x8004f,0xe,0x3fd,0x8ab, + 0x8ab,0x0,0x1,0x2,0x60050,0xe,0x75f,0x6e9,0x6e9,0x6e9,0x8000c,0xe, + 0x760,0x1,0x2e,0x3fd,0x3ec,0x75f,0x50051,0x8,0x402,0x760,0x0,0x60052, + 0x67,0x885,0x402,0x8ab,0x0,0x50051,0x8,0x404,0x760,0x1,0x60052,0x67, + 0x887,0x404,0x885,0x1,0x50051,0x8,0x406,0x760,0x2,0x60052,0x67,0x889, + 0x406,0x887,0x2,0x200f9,0x407,0x200f8,0x407,0x700f5,0x67,0x8ae,0x8ab,0x73a, + 0x889,0x3fb,0x600a9,0x49,0x864,0x3fa,0x2de,0x3d1,0x200f9,0x408,0x200f8,0x408, + 0x700f5,0x67,0x8ad,0x8ab,0x3e7,0x8ae,0x407,0x700f5,0x49,0x81d,0x3d1,0x3e7, + 0x864,0x407,0x200f9,0x409,0x200f8,0x409,0x700f5,0x67,0x8ac,0x8ab,0x3e4,0x8ad, + 0x408,0x700f5,0x49,0x81b,0x3d1,0x3e4,0x81d,0x408,0x50041,0x153,0x763,0x13f, + 0x8a3,0x4003d,0x6,0x764,0x763,0x500c7,0x6,0x40b,0x764,0x16a,0x500ab,0x49, + 0x40c,0x40b,0x164,0x300f7,0x41b,0x0,0x400fa,0x40c,0x40d,0x41b,0x200f8,0x40d, + 0x8004f,0xe,0x410,0x8ac,0x8ac,0x0,0x1,0x2,0x50051,0x44,0x767,0x39a, + 0x0,0x500b1,0x49,0x768,0x767,0x2d9,0x300f7,0x777,0x0,0x400fa,0x768,0x769, + 0x76b,0x200f8,0x769,0x60052,0xe,0x88c,0xc5,0x410,0x1,0x200f9,0x777,0x200f8, + 0x76b,0x50041,0x141,0x77a,0x13f,0x164,0x4003d,0x45,0x77b,0x77a,0x50051,0x44, + 0x76f,0x77b,0x0,0x50082,0x44,0x770,0x76f,0x2d9,0x500ad,0x49,0x771,0x767, + 0x770,0x300f7,0x776,0x0,0x400fa,0x771,0x772,0x776,0x200f8,0x772,0x50041,0x159, + 0x77e,0x13f,0x83,0x4003d,0xe,0x77f,0x77e,0x50081,0xe,0x775,0x410,0x77f, + 0x200f9,0x776,0x200f8,0x776,0x700f5,0xe,0x8b0,0x410,0x76b,0x775,0x772,0x600a9, + 0x49,0x865,0x771,0x2de,0x81b,0x200f9,0x777,0x200f8,0x777,0x700f5,0xe,0x8af, + 0x88c,0x769,0x8b0,0x776,0x700f5,0x49,0x824,0x2de,0x769,0x865,0x776,0x50051, + 0x8,0x415,0x8af,0x0,0x60052,0x67,0x88f,0x415,0x8ac,0x0,0x50051,0x8, + 0x417,0x8af,0x1,0x60052,0x67,0x891,0x417,0x88f,0x1,0x50051,0x8,0x419, + 0x8af,0x2,0x60052,0x67,0x893,0x419,0x891,0x2,0x200f9,0x41b,0x200f8,0x41b, + 0x700f5,0x67,0x8b3,0x8ac,0x409,0x893,0x777,0x700f5,0x49,0x829,0x81b,0x409, + 0x824,0x777,0x500c7,0x6,0x41d,0x764,0x238,0x500ab,0x49,0x41e,0x41d,0x164, + 0x300f7,0x42d,0x0,0x400fa,0x41e,0x41f,0x42d,0x200f8,0x41f,0x8004f,0xe,0x422, + 0x8b3,0x8b3,0x0,0x1,0x2,0x50051,0x44,0x786,0x39a,0x1,0x500b1,0x49, + 0x787,0x786,0x2ed,0x300f7,0x78a,0x0,0x400fa,0x787,0x788,0x78a,0x200f8,0x788, + 0x50041,0x147,0x7a2,0x13f,0x16a,0x4003d,0x44,0x7a3,0x7a2,0x500aa,0x49,0x7a4, + 0x7a3,0x140,0x200f9,0x78a,0x200f8,0x78a,0x700f5,0x49,0x78b,0x787,0x41f,0x7a4, + 0x788,0x300f7,0x79f,0x0,0x400fa,0x78b,0x78c,0x78e,0x200f8,0x78c,0x60052,0xe, + 0x896,0xc5,0x422,0x0,0x200f9,0x79f,0x200f8,0x78e,0x500ad,0x49,0x791,0x786, + 0x2ed,0x300f7,0x796,0x0,0x400fa,0x791,0x792,0x796,0x200f8,0x792,0x500b1,0x49, + 0x795,0x786,0x2fe,0x200f9,0x796,0x200f8,0x796,0x700f5,0x49,0x797,0x791,0x78e, + 0x795,0x792,0x300f7,0x79a,0x0,0x400fa,0x797,0x798,0x79a,0x200f8,0x798,0x4003d, + 0x179,0x7a7,0x17b,0x7005f,0x17e,0x7a8,0x7a7,0x17d,0x2002,0x174,0x50051,0x6, + 0x7a9,0x7a8,0x0,0x500c7,0x6,0x7aa,0x7a9,0x181,0x500ab,0x49,0x7ab,0x7aa, + 0x164,0x200f9,0x79a,0x200f8,0x79a,0x700f5,0x49,0x79b,0x797,0x796,0x7ab,0x798, + 0x300f7,0x79e,0x0,0x400fa,0x79b,0x79c,0x79e,0x200f8,0x79c,0x60052,0xe,0x89a, + 0xc5,0x422,0x2,0x200f9,0x79e,0x200f8,0x79e,0x700f5,0xe,0x8b8,0x422,0x79a, + 0x89a,0x79c,0x600a9,0x49,0x866,0x79b,0x2de,0x829,0x200f9,0x79f,0x200f8,0x79f, + 0x700f5,0xe,0x8b7,0x896,0x78c,0x8b8,0x79e,0x700f5,0x49,0x82a,0x2de,0x78c, + 0x866,0x79e,0x50051,0x8,0x427,0x8b7,0x0,0x60052,0x67,0x89c,0x427,0x8b3, + 0x0,0x50051,0x8,0x429,0x8b7,0x1,0x60052,0x67,0x89e,0x429,0x89c,0x1, + 0x50051,0x8,0x42b,0x8b7,0x2,0x60052,0x67,0x8a0,0x42b,0x89e,0x2,0x200f9, + 0x42d,0x200f8,0x42d,0x700f5,0x67,0x8be,0x8b3,0x41b,0x8a0,0x79f,0x700f5,0x49, + 0x82f,0x829,0x41b,0x82a,0x79f,0x300f7,0x438,0x0,0x400fa,0x82f,0x42f,0x438, + 0x200f8,0x42f,0x50051,0x8,0x432,0x8be,0x0,0x50051,0x8,0x433,0x8be,0x1, + 0x50051,0x8,0x434,0x8be,0x2,0x70050,0x67,0x435,0x432,0x433,0x434,0xc5, + 0x4003d,0x194,0x7ad,0x196,0x40063,0x7ad,0x39a,0x435,0x200f9,0x438,0x200f8,0x438, + 0x100fd,0x10038, +}; +static const char *fi_inpainting_pass_0_cb_names[] = {"cbFI"}; +static const uint32_t fi_inpainting_pass_0_cb_bind[] = {8}; +static const uint32_t fi_inpainting_pass_0_cb_count[] = {1}; +static const uint32_t fi_inpainting_pass_0_cb_space[] = {0}; +static const char *fi_inpainting_pass_0_srv_tex_names[] = {"r_optical_flow_scd", "r_inpainting_pyramid", "r_present_backbuffer", "r_current_interpolation_source"}; +static const uint32_t fi_inpainting_pass_0_srv_tex_bind[] = {0, 1, 2, 3}; +static const uint32_t fi_inpainting_pass_0_srv_tex_count[] = {1, 1, 1, 1}; +static const uint32_t fi_inpainting_pass_0_srv_tex_space[] = {0, 0, 0, 0}; +static const char *fi_inpainting_pass_0_uav_tex_names[] = {"rw_output"}; +static const uint32_t fi_inpainting_pass_0_uav_tex_bind[] = {7}; +static const uint32_t fi_inpainting_pass_0_uav_tex_count[] = {1}; +static const uint32_t fi_inpainting_pass_0_uav_tex_space[] = {0}; + +static const uint32_t fi_compute_game_vector_field_inpainting_pyramid_pass_0_spv[9606] = { + 0x7230203,0x10500,0x8000b,0x415a,0x0,0x20011,0x1,0x20011,0x3d,0x20011,0x44,0x6000b, + 0x1,0x4c534c47,0x6474732e,0x3035342e,0x0,0x3000e,0x0,0x1,0x1d000f,0x5,0x4,0x6e69616d, + 0x0,0x130,0x139,0x14c,0x154,0x161,0x16f,0x178,0x181,0x18a,0x194,0x19e, + 0x1a8,0x1b2,0x1bc,0x1c6,0x1d0,0x1da,0x2ba,0x2c8,0x2ce,0x2d3,0x2d8,0x748, + 0x74c,0x60010,0x4,0x11,0x100,0x1,0x1,0x30003,0x2,0x1c2,0xb0004,0x455f4c47, + 0x735f5458,0x6c706d61,0x656c7265,0x745f7373,0x75747865,0x665f6572,0x74636e75,0x736e6f69,0x0,0xb0004,0x455f4c47,0x735f5458, + 0x65646168,0x78655f72,0x63696c70,0x615f7469,0x68746972,0x6974656d,0x79745f63,0x736570,0xa0004,0x475f4c47,0x4c474f4f,0x70635f45, + 0x74735f70,0x5f656c79,0x656e696c,0x7269645f,0x69746365,0x6576,0x80004,0x475f4c47,0x4c474f4f,0x6e695f45,0x64756c63,0x69645f65, + 0x74636572,0x657669,0x90004,0x4b5f4c47,0x735f5248,0x65646168,0x75735f72,0x6f726762,0x625f7075,0x63697361,0x0,0x80004, + 0x4b5f4c47,0x735f5248,0x65646168,0x75735f72,0x6f726762,0x715f7075,0x646175,0x40005,0x4,0x6e69616d,0x0,0x40005, + 0x12e,0x49466263,0x745f,0x60006,0x12e,0x0,0x70736964,0x5379616c,0x657a69,0x40005,0x130,0x49466263, + 0x0,0x80005,0x137,0x6e496263,0x6e696170,0x676e6974,0x61727950,0x5f64696d,0x74,0x50006,0x137,0x0, + 0x7370696d,0x0,0x70006,0x137,0x1,0x576d756e,0x476b726f,0x70756f72,0x73,0x70006,0x137,0x2, + 0x6b726f77,0x756f7247,0x66664f70,0x746573,0x70005,0x139,0x6e496263,0x6e696170,0x676e6974,0x61727950,0x64696d,0xa0005, + 0x14c,0x61675f72,0x6d5f656d,0x6f69746f,0x65765f6e,0x726f7463,0x6569665f,0x785f646c,0x0,0xa0005,0x154,0x61675f72, + 0x6d5f656d,0x6f69746f,0x65765f6e,0x726f7463,0x6569665f,0x795f646c,0x0,0xa0005,0x15f,0x6d617246,0x746e4965,0x6f707265, + 0x6974616c,0x57526e6f,0x6e756f43,0x73726574,0x745f,0x50006,0x15f,0x0,0x61746164,0x0,0x50005,0x161, + 0x635f7772,0x746e756f,0x737265,0x80005,0x16f,0x695f7772,0x6961706e,0x6e69746e,0x79705f67,0x696d6172,0x3064,0x80005, + 0x178,0x695f7772,0x6961706e,0x6e69746e,0x79705f67,0x696d6172,0x3164,0x80005,0x181,0x695f7772,0x6961706e,0x6e69746e, + 0x79705f67,0x696d6172,0x3264,0x80005,0x18a,0x695f7772,0x6961706e,0x6e69746e,0x79705f67,0x696d6172,0x3364,0x80005, + 0x194,0x695f7772,0x6961706e,0x6e69746e,0x79705f67,0x696d6172,0x3464,0x80005,0x19e,0x695f7772,0x6961706e,0x6e69746e, + 0x79705f67,0x696d6172,0x3564,0x80005,0x1a8,0x695f7772,0x6961706e,0x6e69746e,0x79705f67,0x696d6172,0x3664,0x80005, + 0x1b2,0x695f7772,0x6961706e,0x6e69746e,0x79705f67,0x696d6172,0x3764,0x80005,0x1bc,0x695f7772,0x6961706e,0x6e69746e, + 0x79705f67,0x696d6172,0x3864,0x80005,0x1c6,0x695f7772,0x6961706e,0x6e69746e,0x79705f67,0x696d6172,0x3964,0x80005, + 0x1d0,0x695f7772,0x6961706e,0x6e69746e,0x79705f67,0x696d6172,0x303164,0x80005,0x1da,0x695f7772,0x6961706e,0x6e69746e, + 0x79705f67,0x696d6172,0x313164,0x50005,0x2ba,0x43647073,0x746e756f,0x7265,0x70005,0x2c8,0x49647073,0x7265746e, + 0x6964656d,0x52657461,0x0,0x70005,0x2ce,0x49647073,0x7265746e,0x6964656d,0x47657461,0x0,0x70005,0x2d3, + 0x49647073,0x7265746e,0x6964656d,0x42657461,0x0,0x70005,0x2d8,0x49647073,0x7265746e,0x6964656d,0x41657461,0x0, + 0x60005,0x748,0x575f6c67,0x476b726f,0x70756f72,0x4449,0x80005,0x74c,0x4c5f6c67,0x6c61636f,0x6f766e49,0x69746163, + 0x6e496e6f,0x786564,0x30047,0x12e,0x2,0x50048,0x12e,0x0,0x23,0x8,0x40047,0x130, + 0x21,0x10,0x40047,0x130,0x22,0x0,0x30047,0x137,0x2,0x50048,0x137,0x0, + 0x23,0x0,0x50048,0x137,0x1,0x23,0x4,0x50048,0x137,0x2,0x23,0x8, + 0x40047,0x139,0x21,0x11,0x40047,0x139,0x22,0x0,0x40047,0x14c,0x21,0x0, + 0x40047,0x14c,0x22,0x0,0x40047,0x154,0x21,0x1,0x40047,0x154,0x22,0x0, + 0x40047,0x15e,0x6,0x4,0x30047,0x15f,0x2,0x40048,0x15f,0x0,0x17,0x50048, + 0x15f,0x0,0x23,0x0,0x30047,0x161,0x17,0x40047,0x161,0x21,0x2,0x40047, + 0x161,0x22,0x0,0x40047,0x16f,0x21,0x3,0x40047,0x16f,0x22,0x0,0x40047, + 0x178,0x21,0x4,0x40047,0x178,0x22,0x0,0x40047,0x181,0x21,0x5,0x40047, + 0x181,0x22,0x0,0x40047,0x18a,0x21,0x6,0x40047,0x18a,0x22,0x0,0x40047, + 0x194,0x21,0x7,0x40047,0x194,0x22,0x0,0x30047,0x19e,0x17,0x40047,0x19e, + 0x21,0x8,0x40047,0x19e,0x22,0x0,0x40047,0x1a8,0x21,0x9,0x40047,0x1a8, + 0x22,0x0,0x40047,0x1b2,0x21,0xa,0x40047,0x1b2,0x22,0x0,0x40047,0x1bc, + 0x21,0xb,0x40047,0x1bc,0x22,0x0,0x40047,0x1c6,0x21,0xc,0x40047,0x1c6, + 0x22,0x0,0x40047,0x1d0,0x21,0xd,0x40047,0x1d0,0x22,0x0,0x40047,0x1da, + 0x21,0xe,0x40047,0x1da,0x22,0x0,0x40047,0x748,0xb,0x1a,0x40047,0x74c, + 0xb,0x1d,0x40047,0x75b,0xb,0x19,0x20013,0x2,0x30021,0x3,0x2,0x40015, + 0x6,0x20,0x0,0x30016,0x13,0x20,0x40017,0x14,0x13,0x2,0x40017,0x19, + 0x6,0x2,0x40015,0x1e,0x20,0x1,0x40017,0x1f,0x1e,0x2,0x40017,0x3a, + 0x13,0x4,0x20014,0x47,0x40017,0xf4,0x1e,0x3,0x4002b,0x1e,0x105,0x0, + 0x4002b,0x6,0x10f,0x2,0x4002b,0x6,0x110,0x3,0x4002b,0x6,0x116,0x1, + 0x3001e,0x12e,0x1f,0x40020,0x12f,0x2,0x12e,0x4003b,0x12f,0x130,0x2,0x4002b, + 0x1e,0x131,0x1,0x40020,0x132,0x2,0x1f,0x5001e,0x137,0x6,0x6,0x19, + 0x40020,0x138,0x2,0x137,0x4003b,0x138,0x139,0x2,0x40020,0x13a,0x2,0x6, + 0x4002b,0x1e,0x143,0x2,0x40020,0x144,0x2,0x19,0x90019,0x14a,0x6,0x1, + 0x0,0x0,0x0,0x1,0x0,0x40020,0x14b,0x0,0x14a,0x4003b,0x14b,0x14c, + 0x0,0x40017,0x14f,0x6,0x4,0x4002b,0x6,0x151,0x0,0x4003b,0x14b,0x154, + 0x0,0x3001d,0x15e,0x6,0x3001e,0x15f,0x15e,0x40020,0x160,0xc,0x15f,0x4003b, + 0x160,0x161,0xc,0x40020,0x164,0xc,0x6,0x90019,0x16d,0x13,0x1,0x0, + 0x0,0x0,0x2,0x2,0x40020,0x16e,0x0,0x16d,0x4003b,0x16e,0x16f,0x0, + 0x4003b,0x16e,0x178,0x0,0x4003b,0x16e,0x181,0x0,0x4003b,0x16e,0x18a,0x0, + 0x4002b,0x6,0x190,0x4,0x4003b,0x16e,0x194,0x0,0x4002b,0x6,0x19a,0x5, + 0x4003b,0x16e,0x19e,0x0,0x4002b,0x6,0x1a4,0x6,0x4003b,0x16e,0x1a8,0x0, + 0x4002b,0x6,0x1ae,0x7,0x4003b,0x16e,0x1b2,0x0,0x4002b,0x6,0x1b8,0x8, + 0x4003b,0x16e,0x1bc,0x0,0x4002b,0x6,0x1c2,0x9,0x4003b,0x16e,0x1c6,0x0, + 0x4002b,0x6,0x1cc,0xa,0x4003b,0x16e,0x1d0,0x0,0x4002b,0x6,0x1d6,0xb, + 0x4003b,0x16e,0x1da,0x0,0x4002b,0x13,0x1e9,0x0,0x4002b,0x6,0x249,0x80000000, + 0x4002b,0x6,0x250,0x15,0x4002b,0x6,0x252,0x3ff,0x4002b,0x6,0x25b,0x10, + 0x4002b,0x6,0x25d,0x1f,0x4002b,0x1e,0x26a,0x3,0x4002b,0x13,0x27d,0x3f800000, + 0x4002b,0x1e,0x28e,0x6,0x40020,0x2b9,0x4,0x6,0x4003b,0x2b9,0x2ba,0x4, + 0x4001c,0x2c5,0x13,0x25b,0x4001c,0x2c6,0x2c5,0x25b,0x40020,0x2c7,0x4,0x2c6, + 0x4003b,0x2c7,0x2c8,0x4,0x40020,0x2cb,0x4,0x13,0x4003b,0x2c7,0x2ce,0x4, + 0x4003b,0x2c7,0x2d3,0x4,0x4003b,0x2c7,0x2d8,0x4,0x4002b,0x13,0x32b,0x3a83126f, + 0x4002b,0x6,0x335,0xd48,0x4002b,0x6,0x336,0x108,0x5002c,0x19,0x388,0x151, + 0x116,0x5002c,0x19,0x38b,0x116,0x151,0x5002c,0x19,0x38e,0x116,0x116,0x4002b, + 0x6,0x3d3,0x40,0x4002b,0x6,0x3e1,0x20,0x4002b,0x1e,0x6e0,0x7,0x40017, + 0x746,0x6,0x3,0x40020,0x747,0x1,0x746,0x4003b,0x747,0x748,0x1,0x40020, + 0x74b,0x1,0x6,0x4003b,0x74b,0x74c,0x1,0x4002b,0x6,0x75a,0x100,0x6002c, + 0x746,0x75b,0x75a,0x116,0x116,0x5002c,0x19,0x412d,0x3d3,0x3d3,0x5002c,0x19, + 0x412e,0x3e1,0x3e1,0x5002c,0x19,0x412f,0x25b,0x25b,0x5002c,0x19,0x4130,0x1b8, + 0x1b8,0x5002c,0x19,0x4131,0x190,0x190,0x5002c,0x19,0x4132,0x10f,0x10f,0x4002b, + 0x13,0x4133,0x3a802008,0x4002b,0x13,0x4134,0x3d042108,0x5002c,0x1f,0x4159,0x105,0x105, + 0x50036,0x2,0x4,0x0,0x3,0x200f8,0x5,0x4003d,0x746,0x749,0x748,0x4007c, + 0xf4,0x74a,0x749,0x4003d,0x6,0x74d,0x74c,0x7004f,0x1f,0x776,0x74a,0x74a, + 0x0,0x1,0x4007c,0x19,0x777,0x776,0x50041,0x13a,0x783,0x139,0x105,0x4003d, + 0x6,0x784,0x783,0x50041,0x13a,0x787,0x139,0x131,0x4003d,0x6,0x788,0x787, + 0x50041,0x144,0x78b,0x139,0x143,0x4003d,0x19,0x78c,0x78b,0x50080,0x19,0x795, + 0x777,0x78c,0x300f7,0x7f3,0x0,0x300fb,0x151,0x7bd,0x200f8,0x7bd,0x50089,0x6, + 0x7bf,0x74d,0x3d3,0x600cb,0x6,0x816,0x7bf,0x143,0x26a,0x700c9,0x6,0x81d, + 0x816,0x7bf,0x105,0x131,0x600cb,0x6,0x825,0x7bf,0x26a,0x26a,0x600cb,0x6, + 0x82d,0x7bf,0x131,0x143,0x700c9,0x6,0x834,0x825,0x82d,0x105,0x143,0x500c2, + 0x6,0x7c4,0x74d,0x28e,0x50089,0x6,0x7c5,0x7c4,0x10f,0x50084,0x6,0x7c6, + 0x1b8,0x7c5,0x50080,0x6,0x7c7,0x81d,0x7c6,0x500c2,0x6,0x7cb,0x74d,0x6e0, + 0x50084,0x6,0x7cc,0x1b8,0x7cb,0x50080,0x6,0x7cd,0x834,0x7cc,0x300f7,0x986, + 0x0,0x300fb,0x151,0x880,0x200f8,0x880,0x50084,0x19,0x883,0x795,0x412d,0x4007c, + 0x1f,0x884,0x883,0x50084,0x6,0x886,0x7c7,0x10f,0x4007c,0x1e,0x887,0x886, + 0x50084,0x6,0x889,0x7cd,0x10f,0x4007c,0x1e,0x88a,0x889,0x50050,0x1f,0x88b, + 0x887,0x88a,0x50080,0x1f,0x88c,0x884,0x88b,0x50084,0x19,0x88f,0x795,0x412e, + 0x4007c,0x1f,0x890,0x88f,0x4007c,0x1e,0x892,0x7c7,0x4007c,0x1e,0x894,0x7cd, + 0x50050,0x1f,0x895,0x892,0x894,0x50080,0x1f,0x896,0x890,0x895,0x4007c,0x19, + 0x898,0x88c,0x50080,0x19,0x991,0x898,0x388,0x50080,0x19,0x993,0x898,0x38b, + 0x50080,0x19,0x995,0x898,0x38e,0x4003d,0x14a,0x9dd,0x14c,0x7005f,0x14f,0x9df, + 0x9dd,0x88c,0x2002,0x105,0x50051,0x6,0x9e0,0x9df,0x0,0x4003d,0x14a,0x9e1, + 0x154,0x7005f,0x14f,0x9e3,0x9e1,0x88c,0x2002,0x105,0x50051,0x6,0x9e4,0x9e3, + 0x0,0x500c2,0x6,0x9ee,0x9e0,0x250,0x500c7,0x6,0x9ef,0x9ee,0x252,0x40070, + 0x13,0x9f0,0x9ef,0x50085,0x13,0x9f1,0x9f0,0x4133,0x500c2,0x6,0x9f5,0x9e0, + 0x25b,0x500c7,0x6,0x9f6,0x9f5,0x25d,0x40070,0x13,0x9f7,0x9f6,0x50085,0x13, + 0x9f8,0x9f7,0x4134,0x500c7,0x6,0xa21,0x9e0,0x249,0x500ba,0x47,0xa00,0x9f1, + 0x1e9,0x300f7,0xa08,0x0,0x400fa,0xa00,0xa04,0xa08,0x200f8,0xa04,0x500aa,0x47, + 0xa07,0xa21,0x151,0x200f9,0xa08,0x200f8,0xa08,0x700f5,0x47,0xa09,0xa00,0x880, + 0xa07,0xa04,0x300f7,0xa12,0x0,0x400fa,0xa09,0xa0d,0xa12,0x200f8,0xa0d,0x50083, + 0x13,0xa10,0x27d,0x9f1,0x200f9,0xa12,0x200f8,0xa12,0x700f5,0x13,0x2d26,0x9f1, + 0xa08,0xa10,0xa0d,0x6000c,0x14,0xa26,0x1,0x3e,0x9e0,0x50051,0x13,0xa16, + 0xa26,0x0,0x6000c,0x14,0xa2a,0x1,0x3e,0x9e4,0x50051,0x13,0xa1b,0xa2a, + 0x0,0x70050,0x3a,0x9d3,0xa16,0xa1b,0x2d26,0x9f8,0x50041,0x132,0xa2d,0x130, + 0x151,0x4003d,0x1f,0xa2e,0xa2d,0x50051,0x1e,0x9d5,0xa2e,0x0,0x500ad,0x47, + 0x9d6,0x9d5,0x105,0x600a9,0x13,0x9d7,0x9d6,0x27d,0x1e9,0x5008e,0x3a,0x9d8, + 0x9d3,0x9d7,0x4007c,0x1f,0x9af,0x991,0x4003d,0x14a,0xa4d,0x14c,0x7005f,0x14f, + 0xa4f,0xa4d,0x9af,0x2002,0x105,0x50051,0x6,0xa50,0xa4f,0x0,0x4003d,0x14a, + 0xa51,0x154,0x7005f,0x14f,0xa53,0xa51,0x9af,0x2002,0x105,0x50051,0x6,0xa54, + 0xa53,0x0,0x500c2,0x6,0xa5e,0xa50,0x250,0x500c7,0x6,0xa5f,0xa5e,0x252, + 0x40070,0x13,0xa60,0xa5f,0x50085,0x13,0xa61,0xa60,0x4133,0x500c2,0x6,0xa65, + 0xa50,0x25b,0x500c7,0x6,0xa66,0xa65,0x25d,0x40070,0x13,0xa67,0xa66,0x50085, + 0x13,0xa68,0xa67,0x4134,0x500c7,0x6,0xa91,0xa50,0x249,0x500ba,0x47,0xa70, + 0xa61,0x1e9,0x300f7,0xa78,0x0,0x400fa,0xa70,0xa74,0xa78,0x200f8,0xa74,0x500aa, + 0x47,0xa77,0xa91,0x151,0x200f9,0xa78,0x200f8,0xa78,0x700f5,0x47,0xa79,0xa70, + 0xa12,0xa77,0xa74,0x300f7,0xa82,0x0,0x400fa,0xa79,0xa7d,0xa82,0x200f8,0xa7d, + 0x50083,0x13,0xa80,0x27d,0xa61,0x200f9,0xa82,0x200f8,0xa82,0x700f5,0x13,0x2d33, + 0xa61,0xa78,0xa80,0xa7d,0x6000c,0x14,0xa96,0x1,0x3e,0xa50,0x50051,0x13, + 0xa86,0xa96,0x0,0x6000c,0x14,0xa9a,0x1,0x3e,0xa54,0x50051,0x13,0xa8b, + 0xa9a,0x0,0x70050,0x3a,0xa43,0xa86,0xa8b,0x2d33,0xa68,0x5008e,0x3a,0xa48, + 0xa43,0x9d7,0x4007c,0x1f,0x9b3,0x993,0x4003d,0x14a,0xabd,0x14c,0x7005f,0x14f, + 0xabf,0xabd,0x9b3,0x2002,0x105,0x50051,0x6,0xac0,0xabf,0x0,0x4003d,0x14a, + 0xac1,0x154,0x7005f,0x14f,0xac3,0xac1,0x9b3,0x2002,0x105,0x50051,0x6,0xac4, + 0xac3,0x0,0x500c2,0x6,0xace,0xac0,0x250,0x500c7,0x6,0xacf,0xace,0x252, + 0x40070,0x13,0xad0,0xacf,0x50085,0x13,0xad1,0xad0,0x4133,0x500c2,0x6,0xad5, + 0xac0,0x25b,0x500c7,0x6,0xad6,0xad5,0x25d,0x40070,0x13,0xad7,0xad6,0x50085, + 0x13,0xad8,0xad7,0x4134,0x500c7,0x6,0xb01,0xac0,0x249,0x500ba,0x47,0xae0, + 0xad1,0x1e9,0x300f7,0xae8,0x0,0x400fa,0xae0,0xae4,0xae8,0x200f8,0xae4,0x500aa, + 0x47,0xae7,0xb01,0x151,0x200f9,0xae8,0x200f8,0xae8,0x700f5,0x47,0xae9,0xae0, + 0xa82,0xae7,0xae4,0x300f7,0xaf2,0x0,0x400fa,0xae9,0xaed,0xaf2,0x200f8,0xaed, + 0x50083,0x13,0xaf0,0x27d,0xad1,0x200f9,0xaf2,0x200f8,0xaf2,0x700f5,0x13,0x2d42, + 0xad1,0xae8,0xaf0,0xaed,0x6000c,0x14,0xb06,0x1,0x3e,0xac0,0x50051,0x13, + 0xaf6,0xb06,0x0,0x6000c,0x14,0xb0a,0x1,0x3e,0xac4,0x50051,0x13,0xafb, + 0xb0a,0x0,0x70050,0x3a,0xab3,0xaf6,0xafb,0x2d42,0xad8,0x5008e,0x3a,0xab8, + 0xab3,0x9d7,0x4007c,0x1f,0x9b7,0x995,0x4003d,0x14a,0xb2d,0x14c,0x7005f,0x14f, + 0xb2f,0xb2d,0x9b7,0x2002,0x105,0x50051,0x6,0xb30,0xb2f,0x0,0x4003d,0x14a, + 0xb31,0x154,0x7005f,0x14f,0xb33,0xb31,0x9b7,0x2002,0x105,0x50051,0x6,0xb34, + 0xb33,0x0,0x500c2,0x6,0xb3e,0xb30,0x250,0x500c7,0x6,0xb3f,0xb3e,0x252, + 0x40070,0x13,0xb40,0xb3f,0x50085,0x13,0xb41,0xb40,0x4133,0x500c2,0x6,0xb45, + 0xb30,0x25b,0x500c7,0x6,0xb46,0xb45,0x25d,0x40070,0x13,0xb47,0xb46,0x50085, + 0x13,0xb48,0xb47,0x4134,0x500c7,0x6,0xb71,0xb30,0x249,0x500ba,0x47,0xb50, + 0xb41,0x1e9,0x300f7,0xb58,0x0,0x400fa,0xb50,0xb54,0xb58,0x200f8,0xb54,0x500aa, + 0x47,0xb57,0xb71,0x151,0x200f9,0xb58,0x200f8,0xb58,0x700f5,0x47,0xb59,0xb50, + 0xaf2,0xb57,0xb54,0x300f7,0xb62,0x0,0x400fa,0xb59,0xb5d,0xb62,0x200f8,0xb5d, + 0x50083,0x13,0xb60,0x27d,0xb41,0x200f9,0xb62,0x200f8,0xb62,0x700f5,0x13,0x2d53, + 0xb41,0xb58,0xb60,0xb5d,0x6000c,0x14,0xb76,0x1,0x3e,0xb30,0x50051,0x13, + 0xb66,0xb76,0x0,0x6000c,0x14,0xb7a,0x1,0x3e,0xb34,0x50051,0x13,0xb6b, + 0xb7a,0x0,0x70050,0x3a,0xb23,0xb66,0xb6b,0x2d53,0xb48,0x5008e,0x3a,0xb28, + 0xb23,0x9d7,0x50051,0x13,0xb88,0x9d8,0x2,0x500ba,0x47,0xb89,0xb88,0x1e9, + 0x600a9,0x13,0xb8a,0xb89,0x27d,0x1e9,0x5008e,0x3a,0xb8d,0x9d8,0xb8a,0x50051, + 0x13,0xb94,0xa48,0x2,0x500ba,0x47,0xb95,0xb94,0x1e9,0x600a9,0x13,0xb96, + 0xb95,0x27d,0x1e9,0x5008e,0x3a,0xb99,0xa48,0xb96,0x50081,0x3a,0xb9b,0xb8d, + 0xb99,0x50081,0x13,0xb9e,0xb8a,0xb96,0x50051,0x13,0xba0,0xab8,0x2,0x500ba, + 0x47,0xba1,0xba0,0x1e9,0x600a9,0x13,0xba2,0xba1,0x27d,0x1e9,0x5008e,0x3a, + 0xba5,0xab8,0xba2,0x50081,0x3a,0xba7,0xb9b,0xba5,0x50081,0x13,0xbaa,0xb9e, + 0xba2,0x50051,0x13,0xbac,0xb28,0x2,0x500ba,0x47,0xbad,0xbac,0x1e9,0x600a9, + 0x13,0xbae,0xbad,0x27d,0x1e9,0x5008e,0x3a,0xbb1,0xb28,0xbae,0x50081,0x3a, + 0xbb3,0xba7,0xbb1,0x50081,0x13,0xbb6,0xbaa,0xbae,0x500ba,0x47,0xbb8,0xbb6, + 0x32b,0x600a9,0x13,0xbba,0xbb8,0xbb6,0x27d,0x70050,0x3a,0xbbc,0xbba,0xbba, + 0xbba,0xbba,0x50088,0x3a,0xbbd,0xbb3,0xbbc,0x4003d,0x16d,0xbcb,0x16f,0x40063, + 0xbcb,0x896,0xbbd,0x50080,0x6,0x8a7,0x886,0x3e1,0x4007c,0x1e,0x8a8,0x8a7, + 0x50050,0x1f,0x8ac,0x8a8,0x88a,0x50080,0x1f,0x8ad,0x884,0x8ac,0x50080,0x6, + 0x8b3,0x7c7,0x25b,0x4007c,0x1e,0x8b4,0x8b3,0x50050,0x1f,0x8b7,0x8b4,0x894, + 0x50080,0x1f,0x8b8,0x890,0x8b7,0x4007c,0x19,0x8ba,0x8ad,0x50080,0x19,0xc2d, + 0x8ba,0x388,0x50080,0x19,0xc2f,0x8ba,0x38b,0x50080,0x19,0xc31,0x8ba,0x38e, + 0x4003d,0x14a,0xc79,0x14c,0x7005f,0x14f,0xc7b,0xc79,0x8ad,0x2002,0x105,0x50051, + 0x6,0xc7c,0xc7b,0x0,0x4003d,0x14a,0xc7d,0x154,0x7005f,0x14f,0xc7f,0xc7d, + 0x8ad,0x2002,0x105,0x50051,0x6,0xc80,0xc7f,0x0,0x500c2,0x6,0xc8a,0xc7c, + 0x250,0x500c7,0x6,0xc8b,0xc8a,0x252,0x40070,0x13,0xc8c,0xc8b,0x50085,0x13, + 0xc8d,0xc8c,0x4133,0x500c2,0x6,0xc91,0xc7c,0x25b,0x500c7,0x6,0xc92,0xc91, + 0x25d,0x40070,0x13,0xc93,0xc92,0x50085,0x13,0xc94,0xc93,0x4134,0x500c7,0x6, + 0xcbd,0xc7c,0x249,0x500ba,0x47,0xc9c,0xc8d,0x1e9,0x300f7,0xca4,0x0,0x400fa, + 0xc9c,0xca0,0xca4,0x200f8,0xca0,0x500aa,0x47,0xca3,0xcbd,0x151,0x200f9,0xca4, + 0x200f8,0xca4,0x700f5,0x47,0xca5,0xc9c,0xb62,0xca3,0xca0,0x300f7,0xcae,0x0, + 0x400fa,0xca5,0xca9,0xcae,0x200f8,0xca9,0x50083,0x13,0xcac,0x27d,0xc8d,0x200f9, + 0xcae,0x200f8,0xcae,0x700f5,0x13,0x2de8,0xc8d,0xca4,0xcac,0xca9,0x6000c,0x14, + 0xcc2,0x1,0x3e,0xc7c,0x50051,0x13,0xcb2,0xcc2,0x0,0x6000c,0x14,0xcc6, + 0x1,0x3e,0xc80,0x50051,0x13,0xcb7,0xcc6,0x0,0x70050,0x3a,0xc6f,0xcb2, + 0xcb7,0x2de8,0xc94,0x5008e,0x3a,0xc74,0xc6f,0x9d7,0x4007c,0x1f,0xc4b,0xc2d, + 0x4003d,0x14a,0xce9,0x14c,0x7005f,0x14f,0xceb,0xce9,0xc4b,0x2002,0x105,0x50051, + 0x6,0xcec,0xceb,0x0,0x4003d,0x14a,0xced,0x154,0x7005f,0x14f,0xcef,0xced, + 0xc4b,0x2002,0x105,0x50051,0x6,0xcf0,0xcef,0x0,0x500c2,0x6,0xcfa,0xcec, + 0x250,0x500c7,0x6,0xcfb,0xcfa,0x252,0x40070,0x13,0xcfc,0xcfb,0x50085,0x13, + 0xcfd,0xcfc,0x4133,0x500c2,0x6,0xd01,0xcec,0x25b,0x500c7,0x6,0xd02,0xd01, + 0x25d,0x40070,0x13,0xd03,0xd02,0x50085,0x13,0xd04,0xd03,0x4134,0x500c7,0x6, + 0xd2d,0xcec,0x249,0x500ba,0x47,0xd0c,0xcfd,0x1e9,0x300f7,0xd14,0x0,0x400fa, + 0xd0c,0xd10,0xd14,0x200f8,0xd10,0x500aa,0x47,0xd13,0xd2d,0x151,0x200f9,0xd14, + 0x200f8,0xd14,0x700f5,0x47,0xd15,0xd0c,0xcae,0xd13,0xd10,0x300f7,0xd1e,0x0, + 0x400fa,0xd15,0xd19,0xd1e,0x200f8,0xd19,0x50083,0x13,0xd1c,0x27d,0xcfd,0x200f9, + 0xd1e,0x200f8,0xd1e,0x700f5,0x13,0x2df5,0xcfd,0xd14,0xd1c,0xd19,0x6000c,0x14, + 0xd32,0x1,0x3e,0xcec,0x50051,0x13,0xd22,0xd32,0x0,0x6000c,0x14,0xd36, + 0x1,0x3e,0xcf0,0x50051,0x13,0xd27,0xd36,0x0,0x70050,0x3a,0xcdf,0xd22, + 0xd27,0x2df5,0xd04,0x5008e,0x3a,0xce4,0xcdf,0x9d7,0x4007c,0x1f,0xc4f,0xc2f, + 0x4003d,0x14a,0xd59,0x14c,0x7005f,0x14f,0xd5b,0xd59,0xc4f,0x2002,0x105,0x50051, + 0x6,0xd5c,0xd5b,0x0,0x4003d,0x14a,0xd5d,0x154,0x7005f,0x14f,0xd5f,0xd5d, + 0xc4f,0x2002,0x105,0x50051,0x6,0xd60,0xd5f,0x0,0x500c2,0x6,0xd6a,0xd5c, + 0x250,0x500c7,0x6,0xd6b,0xd6a,0x252,0x40070,0x13,0xd6c,0xd6b,0x50085,0x13, + 0xd6d,0xd6c,0x4133,0x500c2,0x6,0xd71,0xd5c,0x25b,0x500c7,0x6,0xd72,0xd71, + 0x25d,0x40070,0x13,0xd73,0xd72,0x50085,0x13,0xd74,0xd73,0x4134,0x500c7,0x6, + 0xd9d,0xd5c,0x249,0x500ba,0x47,0xd7c,0xd6d,0x1e9,0x300f7,0xd84,0x0,0x400fa, + 0xd7c,0xd80,0xd84,0x200f8,0xd80,0x500aa,0x47,0xd83,0xd9d,0x151,0x200f9,0xd84, + 0x200f8,0xd84,0x700f5,0x47,0xd85,0xd7c,0xd1e,0xd83,0xd80,0x300f7,0xd8e,0x0, + 0x400fa,0xd85,0xd89,0xd8e,0x200f8,0xd89,0x50083,0x13,0xd8c,0x27d,0xd6d,0x200f9, + 0xd8e,0x200f8,0xd8e,0x700f5,0x13,0x2e04,0xd6d,0xd84,0xd8c,0xd89,0x6000c,0x14, + 0xda2,0x1,0x3e,0xd5c,0x50051,0x13,0xd92,0xda2,0x0,0x6000c,0x14,0xda6, + 0x1,0x3e,0xd60,0x50051,0x13,0xd97,0xda6,0x0,0x70050,0x3a,0xd4f,0xd92, + 0xd97,0x2e04,0xd74,0x5008e,0x3a,0xd54,0xd4f,0x9d7,0x4007c,0x1f,0xc53,0xc31, + 0x4003d,0x14a,0xdc9,0x14c,0x7005f,0x14f,0xdcb,0xdc9,0xc53,0x2002,0x105,0x50051, + 0x6,0xdcc,0xdcb,0x0,0x4003d,0x14a,0xdcd,0x154,0x7005f,0x14f,0xdcf,0xdcd, + 0xc53,0x2002,0x105,0x50051,0x6,0xdd0,0xdcf,0x0,0x500c2,0x6,0xdda,0xdcc, + 0x250,0x500c7,0x6,0xddb,0xdda,0x252,0x40070,0x13,0xddc,0xddb,0x50085,0x13, + 0xddd,0xddc,0x4133,0x500c2,0x6,0xde1,0xdcc,0x25b,0x500c7,0x6,0xde2,0xde1, + 0x25d,0x40070,0x13,0xde3,0xde2,0x50085,0x13,0xde4,0xde3,0x4134,0x500c7,0x6, + 0xe0d,0xdcc,0x249,0x500ba,0x47,0xdec,0xddd,0x1e9,0x300f7,0xdf4,0x0,0x400fa, + 0xdec,0xdf0,0xdf4,0x200f8,0xdf0,0x500aa,0x47,0xdf3,0xe0d,0x151,0x200f9,0xdf4, + 0x200f8,0xdf4,0x700f5,0x47,0xdf5,0xdec,0xd8e,0xdf3,0xdf0,0x300f7,0xdfe,0x0, + 0x400fa,0xdf5,0xdf9,0xdfe,0x200f8,0xdf9,0x50083,0x13,0xdfc,0x27d,0xddd,0x200f9, + 0xdfe,0x200f8,0xdfe,0x700f5,0x13,0x2e15,0xddd,0xdf4,0xdfc,0xdf9,0x6000c,0x14, + 0xe12,0x1,0x3e,0xdcc,0x50051,0x13,0xe02,0xe12,0x0,0x6000c,0x14,0xe16, + 0x1,0x3e,0xdd0,0x50051,0x13,0xe07,0xe16,0x0,0x70050,0x3a,0xdbf,0xe02, + 0xe07,0x2e15,0xde4,0x5008e,0x3a,0xdc4,0xdbf,0x9d7,0x50051,0x13,0xe24,0xc74, + 0x2,0x500ba,0x47,0xe25,0xe24,0x1e9,0x600a9,0x13,0xe26,0xe25,0x27d,0x1e9, + 0x5008e,0x3a,0xe29,0xc74,0xe26,0x50051,0x13,0xe30,0xce4,0x2,0x500ba,0x47, + 0xe31,0xe30,0x1e9,0x600a9,0x13,0xe32,0xe31,0x27d,0x1e9,0x5008e,0x3a,0xe35, + 0xce4,0xe32,0x50081,0x3a,0xe37,0xe29,0xe35,0x50081,0x13,0xe3a,0xe26,0xe32, + 0x50051,0x13,0xe3c,0xd54,0x2,0x500ba,0x47,0xe3d,0xe3c,0x1e9,0x600a9,0x13, + 0xe3e,0xe3d,0x27d,0x1e9,0x5008e,0x3a,0xe41,0xd54,0xe3e,0x50081,0x3a,0xe43, + 0xe37,0xe41,0x50081,0x13,0xe46,0xe3a,0xe3e,0x50051,0x13,0xe48,0xdc4,0x2, + 0x500ba,0x47,0xe49,0xe48,0x1e9,0x600a9,0x13,0xe4a,0xe49,0x27d,0x1e9,0x5008e, + 0x3a,0xe4d,0xdc4,0xe4a,0x50081,0x3a,0xe4f,0xe43,0xe4d,0x50081,0x13,0xe52, + 0xe46,0xe4a,0x500ba,0x47,0xe54,0xe52,0x32b,0x600a9,0x13,0xe56,0xe54,0xe52, + 0x27d,0x70050,0x3a,0xe58,0xe56,0xe56,0xe56,0xe56,0x50088,0x3a,0xe59,0xe4f, + 0xe58,0x4003d,0x16d,0xe67,0x16f,0x40063,0xe67,0x8b8,0xe59,0x50080,0x6,0x8cc, + 0x889,0x3e1,0x4007c,0x1e,0x8cd,0x8cc,0x50050,0x1f,0x8ce,0x887,0x8cd,0x50080, + 0x1f,0x8cf,0x884,0x8ce,0x50080,0x6,0x8d7,0x7cd,0x25b,0x4007c,0x1e,0x8d8, + 0x8d7,0x50050,0x1f,0x8d9,0x892,0x8d8,0x50080,0x1f,0x8da,0x890,0x8d9,0x4007c, + 0x19,0x8dc,0x8cf,0x50080,0x19,0xec9,0x8dc,0x388,0x50080,0x19,0xecb,0x8dc, + 0x38b,0x50080,0x19,0xecd,0x8dc,0x38e,0x4003d,0x14a,0xf15,0x14c,0x7005f,0x14f, + 0xf17,0xf15,0x8cf,0x2002,0x105,0x50051,0x6,0xf18,0xf17,0x0,0x4003d,0x14a, + 0xf19,0x154,0x7005f,0x14f,0xf1b,0xf19,0x8cf,0x2002,0x105,0x50051,0x6,0xf1c, + 0xf1b,0x0,0x500c2,0x6,0xf26,0xf18,0x250,0x500c7,0x6,0xf27,0xf26,0x252, + 0x40070,0x13,0xf28,0xf27,0x50085,0x13,0xf29,0xf28,0x4133,0x500c2,0x6,0xf2d, + 0xf18,0x25b,0x500c7,0x6,0xf2e,0xf2d,0x25d,0x40070,0x13,0xf2f,0xf2e,0x50085, + 0x13,0xf30,0xf2f,0x4134,0x500c7,0x6,0xf59,0xf18,0x249,0x500ba,0x47,0xf38, + 0xf29,0x1e9,0x300f7,0xf40,0x0,0x400fa,0xf38,0xf3c,0xf40,0x200f8,0xf3c,0x500aa, + 0x47,0xf3f,0xf59,0x151,0x200f9,0xf40,0x200f8,0xf40,0x700f5,0x47,0xf41,0xf38, + 0xdfe,0xf3f,0xf3c,0x300f7,0xf4a,0x0,0x400fa,0xf41,0xf45,0xf4a,0x200f8,0xf45, + 0x50083,0x13,0xf48,0x27d,0xf29,0x200f9,0xf4a,0x200f8,0xf4a,0x700f5,0x13,0x2eaa, + 0xf29,0xf40,0xf48,0xf45,0x6000c,0x14,0xf5e,0x1,0x3e,0xf18,0x50051,0x13, + 0xf4e,0xf5e,0x0,0x6000c,0x14,0xf62,0x1,0x3e,0xf1c,0x50051,0x13,0xf53, + 0xf62,0x0,0x70050,0x3a,0xf0b,0xf4e,0xf53,0x2eaa,0xf30,0x5008e,0x3a,0xf10, + 0xf0b,0x9d7,0x4007c,0x1f,0xee7,0xec9,0x4003d,0x14a,0xf85,0x14c,0x7005f,0x14f, + 0xf87,0xf85,0xee7,0x2002,0x105,0x50051,0x6,0xf88,0xf87,0x0,0x4003d,0x14a, + 0xf89,0x154,0x7005f,0x14f,0xf8b,0xf89,0xee7,0x2002,0x105,0x50051,0x6,0xf8c, + 0xf8b,0x0,0x500c2,0x6,0xf96,0xf88,0x250,0x500c7,0x6,0xf97,0xf96,0x252, + 0x40070,0x13,0xf98,0xf97,0x50085,0x13,0xf99,0xf98,0x4133,0x500c2,0x6,0xf9d, + 0xf88,0x25b,0x500c7,0x6,0xf9e,0xf9d,0x25d,0x40070,0x13,0xf9f,0xf9e,0x50085, + 0x13,0xfa0,0xf9f,0x4134,0x500c7,0x6,0xfc9,0xf88,0x249,0x500ba,0x47,0xfa8, + 0xf99,0x1e9,0x300f7,0xfb0,0x0,0x400fa,0xfa8,0xfac,0xfb0,0x200f8,0xfac,0x500aa, + 0x47,0xfaf,0xfc9,0x151,0x200f9,0xfb0,0x200f8,0xfb0,0x700f5,0x47,0xfb1,0xfa8, + 0xf4a,0xfaf,0xfac,0x300f7,0xfba,0x0,0x400fa,0xfb1,0xfb5,0xfba,0x200f8,0xfb5, + 0x50083,0x13,0xfb8,0x27d,0xf99,0x200f9,0xfba,0x200f8,0xfba,0x700f5,0x13,0x2eb7, + 0xf99,0xfb0,0xfb8,0xfb5,0x6000c,0x14,0xfce,0x1,0x3e,0xf88,0x50051,0x13, + 0xfbe,0xfce,0x0,0x6000c,0x14,0xfd2,0x1,0x3e,0xf8c,0x50051,0x13,0xfc3, + 0xfd2,0x0,0x70050,0x3a,0xf7b,0xfbe,0xfc3,0x2eb7,0xfa0,0x5008e,0x3a,0xf80, + 0xf7b,0x9d7,0x4007c,0x1f,0xeeb,0xecb,0x4003d,0x14a,0xff5,0x14c,0x7005f,0x14f, + 0xff7,0xff5,0xeeb,0x2002,0x105,0x50051,0x6,0xff8,0xff7,0x0,0x4003d,0x14a, + 0xff9,0x154,0x7005f,0x14f,0xffb,0xff9,0xeeb,0x2002,0x105,0x50051,0x6,0xffc, + 0xffb,0x0,0x500c2,0x6,0x1006,0xff8,0x250,0x500c7,0x6,0x1007,0x1006,0x252, + 0x40070,0x13,0x1008,0x1007,0x50085,0x13,0x1009,0x1008,0x4133,0x500c2,0x6,0x100d, + 0xff8,0x25b,0x500c7,0x6,0x100e,0x100d,0x25d,0x40070,0x13,0x100f,0x100e,0x50085, + 0x13,0x1010,0x100f,0x4134,0x500c7,0x6,0x1039,0xff8,0x249,0x500ba,0x47,0x1018, + 0x1009,0x1e9,0x300f7,0x1020,0x0,0x400fa,0x1018,0x101c,0x1020,0x200f8,0x101c,0x500aa, + 0x47,0x101f,0x1039,0x151,0x200f9,0x1020,0x200f8,0x1020,0x700f5,0x47,0x1021,0x1018, + 0xfba,0x101f,0x101c,0x300f7,0x102a,0x0,0x400fa,0x1021,0x1025,0x102a,0x200f8,0x1025, + 0x50083,0x13,0x1028,0x27d,0x1009,0x200f9,0x102a,0x200f8,0x102a,0x700f5,0x13,0x2ec6, + 0x1009,0x1020,0x1028,0x1025,0x6000c,0x14,0x103e,0x1,0x3e,0xff8,0x50051,0x13, + 0x102e,0x103e,0x0,0x6000c,0x14,0x1042,0x1,0x3e,0xffc,0x50051,0x13,0x1033, + 0x1042,0x0,0x70050,0x3a,0xfeb,0x102e,0x1033,0x2ec6,0x1010,0x5008e,0x3a,0xff0, + 0xfeb,0x9d7,0x4007c,0x1f,0xeef,0xecd,0x4003d,0x14a,0x1065,0x14c,0x7005f,0x14f, + 0x1067,0x1065,0xeef,0x2002,0x105,0x50051,0x6,0x1068,0x1067,0x0,0x4003d,0x14a, + 0x1069,0x154,0x7005f,0x14f,0x106b,0x1069,0xeef,0x2002,0x105,0x50051,0x6,0x106c, + 0x106b,0x0,0x500c2,0x6,0x1076,0x1068,0x250,0x500c7,0x6,0x1077,0x1076,0x252, + 0x40070,0x13,0x1078,0x1077,0x50085,0x13,0x1079,0x1078,0x4133,0x500c2,0x6,0x107d, + 0x1068,0x25b,0x500c7,0x6,0x107e,0x107d,0x25d,0x40070,0x13,0x107f,0x107e,0x50085, + 0x13,0x1080,0x107f,0x4134,0x500c7,0x6,0x10a9,0x1068,0x249,0x500ba,0x47,0x1088, + 0x1079,0x1e9,0x300f7,0x1090,0x0,0x400fa,0x1088,0x108c,0x1090,0x200f8,0x108c,0x500aa, + 0x47,0x108f,0x10a9,0x151,0x200f9,0x1090,0x200f8,0x1090,0x700f5,0x47,0x1091,0x1088, + 0x102a,0x108f,0x108c,0x300f7,0x109a,0x0,0x400fa,0x1091,0x1095,0x109a,0x200f8,0x1095, + 0x50083,0x13,0x1098,0x27d,0x1079,0x200f9,0x109a,0x200f8,0x109a,0x700f5,0x13,0x2ed7, + 0x1079,0x1090,0x1098,0x1095,0x6000c,0x14,0x10ae,0x1,0x3e,0x1068,0x50051,0x13, + 0x109e,0x10ae,0x0,0x6000c,0x14,0x10b2,0x1,0x3e,0x106c,0x50051,0x13,0x10a3, + 0x10b2,0x0,0x70050,0x3a,0x105b,0x109e,0x10a3,0x2ed7,0x1080,0x5008e,0x3a,0x1060, + 0x105b,0x9d7,0x50051,0x13,0x10c0,0xf10,0x2,0x500ba,0x47,0x10c1,0x10c0,0x1e9, + 0x600a9,0x13,0x10c2,0x10c1,0x27d,0x1e9,0x5008e,0x3a,0x10c5,0xf10,0x10c2,0x50051, + 0x13,0x10cc,0xf80,0x2,0x500ba,0x47,0x10cd,0x10cc,0x1e9,0x600a9,0x13,0x10ce, + 0x10cd,0x27d,0x1e9,0x5008e,0x3a,0x10d1,0xf80,0x10ce,0x50081,0x3a,0x10d3,0x10c5, + 0x10d1,0x50081,0x13,0x10d6,0x10c2,0x10ce,0x50051,0x13,0x10d8,0xff0,0x2,0x500ba, + 0x47,0x10d9,0x10d8,0x1e9,0x600a9,0x13,0x10da,0x10d9,0x27d,0x1e9,0x5008e,0x3a, + 0x10dd,0xff0,0x10da,0x50081,0x3a,0x10df,0x10d3,0x10dd,0x50081,0x13,0x10e2,0x10d6, + 0x10da,0x50051,0x13,0x10e4,0x1060,0x2,0x500ba,0x47,0x10e5,0x10e4,0x1e9,0x600a9, + 0x13,0x10e6,0x10e5,0x27d,0x1e9,0x5008e,0x3a,0x10e9,0x1060,0x10e6,0x50081,0x3a, + 0x10eb,0x10df,0x10e9,0x50081,0x13,0x10ee,0x10e2,0x10e6,0x500ba,0x47,0x10f0,0x10ee, + 0x32b,0x600a9,0x13,0x10f2,0x10f0,0x10ee,0x27d,0x70050,0x3a,0x10f4,0x10f2,0x10f2, + 0x10f2,0x10f2,0x50088,0x3a,0x10f5,0x10eb,0x10f4,0x4003d,0x16d,0x1103,0x16f,0x40063, + 0x1103,0x8da,0x10f5,0x50050,0x1f,0x8f1,0x8a8,0x8cd,0x50080,0x1f,0x8f2,0x884, + 0x8f1,0x50050,0x1f,0x8fd,0x8b4,0x8d8,0x50080,0x1f,0x8fe,0x890,0x8fd,0x4007c, + 0x19,0x900,0x8f2,0x50080,0x19,0x1165,0x900,0x388,0x50080,0x19,0x1167,0x900, + 0x38b,0x50080,0x19,0x1169,0x900,0x38e,0x4003d,0x14a,0x11b1,0x14c,0x7005f,0x14f, + 0x11b3,0x11b1,0x8f2,0x2002,0x105,0x50051,0x6,0x11b4,0x11b3,0x0,0x4003d,0x14a, + 0x11b5,0x154,0x7005f,0x14f,0x11b7,0x11b5,0x8f2,0x2002,0x105,0x50051,0x6,0x11b8, + 0x11b7,0x0,0x500c2,0x6,0x11c2,0x11b4,0x250,0x500c7,0x6,0x11c3,0x11c2,0x252, + 0x40070,0x13,0x11c4,0x11c3,0x50085,0x13,0x11c5,0x11c4,0x4133,0x500c2,0x6,0x11c9, + 0x11b4,0x25b,0x500c7,0x6,0x11ca,0x11c9,0x25d,0x40070,0x13,0x11cb,0x11ca,0x50085, + 0x13,0x11cc,0x11cb,0x4134,0x500c7,0x6,0x11f5,0x11b4,0x249,0x500ba,0x47,0x11d4, + 0x11c5,0x1e9,0x300f7,0x11dc,0x0,0x400fa,0x11d4,0x11d8,0x11dc,0x200f8,0x11d8,0x500aa, + 0x47,0x11db,0x11f5,0x151,0x200f9,0x11dc,0x200f8,0x11dc,0x700f5,0x47,0x11dd,0x11d4, + 0x109a,0x11db,0x11d8,0x300f7,0x11e6,0x0,0x400fa,0x11dd,0x11e1,0x11e6,0x200f8,0x11e1, + 0x50083,0x13,0x11e4,0x27d,0x11c5,0x200f9,0x11e6,0x200f8,0x11e6,0x700f5,0x13,0x2f6c, + 0x11c5,0x11dc,0x11e4,0x11e1,0x6000c,0x14,0x11fa,0x1,0x3e,0x11b4,0x50051,0x13, + 0x11ea,0x11fa,0x0,0x6000c,0x14,0x11fe,0x1,0x3e,0x11b8,0x50051,0x13,0x11ef, + 0x11fe,0x0,0x70050,0x3a,0x11a7,0x11ea,0x11ef,0x2f6c,0x11cc,0x5008e,0x3a,0x11ac, + 0x11a7,0x9d7,0x4007c,0x1f,0x1183,0x1165,0x4003d,0x14a,0x1221,0x14c,0x7005f,0x14f, + 0x1223,0x1221,0x1183,0x2002,0x105,0x50051,0x6,0x1224,0x1223,0x0,0x4003d,0x14a, + 0x1225,0x154,0x7005f,0x14f,0x1227,0x1225,0x1183,0x2002,0x105,0x50051,0x6,0x1228, + 0x1227,0x0,0x500c2,0x6,0x1232,0x1224,0x250,0x500c7,0x6,0x1233,0x1232,0x252, + 0x40070,0x13,0x1234,0x1233,0x50085,0x13,0x1235,0x1234,0x4133,0x500c2,0x6,0x1239, + 0x1224,0x25b,0x500c7,0x6,0x123a,0x1239,0x25d,0x40070,0x13,0x123b,0x123a,0x50085, + 0x13,0x123c,0x123b,0x4134,0x500c7,0x6,0x1265,0x1224,0x249,0x500ba,0x47,0x1244, + 0x1235,0x1e9,0x300f7,0x124c,0x0,0x400fa,0x1244,0x1248,0x124c,0x200f8,0x1248,0x500aa, + 0x47,0x124b,0x1265,0x151,0x200f9,0x124c,0x200f8,0x124c,0x700f5,0x47,0x124d,0x1244, + 0x11e6,0x124b,0x1248,0x300f7,0x1256,0x0,0x400fa,0x124d,0x1251,0x1256,0x200f8,0x1251, + 0x50083,0x13,0x1254,0x27d,0x1235,0x200f9,0x1256,0x200f8,0x1256,0x700f5,0x13,0x2f79, + 0x1235,0x124c,0x1254,0x1251,0x6000c,0x14,0x126a,0x1,0x3e,0x1224,0x50051,0x13, + 0x125a,0x126a,0x0,0x6000c,0x14,0x126e,0x1,0x3e,0x1228,0x50051,0x13,0x125f, + 0x126e,0x0,0x70050,0x3a,0x1217,0x125a,0x125f,0x2f79,0x123c,0x5008e,0x3a,0x121c, + 0x1217,0x9d7,0x4007c,0x1f,0x1187,0x1167,0x4003d,0x14a,0x1291,0x14c,0x7005f,0x14f, + 0x1293,0x1291,0x1187,0x2002,0x105,0x50051,0x6,0x1294,0x1293,0x0,0x4003d,0x14a, + 0x1295,0x154,0x7005f,0x14f,0x1297,0x1295,0x1187,0x2002,0x105,0x50051,0x6,0x1298, + 0x1297,0x0,0x500c2,0x6,0x12a2,0x1294,0x250,0x500c7,0x6,0x12a3,0x12a2,0x252, + 0x40070,0x13,0x12a4,0x12a3,0x50085,0x13,0x12a5,0x12a4,0x4133,0x500c2,0x6,0x12a9, + 0x1294,0x25b,0x500c7,0x6,0x12aa,0x12a9,0x25d,0x40070,0x13,0x12ab,0x12aa,0x50085, + 0x13,0x12ac,0x12ab,0x4134,0x500c7,0x6,0x12d5,0x1294,0x249,0x500ba,0x47,0x12b4, + 0x12a5,0x1e9,0x300f7,0x12bc,0x0,0x400fa,0x12b4,0x12b8,0x12bc,0x200f8,0x12b8,0x500aa, + 0x47,0x12bb,0x12d5,0x151,0x200f9,0x12bc,0x200f8,0x12bc,0x700f5,0x47,0x12bd,0x12b4, + 0x1256,0x12bb,0x12b8,0x300f7,0x12c6,0x0,0x400fa,0x12bd,0x12c1,0x12c6,0x200f8,0x12c1, + 0x50083,0x13,0x12c4,0x27d,0x12a5,0x200f9,0x12c6,0x200f8,0x12c6,0x700f5,0x13,0x2f88, + 0x12a5,0x12bc,0x12c4,0x12c1,0x6000c,0x14,0x12da,0x1,0x3e,0x1294,0x50051,0x13, + 0x12ca,0x12da,0x0,0x6000c,0x14,0x12de,0x1,0x3e,0x1298,0x50051,0x13,0x12cf, + 0x12de,0x0,0x70050,0x3a,0x1287,0x12ca,0x12cf,0x2f88,0x12ac,0x5008e,0x3a,0x128c, + 0x1287,0x9d7,0x4007c,0x1f,0x118b,0x1169,0x4003d,0x14a,0x1301,0x14c,0x7005f,0x14f, + 0x1303,0x1301,0x118b,0x2002,0x105,0x50051,0x6,0x1304,0x1303,0x0,0x4003d,0x14a, + 0x1305,0x154,0x7005f,0x14f,0x1307,0x1305,0x118b,0x2002,0x105,0x50051,0x6,0x1308, + 0x1307,0x0,0x500c2,0x6,0x1312,0x1304,0x250,0x500c7,0x6,0x1313,0x1312,0x252, + 0x40070,0x13,0x1314,0x1313,0x50085,0x13,0x1315,0x1314,0x4133,0x500c2,0x6,0x1319, + 0x1304,0x25b,0x500c7,0x6,0x131a,0x1319,0x25d,0x40070,0x13,0x131b,0x131a,0x50085, + 0x13,0x131c,0x131b,0x4134,0x500c7,0x6,0x1345,0x1304,0x249,0x500ba,0x47,0x1324, + 0x1315,0x1e9,0x300f7,0x132c,0x0,0x400fa,0x1324,0x1328,0x132c,0x200f8,0x1328,0x500aa, + 0x47,0x132b,0x1345,0x151,0x200f9,0x132c,0x200f8,0x132c,0x700f5,0x47,0x132d,0x1324, + 0x12c6,0x132b,0x1328,0x300f7,0x1336,0x0,0x400fa,0x132d,0x1331,0x1336,0x200f8,0x1331, + 0x50083,0x13,0x1334,0x27d,0x1315,0x200f9,0x1336,0x200f8,0x1336,0x700f5,0x13,0x2f99, + 0x1315,0x132c,0x1334,0x1331,0x6000c,0x14,0x134a,0x1,0x3e,0x1304,0x50051,0x13, + 0x133a,0x134a,0x0,0x6000c,0x14,0x134e,0x1,0x3e,0x1308,0x50051,0x13,0x133f, + 0x134e,0x0,0x70050,0x3a,0x12f7,0x133a,0x133f,0x2f99,0x131c,0x5008e,0x3a,0x12fc, + 0x12f7,0x9d7,0x50051,0x13,0x135c,0x11ac,0x2,0x500ba,0x47,0x135d,0x135c,0x1e9, + 0x600a9,0x13,0x135e,0x135d,0x27d,0x1e9,0x5008e,0x3a,0x1361,0x11ac,0x135e,0x50051, + 0x13,0x1368,0x121c,0x2,0x500ba,0x47,0x1369,0x1368,0x1e9,0x600a9,0x13,0x136a, + 0x1369,0x27d,0x1e9,0x5008e,0x3a,0x136d,0x121c,0x136a,0x50081,0x3a,0x136f,0x1361, + 0x136d,0x50081,0x13,0x1372,0x135e,0x136a,0x50051,0x13,0x1374,0x128c,0x2,0x500ba, + 0x47,0x1375,0x1374,0x1e9,0x600a9,0x13,0x1376,0x1375,0x27d,0x1e9,0x5008e,0x3a, + 0x1379,0x128c,0x1376,0x50081,0x3a,0x137b,0x136f,0x1379,0x50081,0x13,0x137e,0x1372, + 0x1376,0x50051,0x13,0x1380,0x12fc,0x2,0x500ba,0x47,0x1381,0x1380,0x1e9,0x600a9, + 0x13,0x1382,0x1381,0x27d,0x1e9,0x5008e,0x3a,0x1385,0x12fc,0x1382,0x50081,0x3a, + 0x1387,0x137b,0x1385,0x50081,0x13,0x138a,0x137e,0x1382,0x500ba,0x47,0x138c,0x138a, + 0x32b,0x600a9,0x13,0x138e,0x138c,0x138a,0x27d,0x70050,0x3a,0x1390,0x138e,0x138e, + 0x138e,0x138e,0x50088,0x3a,0x1391,0x1387,0x1390,0x4003d,0x16d,0x139f,0x16f,0x40063, + 0x139f,0x8fe,0x1391,0x500b2,0x47,0x90a,0x784,0x116,0x300f7,0x90c,0x0,0x400fa, + 0x90a,0x90b,0x90c,0x200f8,0x90b,0x200f9,0x986,0x200f8,0x90c,0x6016e,0x3a,0x1403, + 0x110,0xbbd,0x151,0x6016e,0x3a,0x1405,0x110,0xbbd,0x116,0x6016e,0x3a,0x1407, + 0x110,0xbbd,0x10f,0x50051,0x13,0x1416,0xbbd,0x2,0x500ba,0x47,0x1417,0x1416, + 0x1e9,0x600a9,0x13,0x1418,0x1417,0x27d,0x1e9,0x5008e,0x3a,0x141b,0xbbd,0x1418, + 0x50051,0x13,0x1422,0x1403,0x2,0x500ba,0x47,0x1423,0x1422,0x1e9,0x600a9,0x13, + 0x1424,0x1423,0x27d,0x1e9,0x5008e,0x3a,0x1427,0x1403,0x1424,0x50081,0x3a,0x1429, + 0x141b,0x1427,0x50081,0x13,0x142c,0x1418,0x1424,0x50051,0x13,0x142e,0x1405,0x2, + 0x500ba,0x47,0x142f,0x142e,0x1e9,0x600a9,0x13,0x1430,0x142f,0x27d,0x1e9,0x5008e, + 0x3a,0x1433,0x1405,0x1430,0x50081,0x3a,0x1435,0x1429,0x1433,0x50081,0x13,0x1438, + 0x142c,0x1430,0x50051,0x13,0x143a,0x1407,0x2,0x500ba,0x47,0x143b,0x143a,0x1e9, + 0x600a9,0x13,0x143c,0x143b,0x27d,0x1e9,0x5008e,0x3a,0x143f,0x1407,0x143c,0x50081, + 0x3a,0x1441,0x1435,0x143f,0x50081,0x13,0x1444,0x1438,0x143c,0x500ba,0x47,0x1446, + 0x1444,0x32b,0x600a9,0x13,0x1448,0x1446,0x1444,0x27d,0x70050,0x3a,0x144a,0x1448, + 0x1448,0x1448,0x1448,0x50088,0x3a,0x144b,0x1441,0x144a,0x6016e,0x3a,0x1459,0x110, + 0xe59,0x151,0x6016e,0x3a,0x145b,0x110,0xe59,0x116,0x6016e,0x3a,0x145d,0x110, + 0xe59,0x10f,0x50051,0x13,0x146c,0xe59,0x2,0x500ba,0x47,0x146d,0x146c,0x1e9, + 0x600a9,0x13,0x146e,0x146d,0x27d,0x1e9,0x5008e,0x3a,0x1471,0xe59,0x146e,0x50051, + 0x13,0x1478,0x1459,0x2,0x500ba,0x47,0x1479,0x1478,0x1e9,0x600a9,0x13,0x147a, + 0x1479,0x27d,0x1e9,0x5008e,0x3a,0x147d,0x1459,0x147a,0x50081,0x3a,0x147f,0x1471, + 0x147d,0x50081,0x13,0x1482,0x146e,0x147a,0x50051,0x13,0x1484,0x145b,0x2,0x500ba, + 0x47,0x1485,0x1484,0x1e9,0x600a9,0x13,0x1486,0x1485,0x27d,0x1e9,0x5008e,0x3a, + 0x1489,0x145b,0x1486,0x50081,0x3a,0x148b,0x147f,0x1489,0x50081,0x13,0x148e,0x1482, + 0x1486,0x50051,0x13,0x1490,0x145d,0x2,0x500ba,0x47,0x1491,0x1490,0x1e9,0x600a9, + 0x13,0x1492,0x1491,0x27d,0x1e9,0x5008e,0x3a,0x1495,0x145d,0x1492,0x50081,0x3a, + 0x1497,0x148b,0x1495,0x50081,0x13,0x149a,0x148e,0x1492,0x500ba,0x47,0x149c,0x149a, + 0x32b,0x600a9,0x13,0x149e,0x149c,0x149a,0x27d,0x70050,0x3a,0x14a0,0x149e,0x149e, + 0x149e,0x149e,0x50088,0x3a,0x14a1,0x1497,0x14a0,0x6016e,0x3a,0x14af,0x110,0x10f5, + 0x151,0x6016e,0x3a,0x14b1,0x110,0x10f5,0x116,0x6016e,0x3a,0x14b3,0x110,0x10f5, + 0x10f,0x50051,0x13,0x14c2,0x10f5,0x2,0x500ba,0x47,0x14c3,0x14c2,0x1e9,0x600a9, + 0x13,0x14c4,0x14c3,0x27d,0x1e9,0x5008e,0x3a,0x14c7,0x10f5,0x14c4,0x50051,0x13, + 0x14ce,0x14af,0x2,0x500ba,0x47,0x14cf,0x14ce,0x1e9,0x600a9,0x13,0x14d0,0x14cf, + 0x27d,0x1e9,0x5008e,0x3a,0x14d3,0x14af,0x14d0,0x50081,0x3a,0x14d5,0x14c7,0x14d3, + 0x50081,0x13,0x14d8,0x14c4,0x14d0,0x50051,0x13,0x14da,0x14b1,0x2,0x500ba,0x47, + 0x14db,0x14da,0x1e9,0x600a9,0x13,0x14dc,0x14db,0x27d,0x1e9,0x5008e,0x3a,0x14df, + 0x14b1,0x14dc,0x50081,0x3a,0x14e1,0x14d5,0x14df,0x50081,0x13,0x14e4,0x14d8,0x14dc, + 0x50051,0x13,0x14e6,0x14b3,0x2,0x500ba,0x47,0x14e7,0x14e6,0x1e9,0x600a9,0x13, + 0x14e8,0x14e7,0x27d,0x1e9,0x5008e,0x3a,0x14eb,0x14b3,0x14e8,0x50081,0x3a,0x14ed, + 0x14e1,0x14eb,0x50081,0x13,0x14f0,0x14e4,0x14e8,0x500ba,0x47,0x14f2,0x14f0,0x32b, + 0x600a9,0x13,0x14f4,0x14f2,0x14f0,0x27d,0x70050,0x3a,0x14f6,0x14f4,0x14f4,0x14f4, + 0x14f4,0x50088,0x3a,0x14f7,0x14ed,0x14f6,0x6016e,0x3a,0x1505,0x110,0x1391,0x151, + 0x6016e,0x3a,0x1507,0x110,0x1391,0x116,0x6016e,0x3a,0x1509,0x110,0x1391,0x10f, + 0x50051,0x13,0x1518,0x1391,0x2,0x500ba,0x47,0x1519,0x1518,0x1e9,0x600a9,0x13, + 0x151a,0x1519,0x27d,0x1e9,0x5008e,0x3a,0x151d,0x1391,0x151a,0x50051,0x13,0x1524, + 0x1505,0x2,0x500ba,0x47,0x1525,0x1524,0x1e9,0x600a9,0x13,0x1526,0x1525,0x27d, + 0x1e9,0x5008e,0x3a,0x1529,0x1505,0x1526,0x50081,0x3a,0x152b,0x151d,0x1529,0x50081, + 0x13,0x152e,0x151a,0x1526,0x50051,0x13,0x1530,0x1507,0x2,0x500ba,0x47,0x1531, + 0x1530,0x1e9,0x600a9,0x13,0x1532,0x1531,0x27d,0x1e9,0x5008e,0x3a,0x1535,0x1507, + 0x1532,0x50081,0x3a,0x1537,0x152b,0x1535,0x50081,0x13,0x153a,0x152e,0x1532,0x50051, + 0x13,0x153c,0x1509,0x2,0x500ba,0x47,0x153d,0x153c,0x1e9,0x600a9,0x13,0x153e, + 0x153d,0x27d,0x1e9,0x5008e,0x3a,0x1541,0x1509,0x153e,0x50081,0x3a,0x1543,0x1537, + 0x1541,0x50081,0x13,0x1546,0x153a,0x153e,0x500ba,0x47,0x1548,0x1546,0x32b,0x600a9, + 0x13,0x154a,0x1548,0x1546,0x27d,0x70050,0x3a,0x154c,0x154a,0x154a,0x154a,0x154a, + 0x50088,0x3a,0x154d,0x1543,0x154c,0x50089,0x6,0x91e,0x74d,0x190,0x500aa,0x47, + 0x91f,0x91e,0x151,0x300f7,0x985,0x0,0x400fa,0x91f,0x920,0x985,0x200f8,0x920, + 0x50084,0x19,0x923,0x795,0x412f,0x4007c,0x1f,0x924,0x923,0x50086,0x6,0x926, + 0x7c7,0x10f,0x4007c,0x1e,0x927,0x926,0x50086,0x6,0x929,0x7cd,0x10f,0x4007c, + 0x1e,0x92a,0x929,0x50050,0x1f,0x92b,0x927,0x92a,0x50080,0x1f,0x92c,0x924, + 0x92b,0x4003d,0x16d,0x1562,0x178,0x40063,0x1562,0x92c,0x144b,0x50051,0x13,0x15b7, + 0x144b,0x0,0x60041,0x2cb,0x15b8,0x2c8,0x926,0x929,0x3003e,0x15b8,0x15b7,0x50051, + 0x13,0x15bc,0x144b,0x1,0x60041,0x2cb,0x15bd,0x2ce,0x926,0x929,0x3003e,0x15bd, + 0x15bc,0x50051,0x13,0x15c1,0x144b,0x2,0x60041,0x2cb,0x15c2,0x2d3,0x926,0x929, + 0x3003e,0x15c2,0x15c1,0x50051,0x13,0x15c6,0x144b,0x3,0x60041,0x2cb,0x15c7,0x2d8, + 0x926,0x929,0x3003e,0x15c7,0x15c6,0x50080,0x6,0x93e,0x926,0x1b8,0x4007c,0x1e, + 0x93f,0x93e,0x50050,0x1f,0x943,0x93f,0x92a,0x50080,0x1f,0x944,0x924,0x943, + 0x4003d,0x16d,0x15db,0x178,0x40063,0x15db,0x944,0x14a1,0x50051,0x13,0x1630,0x14a1, + 0x0,0x60041,0x2cb,0x1631,0x2c8,0x93e,0x929,0x3003e,0x1631,0x1630,0x50051,0x13, + 0x1635,0x14a1,0x1,0x60041,0x2cb,0x1636,0x2ce,0x93e,0x929,0x3003e,0x1636,0x1635, + 0x50051,0x13,0x163a,0x14a1,0x2,0x60041,0x2cb,0x163b,0x2d3,0x93e,0x929,0x3003e, + 0x163b,0x163a,0x50051,0x13,0x163f,0x14a1,0x3,0x60041,0x2cb,0x1640,0x2d8,0x93e, + 0x929,0x3003e,0x1640,0x163f,0x50080,0x6,0x95a,0x929,0x1b8,0x4007c,0x1e,0x95b, + 0x95a,0x50050,0x1f,0x95c,0x927,0x95b,0x50080,0x1f,0x95d,0x924,0x95c,0x4003d, + 0x16d,0x1654,0x178,0x40063,0x1654,0x95d,0x14f7,0x50051,0x13,0x16a9,0x14f7,0x0, + 0x60041,0x2cb,0x16aa,0x2c8,0x926,0x95a,0x3003e,0x16aa,0x16a9,0x50051,0x13,0x16ae, + 0x14f7,0x1,0x60041,0x2cb,0x16af,0x2ce,0x926,0x95a,0x3003e,0x16af,0x16ae,0x50051, + 0x13,0x16b3,0x14f7,0x2,0x60041,0x2cb,0x16b4,0x2d3,0x926,0x95a,0x3003e,0x16b4, + 0x16b3,0x50051,0x13,0x16b8,0x14f7,0x3,0x60041,0x2cb,0x16b9,0x2d8,0x926,0x95a, + 0x3003e,0x16b9,0x16b8,0x50050,0x1f,0x976,0x93f,0x95b,0x50080,0x1f,0x977,0x924, + 0x976,0x4003d,0x16d,0x16cd,0x178,0x40063,0x16cd,0x977,0x154d,0x50051,0x13,0x1722, + 0x154d,0x0,0x60041,0x2cb,0x1723,0x2c8,0x93e,0x95a,0x3003e,0x1723,0x1722,0x50051, + 0x13,0x1727,0x154d,0x1,0x60041,0x2cb,0x1728,0x2ce,0x93e,0x95a,0x3003e,0x1728, + 0x1727,0x50051,0x13,0x172c,0x154d,0x2,0x60041,0x2cb,0x172d,0x2d3,0x93e,0x95a, + 0x3003e,0x172d,0x172c,0x50051,0x13,0x1731,0x154d,0x3,0x60041,0x2cb,0x1732,0x2d8, + 0x93e,0x95a,0x3003e,0x1732,0x1731,0x200f9,0x985,0x200f8,0x985,0x200f9,0x986,0x200f8, + 0x986,0x300f7,0x1784,0x0,0x300fb,0x151,0x174b,0x200f8,0x174b,0x500b2,0x47,0x174e, + 0x784,0x10f,0x300f7,0x1750,0x0,0x400fa,0x174e,0x174f,0x1750,0x200f8,0x174f,0x200f9, + 0x1784,0x200f8,0x1750,0x300e1,0x10f,0x335,0x400e0,0x10f,0x10f,0x336,0x60041,0x2cb, + 0x17b8,0x2c8,0x7c7,0x7cd,0x4003d,0x13,0x17b9,0x17b8,0x60041,0x2cb,0x17bc,0x2ce, + 0x7c7,0x7cd,0x4003d,0x13,0x17bd,0x17bc,0x60041,0x2cb,0x17c0,0x2d3,0x7c7,0x7cd, + 0x4003d,0x13,0x17c1,0x17c0,0x60041,0x2cb,0x17c4,0x2d8,0x7c7,0x7cd,0x4003d,0x13, + 0x17c5,0x17c4,0x70050,0x3a,0x17c6,0x17b9,0x17bd,0x17c1,0x17c5,0x6016e,0x3a,0x17d3, + 0x110,0x17c6,0x151,0x6016e,0x3a,0x17d5,0x110,0x17c6,0x116,0x6016e,0x3a,0x17d7, + 0x110,0x17c6,0x10f,0x500ba,0x47,0x17e7,0x17c1,0x1e9,0x600a9,0x13,0x17e8,0x17e7, + 0x27d,0x1e9,0x5008e,0x3a,0x17eb,0x17c6,0x17e8,0x50051,0x13,0x17f2,0x17d3,0x2, + 0x500ba,0x47,0x17f3,0x17f2,0x1e9,0x600a9,0x13,0x17f4,0x17f3,0x27d,0x1e9,0x5008e, + 0x3a,0x17f7,0x17d3,0x17f4,0x50081,0x3a,0x17f9,0x17eb,0x17f7,0x50081,0x13,0x17fc, + 0x17e8,0x17f4,0x50051,0x13,0x17fe,0x17d5,0x2,0x500ba,0x47,0x17ff,0x17fe,0x1e9, + 0x600a9,0x13,0x1800,0x17ff,0x27d,0x1e9,0x5008e,0x3a,0x1803,0x17d5,0x1800,0x50081, + 0x3a,0x1805,0x17f9,0x1803,0x50081,0x13,0x1808,0x17fc,0x1800,0x50051,0x13,0x180a, + 0x17d7,0x2,0x500ba,0x47,0x180b,0x180a,0x1e9,0x600a9,0x13,0x180c,0x180b,0x27d, + 0x1e9,0x5008e,0x3a,0x180f,0x17d7,0x180c,0x50081,0x3a,0x1811,0x1805,0x180f,0x50081, + 0x13,0x1814,0x1808,0x180c,0x500ba,0x47,0x1816,0x1814,0x32b,0x600a9,0x13,0x1818, + 0x1816,0x1814,0x27d,0x70050,0x3a,0x181a,0x1818,0x1818,0x1818,0x1818,0x50088,0x3a, + 0x181b,0x1811,0x181a,0x50089,0x6,0x1798,0x74d,0x190,0x500aa,0x47,0x1799,0x1798, + 0x151,0x300f7,0x17b3,0x0,0x400fa,0x1799,0x179a,0x17b3,0x200f8,0x179a,0x50084,0x19, + 0x179d,0x795,0x4130,0x4007c,0x1f,0x179e,0x179d,0x50086,0x6,0x17a0,0x7c7,0x10f, + 0x4007c,0x1e,0x17a1,0x17a0,0x50086,0x6,0x17a3,0x7cd,0x10f,0x4007c,0x1e,0x17a4, + 0x17a3,0x50050,0x1f,0x17a5,0x17a1,0x17a4,0x50080,0x1f,0x17a6,0x179e,0x17a5,0x4003d, + 0x16d,0x1837,0x181,0x40063,0x1837,0x17a6,0x181b,0x50089,0x6,0x17ae,0x17a3,0x10f, + 0x50080,0x6,0x17af,0x7c7,0x17ae,0x50051,0x13,0x1885,0x181b,0x0,0x60041,0x2cb, + 0x1886,0x2c8,0x17af,0x7cd,0x3003e,0x1886,0x1885,0x50051,0x13,0x188a,0x181b,0x1, + 0x60041,0x2cb,0x188b,0x2ce,0x17af,0x7cd,0x3003e,0x188b,0x188a,0x50051,0x13,0x188f, + 0x181b,0x2,0x60041,0x2cb,0x1890,0x2d3,0x17af,0x7cd,0x3003e,0x1890,0x188f,0x50051, + 0x13,0x1894,0x181b,0x3,0x60041,0x2cb,0x1895,0x2d8,0x17af,0x7cd,0x3003e,0x1895, + 0x1894,0x200f9,0x17b3,0x200f8,0x17b3,0x500b2,0x47,0x175c,0x784,0x110,0x300f7,0x175e, + 0x0,0x400fa,0x175c,0x175d,0x175e,0x200f8,0x175d,0x200f9,0x1784,0x200f8,0x175e,0x300e1, + 0x10f,0x335,0x400e0,0x10f,0x10f,0x336,0x500b0,0x47,0x18a4,0x74d,0x3d3,0x300f7, + 0x18ce,0x0,0x400fa,0x18a4,0x18a5,0x18ce,0x200f8,0x18a5,0x50089,0x6,0x18a9,0x7cd, + 0x10f,0x50080,0x6,0x18aa,0x886,0x18a9,0x60041,0x2cb,0x18d3,0x2c8,0x18aa,0x889, + 0x4003d,0x13,0x18d4,0x18d3,0x60041,0x2cb,0x18d7,0x2ce,0x18aa,0x889,0x4003d,0x13, + 0x18d8,0x18d7,0x60041,0x2cb,0x18db,0x2d3,0x18aa,0x889,0x4003d,0x13,0x18dc,0x18db, + 0x60041,0x2cb,0x18df,0x2d8,0x18aa,0x889,0x4003d,0x13,0x18e0,0x18df,0x70050,0x3a, + 0x18e1,0x18d4,0x18d8,0x18dc,0x18e0,0x6016e,0x3a,0x18ee,0x110,0x18e1,0x151,0x6016e, + 0x3a,0x18f0,0x110,0x18e1,0x116,0x6016e,0x3a,0x18f2,0x110,0x18e1,0x10f,0x500ba, + 0x47,0x1902,0x18dc,0x1e9,0x600a9,0x13,0x1903,0x1902,0x27d,0x1e9,0x5008e,0x3a, + 0x1906,0x18e1,0x1903,0x50051,0x13,0x190d,0x18ee,0x2,0x500ba,0x47,0x190e,0x190d, + 0x1e9,0x600a9,0x13,0x190f,0x190e,0x27d,0x1e9,0x5008e,0x3a,0x1912,0x18ee,0x190f, + 0x50081,0x3a,0x1914,0x1906,0x1912,0x50081,0x13,0x1917,0x1903,0x190f,0x50051,0x13, + 0x1919,0x18f0,0x2,0x500ba,0x47,0x191a,0x1919,0x1e9,0x600a9,0x13,0x191b,0x191a, + 0x27d,0x1e9,0x5008e,0x3a,0x191e,0x18f0,0x191b,0x50081,0x3a,0x1920,0x1914,0x191e, + 0x50081,0x13,0x1923,0x1917,0x191b,0x50051,0x13,0x1925,0x18f2,0x2,0x500ba,0x47, + 0x1926,0x1925,0x1e9,0x600a9,0x13,0x1927,0x1926,0x27d,0x1e9,0x5008e,0x3a,0x192a, + 0x18f2,0x1927,0x50081,0x3a,0x192c,0x1920,0x192a,0x50081,0x13,0x192f,0x1923,0x1927, + 0x500ba,0x47,0x1931,0x192f,0x32b,0x600a9,0x13,0x1933,0x1931,0x192f,0x27d,0x70050, + 0x3a,0x1935,0x1933,0x1933,0x1933,0x1933,0x50088,0x3a,0x1936,0x192c,0x1935,0x300f7, + 0x18cd,0x0,0x400fa,0x1799,0x18b3,0x18cd,0x200f8,0x18b3,0x50084,0x19,0x18b6,0x795, + 0x4131,0x4007c,0x1f,0x18b7,0x18b6,0x50086,0x6,0x18b9,0x7c7,0x10f,0x4007c,0x1e, + 0x18ba,0x18b9,0x50086,0x6,0x18bc,0x7cd,0x10f,0x4007c,0x1e,0x18bd,0x18bc,0x50050, + 0x1f,0x18be,0x18ba,0x18bd,0x50080,0x1f,0x18bf,0x18b7,0x18be,0x4003d,0x16d,0x1959, + 0x18a,0x40063,0x1959,0x18bf,0x1936,0x50080,0x6,0x18c8,0x886,0x18bc,0x50051,0x13, + 0x19a0,0x1936,0x0,0x60041,0x2cb,0x19a1,0x2c8,0x18c8,0x889,0x3003e,0x19a1,0x19a0, + 0x50051,0x13,0x19a5,0x1936,0x1,0x60041,0x2cb,0x19a6,0x2ce,0x18c8,0x889,0x3003e, + 0x19a6,0x19a5,0x50051,0x13,0x19aa,0x1936,0x2,0x60041,0x2cb,0x19ab,0x2d3,0x18c8, + 0x889,0x3003e,0x19ab,0x19aa,0x50051,0x13,0x19af,0x1936,0x3,0x60041,0x2cb,0x19b0, + 0x2d8,0x18c8,0x889,0x3003e,0x19b0,0x19af,0x200f9,0x18cd,0x200f8,0x18cd,0x200f9,0x18ce, + 0x200f8,0x18ce,0x500b2,0x47,0x176b,0x784,0x190,0x300f7,0x176d,0x0,0x400fa,0x176b, + 0x176c,0x176d,0x200f8,0x176c,0x200f9,0x1784,0x200f8,0x176d,0x300e1,0x10f,0x335,0x400e0, + 0x10f,0x10f,0x336,0x500b0,0x47,0x19bf,0x74d,0x25b,0x300f7,0x19e5,0x0,0x400fa, + 0x19bf,0x19c0,0x19e5,0x200f8,0x19c0,0x50084,0x6,0x19c2,0x7c7,0x190,0x50080,0x6, + 0x19c4,0x19c2,0x7cd,0x50084,0x6,0x19c6,0x7cd,0x190,0x60041,0x2cb,0x19ea,0x2c8, + 0x19c4,0x19c6,0x4003d,0x13,0x19eb,0x19ea,0x60041,0x2cb,0x19ee,0x2ce,0x19c4,0x19c6, + 0x4003d,0x13,0x19ef,0x19ee,0x60041,0x2cb,0x19f2,0x2d3,0x19c4,0x19c6,0x4003d,0x13, + 0x19f3,0x19f2,0x60041,0x2cb,0x19f6,0x2d8,0x19c4,0x19c6,0x4003d,0x13,0x19f7,0x19f6, + 0x70050,0x3a,0x19f8,0x19eb,0x19ef,0x19f3,0x19f7,0x6016e,0x3a,0x1a05,0x110,0x19f8, + 0x151,0x6016e,0x3a,0x1a07,0x110,0x19f8,0x116,0x6016e,0x3a,0x1a09,0x110,0x19f8, + 0x10f,0x500ba,0x47,0x1a19,0x19f3,0x1e9,0x600a9,0x13,0x1a1a,0x1a19,0x27d,0x1e9, + 0x5008e,0x3a,0x1a1d,0x19f8,0x1a1a,0x50051,0x13,0x1a24,0x1a05,0x2,0x500ba,0x47, + 0x1a25,0x1a24,0x1e9,0x600a9,0x13,0x1a26,0x1a25,0x27d,0x1e9,0x5008e,0x3a,0x1a29, + 0x1a05,0x1a26,0x50081,0x3a,0x1a2b,0x1a1d,0x1a29,0x50081,0x13,0x1a2e,0x1a1a,0x1a26, + 0x50051,0x13,0x1a30,0x1a07,0x2,0x500ba,0x47,0x1a31,0x1a30,0x1e9,0x600a9,0x13, + 0x1a32,0x1a31,0x27d,0x1e9,0x5008e,0x3a,0x1a35,0x1a07,0x1a32,0x50081,0x3a,0x1a37, + 0x1a2b,0x1a35,0x50081,0x13,0x1a3a,0x1a2e,0x1a32,0x50051,0x13,0x1a3c,0x1a09,0x2, + 0x500ba,0x47,0x1a3d,0x1a3c,0x1e9,0x600a9,0x13,0x1a3e,0x1a3d,0x27d,0x1e9,0x5008e, + 0x3a,0x1a41,0x1a09,0x1a3e,0x50081,0x3a,0x1a43,0x1a37,0x1a41,0x50081,0x13,0x1a46, + 0x1a3a,0x1a3e,0x500ba,0x47,0x1a48,0x1a46,0x32b,0x600a9,0x13,0x1a4a,0x1a48,0x1a46, + 0x27d,0x70050,0x3a,0x1a4c,0x1a4a,0x1a4a,0x1a4a,0x1a4a,0x50088,0x3a,0x1a4d,0x1a43, + 0x1a4c,0x300f7,0x19e4,0x0,0x400fa,0x1799,0x19cd,0x19e4,0x200f8,0x19cd,0x50084,0x19, + 0x19d0,0x795,0x4132,0x4007c,0x1f,0x19d1,0x19d0,0x50086,0x6,0x19d3,0x7c7,0x10f, + 0x4007c,0x1e,0x19d4,0x19d3,0x50086,0x6,0x19d6,0x7cd,0x10f,0x4007c,0x1e,0x19d7, + 0x19d6,0x50050,0x1f,0x19d8,0x19d4,0x19d7,0x50080,0x1f,0x19d9,0x19d1,0x19d8,0x4003d, + 0x16d,0x1a77,0x194,0x40063,0x1a77,0x19d9,0x1a4d,0x50080,0x6,0x19e1,0x19d3,0x7cd, + 0x50051,0x13,0x1ab7,0x1a4d,0x0,0x60041,0x2cb,0x1ab8,0x2c8,0x19e1,0x151,0x3003e, + 0x1ab8,0x1ab7,0x50051,0x13,0x1abc,0x1a4d,0x1,0x60041,0x2cb,0x1abd,0x2ce,0x19e1, + 0x151,0x3003e,0x1abd,0x1abc,0x50051,0x13,0x1ac1,0x1a4d,0x2,0x60041,0x2cb,0x1ac2, + 0x2d3,0x19e1,0x151,0x3003e,0x1ac2,0x1ac1,0x50051,0x13,0x1ac6,0x1a4d,0x3,0x60041, + 0x2cb,0x1ac7,0x2d8,0x19e1,0x151,0x3003e,0x1ac7,0x1ac6,0x200f9,0x19e4,0x200f8,0x19e4, + 0x200f9,0x19e5,0x200f8,0x19e5,0x500b2,0x47,0x177a,0x784,0x19a,0x300f7,0x177c,0x0, + 0x400fa,0x177a,0x177b,0x177c,0x200f8,0x177b,0x200f9,0x1784,0x200f8,0x177c,0x300e1,0x10f, + 0x335,0x400e0,0x10f,0x10f,0x336,0x500b0,0x47,0x1ad3,0x74d,0x190,0x300f7,0x1ae4, + 0x0,0x400fa,0x1ad3,0x1ad4,0x1ae4,0x200f8,0x1ad4,0x60041,0x2cb,0x1ae9,0x2c8,0x74d, + 0x151,0x4003d,0x13,0x1aea,0x1ae9,0x60041,0x2cb,0x1aed,0x2ce,0x74d,0x151,0x4003d, + 0x13,0x1aee,0x1aed,0x60041,0x2cb,0x1af1,0x2d3,0x74d,0x151,0x4003d,0x13,0x1af2, + 0x1af1,0x60041,0x2cb,0x1af5,0x2d8,0x74d,0x151,0x4003d,0x13,0x1af6,0x1af5,0x70050, + 0x3a,0x1af7,0x1aea,0x1aee,0x1af2,0x1af6,0x6016e,0x3a,0x1b04,0x110,0x1af7,0x151, + 0x6016e,0x3a,0x1b06,0x110,0x1af7,0x116,0x6016e,0x3a,0x1b08,0x110,0x1af7,0x10f, + 0x500ba,0x47,0x1b18,0x1af2,0x1e9,0x600a9,0x13,0x1b19,0x1b18,0x27d,0x1e9,0x5008e, + 0x3a,0x1b1c,0x1af7,0x1b19,0x50051,0x13,0x1b23,0x1b04,0x2,0x500ba,0x47,0x1b24, + 0x1b23,0x1e9,0x600a9,0x13,0x1b25,0x1b24,0x27d,0x1e9,0x5008e,0x3a,0x1b28,0x1b04, + 0x1b25,0x50081,0x3a,0x1b2a,0x1b1c,0x1b28,0x50081,0x13,0x1b2d,0x1b19,0x1b25,0x50051, + 0x13,0x1b2f,0x1b06,0x2,0x500ba,0x47,0x1b30,0x1b2f,0x1e9,0x600a9,0x13,0x1b31, + 0x1b30,0x27d,0x1e9,0x5008e,0x3a,0x1b34,0x1b06,0x1b31,0x50081,0x3a,0x1b36,0x1b2a, + 0x1b34,0x50081,0x13,0x1b39,0x1b2d,0x1b31,0x50051,0x13,0x1b3b,0x1b08,0x2,0x500ba, + 0x47,0x1b3c,0x1b3b,0x1e9,0x600a9,0x13,0x1b3d,0x1b3c,0x27d,0x1e9,0x5008e,0x3a, + 0x1b40,0x1b08,0x1b3d,0x50081,0x3a,0x1b42,0x1b36,0x1b40,0x50081,0x13,0x1b45,0x1b39, + 0x1b3d,0x500ba,0x47,0x1b47,0x1b45,0x32b,0x600a9,0x13,0x1b49,0x1b47,0x1b45,0x27d, + 0x70050,0x3a,0x1b4b,0x1b49,0x1b49,0x1b49,0x1b49,0x50088,0x3a,0x1b4c,0x1b42,0x1b4b, + 0x300f7,0x1ae3,0x0,0x400fa,0x1799,0x1adc,0x1ae3,0x200f8,0x1adc,0x4007c,0x1f,0x1ade, + 0x795,0x4003d,0x16d,0x1b7d,0x19e,0x40063,0x1b7d,0x1ade,0x1b4c,0x200f9,0x1ae3,0x200f8, + 0x1ae3,0x200f9,0x1ae4,0x200f8,0x1ae4,0x200f9,0x1784,0x200f8,0x1784,0x500b2,0x47,0x7dd, + 0x784,0x1a4,0x300f7,0x7df,0x0,0x400fa,0x7dd,0x7de,0x7df,0x200f8,0x7de,0x200f9, + 0x7f3,0x200f8,0x7df,0x500aa,0x47,0x1bb6,0x74d,0x151,0x300f7,0x1bba,0x0,0x400fa, + 0x1bb6,0x1bb7,0x1bba,0x200f8,0x1bb7,0x60041,0x164,0x1bc7,0x161,0x105,0x105,0x700ea, + 0x6,0x1bc8,0x1bc7,0x116,0x151,0x116,0x3003e,0x2ba,0x1bc8,0x200f9,0x1bba,0x200f8, + 0x1bba,0x300e1,0x10f,0x335,0x400e0,0x10f,0x10f,0x336,0x4003d,0x6,0x1bcc,0x2ba, + 0x50082,0x6,0x1bbe,0x788,0x116,0x500ab,0x47,0x1bbf,0x1bcc,0x1bbe,0x300f7,0x7e5, + 0x0,0x400fa,0x1bbf,0x7e4,0x7e5,0x200f8,0x7e4,0x200f9,0x7f3,0x200f8,0x7e5,0x60041, + 0x164,0x1bd4,0x161,0x105,0x105,0x3003e,0x1bd4,0x151,0x300f7,0x1c7f,0x0,0x300fb, + 0x151,0x1c01,0x200f8,0x1c01,0x50084,0x6,0x1c03,0x7c7,0x190,0x4007c,0x1e,0x1c05, + 0x1c03,0x50084,0x6,0x1c07,0x7cd,0x190,0x4007c,0x1e,0x1c09,0x1c07,0x50050,0x1f, + 0x1c0a,0x1c05,0x1c09,0x4007c,0x19,0x1c15,0x1c0a,0x50080,0x19,0x1c8a,0x1c15,0x388, + 0x50080,0x19,0x1c8c,0x1c15,0x38b,0x50080,0x19,0x1c8e,0x1c15,0x38e,0x4003d,0x16d, + 0x1ce9,0x19e,0x50062,0x3a,0x1ceb,0x1ce9,0x1c0a,0x4007c,0x1f,0x1ca8,0x1c8a,0x4003d, + 0x16d,0x1d51,0x19e,0x50062,0x3a,0x1d53,0x1d51,0x1ca8,0x4007c,0x1f,0x1cac,0x1c8c, + 0x4003d,0x16d,0x1db9,0x19e,0x50062,0x3a,0x1dbb,0x1db9,0x1cac,0x4007c,0x1f,0x1cb0, + 0x1c8e,0x4003d,0x16d,0x1e21,0x19e,0x50062,0x3a,0x1e23,0x1e21,0x1cb0,0x50051,0x13, + 0x1e61,0x1ceb,0x2,0x500ba,0x47,0x1e62,0x1e61,0x1e9,0x600a9,0x13,0x1e63,0x1e62, + 0x27d,0x1e9,0x5008e,0x3a,0x1e66,0x1ceb,0x1e63,0x50051,0x13,0x1e6d,0x1d53,0x2, + 0x500ba,0x47,0x1e6e,0x1e6d,0x1e9,0x600a9,0x13,0x1e6f,0x1e6e,0x27d,0x1e9,0x5008e, + 0x3a,0x1e72,0x1d53,0x1e6f,0x50081,0x3a,0x1e74,0x1e66,0x1e72,0x50081,0x13,0x1e77, + 0x1e63,0x1e6f,0x50051,0x13,0x1e79,0x1dbb,0x2,0x500ba,0x47,0x1e7a,0x1e79,0x1e9, + 0x600a9,0x13,0x1e7b,0x1e7a,0x27d,0x1e9,0x5008e,0x3a,0x1e7e,0x1dbb,0x1e7b,0x50081, + 0x3a,0x1e80,0x1e74,0x1e7e,0x50081,0x13,0x1e83,0x1e77,0x1e7b,0x50051,0x13,0x1e85, + 0x1e23,0x2,0x500ba,0x47,0x1e86,0x1e85,0x1e9,0x600a9,0x13,0x1e87,0x1e86,0x27d, + 0x1e9,0x5008e,0x3a,0x1e8a,0x1e23,0x1e87,0x50081,0x3a,0x1e8c,0x1e80,0x1e8a,0x50081, + 0x13,0x1e8f,0x1e83,0x1e87,0x500ba,0x47,0x1e91,0x1e8f,0x32b,0x600a9,0x13,0x1e93, + 0x1e91,0x1e8f,0x27d,0x70050,0x3a,0x1e95,0x1e93,0x1e93,0x1e93,0x1e93,0x50088,0x3a, + 0x1e96,0x1e8c,0x1e95,0x4003d,0x16d,0x1ece,0x1a8,0x40063,0x1ece,0x88b,0x1e96,0x50080, + 0x6,0x1c1e,0x1c03,0x10f,0x4007c,0x1e,0x1c1f,0x1c1e,0x50050,0x1f,0x1c24,0x1c1f, + 0x1c09,0x50080,0x6,0x1c27,0x886,0x116,0x4007c,0x1e,0x1c28,0x1c27,0x50050,0x1f, + 0x1c2d,0x1c28,0x88a,0x4007c,0x19,0x1c2f,0x1c24,0x50080,0x19,0x1f06,0x1c2f,0x388, + 0x50080,0x19,0x1f08,0x1c2f,0x38b,0x50080,0x19,0x1f0a,0x1c2f,0x38e,0x4003d,0x16d, + 0x1f65,0x19e,0x50062,0x3a,0x1f67,0x1f65,0x1c24,0x4007c,0x1f,0x1f24,0x1f06,0x4003d, + 0x16d,0x1fcd,0x19e,0x50062,0x3a,0x1fcf,0x1fcd,0x1f24,0x4007c,0x1f,0x1f28,0x1f08, + 0x4003d,0x16d,0x2035,0x19e,0x50062,0x3a,0x2037,0x2035,0x1f28,0x4007c,0x1f,0x1f2c, + 0x1f0a,0x4003d,0x16d,0x209d,0x19e,0x50062,0x3a,0x209f,0x209d,0x1f2c,0x50051,0x13, + 0x20dd,0x1f67,0x2,0x500ba,0x47,0x20de,0x20dd,0x1e9,0x600a9,0x13,0x20df,0x20de, + 0x27d,0x1e9,0x5008e,0x3a,0x20e2,0x1f67,0x20df,0x50051,0x13,0x20e9,0x1fcf,0x2, + 0x500ba,0x47,0x20ea,0x20e9,0x1e9,0x600a9,0x13,0x20eb,0x20ea,0x27d,0x1e9,0x5008e, + 0x3a,0x20ee,0x1fcf,0x20eb,0x50081,0x3a,0x20f0,0x20e2,0x20ee,0x50081,0x13,0x20f3, + 0x20df,0x20eb,0x50051,0x13,0x20f5,0x2037,0x2,0x500ba,0x47,0x20f6,0x20f5,0x1e9, + 0x600a9,0x13,0x20f7,0x20f6,0x27d,0x1e9,0x5008e,0x3a,0x20fa,0x2037,0x20f7,0x50081, + 0x3a,0x20fc,0x20f0,0x20fa,0x50081,0x13,0x20ff,0x20f3,0x20f7,0x50051,0x13,0x2101, + 0x209f,0x2,0x500ba,0x47,0x2102,0x2101,0x1e9,0x600a9,0x13,0x2103,0x2102,0x27d, + 0x1e9,0x5008e,0x3a,0x2106,0x209f,0x2103,0x50081,0x3a,0x2108,0x20fc,0x2106,0x50081, + 0x13,0x210b,0x20ff,0x2103,0x500ba,0x47,0x210d,0x210b,0x32b,0x600a9,0x13,0x210f, + 0x210d,0x210b,0x27d,0x70050,0x3a,0x2111,0x210f,0x210f,0x210f,0x210f,0x50088,0x3a, + 0x2112,0x2108,0x2111,0x4003d,0x16d,0x214a,0x1a8,0x40063,0x214a,0x1c2d,0x2112,0x50080, + 0x6,0x1c3c,0x1c07,0x10f,0x4007c,0x1e,0x1c3d,0x1c3c,0x50050,0x1f,0x1c3e,0x1c05, + 0x1c3d,0x50080,0x6,0x1c45,0x889,0x116,0x4007c,0x1e,0x1c46,0x1c45,0x50050,0x1f, + 0x1c47,0x887,0x1c46,0x4007c,0x19,0x1c49,0x1c3e,0x50080,0x19,0x2182,0x1c49,0x388, + 0x50080,0x19,0x2184,0x1c49,0x38b,0x50080,0x19,0x2186,0x1c49,0x38e,0x4003d,0x16d, + 0x21e1,0x19e,0x50062,0x3a,0x21e3,0x21e1,0x1c3e,0x4007c,0x1f,0x21a0,0x2182,0x4003d, + 0x16d,0x2249,0x19e,0x50062,0x3a,0x224b,0x2249,0x21a0,0x4007c,0x1f,0x21a4,0x2184, + 0x4003d,0x16d,0x22b1,0x19e,0x50062,0x3a,0x22b3,0x22b1,0x21a4,0x4007c,0x1f,0x21a8, + 0x2186,0x4003d,0x16d,0x2319,0x19e,0x50062,0x3a,0x231b,0x2319,0x21a8,0x50051,0x13, + 0x2359,0x21e3,0x2,0x500ba,0x47,0x235a,0x2359,0x1e9,0x600a9,0x13,0x235b,0x235a, + 0x27d,0x1e9,0x5008e,0x3a,0x235e,0x21e3,0x235b,0x50051,0x13,0x2365,0x224b,0x2, + 0x500ba,0x47,0x2366,0x2365,0x1e9,0x600a9,0x13,0x2367,0x2366,0x27d,0x1e9,0x5008e, + 0x3a,0x236a,0x224b,0x2367,0x50081,0x3a,0x236c,0x235e,0x236a,0x50081,0x13,0x236f, + 0x235b,0x2367,0x50051,0x13,0x2371,0x22b3,0x2,0x500ba,0x47,0x2372,0x2371,0x1e9, + 0x600a9,0x13,0x2373,0x2372,0x27d,0x1e9,0x5008e,0x3a,0x2376,0x22b3,0x2373,0x50081, + 0x3a,0x2378,0x236c,0x2376,0x50081,0x13,0x237b,0x236f,0x2373,0x50051,0x13,0x237d, + 0x231b,0x2,0x500ba,0x47,0x237e,0x237d,0x1e9,0x600a9,0x13,0x237f,0x237e,0x27d, + 0x1e9,0x5008e,0x3a,0x2382,0x231b,0x237f,0x50081,0x3a,0x2384,0x2378,0x2382,0x50081, + 0x13,0x2387,0x237b,0x237f,0x500ba,0x47,0x2389,0x2387,0x32b,0x600a9,0x13,0x238b, + 0x2389,0x2387,0x27d,0x70050,0x3a,0x238d,0x238b,0x238b,0x238b,0x238b,0x50088,0x3a, + 0x238e,0x2384,0x238d,0x4003d,0x16d,0x23c6,0x1a8,0x40063,0x23c6,0x1c47,0x238e,0x50050, + 0x1f,0x1c58,0x1c1f,0x1c3d,0x50050,0x1f,0x1c61,0x1c28,0x1c46,0x4007c,0x19,0x1c63, + 0x1c58,0x50080,0x19,0x23fe,0x1c63,0x388,0x50080,0x19,0x2400,0x1c63,0x38b,0x50080, + 0x19,0x2402,0x1c63,0x38e,0x4003d,0x16d,0x245d,0x19e,0x50062,0x3a,0x245f,0x245d, + 0x1c58,0x4007c,0x1f,0x241c,0x23fe,0x4003d,0x16d,0x24c5,0x19e,0x50062,0x3a,0x24c7, + 0x24c5,0x241c,0x4007c,0x1f,0x2420,0x2400,0x4003d,0x16d,0x252d,0x19e,0x50062,0x3a, + 0x252f,0x252d,0x2420,0x4007c,0x1f,0x2424,0x2402,0x4003d,0x16d,0x2595,0x19e,0x50062, + 0x3a,0x2597,0x2595,0x2424,0x50051,0x13,0x25d5,0x245f,0x2,0x500ba,0x47,0x25d6, + 0x25d5,0x1e9,0x600a9,0x13,0x25d7,0x25d6,0x27d,0x1e9,0x5008e,0x3a,0x25da,0x245f, + 0x25d7,0x50051,0x13,0x25e1,0x24c7,0x2,0x500ba,0x47,0x25e2,0x25e1,0x1e9,0x600a9, + 0x13,0x25e3,0x25e2,0x27d,0x1e9,0x5008e,0x3a,0x25e6,0x24c7,0x25e3,0x50081,0x3a, + 0x25e8,0x25da,0x25e6,0x50081,0x13,0x25eb,0x25d7,0x25e3,0x50051,0x13,0x25ed,0x252f, + 0x2,0x500ba,0x47,0x25ee,0x25ed,0x1e9,0x600a9,0x13,0x25ef,0x25ee,0x27d,0x1e9, + 0x5008e,0x3a,0x25f2,0x252f,0x25ef,0x50081,0x3a,0x25f4,0x25e8,0x25f2,0x50081,0x13, + 0x25f7,0x25eb,0x25ef,0x50051,0x13,0x25f9,0x2597,0x2,0x500ba,0x47,0x25fa,0x25f9, + 0x1e9,0x600a9,0x13,0x25fb,0x25fa,0x27d,0x1e9,0x5008e,0x3a,0x25fe,0x2597,0x25fb, + 0x50081,0x3a,0x2600,0x25f4,0x25fe,0x50081,0x13,0x2603,0x25f7,0x25fb,0x500ba,0x47, + 0x2605,0x2603,0x32b,0x600a9,0x13,0x2607,0x2605,0x2603,0x27d,0x70050,0x3a,0x2609, + 0x2607,0x2607,0x2607,0x2607,0x50088,0x3a,0x260a,0x2600,0x2609,0x4003d,0x16d,0x2642, + 0x1a8,0x40063,0x2642,0x1c61,0x260a,0x500b2,0x47,0x1c6b,0x784,0x1ae,0x300f7,0x1c6d, + 0x0,0x400fa,0x1c6b,0x1c6c,0x1c6d,0x200f8,0x1c6c,0x200f9,0x1c7f,0x200f8,0x1c6d,0x50051, + 0x13,0x2679,0x1e96,0x2,0x500ba,0x47,0x267a,0x2679,0x1e9,0x600a9,0x13,0x267b, + 0x267a,0x27d,0x1e9,0x5008e,0x3a,0x267e,0x1e96,0x267b,0x50051,0x13,0x2685,0x2112, + 0x2,0x500ba,0x47,0x2686,0x2685,0x1e9,0x600a9,0x13,0x2687,0x2686,0x27d,0x1e9, + 0x5008e,0x3a,0x268a,0x2112,0x2687,0x50081,0x3a,0x268c,0x267e,0x268a,0x50081,0x13, + 0x268f,0x267b,0x2687,0x50051,0x13,0x2691,0x238e,0x2,0x500ba,0x47,0x2692,0x2691, + 0x1e9,0x600a9,0x13,0x2693,0x2692,0x27d,0x1e9,0x5008e,0x3a,0x2696,0x238e,0x2693, + 0x50081,0x3a,0x2698,0x268c,0x2696,0x50081,0x13,0x269b,0x268f,0x2693,0x50051,0x13, + 0x269d,0x260a,0x2,0x500ba,0x47,0x269e,0x269d,0x1e9,0x600a9,0x13,0x269f,0x269e, + 0x27d,0x1e9,0x5008e,0x3a,0x26a2,0x260a,0x269f,0x50081,0x3a,0x26a4,0x2698,0x26a2, + 0x50081,0x13,0x26a7,0x269b,0x269f,0x500ba,0x47,0x26a9,0x26a7,0x32b,0x600a9,0x13, + 0x26ab,0x26a9,0x26a7,0x27d,0x70050,0x3a,0x26ad,0x26ab,0x26ab,0x26ab,0x26ab,0x50088, + 0x3a,0x26ae,0x26a4,0x26ad,0x4003d,0x16d,0x26ed,0x1b2,0x40063,0x26ed,0x895,0x26ae, + 0x50051,0x13,0x2718,0x26ae,0x0,0x60041,0x2cb,0x2719,0x2c8,0x7c7,0x7cd,0x3003e, + 0x2719,0x2718,0x50051,0x13,0x271d,0x26ae,0x1,0x60041,0x2cb,0x271e,0x2ce,0x7c7, + 0x7cd,0x3003e,0x271e,0x271d,0x50051,0x13,0x2722,0x26ae,0x2,0x60041,0x2cb,0x2723, + 0x2d3,0x7c7,0x7cd,0x3003e,0x2723,0x2722,0x50051,0x13,0x2727,0x26ae,0x3,0x60041, + 0x2cb,0x2728,0x2d8,0x7c7,0x7cd,0x3003e,0x2728,0x2727,0x200f9,0x1c7f,0x200f8,0x1c7f, + 0x300f7,0x277a,0x0,0x300fb,0x151,0x2741,0x200f8,0x2741,0x500b2,0x47,0x2744,0x784, + 0x1b8,0x300f7,0x2746,0x0,0x400fa,0x2744,0x2745,0x2746,0x200f8,0x2745,0x200f9,0x277a, + 0x200f8,0x2746,0x300e1,0x10f,0x335,0x400e0,0x10f,0x10f,0x336,0x60041,0x2cb,0x27ae, + 0x2c8,0x7c7,0x7cd,0x4003d,0x13,0x27af,0x27ae,0x60041,0x2cb,0x27b2,0x2ce,0x7c7, + 0x7cd,0x4003d,0x13,0x27b3,0x27b2,0x60041,0x2cb,0x27b6,0x2d3,0x7c7,0x7cd,0x4003d, + 0x13,0x27b7,0x27b6,0x60041,0x2cb,0x27ba,0x2d8,0x7c7,0x7cd,0x4003d,0x13,0x27bb, + 0x27ba,0x70050,0x3a,0x27bc,0x27af,0x27b3,0x27b7,0x27bb,0x6016e,0x3a,0x27c9,0x110, + 0x27bc,0x151,0x6016e,0x3a,0x27cb,0x110,0x27bc,0x116,0x6016e,0x3a,0x27cd,0x110, + 0x27bc,0x10f,0x500ba,0x47,0x27dd,0x27b7,0x1e9,0x600a9,0x13,0x27de,0x27dd,0x27d, + 0x1e9,0x5008e,0x3a,0x27e1,0x27bc,0x27de,0x50051,0x13,0x27e8,0x27c9,0x2,0x500ba, + 0x47,0x27e9,0x27e8,0x1e9,0x600a9,0x13,0x27ea,0x27e9,0x27d,0x1e9,0x5008e,0x3a, + 0x27ed,0x27c9,0x27ea,0x50081,0x3a,0x27ef,0x27e1,0x27ed,0x50081,0x13,0x27f2,0x27de, + 0x27ea,0x50051,0x13,0x27f4,0x27cb,0x2,0x500ba,0x47,0x27f5,0x27f4,0x1e9,0x600a9, + 0x13,0x27f6,0x27f5,0x27d,0x1e9,0x5008e,0x3a,0x27f9,0x27cb,0x27f6,0x50081,0x3a, + 0x27fb,0x27ef,0x27f9,0x50081,0x13,0x27fe,0x27f2,0x27f6,0x50051,0x13,0x2800,0x27cd, + 0x2,0x500ba,0x47,0x2801,0x2800,0x1e9,0x600a9,0x13,0x2802,0x2801,0x27d,0x1e9, + 0x5008e,0x3a,0x2805,0x27cd,0x2802,0x50081,0x3a,0x2807,0x27fb,0x2805,0x50081,0x13, + 0x280a,0x27fe,0x2802,0x500ba,0x47,0x280c,0x280a,0x32b,0x600a9,0x13,0x280e,0x280c, + 0x280a,0x27d,0x70050,0x3a,0x2810,0x280e,0x280e,0x280e,0x280e,0x50088,0x3a,0x2811, + 0x2807,0x2810,0x50089,0x6,0x278e,0x74d,0x190,0x500aa,0x47,0x278f,0x278e,0x151, + 0x300f7,0x27a9,0x0,0x400fa,0x278f,0x2790,0x27a9,0x200f8,0x2790,0x50086,0x6,0x2796, + 0x7c7,0x10f,0x4007c,0x1e,0x2797,0x2796,0x50086,0x6,0x2799,0x7cd,0x10f,0x4007c, + 0x1e,0x279a,0x2799,0x50050,0x1f,0x279b,0x2797,0x279a,0x4003d,0x16d,0x2857,0x1bc, + 0x40063,0x2857,0x279b,0x2811,0x50089,0x6,0x27a4,0x2799,0x10f,0x50080,0x6,0x27a5, + 0x7c7,0x27a4,0x50051,0x13,0x287b,0x2811,0x0,0x60041,0x2cb,0x287c,0x2c8,0x27a5, + 0x7cd,0x3003e,0x287c,0x287b,0x50051,0x13,0x2880,0x2811,0x1,0x60041,0x2cb,0x2881, + 0x2ce,0x27a5,0x7cd,0x3003e,0x2881,0x2880,0x50051,0x13,0x2885,0x2811,0x2,0x60041, + 0x2cb,0x2886,0x2d3,0x27a5,0x7cd,0x3003e,0x2886,0x2885,0x50051,0x13,0x288a,0x2811, + 0x3,0x60041,0x2cb,0x288b,0x2d8,0x27a5,0x7cd,0x3003e,0x288b,0x288a,0x200f9,0x27a9, + 0x200f8,0x27a9,0x500b2,0x47,0x2752,0x784,0x1c2,0x300f7,0x2754,0x0,0x400fa,0x2752, + 0x2753,0x2754,0x200f8,0x2753,0x200f9,0x277a,0x200f8,0x2754,0x300e1,0x10f,0x335,0x400e0, + 0x10f,0x10f,0x336,0x500b0,0x47,0x289a,0x74d,0x3d3,0x300f7,0x28c4,0x0,0x400fa, + 0x289a,0x289b,0x28c4,0x200f8,0x289b,0x50089,0x6,0x289f,0x7cd,0x10f,0x50080,0x6, + 0x28a0,0x886,0x289f,0x60041,0x2cb,0x28c9,0x2c8,0x28a0,0x889,0x4003d,0x13,0x28ca, + 0x28c9,0x60041,0x2cb,0x28cd,0x2ce,0x28a0,0x889,0x4003d,0x13,0x28ce,0x28cd,0x60041, + 0x2cb,0x28d1,0x2d3,0x28a0,0x889,0x4003d,0x13,0x28d2,0x28d1,0x60041,0x2cb,0x28d5, + 0x2d8,0x28a0,0x889,0x4003d,0x13,0x28d6,0x28d5,0x70050,0x3a,0x28d7,0x28ca,0x28ce, + 0x28d2,0x28d6,0x6016e,0x3a,0x28e4,0x110,0x28d7,0x151,0x6016e,0x3a,0x28e6,0x110, + 0x28d7,0x116,0x6016e,0x3a,0x28e8,0x110,0x28d7,0x10f,0x500ba,0x47,0x28f8,0x28d2, + 0x1e9,0x600a9,0x13,0x28f9,0x28f8,0x27d,0x1e9,0x5008e,0x3a,0x28fc,0x28d7,0x28f9, + 0x50051,0x13,0x2903,0x28e4,0x2,0x500ba,0x47,0x2904,0x2903,0x1e9,0x600a9,0x13, + 0x2905,0x2904,0x27d,0x1e9,0x5008e,0x3a,0x2908,0x28e4,0x2905,0x50081,0x3a,0x290a, + 0x28fc,0x2908,0x50081,0x13,0x290d,0x28f9,0x2905,0x50051,0x13,0x290f,0x28e6,0x2, + 0x500ba,0x47,0x2910,0x290f,0x1e9,0x600a9,0x13,0x2911,0x2910,0x27d,0x1e9,0x5008e, + 0x3a,0x2914,0x28e6,0x2911,0x50081,0x3a,0x2916,0x290a,0x2914,0x50081,0x13,0x2919, + 0x290d,0x2911,0x50051,0x13,0x291b,0x28e8,0x2,0x500ba,0x47,0x291c,0x291b,0x1e9, + 0x600a9,0x13,0x291d,0x291c,0x27d,0x1e9,0x5008e,0x3a,0x2920,0x28e8,0x291d,0x50081, + 0x3a,0x2922,0x2916,0x2920,0x50081,0x13,0x2925,0x2919,0x291d,0x500ba,0x47,0x2927, + 0x2925,0x32b,0x600a9,0x13,0x2929,0x2927,0x2925,0x27d,0x70050,0x3a,0x292b,0x2929, + 0x2929,0x2929,0x2929,0x50088,0x3a,0x292c,0x2922,0x292b,0x300f7,0x28c3,0x0,0x400fa, + 0x278f,0x28a9,0x28c3,0x200f8,0x28a9,0x50086,0x6,0x28af,0x7c7,0x10f,0x4007c,0x1e, + 0x28b0,0x28af,0x50086,0x6,0x28b2,0x7cd,0x10f,0x4007c,0x1e,0x28b3,0x28b2,0x50050, + 0x1f,0x28b4,0x28b0,0x28b3,0x4003d,0x16d,0x2979,0x1c6,0x40063,0x2979,0x28b4,0x292c, + 0x50080,0x6,0x28be,0x886,0x28b2,0x50051,0x13,0x2996,0x292c,0x0,0x60041,0x2cb, + 0x2997,0x2c8,0x28be,0x889,0x3003e,0x2997,0x2996,0x50051,0x13,0x299b,0x292c,0x1, + 0x60041,0x2cb,0x299c,0x2ce,0x28be,0x889,0x3003e,0x299c,0x299b,0x50051,0x13,0x29a0, + 0x292c,0x2,0x60041,0x2cb,0x29a1,0x2d3,0x28be,0x889,0x3003e,0x29a1,0x29a0,0x50051, + 0x13,0x29a5,0x292c,0x3,0x60041,0x2cb,0x29a6,0x2d8,0x28be,0x889,0x3003e,0x29a6, + 0x29a5,0x200f9,0x28c3,0x200f8,0x28c3,0x200f9,0x28c4,0x200f8,0x28c4,0x500b2,0x47,0x2761, + 0x784,0x1cc,0x300f7,0x2763,0x0,0x400fa,0x2761,0x2762,0x2763,0x200f8,0x2762,0x200f9, + 0x277a,0x200f8,0x2763,0x300e1,0x10f,0x335,0x400e0,0x10f,0x10f,0x336,0x500b0,0x47, + 0x29b5,0x74d,0x25b,0x300f7,0x29db,0x0,0x400fa,0x29b5,0x29b6,0x29db,0x200f8,0x29b6, + 0x50080,0x6,0x29ba,0x1c03,0x7cd,0x60041,0x2cb,0x29e0,0x2c8,0x29ba,0x1c07,0x4003d, + 0x13,0x29e1,0x29e0,0x60041,0x2cb,0x29e4,0x2ce,0x29ba,0x1c07,0x4003d,0x13,0x29e5, + 0x29e4,0x60041,0x2cb,0x29e8,0x2d3,0x29ba,0x1c07,0x4003d,0x13,0x29e9,0x29e8,0x60041, + 0x2cb,0x29ec,0x2d8,0x29ba,0x1c07,0x4003d,0x13,0x29ed,0x29ec,0x70050,0x3a,0x29ee, + 0x29e1,0x29e5,0x29e9,0x29ed,0x6016e,0x3a,0x29fb,0x110,0x29ee,0x151,0x6016e,0x3a, + 0x29fd,0x110,0x29ee,0x116,0x6016e,0x3a,0x29ff,0x110,0x29ee,0x10f,0x500ba,0x47, + 0x2a0f,0x29e9,0x1e9,0x600a9,0x13,0x2a10,0x2a0f,0x27d,0x1e9,0x5008e,0x3a,0x2a13, + 0x29ee,0x2a10,0x50051,0x13,0x2a1a,0x29fb,0x2,0x500ba,0x47,0x2a1b,0x2a1a,0x1e9, + 0x600a9,0x13,0x2a1c,0x2a1b,0x27d,0x1e9,0x5008e,0x3a,0x2a1f,0x29fb,0x2a1c,0x50081, + 0x3a,0x2a21,0x2a13,0x2a1f,0x50081,0x13,0x2a24,0x2a10,0x2a1c,0x50051,0x13,0x2a26, + 0x29fd,0x2,0x500ba,0x47,0x2a27,0x2a26,0x1e9,0x600a9,0x13,0x2a28,0x2a27,0x27d, + 0x1e9,0x5008e,0x3a,0x2a2b,0x29fd,0x2a28,0x50081,0x3a,0x2a2d,0x2a21,0x2a2b,0x50081, + 0x13,0x2a30,0x2a24,0x2a28,0x50051,0x13,0x2a32,0x29ff,0x2,0x500ba,0x47,0x2a33, + 0x2a32,0x1e9,0x600a9,0x13,0x2a34,0x2a33,0x27d,0x1e9,0x5008e,0x3a,0x2a37,0x29ff, + 0x2a34,0x50081,0x3a,0x2a39,0x2a2d,0x2a37,0x50081,0x13,0x2a3c,0x2a30,0x2a34,0x500ba, + 0x47,0x2a3e,0x2a3c,0x32b,0x600a9,0x13,0x2a40,0x2a3e,0x2a3c,0x27d,0x70050,0x3a, + 0x2a42,0x2a40,0x2a40,0x2a40,0x2a40,0x50088,0x3a,0x2a43,0x2a39,0x2a42,0x300f7,0x29da, + 0x0,0x400fa,0x278f,0x29c3,0x29da,0x200f8,0x29c3,0x50086,0x6,0x29c9,0x7c7,0x10f, + 0x4007c,0x1e,0x29ca,0x29c9,0x50086,0x6,0x29cc,0x7cd,0x10f,0x4007c,0x1e,0x29cd, + 0x29cc,0x50050,0x1f,0x29ce,0x29ca,0x29cd,0x4003d,0x16d,0x2a97,0x1d0,0x40063,0x2a97, + 0x29ce,0x2a43,0x50080,0x6,0x29d7,0x29c9,0x7cd,0x50051,0x13,0x2aad,0x2a43,0x0, + 0x60041,0x2cb,0x2aae,0x2c8,0x29d7,0x151,0x3003e,0x2aae,0x2aad,0x50051,0x13,0x2ab2, + 0x2a43,0x1,0x60041,0x2cb,0x2ab3,0x2ce,0x29d7,0x151,0x3003e,0x2ab3,0x2ab2,0x50051, + 0x13,0x2ab7,0x2a43,0x2,0x60041,0x2cb,0x2ab8,0x2d3,0x29d7,0x151,0x3003e,0x2ab8, + 0x2ab7,0x50051,0x13,0x2abc,0x2a43,0x3,0x60041,0x2cb,0x2abd,0x2d8,0x29d7,0x151, + 0x3003e,0x2abd,0x2abc,0x200f9,0x29da,0x200f8,0x29da,0x200f9,0x29db,0x200f8,0x29db,0x500b2, + 0x47,0x2770,0x784,0x1d6,0x300f7,0x2772,0x0,0x400fa,0x2770,0x2771,0x2772,0x200f8, + 0x2771,0x200f9,0x277a,0x200f8,0x2772,0x300e1,0x10f,0x335,0x400e0,0x10f,0x10f,0x336, + 0x500b0,0x47,0x2ac9,0x74d,0x190,0x300f7,0x2ada,0x0,0x400fa,0x2ac9,0x2aca,0x2ada, + 0x200f8,0x2aca,0x60041,0x2cb,0x2adf,0x2c8,0x74d,0x151,0x4003d,0x13,0x2ae0,0x2adf, + 0x60041,0x2cb,0x2ae3,0x2ce,0x74d,0x151,0x4003d,0x13,0x2ae4,0x2ae3,0x60041,0x2cb, + 0x2ae7,0x2d3,0x74d,0x151,0x4003d,0x13,0x2ae8,0x2ae7,0x60041,0x2cb,0x2aeb,0x2d8, + 0x74d,0x151,0x4003d,0x13,0x2aec,0x2aeb,0x70050,0x3a,0x2aed,0x2ae0,0x2ae4,0x2ae8, + 0x2aec,0x6016e,0x3a,0x2afa,0x110,0x2aed,0x151,0x6016e,0x3a,0x2afc,0x110,0x2aed, + 0x116,0x6016e,0x3a,0x2afe,0x110,0x2aed,0x10f,0x500ba,0x47,0x2b0e,0x2ae8,0x1e9, + 0x600a9,0x13,0x2b0f,0x2b0e,0x27d,0x1e9,0x5008e,0x3a,0x2b12,0x2aed,0x2b0f,0x50051, + 0x13,0x2b19,0x2afa,0x2,0x500ba,0x47,0x2b1a,0x2b19,0x1e9,0x600a9,0x13,0x2b1b, + 0x2b1a,0x27d,0x1e9,0x5008e,0x3a,0x2b1e,0x2afa,0x2b1b,0x50081,0x3a,0x2b20,0x2b12, + 0x2b1e,0x50081,0x13,0x2b23,0x2b0f,0x2b1b,0x50051,0x13,0x2b25,0x2afc,0x2,0x500ba, + 0x47,0x2b26,0x2b25,0x1e9,0x600a9,0x13,0x2b27,0x2b26,0x27d,0x1e9,0x5008e,0x3a, + 0x2b2a,0x2afc,0x2b27,0x50081,0x3a,0x2b2c,0x2b20,0x2b2a,0x50081,0x13,0x2b2f,0x2b23, + 0x2b27,0x50051,0x13,0x2b31,0x2afe,0x2,0x500ba,0x47,0x2b32,0x2b31,0x1e9,0x600a9, + 0x13,0x2b33,0x2b32,0x27d,0x1e9,0x5008e,0x3a,0x2b36,0x2afe,0x2b33,0x50081,0x3a, + 0x2b38,0x2b2c,0x2b36,0x50081,0x13,0x2b3b,0x2b2f,0x2b33,0x500ba,0x47,0x2b3d,0x2b3b, + 0x32b,0x600a9,0x13,0x2b3f,0x2b3d,0x2b3b,0x27d,0x70050,0x3a,0x2b41,0x2b3f,0x2b3f, + 0x2b3f,0x2b3f,0x50088,0x3a,0x2b42,0x2b38,0x2b41,0x300f7,0x2ad9,0x0,0x400fa,0x278f, + 0x2ad2,0x2ad9,0x200f8,0x2ad2,0x4003d,0x16d,0x2b9d,0x1da,0x40063,0x2b9d,0x4159,0x2b42, + 0x200f9,0x2ad9,0x200f8,0x2ad9,0x200f9,0x2ada,0x200f8,0x2ada,0x200f9,0x277a,0x200f8,0x277a, + 0x200f9,0x7f3,0x200f8,0x7f3,0x100fd,0x10038, +}; +static const char *fi_compute_game_vector_field_inpainting_pyramid_pass_0_cb_names[] = {"cbFI", "cbInpaintingPyramid"}; +static const uint32_t fi_compute_game_vector_field_inpainting_pyramid_pass_0_cb_bind[] = {16, 17}; +static const uint32_t fi_compute_game_vector_field_inpainting_pyramid_pass_0_cb_count[] = {1, 1}; +static const uint32_t fi_compute_game_vector_field_inpainting_pyramid_pass_0_cb_space[] = {0, 0}; +static const char *fi_compute_game_vector_field_inpainting_pyramid_pass_0_srv_tex_names[] = {"r_game_motion_vector_field_x", "r_game_motion_vector_field_y"}; +static const uint32_t fi_compute_game_vector_field_inpainting_pyramid_pass_0_srv_tex_bind[] = {0, 1}; +static const uint32_t fi_compute_game_vector_field_inpainting_pyramid_pass_0_srv_tex_count[] = {1, 1}; +static const uint32_t fi_compute_game_vector_field_inpainting_pyramid_pass_0_srv_tex_space[] = {0, 0}; +static const char *fi_compute_game_vector_field_inpainting_pyramid_pass_0_uav_tex_names[] = {"rw_inpainting_pyramid0", "rw_inpainting_pyramid1", "rw_inpainting_pyramid2", "rw_inpainting_pyramid3", "rw_inpainting_pyramid4", "rw_inpainting_pyramid5", "rw_inpainting_pyramid6", "rw_inpainting_pyramid7", "rw_inpainting_pyramid8", "rw_inpainting_pyramid9", "rw_inpainting_pyramid10", "rw_inpainting_pyramid11"}; +static const uint32_t fi_compute_game_vector_field_inpainting_pyramid_pass_0_uav_tex_bind[] = {3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}; +static const uint32_t fi_compute_game_vector_field_inpainting_pyramid_pass_0_uav_tex_count[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; +static const uint32_t fi_compute_game_vector_field_inpainting_pyramid_pass_0_uav_tex_space[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +static const char *fi_compute_game_vector_field_inpainting_pyramid_pass_0_uav_buf_names[] = {"rw_counters"}; +static const uint32_t fi_compute_game_vector_field_inpainting_pyramid_pass_0_uav_buf_bind[] = {2}; +static const uint32_t fi_compute_game_vector_field_inpainting_pyramid_pass_0_uav_buf_count[] = {1}; +static const uint32_t fi_compute_game_vector_field_inpainting_pyramid_pass_0_uav_buf_space[] = {0}; + +static const uint32_t fi_debug_view_pass_0_spv[3800] = { + 0x7230203,0x10500,0x8000b,0x1039,0x0,0x20011,0x1,0x20011,0x38,0x6000b,0x1,0x4c534c47, + 0x6474732e,0x3035342e,0x0,0x3000e,0x0,0x1,0x12000f,0x5,0x4,0x6e69616d,0x0,0xca, + 0xf9,0xfd,0x106,0x111,0x119,0x124,0x12a,0x134,0x13c,0x144,0x14f,0x478, + 0x60010,0x4,0x11,0x8,0x8,0x1,0x30003,0x2,0x1c2,0xb0004,0x455f4c47,0x735f5458, + 0x6c706d61,0x656c7265,0x745f7373,0x75747865,0x665f6572,0x74636e75,0x736e6f69,0x0,0xb0004,0x455f4c47,0x735f5458,0x65646168, + 0x78655f72,0x63696c70,0x615f7469,0x68746972,0x6974656d,0x79745f63,0x736570,0xa0004,0x455f4c47,0x735f5458,0x65646168,0x6d695f72, + 0x5f656761,0x64616f6c,0x726f665f,0x7474616d,0x6465,0xa0004,0x475f4c47,0x4c474f4f,0x70635f45,0x74735f70,0x5f656c79,0x656e696c, + 0x7269645f,0x69746365,0x6576,0x80004,0x475f4c47,0x4c474f4f,0x6e695f45,0x64756c63,0x69645f65,0x74636572,0x657669,0x40005, + 0x4,0x6e69616d,0x0,0xb0005,0x81,0x46786646,0x656d6172,0x65746e49,0x6c6f7072,0x6f697461,0x6265446e,0x69566775, + 0x6f707765,0x7472,0x50006,0x81,0x0,0x7366666f,0x7465,0x50006,0x81,0x1,0x657a6973,0x0, + 0x40005,0xc8,0x49466263,0x745f,0x60006,0xc8,0x0,0x646e6572,0x69537265,0x657a,0x60006,0xc8, + 0x1,0x70736964,0x5379616c,0x657a69,0x90006,0xc8,0x2,0x4c445548,0x41737365,0x63617474,0x46646568,0x6f746361, + 0x72,0x80006,0xc8,0x3,0x6974706f,0x466c6163,0x53776f6c,0x656c6163,0x0,0x90006,0xc8,0x4, + 0x6974706f,0x466c6163,0x42776f6c,0x6b636f6c,0x657a6953,0x0,0x70006,0xc8,0x5,0x5278616d,0x65646e65,0x7a695372, + 0x65,0x40005,0xca,0x49466263,0x0,0xa0005,0xf9,0x75635f72,0x6e657272,0x6e695f74,0x70726574,0x74616c6f, + 0x5f6e6f69,0x72756f73,0x6563,0x60005,0xfd,0x694c5f73,0x7261656e,0x6d616c43,0x70,0x70005,0x106,0x69645f72, + 0x63636f73,0x6973756c,0x6d5f6e6f,0x6b7361,0xa0005,0x111,0x61675f72,0x6d5f656d,0x6f69746f,0x65765f6e,0x726f7463,0x6569665f, + 0x785f646c,0x0,0xa0005,0x119,0x61675f72,0x6d5f656d,0x6f69746f,0x65765f6e,0x726f7463,0x6569665f,0x795f646c,0x0, + 0xc0005,0x124,0x706f5f72,0x61636974,0x6c665f6c,0x6d5f776f,0x6f69746f,0x65765f6e,0x726f7463,0x6569665f,0x785f646c,0x0, + 0xc0005,0x12a,0x706f5f72,0x61636974,0x6c665f6c,0x6d5f776f,0x6f69746f,0x65765f6e,0x726f7463,0x6569665f,0x795f646c,0x0, + 0x80005,0x134,0x6e695f72,0x6e696170,0x676e6974,0x7279705f,0x64696d61,0x0,0x80005,0x13c,0x72705f72,0x6e657365, + 0x61625f74,0x75626b63,0x72656666,0x0,0x90005,0x144,0x6e695f72,0x5f747570,0x74736964,0x6974726f,0x665f6e6f,0x646c6569, + 0x0,0x50005,0x14f,0x6f5f7772,0x75707475,0x74,0x80005,0x478,0x475f6c67,0x61626f6c,0x766e496c,0x7461636f, + 0x496e6f69,0x44,0x30047,0xc8,0x2,0x50048,0xc8,0x0,0x23,0x0,0x50048,0xc8, + 0x1,0x23,0x8,0x50048,0xc8,0x2,0x23,0x44,0x50048,0xc8,0x3,0x23, + 0x50,0x50048,0xc8,0x4,0x23,0x58,0x50048,0xc8,0x5,0x23,0x60,0x40047, + 0xca,0x21,0xa,0x40047,0xca,0x22,0x0,0x40047,0xf9,0x21,0x7,0x40047, + 0xf9,0x22,0x0,0x40047,0xfd,0x21,0x3e8,0x40047,0xfd,0x22,0x0,0x40047, + 0x106,0x21,0x4,0x40047,0x106,0x22,0x0,0x40047,0x111,0x21,0x0,0x40047, + 0x111,0x22,0x0,0x40047,0x119,0x21,0x1,0x40047,0x119,0x22,0x0,0x40047, + 0x124,0x21,0x2,0x40047,0x124,0x22,0x0,0x40047,0x12a,0x21,0x3,0x40047, + 0x12a,0x22,0x0,0x40047,0x134,0x21,0x6,0x40047,0x134,0x22,0x0,0x40047, + 0x13c,0x21,0x5,0x40047,0x13c,0x22,0x0,0x40047,0x144,0x21,0x8,0x40047, + 0x144,0x22,0x0,0x40047,0x14f,0x21,0x9,0x40047,0x14f,0x22,0x0,0x40047, + 0x478,0xb,0x1c,0x40047,0x488,0xb,0x19,0x20013,0x2,0x30021,0x3,0x2, + 0x30016,0x6,0x20,0x40020,0x7,0x7,0x6,0x40017,0x8,0x6,0x2,0x40015, + 0x15,0x20,0x0,0x40015,0x1b,0x20,0x1,0x40017,0x1c,0x1b,0x2,0x40017, + 0x30,0x6,0x4,0x40020,0x35,0x7,0x1c,0x40017,0x36,0x15,0x2,0x4002b, + 0x15,0x51,0x4,0x4001c,0x52,0x1c,0x51,0x4001c,0x53,0x6,0x51,0x20014, + 0x5a,0x4001e,0x81,0x1c,0x1c,0x40020,0x82,0x7,0x81,0x4002b,0x6,0xb7, + 0x0,0x4002b,0x6,0xba,0x3f800000,0x8001e,0xc8,0x1c,0x1c,0x1b,0x8,0x1b, + 0x1c,0x40020,0xc9,0x2,0xc8,0x4003b,0xc9,0xca,0x2,0x4002b,0x1b,0xcb, + 0x0,0x40020,0xcc,0x2,0x1c,0x4002b,0x1b,0xd1,0x1,0x40020,0xd8,0x2, + 0x8,0x40020,0xde,0x2,0x1b,0x90019,0xf7,0x6,0x1,0x0,0x0,0x0, + 0x1,0x0,0x40020,0xf8,0x0,0xf7,0x4003b,0xf8,0xf9,0x0,0x2001a,0xfb, + 0x40020,0xfc,0x0,0xfb,0x4003b,0xfc,0xfd,0x0,0x3001b,0xff,0xf7,0x4003b, + 0xf8,0x106,0x0,0x90019,0x10f,0x15,0x1,0x0,0x0,0x0,0x1,0x0, + 0x40020,0x110,0x0,0x10f,0x4003b,0x110,0x111,0x0,0x40017,0x114,0x15,0x4, + 0x4002b,0x15,0x116,0x0,0x4003b,0x110,0x119,0x0,0x4003b,0x110,0x124,0x0, + 0x4003b,0x110,0x12a,0x0,0x4003b,0xf8,0x134,0x0,0x4003b,0xf8,0x13c,0x0, + 0x4003b,0xf8,0x144,0x0,0x90019,0x14d,0x6,0x1,0x0,0x0,0x0,0x2, + 0x0,0x40020,0x14e,0x0,0x14d,0x4003b,0x14e,0x14f,0x0,0x4002b,0x6,0x158, + 0x3f000000,0x5002c,0x8,0x159,0x158,0x158,0x4002b,0x1b,0x15d,0x2,0x5002c,0x1c, + 0x166,0xcb,0xcb,0x5002c,0x1c,0x168,0xd1,0xcb,0x5002c,0x1c,0x16a,0xcb, + 0xd1,0x4002b,0x1b,0x16c,0x3,0x5002c,0x1c,0x16d,0xd1,0xd1,0x4002b,0x15, + 0x172,0x1,0x40017,0x193,0x5a,0x2,0x5002c,0x8,0x1b0,0xb7,0xb7,0x4002b, + 0x1b,0x1b7,0x4,0x4002b,0x15,0x1c7,0x80000000,0x4002b,0x15,0x1ce,0x15,0x4002b, + 0x15,0x1d0,0x3ff,0x7002c,0x30,0x20e,0xb7,0xb7,0xb7,0xb7,0x4002b,0x1b, + 0x270,0xb,0x4002b,0x15,0x274,0x3,0x4002b,0x6,0x331,0x3dcccccd,0x4002b,0x6, + 0x39e,0x41200000,0x4002b,0x6,0x3f6,0x3eaaaaab,0x5002c,0x8,0x3f7,0x3f6,0x3f6,0x4001c, + 0x40e,0x81,0x274,0x4001c,0x40f,0x40e,0x274,0x40020,0x410,0x7,0x40f,0x40017, + 0x476,0x15,0x3,0x40020,0x477,0x1,0x476,0x4003b,0x477,0x478,0x1,0x4002b, + 0x15,0x487,0x8,0x6002c,0x476,0x488,0x487,0x487,0x172,0x40020,0xc23,0x7, + 0x52,0x40020,0xc25,0x7,0x53,0x5002c,0x8,0xfa1,0xba,0xba,0x7002c,0x52, + 0xfa2,0x166,0x168,0x16a,0x16d,0x5002c,0x1c,0xfa4,0x15d,0x15d,0x4002b,0x6, + 0xfa5,0x3a802008,0x4002b,0x15,0x100c,0x5,0x4002b,0x15,0x100d,0x2,0x50036,0x2, + 0x4,0x0,0x3,0x200f8,0x5,0x4003b,0xc25,0xced,0x7,0x4003b,0xc23,0xcec, + 0x7,0x4003b,0xc25,0xc95,0x7,0x4003b,0xc23,0xc94,0x7,0x4003b,0xc25,0xc3f, + 0x7,0x4003b,0xc23,0xc3e,0x7,0x4003b,0x410,0x48d,0x7,0x4003d,0x476,0x479, + 0x478,0x7004f,0x36,0x47a,0x479,0x479,0x0,0x1,0x4007c,0x1c,0x47b,0x47a, + 0x50041,0xcc,0x508,0xca,0xd1,0x4003d,0x1c,0x509,0x508,0x4006f,0x8,0x4a8, + 0x509,0x50085,0x8,0x4aa,0x4a8,0x3f7,0x4006e,0x1c,0x4ab,0x4aa,0x200f9,0x4ac, + 0x200f8,0x4ac,0x700f5,0x1b,0xdff,0xcb,0x5,0x4c8,0x4c6,0x500b1,0x5a,0x4af, + 0xdff,0x16c,0x400f6,0x4c9,0x4c6,0x0,0x400fa,0x4af,0x4b0,0x4c9,0x200f8,0x4b0, + 0x200f9,0x4b1,0x200f8,0x4b1,0x700f5,0x1b,0xf66,0xcb,0x4b0,0x4c4,0x4b5,0x500b1, + 0x5a,0x4b4,0xf66,0x16c,0x400f6,0x4c5,0x4b5,0x0,0x400fa,0x4b4,0x4b5,0x4c5, + 0x200f8,0x4b5,0x50050,0x1c,0x4bb,0xf66,0xdff,0x50084,0x1c,0x4bc,0x4ab,0x4bb, + 0x70041,0x35,0x4bd,0x48d,0xdff,0xf66,0xcb,0x3003e,0x4bd,0x4bc,0x70041,0x35, + 0x4c1,0x48d,0xdff,0xf66,0xd1,0x3003e,0x4c1,0x4ab,0x50080,0x1b,0x4c4,0xf66, + 0xd1,0x200f9,0x4b1,0x200f8,0x4c5,0x200f9,0x4c6,0x200f8,0x4c6,0x50080,0x1b,0x4c8, + 0xdff,0xd1,0x200f9,0x4ac,0x200f8,0x4c9,0x60041,0x82,0x4cb,0x48d,0xcb,0xcb, + 0x4003d,0x81,0x4cc,0x4cb,0x50051,0x1c,0xd2c,0x4cc,0x0,0x50051,0x1c,0xd2d, + 0x4cc,0x1,0x50080,0x1c,0x511,0xd2c,0xd2d,0x50051,0x1b,0x513,0x47b,0x0, + 0x50051,0x1b,0x515,0xd2c,0x0,0x500af,0x5a,0x516,0x513,0x515,0x300f7,0x51d, + 0x0,0x400fa,0x516,0x517,0x51d,0x200f8,0x517,0x50051,0x1b,0x51b,0x511,0x0, + 0x500b1,0x5a,0x51c,0x513,0x51b,0x200f9,0x51d,0x200f8,0x51d,0x700f5,0x5a,0x51e, + 0x516,0x4c9,0x51c,0x517,0x300f7,0x52d,0x0,0x400fa,0x51e,0x51f,0x52d,0x200f8, + 0x51f,0x50051,0x1b,0x521,0x47b,0x1,0x50051,0x1b,0x523,0xd2c,0x1,0x500af, + 0x5a,0x524,0x521,0x523,0x300f7,0x52b,0x0,0x400fa,0x524,0x525,0x52b,0x200f8, + 0x525,0x50051,0x1b,0x529,0x511,0x1,0x500b1,0x5a,0x52a,0x521,0x529,0x200f9, + 0x52b,0x200f8,0x52b,0x700f5,0x5a,0x52c,0x524,0x51f,0x52a,0x525,0x200f9,0x52d, + 0x200f8,0x52d,0x700f5,0x5a,0x52e,0x51e,0x51d,0x52c,0x52b,0x300f7,0x4d3,0x0, + 0x400fa,0x52e,0x4ce,0x4d3,0x200f8,0x4ce,0x4003d,0x81,0x4d1,0x4cb,0x50051,0x1c, + 0xd0d,0x4d1,0x0,0x50051,0x1c,0xd0e,0x4d1,0x1,0x50082,0x1c,0x54a,0x47b, + 0xd0d,0x4006f,0x8,0x54b,0x54a,0x50081,0x8,0x54d,0x54b,0x159,0x4006f,0x8, + 0x550,0xd0e,0x50088,0x8,0x551,0x54d,0x550,0x50041,0xcc,0x5a3,0xca,0xcb, + 0x4003d,0x1c,0x5a4,0x5a3,0x4006f,0x8,0x561,0x5a4,0x50085,0x8,0x562,0x551, + 0x561,0x4006e,0x1c,0x563,0x562,0x4003d,0x10f,0x5a9,0x111,0x7005f,0x114,0x5ab, + 0x5a9,0x563,0x2002,0xcb,0x50051,0x15,0x5ac,0x5ab,0x0,0x4003d,0x10f,0x5ad, + 0x119,0x7005f,0x114,0x5af,0x5ad,0x563,0x2002,0xcb,0x50051,0x15,0x5b0,0x5af, + 0x0,0x500c2,0x15,0x5ba,0x5ac,0x1ce,0x500c7,0x15,0x5bb,0x5ba,0x1d0,0x40070, + 0x6,0x5bc,0x5bb,0x50085,0x6,0x5bd,0x5bc,0xfa5,0x6000c,0x8,0x5f2,0x1, + 0x3e,0x5ac,0x50051,0x6,0x5e2,0x5f2,0x0,0x6000c,0x8,0x5f6,0x1,0x3e, + 0x5b0,0x50051,0x6,0x5e7,0x5f6,0x0,0x50050,0x8,0x1037,0x5e2,0x5e7,0x500bd, + 0x5a,0x56b,0x5bd,0xb7,0x300f7,0x58e,0x0,0x400fa,0x56b,0x56c,0x58e,0x200f8, + 0x56c,0x200f9,0x56e,0x200f8,0x56e,0x700f5,0x30,0x1013,0x20e,0x56c,0x642,0x580, + 0x700f5,0x1c,0xf5f,0x5a4,0x56c,0x57b,0x580,0x700f5,0x1b,0xe21,0xcb,0x56c, + 0x582,0x580,0x400f6,0x583,0x580,0x0,0x200f9,0x56f,0x200f8,0x56f,0x500b1,0x5a, + 0x571,0xe21,0x270,0x300f7,0x576,0x0,0x400fa,0x571,0x572,0x576,0x200f8,0x572, + 0x50051,0x6,0x574,0x1013,0x3,0x500b4,0x5a,0x575,0x574,0xb7,0x200f9,0x576, + 0x200f8,0x576,0x700f5,0x5a,0x577,0x571,0x56f,0x575,0x572,0x400fa,0x577,0x578, + 0x583,0x200f8,0x578,0x50087,0x1c,0x57b,0xf5f,0xfa4,0x4006f,0x8,0x64c,0x57b, + 0x50085,0x8,0x64d,0x551,0x64c,0x50083,0x8,0x64e,0x64d,0x159,0x6000c,0x8, + 0x650,0x1,0x8,0x64e,0x4006e,0x1c,0x651,0x650,0x6000c,0x8,0x679,0x1, + 0xa,0x64e,0x50051,0x6,0x65a,0x679,0x0,0x50083,0x6,0x65b,0xba,0x65a, + 0x50051,0x6,0x65d,0x679,0x1,0x50083,0x6,0x65e,0xba,0x65d,0x50085,0x6, + 0x65f,0x65b,0x65e,0x50085,0x6,0x666,0x65a,0x65e,0x50085,0x6,0x66d,0x65b, + 0x65d,0x50085,0x6,0x673,0x65a,0x65d,0x70050,0x53,0xdfe,0x65f,0x666,0x66d, + 0x673,0x3003e,0xcec,0xfa2,0x3003e,0xced,0xdfe,0x200f9,0x610,0x200f8,0x610,0x700f5, + 0x30,0x102d,0x20e,0x578,0x1036,0x638,0x700f5,0x6,0xf62,0xb7,0x578,0xf9e, + 0x638,0x700f5,0x1b,0xf61,0xcb,0x578,0x63a,0x638,0x500b1,0x5a,0x613,0xf61, + 0x1b7,0x400f6,0x63b,0x638,0x0,0x400fa,0x613,0x614,0x63b,0x200f8,0x614,0x50041, + 0x35,0xcf2,0xcec,0xf61,0x4003d,0x1c,0x617,0xcf2,0x50080,0x1c,0x61b,0x651, + 0x617,0x4007c,0x36,0x67d,0x61b,0x4007c,0x36,0x67f,0x57b,0x500b0,0x193,0x680, + 0x67d,0x67f,0x4009b,0x5a,0x681,0x680,0x300f7,0x637,0x0,0x400fa,0x681,0x61e, + 0x637,0x200f8,0x61e,0x4003d,0xf7,0x684,0x134,0x7005f,0x30,0x688,0x684,0x61b, + 0x2,0xe21,0x50051,0x6,0x623,0x688,0x2,0x500ba,0x5a,0x626,0x623,0xb7, + 0x600a9,0x6,0x627,0x626,0xba,0xb7,0x50041,0x7,0xcf3,0xced,0xf61,0x4003d, + 0x6,0x62a,0xcf3,0x50085,0x6,0x62c,0x62a,0x627,0x50085,0x6,0x62e,0x62c, + 0x623,0x50081,0x6,0x631,0xf62,0x62e,0x5008e,0x30,0x634,0x688,0x62e,0x50081, + 0x30,0x636,0x102d,0x634,0x200f9,0x637,0x200f8,0x637,0x700f5,0x30,0x1036,0x102d, + 0x614,0x636,0x61e,0x700f5,0x6,0xf9e,0xf62,0x614,0x631,0x61e,0x200f9,0x638, + 0x200f8,0x638,0x50080,0x1b,0x63a,0xf61,0xd1,0x200f9,0x610,0x200f8,0x63b,0x500ba, + 0x5a,0x63d,0xf62,0xb7,0x600a9,0x6,0x63f,0x63d,0xf62,0xba,0x70050,0x30, + 0x641,0x63f,0x63f,0x63f,0x63f,0x50088,0x30,0x642,0x102d,0x641,0x200f9,0x580, + 0x200f8,0x580,0x50080,0x1b,0x582,0xe21,0xd1,0x200f9,0x56e,0x200f8,0x583,0x7004f, + 0x8,0x585,0x1013,0x1013,0x0,0x1,0x200f9,0x58e,0x200f8,0x58e,0x700f5,0x8, + 0xe27,0x1037,0x4ce,0x585,0x583,0x50085,0x8,0x6bc,0xe27,0x4a8,0x5008e,0x8, + 0x6bd,0x6bc,0x331,0x50081,0x8,0x6bf,0x159,0x6bd,0x50051,0x6,0x6c0,0x6bf, + 0x0,0x50051,0x6,0x6c1,0x6bf,0x1,0x70050,0x30,0x6c2,0x6c0,0x6c1,0x158, + 0xba,0x4003d,0x14d,0x6c8,0x14f,0x40063,0x6c8,0x47b,0x6c2,0x200f9,0x4d3,0x200f8, + 0x4d3,0x60041,0x82,0x4d5,0x48d,0xcb,0xd1,0x4003d,0x81,0x4d6,0x4d5,0x50051, + 0x1c,0xd39,0x4d6,0x0,0x50051,0x1c,0xd3a,0x4d6,0x1,0x50080,0x1c,0x6d2, + 0xd39,0xd3a,0x50051,0x1b,0x6d6,0xd39,0x0,0x500af,0x5a,0x6d7,0x513,0x6d6, + 0x300f7,0x6de,0x0,0x400fa,0x6d7,0x6d8,0x6de,0x200f8,0x6d8,0x50051,0x1b,0x6dc, + 0x6d2,0x0,0x500b1,0x5a,0x6dd,0x513,0x6dc,0x200f9,0x6de,0x200f8,0x6de,0x700f5, + 0x5a,0x6df,0x6d7,0x4d3,0x6dd,0x6d8,0x300f7,0x6ee,0x0,0x400fa,0x6df,0x6e0, + 0x6ee,0x200f8,0x6e0,0x50051,0x1b,0x6e2,0x47b,0x1,0x50051,0x1b,0x6e4,0xd39, + 0x1,0x500af,0x5a,0x6e5,0x6e2,0x6e4,0x300f7,0x6ec,0x0,0x400fa,0x6e5,0x6e6, + 0x6ec,0x200f8,0x6e6,0x50051,0x1b,0x6ea,0x6d2,0x1,0x500b1,0x5a,0x6eb,0x6e2, + 0x6ea,0x200f9,0x6ec,0x200f8,0x6ec,0x700f5,0x5a,0x6ed,0x6e5,0x6e0,0x6eb,0x6e6, + 0x200f9,0x6ee,0x200f8,0x6ee,0x700f5,0x5a,0x6ef,0x6df,0x6de,0x6ed,0x6ec,0x300f7, + 0x4dd,0x0,0x400fa,0x6ef,0x4d8,0x4dd,0x200f8,0x4d8,0x4003d,0x81,0x4db,0x4d5, + 0x50051,0x1c,0xcb5,0x4db,0x0,0x50051,0x1c,0xcb6,0x4db,0x1,0x50082,0x1c, + 0x70a,0x47b,0xcb5,0x4006f,0x8,0x70b,0x70a,0x50081,0x8,0x70d,0x70b,0x159, + 0x4006f,0x8,0x710,0xcb6,0x50088,0x8,0x711,0x70d,0x710,0x50041,0xcc,0x763, + 0xca,0xcb,0x4003d,0x1c,0x764,0x763,0x4006f,0x8,0x721,0x764,0x50085,0x8, + 0x722,0x711,0x721,0x4006e,0x1c,0x723,0x722,0x4003d,0x10f,0x769,0x111,0x7005f, + 0x114,0x76b,0x769,0x723,0x2002,0xcb,0x50051,0x15,0x76c,0x76b,0x0,0x500c2, + 0x15,0x77a,0x76c,0x1ce,0x500c7,0x15,0x77b,0x77a,0x1d0,0x40070,0x6,0x77c, + 0x77b,0x50085,0x6,0x77d,0x77c,0xfa5,0x500c7,0x15,0x7ad,0x76c,0x1c7,0x500ba, + 0x5a,0x78c,0x77d,0xb7,0x300f7,0x794,0x0,0x400fa,0x78c,0x790,0x794,0x200f8, + 0x790,0x500aa,0x5a,0x793,0x7ad,0x116,0x200f9,0x794,0x200f8,0x794,0x700f5,0x5a, + 0x795,0x78c,0x4d8,0x793,0x790,0x300f7,0x79e,0x0,0x400fa,0x795,0x799,0x79e, + 0x200f8,0x799,0x50083,0x6,0x79c,0xba,0x77d,0x200f9,0x79e,0x200f8,0x79e,0x700f5, + 0x6,0xeb3,0x77d,0x794,0x79c,0x799,0x400a8,0x5a,0x72b,0x78c,0x300f7,0x74e, + 0x0,0x400fa,0x72b,0x72c,0x74e,0x200f8,0x72c,0x200f9,0x72e,0x200f8,0x72e,0x700f5, + 0x30,0x1015,0x20e,0x72c,0x802,0x740,0x700f5,0x1c,0xf57,0x764,0x72c,0x73b, + 0x740,0x700f5,0x1b,0xeb4,0xcb,0x72c,0x742,0x740,0x400f6,0x743,0x740,0x0, + 0x200f9,0x72f,0x200f8,0x72f,0x500b1,0x5a,0x731,0xeb4,0x270,0x300f7,0x736,0x0, + 0x400fa,0x731,0x732,0x736,0x200f8,0x732,0x50051,0x6,0x734,0x1015,0x3,0x500b4, + 0x5a,0x735,0x734,0xb7,0x200f9,0x736,0x200f8,0x736,0x700f5,0x5a,0x737,0x731, + 0x72f,0x735,0x732,0x400fa,0x737,0x738,0x743,0x200f8,0x738,0x50087,0x1c,0x73b, + 0xf57,0xfa4,0x4006f,0x8,0x80c,0x73b,0x50085,0x8,0x80d,0x711,0x80c,0x50083, + 0x8,0x80e,0x80d,0x159,0x6000c,0x8,0x810,0x1,0x8,0x80e,0x4006e,0x1c, + 0x811,0x810,0x6000c,0x8,0x839,0x1,0xa,0x80e,0x50051,0x6,0x81a,0x839, + 0x0,0x50083,0x6,0x81b,0xba,0x81a,0x50051,0x6,0x81d,0x839,0x1,0x50083, + 0x6,0x81e,0xba,0x81d,0x50085,0x6,0x81f,0x81b,0x81e,0x50085,0x6,0x826, + 0x81a,0x81e,0x50085,0x6,0x82d,0x81b,0x81d,0x50085,0x6,0x833,0x81a,0x81d, + 0x70050,0x53,0xdd2,0x81f,0x826,0x82d,0x833,0x3003e,0xc94,0xfa2,0x3003e,0xc95, + 0xdd2,0x200f9,0x7d0,0x200f8,0x7d0,0x700f5,0x30,0x102c,0x20e,0x738,0x1035,0x7f8, + 0x700f5,0x6,0xf5a,0xb7,0x738,0xf99,0x7f8,0x700f5,0x1b,0xf59,0xcb,0x738, + 0x7fa,0x7f8,0x500b1,0x5a,0x7d3,0xf59,0x1b7,0x400f6,0x7fb,0x7f8,0x0,0x400fa, + 0x7d3,0x7d4,0x7fb,0x200f8,0x7d4,0x50041,0x35,0xc9a,0xc94,0xf59,0x4003d,0x1c, + 0x7d7,0xc9a,0x50080,0x1c,0x7db,0x811,0x7d7,0x4007c,0x36,0x83d,0x7db,0x4007c, + 0x36,0x83f,0x73b,0x500b0,0x193,0x840,0x83d,0x83f,0x4009b,0x5a,0x841,0x840, + 0x300f7,0x7f7,0x0,0x400fa,0x841,0x7de,0x7f7,0x200f8,0x7de,0x4003d,0xf7,0x844, + 0x134,0x7005f,0x30,0x848,0x844,0x7db,0x2,0xeb4,0x50051,0x6,0x7e3,0x848, + 0x2,0x500ba,0x5a,0x7e6,0x7e3,0xb7,0x600a9,0x6,0x7e7,0x7e6,0xba,0xb7, + 0x50041,0x7,0xc9b,0xc95,0xf59,0x4003d,0x6,0x7ea,0xc9b,0x50085,0x6,0x7ec, + 0x7ea,0x7e7,0x50085,0x6,0x7ee,0x7ec,0x7e3,0x50081,0x6,0x7f1,0xf5a,0x7ee, + 0x5008e,0x30,0x7f4,0x848,0x7ee,0x50081,0x30,0x7f6,0x102c,0x7f4,0x200f9,0x7f7, + 0x200f8,0x7f7,0x700f5,0x30,0x1035,0x102c,0x7d4,0x7f6,0x7de,0x700f5,0x6,0xf99, + 0xf5a,0x7d4,0x7f1,0x7de,0x200f9,0x7f8,0x200f8,0x7f8,0x50080,0x1b,0x7fa,0xf59, + 0xd1,0x200f9,0x7d0,0x200f8,0x7fb,0x500ba,0x5a,0x7fd,0xf5a,0xb7,0x600a9,0x6, + 0x7ff,0x7fd,0xf5a,0xba,0x70050,0x30,0x801,0x7ff,0x7ff,0x7ff,0x7ff,0x50088, + 0x30,0x802,0x102c,0x801,0x200f9,0x740,0x200f8,0x740,0x50080,0x1b,0x742,0xeb4, + 0xd1,0x200f9,0x72e,0x200f8,0x743,0x50051,0x6,0x748,0x1015,0x2,0x200f9,0x74e, + 0x200f8,0x74e,0x700f5,0x6,0xee2,0xeb3,0x79e,0x748,0x743,0x70050,0x30,0x701, + 0xb7,0xee2,0xb7,0xba,0x4003d,0x14d,0x878,0x14f,0x40063,0x878,0x47b,0x701, + 0x200f9,0x4dd,0x200f8,0x4dd,0x60041,0x82,0x4df,0x48d,0xcb,0x15d,0x4003d,0x81, + 0x4e0,0x4df,0x50051,0x1c,0xd46,0x4e0,0x0,0x50051,0x1c,0xd47,0x4e0,0x1, + 0x50080,0x1c,0x882,0xd46,0xd47,0x50051,0x1b,0x886,0xd46,0x0,0x500af,0x5a, + 0x887,0x513,0x886,0x300f7,0x88e,0x0,0x400fa,0x887,0x888,0x88e,0x200f8,0x888, + 0x50051,0x1b,0x88c,0x882,0x0,0x500b1,0x5a,0x88d,0x513,0x88c,0x200f9,0x88e, + 0x200f8,0x88e,0x700f5,0x5a,0x88f,0x887,0x4dd,0x88d,0x888,0x300f7,0x89e,0x0, + 0x400fa,0x88f,0x890,0x89e,0x200f8,0x890,0x50051,0x1b,0x892,0x47b,0x1,0x50051, + 0x1b,0x894,0xd46,0x1,0x500af,0x5a,0x895,0x892,0x894,0x300f7,0x89c,0x0, + 0x400fa,0x895,0x896,0x89c,0x200f8,0x896,0x50051,0x1b,0x89a,0x882,0x1,0x500b1, + 0x5a,0x89b,0x892,0x89a,0x200f9,0x89c,0x200f8,0x89c,0x700f5,0x5a,0x89d,0x895, + 0x890,0x89b,0x896,0x200f9,0x89e,0x200f8,0x89e,0x700f5,0x5a,0x89f,0x88f,0x88e, + 0x89d,0x89c,0x300f7,0x4e7,0x0,0x400fa,0x89f,0x4e2,0x4e7,0x200f8,0x4e2,0x4003d, + 0x81,0x4e5,0x4df,0x50051,0x1c,0xc64,0x4e5,0x0,0x50051,0x1c,0xc65,0x4e5, + 0x1,0x50082,0x1c,0x8bb,0x47b,0xc64,0x4006f,0x8,0x8bc,0x8bb,0x50081,0x8, + 0x8be,0x8bc,0x159,0x4006f,0x8,0x8c1,0xc65,0x50088,0x8,0x8c2,0x8be,0x8c1, + 0x50041,0xd8,0x949,0xca,0x274,0x4003d,0x8,0x94a,0x949,0x50088,0x8,0x94c, + 0xfa1,0x94a,0x50041,0xde,0x94d,0xca,0x51,0x4003d,0x1b,0x94e,0x94d,0x50050, + 0x1c,0x94f,0x94e,0x94e,0x4006f,0x8,0x950,0x94f,0x50088,0x8,0x951,0x94c, + 0x950,0x4006e,0x1c,0x952,0x951,0x50084,0x1c,0x945,0x952,0x16d,0x4006f,0x8, + 0x8d7,0x945,0x5008e,0x8,0x8d8,0x8d7,0xba,0x4006e,0x1c,0x8d9,0x8d8,0x4006f, + 0x8,0x95c,0x8d9,0x50085,0x8,0x95d,0x8c2,0x95c,0x50083,0x8,0x95e,0x95d, + 0x159,0x6000c,0x8,0x960,0x1,0x8,0x95e,0x4006e,0x1c,0x961,0x960,0x6000c, + 0x8,0x989,0x1,0xa,0x95e,0x50051,0x6,0x96a,0x989,0x0,0x50083,0x6, + 0x96b,0xba,0x96a,0x50051,0x6,0x96d,0x989,0x1,0x50083,0x6,0x96e,0xba, + 0x96d,0x50085,0x6,0x96f,0x96b,0x96e,0x50085,0x6,0x976,0x96a,0x96e,0x50085, + 0x6,0x97d,0x96b,0x96d,0x50085,0x6,0x983,0x96a,0x96d,0x70050,0x53,0xda6, + 0x96f,0x976,0x97d,0x983,0x3003e,0xc3e,0xfa2,0x3003e,0xc3f,0xda6,0x200f9,0x8dd, + 0x200f8,0x8dd,0x700f5,0x8,0xf01,0x1b0,0x4e2,0xf88,0x917,0x700f5,0x6,0xf00, + 0xb7,0x4e2,0xf87,0x917,0x700f5,0x1b,0xeff,0xcb,0x4e2,0x919,0x917,0x500b1, + 0x5a,0x8e0,0xeff,0x1b7,0x400f6,0x91a,0x917,0x0,0x400fa,0x8e0,0x8e1,0x91a, + 0x200f8,0x8e1,0x50041,0x35,0xc44,0xc3e,0xeff,0x4003d,0x1c,0x8e4,0xc44,0x50080, + 0x1c,0x8e8,0x961,0x8e4,0x4007c,0x36,0x9ae,0x8e8,0x4007c,0x36,0x9b0,0x8d9, + 0x500b0,0x193,0x9b1,0x9ae,0x9b0,0x4009b,0x5a,0x9b2,0x9b1,0x300f7,0x916,0x0, + 0x400fa,0x9b2,0x8ef,0x916,0x200f8,0x8ef,0x50041,0x7,0xc45,0xc3f,0xeff,0x4003d, + 0x6,0x8f2,0xc45,0x4003d,0x10f,0x9c5,0x124,0x7005f,0x114,0x9c7,0x9c5,0x8e8, + 0x2002,0xcb,0x50051,0x15,0x9c8,0x9c7,0x0,0x4003d,0x10f,0x9c9,0x12a,0x7005f, + 0x114,0x9cb,0x9c9,0x8e8,0x2002,0xcb,0x50051,0x15,0x9cc,0x9cb,0x0,0x6000c, + 0x8,0xa0e,0x1,0x3e,0x9c8,0x50051,0x6,0x9fe,0xa0e,0x0,0x6000c,0x8, + 0xa12,0x1,0x3e,0x9cc,0x50051,0x6,0xa03,0xa12,0x0,0x50050,0x8,0x1038, + 0x9fe,0xa03,0x5008e,0x8,0x8fe,0x1038,0x8f2,0x50081,0x8,0x901,0xf01,0x8fe, + 0x50081,0x6,0x915,0xf00,0x8f2,0x200f9,0x916,0x200f8,0x916,0x700f5,0x8,0xf88, + 0xf01,0x8e1,0x901,0x8ef,0x700f5,0x6,0xf87,0xf00,0x8e1,0x915,0x8ef,0x200f9, + 0x917,0x200f8,0x917,0x50080,0x1b,0x919,0xeff,0xd1,0x200f9,0x8dd,0x200f8,0x91a, + 0x500ba,0x5a,0x91c,0xf00,0xb7,0x300f7,0x92e,0x0,0x400fa,0x91c,0x91d,0x92e, + 0x200f8,0x91d,0x50050,0x8,0x921,0xf00,0xf00,0x50088,0x8,0x922,0xf01,0x921, + 0x200f9,0x92e,0x200f8,0x92e,0x700f5,0x8,0xf06,0xf01,0x91a,0x922,0x91d,0x50085, + 0x8,0xa46,0xf06,0x4a8,0x5008e,0x8,0xa47,0xa46,0x331,0x50081,0x8,0xa49, + 0x159,0xa47,0x50051,0x6,0xa4a,0xa49,0x0,0x50051,0x6,0xa4b,0xa49,0x1, + 0x70050,0x30,0xa4c,0xa4a,0xa4b,0x158,0xba,0x4003d,0x14d,0xa52,0x14f,0x40063, + 0xa52,0x47b,0xa4c,0x200f9,0x4e7,0x200f8,0x4e7,0x60041,0x82,0x4e9,0x48d,0x15d, + 0xcb,0x4003d,0x81,0x4ea,0x4e9,0x50051,0x1c,0xd53,0x4ea,0x0,0x50051,0x1c, + 0xd54,0x4ea,0x1,0x50080,0x1c,0xa5c,0xd53,0xd54,0x50051,0x1b,0xa60,0xd53, + 0x0,0x500af,0x5a,0xa61,0x513,0xa60,0x300f7,0xa68,0x0,0x400fa,0xa61,0xa62, + 0xa68,0x200f8,0xa62,0x50051,0x1b,0xa66,0xa5c,0x0,0x500b1,0x5a,0xa67,0x513, + 0xa66,0x200f9,0xa68,0x200f8,0xa68,0x700f5,0x5a,0xa69,0xa61,0x4e7,0xa67,0xa62, + 0x300f7,0xa78,0x0,0x400fa,0xa69,0xa6a,0xa78,0x200f8,0xa6a,0x50051,0x1b,0xa6c, + 0x47b,0x1,0x50051,0x1b,0xa6e,0xd53,0x1,0x500af,0x5a,0xa6f,0xa6c,0xa6e, + 0x300f7,0xa76,0x0,0x400fa,0xa6f,0xa70,0xa76,0x200f8,0xa70,0x50051,0x1b,0xa74, + 0xa5c,0x1,0x500b1,0x5a,0xa75,0xa6c,0xa74,0x200f9,0xa76,0x200f8,0xa76,0x700f5, + 0x5a,0xa77,0xa6f,0xa6a,0xa75,0xa70,0x200f9,0xa78,0x200f8,0xa78,0x700f5,0x5a, + 0xa79,0xa69,0xa68,0xa77,0xa76,0x300f7,0x4f1,0x0,0x400fa,0xa79,0x4ec,0x4f1, + 0x200f8,0x4ec,0x4003d,0x81,0x4ef,0x4e9,0x50051,0x1c,0xbb9,0x4ef,0x0,0x50051, + 0x1c,0xbba,0x4ef,0x1,0x50082,0x1c,0xa9e,0x47b,0xbb9,0x4006f,0x8,0xa9f, + 0xa9e,0x50081,0x8,0xaa1,0xa9f,0x159,0x4006f,0x8,0xaa4,0xbba,0x50088,0x8, + 0xaa5,0xaa1,0xaa4,0x50041,0xcc,0xaa9,0xca,0xcb,0x4003d,0x1c,0xaaa,0xaa9, + 0x4006f,0x8,0xa89,0xaaa,0x50041,0xcc,0xaad,0xca,0x100c,0x4003d,0x1c,0xaae, + 0xaad,0x4006f,0x8,0xa8b,0xaae,0x50088,0x8,0xa8c,0xa89,0xa8b,0x50085,0x8, + 0xa8d,0xaa5,0xa8c,0x4003d,0xf7,0xab1,0x106,0x4003d,0xfb,0xab2,0xfd,0x50056, + 0xff,0xab3,0xab1,0xab2,0x70058,0x30,0xab5,0xab3,0xa8d,0x2,0xb7,0x7004f, + 0x8,0xa90,0xab5,0xab5,0x0,0x1,0x8000c,0x8,0xabd,0x1,0x2b,0xa90, + 0x1b0,0xfa1,0x50051,0x6,0xa93,0xabd,0x0,0x50051,0x6,0xa94,0xabd,0x1, + 0x70050,0x30,0xa95,0xa93,0xa94,0xb7,0xba,0x4003d,0x14d,0xac7,0x14f,0x40063, + 0xac7,0x47b,0xa95,0x200f9,0x4f1,0x200f8,0x4f1,0x60041,0x82,0x4f3,0x48d,0x15d, + 0xd1,0x4003d,0x81,0x4f4,0x4f3,0x50051,0x1c,0xd60,0x4f4,0x0,0x50051,0x1c, + 0xd61,0x4f4,0x1,0x50080,0x1c,0xad1,0xd60,0xd61,0x50051,0x1b,0xad5,0xd60, + 0x0,0x500af,0x5a,0xad6,0x513,0xad5,0x300f7,0xadd,0x0,0x400fa,0xad6,0xad7, + 0xadd,0x200f8,0xad7,0x50051,0x1b,0xadb,0xad1,0x0,0x500b1,0x5a,0xadc,0x513, + 0xadb,0x200f9,0xadd,0x200f8,0xadd,0x700f5,0x5a,0xade,0xad6,0x4f1,0xadc,0xad7, + 0x300f7,0xaed,0x0,0x400fa,0xade,0xadf,0xaed,0x200f8,0xadf,0x50051,0x1b,0xae1, + 0x47b,0x1,0x50051,0x1b,0xae3,0xd60,0x1,0x500af,0x5a,0xae4,0xae1,0xae3, + 0x300f7,0xaeb,0x0,0x400fa,0xae4,0xae5,0xaeb,0x200f8,0xae5,0x50051,0x1b,0xae9, + 0xad1,0x1,0x500b1,0x5a,0xaea,0xae1,0xae9,0x200f9,0xaeb,0x200f8,0xaeb,0x700f5, + 0x5a,0xaec,0xae4,0xadf,0xaea,0xae5,0x200f9,0xaed,0x200f8,0xaed,0x700f5,0x5a, + 0xaee,0xade,0xadd,0xaec,0xaeb,0x300f7,0x4fb,0x0,0x400fa,0xaee,0x4f6,0x4fb, + 0x200f8,0x4f6,0x4003d,0x81,0x4f9,0x4f3,0x50051,0x1c,0xbb5,0x4f9,0x0,0x50051, + 0x1c,0xbb6,0x4f9,0x1,0x50082,0x1c,0xb09,0x47b,0xbb5,0x4006f,0x8,0xb0a, + 0xb09,0x50081,0x8,0xb0c,0xb0a,0x159,0x4006f,0x8,0xb0f,0xbb6,0x50088,0x8, + 0xb10,0xb0c,0xb0f,0x4003d,0xf7,0xb15,0xf9,0x4003d,0xfb,0xb16,0xfd,0x50056, + 0xff,0xb17,0xb15,0xb16,0x70058,0x30,0xb19,0xb17,0xb10,0x2,0xb7,0x50051, + 0x6,0xafc,0xb19,0x0,0x50051,0x6,0xafd,0xb19,0x1,0x50051,0x6,0xafe, + 0xb19,0x2,0x70050,0x30,0xaff,0xafc,0xafd,0xafe,0xba,0x4003d,0x14d,0xb1c, + 0x14f,0x40063,0xb1c,0x47b,0xaff,0x200f9,0x4fb,0x200f8,0x4fb,0x60041,0x82,0x4fd, + 0x48d,0x15d,0x15d,0x4003d,0x81,0x4fe,0x4fd,0x50051,0x1c,0xd6d,0x4fe,0x0, + 0x50051,0x1c,0xd6e,0x4fe,0x1,0x50080,0x1c,0xb26,0xd6d,0xd6e,0x50051,0x1b, + 0xb2a,0xd6d,0x0,0x500af,0x5a,0xb2b,0x513,0xb2a,0x300f7,0xb32,0x0,0x400fa, + 0xb2b,0xb2c,0xb32,0x200f8,0xb2c,0x50051,0x1b,0xb30,0xb26,0x0,0x500b1,0x5a, + 0xb31,0x513,0xb30,0x200f9,0xb32,0x200f8,0xb32,0x700f5,0x5a,0xb33,0xb2b,0x4fb, + 0xb31,0xb2c,0x300f7,0xb42,0x0,0x400fa,0xb33,0xb34,0xb42,0x200f8,0xb34,0x50051, + 0x1b,0xb36,0x47b,0x1,0x50051,0x1b,0xb38,0xd6d,0x1,0x500af,0x5a,0xb39, + 0xb36,0xb38,0x300f7,0xb40,0x0,0x400fa,0xb39,0xb3a,0xb40,0x200f8,0xb3a,0x50051, + 0x1b,0xb3e,0xb26,0x1,0x500b1,0x5a,0xb3f,0xb36,0xb3e,0x200f9,0xb40,0x200f8, + 0xb40,0x700f5,0x5a,0xb41,0xb39,0xb34,0xb3f,0xb3a,0x200f9,0xb42,0x200f8,0xb42, + 0x700f5,0x5a,0xb43,0xb33,0xb32,0xb41,0xb40,0x300f7,0x505,0x0,0x400fa,0xb43, + 0x500,0x505,0x200f8,0x500,0x4003d,0x81,0x503,0x4fd,0x50051,0x1c,0xbaa,0x503, + 0x0,0x50051,0x1c,0xbab,0x503,0x1,0x50082,0x1c,0xb63,0x47b,0xbaa,0x4006f, + 0x8,0xb64,0xb63,0x50081,0x8,0xb66,0xb64,0x159,0x4006f,0x8,0xb69,0xbab, + 0x50088,0x8,0xb6a,0xb66,0xb69,0x4003d,0xf7,0xb8f,0x144,0x4003d,0xfb,0xb90, + 0xfd,0x50056,0xff,0xb91,0xb8f,0xb90,0x70058,0x30,0xb93,0xb91,0xb6a,0x2, + 0xb7,0x7004f,0x8,0xb94,0xb93,0xb93,0x0,0x1,0x6000c,0x8,0xb78,0x1, + 0x4,0xb94,0x5008e,0x8,0xb7a,0xb78,0x39e,0x50051,0x6,0xb7b,0xb7a,0x0, + 0x50051,0x6,0xb7c,0xb7a,0x1,0x70050,0x30,0xb7d,0xb7b,0xb7c,0xb7,0xba, + 0x50041,0xde,0xb97,0xca,0x100d,0x4003d,0x1b,0xb98,0xb97,0x500aa,0x5a,0xb55, + 0xb98,0xd1,0x300f7,0xb59,0x0,0x400fa,0xb55,0xb56,0xb59,0x200f8,0xb56,0x4003d, + 0xf7,0xb9b,0x13c,0x4003d,0xfb,0xb9c,0xfd,0x50056,0xff,0xb9d,0xb9b,0xb9c, + 0x70058,0x30,0xb9f,0xb9d,0xb6a,0x2,0xb7,0x200f9,0xb59,0x200f8,0xb59,0x700f5, + 0x30,0xf3e,0xb7d,0x500,0xb9f,0xb56,0x4003d,0x14d,0xba1,0x14f,0x40063,0xba1, + 0x47b,0xf3e,0x200f9,0x505,0x200f8,0x505,0x100fd,0x10038, +}; +static const char *fi_debug_view_pass_0_cb_names[] = {"cbFI"}; +static const uint32_t fi_debug_view_pass_0_cb_bind[] = {10}; +static const uint32_t fi_debug_view_pass_0_cb_count[] = {1}; +static const uint32_t fi_debug_view_pass_0_cb_space[] = {0}; +static const char *fi_debug_view_pass_0_srv_tex_names[] = {"r_game_motion_vector_field_x", "r_game_motion_vector_field_y", "r_optical_flow_motion_vector_field_x", "r_optical_flow_motion_vector_field_y", "r_disocclusion_mask", "r_present_backbuffer", "r_inpainting_pyramid", "r_current_interpolation_source", "r_input_distortion_field"}; +static const uint32_t fi_debug_view_pass_0_srv_tex_bind[] = {0, 1, 2, 3, 4, 5, 6, 7, 8}; +static const uint32_t fi_debug_view_pass_0_srv_tex_count[] = {1, 1, 1, 1, 1, 1, 1, 1, 1}; +static const uint32_t fi_debug_view_pass_0_srv_tex_space[] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; +static const char *fi_debug_view_pass_0_uav_tex_names[] = {"rw_output"}; +static const uint32_t fi_debug_view_pass_0_uav_tex_bind[] = {9}; +static const uint32_t fi_debug_view_pass_0_uav_tex_count[] = {1}; +static const uint32_t fi_debug_view_pass_0_uav_tex_space[] = {0}; +static const char *fi_debug_view_pass_0_sampler_names[] = {"s_LinearClamp"}; +static const uint32_t fi_debug_view_pass_0_sampler_bind[] = {1000}; +static const uint32_t fi_debug_view_pass_0_sampler_count[] = {1}; +static const uint32_t fi_debug_view_pass_0_sampler_space[] = {0}; + +static const uint32_t fi_reconstruct_and_dilate_pass_1_spv[1193] = { + 0x7230203,0x10500,0x8000b,0x36a,0x0,0x20011,0x1,0x20011,0x31,0x6000b,0x1,0x4c534c47, + 0x6474732e,0x3035342e,0x0,0x3000e,0x0,0x1,0xc000f,0x5,0x4,0x6e69616d,0x0,0x61, + 0x75,0x7e,0x8c,0x96,0xa2,0x1a6,0x60010,0x4,0x11,0x8,0x8,0x1, + 0x30003,0x2,0x1c2,0xb0004,0x455f4c47,0x735f5458,0x6c706d61,0x656c7265,0x745f7373,0x75747865,0x665f6572,0x74636e75, + 0x736e6f69,0x0,0xb0004,0x455f4c47,0x735f5458,0x65646168,0x78655f72,0x63696c70,0x615f7469,0x68746972,0x6974656d,0x79745f63, + 0x736570,0xa0004,0x475f4c47,0x4c474f4f,0x70635f45,0x74735f70,0x5f656c79,0x656e696c,0x7269645f,0x69746365,0x6576,0x80004, + 0x475f4c47,0x4c474f4f,0x6e695f45,0x64756c63,0x69645f65,0x74636572,0x657669,0x40005,0x4,0x6e69616d,0x0,0x40005, + 0x5f,0x49466263,0x745f,0x60006,0x5f,0x0,0x646e6572,0x69537265,0x657a,0x60006,0x5f,0x1, + 0x70736964,0x5379616c,0x657a69,0x80006,0x5f,0x2,0x746f4d66,0x566e6f69,0x6f746365,0x61635372,0x656c,0x40005, + 0x61,0x49466263,0x0,0x60005,0x75,0x6e695f72,0x5f747570,0x74706564,0x68,0x80005,0x7e,0x6e695f72, + 0x5f747570,0x69746f6d,0x765f6e6f,0x6f746365,0x7372,0x90005,0x8c,0x645f7772,0x74616c69,0x6d5f6465,0x6f69746f,0x65765f6e, + 0x726f7463,0x73,0x70005,0x96,0x645f7772,0x74616c69,0x645f6465,0x68747065,0x0,0xc0005,0xa2,0x725f7772, + 0x6e6f6365,0x75727473,0x64657463,0x7065645f,0x705f6874,0x69766572,0x5f73756f,0x6d617266,0x65,0x80005,0x1a6,0x475f6c67, + 0x61626f6c,0x766e496c,0x7461636f,0x496e6f69,0x44,0x30047,0x5f,0x2,0x50048,0x5f,0x0,0x23, + 0x0,0x50048,0x5f,0x1,0x23,0x8,0x50048,0x5f,0x2,0x23,0xa8,0x40047, + 0x61,0x21,0x5,0x40047,0x61,0x22,0x0,0x40047,0x75,0x21,0x1,0x40047, + 0x75,0x22,0x0,0x40047,0x7e,0x21,0x0,0x40047,0x7e,0x22,0x0,0x40047, + 0x8c,0x21,0x3,0x40047,0x8c,0x22,0x0,0x40047,0x96,0x21,0x4,0x40047, + 0x96,0x22,0x0,0x40047,0xa2,0x21,0x2,0x40047,0xa2,0x22,0x0,0x40047, + 0x1a6,0xb,0x1c,0x40047,0x1bd,0xb,0x19,0x30047,0x1eb,0x18,0x30047,0x1ef, + 0x18,0x20013,0x2,0x30021,0x3,0x2,0x30016,0x6,0x20,0x40020,0x7,0x7, + 0x6,0x40015,0x8,0x20,0x0,0x40017,0xd,0x6,0x2,0x40015,0x16,0x20, + 0x1,0x40017,0x17,0x16,0x2,0x40020,0x1d,0x7,0x17,0x4002b,0x8,0x34, + 0x4,0x4001c,0x35,0x17,0x34,0x4001c,0x36,0x6,0x34,0x20014,0x3d,0x40017, + 0x5d,0x6,0x4,0x5001e,0x5f,0x17,0x17,0xd,0x40020,0x60,0x2,0x5f, + 0x4003b,0x60,0x61,0x2,0x40020,0x63,0x2,0xd,0x4002b,0x16,0x68,0x0, + 0x40020,0x69,0x2,0x17,0x4002b,0x16,0x6e,0x1,0x90019,0x73,0x6,0x1, + 0x0,0x0,0x0,0x1,0x0,0x40020,0x74,0x0,0x73,0x4003b,0x74,0x75, + 0x0,0x4002b,0x8,0x79,0x0,0x4003b,0x74,0x7e,0x0,0x90019,0x8a,0x6, + 0x1,0x0,0x0,0x0,0x2,0x7,0x40020,0x8b,0x0,0x8a,0x4003b,0x8b, + 0x8c,0x0,0x4002b,0x6,0x90,0x0,0x90019,0x94,0x6,0x1,0x0,0x0, + 0x0,0x2,0x3,0x40020,0x95,0x0,0x94,0x4003b,0x95,0x96,0x0,0x90019, + 0xa0,0x8,0x1,0x0,0x0,0x0,0x2,0x21,0x40020,0xa1,0x0,0xa0, + 0x4003b,0xa1,0xa2,0x0,0x40020,0xa5,0xb,0x8,0x4002b,0x8,0xa7,0x1, + 0x4002b,0x6,0xae,0x3f000000,0x5002c,0xd,0xaf,0xae,0xae,0x5002c,0x17,0xbc, + 0x68,0x68,0x5002c,0x17,0xbe,0x6e,0x68,0x5002c,0x17,0xc0,0x68,0x6e, + 0x5002c,0x17,0xc3,0x6e,0x6e,0x4002b,0x6,0xc5,0x3f800000,0x40017,0xe6,0x8, + 0x2,0x40017,0xea,0x3d,0x2,0x4002b,0x6,0xf4,0x3dcccccd,0x4002b,0x16,0x113, + 0x4,0x4002b,0x6,0x11e,0x3a83126f,0x4002b,0x16,0x13c,0x9,0x4002b,0x8,0x140, + 0x9,0x4001c,0x141,0x17,0x140,0x4002b,0x16,0x142,0xffffffff,0x5002c,0x17,0x143, + 0x68,0x142,0x5002c,0x17,0x144,0x142,0x68,0x5002c,0x17,0x145,0x142,0x6e, + 0x5002c,0x17,0x146,0x142,0x142,0x5002c,0x17,0x147,0x6e,0x142,0xc002c,0x141, + 0x148,0xbc,0xbe,0xc0,0x143,0x144,0x145,0xc3,0x146,0x147,0x40020,0x14a, + 0x7,0x141,0x4001c,0x14f,0x6,0x140,0x40020,0x150,0x7,0x14f,0x40017,0x1a4, + 0x8,0x3,0x40020,0x1a5,0x1,0x1a4,0x4003b,0x1a5,0x1a6,0x1,0x4002b,0x8, + 0x1bc,0x8,0x6002c,0x1a4,0x1bd,0x1bc,0x1bc,0xa7,0x40020,0x2eb,0x7,0x35, + 0x40020,0x2ed,0x7,0x36,0x7002c,0x35,0x35d,0xbc,0xbe,0xc0,0xc3,0x4002b, + 0x8,0x369,0x2,0x50036,0x2,0x4,0x0,0x3,0x200f8,0x5,0x4003b,0x2ed, + 0x307,0x7,0x4003b,0x2eb,0x306,0x7,0x5003b,0x14a,0x1eb,0x7,0x148,0x4003b, + 0x150,0x1ec,0x7,0x5003b,0x14a,0x1ef,0x7,0x148,0x4003d,0x1a4,0x1a7,0x1a6, + 0x7004f,0xe6,0x1a8,0x1a7,0x1a7,0x0,0x1,0x4007c,0x17,0x1a9,0x1a8,0x50041, + 0x69,0x1e7,0x61,0x68,0x4003d,0x17,0x1e8,0x1e7,0x3003e,0x1eb,0x148,0x3003e, + 0x1ef,0x148,0x200f9,0x1f4,0x200f8,0x1f4,0x700f5,0x16,0x33a,0x68,0x5,0x204, + 0x1f8,0x500b1,0x3d,0x1f7,0x33a,0x13c,0x400f6,0x205,0x1f8,0x0,0x400fa,0x1f7, + 0x1f8,0x205,0x200f8,0x1f8,0x50041,0x1d,0x1fb,0x1eb,0x33a,0x4003d,0x17,0x1fc, + 0x1fb,0x50080,0x17,0x1fd,0x1a9,0x1fc,0x4003d,0x73,0x228,0x75,0x7005f,0x5d, + 0x22a,0x228,0x1fd,0x2,0x68,0x50051,0x6,0x22b,0x22a,0x0,0x50041,0x7, + 0x201,0x1ec,0x33a,0x3003e,0x201,0x22b,0x50080,0x16,0x204,0x33a,0x6e,0x200f9, + 0x1f4,0x200f8,0x205,0x50041,0x7,0x207,0x1ec,0x68,0x4003d,0x6,0x208,0x207, + 0x200f9,0x209,0x200f8,0x209,0x700f5,0x17,0x33e,0x1a9,0x205,0x34e,0x222,0x700f5, + 0x6,0x33d,0x208,0x205,0x34c,0x222,0x700f5,0x16,0x33c,0x6e,0x205,0x224, + 0x222,0x500b1,0x3d,0x20c,0x33c,0x13c,0x400f6,0x225,0x222,0x0,0x400fa,0x20c, + 0x20d,0x225,0x200f8,0x20d,0x50041,0x1d,0x210,0x1ef,0x33c,0x4003d,0x17,0x211, + 0x210,0x50080,0x17,0x212,0x1a9,0x211,0x4007c,0xe6,0x230,0x212,0x4007c,0xe6, + 0x232,0x1e8,0x500b0,0xea,0x233,0x230,0x232,0x4009b,0x3d,0x234,0x233,0x300f7, + 0x221,0x0,0x400fa,0x234,0x216,0x221,0x200f8,0x216,0x50041,0x7,0x218,0x1ec, + 0x33c,0x4003d,0x6,0x219,0x218,0x500ba,0x3d,0x21c,0x219,0x33d,0x50050,0xea, + 0x35e,0x21c,0x21c,0x600a9,0x17,0x35f,0x35e,0x212,0x33e,0x600a9,0x6,0x360, + 0x21c,0x219,0x33d,0x200f9,0x221,0x200f8,0x221,0x700f5,0x17,0x34e,0x33e,0x20d, + 0x35f,0x216,0x700f5,0x6,0x34c,0x33d,0x20d,0x360,0x216,0x200f9,0x222,0x200f8, + 0x222,0x50080,0x16,0x224,0x33c,0x6e,0x200f9,0x209,0x200f8,0x225,0x4003d,0x73, + 0x239,0x7e,0x7005f,0x5d,0x23b,0x239,0x33e,0x2,0x68,0x7004f,0xd,0x23c, + 0x23b,0x23b,0x0,0x1,0x50041,0x63,0x243,0x61,0x369,0x4003d,0xd,0x244, + 0x243,0x50085,0xd,0x23f,0x23c,0x244,0x4003d,0x94,0x246,0x96,0x70050,0x5d, + 0x249,0x33d,0x90,0x90,0x90,0x40063,0x246,0x1a9,0x249,0x4003d,0x8a,0x24b, + 0x8c,0x50051,0x6,0x24e,0x23f,0x0,0x50051,0x6,0x24f,0x23f,0x1,0x70050, + 0x5d,0x250,0x24e,0x24f,0x90,0x90,0x40063,0x24b,0x1a9,0x250,0x50041,0x69, + 0x29a,0x61,0x6e,0x4003d,0x17,0x29b,0x29a,0x4006f,0xd,0x265,0x29b,0x50085, + 0xd,0x266,0x23f,0x265,0x6000c,0x6,0x267,0x1,0x42,0x266,0x500ba,0x3d, + 0x268,0x267,0xf4,0x600a9,0x6,0x269,0x268,0xc5,0x90,0x5008e,0xd,0x26b, + 0x23f,0x269,0x4006f,0xd,0x26d,0x1a9,0x50081,0xd,0x26f,0x26d,0xaf,0x4006f, + 0xd,0x271,0x1e8,0x50088,0xd,0x272,0x26f,0x271,0x50081,0xd,0x275,0x272, + 0x26b,0x50085,0xd,0x2a9,0x275,0x271,0x50083,0xd,0x2aa,0x2a9,0xaf,0x6000c, + 0xd,0x2ac,0x1,0x8,0x2aa,0x4006e,0x17,0x2ad,0x2ac,0x6000c,0xd,0x2d5, + 0x1,0xa,0x2aa,0x50051,0x6,0x2b6,0x2d5,0x0,0x50083,0x6,0x2b7,0xc5, + 0x2b6,0x50051,0x6,0x2b9,0x2d5,0x1,0x50083,0x6,0x2ba,0xc5,0x2b9,0x50085, + 0x6,0x2bb,0x2b7,0x2ba,0x50085,0x6,0x2c2,0x2b6,0x2ba,0x50085,0x6,0x2c9, + 0x2b7,0x2b9,0x50085,0x6,0x2cf,0x2b6,0x2b9,0x70050,0x36,0x339,0x2bb,0x2c2, + 0x2c9,0x2cf,0x3003e,0x306,0x35d,0x3003e,0x307,0x339,0x200f9,0x279,0x200f8,0x279, + 0x700f5,0x16,0x341,0x68,0x225,0x296,0x294,0x500b1,0x3d,0x27c,0x341,0x113, + 0x400f6,0x297,0x294,0x0,0x400fa,0x27c,0x27d,0x297,0x200f8,0x27d,0x50041,0x1d, + 0x30c,0x306,0x341,0x4003d,0x17,0x280,0x30c,0x50041,0x7,0x30d,0x307,0x341, + 0x4003d,0x6,0x283,0x30d,0x500ba,0x3d,0x285,0x283,0x11e,0x300f7,0x293,0x0, + 0x400fa,0x285,0x286,0x293,0x200f8,0x286,0x50080,0x17,0x28a,0x2ad,0x280,0x4007c, + 0xe6,0x2d9,0x28a,0x4007c,0xe6,0x2db,0x1e8,0x500b0,0xea,0x2dc,0x2d9,0x2db, + 0x4009b,0x3d,0x2dd,0x2dc,0x300f7,0x292,0x0,0x400fa,0x2dd,0x28e,0x292,0x200f8, + 0x28e,0x4007c,0x8,0x2ea,0x33d,0x6003c,0xa5,0x2e5,0xa2,0x28a,0x79,0x700ef, + 0x8,0x2e6,0x2e5,0xa7,0x79,0x2ea,0x200f9,0x292,0x200f8,0x292,0x200f9,0x293, + 0x200f8,0x293,0x200f9,0x294,0x200f8,0x294,0x50080,0x16,0x296,0x341,0x6e,0x200f9, + 0x279,0x200f8,0x297,0x100fd,0x10038, +}; +static const char *fi_reconstruct_and_dilate_pass_1_cb_names[] = {"cbFI"}; +static const uint32_t fi_reconstruct_and_dilate_pass_1_cb_bind[] = {5}; +static const uint32_t fi_reconstruct_and_dilate_pass_1_cb_count[] = {1}; +static const uint32_t fi_reconstruct_and_dilate_pass_1_cb_space[] = {0}; +static const char *fi_reconstruct_and_dilate_pass_1_srv_tex_names[] = {"r_input_motion_vectors", "r_input_depth"}; +static const uint32_t fi_reconstruct_and_dilate_pass_1_srv_tex_bind[] = {0, 1}; +static const uint32_t fi_reconstruct_and_dilate_pass_1_srv_tex_count[] = {1, 1}; +static const uint32_t fi_reconstruct_and_dilate_pass_1_srv_tex_space[] = {0, 0}; +static const char *fi_reconstruct_and_dilate_pass_1_uav_tex_names[] = {"rw_reconstructed_depth_previous_frame", "rw_dilated_motion_vectors", "rw_dilated_depth"}; +static const uint32_t fi_reconstruct_and_dilate_pass_1_uav_tex_bind[] = {2, 3, 4}; +static const uint32_t fi_reconstruct_and_dilate_pass_1_uav_tex_count[] = {1, 1, 1}; +static const uint32_t fi_reconstruct_and_dilate_pass_1_uav_tex_space[] = {0, 0, 0}; + +static const uint32_t fi_setup_pass_1_spv[695] = { + 0x7230203,0x10500,0x8000b,0x140,0x0,0x20011,0x1,0x20011,0x31,0x6000b,0x1,0x4c534c47, + 0x6474732e,0x3035342e,0x0,0x3000e,0x0,0x1,0xe000f,0x5,0x4,0x6e69616d,0x0,0x3c, + 0x47,0x56,0x60,0x65,0x6a,0x6f,0x77,0xb7,0x60010,0x4,0x11,0x8, + 0x8,0x1,0x30003,0x2,0x1c2,0xb0004,0x455f4c47,0x735f5458,0x6c706d61,0x656c7265,0x745f7373,0x75747865, + 0x665f6572,0x74636e75,0x736e6f69,0x0,0xb0004,0x455f4c47,0x735f5458,0x65646168,0x78655f72,0x63696c70,0x615f7469,0x68746972, + 0x6974656d,0x79745f63,0x736570,0xa0004,0x475f4c47,0x4c474f4f,0x70635f45,0x74735f70,0x5f656c79,0x656e696c,0x7269645f,0x69746365, + 0x6576,0x80004,0x475f4c47,0x4c474f4f,0x6e695f45,0x64756c63,0x69645f65,0x74636572,0x657669,0x40005,0x4,0x6e69616d, + 0x0,0x40005,0x3a,0x49466263,0x745f,0x50006,0x3a,0x0,0x65736572,0x74,0x40005,0x3c, + 0x49466263,0x0,0x70005,0x47,0x706f5f72,0x61636974,0x6c665f6c,0x735f776f,0x6463,0x80005,0x56,0x645f7772, + 0x636f7369,0x73756c63,0x5f6e6f69,0x6b73616d,0x0,0xa0005,0x60,0x675f7772,0x5f656d61,0x69746f6d,0x765f6e6f,0x6f746365, + 0x69665f72,0x5f646c65,0x78,0xa0005,0x65,0x675f7772,0x5f656d61,0x69746f6d,0x765f6e6f,0x6f746365,0x69665f72,0x5f646c65, + 0x79,0xc0005,0x6a,0x6f5f7772,0x63697470,0x665f6c61,0x5f776f6c,0x69746f6d,0x765f6e6f,0x6f746365,0x69665f72,0x5f646c65, + 0x78,0xc0005,0x6f,0x6f5f7772,0x63697470,0x665f6c61,0x5f776f6c,0x69746f6d,0x765f6e6f,0x6f746365,0x69665f72,0x5f646c65, + 0x79,0xa0005,0x75,0x6d617246,0x746e4965,0x6f707265,0x6974616c,0x57526e6f,0x6e756f43,0x73726574,0x745f,0x50006, + 0x75,0x0,0x61746164,0x0,0x50005,0x77,0x635f7772,0x746e756f,0x737265,0x80005,0xb7,0x475f6c67, + 0x61626f6c,0x766e496c,0x7461636f,0x496e6f69,0x44,0x30047,0x3a,0x2,0x50048,0x3a,0x0,0x23, + 0x2c,0x40047,0x3c,0x21,0x7,0x40047,0x3c,0x22,0x0,0x40047,0x47,0x21, + 0x0,0x40047,0x47,0x22,0x0,0x40047,0x56,0x21,0x5,0x40047,0x56,0x22, + 0x0,0x40047,0x60,0x21,0x1,0x40047,0x60,0x22,0x0,0x40047,0x65,0x21, + 0x2,0x40047,0x65,0x22,0x0,0x40047,0x6a,0x21,0x3,0x40047,0x6a,0x22, + 0x0,0x40047,0x6f,0x21,0x4,0x40047,0x6f,0x22,0x0,0x40047,0x74,0x6, + 0x4,0x30047,0x75,0x2,0x40048,0x75,0x0,0x17,0x50048,0x75,0x0,0x23, + 0x0,0x30047,0x77,0x17,0x40047,0x77,0x21,0x6,0x40047,0x77,0x22,0x0, + 0x40047,0xb7,0xb,0x1c,0x40047,0xd0,0xb,0x19,0x20013,0x2,0x30021,0x3, + 0x2,0x20014,0x6,0x40015,0xc,0x20,0x1,0x40017,0xd,0xc,0x2,0x30016, + 0xf,0x20,0x40015,0x17,0x20,0x0,0x40017,0x38,0xf,0x4,0x3001e,0x3a, + 0xc,0x40020,0x3b,0x2,0x3a,0x4003b,0x3b,0x3c,0x2,0x40020,0x3e,0x2, + 0xc,0x4002b,0xc,0x41,0x1,0x90019,0x45,0x17,0x1,0x0,0x0,0x0, + 0x1,0x0,0x40020,0x46,0x0,0x45,0x4003b,0x46,0x47,0x0,0x4002b,0xc, + 0x49,0x0,0x5002c,0xd,0x4a,0x41,0x49,0x40017,0x4b,0x17,0x4,0x4002b, + 0x17,0x4d,0x0,0x4002b,0x17,0x4f,0xf,0x90019,0x54,0xf,0x1,0x0, + 0x0,0x0,0x2,0xd,0x40020,0x55,0x0,0x54,0x4003b,0x55,0x56,0x0, + 0x4002b,0xf,0x5a,0x0,0x90019,0x5e,0x17,0x1,0x0,0x0,0x0,0x2, + 0x21,0x40020,0x5f,0x0,0x5e,0x4003b,0x5f,0x60,0x0,0x4003b,0x5f,0x65, + 0x0,0x4003b,0x5f,0x6a,0x0,0x4003b,0x5f,0x6f,0x0,0x3001d,0x74,0x17, + 0x3001e,0x75,0x74,0x40020,0x76,0xc,0x75,0x4003b,0x76,0x77,0xc,0x40020, + 0x79,0xc,0x17,0x5002c,0xd,0x85,0x49,0x49,0x40017,0x86,0x6,0x2, + 0x4002b,0x17,0x9b,0x1,0x40017,0xb5,0x17,0x3,0x40020,0xb6,0x1,0xb5, + 0x4003b,0xb6,0xb7,0x1,0x40017,0xb8,0x17,0x2,0x4002b,0x17,0xcf,0x8, + 0x6002c,0xb5,0xd0,0xcf,0xcf,0x9b,0x7002c,0x4b,0x13e,0x4d,0x4d,0x4d, + 0x4d,0x7002c,0x38,0x13f,0x5a,0x5a,0x5a,0x5a,0x50036,0x2,0x4,0x0, + 0x3,0x200f8,0x5,0x4003d,0xb5,0xb9,0xb7,0x7004f,0xb8,0xba,0xb9,0xb9, + 0x0,0x1,0x4007c,0xd,0xbb,0xba,0x60041,0x79,0x105,0x77,0x49,0x49, + 0x3003e,0x105,0x4d,0x500aa,0x86,0xe6,0xbb,0x85,0x4009b,0x6,0xe7,0xe6, + 0x300f7,0xf7,0x0,0x400fa,0xe7,0xe8,0xf7,0x200f8,0xe8,0x50041,0x3e,0x109, + 0x3c,0x4d,0x4003d,0xc,0x10a,0x109,0x500aa,0x6,0x10b,0x10a,0x41,0x400a8, + 0x6,0xea,0x10b,0x300f7,0xed,0x0,0x400fa,0xea,0xeb,0xed,0x200f8,0xeb, + 0x4003d,0x45,0x10e,0x47,0x7005f,0x4b,0x10f,0x10e,0x4a,0x2002,0x49,0x50051, + 0x17,0x110,0x10f,0x0,0x500c7,0x17,0x111,0x110,0x4f,0x500ab,0x6,0x112, + 0x111,0x4d,0x200f9,0xed,0x200f8,0xed,0x700f5,0x6,0xee,0x10b,0xe8,0x112, + 0xeb,0x300f7,0xf6,0x0,0x400fa,0xee,0xef,0xf1,0x200f8,0xef,0x60041,0x79, + 0x116,0x77,0x49,0x41,0x3003e,0x116,0x4d,0x200f9,0xf6,0x200f8,0xf1,0x60041, + 0x79,0x11a,0x77,0x49,0x41,0x4003d,0x17,0x11b,0x11a,0x50080,0x17,0xf4, + 0x11b,0x9b,0x3003e,0x11a,0xf4,0x200f9,0xf6,0x200f8,0xf6,0x200f9,0xf7,0x200f8, + 0xf7,0x4003d,0x5e,0x121,0x60,0x50063,0x121,0xbb,0x13e,0x2000,0x4003d,0x5e, + 0x126,0x65,0x50063,0x126,0xbb,0x13e,0x2000,0x4003d,0x5e,0x12b,0x6a,0x50063, + 0x12b,0xbb,0x13e,0x2000,0x4003d,0x5e,0x130,0x6f,0x50063,0x130,0xbb,0x13e, + 0x2000,0x4003d,0x54,0x135,0x56,0x40063,0x135,0xbb,0x13f,0x100fd,0x10038, +}; +static const char *fi_setup_pass_1_cb_names[] = {"cbFI"}; +static const uint32_t fi_setup_pass_1_cb_bind[] = {7}; +static const uint32_t fi_setup_pass_1_cb_count[] = {1}; +static const uint32_t fi_setup_pass_1_cb_space[] = {0}; +static const char *fi_setup_pass_1_srv_tex_names[] = {"r_optical_flow_scd"}; +static const uint32_t fi_setup_pass_1_srv_tex_bind[] = {0}; +static const uint32_t fi_setup_pass_1_srv_tex_count[] = {1}; +static const uint32_t fi_setup_pass_1_srv_tex_space[] = {0}; +static const char *fi_setup_pass_1_uav_tex_names[] = {"rw_game_motion_vector_field_x", "rw_game_motion_vector_field_y", "rw_optical_flow_motion_vector_field_x", "rw_optical_flow_motion_vector_field_y", "rw_disocclusion_mask"}; +static const uint32_t fi_setup_pass_1_uav_tex_bind[] = {1, 2, 3, 4, 5}; +static const uint32_t fi_setup_pass_1_uav_tex_count[] = {1, 1, 1, 1, 1}; +static const uint32_t fi_setup_pass_1_uav_tex_space[] = {0, 0, 0, 0, 0}; +static const char *fi_setup_pass_1_uav_buf_names[] = {"rw_counters"}; +static const uint32_t fi_setup_pass_1_uav_buf_bind[] = {6}; +static const uint32_t fi_setup_pass_1_uav_buf_count[] = {1}; +static const uint32_t fi_setup_pass_1_uav_buf_space[] = {0}; + +static const uint32_t fi_reconstruct_previous_depth_pass_1_spv[790] = { + 0x7230203,0x10500,0x8000b,0x284,0x0,0x20011,0x1,0x6000b,0x1,0x4c534c47,0x6474732e,0x3035342e, + 0x0,0x3000e,0x0,0x1,0xc000f,0x5,0x4,0x6e69616d,0x0,0x51,0x5a,0x61, + 0x69,0x6d,0x7d,0x134,0x60010,0x4,0x11,0x8,0x8,0x1,0x30003,0x2, + 0x1c2,0xb0004,0x455f4c47,0x735f5458,0x6c706d61,0x656c7265,0x745f7373,0x75747865,0x665f6572,0x74636e75,0x736e6f69,0x0, + 0xb0004,0x455f4c47,0x735f5458,0x65646168,0x78655f72,0x63696c70,0x615f7469,0x68746972,0x6974656d,0x79745f63,0x736570,0xa0004, + 0x475f4c47,0x4c474f4f,0x70635f45,0x74735f70,0x5f656c79,0x656e696c,0x7269645f,0x69746365,0x6576,0x80004,0x475f4c47,0x4c474f4f, + 0x6e695f45,0x64756c63,0x69645f65,0x74636572,0x657669,0x40005,0x4,0x6e69616d,0x0,0x40005,0x4f,0x49466263, + 0x745f,0x60006,0x4f,0x0,0x646e6572,0x69537265,0x657a,0x40005,0x51,0x49466263,0x0,0x90005, + 0x5a,0x69645f72,0x6574616c,0x6f6d5f64,0x6e6f6974,0x6365765f,0x73726f74,0x0,0x60005,0x61,0x69645f72,0x6574616c, + 0x65645f64,0x687470,0x90005,0x69,0x6e695f72,0x5f747570,0x74736964,0x6974726f,0x665f6e6f,0x646c6569,0x0,0x60005, + 0x6d,0x694c5f73,0x7261656e,0x6d616c43,0x70,0xd0005,0x7d,0x725f7772,0x6e6f6365,0x75727473,0x64657463,0x7065645f, + 0x695f6874,0x7265746e,0x616c6f70,0x5f646574,0x6d617266,0x65,0x80005,0x134,0x475f6c67,0x61626f6c,0x766e496c,0x7461636f, + 0x496e6f69,0x44,0x30047,0x4f,0x2,0x50048,0x4f,0x0,0x23,0x0,0x40047,0x51, + 0x21,0x5,0x40047,0x51,0x22,0x0,0x40047,0x5a,0x21,0x0,0x40047,0x5a, + 0x22,0x0,0x40047,0x61,0x21,0x1,0x40047,0x61,0x22,0x0,0x40047,0x69, + 0x21,0x3,0x40047,0x69,0x22,0x0,0x40047,0x6d,0x21,0x3e8,0x40047,0x6d, + 0x22,0x0,0x40047,0x7d,0x21,0x4,0x40047,0x7d,0x22,0x0,0x40047,0x134, + 0xb,0x1c,0x40047,0x149,0xb,0x19,0x20013,0x2,0x30021,0x3,0x2,0x30016, + 0x6,0x20,0x40020,0x7,0x7,0x6,0x40015,0x8,0x20,0x0,0x40017,0xd, + 0x6,0x2,0x40015,0x13,0x20,0x1,0x40017,0x14,0x13,0x2,0x40020,0x18, + 0x7,0x14,0x4002b,0x8,0x29,0x4,0x4001c,0x2a,0x14,0x29,0x4001c,0x2b, + 0x6,0x29,0x20014,0x32,0x40017,0x4d,0x6,0x4,0x3001e,0x4f,0x14,0x40020, + 0x50,0x2,0x4f,0x4003b,0x50,0x51,0x2,0x4002b,0x13,0x52,0x0,0x40020, + 0x53,0x2,0x14,0x90019,0x58,0x6,0x1,0x0,0x0,0x0,0x1,0x0, + 0x40020,0x59,0x0,0x58,0x4003b,0x59,0x5a,0x0,0x4003b,0x59,0x61,0x0, + 0x4002b,0x8,0x65,0x0,0x4003b,0x59,0x69,0x0,0x2001a,0x6b,0x40020,0x6c, + 0x0,0x6b,0x4003b,0x6c,0x6d,0x0,0x3001b,0x6f,0x58,0x4002b,0x6,0x72, + 0x0,0x90019,0x7b,0x8,0x1,0x0,0x0,0x0,0x2,0x21,0x40020,0x7c, + 0x0,0x7b,0x4003b,0x7c,0x7d,0x0,0x40020,0x80,0xb,0x8,0x4002b,0x8, + 0x82,0x1,0x4002b,0x6,0x89,0x3f000000,0x5002c,0xd,0x8a,0x89,0x89,0x5002c, + 0x14,0x97,0x52,0x52,0x4002b,0x13,0x99,0x1,0x5002c,0x14,0x9a,0x99, + 0x52,0x5002c,0x14,0x9c,0x52,0x99,0x5002c,0x14,0x9f,0x99,0x99,0x4002b, + 0x6,0xa1,0x3f800000,0x40017,0xc2,0x8,0x2,0x40017,0xc6,0x32,0x2,0x4002b, + 0x13,0xe3,0x4,0x4002b,0x6,0xf3,0x3a83126f,0x40017,0x132,0x8,0x3,0x40020, + 0x133,0x1,0x132,0x4003b,0x133,0x134,0x1,0x4002b,0x8,0x148,0x8,0x6002c, + 0x132,0x149,0x148,0x148,0x82,0x40020,0x224,0x7,0x2a,0x40020,0x226,0x7, + 0x2b,0x7002c,0x2a,0x283,0x97,0x9a,0x9c,0x9f,0x50036,0x2,0x4,0x0, + 0x3,0x200f8,0x5,0x4003b,0x226,0x240,0x7,0x4003b,0x224,0x23f,0x7,0x4003d, + 0x132,0x135,0x134,0x7004f,0xc2,0x136,0x135,0x135,0x0,0x1,0x4007c,0x14, + 0x137,0x136,0x4006f,0xd,0x159,0x137,0x50081,0xd,0x15b,0x159,0x8a,0x50041, + 0x53,0x176,0x51,0x52,0x4003d,0x14,0x177,0x176,0x4006f,0xd,0x15d,0x177, + 0x50088,0xd,0x15e,0x15b,0x15d,0x4003d,0x58,0x17a,0x69,0x4003d,0x6b,0x17b, + 0x6d,0x50056,0x6f,0x17c,0x17a,0x17b,0x70058,0x4d,0x17e,0x17c,0x15e,0x2, + 0x72,0x7004f,0xd,0x17f,0x17e,0x17e,0x0,0x1,0x50085,0xd,0x164,0x17f, + 0x15d,0x4006e,0x14,0x165,0x164,0x50080,0x14,0x168,0x137,0x165,0x4003d,0x58, + 0x186,0x5a,0x7005f,0x4d,0x188,0x186,0x168,0x2,0x52,0x7004f,0xd,0x189, + 0x188,0x188,0x0,0x1,0x4003d,0x58,0x18c,0x61,0x7005f,0x4d,0x18e,0x18c, + 0x168,0x2,0x52,0x50051,0x6,0x18f,0x18e,0x0,0x5008e,0xd,0x16f,0x189, + 0x89,0x50081,0xd,0x1aa,0x15e,0x16f,0x50085,0xd,0x1dd,0x1aa,0x15d,0x50083, + 0xd,0x1de,0x1dd,0x8a,0x6000c,0xd,0x1e0,0x1,0x8,0x1de,0x4006e,0x14, + 0x1e1,0x1e0,0x6000c,0xd,0x209,0x1,0xa,0x1de,0x50051,0x6,0x1ea,0x209, + 0x0,0x50083,0x6,0x1eb,0xa1,0x1ea,0x50051,0x6,0x1ed,0x209,0x1,0x50083, + 0x6,0x1ee,0xa1,0x1ed,0x50085,0x6,0x1ef,0x1eb,0x1ee,0x50085,0x6,0x1f6, + 0x1ea,0x1ee,0x50085,0x6,0x1fd,0x1eb,0x1ed,0x50085,0x6,0x203,0x1ea,0x1ed, + 0x70050,0x2b,0x272,0x1ef,0x1f6,0x1fd,0x203,0x3003e,0x23f,0x283,0x3003e,0x240, + 0x272,0x200f9,0x1ad,0x200f8,0x1ad,0x700f5,0x13,0x273,0x52,0x5,0x1ce,0x1cc, + 0x500b1,0x32,0x1b0,0x273,0xe3,0x400f6,0x1cf,0x1cc,0x0,0x400fa,0x1b0,0x1b1, + 0x1cf,0x200f8,0x1b1,0x50041,0x18,0x245,0x23f,0x273,0x4003d,0x14,0x1b4,0x245, + 0x50080,0x14,0x1b8,0x1e1,0x1b4,0x50041,0x7,0x246,0x240,0x273,0x4003d,0x6, + 0x1bb,0x246,0x500ba,0x32,0x1bd,0x1bb,0xf3,0x300f7,0x1cb,0x0,0x400fa,0x1bd, + 0x1be,0x1cb,0x200f8,0x1be,0x4007c,0xc2,0x212,0x1b8,0x4007c,0xc2,0x214,0x177, + 0x500b0,0xc6,0x215,0x212,0x214,0x4009b,0x32,0x216,0x215,0x300f7,0x1ca,0x0, + 0x400fa,0x216,0x1c2,0x1ca,0x200f8,0x1c2,0x4007c,0x8,0x223,0x18f,0x6003c,0x80, + 0x21e,0x7d,0x1b8,0x65,0x700ef,0x8,0x21f,0x21e,0x82,0x65,0x223,0x200f9, + 0x1ca,0x200f8,0x1ca,0x200f9,0x1cb,0x200f8,0x1cb,0x200f9,0x1cc,0x200f8,0x1cc,0x50080, + 0x13,0x1ce,0x273,0x99,0x200f9,0x1ad,0x200f8,0x1cf,0x100fd,0x10038, +}; +static const char *fi_reconstruct_previous_depth_pass_1_cb_names[] = {"cbFI"}; +static const uint32_t fi_reconstruct_previous_depth_pass_1_cb_bind[] = {5}; +static const uint32_t fi_reconstruct_previous_depth_pass_1_cb_count[] = {1}; +static const uint32_t fi_reconstruct_previous_depth_pass_1_cb_space[] = {0}; +static const char *fi_reconstruct_previous_depth_pass_1_srv_tex_names[] = {"r_dilated_motion_vectors", "r_dilated_depth", "r_input_distortion_field"}; +static const uint32_t fi_reconstruct_previous_depth_pass_1_srv_tex_bind[] = {0, 1, 3}; +static const uint32_t fi_reconstruct_previous_depth_pass_1_srv_tex_count[] = {1, 1, 1}; +static const uint32_t fi_reconstruct_previous_depth_pass_1_srv_tex_space[] = {0, 0, 0}; +static const char *fi_reconstruct_previous_depth_pass_1_uav_tex_names[] = {"rw_reconstructed_depth_interpolated_frame"}; +static const uint32_t fi_reconstruct_previous_depth_pass_1_uav_tex_bind[] = {4}; +static const uint32_t fi_reconstruct_previous_depth_pass_1_uav_tex_count[] = {1}; +static const uint32_t fi_reconstruct_previous_depth_pass_1_uav_tex_space[] = {0}; +static const char *fi_reconstruct_previous_depth_pass_1_sampler_names[] = {"s_LinearClamp"}; +static const uint32_t fi_reconstruct_previous_depth_pass_1_sampler_bind[] = {1000}; +static const uint32_t fi_reconstruct_previous_depth_pass_1_sampler_count[] = {1}; +static const uint32_t fi_reconstruct_previous_depth_pass_1_sampler_space[] = {0}; + +static const uint32_t fi_game_motion_vector_field_pass_1_spv[3471] = { + 0x7230203,0x10500,0x8000b,0xd73,0x0,0x20011,0x1,0x6000b,0x1,0x4c534c47,0x6474732e,0x3035342e, + 0x0,0x3000e,0x0,0x1,0xf000f,0x5,0x4,0x6e69616d,0x0,0x14c,0x17c,0x180, + 0x189,0x192,0x199,0x1a0,0x1ab,0x1b2,0x40c,0x60010,0x4,0x11,0x8,0x8, + 0x1,0x30003,0x2,0x1c2,0xb0004,0x455f4c47,0x735f5458,0x6c706d61,0x656c7265,0x745f7373,0x75747865,0x665f6572, + 0x74636e75,0x736e6f69,0x0,0xb0004,0x455f4c47,0x735f5458,0x65646168,0x78655f72,0x63696c70,0x615f7469,0x68746972,0x6974656d, + 0x79745f63,0x736570,0xa0004,0x475f4c47,0x4c474f4f,0x70635f45,0x74735f70,0x5f656c79,0x656e696c,0x7269645f,0x69746365,0x6576, + 0x80004,0x475f4c47,0x4c474f4f,0x6e695f45,0x64756c63,0x69645f65,0x74636572,0x657669,0x40005,0x4,0x6e69616d,0x0, + 0x40005,0x14a,0x49466263,0x745f,0x60006,0x14a,0x0,0x646e6572,0x69537265,0x657a,0x60006,0x14a, + 0x1,0x70736964,0x5379616c,0x657a69,0x80006,0x14a,0x2,0x76654466,0x54656369,0x6569566f,0x70654477,0x6874, + 0x90006,0x14a,0x3,0x65746e69,0x6c6f7072,0x6f697461,0x6365526e,0x73614274,0x65,0x90006,0x14a,0x4, + 0x65746e69,0x6c6f7072,0x6f697461,0x6365526e,0x7a695374,0x65,0xa0006,0x14a,0x5,0x6b636162,0x66667542,0x72547265, + 0x66736e61,0x75467265,0x6974636e,0x6e6f,0x70006,0x14a,0x6,0x4d6e696d,0x754c7861,0x616e696d,0x65636e,0x40005, + 0x14c,0x49466263,0x0,0xa0005,0x17c,0x72705f72,0x6f697665,0x695f7375,0x7265746e,0x616c6f70,0x6e6f6974,0x756f735f, + 0x656372,0x60005,0x180,0x694c5f73,0x7261656e,0x6d616c43,0x70,0xa0005,0x189,0x75635f72,0x6e657272,0x6e695f74, + 0x70726574,0x74616c6f,0x5f6e6f69,0x72756f73,0x6563,0x90005,0x192,0x69645f72,0x6574616c,0x6f6d5f64,0x6e6f6974,0x6365765f, + 0x73726f74,0x0,0x60005,0x199,0x69645f72,0x6574616c,0x65645f64,0x687470,0x90005,0x1a0,0x6e695f72,0x5f747570, + 0x74736964,0x6974726f,0x665f6e6f,0x646c6569,0x0,0xa0005,0x1ab,0x675f7772,0x5f656d61,0x69746f6d,0x765f6e6f,0x6f746365, + 0x69665f72,0x5f646c65,0x78,0xa0005,0x1b2,0x675f7772,0x5f656d61,0x69746f6d,0x765f6e6f,0x6f746365,0x69665f72,0x5f646c65, + 0x79,0x80005,0x40c,0x475f6c67,0x61626f6c,0x766e496c,0x7461636f,0x496e6f69,0x44,0x30047,0x14a,0x2, + 0x50048,0x14a,0x0,0x23,0x0,0x50048,0x14a,0x1,0x23,0x8,0x50048,0x14a, + 0x2,0x23,0x30,0x50048,0x14a,0x3,0x23,0x70,0x50048,0x14a,0x4,0x23, + 0x78,0x50048,0x14a,0x5,0x23,0x8c,0x50048,0x14a,0x6,0x23,0x90,0x40047, + 0x14c,0x21,0x7,0x40047,0x14c,0x22,0x0,0x40047,0x17c,0x21,0x2,0x40047, + 0x17c,0x22,0x0,0x40047,0x180,0x21,0x3e8,0x40047,0x180,0x22,0x0,0x40047, + 0x189,0x21,0x3,0x40047,0x189,0x22,0x0,0x40047,0x192,0x21,0x0,0x40047, + 0x192,0x22,0x0,0x40047,0x199,0x21,0x1,0x40047,0x199,0x22,0x0,0x40047, + 0x1a0,0x21,0x4,0x40047,0x1a0,0x22,0x0,0x40047,0x1ab,0x21,0x5,0x40047, + 0x1ab,0x22,0x0,0x40047,0x1b2,0x21,0x6,0x40047,0x1b2,0x22,0x0,0x40047, + 0x40c,0xb,0x1c,0x40047,0x41b,0xb,0x19,0x20013,0x2,0x30021,0x3,0x2, + 0x40015,0x6,0x20,0x0,0x30016,0x8,0x20,0x40017,0x12,0x8,0x3,0x40017, + 0x1c,0x8,0x2,0x40015,0x47,0x20,0x1,0x40017,0x48,0x47,0x2,0x40017, + 0x52,0x8,0x4,0x40020,0x65,0x7,0x48,0x40017,0x71,0x6,0x2,0x4002b, + 0x6,0x90,0x4,0x4001c,0x91,0x48,0x90,0x20014,0x9c,0x4002b,0x8,0xc3, + 0x0,0x4002b,0x8,0xcf,0x3f800000,0x4002b,0x8,0x10c,0x3c4fcd9e,0x4002b,0x8,0x111, + 0x3f560008,0x4002b,0x8,0x117,0x4196d014,0x4002b,0x8,0x11a,0x41958000,0x4002b,0x8,0x121, + 0x40c8e061,0x4002b,0x8,0x128,0x3d25aee6,0x4002b,0x8,0x129,0x3d9e8391,0x4002b,0x8,0x12a, + 0x4019999a,0x4002b,0x8,0x12d,0x3f72a76e,0x4002b,0x8,0x12e,0x3d558919,0x9001e,0x14a,0x48, + 0x48,0x52,0x48,0x48,0x6,0x1c,0x40020,0x14b,0x2,0x14a,0x4003b,0x14b, + 0x14c,0x2,0x40020,0x14e,0x2,0x48,0x4002b,0x47,0x158,0x0,0x4002b,0x47, + 0x15d,0x1,0x40020,0x163,0x2,0x52,0x40020,0x169,0x2,0x6,0x4002b,0x6, + 0x16f,0x0,0x40020,0x170,0x2,0x8,0x4002b,0x6,0x175,0x1,0x90019,0x17a, + 0x8,0x1,0x0,0x0,0x0,0x1,0x0,0x40020,0x17b,0x0,0x17a,0x4003b, + 0x17b,0x17c,0x0,0x2001a,0x17e,0x40020,0x17f,0x0,0x17e,0x4003b,0x17f,0x180, + 0x0,0x3001b,0x182,0x17a,0x4003b,0x17b,0x189,0x0,0x4003b,0x17b,0x192,0x0, + 0x4003b,0x17b,0x199,0x0,0x4003b,0x17b,0x1a0,0x0,0x90019,0x1a9,0x6,0x1, + 0x0,0x0,0x0,0x2,0x21,0x40020,0x1aa,0x0,0x1a9,0x4003b,0x1aa,0x1ab, + 0x0,0x40020,0x1af,0xb,0x6,0x4003b,0x1aa,0x1b2,0x0,0x4002b,0x8,0x1ce, + 0x3e59b3d0,0x4002b,0x8,0x1cf,0x3f371759,0x4002b,0x8,0x1d0,0x3d93dd98,0x6002c,0x12,0x1d1, + 0x1ce,0x1cf,0x1d0,0x4002b,0x8,0x1d6,0x3e86809d,0x4002b,0x8,0x1da,0x3f2d9168,0x4002b, + 0x8,0x1df,0x3d72e48f,0x4002b,0x8,0x207,0x461c4000,0x4002b,0x8,0x239,0x3f000000,0x5002c, + 0x1c,0x23a,0x239,0x239,0x5002c,0x48,0x247,0x158,0x158,0x5002c,0x48,0x249, + 0x15d,0x158,0x5002c,0x48,0x24b,0x158,0x15d,0x5002c,0x48,0x24e,0x15d,0x15d, + 0x40017,0x27f,0x9c,0x2,0x4002b,0x6,0x2ae,0x80000000,0x4002b,0x6,0x2b8,0x3ff, + 0x4002b,0x6,0x2ba,0x15,0x4002b,0x6,0x2be,0x1f,0x4002b,0x6,0x2c0,0x10, + 0x4002b,0x8,0x2d6,0x3ea8f5c3,0x4002b,0x8,0x2e2,0x447fc000,0x4002b,0x8,0x337,0x3a83126f, + 0x4002b,0x8,0x348,0x41f80000,0x30029,0x9c,0x357,0x4002b,0x47,0x36e,0x4,0x4002b, + 0x8,0x39f,0x3f3504f3,0x4002b,0x6,0x402,0x3,0x40017,0x40a,0x6,0x3,0x40020, + 0x40b,0x1,0x40a,0x4003b,0x40b,0x40c,0x1,0x4002b,0x6,0x41a,0x8,0x6002c, + 0x40a,0x41b,0x41a,0x41a,0x175,0x40020,0xc19,0x7,0x91,0x30001,0x12,0xcb1, + 0x6002c,0x12,0xd4b,0x128,0x128,0x128,0x6002c,0x12,0xd4c,0xc3,0xc3,0xc3, + 0x6002c,0x12,0xd4d,0xcf,0xcf,0xcf,0x6002c,0x12,0xd4e,0x129,0x129,0x129, + 0x6002c,0x12,0xd4f,0x12d,0x12d,0x12d,0x6002c,0x12,0xd50,0x12e,0x12e,0x12e, + 0x6002c,0x12,0xd51,0x12a,0x12a,0x12a,0x6002c,0x12,0xd52,0x10c,0x10c,0x10c, + 0x6002c,0x12,0xd53,0x111,0x111,0x111,0x6002c,0x12,0xd54,0x117,0x117,0x117, + 0x6002c,0x12,0xd55,0x11a,0x11a,0x11a,0x6002c,0x12,0xd56,0x121,0x121,0x121, + 0x7002c,0x91,0xd57,0x247,0x249,0x24b,0x24e,0x5002c,0x1c,0xd58,0xcf,0xcf, + 0x4002b,0x8,0xd59,0x3c4ccccd,0x4002b,0x8,0xd5a,0xff800000,0x6002c,0x12,0xd5b,0xd5a, + 0xd5a,0xd5a,0x4002b,0x6,0xd70,0x2,0x4002b,0x6,0xd71,0x5,0x4002b,0x6, + 0xd72,0x6,0x50036,0x2,0x4,0x0,0x3,0x200f8,0x5,0x4003b,0xc19,0xc53, + 0x7,0x4003b,0xc19,0xc4d,0x7,0x4003d,0x40a,0x40d,0x40c,0x7004f,0x71,0x40e, + 0x40d,0x40d,0x0,0x1,0x4007c,0x48,0x40f,0x40e,0x4006f,0x1c,0x46c,0x40f, + 0x50081,0x1c,0x46e,0x46c,0x23a,0x50041,0x14e,0x536,0x14c,0x158,0x4003d,0x48, + 0x537,0x536,0x4006f,0x1c,0x470,0x537,0x50088,0x1c,0x471,0x46e,0x470,0x4003d, + 0x17a,0x53a,0x1a0,0x4003d,0x17e,0x53b,0x180,0x50056,0x182,0x53c,0x53a,0x53b, + 0x70058,0x52,0x53e,0x53c,0x471,0x2,0xc3,0x7004f,0x1c,0x53f,0x53e,0x53e, + 0x0,0x1,0x50085,0x1c,0x477,0x53f,0x470,0x4006e,0x48,0x478,0x477,0x50041, + 0x14e,0x546,0x14c,0x402,0x4003d,0x48,0x547,0x546,0x4006f,0x1c,0x47a,0x547, + 0x50041,0x14e,0x54a,0x14c,0x15d,0x4003d,0x48,0x54b,0x54a,0x4006f,0x1c,0x47c, + 0x54b,0x50088,0x1c,0x47d,0x47a,0x47c,0x50041,0x14e,0x54e,0x14c,0x90,0x4003d, + 0x48,0x54f,0x54e,0x4006f,0x1c,0x47f,0x54f,0x50088,0x1c,0x482,0x47f,0x47c, + 0x50085,0x1c,0x486,0x471,0x482,0x50081,0x1c,0x487,0x47d,0x486,0x50080,0x48, + 0x48a,0x40f,0x478,0x4003d,0x17a,0x556,0x199,0x7005f,0x52,0x558,0x556,0x48a, + 0x2,0x158,0x50051,0x8,0x559,0x558,0x0,0x4003d,0x17a,0x55c,0x192,0x7005f, + 0x52,0x55e,0x55c,0x48a,0x2,0x158,0x7004f,0x1c,0x55f,0x55e,0x55e,0x0, + 0x1,0x5008e,0x1c,0x491,0x55f,0x239,0x50081,0x1c,0x494,0x471,0x491,0x50041, + 0x163,0x56d,0x14c,0xd70,0x4003d,0x52,0x56e,0x56d,0x50051,0x8,0x565,0x56e, + 0x1,0x50051,0x8,0x568,0x56e,0x0,0x50083,0x8,0x569,0x559,0x568,0x50088, + 0x8,0x56a,0x565,0x569,0x7000c,0x8,0x586,0x1,0x1a,0x56a,0x2d6,0x50081, + 0x8,0x57a,0xcf,0x586,0x50088,0x8,0x57b,0xcf,0x57a,0x50085,0x8,0x57c, + 0x586,0x57b,0x50083,0x8,0x57d,0xcf,0x57c,0x50085,0x8,0x57e,0x57d,0x2e2, + 0x4006d,0x6,0x57f,0x57e,0x7000c,0x6,0x58b,0x1,0x29,0x175,0x57f,0x50085, + 0x1c,0x49c,0x55f,0x482,0x50081,0x1c,0x49d,0x487,0x49c,0x4003d,0x17a,0x58e, + 0x17c,0x4003d,0x17e,0x58f,0x180,0x50056,0x182,0x590,0x58e,0x58f,0x70058,0x52, + 0x592,0x590,0x49d,0x2,0xc3,0x8004f,0x12,0x593,0x592,0x592,0x0,0x1, + 0x2,0x4003d,0x17a,0x596,0x189,0x4003d,0x17e,0x597,0x180,0x50056,0x182,0x598, + 0x596,0x597,0x70058,0x52,0x59a,0x598,0x487,0x2,0xc3,0x8004f,0x12,0x59b, + 0x59a,0x59a,0x0,0x1,0x2,0x50041,0x169,0x5b6,0x14c,0xd71,0x4003d,0x6, + 0x5b7,0x5b6,0x300f7,0x5b2,0x0,0x900fb,0x5b7,0x5b2,0x0,0x5a6,0x1,0x5aa, + 0x2,0x5ae,0x200f8,0x5a6,0x300f7,0x5cf,0x0,0x900fb,0x5b7,0x5cf,0x0,0x5c1, + 0x1,0x5c4,0x2,0x5ca,0x200f8,0x5c1,0x50083,0x12,0x5e0,0x593,0xd4b,0x50085, + 0x12,0x5f9,0x5e0,0xd5b,0x8000c,0x12,0x60a,0x1,0x2b,0x5f9,0xd4c,0xd4d, + 0x50085,0x12,0x5e5,0x593,0xd4e,0x50085,0x12,0x5e9,0x593,0xd4f,0x50081,0x12, + 0x5ec,0x5e9,0xd50,0x7000c,0x12,0x5ef,0x1,0x1a,0x5ec,0xd51,0x4007f,0x12, + 0x617,0x60a,0x50085,0x12,0x619,0x617,0x5ef,0x50081,0x12,0x61b,0x619,0x5ef, + 0x50085,0x12,0x61e,0x60a,0x5e5,0x50081,0x12,0x620,0x61e,0x61b,0x200f9,0x5cf, + 0x200f8,0x5c4,0x7000c,0x12,0x62c,0x1,0x1a,0x593,0xd52,0x50083,0x12,0x62f, + 0x62c,0xd53,0x8000c,0x12,0x648,0x1,0x2b,0x62f,0xd4c,0xd4d,0x50085,0x12, + 0x634,0xd55,0x62c,0x50083,0x12,0x635,0xd54,0x634,0x50088,0x12,0x636,0x648, + 0x635,0x7000c,0x12,0x638,0x1,0x1a,0x636,0xd56,0x60041,0x170,0x65f,0x14c, + 0xd72,0x175,0x4003d,0x8,0x660,0x65f,0x50088,0x8,0x5c8,0x207,0x660,0x5008e, + 0x12,0x5c9,0x638,0x5c8,0x200f9,0x5cf,0x200f8,0x5ca,0x60041,0x170,0x663,0x14c, + 0xd72,0x16f,0x4003d,0x8,0x664,0x663,0x60041,0x170,0x667,0x14c,0xd72,0x175, + 0x4003d,0x8,0x668,0x667,0x50085,0x8,0x670,0x664,0xd59,0x60050,0x12,0x67d, + 0x670,0x670,0x670,0x50083,0x12,0x672,0x593,0x67d,0x50083,0x8,0x676,0x668, + 0x664,0x50085,0x8,0x677,0x676,0xd59,0x60050,0x12,0x681,0x677,0x677,0x677, + 0x50088,0x12,0x679,0x672,0x681,0x200f9,0x5cf,0x200f8,0x5cf,0xb00f5,0x12,0xcb3, + 0xcb1,0x5a6,0x620,0x5c1,0x5c9,0x5c4,0x679,0x5ca,0x50094,0x8,0x685,0xcb3, + 0x1d1,0x200f9,0x5b2,0x200f8,0x5aa,0x300f7,0x69d,0x0,0x900fb,0x5b7,0x69d,0x0, + 0x68f,0x1,0x692,0x2,0x698,0x200f8,0x68f,0x50083,0x12,0x6ae,0x593,0xd4b, + 0x50085,0x12,0x6c7,0x6ae,0xd5b,0x8000c,0x12,0x6d8,0x1,0x2b,0x6c7,0xd4c, + 0xd4d,0x50085,0x12,0x6b3,0x593,0xd4e,0x50085,0x12,0x6b7,0x593,0xd4f,0x50081, + 0x12,0x6ba,0x6b7,0xd50,0x7000c,0x12,0x6bd,0x1,0x1a,0x6ba,0xd51,0x4007f, + 0x12,0x6e5,0x6d8,0x50085,0x12,0x6e7,0x6e5,0x6bd,0x50081,0x12,0x6e9,0x6e7, + 0x6bd,0x50085,0x12,0x6ec,0x6d8,0x6b3,0x50081,0x12,0x6ee,0x6ec,0x6e9,0x200f9, + 0x69d,0x200f8,0x692,0x7000c,0x12,0x6fa,0x1,0x1a,0x593,0xd52,0x50083,0x12, + 0x6fd,0x6fa,0xd53,0x8000c,0x12,0x716,0x1,0x2b,0x6fd,0xd4c,0xd4d,0x50085, + 0x12,0x702,0xd55,0x6fa,0x50083,0x12,0x703,0xd54,0x702,0x50088,0x12,0x704, + 0x716,0x703,0x7000c,0x12,0x706,0x1,0x1a,0x704,0xd56,0x60041,0x170,0x72d, + 0x14c,0xd72,0x175,0x4003d,0x8,0x72e,0x72d,0x50088,0x8,0x696,0x207,0x72e, + 0x5008e,0x12,0x697,0x706,0x696,0x200f9,0x69d,0x200f8,0x698,0x60041,0x170,0x731, + 0x14c,0xd72,0x16f,0x4003d,0x8,0x732,0x731,0x60041,0x170,0x735,0x14c,0xd72, + 0x175,0x4003d,0x8,0x736,0x735,0x50085,0x8,0x73e,0x732,0xd59,0x60050,0x12, + 0x74b,0x73e,0x73e,0x73e,0x50083,0x12,0x740,0x593,0x74b,0x50083,0x8,0x744, + 0x736,0x732,0x50085,0x8,0x745,0x744,0xd59,0x60050,0x12,0x74f,0x745,0x745, + 0x745,0x50088,0x12,0x747,0x740,0x74f,0x200f9,0x69d,0x200f8,0x69d,0xb00f5,0x12, + 0xcb2,0xcb1,0x5aa,0x6ee,0x68f,0x697,0x692,0x747,0x698,0x50051,0x8,0x754, + 0xcb2,0x0,0x50085,0x8,0x755,0x1d6,0x754,0x50051,0x8,0x757,0xcb2,0x1, + 0x50085,0x8,0x758,0x1da,0x757,0x50081,0x8,0x759,0x755,0x758,0x50051,0x8, + 0x75b,0xcb2,0x2,0x50085,0x8,0x75c,0x1df,0x75b,0x50081,0x8,0x75d,0x759, + 0x75c,0x200f9,0x5b2,0x200f8,0x5ae,0x300f7,0x776,0x0,0x900fb,0x5b7,0x776,0x0, + 0x768,0x1,0x76b,0x2,0x771,0x200f8,0x768,0x50083,0x12,0x787,0x593,0xd4b, + 0x50085,0x12,0x7a0,0x787,0xd5b,0x8000c,0x12,0x7b1,0x1,0x2b,0x7a0,0xd4c, + 0xd4d,0x50085,0x12,0x78c,0x593,0xd4e,0x50085,0x12,0x790,0x593,0xd4f,0x50081, + 0x12,0x793,0x790,0xd50,0x7000c,0x12,0x796,0x1,0x1a,0x793,0xd51,0x4007f, + 0x12,0x7be,0x7b1,0x50085,0x12,0x7c0,0x7be,0x796,0x50081,0x12,0x7c2,0x7c0, + 0x796,0x50085,0x12,0x7c5,0x7b1,0x78c,0x50081,0x12,0x7c7,0x7c5,0x7c2,0x200f9, + 0x776,0x200f8,0x76b,0x7000c,0x12,0x7d3,0x1,0x1a,0x593,0xd52,0x50083,0x12, + 0x7d6,0x7d3,0xd53,0x8000c,0x12,0x7ef,0x1,0x2b,0x7d6,0xd4c,0xd4d,0x50085, + 0x12,0x7db,0xd55,0x7d3,0x50083,0x12,0x7dc,0xd54,0x7db,0x50088,0x12,0x7dd, + 0x7ef,0x7dc,0x7000c,0x12,0x7df,0x1,0x1a,0x7dd,0xd56,0x60041,0x170,0x806, + 0x14c,0xd72,0x175,0x4003d,0x8,0x807,0x806,0x50088,0x8,0x76f,0x207,0x807, + 0x5008e,0x12,0x770,0x7df,0x76f,0x200f9,0x776,0x200f8,0x771,0x60041,0x170,0x80a, + 0x14c,0xd72,0x16f,0x4003d,0x8,0x80b,0x80a,0x60041,0x170,0x80e,0x14c,0xd72, + 0x175,0x4003d,0x8,0x80f,0x80e,0x50085,0x8,0x817,0x80b,0xd59,0x60050,0x12, + 0x824,0x817,0x817,0x817,0x50083,0x12,0x819,0x593,0x824,0x50083,0x8,0x81d, + 0x80f,0x80b,0x50085,0x8,0x81e,0x81d,0xd59,0x60050,0x12,0x828,0x81e,0x81e, + 0x81e,0x50088,0x12,0x820,0x819,0x828,0x200f9,0x776,0x200f8,0x776,0xb00f5,0x12, + 0xcb0,0xcb1,0x5ae,0x7c7,0x768,0x770,0x76b,0x820,0x771,0x50094,0x8,0x82c, + 0xcb0,0x1d1,0x200f9,0x5b2,0x200f8,0x5b2,0xb00f5,0x8,0xcb4,0xc3,0x5,0x685, + 0x5cf,0x75d,0x69d,0x82c,0x776,0x50081,0x8,0x4a3,0x337,0xcb4,0x300f7,0x843, + 0x0,0x900fb,0x5b7,0x843,0x0,0x837,0x1,0x83b,0x2,0x83f,0x200f8,0x837, + 0x300f7,0x860,0x0,0x900fb,0x5b7,0x860,0x0,0x852,0x1,0x855,0x2,0x85b, + 0x200f8,0x852,0x50083,0x12,0x871,0x59b,0xd4b,0x50085,0x12,0x88a,0x871,0xd5b, + 0x8000c,0x12,0x89b,0x1,0x2b,0x88a,0xd4c,0xd4d,0x50085,0x12,0x876,0x59b, + 0xd4e,0x50085,0x12,0x87a,0x59b,0xd4f,0x50081,0x12,0x87d,0x87a,0xd50,0x7000c, + 0x12,0x880,0x1,0x1a,0x87d,0xd51,0x4007f,0x12,0x8a8,0x89b,0x50085,0x12, + 0x8aa,0x8a8,0x880,0x50081,0x12,0x8ac,0x8aa,0x880,0x50085,0x12,0x8af,0x89b, + 0x876,0x50081,0x12,0x8b1,0x8af,0x8ac,0x200f9,0x860,0x200f8,0x855,0x7000c,0x12, + 0x8bd,0x1,0x1a,0x59b,0xd52,0x50083,0x12,0x8c0,0x8bd,0xd53,0x8000c,0x12, + 0x8d9,0x1,0x2b,0x8c0,0xd4c,0xd4d,0x50085,0x12,0x8c5,0xd55,0x8bd,0x50083, + 0x12,0x8c6,0xd54,0x8c5,0x50088,0x12,0x8c7,0x8d9,0x8c6,0x7000c,0x12,0x8c9, + 0x1,0x1a,0x8c7,0xd56,0x60041,0x170,0x8f0,0x14c,0xd72,0x175,0x4003d,0x8, + 0x8f1,0x8f0,0x50088,0x8,0x859,0x207,0x8f1,0x5008e,0x12,0x85a,0x8c9,0x859, + 0x200f9,0x860,0x200f8,0x85b,0x60041,0x170,0x8f4,0x14c,0xd72,0x16f,0x4003d,0x8, + 0x8f5,0x8f4,0x60041,0x170,0x8f8,0x14c,0xd72,0x175,0x4003d,0x8,0x8f9,0x8f8, + 0x50085,0x8,0x901,0x8f5,0xd59,0x60050,0x12,0x90e,0x901,0x901,0x901,0x50083, + 0x12,0x903,0x59b,0x90e,0x50083,0x8,0x907,0x8f9,0x8f5,0x50085,0x8,0x908, + 0x907,0xd59,0x60050,0x12,0x912,0x908,0x908,0x908,0x50088,0x12,0x90a,0x903, + 0x912,0x200f9,0x860,0x200f8,0x860,0xb00f5,0x12,0xcc3,0xcb1,0x837,0x8b1,0x852, + 0x85a,0x855,0x90a,0x85b,0x50094,0x8,0x916,0xcc3,0x1d1,0x200f9,0x843,0x200f8, + 0x83b,0x300f7,0x92e,0x0,0x900fb,0x5b7,0x92e,0x0,0x920,0x1,0x923,0x2, + 0x929,0x200f8,0x920,0x50083,0x12,0x93f,0x59b,0xd4b,0x50085,0x12,0x958,0x93f, + 0xd5b,0x8000c,0x12,0x969,0x1,0x2b,0x958,0xd4c,0xd4d,0x50085,0x12,0x944, + 0x59b,0xd4e,0x50085,0x12,0x948,0x59b,0xd4f,0x50081,0x12,0x94b,0x948,0xd50, + 0x7000c,0x12,0x94e,0x1,0x1a,0x94b,0xd51,0x4007f,0x12,0x976,0x969,0x50085, + 0x12,0x978,0x976,0x94e,0x50081,0x12,0x97a,0x978,0x94e,0x50085,0x12,0x97d, + 0x969,0x944,0x50081,0x12,0x97f,0x97d,0x97a,0x200f9,0x92e,0x200f8,0x923,0x7000c, + 0x12,0x98b,0x1,0x1a,0x59b,0xd52,0x50083,0x12,0x98e,0x98b,0xd53,0x8000c, + 0x12,0x9a7,0x1,0x2b,0x98e,0xd4c,0xd4d,0x50085,0x12,0x993,0xd55,0x98b, + 0x50083,0x12,0x994,0xd54,0x993,0x50088,0x12,0x995,0x9a7,0x994,0x7000c,0x12, + 0x997,0x1,0x1a,0x995,0xd56,0x60041,0x170,0x9be,0x14c,0xd72,0x175,0x4003d, + 0x8,0x9bf,0x9be,0x50088,0x8,0x927,0x207,0x9bf,0x5008e,0x12,0x928,0x997, + 0x927,0x200f9,0x92e,0x200f8,0x929,0x60041,0x170,0x9c2,0x14c,0xd72,0x16f,0x4003d, + 0x8,0x9c3,0x9c2,0x60041,0x170,0x9c6,0x14c,0xd72,0x175,0x4003d,0x8,0x9c7, + 0x9c6,0x50085,0x8,0x9cf,0x9c3,0xd59,0x60050,0x12,0x9dc,0x9cf,0x9cf,0x9cf, + 0x50083,0x12,0x9d1,0x59b,0x9dc,0x50083,0x8,0x9d5,0x9c7,0x9c3,0x50085,0x8, + 0x9d6,0x9d5,0xd59,0x60050,0x12,0x9e0,0x9d6,0x9d6,0x9d6,0x50088,0x12,0x9d8, + 0x9d1,0x9e0,0x200f9,0x92e,0x200f8,0x92e,0xb00f5,0x12,0xcbe,0xcb1,0x83b,0x97f, + 0x920,0x928,0x923,0x9d8,0x929,0x50051,0x8,0x9e5,0xcbe,0x0,0x50085,0x8, + 0x9e6,0x1d6,0x9e5,0x50051,0x8,0x9e8,0xcbe,0x1,0x50085,0x8,0x9e9,0x1da, + 0x9e8,0x50081,0x8,0x9ea,0x9e6,0x9e9,0x50051,0x8,0x9ec,0xcbe,0x2,0x50085, + 0x8,0x9ed,0x1df,0x9ec,0x50081,0x8,0x9ee,0x9ea,0x9ed,0x200f9,0x843,0x200f8, + 0x83f,0x300f7,0xa07,0x0,0x900fb,0x5b7,0xa07,0x0,0x9f9,0x1,0x9fc,0x2, + 0xa02,0x200f8,0x9f9,0x50083,0x12,0xa18,0x59b,0xd4b,0x50085,0x12,0xa31,0xa18, + 0xd5b,0x8000c,0x12,0xa42,0x1,0x2b,0xa31,0xd4c,0xd4d,0x50085,0x12,0xa1d, + 0x59b,0xd4e,0x50085,0x12,0xa21,0x59b,0xd4f,0x50081,0x12,0xa24,0xa21,0xd50, + 0x7000c,0x12,0xa27,0x1,0x1a,0xa24,0xd51,0x4007f,0x12,0xa4f,0xa42,0x50085, + 0x12,0xa51,0xa4f,0xa27,0x50081,0x12,0xa53,0xa51,0xa27,0x50085,0x12,0xa56, + 0xa42,0xa1d,0x50081,0x12,0xa58,0xa56,0xa53,0x200f9,0xa07,0x200f8,0x9fc,0x7000c, + 0x12,0xa64,0x1,0x1a,0x59b,0xd52,0x50083,0x12,0xa67,0xa64,0xd53,0x8000c, + 0x12,0xa80,0x1,0x2b,0xa67,0xd4c,0xd4d,0x50085,0x12,0xa6c,0xd55,0xa64, + 0x50083,0x12,0xa6d,0xd54,0xa6c,0x50088,0x12,0xa6e,0xa80,0xa6d,0x7000c,0x12, + 0xa70,0x1,0x1a,0xa6e,0xd56,0x60041,0x170,0xa97,0x14c,0xd72,0x175,0x4003d, + 0x8,0xa98,0xa97,0x50088,0x8,0xa00,0x207,0xa98,0x5008e,0x12,0xa01,0xa70, + 0xa00,0x200f9,0xa07,0x200f8,0xa02,0x60041,0x170,0xa9b,0x14c,0xd72,0x16f,0x4003d, + 0x8,0xa9c,0xa9b,0x60041,0x170,0xa9f,0x14c,0xd72,0x175,0x4003d,0x8,0xaa0, + 0xa9f,0x50085,0x8,0xaa8,0xa9c,0xd59,0x60050,0x12,0xab5,0xaa8,0xaa8,0xaa8, + 0x50083,0x12,0xaaa,0x59b,0xab5,0x50083,0x8,0xaae,0xaa0,0xa9c,0x50085,0x8, + 0xaaf,0xaae,0xd59,0x60050,0x12,0xab9,0xaaf,0xaaf,0xaaf,0x50088,0x12,0xab1, + 0xaaa,0xab9,0x200f9,0xa07,0x200f8,0xa07,0xb00f5,0x12,0xcb9,0xcb1,0x83f,0xa58, + 0x9f9,0xa01,0x9fc,0xab1,0xa02,0x50094,0x8,0xabd,0xcb9,0x1d1,0x200f9,0x843, + 0x200f8,0x843,0xb00f5,0x8,0xcc8,0xc3,0x5b2,0x916,0x860,0x9ee,0x92e,0xabd, + 0xa07,0x50081,0x8,0x4a6,0x337,0xcc8,0x7000c,0x8,0xad4,0x1,0x28,0x4a3, + 0x4a6,0x500b7,0x9c,0xac8,0xad4,0xc3,0x300f7,0xace,0x0,0x400fa,0xac8,0xac9, + 0xacd,0x200f8,0xac9,0x7000c,0x8,0xad9,0x1,0x25,0x4a3,0x4a6,0x50088,0x8, + 0xacc,0xad9,0xad4,0x200f9,0xace,0x200f8,0xacd,0x200f9,0xace,0x200f8,0xace,0x700f5, + 0x8,0xccd,0xacc,0xac9,0xc3,0xacd,0x7000c,0x8,0xade,0x1,0x1a,0xccd, + 0xcf,0x50085,0x8,0x4ab,0xade,0x348,0x6000c,0x8,0xae2,0x1,0x2,0x4ab, + 0x4006d,0x6,0x4ad,0xae2,0x50051,0x8,0xae6,0x49d,0x0,0x500ba,0x9c,0xae7, + 0xae6,0xc3,0x300f7,0xaec,0x0,0x400fa,0xae7,0xae8,0xaec,0x200f8,0xae8,0x500b8, + 0x9c,0xaeb,0xae6,0xcf,0x200f9,0xaec,0x200f8,0xaec,0x700f5,0x9c,0xaed,0xae7, + 0xace,0xaeb,0xae8,0x300f7,0xaf8,0x0,0x400fa,0xaed,0xaee,0xaf8,0x200f8,0xaee, + 0x50051,0x8,0xaf0,0x49d,0x1,0x500ba,0x9c,0xaf1,0xaf0,0xc3,0x300f7,0xaf6, + 0x0,0x400fa,0xaf1,0xaf2,0xaf6,0x200f8,0xaf2,0x500b8,0x9c,0xaf5,0xaf0,0xcf, + 0x200f9,0xaf6,0x200f8,0xaf6,0x700f5,0x9c,0xaf7,0xaf1,0xaee,0xaf5,0xaf2,0x200f9, + 0xaf8,0x200f8,0xaf8,0x700f5,0x9c,0xaf9,0xaed,0xaec,0xaf7,0xaf6,0x600a9,0x6, + 0x4b4,0xaf9,0x175,0x16f,0x50084,0x6,0x4b5,0x4ad,0x4b4,0x500c7,0x6,0xb05, + 0x58b,0x2b8,0x500c4,0x6,0xb06,0xb05,0x2ba,0x500c5,0x6,0xb07,0x2ae,0xb06, + 0x500c7,0x6,0xb09,0x4b5,0x2be,0x500c4,0x6,0xb0a,0xb09,0x2c0,0x500c5,0x6, + 0xb0b,0xb07,0xb0a,0x50051,0x8,0xb0e,0x491,0x0,0x50050,0x1c,0xb1c,0xb0e, + 0xc3,0x6000c,0x6,0xb1d,0x1,0x3a,0xb1c,0x500c5,0x6,0xb10,0xb0b,0xb1d, + 0x50051,0x8,0xb13,0x491,0x1,0x50050,0x1c,0xb21,0xb13,0xc3,0x6000c,0x6, + 0xb22,0x1,0x3a,0xb21,0x500c5,0x6,0xb15,0xb0b,0xb22,0x50085,0x1c,0xb30, + 0x494,0x470,0x50083,0x1c,0xb31,0xb30,0x23a,0x6000c,0x1c,0xb33,0x1,0x8, + 0xb31,0x4006e,0x48,0xb34,0xb33,0x3003e,0xc4d,0xd57,0x200f9,0x4bd,0x200f8,0x4bd, + 0x700f5,0x47,0xd0d,0x158,0xaf8,0x4d3,0x4d1,0x500b1,0x9c,0x4c0,0xd0d,0x36e, + 0x400f6,0x4d4,0x4d1,0x0,0x400fa,0x4c0,0x4c1,0x4d4,0x200f8,0x4c1,0x50041,0x65, + 0xc52,0xc4d,0xd0d,0x4003d,0x48,0x4c4,0xc52,0x50080,0x48,0x4c8,0xb34,0x4c4, + 0x4007c,0x71,0xb64,0x4c8,0x4007c,0x71,0xb66,0x537,0x500b0,0x27f,0xb67,0xb64, + 0xb66,0x4009b,0x9c,0xb68,0xb67,0x300f7,0x4d0,0x0,0x400fa,0xb68,0x4cc,0x4d0, + 0x200f8,0x4cc,0x6003c,0x1af,0xb6d,0x1ab,0x4c8,0x16f,0x700ef,0x6,0xb6e,0xb6d, + 0x175,0x16f,0xb10,0x6003c,0x1af,0xb72,0x1b2,0x4c8,0x16f,0x700ef,0x6,0xb73, + 0xb72,0x175,0x16f,0xb15,0x200f9,0x4d0,0x200f8,0x4d0,0x200f9,0x4d1,0x200f8,0x4d1, + 0x50080,0x47,0x4d3,0xd0d,0x15d,0x200f9,0x4bd,0x200f8,0x4d4,0x50085,0x1c,0x4d8, + 0x491,0x470,0x6000c,0x8,0x4d9,0x1,0x42,0x4d8,0x500ba,0x9c,0x4da,0x4d9, + 0x337,0x300f7,0x533,0x0,0x400fa,0x4da,0x4dc,0x533,0x200f8,0x4dc,0x50088,0x1c, + 0x4e0,0xd58,0x470,0x6000c,0x8,0x4e1,0x1,0x42,0x4e0,0x6000c,0x1c,0x4e3, + 0x1,0x45,0x55f,0x6000c,0x8,0x4e5,0x1,0x42,0x491,0x7000c,0x8,0xb80, + 0x1,0x25,0x4e5,0x39f,0x200f9,0x4e8,0x200f8,0x4e8,0x700f5,0x9c,0xd15,0x357, + 0x4dc,0xd21,0x52e,0x700f5,0x8,0xd13,0x4e1,0x4dc,0x531,0x52e,0x700f5,0x6, + 0xd27,0x16f,0x4dc,0xd26,0x52e,0x500bc,0x9c,0x4ec,0xd13,0xb80,0x500a7,0x9c, + 0x4ee,0x4ec,0xd15,0x400f6,0x532,0x52e,0x0,0x400fa,0x4ee,0x4ef,0x532,0x200f8, + 0x4ef,0x5008e,0x1c,0x4f3,0x4e3,0xd13,0x50083,0x1c,0x4f4,0x494,0x4f3,0x50085, + 0x1c,0xb8e,0x4f4,0x470,0x50083,0x1c,0xb8f,0xb8e,0x23a,0x6000c,0x1c,0xb91, + 0x1,0x8,0xb8f,0x4006e,0x48,0xb92,0xb91,0x3003e,0xc53,0xd57,0x50082,0x6, + 0x4f9,0x2b8,0x58b,0x7000c,0x6,0xbbf,0x1,0x29,0x175,0x4f9,0x50083,0x1c, + 0x4fc,0x23a,0x4f4,0x6000c,0x1c,0x4fd,0x1,0x45,0x4fc,0x50094,0x8,0x500, + 0x4fd,0x4e3,0x7000c,0x8,0xbc4,0x1,0x28,0xc3,0x500,0x50085,0x8,0x502, + 0xbc4,0x348,0x4006d,0x6,0x503,0x502,0x500c7,0x6,0xbd0,0xbbf,0x2b8,0x500c4, + 0x6,0xbd1,0xbd0,0x2ba,0x500c7,0x6,0xbd4,0x503,0x2be,0x500c4,0x6,0xbd5, + 0xbd4,0x2c0,0x500c5,0x6,0xbd6,0xbd1,0xbd5,0x500c5,0x6,0xbdb,0xbd6,0xb1d, + 0x500c5,0x6,0xbe0,0xbd6,0xb22,0x200f9,0x508,0x200f8,0x508,0x700f5,0x6,0xd26, + 0xd27,0x4ef,0xd48,0x52a,0x700f5,0x9c,0xd21,0xd15,0x4ef,0xd46,0x52a,0x700f5, + 0x47,0xd1c,0x158,0x4ef,0x52c,0x52a,0x500b1,0x9c,0x50b,0xd1c,0x15d,0x400f6, + 0x52d,0x52a,0x0,0x400fa,0x50b,0x50c,0x52d,0x200f8,0x50c,0x50041,0x65,0xc57, + 0xc53,0xd1c,0x4003d,0x48,0x50f,0xc57,0x50080,0x48,0x513,0xb92,0x50f,0x300f7, + 0x519,0x0,0x400fa,0xd21,0x515,0x519,0x200f8,0x515,0x4007c,0x71,0xbf5,0x513, + 0x4007c,0x71,0xbf7,0x537,0x500b0,0x27f,0xbf8,0xbf5,0xbf7,0x4009b,0x9c,0xbf9, + 0xbf8,0x200f9,0x519,0x200f8,0x519,0x700f5,0x9c,0x51a,0xd21,0x50c,0xbf9,0x515, + 0x300f7,0x529,0x0,0x400fa,0x51a,0x51c,0x529,0x200f8,0x51c,0x6003c,0x1af,0xc04, + 0x1ab,0x513,0x16f,0x700ef,0x6,0xc05,0xc04,0x175,0x16f,0xbdb,0x6003c,0x1af, + 0xc09,0x1b2,0x513,0x16f,0x700ef,0x6,0xc0a,0xc09,0x175,0x16f,0xbe0,0x7000c, + 0x6,0xc13,0x1,0x29,0xc05,0xc0a,0x500c7,0x6,0xc17,0xc13,0x2ae,0x500ab, + 0x9c,0xc18,0xc17,0x16f,0x600a9,0x6,0x522,0xc18,0x175,0x16f,0x50080,0x6, + 0x524,0xd26,0x522,0x500b2,0x9c,0x527,0x524,0x402,0x500a7,0x9c,0x528,0x51a, + 0x527,0x200f9,0x529,0x200f8,0x529,0x700f5,0x6,0xd48,0xd26,0x519,0x524,0x51c, + 0x700f5,0x9c,0xd46,0x51a,0x519,0x528,0x51c,0x200f9,0x52a,0x200f8,0x52a,0x50080, + 0x47,0x52c,0xd1c,0x15d,0x200f9,0x508,0x200f8,0x52d,0x200f9,0x52e,0x200f8,0x52e, + 0x50081,0x8,0x531,0xd13,0x4e1,0x200f9,0x4e8,0x200f8,0x532,0x200f9,0x533,0x200f8, + 0x533,0x100fd,0x10038, +}; +static const char *fi_game_motion_vector_field_pass_1_cb_names[] = {"cbFI"}; +static const uint32_t fi_game_motion_vector_field_pass_1_cb_bind[] = {7}; +static const uint32_t fi_game_motion_vector_field_pass_1_cb_count[] = {1}; +static const uint32_t fi_game_motion_vector_field_pass_1_cb_space[] = {0}; +static const char *fi_game_motion_vector_field_pass_1_srv_tex_names[] = {"r_dilated_motion_vectors", "r_dilated_depth", "r_previous_interpolation_source", "r_current_interpolation_source", "r_input_distortion_field"}; +static const uint32_t fi_game_motion_vector_field_pass_1_srv_tex_bind[] = {0, 1, 2, 3, 4}; +static const uint32_t fi_game_motion_vector_field_pass_1_srv_tex_count[] = {1, 1, 1, 1, 1}; +static const uint32_t fi_game_motion_vector_field_pass_1_srv_tex_space[] = {0, 0, 0, 0, 0}; +static const char *fi_game_motion_vector_field_pass_1_uav_tex_names[] = {"rw_game_motion_vector_field_x", "rw_game_motion_vector_field_y"}; +static const uint32_t fi_game_motion_vector_field_pass_1_uav_tex_bind[] = {5, 6}; +static const uint32_t fi_game_motion_vector_field_pass_1_uav_tex_count[] = {1, 1}; +static const uint32_t fi_game_motion_vector_field_pass_1_uav_tex_space[] = {0, 0}; +static const char *fi_game_motion_vector_field_pass_1_sampler_names[] = {"s_LinearClamp"}; +static const uint32_t fi_game_motion_vector_field_pass_1_sampler_bind[] = {1000}; +static const uint32_t fi_game_motion_vector_field_pass_1_sampler_count[] = {1}; +static const uint32_t fi_game_motion_vector_field_pass_1_sampler_space[] = {0}; + +static const uint32_t fi_optical_flow_vector_field_pass_1_spv[3418] = { + 0x7230203,0x10500,0x8000b,0xc74,0x0,0x20011,0x1,0x6000b,0x1,0x4c534c47,0x6474732e,0x3035342e, + 0x0,0x3000e,0x0,0x1,0xd000f,0x5,0x4,0x6e69616d,0x0,0x13a,0x171,0x175, + 0x17e,0x189,0x1a2,0x1a9,0x3d7,0x60010,0x4,0x11,0x8,0x8,0x1,0x30003, + 0x2,0x1c2,0xb0004,0x455f4c47,0x735f5458,0x6c706d61,0x656c7265,0x745f7373,0x75747865,0x665f6572,0x74636e75,0x736e6f69, + 0x0,0xb0004,0x455f4c47,0x735f5458,0x65646168,0x78655f72,0x63696c70,0x615f7469,0x68746972,0x6974656d,0x79745f63,0x736570, + 0xa0004,0x475f4c47,0x4c474f4f,0x70635f45,0x74735f70,0x5f656c79,0x656e696c,0x7269645f,0x69746365,0x6576,0x80004,0x475f4c47, + 0x4c474f4f,0x6e695f45,0x64756c63,0x69645f65,0x74636572,0x657669,0x40005,0x4,0x6e69616d,0x0,0x40005,0x138, + 0x49466263,0x745f,0x80006,0x138,0x0,0x6974706f,0x466c6163,0x53776f6c,0x656c6163,0x0,0x90006,0x138, + 0x1,0x6974706f,0x466c6163,0x42776f6c,0x6b636f6c,0x657a6953,0x0,0x90006,0x138,0x2,0x65746e69,0x6c6f7072, + 0x6f697461,0x6365526e,0x7a695374,0x65,0xa0006,0x138,0x3,0x6b636162,0x66667542,0x72547265,0x66736e61,0x75467265, + 0x6974636e,0x6e6f,0x70006,0x138,0x4,0x4d6e696d,0x754c7861,0x616e696d,0x65636e,0x40005,0x13a,0x49466263, + 0x0,0xa0005,0x171,0x72705f72,0x6f697665,0x695f7375,0x7265746e,0x616c6f70,0x6e6f6974,0x756f735f,0x656372,0x60005, + 0x175,0x694c5f73,0x7261656e,0x6d616c43,0x70,0xa0005,0x17e,0x75635f72,0x6e657272,0x6e695f74,0x70726574,0x74616c6f, + 0x5f6e6f69,0x72756f73,0x6563,0x60005,0x189,0x706f5f72,0x61636974,0x6c665f6c,0x776f,0xc0005,0x1a2,0x6f5f7772, + 0x63697470,0x665f6c61,0x5f776f6c,0x69746f6d,0x765f6e6f,0x6f746365,0x69665f72,0x5f646c65,0x78,0xc0005,0x1a9,0x6f5f7772, + 0x63697470,0x665f6c61,0x5f776f6c,0x69746f6d,0x765f6e6f,0x6f746365,0x69665f72,0x5f646c65,0x79,0x80005,0x3d7,0x475f6c67, + 0x61626f6c,0x766e496c,0x7461636f,0x496e6f69,0x44,0x30047,0x138,0x2,0x50048,0x138,0x0,0x23, + 0x50,0x50048,0x138,0x1,0x23,0x58,0x50048,0x138,0x2,0x23,0x78,0x50048, + 0x138,0x3,0x23,0x8c,0x50048,0x138,0x4,0x23,0x90,0x40047,0x13a,0x21, + 0x8,0x40047,0x13a,0x22,0x0,0x40047,0x171,0x21,0x3,0x40047,0x171,0x22, + 0x0,0x40047,0x175,0x21,0x3e8,0x40047,0x175,0x22,0x0,0x40047,0x17e,0x21, + 0x4,0x40047,0x17e,0x22,0x0,0x40047,0x189,0x21,0x0,0x40047,0x189,0x22, + 0x0,0x40047,0x1a2,0x21,0x6,0x40047,0x1a2,0x22,0x0,0x40047,0x1a9,0x21, + 0x7,0x40047,0x1a9,0x22,0x0,0x40047,0x3d7,0xb,0x1c,0x40047,0x3e7,0xb, + 0x19,0x20013,0x2,0x30021,0x3,0x2,0x40015,0x6,0x20,0x0,0x30016,0x8, + 0x20,0x40017,0x12,0x8,0x3,0x40017,0x20,0x8,0x2,0x40015,0x45,0x20, + 0x1,0x40017,0x46,0x45,0x2,0x40020,0x60,0x7,0x46,0x40017,0x69,0x6, + 0x2,0x4002b,0x6,0x83,0x4,0x4001c,0x84,0x46,0x83,0x20014,0x8c,0x4002b, + 0x8,0xb1,0x0,0x4002b,0x8,0xbb,0x3f800000,0x4002b,0x8,0xf9,0x3c4fcd9e,0x4002b, + 0x8,0xfe,0x3f560008,0x4002b,0x8,0x104,0x4196d014,0x4002b,0x8,0x107,0x41958000,0x4002b, + 0x8,0x10e,0x40c8e061,0x4002b,0x8,0x115,0x3d25aee6,0x4002b,0x8,0x116,0x3d9e8391,0x4002b, + 0x8,0x117,0x4019999a,0x4002b,0x8,0x11a,0x3f72a76e,0x4002b,0x8,0x11b,0x3d558919,0x40017, + 0x137,0x8,0x4,0x7001e,0x138,0x20,0x45,0x46,0x6,0x20,0x40020,0x139, + 0x2,0x138,0x4003b,0x139,0x13a,0x2,0x40020,0x13c,0x2,0x46,0x40020,0x143, + 0x2,0x20,0x40020,0x149,0x2,0x45,0x4002b,0x45,0x154,0x1,0x40020,0x15e, + 0x2,0x6,0x4002b,0x6,0x164,0x0,0x40020,0x165,0x2,0x8,0x4002b,0x6, + 0x16a,0x1,0x90019,0x16f,0x8,0x1,0x0,0x0,0x0,0x1,0x0,0x40020, + 0x170,0x0,0x16f,0x4003b,0x170,0x171,0x0,0x2001a,0x173,0x40020,0x174,0x0, + 0x173,0x4003b,0x174,0x175,0x0,0x3001b,0x177,0x16f,0x4003b,0x170,0x17e,0x0, + 0x90019,0x187,0x45,0x1,0x0,0x0,0x0,0x1,0x0,0x40020,0x188,0x0, + 0x187,0x4003b,0x188,0x189,0x0,0x4002b,0x45,0x18c,0x0,0x40017,0x18d,0x45, + 0x4,0x90019,0x1a0,0x6,0x1,0x0,0x0,0x0,0x2,0x21,0x40020,0x1a1, + 0x0,0x1a0,0x4003b,0x1a1,0x1a2,0x0,0x40020,0x1a6,0xb,0x6,0x4003b,0x1a1, + 0x1a9,0x0,0x4002b,0x8,0x1b0,0x3e59b3d0,0x4002b,0x8,0x1b1,0x3f371759,0x4002b,0x8, + 0x1b2,0x3d93dd98,0x6002c,0x12,0x1b3,0x1b0,0x1b1,0x1b2,0x4002b,0x8,0x1b8,0x3e86809d, + 0x4002b,0x8,0x1bc,0x3f2d9168,0x4002b,0x8,0x1c1,0x3d72e48f,0x4002b,0x8,0x1e9,0x461c4000, + 0x4002b,0x8,0x21b,0x3f000000,0x5002c,0x20,0x21c,0x21b,0x21b,0x5002c,0x46,0x229, + 0x18c,0x18c,0x5002c,0x46,0x22b,0x154,0x18c,0x5002c,0x46,0x22d,0x18c,0x154, + 0x5002c,0x46,0x230,0x154,0x154,0x40017,0x255,0x8c,0x2,0x4002b,0x6,0x286, + 0x80000000,0x4002b,0x6,0x289,0x3ff,0x4002b,0x6,0x28b,0x15,0x4002b,0x6,0x28f, + 0x1f,0x4002b,0x6,0x291,0x10,0x4002b,0x8,0x2bd,0x3a83126f,0x4002b,0x8,0x2d4, + 0x3d4ccccd,0x4002b,0x8,0x2da,0x447fc000,0x4002b,0x8,0x2e9,0x41f80000,0x4002b,0x45,0x30f, + 0x4,0x5002c,0x20,0x329,0xb1,0xb1,0x4002b,0x8,0x35b,0x44000000,0x4002b,0x8, + 0x3b2,0x3fa00000,0x40017,0x3d5,0x6,0x3,0x40020,0x3d6,0x1,0x3d5,0x4003b,0x3d6, + 0x3d7,0x1,0x4002b,0x6,0x3e6,0x8,0x6002c,0x3d5,0x3e7,0x3e6,0x3e6,0x16a, + 0x40020,0xb81,0x7,0x84,0x30001,0x12,0xbdf,0x4002b,0x45,0xc51,0xffffffff,0x5002c, + 0x20,0xc53,0xbb,0xbb,0x6002c,0x12,0xc54,0x115,0x115,0x115,0x6002c,0x12, + 0xc55,0xb1,0xb1,0xb1,0x6002c,0x12,0xc56,0xbb,0xbb,0xbb,0x6002c,0x12, + 0xc57,0x116,0x116,0x116,0x6002c,0x12,0xc58,0x11a,0x11a,0x11a,0x6002c,0x12, + 0xc59,0x11b,0x11b,0x11b,0x6002c,0x12,0xc5a,0x117,0x117,0x117,0x6002c,0x12, + 0xc5b,0xf9,0xf9,0xf9,0x6002c,0x12,0xc5c,0xfe,0xfe,0xfe,0x6002c,0x12, + 0xc5d,0x104,0x104,0x104,0x6002c,0x12,0xc5e,0x107,0x107,0x107,0x6002c,0x12, + 0xc5f,0x10e,0x10e,0x10e,0x7002c,0x84,0xc60,0x229,0x22b,0x22d,0x230,0x4002b, + 0x8,0xc61,0x3c4ccccd,0x4002b,0x8,0xc62,0xff800000,0x6002c,0x12,0xc63,0xc62,0xc62, + 0xc62,0x4002b,0x6,0xc72,0x2,0x4002b,0x6,0xc73,0x3,0x50036,0x2,0x4, + 0x0,0x3,0x200f8,0x5,0x4003b,0xb81,0xb9c,0x7,0x4003d,0x3d5,0x3d8,0x3d7, + 0x7004f,0x69,0x3d9,0x3d8,0x3d8,0x0,0x1,0x4007c,0x46,0x3da,0x3d9,0x200f9, + 0x411,0x200f8,0x411,0x700f5,0x20,0xbd1,0x329,0x5,0xc40,0x442,0x700f5,0x8, + 0xbd0,0xb1,0x5,0xc41,0x442,0x700f5,0x45,0xbce,0xc51,0x5,0x444,0x442, + 0x500b3,0x8c,0x415,0xbce,0x154,0x400f6,0x445,0x442,0x0,0x400fa,0x415,0x416, + 0x445,0x200f8,0x416,0x200f9,0x419,0x200f8,0x419,0x700f5,0x8,0xc41,0xbd0,0x416, + 0x43d,0x41e,0x700f5,0x20,0xc40,0xbd1,0x416,0x43a,0x41e,0x700f5,0x45,0xc3c, + 0xc51,0x416,0x440,0x41e,0x500b3,0x8c,0x41d,0xc3c,0x154,0x400f6,0x441,0x41e, + 0x0,0x400fa,0x41d,0x41e,0x441,0x200f8,0x41e,0x50050,0x46,0x422,0xc3c,0xbce, + 0x50080,0x46,0x423,0x3da,0x422,0x4003d,0x187,0x495,0x189,0x7005f,0x18d,0x497, + 0x495,0x423,0x1002,0x18c,0x7004f,0x46,0x498,0x497,0x497,0x0,0x1,0x4006f, + 0x20,0x499,0x498,0x50041,0x143,0x49e,0x13a,0x164,0x4003d,0x20,0x49f,0x49e, + 0x50085,0x20,0x49b,0x499,0x49f,0x50041,0x13c,0x4ae,0x13a,0xc72,0x4003d,0x46, + 0x4af,0x4ae,0x4006f,0x20,0x42b,0x4af,0x50085,0x20,0x42c,0x49b,0x42b,0x6000c, + 0x8,0x42d,0x1,0x42,0x42c,0x50083,0x8,0x42f,0x35b,0x42d,0x7000c,0x8, + 0x4b4,0x1,0x28,0xb1,0x42f,0x500ba,0x8c,0x432,0x42d,0xbb,0x600a9,0x8, + 0x433,0x432,0xbb,0xb1,0x50085,0x8,0x434,0x4b4,0x433,0x5008e,0x20,0x438, + 0x49b,0x434,0x50081,0x20,0x43a,0xc40,0x438,0x50081,0x8,0x43d,0xc41,0x434, + 0x50080,0x45,0x440,0xc3c,0x154,0x200f9,0x419,0x200f8,0x441,0x200f9,0x442,0x200f8, + 0x442,0x50080,0x45,0x444,0xbce,0x154,0x200f9,0x411,0x200f8,0x445,0x50050,0x20, + 0x448,0xbd0,0xbd0,0x50088,0x20,0x449,0xbd1,0x448,0x200f9,0x44c,0x200f8,0x44c, + 0x700f5,0x20,0xbd5,0x329,0x445,0xc3a,0x483,0x700f5,0x8,0xbd4,0xb1,0x445, + 0xc3b,0x483,0x700f5,0x45,0xbd2,0xc51,0x445,0x485,0x483,0x500b3,0x8c,0x450, + 0xbd2,0x154,0x400f6,0x486,0x483,0x0,0x400fa,0x450,0x451,0x486,0x200f8,0x451, + 0x200f9,0x454,0x200f8,0x454,0x700f5,0x8,0xc3b,0xbd4,0x451,0x47e,0x459,0x700f5, + 0x20,0xc3a,0xbd5,0x451,0x47b,0x459,0x700f5,0x45,0xc34,0xc51,0x451,0x481, + 0x459,0x500b3,0x8c,0x458,0xc34,0x154,0x400f6,0x482,0x459,0x0,0x400fa,0x458, + 0x459,0x482,0x200f8,0x459,0x50050,0x46,0x45d,0xc34,0xbd2,0x50080,0x46,0x45e, + 0x3da,0x45d,0x4003d,0x187,0x4b7,0x189,0x7005f,0x18d,0x4b9,0x4b7,0x45e,0x1002, + 0x18c,0x7004f,0x46,0x4ba,0x4b9,0x4b9,0x0,0x1,0x4006f,0x20,0x4bb,0x4ba, + 0x50041,0x143,0x4c0,0x13a,0x164,0x4003d,0x20,0x4c1,0x4c0,0x50085,0x20,0x4bd, + 0x4bb,0x4c1,0x50041,0x13c,0x4d0,0x13a,0xc72,0x4003d,0x46,0x4d1,0x4d0,0x4006f, + 0x20,0x466,0x4d1,0x50085,0x20,0x467,0x4bd,0x466,0x6000c,0x8,0x468,0x1, + 0x42,0x467,0x50083,0x8,0x46a,0x35b,0x468,0x7000c,0x8,0x4d6,0x1,0x28, + 0xb1,0x46a,0x500ba,0x8c,0x46d,0x468,0xbb,0x600a9,0x8,0x46e,0x46d,0xbb, + 0xb1,0x50085,0x8,0x46f,0x4d6,0x46e,0x50094,0x8,0x472,0x449,0x4bd,0x7000c, + 0x8,0x4db,0x1,0x1a,0x472,0x3b2,0x7000c,0x8,0x4e0,0x1,0x28,0xb1, + 0x4db,0x50085,0x8,0x476,0x4e0,0x46f,0x5008e,0x20,0x479,0x4bd,0x476,0x50081, + 0x20,0x47b,0xc3a,0x479,0x50081,0x8,0x47e,0xc3b,0x476,0x50080,0x45,0x481, + 0xc34,0x154,0x200f9,0x454,0x200f8,0x482,0x200f9,0x483,0x200f8,0x483,0x50080,0x45, + 0x485,0xbd2,0x154,0x200f9,0x44c,0x200f8,0x486,0x500ba,0x8c,0x488,0xbd4,0x2bd, + 0x300f7,0x48e,0x0,0x400fa,0x488,0x489,0x48e,0x200f8,0x489,0x50050,0x20,0x48c, + 0xbd4,0xbd4,0x50088,0x20,0x48d,0xbd5,0x48c,0x200f9,0x48e,0x200f8,0x48e,0x700f5, + 0x20,0xbda,0xbd5,0x486,0x48d,0x489,0x40070,0x20,0x504,0x3d9,0x50081,0x20, + 0x506,0x504,0x21c,0x50041,0x143,0x564,0x13a,0x164,0x4003d,0x20,0x565,0x564, + 0x50088,0x20,0x567,0xc53,0x565,0x50041,0x149,0x568,0x13a,0x16a,0x4003d,0x45, + 0x569,0x568,0x50050,0x46,0x56a,0x569,0x569,0x4006f,0x20,0x56b,0x56a,0x50088, + 0x20,0x56c,0x567,0x56b,0x4006e,0x46,0x56d,0x56c,0x50084,0x46,0x560,0x56d, + 0x230,0x4006f,0x20,0x508,0x560,0x50088,0x20,0x509,0x506,0x508,0x5008e,0x20, + 0x50b,0xbda,0x21b,0x50081,0x20,0x50e,0x509,0xbda,0x4003d,0x16f,0x571,0x171, + 0x4003d,0x173,0x572,0x175,0x50056,0x177,0x573,0x571,0x572,0x70058,0x137,0x575, + 0x573,0x50e,0x2,0xb1,0x8004f,0x12,0x576,0x575,0x575,0x0,0x1,0x2, + 0x4003d,0x16f,0x579,0x17e,0x4003d,0x173,0x57a,0x175,0x50056,0x177,0x57b,0x579, + 0x57a,0x70058,0x137,0x57d,0x57b,0x509,0x2,0xb1,0x8004f,0x12,0x57e,0x57d, + 0x57d,0x0,0x1,0x2,0x50041,0x15e,0x599,0x13a,0xc73,0x4003d,0x6,0x59a, + 0x599,0x300f7,0x595,0x0,0x900fb,0x59a,0x595,0x0,0x589,0x1,0x58d,0x2, + 0x591,0x200f8,0x589,0x300f7,0x5b2,0x0,0x900fb,0x59a,0x5b2,0x0,0x5a4,0x1, + 0x5a7,0x2,0x5ad,0x200f8,0x5a4,0x50083,0x12,0x5c3,0x576,0xc54,0x50085,0x12, + 0x5dc,0x5c3,0xc63,0x8000c,0x12,0x5ed,0x1,0x2b,0x5dc,0xc55,0xc56,0x50085, + 0x12,0x5c8,0x576,0xc57,0x50085,0x12,0x5cc,0x576,0xc58,0x50081,0x12,0x5cf, + 0x5cc,0xc59,0x7000c,0x12,0x5d2,0x1,0x1a,0x5cf,0xc5a,0x4007f,0x12,0x5fa, + 0x5ed,0x50085,0x12,0x5fc,0x5fa,0x5d2,0x50081,0x12,0x5fe,0x5fc,0x5d2,0x50085, + 0x12,0x601,0x5ed,0x5c8,0x50081,0x12,0x603,0x601,0x5fe,0x200f9,0x5b2,0x200f8, + 0x5a7,0x7000c,0x12,0x60f,0x1,0x1a,0x576,0xc5b,0x50083,0x12,0x612,0x60f, + 0xc5c,0x8000c,0x12,0x62b,0x1,0x2b,0x612,0xc55,0xc56,0x50085,0x12,0x617, + 0xc5e,0x60f,0x50083,0x12,0x618,0xc5d,0x617,0x50088,0x12,0x619,0x62b,0x618, + 0x7000c,0x12,0x61b,0x1,0x1a,0x619,0xc5f,0x60041,0x165,0x642,0x13a,0x83, + 0x16a,0x4003d,0x8,0x643,0x642,0x50088,0x8,0x5ab,0x1e9,0x643,0x5008e,0x12, + 0x5ac,0x61b,0x5ab,0x200f9,0x5b2,0x200f8,0x5ad,0x60041,0x165,0x646,0x13a,0x83, + 0x164,0x4003d,0x8,0x647,0x646,0x60041,0x165,0x64a,0x13a,0x83,0x16a,0x4003d, + 0x8,0x64b,0x64a,0x50085,0x8,0x653,0x647,0xc61,0x60050,0x12,0x660,0x653, + 0x653,0x653,0x50083,0x12,0x655,0x576,0x660,0x50083,0x8,0x659,0x64b,0x647, + 0x50085,0x8,0x65a,0x659,0xc61,0x60050,0x12,0x664,0x65a,0x65a,0x65a,0x50088, + 0x12,0x65c,0x655,0x664,0x200f9,0x5b2,0x200f8,0x5b2,0xb00f5,0x12,0xbe4,0xbdf, + 0x589,0x603,0x5a4,0x5ac,0x5a7,0x65c,0x5ad,0x50094,0x8,0x668,0xbe4,0x1b3, + 0x200f9,0x595,0x200f8,0x58d,0x300f7,0x680,0x0,0x900fb,0x59a,0x680,0x0,0x672, + 0x1,0x675,0x2,0x67b,0x200f8,0x672,0x50083,0x12,0x691,0x576,0xc54,0x50085, + 0x12,0x6aa,0x691,0xc63,0x8000c,0x12,0x6bb,0x1,0x2b,0x6aa,0xc55,0xc56, + 0x50085,0x12,0x696,0x576,0xc57,0x50085,0x12,0x69a,0x576,0xc58,0x50081,0x12, + 0x69d,0x69a,0xc59,0x7000c,0x12,0x6a0,0x1,0x1a,0x69d,0xc5a,0x4007f,0x12, + 0x6c8,0x6bb,0x50085,0x12,0x6ca,0x6c8,0x6a0,0x50081,0x12,0x6cc,0x6ca,0x6a0, + 0x50085,0x12,0x6cf,0x6bb,0x696,0x50081,0x12,0x6d1,0x6cf,0x6cc,0x200f9,0x680, + 0x200f8,0x675,0x7000c,0x12,0x6dd,0x1,0x1a,0x576,0xc5b,0x50083,0x12,0x6e0, + 0x6dd,0xc5c,0x8000c,0x12,0x6f9,0x1,0x2b,0x6e0,0xc55,0xc56,0x50085,0x12, + 0x6e5,0xc5e,0x6dd,0x50083,0x12,0x6e6,0xc5d,0x6e5,0x50088,0x12,0x6e7,0x6f9, + 0x6e6,0x7000c,0x12,0x6e9,0x1,0x1a,0x6e7,0xc5f,0x60041,0x165,0x710,0x13a, + 0x83,0x16a,0x4003d,0x8,0x711,0x710,0x50088,0x8,0x679,0x1e9,0x711,0x5008e, + 0x12,0x67a,0x6e9,0x679,0x200f9,0x680,0x200f8,0x67b,0x60041,0x165,0x714,0x13a, + 0x83,0x164,0x4003d,0x8,0x715,0x714,0x60041,0x165,0x718,0x13a,0x83,0x16a, + 0x4003d,0x8,0x719,0x718,0x50085,0x8,0x721,0x715,0xc61,0x60050,0x12,0x72e, + 0x721,0x721,0x721,0x50083,0x12,0x723,0x576,0x72e,0x50083,0x8,0x727,0x719, + 0x715,0x50085,0x8,0x728,0x727,0xc61,0x60050,0x12,0x732,0x728,0x728,0x728, + 0x50088,0x12,0x72a,0x723,0x732,0x200f9,0x680,0x200f8,0x680,0xb00f5,0x12,0xbe0, + 0xbdf,0x58d,0x6d1,0x672,0x67a,0x675,0x72a,0x67b,0x50051,0x8,0x737,0xbe0, + 0x0,0x50085,0x8,0x738,0x1b8,0x737,0x50051,0x8,0x73a,0xbe0,0x1,0x50085, + 0x8,0x73b,0x1bc,0x73a,0x50081,0x8,0x73c,0x738,0x73b,0x50051,0x8,0x73e, + 0xbe0,0x2,0x50085,0x8,0x73f,0x1c1,0x73e,0x50081,0x8,0x740,0x73c,0x73f, + 0x200f9,0x595,0x200f8,0x591,0x300f7,0x759,0x0,0x900fb,0x59a,0x759,0x0,0x74b, + 0x1,0x74e,0x2,0x754,0x200f8,0x74b,0x50083,0x12,0x76a,0x576,0xc54,0x50085, + 0x12,0x783,0x76a,0xc63,0x8000c,0x12,0x794,0x1,0x2b,0x783,0xc55,0xc56, + 0x50085,0x12,0x76f,0x576,0xc57,0x50085,0x12,0x773,0x576,0xc58,0x50081,0x12, + 0x776,0x773,0xc59,0x7000c,0x12,0x779,0x1,0x1a,0x776,0xc5a,0x4007f,0x12, + 0x7a1,0x794,0x50085,0x12,0x7a3,0x7a1,0x779,0x50081,0x12,0x7a5,0x7a3,0x779, + 0x50085,0x12,0x7a8,0x794,0x76f,0x50081,0x12,0x7aa,0x7a8,0x7a5,0x200f9,0x759, + 0x200f8,0x74e,0x7000c,0x12,0x7b6,0x1,0x1a,0x576,0xc5b,0x50083,0x12,0x7b9, + 0x7b6,0xc5c,0x8000c,0x12,0x7d2,0x1,0x2b,0x7b9,0xc55,0xc56,0x50085,0x12, + 0x7be,0xc5e,0x7b6,0x50083,0x12,0x7bf,0xc5d,0x7be,0x50088,0x12,0x7c0,0x7d2, + 0x7bf,0x7000c,0x12,0x7c2,0x1,0x1a,0x7c0,0xc5f,0x60041,0x165,0x7e9,0x13a, + 0x83,0x16a,0x4003d,0x8,0x7ea,0x7e9,0x50088,0x8,0x752,0x1e9,0x7ea,0x5008e, + 0x12,0x753,0x7c2,0x752,0x200f9,0x759,0x200f8,0x754,0x60041,0x165,0x7ed,0x13a, + 0x83,0x164,0x4003d,0x8,0x7ee,0x7ed,0x60041,0x165,0x7f1,0x13a,0x83,0x16a, + 0x4003d,0x8,0x7f2,0x7f1,0x50085,0x8,0x7fa,0x7ee,0xc61,0x60050,0x12,0x807, + 0x7fa,0x7fa,0x7fa,0x50083,0x12,0x7fc,0x576,0x807,0x50083,0x8,0x800,0x7f2, + 0x7ee,0x50085,0x8,0x801,0x800,0xc61,0x60050,0x12,0x80b,0x801,0x801,0x801, + 0x50088,0x12,0x803,0x7fc,0x80b,0x200f9,0x759,0x200f8,0x759,0xb00f5,0x12,0xbdb, + 0xbdf,0x591,0x7aa,0x74b,0x753,0x74e,0x803,0x754,0x50094,0x8,0x80f,0xbdb, + 0x1b3,0x200f9,0x595,0x200f8,0x595,0xb00f5,0x8,0xbe8,0xb1,0x48e,0x668,0x5b2, + 0x740,0x680,0x80f,0x759,0x50081,0x8,0x514,0x2bd,0xbe8,0x300f7,0x826,0x0, + 0x900fb,0x59a,0x826,0x0,0x81a,0x1,0x81e,0x2,0x822,0x200f8,0x81a,0x300f7, + 0x843,0x0,0x900fb,0x59a,0x843,0x0,0x835,0x1,0x838,0x2,0x83e,0x200f8, + 0x835,0x50083,0x12,0x854,0x57e,0xc54,0x50085,0x12,0x86d,0x854,0xc63,0x8000c, + 0x12,0x87e,0x1,0x2b,0x86d,0xc55,0xc56,0x50085,0x12,0x859,0x57e,0xc57, + 0x50085,0x12,0x85d,0x57e,0xc58,0x50081,0x12,0x860,0x85d,0xc59,0x7000c,0x12, + 0x863,0x1,0x1a,0x860,0xc5a,0x4007f,0x12,0x88b,0x87e,0x50085,0x12,0x88d, + 0x88b,0x863,0x50081,0x12,0x88f,0x88d,0x863,0x50085,0x12,0x892,0x87e,0x859, + 0x50081,0x12,0x894,0x892,0x88f,0x200f9,0x843,0x200f8,0x838,0x7000c,0x12,0x8a0, + 0x1,0x1a,0x57e,0xc5b,0x50083,0x12,0x8a3,0x8a0,0xc5c,0x8000c,0x12,0x8bc, + 0x1,0x2b,0x8a3,0xc55,0xc56,0x50085,0x12,0x8a8,0xc5e,0x8a0,0x50083,0x12, + 0x8a9,0xc5d,0x8a8,0x50088,0x12,0x8aa,0x8bc,0x8a9,0x7000c,0x12,0x8ac,0x1, + 0x1a,0x8aa,0xc5f,0x60041,0x165,0x8d3,0x13a,0x83,0x16a,0x4003d,0x8,0x8d4, + 0x8d3,0x50088,0x8,0x83c,0x1e9,0x8d4,0x5008e,0x12,0x83d,0x8ac,0x83c,0x200f9, + 0x843,0x200f8,0x83e,0x60041,0x165,0x8d7,0x13a,0x83,0x164,0x4003d,0x8,0x8d8, + 0x8d7,0x60041,0x165,0x8db,0x13a,0x83,0x16a,0x4003d,0x8,0x8dc,0x8db,0x50085, + 0x8,0x8e4,0x8d8,0xc61,0x60050,0x12,0x8f1,0x8e4,0x8e4,0x8e4,0x50083,0x12, + 0x8e6,0x57e,0x8f1,0x50083,0x8,0x8ea,0x8dc,0x8d8,0x50085,0x8,0x8eb,0x8ea, + 0xc61,0x60050,0x12,0x8f5,0x8eb,0x8eb,0x8eb,0x50088,0x12,0x8ed,0x8e6,0x8f5, + 0x200f9,0x843,0x200f8,0x843,0xb00f5,0x12,0xbfd,0xbdf,0x81a,0x894,0x835,0x83d, + 0x838,0x8ed,0x83e,0x50094,0x8,0x8f9,0xbfd,0x1b3,0x200f9,0x826,0x200f8,0x81e, + 0x300f7,0x911,0x0,0x900fb,0x59a,0x911,0x0,0x903,0x1,0x906,0x2,0x90c, + 0x200f8,0x903,0x50083,0x12,0x922,0x57e,0xc54,0x50085,0x12,0x93b,0x922,0xc63, + 0x8000c,0x12,0x94c,0x1,0x2b,0x93b,0xc55,0xc56,0x50085,0x12,0x927,0x57e, + 0xc57,0x50085,0x12,0x92b,0x57e,0xc58,0x50081,0x12,0x92e,0x92b,0xc59,0x7000c, + 0x12,0x931,0x1,0x1a,0x92e,0xc5a,0x4007f,0x12,0x959,0x94c,0x50085,0x12, + 0x95b,0x959,0x931,0x50081,0x12,0x95d,0x95b,0x931,0x50085,0x12,0x960,0x94c, + 0x927,0x50081,0x12,0x962,0x960,0x95d,0x200f9,0x911,0x200f8,0x906,0x7000c,0x12, + 0x96e,0x1,0x1a,0x57e,0xc5b,0x50083,0x12,0x971,0x96e,0xc5c,0x8000c,0x12, + 0x98a,0x1,0x2b,0x971,0xc55,0xc56,0x50085,0x12,0x976,0xc5e,0x96e,0x50083, + 0x12,0x977,0xc5d,0x976,0x50088,0x12,0x978,0x98a,0x977,0x7000c,0x12,0x97a, + 0x1,0x1a,0x978,0xc5f,0x60041,0x165,0x9a1,0x13a,0x83,0x16a,0x4003d,0x8, + 0x9a2,0x9a1,0x50088,0x8,0x90a,0x1e9,0x9a2,0x5008e,0x12,0x90b,0x97a,0x90a, + 0x200f9,0x911,0x200f8,0x90c,0x60041,0x165,0x9a5,0x13a,0x83,0x164,0x4003d,0x8, + 0x9a6,0x9a5,0x60041,0x165,0x9a9,0x13a,0x83,0x16a,0x4003d,0x8,0x9aa,0x9a9, + 0x50085,0x8,0x9b2,0x9a6,0xc61,0x60050,0x12,0x9bf,0x9b2,0x9b2,0x9b2,0x50083, + 0x12,0x9b4,0x57e,0x9bf,0x50083,0x8,0x9b8,0x9aa,0x9a6,0x50085,0x8,0x9b9, + 0x9b8,0xc61,0x60050,0x12,0x9c3,0x9b9,0x9b9,0x9b9,0x50088,0x12,0x9bb,0x9b4, + 0x9c3,0x200f9,0x911,0x200f8,0x911,0xb00f5,0x12,0xbf5,0xbdf,0x81e,0x962,0x903, + 0x90b,0x906,0x9bb,0x90c,0x50051,0x8,0x9c8,0xbf5,0x0,0x50085,0x8,0x9c9, + 0x1b8,0x9c8,0x50051,0x8,0x9cb,0xbf5,0x1,0x50085,0x8,0x9cc,0x1bc,0x9cb, + 0x50081,0x8,0x9cd,0x9c9,0x9cc,0x50051,0x8,0x9cf,0xbf5,0x2,0x50085,0x8, + 0x9d0,0x1c1,0x9cf,0x50081,0x8,0x9d1,0x9cd,0x9d0,0x200f9,0x826,0x200f8,0x822, + 0x300f7,0x9ea,0x0,0x900fb,0x59a,0x9ea,0x0,0x9dc,0x1,0x9df,0x2,0x9e5, + 0x200f8,0x9dc,0x50083,0x12,0x9fb,0x57e,0xc54,0x50085,0x12,0xa14,0x9fb,0xc63, + 0x8000c,0x12,0xa25,0x1,0x2b,0xa14,0xc55,0xc56,0x50085,0x12,0xa00,0x57e, + 0xc57,0x50085,0x12,0xa04,0x57e,0xc58,0x50081,0x12,0xa07,0xa04,0xc59,0x7000c, + 0x12,0xa0a,0x1,0x1a,0xa07,0xc5a,0x4007f,0x12,0xa32,0xa25,0x50085,0x12, + 0xa34,0xa32,0xa0a,0x50081,0x12,0xa36,0xa34,0xa0a,0x50085,0x12,0xa39,0xa25, + 0xa00,0x50081,0x12,0xa3b,0xa39,0xa36,0x200f9,0x9ea,0x200f8,0x9df,0x7000c,0x12, + 0xa47,0x1,0x1a,0x57e,0xc5b,0x50083,0x12,0xa4a,0xa47,0xc5c,0x8000c,0x12, + 0xa63,0x1,0x2b,0xa4a,0xc55,0xc56,0x50085,0x12,0xa4f,0xc5e,0xa47,0x50083, + 0x12,0xa50,0xc5d,0xa4f,0x50088,0x12,0xa51,0xa63,0xa50,0x7000c,0x12,0xa53, + 0x1,0x1a,0xa51,0xc5f,0x60041,0x165,0xa7a,0x13a,0x83,0x16a,0x4003d,0x8, + 0xa7b,0xa7a,0x50088,0x8,0x9e3,0x1e9,0xa7b,0x5008e,0x12,0x9e4,0xa53,0x9e3, + 0x200f9,0x9ea,0x200f8,0x9e5,0x60041,0x165,0xa7e,0x13a,0x83,0x164,0x4003d,0x8, + 0xa7f,0xa7e,0x60041,0x165,0xa82,0x13a,0x83,0x16a,0x4003d,0x8,0xa83,0xa82, + 0x50085,0x8,0xa8b,0xa7f,0xc61,0x60050,0x12,0xa98,0xa8b,0xa8b,0xa8b,0x50083, + 0x12,0xa8d,0x57e,0xa98,0x50083,0x8,0xa91,0xa83,0xa7f,0x50085,0x8,0xa92, + 0xa91,0xc61,0x60050,0x12,0xa9c,0xa92,0xa92,0xa92,0x50088,0x12,0xa94,0xa8d, + 0xa9c,0x200f9,0x9ea,0x200f8,0x9ea,0xb00f5,0x12,0xbed,0xbdf,0x822,0xa3b,0x9dc, + 0x9e4,0x9df,0xa94,0x9e5,0x50094,0x8,0xaa0,0xbed,0x1b3,0x200f9,0x826,0x200f8, + 0x826,0xb00f5,0x8,0xc05,0xb1,0x595,0x8f9,0x843,0x9d1,0x911,0xaa0,0x9ea, + 0x50081,0x8,0x517,0x2bd,0xc05,0x50041,0x13c,0xaa3,0x13a,0xc72,0x4003d,0x46, + 0xaa4,0xaa3,0x4006f,0x20,0x51a,0xaa4,0x50085,0x20,0x51b,0xbda,0x51a,0x6000c, + 0x8,0x51c,0x1,0x42,0x51b,0x500ba,0x8c,0x51e,0x51c,0xbb,0x600a9,0x6, + 0x51f,0x51e,0x16a,0x164,0x5008e,0x20,0x523,0x51a,0x2d4,0x6000c,0x8,0x524, + 0x1,0x42,0x523,0x50088,0x8,0x525,0x51c,0x524,0x8000c,0x8,0xaac,0x1, + 0x2b,0x525,0xb1,0xbb,0x50085,0x8,0x527,0xaac,0x2da,0x4006d,0x6,0x528, + 0x527,0x50084,0x6,0x529,0x51f,0x528,0x500ac,0x8c,0x52b,0x529,0x164,0x300f7, + 0x55b,0x0,0x400fa,0x52b,0x52c,0x55b,0x200f8,0x52c,0x7000c,0x8,0xac3,0x1, + 0x28,0x514,0x517,0x500b7,0x8c,0xab7,0xac3,0xb1,0x300f7,0xabd,0x0,0x400fa, + 0xab7,0xab8,0xabc,0x200f8,0xab8,0x7000c,0x8,0xac8,0x1,0x25,0x514,0x517, + 0x50088,0x8,0xabb,0xac8,0xac3,0x200f9,0xabd,0x200f8,0xabc,0x200f9,0xabd,0x200f8, + 0xabd,0x700f5,0x8,0xc12,0xabb,0xab8,0xb1,0xabc,0x7000c,0x8,0xacd,0x1, + 0x1a,0xc12,0xbb,0x50085,0x8,0x531,0xacd,0x2e9,0x6000c,0x8,0xad1,0x1, + 0x2,0x531,0x4006d,0x6,0x533,0xad1,0x50051,0x8,0xad5,0x50e,0x0,0x500ba, + 0x8c,0xad6,0xad5,0xb1,0x300f7,0xadb,0x0,0x400fa,0xad6,0xad7,0xadb,0x200f8, + 0xad7,0x500b8,0x8c,0xada,0xad5,0xbb,0x200f9,0xadb,0x200f8,0xadb,0x700f5,0x8c, + 0xadc,0xad6,0xabd,0xada,0xad7,0x300f7,0xae7,0x0,0x400fa,0xadc,0xadd,0xae7, + 0x200f8,0xadd,0x50051,0x8,0xadf,0x50e,0x1,0x500ba,0x8c,0xae0,0xadf,0xb1, + 0x300f7,0xae5,0x0,0x400fa,0xae0,0xae1,0xae5,0x200f8,0xae1,0x500b8,0x8c,0xae4, + 0xadf,0xbb,0x200f9,0xae5,0x200f8,0xae5,0x700f5,0x8c,0xae6,0xae0,0xadd,0xae4, + 0xae1,0x200f9,0xae7,0x200f8,0xae7,0x700f5,0x8c,0xae8,0xadc,0xadb,0xae6,0xae5, + 0x600a9,0x6,0x538,0xae8,0x16a,0x164,0x50084,0x6,0x539,0x533,0x538,0x500c7, + 0x6,0xaf4,0x529,0x289,0x500c4,0x6,0xaf5,0xaf4,0x28b,0x500c5,0x6,0xaf6, + 0x286,0xaf5,0x500c7,0x6,0xaf8,0x539,0x28f,0x500c4,0x6,0xaf9,0xaf8,0x291, + 0x500c5,0x6,0xafa,0xaf6,0xaf9,0x50051,0x8,0xafd,0x50b,0x0,0x50050,0x20, + 0xb0b,0xafd,0xb1,0x6000c,0x6,0xb0c,0x1,0x3a,0xb0b,0x500c5,0x6,0xaff, + 0xafa,0xb0c,0x50051,0x8,0xb02,0x50b,0x1,0x50050,0x20,0xb10,0xb02,0xb1, + 0x6000c,0x6,0xb11,0x1,0x3a,0xb10,0x500c5,0x6,0xb04,0xafa,0xb11,0x50081, + 0x20,0x540,0x509,0x50b,0x50085,0x20,0xb2e,0x540,0x508,0x50083,0x20,0xb2f, + 0xb2e,0x21c,0x6000c,0x20,0xb31,0x1,0x8,0xb2f,0x4006e,0x46,0xb32,0xb31, + 0x3003e,0xb9c,0xc60,0x200f9,0x543,0x200f8,0x543,0x700f5,0x45,0xc30,0x18c,0xae7, + 0x559,0x557,0x500b1,0x8c,0x546,0xc30,0x30f,0x400f6,0x55a,0x557,0x0,0x400fa, + 0x546,0x547,0x55a,0x200f8,0x547,0x50041,0x60,0xba1,0xb9c,0xc30,0x4003d,0x46, + 0x54a,0xba1,0x50080,0x46,0x54e,0xb32,0x54a,0x4007c,0x69,0xb71,0x54e,0x4007c, + 0x69,0xb73,0x560,0x500b0,0x255,0xb74,0xb71,0xb73,0x4009b,0x8c,0xb75,0xb74, + 0x300f7,0x556,0x0,0x400fa,0xb75,0x552,0x556,0x200f8,0x552,0x6003c,0x1a6,0xb7a, + 0x1a2,0x54e,0x164,0x700ef,0x6,0xb7b,0xb7a,0x16a,0x164,0xaff,0x6003c,0x1a6, + 0xb7f,0x1a9,0x54e,0x164,0x700ef,0x6,0xb80,0xb7f,0x16a,0x164,0xb04,0x200f9, + 0x556,0x200f8,0x556,0x200f9,0x557,0x200f8,0x557,0x50080,0x45,0x559,0xc30,0x154, + 0x200f9,0x543,0x200f8,0x55a,0x200f9,0x55b,0x200f8,0x55b,0x100fd,0x10038, +}; +static const char *fi_optical_flow_vector_field_pass_1_cb_names[] = {"cbFI"}; +static const uint32_t fi_optical_flow_vector_field_pass_1_cb_bind[] = {8}; +static const uint32_t fi_optical_flow_vector_field_pass_1_cb_count[] = {1}; +static const uint32_t fi_optical_flow_vector_field_pass_1_cb_space[] = {0}; +static const char *fi_optical_flow_vector_field_pass_1_srv_tex_names[] = {"r_optical_flow", "r_previous_interpolation_source", "r_current_interpolation_source"}; +static const uint32_t fi_optical_flow_vector_field_pass_1_srv_tex_bind[] = {0, 3, 4}; +static const uint32_t fi_optical_flow_vector_field_pass_1_srv_tex_count[] = {1, 1, 1}; +static const uint32_t fi_optical_flow_vector_field_pass_1_srv_tex_space[] = {0, 0, 0}; +static const char *fi_optical_flow_vector_field_pass_1_uav_tex_names[] = {"rw_optical_flow_motion_vector_field_x", "rw_optical_flow_motion_vector_field_y"}; +static const uint32_t fi_optical_flow_vector_field_pass_1_uav_tex_bind[] = {6, 7}; +static const uint32_t fi_optical_flow_vector_field_pass_1_uav_tex_count[] = {1, 1}; +static const uint32_t fi_optical_flow_vector_field_pass_1_uav_tex_space[] = {0, 0}; +static const char *fi_optical_flow_vector_field_pass_1_sampler_names[] = {"s_LinearClamp"}; +static const uint32_t fi_optical_flow_vector_field_pass_1_sampler_bind[] = {1000}; +static const uint32_t fi_optical_flow_vector_field_pass_1_sampler_count[] = {1}; +static const uint32_t fi_optical_flow_vector_field_pass_1_sampler_space[] = {0}; + +static const uint32_t fi_disocclusion_mask_pass_1_spv[2587] = { + 0x7230203,0x10500,0x8000b,0xc4a,0x0,0x20011,0x1,0x20011,0x31,0x6000b,0x1,0x4c534c47, + 0x6474732e,0x3035342e,0x0,0x3000e,0x0,0x1,0x10000f,0x5,0x4,0x6e69616d,0x0,0xbd, + 0xcc,0xd6,0xe0,0xea,0xf0,0xfa,0x102,0x106,0x111,0x3c6,0x60010,0x4, + 0x11,0x8,0x8,0x1,0x30003,0x2,0x1c2,0xb0004,0x455f4c47,0x735f5458,0x6c706d61,0x656c7265, + 0x745f7373,0x75747865,0x665f6572,0x74636e75,0x736e6f69,0x0,0xb0004,0x455f4c47,0x735f5458,0x65646168,0x78655f72,0x63696c70, + 0x615f7469,0x68746972,0x6974656d,0x79745f63,0x736570,0xa0004,0x475f4c47,0x4c474f4f,0x70635f45,0x74735f70,0x5f656c79,0x656e696c, + 0x7269645f,0x69746365,0x6576,0x80004,0x475f4c47,0x4c474f4f,0x6e695f45,0x64756c63,0x69645f65,0x74636572,0x657669,0x40005, + 0x4,0x6e69616d,0x0,0x40005,0xbb,0x49466263,0x745f,0x60006,0xbb,0x0,0x646e6572,0x69537265, + 0x657a,0x80006,0xbb,0x1,0x76654466,0x54656369,0x6569566f,0x70654477,0x6874,0x40005,0xbd,0x49466263, + 0x0,0x60005,0xcc,0x69645f72,0x6574616c,0x65645f64,0x687470,0xc0005,0xd6,0x65725f72,0x736e6f63,0x63757274, + 0x5f646574,0x74706564,0x72705f68,0x6f697665,0x665f7375,0x656d6172,0x0,0xd0005,0xe0,0x65725f72,0x736e6f63,0x63757274, + 0x5f646574,0x74706564,0x6e695f68,0x70726574,0x74616c6f,0x665f6465,0x656d6172,0x0,0xa0005,0xea,0x61675f72,0x6d5f656d, + 0x6f69746f,0x65765f6e,0x726f7463,0x6569665f,0x785f646c,0x0,0xa0005,0xf0,0x61675f72,0x6d5f656d,0x6f69746f,0x65765f6e, + 0x726f7463,0x6569665f,0x795f646c,0x0,0x80005,0xfa,0x6e695f72,0x6e696170,0x676e6974,0x7279705f,0x64696d61,0x0, + 0x90005,0x102,0x6e695f72,0x5f747570,0x74736964,0x6974726f,0x665f6e6f,0x646c6569,0x0,0x60005,0x106,0x694c5f73, + 0x7261656e,0x6d616c43,0x70,0x80005,0x111,0x645f7772,0x636f7369,0x73756c63,0x5f6e6f69,0x6b73616d,0x0,0x80005, + 0x3c6,0x475f6c67,0x61626f6c,0x766e496c,0x7461636f,0x496e6f69,0x44,0x30047,0xbb,0x2,0x50048,0xbb, + 0x0,0x23,0x0,0x50048,0xbb,0x1,0x23,0x30,0x40047,0xbd,0x21,0x8, + 0x40047,0xbd,0x22,0x0,0x40047,0xcc,0x21,0x3,0x40047,0xcc,0x22,0x0, + 0x40047,0xd6,0x21,0x2,0x40047,0xd6,0x22,0x0,0x40047,0xe0,0x21,0x4, + 0x40047,0xe0,0x22,0x0,0x40047,0xea,0x21,0x0,0x40047,0xea,0x22,0x0, + 0x40047,0xf0,0x21,0x1,0x40047,0xf0,0x22,0x0,0x40047,0xfa,0x21,0x5, + 0x40047,0xfa,0x22,0x0,0x40047,0x102,0x21,0x6,0x40047,0x102,0x22,0x0, + 0x40047,0x106,0x21,0x3e8,0x40047,0x106,0x22,0x0,0x40047,0x111,0x21,0x7, + 0x40047,0x111,0x22,0x0,0x40047,0x3c6,0xb,0x1c,0x40047,0x3d5,0xb,0x19, + 0x20013,0x2,0x30021,0x3,0x2,0x40015,0x6,0x20,0x0,0x30016,0x8,0x20, + 0x40020,0xd,0x7,0x8,0x40017,0xe,0x8,0x2,0x40015,0x2b,0x20,0x1, + 0x40017,0x2c,0x2b,0x2,0x40017,0x30,0x8,0x4,0x40020,0x34,0x7,0x2c, + 0x40017,0x3f,0x6,0x2,0x4002b,0x6,0x53,0x4,0x4001c,0x54,0x2c,0x53, + 0x4001c,0x55,0x8,0x53,0x40017,0x64,0x8,0x3,0x20014,0x6b,0x4002b,0x8, + 0xa9,0x0,0x4002b,0x8,0xaa,0x3f800000,0x4001e,0xbb,0x2c,0x30,0x40020,0xbc, + 0x2,0xbb,0x4003b,0xbc,0xbd,0x2,0x4002b,0x2b,0xbe,0x0,0x40020,0xbf, + 0x2,0x2c,0x40020,0xc5,0x2,0x30,0x90019,0xca,0x8,0x1,0x0,0x0, + 0x0,0x1,0x0,0x40020,0xcb,0x0,0xca,0x4003b,0xcb,0xcc,0x0,0x90019, + 0xd4,0x6,0x1,0x0,0x0,0x0,0x1,0x0,0x40020,0xd5,0x0,0xd4, + 0x4003b,0xd5,0xd6,0x0,0x40017,0xd9,0x6,0x4,0x4003b,0xd5,0xe0,0x0, + 0x4003b,0xd5,0xea,0x0,0x4003b,0xd5,0xf0,0x0,0x4003b,0xcb,0xfa,0x0, + 0x4003b,0xcb,0x102,0x0,0x2001a,0x104,0x40020,0x105,0x0,0x104,0x4003b,0x105, + 0x106,0x0,0x3001b,0x108,0xca,0x90019,0x10f,0x8,0x1,0x0,0x0,0x0, + 0x2,0xd,0x40020,0x110,0x0,0x10f,0x4003b,0x110,0x111,0x0,0x4002b,0x8, + 0x11d,0x3f000000,0x5002c,0xe,0x11e,0x11d,0x11d,0x4002b,0x2b,0x122,0x2,0x5002c, + 0x2c,0x12b,0xbe,0xbe,0x4002b,0x2b,0x12d,0x1,0x5002c,0x2c,0x12e,0x12d, + 0xbe,0x5002c,0x2c,0x130,0xbe,0x12d,0x5002c,0x2c,0x133,0x12d,0x12d,0x4002b, + 0x6,0x138,0x1,0x4002b,0x8,0x165,0x40000000,0x4002b,0x8,0x166,0xc0000000,0x5002c, + 0xe,0x167,0x165,0x166,0x4002b,0x8,0x169,0xbf800000,0x5002c,0xe,0x16a,0x169, + 0xaa,0x40017,0x197,0x6b,0x2,0x4002b,0x6,0x1bb,0x15,0x4002b,0x6,0x1bd, + 0x3ff,0x4002b,0x2b,0x1cd,0x4,0x7002c,0x30,0x200,0xa9,0xa9,0xa9,0xa9, + 0x4002b,0x2b,0x261,0xb,0x4002b,0x8,0x2e7,0x3a83126f,0x4002b,0x8,0x327,0x3765d90d, + 0x5002c,0xe,0x38e,0xa9,0xa9,0x5002c,0xe,0x38f,0xaa,0xaa,0x40017,0x3c4, + 0x6,0x3,0x40020,0x3c5,0x1,0x3c4,0x4003b,0x3c5,0x3c6,0x1,0x4002b,0x6, + 0x3d4,0x8,0x6002c,0x3c4,0x3d5,0x3d4,0x3d4,0x138,0x40020,0x9de,0x7,0x54, + 0x40020,0x9e0,0x7,0x55,0x7002c,0x54,0xbf1,0x12b,0x12e,0x130,0x133,0x5002c, + 0x2c,0xbf2,0x122,0x122,0x5002c,0xe,0xbf3,0x2e7,0x2e7,0x4002b,0x8,0xbf4, + 0x3a802008,0x50036,0x2,0x4,0x0,0x3,0x200f8,0x5,0x4003b,0x9e0,0xa3c,0x7, + 0x4003b,0x9de,0xa3b,0x7,0x4003b,0x9e0,0xa1b,0x7,0x4003b,0x9de,0xa1a,0x7, + 0x4003b,0x9e0,0x9fa,0x7,0x4003b,0x9de,0x9f9,0x7,0x4003d,0x3c4,0x3c7,0x3c6, + 0x7004f,0x3f,0x3c8,0x3c7,0x3c7,0x0,0x1,0x4007c,0x2c,0x3c9,0x3c8,0x4003d, + 0xd4,0x447,0xe0,0x7005f,0xd9,0x449,0x447,0x3c9,0x2002,0xbe,0x50051,0x6, + 0x44a,0x449,0x0,0x4007c,0x8,0x44f,0x44a,0x4006f,0xe,0x3fc,0x3c9,0x50081, + 0xe,0x3fe,0x3fc,0x11e,0x50041,0xbf,0x452,0xbd,0xbe,0x4003d,0x2c,0x453, + 0x452,0x4006f,0xe,0x400,0x453,0x50088,0xe,0x401,0x3fe,0x400,0x4006e,0x2c, + 0x473,0x3fe,0x4003d,0xd4,0x4b9,0xea,0x7005f,0xd9,0x4bb,0x4b9,0x473,0x2002, + 0xbe,0x50051,0x6,0x4bc,0x4bb,0x0,0x4003d,0xd4,0x4bd,0xf0,0x7005f,0xd9, + 0x4bf,0x4bd,0x473,0x2002,0xbe,0x50051,0x6,0x4c0,0x4bf,0x0,0x500c2,0x6, + 0x4ca,0x4bc,0x1bb,0x500c7,0x6,0x4cb,0x4ca,0x1bd,0x40070,0x8,0x4cc,0x4cb, + 0x50085,0x8,0x4cd,0x4cc,0xbf4,0x6000c,0xe,0x502,0x1,0x3e,0x4bc,0x50051, + 0x8,0x4f2,0x502,0x0,0x6000c,0xe,0x506,0x1,0x3e,0x4c0,0x50051,0x8, + 0x4f7,0x506,0x0,0x50050,0xe,0xc49,0x4f2,0x4f7,0x500bd,0x6b,0x47b,0x4cd, + 0xa9,0x300f7,0x49e,0x0,0x400fa,0x47b,0x47c,0x49e,0x200f8,0x47c,0x200f9,0x47e, + 0x200f8,0x47e,0x700f5,0x30,0xc45,0x200,0x47c,0x552,0x490,0x700f5,0x2c,0xb93, + 0x453,0x47c,0x48b,0x490,0x700f5,0x2b,0xb0c,0xbe,0x47c,0x492,0x490,0x400f6, + 0x493,0x490,0x0,0x200f9,0x47f,0x200f8,0x47f,0x500b1,0x6b,0x481,0xb0c,0x261, + 0x300f7,0x486,0x0,0x400fa,0x481,0x482,0x486,0x200f8,0x482,0x50051,0x8,0x484, + 0xc45,0x3,0x500b4,0x6b,0x485,0x484,0xa9,0x200f9,0x486,0x200f8,0x486,0x700f5, + 0x6b,0x487,0x481,0x47f,0x485,0x482,0x400fa,0x487,0x488,0x493,0x200f8,0x488, + 0x50087,0x2c,0x48b,0xb93,0xbf2,0x4006f,0xe,0x55c,0x48b,0x50085,0xe,0x55d, + 0x401,0x55c,0x50083,0xe,0x55e,0x55d,0x11e,0x6000c,0xe,0x560,0x1,0x8, + 0x55e,0x4006e,0x2c,0x561,0x560,0x6000c,0xe,0x589,0x1,0xa,0x55e,0x50051, + 0x8,0x56a,0x589,0x0,0x50083,0x8,0x56b,0xaa,0x56a,0x50051,0x8,0x56d, + 0x589,0x1,0x50083,0x8,0x56e,0xaa,0x56d,0x50085,0x8,0x56f,0x56b,0x56e, + 0x50085,0x8,0x576,0x56a,0x56e,0x50085,0x8,0x57d,0x56b,0x56d,0x50085,0x8, + 0x583,0x56a,0x56d,0x70050,0x55,0xafa,0x56f,0x576,0x57d,0x583,0x3003e,0xa3b, + 0xbf1,0x3003e,0xa3c,0xafa,0x200f9,0x520,0x200f8,0x520,0x700f5,0x30,0xc47,0x200, + 0x488,0xc48,0x548,0x700f5,0x8,0xb96,0xa9,0x488,0xbee,0x548,0x700f5,0x2b, + 0xb95,0xbe,0x488,0x54a,0x548,0x500b1,0x6b,0x523,0xb95,0x1cd,0x400f6,0x54b, + 0x548,0x0,0x400fa,0x523,0x524,0x54b,0x200f8,0x524,0x50041,0x34,0xa41,0xa3b, + 0xb95,0x4003d,0x2c,0x527,0xa41,0x50080,0x2c,0x52b,0x561,0x527,0x4007c,0x3f, + 0x58d,0x52b,0x4007c,0x3f,0x58f,0x48b,0x500b0,0x197,0x590,0x58d,0x58f,0x4009b, + 0x6b,0x591,0x590,0x300f7,0x547,0x0,0x400fa,0x591,0x52e,0x547,0x200f8,0x52e, + 0x4003d,0xca,0x594,0xfa,0x7005f,0x30,0x598,0x594,0x52b,0x2,0xb0c,0x50051, + 0x8,0x533,0x598,0x2,0x500ba,0x6b,0x536,0x533,0xa9,0x600a9,0x8,0x537, + 0x536,0xaa,0xa9,0x50041,0xd,0xa42,0xa3c,0xb95,0x4003d,0x8,0x53a,0xa42, + 0x50085,0x8,0x53c,0x53a,0x537,0x50085,0x8,0x53e,0x53c,0x533,0x50081,0x8, + 0x541,0xb96,0x53e,0x5008e,0x30,0x544,0x598,0x53e,0x50081,0x30,0x546,0xc47, + 0x544,0x200f9,0x547,0x200f8,0x547,0x700f5,0x30,0xc48,0xc47,0x524,0x546,0x52e, + 0x700f5,0x8,0xbee,0xb96,0x524,0x541,0x52e,0x200f9,0x548,0x200f8,0x548,0x50080, + 0x2b,0x54a,0xb95,0x12d,0x200f9,0x520,0x200f8,0x54b,0x500ba,0x6b,0x54d,0xb96, + 0xa9,0x600a9,0x8,0x54f,0x54d,0xb96,0xaa,0x70050,0x30,0x551,0x54f,0x54f, + 0x54f,0x54f,0x50088,0x30,0x552,0xc47,0x551,0x200f9,0x490,0x200f8,0x490,0x50080, + 0x2b,0x492,0xb0c,0x12d,0x200f9,0x47e,0x200f8,0x493,0x7004f,0xe,0x495,0xc45, + 0xc45,0x0,0x1,0x200f9,0x49e,0x200f8,0x49e,0x700f5,0xe,0xb12,0xc49,0x5, + 0x495,0x493,0x50081,0xe,0x40a,0x401,0xb12,0x50041,0xc5,0x66c,0xbd,0x138, + 0x4003d,0x30,0x66d,0x66c,0x50051,0x8,0x664,0x66d,0x1,0x50051,0x8,0x667, + 0x66d,0x0,0x50083,0x8,0x668,0x44f,0x667,0x50088,0x8,0x669,0x664,0x668, + 0x50085,0xe,0x67b,0x40a,0x400,0x50083,0xe,0x67c,0x67b,0x11e,0x6000c,0xe, + 0x67e,0x1,0x8,0x67c,0x4006e,0x2c,0x67f,0x67e,0x6000c,0xe,0x6a7,0x1, + 0xa,0x67c,0x50051,0x8,0x688,0x6a7,0x0,0x50083,0x8,0x689,0xaa,0x688, + 0x50051,0x8,0x68b,0x6a7,0x1,0x50083,0x8,0x68c,0xaa,0x68b,0x50085,0x8, + 0x68d,0x689,0x68c,0x50085,0x8,0x694,0x688,0x68c,0x50085,0x8,0x69b,0x689, + 0x68b,0x50085,0x8,0x6a1,0x688,0x68b,0x70050,0x55,0xace,0x68d,0x694,0x69b, + 0x6a1,0x3003e,0xa1a,0xbf1,0x3003e,0xa1b,0xace,0x200f9,0x5fb,0x200f8,0x5fb,0x700f5, + 0x8,0xb55,0xa9,0x49e,0xba5,0x650,0x700f5,0x8,0xb54,0xa9,0x49e,0xba2, + 0x650,0x700f5,0x2b,0xb53,0xbe,0x49e,0x652,0x650,0x500b1,0x6b,0x5fe,0xb53, + 0x1cd,0x400f6,0x653,0x650,0x0,0x400fa,0x5fe,0x5ff,0x653,0x200f8,0x5ff,0x50041, + 0x34,0xa20,0xa1a,0xb53,0x4003d,0x2c,0x602,0xa20,0x50080,0x2c,0x606,0x67f, + 0x602,0x4007c,0x3f,0x6af,0x606,0x4007c,0x3f,0x6b1,0x453,0x500b0,0x197,0x6b2, + 0x6af,0x6b1,0x4009b,0x6b,0x6b3,0x6b2,0x300f7,0x64f,0x0,0x400fa,0x6b3,0x60a, + 0x64f,0x200f8,0x60a,0x50041,0xd,0xa21,0xa1b,0xb53,0x4003d,0x8,0x60d,0xa21, + 0x500ba,0x6b,0x60f,0x60d,0x2e7,0x300f7,0x64e,0x0,0x400fa,0x60f,0x610,0x64e, + 0x200f8,0x610,0x4006f,0xe,0x6c0,0x606,0x50081,0xe,0x6c2,0x6c0,0x11e,0x50088, + 0xe,0x6c5,0x6c2,0x400,0x4003d,0xca,0x6e6,0x102,0x4003d,0x104,0x6e7,0x106, + 0x50056,0x108,0x6e8,0x6e6,0x6e7,0x70058,0x30,0x6ea,0x6e8,0x6c5,0x2,0xa9, + 0x7004f,0xe,0x6eb,0x6ea,0x6ea,0x0,0x1,0x50085,0xe,0x6cb,0x6eb,0x400, + 0x4006e,0x2c,0x6cc,0x6cb,0x50080,0x2c,0x6d2,0x606,0x6cc,0x4003d,0xd4,0x6f3, + 0xd6,0x7005f,0xd9,0x6f5,0x6f3,0x6d2,0x2002,0xbe,0x50051,0x6,0x6f6,0x6f5, + 0x0,0x4007c,0x8,0x6fb,0x6f6,0x50083,0x8,0x70b,0x6fb,0x667,0x50088,0x8, + 0x70c,0x664,0x70b,0x50083,0x8,0x618,0x669,0x70c,0x500ba,0x6b,0x61a,0x618, + 0xa9,0x300f7,0x64d,0x0,0x400fa,0x61a,0x61b,0x64d,0x200f8,0x61b,0x7000c,0x8, + 0x715,0x1,0x25,0x6fb,0x44f,0x5008e,0xe,0x621,0x400,0x11d,0x4006e,0x2c, + 0x622,0x621,0x50083,0x8,0x74e,0x715,0x667,0x50088,0x8,0x74f,0x664,0x74e, + 0x4006f,0xe,0x72c,0x622,0x50088,0xe,0x759,0x72c,0x400,0x50085,0xe,0x75a, + 0x759,0x167,0x50081,0xe,0x75b,0x75a,0x16a,0x50051,0x8,0x730,0x66d,0x2, + 0x50051,0x8,0x732,0x75b,0x0,0x50085,0x8,0x733,0x730,0x732,0x50085,0x8, + 0x735,0x733,0x74f,0x50051,0x8,0x737,0x66d,0x3,0x50051,0x8,0x739,0x75b, + 0x1,0x50085,0x8,0x73a,0x737,0x739,0x50085,0x8,0x73c,0x73a,0x74f,0x60050, + 0x64,0x740,0x735,0x73c,0x74f,0x50085,0x8,0x775,0x730,0x169,0x50085,0x8, + 0x777,0x775,0x74f,0x50085,0x8,0x77e,0x737,0x74f,0x60050,0x64,0x782,0x777, + 0x77e,0x74f,0x6000c,0x8,0x62b,0x1,0x42,0x400,0x7000c,0x8,0x7a6,0x1, + 0x25,0x669,0x70c,0x6000c,0x8,0x630,0x1,0x42,0x782,0x6000c,0x8,0x632, + 0x1,0x42,0x740,0x50088,0x8,0x633,0x630,0x632,0x50085,0x8,0x635,0x327, + 0x633,0x50085,0x8,0x637,0x635,0x62b,0x50085,0x8,0x639,0x637,0x7a6,0x50088, + 0x8,0x643,0x639,0x618,0x500be,0x6b,0x644,0x643,0xaa,0x600a9,0x8,0x645, + 0x644,0xaa,0xa9,0x50085,0x8,0x647,0x645,0x60d,0x50081,0x8,0x649,0xb55, + 0x647,0x50081,0x8,0x64c,0xb54,0x60d,0x200f9,0x64d,0x200f8,0x64d,0x700f5,0x8, + 0xba7,0xb55,0x610,0x649,0x61b,0x700f5,0x8,0xba4,0xb54,0x610,0x64c,0x61b, + 0x200f9,0x64e,0x200f8,0x64e,0x700f5,0x8,0xba6,0xb55,0x60a,0xba7,0x64d,0x700f5, + 0x8,0xba3,0xb54,0x60a,0xba4,0x64d,0x200f9,0x64f,0x200f8,0x64f,0x700f5,0x8, + 0xba5,0xb55,0x5ff,0xba6,0x64e,0x700f5,0x8,0xba2,0xb54,0x5ff,0xba3,0x64e, + 0x200f9,0x650,0x200f8,0x650,0x50080,0x2b,0x652,0xb53,0x12d,0x200f9,0x5fb,0x200f8, + 0x653,0x500ba,0x6b,0x655,0xb54,0xa9,0x300f7,0x65d,0x0,0x400fa,0x655,0x656, + 0x65c,0x200f8,0x65c,0x200f9,0x65d,0x200f8,0x656,0x50088,0x8,0x659,0xb55,0xb54, + 0x50083,0x8,0x65a,0xaa,0x659,0x8000c,0x8,0x7b8,0x1,0x2b,0x65a,0xa9, + 0xaa,0x200f9,0x65d,0x200f8,0x65d,0x700f5,0x8,0xb56,0x7b8,0x656,0xa9,0x65c, + 0x50083,0x8,0x40d,0xaa,0xb56,0x50083,0xe,0x411,0x401,0xb12,0x50085,0xe, + 0x86d,0x411,0x400,0x50083,0xe,0x86e,0x86d,0x11e,0x6000c,0xe,0x870,0x1, + 0x8,0x86e,0x4006e,0x2c,0x871,0x870,0x6000c,0xe,0x899,0x1,0xa,0x86e, + 0x50051,0x8,0x87a,0x899,0x0,0x50083,0x8,0x87b,0xaa,0x87a,0x50051,0x8, + 0x87d,0x899,0x1,0x50083,0x8,0x87e,0xaa,0x87d,0x50085,0x8,0x87f,0x87b, + 0x87e,0x50085,0x8,0x886,0x87a,0x87e,0x50085,0x8,0x88d,0x87b,0x87d,0x50085, + 0x8,0x893,0x87a,0x87d,0x70050,0x55,0xaa2,0x87f,0x886,0x88d,0x893,0x3003e, + 0x9f9,0xbf1,0x3003e,0x9fa,0xaa2,0x200f9,0x7ed,0x200f8,0x7ed,0x700f5,0x8,0xb5f, + 0xa9,0x65d,0xbb7,0x842,0x700f5,0x8,0xb5e,0xa9,0x65d,0xbb4,0x842,0x700f5, + 0x2b,0xb5d,0xbe,0x65d,0x844,0x842,0x500b1,0x6b,0x7f0,0xb5d,0x1cd,0x400f6, + 0x845,0x842,0x0,0x400fa,0x7f0,0x7f1,0x845,0x200f8,0x7f1,0x50041,0x34,0x9ff, + 0x9f9,0xb5d,0x4003d,0x2c,0x7f4,0x9ff,0x50080,0x2c,0x7f8,0x871,0x7f4,0x4007c, + 0x3f,0x8a1,0x7f8,0x4007c,0x3f,0x8a3,0x453,0x500b0,0x197,0x8a4,0x8a1,0x8a3, + 0x4009b,0x6b,0x8a5,0x8a4,0x300f7,0x841,0x0,0x400fa,0x8a5,0x7fc,0x841,0x200f8, + 0x7fc,0x50041,0xd,0xa00,0x9fa,0xb5d,0x4003d,0x8,0x7ff,0xa00,0x500ba,0x6b, + 0x801,0x7ff,0x2e7,0x300f7,0x840,0x0,0x400fa,0x801,0x802,0x840,0x200f8,0x802, + 0x4006f,0xe,0x8b2,0x7f8,0x50081,0xe,0x8b4,0x8b2,0x11e,0x50088,0xe,0x8b7, + 0x8b4,0x400,0x4003d,0xca,0x8d8,0x102,0x4003d,0x104,0x8d9,0x106,0x50056,0x108, + 0x8da,0x8d8,0x8d9,0x70058,0x30,0x8dc,0x8da,0x8b7,0x2,0xa9,0x7004f,0xe, + 0x8dd,0x8dc,0x8dc,0x0,0x1,0x50085,0xe,0x8bd,0x8dd,0x400,0x4006e,0x2c, + 0x8be,0x8bd,0x50080,0x2c,0x8cc,0x7f8,0x8be,0x4003d,0xca,0x8f0,0xcc,0x7005f, + 0x30,0x8f2,0x8f0,0x8cc,0x2,0xbe,0x50051,0x8,0x8f3,0x8f2,0x0,0x50083, + 0x8,0x8fd,0x8f3,0x667,0x50088,0x8,0x8fe,0x664,0x8fd,0x50083,0x8,0x80a, + 0x669,0x8fe,0x500ba,0x6b,0x80c,0x80a,0xa9,0x300f7,0x83f,0x0,0x400fa,0x80c, + 0x80d,0x83f,0x200f8,0x80d,0x7000c,0x8,0x907,0x1,0x25,0x8f3,0x44f,0x5008e, + 0xe,0x813,0x400,0x11d,0x4006e,0x2c,0x814,0x813,0x50083,0x8,0x940,0x907, + 0x667,0x50088,0x8,0x941,0x664,0x940,0x4006f,0xe,0x91e,0x814,0x50088,0xe, + 0x94b,0x91e,0x400,0x50085,0xe,0x94c,0x94b,0x167,0x50081,0xe,0x94d,0x94c, + 0x16a,0x50051,0x8,0x922,0x66d,0x2,0x50051,0x8,0x924,0x94d,0x0,0x50085, + 0x8,0x925,0x922,0x924,0x50085,0x8,0x927,0x925,0x941,0x50051,0x8,0x929, + 0x66d,0x3,0x50051,0x8,0x92b,0x94d,0x1,0x50085,0x8,0x92c,0x929,0x92b, + 0x50085,0x8,0x92e,0x92c,0x941,0x60050,0x64,0x932,0x927,0x92e,0x941,0x50085, + 0x8,0x967,0x922,0x169,0x50085,0x8,0x969,0x967,0x941,0x50085,0x8,0x970, + 0x929,0x941,0x60050,0x64,0x974,0x969,0x970,0x941,0x6000c,0x8,0x81d,0x1, + 0x42,0x400,0x7000c,0x8,0x998,0x1,0x25,0x669,0x8fe,0x6000c,0x8,0x822, + 0x1,0x42,0x974,0x6000c,0x8,0x824,0x1,0x42,0x932,0x50088,0x8,0x825, + 0x822,0x824,0x50085,0x8,0x827,0x327,0x825,0x50085,0x8,0x829,0x827,0x81d, + 0x50085,0x8,0x82b,0x829,0x998,0x50088,0x8,0x835,0x82b,0x80a,0x500be,0x6b, + 0x836,0x835,0xaa,0x600a9,0x8,0x837,0x836,0xaa,0xa9,0x50085,0x8,0x839, + 0x837,0x7ff,0x50081,0x8,0x83b,0xb5f,0x839,0x50081,0x8,0x83e,0xb5e,0x7ff, + 0x200f9,0x83f,0x200f8,0x83f,0x700f5,0x8,0xbb9,0xb5f,0x802,0x83b,0x80d,0x700f5, + 0x8,0xbb6,0xb5e,0x802,0x83e,0x80d,0x200f9,0x840,0x200f8,0x840,0x700f5,0x8, + 0xbb8,0xb5f,0x7fc,0xbb9,0x83f,0x700f5,0x8,0xbb5,0xb5e,0x7fc,0xbb6,0x83f, + 0x200f9,0x841,0x200f8,0x841,0x700f5,0x8,0xbb7,0xb5f,0x7f1,0xbb8,0x840,0x700f5, + 0x8,0xbb4,0xb5e,0x7f1,0xbb5,0x840,0x200f9,0x842,0x200f8,0x842,0x50080,0x2b, + 0x844,0xb5d,0x12d,0x200f9,0x7ed,0x200f8,0x845,0x500ba,0x6b,0x847,0xb5e,0xa9, + 0x300f7,0x84f,0x0,0x400fa,0x847,0x848,0x84e,0x200f8,0x84e,0x200f9,0x84f,0x200f8, + 0x848,0x50088,0x8,0x84b,0xb5f,0xb5e,0x50083,0x8,0x84c,0xaa,0x84b,0x8000c, + 0x8,0x9aa,0x1,0x2b,0x84c,0xa9,0xaa,0x200f9,0x84f,0x200f8,0x84f,0x700f5, + 0x8,0xb60,0x9aa,0x848,0xa9,0x84e,0x50083,0x8,0x414,0xaa,0xb60,0x50050, + 0xe,0x417,0x40d,0x414,0x500be,0x197,0x41a,0x417,0xbf3,0x600a9,0xe,0x41b, + 0x41a,0x38f,0x38e,0x5008e,0xe,0x41e,0xb12,0x165,0x50081,0xe,0x421,0x401, + 0x41e,0x50085,0xe,0x424,0x421,0x400,0x4006e,0x2c,0x425,0x424,0x50051,0x8, + 0x427,0x41b,0x0,0x4007c,0x3f,0x9ba,0x425,0x4007c,0x3f,0x9bc,0x453,0x500b0, + 0x197,0x9bd,0x9ba,0x9bc,0x4009b,0x6b,0x9be,0x9bd,0x400a8,0x6b,0x42b,0x9be, + 0x600a9,0x8,0x42c,0x42b,0xaa,0xa9,0x50081,0x8,0x42d,0x427,0x42c,0x8000c, + 0x8,0x9c2,0x1,0x2b,0x42d,0xa9,0xaa,0x50083,0xe,0x432,0x401,0x41e, + 0x50085,0xe,0x435,0x432,0x400,0x4006e,0x2c,0x436,0x435,0x50051,0x8,0x438, + 0x41b,0x1,0x4007c,0x3f,0x9ce,0x436,0x500b0,0x197,0x9d1,0x9ce,0x9bc,0x4009b, + 0x6b,0x9d2,0x9d1,0x400a8,0x6b,0x43c,0x9d2,0x600a9,0x8,0x43d,0x43c,0xaa, + 0xa9,0x50081,0x8,0x43e,0x438,0x43d,0x8000c,0x8,0x9d6,0x1,0x2b,0x43e, + 0xa9,0xaa,0x4003d,0x10f,0x9d8,0x111,0x70050,0x30,0x9dd,0x9c2,0x9d6,0xa9, + 0xa9,0x40063,0x9d8,0x3c9,0x9dd,0x100fd,0x10038, +}; +static const char *fi_disocclusion_mask_pass_1_cb_names[] = {"cbFI"}; +static const uint32_t fi_disocclusion_mask_pass_1_cb_bind[] = {8}; +static const uint32_t fi_disocclusion_mask_pass_1_cb_count[] = {1}; +static const uint32_t fi_disocclusion_mask_pass_1_cb_space[] = {0}; +static const char *fi_disocclusion_mask_pass_1_srv_tex_names[] = {"r_game_motion_vector_field_x", "r_game_motion_vector_field_y", "r_reconstructed_depth_previous_frame", "r_dilated_depth", "r_reconstructed_depth_interpolated_frame", "r_inpainting_pyramid", "r_input_distortion_field"}; +static const uint32_t fi_disocclusion_mask_pass_1_srv_tex_bind[] = {0, 1, 2, 3, 4, 5, 6}; +static const uint32_t fi_disocclusion_mask_pass_1_srv_tex_count[] = {1, 1, 1, 1, 1, 1, 1}; +static const uint32_t fi_disocclusion_mask_pass_1_srv_tex_space[] = {0, 0, 0, 0, 0, 0, 0}; +static const char *fi_disocclusion_mask_pass_1_uav_tex_names[] = {"rw_disocclusion_mask"}; +static const uint32_t fi_disocclusion_mask_pass_1_uav_tex_bind[] = {7}; +static const uint32_t fi_disocclusion_mask_pass_1_uav_tex_count[] = {1}; +static const uint32_t fi_disocclusion_mask_pass_1_uav_tex_space[] = {0}; +static const char *fi_disocclusion_mask_pass_1_sampler_names[] = {"s_LinearClamp"}; +static const uint32_t fi_disocclusion_mask_pass_1_sampler_bind[] = {1000}; +static const uint32_t fi_disocclusion_mask_pass_1_sampler_count[] = {1}; +static const uint32_t fi_disocclusion_mask_pass_1_sampler_space[] = {0}; + +static const uint32_t fi_pass_1_spv[4444] = { + 0x7230203,0x10500,0x8000b,0x1a02,0x0,0x20011,0x1,0x20011,0x38,0x6000b,0x1,0x4c534c47, + 0x6474732e,0x3035342e,0x0,0x3000e,0x0,0x1,0x12000f,0x5,0x4,0x6e69616d,0x0,0x196, + 0x1dc,0x1e3,0x1ea,0x1ee,0x1f9,0x200,0x20b,0x211,0x21b,0x226,0x233,0x613, + 0x60010,0x4,0x11,0x8,0x8,0x1,0x30003,0x2,0x1c2,0xb0004,0x455f4c47,0x735f5458, + 0x6c706d61,0x656c7265,0x745f7373,0x75747865,0x665f6572,0x74636e75,0x736e6f69,0x0,0xb0004,0x455f4c47,0x735f5458,0x65646168, + 0x78655f72,0x63696c70,0x615f7469,0x68746972,0x6974656d,0x79745f63,0x736570,0xa0004,0x455f4c47,0x735f5458,0x65646168,0x6d695f72, + 0x5f656761,0x64616f6c,0x726f665f,0x7474616d,0x6465,0xa0004,0x475f4c47,0x4c474f4f,0x70635f45,0x74735f70,0x5f656c79,0x656e696c, + 0x7269645f,0x69746365,0x6576,0x80004,0x475f4c47,0x4c474f4f,0x6e695f45,0x64756c63,0x69645f65,0x74636572,0x657669,0x40005, + 0x4,0x6e69616d,0x0,0x40005,0x194,0x49466263,0x745f,0x60006,0x194,0x0,0x646e6572,0x69537265, + 0x657a,0x60006,0x194,0x1,0x70736964,0x5379616c,0x657a69,0x80006,0x194,0x2,0x6974706f,0x466c6163, + 0x53776f6c,0x656c6163,0x0,0x90006,0x194,0x3,0x6974706f,0x466c6163,0x42776f6c,0x6b636f6c,0x657a6953,0x0, + 0x70006,0x194,0x4,0x5278616d,0x65646e65,0x7a695372,0x65,0x90006,0x194,0x5,0x65746e69,0x6c6f7072, + 0x6f697461,0x6365526e,0x73614274,0x65,0x90006,0x194,0x6,0x65746e69,0x6c6f7072,0x6f697461,0x6365526e,0x7a695374, + 0x65,0x40005,0x196,0x49466263,0x0,0xa0005,0x1dc,0x72705f72,0x6f697665,0x695f7375,0x7265746e,0x616c6f70, + 0x6e6f6974,0x756f735f,0x656372,0xa0005,0x1e3,0x75635f72,0x6e657272,0x6e695f74,0x70726574,0x74616c6f,0x5f6e6f69,0x72756f73, + 0x6563,0x70005,0x1ea,0x69645f72,0x63636f73,0x6973756c,0x6d5f6e6f,0x6b7361,0x60005,0x1ee,0x694c5f73,0x7261656e, + 0x6d616c43,0x70,0xa0005,0x1f9,0x61675f72,0x6d5f656d,0x6f69746f,0x65765f6e,0x726f7463,0x6569665f,0x785f646c,0x0, + 0xa0005,0x200,0x61675f72,0x6d5f656d,0x6f69746f,0x65765f6e,0x726f7463,0x6569665f,0x795f646c,0x0,0xc0005,0x20b, + 0x706f5f72,0x61636974,0x6c665f6c,0x6d5f776f,0x6f69746f,0x65765f6e,0x726f7463,0x6569665f,0x785f646c,0x0,0xc0005,0x211, + 0x706f5f72,0x61636974,0x6c665f6c,0x6d5f776f,0x6f69746f,0x65765f6e,0x726f7463,0x6569665f,0x795f646c,0x0,0x80005,0x21b, + 0x6e695f72,0x6e696170,0x676e6974,0x7279705f,0x64696d61,0x0,0xa0005,0x224,0x6d617246,0x746e4965,0x6f707265,0x6974616c, + 0x6f436e6f,0x65746e75,0x745f7372,0x0,0x50006,0x224,0x0,0x61746164,0x0,0x50005,0x226,0x6f635f72, + 0x65746e75,0x7372,0x50005,0x233,0x6f5f7772,0x75707475,0x74,0x80005,0x613,0x475f6c67,0x61626f6c,0x766e496c, + 0x7461636f,0x496e6f69,0x44,0x30047,0x194,0x2,0x50048,0x194,0x0,0x23,0x0,0x50048, + 0x194,0x1,0x23,0x8,0x50048,0x194,0x2,0x23,0x50,0x50048,0x194,0x3, + 0x23,0x58,0x50048,0x194,0x4,0x23,0x60,0x50048,0x194,0x5,0x23,0x70, + 0x50048,0x194,0x6,0x23,0x78,0x40047,0x196,0x21,0xa,0x40047,0x196,0x22, + 0x0,0x40047,0x1dc,0x21,0x4,0x40047,0x1dc,0x22,0x0,0x40047,0x1e3,0x21, + 0x5,0x40047,0x1e3,0x22,0x0,0x40047,0x1ea,0x21,0x6,0x40047,0x1ea,0x22, + 0x0,0x40047,0x1ee,0x21,0x3e8,0x40047,0x1ee,0x22,0x0,0x40047,0x1f9,0x21, + 0x0,0x40047,0x1f9,0x22,0x0,0x40047,0x200,0x21,0x1,0x40047,0x200,0x22, + 0x0,0x40047,0x20b,0x21,0x2,0x40047,0x20b,0x22,0x0,0x40047,0x211,0x21, + 0x3,0x40047,0x211,0x22,0x0,0x40047,0x21b,0x21,0x7,0x40047,0x21b,0x22, + 0x0,0x40047,0x223,0x6,0x4,0x30047,0x224,0x2,0x40048,0x224,0x0,0x18, + 0x50048,0x224,0x0,0x23,0x0,0x30047,0x226,0x18,0x40047,0x226,0x21,0x8, + 0x40047,0x226,0x22,0x0,0x40047,0x233,0x21,0x9,0x40047,0x233,0x22,0x0, + 0x40047,0x613,0xb,0x1c,0x40047,0x621,0xb,0x19,0x20013,0x2,0x30021,0x3, + 0x2,0x40015,0x6,0x20,0x0,0x30016,0x8,0x20,0x40020,0xd,0x7,0x8, + 0x40017,0xe,0x8,0x2,0x40017,0x13,0x8,0x3,0x40015,0x55,0x20,0x1, + 0x40017,0x56,0x55,0x2,0x40020,0x6e,0x7,0x56,0x40017,0x76,0x8,0x4, + 0x40017,0x7b,0x6,0x2,0x4002b,0x6,0x9f,0x4,0x4001c,0xa0,0x56,0x9f, + 0x4001c,0xa1,0x8,0x9f,0x20014,0xa8,0x4002b,0x8,0x10f,0x0,0x4002b,0x8, + 0x110,0x3f800000,0x9001e,0x194,0x56,0x56,0xe,0x55,0x56,0x56,0x56,0x40020, + 0x195,0x2,0x194,0x4003b,0x195,0x196,0x2,0x40020,0x198,0x2,0x56,0x4002b, + 0x55,0x1a2,0x0,0x4002b,0x55,0x1a7,0x1,0x40020,0x1ae,0x2,0xe,0x40020, + 0x1b4,0x2,0x55,0x4002b,0x6,0x1cf,0x0,0x4002b,0x6,0x1d5,0x1,0x90019, + 0x1da,0x8,0x1,0x0,0x0,0x0,0x1,0x0,0x40020,0x1db,0x0,0x1da, + 0x4003b,0x1db,0x1dc,0x0,0x4003b,0x1db,0x1e3,0x0,0x4003b,0x1db,0x1ea,0x0, + 0x2001a,0x1ec,0x40020,0x1ed,0x0,0x1ec,0x4003b,0x1ed,0x1ee,0x0,0x3001b,0x1f0, + 0x1da,0x90019,0x1f7,0x6,0x1,0x0,0x0,0x0,0x1,0x0,0x40020,0x1f8, + 0x0,0x1f7,0x4003b,0x1f8,0x1f9,0x0,0x40017,0x1fc,0x6,0x4,0x4003b,0x1f8, + 0x200,0x0,0x4003b,0x1f8,0x20b,0x0,0x4003b,0x1f8,0x211,0x0,0x4003b,0x1db, + 0x21b,0x0,0x3001d,0x223,0x6,0x3001e,0x224,0x223,0x40020,0x225,0xc,0x224, + 0x4003b,0x225,0x226,0xc,0x40020,0x228,0xc,0x6,0x90019,0x231,0x8,0x1, + 0x0,0x0,0x0,0x2,0x0,0x40020,0x232,0x0,0x231,0x4003b,0x232,0x233, + 0x0,0x4002b,0x8,0x26c,0x3f000000,0x5002c,0xe,0x26d,0x26c,0x26c,0x4002b,0x55, + 0x271,0x2,0x5002c,0x56,0x27a,0x1a2,0x1a2,0x5002c,0x56,0x27c,0x1a7,0x1a2, + 0x5002c,0x56,0x27e,0x1a2,0x1a7,0x5002c,0x56,0x281,0x1a7,0x1a7,0x40017,0x2a6, + 0xa8,0x2,0x5002c,0xe,0x2fe,0x10f,0x10f,0x4002b,0x55,0x304,0x4,0x4002b, + 0x6,0x31b,0x15,0x4002b,0x6,0x31d,0x3ff,0x7002c,0x76,0x35b,0x10f,0x10f, + 0x10f,0x10f,0x4002b,0x55,0x3bd,0xb,0x6002c,0x13,0x46d,0x10f,0x10f,0x10f, + 0x5002c,0xe,0x508,0x110,0x110,0x4002b,0x8,0x550,0x3a83126f,0x4002b,0x6,0x5d6, + 0xa,0x40017,0x611,0x6,0x3,0x40020,0x612,0x1,0x611,0x4003b,0x612,0x613, + 0x1,0x4002b,0x6,0x620,0x8,0x6002c,0x611,0x621,0x620,0x620,0x1d5,0x40020, + 0x11bf,0x7,0xa0,0x40020,0x11c1,0x7,0xa1,0x7002c,0xa0,0x1928,0x27a,0x27c, + 0x27e,0x281,0x5002c,0x56,0x192a,0x271,0x271,0x4002b,0x8,0x1938,0x3a802008,0x40017, + 0x193e,0xa8,0x3,0x4002b,0x6,0x19c9,0x5,0x4002b,0x6,0x19ca,0x6,0x4002b, + 0x6,0x19cb,0x2,0x4002b,0x6,0x19cc,0x3,0x50036,0x2,0x4,0x0,0x3, + 0x200f8,0x5,0x4003b,0x11c1,0x1398,0x7,0x4003b,0x11bf,0x1397,0x7,0x4003b,0x11c1, + 0x135b,0x7,0x4003b,0x11bf,0x135a,0x7,0x4003b,0x11c1,0x12c8,0x7,0x4003b,0x11bf, + 0x12c7,0x7,0x4003b,0x11c1,0x1282,0x7,0x4003b,0x11bf,0x1281,0x7,0x4003b,0x11c1, + 0x123c,0x7,0x4003b,0x11bf,0x123b,0x7,0x4003b,0x11c1,0x11f6,0x7,0x4003b,0x11bf, + 0x11f5,0x7,0x4003d,0x611,0x614,0x613,0x7004f,0x7b,0x615,0x614,0x614,0x0, + 0x1,0x4007c,0x56,0x616,0x615,0x50041,0x198,0x64e,0x196,0x19c9,0x4003d,0x56, + 0x64f,0x64e,0x50041,0x198,0x652,0x196,0x19ca,0x4003d,0x56,0x653,0x652,0x50051, + 0x55,0x657,0x616,0x0,0x50051,0x55,0x659,0x64f,0x0,0x500af,0xa8,0x65a, + 0x657,0x659,0x300f7,0x664,0x0,0x400fa,0x65a,0x65b,0x664,0x200f8,0x65b,0x50051, + 0x55,0x65f,0x653,0x0,0x50080,0x55,0x662,0x65f,0x659,0x500b1,0xa8,0x663, + 0x657,0x662,0x200f9,0x664,0x200f8,0x664,0x700f5,0xa8,0x665,0x65a,0x5,0x663, + 0x65b,0x300f7,0x66c,0x0,0x400fa,0x665,0x666,0x66c,0x200f8,0x666,0x50051,0x55, + 0x668,0x616,0x1,0x50051,0x55,0x66a,0x64f,0x1,0x500af,0xa8,0x66b,0x668, + 0x66a,0x200f9,0x66c,0x200f8,0x66c,0x700f5,0xa8,0x66d,0x665,0x664,0x66b,0x666, + 0x300f7,0x677,0x0,0x400fa,0x66d,0x66e,0x677,0x200f8,0x66e,0x50051,0x55,0x670, + 0x616,0x1,0x50051,0x55,0x672,0x653,0x1,0x50051,0x55,0x674,0x64f,0x1, + 0x50080,0x55,0x675,0x672,0x674,0x500b1,0xa8,0x676,0x670,0x675,0x200f9,0x677, + 0x200f8,0x677,0x700f5,0xa8,0x678,0x66d,0x66c,0x676,0x66e,0x400a8,0xa8,0x632, + 0x678,0x300f7,0x637,0x0,0x400fa,0x678,0x634,0x637,0x200f8,0x634,0x60041,0x228, + 0x680,0x226,0x1a2,0x1a7,0x4003d,0x6,0x681,0x680,0x500aa,0xa8,0x636,0x681, + 0x1cf,0x200f9,0x637,0x200f8,0x637,0x700f5,0xa8,0x638,0x632,0x677,0x636,0x634, + 0x300f7,0x643,0x0,0x400fa,0x638,0x639,0x63c,0x200f8,0x63c,0x4007c,0x7b,0x6d2, + 0x64f,0x50082,0x7b,0x6d3,0x615,0x6d2,0x40070,0xe,0x6d4,0x6d3,0x50081,0xe, + 0x6d6,0x6d4,0x26d,0x4006f,0xe,0x6d8,0x653,0x50088,0xe,0x6d9,0x6d6,0x6d8, + 0x40070,0xe,0x6db,0x615,0x50081,0xe,0x6dd,0x6db,0x26d,0x50041,0x198,0x7a4, + 0x196,0x1a7,0x4003d,0x56,0x7a5,0x7a4,0x4006f,0xe,0x6df,0x7a5,0x50088,0xe, + 0x6e0,0x6dd,0x6df,0x50041,0x198,0x7a8,0x196,0x1a2,0x4003d,0x56,0x7a9,0x7a8, + 0x4006f,0xe,0x6e3,0x7a9,0x50041,0x198,0x7ac,0x196,0x9f,0x4003d,0x56,0x7ad, + 0x7ac,0x4006f,0xe,0x6e5,0x7ad,0x50088,0xe,0x6e6,0x6e3,0x6e5,0x50085,0xe, + 0x6e7,0x6d9,0x6e6,0x50088,0xe,0x6ec,0x6d8,0x6df,0x50085,0xe,0x7c5,0x6d9, + 0x6e3,0x4006e,0x56,0x7c6,0x7c5,0x4003d,0x1f7,0x80c,0x1f9,0x7005f,0x1fc,0x80e, + 0x80c,0x7c6,0x2002,0x1a2,0x50051,0x6,0x80f,0x80e,0x0,0x4003d,0x1f7,0x810, + 0x200,0x7005f,0x1fc,0x812,0x810,0x7c6,0x2002,0x1a2,0x50051,0x6,0x813,0x812, + 0x0,0x500c2,0x6,0x81d,0x80f,0x31b,0x500c7,0x6,0x81e,0x81d,0x31d,0x40070, + 0x8,0x81f,0x81e,0x50085,0x8,0x820,0x81f,0x1938,0x6000c,0xe,0x855,0x1, + 0x3e,0x80f,0x50051,0x8,0x845,0x855,0x0,0x6000c,0xe,0x859,0x1,0x3e, + 0x813,0x50051,0x8,0x84a,0x859,0x0,0x50050,0xe,0x19ff,0x845,0x84a,0x500bd, + 0xa8,0x7ce,0x820,0x10f,0x300f7,0x7f1,0x0,0x400fa,0x7ce,0x7cf,0x7f1,0x200f8, + 0x7cf,0x200f9,0x7d1,0x200f8,0x7d1,0x700f5,0x76,0x19d2,0x35b,0x7cf,0x8a5,0x7e3, + 0x700f5,0x56,0x1795,0x7a9,0x7cf,0x7de,0x7e3,0x700f5,0x55,0x1528,0x1a2,0x7cf, + 0x7e5,0x7e3,0x400f6,0x7e6,0x7e3,0x0,0x200f9,0x7d2,0x200f8,0x7d2,0x500b1,0xa8, + 0x7d4,0x1528,0x3bd,0x300f7,0x7d9,0x0,0x400fa,0x7d4,0x7d5,0x7d9,0x200f8,0x7d5, + 0x50051,0x8,0x7d7,0x19d2,0x3,0x500b4,0xa8,0x7d8,0x7d7,0x10f,0x200f9,0x7d9, + 0x200f8,0x7d9,0x700f5,0xa8,0x7da,0x7d4,0x7d2,0x7d8,0x7d5,0x400fa,0x7da,0x7db, + 0x7e6,0x200f8,0x7db,0x50087,0x56,0x7de,0x1795,0x192a,0x4006f,0xe,0x8af,0x7de, + 0x50085,0xe,0x8b0,0x6d9,0x8af,0x50083,0xe,0x8b1,0x8b0,0x26d,0x6000c,0xe, + 0x8b3,0x1,0x8,0x8b1,0x4006e,0x56,0x8b4,0x8b3,0x6000c,0xe,0x8dc,0x1, + 0xa,0x8b1,0x50051,0x8,0x8bd,0x8dc,0x0,0x50083,0x8,0x8be,0x110,0x8bd, + 0x50051,0x8,0x8c0,0x8dc,0x1,0x50083,0x8,0x8c1,0x110,0x8c0,0x50085,0x8, + 0x8c2,0x8be,0x8c1,0x50085,0x8,0x8c9,0x8bd,0x8c1,0x50085,0x8,0x8d0,0x8be, + 0x8c0,0x50085,0x8,0x8d6,0x8bd,0x8c0,0x70050,0xa1,0x1502,0x8c2,0x8c9,0x8d0, + 0x8d6,0x3003e,0x1397,0x1928,0x3003e,0x1398,0x1502,0x200f9,0x873,0x200f8,0x873,0x700f5, + 0x76,0x19ea,0x35b,0x7db,0x19fe,0x89b,0x700f5,0x8,0x1798,0x10f,0x7db,0x1925, + 0x89b,0x700f5,0x55,0x1797,0x1a2,0x7db,0x89d,0x89b,0x500b1,0xa8,0x876,0x1797, + 0x304,0x400f6,0x89e,0x89b,0x0,0x400fa,0x876,0x877,0x89e,0x200f8,0x877,0x50041, + 0x6e,0x139d,0x1397,0x1797,0x4003d,0x56,0x87a,0x139d,0x50080,0x56,0x87e,0x8b4, + 0x87a,0x4007c,0x7b,0x8e0,0x87e,0x4007c,0x7b,0x8e2,0x7de,0x500b0,0x2a6,0x8e3, + 0x8e0,0x8e2,0x4009b,0xa8,0x8e4,0x8e3,0x300f7,0x89a,0x0,0x400fa,0x8e4,0x881, + 0x89a,0x200f8,0x881,0x4003d,0x1da,0x8e7,0x21b,0x7005f,0x76,0x8eb,0x8e7,0x87e, + 0x2,0x1528,0x50051,0x8,0x886,0x8eb,0x2,0x500ba,0xa8,0x889,0x886,0x10f, + 0x600a9,0x8,0x88a,0x889,0x110,0x10f,0x50041,0xd,0x139e,0x1398,0x1797,0x4003d, + 0x8,0x88d,0x139e,0x50085,0x8,0x88f,0x88d,0x88a,0x50085,0x8,0x891,0x88f, + 0x886,0x50081,0x8,0x894,0x1798,0x891,0x5008e,0x76,0x897,0x8eb,0x891,0x50081, + 0x76,0x899,0x19ea,0x897,0x200f9,0x89a,0x200f8,0x89a,0x700f5,0x76,0x19fe,0x19ea, + 0x877,0x899,0x881,0x700f5,0x8,0x1925,0x1798,0x877,0x894,0x881,0x200f9,0x89b, + 0x200f8,0x89b,0x50080,0x55,0x89d,0x1797,0x1a7,0x200f9,0x873,0x200f8,0x89e,0x500ba, + 0xa8,0x8a0,0x1798,0x10f,0x600a9,0x8,0x8a2,0x8a0,0x1798,0x110,0x70050,0x76, + 0x8a4,0x8a2,0x8a2,0x8a2,0x8a2,0x50088,0x76,0x8a5,0x19ea,0x8a4,0x200f9,0x7e3, + 0x200f8,0x7e3,0x50080,0x55,0x7e5,0x1528,0x1a7,0x200f9,0x7d1,0x200f8,0x7e6,0x7004f, + 0xe,0x7e8,0x19d2,0x19d2,0x0,0x1,0x200f9,0x7f1,0x200f8,0x7f1,0x700f5,0xe, + 0x152e,0x19ff,0x63c,0x7e8,0x7e6,0x50083,0xe,0x7f5,0x6d9,0x152e,0x50051,0x8, + 0x8ef,0x7f5,0x0,0x500ba,0xa8,0x8f0,0x8ef,0x10f,0x300f7,0x8f5,0x0,0x400fa, + 0x8f0,0x8f1,0x8f5,0x200f8,0x8f1,0x500b8,0xa8,0x8f4,0x8ef,0x110,0x200f9,0x8f5, + 0x200f8,0x8f5,0x700f5,0xa8,0x8f6,0x8f0,0x7f1,0x8f4,0x8f1,0x300f7,0x901,0x0, + 0x400fa,0x8f6,0x8f7,0x901,0x200f8,0x8f7,0x50051,0x8,0x8f9,0x7f5,0x1,0x500ba, + 0xa8,0x8fa,0x8f9,0x10f,0x300f7,0x8ff,0x0,0x400fa,0x8fa,0x8fb,0x8ff,0x200f8, + 0x8fb,0x500b8,0xa8,0x8fe,0x8f9,0x110,0x200f9,0x8ff,0x200f8,0x8ff,0x700f5,0xa8, + 0x900,0x8fa,0x8f7,0x8fe,0x8fb,0x200f9,0x901,0x200f8,0x901,0x700f5,0xa8,0x902, + 0x8f6,0x8f5,0x900,0x8ff,0x50081,0xe,0x7fc,0x6d9,0x152e,0x50051,0x8,0x906, + 0x7fc,0x0,0x500ba,0xa8,0x907,0x906,0x10f,0x300f7,0x90c,0x0,0x400fa,0x907, + 0x908,0x90c,0x200f8,0x908,0x500b8,0xa8,0x90b,0x906,0x110,0x200f9,0x90c,0x200f8, + 0x90c,0x700f5,0xa8,0x90d,0x907,0x901,0x90b,0x908,0x300f7,0x918,0x0,0x400fa, + 0x90d,0x90e,0x918,0x200f8,0x90e,0x50051,0x8,0x910,0x7fc,0x1,0x500ba,0xa8, + 0x911,0x910,0x10f,0x300f7,0x916,0x0,0x400fa,0x911,0x912,0x916,0x200f8,0x912, + 0x500b8,0xa8,0x915,0x910,0x110,0x200f9,0x916,0x200f8,0x916,0x700f5,0xa8,0x917, + 0x911,0x90e,0x915,0x912,0x200f9,0x918,0x200f8,0x918,0x700f5,0xa8,0x919,0x90d, + 0x90c,0x917,0x916,0x50041,0x1ae,0x99f,0x196,0x19cb,0x4003d,0xe,0x9a0,0x99f, + 0x50088,0xe,0x9a2,0x508,0x9a0,0x50041,0x1b4,0x9a3,0x196,0x19cc,0x4003d,0x55, + 0x9a4,0x9a3,0x50050,0x56,0x9a5,0x9a4,0x9a4,0x4006f,0xe,0x9a6,0x9a5,0x50088, + 0xe,0x9a7,0x9a2,0x9a6,0x4006e,0x56,0x9a8,0x9a7,0x50084,0x56,0x99b,0x9a8, + 0x281,0x4006f,0xe,0x92d,0x99b,0x5008e,0xe,0x92e,0x92d,0x110,0x4006e,0x56, + 0x92f,0x92e,0x4006f,0xe,0x9b2,0x92f,0x50085,0xe,0x9b3,0x6e0,0x9b2,0x50083, + 0xe,0x9b4,0x9b3,0x26d,0x6000c,0xe,0x9b6,0x1,0x8,0x9b4,0x4006e,0x56, + 0x9b7,0x9b6,0x6000c,0xe,0x9df,0x1,0xa,0x9b4,0x50051,0x8,0x9c0,0x9df, + 0x0,0x50083,0x8,0x9c1,0x110,0x9c0,0x50051,0x8,0x9c3,0x9df,0x1,0x50083, + 0x8,0x9c4,0x110,0x9c3,0x50085,0x8,0x9c5,0x9c1,0x9c4,0x50085,0x8,0x9cc, + 0x9c0,0x9c4,0x50085,0x8,0x9d3,0x9c1,0x9c3,0x50085,0x8,0x9d9,0x9c0,0x9c3, + 0x70050,0xa1,0x14d6,0x9c5,0x9cc,0x9d3,0x9d9,0x3003e,0x135a,0x1928,0x3003e,0x135b, + 0x14d6,0x200f9,0x933,0x200f8,0x933,0x700f5,0xe,0x1566,0x2fe,0x918,0x17e7,0x96d, + 0x700f5,0x8,0x1565,0x10f,0x918,0x17e6,0x96d,0x700f5,0x55,0x1564,0x1a2,0x918, + 0x96f,0x96d,0x500b1,0xa8,0x936,0x1564,0x304,0x400f6,0x970,0x96d,0x0,0x400fa, + 0x936,0x937,0x970,0x200f8,0x937,0x50041,0x6e,0x1360,0x135a,0x1564,0x4003d,0x56, + 0x93a,0x1360,0x50080,0x56,0x93e,0x9b7,0x93a,0x4007c,0x7b,0xa04,0x93e,0x4007c, + 0x7b,0xa06,0x92f,0x500b0,0x2a6,0xa07,0xa04,0xa06,0x4009b,0xa8,0xa08,0xa07, + 0x300f7,0x96c,0x0,0x400fa,0xa08,0x945,0x96c,0x200f8,0x945,0x50041,0xd,0x1361, + 0x135b,0x1564,0x4003d,0x8,0x948,0x1361,0x4003d,0x1f7,0xa1b,0x20b,0x7005f,0x1fc, + 0xa1d,0xa1b,0x93e,0x2002,0x1a2,0x50051,0x6,0xa1e,0xa1d,0x0,0x4003d,0x1f7, + 0xa1f,0x211,0x7005f,0x1fc,0xa21,0xa1f,0x93e,0x2002,0x1a2,0x50051,0x6,0xa22, + 0xa21,0x0,0x6000c,0xe,0xa64,0x1,0x3e,0xa1e,0x50051,0x8,0xa54,0xa64, + 0x0,0x6000c,0xe,0xa68,0x1,0x3e,0xa22,0x50051,0x8,0xa59,0xa68,0x0, + 0x50050,0xe,0x1a01,0xa54,0xa59,0x5008e,0xe,0x954,0x1a01,0x948,0x50081,0xe, + 0x957,0x1566,0x954,0x50081,0x8,0x96b,0x1565,0x948,0x200f9,0x96c,0x200f8,0x96c, + 0x700f5,0xe,0x17e7,0x1566,0x937,0x957,0x945,0x700f5,0x8,0x17e6,0x1565,0x937, + 0x96b,0x945,0x200f9,0x96d,0x200f8,0x96d,0x50080,0x55,0x96f,0x1564,0x1a7,0x200f9, + 0x933,0x200f8,0x970,0x500ba,0xa8,0x972,0x1565,0x10f,0x300f7,0x984,0x0,0x400fa, + 0x972,0x973,0x984,0x200f8,0x973,0x50050,0xe,0x977,0x1565,0x1565,0x50088,0xe, + 0x978,0x1566,0x977,0x200f9,0x984,0x200f8,0x984,0x700f5,0xe,0x156b,0x1566,0x970, + 0x978,0x973,0x4003d,0x1da,0xa99,0x1ea,0x4003d,0x1ec,0xa9a,0x1ee,0x50056,0x1f0, + 0xa9b,0xa99,0xa9a,0x70058,0x76,0xa9d,0xa9b,0x6e7,0x2,0x10f,0x7004f,0xe, + 0x6f5,0xa9d,0xa9d,0x0,0x1,0x8000c,0xe,0xaa5,0x1,0x2b,0x6f5,0x2fe, + 0x508,0x500b4,0x2a6,0x6f7,0xaa5,0x508,0x600a9,0xe,0x6f8,0x6f7,0x508,0x2fe, + 0x50085,0xe,0x6fc,0x152e,0x6ec,0x50081,0xe,0xac9,0x6e0,0x6fc,0x50085,0xe, + 0xb1b,0xac9,0x6df,0x50083,0xe,0xb1c,0xb1b,0x26d,0x6000c,0xe,0xb1e,0x1, + 0x8,0xb1c,0x4006e,0x56,0xb1f,0xb1e,0x6000c,0xe,0xb47,0x1,0xa,0xb1c, + 0x50051,0x8,0xb28,0xb47,0x0,0x50083,0x8,0xb29,0x110,0xb28,0x50051,0x8, + 0xb2b,0xb47,0x1,0x50083,0x8,0xb2c,0x110,0xb2b,0x50085,0x8,0xb2d,0xb29, + 0xb2c,0x50085,0x8,0xb34,0xb28,0xb2c,0x50085,0x8,0xb3b,0xb29,0xb2b,0x50085, + 0x8,0xb41,0xb28,0xb2b,0x70050,0xa1,0x14aa,0xb2d,0xb34,0xb3b,0xb41,0x3003e, + 0x12c7,0x1928,0x3003e,0x12c8,0x14aa,0x200f9,0xacd,0x200f8,0xacd,0x700f5,0x13,0x15be, + 0x46d,0x984,0x17fe,0xaf5,0x700f5,0x8,0x15bd,0x10f,0x984,0x17fd,0xaf5,0x700f5, + 0x55,0x15bc,0x1a2,0x984,0xaf7,0xaf5,0x500b1,0xa8,0xad0,0x15bc,0x304,0x400f6, + 0xaf8,0xaf5,0x0,0x400fa,0xad0,0xad1,0xaf8,0x200f8,0xad1,0x50041,0x6e,0x12cd, + 0x12c7,0x15bc,0x4003d,0x56,0xad4,0x12cd,0x50080,0x56,0xad8,0xb1f,0xad4,0x50051, + 0x55,0xb53,0xad8,0x0,0x500af,0xa8,0xb56,0xb53,0x659,0x300f7,0xb60,0x0, + 0x400fa,0xb56,0xb57,0xb60,0x200f8,0xb57,0x50051,0x55,0xb5b,0x653,0x0,0x50080, + 0x55,0xb5e,0xb5b,0x659,0x500b1,0xa8,0xb5f,0xb53,0xb5e,0x200f9,0xb60,0x200f8, + 0xb60,0x700f5,0xa8,0xb61,0xb56,0xad1,0xb5f,0xb57,0x300f7,0xb68,0x0,0x400fa, + 0xb61,0xb62,0xb68,0x200f8,0xb62,0x50051,0x55,0xb64,0xad8,0x1,0x50051,0x55, + 0xb66,0x64f,0x1,0x500af,0xa8,0xb67,0xb64,0xb66,0x200f9,0xb68,0x200f8,0xb68, + 0x700f5,0xa8,0xb69,0xb61,0xb60,0xb67,0xb62,0x300f7,0xb73,0x0,0x400fa,0xb69, + 0xb6a,0xb73,0x200f8,0xb6a,0x50051,0x55,0xb6c,0xad8,0x1,0x50051,0x55,0xb6e, + 0x653,0x1,0x50051,0x55,0xb70,0x64f,0x1,0x50080,0x55,0xb71,0xb6e,0xb70, + 0x500b1,0xa8,0xb72,0xb6c,0xb71,0x200f9,0xb73,0x200f8,0xb73,0x700f5,0xa8,0xb74, + 0xb69,0xb68,0xb72,0xb6a,0x300f7,0xaf4,0x0,0x400fa,0xb74,0xadd,0xaf4,0x200f8, + 0xadd,0x50041,0xd,0x12ce,0x12c8,0x15bc,0x4003d,0x8,0xae0,0x12ce,0x4003d,0x1da, + 0xb7d,0x1dc,0x7005f,0x76,0xb7f,0xb7d,0xad8,0x2,0x1a2,0x8004f,0x13,0xb80, + 0xb7f,0xb7f,0x0,0x1,0x2,0x5008e,0x13,0xaed,0xb80,0xae0,0x50081,0x13, + 0xaef,0x15be,0xaed,0x50081,0x8,0xaf3,0x15bd,0xae0,0x200f9,0xaf4,0x200f8,0xaf4, + 0x700f5,0x13,0x17fe,0x15be,0xb73,0xaef,0xadd,0x700f5,0x8,0x17fd,0x15bd,0xb73, + 0xaf3,0xadd,0x200f9,0xaf5,0x200f8,0xaf5,0x50080,0x55,0xaf7,0x15bc,0x1a7,0x200f9, + 0xacd,0x200f8,0xaf8,0x500b7,0xa8,0xafa,0x15bd,0x10f,0x300f7,0xb01,0x0,0x400fa, + 0xafa,0xafb,0xb00,0x200f8,0xb00,0x200f9,0xb01,0x200f8,0xafb,0x60050,0x13,0xafe, + 0x15bd,0x15bd,0x15bd,0x50088,0x13,0xaff,0x15be,0xafe,0x200f9,0xb01,0x200f8,0xb01, + 0x700f5,0x13,0x15bf,0xaff,0xafb,0x46d,0xb00,0x4007f,0xe,0x702,0x152e,0x50085, + 0xe,0x704,0x702,0x6ec,0x50081,0xe,0xc66,0x6e0,0x704,0x50085,0xe,0xcb8, + 0xc66,0x6df,0x50083,0xe,0xcb9,0xcb8,0x26d,0x6000c,0xe,0xcbb,0x1,0x8, + 0xcb9,0x4006e,0x56,0xcbc,0xcbb,0x6000c,0xe,0xce4,0x1,0xa,0xcb9,0x50051, + 0x8,0xcc5,0xce4,0x0,0x50083,0x8,0xcc6,0x110,0xcc5,0x50051,0x8,0xcc8, + 0xce4,0x1,0x50083,0x8,0xcc9,0x110,0xcc8,0x50085,0x8,0xcca,0xcc6,0xcc9, + 0x50085,0x8,0xcd1,0xcc5,0xcc9,0x50085,0x8,0xcd8,0xcc6,0xcc8,0x50085,0x8, + 0xcde,0xcc5,0xcc8,0x70050,0xa1,0x147e,0xcca,0xcd1,0xcd8,0xcde,0x3003e,0x1281, + 0x1928,0x3003e,0x1282,0x147e,0x200f9,0xc6a,0x200f8,0xc6a,0x700f5,0x13,0x15e9,0x46d, + 0xb01,0x181a,0xc92,0x700f5,0x8,0x15e8,0x10f,0xb01,0x1819,0xc92,0x700f5,0x55, + 0x15e7,0x1a2,0xb01,0xc94,0xc92,0x500b1,0xa8,0xc6d,0x15e7,0x304,0x400f6,0xc95, + 0xc92,0x0,0x400fa,0xc6d,0xc6e,0xc95,0x200f8,0xc6e,0x50041,0x6e,0x1287,0x1281, + 0x15e7,0x4003d,0x56,0xc71,0x1287,0x50080,0x56,0xc75,0xcbc,0xc71,0x50051,0x55, + 0xcf0,0xc75,0x0,0x500af,0xa8,0xcf3,0xcf0,0x659,0x300f7,0xcfd,0x0,0x400fa, + 0xcf3,0xcf4,0xcfd,0x200f8,0xcf4,0x50051,0x55,0xcf8,0x653,0x0,0x50080,0x55, + 0xcfb,0xcf8,0x659,0x500b1,0xa8,0xcfc,0xcf0,0xcfb,0x200f9,0xcfd,0x200f8,0xcfd, + 0x700f5,0xa8,0xcfe,0xcf3,0xc6e,0xcfc,0xcf4,0x300f7,0xd05,0x0,0x400fa,0xcfe, + 0xcff,0xd05,0x200f8,0xcff,0x50051,0x55,0xd01,0xc75,0x1,0x50051,0x55,0xd03, + 0x64f,0x1,0x500af,0xa8,0xd04,0xd01,0xd03,0x200f9,0xd05,0x200f8,0xd05,0x700f5, + 0xa8,0xd06,0xcfe,0xcfd,0xd04,0xcff,0x300f7,0xd10,0x0,0x400fa,0xd06,0xd07, + 0xd10,0x200f8,0xd07,0x50051,0x55,0xd09,0xc75,0x1,0x50051,0x55,0xd0b,0x653, + 0x1,0x50051,0x55,0xd0d,0x64f,0x1,0x50080,0x55,0xd0e,0xd0b,0xd0d,0x500b1, + 0xa8,0xd0f,0xd09,0xd0e,0x200f9,0xd10,0x200f8,0xd10,0x700f5,0xa8,0xd11,0xd06, + 0xd05,0xd0f,0xd07,0x300f7,0xc91,0x0,0x400fa,0xd11,0xc7a,0xc91,0x200f8,0xc7a, + 0x50041,0xd,0x1288,0x1282,0x15e7,0x4003d,0x8,0xc7d,0x1288,0x4003d,0x1da,0xd14, + 0x1e3,0x7005f,0x76,0xd16,0xd14,0xc75,0x2,0x1a2,0x8004f,0x13,0xd17,0xd16, + 0xd16,0x0,0x1,0x2,0x5008e,0x13,0xc83,0xd17,0xc7d,0x50081,0x13,0xc85, + 0x15e9,0xc83,0x50081,0x8,0xc90,0x15e8,0xc7d,0x200f9,0xc91,0x200f8,0xc91,0x700f5, + 0x13,0x181a,0x15e9,0xd10,0xc85,0xc7a,0x700f5,0x8,0x1819,0x15e8,0xd10,0xc90, + 0xc7a,0x200f9,0xc92,0x200f8,0xc92,0x50080,0x55,0xc94,0x15e7,0x1a7,0x200f9,0xc6a, + 0x200f8,0xc95,0x500b7,0xa8,0xc97,0x15e8,0x10f,0x300f7,0xc9e,0x0,0x400fa,0xc97, + 0xc98,0xc9d,0x200f8,0xc9d,0x200f9,0xc9e,0x200f8,0xc98,0x60050,0x13,0xc9b,0x15e8, + 0x15e8,0x15e8,0x50088,0x13,0xc9c,0x15e9,0xc9b,0x200f9,0xc9e,0x200f8,0xc9e,0x700f5, + 0x13,0x15ea,0xc9c,0xc98,0x46d,0xc9d,0x50085,0xe,0x70b,0x156b,0x6ec,0x50081, + 0xe,0xe03,0x6e0,0x70b,0x50085,0xe,0xe55,0xe03,0x6df,0x50083,0xe,0xe56, + 0xe55,0x26d,0x6000c,0xe,0xe58,0x1,0x8,0xe56,0x4006e,0x56,0xe59,0xe58, + 0x6000c,0xe,0xe81,0x1,0xa,0xe56,0x50051,0x8,0xe62,0xe81,0x0,0x50083, + 0x8,0xe63,0x110,0xe62,0x50051,0x8,0xe65,0xe81,0x1,0x50083,0x8,0xe66, + 0x110,0xe65,0x50085,0x8,0xe67,0xe63,0xe66,0x50085,0x8,0xe6e,0xe62,0xe66, + 0x50085,0x8,0xe75,0xe63,0xe65,0x50085,0x8,0xe7b,0xe62,0xe65,0x70050,0xa1, + 0x1452,0xe67,0xe6e,0xe75,0xe7b,0x3003e,0x123b,0x1928,0x3003e,0x123c,0x1452,0x200f9, + 0xe07,0x200f8,0xe07,0x700f5,0x13,0x1619,0x46d,0xc9e,0x1840,0xe2f,0x700f5,0x8, + 0x1618,0x10f,0xc9e,0x183f,0xe2f,0x700f5,0x55,0x1617,0x1a2,0xc9e,0xe31,0xe2f, + 0x500b1,0xa8,0xe0a,0x1617,0x304,0x400f6,0xe32,0xe2f,0x0,0x400fa,0xe0a,0xe0b, + 0xe32,0x200f8,0xe0b,0x50041,0x6e,0x1241,0x123b,0x1617,0x4003d,0x56,0xe0e,0x1241, + 0x50080,0x56,0xe12,0xe59,0xe0e,0x50051,0x55,0xe8d,0xe12,0x0,0x500af,0xa8, + 0xe90,0xe8d,0x659,0x300f7,0xe9a,0x0,0x400fa,0xe90,0xe91,0xe9a,0x200f8,0xe91, + 0x50051,0x55,0xe95,0x653,0x0,0x50080,0x55,0xe98,0xe95,0x659,0x500b1,0xa8, + 0xe99,0xe8d,0xe98,0x200f9,0xe9a,0x200f8,0xe9a,0x700f5,0xa8,0xe9b,0xe90,0xe0b, + 0xe99,0xe91,0x300f7,0xea2,0x0,0x400fa,0xe9b,0xe9c,0xea2,0x200f8,0xe9c,0x50051, + 0x55,0xe9e,0xe12,0x1,0x50051,0x55,0xea0,0x64f,0x1,0x500af,0xa8,0xea1, + 0xe9e,0xea0,0x200f9,0xea2,0x200f8,0xea2,0x700f5,0xa8,0xea3,0xe9b,0xe9a,0xea1, + 0xe9c,0x300f7,0xead,0x0,0x400fa,0xea3,0xea4,0xead,0x200f8,0xea4,0x50051,0x55, + 0xea6,0xe12,0x1,0x50051,0x55,0xea8,0x653,0x1,0x50051,0x55,0xeaa,0x64f, + 0x1,0x50080,0x55,0xeab,0xea8,0xeaa,0x500b1,0xa8,0xeac,0xea6,0xeab,0x200f9, + 0xead,0x200f8,0xead,0x700f5,0xa8,0xeae,0xea3,0xea2,0xeac,0xea4,0x300f7,0xe2e, + 0x0,0x400fa,0xeae,0xe17,0xe2e,0x200f8,0xe17,0x50041,0xd,0x1242,0x123c,0x1617, + 0x4003d,0x8,0xe1a,0x1242,0x4003d,0x1da,0xeb7,0x1dc,0x7005f,0x76,0xeb9,0xeb7, + 0xe12,0x2,0x1a2,0x8004f,0x13,0xeba,0xeb9,0xeb9,0x0,0x1,0x2,0x5008e, + 0x13,0xe27,0xeba,0xe1a,0x50081,0x13,0xe29,0x1619,0xe27,0x50081,0x8,0xe2d, + 0x1618,0xe1a,0x200f9,0xe2e,0x200f8,0xe2e,0x700f5,0x13,0x1840,0x1619,0xead,0xe29, + 0xe17,0x700f5,0x8,0x183f,0x1618,0xead,0xe2d,0xe17,0x200f9,0xe2f,0x200f8,0xe2f, + 0x50080,0x55,0xe31,0x1617,0x1a7,0x200f9,0xe07,0x200f8,0xe32,0x500b7,0xa8,0xe34, + 0x1618,0x10f,0x300f7,0xe3b,0x0,0x400fa,0xe34,0xe35,0xe3a,0x200f8,0xe3a,0x200f9, + 0xe3b,0x200f8,0xe35,0x60050,0x13,0xe38,0x1618,0x1618,0x1618,0x50088,0x13,0xe39, + 0x1619,0xe38,0x200f9,0xe3b,0x200f8,0xe3b,0x700f5,0x13,0x161a,0xe39,0xe35,0x46d, + 0xe3a,0x4007f,0xe,0x711,0x156b,0x50085,0xe,0x713,0x711,0x6ec,0x50081,0xe, + 0xfa0,0x6e0,0x713,0x50085,0xe,0xff2,0xfa0,0x6df,0x50083,0xe,0xff3,0xff2, + 0x26d,0x6000c,0xe,0xff5,0x1,0x8,0xff3,0x4006e,0x56,0xff6,0xff5,0x6000c, + 0xe,0x101e,0x1,0xa,0xff3,0x50051,0x8,0xfff,0x101e,0x0,0x50083,0x8, + 0x1000,0x110,0xfff,0x50051,0x8,0x1002,0x101e,0x1,0x50083,0x8,0x1003,0x110, + 0x1002,0x50085,0x8,0x1004,0x1000,0x1003,0x50085,0x8,0x100b,0xfff,0x1003,0x50085, + 0x8,0x1012,0x1000,0x1002,0x50085,0x8,0x1018,0xfff,0x1002,0x70050,0xa1,0x1426, + 0x1004,0x100b,0x1012,0x1018,0x3003e,0x11f5,0x1928,0x3003e,0x11f6,0x1426,0x200f9,0xfa4, + 0x200f8,0xfa4,0x700f5,0x13,0x1649,0x46d,0xe3b,0x1866,0xfcc,0x700f5,0x8,0x1648, + 0x10f,0xe3b,0x1865,0xfcc,0x700f5,0x55,0x1647,0x1a2,0xe3b,0xfce,0xfcc,0x500b1, + 0xa8,0xfa7,0x1647,0x304,0x400f6,0xfcf,0xfcc,0x0,0x400fa,0xfa7,0xfa8,0xfcf, + 0x200f8,0xfa8,0x50041,0x6e,0x11fb,0x11f5,0x1647,0x4003d,0x56,0xfab,0x11fb,0x50080, + 0x56,0xfaf,0xff6,0xfab,0x50051,0x55,0x102a,0xfaf,0x0,0x500af,0xa8,0x102d, + 0x102a,0x659,0x300f7,0x1037,0x0,0x400fa,0x102d,0x102e,0x1037,0x200f8,0x102e,0x50051, + 0x55,0x1032,0x653,0x0,0x50080,0x55,0x1035,0x1032,0x659,0x500b1,0xa8,0x1036, + 0x102a,0x1035,0x200f9,0x1037,0x200f8,0x1037,0x700f5,0xa8,0x1038,0x102d,0xfa8,0x1036, + 0x102e,0x300f7,0x103f,0x0,0x400fa,0x1038,0x1039,0x103f,0x200f8,0x1039,0x50051,0x55, + 0x103b,0xfaf,0x1,0x50051,0x55,0x103d,0x64f,0x1,0x500af,0xa8,0x103e,0x103b, + 0x103d,0x200f9,0x103f,0x200f8,0x103f,0x700f5,0xa8,0x1040,0x1038,0x1037,0x103e,0x1039, + 0x300f7,0x104a,0x0,0x400fa,0x1040,0x1041,0x104a,0x200f8,0x1041,0x50051,0x55,0x1043, + 0xfaf,0x1,0x50051,0x55,0x1045,0x653,0x1,0x50051,0x55,0x1047,0x64f,0x1, + 0x50080,0x55,0x1048,0x1045,0x1047,0x500b1,0xa8,0x1049,0x1043,0x1048,0x200f9,0x104a, + 0x200f8,0x104a,0x700f5,0xa8,0x104b,0x1040,0x103f,0x1049,0x1041,0x300f7,0xfcb,0x0, + 0x400fa,0x104b,0xfb4,0xfcb,0x200f8,0xfb4,0x50041,0xd,0x11fc,0x11f6,0x1647,0x4003d, + 0x8,0xfb7,0x11fc,0x4003d,0x1da,0x104e,0x1e3,0x7005f,0x76,0x1050,0x104e,0xfaf, + 0x2,0x1a2,0x8004f,0x13,0x1051,0x1050,0x1050,0x0,0x1,0x2,0x5008e,0x13, + 0xfbd,0x1051,0xfb7,0x50081,0x13,0xfbf,0x1649,0xfbd,0x50081,0x8,0xfca,0x1648, + 0xfb7,0x200f9,0xfcb,0x200f8,0xfcb,0x700f5,0x13,0x1866,0x1649,0x104a,0xfbf,0xfb4, + 0x700f5,0x8,0x1865,0x1648,0x104a,0xfca,0xfb4,0x200f9,0xfcc,0x200f8,0xfcc,0x50080, + 0x55,0xfce,0x1647,0x1a7,0x200f9,0xfa4,0x200f8,0xfcf,0x500b7,0xa8,0xfd1,0x1648, + 0x10f,0x300f7,0xfd8,0x0,0x400fa,0xfd1,0xfd2,0xfd7,0x200f8,0xfd7,0x200f9,0xfd8, + 0x200f8,0xfd2,0x60050,0x13,0xfd5,0x1648,0x1648,0x1648,0x50088,0x13,0xfd6,0x1649, + 0xfd5,0x200f9,0xfd8,0x200f8,0xfd8,0x700f5,0x13,0x164a,0xfd6,0xfd2,0x46d,0xfd7, + 0x600a9,0x8,0x71a,0x919,0x110,0x10f,0x50051,0x8,0x71c,0x6f8,0x0,0x50085, + 0x8,0x71d,0x71c,0x71a,0x600a9,0x8,0x722,0x902,0x110,0x10f,0x50051,0x8, + 0x724,0x6f8,0x1,0x50085,0x8,0x725,0x724,0x722,0x50050,0xe,0x1a00,0x71d, + 0x725,0x6000c,0x8,0x728,0x1,0x42,0x1a00,0x500bc,0xa8,0x729,0x728,0x550, + 0x600a9,0x8,0x72a,0x729,0x110,0x10f,0x7000c,0x8,0x112e,0x1,0x28,0x10f, + 0x72a,0x8000c,0x8,0x1132,0x1,0x2b,0x112e,0x10f,0x110,0x50083,0x8,0x730, + 0x110,0x71d,0x50085,0x8,0x731,0x26c,0x730,0x50081,0x8,0x733,0x26c,0x731, + 0x50083,0x8,0x736,0x110,0x725,0x50085,0x8,0x737,0x26c,0x736,0x50083,0x8, + 0x739,0x733,0x737,0x8000c,0x8,0x1136,0x1,0x2b,0x739,0x10f,0x110,0x60050, + 0x13,0x113c,0x1136,0x1136,0x1136,0x8000c,0x13,0x113d,0x1,0x2e,0x15bf,0x15ea, + 0x113c,0x7000c,0x8,0x1142,0x1,0x25,0x71d,0x725,0x50083,0x8,0x746,0x110, + 0x1142,0x8000c,0x8,0x1146,0x1,0x2b,0x746,0x10f,0x110,0x500b4,0xa8,0x74a, + 0x15bd,0x10f,0x300f7,0x756,0x0,0x400fa,0x74a,0x74b,0x74e,0x200f8,0x74e,0x500b4, + 0xa8,0x751,0x15e8,0x10f,0x60050,0x193e,0x193f,0x751,0x751,0x751,0x600a9,0x13, + 0x1940,0x193f,0x15bf,0x113d,0x200f9,0x756,0x200f8,0x74b,0x200f9,0x756,0x200f8,0x756, + 0x700f5,0x13,0x171d,0x15ea,0x74b,0x1940,0x74e,0x300f7,0x75e,0x0,0x400fa,0x74a, + 0x75a,0x75e,0x200f8,0x75a,0x500b4,0xa8,0x75d,0x15e8,0x10f,0x200f9,0x75e,0x200f8, + 0x75e,0x700f5,0xa8,0x75f,0x74a,0x756,0x75d,0x75a,0x600a9,0x8,0x1941,0x75f, + 0x110,0x1132,0x500ba,0xa8,0x764,0x1618,0x10f,0x300f7,0x769,0x0,0x400fa,0x764, + 0x765,0x769,0x200f8,0x765,0x500ba,0xa8,0x768,0x1648,0x10f,0x200f9,0x769,0x200f8, + 0x769,0x700f5,0xa8,0x76a,0x764,0x75e,0x768,0x765,0x300f7,0x773,0x0,0x400fa, + 0x76a,0x76b,0x76c,0x200f8,0x76c,0x600a9,0x8,0x1942,0x764,0x10f,0x110,0x200f9, + 0x773,0x200f8,0x76b,0x200f9,0x773,0x200f8,0x773,0x700f5,0x8,0x16f7,0x26c,0x76b, + 0x1942,0x76c,0x60050,0x13,0x114c,0x16f7,0x16f7,0x16f7,0x8000c,0x13,0x114d,0x1, + 0x2e,0x161a,0x164a,0x114c,0x6000c,0x8,0x1154,0x1,0x42,0x161a,0x6000c,0x8, + 0x1155,0x1,0x42,0x164a,0x7000c,0x8,0x1168,0x1,0x28,0x1154,0x1155,0x500ba, + 0xa8,0x1158,0x1168,0x10f,0x300f7,0x1162,0x0,0x400fa,0x1158,0x1159,0x1161,0x200f8, + 0x1161,0x200f9,0x1162,0x200f8,0x1159,0x60050,0x13,0x115b,0x1168,0x1168,0x1168,0x50088, + 0x13,0x115c,0x161a,0x115b,0x50088,0x13,0x115f,0x164a,0x115b,0x50094,0x8,0x1160, + 0x115c,0x115f,0x200f9,0x1162,0x200f8,0x1162,0x700f5,0x8,0x16f9,0x1160,0x1159,0x110, + 0x1161,0x6000c,0x8,0x116f,0x1,0x42,0x15bf,0x6000c,0x8,0x1170,0x1,0x42, + 0x15ea,0x7000c,0x8,0x1183,0x1,0x28,0x116f,0x1170,0x500ba,0xa8,0x1173,0x1183, + 0x10f,0x300f7,0x117d,0x0,0x400fa,0x1173,0x1174,0x117c,0x200f8,0x117c,0x200f9,0x117d, + 0x200f8,0x1174,0x60050,0x13,0x1176,0x1183,0x1183,0x1183,0x50088,0x13,0x1177,0x15bf, + 0x1176,0x50088,0x13,0x117a,0x15ea,0x1176,0x50094,0x8,0x117b,0x1177,0x117a,0x200f9, + 0x117d,0x200f8,0x117d,0x700f5,0x8,0x170a,0x117b,0x1174,0x110,0x117c,0x7000c,0x8, + 0x1188,0x1,0x28,0x550,0x170a,0x8000c,0x8,0x118c,0x1,0x2b,0x1146,0x10f, + 0x110,0x8000c,0x8,0x1192,0x1,0x2e,0x1188,0x110,0x118c,0x7000c,0x8,0x1197, + 0x1,0x28,0x550,0x16f9,0x50088,0x8,0x78c,0x1192,0x1197,0x8000c,0x8,0x119b, + 0x1,0x2b,0x78c,0x10f,0x110,0x7000c,0x8,0x11a0,0x1,0x1a,0x119b,0x110, + 0x60041,0x228,0x11a8,0x226,0x1a2,0x1a7,0x4003d,0x6,0x11a9,0x11a8,0x500b0,0xa8, + 0x790,0x11a9,0x5d6,0x600a9,0x8,0x791,0x790,0x110,0x10f,0x8000c,0x8,0x11af, + 0x1,0x2e,0x11a0,0x110,0x791,0x8000c,0x8,0x11b3,0x1,0x2b,0x11af,0x10f, + 0x110,0x60050,0x13,0x11b9,0x11b3,0x11b3,0x11b3,0x8000c,0x13,0x11ba,0x1,0x2e, + 0x114d,0x171d,0x11b9,0x200f9,0x643,0x200f8,0x639,0x4003d,0x1da,0x684,0x1e3,0x7005f, + 0x76,0x686,0x684,0x616,0x2,0x1a2,0x8004f,0x13,0x687,0x686,0x686,0x0, + 0x1,0x2,0x200f9,0x643,0x200f8,0x643,0x700f5,0x8,0x17df,0x10f,0x639,0x1941, + 0x117d,0x700f5,0x13,0x17de,0x687,0x639,0x11ba,0x117d,0x50051,0x8,0x647,0x17de, + 0x0,0x50051,0x8,0x648,0x17de,0x1,0x50051,0x8,0x649,0x17de,0x2,0x70050, + 0x76,0x64a,0x647,0x648,0x649,0x17df,0x4003d,0x231,0x11bc,0x233,0x40063,0x11bc, + 0x616,0x64a,0x100fd,0x10038, +}; +static const char *fi_pass_1_cb_names[] = {"cbFI"}; +static const uint32_t fi_pass_1_cb_bind[] = {10}; +static const uint32_t fi_pass_1_cb_count[] = {1}; +static const uint32_t fi_pass_1_cb_space[] = {0}; +static const char *fi_pass_1_srv_tex_names[] = {"r_game_motion_vector_field_x", "r_game_motion_vector_field_y", "r_optical_flow_motion_vector_field_x", "r_optical_flow_motion_vector_field_y", "r_previous_interpolation_source", "r_current_interpolation_source", "r_disocclusion_mask", "r_inpainting_pyramid"}; +static const uint32_t fi_pass_1_srv_tex_bind[] = {0, 1, 2, 3, 4, 5, 6, 7}; +static const uint32_t fi_pass_1_srv_tex_count[] = {1, 1, 1, 1, 1, 1, 1, 1}; +static const uint32_t fi_pass_1_srv_tex_space[] = {0, 0, 0, 0, 0, 0, 0, 0}; +static const char *fi_pass_1_uav_tex_names[] = {"rw_output"}; +static const uint32_t fi_pass_1_uav_tex_bind[] = {9}; +static const uint32_t fi_pass_1_uav_tex_count[] = {1}; +static const uint32_t fi_pass_1_uav_tex_space[] = {0}; +static const char *fi_pass_1_srv_buf_names[] = {"r_counters"}; +static const uint32_t fi_pass_1_srv_buf_bind[] = {8}; +static const uint32_t fi_pass_1_srv_buf_count[] = {1}; +static const uint32_t fi_pass_1_srv_buf_space[] = {0}; +static const char *fi_pass_1_sampler_names[] = {"s_LinearClamp"}; +static const uint32_t fi_pass_1_sampler_bind[] = {1000}; +static const uint32_t fi_pass_1_sampler_count[] = {1}; +static const uint32_t fi_pass_1_sampler_space[] = {0}; + +static const uint32_t fi_compute_inpainting_pyramid_pass_1_spv[10127] = { + 0x7230203,0x10500,0x8000b,0x42d7,0x0,0x20011,0x1,0x20011,0x3d,0x20011,0x44,0x6000b, + 0x1,0x4c534c47,0x6474732e,0x3035342e,0x0,0x3000e,0x0,0x1,0x1c000f,0x5,0x4,0x6e69616d, + 0x0,0x12c,0x13f,0x151,0x15a,0x169,0x172,0x17b,0x184,0x18e,0x198,0x1a2, + 0x1ac,0x1b6,0x1c0,0x1ca,0x1d4,0x28a,0x299,0x29f,0x2a4,0x2a9,0x70d,0x711, + 0x60010,0x4,0x11,0x100,0x1,0x1,0x30003,0x2,0x1c2,0xb0004,0x455f4c47,0x735f5458, + 0x6c706d61,0x656c7265,0x745f7373,0x75747865,0x665f6572,0x74636e75,0x736e6f69,0x0,0xb0004,0x455f4c47,0x735f5458,0x65646168, + 0x78655f72,0x63696c70,0x615f7469,0x68746972,0x6974656d,0x79745f63,0x736570,0xa0004,0x475f4c47,0x4c474f4f,0x70635f45,0x74735f70, + 0x5f656c79,0x656e696c,0x7269645f,0x69746365,0x6576,0x80004,0x475f4c47,0x4c474f4f,0x6e695f45,0x64756c63,0x69645f65,0x74636572, + 0x657669,0x90004,0x4b5f4c47,0x735f5248,0x65646168,0x75735f72,0x6f726762,0x625f7075,0x63697361,0x0,0x80004,0x4b5f4c47, + 0x735f5248,0x65646168,0x75735f72,0x6f726762,0x715f7075,0x646175,0x40005,0x4,0x6e69616d,0x0,0x40005,0x12a, + 0x49466263,0x745f,0x60006,0x12a,0x0,0x70736964,0x5379616c,0x657a69,0x90006,0x12a,0x1,0x65746e69, + 0x6c6f7072,0x6f697461,0x6365526e,0x73614274,0x65,0x90006,0x12a,0x2,0x65746e69,0x6c6f7072,0x6f697461,0x6365526e, + 0x7a695374,0x65,0x40005,0x12c,0x49466263,0x0,0x80005,0x13d,0x6e496263,0x6e696170,0x676e6974,0x61727950, + 0x5f64696d,0x74,0x50006,0x13d,0x0,0x7370696d,0x0,0x70006,0x13d,0x1,0x576d756e,0x476b726f, + 0x70756f72,0x73,0x70006,0x13d,0x2,0x6b726f77,0x756f7247,0x66664f70,0x746573,0x70005,0x13f,0x6e496263, + 0x6e696170,0x676e6974,0x61727950,0x64696d,0x50005,0x151,0x756f5f72,0x74757074,0x0,0xa0005,0x158,0x6d617246, + 0x746e4965,0x6f707265,0x6974616c,0x57526e6f,0x6e756f43,0x73726574,0x745f,0x50006,0x158,0x0,0x61746164,0x0, + 0x50005,0x15a,0x635f7772,0x746e756f,0x737265,0x80005,0x169,0x695f7772,0x6961706e,0x6e69746e,0x79705f67,0x696d6172, + 0x3064,0x80005,0x172,0x695f7772,0x6961706e,0x6e69746e,0x79705f67,0x696d6172,0x3164,0x80005,0x17b,0x695f7772, + 0x6961706e,0x6e69746e,0x79705f67,0x696d6172,0x3264,0x80005,0x184,0x695f7772,0x6961706e,0x6e69746e,0x79705f67,0x696d6172, + 0x3364,0x80005,0x18e,0x695f7772,0x6961706e,0x6e69746e,0x79705f67,0x696d6172,0x3464,0x80005,0x198,0x695f7772, + 0x6961706e,0x6e69746e,0x79705f67,0x696d6172,0x3564,0x80005,0x1a2,0x695f7772,0x6961706e,0x6e69746e,0x79705f67,0x696d6172, + 0x3664,0x80005,0x1ac,0x695f7772,0x6961706e,0x6e69746e,0x79705f67,0x696d6172,0x3764,0x80005,0x1b6,0x695f7772, + 0x6961706e,0x6e69746e,0x79705f67,0x696d6172,0x3864,0x80005,0x1c0,0x695f7772,0x6961706e,0x6e69746e,0x79705f67,0x696d6172, + 0x3964,0x80005,0x1ca,0x695f7772,0x6961706e,0x6e69746e,0x79705f67,0x696d6172,0x303164,0x80005,0x1d4,0x695f7772, + 0x6961706e,0x6e69746e,0x79705f67,0x696d6172,0x313164,0x50005,0x28a,0x43647073,0x746e756f,0x7265,0x70005,0x299, + 0x49647073,0x7265746e,0x6964656d,0x52657461,0x0,0x70005,0x29f,0x49647073,0x7265746e,0x6964656d,0x47657461,0x0, + 0x70005,0x2a4,0x49647073,0x7265746e,0x6964656d,0x42657461,0x0,0x70005,0x2a9,0x49647073,0x7265746e,0x6964656d, + 0x41657461,0x0,0x60005,0x70d,0x575f6c67,0x476b726f,0x70756f72,0x4449,0x80005,0x711,0x4c5f6c67,0x6c61636f, + 0x6f766e49,0x69746163,0x6e496e6f,0x786564,0x30047,0x12a,0x2,0x50048,0x12a,0x0,0x23,0x8, + 0x50048,0x12a,0x1,0x23,0x70,0x50048,0x12a,0x2,0x23,0x78,0x40047,0x12c, + 0x21,0xf,0x40047,0x12c,0x22,0x0,0x30047,0x13d,0x2,0x50048,0x13d,0x0, + 0x23,0x0,0x50048,0x13d,0x1,0x23,0x4,0x50048,0x13d,0x2,0x23,0x8, + 0x40047,0x13f,0x21,0x10,0x40047,0x13f,0x22,0x0,0x40047,0x151,0x21,0x0, + 0x40047,0x151,0x22,0x0,0x40047,0x157,0x6,0x4,0x30047,0x158,0x2,0x40048, + 0x158,0x0,0x17,0x50048,0x158,0x0,0x23,0x0,0x30047,0x15a,0x17,0x40047, + 0x15a,0x21,0x1,0x40047,0x15a,0x22,0x0,0x40047,0x169,0x21,0x2,0x40047, + 0x169,0x22,0x0,0x40047,0x172,0x21,0x3,0x40047,0x172,0x22,0x0,0x40047, + 0x17b,0x21,0x4,0x40047,0x17b,0x22,0x0,0x40047,0x184,0x21,0x5,0x40047, + 0x184,0x22,0x0,0x40047,0x18e,0x21,0x6,0x40047,0x18e,0x22,0x0,0x30047, + 0x198,0x17,0x40047,0x198,0x21,0x7,0x40047,0x198,0x22,0x0,0x40047,0x1a2, + 0x21,0x8,0x40047,0x1a2,0x22,0x0,0x40047,0x1ac,0x21,0x9,0x40047,0x1ac, + 0x22,0x0,0x40047,0x1b6,0x21,0xa,0x40047,0x1b6,0x22,0x0,0x40047,0x1c0, + 0x21,0xb,0x40047,0x1c0,0x22,0x0,0x40047,0x1ca,0x21,0xc,0x40047,0x1ca, + 0x22,0x0,0x40047,0x1d4,0x21,0xd,0x40047,0x1d4,0x22,0x0,0x40047,0x70d, + 0xb,0x1a,0x40047,0x711,0xb,0x1d,0x40047,0x725,0xb,0x19,0x20013,0x2, + 0x30021,0x3,0x2,0x40015,0x6,0x20,0x0,0x30016,0x13,0x20,0x40017,0x19, + 0x6,0x2,0x40015,0x1e,0x20,0x1,0x40017,0x1f,0x1e,0x2,0x40017,0x30, + 0x13,0x4,0x20014,0x77,0x40017,0xed,0x1e,0x3,0x4002b,0x1e,0xfe,0x0, + 0x4002b,0x13,0x105,0x0,0x4002b,0x13,0x106,0x3f800000,0x4002b,0x6,0x10a,0x2, + 0x4002b,0x6,0x10b,0x3,0x4002b,0x6,0x111,0x1,0x5001e,0x12a,0x1f,0x1f, + 0x1f,0x40020,0x12b,0x2,0x12a,0x4003b,0x12b,0x12c,0x2,0x40020,0x12e,0x2, + 0x1f,0x4002b,0x1e,0x138,0x1,0x5001e,0x13d,0x6,0x6,0x19,0x40020,0x13e, + 0x2,0x13d,0x4003b,0x13e,0x13f,0x2,0x40020,0x140,0x2,0x6,0x4002b,0x1e, + 0x149,0x2,0x40020,0x14a,0x2,0x19,0x90019,0x14f,0x13,0x1,0x0,0x0, + 0x0,0x1,0x0,0x40020,0x150,0x0,0x14f,0x4003b,0x150,0x151,0x0,0x3001d, + 0x157,0x6,0x3001e,0x158,0x157,0x40020,0x159,0xc,0x158,0x4003b,0x159,0x15a, + 0xc,0x40020,0x15d,0xc,0x6,0x4002b,0x6,0x161,0x0,0x90019,0x167,0x13, + 0x1,0x0,0x0,0x0,0x2,0x2,0x40020,0x168,0x0,0x167,0x4003b,0x168, + 0x169,0x0,0x4003b,0x168,0x172,0x0,0x4003b,0x168,0x17b,0x0,0x4003b,0x168, + 0x184,0x0,0x4002b,0x6,0x18a,0x4,0x4003b,0x168,0x18e,0x0,0x4002b,0x6, + 0x194,0x5,0x4003b,0x168,0x198,0x0,0x4002b,0x6,0x19e,0x6,0x4003b,0x168, + 0x1a2,0x0,0x4002b,0x6,0x1a8,0x7,0x4003b,0x168,0x1ac,0x0,0x4002b,0x6, + 0x1b2,0x8,0x4003b,0x168,0x1b6,0x0,0x4002b,0x6,0x1bc,0x9,0x4003b,0x168, + 0x1c0,0x0,0x4002b,0x6,0x1c6,0xa,0x4003b,0x168,0x1ca,0x0,0x4002b,0x6, + 0x1d0,0xb,0x4003b,0x168,0x1d4,0x0,0x7002c,0x30,0x1e3,0x105,0x105,0x105, + 0x105,0x40020,0x289,0x4,0x6,0x4003b,0x289,0x28a,0x4,0x4002b,0x6,0x295, + 0x10,0x4001c,0x296,0x13,0x295,0x4001c,0x297,0x296,0x295,0x40020,0x298,0x4, + 0x297,0x4003b,0x298,0x299,0x4,0x40020,0x29c,0x4,0x13,0x4003b,0x298,0x29f, + 0x4,0x4003b,0x298,0x2a4,0x4,0x4003b,0x298,0x2a9,0x4,0x4002b,0x6,0x2f8, + 0xd48,0x4002b,0x6,0x2f9,0x108,0x5002c,0x19,0x34b,0x161,0x111,0x5002c,0x19, + 0x34e,0x111,0x161,0x5002c,0x19,0x351,0x111,0x111,0x4002b,0x6,0x396,0x40, + 0x4002b,0x6,0x3a4,0x20,0x4002b,0x1e,0x42b,0x3,0x4002b,0x1e,0x69c,0x6, + 0x4002b,0x1e,0x6a5,0x7,0x40017,0x70b,0x6,0x3,0x40020,0x70c,0x1,0x70b, + 0x4003b,0x70c,0x70d,0x1,0x40020,0x710,0x1,0x6,0x4003b,0x710,0x711,0x1, + 0x4002b,0x6,0x724,0x100,0x6002c,0x70b,0x725,0x724,0x111,0x111,0x5002c,0x19, + 0x40d6,0x396,0x396,0x5002c,0x19,0x40d7,0x3a4,0x3a4,0x5002c,0x19,0x40d8,0x1b2, + 0x1b2,0x5002c,0x19,0x40d9,0x18a,0x18a,0x5002c,0x19,0x40da,0x295,0x295,0x5002c, + 0x19,0x40db,0x10a,0x10a,0x5002c,0x1f,0x40dc,0xfe,0xfe,0x50036,0x2,0x4, + 0x0,0x3,0x200f8,0x5,0x4003d,0x70b,0x70e,0x70d,0x4007c,0xed,0x70f,0x70e, + 0x4003d,0x6,0x712,0x711,0x7004f,0x1f,0x747,0x70f,0x70f,0x0,0x1,0x4007c, + 0x19,0x748,0x747,0x50041,0x140,0x754,0x13f,0xfe,0x4003d,0x6,0x755,0x754, + 0x50041,0x140,0x758,0x13f,0x138,0x4003d,0x6,0x759,0x758,0x50041,0x14a,0x75c, + 0x13f,0x149,0x4003d,0x19,0x75d,0x75c,0x50080,0x19,0x766,0x748,0x75d,0x300f7, + 0x7c4,0x0,0x300fb,0x161,0x78e,0x200f8,0x78e,0x50089,0x6,0x790,0x712,0x396, + 0x600cb,0x6,0x7e7,0x790,0x149,0x42b,0x700c9,0x6,0x7ee,0x7e7,0x790,0xfe, + 0x138,0x600cb,0x6,0x7f6,0x790,0x42b,0x42b,0x600cb,0x6,0x7fe,0x790,0x138, + 0x149,0x700c9,0x6,0x805,0x7f6,0x7fe,0xfe,0x149,0x500c2,0x6,0x795,0x712, + 0x69c,0x50089,0x6,0x796,0x795,0x10a,0x50084,0x6,0x797,0x1b2,0x796,0x50080, + 0x6,0x798,0x7ee,0x797,0x500c2,0x6,0x79c,0x712,0x6a5,0x50084,0x6,0x79d, + 0x1b2,0x79c,0x50080,0x6,0x79e,0x805,0x79d,0x300f7,0x957,0x0,0x300fb,0x161, + 0x851,0x200f8,0x851,0x50084,0x19,0x854,0x766,0x40d6,0x4007c,0x1f,0x855,0x854, + 0x50084,0x6,0x857,0x798,0x10a,0x4007c,0x1e,0x858,0x857,0x50084,0x6,0x85a, + 0x79e,0x10a,0x4007c,0x1e,0x85b,0x85a,0x50050,0x1f,0x85c,0x858,0x85b,0x50080, + 0x1f,0x85d,0x855,0x85c,0x50084,0x19,0x860,0x766,0x40d7,0x4007c,0x1f,0x861, + 0x860,0x4007c,0x1e,0x863,0x798,0x4007c,0x1e,0x865,0x79e,0x50050,0x1f,0x866, + 0x863,0x865,0x50080,0x1f,0x867,0x861,0x866,0x4007c,0x19,0x869,0x85d,0x50080, + 0x19,0x962,0x869,0x34b,0x50080,0x19,0x964,0x869,0x34e,0x50080,0x19,0x966, + 0x869,0x351,0x4003d,0x14f,0x9cd,0x151,0x7005f,0x30,0x9cf,0x9cd,0x85d,0x2, + 0xfe,0x50041,0x12e,0x9d2,0x12c,0x161,0x4003d,0x1f,0x9d3,0x9d2,0x50051,0x1e, + 0x998,0x9d3,0x0,0x500ad,0x77,0x999,0x998,0xfe,0x600a9,0x13,0x99a,0x999, + 0x106,0x105,0x5008e,0x30,0x99b,0x9cf,0x99a,0x50051,0x13,0x99d,0x99b,0x3, + 0x50083,0x13,0x99e,0x106,0x99d,0x8000c,0x13,0x9d7,0x1,0x2b,0x99e,0x105, + 0x106,0x60052,0x30,0x40e1,0x9d7,0x99b,0x3,0x50051,0x1e,0x9a2,0x85d,0x0, + 0x50041,0x12e,0x9da,0x12c,0x111,0x4003d,0x1f,0x9db,0x9da,0x50051,0x1e,0x9a4, + 0x9db,0x0,0x500b1,0x77,0x9a5,0x9a2,0x9a4,0x400a8,0x77,0x9a6,0x9a5,0x300f7, + 0x9b0,0x0,0x400fa,0x9a6,0x9a7,0x9b0,0x200f8,0x9a7,0x50041,0x12e,0x9de,0x12c, + 0x10a,0x4003d,0x1f,0x9df,0x9de,0x50051,0x1e,0x9ab,0x9df,0x0,0x50080,0x1e, + 0x9ae,0x9ab,0x9a4,0x500af,0x77,0x9af,0x9a2,0x9ae,0x200f9,0x9b0,0x200f8,0x9b0, + 0x700f5,0x77,0x9b1,0x9a5,0x851,0x9af,0x9a7,0x400a8,0x77,0x9b2,0x9b1,0x300f7, + 0x9b9,0x0,0x400fa,0x9b2,0x9b3,0x9b9,0x200f8,0x9b3,0x50051,0x1e,0x9b5,0x85d, + 0x1,0x50051,0x1e,0x9b7,0x9db,0x1,0x500b1,0x77,0x9b8,0x9b5,0x9b7,0x200f9, + 0x9b9,0x200f8,0x9b9,0x700f5,0x77,0x9ba,0x9b1,0x9b0,0x9b8,0x9b3,0x400a8,0x77, + 0x9bb,0x9ba,0x300f7,0x9c5,0x0,0x400fa,0x9bb,0x9bc,0x9c5,0x200f8,0x9bc,0x50051, + 0x1e,0x9be,0x85d,0x1,0x50041,0x12e,0x9ea,0x12c,0x10a,0x4003d,0x1f,0x9eb, + 0x9ea,0x50051,0x1e,0x9c0,0x9eb,0x1,0x50051,0x1e,0x9c2,0x9db,0x1,0x50080, + 0x1e,0x9c3,0x9c0,0x9c2,0x500af,0x77,0x9c4,0x9be,0x9c3,0x200f9,0x9c5,0x200f8, + 0x9c5,0x700f5,0x77,0x9c6,0x9ba,0x9b9,0x9c4,0x9bc,0x300f7,0x9c9,0x0,0x400fa, + 0x9c6,0x9c7,0x9c9,0x200f8,0x9c7,0x60052,0x30,0x40e7,0x105,0x40e1,0x3,0x200f9, + 0x9c9,0x200f8,0x9c9,0x700f5,0x30,0x429a,0x40e1,0x9c5,0x40e7,0x9c7,0x4007c,0x1f, + 0x980,0x962,0x4003d,0x14f,0xa2d,0x151,0x7005f,0x30,0xa2f,0xa2d,0x980,0x2, + 0xfe,0x5008e,0x30,0x9fb,0xa2f,0x99a,0x50051,0x13,0x9fd,0x9fb,0x3,0x50083, + 0x13,0x9fe,0x106,0x9fd,0x8000c,0x13,0xa37,0x1,0x2b,0x9fe,0x105,0x106, + 0x60052,0x30,0x40ea,0xa37,0x9fb,0x3,0x50051,0x1e,0xa02,0x980,0x0,0x500b1, + 0x77,0xa05,0xa02,0x9a4,0x400a8,0x77,0xa06,0xa05,0x300f7,0xa10,0x0,0x400fa, + 0xa06,0xa07,0xa10,0x200f8,0xa07,0x50041,0x12e,0xa3e,0x12c,0x10a,0x4003d,0x1f, + 0xa3f,0xa3e,0x50051,0x1e,0xa0b,0xa3f,0x0,0x50080,0x1e,0xa0e,0xa0b,0x9a4, + 0x500af,0x77,0xa0f,0xa02,0xa0e,0x200f9,0xa10,0x200f8,0xa10,0x700f5,0x77,0xa11, + 0xa05,0x9c9,0xa0f,0xa07,0x400a8,0x77,0xa12,0xa11,0x300f7,0xa19,0x0,0x400fa, + 0xa12,0xa13,0xa19,0x200f8,0xa13,0x50051,0x1e,0xa15,0x980,0x1,0x50051,0x1e, + 0xa17,0x9db,0x1,0x500b1,0x77,0xa18,0xa15,0xa17,0x200f9,0xa19,0x200f8,0xa19, + 0x700f5,0x77,0xa1a,0xa11,0xa10,0xa18,0xa13,0x400a8,0x77,0xa1b,0xa1a,0x300f7, + 0xa25,0x0,0x400fa,0xa1b,0xa1c,0xa25,0x200f8,0xa1c,0x50051,0x1e,0xa1e,0x980, + 0x1,0x50041,0x12e,0xa4a,0x12c,0x10a,0x4003d,0x1f,0xa4b,0xa4a,0x50051,0x1e, + 0xa20,0xa4b,0x1,0x50051,0x1e,0xa22,0x9db,0x1,0x50080,0x1e,0xa23,0xa20, + 0xa22,0x500af,0x77,0xa24,0xa1e,0xa23,0x200f9,0xa25,0x200f8,0xa25,0x700f5,0x77, + 0xa26,0xa1a,0xa19,0xa24,0xa1c,0x300f7,0xa29,0x0,0x400fa,0xa26,0xa27,0xa29, + 0x200f8,0xa27,0x60052,0x30,0x40f0,0x105,0x40ea,0x3,0x200f9,0xa29,0x200f8,0xa29, + 0x700f5,0x30,0x429e,0x40ea,0xa25,0x40f0,0xa27,0x4007c,0x1f,0x984,0x964,0x4003d, + 0x14f,0xa8d,0x151,0x7005f,0x30,0xa8f,0xa8d,0x984,0x2,0xfe,0x5008e,0x30, + 0xa5b,0xa8f,0x99a,0x50051,0x13,0xa5d,0xa5b,0x3,0x50083,0x13,0xa5e,0x106, + 0xa5d,0x8000c,0x13,0xa97,0x1,0x2b,0xa5e,0x105,0x106,0x60052,0x30,0x40f3, + 0xa97,0xa5b,0x3,0x50051,0x1e,0xa62,0x984,0x0,0x500b1,0x77,0xa65,0xa62, + 0x9a4,0x400a8,0x77,0xa66,0xa65,0x300f7,0xa70,0x0,0x400fa,0xa66,0xa67,0xa70, + 0x200f8,0xa67,0x50041,0x12e,0xa9e,0x12c,0x10a,0x4003d,0x1f,0xa9f,0xa9e,0x50051, + 0x1e,0xa6b,0xa9f,0x0,0x50080,0x1e,0xa6e,0xa6b,0x9a4,0x500af,0x77,0xa6f, + 0xa62,0xa6e,0x200f9,0xa70,0x200f8,0xa70,0x700f5,0x77,0xa71,0xa65,0xa29,0xa6f, + 0xa67,0x400a8,0x77,0xa72,0xa71,0x300f7,0xa79,0x0,0x400fa,0xa72,0xa73,0xa79, + 0x200f8,0xa73,0x50051,0x1e,0xa75,0x984,0x1,0x50051,0x1e,0xa77,0x9db,0x1, + 0x500b1,0x77,0xa78,0xa75,0xa77,0x200f9,0xa79,0x200f8,0xa79,0x700f5,0x77,0xa7a, + 0xa71,0xa70,0xa78,0xa73,0x400a8,0x77,0xa7b,0xa7a,0x300f7,0xa85,0x0,0x400fa, + 0xa7b,0xa7c,0xa85,0x200f8,0xa7c,0x50051,0x1e,0xa7e,0x984,0x1,0x50041,0x12e, + 0xaaa,0x12c,0x10a,0x4003d,0x1f,0xaab,0xaaa,0x50051,0x1e,0xa80,0xaab,0x1, + 0x50051,0x1e,0xa82,0x9db,0x1,0x50080,0x1e,0xa83,0xa80,0xa82,0x500af,0x77, + 0xa84,0xa7e,0xa83,0x200f9,0xa85,0x200f8,0xa85,0x700f5,0x77,0xa86,0xa7a,0xa79, + 0xa84,0xa7c,0x300f7,0xa89,0x0,0x400fa,0xa86,0xa87,0xa89,0x200f8,0xa87,0x60052, + 0x30,0x40f9,0x105,0x40f3,0x3,0x200f9,0xa89,0x200f8,0xa89,0x700f5,0x30,0x42a2, + 0x40f3,0xa85,0x40f9,0xa87,0x4007c,0x1f,0x988,0x966,0x4003d,0x14f,0xaed,0x151, + 0x7005f,0x30,0xaef,0xaed,0x988,0x2,0xfe,0x5008e,0x30,0xabb,0xaef,0x99a, + 0x50051,0x13,0xabd,0xabb,0x3,0x50083,0x13,0xabe,0x106,0xabd,0x8000c,0x13, + 0xaf7,0x1,0x2b,0xabe,0x105,0x106,0x60052,0x30,0x40fc,0xaf7,0xabb,0x3, + 0x50051,0x1e,0xac2,0x988,0x0,0x500b1,0x77,0xac5,0xac2,0x9a4,0x400a8,0x77, + 0xac6,0xac5,0x300f7,0xad0,0x0,0x400fa,0xac6,0xac7,0xad0,0x200f8,0xac7,0x50041, + 0x12e,0xafe,0x12c,0x10a,0x4003d,0x1f,0xaff,0xafe,0x50051,0x1e,0xacb,0xaff, + 0x0,0x50080,0x1e,0xace,0xacb,0x9a4,0x500af,0x77,0xacf,0xac2,0xace,0x200f9, + 0xad0,0x200f8,0xad0,0x700f5,0x77,0xad1,0xac5,0xa89,0xacf,0xac7,0x400a8,0x77, + 0xad2,0xad1,0x300f7,0xad9,0x0,0x400fa,0xad2,0xad3,0xad9,0x200f8,0xad3,0x50051, + 0x1e,0xad5,0x988,0x1,0x50051,0x1e,0xad7,0x9db,0x1,0x500b1,0x77,0xad8, + 0xad5,0xad7,0x200f9,0xad9,0x200f8,0xad9,0x700f5,0x77,0xada,0xad1,0xad0,0xad8, + 0xad3,0x400a8,0x77,0xadb,0xada,0x300f7,0xae5,0x0,0x400fa,0xadb,0xadc,0xae5, + 0x200f8,0xadc,0x50051,0x1e,0xade,0x988,0x1,0x50041,0x12e,0xb0a,0x12c,0x10a, + 0x4003d,0x1f,0xb0b,0xb0a,0x50051,0x1e,0xae0,0xb0b,0x1,0x50051,0x1e,0xae2, + 0x9db,0x1,0x50080,0x1e,0xae3,0xae0,0xae2,0x500af,0x77,0xae4,0xade,0xae3, + 0x200f9,0xae5,0x200f8,0xae5,0x700f5,0x77,0xae6,0xada,0xad9,0xae4,0xadc,0x300f7, + 0xae9,0x0,0x400fa,0xae6,0xae7,0xae9,0x200f8,0xae7,0x60052,0x30,0x4102,0x105, + 0x40fc,0x3,0x200f9,0xae9,0x200f8,0xae9,0x700f5,0x30,0x42a6,0x40fc,0xae5,0x4102, + 0xae7,0x300f7,0xb45,0x0,0x300fb,0x161,0xb16,0x200f8,0xb16,0x50051,0x13,0xb18, + 0x429a,0x3,0x50051,0x13,0xb1a,0x429e,0x3,0x50051,0x13,0xb1c,0x42a2,0x3, + 0x50051,0x13,0xb1e,0x42a6,0x3,0x50081,0x13,0xb24,0xb18,0xb1a,0x50081,0x13, + 0xb27,0xb24,0xb1c,0x50081,0x13,0xb2a,0xb27,0xb1e,0x500b4,0x77,0xb2c,0xb2a, + 0x105,0x300f7,0xb2e,0x0,0x400fa,0xb2c,0xb2d,0xb2e,0x200f8,0xb2d,0x200f9,0xb45, + 0x200f8,0xb2e,0x5008e,0x30,0xb32,0x429a,0xb18,0x5008e,0x30,0xb36,0x429e,0xb1a, + 0x50081,0x30,0xb37,0xb32,0xb36,0x5008e,0x30,0xb3b,0x42a2,0xb1c,0x50081,0x30, + 0xb3c,0xb37,0xb3b,0x5008e,0x30,0xb40,0x42a6,0xb1e,0x50081,0x30,0xb41,0xb3c, + 0xb40,0x70050,0x30,0xb43,0xb2a,0xb2a,0xb2a,0xb2a,0x50088,0x30,0xb44,0xb41, + 0xb43,0x200f9,0xb45,0x200f8,0xb45,0x700f5,0x30,0x29fc,0x1e3,0xb2d,0xb44,0xb2e, + 0x4003d,0x167,0xb53,0x169,0x40063,0xb53,0x867,0x29fc,0x50080,0x6,0x878,0x857, + 0x3a4,0x4007c,0x1e,0x879,0x878,0x50050,0x1f,0x87d,0x879,0x85b,0x50080,0x1f, + 0x87e,0x855,0x87d,0x50080,0x6,0x884,0x798,0x295,0x4007c,0x1e,0x885,0x884, + 0x50050,0x1f,0x888,0x885,0x865,0x50080,0x1f,0x889,0x861,0x888,0x4007c,0x19, + 0x88b,0x87e,0x50080,0x19,0xbb5,0x88b,0x34b,0x50080,0x19,0xbb7,0x88b,0x34e, + 0x50080,0x19,0xbb9,0x88b,0x351,0x4003d,0x14f,0xc20,0x151,0x7005f,0x30,0xc22, + 0xc20,0x87e,0x2,0xfe,0x5008e,0x30,0xbee,0xc22,0x99a,0x50051,0x13,0xbf0, + 0xbee,0x3,0x50083,0x13,0xbf1,0x106,0xbf0,0x8000c,0x13,0xc2a,0x1,0x2b, + 0xbf1,0x105,0x106,0x60052,0x30,0x4111,0xc2a,0xbee,0x3,0x50051,0x1e,0xbf5, + 0x87e,0x0,0x500b1,0x77,0xbf8,0xbf5,0x9a4,0x400a8,0x77,0xbf9,0xbf8,0x300f7, + 0xc03,0x0,0x400fa,0xbf9,0xbfa,0xc03,0x200f8,0xbfa,0x50041,0x12e,0xc31,0x12c, + 0x10a,0x4003d,0x1f,0xc32,0xc31,0x50051,0x1e,0xbfe,0xc32,0x0,0x50080,0x1e, + 0xc01,0xbfe,0x9a4,0x500af,0x77,0xc02,0xbf5,0xc01,0x200f9,0xc03,0x200f8,0xc03, + 0x700f5,0x77,0xc04,0xbf8,0xb45,0xc02,0xbfa,0x400a8,0x77,0xc05,0xc04,0x300f7, + 0xc0c,0x0,0x400fa,0xc05,0xc06,0xc0c,0x200f8,0xc06,0x50051,0x1e,0xc08,0x87e, + 0x1,0x50051,0x1e,0xc0a,0x9db,0x1,0x500b1,0x77,0xc0b,0xc08,0xc0a,0x200f9, + 0xc0c,0x200f8,0xc0c,0x700f5,0x77,0xc0d,0xc04,0xc03,0xc0b,0xc06,0x400a8,0x77, + 0xc0e,0xc0d,0x300f7,0xc18,0x0,0x400fa,0xc0e,0xc0f,0xc18,0x200f8,0xc0f,0x50051, + 0x1e,0xc11,0x87e,0x1,0x50041,0x12e,0xc3d,0x12c,0x10a,0x4003d,0x1f,0xc3e, + 0xc3d,0x50051,0x1e,0xc13,0xc3e,0x1,0x50051,0x1e,0xc15,0x9db,0x1,0x50080, + 0x1e,0xc16,0xc13,0xc15,0x500af,0x77,0xc17,0xc11,0xc16,0x200f9,0xc18,0x200f8, + 0xc18,0x700f5,0x77,0xc19,0xc0d,0xc0c,0xc17,0xc0f,0x300f7,0xc1c,0x0,0x400fa, + 0xc19,0xc1a,0xc1c,0x200f8,0xc1a,0x60052,0x30,0x4117,0x105,0x4111,0x3,0x200f9, + 0xc1c,0x200f8,0xc1c,0x700f5,0x30,0x42aa,0x4111,0xc18,0x4117,0xc1a,0x4007c,0x1f, + 0xbd3,0xbb5,0x4003d,0x14f,0xc80,0x151,0x7005f,0x30,0xc82,0xc80,0xbd3,0x2, + 0xfe,0x5008e,0x30,0xc4e,0xc82,0x99a,0x50051,0x13,0xc50,0xc4e,0x3,0x50083, + 0x13,0xc51,0x106,0xc50,0x8000c,0x13,0xc8a,0x1,0x2b,0xc51,0x105,0x106, + 0x60052,0x30,0x411a,0xc8a,0xc4e,0x3,0x50051,0x1e,0xc55,0xbd3,0x0,0x500b1, + 0x77,0xc58,0xc55,0x9a4,0x400a8,0x77,0xc59,0xc58,0x300f7,0xc63,0x0,0x400fa, + 0xc59,0xc5a,0xc63,0x200f8,0xc5a,0x50041,0x12e,0xc91,0x12c,0x10a,0x4003d,0x1f, + 0xc92,0xc91,0x50051,0x1e,0xc5e,0xc92,0x0,0x50080,0x1e,0xc61,0xc5e,0x9a4, + 0x500af,0x77,0xc62,0xc55,0xc61,0x200f9,0xc63,0x200f8,0xc63,0x700f5,0x77,0xc64, + 0xc58,0xc1c,0xc62,0xc5a,0x400a8,0x77,0xc65,0xc64,0x300f7,0xc6c,0x0,0x400fa, + 0xc65,0xc66,0xc6c,0x200f8,0xc66,0x50051,0x1e,0xc68,0xbd3,0x1,0x50051,0x1e, + 0xc6a,0x9db,0x1,0x500b1,0x77,0xc6b,0xc68,0xc6a,0x200f9,0xc6c,0x200f8,0xc6c, + 0x700f5,0x77,0xc6d,0xc64,0xc63,0xc6b,0xc66,0x400a8,0x77,0xc6e,0xc6d,0x300f7, + 0xc78,0x0,0x400fa,0xc6e,0xc6f,0xc78,0x200f8,0xc6f,0x50051,0x1e,0xc71,0xbd3, + 0x1,0x50041,0x12e,0xc9d,0x12c,0x10a,0x4003d,0x1f,0xc9e,0xc9d,0x50051,0x1e, + 0xc73,0xc9e,0x1,0x50051,0x1e,0xc75,0x9db,0x1,0x50080,0x1e,0xc76,0xc73, + 0xc75,0x500af,0x77,0xc77,0xc71,0xc76,0x200f9,0xc78,0x200f8,0xc78,0x700f5,0x77, + 0xc79,0xc6d,0xc6c,0xc77,0xc6f,0x300f7,0xc7c,0x0,0x400fa,0xc79,0xc7a,0xc7c, + 0x200f8,0xc7a,0x60052,0x30,0x4120,0x105,0x411a,0x3,0x200f9,0xc7c,0x200f8,0xc7c, + 0x700f5,0x30,0x42ae,0x411a,0xc78,0x4120,0xc7a,0x4007c,0x1f,0xbd7,0xbb7,0x4003d, + 0x14f,0xce0,0x151,0x7005f,0x30,0xce2,0xce0,0xbd7,0x2,0xfe,0x5008e,0x30, + 0xcae,0xce2,0x99a,0x50051,0x13,0xcb0,0xcae,0x3,0x50083,0x13,0xcb1,0x106, + 0xcb0,0x8000c,0x13,0xcea,0x1,0x2b,0xcb1,0x105,0x106,0x60052,0x30,0x4123, + 0xcea,0xcae,0x3,0x50051,0x1e,0xcb5,0xbd7,0x0,0x500b1,0x77,0xcb8,0xcb5, + 0x9a4,0x400a8,0x77,0xcb9,0xcb8,0x300f7,0xcc3,0x0,0x400fa,0xcb9,0xcba,0xcc3, + 0x200f8,0xcba,0x50041,0x12e,0xcf1,0x12c,0x10a,0x4003d,0x1f,0xcf2,0xcf1,0x50051, + 0x1e,0xcbe,0xcf2,0x0,0x50080,0x1e,0xcc1,0xcbe,0x9a4,0x500af,0x77,0xcc2, + 0xcb5,0xcc1,0x200f9,0xcc3,0x200f8,0xcc3,0x700f5,0x77,0xcc4,0xcb8,0xc7c,0xcc2, + 0xcba,0x400a8,0x77,0xcc5,0xcc4,0x300f7,0xccc,0x0,0x400fa,0xcc5,0xcc6,0xccc, + 0x200f8,0xcc6,0x50051,0x1e,0xcc8,0xbd7,0x1,0x50051,0x1e,0xcca,0x9db,0x1, + 0x500b1,0x77,0xccb,0xcc8,0xcca,0x200f9,0xccc,0x200f8,0xccc,0x700f5,0x77,0xccd, + 0xcc4,0xcc3,0xccb,0xcc6,0x400a8,0x77,0xcce,0xccd,0x300f7,0xcd8,0x0,0x400fa, + 0xcce,0xccf,0xcd8,0x200f8,0xccf,0x50051,0x1e,0xcd1,0xbd7,0x1,0x50041,0x12e, + 0xcfd,0x12c,0x10a,0x4003d,0x1f,0xcfe,0xcfd,0x50051,0x1e,0xcd3,0xcfe,0x1, + 0x50051,0x1e,0xcd5,0x9db,0x1,0x50080,0x1e,0xcd6,0xcd3,0xcd5,0x500af,0x77, + 0xcd7,0xcd1,0xcd6,0x200f9,0xcd8,0x200f8,0xcd8,0x700f5,0x77,0xcd9,0xccd,0xccc, + 0xcd7,0xccf,0x300f7,0xcdc,0x0,0x400fa,0xcd9,0xcda,0xcdc,0x200f8,0xcda,0x60052, + 0x30,0x4129,0x105,0x4123,0x3,0x200f9,0xcdc,0x200f8,0xcdc,0x700f5,0x30,0x42b2, + 0x4123,0xcd8,0x4129,0xcda,0x4007c,0x1f,0xbdb,0xbb9,0x4003d,0x14f,0xd40,0x151, + 0x7005f,0x30,0xd42,0xd40,0xbdb,0x2,0xfe,0x5008e,0x30,0xd0e,0xd42,0x99a, + 0x50051,0x13,0xd10,0xd0e,0x3,0x50083,0x13,0xd11,0x106,0xd10,0x8000c,0x13, + 0xd4a,0x1,0x2b,0xd11,0x105,0x106,0x60052,0x30,0x412c,0xd4a,0xd0e,0x3, + 0x50051,0x1e,0xd15,0xbdb,0x0,0x500b1,0x77,0xd18,0xd15,0x9a4,0x400a8,0x77, + 0xd19,0xd18,0x300f7,0xd23,0x0,0x400fa,0xd19,0xd1a,0xd23,0x200f8,0xd1a,0x50041, + 0x12e,0xd51,0x12c,0x10a,0x4003d,0x1f,0xd52,0xd51,0x50051,0x1e,0xd1e,0xd52, + 0x0,0x50080,0x1e,0xd21,0xd1e,0x9a4,0x500af,0x77,0xd22,0xd15,0xd21,0x200f9, + 0xd23,0x200f8,0xd23,0x700f5,0x77,0xd24,0xd18,0xcdc,0xd22,0xd1a,0x400a8,0x77, + 0xd25,0xd24,0x300f7,0xd2c,0x0,0x400fa,0xd25,0xd26,0xd2c,0x200f8,0xd26,0x50051, + 0x1e,0xd28,0xbdb,0x1,0x50051,0x1e,0xd2a,0x9db,0x1,0x500b1,0x77,0xd2b, + 0xd28,0xd2a,0x200f9,0xd2c,0x200f8,0xd2c,0x700f5,0x77,0xd2d,0xd24,0xd23,0xd2b, + 0xd26,0x400a8,0x77,0xd2e,0xd2d,0x300f7,0xd38,0x0,0x400fa,0xd2e,0xd2f,0xd38, + 0x200f8,0xd2f,0x50051,0x1e,0xd31,0xbdb,0x1,0x50041,0x12e,0xd5d,0x12c,0x10a, + 0x4003d,0x1f,0xd5e,0xd5d,0x50051,0x1e,0xd33,0xd5e,0x1,0x50051,0x1e,0xd35, + 0x9db,0x1,0x50080,0x1e,0xd36,0xd33,0xd35,0x500af,0x77,0xd37,0xd31,0xd36, + 0x200f9,0xd38,0x200f8,0xd38,0x700f5,0x77,0xd39,0xd2d,0xd2c,0xd37,0xd2f,0x300f7, + 0xd3c,0x0,0x400fa,0xd39,0xd3a,0xd3c,0x200f8,0xd3a,0x60052,0x30,0x4132,0x105, + 0x412c,0x3,0x200f9,0xd3c,0x200f8,0xd3c,0x700f5,0x30,0x42b6,0x412c,0xd38,0x4132, + 0xd3a,0x300f7,0xd98,0x0,0x300fb,0x161,0xd69,0x200f8,0xd69,0x50051,0x13,0xd6b, + 0x42aa,0x3,0x50051,0x13,0xd6d,0x42ae,0x3,0x50051,0x13,0xd6f,0x42b2,0x3, + 0x50051,0x13,0xd71,0x42b6,0x3,0x50081,0x13,0xd77,0xd6b,0xd6d,0x50081,0x13, + 0xd7a,0xd77,0xd6f,0x50081,0x13,0xd7d,0xd7a,0xd71,0x500b4,0x77,0xd7f,0xd7d, + 0x105,0x300f7,0xd81,0x0,0x400fa,0xd7f,0xd80,0xd81,0x200f8,0xd80,0x200f9,0xd98, + 0x200f8,0xd81,0x5008e,0x30,0xd85,0x42aa,0xd6b,0x5008e,0x30,0xd89,0x42ae,0xd6d, + 0x50081,0x30,0xd8a,0xd85,0xd89,0x5008e,0x30,0xd8e,0x42b2,0xd6f,0x50081,0x30, + 0xd8f,0xd8a,0xd8e,0x5008e,0x30,0xd93,0x42b6,0xd71,0x50081,0x30,0xd94,0xd8f, + 0xd93,0x70050,0x30,0xd96,0xd7d,0xd7d,0xd7d,0xd7d,0x50088,0x30,0xd97,0xd94, + 0xd96,0x200f9,0xd98,0x200f8,0xd98,0x700f5,0x30,0x2ae6,0x1e3,0xd80,0xd97,0xd81, + 0x4003d,0x167,0xda6,0x169,0x40063,0xda6,0x889,0x2ae6,0x50080,0x6,0x89d,0x85a, + 0x3a4,0x4007c,0x1e,0x89e,0x89d,0x50050,0x1f,0x89f,0x858,0x89e,0x50080,0x1f, + 0x8a0,0x855,0x89f,0x50080,0x6,0x8a8,0x79e,0x295,0x4007c,0x1e,0x8a9,0x8a8, + 0x50050,0x1f,0x8aa,0x863,0x8a9,0x50080,0x1f,0x8ab,0x861,0x8aa,0x4007c,0x19, + 0x8ad,0x8a0,0x50080,0x19,0xe08,0x8ad,0x34b,0x50080,0x19,0xe0a,0x8ad,0x34e, + 0x50080,0x19,0xe0c,0x8ad,0x351,0x4003d,0x14f,0xe73,0x151,0x7005f,0x30,0xe75, + 0xe73,0x8a0,0x2,0xfe,0x5008e,0x30,0xe41,0xe75,0x99a,0x50051,0x13,0xe43, + 0xe41,0x3,0x50083,0x13,0xe44,0x106,0xe43,0x8000c,0x13,0xe7d,0x1,0x2b, + 0xe44,0x105,0x106,0x60052,0x30,0x4141,0xe7d,0xe41,0x3,0x50051,0x1e,0xe48, + 0x8a0,0x0,0x500b1,0x77,0xe4b,0xe48,0x9a4,0x400a8,0x77,0xe4c,0xe4b,0x300f7, + 0xe56,0x0,0x400fa,0xe4c,0xe4d,0xe56,0x200f8,0xe4d,0x50041,0x12e,0xe84,0x12c, + 0x10a,0x4003d,0x1f,0xe85,0xe84,0x50051,0x1e,0xe51,0xe85,0x0,0x50080,0x1e, + 0xe54,0xe51,0x9a4,0x500af,0x77,0xe55,0xe48,0xe54,0x200f9,0xe56,0x200f8,0xe56, + 0x700f5,0x77,0xe57,0xe4b,0xd98,0xe55,0xe4d,0x400a8,0x77,0xe58,0xe57,0x300f7, + 0xe5f,0x0,0x400fa,0xe58,0xe59,0xe5f,0x200f8,0xe59,0x50051,0x1e,0xe5b,0x8a0, + 0x1,0x50051,0x1e,0xe5d,0x9db,0x1,0x500b1,0x77,0xe5e,0xe5b,0xe5d,0x200f9, + 0xe5f,0x200f8,0xe5f,0x700f5,0x77,0xe60,0xe57,0xe56,0xe5e,0xe59,0x400a8,0x77, + 0xe61,0xe60,0x300f7,0xe6b,0x0,0x400fa,0xe61,0xe62,0xe6b,0x200f8,0xe62,0x50051, + 0x1e,0xe64,0x8a0,0x1,0x50041,0x12e,0xe90,0x12c,0x10a,0x4003d,0x1f,0xe91, + 0xe90,0x50051,0x1e,0xe66,0xe91,0x1,0x50051,0x1e,0xe68,0x9db,0x1,0x50080, + 0x1e,0xe69,0xe66,0xe68,0x500af,0x77,0xe6a,0xe64,0xe69,0x200f9,0xe6b,0x200f8, + 0xe6b,0x700f5,0x77,0xe6c,0xe60,0xe5f,0xe6a,0xe62,0x300f7,0xe6f,0x0,0x400fa, + 0xe6c,0xe6d,0xe6f,0x200f8,0xe6d,0x60052,0x30,0x4147,0x105,0x4141,0x3,0x200f9, + 0xe6f,0x200f8,0xe6f,0x700f5,0x30,0x42ba,0x4141,0xe6b,0x4147,0xe6d,0x4007c,0x1f, + 0xe26,0xe08,0x4003d,0x14f,0xed3,0x151,0x7005f,0x30,0xed5,0xed3,0xe26,0x2, + 0xfe,0x5008e,0x30,0xea1,0xed5,0x99a,0x50051,0x13,0xea3,0xea1,0x3,0x50083, + 0x13,0xea4,0x106,0xea3,0x8000c,0x13,0xedd,0x1,0x2b,0xea4,0x105,0x106, + 0x60052,0x30,0x414a,0xedd,0xea1,0x3,0x50051,0x1e,0xea8,0xe26,0x0,0x500b1, + 0x77,0xeab,0xea8,0x9a4,0x400a8,0x77,0xeac,0xeab,0x300f7,0xeb6,0x0,0x400fa, + 0xeac,0xead,0xeb6,0x200f8,0xead,0x50041,0x12e,0xee4,0x12c,0x10a,0x4003d,0x1f, + 0xee5,0xee4,0x50051,0x1e,0xeb1,0xee5,0x0,0x50080,0x1e,0xeb4,0xeb1,0x9a4, + 0x500af,0x77,0xeb5,0xea8,0xeb4,0x200f9,0xeb6,0x200f8,0xeb6,0x700f5,0x77,0xeb7, + 0xeab,0xe6f,0xeb5,0xead,0x400a8,0x77,0xeb8,0xeb7,0x300f7,0xebf,0x0,0x400fa, + 0xeb8,0xeb9,0xebf,0x200f8,0xeb9,0x50051,0x1e,0xebb,0xe26,0x1,0x50051,0x1e, + 0xebd,0x9db,0x1,0x500b1,0x77,0xebe,0xebb,0xebd,0x200f9,0xebf,0x200f8,0xebf, + 0x700f5,0x77,0xec0,0xeb7,0xeb6,0xebe,0xeb9,0x400a8,0x77,0xec1,0xec0,0x300f7, + 0xecb,0x0,0x400fa,0xec1,0xec2,0xecb,0x200f8,0xec2,0x50051,0x1e,0xec4,0xe26, + 0x1,0x50041,0x12e,0xef0,0x12c,0x10a,0x4003d,0x1f,0xef1,0xef0,0x50051,0x1e, + 0xec6,0xef1,0x1,0x50051,0x1e,0xec8,0x9db,0x1,0x50080,0x1e,0xec9,0xec6, + 0xec8,0x500af,0x77,0xeca,0xec4,0xec9,0x200f9,0xecb,0x200f8,0xecb,0x700f5,0x77, + 0xecc,0xec0,0xebf,0xeca,0xec2,0x300f7,0xecf,0x0,0x400fa,0xecc,0xecd,0xecf, + 0x200f8,0xecd,0x60052,0x30,0x4150,0x105,0x414a,0x3,0x200f9,0xecf,0x200f8,0xecf, + 0x700f5,0x30,0x42be,0x414a,0xecb,0x4150,0xecd,0x4007c,0x1f,0xe2a,0xe0a,0x4003d, + 0x14f,0xf33,0x151,0x7005f,0x30,0xf35,0xf33,0xe2a,0x2,0xfe,0x5008e,0x30, + 0xf01,0xf35,0x99a,0x50051,0x13,0xf03,0xf01,0x3,0x50083,0x13,0xf04,0x106, + 0xf03,0x8000c,0x13,0xf3d,0x1,0x2b,0xf04,0x105,0x106,0x60052,0x30,0x4153, + 0xf3d,0xf01,0x3,0x50051,0x1e,0xf08,0xe2a,0x0,0x500b1,0x77,0xf0b,0xf08, + 0x9a4,0x400a8,0x77,0xf0c,0xf0b,0x300f7,0xf16,0x0,0x400fa,0xf0c,0xf0d,0xf16, + 0x200f8,0xf0d,0x50041,0x12e,0xf44,0x12c,0x10a,0x4003d,0x1f,0xf45,0xf44,0x50051, + 0x1e,0xf11,0xf45,0x0,0x50080,0x1e,0xf14,0xf11,0x9a4,0x500af,0x77,0xf15, + 0xf08,0xf14,0x200f9,0xf16,0x200f8,0xf16,0x700f5,0x77,0xf17,0xf0b,0xecf,0xf15, + 0xf0d,0x400a8,0x77,0xf18,0xf17,0x300f7,0xf1f,0x0,0x400fa,0xf18,0xf19,0xf1f, + 0x200f8,0xf19,0x50051,0x1e,0xf1b,0xe2a,0x1,0x50051,0x1e,0xf1d,0x9db,0x1, + 0x500b1,0x77,0xf1e,0xf1b,0xf1d,0x200f9,0xf1f,0x200f8,0xf1f,0x700f5,0x77,0xf20, + 0xf17,0xf16,0xf1e,0xf19,0x400a8,0x77,0xf21,0xf20,0x300f7,0xf2b,0x0,0x400fa, + 0xf21,0xf22,0xf2b,0x200f8,0xf22,0x50051,0x1e,0xf24,0xe2a,0x1,0x50041,0x12e, + 0xf50,0x12c,0x10a,0x4003d,0x1f,0xf51,0xf50,0x50051,0x1e,0xf26,0xf51,0x1, + 0x50051,0x1e,0xf28,0x9db,0x1,0x50080,0x1e,0xf29,0xf26,0xf28,0x500af,0x77, + 0xf2a,0xf24,0xf29,0x200f9,0xf2b,0x200f8,0xf2b,0x700f5,0x77,0xf2c,0xf20,0xf1f, + 0xf2a,0xf22,0x300f7,0xf2f,0x0,0x400fa,0xf2c,0xf2d,0xf2f,0x200f8,0xf2d,0x60052, + 0x30,0x4159,0x105,0x4153,0x3,0x200f9,0xf2f,0x200f8,0xf2f,0x700f5,0x30,0x42c2, + 0x4153,0xf2b,0x4159,0xf2d,0x4007c,0x1f,0xe2e,0xe0c,0x4003d,0x14f,0xf93,0x151, + 0x7005f,0x30,0xf95,0xf93,0xe2e,0x2,0xfe,0x5008e,0x30,0xf61,0xf95,0x99a, + 0x50051,0x13,0xf63,0xf61,0x3,0x50083,0x13,0xf64,0x106,0xf63,0x8000c,0x13, + 0xf9d,0x1,0x2b,0xf64,0x105,0x106,0x60052,0x30,0x415c,0xf9d,0xf61,0x3, + 0x50051,0x1e,0xf68,0xe2e,0x0,0x500b1,0x77,0xf6b,0xf68,0x9a4,0x400a8,0x77, + 0xf6c,0xf6b,0x300f7,0xf76,0x0,0x400fa,0xf6c,0xf6d,0xf76,0x200f8,0xf6d,0x50041, + 0x12e,0xfa4,0x12c,0x10a,0x4003d,0x1f,0xfa5,0xfa4,0x50051,0x1e,0xf71,0xfa5, + 0x0,0x50080,0x1e,0xf74,0xf71,0x9a4,0x500af,0x77,0xf75,0xf68,0xf74,0x200f9, + 0xf76,0x200f8,0xf76,0x700f5,0x77,0xf77,0xf6b,0xf2f,0xf75,0xf6d,0x400a8,0x77, + 0xf78,0xf77,0x300f7,0xf7f,0x0,0x400fa,0xf78,0xf79,0xf7f,0x200f8,0xf79,0x50051, + 0x1e,0xf7b,0xe2e,0x1,0x50051,0x1e,0xf7d,0x9db,0x1,0x500b1,0x77,0xf7e, + 0xf7b,0xf7d,0x200f9,0xf7f,0x200f8,0xf7f,0x700f5,0x77,0xf80,0xf77,0xf76,0xf7e, + 0xf79,0x400a8,0x77,0xf81,0xf80,0x300f7,0xf8b,0x0,0x400fa,0xf81,0xf82,0xf8b, + 0x200f8,0xf82,0x50051,0x1e,0xf84,0xe2e,0x1,0x50041,0x12e,0xfb0,0x12c,0x10a, + 0x4003d,0x1f,0xfb1,0xfb0,0x50051,0x1e,0xf86,0xfb1,0x1,0x50051,0x1e,0xf88, + 0x9db,0x1,0x50080,0x1e,0xf89,0xf86,0xf88,0x500af,0x77,0xf8a,0xf84,0xf89, + 0x200f9,0xf8b,0x200f8,0xf8b,0x700f5,0x77,0xf8c,0xf80,0xf7f,0xf8a,0xf82,0x300f7, + 0xf8f,0x0,0x400fa,0xf8c,0xf8d,0xf8f,0x200f8,0xf8d,0x60052,0x30,0x4162,0x105, + 0x415c,0x3,0x200f9,0xf8f,0x200f8,0xf8f,0x700f5,0x30,0x42c6,0x415c,0xf8b,0x4162, + 0xf8d,0x300f7,0xfeb,0x0,0x300fb,0x161,0xfbc,0x200f8,0xfbc,0x50051,0x13,0xfbe, + 0x42ba,0x3,0x50051,0x13,0xfc0,0x42be,0x3,0x50051,0x13,0xfc2,0x42c2,0x3, + 0x50051,0x13,0xfc4,0x42c6,0x3,0x50081,0x13,0xfca,0xfbe,0xfc0,0x50081,0x13, + 0xfcd,0xfca,0xfc2,0x50081,0x13,0xfd0,0xfcd,0xfc4,0x500b4,0x77,0xfd2,0xfd0, + 0x105,0x300f7,0xfd4,0x0,0x400fa,0xfd2,0xfd3,0xfd4,0x200f8,0xfd3,0x200f9,0xfeb, + 0x200f8,0xfd4,0x5008e,0x30,0xfd8,0x42ba,0xfbe,0x5008e,0x30,0xfdc,0x42be,0xfc0, + 0x50081,0x30,0xfdd,0xfd8,0xfdc,0x5008e,0x30,0xfe1,0x42c2,0xfc2,0x50081,0x30, + 0xfe2,0xfdd,0xfe1,0x5008e,0x30,0xfe6,0x42c6,0xfc4,0x50081,0x30,0xfe7,0xfe2, + 0xfe6,0x70050,0x30,0xfe9,0xfd0,0xfd0,0xfd0,0xfd0,0x50088,0x30,0xfea,0xfe7, + 0xfe9,0x200f9,0xfeb,0x200f8,0xfeb,0x700f5,0x30,0x2bd0,0x1e3,0xfd3,0xfea,0xfd4, + 0x4003d,0x167,0xff9,0x169,0x40063,0xff9,0x8ab,0x2bd0,0x50050,0x1f,0x8c2,0x879, + 0x89e,0x50080,0x1f,0x8c3,0x855,0x8c2,0x50050,0x1f,0x8ce,0x885,0x8a9,0x50080, + 0x1f,0x8cf,0x861,0x8ce,0x4007c,0x19,0x8d1,0x8c3,0x50080,0x19,0x105b,0x8d1, + 0x34b,0x50080,0x19,0x105d,0x8d1,0x34e,0x50080,0x19,0x105f,0x8d1,0x351,0x4003d, + 0x14f,0x10c6,0x151,0x7005f,0x30,0x10c8,0x10c6,0x8c3,0x2,0xfe,0x5008e,0x30, + 0x1094,0x10c8,0x99a,0x50051,0x13,0x1096,0x1094,0x3,0x50083,0x13,0x1097,0x106, + 0x1096,0x8000c,0x13,0x10d0,0x1,0x2b,0x1097,0x105,0x106,0x60052,0x30,0x4171, + 0x10d0,0x1094,0x3,0x50051,0x1e,0x109b,0x8c3,0x0,0x500b1,0x77,0x109e,0x109b, + 0x9a4,0x400a8,0x77,0x109f,0x109e,0x300f7,0x10a9,0x0,0x400fa,0x109f,0x10a0,0x10a9, + 0x200f8,0x10a0,0x50041,0x12e,0x10d7,0x12c,0x10a,0x4003d,0x1f,0x10d8,0x10d7,0x50051, + 0x1e,0x10a4,0x10d8,0x0,0x50080,0x1e,0x10a7,0x10a4,0x9a4,0x500af,0x77,0x10a8, + 0x109b,0x10a7,0x200f9,0x10a9,0x200f8,0x10a9,0x700f5,0x77,0x10aa,0x109e,0xfeb,0x10a8, + 0x10a0,0x400a8,0x77,0x10ab,0x10aa,0x300f7,0x10b2,0x0,0x400fa,0x10ab,0x10ac,0x10b2, + 0x200f8,0x10ac,0x50051,0x1e,0x10ae,0x8c3,0x1,0x50051,0x1e,0x10b0,0x9db,0x1, + 0x500b1,0x77,0x10b1,0x10ae,0x10b0,0x200f9,0x10b2,0x200f8,0x10b2,0x700f5,0x77,0x10b3, + 0x10aa,0x10a9,0x10b1,0x10ac,0x400a8,0x77,0x10b4,0x10b3,0x300f7,0x10be,0x0,0x400fa, + 0x10b4,0x10b5,0x10be,0x200f8,0x10b5,0x50051,0x1e,0x10b7,0x8c3,0x1,0x50041,0x12e, + 0x10e3,0x12c,0x10a,0x4003d,0x1f,0x10e4,0x10e3,0x50051,0x1e,0x10b9,0x10e4,0x1, + 0x50051,0x1e,0x10bb,0x9db,0x1,0x50080,0x1e,0x10bc,0x10b9,0x10bb,0x500af,0x77, + 0x10bd,0x10b7,0x10bc,0x200f9,0x10be,0x200f8,0x10be,0x700f5,0x77,0x10bf,0x10b3,0x10b2, + 0x10bd,0x10b5,0x300f7,0x10c2,0x0,0x400fa,0x10bf,0x10c0,0x10c2,0x200f8,0x10c0,0x60052, + 0x30,0x4177,0x105,0x4171,0x3,0x200f9,0x10c2,0x200f8,0x10c2,0x700f5,0x30,0x42ca, + 0x4171,0x10be,0x4177,0x10c0,0x4007c,0x1f,0x1079,0x105b,0x4003d,0x14f,0x1126,0x151, + 0x7005f,0x30,0x1128,0x1126,0x1079,0x2,0xfe,0x5008e,0x30,0x10f4,0x1128,0x99a, + 0x50051,0x13,0x10f6,0x10f4,0x3,0x50083,0x13,0x10f7,0x106,0x10f6,0x8000c,0x13, + 0x1130,0x1,0x2b,0x10f7,0x105,0x106,0x60052,0x30,0x417a,0x1130,0x10f4,0x3, + 0x50051,0x1e,0x10fb,0x1079,0x0,0x500b1,0x77,0x10fe,0x10fb,0x9a4,0x400a8,0x77, + 0x10ff,0x10fe,0x300f7,0x1109,0x0,0x400fa,0x10ff,0x1100,0x1109,0x200f8,0x1100,0x50041, + 0x12e,0x1137,0x12c,0x10a,0x4003d,0x1f,0x1138,0x1137,0x50051,0x1e,0x1104,0x1138, + 0x0,0x50080,0x1e,0x1107,0x1104,0x9a4,0x500af,0x77,0x1108,0x10fb,0x1107,0x200f9, + 0x1109,0x200f8,0x1109,0x700f5,0x77,0x110a,0x10fe,0x10c2,0x1108,0x1100,0x400a8,0x77, + 0x110b,0x110a,0x300f7,0x1112,0x0,0x400fa,0x110b,0x110c,0x1112,0x200f8,0x110c,0x50051, + 0x1e,0x110e,0x1079,0x1,0x50051,0x1e,0x1110,0x9db,0x1,0x500b1,0x77,0x1111, + 0x110e,0x1110,0x200f9,0x1112,0x200f8,0x1112,0x700f5,0x77,0x1113,0x110a,0x1109,0x1111, + 0x110c,0x400a8,0x77,0x1114,0x1113,0x300f7,0x111e,0x0,0x400fa,0x1114,0x1115,0x111e, + 0x200f8,0x1115,0x50051,0x1e,0x1117,0x1079,0x1,0x50041,0x12e,0x1143,0x12c,0x10a, + 0x4003d,0x1f,0x1144,0x1143,0x50051,0x1e,0x1119,0x1144,0x1,0x50051,0x1e,0x111b, + 0x9db,0x1,0x50080,0x1e,0x111c,0x1119,0x111b,0x500af,0x77,0x111d,0x1117,0x111c, + 0x200f9,0x111e,0x200f8,0x111e,0x700f5,0x77,0x111f,0x1113,0x1112,0x111d,0x1115,0x300f7, + 0x1122,0x0,0x400fa,0x111f,0x1120,0x1122,0x200f8,0x1120,0x60052,0x30,0x4180,0x105, + 0x417a,0x3,0x200f9,0x1122,0x200f8,0x1122,0x700f5,0x30,0x42ce,0x417a,0x111e,0x4180, + 0x1120,0x4007c,0x1f,0x107d,0x105d,0x4003d,0x14f,0x1186,0x151,0x7005f,0x30,0x1188, + 0x1186,0x107d,0x2,0xfe,0x5008e,0x30,0x1154,0x1188,0x99a,0x50051,0x13,0x1156, + 0x1154,0x3,0x50083,0x13,0x1157,0x106,0x1156,0x8000c,0x13,0x1190,0x1,0x2b, + 0x1157,0x105,0x106,0x60052,0x30,0x4183,0x1190,0x1154,0x3,0x50051,0x1e,0x115b, + 0x107d,0x0,0x500b1,0x77,0x115e,0x115b,0x9a4,0x400a8,0x77,0x115f,0x115e,0x300f7, + 0x1169,0x0,0x400fa,0x115f,0x1160,0x1169,0x200f8,0x1160,0x50041,0x12e,0x1197,0x12c, + 0x10a,0x4003d,0x1f,0x1198,0x1197,0x50051,0x1e,0x1164,0x1198,0x0,0x50080,0x1e, + 0x1167,0x1164,0x9a4,0x500af,0x77,0x1168,0x115b,0x1167,0x200f9,0x1169,0x200f8,0x1169, + 0x700f5,0x77,0x116a,0x115e,0x1122,0x1168,0x1160,0x400a8,0x77,0x116b,0x116a,0x300f7, + 0x1172,0x0,0x400fa,0x116b,0x116c,0x1172,0x200f8,0x116c,0x50051,0x1e,0x116e,0x107d, + 0x1,0x50051,0x1e,0x1170,0x9db,0x1,0x500b1,0x77,0x1171,0x116e,0x1170,0x200f9, + 0x1172,0x200f8,0x1172,0x700f5,0x77,0x1173,0x116a,0x1169,0x1171,0x116c,0x400a8,0x77, + 0x1174,0x1173,0x300f7,0x117e,0x0,0x400fa,0x1174,0x1175,0x117e,0x200f8,0x1175,0x50051, + 0x1e,0x1177,0x107d,0x1,0x50041,0x12e,0x11a3,0x12c,0x10a,0x4003d,0x1f,0x11a4, + 0x11a3,0x50051,0x1e,0x1179,0x11a4,0x1,0x50051,0x1e,0x117b,0x9db,0x1,0x50080, + 0x1e,0x117c,0x1179,0x117b,0x500af,0x77,0x117d,0x1177,0x117c,0x200f9,0x117e,0x200f8, + 0x117e,0x700f5,0x77,0x117f,0x1173,0x1172,0x117d,0x1175,0x300f7,0x1182,0x0,0x400fa, + 0x117f,0x1180,0x1182,0x200f8,0x1180,0x60052,0x30,0x4189,0x105,0x4183,0x3,0x200f9, + 0x1182,0x200f8,0x1182,0x700f5,0x30,0x42d2,0x4183,0x117e,0x4189,0x1180,0x4007c,0x1f, + 0x1081,0x105f,0x4003d,0x14f,0x11e6,0x151,0x7005f,0x30,0x11e8,0x11e6,0x1081,0x2, + 0xfe,0x5008e,0x30,0x11b4,0x11e8,0x99a,0x50051,0x13,0x11b6,0x11b4,0x3,0x50083, + 0x13,0x11b7,0x106,0x11b6,0x8000c,0x13,0x11f0,0x1,0x2b,0x11b7,0x105,0x106, + 0x60052,0x30,0x418c,0x11f0,0x11b4,0x3,0x50051,0x1e,0x11bb,0x1081,0x0,0x500b1, + 0x77,0x11be,0x11bb,0x9a4,0x400a8,0x77,0x11bf,0x11be,0x300f7,0x11c9,0x0,0x400fa, + 0x11bf,0x11c0,0x11c9,0x200f8,0x11c0,0x50041,0x12e,0x11f7,0x12c,0x10a,0x4003d,0x1f, + 0x11f8,0x11f7,0x50051,0x1e,0x11c4,0x11f8,0x0,0x50080,0x1e,0x11c7,0x11c4,0x9a4, + 0x500af,0x77,0x11c8,0x11bb,0x11c7,0x200f9,0x11c9,0x200f8,0x11c9,0x700f5,0x77,0x11ca, + 0x11be,0x1182,0x11c8,0x11c0,0x400a8,0x77,0x11cb,0x11ca,0x300f7,0x11d2,0x0,0x400fa, + 0x11cb,0x11cc,0x11d2,0x200f8,0x11cc,0x50051,0x1e,0x11ce,0x1081,0x1,0x50051,0x1e, + 0x11d0,0x9db,0x1,0x500b1,0x77,0x11d1,0x11ce,0x11d0,0x200f9,0x11d2,0x200f8,0x11d2, + 0x700f5,0x77,0x11d3,0x11ca,0x11c9,0x11d1,0x11cc,0x400a8,0x77,0x11d4,0x11d3,0x300f7, + 0x11de,0x0,0x400fa,0x11d4,0x11d5,0x11de,0x200f8,0x11d5,0x50051,0x1e,0x11d7,0x1081, + 0x1,0x50041,0x12e,0x1203,0x12c,0x10a,0x4003d,0x1f,0x1204,0x1203,0x50051,0x1e, + 0x11d9,0x1204,0x1,0x50051,0x1e,0x11db,0x9db,0x1,0x50080,0x1e,0x11dc,0x11d9, + 0x11db,0x500af,0x77,0x11dd,0x11d7,0x11dc,0x200f9,0x11de,0x200f8,0x11de,0x700f5,0x77, + 0x11df,0x11d3,0x11d2,0x11dd,0x11d5,0x300f7,0x11e2,0x0,0x400fa,0x11df,0x11e0,0x11e2, + 0x200f8,0x11e0,0x60052,0x30,0x4192,0x105,0x418c,0x3,0x200f9,0x11e2,0x200f8,0x11e2, + 0x700f5,0x30,0x42d6,0x418c,0x11de,0x4192,0x11e0,0x300f7,0x123e,0x0,0x300fb,0x161, + 0x120f,0x200f8,0x120f,0x50051,0x13,0x1211,0x42ca,0x3,0x50051,0x13,0x1213,0x42ce, + 0x3,0x50051,0x13,0x1215,0x42d2,0x3,0x50051,0x13,0x1217,0x42d6,0x3,0x50081, + 0x13,0x121d,0x1211,0x1213,0x50081,0x13,0x1220,0x121d,0x1215,0x50081,0x13,0x1223, + 0x1220,0x1217,0x500b4,0x77,0x1225,0x1223,0x105,0x300f7,0x1227,0x0,0x400fa,0x1225, + 0x1226,0x1227,0x200f8,0x1226,0x200f9,0x123e,0x200f8,0x1227,0x5008e,0x30,0x122b,0x42ca, + 0x1211,0x5008e,0x30,0x122f,0x42ce,0x1213,0x50081,0x30,0x1230,0x122b,0x122f,0x5008e, + 0x30,0x1234,0x42d2,0x1215,0x50081,0x30,0x1235,0x1230,0x1234,0x5008e,0x30,0x1239, + 0x42d6,0x1217,0x50081,0x30,0x123a,0x1235,0x1239,0x70050,0x30,0x123c,0x1223,0x1223, + 0x1223,0x1223,0x50088,0x30,0x123d,0x123a,0x123c,0x200f9,0x123e,0x200f8,0x123e,0x700f5, + 0x30,0x2cba,0x1e3,0x1226,0x123d,0x1227,0x4003d,0x167,0x124c,0x169,0x40063,0x124c, + 0x8cf,0x2cba,0x500b2,0x77,0x8db,0x755,0x111,0x300f7,0x8dd,0x0,0x400fa,0x8db, + 0x8dc,0x8dd,0x200f8,0x8dc,0x200f9,0x957,0x200f8,0x8dd,0x6016e,0x30,0x12b0,0x10b, + 0x29fc,0x161,0x6016e,0x30,0x12b2,0x10b,0x29fc,0x111,0x6016e,0x30,0x12b4,0x10b, + 0x29fc,0x10a,0x300f7,0x12ef,0x0,0x300fb,0x161,0x12c0,0x200f8,0x12c0,0x50051,0x13, + 0x12c2,0x29fc,0x3,0x50051,0x13,0x12c4,0x12b0,0x3,0x50051,0x13,0x12c6,0x12b2, + 0x3,0x50051,0x13,0x12c8,0x12b4,0x3,0x50081,0x13,0x12ce,0x12c2,0x12c4,0x50081, + 0x13,0x12d1,0x12ce,0x12c6,0x50081,0x13,0x12d4,0x12d1,0x12c8,0x500b4,0x77,0x12d6, + 0x12d4,0x105,0x300f7,0x12d8,0x0,0x400fa,0x12d6,0x12d7,0x12d8,0x200f8,0x12d7,0x200f9, + 0x12ef,0x200f8,0x12d8,0x5008e,0x30,0x12dc,0x29fc,0x12c2,0x5008e,0x30,0x12e0,0x12b0, + 0x12c4,0x50081,0x30,0x12e1,0x12dc,0x12e0,0x5008e,0x30,0x12e5,0x12b2,0x12c6,0x50081, + 0x30,0x12e6,0x12e1,0x12e5,0x5008e,0x30,0x12ea,0x12b4,0x12c8,0x50081,0x30,0x12eb, + 0x12e6,0x12ea,0x70050,0x30,0x12ed,0x12d4,0x12d4,0x12d4,0x12d4,0x50088,0x30,0x12ee, + 0x12eb,0x12ed,0x200f9,0x12ef,0x200f8,0x12ef,0x700f5,0x30,0x2de0,0x1e3,0x12d7,0x12ee, + 0x12d8,0x6016e,0x30,0x12fd,0x10b,0x2ae6,0x161,0x6016e,0x30,0x12ff,0x10b,0x2ae6, + 0x111,0x6016e,0x30,0x1301,0x10b,0x2ae6,0x10a,0x300f7,0x133c,0x0,0x300fb,0x161, + 0x130d,0x200f8,0x130d,0x50051,0x13,0x130f,0x2ae6,0x3,0x50051,0x13,0x1311,0x12fd, + 0x3,0x50051,0x13,0x1313,0x12ff,0x3,0x50051,0x13,0x1315,0x1301,0x3,0x50081, + 0x13,0x131b,0x130f,0x1311,0x50081,0x13,0x131e,0x131b,0x1313,0x50081,0x13,0x1321, + 0x131e,0x1315,0x500b4,0x77,0x1323,0x1321,0x105,0x300f7,0x1325,0x0,0x400fa,0x1323, + 0x1324,0x1325,0x200f8,0x1324,0x200f9,0x133c,0x200f8,0x1325,0x5008e,0x30,0x1329,0x2ae6, + 0x130f,0x5008e,0x30,0x132d,0x12fd,0x1311,0x50081,0x30,0x132e,0x1329,0x132d,0x5008e, + 0x30,0x1332,0x12ff,0x1313,0x50081,0x30,0x1333,0x132e,0x1332,0x5008e,0x30,0x1337, + 0x1301,0x1315,0x50081,0x30,0x1338,0x1333,0x1337,0x70050,0x30,0x133a,0x1321,0x1321, + 0x1321,0x1321,0x50088,0x30,0x133b,0x1338,0x133a,0x200f9,0x133c,0x200f8,0x133c,0x700f5, + 0x30,0x2e2b,0x1e3,0x1324,0x133b,0x1325,0x6016e,0x30,0x134a,0x10b,0x2bd0,0x161, + 0x6016e,0x30,0x134c,0x10b,0x2bd0,0x111,0x6016e,0x30,0x134e,0x10b,0x2bd0,0x10a, + 0x300f7,0x1389,0x0,0x300fb,0x161,0x135a,0x200f8,0x135a,0x50051,0x13,0x135c,0x2bd0, + 0x3,0x50051,0x13,0x135e,0x134a,0x3,0x50051,0x13,0x1360,0x134c,0x3,0x50051, + 0x13,0x1362,0x134e,0x3,0x50081,0x13,0x1368,0x135c,0x135e,0x50081,0x13,0x136b, + 0x1368,0x1360,0x50081,0x13,0x136e,0x136b,0x1362,0x500b4,0x77,0x1370,0x136e,0x105, + 0x300f7,0x1372,0x0,0x400fa,0x1370,0x1371,0x1372,0x200f8,0x1371,0x200f9,0x1389,0x200f8, + 0x1372,0x5008e,0x30,0x1376,0x2bd0,0x135c,0x5008e,0x30,0x137a,0x134a,0x135e,0x50081, + 0x30,0x137b,0x1376,0x137a,0x5008e,0x30,0x137f,0x134c,0x1360,0x50081,0x30,0x1380, + 0x137b,0x137f,0x5008e,0x30,0x1384,0x134e,0x1362,0x50081,0x30,0x1385,0x1380,0x1384, + 0x70050,0x30,0x1387,0x136e,0x136e,0x136e,0x136e,0x50088,0x30,0x1388,0x1385,0x1387, + 0x200f9,0x1389,0x200f8,0x1389,0x700f5,0x30,0x2e59,0x1e3,0x1371,0x1388,0x1372,0x6016e, + 0x30,0x1397,0x10b,0x2cba,0x161,0x6016e,0x30,0x1399,0x10b,0x2cba,0x111,0x6016e, + 0x30,0x139b,0x10b,0x2cba,0x10a,0x300f7,0x13d6,0x0,0x300fb,0x161,0x13a7,0x200f8, + 0x13a7,0x50051,0x13,0x13a9,0x2cba,0x3,0x50051,0x13,0x13ab,0x1397,0x3,0x50051, + 0x13,0x13ad,0x1399,0x3,0x50051,0x13,0x13af,0x139b,0x3,0x50081,0x13,0x13b5, + 0x13a9,0x13ab,0x50081,0x13,0x13b8,0x13b5,0x13ad,0x50081,0x13,0x13bb,0x13b8,0x13af, + 0x500b4,0x77,0x13bd,0x13bb,0x105,0x300f7,0x13bf,0x0,0x400fa,0x13bd,0x13be,0x13bf, + 0x200f8,0x13be,0x200f9,0x13d6,0x200f8,0x13bf,0x5008e,0x30,0x13c3,0x2cba,0x13a9,0x5008e, + 0x30,0x13c7,0x1397,0x13ab,0x50081,0x30,0x13c8,0x13c3,0x13c7,0x5008e,0x30,0x13cc, + 0x1399,0x13ad,0x50081,0x30,0x13cd,0x13c8,0x13cc,0x5008e,0x30,0x13d1,0x139b,0x13af, + 0x50081,0x30,0x13d2,0x13cd,0x13d1,0x70050,0x30,0x13d4,0x13bb,0x13bb,0x13bb,0x13bb, + 0x50088,0x30,0x13d5,0x13d2,0x13d4,0x200f9,0x13d6,0x200f8,0x13d6,0x700f5,0x30,0x2e6a, + 0x1e3,0x13be,0x13d5,0x13bf,0x50089,0x6,0x8ef,0x712,0x18a,0x500aa,0x77,0x8f0, + 0x8ef,0x161,0x300f7,0x956,0x0,0x400fa,0x8f0,0x8f1,0x956,0x200f8,0x8f1,0x50084, + 0x19,0x8f4,0x766,0x40da,0x4007c,0x1f,0x8f5,0x8f4,0x50086,0x6,0x8f7,0x798, + 0x10a,0x4007c,0x1e,0x8f8,0x8f7,0x50086,0x6,0x8fa,0x79e,0x10a,0x4007c,0x1e, + 0x8fb,0x8fa,0x50050,0x1f,0x8fc,0x8f8,0x8fb,0x50080,0x1f,0x8fd,0x8f5,0x8fc, + 0x4003d,0x167,0x13eb,0x172,0x40063,0x13eb,0x8fd,0x2de0,0x50051,0x13,0x1440,0x2de0, + 0x0,0x60041,0x29c,0x1441,0x299,0x8f7,0x8fa,0x3003e,0x1441,0x1440,0x50051,0x13, + 0x1445,0x2de0,0x1,0x60041,0x29c,0x1446,0x29f,0x8f7,0x8fa,0x3003e,0x1446,0x1445, + 0x50051,0x13,0x144a,0x2de0,0x2,0x60041,0x29c,0x144b,0x2a4,0x8f7,0x8fa,0x3003e, + 0x144b,0x144a,0x50051,0x13,0x144f,0x2de0,0x3,0x60041,0x29c,0x1450,0x2a9,0x8f7, + 0x8fa,0x3003e,0x1450,0x144f,0x50080,0x6,0x90f,0x8f7,0x1b2,0x4007c,0x1e,0x910, + 0x90f,0x50050,0x1f,0x914,0x910,0x8fb,0x50080,0x1f,0x915,0x8f5,0x914,0x4003d, + 0x167,0x1464,0x172,0x40063,0x1464,0x915,0x2e2b,0x50051,0x13,0x14b9,0x2e2b,0x0, + 0x60041,0x29c,0x14ba,0x299,0x90f,0x8fa,0x3003e,0x14ba,0x14b9,0x50051,0x13,0x14be, + 0x2e2b,0x1,0x60041,0x29c,0x14bf,0x29f,0x90f,0x8fa,0x3003e,0x14bf,0x14be,0x50051, + 0x13,0x14c3,0x2e2b,0x2,0x60041,0x29c,0x14c4,0x2a4,0x90f,0x8fa,0x3003e,0x14c4, + 0x14c3,0x50051,0x13,0x14c8,0x2e2b,0x3,0x60041,0x29c,0x14c9,0x2a9,0x90f,0x8fa, + 0x3003e,0x14c9,0x14c8,0x50080,0x6,0x92b,0x8fa,0x1b2,0x4007c,0x1e,0x92c,0x92b, + 0x50050,0x1f,0x92d,0x8f8,0x92c,0x50080,0x1f,0x92e,0x8f5,0x92d,0x4003d,0x167, + 0x14dd,0x172,0x40063,0x14dd,0x92e,0x2e59,0x50051,0x13,0x1532,0x2e59,0x0,0x60041, + 0x29c,0x1533,0x299,0x8f7,0x92b,0x3003e,0x1533,0x1532,0x50051,0x13,0x1537,0x2e59, + 0x1,0x60041,0x29c,0x1538,0x29f,0x8f7,0x92b,0x3003e,0x1538,0x1537,0x50051,0x13, + 0x153c,0x2e59,0x2,0x60041,0x29c,0x153d,0x2a4,0x8f7,0x92b,0x3003e,0x153d,0x153c, + 0x50051,0x13,0x1541,0x2e59,0x3,0x60041,0x29c,0x1542,0x2a9,0x8f7,0x92b,0x3003e, + 0x1542,0x1541,0x50050,0x1f,0x947,0x910,0x92c,0x50080,0x1f,0x948,0x8f5,0x947, + 0x4003d,0x167,0x1556,0x172,0x40063,0x1556,0x948,0x2e6a,0x50051,0x13,0x15ab,0x2e6a, + 0x0,0x60041,0x29c,0x15ac,0x299,0x90f,0x92b,0x3003e,0x15ac,0x15ab,0x50051,0x13, + 0x15b0,0x2e6a,0x1,0x60041,0x29c,0x15b1,0x29f,0x90f,0x92b,0x3003e,0x15b1,0x15b0, + 0x50051,0x13,0x15b5,0x2e6a,0x2,0x60041,0x29c,0x15b6,0x2a4,0x90f,0x92b,0x3003e, + 0x15b6,0x15b5,0x50051,0x13,0x15ba,0x2e6a,0x3,0x60041,0x29c,0x15bb,0x2a9,0x90f, + 0x92b,0x3003e,0x15bb,0x15ba,0x200f9,0x956,0x200f8,0x956,0x200f9,0x957,0x200f8,0x957, + 0x300f7,0x160d,0x0,0x300fb,0x161,0x15d4,0x200f8,0x15d4,0x500b2,0x77,0x15d7,0x755, + 0x10a,0x300f7,0x15d9,0x0,0x400fa,0x15d7,0x15d8,0x15d9,0x200f8,0x15d8,0x200f9,0x160d, + 0x200f8,0x15d9,0x300e1,0x10a,0x2f8,0x400e0,0x10a,0x10a,0x2f9,0x60041,0x29c,0x1641, + 0x299,0x798,0x79e,0x4003d,0x13,0x1642,0x1641,0x60041,0x29c,0x1645,0x29f,0x798, + 0x79e,0x4003d,0x13,0x1646,0x1645,0x60041,0x29c,0x1649,0x2a4,0x798,0x79e,0x4003d, + 0x13,0x164a,0x1649,0x60041,0x29c,0x164d,0x2a9,0x798,0x79e,0x4003d,0x13,0x164e, + 0x164d,0x70050,0x30,0x164f,0x1642,0x1646,0x164a,0x164e,0x6016e,0x30,0x165c,0x10b, + 0x164f,0x161,0x6016e,0x30,0x165e,0x10b,0x164f,0x111,0x6016e,0x30,0x1660,0x10b, + 0x164f,0x10a,0x300f7,0x169b,0x0,0x300fb,0x161,0x166c,0x200f8,0x166c,0x50051,0x13, + 0x1670,0x165c,0x3,0x50051,0x13,0x1672,0x165e,0x3,0x50051,0x13,0x1674,0x1660, + 0x3,0x50081,0x13,0x167a,0x164e,0x1670,0x50081,0x13,0x167d,0x167a,0x1672,0x50081, + 0x13,0x1680,0x167d,0x1674,0x500b4,0x77,0x1682,0x1680,0x105,0x300f7,0x1684,0x0, + 0x400fa,0x1682,0x1683,0x1684,0x200f8,0x1683,0x200f9,0x169b,0x200f8,0x1684,0x5008e,0x30, + 0x1688,0x164f,0x164e,0x5008e,0x30,0x168c,0x165c,0x1670,0x50081,0x30,0x168d,0x1688, + 0x168c,0x5008e,0x30,0x1691,0x165e,0x1672,0x50081,0x30,0x1692,0x168d,0x1691,0x5008e, + 0x30,0x1696,0x1660,0x1674,0x50081,0x30,0x1697,0x1692,0x1696,0x70050,0x30,0x1699, + 0x1680,0x1680,0x1680,0x1680,0x50088,0x30,0x169a,0x1697,0x1699,0x200f9,0x169b,0x200f8, + 0x169b,0x700f5,0x30,0x3558,0x1e3,0x1683,0x169a,0x1684,0x50089,0x6,0x1621,0x712, + 0x18a,0x500aa,0x77,0x1622,0x1621,0x161,0x300f7,0x163c,0x0,0x400fa,0x1622,0x1623, + 0x163c,0x200f8,0x1623,0x50084,0x19,0x1626,0x766,0x40d8,0x4007c,0x1f,0x1627,0x1626, + 0x50086,0x6,0x1629,0x798,0x10a,0x4007c,0x1e,0x162a,0x1629,0x50086,0x6,0x162c, + 0x79e,0x10a,0x4007c,0x1e,0x162d,0x162c,0x50050,0x1f,0x162e,0x162a,0x162d,0x50080, + 0x1f,0x162f,0x1627,0x162e,0x4003d,0x167,0x16b7,0x17b,0x40063,0x16b7,0x162f,0x3558, + 0x50089,0x6,0x1637,0x162c,0x10a,0x50080,0x6,0x1638,0x798,0x1637,0x50051,0x13, + 0x1705,0x3558,0x0,0x60041,0x29c,0x1706,0x299,0x1638,0x79e,0x3003e,0x1706,0x1705, + 0x50051,0x13,0x170a,0x3558,0x1,0x60041,0x29c,0x170b,0x29f,0x1638,0x79e,0x3003e, + 0x170b,0x170a,0x50051,0x13,0x170f,0x3558,0x2,0x60041,0x29c,0x1710,0x2a4,0x1638, + 0x79e,0x3003e,0x1710,0x170f,0x50051,0x13,0x1714,0x3558,0x3,0x60041,0x29c,0x1715, + 0x2a9,0x1638,0x79e,0x3003e,0x1715,0x1714,0x200f9,0x163c,0x200f8,0x163c,0x500b2,0x77, + 0x15e5,0x755,0x10b,0x300f7,0x15e7,0x0,0x400fa,0x15e5,0x15e6,0x15e7,0x200f8,0x15e6, + 0x200f9,0x160d,0x200f8,0x15e7,0x300e1,0x10a,0x2f8,0x400e0,0x10a,0x10a,0x2f9,0x500b0, + 0x77,0x1724,0x712,0x396,0x300f7,0x174e,0x0,0x400fa,0x1724,0x1725,0x174e,0x200f8, + 0x1725,0x50089,0x6,0x1729,0x79e,0x10a,0x50080,0x6,0x172a,0x857,0x1729,0x60041, + 0x29c,0x1753,0x299,0x172a,0x85a,0x4003d,0x13,0x1754,0x1753,0x60041,0x29c,0x1757, + 0x29f,0x172a,0x85a,0x4003d,0x13,0x1758,0x1757,0x60041,0x29c,0x175b,0x2a4,0x172a, + 0x85a,0x4003d,0x13,0x175c,0x175b,0x60041,0x29c,0x175f,0x2a9,0x172a,0x85a,0x4003d, + 0x13,0x1760,0x175f,0x70050,0x30,0x1761,0x1754,0x1758,0x175c,0x1760,0x6016e,0x30, + 0x176e,0x10b,0x1761,0x161,0x6016e,0x30,0x1770,0x10b,0x1761,0x111,0x6016e,0x30, + 0x1772,0x10b,0x1761,0x10a,0x300f7,0x17ad,0x0,0x300fb,0x161,0x177e,0x200f8,0x177e, + 0x50051,0x13,0x1782,0x176e,0x3,0x50051,0x13,0x1784,0x1770,0x3,0x50051,0x13, + 0x1786,0x1772,0x3,0x50081,0x13,0x178c,0x1760,0x1782,0x50081,0x13,0x178f,0x178c, + 0x1784,0x50081,0x13,0x1792,0x178f,0x1786,0x500b4,0x77,0x1794,0x1792,0x105,0x300f7, + 0x1796,0x0,0x400fa,0x1794,0x1795,0x1796,0x200f8,0x1795,0x200f9,0x17ad,0x200f8,0x1796, + 0x5008e,0x30,0x179a,0x1761,0x1760,0x5008e,0x30,0x179e,0x176e,0x1782,0x50081,0x30, + 0x179f,0x179a,0x179e,0x5008e,0x30,0x17a3,0x1770,0x1784,0x50081,0x30,0x17a4,0x179f, + 0x17a3,0x5008e,0x30,0x17a8,0x1772,0x1786,0x50081,0x30,0x17a9,0x17a4,0x17a8,0x70050, + 0x30,0x17ab,0x1792,0x1792,0x1792,0x1792,0x50088,0x30,0x17ac,0x17a9,0x17ab,0x200f9, + 0x17ad,0x200f8,0x17ad,0x700f5,0x30,0x3613,0x1e3,0x1795,0x17ac,0x1796,0x300f7,0x174d, + 0x0,0x400fa,0x1622,0x1733,0x174d,0x200f8,0x1733,0x50084,0x19,0x1736,0x766,0x40d9, + 0x4007c,0x1f,0x1737,0x1736,0x50086,0x6,0x1739,0x798,0x10a,0x4007c,0x1e,0x173a, + 0x1739,0x50086,0x6,0x173c,0x79e,0x10a,0x4007c,0x1e,0x173d,0x173c,0x50050,0x1f, + 0x173e,0x173a,0x173d,0x50080,0x1f,0x173f,0x1737,0x173e,0x4003d,0x167,0x17d0,0x184, + 0x40063,0x17d0,0x173f,0x3613,0x50080,0x6,0x1748,0x857,0x173c,0x50051,0x13,0x1817, + 0x3613,0x0,0x60041,0x29c,0x1818,0x299,0x1748,0x85a,0x3003e,0x1818,0x1817,0x50051, + 0x13,0x181c,0x3613,0x1,0x60041,0x29c,0x181d,0x29f,0x1748,0x85a,0x3003e,0x181d, + 0x181c,0x50051,0x13,0x1821,0x3613,0x2,0x60041,0x29c,0x1822,0x2a4,0x1748,0x85a, + 0x3003e,0x1822,0x1821,0x50051,0x13,0x1826,0x3613,0x3,0x60041,0x29c,0x1827,0x2a9, + 0x1748,0x85a,0x3003e,0x1827,0x1826,0x200f9,0x174d,0x200f8,0x174d,0x200f9,0x174e,0x200f8, + 0x174e,0x500b2,0x77,0x15f4,0x755,0x18a,0x300f7,0x15f6,0x0,0x400fa,0x15f4,0x15f5, + 0x15f6,0x200f8,0x15f5,0x200f9,0x160d,0x200f8,0x15f6,0x300e1,0x10a,0x2f8,0x400e0,0x10a, + 0x10a,0x2f9,0x500b0,0x77,0x1836,0x712,0x295,0x300f7,0x185c,0x0,0x400fa,0x1836, + 0x1837,0x185c,0x200f8,0x1837,0x50084,0x6,0x1839,0x798,0x18a,0x50080,0x6,0x183b, + 0x1839,0x79e,0x50084,0x6,0x183d,0x79e,0x18a,0x60041,0x29c,0x1861,0x299,0x183b, + 0x183d,0x4003d,0x13,0x1862,0x1861,0x60041,0x29c,0x1865,0x29f,0x183b,0x183d,0x4003d, + 0x13,0x1866,0x1865,0x60041,0x29c,0x1869,0x2a4,0x183b,0x183d,0x4003d,0x13,0x186a, + 0x1869,0x60041,0x29c,0x186d,0x2a9,0x183b,0x183d,0x4003d,0x13,0x186e,0x186d,0x70050, + 0x30,0x186f,0x1862,0x1866,0x186a,0x186e,0x6016e,0x30,0x187c,0x10b,0x186f,0x161, + 0x6016e,0x30,0x187e,0x10b,0x186f,0x111,0x6016e,0x30,0x1880,0x10b,0x186f,0x10a, + 0x300f7,0x18bb,0x0,0x300fb,0x161,0x188c,0x200f8,0x188c,0x50051,0x13,0x1890,0x187c, + 0x3,0x50051,0x13,0x1892,0x187e,0x3,0x50051,0x13,0x1894,0x1880,0x3,0x50081, + 0x13,0x189a,0x186e,0x1890,0x50081,0x13,0x189d,0x189a,0x1892,0x50081,0x13,0x18a0, + 0x189d,0x1894,0x500b4,0x77,0x18a2,0x18a0,0x105,0x300f7,0x18a4,0x0,0x400fa,0x18a2, + 0x18a3,0x18a4,0x200f8,0x18a3,0x200f9,0x18bb,0x200f8,0x18a4,0x5008e,0x30,0x18a8,0x186f, + 0x186e,0x5008e,0x30,0x18ac,0x187c,0x1890,0x50081,0x30,0x18ad,0x18a8,0x18ac,0x5008e, + 0x30,0x18b1,0x187e,0x1892,0x50081,0x30,0x18b2,0x18ad,0x18b1,0x5008e,0x30,0x18b6, + 0x1880,0x1894,0x50081,0x30,0x18b7,0x18b2,0x18b6,0x70050,0x30,0x18b9,0x18a0,0x18a0, + 0x18a0,0x18a0,0x50088,0x30,0x18ba,0x18b7,0x18b9,0x200f9,0x18bb,0x200f8,0x18bb,0x700f5, + 0x30,0x36d5,0x1e3,0x18a3,0x18ba,0x18a4,0x300f7,0x185b,0x0,0x400fa,0x1622,0x1844, + 0x185b,0x200f8,0x1844,0x50084,0x19,0x1847,0x766,0x40db,0x4007c,0x1f,0x1848,0x1847, + 0x50086,0x6,0x184a,0x798,0x10a,0x4007c,0x1e,0x184b,0x184a,0x50086,0x6,0x184d, + 0x79e,0x10a,0x4007c,0x1e,0x184e,0x184d,0x50050,0x1f,0x184f,0x184b,0x184e,0x50080, + 0x1f,0x1850,0x1848,0x184f,0x4003d,0x167,0x18e5,0x18e,0x40063,0x18e5,0x1850,0x36d5, + 0x50080,0x6,0x1858,0x184a,0x79e,0x50051,0x13,0x1925,0x36d5,0x0,0x60041,0x29c, + 0x1926,0x299,0x1858,0x161,0x3003e,0x1926,0x1925,0x50051,0x13,0x192a,0x36d5,0x1, + 0x60041,0x29c,0x192b,0x29f,0x1858,0x161,0x3003e,0x192b,0x192a,0x50051,0x13,0x192f, + 0x36d5,0x2,0x60041,0x29c,0x1930,0x2a4,0x1858,0x161,0x3003e,0x1930,0x192f,0x50051, + 0x13,0x1934,0x36d5,0x3,0x60041,0x29c,0x1935,0x2a9,0x1858,0x161,0x3003e,0x1935, + 0x1934,0x200f9,0x185b,0x200f8,0x185b,0x200f9,0x185c,0x200f8,0x185c,0x500b2,0x77,0x1603, + 0x755,0x194,0x300f7,0x1605,0x0,0x400fa,0x1603,0x1604,0x1605,0x200f8,0x1604,0x200f9, + 0x160d,0x200f8,0x1605,0x300e1,0x10a,0x2f8,0x400e0,0x10a,0x10a,0x2f9,0x500b0,0x77, + 0x1941,0x712,0x18a,0x300f7,0x1952,0x0,0x400fa,0x1941,0x1942,0x1952,0x200f8,0x1942, + 0x60041,0x29c,0x1957,0x299,0x712,0x161,0x4003d,0x13,0x1958,0x1957,0x60041,0x29c, + 0x195b,0x29f,0x712,0x161,0x4003d,0x13,0x195c,0x195b,0x60041,0x29c,0x195f,0x2a4, + 0x712,0x161,0x4003d,0x13,0x1960,0x195f,0x60041,0x29c,0x1963,0x2a9,0x712,0x161, + 0x4003d,0x13,0x1964,0x1963,0x70050,0x30,0x1965,0x1958,0x195c,0x1960,0x1964,0x6016e, + 0x30,0x1972,0x10b,0x1965,0x161,0x6016e,0x30,0x1974,0x10b,0x1965,0x111,0x6016e, + 0x30,0x1976,0x10b,0x1965,0x10a,0x300f7,0x19b1,0x0,0x300fb,0x161,0x1982,0x200f8, + 0x1982,0x50051,0x13,0x1986,0x1972,0x3,0x50051,0x13,0x1988,0x1974,0x3,0x50051, + 0x13,0x198a,0x1976,0x3,0x50081,0x13,0x1990,0x1964,0x1986,0x50081,0x13,0x1993, + 0x1990,0x1988,0x50081,0x13,0x1996,0x1993,0x198a,0x500b4,0x77,0x1998,0x1996,0x105, + 0x300f7,0x199a,0x0,0x400fa,0x1998,0x1999,0x199a,0x200f8,0x1999,0x200f9,0x19b1,0x200f8, + 0x199a,0x5008e,0x30,0x199e,0x1965,0x1964,0x5008e,0x30,0x19a2,0x1972,0x1986,0x50081, + 0x30,0x19a3,0x199e,0x19a2,0x5008e,0x30,0x19a7,0x1974,0x1988,0x50081,0x30,0x19a8, + 0x19a3,0x19a7,0x5008e,0x30,0x19ac,0x1976,0x198a,0x50081,0x30,0x19ad,0x19a8,0x19ac, + 0x70050,0x30,0x19af,0x1996,0x1996,0x1996,0x1996,0x50088,0x30,0x19b0,0x19ad,0x19af, + 0x200f9,0x19b1,0x200f8,0x19b1,0x700f5,0x30,0x3777,0x1e3,0x1999,0x19b0,0x199a,0x300f7, + 0x1951,0x0,0x400fa,0x1622,0x194a,0x1951,0x200f8,0x194a,0x4007c,0x1f,0x194c,0x766, + 0x4003d,0x167,0x19e2,0x198,0x40063,0x19e2,0x194c,0x3777,0x200f9,0x1951,0x200f8,0x1951, + 0x200f9,0x1952,0x200f8,0x1952,0x200f9,0x160d,0x200f8,0x160d,0x500b2,0x77,0x7ae,0x755, + 0x19e,0x300f7,0x7b0,0x0,0x400fa,0x7ae,0x7af,0x7b0,0x200f8,0x7af,0x200f9,0x7c4, + 0x200f8,0x7b0,0x500aa,0x77,0x1a1b,0x712,0x161,0x300f7,0x1a1f,0x0,0x400fa,0x1a1b, + 0x1a1c,0x1a1f,0x200f8,0x1a1c,0x60041,0x15d,0x1a2c,0x15a,0xfe,0xfe,0x700ea,0x6, + 0x1a2d,0x1a2c,0x111,0x161,0x111,0x3003e,0x28a,0x1a2d,0x200f9,0x1a1f,0x200f8,0x1a1f, + 0x300e1,0x10a,0x2f8,0x400e0,0x10a,0x10a,0x2f9,0x4003d,0x6,0x1a31,0x28a,0x50082, + 0x6,0x1a23,0x759,0x111,0x500ab,0x77,0x1a24,0x1a31,0x1a23,0x300f7,0x7b6,0x0, + 0x400fa,0x1a24,0x7b5,0x7b6,0x200f8,0x7b5,0x200f9,0x7c4,0x200f8,0x7b6,0x60041,0x15d, + 0x1a39,0x15a,0xfe,0xfe,0x3003e,0x1a39,0x161,0x300f7,0x1ae4,0x0,0x300fb,0x161, + 0x1a66,0x200f8,0x1a66,0x50084,0x6,0x1a68,0x798,0x18a,0x4007c,0x1e,0x1a6a,0x1a68, + 0x50084,0x6,0x1a6c,0x79e,0x18a,0x4007c,0x1e,0x1a6e,0x1a6c,0x50050,0x1f,0x1a6f, + 0x1a6a,0x1a6e,0x4007c,0x19,0x1a7a,0x1a6f,0x50080,0x19,0x1aef,0x1a7a,0x34b,0x50080, + 0x19,0x1af1,0x1a7a,0x34e,0x50080,0x19,0x1af3,0x1a7a,0x351,0x4003d,0x167,0x1b4e, + 0x198,0x50062,0x30,0x1b50,0x1b4e,0x1a6f,0x4007c,0x1f,0x1b0d,0x1aef,0x4003d,0x167, + 0x1bb6,0x198,0x50062,0x30,0x1bb8,0x1bb6,0x1b0d,0x4007c,0x1f,0x1b11,0x1af1,0x4003d, + 0x167,0x1c1e,0x198,0x50062,0x30,0x1c20,0x1c1e,0x1b11,0x4007c,0x1f,0x1b15,0x1af3, + 0x4003d,0x167,0x1c86,0x198,0x50062,0x30,0x1c88,0x1c86,0x1b15,0x300f7,0x1cf2,0x0, + 0x300fb,0x161,0x1cc3,0x200f8,0x1cc3,0x50051,0x13,0x1cc5,0x1b50,0x3,0x50051,0x13, + 0x1cc7,0x1bb8,0x3,0x50051,0x13,0x1cc9,0x1c20,0x3,0x50051,0x13,0x1ccb,0x1c88, + 0x3,0x50081,0x13,0x1cd1,0x1cc5,0x1cc7,0x50081,0x13,0x1cd4,0x1cd1,0x1cc9,0x50081, + 0x13,0x1cd7,0x1cd4,0x1ccb,0x500b4,0x77,0x1cd9,0x1cd7,0x105,0x300f7,0x1cdb,0x0, + 0x400fa,0x1cd9,0x1cda,0x1cdb,0x200f8,0x1cda,0x200f9,0x1cf2,0x200f8,0x1cdb,0x5008e,0x30, + 0x1cdf,0x1b50,0x1cc5,0x5008e,0x30,0x1ce3,0x1bb8,0x1cc7,0x50081,0x30,0x1ce4,0x1cdf, + 0x1ce3,0x5008e,0x30,0x1ce8,0x1c20,0x1cc9,0x50081,0x30,0x1ce9,0x1ce4,0x1ce8,0x5008e, + 0x30,0x1ced,0x1c88,0x1ccb,0x50081,0x30,0x1cee,0x1ce9,0x1ced,0x70050,0x30,0x1cf0, + 0x1cd7,0x1cd7,0x1cd7,0x1cd7,0x50088,0x30,0x1cf1,0x1cee,0x1cf0,0x200f9,0x1cf2,0x200f8, + 0x1cf2,0x700f5,0x30,0x39ea,0x1e3,0x1cda,0x1cf1,0x1cdb,0x4003d,0x167,0x1d2a,0x1a2, + 0x40063,0x1d2a,0x85c,0x39ea,0x50080,0x6,0x1a83,0x1a68,0x10a,0x4007c,0x1e,0x1a84, + 0x1a83,0x50050,0x1f,0x1a89,0x1a84,0x1a6e,0x50080,0x6,0x1a8c,0x857,0x111,0x4007c, + 0x1e,0x1a8d,0x1a8c,0x50050,0x1f,0x1a92,0x1a8d,0x85b,0x4007c,0x19,0x1a94,0x1a89, + 0x50080,0x19,0x1d62,0x1a94,0x34b,0x50080,0x19,0x1d64,0x1a94,0x34e,0x50080,0x19, + 0x1d66,0x1a94,0x351,0x4003d,0x167,0x1dc1,0x198,0x50062,0x30,0x1dc3,0x1dc1,0x1a89, + 0x4007c,0x1f,0x1d80,0x1d62,0x4003d,0x167,0x1e29,0x198,0x50062,0x30,0x1e2b,0x1e29, + 0x1d80,0x4007c,0x1f,0x1d84,0x1d64,0x4003d,0x167,0x1e91,0x198,0x50062,0x30,0x1e93, + 0x1e91,0x1d84,0x4007c,0x1f,0x1d88,0x1d66,0x4003d,0x167,0x1ef9,0x198,0x50062,0x30, + 0x1efb,0x1ef9,0x1d88,0x300f7,0x1f65,0x0,0x300fb,0x161,0x1f36,0x200f8,0x1f36,0x50051, + 0x13,0x1f38,0x1dc3,0x3,0x50051,0x13,0x1f3a,0x1e2b,0x3,0x50051,0x13,0x1f3c, + 0x1e93,0x3,0x50051,0x13,0x1f3e,0x1efb,0x3,0x50081,0x13,0x1f44,0x1f38,0x1f3a, + 0x50081,0x13,0x1f47,0x1f44,0x1f3c,0x50081,0x13,0x1f4a,0x1f47,0x1f3e,0x500b4,0x77, + 0x1f4c,0x1f4a,0x105,0x300f7,0x1f4e,0x0,0x400fa,0x1f4c,0x1f4d,0x1f4e,0x200f8,0x1f4d, + 0x200f9,0x1f65,0x200f8,0x1f4e,0x5008e,0x30,0x1f52,0x1dc3,0x1f38,0x5008e,0x30,0x1f56, + 0x1e2b,0x1f3a,0x50081,0x30,0x1f57,0x1f52,0x1f56,0x5008e,0x30,0x1f5b,0x1e93,0x1f3c, + 0x50081,0x30,0x1f5c,0x1f57,0x1f5b,0x5008e,0x30,0x1f60,0x1efb,0x1f3e,0x50081,0x30, + 0x1f61,0x1f5c,0x1f60,0x70050,0x30,0x1f63,0x1f4a,0x1f4a,0x1f4a,0x1f4a,0x50088,0x30, + 0x1f64,0x1f61,0x1f63,0x200f9,0x1f65,0x200f8,0x1f65,0x700f5,0x30,0x3a5d,0x1e3,0x1f4d, + 0x1f64,0x1f4e,0x4003d,0x167,0x1f9d,0x1a2,0x40063,0x1f9d,0x1a92,0x3a5d,0x50080,0x6, + 0x1aa1,0x1a6c,0x10a,0x4007c,0x1e,0x1aa2,0x1aa1,0x50050,0x1f,0x1aa3,0x1a6a,0x1aa2, + 0x50080,0x6,0x1aaa,0x85a,0x111,0x4007c,0x1e,0x1aab,0x1aaa,0x50050,0x1f,0x1aac, + 0x858,0x1aab,0x4007c,0x19,0x1aae,0x1aa3,0x50080,0x19,0x1fd5,0x1aae,0x34b,0x50080, + 0x19,0x1fd7,0x1aae,0x34e,0x50080,0x19,0x1fd9,0x1aae,0x351,0x4003d,0x167,0x2034, + 0x198,0x50062,0x30,0x2036,0x2034,0x1aa3,0x4007c,0x1f,0x1ff3,0x1fd5,0x4003d,0x167, + 0x209c,0x198,0x50062,0x30,0x209e,0x209c,0x1ff3,0x4007c,0x1f,0x1ff7,0x1fd7,0x4003d, + 0x167,0x2104,0x198,0x50062,0x30,0x2106,0x2104,0x1ff7,0x4007c,0x1f,0x1ffb,0x1fd9, + 0x4003d,0x167,0x216c,0x198,0x50062,0x30,0x216e,0x216c,0x1ffb,0x300f7,0x21d8,0x0, + 0x300fb,0x161,0x21a9,0x200f8,0x21a9,0x50051,0x13,0x21ab,0x2036,0x3,0x50051,0x13, + 0x21ad,0x209e,0x3,0x50051,0x13,0x21af,0x2106,0x3,0x50051,0x13,0x21b1,0x216e, + 0x3,0x50081,0x13,0x21b7,0x21ab,0x21ad,0x50081,0x13,0x21ba,0x21b7,0x21af,0x50081, + 0x13,0x21bd,0x21ba,0x21b1,0x500b4,0x77,0x21bf,0x21bd,0x105,0x300f7,0x21c1,0x0, + 0x400fa,0x21bf,0x21c0,0x21c1,0x200f8,0x21c0,0x200f9,0x21d8,0x200f8,0x21c1,0x5008e,0x30, + 0x21c5,0x2036,0x21ab,0x5008e,0x30,0x21c9,0x209e,0x21ad,0x50081,0x30,0x21ca,0x21c5, + 0x21c9,0x5008e,0x30,0x21ce,0x2106,0x21af,0x50081,0x30,0x21cf,0x21ca,0x21ce,0x5008e, + 0x30,0x21d3,0x216e,0x21b1,0x50081,0x30,0x21d4,0x21cf,0x21d3,0x70050,0x30,0x21d6, + 0x21bd,0x21bd,0x21bd,0x21bd,0x50088,0x30,0x21d7,0x21d4,0x21d6,0x200f9,0x21d8,0x200f8, + 0x21d8,0x700f5,0x30,0x3ad0,0x1e3,0x21c0,0x21d7,0x21c1,0x4003d,0x167,0x2210,0x1a2, + 0x40063,0x2210,0x1aac,0x3ad0,0x50050,0x1f,0x1abd,0x1a84,0x1aa2,0x50050,0x1f,0x1ac6, + 0x1a8d,0x1aab,0x4007c,0x19,0x1ac8,0x1abd,0x50080,0x19,0x2248,0x1ac8,0x34b,0x50080, + 0x19,0x224a,0x1ac8,0x34e,0x50080,0x19,0x224c,0x1ac8,0x351,0x4003d,0x167,0x22a7, + 0x198,0x50062,0x30,0x22a9,0x22a7,0x1abd,0x4007c,0x1f,0x2266,0x2248,0x4003d,0x167, + 0x230f,0x198,0x50062,0x30,0x2311,0x230f,0x2266,0x4007c,0x1f,0x226a,0x224a,0x4003d, + 0x167,0x2377,0x198,0x50062,0x30,0x2379,0x2377,0x226a,0x4007c,0x1f,0x226e,0x224c, + 0x4003d,0x167,0x23df,0x198,0x50062,0x30,0x23e1,0x23df,0x226e,0x300f7,0x244b,0x0, + 0x300fb,0x161,0x241c,0x200f8,0x241c,0x50051,0x13,0x241e,0x22a9,0x3,0x50051,0x13, + 0x2420,0x2311,0x3,0x50051,0x13,0x2422,0x2379,0x3,0x50051,0x13,0x2424,0x23e1, + 0x3,0x50081,0x13,0x242a,0x241e,0x2420,0x50081,0x13,0x242d,0x242a,0x2422,0x50081, + 0x13,0x2430,0x242d,0x2424,0x500b4,0x77,0x2432,0x2430,0x105,0x300f7,0x2434,0x0, + 0x400fa,0x2432,0x2433,0x2434,0x200f8,0x2433,0x200f9,0x244b,0x200f8,0x2434,0x5008e,0x30, + 0x2438,0x22a9,0x241e,0x5008e,0x30,0x243c,0x2311,0x2420,0x50081,0x30,0x243d,0x2438, + 0x243c,0x5008e,0x30,0x2441,0x2379,0x2422,0x50081,0x30,0x2442,0x243d,0x2441,0x5008e, + 0x30,0x2446,0x23e1,0x2424,0x50081,0x30,0x2447,0x2442,0x2446,0x70050,0x30,0x2449, + 0x2430,0x2430,0x2430,0x2430,0x50088,0x30,0x244a,0x2447,0x2449,0x200f9,0x244b,0x200f8, + 0x244b,0x700f5,0x30,0x3b43,0x1e3,0x2433,0x244a,0x2434,0x4003d,0x167,0x2483,0x1a2, + 0x40063,0x2483,0x1ac6,0x3b43,0x500b2,0x77,0x1ad0,0x755,0x1a8,0x300f7,0x1ad2,0x0, + 0x400fa,0x1ad0,0x1ad1,0x1ad2,0x200f8,0x1ad1,0x200f9,0x1ae4,0x200f8,0x1ad2,0x300f7,0x24e6, + 0x0,0x300fb,0x161,0x24b7,0x200f8,0x24b7,0x50051,0x13,0x24b9,0x39ea,0x3,0x50051, + 0x13,0x24bb,0x3a5d,0x3,0x50051,0x13,0x24bd,0x3ad0,0x3,0x50051,0x13,0x24bf, + 0x3b43,0x3,0x50081,0x13,0x24c5,0x24b9,0x24bb,0x50081,0x13,0x24c8,0x24c5,0x24bd, + 0x50081,0x13,0x24cb,0x24c8,0x24bf,0x500b4,0x77,0x24cd,0x24cb,0x105,0x300f7,0x24cf, + 0x0,0x400fa,0x24cd,0x24ce,0x24cf,0x200f8,0x24ce,0x200f9,0x24e6,0x200f8,0x24cf,0x5008e, + 0x30,0x24d3,0x39ea,0x24b9,0x5008e,0x30,0x24d7,0x3a5d,0x24bb,0x50081,0x30,0x24d8, + 0x24d3,0x24d7,0x5008e,0x30,0x24dc,0x3ad0,0x24bd,0x50081,0x30,0x24dd,0x24d8,0x24dc, + 0x5008e,0x30,0x24e1,0x3b43,0x24bf,0x50081,0x30,0x24e2,0x24dd,0x24e1,0x70050,0x30, + 0x24e4,0x24cb,0x24cb,0x24cb,0x24cb,0x50088,0x30,0x24e5,0x24e2,0x24e4,0x200f9,0x24e6, + 0x200f8,0x24e6,0x700f5,0x30,0x3c5a,0x1e3,0x24ce,0x24e5,0x24cf,0x4003d,0x167,0x2525, + 0x1ac,0x40063,0x2525,0x866,0x3c5a,0x50051,0x13,0x2550,0x3c5a,0x0,0x60041,0x29c, + 0x2551,0x299,0x798,0x79e,0x3003e,0x2551,0x2550,0x50051,0x13,0x2555,0x3c5a,0x1, + 0x60041,0x29c,0x2556,0x29f,0x798,0x79e,0x3003e,0x2556,0x2555,0x50051,0x13,0x255a, + 0x3c5a,0x2,0x60041,0x29c,0x255b,0x2a4,0x798,0x79e,0x3003e,0x255b,0x255a,0x50051, + 0x13,0x255f,0x3c5a,0x3,0x60041,0x29c,0x2560,0x2a9,0x798,0x79e,0x3003e,0x2560, + 0x255f,0x200f9,0x1ae4,0x200f8,0x1ae4,0x300f7,0x25b2,0x0,0x300fb,0x161,0x2579,0x200f8, + 0x2579,0x500b2,0x77,0x257c,0x755,0x1b2,0x300f7,0x257e,0x0,0x400fa,0x257c,0x257d, + 0x257e,0x200f8,0x257d,0x200f9,0x25b2,0x200f8,0x257e,0x300e1,0x10a,0x2f8,0x400e0,0x10a, + 0x10a,0x2f9,0x60041,0x29c,0x25e6,0x299,0x798,0x79e,0x4003d,0x13,0x25e7,0x25e6, + 0x60041,0x29c,0x25ea,0x29f,0x798,0x79e,0x4003d,0x13,0x25eb,0x25ea,0x60041,0x29c, + 0x25ee,0x2a4,0x798,0x79e,0x4003d,0x13,0x25ef,0x25ee,0x60041,0x29c,0x25f2,0x2a9, + 0x798,0x79e,0x4003d,0x13,0x25f3,0x25f2,0x70050,0x30,0x25f4,0x25e7,0x25eb,0x25ef, + 0x25f3,0x6016e,0x30,0x2601,0x10b,0x25f4,0x161,0x6016e,0x30,0x2603,0x10b,0x25f4, + 0x111,0x6016e,0x30,0x2605,0x10b,0x25f4,0x10a,0x300f7,0x2640,0x0,0x300fb,0x161, + 0x2611,0x200f8,0x2611,0x50051,0x13,0x2615,0x2601,0x3,0x50051,0x13,0x2617,0x2603, + 0x3,0x50051,0x13,0x2619,0x2605,0x3,0x50081,0x13,0x261f,0x25f3,0x2615,0x50081, + 0x13,0x2622,0x261f,0x2617,0x50081,0x13,0x2625,0x2622,0x2619,0x500b4,0x77,0x2627, + 0x2625,0x105,0x300f7,0x2629,0x0,0x400fa,0x2627,0x2628,0x2629,0x200f8,0x2628,0x200f9, + 0x2640,0x200f8,0x2629,0x5008e,0x30,0x262d,0x25f4,0x25f3,0x5008e,0x30,0x2631,0x2601, + 0x2615,0x50081,0x30,0x2632,0x262d,0x2631,0x5008e,0x30,0x2636,0x2603,0x2617,0x50081, + 0x30,0x2637,0x2632,0x2636,0x5008e,0x30,0x263b,0x2605,0x2619,0x50081,0x30,0x263c, + 0x2637,0x263b,0x70050,0x30,0x263e,0x2625,0x2625,0x2625,0x2625,0x50088,0x30,0x263f, + 0x263c,0x263e,0x200f9,0x2640,0x200f8,0x2640,0x700f5,0x30,0x3e8e,0x1e3,0x2628,0x263f, + 0x2629,0x50089,0x6,0x25c6,0x712,0x18a,0x500aa,0x77,0x25c7,0x25c6,0x161,0x300f7, + 0x25e1,0x0,0x400fa,0x25c7,0x25c8,0x25e1,0x200f8,0x25c8,0x50086,0x6,0x25ce,0x798, + 0x10a,0x4007c,0x1e,0x25cf,0x25ce,0x50086,0x6,0x25d1,0x79e,0x10a,0x4007c,0x1e, + 0x25d2,0x25d1,0x50050,0x1f,0x25d3,0x25cf,0x25d2,0x4003d,0x167,0x2686,0x1b6,0x40063, + 0x2686,0x25d3,0x3e8e,0x50089,0x6,0x25dc,0x25d1,0x10a,0x50080,0x6,0x25dd,0x798, + 0x25dc,0x50051,0x13,0x26aa,0x3e8e,0x0,0x60041,0x29c,0x26ab,0x299,0x25dd,0x79e, + 0x3003e,0x26ab,0x26aa,0x50051,0x13,0x26af,0x3e8e,0x1,0x60041,0x29c,0x26b0,0x29f, + 0x25dd,0x79e,0x3003e,0x26b0,0x26af,0x50051,0x13,0x26b4,0x3e8e,0x2,0x60041,0x29c, + 0x26b5,0x2a4,0x25dd,0x79e,0x3003e,0x26b5,0x26b4,0x50051,0x13,0x26b9,0x3e8e,0x3, + 0x60041,0x29c,0x26ba,0x2a9,0x25dd,0x79e,0x3003e,0x26ba,0x26b9,0x200f9,0x25e1,0x200f8, + 0x25e1,0x500b2,0x77,0x258a,0x755,0x1bc,0x300f7,0x258c,0x0,0x400fa,0x258a,0x258b, + 0x258c,0x200f8,0x258b,0x200f9,0x25b2,0x200f8,0x258c,0x300e1,0x10a,0x2f8,0x400e0,0x10a, + 0x10a,0x2f9,0x500b0,0x77,0x26c9,0x712,0x396,0x300f7,0x26f3,0x0,0x400fa,0x26c9, + 0x26ca,0x26f3,0x200f8,0x26ca,0x50089,0x6,0x26ce,0x79e,0x10a,0x50080,0x6,0x26cf, + 0x857,0x26ce,0x60041,0x29c,0x26f8,0x299,0x26cf,0x85a,0x4003d,0x13,0x26f9,0x26f8, + 0x60041,0x29c,0x26fc,0x29f,0x26cf,0x85a,0x4003d,0x13,0x26fd,0x26fc,0x60041,0x29c, + 0x2700,0x2a4,0x26cf,0x85a,0x4003d,0x13,0x2701,0x2700,0x60041,0x29c,0x2704,0x2a9, + 0x26cf,0x85a,0x4003d,0x13,0x2705,0x2704,0x70050,0x30,0x2706,0x26f9,0x26fd,0x2701, + 0x2705,0x6016e,0x30,0x2713,0x10b,0x2706,0x161,0x6016e,0x30,0x2715,0x10b,0x2706, + 0x111,0x6016e,0x30,0x2717,0x10b,0x2706,0x10a,0x300f7,0x2752,0x0,0x300fb,0x161, + 0x2723,0x200f8,0x2723,0x50051,0x13,0x2727,0x2713,0x3,0x50051,0x13,0x2729,0x2715, + 0x3,0x50051,0x13,0x272b,0x2717,0x3,0x50081,0x13,0x2731,0x2705,0x2727,0x50081, + 0x13,0x2734,0x2731,0x2729,0x50081,0x13,0x2737,0x2734,0x272b,0x500b4,0x77,0x2739, + 0x2737,0x105,0x300f7,0x273b,0x0,0x400fa,0x2739,0x273a,0x273b,0x200f8,0x273a,0x200f9, + 0x2752,0x200f8,0x273b,0x5008e,0x30,0x273f,0x2706,0x2705,0x5008e,0x30,0x2743,0x2713, + 0x2727,0x50081,0x30,0x2744,0x273f,0x2743,0x5008e,0x30,0x2748,0x2715,0x2729,0x50081, + 0x30,0x2749,0x2744,0x2748,0x5008e,0x30,0x274d,0x2717,0x272b,0x50081,0x30,0x274e, + 0x2749,0x274d,0x70050,0x30,0x2750,0x2737,0x2737,0x2737,0x2737,0x50088,0x30,0x2751, + 0x274e,0x2750,0x200f9,0x2752,0x200f8,0x2752,0x700f5,0x30,0x3f49,0x1e3,0x273a,0x2751, + 0x273b,0x300f7,0x26f2,0x0,0x400fa,0x25c7,0x26d8,0x26f2,0x200f8,0x26d8,0x50086,0x6, + 0x26de,0x798,0x10a,0x4007c,0x1e,0x26df,0x26de,0x50086,0x6,0x26e1,0x79e,0x10a, + 0x4007c,0x1e,0x26e2,0x26e1,0x50050,0x1f,0x26e3,0x26df,0x26e2,0x4003d,0x167,0x279f, + 0x1c0,0x40063,0x279f,0x26e3,0x3f49,0x50080,0x6,0x26ed,0x857,0x26e1,0x50051,0x13, + 0x27bc,0x3f49,0x0,0x60041,0x29c,0x27bd,0x299,0x26ed,0x85a,0x3003e,0x27bd,0x27bc, + 0x50051,0x13,0x27c1,0x3f49,0x1,0x60041,0x29c,0x27c2,0x29f,0x26ed,0x85a,0x3003e, + 0x27c2,0x27c1,0x50051,0x13,0x27c6,0x3f49,0x2,0x60041,0x29c,0x27c7,0x2a4,0x26ed, + 0x85a,0x3003e,0x27c7,0x27c6,0x50051,0x13,0x27cb,0x3f49,0x3,0x60041,0x29c,0x27cc, + 0x2a9,0x26ed,0x85a,0x3003e,0x27cc,0x27cb,0x200f9,0x26f2,0x200f8,0x26f2,0x200f9,0x26f3, + 0x200f8,0x26f3,0x500b2,0x77,0x2599,0x755,0x1c6,0x300f7,0x259b,0x0,0x400fa,0x2599, + 0x259a,0x259b,0x200f8,0x259a,0x200f9,0x25b2,0x200f8,0x259b,0x300e1,0x10a,0x2f8,0x400e0, + 0x10a,0x10a,0x2f9,0x500b0,0x77,0x27db,0x712,0x295,0x300f7,0x2801,0x0,0x400fa, + 0x27db,0x27dc,0x2801,0x200f8,0x27dc,0x50080,0x6,0x27e0,0x1a68,0x79e,0x60041,0x29c, + 0x2806,0x299,0x27e0,0x1a6c,0x4003d,0x13,0x2807,0x2806,0x60041,0x29c,0x280a,0x29f, + 0x27e0,0x1a6c,0x4003d,0x13,0x280b,0x280a,0x60041,0x29c,0x280e,0x2a4,0x27e0,0x1a6c, + 0x4003d,0x13,0x280f,0x280e,0x60041,0x29c,0x2812,0x2a9,0x27e0,0x1a6c,0x4003d,0x13, + 0x2813,0x2812,0x70050,0x30,0x2814,0x2807,0x280b,0x280f,0x2813,0x6016e,0x30,0x2821, + 0x10b,0x2814,0x161,0x6016e,0x30,0x2823,0x10b,0x2814,0x111,0x6016e,0x30,0x2825, + 0x10b,0x2814,0x10a,0x300f7,0x2860,0x0,0x300fb,0x161,0x2831,0x200f8,0x2831,0x50051, + 0x13,0x2835,0x2821,0x3,0x50051,0x13,0x2837,0x2823,0x3,0x50051,0x13,0x2839, + 0x2825,0x3,0x50081,0x13,0x283f,0x2813,0x2835,0x50081,0x13,0x2842,0x283f,0x2837, + 0x50081,0x13,0x2845,0x2842,0x2839,0x500b4,0x77,0x2847,0x2845,0x105,0x300f7,0x2849, + 0x0,0x400fa,0x2847,0x2848,0x2849,0x200f8,0x2848,0x200f9,0x2860,0x200f8,0x2849,0x5008e, + 0x30,0x284d,0x2814,0x2813,0x5008e,0x30,0x2851,0x2821,0x2835,0x50081,0x30,0x2852, + 0x284d,0x2851,0x5008e,0x30,0x2856,0x2823,0x2837,0x50081,0x30,0x2857,0x2852,0x2856, + 0x5008e,0x30,0x285b,0x2825,0x2839,0x50081,0x30,0x285c,0x2857,0x285b,0x70050,0x30, + 0x285e,0x2845,0x2845,0x2845,0x2845,0x50088,0x30,0x285f,0x285c,0x285e,0x200f9,0x2860, + 0x200f8,0x2860,0x700f5,0x30,0x400b,0x1e3,0x2848,0x285f,0x2849,0x300f7,0x2800,0x0, + 0x400fa,0x25c7,0x27e9,0x2800,0x200f8,0x27e9,0x50086,0x6,0x27ef,0x798,0x10a,0x4007c, + 0x1e,0x27f0,0x27ef,0x50086,0x6,0x27f2,0x79e,0x10a,0x4007c,0x1e,0x27f3,0x27f2, + 0x50050,0x1f,0x27f4,0x27f0,0x27f3,0x4003d,0x167,0x28b4,0x1ca,0x40063,0x28b4,0x27f4, + 0x400b,0x50080,0x6,0x27fd,0x27ef,0x79e,0x50051,0x13,0x28ca,0x400b,0x0,0x60041, + 0x29c,0x28cb,0x299,0x27fd,0x161,0x3003e,0x28cb,0x28ca,0x50051,0x13,0x28cf,0x400b, + 0x1,0x60041,0x29c,0x28d0,0x29f,0x27fd,0x161,0x3003e,0x28d0,0x28cf,0x50051,0x13, + 0x28d4,0x400b,0x2,0x60041,0x29c,0x28d5,0x2a4,0x27fd,0x161,0x3003e,0x28d5,0x28d4, + 0x50051,0x13,0x28d9,0x400b,0x3,0x60041,0x29c,0x28da,0x2a9,0x27fd,0x161,0x3003e, + 0x28da,0x28d9,0x200f9,0x2800,0x200f8,0x2800,0x200f9,0x2801,0x200f8,0x2801,0x500b2,0x77, + 0x25a8,0x755,0x1d0,0x300f7,0x25aa,0x0,0x400fa,0x25a8,0x25a9,0x25aa,0x200f8,0x25a9, + 0x200f9,0x25b2,0x200f8,0x25aa,0x300e1,0x10a,0x2f8,0x400e0,0x10a,0x10a,0x2f9,0x500b0, + 0x77,0x28e6,0x712,0x18a,0x300f7,0x28f7,0x0,0x400fa,0x28e6,0x28e7,0x28f7,0x200f8, + 0x28e7,0x60041,0x29c,0x28fc,0x299,0x712,0x161,0x4003d,0x13,0x28fd,0x28fc,0x60041, + 0x29c,0x2900,0x29f,0x712,0x161,0x4003d,0x13,0x2901,0x2900,0x60041,0x29c,0x2904, + 0x2a4,0x712,0x161,0x4003d,0x13,0x2905,0x2904,0x60041,0x29c,0x2908,0x2a9,0x712, + 0x161,0x4003d,0x13,0x2909,0x2908,0x70050,0x30,0x290a,0x28fd,0x2901,0x2905,0x2909, + 0x6016e,0x30,0x2917,0x10b,0x290a,0x161,0x6016e,0x30,0x2919,0x10b,0x290a,0x111, + 0x6016e,0x30,0x291b,0x10b,0x290a,0x10a,0x300f7,0x2956,0x0,0x300fb,0x161,0x2927, + 0x200f8,0x2927,0x50051,0x13,0x292b,0x2917,0x3,0x50051,0x13,0x292d,0x2919,0x3, + 0x50051,0x13,0x292f,0x291b,0x3,0x50081,0x13,0x2935,0x2909,0x292b,0x50081,0x13, + 0x2938,0x2935,0x292d,0x50081,0x13,0x293b,0x2938,0x292f,0x500b4,0x77,0x293d,0x293b, + 0x105,0x300f7,0x293f,0x0,0x400fa,0x293d,0x293e,0x293f,0x200f8,0x293e,0x200f9,0x2956, + 0x200f8,0x293f,0x5008e,0x30,0x2943,0x290a,0x2909,0x5008e,0x30,0x2947,0x2917,0x292b, + 0x50081,0x30,0x2948,0x2943,0x2947,0x5008e,0x30,0x294c,0x2919,0x292d,0x50081,0x30, + 0x294d,0x2948,0x294c,0x5008e,0x30,0x2951,0x291b,0x292f,0x50081,0x30,0x2952,0x294d, + 0x2951,0x70050,0x30,0x2954,0x293b,0x293b,0x293b,0x293b,0x50088,0x30,0x2955,0x2952, + 0x2954,0x200f9,0x2956,0x200f8,0x2956,0x700f5,0x30,0x40ad,0x1e3,0x293e,0x2955,0x293f, + 0x300f7,0x28f6,0x0,0x400fa,0x25c7,0x28ef,0x28f6,0x200f8,0x28ef,0x4003d,0x167,0x29b1, + 0x1d4,0x40063,0x29b1,0x40dc,0x40ad,0x200f9,0x28f6,0x200f8,0x28f6,0x200f9,0x28f7,0x200f8, + 0x28f7,0x200f9,0x25b2,0x200f8,0x25b2,0x200f9,0x7c4,0x200f8,0x7c4,0x100fd,0x10038, +}; +static const char *fi_compute_inpainting_pyramid_pass_1_cb_names[] = {"cbFI", "cbInpaintingPyramid"}; +static const uint32_t fi_compute_inpainting_pyramid_pass_1_cb_bind[] = {15, 16}; +static const uint32_t fi_compute_inpainting_pyramid_pass_1_cb_count[] = {1, 1}; +static const uint32_t fi_compute_inpainting_pyramid_pass_1_cb_space[] = {0, 0}; +static const char *fi_compute_inpainting_pyramid_pass_1_srv_tex_names[] = {"r_output"}; +static const uint32_t fi_compute_inpainting_pyramid_pass_1_srv_tex_bind[] = {0}; +static const uint32_t fi_compute_inpainting_pyramid_pass_1_srv_tex_count[] = {1}; +static const uint32_t fi_compute_inpainting_pyramid_pass_1_srv_tex_space[] = {0}; +static const char *fi_compute_inpainting_pyramid_pass_1_uav_tex_names[] = {"rw_inpainting_pyramid0", "rw_inpainting_pyramid1", "rw_inpainting_pyramid2", "rw_inpainting_pyramid3", "rw_inpainting_pyramid4", "rw_inpainting_pyramid5", "rw_inpainting_pyramid6", "rw_inpainting_pyramid7", "rw_inpainting_pyramid8", "rw_inpainting_pyramid9", "rw_inpainting_pyramid10", "rw_inpainting_pyramid11"}; +static const uint32_t fi_compute_inpainting_pyramid_pass_1_uav_tex_bind[] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13}; +static const uint32_t fi_compute_inpainting_pyramid_pass_1_uav_tex_count[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; +static const uint32_t fi_compute_inpainting_pyramid_pass_1_uav_tex_space[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +static const char *fi_compute_inpainting_pyramid_pass_1_uav_buf_names[] = {"rw_counters"}; +static const uint32_t fi_compute_inpainting_pyramid_pass_1_uav_buf_bind[] = {1}; +static const uint32_t fi_compute_inpainting_pyramid_pass_1_uav_buf_count[] = {1}; +static const uint32_t fi_compute_inpainting_pyramid_pass_1_uav_buf_space[] = {0}; + +static const uint32_t fi_inpainting_pass_1_spv[2822] = { + 0x7230203,0x10500,0x8000b,0x8c1,0x0,0x20011,0x1,0x20011,0x37,0x20011,0x38,0x6000b, + 0x1,0x4c534c47,0x6474732e,0x3035342e,0x0,0x3000e,0x0,0x1,0xc000f,0x5,0x4,0x6e69616d, + 0x0,0x13f,0x171,0x17b,0x186,0x18e,0x196,0x397,0x60010,0x4,0x11,0x8, + 0x8,0x1,0x30003,0x2,0x1c2,0xb0004,0x455f4c47,0x735f5458,0x6c706d61,0x656c7265,0x745f7373,0x75747865, + 0x665f6572,0x74636e75,0x736e6f69,0x0,0xb0004,0x455f4c47,0x735f5458,0x65646168,0x78655f72,0x63696c70,0x615f7469,0x68746972, + 0x6974656d,0x79745f63,0x736570,0xa0004,0x455f4c47,0x735f5458,0x65646168,0x6d695f72,0x5f656761,0x64616f6c,0x726f665f,0x7474616d, + 0x6465,0xa0004,0x475f4c47,0x4c474f4f,0x70635f45,0x74735f70,0x5f656c79,0x656e696c,0x7269645f,0x69746365,0x6576,0x80004, + 0x475f4c47,0x4c474f4f,0x6e695f45,0x64756c63,0x69645f65,0x74636572,0x657669,0x40005,0x4,0x6e69616d,0x0,0x40005, + 0x13d,0x49466263,0x745f,0x60006,0x13d,0x0,0x70736964,0x5379616c,0x657a69,0x50006,0x13d,0x1, + 0x65736572,0x74,0x90006,0x13d,0x2,0x4c445548,0x41737365,0x63617474,0x46646568,0x6f746361,0x72,0x70006, + 0x13d,0x3,0x70736964,0x68637461,0x67616c46,0x73,0x70006,0x13d,0x4,0x75626564,0x72614267,0x6f6c6f43, + 0x72,0xa0006,0x13d,0x5,0x6b636162,0x66667542,0x72547265,0x66736e61,0x75467265,0x6974636e,0x6e6f,0x70006, + 0x13d,0x6,0x4d6e696d,0x754c7861,0x616e696d,0x65636e,0x40005,0x13f,0x49466263,0x0,0xa0005,0x171, + 0x75635f72,0x6e657272,0x6e695f74,0x70726574,0x74616c6f,0x5f6e6f69,0x72756f73,0x6563,0x70005,0x17b,0x706f5f72,0x61636974, + 0x6c665f6c,0x735f776f,0x6463,0x80005,0x186,0x6e695f72,0x6e696170,0x676e6974,0x7279705f,0x64696d61,0x0,0x80005, + 0x18e,0x72705f72,0x6e657365,0x61625f74,0x75626b63,0x72656666,0x0,0x50005,0x196,0x6f5f7772,0x75707475,0x74, + 0x80005,0x397,0x475f6c67,0x61626f6c,0x766e496c,0x7461636f,0x496e6f69,0x44,0x30047,0x13d,0x2,0x50048, + 0x13d,0x0,0x23,0x8,0x50048,0x13d,0x1,0x23,0x2c,0x50048,0x13d,0x2, + 0x23,0x44,0x50048,0x13d,0x3,0x23,0x5c,0x50048,0x13d,0x4,0x23,0x80, + 0x50048,0x13d,0x5,0x23,0x8c,0x50048,0x13d,0x6,0x23,0x90,0x40047,0x13f, + 0x21,0x8,0x40047,0x13f,0x22,0x0,0x40047,0x171,0x21,0x3,0x40047,0x171, + 0x22,0x0,0x40047,0x17b,0x21,0x0,0x40047,0x17b,0x22,0x0,0x40047,0x186, + 0x21,0x1,0x40047,0x186,0x22,0x0,0x40047,0x18e,0x21,0x2,0x40047,0x18e, + 0x22,0x0,0x40047,0x196,0x21,0x7,0x40047,0x196,0x22,0x0,0x40047,0x397, + 0xb,0x1c,0x40047,0x3ae,0xb,0x19,0x20013,0x2,0x30021,0x3,0x2,0x40015, + 0x6,0x20,0x0,0x30016,0x8,0x20,0x40020,0xd,0x7,0x8,0x40017,0xe, + 0x8,0x3,0x40017,0x22,0x8,0x2,0x40015,0x44,0x20,0x1,0x40017,0x45, + 0x44,0x2,0x20014,0x49,0x40020,0x5d,0x7,0x45,0x40017,0x65,0x6,0x2, + 0x40017,0x67,0x8,0x4,0x4002b,0x6,0x83,0x4,0x4001c,0x84,0x45,0x83, + 0x4001c,0x85,0x8,0x83,0x4002b,0x8,0xc4,0x0,0x4002b,0x8,0xc5,0x3f800000, + 0x4002b,0x8,0xff,0x3c4fcd9e,0x4002b,0x8,0x104,0x3f560008,0x4002b,0x8,0x10a,0x4196d014, + 0x4002b,0x8,0x10d,0x41958000,0x4002b,0x8,0x114,0x40c8e061,0x4002b,0x8,0x11b,0x3d25aee6, + 0x4002b,0x8,0x11c,0x3d9e8391,0x4002b,0x8,0x11d,0x4019999a,0x4002b,0x8,0x120,0x3f72a76e, + 0x4002b,0x8,0x121,0x3d558919,0x9001e,0x13d,0x45,0x44,0x44,0x6,0xe,0x6, + 0x22,0x40020,0x13e,0x2,0x13d,0x4003b,0x13e,0x13f,0x2,0x4002b,0x44,0x140, + 0x1,0x40020,0x141,0x2,0x45,0x40020,0x147,0x2,0x44,0x4002b,0x44,0x14d, + 0xa,0x40020,0x153,0x2,0x6,0x40020,0x159,0x2,0xe,0x4002b,0x6,0x164, + 0x0,0x40020,0x165,0x2,0x8,0x4002b,0x6,0x16a,0x1,0x90019,0x16f,0x8, + 0x1,0x0,0x0,0x0,0x1,0x0,0x40020,0x170,0x0,0x16f,0x4003b,0x170, + 0x171,0x0,0x4002b,0x44,0x174,0x0,0x90019,0x179,0x6,0x1,0x0,0x0, + 0x0,0x1,0x0,0x40020,0x17a,0x0,0x179,0x4003b,0x17a,0x17b,0x0,0x5002c, + 0x45,0x17d,0x140,0x174,0x40017,0x17e,0x6,0x4,0x4002b,0x6,0x181,0xf, + 0x4003b,0x170,0x186,0x0,0x4003b,0x170,0x18e,0x0,0x90019,0x194,0x8,0x1, + 0x0,0x0,0x0,0x2,0x0,0x40020,0x195,0x0,0x194,0x4003b,0x195,0x196, + 0x0,0x4002b,0x8,0x1be,0x461c4000,0x4002b,0x8,0x1d4,0x3f000000,0x5002c,0x22,0x1d5, + 0x1d4,0x1d4,0x4002b,0x44,0x1d9,0x2,0x5002c,0x45,0x1e2,0x174,0x174,0x5002c, + 0x45,0x1e5,0x174,0x140,0x5002c,0x45,0x1e8,0x140,0x140,0x40017,0x20d,0x49, + 0x2,0x4002b,0x8,0x22b,0x3dcccccd,0x4002b,0x6,0x238,0x2,0x7002c,0x67,0x255, + 0xc4,0xc4,0xc4,0xc4,0x4002b,0x44,0x25d,0x4,0x4002b,0x8,0x2ba,0x41200000, + 0x4002b,0x8,0x2bd,0x40400000,0x4002b,0x44,0x2d9,0x10,0x30029,0x49,0x2de,0x4002b, + 0x44,0x2ed,0x20,0x4002b,0x44,0x2fe,0x40,0x4002b,0x8,0x312,0x3a83126f,0x6002c, + 0xe,0x33c,0xc4,0xc4,0xc4,0x40017,0x33d,0x49,0x3,0x40017,0x395,0x6, + 0x3,0x40020,0x396,0x1,0x395,0x4003b,0x396,0x397,0x1,0x4002b,0x6,0x3ad, + 0x8,0x6002c,0x395,0x3ae,0x3ad,0x3ad,0x16a,0x40020,0x7b0,0x7,0x84,0x40020, + 0x7b2,0x7,0x85,0x30001,0xe,0x805,0x5002c,0x45,0x853,0x1d9,0x1d9,0x7002c, + 0x84,0x854,0x1e2,0x17d,0x1e5,0x1e8,0x6002c,0xe,0x855,0x11b,0x11b,0x11b, + 0x6002c,0xe,0x856,0xc5,0xc5,0xc5,0x6002c,0xe,0x857,0x11c,0x11c,0x11c, + 0x6002c,0xe,0x858,0x120,0x120,0x120,0x6002c,0xe,0x859,0x121,0x121,0x121, + 0x6002c,0xe,0x85a,0x11d,0x11d,0x11d,0x6002c,0xe,0x85b,0xff,0xff,0xff, + 0x6002c,0xe,0x85c,0x104,0x104,0x104,0x6002c,0xe,0x85d,0x10a,0x10a,0x10a, + 0x6002c,0xe,0x85e,0x10d,0x10d,0x10d,0x6002c,0xe,0x85f,0x114,0x114,0x114, + 0x4002b,0x8,0x860,0x3c4ccccd,0x4002b,0x8,0x861,0xff800000,0x6002c,0xe,0x862,0x861, + 0x861,0x861,0x4002b,0x6,0x8a1,0x5,0x4002b,0x6,0x8a2,0x6,0x4002b,0x6, + 0x8a3,0x3,0x50036,0x2,0x4,0x0,0x3,0x200f8,0x5,0x4003b,0x7b2,0x7cc, + 0x7,0x4003b,0x7b0,0x7cb,0x7,0x4003d,0x395,0x398,0x397,0x7004f,0x65,0x399, + 0x398,0x398,0x0,0x1,0x4007c,0x45,0x39a,0x399,0x4003d,0x194,0x43b,0x196, + 0x50062,0x67,0x43d,0x43b,0x39a,0x50051,0x8,0x3cf,0x43d,0x3,0x500ba,0x49, + 0x3d1,0x3cf,0x312,0x300f7,0x3e4,0x0,0x400fa,0x3d1,0x3d2,0x3e4,0x200f8,0x3d2, + 0x4006f,0x22,0x44c,0x39a,0x50081,0x22,0x44e,0x44c,0x1d5,0x50041,0x141,0x487, + 0x13f,0x164,0x4003d,0x45,0x488,0x487,0x4006f,0x22,0x450,0x488,0x50088,0x22, + 0x451,0x44e,0x450,0x200f9,0x453,0x200f8,0x453,0x700f5,0x67,0x8a4,0x255,0x3d2, + 0x8c0,0x47b,0x700f5,0x45,0x836,0x488,0x3d2,0x45a,0x47b,0x700f5,0x44,0x7ff, + 0x174,0x3d2,0x47d,0x47b,0x500b1,0x49,0x456,0x7ff,0x14d,0x400f6,0x47e,0x47b, + 0x0,0x400fa,0x456,0x457,0x47e,0x200f8,0x457,0x50087,0x45,0x45a,0x836,0x853, + 0x4006f,0x22,0x4d1,0x45a,0x50085,0x22,0x4d2,0x451,0x4d1,0x50083,0x22,0x4d3, + 0x4d2,0x1d5,0x6000c,0x22,0x4d5,0x1,0x8,0x4d3,0x4006e,0x45,0x4d6,0x4d5, + 0x6000c,0x22,0x4fe,0x1,0xa,0x4d3,0x50051,0x8,0x4df,0x4fe,0x0,0x50083, + 0x8,0x4e0,0xc5,0x4df,0x50051,0x8,0x4e2,0x4fe,0x1,0x50083,0x8,0x4e3, + 0xc5,0x4e2,0x50085,0x8,0x4e4,0x4e0,0x4e3,0x50085,0x8,0x4eb,0x4df,0x4e3, + 0x50085,0x8,0x4f2,0x4e0,0x4e2,0x50085,0x8,0x4f8,0x4df,0x4e2,0x70050,0x85, + 0x7fe,0x4e4,0x4eb,0x4f2,0x4f8,0x3003e,0x7cb,0x854,0x3003e,0x7cc,0x7fe,0x200f9, + 0x49e,0x200f8,0x49e,0x700f5,0x67,0x839,0x255,0x457,0x850,0x4c4,0x700f5,0x44, + 0x838,0x174,0x457,0x4c6,0x4c4,0x500b1,0x49,0x4a1,0x838,0x25d,0x400f6,0x4c7, + 0x4c4,0x0,0x400fa,0x4a1,0x4a2,0x4c7,0x200f8,0x4a2,0x50041,0x5d,0x7d1,0x7cb, + 0x838,0x4003d,0x45,0x4a5,0x7d1,0x50080,0x45,0x4a9,0x4d6,0x4a5,0x4007c,0x65, + 0x502,0x4a9,0x4007c,0x65,0x504,0x45a,0x500b0,0x20d,0x505,0x502,0x504,0x4009b, + 0x49,0x506,0x505,0x300f7,0x4c3,0x0,0x400fa,0x506,0x4ac,0x4c3,0x200f8,0x4ac, + 0x4003d,0x16f,0x509,0x186,0x7005f,0x67,0x50d,0x509,0x4a9,0x2,0x7ff,0x50041, + 0xd,0x7d2,0x7cc,0x838,0x4003d,0x8,0x4b2,0x7d2,0x50051,0x8,0x4b4,0x50d, + 0x3,0x500ba,0x49,0x4b5,0x4b4,0xc4,0x600a9,0x8,0x4b6,0x4b5,0xc5,0xc4, + 0x50085,0x8,0x4b7,0x4b2,0x4b6,0x8004f,0xe,0x4b9,0x50d,0x50d,0x0,0x1, + 0x2,0x5008e,0xe,0x4bb,0x4b9,0x4b7,0x50051,0x8,0x4bd,0x4bb,0x0,0x50051, + 0x8,0x4be,0x4bb,0x1,0x50051,0x8,0x4bf,0x4bb,0x2,0x70050,0x67,0x4c0, + 0x4bd,0x4be,0x4bf,0x4b7,0x50081,0x67,0x4c2,0x839,0x4c0,0x200f9,0x4c3,0x200f8, + 0x4c3,0x700f5,0x67,0x850,0x839,0x4a2,0x4c2,0x4ac,0x200f9,0x4c4,0x200f8,0x4c4, + 0x50080,0x44,0x4c6,0x838,0x140,0x200f9,0x49e,0x200f8,0x4c7,0x50051,0x8,0x460, + 0x839,0x3,0x500ba,0x49,0x461,0x460,0xc4,0x300f7,0x47a,0x0,0x400fa,0x461, + 0x462,0x47a,0x200f8,0x462,0x8004f,0xe,0x464,0x839,0x839,0x0,0x1,0x2, + 0x60050,0xe,0x467,0x460,0x460,0x460,0x50088,0xe,0x468,0x464,0x467,0x4006f, + 0x8,0x46a,0x7ff,0x50085,0x8,0x46b,0x46a,0x22b,0x50083,0x8,0x46c,0xc5, + 0x46b,0x7000c,0x8,0x512,0x1,0x1a,0x46c,0x2bd,0x50085,0x8,0x470,0x512, + 0x460,0x50051,0x8,0x472,0x468,0x0,0x50051,0x8,0x473,0x468,0x1,0x50051, + 0x8,0x474,0x468,0x2,0x70050,0x67,0x475,0x472,0x473,0x474,0xc5,0x5008e, + 0x67,0x477,0x475,0x470,0x50081,0x67,0x479,0x8a4,0x477,0x200f9,0x47a,0x200f8, + 0x47a,0x700f5,0x67,0x8c0,0x8a4,0x4c7,0x479,0x462,0x200f9,0x47b,0x200f8,0x47b, + 0x50080,0x44,0x47d,0x7ff,0x140,0x200f9,0x453,0x200f8,0x47e,0x8004f,0xe,0x480, + 0x8a4,0x8a4,0x0,0x1,0x2,0x50051,0x8,0x482,0x8a4,0x3,0x60050,0xe, + 0x483,0x482,0x482,0x482,0x50088,0xe,0x484,0x480,0x483,0x50051,0x44,0x3d6, + 0x488,0x0,0x500ad,0x49,0x3d7,0x3d6,0x174,0x600a9,0x8,0x3d8,0x3d7,0xc5, + 0xc4,0x5008e,0xe,0x3d9,0x484,0x3d8,0x8004f,0xe,0x3db,0x43d,0x43d,0x0, + 0x1,0x2,0x60050,0xe,0x51c,0x3cf,0x3cf,0x3cf,0x8000c,0xe,0x51d,0x1, + 0x2e,0x3db,0x3d9,0x51c,0x50051,0x8,0x3df,0x51d,0x0,0x60052,0x67,0x876, + 0x3df,0x43d,0x0,0x50051,0x8,0x3e1,0x51d,0x1,0x60052,0x67,0x878,0x3e1, + 0x876,0x1,0x50051,0x8,0x3e3,0x51d,0x2,0x60052,0x67,0x87a,0x3e3,0x878, + 0x2,0x200f9,0x3e4,0x200f8,0x3e4,0x700f5,0x67,0x8ab,0x43d,0x5,0x87a,0x47e, + 0x50041,0x147,0x520,0x13f,0x238,0x4003d,0x44,0x521,0x520,0x500aa,0x49,0x3e6, + 0x521,0x140,0x300f7,0x409,0x0,0x400fa,0x3e6,0x3e7,0x409,0x200f8,0x3e7,0x4003d, + 0x16f,0x524,0x171,0x7005f,0x67,0x526,0x524,0x39a,0x2,0x174,0x8004f,0xe, + 0x527,0x526,0x526,0x0,0x1,0x2,0x4003d,0x16f,0x52a,0x18e,0x7005f,0x67, + 0x52c,0x52a,0x39a,0x2,0x174,0x8004f,0xe,0x3ec,0x52c,0x52c,0x0,0x1, + 0x2,0x50083,0xe,0x3ef,0x527,0x3ec,0x6000c,0xe,0x3f0,0x1,0x4,0x3ef, + 0x500ba,0x33d,0x3f1,0x3f0,0x33c,0x4009a,0x49,0x3f2,0x3f1,0x300f7,0x408,0x0, + 0x400fa,0x3f2,0x3f3,0x408,0x200f8,0x3f3,0x50041,0x153,0x548,0x13f,0x8a1,0x4003d, + 0x6,0x549,0x548,0x300f7,0x544,0x0,0x900fb,0x549,0x544,0x0,0x536,0x1, + 0x539,0x2,0x53f,0x200f8,0x536,0x50083,0xe,0x555,0x527,0x855,0x50085,0xe, + 0x56e,0x555,0x862,0x8000c,0xe,0x57f,0x1,0x2b,0x56e,0x33c,0x856,0x50085, + 0xe,0x55a,0x527,0x857,0x50085,0xe,0x55e,0x527,0x858,0x50081,0xe,0x561, + 0x55e,0x859,0x7000c,0xe,0x564,0x1,0x1a,0x561,0x85a,0x4007f,0xe,0x58c, + 0x57f,0x50085,0xe,0x58e,0x58c,0x564,0x50081,0xe,0x590,0x58e,0x564,0x50085, + 0xe,0x593,0x57f,0x55a,0x50081,0xe,0x595,0x593,0x590,0x200f9,0x544,0x200f8, + 0x539,0x7000c,0xe,0x5a1,0x1,0x1a,0x527,0x85b,0x50083,0xe,0x5a4,0x5a1, + 0x85c,0x8000c,0xe,0x5bd,0x1,0x2b,0x5a4,0x33c,0x856,0x50085,0xe,0x5a9, + 0x85e,0x5a1,0x50083,0xe,0x5aa,0x85d,0x5a9,0x50088,0xe,0x5ab,0x5bd,0x5aa, + 0x7000c,0xe,0x5ad,0x1,0x1a,0x5ab,0x85f,0x60041,0x165,0x5d4,0x13f,0x8a2, + 0x16a,0x4003d,0x8,0x5d5,0x5d4,0x50088,0x8,0x53d,0x1be,0x5d5,0x5008e,0xe, + 0x53e,0x5ad,0x53d,0x200f9,0x544,0x200f8,0x53f,0x60041,0x165,0x5d8,0x13f,0x8a2, + 0x164,0x4003d,0x8,0x5d9,0x5d8,0x60041,0x165,0x5dc,0x13f,0x8a2,0x16a,0x4003d, + 0x8,0x5dd,0x5dc,0x50085,0x8,0x5e5,0x5d9,0x860,0x60050,0xe,0x5f2,0x5e5, + 0x5e5,0x5e5,0x50083,0xe,0x5e7,0x527,0x5f2,0x50083,0x8,0x5eb,0x5dd,0x5d9, + 0x50085,0x8,0x5ec,0x5eb,0x860,0x60050,0xe,0x5f6,0x5ec,0x5ec,0x5ec,0x50088, + 0xe,0x5ee,0x5e7,0x5f6,0x200f9,0x544,0x200f8,0x544,0xb00f5,0xe,0x803,0x805, + 0x3f3,0x595,0x536,0x53e,0x539,0x5ee,0x53f,0x300f7,0x60e,0x0,0x900fb,0x549, + 0x60e,0x0,0x600,0x1,0x603,0x2,0x609,0x200f8,0x600,0x50083,0xe,0x61f, + 0x3ec,0x855,0x50085,0xe,0x638,0x61f,0x862,0x8000c,0xe,0x649,0x1,0x2b, + 0x638,0x33c,0x856,0x50085,0xe,0x624,0x3ec,0x857,0x50085,0xe,0x628,0x3ec, + 0x858,0x50081,0xe,0x62b,0x628,0x859,0x7000c,0xe,0x62e,0x1,0x1a,0x62b, + 0x85a,0x4007f,0xe,0x656,0x649,0x50085,0xe,0x658,0x656,0x62e,0x50081,0xe, + 0x65a,0x658,0x62e,0x50085,0xe,0x65d,0x649,0x624,0x50081,0xe,0x65f,0x65d, + 0x65a,0x200f9,0x60e,0x200f8,0x603,0x7000c,0xe,0x66b,0x1,0x1a,0x3ec,0x85b, + 0x50083,0xe,0x66e,0x66b,0x85c,0x8000c,0xe,0x687,0x1,0x2b,0x66e,0x33c, + 0x856,0x50085,0xe,0x673,0x85e,0x66b,0x50083,0xe,0x674,0x85d,0x673,0x50088, + 0xe,0x675,0x687,0x674,0x7000c,0xe,0x677,0x1,0x1a,0x675,0x85f,0x60041, + 0x165,0x69e,0x13f,0x8a2,0x16a,0x4003d,0x8,0x69f,0x69e,0x50088,0x8,0x607, + 0x1be,0x69f,0x5008e,0xe,0x608,0x677,0x607,0x200f9,0x60e,0x200f8,0x609,0x60041, + 0x165,0x6a2,0x13f,0x8a2,0x164,0x4003d,0x8,0x6a3,0x6a2,0x60041,0x165,0x6a6, + 0x13f,0x8a2,0x16a,0x4003d,0x8,0x6a7,0x6a6,0x50085,0x8,0x6af,0x6a3,0x860, + 0x60050,0xe,0x6bc,0x6af,0x6af,0x6af,0x50083,0xe,0x6b1,0x3ec,0x6bc,0x50083, + 0x8,0x6b5,0x6a7,0x6a3,0x50085,0x8,0x6b6,0x6b5,0x860,0x60050,0xe,0x6c0, + 0x6b6,0x6b6,0x6b6,0x50088,0xe,0x6b8,0x6b1,0x6c0,0x200f9,0x60e,0x200f8,0x60e, + 0xb00f5,0xe,0x808,0x805,0x544,0x65f,0x600,0x608,0x603,0x6b8,0x609,0x50051, + 0x8,0x6c9,0x803,0x0,0x50051,0x8,0x6cb,0x808,0x0,0x7000c,0x8,0x700, + 0x1,0x28,0x6c9,0x6cb,0x500b7,0x49,0x6f4,0x700,0xc4,0x300f7,0x6fa,0x0, + 0x400fa,0x6f4,0x6f5,0x6f9,0x200f8,0x6f5,0x7000c,0x8,0x705,0x1,0x25,0x6c9, + 0x6cb,0x50088,0x8,0x6f8,0x705,0x700,0x200f9,0x6fa,0x200f8,0x6f9,0x200f9,0x6fa, + 0x200f8,0x6fa,0x700f5,0x8,0x80c,0x6f8,0x6f5,0xc4,0x6f9,0x50083,0x8,0x6cd, + 0xc5,0x80c,0x50085,0x8,0x6ce,0x6cd,0x2ba,0x8000c,0x8,0x709,0x1,0x2b, + 0x6ce,0xc4,0xc5,0x50051,0x8,0x6d1,0x803,0x1,0x50051,0x8,0x6d3,0x808, + 0x1,0x7000c,0x8,0x720,0x1,0x28,0x6d1,0x6d3,0x500b7,0x49,0x714,0x720, + 0xc4,0x300f7,0x71a,0x0,0x400fa,0x714,0x715,0x719,0x200f8,0x715,0x7000c,0x8, + 0x725,0x1,0x25,0x6d1,0x6d3,0x50088,0x8,0x718,0x725,0x720,0x200f9,0x71a, + 0x200f8,0x719,0x200f9,0x71a,0x200f8,0x71a,0x700f5,0x8,0x80d,0x718,0x715,0xc4, + 0x719,0x50083,0x8,0x6d5,0xc5,0x80d,0x50085,0x8,0x6d6,0x6d5,0x2ba,0x8000c, + 0x8,0x729,0x1,0x2b,0x6d6,0xc4,0xc5,0x50051,0x8,0x6d9,0x803,0x2, + 0x50051,0x8,0x6db,0x808,0x2,0x7000c,0x8,0x740,0x1,0x28,0x6d9,0x6db, + 0x500b7,0x49,0x734,0x740,0xc4,0x300f7,0x73a,0x0,0x400fa,0x734,0x735,0x739, + 0x200f8,0x735,0x7000c,0x8,0x745,0x1,0x25,0x6d9,0x6db,0x50088,0x8,0x738, + 0x745,0x740,0x200f9,0x73a,0x200f8,0x739,0x200f9,0x73a,0x200f8,0x73a,0x700f5,0x8, + 0x80e,0x738,0x735,0xc4,0x739,0x50083,0x8,0x6dd,0xc5,0x80e,0x50085,0x8, + 0x6de,0x6dd,0x2ba,0x8000c,0x8,0x749,0x1,0x2b,0x6de,0xc4,0xc5,0x60050, + 0xe,0x6e0,0x709,0x729,0x749,0x8000c,0xe,0x751,0x1,0x2b,0x6e0,0x33c, + 0x856,0x50051,0x8,0x6e3,0x751,0x0,0x50051,0x8,0x6e5,0x751,0x1,0x50051, + 0x8,0x6e7,0x751,0x2,0x7000c,0x8,0x6e8,0x1,0x28,0x6e5,0x6e7,0x7000c, + 0x8,0x6e9,0x1,0x28,0x6e3,0x6e8,0x500ba,0x49,0x3fa,0x6e9,0x312,0x300f7, + 0x407,0x0,0x400fa,0x3fa,0x3fb,0x407,0x200f8,0x3fb,0x8004f,0xe,0x3fd,0x8ab, + 0x8ab,0x0,0x1,0x2,0x60050,0xe,0x75f,0x6e9,0x6e9,0x6e9,0x8000c,0xe, + 0x760,0x1,0x2e,0x3fd,0x3ec,0x75f,0x50051,0x8,0x402,0x760,0x0,0x60052, + 0x67,0x885,0x402,0x8ab,0x0,0x50051,0x8,0x404,0x760,0x1,0x60052,0x67, + 0x887,0x404,0x885,0x1,0x50051,0x8,0x406,0x760,0x2,0x60052,0x67,0x889, + 0x406,0x887,0x2,0x200f9,0x407,0x200f8,0x407,0x700f5,0x67,0x8ae,0x8ab,0x73a, + 0x889,0x3fb,0x600a9,0x49,0x864,0x3fa,0x2de,0x3d1,0x200f9,0x408,0x200f8,0x408, + 0x700f5,0x67,0x8ad,0x8ab,0x3e7,0x8ae,0x407,0x700f5,0x49,0x81d,0x3d1,0x3e7, + 0x864,0x407,0x200f9,0x409,0x200f8,0x409,0x700f5,0x67,0x8ac,0x8ab,0x3e4,0x8ad, + 0x408,0x700f5,0x49,0x81b,0x3d1,0x3e4,0x81d,0x408,0x50041,0x153,0x763,0x13f, + 0x8a3,0x4003d,0x6,0x764,0x763,0x500c7,0x6,0x40b,0x764,0x16a,0x500ab,0x49, + 0x40c,0x40b,0x164,0x300f7,0x41b,0x0,0x400fa,0x40c,0x40d,0x41b,0x200f8,0x40d, + 0x8004f,0xe,0x410,0x8ac,0x8ac,0x0,0x1,0x2,0x50051,0x44,0x767,0x39a, + 0x0,0x500b1,0x49,0x768,0x767,0x2d9,0x300f7,0x777,0x0,0x400fa,0x768,0x769, + 0x76b,0x200f8,0x769,0x60052,0xe,0x88c,0xc5,0x410,0x1,0x200f9,0x777,0x200f8, + 0x76b,0x50041,0x141,0x77a,0x13f,0x164,0x4003d,0x45,0x77b,0x77a,0x50051,0x44, + 0x76f,0x77b,0x0,0x50082,0x44,0x770,0x76f,0x2d9,0x500ad,0x49,0x771,0x767, + 0x770,0x300f7,0x776,0x0,0x400fa,0x771,0x772,0x776,0x200f8,0x772,0x50041,0x159, + 0x77e,0x13f,0x83,0x4003d,0xe,0x77f,0x77e,0x50081,0xe,0x775,0x410,0x77f, + 0x200f9,0x776,0x200f8,0x776,0x700f5,0xe,0x8b0,0x410,0x76b,0x775,0x772,0x600a9, + 0x49,0x865,0x771,0x2de,0x81b,0x200f9,0x777,0x200f8,0x777,0x700f5,0xe,0x8af, + 0x88c,0x769,0x8b0,0x776,0x700f5,0x49,0x824,0x2de,0x769,0x865,0x776,0x50051, + 0x8,0x415,0x8af,0x0,0x60052,0x67,0x88f,0x415,0x8ac,0x0,0x50051,0x8, + 0x417,0x8af,0x1,0x60052,0x67,0x891,0x417,0x88f,0x1,0x50051,0x8,0x419, + 0x8af,0x2,0x60052,0x67,0x893,0x419,0x891,0x2,0x200f9,0x41b,0x200f8,0x41b, + 0x700f5,0x67,0x8b3,0x8ac,0x409,0x893,0x777,0x700f5,0x49,0x829,0x81b,0x409, + 0x824,0x777,0x500c7,0x6,0x41d,0x764,0x238,0x500ab,0x49,0x41e,0x41d,0x164, + 0x300f7,0x42d,0x0,0x400fa,0x41e,0x41f,0x42d,0x200f8,0x41f,0x8004f,0xe,0x422, + 0x8b3,0x8b3,0x0,0x1,0x2,0x50051,0x44,0x786,0x39a,0x1,0x500b1,0x49, + 0x787,0x786,0x2ed,0x300f7,0x78a,0x0,0x400fa,0x787,0x788,0x78a,0x200f8,0x788, + 0x50041,0x147,0x7a2,0x13f,0x16a,0x4003d,0x44,0x7a3,0x7a2,0x500aa,0x49,0x7a4, + 0x7a3,0x140,0x200f9,0x78a,0x200f8,0x78a,0x700f5,0x49,0x78b,0x787,0x41f,0x7a4, + 0x788,0x300f7,0x79f,0x0,0x400fa,0x78b,0x78c,0x78e,0x200f8,0x78c,0x60052,0xe, + 0x896,0xc5,0x422,0x0,0x200f9,0x79f,0x200f8,0x78e,0x500ad,0x49,0x791,0x786, + 0x2ed,0x300f7,0x796,0x0,0x400fa,0x791,0x792,0x796,0x200f8,0x792,0x500b1,0x49, + 0x795,0x786,0x2fe,0x200f9,0x796,0x200f8,0x796,0x700f5,0x49,0x797,0x791,0x78e, + 0x795,0x792,0x300f7,0x79a,0x0,0x400fa,0x797,0x798,0x79a,0x200f8,0x798,0x4003d, + 0x179,0x7a7,0x17b,0x7005f,0x17e,0x7a8,0x7a7,0x17d,0x2002,0x174,0x50051,0x6, + 0x7a9,0x7a8,0x0,0x500c7,0x6,0x7aa,0x7a9,0x181,0x500ab,0x49,0x7ab,0x7aa, + 0x164,0x200f9,0x79a,0x200f8,0x79a,0x700f5,0x49,0x79b,0x797,0x796,0x7ab,0x798, + 0x300f7,0x79e,0x0,0x400fa,0x79b,0x79c,0x79e,0x200f8,0x79c,0x60052,0xe,0x89a, + 0xc5,0x422,0x2,0x200f9,0x79e,0x200f8,0x79e,0x700f5,0xe,0x8b8,0x422,0x79a, + 0x89a,0x79c,0x600a9,0x49,0x866,0x79b,0x2de,0x829,0x200f9,0x79f,0x200f8,0x79f, + 0x700f5,0xe,0x8b7,0x896,0x78c,0x8b8,0x79e,0x700f5,0x49,0x82a,0x2de,0x78c, + 0x866,0x79e,0x50051,0x8,0x427,0x8b7,0x0,0x60052,0x67,0x89c,0x427,0x8b3, + 0x0,0x50051,0x8,0x429,0x8b7,0x1,0x60052,0x67,0x89e,0x429,0x89c,0x1, + 0x50051,0x8,0x42b,0x8b7,0x2,0x60052,0x67,0x8a0,0x42b,0x89e,0x2,0x200f9, + 0x42d,0x200f8,0x42d,0x700f5,0x67,0x8be,0x8b3,0x41b,0x8a0,0x79f,0x700f5,0x49, + 0x82f,0x829,0x41b,0x82a,0x79f,0x300f7,0x438,0x0,0x400fa,0x82f,0x42f,0x438, + 0x200f8,0x42f,0x50051,0x8,0x432,0x8be,0x0,0x50051,0x8,0x433,0x8be,0x1, + 0x50051,0x8,0x434,0x8be,0x2,0x70050,0x67,0x435,0x432,0x433,0x434,0xc5, + 0x4003d,0x194,0x7ad,0x196,0x40063,0x7ad,0x39a,0x435,0x200f9,0x438,0x200f8,0x438, + 0x100fd,0x10038, +}; +static const char *fi_inpainting_pass_1_cb_names[] = {"cbFI"}; +static const uint32_t fi_inpainting_pass_1_cb_bind[] = {8}; +static const uint32_t fi_inpainting_pass_1_cb_count[] = {1}; +static const uint32_t fi_inpainting_pass_1_cb_space[] = {0}; +static const char *fi_inpainting_pass_1_srv_tex_names[] = {"r_optical_flow_scd", "r_inpainting_pyramid", "r_present_backbuffer", "r_current_interpolation_source"}; +static const uint32_t fi_inpainting_pass_1_srv_tex_bind[] = {0, 1, 2, 3}; +static const uint32_t fi_inpainting_pass_1_srv_tex_count[] = {1, 1, 1, 1}; +static const uint32_t fi_inpainting_pass_1_srv_tex_space[] = {0, 0, 0, 0}; +static const char *fi_inpainting_pass_1_uav_tex_names[] = {"rw_output"}; +static const uint32_t fi_inpainting_pass_1_uav_tex_bind[] = {7}; +static const uint32_t fi_inpainting_pass_1_uav_tex_count[] = {1}; +static const uint32_t fi_inpainting_pass_1_uav_tex_space[] = {0}; + +static const uint32_t fi_compute_game_vector_field_inpainting_pyramid_pass_1_spv[9606] = { + 0x7230203,0x10500,0x8000b,0x415a,0x0,0x20011,0x1,0x20011,0x3d,0x20011,0x44,0x6000b, + 0x1,0x4c534c47,0x6474732e,0x3035342e,0x0,0x3000e,0x0,0x1,0x1d000f,0x5,0x4,0x6e69616d, + 0x0,0x130,0x139,0x14c,0x154,0x161,0x16f,0x178,0x181,0x18a,0x194,0x19e, + 0x1a8,0x1b2,0x1bc,0x1c6,0x1d0,0x1da,0x2ba,0x2c8,0x2ce,0x2d3,0x2d8,0x748, + 0x74c,0x60010,0x4,0x11,0x100,0x1,0x1,0x30003,0x2,0x1c2,0xb0004,0x455f4c47, + 0x735f5458,0x6c706d61,0x656c7265,0x745f7373,0x75747865,0x665f6572,0x74636e75,0x736e6f69,0x0,0xb0004,0x455f4c47,0x735f5458, + 0x65646168,0x78655f72,0x63696c70,0x615f7469,0x68746972,0x6974656d,0x79745f63,0x736570,0xa0004,0x475f4c47,0x4c474f4f,0x70635f45, + 0x74735f70,0x5f656c79,0x656e696c,0x7269645f,0x69746365,0x6576,0x80004,0x475f4c47,0x4c474f4f,0x6e695f45,0x64756c63,0x69645f65, + 0x74636572,0x657669,0x90004,0x4b5f4c47,0x735f5248,0x65646168,0x75735f72,0x6f726762,0x625f7075,0x63697361,0x0,0x80004, + 0x4b5f4c47,0x735f5248,0x65646168,0x75735f72,0x6f726762,0x715f7075,0x646175,0x40005,0x4,0x6e69616d,0x0,0x40005, + 0x12e,0x49466263,0x745f,0x60006,0x12e,0x0,0x70736964,0x5379616c,0x657a69,0x40005,0x130,0x49466263, + 0x0,0x80005,0x137,0x6e496263,0x6e696170,0x676e6974,0x61727950,0x5f64696d,0x74,0x50006,0x137,0x0, + 0x7370696d,0x0,0x70006,0x137,0x1,0x576d756e,0x476b726f,0x70756f72,0x73,0x70006,0x137,0x2, + 0x6b726f77,0x756f7247,0x66664f70,0x746573,0x70005,0x139,0x6e496263,0x6e696170,0x676e6974,0x61727950,0x64696d,0xa0005, + 0x14c,0x61675f72,0x6d5f656d,0x6f69746f,0x65765f6e,0x726f7463,0x6569665f,0x785f646c,0x0,0xa0005,0x154,0x61675f72, + 0x6d5f656d,0x6f69746f,0x65765f6e,0x726f7463,0x6569665f,0x795f646c,0x0,0xa0005,0x15f,0x6d617246,0x746e4965,0x6f707265, + 0x6974616c,0x57526e6f,0x6e756f43,0x73726574,0x745f,0x50006,0x15f,0x0,0x61746164,0x0,0x50005,0x161, + 0x635f7772,0x746e756f,0x737265,0x80005,0x16f,0x695f7772,0x6961706e,0x6e69746e,0x79705f67,0x696d6172,0x3064,0x80005, + 0x178,0x695f7772,0x6961706e,0x6e69746e,0x79705f67,0x696d6172,0x3164,0x80005,0x181,0x695f7772,0x6961706e,0x6e69746e, + 0x79705f67,0x696d6172,0x3264,0x80005,0x18a,0x695f7772,0x6961706e,0x6e69746e,0x79705f67,0x696d6172,0x3364,0x80005, + 0x194,0x695f7772,0x6961706e,0x6e69746e,0x79705f67,0x696d6172,0x3464,0x80005,0x19e,0x695f7772,0x6961706e,0x6e69746e, + 0x79705f67,0x696d6172,0x3564,0x80005,0x1a8,0x695f7772,0x6961706e,0x6e69746e,0x79705f67,0x696d6172,0x3664,0x80005, + 0x1b2,0x695f7772,0x6961706e,0x6e69746e,0x79705f67,0x696d6172,0x3764,0x80005,0x1bc,0x695f7772,0x6961706e,0x6e69746e, + 0x79705f67,0x696d6172,0x3864,0x80005,0x1c6,0x695f7772,0x6961706e,0x6e69746e,0x79705f67,0x696d6172,0x3964,0x80005, + 0x1d0,0x695f7772,0x6961706e,0x6e69746e,0x79705f67,0x696d6172,0x303164,0x80005,0x1da,0x695f7772,0x6961706e,0x6e69746e, + 0x79705f67,0x696d6172,0x313164,0x50005,0x2ba,0x43647073,0x746e756f,0x7265,0x70005,0x2c8,0x49647073,0x7265746e, + 0x6964656d,0x52657461,0x0,0x70005,0x2ce,0x49647073,0x7265746e,0x6964656d,0x47657461,0x0,0x70005,0x2d3, + 0x49647073,0x7265746e,0x6964656d,0x42657461,0x0,0x70005,0x2d8,0x49647073,0x7265746e,0x6964656d,0x41657461,0x0, + 0x60005,0x748,0x575f6c67,0x476b726f,0x70756f72,0x4449,0x80005,0x74c,0x4c5f6c67,0x6c61636f,0x6f766e49,0x69746163, + 0x6e496e6f,0x786564,0x30047,0x12e,0x2,0x50048,0x12e,0x0,0x23,0x8,0x40047,0x130, + 0x21,0x10,0x40047,0x130,0x22,0x0,0x30047,0x137,0x2,0x50048,0x137,0x0, + 0x23,0x0,0x50048,0x137,0x1,0x23,0x4,0x50048,0x137,0x2,0x23,0x8, + 0x40047,0x139,0x21,0x11,0x40047,0x139,0x22,0x0,0x40047,0x14c,0x21,0x0, + 0x40047,0x14c,0x22,0x0,0x40047,0x154,0x21,0x1,0x40047,0x154,0x22,0x0, + 0x40047,0x15e,0x6,0x4,0x30047,0x15f,0x2,0x40048,0x15f,0x0,0x17,0x50048, + 0x15f,0x0,0x23,0x0,0x30047,0x161,0x17,0x40047,0x161,0x21,0x2,0x40047, + 0x161,0x22,0x0,0x40047,0x16f,0x21,0x3,0x40047,0x16f,0x22,0x0,0x40047, + 0x178,0x21,0x4,0x40047,0x178,0x22,0x0,0x40047,0x181,0x21,0x5,0x40047, + 0x181,0x22,0x0,0x40047,0x18a,0x21,0x6,0x40047,0x18a,0x22,0x0,0x40047, + 0x194,0x21,0x7,0x40047,0x194,0x22,0x0,0x30047,0x19e,0x17,0x40047,0x19e, + 0x21,0x8,0x40047,0x19e,0x22,0x0,0x40047,0x1a8,0x21,0x9,0x40047,0x1a8, + 0x22,0x0,0x40047,0x1b2,0x21,0xa,0x40047,0x1b2,0x22,0x0,0x40047,0x1bc, + 0x21,0xb,0x40047,0x1bc,0x22,0x0,0x40047,0x1c6,0x21,0xc,0x40047,0x1c6, + 0x22,0x0,0x40047,0x1d0,0x21,0xd,0x40047,0x1d0,0x22,0x0,0x40047,0x1da, + 0x21,0xe,0x40047,0x1da,0x22,0x0,0x40047,0x748,0xb,0x1a,0x40047,0x74c, + 0xb,0x1d,0x40047,0x75b,0xb,0x19,0x20013,0x2,0x30021,0x3,0x2,0x40015, + 0x6,0x20,0x0,0x30016,0x13,0x20,0x40017,0x14,0x13,0x2,0x40017,0x19, + 0x6,0x2,0x40015,0x1e,0x20,0x1,0x40017,0x1f,0x1e,0x2,0x40017,0x3a, + 0x13,0x4,0x20014,0x47,0x40017,0xf4,0x1e,0x3,0x4002b,0x1e,0x105,0x0, + 0x4002b,0x6,0x10f,0x2,0x4002b,0x6,0x110,0x3,0x4002b,0x6,0x116,0x1, + 0x3001e,0x12e,0x1f,0x40020,0x12f,0x2,0x12e,0x4003b,0x12f,0x130,0x2,0x4002b, + 0x1e,0x131,0x1,0x40020,0x132,0x2,0x1f,0x5001e,0x137,0x6,0x6,0x19, + 0x40020,0x138,0x2,0x137,0x4003b,0x138,0x139,0x2,0x40020,0x13a,0x2,0x6, + 0x4002b,0x1e,0x143,0x2,0x40020,0x144,0x2,0x19,0x90019,0x14a,0x6,0x1, + 0x0,0x0,0x0,0x1,0x0,0x40020,0x14b,0x0,0x14a,0x4003b,0x14b,0x14c, + 0x0,0x40017,0x14f,0x6,0x4,0x4002b,0x6,0x151,0x0,0x4003b,0x14b,0x154, + 0x0,0x3001d,0x15e,0x6,0x3001e,0x15f,0x15e,0x40020,0x160,0xc,0x15f,0x4003b, + 0x160,0x161,0xc,0x40020,0x164,0xc,0x6,0x90019,0x16d,0x13,0x1,0x0, + 0x0,0x0,0x2,0x2,0x40020,0x16e,0x0,0x16d,0x4003b,0x16e,0x16f,0x0, + 0x4003b,0x16e,0x178,0x0,0x4003b,0x16e,0x181,0x0,0x4003b,0x16e,0x18a,0x0, + 0x4002b,0x6,0x190,0x4,0x4003b,0x16e,0x194,0x0,0x4002b,0x6,0x19a,0x5, + 0x4003b,0x16e,0x19e,0x0,0x4002b,0x6,0x1a4,0x6,0x4003b,0x16e,0x1a8,0x0, + 0x4002b,0x6,0x1ae,0x7,0x4003b,0x16e,0x1b2,0x0,0x4002b,0x6,0x1b8,0x8, + 0x4003b,0x16e,0x1bc,0x0,0x4002b,0x6,0x1c2,0x9,0x4003b,0x16e,0x1c6,0x0, + 0x4002b,0x6,0x1cc,0xa,0x4003b,0x16e,0x1d0,0x0,0x4002b,0x6,0x1d6,0xb, + 0x4003b,0x16e,0x1da,0x0,0x4002b,0x13,0x1e9,0x0,0x4002b,0x6,0x249,0x80000000, + 0x4002b,0x6,0x250,0x15,0x4002b,0x6,0x252,0x3ff,0x4002b,0x6,0x25b,0x10, + 0x4002b,0x6,0x25d,0x1f,0x4002b,0x1e,0x26a,0x3,0x4002b,0x13,0x27d,0x3f800000, + 0x4002b,0x1e,0x28e,0x6,0x40020,0x2b9,0x4,0x6,0x4003b,0x2b9,0x2ba,0x4, + 0x4001c,0x2c5,0x13,0x25b,0x4001c,0x2c6,0x2c5,0x25b,0x40020,0x2c7,0x4,0x2c6, + 0x4003b,0x2c7,0x2c8,0x4,0x40020,0x2cb,0x4,0x13,0x4003b,0x2c7,0x2ce,0x4, + 0x4003b,0x2c7,0x2d3,0x4,0x4003b,0x2c7,0x2d8,0x4,0x4002b,0x13,0x32b,0x3a83126f, + 0x4002b,0x6,0x335,0xd48,0x4002b,0x6,0x336,0x108,0x5002c,0x19,0x388,0x151, + 0x116,0x5002c,0x19,0x38b,0x116,0x151,0x5002c,0x19,0x38e,0x116,0x116,0x4002b, + 0x6,0x3d3,0x40,0x4002b,0x6,0x3e1,0x20,0x4002b,0x1e,0x6e0,0x7,0x40017, + 0x746,0x6,0x3,0x40020,0x747,0x1,0x746,0x4003b,0x747,0x748,0x1,0x40020, + 0x74b,0x1,0x6,0x4003b,0x74b,0x74c,0x1,0x4002b,0x6,0x75a,0x100,0x6002c, + 0x746,0x75b,0x75a,0x116,0x116,0x5002c,0x19,0x412d,0x3d3,0x3d3,0x5002c,0x19, + 0x412e,0x3e1,0x3e1,0x5002c,0x19,0x412f,0x25b,0x25b,0x5002c,0x19,0x4130,0x1b8, + 0x1b8,0x5002c,0x19,0x4131,0x190,0x190,0x5002c,0x19,0x4132,0x10f,0x10f,0x4002b, + 0x13,0x4133,0x3a802008,0x4002b,0x13,0x4134,0x3d042108,0x5002c,0x1f,0x4159,0x105,0x105, + 0x50036,0x2,0x4,0x0,0x3,0x200f8,0x5,0x4003d,0x746,0x749,0x748,0x4007c, + 0xf4,0x74a,0x749,0x4003d,0x6,0x74d,0x74c,0x7004f,0x1f,0x776,0x74a,0x74a, + 0x0,0x1,0x4007c,0x19,0x777,0x776,0x50041,0x13a,0x783,0x139,0x105,0x4003d, + 0x6,0x784,0x783,0x50041,0x13a,0x787,0x139,0x131,0x4003d,0x6,0x788,0x787, + 0x50041,0x144,0x78b,0x139,0x143,0x4003d,0x19,0x78c,0x78b,0x50080,0x19,0x795, + 0x777,0x78c,0x300f7,0x7f3,0x0,0x300fb,0x151,0x7bd,0x200f8,0x7bd,0x50089,0x6, + 0x7bf,0x74d,0x3d3,0x600cb,0x6,0x816,0x7bf,0x143,0x26a,0x700c9,0x6,0x81d, + 0x816,0x7bf,0x105,0x131,0x600cb,0x6,0x825,0x7bf,0x26a,0x26a,0x600cb,0x6, + 0x82d,0x7bf,0x131,0x143,0x700c9,0x6,0x834,0x825,0x82d,0x105,0x143,0x500c2, + 0x6,0x7c4,0x74d,0x28e,0x50089,0x6,0x7c5,0x7c4,0x10f,0x50084,0x6,0x7c6, + 0x1b8,0x7c5,0x50080,0x6,0x7c7,0x81d,0x7c6,0x500c2,0x6,0x7cb,0x74d,0x6e0, + 0x50084,0x6,0x7cc,0x1b8,0x7cb,0x50080,0x6,0x7cd,0x834,0x7cc,0x300f7,0x986, + 0x0,0x300fb,0x151,0x880,0x200f8,0x880,0x50084,0x19,0x883,0x795,0x412d,0x4007c, + 0x1f,0x884,0x883,0x50084,0x6,0x886,0x7c7,0x10f,0x4007c,0x1e,0x887,0x886, + 0x50084,0x6,0x889,0x7cd,0x10f,0x4007c,0x1e,0x88a,0x889,0x50050,0x1f,0x88b, + 0x887,0x88a,0x50080,0x1f,0x88c,0x884,0x88b,0x50084,0x19,0x88f,0x795,0x412e, + 0x4007c,0x1f,0x890,0x88f,0x4007c,0x1e,0x892,0x7c7,0x4007c,0x1e,0x894,0x7cd, + 0x50050,0x1f,0x895,0x892,0x894,0x50080,0x1f,0x896,0x890,0x895,0x4007c,0x19, + 0x898,0x88c,0x50080,0x19,0x991,0x898,0x388,0x50080,0x19,0x993,0x898,0x38b, + 0x50080,0x19,0x995,0x898,0x38e,0x4003d,0x14a,0x9dd,0x14c,0x7005f,0x14f,0x9df, + 0x9dd,0x88c,0x2002,0x105,0x50051,0x6,0x9e0,0x9df,0x0,0x4003d,0x14a,0x9e1, + 0x154,0x7005f,0x14f,0x9e3,0x9e1,0x88c,0x2002,0x105,0x50051,0x6,0x9e4,0x9e3, + 0x0,0x500c2,0x6,0x9ee,0x9e0,0x250,0x500c7,0x6,0x9ef,0x9ee,0x252,0x40070, + 0x13,0x9f0,0x9ef,0x50085,0x13,0x9f1,0x9f0,0x4133,0x500c2,0x6,0x9f5,0x9e0, + 0x25b,0x500c7,0x6,0x9f6,0x9f5,0x25d,0x40070,0x13,0x9f7,0x9f6,0x50085,0x13, + 0x9f8,0x9f7,0x4134,0x500c7,0x6,0xa21,0x9e0,0x249,0x500ba,0x47,0xa00,0x9f1, + 0x1e9,0x300f7,0xa08,0x0,0x400fa,0xa00,0xa04,0xa08,0x200f8,0xa04,0x500aa,0x47, + 0xa07,0xa21,0x151,0x200f9,0xa08,0x200f8,0xa08,0x700f5,0x47,0xa09,0xa00,0x880, + 0xa07,0xa04,0x300f7,0xa12,0x0,0x400fa,0xa09,0xa0d,0xa12,0x200f8,0xa0d,0x50083, + 0x13,0xa10,0x27d,0x9f1,0x200f9,0xa12,0x200f8,0xa12,0x700f5,0x13,0x2d26,0x9f1, + 0xa08,0xa10,0xa0d,0x6000c,0x14,0xa26,0x1,0x3e,0x9e0,0x50051,0x13,0xa16, + 0xa26,0x0,0x6000c,0x14,0xa2a,0x1,0x3e,0x9e4,0x50051,0x13,0xa1b,0xa2a, + 0x0,0x70050,0x3a,0x9d3,0xa16,0xa1b,0x2d26,0x9f8,0x50041,0x132,0xa2d,0x130, + 0x151,0x4003d,0x1f,0xa2e,0xa2d,0x50051,0x1e,0x9d5,0xa2e,0x0,0x500ad,0x47, + 0x9d6,0x9d5,0x105,0x600a9,0x13,0x9d7,0x9d6,0x27d,0x1e9,0x5008e,0x3a,0x9d8, + 0x9d3,0x9d7,0x4007c,0x1f,0x9af,0x991,0x4003d,0x14a,0xa4d,0x14c,0x7005f,0x14f, + 0xa4f,0xa4d,0x9af,0x2002,0x105,0x50051,0x6,0xa50,0xa4f,0x0,0x4003d,0x14a, + 0xa51,0x154,0x7005f,0x14f,0xa53,0xa51,0x9af,0x2002,0x105,0x50051,0x6,0xa54, + 0xa53,0x0,0x500c2,0x6,0xa5e,0xa50,0x250,0x500c7,0x6,0xa5f,0xa5e,0x252, + 0x40070,0x13,0xa60,0xa5f,0x50085,0x13,0xa61,0xa60,0x4133,0x500c2,0x6,0xa65, + 0xa50,0x25b,0x500c7,0x6,0xa66,0xa65,0x25d,0x40070,0x13,0xa67,0xa66,0x50085, + 0x13,0xa68,0xa67,0x4134,0x500c7,0x6,0xa91,0xa50,0x249,0x500ba,0x47,0xa70, + 0xa61,0x1e9,0x300f7,0xa78,0x0,0x400fa,0xa70,0xa74,0xa78,0x200f8,0xa74,0x500aa, + 0x47,0xa77,0xa91,0x151,0x200f9,0xa78,0x200f8,0xa78,0x700f5,0x47,0xa79,0xa70, + 0xa12,0xa77,0xa74,0x300f7,0xa82,0x0,0x400fa,0xa79,0xa7d,0xa82,0x200f8,0xa7d, + 0x50083,0x13,0xa80,0x27d,0xa61,0x200f9,0xa82,0x200f8,0xa82,0x700f5,0x13,0x2d33, + 0xa61,0xa78,0xa80,0xa7d,0x6000c,0x14,0xa96,0x1,0x3e,0xa50,0x50051,0x13, + 0xa86,0xa96,0x0,0x6000c,0x14,0xa9a,0x1,0x3e,0xa54,0x50051,0x13,0xa8b, + 0xa9a,0x0,0x70050,0x3a,0xa43,0xa86,0xa8b,0x2d33,0xa68,0x5008e,0x3a,0xa48, + 0xa43,0x9d7,0x4007c,0x1f,0x9b3,0x993,0x4003d,0x14a,0xabd,0x14c,0x7005f,0x14f, + 0xabf,0xabd,0x9b3,0x2002,0x105,0x50051,0x6,0xac0,0xabf,0x0,0x4003d,0x14a, + 0xac1,0x154,0x7005f,0x14f,0xac3,0xac1,0x9b3,0x2002,0x105,0x50051,0x6,0xac4, + 0xac3,0x0,0x500c2,0x6,0xace,0xac0,0x250,0x500c7,0x6,0xacf,0xace,0x252, + 0x40070,0x13,0xad0,0xacf,0x50085,0x13,0xad1,0xad0,0x4133,0x500c2,0x6,0xad5, + 0xac0,0x25b,0x500c7,0x6,0xad6,0xad5,0x25d,0x40070,0x13,0xad7,0xad6,0x50085, + 0x13,0xad8,0xad7,0x4134,0x500c7,0x6,0xb01,0xac0,0x249,0x500ba,0x47,0xae0, + 0xad1,0x1e9,0x300f7,0xae8,0x0,0x400fa,0xae0,0xae4,0xae8,0x200f8,0xae4,0x500aa, + 0x47,0xae7,0xb01,0x151,0x200f9,0xae8,0x200f8,0xae8,0x700f5,0x47,0xae9,0xae0, + 0xa82,0xae7,0xae4,0x300f7,0xaf2,0x0,0x400fa,0xae9,0xaed,0xaf2,0x200f8,0xaed, + 0x50083,0x13,0xaf0,0x27d,0xad1,0x200f9,0xaf2,0x200f8,0xaf2,0x700f5,0x13,0x2d42, + 0xad1,0xae8,0xaf0,0xaed,0x6000c,0x14,0xb06,0x1,0x3e,0xac0,0x50051,0x13, + 0xaf6,0xb06,0x0,0x6000c,0x14,0xb0a,0x1,0x3e,0xac4,0x50051,0x13,0xafb, + 0xb0a,0x0,0x70050,0x3a,0xab3,0xaf6,0xafb,0x2d42,0xad8,0x5008e,0x3a,0xab8, + 0xab3,0x9d7,0x4007c,0x1f,0x9b7,0x995,0x4003d,0x14a,0xb2d,0x14c,0x7005f,0x14f, + 0xb2f,0xb2d,0x9b7,0x2002,0x105,0x50051,0x6,0xb30,0xb2f,0x0,0x4003d,0x14a, + 0xb31,0x154,0x7005f,0x14f,0xb33,0xb31,0x9b7,0x2002,0x105,0x50051,0x6,0xb34, + 0xb33,0x0,0x500c2,0x6,0xb3e,0xb30,0x250,0x500c7,0x6,0xb3f,0xb3e,0x252, + 0x40070,0x13,0xb40,0xb3f,0x50085,0x13,0xb41,0xb40,0x4133,0x500c2,0x6,0xb45, + 0xb30,0x25b,0x500c7,0x6,0xb46,0xb45,0x25d,0x40070,0x13,0xb47,0xb46,0x50085, + 0x13,0xb48,0xb47,0x4134,0x500c7,0x6,0xb71,0xb30,0x249,0x500ba,0x47,0xb50, + 0xb41,0x1e9,0x300f7,0xb58,0x0,0x400fa,0xb50,0xb54,0xb58,0x200f8,0xb54,0x500aa, + 0x47,0xb57,0xb71,0x151,0x200f9,0xb58,0x200f8,0xb58,0x700f5,0x47,0xb59,0xb50, + 0xaf2,0xb57,0xb54,0x300f7,0xb62,0x0,0x400fa,0xb59,0xb5d,0xb62,0x200f8,0xb5d, + 0x50083,0x13,0xb60,0x27d,0xb41,0x200f9,0xb62,0x200f8,0xb62,0x700f5,0x13,0x2d53, + 0xb41,0xb58,0xb60,0xb5d,0x6000c,0x14,0xb76,0x1,0x3e,0xb30,0x50051,0x13, + 0xb66,0xb76,0x0,0x6000c,0x14,0xb7a,0x1,0x3e,0xb34,0x50051,0x13,0xb6b, + 0xb7a,0x0,0x70050,0x3a,0xb23,0xb66,0xb6b,0x2d53,0xb48,0x5008e,0x3a,0xb28, + 0xb23,0x9d7,0x50051,0x13,0xb88,0x9d8,0x2,0x500ba,0x47,0xb89,0xb88,0x1e9, + 0x600a9,0x13,0xb8a,0xb89,0x27d,0x1e9,0x5008e,0x3a,0xb8d,0x9d8,0xb8a,0x50051, + 0x13,0xb94,0xa48,0x2,0x500ba,0x47,0xb95,0xb94,0x1e9,0x600a9,0x13,0xb96, + 0xb95,0x27d,0x1e9,0x5008e,0x3a,0xb99,0xa48,0xb96,0x50081,0x3a,0xb9b,0xb8d, + 0xb99,0x50081,0x13,0xb9e,0xb8a,0xb96,0x50051,0x13,0xba0,0xab8,0x2,0x500ba, + 0x47,0xba1,0xba0,0x1e9,0x600a9,0x13,0xba2,0xba1,0x27d,0x1e9,0x5008e,0x3a, + 0xba5,0xab8,0xba2,0x50081,0x3a,0xba7,0xb9b,0xba5,0x50081,0x13,0xbaa,0xb9e, + 0xba2,0x50051,0x13,0xbac,0xb28,0x2,0x500ba,0x47,0xbad,0xbac,0x1e9,0x600a9, + 0x13,0xbae,0xbad,0x27d,0x1e9,0x5008e,0x3a,0xbb1,0xb28,0xbae,0x50081,0x3a, + 0xbb3,0xba7,0xbb1,0x50081,0x13,0xbb6,0xbaa,0xbae,0x500ba,0x47,0xbb8,0xbb6, + 0x32b,0x600a9,0x13,0xbba,0xbb8,0xbb6,0x27d,0x70050,0x3a,0xbbc,0xbba,0xbba, + 0xbba,0xbba,0x50088,0x3a,0xbbd,0xbb3,0xbbc,0x4003d,0x16d,0xbcb,0x16f,0x40063, + 0xbcb,0x896,0xbbd,0x50080,0x6,0x8a7,0x886,0x3e1,0x4007c,0x1e,0x8a8,0x8a7, + 0x50050,0x1f,0x8ac,0x8a8,0x88a,0x50080,0x1f,0x8ad,0x884,0x8ac,0x50080,0x6, + 0x8b3,0x7c7,0x25b,0x4007c,0x1e,0x8b4,0x8b3,0x50050,0x1f,0x8b7,0x8b4,0x894, + 0x50080,0x1f,0x8b8,0x890,0x8b7,0x4007c,0x19,0x8ba,0x8ad,0x50080,0x19,0xc2d, + 0x8ba,0x388,0x50080,0x19,0xc2f,0x8ba,0x38b,0x50080,0x19,0xc31,0x8ba,0x38e, + 0x4003d,0x14a,0xc79,0x14c,0x7005f,0x14f,0xc7b,0xc79,0x8ad,0x2002,0x105,0x50051, + 0x6,0xc7c,0xc7b,0x0,0x4003d,0x14a,0xc7d,0x154,0x7005f,0x14f,0xc7f,0xc7d, + 0x8ad,0x2002,0x105,0x50051,0x6,0xc80,0xc7f,0x0,0x500c2,0x6,0xc8a,0xc7c, + 0x250,0x500c7,0x6,0xc8b,0xc8a,0x252,0x40070,0x13,0xc8c,0xc8b,0x50085,0x13, + 0xc8d,0xc8c,0x4133,0x500c2,0x6,0xc91,0xc7c,0x25b,0x500c7,0x6,0xc92,0xc91, + 0x25d,0x40070,0x13,0xc93,0xc92,0x50085,0x13,0xc94,0xc93,0x4134,0x500c7,0x6, + 0xcbd,0xc7c,0x249,0x500ba,0x47,0xc9c,0xc8d,0x1e9,0x300f7,0xca4,0x0,0x400fa, + 0xc9c,0xca0,0xca4,0x200f8,0xca0,0x500aa,0x47,0xca3,0xcbd,0x151,0x200f9,0xca4, + 0x200f8,0xca4,0x700f5,0x47,0xca5,0xc9c,0xb62,0xca3,0xca0,0x300f7,0xcae,0x0, + 0x400fa,0xca5,0xca9,0xcae,0x200f8,0xca9,0x50083,0x13,0xcac,0x27d,0xc8d,0x200f9, + 0xcae,0x200f8,0xcae,0x700f5,0x13,0x2de8,0xc8d,0xca4,0xcac,0xca9,0x6000c,0x14, + 0xcc2,0x1,0x3e,0xc7c,0x50051,0x13,0xcb2,0xcc2,0x0,0x6000c,0x14,0xcc6, + 0x1,0x3e,0xc80,0x50051,0x13,0xcb7,0xcc6,0x0,0x70050,0x3a,0xc6f,0xcb2, + 0xcb7,0x2de8,0xc94,0x5008e,0x3a,0xc74,0xc6f,0x9d7,0x4007c,0x1f,0xc4b,0xc2d, + 0x4003d,0x14a,0xce9,0x14c,0x7005f,0x14f,0xceb,0xce9,0xc4b,0x2002,0x105,0x50051, + 0x6,0xcec,0xceb,0x0,0x4003d,0x14a,0xced,0x154,0x7005f,0x14f,0xcef,0xced, + 0xc4b,0x2002,0x105,0x50051,0x6,0xcf0,0xcef,0x0,0x500c2,0x6,0xcfa,0xcec, + 0x250,0x500c7,0x6,0xcfb,0xcfa,0x252,0x40070,0x13,0xcfc,0xcfb,0x50085,0x13, + 0xcfd,0xcfc,0x4133,0x500c2,0x6,0xd01,0xcec,0x25b,0x500c7,0x6,0xd02,0xd01, + 0x25d,0x40070,0x13,0xd03,0xd02,0x50085,0x13,0xd04,0xd03,0x4134,0x500c7,0x6, + 0xd2d,0xcec,0x249,0x500ba,0x47,0xd0c,0xcfd,0x1e9,0x300f7,0xd14,0x0,0x400fa, + 0xd0c,0xd10,0xd14,0x200f8,0xd10,0x500aa,0x47,0xd13,0xd2d,0x151,0x200f9,0xd14, + 0x200f8,0xd14,0x700f5,0x47,0xd15,0xd0c,0xcae,0xd13,0xd10,0x300f7,0xd1e,0x0, + 0x400fa,0xd15,0xd19,0xd1e,0x200f8,0xd19,0x50083,0x13,0xd1c,0x27d,0xcfd,0x200f9, + 0xd1e,0x200f8,0xd1e,0x700f5,0x13,0x2df5,0xcfd,0xd14,0xd1c,0xd19,0x6000c,0x14, + 0xd32,0x1,0x3e,0xcec,0x50051,0x13,0xd22,0xd32,0x0,0x6000c,0x14,0xd36, + 0x1,0x3e,0xcf0,0x50051,0x13,0xd27,0xd36,0x0,0x70050,0x3a,0xcdf,0xd22, + 0xd27,0x2df5,0xd04,0x5008e,0x3a,0xce4,0xcdf,0x9d7,0x4007c,0x1f,0xc4f,0xc2f, + 0x4003d,0x14a,0xd59,0x14c,0x7005f,0x14f,0xd5b,0xd59,0xc4f,0x2002,0x105,0x50051, + 0x6,0xd5c,0xd5b,0x0,0x4003d,0x14a,0xd5d,0x154,0x7005f,0x14f,0xd5f,0xd5d, + 0xc4f,0x2002,0x105,0x50051,0x6,0xd60,0xd5f,0x0,0x500c2,0x6,0xd6a,0xd5c, + 0x250,0x500c7,0x6,0xd6b,0xd6a,0x252,0x40070,0x13,0xd6c,0xd6b,0x50085,0x13, + 0xd6d,0xd6c,0x4133,0x500c2,0x6,0xd71,0xd5c,0x25b,0x500c7,0x6,0xd72,0xd71, + 0x25d,0x40070,0x13,0xd73,0xd72,0x50085,0x13,0xd74,0xd73,0x4134,0x500c7,0x6, + 0xd9d,0xd5c,0x249,0x500ba,0x47,0xd7c,0xd6d,0x1e9,0x300f7,0xd84,0x0,0x400fa, + 0xd7c,0xd80,0xd84,0x200f8,0xd80,0x500aa,0x47,0xd83,0xd9d,0x151,0x200f9,0xd84, + 0x200f8,0xd84,0x700f5,0x47,0xd85,0xd7c,0xd1e,0xd83,0xd80,0x300f7,0xd8e,0x0, + 0x400fa,0xd85,0xd89,0xd8e,0x200f8,0xd89,0x50083,0x13,0xd8c,0x27d,0xd6d,0x200f9, + 0xd8e,0x200f8,0xd8e,0x700f5,0x13,0x2e04,0xd6d,0xd84,0xd8c,0xd89,0x6000c,0x14, + 0xda2,0x1,0x3e,0xd5c,0x50051,0x13,0xd92,0xda2,0x0,0x6000c,0x14,0xda6, + 0x1,0x3e,0xd60,0x50051,0x13,0xd97,0xda6,0x0,0x70050,0x3a,0xd4f,0xd92, + 0xd97,0x2e04,0xd74,0x5008e,0x3a,0xd54,0xd4f,0x9d7,0x4007c,0x1f,0xc53,0xc31, + 0x4003d,0x14a,0xdc9,0x14c,0x7005f,0x14f,0xdcb,0xdc9,0xc53,0x2002,0x105,0x50051, + 0x6,0xdcc,0xdcb,0x0,0x4003d,0x14a,0xdcd,0x154,0x7005f,0x14f,0xdcf,0xdcd, + 0xc53,0x2002,0x105,0x50051,0x6,0xdd0,0xdcf,0x0,0x500c2,0x6,0xdda,0xdcc, + 0x250,0x500c7,0x6,0xddb,0xdda,0x252,0x40070,0x13,0xddc,0xddb,0x50085,0x13, + 0xddd,0xddc,0x4133,0x500c2,0x6,0xde1,0xdcc,0x25b,0x500c7,0x6,0xde2,0xde1, + 0x25d,0x40070,0x13,0xde3,0xde2,0x50085,0x13,0xde4,0xde3,0x4134,0x500c7,0x6, + 0xe0d,0xdcc,0x249,0x500ba,0x47,0xdec,0xddd,0x1e9,0x300f7,0xdf4,0x0,0x400fa, + 0xdec,0xdf0,0xdf4,0x200f8,0xdf0,0x500aa,0x47,0xdf3,0xe0d,0x151,0x200f9,0xdf4, + 0x200f8,0xdf4,0x700f5,0x47,0xdf5,0xdec,0xd8e,0xdf3,0xdf0,0x300f7,0xdfe,0x0, + 0x400fa,0xdf5,0xdf9,0xdfe,0x200f8,0xdf9,0x50083,0x13,0xdfc,0x27d,0xddd,0x200f9, + 0xdfe,0x200f8,0xdfe,0x700f5,0x13,0x2e15,0xddd,0xdf4,0xdfc,0xdf9,0x6000c,0x14, + 0xe12,0x1,0x3e,0xdcc,0x50051,0x13,0xe02,0xe12,0x0,0x6000c,0x14,0xe16, + 0x1,0x3e,0xdd0,0x50051,0x13,0xe07,0xe16,0x0,0x70050,0x3a,0xdbf,0xe02, + 0xe07,0x2e15,0xde4,0x5008e,0x3a,0xdc4,0xdbf,0x9d7,0x50051,0x13,0xe24,0xc74, + 0x2,0x500ba,0x47,0xe25,0xe24,0x1e9,0x600a9,0x13,0xe26,0xe25,0x27d,0x1e9, + 0x5008e,0x3a,0xe29,0xc74,0xe26,0x50051,0x13,0xe30,0xce4,0x2,0x500ba,0x47, + 0xe31,0xe30,0x1e9,0x600a9,0x13,0xe32,0xe31,0x27d,0x1e9,0x5008e,0x3a,0xe35, + 0xce4,0xe32,0x50081,0x3a,0xe37,0xe29,0xe35,0x50081,0x13,0xe3a,0xe26,0xe32, + 0x50051,0x13,0xe3c,0xd54,0x2,0x500ba,0x47,0xe3d,0xe3c,0x1e9,0x600a9,0x13, + 0xe3e,0xe3d,0x27d,0x1e9,0x5008e,0x3a,0xe41,0xd54,0xe3e,0x50081,0x3a,0xe43, + 0xe37,0xe41,0x50081,0x13,0xe46,0xe3a,0xe3e,0x50051,0x13,0xe48,0xdc4,0x2, + 0x500ba,0x47,0xe49,0xe48,0x1e9,0x600a9,0x13,0xe4a,0xe49,0x27d,0x1e9,0x5008e, + 0x3a,0xe4d,0xdc4,0xe4a,0x50081,0x3a,0xe4f,0xe43,0xe4d,0x50081,0x13,0xe52, + 0xe46,0xe4a,0x500ba,0x47,0xe54,0xe52,0x32b,0x600a9,0x13,0xe56,0xe54,0xe52, + 0x27d,0x70050,0x3a,0xe58,0xe56,0xe56,0xe56,0xe56,0x50088,0x3a,0xe59,0xe4f, + 0xe58,0x4003d,0x16d,0xe67,0x16f,0x40063,0xe67,0x8b8,0xe59,0x50080,0x6,0x8cc, + 0x889,0x3e1,0x4007c,0x1e,0x8cd,0x8cc,0x50050,0x1f,0x8ce,0x887,0x8cd,0x50080, + 0x1f,0x8cf,0x884,0x8ce,0x50080,0x6,0x8d7,0x7cd,0x25b,0x4007c,0x1e,0x8d8, + 0x8d7,0x50050,0x1f,0x8d9,0x892,0x8d8,0x50080,0x1f,0x8da,0x890,0x8d9,0x4007c, + 0x19,0x8dc,0x8cf,0x50080,0x19,0xec9,0x8dc,0x388,0x50080,0x19,0xecb,0x8dc, + 0x38b,0x50080,0x19,0xecd,0x8dc,0x38e,0x4003d,0x14a,0xf15,0x14c,0x7005f,0x14f, + 0xf17,0xf15,0x8cf,0x2002,0x105,0x50051,0x6,0xf18,0xf17,0x0,0x4003d,0x14a, + 0xf19,0x154,0x7005f,0x14f,0xf1b,0xf19,0x8cf,0x2002,0x105,0x50051,0x6,0xf1c, + 0xf1b,0x0,0x500c2,0x6,0xf26,0xf18,0x250,0x500c7,0x6,0xf27,0xf26,0x252, + 0x40070,0x13,0xf28,0xf27,0x50085,0x13,0xf29,0xf28,0x4133,0x500c2,0x6,0xf2d, + 0xf18,0x25b,0x500c7,0x6,0xf2e,0xf2d,0x25d,0x40070,0x13,0xf2f,0xf2e,0x50085, + 0x13,0xf30,0xf2f,0x4134,0x500c7,0x6,0xf59,0xf18,0x249,0x500ba,0x47,0xf38, + 0xf29,0x1e9,0x300f7,0xf40,0x0,0x400fa,0xf38,0xf3c,0xf40,0x200f8,0xf3c,0x500aa, + 0x47,0xf3f,0xf59,0x151,0x200f9,0xf40,0x200f8,0xf40,0x700f5,0x47,0xf41,0xf38, + 0xdfe,0xf3f,0xf3c,0x300f7,0xf4a,0x0,0x400fa,0xf41,0xf45,0xf4a,0x200f8,0xf45, + 0x50083,0x13,0xf48,0x27d,0xf29,0x200f9,0xf4a,0x200f8,0xf4a,0x700f5,0x13,0x2eaa, + 0xf29,0xf40,0xf48,0xf45,0x6000c,0x14,0xf5e,0x1,0x3e,0xf18,0x50051,0x13, + 0xf4e,0xf5e,0x0,0x6000c,0x14,0xf62,0x1,0x3e,0xf1c,0x50051,0x13,0xf53, + 0xf62,0x0,0x70050,0x3a,0xf0b,0xf4e,0xf53,0x2eaa,0xf30,0x5008e,0x3a,0xf10, + 0xf0b,0x9d7,0x4007c,0x1f,0xee7,0xec9,0x4003d,0x14a,0xf85,0x14c,0x7005f,0x14f, + 0xf87,0xf85,0xee7,0x2002,0x105,0x50051,0x6,0xf88,0xf87,0x0,0x4003d,0x14a, + 0xf89,0x154,0x7005f,0x14f,0xf8b,0xf89,0xee7,0x2002,0x105,0x50051,0x6,0xf8c, + 0xf8b,0x0,0x500c2,0x6,0xf96,0xf88,0x250,0x500c7,0x6,0xf97,0xf96,0x252, + 0x40070,0x13,0xf98,0xf97,0x50085,0x13,0xf99,0xf98,0x4133,0x500c2,0x6,0xf9d, + 0xf88,0x25b,0x500c7,0x6,0xf9e,0xf9d,0x25d,0x40070,0x13,0xf9f,0xf9e,0x50085, + 0x13,0xfa0,0xf9f,0x4134,0x500c7,0x6,0xfc9,0xf88,0x249,0x500ba,0x47,0xfa8, + 0xf99,0x1e9,0x300f7,0xfb0,0x0,0x400fa,0xfa8,0xfac,0xfb0,0x200f8,0xfac,0x500aa, + 0x47,0xfaf,0xfc9,0x151,0x200f9,0xfb0,0x200f8,0xfb0,0x700f5,0x47,0xfb1,0xfa8, + 0xf4a,0xfaf,0xfac,0x300f7,0xfba,0x0,0x400fa,0xfb1,0xfb5,0xfba,0x200f8,0xfb5, + 0x50083,0x13,0xfb8,0x27d,0xf99,0x200f9,0xfba,0x200f8,0xfba,0x700f5,0x13,0x2eb7, + 0xf99,0xfb0,0xfb8,0xfb5,0x6000c,0x14,0xfce,0x1,0x3e,0xf88,0x50051,0x13, + 0xfbe,0xfce,0x0,0x6000c,0x14,0xfd2,0x1,0x3e,0xf8c,0x50051,0x13,0xfc3, + 0xfd2,0x0,0x70050,0x3a,0xf7b,0xfbe,0xfc3,0x2eb7,0xfa0,0x5008e,0x3a,0xf80, + 0xf7b,0x9d7,0x4007c,0x1f,0xeeb,0xecb,0x4003d,0x14a,0xff5,0x14c,0x7005f,0x14f, + 0xff7,0xff5,0xeeb,0x2002,0x105,0x50051,0x6,0xff8,0xff7,0x0,0x4003d,0x14a, + 0xff9,0x154,0x7005f,0x14f,0xffb,0xff9,0xeeb,0x2002,0x105,0x50051,0x6,0xffc, + 0xffb,0x0,0x500c2,0x6,0x1006,0xff8,0x250,0x500c7,0x6,0x1007,0x1006,0x252, + 0x40070,0x13,0x1008,0x1007,0x50085,0x13,0x1009,0x1008,0x4133,0x500c2,0x6,0x100d, + 0xff8,0x25b,0x500c7,0x6,0x100e,0x100d,0x25d,0x40070,0x13,0x100f,0x100e,0x50085, + 0x13,0x1010,0x100f,0x4134,0x500c7,0x6,0x1039,0xff8,0x249,0x500ba,0x47,0x1018, + 0x1009,0x1e9,0x300f7,0x1020,0x0,0x400fa,0x1018,0x101c,0x1020,0x200f8,0x101c,0x500aa, + 0x47,0x101f,0x1039,0x151,0x200f9,0x1020,0x200f8,0x1020,0x700f5,0x47,0x1021,0x1018, + 0xfba,0x101f,0x101c,0x300f7,0x102a,0x0,0x400fa,0x1021,0x1025,0x102a,0x200f8,0x1025, + 0x50083,0x13,0x1028,0x27d,0x1009,0x200f9,0x102a,0x200f8,0x102a,0x700f5,0x13,0x2ec6, + 0x1009,0x1020,0x1028,0x1025,0x6000c,0x14,0x103e,0x1,0x3e,0xff8,0x50051,0x13, + 0x102e,0x103e,0x0,0x6000c,0x14,0x1042,0x1,0x3e,0xffc,0x50051,0x13,0x1033, + 0x1042,0x0,0x70050,0x3a,0xfeb,0x102e,0x1033,0x2ec6,0x1010,0x5008e,0x3a,0xff0, + 0xfeb,0x9d7,0x4007c,0x1f,0xeef,0xecd,0x4003d,0x14a,0x1065,0x14c,0x7005f,0x14f, + 0x1067,0x1065,0xeef,0x2002,0x105,0x50051,0x6,0x1068,0x1067,0x0,0x4003d,0x14a, + 0x1069,0x154,0x7005f,0x14f,0x106b,0x1069,0xeef,0x2002,0x105,0x50051,0x6,0x106c, + 0x106b,0x0,0x500c2,0x6,0x1076,0x1068,0x250,0x500c7,0x6,0x1077,0x1076,0x252, + 0x40070,0x13,0x1078,0x1077,0x50085,0x13,0x1079,0x1078,0x4133,0x500c2,0x6,0x107d, + 0x1068,0x25b,0x500c7,0x6,0x107e,0x107d,0x25d,0x40070,0x13,0x107f,0x107e,0x50085, + 0x13,0x1080,0x107f,0x4134,0x500c7,0x6,0x10a9,0x1068,0x249,0x500ba,0x47,0x1088, + 0x1079,0x1e9,0x300f7,0x1090,0x0,0x400fa,0x1088,0x108c,0x1090,0x200f8,0x108c,0x500aa, + 0x47,0x108f,0x10a9,0x151,0x200f9,0x1090,0x200f8,0x1090,0x700f5,0x47,0x1091,0x1088, + 0x102a,0x108f,0x108c,0x300f7,0x109a,0x0,0x400fa,0x1091,0x1095,0x109a,0x200f8,0x1095, + 0x50083,0x13,0x1098,0x27d,0x1079,0x200f9,0x109a,0x200f8,0x109a,0x700f5,0x13,0x2ed7, + 0x1079,0x1090,0x1098,0x1095,0x6000c,0x14,0x10ae,0x1,0x3e,0x1068,0x50051,0x13, + 0x109e,0x10ae,0x0,0x6000c,0x14,0x10b2,0x1,0x3e,0x106c,0x50051,0x13,0x10a3, + 0x10b2,0x0,0x70050,0x3a,0x105b,0x109e,0x10a3,0x2ed7,0x1080,0x5008e,0x3a,0x1060, + 0x105b,0x9d7,0x50051,0x13,0x10c0,0xf10,0x2,0x500ba,0x47,0x10c1,0x10c0,0x1e9, + 0x600a9,0x13,0x10c2,0x10c1,0x27d,0x1e9,0x5008e,0x3a,0x10c5,0xf10,0x10c2,0x50051, + 0x13,0x10cc,0xf80,0x2,0x500ba,0x47,0x10cd,0x10cc,0x1e9,0x600a9,0x13,0x10ce, + 0x10cd,0x27d,0x1e9,0x5008e,0x3a,0x10d1,0xf80,0x10ce,0x50081,0x3a,0x10d3,0x10c5, + 0x10d1,0x50081,0x13,0x10d6,0x10c2,0x10ce,0x50051,0x13,0x10d8,0xff0,0x2,0x500ba, + 0x47,0x10d9,0x10d8,0x1e9,0x600a9,0x13,0x10da,0x10d9,0x27d,0x1e9,0x5008e,0x3a, + 0x10dd,0xff0,0x10da,0x50081,0x3a,0x10df,0x10d3,0x10dd,0x50081,0x13,0x10e2,0x10d6, + 0x10da,0x50051,0x13,0x10e4,0x1060,0x2,0x500ba,0x47,0x10e5,0x10e4,0x1e9,0x600a9, + 0x13,0x10e6,0x10e5,0x27d,0x1e9,0x5008e,0x3a,0x10e9,0x1060,0x10e6,0x50081,0x3a, + 0x10eb,0x10df,0x10e9,0x50081,0x13,0x10ee,0x10e2,0x10e6,0x500ba,0x47,0x10f0,0x10ee, + 0x32b,0x600a9,0x13,0x10f2,0x10f0,0x10ee,0x27d,0x70050,0x3a,0x10f4,0x10f2,0x10f2, + 0x10f2,0x10f2,0x50088,0x3a,0x10f5,0x10eb,0x10f4,0x4003d,0x16d,0x1103,0x16f,0x40063, + 0x1103,0x8da,0x10f5,0x50050,0x1f,0x8f1,0x8a8,0x8cd,0x50080,0x1f,0x8f2,0x884, + 0x8f1,0x50050,0x1f,0x8fd,0x8b4,0x8d8,0x50080,0x1f,0x8fe,0x890,0x8fd,0x4007c, + 0x19,0x900,0x8f2,0x50080,0x19,0x1165,0x900,0x388,0x50080,0x19,0x1167,0x900, + 0x38b,0x50080,0x19,0x1169,0x900,0x38e,0x4003d,0x14a,0x11b1,0x14c,0x7005f,0x14f, + 0x11b3,0x11b1,0x8f2,0x2002,0x105,0x50051,0x6,0x11b4,0x11b3,0x0,0x4003d,0x14a, + 0x11b5,0x154,0x7005f,0x14f,0x11b7,0x11b5,0x8f2,0x2002,0x105,0x50051,0x6,0x11b8, + 0x11b7,0x0,0x500c2,0x6,0x11c2,0x11b4,0x250,0x500c7,0x6,0x11c3,0x11c2,0x252, + 0x40070,0x13,0x11c4,0x11c3,0x50085,0x13,0x11c5,0x11c4,0x4133,0x500c2,0x6,0x11c9, + 0x11b4,0x25b,0x500c7,0x6,0x11ca,0x11c9,0x25d,0x40070,0x13,0x11cb,0x11ca,0x50085, + 0x13,0x11cc,0x11cb,0x4134,0x500c7,0x6,0x11f5,0x11b4,0x249,0x500ba,0x47,0x11d4, + 0x11c5,0x1e9,0x300f7,0x11dc,0x0,0x400fa,0x11d4,0x11d8,0x11dc,0x200f8,0x11d8,0x500aa, + 0x47,0x11db,0x11f5,0x151,0x200f9,0x11dc,0x200f8,0x11dc,0x700f5,0x47,0x11dd,0x11d4, + 0x109a,0x11db,0x11d8,0x300f7,0x11e6,0x0,0x400fa,0x11dd,0x11e1,0x11e6,0x200f8,0x11e1, + 0x50083,0x13,0x11e4,0x27d,0x11c5,0x200f9,0x11e6,0x200f8,0x11e6,0x700f5,0x13,0x2f6c, + 0x11c5,0x11dc,0x11e4,0x11e1,0x6000c,0x14,0x11fa,0x1,0x3e,0x11b4,0x50051,0x13, + 0x11ea,0x11fa,0x0,0x6000c,0x14,0x11fe,0x1,0x3e,0x11b8,0x50051,0x13,0x11ef, + 0x11fe,0x0,0x70050,0x3a,0x11a7,0x11ea,0x11ef,0x2f6c,0x11cc,0x5008e,0x3a,0x11ac, + 0x11a7,0x9d7,0x4007c,0x1f,0x1183,0x1165,0x4003d,0x14a,0x1221,0x14c,0x7005f,0x14f, + 0x1223,0x1221,0x1183,0x2002,0x105,0x50051,0x6,0x1224,0x1223,0x0,0x4003d,0x14a, + 0x1225,0x154,0x7005f,0x14f,0x1227,0x1225,0x1183,0x2002,0x105,0x50051,0x6,0x1228, + 0x1227,0x0,0x500c2,0x6,0x1232,0x1224,0x250,0x500c7,0x6,0x1233,0x1232,0x252, + 0x40070,0x13,0x1234,0x1233,0x50085,0x13,0x1235,0x1234,0x4133,0x500c2,0x6,0x1239, + 0x1224,0x25b,0x500c7,0x6,0x123a,0x1239,0x25d,0x40070,0x13,0x123b,0x123a,0x50085, + 0x13,0x123c,0x123b,0x4134,0x500c7,0x6,0x1265,0x1224,0x249,0x500ba,0x47,0x1244, + 0x1235,0x1e9,0x300f7,0x124c,0x0,0x400fa,0x1244,0x1248,0x124c,0x200f8,0x1248,0x500aa, + 0x47,0x124b,0x1265,0x151,0x200f9,0x124c,0x200f8,0x124c,0x700f5,0x47,0x124d,0x1244, + 0x11e6,0x124b,0x1248,0x300f7,0x1256,0x0,0x400fa,0x124d,0x1251,0x1256,0x200f8,0x1251, + 0x50083,0x13,0x1254,0x27d,0x1235,0x200f9,0x1256,0x200f8,0x1256,0x700f5,0x13,0x2f79, + 0x1235,0x124c,0x1254,0x1251,0x6000c,0x14,0x126a,0x1,0x3e,0x1224,0x50051,0x13, + 0x125a,0x126a,0x0,0x6000c,0x14,0x126e,0x1,0x3e,0x1228,0x50051,0x13,0x125f, + 0x126e,0x0,0x70050,0x3a,0x1217,0x125a,0x125f,0x2f79,0x123c,0x5008e,0x3a,0x121c, + 0x1217,0x9d7,0x4007c,0x1f,0x1187,0x1167,0x4003d,0x14a,0x1291,0x14c,0x7005f,0x14f, + 0x1293,0x1291,0x1187,0x2002,0x105,0x50051,0x6,0x1294,0x1293,0x0,0x4003d,0x14a, + 0x1295,0x154,0x7005f,0x14f,0x1297,0x1295,0x1187,0x2002,0x105,0x50051,0x6,0x1298, + 0x1297,0x0,0x500c2,0x6,0x12a2,0x1294,0x250,0x500c7,0x6,0x12a3,0x12a2,0x252, + 0x40070,0x13,0x12a4,0x12a3,0x50085,0x13,0x12a5,0x12a4,0x4133,0x500c2,0x6,0x12a9, + 0x1294,0x25b,0x500c7,0x6,0x12aa,0x12a9,0x25d,0x40070,0x13,0x12ab,0x12aa,0x50085, + 0x13,0x12ac,0x12ab,0x4134,0x500c7,0x6,0x12d5,0x1294,0x249,0x500ba,0x47,0x12b4, + 0x12a5,0x1e9,0x300f7,0x12bc,0x0,0x400fa,0x12b4,0x12b8,0x12bc,0x200f8,0x12b8,0x500aa, + 0x47,0x12bb,0x12d5,0x151,0x200f9,0x12bc,0x200f8,0x12bc,0x700f5,0x47,0x12bd,0x12b4, + 0x1256,0x12bb,0x12b8,0x300f7,0x12c6,0x0,0x400fa,0x12bd,0x12c1,0x12c6,0x200f8,0x12c1, + 0x50083,0x13,0x12c4,0x27d,0x12a5,0x200f9,0x12c6,0x200f8,0x12c6,0x700f5,0x13,0x2f88, + 0x12a5,0x12bc,0x12c4,0x12c1,0x6000c,0x14,0x12da,0x1,0x3e,0x1294,0x50051,0x13, + 0x12ca,0x12da,0x0,0x6000c,0x14,0x12de,0x1,0x3e,0x1298,0x50051,0x13,0x12cf, + 0x12de,0x0,0x70050,0x3a,0x1287,0x12ca,0x12cf,0x2f88,0x12ac,0x5008e,0x3a,0x128c, + 0x1287,0x9d7,0x4007c,0x1f,0x118b,0x1169,0x4003d,0x14a,0x1301,0x14c,0x7005f,0x14f, + 0x1303,0x1301,0x118b,0x2002,0x105,0x50051,0x6,0x1304,0x1303,0x0,0x4003d,0x14a, + 0x1305,0x154,0x7005f,0x14f,0x1307,0x1305,0x118b,0x2002,0x105,0x50051,0x6,0x1308, + 0x1307,0x0,0x500c2,0x6,0x1312,0x1304,0x250,0x500c7,0x6,0x1313,0x1312,0x252, + 0x40070,0x13,0x1314,0x1313,0x50085,0x13,0x1315,0x1314,0x4133,0x500c2,0x6,0x1319, + 0x1304,0x25b,0x500c7,0x6,0x131a,0x1319,0x25d,0x40070,0x13,0x131b,0x131a,0x50085, + 0x13,0x131c,0x131b,0x4134,0x500c7,0x6,0x1345,0x1304,0x249,0x500ba,0x47,0x1324, + 0x1315,0x1e9,0x300f7,0x132c,0x0,0x400fa,0x1324,0x1328,0x132c,0x200f8,0x1328,0x500aa, + 0x47,0x132b,0x1345,0x151,0x200f9,0x132c,0x200f8,0x132c,0x700f5,0x47,0x132d,0x1324, + 0x12c6,0x132b,0x1328,0x300f7,0x1336,0x0,0x400fa,0x132d,0x1331,0x1336,0x200f8,0x1331, + 0x50083,0x13,0x1334,0x27d,0x1315,0x200f9,0x1336,0x200f8,0x1336,0x700f5,0x13,0x2f99, + 0x1315,0x132c,0x1334,0x1331,0x6000c,0x14,0x134a,0x1,0x3e,0x1304,0x50051,0x13, + 0x133a,0x134a,0x0,0x6000c,0x14,0x134e,0x1,0x3e,0x1308,0x50051,0x13,0x133f, + 0x134e,0x0,0x70050,0x3a,0x12f7,0x133a,0x133f,0x2f99,0x131c,0x5008e,0x3a,0x12fc, + 0x12f7,0x9d7,0x50051,0x13,0x135c,0x11ac,0x2,0x500ba,0x47,0x135d,0x135c,0x1e9, + 0x600a9,0x13,0x135e,0x135d,0x27d,0x1e9,0x5008e,0x3a,0x1361,0x11ac,0x135e,0x50051, + 0x13,0x1368,0x121c,0x2,0x500ba,0x47,0x1369,0x1368,0x1e9,0x600a9,0x13,0x136a, + 0x1369,0x27d,0x1e9,0x5008e,0x3a,0x136d,0x121c,0x136a,0x50081,0x3a,0x136f,0x1361, + 0x136d,0x50081,0x13,0x1372,0x135e,0x136a,0x50051,0x13,0x1374,0x128c,0x2,0x500ba, + 0x47,0x1375,0x1374,0x1e9,0x600a9,0x13,0x1376,0x1375,0x27d,0x1e9,0x5008e,0x3a, + 0x1379,0x128c,0x1376,0x50081,0x3a,0x137b,0x136f,0x1379,0x50081,0x13,0x137e,0x1372, + 0x1376,0x50051,0x13,0x1380,0x12fc,0x2,0x500ba,0x47,0x1381,0x1380,0x1e9,0x600a9, + 0x13,0x1382,0x1381,0x27d,0x1e9,0x5008e,0x3a,0x1385,0x12fc,0x1382,0x50081,0x3a, + 0x1387,0x137b,0x1385,0x50081,0x13,0x138a,0x137e,0x1382,0x500ba,0x47,0x138c,0x138a, + 0x32b,0x600a9,0x13,0x138e,0x138c,0x138a,0x27d,0x70050,0x3a,0x1390,0x138e,0x138e, + 0x138e,0x138e,0x50088,0x3a,0x1391,0x1387,0x1390,0x4003d,0x16d,0x139f,0x16f,0x40063, + 0x139f,0x8fe,0x1391,0x500b2,0x47,0x90a,0x784,0x116,0x300f7,0x90c,0x0,0x400fa, + 0x90a,0x90b,0x90c,0x200f8,0x90b,0x200f9,0x986,0x200f8,0x90c,0x6016e,0x3a,0x1403, + 0x110,0xbbd,0x151,0x6016e,0x3a,0x1405,0x110,0xbbd,0x116,0x6016e,0x3a,0x1407, + 0x110,0xbbd,0x10f,0x50051,0x13,0x1416,0xbbd,0x2,0x500ba,0x47,0x1417,0x1416, + 0x1e9,0x600a9,0x13,0x1418,0x1417,0x27d,0x1e9,0x5008e,0x3a,0x141b,0xbbd,0x1418, + 0x50051,0x13,0x1422,0x1403,0x2,0x500ba,0x47,0x1423,0x1422,0x1e9,0x600a9,0x13, + 0x1424,0x1423,0x27d,0x1e9,0x5008e,0x3a,0x1427,0x1403,0x1424,0x50081,0x3a,0x1429, + 0x141b,0x1427,0x50081,0x13,0x142c,0x1418,0x1424,0x50051,0x13,0x142e,0x1405,0x2, + 0x500ba,0x47,0x142f,0x142e,0x1e9,0x600a9,0x13,0x1430,0x142f,0x27d,0x1e9,0x5008e, + 0x3a,0x1433,0x1405,0x1430,0x50081,0x3a,0x1435,0x1429,0x1433,0x50081,0x13,0x1438, + 0x142c,0x1430,0x50051,0x13,0x143a,0x1407,0x2,0x500ba,0x47,0x143b,0x143a,0x1e9, + 0x600a9,0x13,0x143c,0x143b,0x27d,0x1e9,0x5008e,0x3a,0x143f,0x1407,0x143c,0x50081, + 0x3a,0x1441,0x1435,0x143f,0x50081,0x13,0x1444,0x1438,0x143c,0x500ba,0x47,0x1446, + 0x1444,0x32b,0x600a9,0x13,0x1448,0x1446,0x1444,0x27d,0x70050,0x3a,0x144a,0x1448, + 0x1448,0x1448,0x1448,0x50088,0x3a,0x144b,0x1441,0x144a,0x6016e,0x3a,0x1459,0x110, + 0xe59,0x151,0x6016e,0x3a,0x145b,0x110,0xe59,0x116,0x6016e,0x3a,0x145d,0x110, + 0xe59,0x10f,0x50051,0x13,0x146c,0xe59,0x2,0x500ba,0x47,0x146d,0x146c,0x1e9, + 0x600a9,0x13,0x146e,0x146d,0x27d,0x1e9,0x5008e,0x3a,0x1471,0xe59,0x146e,0x50051, + 0x13,0x1478,0x1459,0x2,0x500ba,0x47,0x1479,0x1478,0x1e9,0x600a9,0x13,0x147a, + 0x1479,0x27d,0x1e9,0x5008e,0x3a,0x147d,0x1459,0x147a,0x50081,0x3a,0x147f,0x1471, + 0x147d,0x50081,0x13,0x1482,0x146e,0x147a,0x50051,0x13,0x1484,0x145b,0x2,0x500ba, + 0x47,0x1485,0x1484,0x1e9,0x600a9,0x13,0x1486,0x1485,0x27d,0x1e9,0x5008e,0x3a, + 0x1489,0x145b,0x1486,0x50081,0x3a,0x148b,0x147f,0x1489,0x50081,0x13,0x148e,0x1482, + 0x1486,0x50051,0x13,0x1490,0x145d,0x2,0x500ba,0x47,0x1491,0x1490,0x1e9,0x600a9, + 0x13,0x1492,0x1491,0x27d,0x1e9,0x5008e,0x3a,0x1495,0x145d,0x1492,0x50081,0x3a, + 0x1497,0x148b,0x1495,0x50081,0x13,0x149a,0x148e,0x1492,0x500ba,0x47,0x149c,0x149a, + 0x32b,0x600a9,0x13,0x149e,0x149c,0x149a,0x27d,0x70050,0x3a,0x14a0,0x149e,0x149e, + 0x149e,0x149e,0x50088,0x3a,0x14a1,0x1497,0x14a0,0x6016e,0x3a,0x14af,0x110,0x10f5, + 0x151,0x6016e,0x3a,0x14b1,0x110,0x10f5,0x116,0x6016e,0x3a,0x14b3,0x110,0x10f5, + 0x10f,0x50051,0x13,0x14c2,0x10f5,0x2,0x500ba,0x47,0x14c3,0x14c2,0x1e9,0x600a9, + 0x13,0x14c4,0x14c3,0x27d,0x1e9,0x5008e,0x3a,0x14c7,0x10f5,0x14c4,0x50051,0x13, + 0x14ce,0x14af,0x2,0x500ba,0x47,0x14cf,0x14ce,0x1e9,0x600a9,0x13,0x14d0,0x14cf, + 0x27d,0x1e9,0x5008e,0x3a,0x14d3,0x14af,0x14d0,0x50081,0x3a,0x14d5,0x14c7,0x14d3, + 0x50081,0x13,0x14d8,0x14c4,0x14d0,0x50051,0x13,0x14da,0x14b1,0x2,0x500ba,0x47, + 0x14db,0x14da,0x1e9,0x600a9,0x13,0x14dc,0x14db,0x27d,0x1e9,0x5008e,0x3a,0x14df, + 0x14b1,0x14dc,0x50081,0x3a,0x14e1,0x14d5,0x14df,0x50081,0x13,0x14e4,0x14d8,0x14dc, + 0x50051,0x13,0x14e6,0x14b3,0x2,0x500ba,0x47,0x14e7,0x14e6,0x1e9,0x600a9,0x13, + 0x14e8,0x14e7,0x27d,0x1e9,0x5008e,0x3a,0x14eb,0x14b3,0x14e8,0x50081,0x3a,0x14ed, + 0x14e1,0x14eb,0x50081,0x13,0x14f0,0x14e4,0x14e8,0x500ba,0x47,0x14f2,0x14f0,0x32b, + 0x600a9,0x13,0x14f4,0x14f2,0x14f0,0x27d,0x70050,0x3a,0x14f6,0x14f4,0x14f4,0x14f4, + 0x14f4,0x50088,0x3a,0x14f7,0x14ed,0x14f6,0x6016e,0x3a,0x1505,0x110,0x1391,0x151, + 0x6016e,0x3a,0x1507,0x110,0x1391,0x116,0x6016e,0x3a,0x1509,0x110,0x1391,0x10f, + 0x50051,0x13,0x1518,0x1391,0x2,0x500ba,0x47,0x1519,0x1518,0x1e9,0x600a9,0x13, + 0x151a,0x1519,0x27d,0x1e9,0x5008e,0x3a,0x151d,0x1391,0x151a,0x50051,0x13,0x1524, + 0x1505,0x2,0x500ba,0x47,0x1525,0x1524,0x1e9,0x600a9,0x13,0x1526,0x1525,0x27d, + 0x1e9,0x5008e,0x3a,0x1529,0x1505,0x1526,0x50081,0x3a,0x152b,0x151d,0x1529,0x50081, + 0x13,0x152e,0x151a,0x1526,0x50051,0x13,0x1530,0x1507,0x2,0x500ba,0x47,0x1531, + 0x1530,0x1e9,0x600a9,0x13,0x1532,0x1531,0x27d,0x1e9,0x5008e,0x3a,0x1535,0x1507, + 0x1532,0x50081,0x3a,0x1537,0x152b,0x1535,0x50081,0x13,0x153a,0x152e,0x1532,0x50051, + 0x13,0x153c,0x1509,0x2,0x500ba,0x47,0x153d,0x153c,0x1e9,0x600a9,0x13,0x153e, + 0x153d,0x27d,0x1e9,0x5008e,0x3a,0x1541,0x1509,0x153e,0x50081,0x3a,0x1543,0x1537, + 0x1541,0x50081,0x13,0x1546,0x153a,0x153e,0x500ba,0x47,0x1548,0x1546,0x32b,0x600a9, + 0x13,0x154a,0x1548,0x1546,0x27d,0x70050,0x3a,0x154c,0x154a,0x154a,0x154a,0x154a, + 0x50088,0x3a,0x154d,0x1543,0x154c,0x50089,0x6,0x91e,0x74d,0x190,0x500aa,0x47, + 0x91f,0x91e,0x151,0x300f7,0x985,0x0,0x400fa,0x91f,0x920,0x985,0x200f8,0x920, + 0x50084,0x19,0x923,0x795,0x412f,0x4007c,0x1f,0x924,0x923,0x50086,0x6,0x926, + 0x7c7,0x10f,0x4007c,0x1e,0x927,0x926,0x50086,0x6,0x929,0x7cd,0x10f,0x4007c, + 0x1e,0x92a,0x929,0x50050,0x1f,0x92b,0x927,0x92a,0x50080,0x1f,0x92c,0x924, + 0x92b,0x4003d,0x16d,0x1562,0x178,0x40063,0x1562,0x92c,0x144b,0x50051,0x13,0x15b7, + 0x144b,0x0,0x60041,0x2cb,0x15b8,0x2c8,0x926,0x929,0x3003e,0x15b8,0x15b7,0x50051, + 0x13,0x15bc,0x144b,0x1,0x60041,0x2cb,0x15bd,0x2ce,0x926,0x929,0x3003e,0x15bd, + 0x15bc,0x50051,0x13,0x15c1,0x144b,0x2,0x60041,0x2cb,0x15c2,0x2d3,0x926,0x929, + 0x3003e,0x15c2,0x15c1,0x50051,0x13,0x15c6,0x144b,0x3,0x60041,0x2cb,0x15c7,0x2d8, + 0x926,0x929,0x3003e,0x15c7,0x15c6,0x50080,0x6,0x93e,0x926,0x1b8,0x4007c,0x1e, + 0x93f,0x93e,0x50050,0x1f,0x943,0x93f,0x92a,0x50080,0x1f,0x944,0x924,0x943, + 0x4003d,0x16d,0x15db,0x178,0x40063,0x15db,0x944,0x14a1,0x50051,0x13,0x1630,0x14a1, + 0x0,0x60041,0x2cb,0x1631,0x2c8,0x93e,0x929,0x3003e,0x1631,0x1630,0x50051,0x13, + 0x1635,0x14a1,0x1,0x60041,0x2cb,0x1636,0x2ce,0x93e,0x929,0x3003e,0x1636,0x1635, + 0x50051,0x13,0x163a,0x14a1,0x2,0x60041,0x2cb,0x163b,0x2d3,0x93e,0x929,0x3003e, + 0x163b,0x163a,0x50051,0x13,0x163f,0x14a1,0x3,0x60041,0x2cb,0x1640,0x2d8,0x93e, + 0x929,0x3003e,0x1640,0x163f,0x50080,0x6,0x95a,0x929,0x1b8,0x4007c,0x1e,0x95b, + 0x95a,0x50050,0x1f,0x95c,0x927,0x95b,0x50080,0x1f,0x95d,0x924,0x95c,0x4003d, + 0x16d,0x1654,0x178,0x40063,0x1654,0x95d,0x14f7,0x50051,0x13,0x16a9,0x14f7,0x0, + 0x60041,0x2cb,0x16aa,0x2c8,0x926,0x95a,0x3003e,0x16aa,0x16a9,0x50051,0x13,0x16ae, + 0x14f7,0x1,0x60041,0x2cb,0x16af,0x2ce,0x926,0x95a,0x3003e,0x16af,0x16ae,0x50051, + 0x13,0x16b3,0x14f7,0x2,0x60041,0x2cb,0x16b4,0x2d3,0x926,0x95a,0x3003e,0x16b4, + 0x16b3,0x50051,0x13,0x16b8,0x14f7,0x3,0x60041,0x2cb,0x16b9,0x2d8,0x926,0x95a, + 0x3003e,0x16b9,0x16b8,0x50050,0x1f,0x976,0x93f,0x95b,0x50080,0x1f,0x977,0x924, + 0x976,0x4003d,0x16d,0x16cd,0x178,0x40063,0x16cd,0x977,0x154d,0x50051,0x13,0x1722, + 0x154d,0x0,0x60041,0x2cb,0x1723,0x2c8,0x93e,0x95a,0x3003e,0x1723,0x1722,0x50051, + 0x13,0x1727,0x154d,0x1,0x60041,0x2cb,0x1728,0x2ce,0x93e,0x95a,0x3003e,0x1728, + 0x1727,0x50051,0x13,0x172c,0x154d,0x2,0x60041,0x2cb,0x172d,0x2d3,0x93e,0x95a, + 0x3003e,0x172d,0x172c,0x50051,0x13,0x1731,0x154d,0x3,0x60041,0x2cb,0x1732,0x2d8, + 0x93e,0x95a,0x3003e,0x1732,0x1731,0x200f9,0x985,0x200f8,0x985,0x200f9,0x986,0x200f8, + 0x986,0x300f7,0x1784,0x0,0x300fb,0x151,0x174b,0x200f8,0x174b,0x500b2,0x47,0x174e, + 0x784,0x10f,0x300f7,0x1750,0x0,0x400fa,0x174e,0x174f,0x1750,0x200f8,0x174f,0x200f9, + 0x1784,0x200f8,0x1750,0x300e1,0x10f,0x335,0x400e0,0x10f,0x10f,0x336,0x60041,0x2cb, + 0x17b8,0x2c8,0x7c7,0x7cd,0x4003d,0x13,0x17b9,0x17b8,0x60041,0x2cb,0x17bc,0x2ce, + 0x7c7,0x7cd,0x4003d,0x13,0x17bd,0x17bc,0x60041,0x2cb,0x17c0,0x2d3,0x7c7,0x7cd, + 0x4003d,0x13,0x17c1,0x17c0,0x60041,0x2cb,0x17c4,0x2d8,0x7c7,0x7cd,0x4003d,0x13, + 0x17c5,0x17c4,0x70050,0x3a,0x17c6,0x17b9,0x17bd,0x17c1,0x17c5,0x6016e,0x3a,0x17d3, + 0x110,0x17c6,0x151,0x6016e,0x3a,0x17d5,0x110,0x17c6,0x116,0x6016e,0x3a,0x17d7, + 0x110,0x17c6,0x10f,0x500ba,0x47,0x17e7,0x17c1,0x1e9,0x600a9,0x13,0x17e8,0x17e7, + 0x27d,0x1e9,0x5008e,0x3a,0x17eb,0x17c6,0x17e8,0x50051,0x13,0x17f2,0x17d3,0x2, + 0x500ba,0x47,0x17f3,0x17f2,0x1e9,0x600a9,0x13,0x17f4,0x17f3,0x27d,0x1e9,0x5008e, + 0x3a,0x17f7,0x17d3,0x17f4,0x50081,0x3a,0x17f9,0x17eb,0x17f7,0x50081,0x13,0x17fc, + 0x17e8,0x17f4,0x50051,0x13,0x17fe,0x17d5,0x2,0x500ba,0x47,0x17ff,0x17fe,0x1e9, + 0x600a9,0x13,0x1800,0x17ff,0x27d,0x1e9,0x5008e,0x3a,0x1803,0x17d5,0x1800,0x50081, + 0x3a,0x1805,0x17f9,0x1803,0x50081,0x13,0x1808,0x17fc,0x1800,0x50051,0x13,0x180a, + 0x17d7,0x2,0x500ba,0x47,0x180b,0x180a,0x1e9,0x600a9,0x13,0x180c,0x180b,0x27d, + 0x1e9,0x5008e,0x3a,0x180f,0x17d7,0x180c,0x50081,0x3a,0x1811,0x1805,0x180f,0x50081, + 0x13,0x1814,0x1808,0x180c,0x500ba,0x47,0x1816,0x1814,0x32b,0x600a9,0x13,0x1818, + 0x1816,0x1814,0x27d,0x70050,0x3a,0x181a,0x1818,0x1818,0x1818,0x1818,0x50088,0x3a, + 0x181b,0x1811,0x181a,0x50089,0x6,0x1798,0x74d,0x190,0x500aa,0x47,0x1799,0x1798, + 0x151,0x300f7,0x17b3,0x0,0x400fa,0x1799,0x179a,0x17b3,0x200f8,0x179a,0x50084,0x19, + 0x179d,0x795,0x4130,0x4007c,0x1f,0x179e,0x179d,0x50086,0x6,0x17a0,0x7c7,0x10f, + 0x4007c,0x1e,0x17a1,0x17a0,0x50086,0x6,0x17a3,0x7cd,0x10f,0x4007c,0x1e,0x17a4, + 0x17a3,0x50050,0x1f,0x17a5,0x17a1,0x17a4,0x50080,0x1f,0x17a6,0x179e,0x17a5,0x4003d, + 0x16d,0x1837,0x181,0x40063,0x1837,0x17a6,0x181b,0x50089,0x6,0x17ae,0x17a3,0x10f, + 0x50080,0x6,0x17af,0x7c7,0x17ae,0x50051,0x13,0x1885,0x181b,0x0,0x60041,0x2cb, + 0x1886,0x2c8,0x17af,0x7cd,0x3003e,0x1886,0x1885,0x50051,0x13,0x188a,0x181b,0x1, + 0x60041,0x2cb,0x188b,0x2ce,0x17af,0x7cd,0x3003e,0x188b,0x188a,0x50051,0x13,0x188f, + 0x181b,0x2,0x60041,0x2cb,0x1890,0x2d3,0x17af,0x7cd,0x3003e,0x1890,0x188f,0x50051, + 0x13,0x1894,0x181b,0x3,0x60041,0x2cb,0x1895,0x2d8,0x17af,0x7cd,0x3003e,0x1895, + 0x1894,0x200f9,0x17b3,0x200f8,0x17b3,0x500b2,0x47,0x175c,0x784,0x110,0x300f7,0x175e, + 0x0,0x400fa,0x175c,0x175d,0x175e,0x200f8,0x175d,0x200f9,0x1784,0x200f8,0x175e,0x300e1, + 0x10f,0x335,0x400e0,0x10f,0x10f,0x336,0x500b0,0x47,0x18a4,0x74d,0x3d3,0x300f7, + 0x18ce,0x0,0x400fa,0x18a4,0x18a5,0x18ce,0x200f8,0x18a5,0x50089,0x6,0x18a9,0x7cd, + 0x10f,0x50080,0x6,0x18aa,0x886,0x18a9,0x60041,0x2cb,0x18d3,0x2c8,0x18aa,0x889, + 0x4003d,0x13,0x18d4,0x18d3,0x60041,0x2cb,0x18d7,0x2ce,0x18aa,0x889,0x4003d,0x13, + 0x18d8,0x18d7,0x60041,0x2cb,0x18db,0x2d3,0x18aa,0x889,0x4003d,0x13,0x18dc,0x18db, + 0x60041,0x2cb,0x18df,0x2d8,0x18aa,0x889,0x4003d,0x13,0x18e0,0x18df,0x70050,0x3a, + 0x18e1,0x18d4,0x18d8,0x18dc,0x18e0,0x6016e,0x3a,0x18ee,0x110,0x18e1,0x151,0x6016e, + 0x3a,0x18f0,0x110,0x18e1,0x116,0x6016e,0x3a,0x18f2,0x110,0x18e1,0x10f,0x500ba, + 0x47,0x1902,0x18dc,0x1e9,0x600a9,0x13,0x1903,0x1902,0x27d,0x1e9,0x5008e,0x3a, + 0x1906,0x18e1,0x1903,0x50051,0x13,0x190d,0x18ee,0x2,0x500ba,0x47,0x190e,0x190d, + 0x1e9,0x600a9,0x13,0x190f,0x190e,0x27d,0x1e9,0x5008e,0x3a,0x1912,0x18ee,0x190f, + 0x50081,0x3a,0x1914,0x1906,0x1912,0x50081,0x13,0x1917,0x1903,0x190f,0x50051,0x13, + 0x1919,0x18f0,0x2,0x500ba,0x47,0x191a,0x1919,0x1e9,0x600a9,0x13,0x191b,0x191a, + 0x27d,0x1e9,0x5008e,0x3a,0x191e,0x18f0,0x191b,0x50081,0x3a,0x1920,0x1914,0x191e, + 0x50081,0x13,0x1923,0x1917,0x191b,0x50051,0x13,0x1925,0x18f2,0x2,0x500ba,0x47, + 0x1926,0x1925,0x1e9,0x600a9,0x13,0x1927,0x1926,0x27d,0x1e9,0x5008e,0x3a,0x192a, + 0x18f2,0x1927,0x50081,0x3a,0x192c,0x1920,0x192a,0x50081,0x13,0x192f,0x1923,0x1927, + 0x500ba,0x47,0x1931,0x192f,0x32b,0x600a9,0x13,0x1933,0x1931,0x192f,0x27d,0x70050, + 0x3a,0x1935,0x1933,0x1933,0x1933,0x1933,0x50088,0x3a,0x1936,0x192c,0x1935,0x300f7, + 0x18cd,0x0,0x400fa,0x1799,0x18b3,0x18cd,0x200f8,0x18b3,0x50084,0x19,0x18b6,0x795, + 0x4131,0x4007c,0x1f,0x18b7,0x18b6,0x50086,0x6,0x18b9,0x7c7,0x10f,0x4007c,0x1e, + 0x18ba,0x18b9,0x50086,0x6,0x18bc,0x7cd,0x10f,0x4007c,0x1e,0x18bd,0x18bc,0x50050, + 0x1f,0x18be,0x18ba,0x18bd,0x50080,0x1f,0x18bf,0x18b7,0x18be,0x4003d,0x16d,0x1959, + 0x18a,0x40063,0x1959,0x18bf,0x1936,0x50080,0x6,0x18c8,0x886,0x18bc,0x50051,0x13, + 0x19a0,0x1936,0x0,0x60041,0x2cb,0x19a1,0x2c8,0x18c8,0x889,0x3003e,0x19a1,0x19a0, + 0x50051,0x13,0x19a5,0x1936,0x1,0x60041,0x2cb,0x19a6,0x2ce,0x18c8,0x889,0x3003e, + 0x19a6,0x19a5,0x50051,0x13,0x19aa,0x1936,0x2,0x60041,0x2cb,0x19ab,0x2d3,0x18c8, + 0x889,0x3003e,0x19ab,0x19aa,0x50051,0x13,0x19af,0x1936,0x3,0x60041,0x2cb,0x19b0, + 0x2d8,0x18c8,0x889,0x3003e,0x19b0,0x19af,0x200f9,0x18cd,0x200f8,0x18cd,0x200f9,0x18ce, + 0x200f8,0x18ce,0x500b2,0x47,0x176b,0x784,0x190,0x300f7,0x176d,0x0,0x400fa,0x176b, + 0x176c,0x176d,0x200f8,0x176c,0x200f9,0x1784,0x200f8,0x176d,0x300e1,0x10f,0x335,0x400e0, + 0x10f,0x10f,0x336,0x500b0,0x47,0x19bf,0x74d,0x25b,0x300f7,0x19e5,0x0,0x400fa, + 0x19bf,0x19c0,0x19e5,0x200f8,0x19c0,0x50084,0x6,0x19c2,0x7c7,0x190,0x50080,0x6, + 0x19c4,0x19c2,0x7cd,0x50084,0x6,0x19c6,0x7cd,0x190,0x60041,0x2cb,0x19ea,0x2c8, + 0x19c4,0x19c6,0x4003d,0x13,0x19eb,0x19ea,0x60041,0x2cb,0x19ee,0x2ce,0x19c4,0x19c6, + 0x4003d,0x13,0x19ef,0x19ee,0x60041,0x2cb,0x19f2,0x2d3,0x19c4,0x19c6,0x4003d,0x13, + 0x19f3,0x19f2,0x60041,0x2cb,0x19f6,0x2d8,0x19c4,0x19c6,0x4003d,0x13,0x19f7,0x19f6, + 0x70050,0x3a,0x19f8,0x19eb,0x19ef,0x19f3,0x19f7,0x6016e,0x3a,0x1a05,0x110,0x19f8, + 0x151,0x6016e,0x3a,0x1a07,0x110,0x19f8,0x116,0x6016e,0x3a,0x1a09,0x110,0x19f8, + 0x10f,0x500ba,0x47,0x1a19,0x19f3,0x1e9,0x600a9,0x13,0x1a1a,0x1a19,0x27d,0x1e9, + 0x5008e,0x3a,0x1a1d,0x19f8,0x1a1a,0x50051,0x13,0x1a24,0x1a05,0x2,0x500ba,0x47, + 0x1a25,0x1a24,0x1e9,0x600a9,0x13,0x1a26,0x1a25,0x27d,0x1e9,0x5008e,0x3a,0x1a29, + 0x1a05,0x1a26,0x50081,0x3a,0x1a2b,0x1a1d,0x1a29,0x50081,0x13,0x1a2e,0x1a1a,0x1a26, + 0x50051,0x13,0x1a30,0x1a07,0x2,0x500ba,0x47,0x1a31,0x1a30,0x1e9,0x600a9,0x13, + 0x1a32,0x1a31,0x27d,0x1e9,0x5008e,0x3a,0x1a35,0x1a07,0x1a32,0x50081,0x3a,0x1a37, + 0x1a2b,0x1a35,0x50081,0x13,0x1a3a,0x1a2e,0x1a32,0x50051,0x13,0x1a3c,0x1a09,0x2, + 0x500ba,0x47,0x1a3d,0x1a3c,0x1e9,0x600a9,0x13,0x1a3e,0x1a3d,0x27d,0x1e9,0x5008e, + 0x3a,0x1a41,0x1a09,0x1a3e,0x50081,0x3a,0x1a43,0x1a37,0x1a41,0x50081,0x13,0x1a46, + 0x1a3a,0x1a3e,0x500ba,0x47,0x1a48,0x1a46,0x32b,0x600a9,0x13,0x1a4a,0x1a48,0x1a46, + 0x27d,0x70050,0x3a,0x1a4c,0x1a4a,0x1a4a,0x1a4a,0x1a4a,0x50088,0x3a,0x1a4d,0x1a43, + 0x1a4c,0x300f7,0x19e4,0x0,0x400fa,0x1799,0x19cd,0x19e4,0x200f8,0x19cd,0x50084,0x19, + 0x19d0,0x795,0x4132,0x4007c,0x1f,0x19d1,0x19d0,0x50086,0x6,0x19d3,0x7c7,0x10f, + 0x4007c,0x1e,0x19d4,0x19d3,0x50086,0x6,0x19d6,0x7cd,0x10f,0x4007c,0x1e,0x19d7, + 0x19d6,0x50050,0x1f,0x19d8,0x19d4,0x19d7,0x50080,0x1f,0x19d9,0x19d1,0x19d8,0x4003d, + 0x16d,0x1a77,0x194,0x40063,0x1a77,0x19d9,0x1a4d,0x50080,0x6,0x19e1,0x19d3,0x7cd, + 0x50051,0x13,0x1ab7,0x1a4d,0x0,0x60041,0x2cb,0x1ab8,0x2c8,0x19e1,0x151,0x3003e, + 0x1ab8,0x1ab7,0x50051,0x13,0x1abc,0x1a4d,0x1,0x60041,0x2cb,0x1abd,0x2ce,0x19e1, + 0x151,0x3003e,0x1abd,0x1abc,0x50051,0x13,0x1ac1,0x1a4d,0x2,0x60041,0x2cb,0x1ac2, + 0x2d3,0x19e1,0x151,0x3003e,0x1ac2,0x1ac1,0x50051,0x13,0x1ac6,0x1a4d,0x3,0x60041, + 0x2cb,0x1ac7,0x2d8,0x19e1,0x151,0x3003e,0x1ac7,0x1ac6,0x200f9,0x19e4,0x200f8,0x19e4, + 0x200f9,0x19e5,0x200f8,0x19e5,0x500b2,0x47,0x177a,0x784,0x19a,0x300f7,0x177c,0x0, + 0x400fa,0x177a,0x177b,0x177c,0x200f8,0x177b,0x200f9,0x1784,0x200f8,0x177c,0x300e1,0x10f, + 0x335,0x400e0,0x10f,0x10f,0x336,0x500b0,0x47,0x1ad3,0x74d,0x190,0x300f7,0x1ae4, + 0x0,0x400fa,0x1ad3,0x1ad4,0x1ae4,0x200f8,0x1ad4,0x60041,0x2cb,0x1ae9,0x2c8,0x74d, + 0x151,0x4003d,0x13,0x1aea,0x1ae9,0x60041,0x2cb,0x1aed,0x2ce,0x74d,0x151,0x4003d, + 0x13,0x1aee,0x1aed,0x60041,0x2cb,0x1af1,0x2d3,0x74d,0x151,0x4003d,0x13,0x1af2, + 0x1af1,0x60041,0x2cb,0x1af5,0x2d8,0x74d,0x151,0x4003d,0x13,0x1af6,0x1af5,0x70050, + 0x3a,0x1af7,0x1aea,0x1aee,0x1af2,0x1af6,0x6016e,0x3a,0x1b04,0x110,0x1af7,0x151, + 0x6016e,0x3a,0x1b06,0x110,0x1af7,0x116,0x6016e,0x3a,0x1b08,0x110,0x1af7,0x10f, + 0x500ba,0x47,0x1b18,0x1af2,0x1e9,0x600a9,0x13,0x1b19,0x1b18,0x27d,0x1e9,0x5008e, + 0x3a,0x1b1c,0x1af7,0x1b19,0x50051,0x13,0x1b23,0x1b04,0x2,0x500ba,0x47,0x1b24, + 0x1b23,0x1e9,0x600a9,0x13,0x1b25,0x1b24,0x27d,0x1e9,0x5008e,0x3a,0x1b28,0x1b04, + 0x1b25,0x50081,0x3a,0x1b2a,0x1b1c,0x1b28,0x50081,0x13,0x1b2d,0x1b19,0x1b25,0x50051, + 0x13,0x1b2f,0x1b06,0x2,0x500ba,0x47,0x1b30,0x1b2f,0x1e9,0x600a9,0x13,0x1b31, + 0x1b30,0x27d,0x1e9,0x5008e,0x3a,0x1b34,0x1b06,0x1b31,0x50081,0x3a,0x1b36,0x1b2a, + 0x1b34,0x50081,0x13,0x1b39,0x1b2d,0x1b31,0x50051,0x13,0x1b3b,0x1b08,0x2,0x500ba, + 0x47,0x1b3c,0x1b3b,0x1e9,0x600a9,0x13,0x1b3d,0x1b3c,0x27d,0x1e9,0x5008e,0x3a, + 0x1b40,0x1b08,0x1b3d,0x50081,0x3a,0x1b42,0x1b36,0x1b40,0x50081,0x13,0x1b45,0x1b39, + 0x1b3d,0x500ba,0x47,0x1b47,0x1b45,0x32b,0x600a9,0x13,0x1b49,0x1b47,0x1b45,0x27d, + 0x70050,0x3a,0x1b4b,0x1b49,0x1b49,0x1b49,0x1b49,0x50088,0x3a,0x1b4c,0x1b42,0x1b4b, + 0x300f7,0x1ae3,0x0,0x400fa,0x1799,0x1adc,0x1ae3,0x200f8,0x1adc,0x4007c,0x1f,0x1ade, + 0x795,0x4003d,0x16d,0x1b7d,0x19e,0x40063,0x1b7d,0x1ade,0x1b4c,0x200f9,0x1ae3,0x200f8, + 0x1ae3,0x200f9,0x1ae4,0x200f8,0x1ae4,0x200f9,0x1784,0x200f8,0x1784,0x500b2,0x47,0x7dd, + 0x784,0x1a4,0x300f7,0x7df,0x0,0x400fa,0x7dd,0x7de,0x7df,0x200f8,0x7de,0x200f9, + 0x7f3,0x200f8,0x7df,0x500aa,0x47,0x1bb6,0x74d,0x151,0x300f7,0x1bba,0x0,0x400fa, + 0x1bb6,0x1bb7,0x1bba,0x200f8,0x1bb7,0x60041,0x164,0x1bc7,0x161,0x105,0x105,0x700ea, + 0x6,0x1bc8,0x1bc7,0x116,0x151,0x116,0x3003e,0x2ba,0x1bc8,0x200f9,0x1bba,0x200f8, + 0x1bba,0x300e1,0x10f,0x335,0x400e0,0x10f,0x10f,0x336,0x4003d,0x6,0x1bcc,0x2ba, + 0x50082,0x6,0x1bbe,0x788,0x116,0x500ab,0x47,0x1bbf,0x1bcc,0x1bbe,0x300f7,0x7e5, + 0x0,0x400fa,0x1bbf,0x7e4,0x7e5,0x200f8,0x7e4,0x200f9,0x7f3,0x200f8,0x7e5,0x60041, + 0x164,0x1bd4,0x161,0x105,0x105,0x3003e,0x1bd4,0x151,0x300f7,0x1c7f,0x0,0x300fb, + 0x151,0x1c01,0x200f8,0x1c01,0x50084,0x6,0x1c03,0x7c7,0x190,0x4007c,0x1e,0x1c05, + 0x1c03,0x50084,0x6,0x1c07,0x7cd,0x190,0x4007c,0x1e,0x1c09,0x1c07,0x50050,0x1f, + 0x1c0a,0x1c05,0x1c09,0x4007c,0x19,0x1c15,0x1c0a,0x50080,0x19,0x1c8a,0x1c15,0x388, + 0x50080,0x19,0x1c8c,0x1c15,0x38b,0x50080,0x19,0x1c8e,0x1c15,0x38e,0x4003d,0x16d, + 0x1ce9,0x19e,0x50062,0x3a,0x1ceb,0x1ce9,0x1c0a,0x4007c,0x1f,0x1ca8,0x1c8a,0x4003d, + 0x16d,0x1d51,0x19e,0x50062,0x3a,0x1d53,0x1d51,0x1ca8,0x4007c,0x1f,0x1cac,0x1c8c, + 0x4003d,0x16d,0x1db9,0x19e,0x50062,0x3a,0x1dbb,0x1db9,0x1cac,0x4007c,0x1f,0x1cb0, + 0x1c8e,0x4003d,0x16d,0x1e21,0x19e,0x50062,0x3a,0x1e23,0x1e21,0x1cb0,0x50051,0x13, + 0x1e61,0x1ceb,0x2,0x500ba,0x47,0x1e62,0x1e61,0x1e9,0x600a9,0x13,0x1e63,0x1e62, + 0x27d,0x1e9,0x5008e,0x3a,0x1e66,0x1ceb,0x1e63,0x50051,0x13,0x1e6d,0x1d53,0x2, + 0x500ba,0x47,0x1e6e,0x1e6d,0x1e9,0x600a9,0x13,0x1e6f,0x1e6e,0x27d,0x1e9,0x5008e, + 0x3a,0x1e72,0x1d53,0x1e6f,0x50081,0x3a,0x1e74,0x1e66,0x1e72,0x50081,0x13,0x1e77, + 0x1e63,0x1e6f,0x50051,0x13,0x1e79,0x1dbb,0x2,0x500ba,0x47,0x1e7a,0x1e79,0x1e9, + 0x600a9,0x13,0x1e7b,0x1e7a,0x27d,0x1e9,0x5008e,0x3a,0x1e7e,0x1dbb,0x1e7b,0x50081, + 0x3a,0x1e80,0x1e74,0x1e7e,0x50081,0x13,0x1e83,0x1e77,0x1e7b,0x50051,0x13,0x1e85, + 0x1e23,0x2,0x500ba,0x47,0x1e86,0x1e85,0x1e9,0x600a9,0x13,0x1e87,0x1e86,0x27d, + 0x1e9,0x5008e,0x3a,0x1e8a,0x1e23,0x1e87,0x50081,0x3a,0x1e8c,0x1e80,0x1e8a,0x50081, + 0x13,0x1e8f,0x1e83,0x1e87,0x500ba,0x47,0x1e91,0x1e8f,0x32b,0x600a9,0x13,0x1e93, + 0x1e91,0x1e8f,0x27d,0x70050,0x3a,0x1e95,0x1e93,0x1e93,0x1e93,0x1e93,0x50088,0x3a, + 0x1e96,0x1e8c,0x1e95,0x4003d,0x16d,0x1ece,0x1a8,0x40063,0x1ece,0x88b,0x1e96,0x50080, + 0x6,0x1c1e,0x1c03,0x10f,0x4007c,0x1e,0x1c1f,0x1c1e,0x50050,0x1f,0x1c24,0x1c1f, + 0x1c09,0x50080,0x6,0x1c27,0x886,0x116,0x4007c,0x1e,0x1c28,0x1c27,0x50050,0x1f, + 0x1c2d,0x1c28,0x88a,0x4007c,0x19,0x1c2f,0x1c24,0x50080,0x19,0x1f06,0x1c2f,0x388, + 0x50080,0x19,0x1f08,0x1c2f,0x38b,0x50080,0x19,0x1f0a,0x1c2f,0x38e,0x4003d,0x16d, + 0x1f65,0x19e,0x50062,0x3a,0x1f67,0x1f65,0x1c24,0x4007c,0x1f,0x1f24,0x1f06,0x4003d, + 0x16d,0x1fcd,0x19e,0x50062,0x3a,0x1fcf,0x1fcd,0x1f24,0x4007c,0x1f,0x1f28,0x1f08, + 0x4003d,0x16d,0x2035,0x19e,0x50062,0x3a,0x2037,0x2035,0x1f28,0x4007c,0x1f,0x1f2c, + 0x1f0a,0x4003d,0x16d,0x209d,0x19e,0x50062,0x3a,0x209f,0x209d,0x1f2c,0x50051,0x13, + 0x20dd,0x1f67,0x2,0x500ba,0x47,0x20de,0x20dd,0x1e9,0x600a9,0x13,0x20df,0x20de, + 0x27d,0x1e9,0x5008e,0x3a,0x20e2,0x1f67,0x20df,0x50051,0x13,0x20e9,0x1fcf,0x2, + 0x500ba,0x47,0x20ea,0x20e9,0x1e9,0x600a9,0x13,0x20eb,0x20ea,0x27d,0x1e9,0x5008e, + 0x3a,0x20ee,0x1fcf,0x20eb,0x50081,0x3a,0x20f0,0x20e2,0x20ee,0x50081,0x13,0x20f3, + 0x20df,0x20eb,0x50051,0x13,0x20f5,0x2037,0x2,0x500ba,0x47,0x20f6,0x20f5,0x1e9, + 0x600a9,0x13,0x20f7,0x20f6,0x27d,0x1e9,0x5008e,0x3a,0x20fa,0x2037,0x20f7,0x50081, + 0x3a,0x20fc,0x20f0,0x20fa,0x50081,0x13,0x20ff,0x20f3,0x20f7,0x50051,0x13,0x2101, + 0x209f,0x2,0x500ba,0x47,0x2102,0x2101,0x1e9,0x600a9,0x13,0x2103,0x2102,0x27d, + 0x1e9,0x5008e,0x3a,0x2106,0x209f,0x2103,0x50081,0x3a,0x2108,0x20fc,0x2106,0x50081, + 0x13,0x210b,0x20ff,0x2103,0x500ba,0x47,0x210d,0x210b,0x32b,0x600a9,0x13,0x210f, + 0x210d,0x210b,0x27d,0x70050,0x3a,0x2111,0x210f,0x210f,0x210f,0x210f,0x50088,0x3a, + 0x2112,0x2108,0x2111,0x4003d,0x16d,0x214a,0x1a8,0x40063,0x214a,0x1c2d,0x2112,0x50080, + 0x6,0x1c3c,0x1c07,0x10f,0x4007c,0x1e,0x1c3d,0x1c3c,0x50050,0x1f,0x1c3e,0x1c05, + 0x1c3d,0x50080,0x6,0x1c45,0x889,0x116,0x4007c,0x1e,0x1c46,0x1c45,0x50050,0x1f, + 0x1c47,0x887,0x1c46,0x4007c,0x19,0x1c49,0x1c3e,0x50080,0x19,0x2182,0x1c49,0x388, + 0x50080,0x19,0x2184,0x1c49,0x38b,0x50080,0x19,0x2186,0x1c49,0x38e,0x4003d,0x16d, + 0x21e1,0x19e,0x50062,0x3a,0x21e3,0x21e1,0x1c3e,0x4007c,0x1f,0x21a0,0x2182,0x4003d, + 0x16d,0x2249,0x19e,0x50062,0x3a,0x224b,0x2249,0x21a0,0x4007c,0x1f,0x21a4,0x2184, + 0x4003d,0x16d,0x22b1,0x19e,0x50062,0x3a,0x22b3,0x22b1,0x21a4,0x4007c,0x1f,0x21a8, + 0x2186,0x4003d,0x16d,0x2319,0x19e,0x50062,0x3a,0x231b,0x2319,0x21a8,0x50051,0x13, + 0x2359,0x21e3,0x2,0x500ba,0x47,0x235a,0x2359,0x1e9,0x600a9,0x13,0x235b,0x235a, + 0x27d,0x1e9,0x5008e,0x3a,0x235e,0x21e3,0x235b,0x50051,0x13,0x2365,0x224b,0x2, + 0x500ba,0x47,0x2366,0x2365,0x1e9,0x600a9,0x13,0x2367,0x2366,0x27d,0x1e9,0x5008e, + 0x3a,0x236a,0x224b,0x2367,0x50081,0x3a,0x236c,0x235e,0x236a,0x50081,0x13,0x236f, + 0x235b,0x2367,0x50051,0x13,0x2371,0x22b3,0x2,0x500ba,0x47,0x2372,0x2371,0x1e9, + 0x600a9,0x13,0x2373,0x2372,0x27d,0x1e9,0x5008e,0x3a,0x2376,0x22b3,0x2373,0x50081, + 0x3a,0x2378,0x236c,0x2376,0x50081,0x13,0x237b,0x236f,0x2373,0x50051,0x13,0x237d, + 0x231b,0x2,0x500ba,0x47,0x237e,0x237d,0x1e9,0x600a9,0x13,0x237f,0x237e,0x27d, + 0x1e9,0x5008e,0x3a,0x2382,0x231b,0x237f,0x50081,0x3a,0x2384,0x2378,0x2382,0x50081, + 0x13,0x2387,0x237b,0x237f,0x500ba,0x47,0x2389,0x2387,0x32b,0x600a9,0x13,0x238b, + 0x2389,0x2387,0x27d,0x70050,0x3a,0x238d,0x238b,0x238b,0x238b,0x238b,0x50088,0x3a, + 0x238e,0x2384,0x238d,0x4003d,0x16d,0x23c6,0x1a8,0x40063,0x23c6,0x1c47,0x238e,0x50050, + 0x1f,0x1c58,0x1c1f,0x1c3d,0x50050,0x1f,0x1c61,0x1c28,0x1c46,0x4007c,0x19,0x1c63, + 0x1c58,0x50080,0x19,0x23fe,0x1c63,0x388,0x50080,0x19,0x2400,0x1c63,0x38b,0x50080, + 0x19,0x2402,0x1c63,0x38e,0x4003d,0x16d,0x245d,0x19e,0x50062,0x3a,0x245f,0x245d, + 0x1c58,0x4007c,0x1f,0x241c,0x23fe,0x4003d,0x16d,0x24c5,0x19e,0x50062,0x3a,0x24c7, + 0x24c5,0x241c,0x4007c,0x1f,0x2420,0x2400,0x4003d,0x16d,0x252d,0x19e,0x50062,0x3a, + 0x252f,0x252d,0x2420,0x4007c,0x1f,0x2424,0x2402,0x4003d,0x16d,0x2595,0x19e,0x50062, + 0x3a,0x2597,0x2595,0x2424,0x50051,0x13,0x25d5,0x245f,0x2,0x500ba,0x47,0x25d6, + 0x25d5,0x1e9,0x600a9,0x13,0x25d7,0x25d6,0x27d,0x1e9,0x5008e,0x3a,0x25da,0x245f, + 0x25d7,0x50051,0x13,0x25e1,0x24c7,0x2,0x500ba,0x47,0x25e2,0x25e1,0x1e9,0x600a9, + 0x13,0x25e3,0x25e2,0x27d,0x1e9,0x5008e,0x3a,0x25e6,0x24c7,0x25e3,0x50081,0x3a, + 0x25e8,0x25da,0x25e6,0x50081,0x13,0x25eb,0x25d7,0x25e3,0x50051,0x13,0x25ed,0x252f, + 0x2,0x500ba,0x47,0x25ee,0x25ed,0x1e9,0x600a9,0x13,0x25ef,0x25ee,0x27d,0x1e9, + 0x5008e,0x3a,0x25f2,0x252f,0x25ef,0x50081,0x3a,0x25f4,0x25e8,0x25f2,0x50081,0x13, + 0x25f7,0x25eb,0x25ef,0x50051,0x13,0x25f9,0x2597,0x2,0x500ba,0x47,0x25fa,0x25f9, + 0x1e9,0x600a9,0x13,0x25fb,0x25fa,0x27d,0x1e9,0x5008e,0x3a,0x25fe,0x2597,0x25fb, + 0x50081,0x3a,0x2600,0x25f4,0x25fe,0x50081,0x13,0x2603,0x25f7,0x25fb,0x500ba,0x47, + 0x2605,0x2603,0x32b,0x600a9,0x13,0x2607,0x2605,0x2603,0x27d,0x70050,0x3a,0x2609, + 0x2607,0x2607,0x2607,0x2607,0x50088,0x3a,0x260a,0x2600,0x2609,0x4003d,0x16d,0x2642, + 0x1a8,0x40063,0x2642,0x1c61,0x260a,0x500b2,0x47,0x1c6b,0x784,0x1ae,0x300f7,0x1c6d, + 0x0,0x400fa,0x1c6b,0x1c6c,0x1c6d,0x200f8,0x1c6c,0x200f9,0x1c7f,0x200f8,0x1c6d,0x50051, + 0x13,0x2679,0x1e96,0x2,0x500ba,0x47,0x267a,0x2679,0x1e9,0x600a9,0x13,0x267b, + 0x267a,0x27d,0x1e9,0x5008e,0x3a,0x267e,0x1e96,0x267b,0x50051,0x13,0x2685,0x2112, + 0x2,0x500ba,0x47,0x2686,0x2685,0x1e9,0x600a9,0x13,0x2687,0x2686,0x27d,0x1e9, + 0x5008e,0x3a,0x268a,0x2112,0x2687,0x50081,0x3a,0x268c,0x267e,0x268a,0x50081,0x13, + 0x268f,0x267b,0x2687,0x50051,0x13,0x2691,0x238e,0x2,0x500ba,0x47,0x2692,0x2691, + 0x1e9,0x600a9,0x13,0x2693,0x2692,0x27d,0x1e9,0x5008e,0x3a,0x2696,0x238e,0x2693, + 0x50081,0x3a,0x2698,0x268c,0x2696,0x50081,0x13,0x269b,0x268f,0x2693,0x50051,0x13, + 0x269d,0x260a,0x2,0x500ba,0x47,0x269e,0x269d,0x1e9,0x600a9,0x13,0x269f,0x269e, + 0x27d,0x1e9,0x5008e,0x3a,0x26a2,0x260a,0x269f,0x50081,0x3a,0x26a4,0x2698,0x26a2, + 0x50081,0x13,0x26a7,0x269b,0x269f,0x500ba,0x47,0x26a9,0x26a7,0x32b,0x600a9,0x13, + 0x26ab,0x26a9,0x26a7,0x27d,0x70050,0x3a,0x26ad,0x26ab,0x26ab,0x26ab,0x26ab,0x50088, + 0x3a,0x26ae,0x26a4,0x26ad,0x4003d,0x16d,0x26ed,0x1b2,0x40063,0x26ed,0x895,0x26ae, + 0x50051,0x13,0x2718,0x26ae,0x0,0x60041,0x2cb,0x2719,0x2c8,0x7c7,0x7cd,0x3003e, + 0x2719,0x2718,0x50051,0x13,0x271d,0x26ae,0x1,0x60041,0x2cb,0x271e,0x2ce,0x7c7, + 0x7cd,0x3003e,0x271e,0x271d,0x50051,0x13,0x2722,0x26ae,0x2,0x60041,0x2cb,0x2723, + 0x2d3,0x7c7,0x7cd,0x3003e,0x2723,0x2722,0x50051,0x13,0x2727,0x26ae,0x3,0x60041, + 0x2cb,0x2728,0x2d8,0x7c7,0x7cd,0x3003e,0x2728,0x2727,0x200f9,0x1c7f,0x200f8,0x1c7f, + 0x300f7,0x277a,0x0,0x300fb,0x151,0x2741,0x200f8,0x2741,0x500b2,0x47,0x2744,0x784, + 0x1b8,0x300f7,0x2746,0x0,0x400fa,0x2744,0x2745,0x2746,0x200f8,0x2745,0x200f9,0x277a, + 0x200f8,0x2746,0x300e1,0x10f,0x335,0x400e0,0x10f,0x10f,0x336,0x60041,0x2cb,0x27ae, + 0x2c8,0x7c7,0x7cd,0x4003d,0x13,0x27af,0x27ae,0x60041,0x2cb,0x27b2,0x2ce,0x7c7, + 0x7cd,0x4003d,0x13,0x27b3,0x27b2,0x60041,0x2cb,0x27b6,0x2d3,0x7c7,0x7cd,0x4003d, + 0x13,0x27b7,0x27b6,0x60041,0x2cb,0x27ba,0x2d8,0x7c7,0x7cd,0x4003d,0x13,0x27bb, + 0x27ba,0x70050,0x3a,0x27bc,0x27af,0x27b3,0x27b7,0x27bb,0x6016e,0x3a,0x27c9,0x110, + 0x27bc,0x151,0x6016e,0x3a,0x27cb,0x110,0x27bc,0x116,0x6016e,0x3a,0x27cd,0x110, + 0x27bc,0x10f,0x500ba,0x47,0x27dd,0x27b7,0x1e9,0x600a9,0x13,0x27de,0x27dd,0x27d, + 0x1e9,0x5008e,0x3a,0x27e1,0x27bc,0x27de,0x50051,0x13,0x27e8,0x27c9,0x2,0x500ba, + 0x47,0x27e9,0x27e8,0x1e9,0x600a9,0x13,0x27ea,0x27e9,0x27d,0x1e9,0x5008e,0x3a, + 0x27ed,0x27c9,0x27ea,0x50081,0x3a,0x27ef,0x27e1,0x27ed,0x50081,0x13,0x27f2,0x27de, + 0x27ea,0x50051,0x13,0x27f4,0x27cb,0x2,0x500ba,0x47,0x27f5,0x27f4,0x1e9,0x600a9, + 0x13,0x27f6,0x27f5,0x27d,0x1e9,0x5008e,0x3a,0x27f9,0x27cb,0x27f6,0x50081,0x3a, + 0x27fb,0x27ef,0x27f9,0x50081,0x13,0x27fe,0x27f2,0x27f6,0x50051,0x13,0x2800,0x27cd, + 0x2,0x500ba,0x47,0x2801,0x2800,0x1e9,0x600a9,0x13,0x2802,0x2801,0x27d,0x1e9, + 0x5008e,0x3a,0x2805,0x27cd,0x2802,0x50081,0x3a,0x2807,0x27fb,0x2805,0x50081,0x13, + 0x280a,0x27fe,0x2802,0x500ba,0x47,0x280c,0x280a,0x32b,0x600a9,0x13,0x280e,0x280c, + 0x280a,0x27d,0x70050,0x3a,0x2810,0x280e,0x280e,0x280e,0x280e,0x50088,0x3a,0x2811, + 0x2807,0x2810,0x50089,0x6,0x278e,0x74d,0x190,0x500aa,0x47,0x278f,0x278e,0x151, + 0x300f7,0x27a9,0x0,0x400fa,0x278f,0x2790,0x27a9,0x200f8,0x2790,0x50086,0x6,0x2796, + 0x7c7,0x10f,0x4007c,0x1e,0x2797,0x2796,0x50086,0x6,0x2799,0x7cd,0x10f,0x4007c, + 0x1e,0x279a,0x2799,0x50050,0x1f,0x279b,0x2797,0x279a,0x4003d,0x16d,0x2857,0x1bc, + 0x40063,0x2857,0x279b,0x2811,0x50089,0x6,0x27a4,0x2799,0x10f,0x50080,0x6,0x27a5, + 0x7c7,0x27a4,0x50051,0x13,0x287b,0x2811,0x0,0x60041,0x2cb,0x287c,0x2c8,0x27a5, + 0x7cd,0x3003e,0x287c,0x287b,0x50051,0x13,0x2880,0x2811,0x1,0x60041,0x2cb,0x2881, + 0x2ce,0x27a5,0x7cd,0x3003e,0x2881,0x2880,0x50051,0x13,0x2885,0x2811,0x2,0x60041, + 0x2cb,0x2886,0x2d3,0x27a5,0x7cd,0x3003e,0x2886,0x2885,0x50051,0x13,0x288a,0x2811, + 0x3,0x60041,0x2cb,0x288b,0x2d8,0x27a5,0x7cd,0x3003e,0x288b,0x288a,0x200f9,0x27a9, + 0x200f8,0x27a9,0x500b2,0x47,0x2752,0x784,0x1c2,0x300f7,0x2754,0x0,0x400fa,0x2752, + 0x2753,0x2754,0x200f8,0x2753,0x200f9,0x277a,0x200f8,0x2754,0x300e1,0x10f,0x335,0x400e0, + 0x10f,0x10f,0x336,0x500b0,0x47,0x289a,0x74d,0x3d3,0x300f7,0x28c4,0x0,0x400fa, + 0x289a,0x289b,0x28c4,0x200f8,0x289b,0x50089,0x6,0x289f,0x7cd,0x10f,0x50080,0x6, + 0x28a0,0x886,0x289f,0x60041,0x2cb,0x28c9,0x2c8,0x28a0,0x889,0x4003d,0x13,0x28ca, + 0x28c9,0x60041,0x2cb,0x28cd,0x2ce,0x28a0,0x889,0x4003d,0x13,0x28ce,0x28cd,0x60041, + 0x2cb,0x28d1,0x2d3,0x28a0,0x889,0x4003d,0x13,0x28d2,0x28d1,0x60041,0x2cb,0x28d5, + 0x2d8,0x28a0,0x889,0x4003d,0x13,0x28d6,0x28d5,0x70050,0x3a,0x28d7,0x28ca,0x28ce, + 0x28d2,0x28d6,0x6016e,0x3a,0x28e4,0x110,0x28d7,0x151,0x6016e,0x3a,0x28e6,0x110, + 0x28d7,0x116,0x6016e,0x3a,0x28e8,0x110,0x28d7,0x10f,0x500ba,0x47,0x28f8,0x28d2, + 0x1e9,0x600a9,0x13,0x28f9,0x28f8,0x27d,0x1e9,0x5008e,0x3a,0x28fc,0x28d7,0x28f9, + 0x50051,0x13,0x2903,0x28e4,0x2,0x500ba,0x47,0x2904,0x2903,0x1e9,0x600a9,0x13, + 0x2905,0x2904,0x27d,0x1e9,0x5008e,0x3a,0x2908,0x28e4,0x2905,0x50081,0x3a,0x290a, + 0x28fc,0x2908,0x50081,0x13,0x290d,0x28f9,0x2905,0x50051,0x13,0x290f,0x28e6,0x2, + 0x500ba,0x47,0x2910,0x290f,0x1e9,0x600a9,0x13,0x2911,0x2910,0x27d,0x1e9,0x5008e, + 0x3a,0x2914,0x28e6,0x2911,0x50081,0x3a,0x2916,0x290a,0x2914,0x50081,0x13,0x2919, + 0x290d,0x2911,0x50051,0x13,0x291b,0x28e8,0x2,0x500ba,0x47,0x291c,0x291b,0x1e9, + 0x600a9,0x13,0x291d,0x291c,0x27d,0x1e9,0x5008e,0x3a,0x2920,0x28e8,0x291d,0x50081, + 0x3a,0x2922,0x2916,0x2920,0x50081,0x13,0x2925,0x2919,0x291d,0x500ba,0x47,0x2927, + 0x2925,0x32b,0x600a9,0x13,0x2929,0x2927,0x2925,0x27d,0x70050,0x3a,0x292b,0x2929, + 0x2929,0x2929,0x2929,0x50088,0x3a,0x292c,0x2922,0x292b,0x300f7,0x28c3,0x0,0x400fa, + 0x278f,0x28a9,0x28c3,0x200f8,0x28a9,0x50086,0x6,0x28af,0x7c7,0x10f,0x4007c,0x1e, + 0x28b0,0x28af,0x50086,0x6,0x28b2,0x7cd,0x10f,0x4007c,0x1e,0x28b3,0x28b2,0x50050, + 0x1f,0x28b4,0x28b0,0x28b3,0x4003d,0x16d,0x2979,0x1c6,0x40063,0x2979,0x28b4,0x292c, + 0x50080,0x6,0x28be,0x886,0x28b2,0x50051,0x13,0x2996,0x292c,0x0,0x60041,0x2cb, + 0x2997,0x2c8,0x28be,0x889,0x3003e,0x2997,0x2996,0x50051,0x13,0x299b,0x292c,0x1, + 0x60041,0x2cb,0x299c,0x2ce,0x28be,0x889,0x3003e,0x299c,0x299b,0x50051,0x13,0x29a0, + 0x292c,0x2,0x60041,0x2cb,0x29a1,0x2d3,0x28be,0x889,0x3003e,0x29a1,0x29a0,0x50051, + 0x13,0x29a5,0x292c,0x3,0x60041,0x2cb,0x29a6,0x2d8,0x28be,0x889,0x3003e,0x29a6, + 0x29a5,0x200f9,0x28c3,0x200f8,0x28c3,0x200f9,0x28c4,0x200f8,0x28c4,0x500b2,0x47,0x2761, + 0x784,0x1cc,0x300f7,0x2763,0x0,0x400fa,0x2761,0x2762,0x2763,0x200f8,0x2762,0x200f9, + 0x277a,0x200f8,0x2763,0x300e1,0x10f,0x335,0x400e0,0x10f,0x10f,0x336,0x500b0,0x47, + 0x29b5,0x74d,0x25b,0x300f7,0x29db,0x0,0x400fa,0x29b5,0x29b6,0x29db,0x200f8,0x29b6, + 0x50080,0x6,0x29ba,0x1c03,0x7cd,0x60041,0x2cb,0x29e0,0x2c8,0x29ba,0x1c07,0x4003d, + 0x13,0x29e1,0x29e0,0x60041,0x2cb,0x29e4,0x2ce,0x29ba,0x1c07,0x4003d,0x13,0x29e5, + 0x29e4,0x60041,0x2cb,0x29e8,0x2d3,0x29ba,0x1c07,0x4003d,0x13,0x29e9,0x29e8,0x60041, + 0x2cb,0x29ec,0x2d8,0x29ba,0x1c07,0x4003d,0x13,0x29ed,0x29ec,0x70050,0x3a,0x29ee, + 0x29e1,0x29e5,0x29e9,0x29ed,0x6016e,0x3a,0x29fb,0x110,0x29ee,0x151,0x6016e,0x3a, + 0x29fd,0x110,0x29ee,0x116,0x6016e,0x3a,0x29ff,0x110,0x29ee,0x10f,0x500ba,0x47, + 0x2a0f,0x29e9,0x1e9,0x600a9,0x13,0x2a10,0x2a0f,0x27d,0x1e9,0x5008e,0x3a,0x2a13, + 0x29ee,0x2a10,0x50051,0x13,0x2a1a,0x29fb,0x2,0x500ba,0x47,0x2a1b,0x2a1a,0x1e9, + 0x600a9,0x13,0x2a1c,0x2a1b,0x27d,0x1e9,0x5008e,0x3a,0x2a1f,0x29fb,0x2a1c,0x50081, + 0x3a,0x2a21,0x2a13,0x2a1f,0x50081,0x13,0x2a24,0x2a10,0x2a1c,0x50051,0x13,0x2a26, + 0x29fd,0x2,0x500ba,0x47,0x2a27,0x2a26,0x1e9,0x600a9,0x13,0x2a28,0x2a27,0x27d, + 0x1e9,0x5008e,0x3a,0x2a2b,0x29fd,0x2a28,0x50081,0x3a,0x2a2d,0x2a21,0x2a2b,0x50081, + 0x13,0x2a30,0x2a24,0x2a28,0x50051,0x13,0x2a32,0x29ff,0x2,0x500ba,0x47,0x2a33, + 0x2a32,0x1e9,0x600a9,0x13,0x2a34,0x2a33,0x27d,0x1e9,0x5008e,0x3a,0x2a37,0x29ff, + 0x2a34,0x50081,0x3a,0x2a39,0x2a2d,0x2a37,0x50081,0x13,0x2a3c,0x2a30,0x2a34,0x500ba, + 0x47,0x2a3e,0x2a3c,0x32b,0x600a9,0x13,0x2a40,0x2a3e,0x2a3c,0x27d,0x70050,0x3a, + 0x2a42,0x2a40,0x2a40,0x2a40,0x2a40,0x50088,0x3a,0x2a43,0x2a39,0x2a42,0x300f7,0x29da, + 0x0,0x400fa,0x278f,0x29c3,0x29da,0x200f8,0x29c3,0x50086,0x6,0x29c9,0x7c7,0x10f, + 0x4007c,0x1e,0x29ca,0x29c9,0x50086,0x6,0x29cc,0x7cd,0x10f,0x4007c,0x1e,0x29cd, + 0x29cc,0x50050,0x1f,0x29ce,0x29ca,0x29cd,0x4003d,0x16d,0x2a97,0x1d0,0x40063,0x2a97, + 0x29ce,0x2a43,0x50080,0x6,0x29d7,0x29c9,0x7cd,0x50051,0x13,0x2aad,0x2a43,0x0, + 0x60041,0x2cb,0x2aae,0x2c8,0x29d7,0x151,0x3003e,0x2aae,0x2aad,0x50051,0x13,0x2ab2, + 0x2a43,0x1,0x60041,0x2cb,0x2ab3,0x2ce,0x29d7,0x151,0x3003e,0x2ab3,0x2ab2,0x50051, + 0x13,0x2ab7,0x2a43,0x2,0x60041,0x2cb,0x2ab8,0x2d3,0x29d7,0x151,0x3003e,0x2ab8, + 0x2ab7,0x50051,0x13,0x2abc,0x2a43,0x3,0x60041,0x2cb,0x2abd,0x2d8,0x29d7,0x151, + 0x3003e,0x2abd,0x2abc,0x200f9,0x29da,0x200f8,0x29da,0x200f9,0x29db,0x200f8,0x29db,0x500b2, + 0x47,0x2770,0x784,0x1d6,0x300f7,0x2772,0x0,0x400fa,0x2770,0x2771,0x2772,0x200f8, + 0x2771,0x200f9,0x277a,0x200f8,0x2772,0x300e1,0x10f,0x335,0x400e0,0x10f,0x10f,0x336, + 0x500b0,0x47,0x2ac9,0x74d,0x190,0x300f7,0x2ada,0x0,0x400fa,0x2ac9,0x2aca,0x2ada, + 0x200f8,0x2aca,0x60041,0x2cb,0x2adf,0x2c8,0x74d,0x151,0x4003d,0x13,0x2ae0,0x2adf, + 0x60041,0x2cb,0x2ae3,0x2ce,0x74d,0x151,0x4003d,0x13,0x2ae4,0x2ae3,0x60041,0x2cb, + 0x2ae7,0x2d3,0x74d,0x151,0x4003d,0x13,0x2ae8,0x2ae7,0x60041,0x2cb,0x2aeb,0x2d8, + 0x74d,0x151,0x4003d,0x13,0x2aec,0x2aeb,0x70050,0x3a,0x2aed,0x2ae0,0x2ae4,0x2ae8, + 0x2aec,0x6016e,0x3a,0x2afa,0x110,0x2aed,0x151,0x6016e,0x3a,0x2afc,0x110,0x2aed, + 0x116,0x6016e,0x3a,0x2afe,0x110,0x2aed,0x10f,0x500ba,0x47,0x2b0e,0x2ae8,0x1e9, + 0x600a9,0x13,0x2b0f,0x2b0e,0x27d,0x1e9,0x5008e,0x3a,0x2b12,0x2aed,0x2b0f,0x50051, + 0x13,0x2b19,0x2afa,0x2,0x500ba,0x47,0x2b1a,0x2b19,0x1e9,0x600a9,0x13,0x2b1b, + 0x2b1a,0x27d,0x1e9,0x5008e,0x3a,0x2b1e,0x2afa,0x2b1b,0x50081,0x3a,0x2b20,0x2b12, + 0x2b1e,0x50081,0x13,0x2b23,0x2b0f,0x2b1b,0x50051,0x13,0x2b25,0x2afc,0x2,0x500ba, + 0x47,0x2b26,0x2b25,0x1e9,0x600a9,0x13,0x2b27,0x2b26,0x27d,0x1e9,0x5008e,0x3a, + 0x2b2a,0x2afc,0x2b27,0x50081,0x3a,0x2b2c,0x2b20,0x2b2a,0x50081,0x13,0x2b2f,0x2b23, + 0x2b27,0x50051,0x13,0x2b31,0x2afe,0x2,0x500ba,0x47,0x2b32,0x2b31,0x1e9,0x600a9, + 0x13,0x2b33,0x2b32,0x27d,0x1e9,0x5008e,0x3a,0x2b36,0x2afe,0x2b33,0x50081,0x3a, + 0x2b38,0x2b2c,0x2b36,0x50081,0x13,0x2b3b,0x2b2f,0x2b33,0x500ba,0x47,0x2b3d,0x2b3b, + 0x32b,0x600a9,0x13,0x2b3f,0x2b3d,0x2b3b,0x27d,0x70050,0x3a,0x2b41,0x2b3f,0x2b3f, + 0x2b3f,0x2b3f,0x50088,0x3a,0x2b42,0x2b38,0x2b41,0x300f7,0x2ad9,0x0,0x400fa,0x278f, + 0x2ad2,0x2ad9,0x200f8,0x2ad2,0x4003d,0x16d,0x2b9d,0x1da,0x40063,0x2b9d,0x4159,0x2b42, + 0x200f9,0x2ad9,0x200f8,0x2ad9,0x200f9,0x2ada,0x200f8,0x2ada,0x200f9,0x277a,0x200f8,0x277a, + 0x200f9,0x7f3,0x200f8,0x7f3,0x100fd,0x10038, +}; +static const char *fi_compute_game_vector_field_inpainting_pyramid_pass_1_cb_names[] = {"cbFI", "cbInpaintingPyramid"}; +static const uint32_t fi_compute_game_vector_field_inpainting_pyramid_pass_1_cb_bind[] = {16, 17}; +static const uint32_t fi_compute_game_vector_field_inpainting_pyramid_pass_1_cb_count[] = {1, 1}; +static const uint32_t fi_compute_game_vector_field_inpainting_pyramid_pass_1_cb_space[] = {0, 0}; +static const char *fi_compute_game_vector_field_inpainting_pyramid_pass_1_srv_tex_names[] = {"r_game_motion_vector_field_x", "r_game_motion_vector_field_y"}; +static const uint32_t fi_compute_game_vector_field_inpainting_pyramid_pass_1_srv_tex_bind[] = {0, 1}; +static const uint32_t fi_compute_game_vector_field_inpainting_pyramid_pass_1_srv_tex_count[] = {1, 1}; +static const uint32_t fi_compute_game_vector_field_inpainting_pyramid_pass_1_srv_tex_space[] = {0, 0}; +static const char *fi_compute_game_vector_field_inpainting_pyramid_pass_1_uav_tex_names[] = {"rw_inpainting_pyramid0", "rw_inpainting_pyramid1", "rw_inpainting_pyramid2", "rw_inpainting_pyramid3", "rw_inpainting_pyramid4", "rw_inpainting_pyramid5", "rw_inpainting_pyramid6", "rw_inpainting_pyramid7", "rw_inpainting_pyramid8", "rw_inpainting_pyramid9", "rw_inpainting_pyramid10", "rw_inpainting_pyramid11"}; +static const uint32_t fi_compute_game_vector_field_inpainting_pyramid_pass_1_uav_tex_bind[] = {3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}; +static const uint32_t fi_compute_game_vector_field_inpainting_pyramid_pass_1_uav_tex_count[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}; +static const uint32_t fi_compute_game_vector_field_inpainting_pyramid_pass_1_uav_tex_space[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; +static const char *fi_compute_game_vector_field_inpainting_pyramid_pass_1_uav_buf_names[] = {"rw_counters"}; +static const uint32_t fi_compute_game_vector_field_inpainting_pyramid_pass_1_uav_buf_bind[] = {2}; +static const uint32_t fi_compute_game_vector_field_inpainting_pyramid_pass_1_uav_buf_count[] = {1}; +static const uint32_t fi_compute_game_vector_field_inpainting_pyramid_pass_1_uav_buf_space[] = {0}; + +static const uint32_t fi_debug_view_pass_1_spv[3800] = { + 0x7230203,0x10500,0x8000b,0x1039,0x0,0x20011,0x1,0x20011,0x38,0x6000b,0x1,0x4c534c47, + 0x6474732e,0x3035342e,0x0,0x3000e,0x0,0x1,0x12000f,0x5,0x4,0x6e69616d,0x0,0xca, + 0xf9,0xfd,0x106,0x111,0x119,0x124,0x12a,0x134,0x13c,0x144,0x14f,0x478, + 0x60010,0x4,0x11,0x8,0x8,0x1,0x30003,0x2,0x1c2,0xb0004,0x455f4c47,0x735f5458, + 0x6c706d61,0x656c7265,0x745f7373,0x75747865,0x665f6572,0x74636e75,0x736e6f69,0x0,0xb0004,0x455f4c47,0x735f5458,0x65646168, + 0x78655f72,0x63696c70,0x615f7469,0x68746972,0x6974656d,0x79745f63,0x736570,0xa0004,0x455f4c47,0x735f5458,0x65646168,0x6d695f72, + 0x5f656761,0x64616f6c,0x726f665f,0x7474616d,0x6465,0xa0004,0x475f4c47,0x4c474f4f,0x70635f45,0x74735f70,0x5f656c79,0x656e696c, + 0x7269645f,0x69746365,0x6576,0x80004,0x475f4c47,0x4c474f4f,0x6e695f45,0x64756c63,0x69645f65,0x74636572,0x657669,0x40005, + 0x4,0x6e69616d,0x0,0xb0005,0x81,0x46786646,0x656d6172,0x65746e49,0x6c6f7072,0x6f697461,0x6265446e,0x69566775, + 0x6f707765,0x7472,0x50006,0x81,0x0,0x7366666f,0x7465,0x50006,0x81,0x1,0x657a6973,0x0, + 0x40005,0xc8,0x49466263,0x745f,0x60006,0xc8,0x0,0x646e6572,0x69537265,0x657a,0x60006,0xc8, + 0x1,0x70736964,0x5379616c,0x657a69,0x90006,0xc8,0x2,0x4c445548,0x41737365,0x63617474,0x46646568,0x6f746361, + 0x72,0x80006,0xc8,0x3,0x6974706f,0x466c6163,0x53776f6c,0x656c6163,0x0,0x90006,0xc8,0x4, + 0x6974706f,0x466c6163,0x42776f6c,0x6b636f6c,0x657a6953,0x0,0x70006,0xc8,0x5,0x5278616d,0x65646e65,0x7a695372, + 0x65,0x40005,0xca,0x49466263,0x0,0xa0005,0xf9,0x75635f72,0x6e657272,0x6e695f74,0x70726574,0x74616c6f, + 0x5f6e6f69,0x72756f73,0x6563,0x60005,0xfd,0x694c5f73,0x7261656e,0x6d616c43,0x70,0x70005,0x106,0x69645f72, + 0x63636f73,0x6973756c,0x6d5f6e6f,0x6b7361,0xa0005,0x111,0x61675f72,0x6d5f656d,0x6f69746f,0x65765f6e,0x726f7463,0x6569665f, + 0x785f646c,0x0,0xa0005,0x119,0x61675f72,0x6d5f656d,0x6f69746f,0x65765f6e,0x726f7463,0x6569665f,0x795f646c,0x0, + 0xc0005,0x124,0x706f5f72,0x61636974,0x6c665f6c,0x6d5f776f,0x6f69746f,0x65765f6e,0x726f7463,0x6569665f,0x785f646c,0x0, + 0xc0005,0x12a,0x706f5f72,0x61636974,0x6c665f6c,0x6d5f776f,0x6f69746f,0x65765f6e,0x726f7463,0x6569665f,0x795f646c,0x0, + 0x80005,0x134,0x6e695f72,0x6e696170,0x676e6974,0x7279705f,0x64696d61,0x0,0x80005,0x13c,0x72705f72,0x6e657365, + 0x61625f74,0x75626b63,0x72656666,0x0,0x90005,0x144,0x6e695f72,0x5f747570,0x74736964,0x6974726f,0x665f6e6f,0x646c6569, + 0x0,0x50005,0x14f,0x6f5f7772,0x75707475,0x74,0x80005,0x478,0x475f6c67,0x61626f6c,0x766e496c,0x7461636f, + 0x496e6f69,0x44,0x30047,0xc8,0x2,0x50048,0xc8,0x0,0x23,0x0,0x50048,0xc8, + 0x1,0x23,0x8,0x50048,0xc8,0x2,0x23,0x44,0x50048,0xc8,0x3,0x23, + 0x50,0x50048,0xc8,0x4,0x23,0x58,0x50048,0xc8,0x5,0x23,0x60,0x40047, + 0xca,0x21,0xa,0x40047,0xca,0x22,0x0,0x40047,0xf9,0x21,0x7,0x40047, + 0xf9,0x22,0x0,0x40047,0xfd,0x21,0x3e8,0x40047,0xfd,0x22,0x0,0x40047, + 0x106,0x21,0x4,0x40047,0x106,0x22,0x0,0x40047,0x111,0x21,0x0,0x40047, + 0x111,0x22,0x0,0x40047,0x119,0x21,0x1,0x40047,0x119,0x22,0x0,0x40047, + 0x124,0x21,0x2,0x40047,0x124,0x22,0x0,0x40047,0x12a,0x21,0x3,0x40047, + 0x12a,0x22,0x0,0x40047,0x134,0x21,0x6,0x40047,0x134,0x22,0x0,0x40047, + 0x13c,0x21,0x5,0x40047,0x13c,0x22,0x0,0x40047,0x144,0x21,0x8,0x40047, + 0x144,0x22,0x0,0x40047,0x14f,0x21,0x9,0x40047,0x14f,0x22,0x0,0x40047, + 0x478,0xb,0x1c,0x40047,0x488,0xb,0x19,0x20013,0x2,0x30021,0x3,0x2, + 0x30016,0x6,0x20,0x40020,0x7,0x7,0x6,0x40017,0x8,0x6,0x2,0x40015, + 0x15,0x20,0x0,0x40015,0x1b,0x20,0x1,0x40017,0x1c,0x1b,0x2,0x40017, + 0x30,0x6,0x4,0x40020,0x35,0x7,0x1c,0x40017,0x36,0x15,0x2,0x4002b, + 0x15,0x51,0x4,0x4001c,0x52,0x1c,0x51,0x4001c,0x53,0x6,0x51,0x20014, + 0x5a,0x4001e,0x81,0x1c,0x1c,0x40020,0x82,0x7,0x81,0x4002b,0x6,0xb7, + 0x0,0x4002b,0x6,0xba,0x3f800000,0x8001e,0xc8,0x1c,0x1c,0x1b,0x8,0x1b, + 0x1c,0x40020,0xc9,0x2,0xc8,0x4003b,0xc9,0xca,0x2,0x4002b,0x1b,0xcb, + 0x0,0x40020,0xcc,0x2,0x1c,0x4002b,0x1b,0xd1,0x1,0x40020,0xd8,0x2, + 0x8,0x40020,0xde,0x2,0x1b,0x90019,0xf7,0x6,0x1,0x0,0x0,0x0, + 0x1,0x0,0x40020,0xf8,0x0,0xf7,0x4003b,0xf8,0xf9,0x0,0x2001a,0xfb, + 0x40020,0xfc,0x0,0xfb,0x4003b,0xfc,0xfd,0x0,0x3001b,0xff,0xf7,0x4003b, + 0xf8,0x106,0x0,0x90019,0x10f,0x15,0x1,0x0,0x0,0x0,0x1,0x0, + 0x40020,0x110,0x0,0x10f,0x4003b,0x110,0x111,0x0,0x40017,0x114,0x15,0x4, + 0x4002b,0x15,0x116,0x0,0x4003b,0x110,0x119,0x0,0x4003b,0x110,0x124,0x0, + 0x4003b,0x110,0x12a,0x0,0x4003b,0xf8,0x134,0x0,0x4003b,0xf8,0x13c,0x0, + 0x4003b,0xf8,0x144,0x0,0x90019,0x14d,0x6,0x1,0x0,0x0,0x0,0x2, + 0x0,0x40020,0x14e,0x0,0x14d,0x4003b,0x14e,0x14f,0x0,0x4002b,0x6,0x158, + 0x3f000000,0x5002c,0x8,0x159,0x158,0x158,0x4002b,0x1b,0x15d,0x2,0x5002c,0x1c, + 0x166,0xcb,0xcb,0x5002c,0x1c,0x168,0xd1,0xcb,0x5002c,0x1c,0x16a,0xcb, + 0xd1,0x4002b,0x1b,0x16c,0x3,0x5002c,0x1c,0x16d,0xd1,0xd1,0x4002b,0x15, + 0x172,0x1,0x40017,0x193,0x5a,0x2,0x5002c,0x8,0x1b0,0xb7,0xb7,0x4002b, + 0x1b,0x1b7,0x4,0x4002b,0x15,0x1c7,0x80000000,0x4002b,0x15,0x1ce,0x15,0x4002b, + 0x15,0x1d0,0x3ff,0x7002c,0x30,0x20e,0xb7,0xb7,0xb7,0xb7,0x4002b,0x1b, + 0x270,0xb,0x4002b,0x15,0x274,0x3,0x4002b,0x6,0x331,0x3dcccccd,0x4002b,0x6, + 0x39e,0x41200000,0x4002b,0x6,0x3f6,0x3eaaaaab,0x5002c,0x8,0x3f7,0x3f6,0x3f6,0x4001c, + 0x40e,0x81,0x274,0x4001c,0x40f,0x40e,0x274,0x40020,0x410,0x7,0x40f,0x40017, + 0x476,0x15,0x3,0x40020,0x477,0x1,0x476,0x4003b,0x477,0x478,0x1,0x4002b, + 0x15,0x487,0x8,0x6002c,0x476,0x488,0x487,0x487,0x172,0x40020,0xc23,0x7, + 0x52,0x40020,0xc25,0x7,0x53,0x5002c,0x8,0xfa1,0xba,0xba,0x7002c,0x52, + 0xfa2,0x166,0x168,0x16a,0x16d,0x5002c,0x1c,0xfa4,0x15d,0x15d,0x4002b,0x6, + 0xfa5,0x3a802008,0x4002b,0x15,0x100c,0x5,0x4002b,0x15,0x100d,0x2,0x50036,0x2, + 0x4,0x0,0x3,0x200f8,0x5,0x4003b,0xc25,0xced,0x7,0x4003b,0xc23,0xcec, + 0x7,0x4003b,0xc25,0xc95,0x7,0x4003b,0xc23,0xc94,0x7,0x4003b,0xc25,0xc3f, + 0x7,0x4003b,0xc23,0xc3e,0x7,0x4003b,0x410,0x48d,0x7,0x4003d,0x476,0x479, + 0x478,0x7004f,0x36,0x47a,0x479,0x479,0x0,0x1,0x4007c,0x1c,0x47b,0x47a, + 0x50041,0xcc,0x508,0xca,0xd1,0x4003d,0x1c,0x509,0x508,0x4006f,0x8,0x4a8, + 0x509,0x50085,0x8,0x4aa,0x4a8,0x3f7,0x4006e,0x1c,0x4ab,0x4aa,0x200f9,0x4ac, + 0x200f8,0x4ac,0x700f5,0x1b,0xdff,0xcb,0x5,0x4c8,0x4c6,0x500b1,0x5a,0x4af, + 0xdff,0x16c,0x400f6,0x4c9,0x4c6,0x0,0x400fa,0x4af,0x4b0,0x4c9,0x200f8,0x4b0, + 0x200f9,0x4b1,0x200f8,0x4b1,0x700f5,0x1b,0xf66,0xcb,0x4b0,0x4c4,0x4b5,0x500b1, + 0x5a,0x4b4,0xf66,0x16c,0x400f6,0x4c5,0x4b5,0x0,0x400fa,0x4b4,0x4b5,0x4c5, + 0x200f8,0x4b5,0x50050,0x1c,0x4bb,0xf66,0xdff,0x50084,0x1c,0x4bc,0x4ab,0x4bb, + 0x70041,0x35,0x4bd,0x48d,0xdff,0xf66,0xcb,0x3003e,0x4bd,0x4bc,0x70041,0x35, + 0x4c1,0x48d,0xdff,0xf66,0xd1,0x3003e,0x4c1,0x4ab,0x50080,0x1b,0x4c4,0xf66, + 0xd1,0x200f9,0x4b1,0x200f8,0x4c5,0x200f9,0x4c6,0x200f8,0x4c6,0x50080,0x1b,0x4c8, + 0xdff,0xd1,0x200f9,0x4ac,0x200f8,0x4c9,0x60041,0x82,0x4cb,0x48d,0xcb,0xcb, + 0x4003d,0x81,0x4cc,0x4cb,0x50051,0x1c,0xd2c,0x4cc,0x0,0x50051,0x1c,0xd2d, + 0x4cc,0x1,0x50080,0x1c,0x511,0xd2c,0xd2d,0x50051,0x1b,0x513,0x47b,0x0, + 0x50051,0x1b,0x515,0xd2c,0x0,0x500af,0x5a,0x516,0x513,0x515,0x300f7,0x51d, + 0x0,0x400fa,0x516,0x517,0x51d,0x200f8,0x517,0x50051,0x1b,0x51b,0x511,0x0, + 0x500b1,0x5a,0x51c,0x513,0x51b,0x200f9,0x51d,0x200f8,0x51d,0x700f5,0x5a,0x51e, + 0x516,0x4c9,0x51c,0x517,0x300f7,0x52d,0x0,0x400fa,0x51e,0x51f,0x52d,0x200f8, + 0x51f,0x50051,0x1b,0x521,0x47b,0x1,0x50051,0x1b,0x523,0xd2c,0x1,0x500af, + 0x5a,0x524,0x521,0x523,0x300f7,0x52b,0x0,0x400fa,0x524,0x525,0x52b,0x200f8, + 0x525,0x50051,0x1b,0x529,0x511,0x1,0x500b1,0x5a,0x52a,0x521,0x529,0x200f9, + 0x52b,0x200f8,0x52b,0x700f5,0x5a,0x52c,0x524,0x51f,0x52a,0x525,0x200f9,0x52d, + 0x200f8,0x52d,0x700f5,0x5a,0x52e,0x51e,0x51d,0x52c,0x52b,0x300f7,0x4d3,0x0, + 0x400fa,0x52e,0x4ce,0x4d3,0x200f8,0x4ce,0x4003d,0x81,0x4d1,0x4cb,0x50051,0x1c, + 0xd0d,0x4d1,0x0,0x50051,0x1c,0xd0e,0x4d1,0x1,0x50082,0x1c,0x54a,0x47b, + 0xd0d,0x4006f,0x8,0x54b,0x54a,0x50081,0x8,0x54d,0x54b,0x159,0x4006f,0x8, + 0x550,0xd0e,0x50088,0x8,0x551,0x54d,0x550,0x50041,0xcc,0x5a3,0xca,0xcb, + 0x4003d,0x1c,0x5a4,0x5a3,0x4006f,0x8,0x561,0x5a4,0x50085,0x8,0x562,0x551, + 0x561,0x4006e,0x1c,0x563,0x562,0x4003d,0x10f,0x5a9,0x111,0x7005f,0x114,0x5ab, + 0x5a9,0x563,0x2002,0xcb,0x50051,0x15,0x5ac,0x5ab,0x0,0x4003d,0x10f,0x5ad, + 0x119,0x7005f,0x114,0x5af,0x5ad,0x563,0x2002,0xcb,0x50051,0x15,0x5b0,0x5af, + 0x0,0x500c2,0x15,0x5ba,0x5ac,0x1ce,0x500c7,0x15,0x5bb,0x5ba,0x1d0,0x40070, + 0x6,0x5bc,0x5bb,0x50085,0x6,0x5bd,0x5bc,0xfa5,0x6000c,0x8,0x5f2,0x1, + 0x3e,0x5ac,0x50051,0x6,0x5e2,0x5f2,0x0,0x6000c,0x8,0x5f6,0x1,0x3e, + 0x5b0,0x50051,0x6,0x5e7,0x5f6,0x0,0x50050,0x8,0x1037,0x5e2,0x5e7,0x500bd, + 0x5a,0x56b,0x5bd,0xb7,0x300f7,0x58e,0x0,0x400fa,0x56b,0x56c,0x58e,0x200f8, + 0x56c,0x200f9,0x56e,0x200f8,0x56e,0x700f5,0x30,0x1013,0x20e,0x56c,0x642,0x580, + 0x700f5,0x1c,0xf5f,0x5a4,0x56c,0x57b,0x580,0x700f5,0x1b,0xe21,0xcb,0x56c, + 0x582,0x580,0x400f6,0x583,0x580,0x0,0x200f9,0x56f,0x200f8,0x56f,0x500b1,0x5a, + 0x571,0xe21,0x270,0x300f7,0x576,0x0,0x400fa,0x571,0x572,0x576,0x200f8,0x572, + 0x50051,0x6,0x574,0x1013,0x3,0x500b4,0x5a,0x575,0x574,0xb7,0x200f9,0x576, + 0x200f8,0x576,0x700f5,0x5a,0x577,0x571,0x56f,0x575,0x572,0x400fa,0x577,0x578, + 0x583,0x200f8,0x578,0x50087,0x1c,0x57b,0xf5f,0xfa4,0x4006f,0x8,0x64c,0x57b, + 0x50085,0x8,0x64d,0x551,0x64c,0x50083,0x8,0x64e,0x64d,0x159,0x6000c,0x8, + 0x650,0x1,0x8,0x64e,0x4006e,0x1c,0x651,0x650,0x6000c,0x8,0x679,0x1, + 0xa,0x64e,0x50051,0x6,0x65a,0x679,0x0,0x50083,0x6,0x65b,0xba,0x65a, + 0x50051,0x6,0x65d,0x679,0x1,0x50083,0x6,0x65e,0xba,0x65d,0x50085,0x6, + 0x65f,0x65b,0x65e,0x50085,0x6,0x666,0x65a,0x65e,0x50085,0x6,0x66d,0x65b, + 0x65d,0x50085,0x6,0x673,0x65a,0x65d,0x70050,0x53,0xdfe,0x65f,0x666,0x66d, + 0x673,0x3003e,0xcec,0xfa2,0x3003e,0xced,0xdfe,0x200f9,0x610,0x200f8,0x610,0x700f5, + 0x30,0x102d,0x20e,0x578,0x1036,0x638,0x700f5,0x6,0xf62,0xb7,0x578,0xf9e, + 0x638,0x700f5,0x1b,0xf61,0xcb,0x578,0x63a,0x638,0x500b1,0x5a,0x613,0xf61, + 0x1b7,0x400f6,0x63b,0x638,0x0,0x400fa,0x613,0x614,0x63b,0x200f8,0x614,0x50041, + 0x35,0xcf2,0xcec,0xf61,0x4003d,0x1c,0x617,0xcf2,0x50080,0x1c,0x61b,0x651, + 0x617,0x4007c,0x36,0x67d,0x61b,0x4007c,0x36,0x67f,0x57b,0x500b0,0x193,0x680, + 0x67d,0x67f,0x4009b,0x5a,0x681,0x680,0x300f7,0x637,0x0,0x400fa,0x681,0x61e, + 0x637,0x200f8,0x61e,0x4003d,0xf7,0x684,0x134,0x7005f,0x30,0x688,0x684,0x61b, + 0x2,0xe21,0x50051,0x6,0x623,0x688,0x2,0x500ba,0x5a,0x626,0x623,0xb7, + 0x600a9,0x6,0x627,0x626,0xba,0xb7,0x50041,0x7,0xcf3,0xced,0xf61,0x4003d, + 0x6,0x62a,0xcf3,0x50085,0x6,0x62c,0x62a,0x627,0x50085,0x6,0x62e,0x62c, + 0x623,0x50081,0x6,0x631,0xf62,0x62e,0x5008e,0x30,0x634,0x688,0x62e,0x50081, + 0x30,0x636,0x102d,0x634,0x200f9,0x637,0x200f8,0x637,0x700f5,0x30,0x1036,0x102d, + 0x614,0x636,0x61e,0x700f5,0x6,0xf9e,0xf62,0x614,0x631,0x61e,0x200f9,0x638, + 0x200f8,0x638,0x50080,0x1b,0x63a,0xf61,0xd1,0x200f9,0x610,0x200f8,0x63b,0x500ba, + 0x5a,0x63d,0xf62,0xb7,0x600a9,0x6,0x63f,0x63d,0xf62,0xba,0x70050,0x30, + 0x641,0x63f,0x63f,0x63f,0x63f,0x50088,0x30,0x642,0x102d,0x641,0x200f9,0x580, + 0x200f8,0x580,0x50080,0x1b,0x582,0xe21,0xd1,0x200f9,0x56e,0x200f8,0x583,0x7004f, + 0x8,0x585,0x1013,0x1013,0x0,0x1,0x200f9,0x58e,0x200f8,0x58e,0x700f5,0x8, + 0xe27,0x1037,0x4ce,0x585,0x583,0x50085,0x8,0x6bc,0xe27,0x4a8,0x5008e,0x8, + 0x6bd,0x6bc,0x331,0x50081,0x8,0x6bf,0x159,0x6bd,0x50051,0x6,0x6c0,0x6bf, + 0x0,0x50051,0x6,0x6c1,0x6bf,0x1,0x70050,0x30,0x6c2,0x6c0,0x6c1,0x158, + 0xba,0x4003d,0x14d,0x6c8,0x14f,0x40063,0x6c8,0x47b,0x6c2,0x200f9,0x4d3,0x200f8, + 0x4d3,0x60041,0x82,0x4d5,0x48d,0xcb,0xd1,0x4003d,0x81,0x4d6,0x4d5,0x50051, + 0x1c,0xd39,0x4d6,0x0,0x50051,0x1c,0xd3a,0x4d6,0x1,0x50080,0x1c,0x6d2, + 0xd39,0xd3a,0x50051,0x1b,0x6d6,0xd39,0x0,0x500af,0x5a,0x6d7,0x513,0x6d6, + 0x300f7,0x6de,0x0,0x400fa,0x6d7,0x6d8,0x6de,0x200f8,0x6d8,0x50051,0x1b,0x6dc, + 0x6d2,0x0,0x500b1,0x5a,0x6dd,0x513,0x6dc,0x200f9,0x6de,0x200f8,0x6de,0x700f5, + 0x5a,0x6df,0x6d7,0x4d3,0x6dd,0x6d8,0x300f7,0x6ee,0x0,0x400fa,0x6df,0x6e0, + 0x6ee,0x200f8,0x6e0,0x50051,0x1b,0x6e2,0x47b,0x1,0x50051,0x1b,0x6e4,0xd39, + 0x1,0x500af,0x5a,0x6e5,0x6e2,0x6e4,0x300f7,0x6ec,0x0,0x400fa,0x6e5,0x6e6, + 0x6ec,0x200f8,0x6e6,0x50051,0x1b,0x6ea,0x6d2,0x1,0x500b1,0x5a,0x6eb,0x6e2, + 0x6ea,0x200f9,0x6ec,0x200f8,0x6ec,0x700f5,0x5a,0x6ed,0x6e5,0x6e0,0x6eb,0x6e6, + 0x200f9,0x6ee,0x200f8,0x6ee,0x700f5,0x5a,0x6ef,0x6df,0x6de,0x6ed,0x6ec,0x300f7, + 0x4dd,0x0,0x400fa,0x6ef,0x4d8,0x4dd,0x200f8,0x4d8,0x4003d,0x81,0x4db,0x4d5, + 0x50051,0x1c,0xcb5,0x4db,0x0,0x50051,0x1c,0xcb6,0x4db,0x1,0x50082,0x1c, + 0x70a,0x47b,0xcb5,0x4006f,0x8,0x70b,0x70a,0x50081,0x8,0x70d,0x70b,0x159, + 0x4006f,0x8,0x710,0xcb6,0x50088,0x8,0x711,0x70d,0x710,0x50041,0xcc,0x763, + 0xca,0xcb,0x4003d,0x1c,0x764,0x763,0x4006f,0x8,0x721,0x764,0x50085,0x8, + 0x722,0x711,0x721,0x4006e,0x1c,0x723,0x722,0x4003d,0x10f,0x769,0x111,0x7005f, + 0x114,0x76b,0x769,0x723,0x2002,0xcb,0x50051,0x15,0x76c,0x76b,0x0,0x500c2, + 0x15,0x77a,0x76c,0x1ce,0x500c7,0x15,0x77b,0x77a,0x1d0,0x40070,0x6,0x77c, + 0x77b,0x50085,0x6,0x77d,0x77c,0xfa5,0x500c7,0x15,0x7ad,0x76c,0x1c7,0x500ba, + 0x5a,0x78c,0x77d,0xb7,0x300f7,0x794,0x0,0x400fa,0x78c,0x790,0x794,0x200f8, + 0x790,0x500aa,0x5a,0x793,0x7ad,0x116,0x200f9,0x794,0x200f8,0x794,0x700f5,0x5a, + 0x795,0x78c,0x4d8,0x793,0x790,0x300f7,0x79e,0x0,0x400fa,0x795,0x799,0x79e, + 0x200f8,0x799,0x50083,0x6,0x79c,0xba,0x77d,0x200f9,0x79e,0x200f8,0x79e,0x700f5, + 0x6,0xeb3,0x77d,0x794,0x79c,0x799,0x400a8,0x5a,0x72b,0x78c,0x300f7,0x74e, + 0x0,0x400fa,0x72b,0x72c,0x74e,0x200f8,0x72c,0x200f9,0x72e,0x200f8,0x72e,0x700f5, + 0x30,0x1015,0x20e,0x72c,0x802,0x740,0x700f5,0x1c,0xf57,0x764,0x72c,0x73b, + 0x740,0x700f5,0x1b,0xeb4,0xcb,0x72c,0x742,0x740,0x400f6,0x743,0x740,0x0, + 0x200f9,0x72f,0x200f8,0x72f,0x500b1,0x5a,0x731,0xeb4,0x270,0x300f7,0x736,0x0, + 0x400fa,0x731,0x732,0x736,0x200f8,0x732,0x50051,0x6,0x734,0x1015,0x3,0x500b4, + 0x5a,0x735,0x734,0xb7,0x200f9,0x736,0x200f8,0x736,0x700f5,0x5a,0x737,0x731, + 0x72f,0x735,0x732,0x400fa,0x737,0x738,0x743,0x200f8,0x738,0x50087,0x1c,0x73b, + 0xf57,0xfa4,0x4006f,0x8,0x80c,0x73b,0x50085,0x8,0x80d,0x711,0x80c,0x50083, + 0x8,0x80e,0x80d,0x159,0x6000c,0x8,0x810,0x1,0x8,0x80e,0x4006e,0x1c, + 0x811,0x810,0x6000c,0x8,0x839,0x1,0xa,0x80e,0x50051,0x6,0x81a,0x839, + 0x0,0x50083,0x6,0x81b,0xba,0x81a,0x50051,0x6,0x81d,0x839,0x1,0x50083, + 0x6,0x81e,0xba,0x81d,0x50085,0x6,0x81f,0x81b,0x81e,0x50085,0x6,0x826, + 0x81a,0x81e,0x50085,0x6,0x82d,0x81b,0x81d,0x50085,0x6,0x833,0x81a,0x81d, + 0x70050,0x53,0xdd2,0x81f,0x826,0x82d,0x833,0x3003e,0xc94,0xfa2,0x3003e,0xc95, + 0xdd2,0x200f9,0x7d0,0x200f8,0x7d0,0x700f5,0x30,0x102c,0x20e,0x738,0x1035,0x7f8, + 0x700f5,0x6,0xf5a,0xb7,0x738,0xf99,0x7f8,0x700f5,0x1b,0xf59,0xcb,0x738, + 0x7fa,0x7f8,0x500b1,0x5a,0x7d3,0xf59,0x1b7,0x400f6,0x7fb,0x7f8,0x0,0x400fa, + 0x7d3,0x7d4,0x7fb,0x200f8,0x7d4,0x50041,0x35,0xc9a,0xc94,0xf59,0x4003d,0x1c, + 0x7d7,0xc9a,0x50080,0x1c,0x7db,0x811,0x7d7,0x4007c,0x36,0x83d,0x7db,0x4007c, + 0x36,0x83f,0x73b,0x500b0,0x193,0x840,0x83d,0x83f,0x4009b,0x5a,0x841,0x840, + 0x300f7,0x7f7,0x0,0x400fa,0x841,0x7de,0x7f7,0x200f8,0x7de,0x4003d,0xf7,0x844, + 0x134,0x7005f,0x30,0x848,0x844,0x7db,0x2,0xeb4,0x50051,0x6,0x7e3,0x848, + 0x2,0x500ba,0x5a,0x7e6,0x7e3,0xb7,0x600a9,0x6,0x7e7,0x7e6,0xba,0xb7, + 0x50041,0x7,0xc9b,0xc95,0xf59,0x4003d,0x6,0x7ea,0xc9b,0x50085,0x6,0x7ec, + 0x7ea,0x7e7,0x50085,0x6,0x7ee,0x7ec,0x7e3,0x50081,0x6,0x7f1,0xf5a,0x7ee, + 0x5008e,0x30,0x7f4,0x848,0x7ee,0x50081,0x30,0x7f6,0x102c,0x7f4,0x200f9,0x7f7, + 0x200f8,0x7f7,0x700f5,0x30,0x1035,0x102c,0x7d4,0x7f6,0x7de,0x700f5,0x6,0xf99, + 0xf5a,0x7d4,0x7f1,0x7de,0x200f9,0x7f8,0x200f8,0x7f8,0x50080,0x1b,0x7fa,0xf59, + 0xd1,0x200f9,0x7d0,0x200f8,0x7fb,0x500ba,0x5a,0x7fd,0xf5a,0xb7,0x600a9,0x6, + 0x7ff,0x7fd,0xf5a,0xba,0x70050,0x30,0x801,0x7ff,0x7ff,0x7ff,0x7ff,0x50088, + 0x30,0x802,0x102c,0x801,0x200f9,0x740,0x200f8,0x740,0x50080,0x1b,0x742,0xeb4, + 0xd1,0x200f9,0x72e,0x200f8,0x743,0x50051,0x6,0x748,0x1015,0x2,0x200f9,0x74e, + 0x200f8,0x74e,0x700f5,0x6,0xee2,0xeb3,0x79e,0x748,0x743,0x70050,0x30,0x701, + 0xb7,0xee2,0xb7,0xba,0x4003d,0x14d,0x878,0x14f,0x40063,0x878,0x47b,0x701, + 0x200f9,0x4dd,0x200f8,0x4dd,0x60041,0x82,0x4df,0x48d,0xcb,0x15d,0x4003d,0x81, + 0x4e0,0x4df,0x50051,0x1c,0xd46,0x4e0,0x0,0x50051,0x1c,0xd47,0x4e0,0x1, + 0x50080,0x1c,0x882,0xd46,0xd47,0x50051,0x1b,0x886,0xd46,0x0,0x500af,0x5a, + 0x887,0x513,0x886,0x300f7,0x88e,0x0,0x400fa,0x887,0x888,0x88e,0x200f8,0x888, + 0x50051,0x1b,0x88c,0x882,0x0,0x500b1,0x5a,0x88d,0x513,0x88c,0x200f9,0x88e, + 0x200f8,0x88e,0x700f5,0x5a,0x88f,0x887,0x4dd,0x88d,0x888,0x300f7,0x89e,0x0, + 0x400fa,0x88f,0x890,0x89e,0x200f8,0x890,0x50051,0x1b,0x892,0x47b,0x1,0x50051, + 0x1b,0x894,0xd46,0x1,0x500af,0x5a,0x895,0x892,0x894,0x300f7,0x89c,0x0, + 0x400fa,0x895,0x896,0x89c,0x200f8,0x896,0x50051,0x1b,0x89a,0x882,0x1,0x500b1, + 0x5a,0x89b,0x892,0x89a,0x200f9,0x89c,0x200f8,0x89c,0x700f5,0x5a,0x89d,0x895, + 0x890,0x89b,0x896,0x200f9,0x89e,0x200f8,0x89e,0x700f5,0x5a,0x89f,0x88f,0x88e, + 0x89d,0x89c,0x300f7,0x4e7,0x0,0x400fa,0x89f,0x4e2,0x4e7,0x200f8,0x4e2,0x4003d, + 0x81,0x4e5,0x4df,0x50051,0x1c,0xc64,0x4e5,0x0,0x50051,0x1c,0xc65,0x4e5, + 0x1,0x50082,0x1c,0x8bb,0x47b,0xc64,0x4006f,0x8,0x8bc,0x8bb,0x50081,0x8, + 0x8be,0x8bc,0x159,0x4006f,0x8,0x8c1,0xc65,0x50088,0x8,0x8c2,0x8be,0x8c1, + 0x50041,0xd8,0x949,0xca,0x274,0x4003d,0x8,0x94a,0x949,0x50088,0x8,0x94c, + 0xfa1,0x94a,0x50041,0xde,0x94d,0xca,0x51,0x4003d,0x1b,0x94e,0x94d,0x50050, + 0x1c,0x94f,0x94e,0x94e,0x4006f,0x8,0x950,0x94f,0x50088,0x8,0x951,0x94c, + 0x950,0x4006e,0x1c,0x952,0x951,0x50084,0x1c,0x945,0x952,0x16d,0x4006f,0x8, + 0x8d7,0x945,0x5008e,0x8,0x8d8,0x8d7,0xba,0x4006e,0x1c,0x8d9,0x8d8,0x4006f, + 0x8,0x95c,0x8d9,0x50085,0x8,0x95d,0x8c2,0x95c,0x50083,0x8,0x95e,0x95d, + 0x159,0x6000c,0x8,0x960,0x1,0x8,0x95e,0x4006e,0x1c,0x961,0x960,0x6000c, + 0x8,0x989,0x1,0xa,0x95e,0x50051,0x6,0x96a,0x989,0x0,0x50083,0x6, + 0x96b,0xba,0x96a,0x50051,0x6,0x96d,0x989,0x1,0x50083,0x6,0x96e,0xba, + 0x96d,0x50085,0x6,0x96f,0x96b,0x96e,0x50085,0x6,0x976,0x96a,0x96e,0x50085, + 0x6,0x97d,0x96b,0x96d,0x50085,0x6,0x983,0x96a,0x96d,0x70050,0x53,0xda6, + 0x96f,0x976,0x97d,0x983,0x3003e,0xc3e,0xfa2,0x3003e,0xc3f,0xda6,0x200f9,0x8dd, + 0x200f8,0x8dd,0x700f5,0x8,0xf01,0x1b0,0x4e2,0xf88,0x917,0x700f5,0x6,0xf00, + 0xb7,0x4e2,0xf87,0x917,0x700f5,0x1b,0xeff,0xcb,0x4e2,0x919,0x917,0x500b1, + 0x5a,0x8e0,0xeff,0x1b7,0x400f6,0x91a,0x917,0x0,0x400fa,0x8e0,0x8e1,0x91a, + 0x200f8,0x8e1,0x50041,0x35,0xc44,0xc3e,0xeff,0x4003d,0x1c,0x8e4,0xc44,0x50080, + 0x1c,0x8e8,0x961,0x8e4,0x4007c,0x36,0x9ae,0x8e8,0x4007c,0x36,0x9b0,0x8d9, + 0x500b0,0x193,0x9b1,0x9ae,0x9b0,0x4009b,0x5a,0x9b2,0x9b1,0x300f7,0x916,0x0, + 0x400fa,0x9b2,0x8ef,0x916,0x200f8,0x8ef,0x50041,0x7,0xc45,0xc3f,0xeff,0x4003d, + 0x6,0x8f2,0xc45,0x4003d,0x10f,0x9c5,0x124,0x7005f,0x114,0x9c7,0x9c5,0x8e8, + 0x2002,0xcb,0x50051,0x15,0x9c8,0x9c7,0x0,0x4003d,0x10f,0x9c9,0x12a,0x7005f, + 0x114,0x9cb,0x9c9,0x8e8,0x2002,0xcb,0x50051,0x15,0x9cc,0x9cb,0x0,0x6000c, + 0x8,0xa0e,0x1,0x3e,0x9c8,0x50051,0x6,0x9fe,0xa0e,0x0,0x6000c,0x8, + 0xa12,0x1,0x3e,0x9cc,0x50051,0x6,0xa03,0xa12,0x0,0x50050,0x8,0x1038, + 0x9fe,0xa03,0x5008e,0x8,0x8fe,0x1038,0x8f2,0x50081,0x8,0x901,0xf01,0x8fe, + 0x50081,0x6,0x915,0xf00,0x8f2,0x200f9,0x916,0x200f8,0x916,0x700f5,0x8,0xf88, + 0xf01,0x8e1,0x901,0x8ef,0x700f5,0x6,0xf87,0xf00,0x8e1,0x915,0x8ef,0x200f9, + 0x917,0x200f8,0x917,0x50080,0x1b,0x919,0xeff,0xd1,0x200f9,0x8dd,0x200f8,0x91a, + 0x500ba,0x5a,0x91c,0xf00,0xb7,0x300f7,0x92e,0x0,0x400fa,0x91c,0x91d,0x92e, + 0x200f8,0x91d,0x50050,0x8,0x921,0xf00,0xf00,0x50088,0x8,0x922,0xf01,0x921, + 0x200f9,0x92e,0x200f8,0x92e,0x700f5,0x8,0xf06,0xf01,0x91a,0x922,0x91d,0x50085, + 0x8,0xa46,0xf06,0x4a8,0x5008e,0x8,0xa47,0xa46,0x331,0x50081,0x8,0xa49, + 0x159,0xa47,0x50051,0x6,0xa4a,0xa49,0x0,0x50051,0x6,0xa4b,0xa49,0x1, + 0x70050,0x30,0xa4c,0xa4a,0xa4b,0x158,0xba,0x4003d,0x14d,0xa52,0x14f,0x40063, + 0xa52,0x47b,0xa4c,0x200f9,0x4e7,0x200f8,0x4e7,0x60041,0x82,0x4e9,0x48d,0x15d, + 0xcb,0x4003d,0x81,0x4ea,0x4e9,0x50051,0x1c,0xd53,0x4ea,0x0,0x50051,0x1c, + 0xd54,0x4ea,0x1,0x50080,0x1c,0xa5c,0xd53,0xd54,0x50051,0x1b,0xa60,0xd53, + 0x0,0x500af,0x5a,0xa61,0x513,0xa60,0x300f7,0xa68,0x0,0x400fa,0xa61,0xa62, + 0xa68,0x200f8,0xa62,0x50051,0x1b,0xa66,0xa5c,0x0,0x500b1,0x5a,0xa67,0x513, + 0xa66,0x200f9,0xa68,0x200f8,0xa68,0x700f5,0x5a,0xa69,0xa61,0x4e7,0xa67,0xa62, + 0x300f7,0xa78,0x0,0x400fa,0xa69,0xa6a,0xa78,0x200f8,0xa6a,0x50051,0x1b,0xa6c, + 0x47b,0x1,0x50051,0x1b,0xa6e,0xd53,0x1,0x500af,0x5a,0xa6f,0xa6c,0xa6e, + 0x300f7,0xa76,0x0,0x400fa,0xa6f,0xa70,0xa76,0x200f8,0xa70,0x50051,0x1b,0xa74, + 0xa5c,0x1,0x500b1,0x5a,0xa75,0xa6c,0xa74,0x200f9,0xa76,0x200f8,0xa76,0x700f5, + 0x5a,0xa77,0xa6f,0xa6a,0xa75,0xa70,0x200f9,0xa78,0x200f8,0xa78,0x700f5,0x5a, + 0xa79,0xa69,0xa68,0xa77,0xa76,0x300f7,0x4f1,0x0,0x400fa,0xa79,0x4ec,0x4f1, + 0x200f8,0x4ec,0x4003d,0x81,0x4ef,0x4e9,0x50051,0x1c,0xbb9,0x4ef,0x0,0x50051, + 0x1c,0xbba,0x4ef,0x1,0x50082,0x1c,0xa9e,0x47b,0xbb9,0x4006f,0x8,0xa9f, + 0xa9e,0x50081,0x8,0xaa1,0xa9f,0x159,0x4006f,0x8,0xaa4,0xbba,0x50088,0x8, + 0xaa5,0xaa1,0xaa4,0x50041,0xcc,0xaa9,0xca,0xcb,0x4003d,0x1c,0xaaa,0xaa9, + 0x4006f,0x8,0xa89,0xaaa,0x50041,0xcc,0xaad,0xca,0x100c,0x4003d,0x1c,0xaae, + 0xaad,0x4006f,0x8,0xa8b,0xaae,0x50088,0x8,0xa8c,0xa89,0xa8b,0x50085,0x8, + 0xa8d,0xaa5,0xa8c,0x4003d,0xf7,0xab1,0x106,0x4003d,0xfb,0xab2,0xfd,0x50056, + 0xff,0xab3,0xab1,0xab2,0x70058,0x30,0xab5,0xab3,0xa8d,0x2,0xb7,0x7004f, + 0x8,0xa90,0xab5,0xab5,0x0,0x1,0x8000c,0x8,0xabd,0x1,0x2b,0xa90, + 0x1b0,0xfa1,0x50051,0x6,0xa93,0xabd,0x0,0x50051,0x6,0xa94,0xabd,0x1, + 0x70050,0x30,0xa95,0xa93,0xa94,0xb7,0xba,0x4003d,0x14d,0xac7,0x14f,0x40063, + 0xac7,0x47b,0xa95,0x200f9,0x4f1,0x200f8,0x4f1,0x60041,0x82,0x4f3,0x48d,0x15d, + 0xd1,0x4003d,0x81,0x4f4,0x4f3,0x50051,0x1c,0xd60,0x4f4,0x0,0x50051,0x1c, + 0xd61,0x4f4,0x1,0x50080,0x1c,0xad1,0xd60,0xd61,0x50051,0x1b,0xad5,0xd60, + 0x0,0x500af,0x5a,0xad6,0x513,0xad5,0x300f7,0xadd,0x0,0x400fa,0xad6,0xad7, + 0xadd,0x200f8,0xad7,0x50051,0x1b,0xadb,0xad1,0x0,0x500b1,0x5a,0xadc,0x513, + 0xadb,0x200f9,0xadd,0x200f8,0xadd,0x700f5,0x5a,0xade,0xad6,0x4f1,0xadc,0xad7, + 0x300f7,0xaed,0x0,0x400fa,0xade,0xadf,0xaed,0x200f8,0xadf,0x50051,0x1b,0xae1, + 0x47b,0x1,0x50051,0x1b,0xae3,0xd60,0x1,0x500af,0x5a,0xae4,0xae1,0xae3, + 0x300f7,0xaeb,0x0,0x400fa,0xae4,0xae5,0xaeb,0x200f8,0xae5,0x50051,0x1b,0xae9, + 0xad1,0x1,0x500b1,0x5a,0xaea,0xae1,0xae9,0x200f9,0xaeb,0x200f8,0xaeb,0x700f5, + 0x5a,0xaec,0xae4,0xadf,0xaea,0xae5,0x200f9,0xaed,0x200f8,0xaed,0x700f5,0x5a, + 0xaee,0xade,0xadd,0xaec,0xaeb,0x300f7,0x4fb,0x0,0x400fa,0xaee,0x4f6,0x4fb, + 0x200f8,0x4f6,0x4003d,0x81,0x4f9,0x4f3,0x50051,0x1c,0xbb5,0x4f9,0x0,0x50051, + 0x1c,0xbb6,0x4f9,0x1,0x50082,0x1c,0xb09,0x47b,0xbb5,0x4006f,0x8,0xb0a, + 0xb09,0x50081,0x8,0xb0c,0xb0a,0x159,0x4006f,0x8,0xb0f,0xbb6,0x50088,0x8, + 0xb10,0xb0c,0xb0f,0x4003d,0xf7,0xb15,0xf9,0x4003d,0xfb,0xb16,0xfd,0x50056, + 0xff,0xb17,0xb15,0xb16,0x70058,0x30,0xb19,0xb17,0xb10,0x2,0xb7,0x50051, + 0x6,0xafc,0xb19,0x0,0x50051,0x6,0xafd,0xb19,0x1,0x50051,0x6,0xafe, + 0xb19,0x2,0x70050,0x30,0xaff,0xafc,0xafd,0xafe,0xba,0x4003d,0x14d,0xb1c, + 0x14f,0x40063,0xb1c,0x47b,0xaff,0x200f9,0x4fb,0x200f8,0x4fb,0x60041,0x82,0x4fd, + 0x48d,0x15d,0x15d,0x4003d,0x81,0x4fe,0x4fd,0x50051,0x1c,0xd6d,0x4fe,0x0, + 0x50051,0x1c,0xd6e,0x4fe,0x1,0x50080,0x1c,0xb26,0xd6d,0xd6e,0x50051,0x1b, + 0xb2a,0xd6d,0x0,0x500af,0x5a,0xb2b,0x513,0xb2a,0x300f7,0xb32,0x0,0x400fa, + 0xb2b,0xb2c,0xb32,0x200f8,0xb2c,0x50051,0x1b,0xb30,0xb26,0x0,0x500b1,0x5a, + 0xb31,0x513,0xb30,0x200f9,0xb32,0x200f8,0xb32,0x700f5,0x5a,0xb33,0xb2b,0x4fb, + 0xb31,0xb2c,0x300f7,0xb42,0x0,0x400fa,0xb33,0xb34,0xb42,0x200f8,0xb34,0x50051, + 0x1b,0xb36,0x47b,0x1,0x50051,0x1b,0xb38,0xd6d,0x1,0x500af,0x5a,0xb39, + 0xb36,0xb38,0x300f7,0xb40,0x0,0x400fa,0xb39,0xb3a,0xb40,0x200f8,0xb3a,0x50051, + 0x1b,0xb3e,0xb26,0x1,0x500b1,0x5a,0xb3f,0xb36,0xb3e,0x200f9,0xb40,0x200f8, + 0xb40,0x700f5,0x5a,0xb41,0xb39,0xb34,0xb3f,0xb3a,0x200f9,0xb42,0x200f8,0xb42, + 0x700f5,0x5a,0xb43,0xb33,0xb32,0xb41,0xb40,0x300f7,0x505,0x0,0x400fa,0xb43, + 0x500,0x505,0x200f8,0x500,0x4003d,0x81,0x503,0x4fd,0x50051,0x1c,0xbaa,0x503, + 0x0,0x50051,0x1c,0xbab,0x503,0x1,0x50082,0x1c,0xb63,0x47b,0xbaa,0x4006f, + 0x8,0xb64,0xb63,0x50081,0x8,0xb66,0xb64,0x159,0x4006f,0x8,0xb69,0xbab, + 0x50088,0x8,0xb6a,0xb66,0xb69,0x4003d,0xf7,0xb8f,0x144,0x4003d,0xfb,0xb90, + 0xfd,0x50056,0xff,0xb91,0xb8f,0xb90,0x70058,0x30,0xb93,0xb91,0xb6a,0x2, + 0xb7,0x7004f,0x8,0xb94,0xb93,0xb93,0x0,0x1,0x6000c,0x8,0xb78,0x1, + 0x4,0xb94,0x5008e,0x8,0xb7a,0xb78,0x39e,0x50051,0x6,0xb7b,0xb7a,0x0, + 0x50051,0x6,0xb7c,0xb7a,0x1,0x70050,0x30,0xb7d,0xb7b,0xb7c,0xb7,0xba, + 0x50041,0xde,0xb97,0xca,0x100d,0x4003d,0x1b,0xb98,0xb97,0x500aa,0x5a,0xb55, + 0xb98,0xd1,0x300f7,0xb59,0x0,0x400fa,0xb55,0xb56,0xb59,0x200f8,0xb56,0x4003d, + 0xf7,0xb9b,0x13c,0x4003d,0xfb,0xb9c,0xfd,0x50056,0xff,0xb9d,0xb9b,0xb9c, + 0x70058,0x30,0xb9f,0xb9d,0xb6a,0x2,0xb7,0x200f9,0xb59,0x200f8,0xb59,0x700f5, + 0x30,0xf3e,0xb7d,0x500,0xb9f,0xb56,0x4003d,0x14d,0xba1,0x14f,0x40063,0xba1, + 0x47b,0xf3e,0x200f9,0x505,0x200f8,0x505,0x100fd,0x10038, +}; +static const char *fi_debug_view_pass_1_cb_names[] = {"cbFI"}; +static const uint32_t fi_debug_view_pass_1_cb_bind[] = {10}; +static const uint32_t fi_debug_view_pass_1_cb_count[] = {1}; +static const uint32_t fi_debug_view_pass_1_cb_space[] = {0}; +static const char *fi_debug_view_pass_1_srv_tex_names[] = {"r_game_motion_vector_field_x", "r_game_motion_vector_field_y", "r_optical_flow_motion_vector_field_x", "r_optical_flow_motion_vector_field_y", "r_disocclusion_mask", "r_present_backbuffer", "r_inpainting_pyramid", "r_current_interpolation_source", "r_input_distortion_field"}; +static const uint32_t fi_debug_view_pass_1_srv_tex_bind[] = {0, 1, 2, 3, 4, 5, 6, 7, 8}; +static const uint32_t fi_debug_view_pass_1_srv_tex_count[] = {1, 1, 1, 1, 1, 1, 1, 1, 1}; +static const uint32_t fi_debug_view_pass_1_srv_tex_space[] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; +static const char *fi_debug_view_pass_1_uav_tex_names[] = {"rw_output"}; +static const uint32_t fi_debug_view_pass_1_uav_tex_bind[] = {9}; +static const uint32_t fi_debug_view_pass_1_uav_tex_count[] = {1}; +static const uint32_t fi_debug_view_pass_1_uav_tex_space[] = {0}; +static const char *fi_debug_view_pass_1_sampler_names[] = {"s_LinearClamp"}; +static const uint32_t fi_debug_view_pass_1_sampler_bind[] = {1000}; +static const uint32_t fi_debug_view_pass_1_sampler_count[] = {1}; +static const uint32_t fi_debug_view_pass_1_sampler_space[] = {0}; + +static const uint32_t of_prepare_luma_pass_spv[1056] = { + 0x7230203,0x10500,0x8000b,0x2dc,0x0,0x20011,0x1,0x20011,0x31,0x6000b,0x1,0x4c534c47, + 0x6474732e,0x3035342e,0x0,0x3000e,0x0,0x1,0x9000f,0x5,0x4,0x6e69616d,0x0,0x86, + 0x95,0x9f,0x16a,0x60010,0x4,0x11,0x10,0x10,0x1,0x30003,0x2,0x1c2, + 0xb0004,0x455f4c47,0x735f5458,0x6c706d61,0x656c7265,0x745f7373,0x75747865,0x665f6572,0x74636e75,0x736e6f69,0x0,0xb0004, + 0x455f4c47,0x735f5458,0x65646168,0x78655f72,0x63696c70,0x615f7469,0x68746972,0x6974656d,0x79745f63,0x736570,0xa0004,0x475f4c47, + 0x4c474f4f,0x70635f45,0x74735f70,0x5f656c79,0x656e696c,0x7269645f,0x69746365,0x6576,0x80004,0x475f4c47,0x4c474f4f,0x6e695f45, + 0x64756c63,0x69645f65,0x74636572,0x657669,0x40005,0x4,0x6e69616d,0x0,0x40005,0x84,0x464f6263,0x745f, + 0xa0006,0x84,0x0,0x6b636162,0x66667562,0x72547265,0x66736e61,0x75467265,0x6974636e,0x6e6f,0x70006,0x84, + 0x1,0x4d6e696d,0x754c7861,0x616e696d,0x65636e,0x40005,0x86,0x464f6263,0x0,0x60005,0x95,0x6e695f72, + 0x5f747570,0x6f6c6f63,0x72,0x80005,0x9f,0x6f5f7772,0x63697470,0x665f6c61,0x5f776f6c,0x75706e69,0x74,0x80005, + 0x16a,0x475f6c67,0x61626f6c,0x766e496c,0x7461636f,0x496e6f69,0x44,0x30047,0x84,0x2,0x50048,0x84, + 0x0,0x23,0x14,0x50048,0x84,0x1,0x23,0x18,0x40047,0x86,0x21,0x2, + 0x40047,0x86,0x22,0x0,0x40047,0x95,0x21,0x0,0x40047,0x95,0x22,0x0, + 0x40047,0x9f,0x21,0x1,0x40047,0x9f,0x22,0x0,0x40047,0x16a,0xb,0x1c, + 0x40047,0x179,0xb,0x19,0x20013,0x2,0x30021,0x3,0x2,0x30016,0x6,0x20, + 0x40017,0x8,0x6,0x3,0x40015,0x1a,0x20,0x0,0x40017,0x1e,0x6,0x2, + 0x40017,0x22,0x1a,0x2,0x40017,0x24,0x6,0x4,0x40015,0x29,0x20,0x1, + 0x40017,0x2a,0x29,0x2,0x4002b,0x6,0x59,0x0,0x4002b,0x6,0x5c,0x3f800000, + 0x4002b,0x6,0x69,0x3c4fcd9e,0x4002b,0x6,0x6e,0x3f560008,0x4002b,0x6,0x74,0x4196d014, + 0x4002b,0x6,0x77,0x41958000,0x4002b,0x6,0x7e,0x40c8e061,0x4001e,0x84,0x1a,0x1e, + 0x40020,0x85,0x2,0x84,0x4003b,0x85,0x86,0x2,0x40020,0x88,0x2,0x1a, + 0x40020,0x8e,0x2,0x1e,0x90019,0x93,0x6,0x1,0x0,0x0,0x0,0x1, + 0x0,0x40020,0x94,0x0,0x93,0x4003b,0x94,0x95,0x0,0x4002b,0x29,0x99, + 0x0,0x90019,0x9d,0x1a,0x1,0x0,0x0,0x0,0x2,0x27,0x40020,0x9e, + 0x0,0x9d,0x4003b,0x9e,0x9f,0x0,0x4002b,0x1a,0xa3,0x0,0x40017,0xa4, + 0x1a,0x4,0x4002b,0x6,0xa8,0x3c111aa7,0x20014,0xa9,0x4002b,0x6,0xae,0x4461d2f7, + 0x4002b,0x6,0xb1,0x3eaaaaab,0x4002b,0x6,0xb6,0x42e80000,0x4002b,0x6,0xb8,0x41800000, + 0x4002b,0x6,0xbb,0x3c23d70a,0x4002b,0x6,0xc0,0x3e59b3d0,0x4002b,0x6,0xc4,0x3f371759, + 0x4002b,0x1a,0xc5,0x1,0x4002b,0x6,0xca,0x3d93dd98,0x4002b,0x1a,0xcb,0x2, + 0x4002b,0x6,0xd4,0x3e86809d,0x4002b,0x6,0xd8,0x3f2d9168,0x4002b,0x6,0xdd,0x3d72e48f, + 0x4002b,0x6,0xe9,0x461c4000,0x4002b,0x29,0x118,0x2,0x5002c,0x2a,0x124,0x118, + 0x118,0x4002b,0x6,0x15c,0x437f0000,0x4002b,0x29,0x164,0x1,0x40017,0x168,0x1a, + 0x3,0x40020,0x169,0x1,0x168,0x4003b,0x169,0x16a,0x1,0x4002b,0x1a,0x178, + 0x10,0x6002c,0x168,0x179,0x178,0x178,0xc5,0x6002c,0x8,0x2d4,0x69,0x69, + 0x69,0x6002c,0x8,0x2d5,0x6e,0x6e,0x6e,0x6002c,0x8,0x2d6,0x59,0x59, + 0x59,0x6002c,0x8,0x2d7,0x5c,0x5c,0x5c,0x6002c,0x8,0x2d8,0x74,0x74, + 0x74,0x6002c,0x8,0x2d9,0x77,0x77,0x77,0x6002c,0x8,0x2da,0x7e,0x7e, + 0x7e,0x4002b,0x6,0x2db,0x3c4ccccd,0x50036,0x2,0x4,0x0,0x3,0x200f8,0x5, + 0x4003d,0x168,0x16b,0x16a,0x7004f,0x22,0x16c,0x16b,0x16b,0x0,0x1,0x4007c, + 0x2a,0x16d,0x16c,0x200f9,0x18d,0x200f8,0x18d,0x700f5,0x29,0x2b4,0x99,0x5, + 0x1cc,0x1ca,0x500b1,0xa9,0x190,0x2b4,0x118,0x400f6,0x1cd,0x1ca,0x0,0x400fa, + 0x190,0x191,0x1cd,0x200f8,0x191,0x200f9,0x192,0x200f8,0x192,0x700f5,0x29,0x2b5, + 0x99,0x191,0x1c8,0x1c6,0x500b1,0xa9,0x195,0x2b5,0x118,0x400f6,0x1c9,0x1c6, + 0x0,0x400fa,0x195,0x196,0x1c9,0x200f8,0x196,0x50084,0x2a,0x198,0x16d,0x124, + 0x50050,0x2a,0x19b,0x2b5,0x2b4,0x50080,0x2a,0x19c,0x198,0x19b,0x4003d,0x93, + 0x1d1,0x95,0x7005f,0x24,0x1d4,0x1d1,0x19c,0x2,0x99,0x8004f,0x8,0x1a1, + 0x1d4,0x1d4,0x0,0x1,0x2,0x50041,0x88,0x1d7,0x86,0xa3,0x4003d,0x1a, + 0x1d8,0x1d7,0x500aa,0xa9,0x1a4,0x1d8,0xa3,0x300f7,0x1c0,0x0,0x400fa,0x1a4, + 0x1a5,0x1a8,0x200f8,0x1a5,0x50051,0x6,0x1dd,0x1d4,0x0,0x50085,0x6,0x1de, + 0xc0,0x1dd,0x50051,0x6,0x1e0,0x1d4,0x1,0x50085,0x6,0x1e1,0xc4,0x1e0, + 0x50081,0x6,0x1e2,0x1de,0x1e1,0x50051,0x6,0x1e4,0x1d4,0x2,0x50085,0x6, + 0x1e5,0xca,0x1e4,0x50081,0x6,0x1e6,0x1e2,0x1e5,0x200f9,0x1c0,0x200f8,0x1a8, + 0x500aa,0xa9,0x1aa,0x1d8,0xc5,0x300f7,0x1bf,0x0,0x400fa,0x1aa,0x1ab,0x1b2, + 0x200f8,0x1ab,0x50041,0x8e,0x1eb,0x86,0xc5,0x4003d,0x1e,0x1ec,0x1eb,0x50051, + 0x6,0x1ae,0x1ec,0x1,0x7000c,0x8,0x204,0x1,0x1a,0x1a1,0x2d4,0x50083, + 0x8,0x207,0x204,0x2d5,0x8000c,0x8,0x220,0x1,0x2b,0x207,0x2d6,0x2d7, + 0x50085,0x8,0x20c,0x2d9,0x204,0x50083,0x8,0x20d,0x2d8,0x20c,0x50088,0x8, + 0x20e,0x220,0x20d,0x7000c,0x8,0x210,0x1,0x1a,0x20e,0x2da,0x50088,0x6, + 0x1f5,0xe9,0x1ae,0x5008e,0x8,0x1f6,0x210,0x1f5,0x50051,0x6,0x239,0x1f6, + 0x0,0x50085,0x6,0x23a,0xd4,0x239,0x50051,0x6,0x23c,0x1f6,0x1,0x50085, + 0x6,0x23d,0xd8,0x23c,0x50081,0x6,0x23e,0x23a,0x23d,0x50051,0x6,0x240, + 0x1f6,0x2,0x50085,0x6,0x241,0xdd,0x240,0x50081,0x6,0x242,0x23e,0x241, + 0x500bc,0xa9,0x24a,0x242,0xa8,0x300f7,0x253,0x0,0x400fa,0x24a,0x24b,0x24e, + 0x200f8,0x24b,0x50085,0x6,0x24d,0x242,0xae,0x200f9,0x253,0x200f8,0x24e,0x7000c, + 0x6,0x25a,0x1,0x1a,0x242,0xb1,0x50085,0x6,0x251,0x25a,0xb6,0x50083, + 0x6,0x252,0x251,0xb8,0x200f9,0x253,0x200f8,0x253,0x700f5,0x6,0x2ba,0x24d, + 0x24b,0x252,0x24e,0x50085,0x6,0x255,0x2ba,0xbb,0x200f9,0x1bf,0x200f8,0x1b2, + 0x500aa,0xa9,0x1b4,0x1d8,0xcb,0x300f7,0x1be,0x0,0x400fa,0x1b4,0x1b5,0x1be, + 0x200f8,0x1b5,0x50041,0x8e,0x25d,0x86,0xc5,0x4003d,0x1e,0x25e,0x25d,0x50051, + 0x6,0x1b9,0x25e,0x0,0x50051,0x6,0x1ba,0x25e,0x1,0x50085,0x6,0x277, + 0x1b9,0x2db,0x60050,0x8,0x284,0x277,0x277,0x277,0x50083,0x8,0x279,0x1a1, + 0x284,0x50083,0x6,0x27d,0x1ba,0x1b9,0x50085,0x6,0x27e,0x27d,0x2db,0x60050, + 0x8,0x288,0x27e,0x27e,0x27e,0x50088,0x8,0x280,0x279,0x288,0x50051,0x6, + 0x28d,0x280,0x0,0x50085,0x6,0x28e,0xc0,0x28d,0x50051,0x6,0x290,0x280, + 0x1,0x50085,0x6,0x291,0xc4,0x290,0x50081,0x6,0x292,0x28e,0x291,0x50051, + 0x6,0x294,0x280,0x2,0x50085,0x6,0x295,0xca,0x294,0x50081,0x6,0x296, + 0x292,0x295,0x500bc,0xa9,0x29e,0x296,0xa8,0x300f7,0x2a7,0x0,0x400fa,0x29e, + 0x29f,0x2a2,0x200f8,0x29f,0x50085,0x6,0x2a1,0x296,0xae,0x200f9,0x2a7,0x200f8, + 0x2a2,0x7000c,0x6,0x2ae,0x1,0x1a,0x296,0xb1,0x50085,0x6,0x2a5,0x2ae, + 0xb6,0x50083,0x6,0x2a6,0x2a5,0xb8,0x200f9,0x2a7,0x200f8,0x2a7,0x700f5,0x6, + 0x2b9,0x2a1,0x29f,0x2a6,0x2a2,0x50085,0x6,0x2a9,0x2b9,0xbb,0x200f9,0x1be, + 0x200f8,0x1be,0x700f5,0x6,0x2bd,0x59,0x1b2,0x2a9,0x2a7,0x200f9,0x1bf,0x200f8, + 0x1bf,0x700f5,0x6,0x2bc,0x255,0x253,0x2bd,0x1be,0x200f9,0x1c0,0x200f8,0x1c0, + 0x700f5,0x6,0x2bb,0x1e6,0x1a5,0x2bc,0x1bf,0x50085,0x6,0x1c2,0x2bb,0x15c, + 0x4006d,0x1a,0x1c3,0x1c2,0x4003d,0x9d,0x2b0,0x9f,0x70050,0xa4,0x2b3,0x1c3, + 0xa3,0xa3,0xa3,0x50063,0x2b0,0x19c,0x2b3,0x2000,0x200f9,0x1c6,0x200f8,0x1c6, + 0x50080,0x29,0x1c8,0x2b5,0x164,0x200f9,0x192,0x200f8,0x1c9,0x200f9,0x1ca,0x200f8, + 0x1ca,0x50080,0x29,0x1cc,0x2b4,0x164,0x200f9,0x18d,0x200f8,0x1cd,0x100fd,0x10038, +}; +static const char *of_prepare_luma_pass_cb_names[] = {"cbOF"}; +static const uint32_t of_prepare_luma_pass_cb_bind[] = {2}; +static const uint32_t of_prepare_luma_pass_cb_count[] = {1}; +static const uint32_t of_prepare_luma_pass_cb_space[] = {0}; +static const char *of_prepare_luma_pass_srv_tex_names[] = {"r_input_color"}; +static const uint32_t of_prepare_luma_pass_srv_tex_bind[] = {0}; +static const uint32_t of_prepare_luma_pass_srv_tex_count[] = {1}; +static const uint32_t of_prepare_luma_pass_srv_tex_space[] = {0}; +static const char *of_prepare_luma_pass_uav_tex_names[] = {"rw_optical_flow_input"}; +static const uint32_t of_prepare_luma_pass_uav_tex_bind[] = {1}; +static const uint32_t of_prepare_luma_pass_uav_tex_count[] = {1}; +static const uint32_t of_prepare_luma_pass_uav_tex_space[] = {0}; + +static const uint32_t of_compute_luminance_pyramid_pass_spv[3105] = { + 0x7230203,0x10500,0x8000b,0x15ae,0x0,0x20011,0x1,0x20011,0x31,0x20011,0x3d,0x20011, + 0x44,0x6000b,0x1,0x4c534c47,0x6474732e,0x3035342e,0x0,0x3000e,0x0,0x1,0x12000f,0x5, + 0x4,0x6e69616d,0x0,0x10a,0x120,0x125,0x12a,0x12f,0x134,0x139,0x15c,0x162, + 0x167,0x16c,0x59d,0x5a2,0x60010,0x4,0x11,0x100,0x1,0x1,0x30003,0x2, + 0x1c2,0xb0004,0x455f4c47,0x735f5458,0x6c706d61,0x656c7265,0x745f7373,0x75747865,0x665f6572,0x74636e75,0x736e6f69,0x0, + 0xb0004,0x455f4c47,0x735f5458,0x65646168,0x78655f72,0x63696c70,0x615f7469,0x68746972,0x6974656d,0x79745f63,0x736570,0xa0004, + 0x475f4c47,0x4c474f4f,0x70635f45,0x74735f70,0x5f656c79,0x656e696c,0x7269645f,0x69746365,0x6576,0x80004,0x475f4c47,0x4c474f4f, + 0x6e695f45,0x64756c63,0x69645f65,0x74636572,0x657669,0x90004,0x4b5f4c47,0x735f5248,0x65646168,0x75735f72,0x6f726762,0x625f7075, + 0x63697361,0x0,0x80004,0x4b5f4c47,0x735f5248,0x65646168,0x75735f72,0x6f726762,0x715f7075,0x646175,0x40005,0x4, + 0x6e69616d,0x0,0x80005,0x10a,0x6f5f7772,0x63697470,0x665f6c61,0x5f776f6c,0x75706e69,0x74,0xa0005,0x120, + 0x6f5f7772,0x63697470,0x665f6c61,0x5f776f6c,0x75706e69,0x656c5f74,0x5f6c6576,0x31,0xa0005,0x125,0x6f5f7772,0x63697470, + 0x665f6c61,0x5f776f6c,0x75706e69,0x656c5f74,0x5f6c6576,0x32,0xa0005,0x12a,0x6f5f7772,0x63697470,0x665f6c61,0x5f776f6c, + 0x75706e69,0x656c5f74,0x5f6c6576,0x33,0xa0005,0x12f,0x6f5f7772,0x63697470,0x665f6c61,0x5f776f6c,0x75706e69,0x656c5f74, + 0x5f6c6576,0x34,0xa0005,0x134,0x6f5f7772,0x63697470,0x665f6c61,0x5f776f6c,0x75706e69,0x656c5f74,0x5f6c6576,0x35, + 0xa0005,0x139,0x6f5f7772,0x63697470,0x665f6c61,0x5f776f6c,0x75706e69,0x656c5f74,0x5f6c6576,0x36,0x70005,0x15c, + 0x49647073,0x7265746e,0x6964656d,0x52657461,0x0,0x70005,0x162,0x49647073,0x7265746e,0x6964656d,0x47657461,0x0, + 0x70005,0x167,0x49647073,0x7265746e,0x6964656d,0x42657461,0x0,0x70005,0x16c,0x49647073,0x7265746e,0x6964656d, + 0x41657461,0x0,0x60005,0x59d,0x575f6c67,0x476b726f,0x70756f72,0x4449,0x80005,0x5a2,0x4c5f6c67,0x6c61636f, + 0x6f766e49,0x69746163,0x6e496e6f,0x786564,0x40047,0x10a,0x21,0x0,0x40047,0x10a,0x22,0x0, + 0x40047,0x120,0x21,0x1,0x40047,0x120,0x22,0x0,0x40047,0x125,0x21,0x2, + 0x40047,0x125,0x22,0x0,0x40047,0x12a,0x21,0x3,0x40047,0x12a,0x22,0x0, + 0x40047,0x12f,0x21,0x4,0x40047,0x12f,0x22,0x0,0x40047,0x134,0x21,0x5, + 0x40047,0x134,0x22,0x0,0x40047,0x139,0x21,0x6,0x40047,0x139,0x22,0x0, + 0x40047,0x59d,0xb,0x1a,0x40047,0x5a2,0xb,0x1d,0x40047,0x5af,0xb,0x19, + 0x20013,0x2,0x30021,0x3,0x2,0x40015,0x6,0x20,0x0,0x40017,0x13,0x6, + 0x2,0x40015,0x1b,0x20,0x1,0x40017,0x1c,0x1b,0x2,0x30016,0x22,0x20, + 0x40017,0x2c,0x22,0x2,0x40017,0x2e,0x22,0x4,0x20014,0x5e,0x4002b,0x1b, + 0xdb,0x0,0x4002b,0x6,0xe1,0x2,0x4002b,0x6,0xe2,0x3,0x4002b,0x6, + 0xe8,0x1,0x4002b,0x1b,0x102,0x3,0x90019,0x108,0x6,0x1,0x0,0x0, + 0x0,0x2,0x27,0x40020,0x109,0x0,0x108,0x4003b,0x109,0x10a,0x0,0x40017, + 0x10d,0x6,0x4,0x4002b,0x6,0x10f,0x0,0x4003b,0x109,0x120,0x0,0x4003b, + 0x109,0x125,0x0,0x4003b,0x109,0x12a,0x0,0x4003b,0x109,0x12f,0x0,0x4003b, + 0x109,0x134,0x0,0x4003b,0x109,0x139,0x0,0x4002b,0x22,0x146,0x0,0x4002b, + 0x6,0x158,0x10,0x4001c,0x159,0x22,0x158,0x4001c,0x15a,0x159,0x158,0x40020, + 0x15b,0x4,0x15a,0x4003b,0x15b,0x15c,0x4,0x40020,0x15f,0x4,0x22,0x4003b, + 0x15b,0x162,0x4,0x4003b,0x15b,0x167,0x4,0x4003b,0x15b,0x16c,0x4,0x4002b, + 0x22,0x18f,0x3e800000,0x4002b,0x6,0x193,0xd48,0x4002b,0x6,0x194,0x108,0x5002c, + 0x13,0x1e6,0x10f,0xe8,0x5002c,0x13,0x1e9,0xe8,0x10f,0x5002c,0x13,0x1ec, + 0xe8,0xe8,0x4002b,0x6,0x235,0x40,0x4002b,0x6,0x243,0x20,0x4002b,0x6, + 0x24d,0x4,0x4002b,0x1b,0x279,0x1,0x4002b,0x1b,0x2a2,0x2,0x4002b,0x6, + 0x31f,0x8,0x4002b,0x1b,0x540,0x6,0x4002b,0x1b,0x549,0x7,0x40017,0x59b, + 0x6,0x3,0x40020,0x59c,0x1,0x59b,0x4003b,0x59c,0x59d,0x1,0x40020,0x5a1, + 0x1,0x6,0x4003b,0x5a1,0x5a2,0x1,0x4002b,0x6,0x5ae,0x100,0x6002c,0x59b, + 0x5af,0x5ae,0xe8,0xe8,0x5002c,0x13,0x15a7,0x235,0x235,0x5002c,0x13,0x15a8, + 0x243,0x243,0x5002c,0x13,0x15a9,0x158,0x158,0x5002c,0x13,0x15aa,0x31f,0x31f, + 0x5002c,0x13,0x15ab,0x24d,0x24d,0x5002c,0x13,0x15ad,0xe1,0xe1,0x50036,0x2, + 0x4,0x0,0x3,0x200f8,0x5,0x4003d,0x59b,0x59e,0x59d,0x7004f,0x13,0x59f, + 0x59e,0x59e,0x0,0x1,0x4003d,0x6,0x5a3,0x5a2,0x50089,0x6,0x5f3,0x5a3, + 0x235,0x600cb,0x6,0x64a,0x5f3,0x2a2,0x102,0x700c9,0x6,0x651,0x64a,0x5f3, + 0xdb,0x279,0x600cb,0x6,0x659,0x5f3,0x102,0x102,0x600cb,0x6,0x661,0x5f3, + 0x279,0x2a2,0x700c9,0x6,0x668,0x659,0x661,0xdb,0x2a2,0x500c2,0x6,0x5f8, + 0x5a3,0x540,0x50089,0x6,0x5f9,0x5f8,0xe1,0x50084,0x6,0x5fa,0x31f,0x5f9, + 0x50080,0x6,0x5fb,0x651,0x5fa,0x500c2,0x6,0x5ff,0x5a3,0x549,0x50084,0x6, + 0x600,0x31f,0x5ff,0x50080,0x6,0x601,0x668,0x600,0x50084,0x13,0x6b7,0x59f, + 0x15a7,0x4007c,0x1c,0x6b8,0x6b7,0x50084,0x6,0x6ba,0x5fb,0xe1,0x4007c,0x1b, + 0x6bb,0x6ba,0x50084,0x6,0x6bd,0x601,0xe1,0x4007c,0x1b,0x6be,0x6bd,0x50050, + 0x1c,0x6bf,0x6bb,0x6be,0x50080,0x1c,0x6c0,0x6b8,0x6bf,0x50084,0x13,0x6c3, + 0x59f,0x15a8,0x4007c,0x1c,0x6c4,0x6c3,0x4007c,0x1b,0x6c6,0x5fb,0x4007c,0x1b, + 0x6c8,0x601,0x50050,0x1c,0x6c9,0x6c6,0x6c8,0x50080,0x1c,0x6ca,0x6c4,0x6c9, + 0x4007c,0x13,0x6cc,0x6c0,0x50080,0x13,0x7c5,0x6cc,0x1e6,0x50080,0x13,0x7c7, + 0x6cc,0x1e9,0x50080,0x13,0x7c9,0x6cc,0x1ec,0x4006f,0x2c,0x7e0,0x6c0,0x4006e, + 0x1c,0x7fc,0x7e0,0x4003d,0x108,0x803,0x10a,0x60062,0x10d,0x805,0x803,0x7fc, + 0x2000,0x50051,0x6,0x806,0x805,0x0,0x40070,0x22,0x7fe,0x806,0x70050,0x2e, + 0x800,0x7fe,0x146,0x146,0x146,0x4007c,0x1c,0x7e4,0x7c5,0x4006f,0x2c,0x7e5, + 0x7e4,0x4006e,0x1c,0x80c,0x7e5,0x4003d,0x108,0x813,0x10a,0x60062,0x10d,0x815, + 0x813,0x80c,0x2000,0x50051,0x6,0x816,0x815,0x0,0x40070,0x22,0x80e,0x816, + 0x70050,0x2e,0x810,0x80e,0x146,0x146,0x146,0x4007c,0x1c,0x7e9,0x7c7,0x4006f, + 0x2c,0x7ea,0x7e9,0x4006e,0x1c,0x81c,0x7ea,0x4003d,0x108,0x823,0x10a,0x60062, + 0x10d,0x825,0x823,0x81c,0x2000,0x50051,0x6,0x826,0x825,0x0,0x40070,0x22, + 0x81e,0x826,0x70050,0x2e,0x820,0x81e,0x146,0x146,0x146,0x4007c,0x1c,0x7ee, + 0x7c9,0x4006f,0x2c,0x7ef,0x7ee,0x4006e,0x1c,0x82c,0x7ef,0x4003d,0x108,0x833, + 0x10a,0x60062,0x10d,0x835,0x833,0x82c,0x2000,0x50051,0x6,0x836,0x835,0x0, + 0x40070,0x22,0x82e,0x836,0x70050,0x2e,0x830,0x82e,0x146,0x146,0x146,0x50081, + 0x2e,0x83b,0x800,0x810,0x50081,0x2e,0x83d,0x83b,0x820,0x50081,0x2e,0x83f, + 0x83d,0x830,0x5008e,0x2e,0x840,0x83f,0x18f,0x50051,0x22,0x848,0x840,0x0, + 0x4006d,0x6,0x84d,0x848,0x70050,0x10d,0x84e,0x84d,0x10f,0x10f,0x10f,0x4003d, + 0x108,0x851,0x120,0x50063,0x851,0x6ca,0x84e,0x2000,0x50080,0x6,0x6db,0x6ba, + 0x243,0x4007c,0x1b,0x6dc,0x6db,0x50050,0x1c,0x6e0,0x6dc,0x6be,0x50080,0x1c, + 0x6e1,0x6b8,0x6e0,0x50080,0x6,0x6e7,0x5fb,0x158,0x4007c,0x1b,0x6e8,0x6e7, + 0x50050,0x1c,0x6eb,0x6e8,0x6c8,0x50080,0x1c,0x6ec,0x6c4,0x6eb,0x4007c,0x13, + 0x6ee,0x6e1,0x50080,0x13,0x873,0x6ee,0x1e6,0x50080,0x13,0x875,0x6ee,0x1e9, + 0x50080,0x13,0x877,0x6ee,0x1ec,0x4006f,0x2c,0x88e,0x6e1,0x4006e,0x1c,0x8aa, + 0x88e,0x4003d,0x108,0x8b1,0x10a,0x60062,0x10d,0x8b3,0x8b1,0x8aa,0x2000,0x50051, + 0x6,0x8b4,0x8b3,0x0,0x40070,0x22,0x8ac,0x8b4,0x70050,0x2e,0x8ae,0x8ac, + 0x146,0x146,0x146,0x4007c,0x1c,0x892,0x873,0x4006f,0x2c,0x893,0x892,0x4006e, + 0x1c,0x8ba,0x893,0x4003d,0x108,0x8c1,0x10a,0x60062,0x10d,0x8c3,0x8c1,0x8ba, + 0x2000,0x50051,0x6,0x8c4,0x8c3,0x0,0x40070,0x22,0x8bc,0x8c4,0x70050,0x2e, + 0x8be,0x8bc,0x146,0x146,0x146,0x4007c,0x1c,0x897,0x875,0x4006f,0x2c,0x898, + 0x897,0x4006e,0x1c,0x8ca,0x898,0x4003d,0x108,0x8d1,0x10a,0x60062,0x10d,0x8d3, + 0x8d1,0x8ca,0x2000,0x50051,0x6,0x8d4,0x8d3,0x0,0x40070,0x22,0x8cc,0x8d4, + 0x70050,0x2e,0x8ce,0x8cc,0x146,0x146,0x146,0x4007c,0x1c,0x89c,0x877,0x4006f, + 0x2c,0x89d,0x89c,0x4006e,0x1c,0x8da,0x89d,0x4003d,0x108,0x8e1,0x10a,0x60062, + 0x10d,0x8e3,0x8e1,0x8da,0x2000,0x50051,0x6,0x8e4,0x8e3,0x0,0x40070,0x22, + 0x8dc,0x8e4,0x70050,0x2e,0x8de,0x8dc,0x146,0x146,0x146,0x50081,0x2e,0x8e9, + 0x8ae,0x8be,0x50081,0x2e,0x8eb,0x8e9,0x8ce,0x50081,0x2e,0x8ed,0x8eb,0x8de, + 0x5008e,0x2e,0x8ee,0x8ed,0x18f,0x50051,0x22,0x8f6,0x8ee,0x0,0x4006d,0x6, + 0x8fb,0x8f6,0x70050,0x10d,0x8fc,0x8fb,0x10f,0x10f,0x10f,0x4003d,0x108,0x8ff, + 0x120,0x50063,0x8ff,0x6ec,0x8fc,0x2000,0x50080,0x6,0x700,0x6bd,0x243,0x4007c, + 0x1b,0x701,0x700,0x50050,0x1c,0x702,0x6bb,0x701,0x50080,0x1c,0x703,0x6b8, + 0x702,0x50080,0x6,0x70b,0x601,0x158,0x4007c,0x1b,0x70c,0x70b,0x50050,0x1c, + 0x70d,0x6c6,0x70c,0x50080,0x1c,0x70e,0x6c4,0x70d,0x4007c,0x13,0x710,0x703, + 0x50080,0x13,0x921,0x710,0x1e6,0x50080,0x13,0x923,0x710,0x1e9,0x50080,0x13, + 0x925,0x710,0x1ec,0x4006f,0x2c,0x93c,0x703,0x4006e,0x1c,0x958,0x93c,0x4003d, + 0x108,0x95f,0x10a,0x60062,0x10d,0x961,0x95f,0x958,0x2000,0x50051,0x6,0x962, + 0x961,0x0,0x40070,0x22,0x95a,0x962,0x70050,0x2e,0x95c,0x95a,0x146,0x146, + 0x146,0x4007c,0x1c,0x940,0x921,0x4006f,0x2c,0x941,0x940,0x4006e,0x1c,0x968, + 0x941,0x4003d,0x108,0x96f,0x10a,0x60062,0x10d,0x971,0x96f,0x968,0x2000,0x50051, + 0x6,0x972,0x971,0x0,0x40070,0x22,0x96a,0x972,0x70050,0x2e,0x96c,0x96a, + 0x146,0x146,0x146,0x4007c,0x1c,0x945,0x923,0x4006f,0x2c,0x946,0x945,0x4006e, + 0x1c,0x978,0x946,0x4003d,0x108,0x97f,0x10a,0x60062,0x10d,0x981,0x97f,0x978, + 0x2000,0x50051,0x6,0x982,0x981,0x0,0x40070,0x22,0x97a,0x982,0x70050,0x2e, + 0x97c,0x97a,0x146,0x146,0x146,0x4007c,0x1c,0x94a,0x925,0x4006f,0x2c,0x94b, + 0x94a,0x4006e,0x1c,0x988,0x94b,0x4003d,0x108,0x98f,0x10a,0x60062,0x10d,0x991, + 0x98f,0x988,0x2000,0x50051,0x6,0x992,0x991,0x0,0x40070,0x22,0x98a,0x992, + 0x70050,0x2e,0x98c,0x98a,0x146,0x146,0x146,0x50081,0x2e,0x997,0x95c,0x96c, + 0x50081,0x2e,0x999,0x997,0x97c,0x50081,0x2e,0x99b,0x999,0x98c,0x5008e,0x2e, + 0x99c,0x99b,0x18f,0x50051,0x22,0x9a4,0x99c,0x0,0x4006d,0x6,0x9a9,0x9a4, + 0x70050,0x10d,0x9aa,0x9a9,0x10f,0x10f,0x10f,0x4003d,0x108,0x9ad,0x120,0x50063, + 0x9ad,0x70e,0x9aa,0x2000,0x50050,0x1c,0x725,0x6dc,0x701,0x50080,0x1c,0x726, + 0x6b8,0x725,0x50050,0x1c,0x731,0x6e8,0x70c,0x50080,0x1c,0x732,0x6c4,0x731, + 0x4007c,0x13,0x734,0x726,0x50080,0x13,0x9cf,0x734,0x1e6,0x50080,0x13,0x9d1, + 0x734,0x1e9,0x50080,0x13,0x9d3,0x734,0x1ec,0x4006f,0x2c,0x9ea,0x726,0x4006e, + 0x1c,0xa06,0x9ea,0x4003d,0x108,0xa0d,0x10a,0x60062,0x10d,0xa0f,0xa0d,0xa06, + 0x2000,0x50051,0x6,0xa10,0xa0f,0x0,0x40070,0x22,0xa08,0xa10,0x70050,0x2e, + 0xa0a,0xa08,0x146,0x146,0x146,0x4007c,0x1c,0x9ee,0x9cf,0x4006f,0x2c,0x9ef, + 0x9ee,0x4006e,0x1c,0xa16,0x9ef,0x4003d,0x108,0xa1d,0x10a,0x60062,0x10d,0xa1f, + 0xa1d,0xa16,0x2000,0x50051,0x6,0xa20,0xa1f,0x0,0x40070,0x22,0xa18,0xa20, + 0x70050,0x2e,0xa1a,0xa18,0x146,0x146,0x146,0x4007c,0x1c,0x9f3,0x9d1,0x4006f, + 0x2c,0x9f4,0x9f3,0x4006e,0x1c,0xa26,0x9f4,0x4003d,0x108,0xa2d,0x10a,0x60062, + 0x10d,0xa2f,0xa2d,0xa26,0x2000,0x50051,0x6,0xa30,0xa2f,0x0,0x40070,0x22, + 0xa28,0xa30,0x70050,0x2e,0xa2a,0xa28,0x146,0x146,0x146,0x4007c,0x1c,0x9f8, + 0x9d3,0x4006f,0x2c,0x9f9,0x9f8,0x4006e,0x1c,0xa36,0x9f9,0x4003d,0x108,0xa3d, + 0x10a,0x60062,0x10d,0xa3f,0xa3d,0xa36,0x2000,0x50051,0x6,0xa40,0xa3f,0x0, + 0x40070,0x22,0xa38,0xa40,0x70050,0x2e,0xa3a,0xa38,0x146,0x146,0x146,0x50081, + 0x2e,0xa45,0xa0a,0xa1a,0x50081,0x2e,0xa47,0xa45,0xa2a,0x50081,0x2e,0xa49, + 0xa47,0xa3a,0x5008e,0x2e,0xa4a,0xa49,0x18f,0x50051,0x22,0xa52,0xa4a,0x0, + 0x4006d,0x6,0xa57,0xa52,0x70050,0x10d,0xa58,0xa57,0x10f,0x10f,0x10f,0x4003d, + 0x108,0xa5b,0x120,0x50063,0xa5b,0x732,0xa58,0x2000,0x6016e,0x2e,0xa7f,0xe2, + 0x840,0x10f,0x6016e,0x2e,0xa81,0xe2,0x840,0xe8,0x6016e,0x2e,0xa83,0xe2, + 0x840,0xe1,0x50081,0x2e,0xa8d,0x840,0xa7f,0x50081,0x2e,0xa8f,0xa8d,0xa81, + 0x50081,0x2e,0xa91,0xa8f,0xa83,0x5008e,0x2e,0xa92,0xa91,0x18f,0x6016e,0x2e, + 0xa9f,0xe2,0x8ee,0x10f,0x6016e,0x2e,0xaa1,0xe2,0x8ee,0xe8,0x6016e,0x2e, + 0xaa3,0xe2,0x8ee,0xe1,0x50081,0x2e,0xaad,0x8ee,0xa9f,0x50081,0x2e,0xaaf, + 0xaad,0xaa1,0x50081,0x2e,0xab1,0xaaf,0xaa3,0x5008e,0x2e,0xab2,0xab1,0x18f, + 0x6016e,0x2e,0xabf,0xe2,0x99c,0x10f,0x6016e,0x2e,0xac1,0xe2,0x99c,0xe8, + 0x6016e,0x2e,0xac3,0xe2,0x99c,0xe1,0x50081,0x2e,0xacd,0x99c,0xabf,0x50081, + 0x2e,0xacf,0xacd,0xac1,0x50081,0x2e,0xad1,0xacf,0xac3,0x5008e,0x2e,0xad2, + 0xad1,0x18f,0x6016e,0x2e,0xadf,0xe2,0xa4a,0x10f,0x6016e,0x2e,0xae1,0xe2, + 0xa4a,0xe8,0x6016e,0x2e,0xae3,0xe2,0xa4a,0xe1,0x50081,0x2e,0xaed,0xa4a, + 0xadf,0x50081,0x2e,0xaef,0xaed,0xae1,0x50081,0x2e,0xaf1,0xaef,0xae3,0x5008e, + 0x2e,0xaf2,0xaf1,0x18f,0x50089,0x6,0x752,0x5a3,0x24d,0x500aa,0x5e,0x753, + 0x752,0x10f,0x300f7,0x7b9,0x0,0x400fa,0x753,0x754,0x7b9,0x200f8,0x754,0x50084, + 0x13,0x757,0x59f,0x15a9,0x4007c,0x1c,0x758,0x757,0x50086,0x6,0x75a,0x5fb, + 0xe1,0x4007c,0x1b,0x75b,0x75a,0x50086,0x6,0x75d,0x601,0xe1,0x4007c,0x1b, + 0x75e,0x75d,0x50050,0x1c,0x75f,0x75b,0x75e,0x50080,0x1c,0x760,0x758,0x75f, + 0x50051,0x22,0xafa,0xa92,0x0,0x4006d,0x6,0xaff,0xafa,0x70050,0x10d,0xb00, + 0xaff,0x10f,0x10f,0x10f,0x4003d,0x108,0xb07,0x125,0x50063,0xb07,0x760,0xb00, + 0x2000,0x60041,0x15f,0xb20,0x15c,0x75a,0x75d,0x3003e,0xb20,0xafa,0x50051,0x22, + 0xb24,0xa92,0x1,0x60041,0x15f,0xb25,0x162,0x75a,0x75d,0x3003e,0xb25,0xb24, + 0x50051,0x22,0xb29,0xa92,0x2,0x60041,0x15f,0xb2a,0x167,0x75a,0x75d,0x3003e, + 0xb2a,0xb29,0x50051,0x22,0xb2e,0xa92,0x3,0x60041,0x15f,0xb2f,0x16c,0x75a, + 0x75d,0x3003e,0xb2f,0xb2e,0x50080,0x6,0x772,0x75a,0x31f,0x4007c,0x1b,0x773, + 0x772,0x50050,0x1c,0x777,0x773,0x75e,0x50080,0x1c,0x778,0x758,0x777,0x50051, + 0x22,0xb37,0xab2,0x0,0x4006d,0x6,0xb3c,0xb37,0x70050,0x10d,0xb3d,0xb3c, + 0x10f,0x10f,0x10f,0x4003d,0x108,0xb44,0x125,0x50063,0xb44,0x778,0xb3d,0x2000, + 0x60041,0x15f,0xb5d,0x15c,0x772,0x75d,0x3003e,0xb5d,0xb37,0x50051,0x22,0xb61, + 0xab2,0x1,0x60041,0x15f,0xb62,0x162,0x772,0x75d,0x3003e,0xb62,0xb61,0x50051, + 0x22,0xb66,0xab2,0x2,0x60041,0x15f,0xb67,0x167,0x772,0x75d,0x3003e,0xb67, + 0xb66,0x50051,0x22,0xb6b,0xab2,0x3,0x60041,0x15f,0xb6c,0x16c,0x772,0x75d, + 0x3003e,0xb6c,0xb6b,0x50080,0x6,0x78e,0x75d,0x31f,0x4007c,0x1b,0x78f,0x78e, + 0x50050,0x1c,0x790,0x75b,0x78f,0x50080,0x1c,0x791,0x758,0x790,0x50051,0x22, + 0xb74,0xad2,0x0,0x4006d,0x6,0xb79,0xb74,0x70050,0x10d,0xb7a,0xb79,0x10f, + 0x10f,0x10f,0x4003d,0x108,0xb81,0x125,0x50063,0xb81,0x791,0xb7a,0x2000,0x60041, + 0x15f,0xb9a,0x15c,0x75a,0x78e,0x3003e,0xb9a,0xb74,0x50051,0x22,0xb9e,0xad2, + 0x1,0x60041,0x15f,0xb9f,0x162,0x75a,0x78e,0x3003e,0xb9f,0xb9e,0x50051,0x22, + 0xba3,0xad2,0x2,0x60041,0x15f,0xba4,0x167,0x75a,0x78e,0x3003e,0xba4,0xba3, + 0x50051,0x22,0xba8,0xad2,0x3,0x60041,0x15f,0xba9,0x16c,0x75a,0x78e,0x3003e, + 0xba9,0xba8,0x50050,0x1c,0x7aa,0x773,0x78f,0x50080,0x1c,0x7ab,0x758,0x7aa, + 0x50051,0x22,0xbb1,0xaf2,0x0,0x4006d,0x6,0xbb6,0xbb1,0x70050,0x10d,0xbb7, + 0xbb6,0x10f,0x10f,0x10f,0x4003d,0x108,0xbbe,0x125,0x50063,0xbbe,0x7ab,0xbb7, + 0x2000,0x60041,0x15f,0xbd7,0x15c,0x772,0x78e,0x3003e,0xbd7,0xbb1,0x50051,0x22, + 0xbdb,0xaf2,0x1,0x60041,0x15f,0xbdc,0x162,0x772,0x78e,0x3003e,0xbdc,0xbdb, + 0x50051,0x22,0xbe0,0xaf2,0x2,0x60041,0x15f,0xbe1,0x167,0x772,0x78e,0x3003e, + 0xbe1,0xbe0,0x50051,0x22,0xbe5,0xaf2,0x3,0x60041,0x15f,0xbe6,0x16c,0x772, + 0x78e,0x3003e,0xbe6,0xbe5,0x200f9,0x7b9,0x200f8,0x7b9,0x300e1,0xe1,0x193,0x400e0, + 0xe1,0xe1,0x194,0x60041,0x15f,0xc6c,0x15c,0x5fb,0x601,0x4003d,0x22,0xc6d, + 0xc6c,0x60041,0x15f,0xc70,0x162,0x5fb,0x601,0x4003d,0x22,0xc71,0xc70,0x60041, + 0x15f,0xc74,0x167,0x5fb,0x601,0x4003d,0x22,0xc75,0xc74,0x60041,0x15f,0xc78, + 0x16c,0x5fb,0x601,0x4003d,0x22,0xc79,0xc78,0x70050,0x2e,0xc7a,0xc6d,0xc71, + 0xc75,0xc79,0x6016e,0x2e,0xc87,0xe2,0xc7a,0x10f,0x6016e,0x2e,0xc89,0xe2, + 0xc7a,0xe8,0x6016e,0x2e,0xc8b,0xe2,0xc7a,0xe1,0x50081,0x2e,0xc95,0xc7a, + 0xc87,0x50081,0x2e,0xc97,0xc95,0xc89,0x50081,0x2e,0xc99,0xc97,0xc8b,0x5008e, + 0x2e,0xc9a,0xc99,0x18f,0x300f7,0xc67,0x0,0x400fa,0x753,0xc4e,0xc67,0x200f8, + 0xc4e,0x50084,0x13,0xc51,0x59f,0x15aa,0x4007c,0x1c,0xc52,0xc51,0x50086,0x6, + 0xc54,0x5fb,0xe1,0x4007c,0x1b,0xc55,0xc54,0x50086,0x6,0xc57,0x601,0xe1, + 0x4007c,0x1b,0xc58,0xc57,0x50050,0x1c,0xc59,0xc55,0xc58,0x50080,0x1c,0xc5a, + 0xc52,0xc59,0x50051,0x22,0xca2,0xc9a,0x0,0x4006d,0x6,0xca7,0xca2,0x70050, + 0x10d,0xca8,0xca7,0x10f,0x10f,0x10f,0x4003d,0x108,0xcb3,0x12a,0x50063,0xcb3, + 0xc5a,0xca8,0x2000,0x50089,0x6,0xc62,0xc57,0xe1,0x50080,0x6,0xc63,0x5fb, + 0xc62,0x60041,0x15f,0xcc8,0x15c,0xc63,0x601,0x3003e,0xcc8,0xca2,0x50051,0x22, + 0xccc,0xc9a,0x1,0x60041,0x15f,0xccd,0x162,0xc63,0x601,0x3003e,0xccd,0xccc, + 0x50051,0x22,0xcd1,0xc9a,0x2,0x60041,0x15f,0xcd2,0x167,0xc63,0x601,0x3003e, + 0xcd2,0xcd1,0x50051,0x22,0xcd6,0xc9a,0x3,0x60041,0x15f,0xcd7,0x16c,0xc63, + 0x601,0x3003e,0xcd7,0xcd6,0x200f9,0xc67,0x200f8,0xc67,0x300e1,0xe1,0x193,0x400e0, + 0xe1,0xe1,0x194,0x500b0,0x5e,0xce6,0x5a3,0x235,0x300f7,0xd10,0x0,0x400fa, + 0xce6,0xce7,0xd10,0x200f8,0xce7,0x50089,0x6,0xceb,0x601,0xe1,0x50080,0x6, + 0xcec,0x6ba,0xceb,0x60041,0x15f,0xd15,0x15c,0xcec,0x6bd,0x4003d,0x22,0xd16, + 0xd15,0x60041,0x15f,0xd19,0x162,0xcec,0x6bd,0x4003d,0x22,0xd1a,0xd19,0x60041, + 0x15f,0xd1d,0x167,0xcec,0x6bd,0x4003d,0x22,0xd1e,0xd1d,0x60041,0x15f,0xd21, + 0x16c,0xcec,0x6bd,0x4003d,0x22,0xd22,0xd21,0x70050,0x2e,0xd23,0xd16,0xd1a, + 0xd1e,0xd22,0x6016e,0x2e,0xd30,0xe2,0xd23,0x10f,0x6016e,0x2e,0xd32,0xe2, + 0xd23,0xe8,0x6016e,0x2e,0xd34,0xe2,0xd23,0xe1,0x50081,0x2e,0xd3e,0xd23, + 0xd30,0x50081,0x2e,0xd40,0xd3e,0xd32,0x50081,0x2e,0xd42,0xd40,0xd34,0x5008e, + 0x2e,0xd43,0xd42,0x18f,0x300f7,0xd0f,0x0,0x400fa,0x753,0xcf5,0xd0f,0x200f8, + 0xcf5,0x50084,0x13,0xcf8,0x59f,0x15ab,0x4007c,0x1c,0xcf9,0xcf8,0x50086,0x6, + 0xcfb,0x5fb,0xe1,0x4007c,0x1b,0xcfc,0xcfb,0x50086,0x6,0xcfe,0x601,0xe1, + 0x4007c,0x1b,0xcff,0xcfe,0x50050,0x1c,0xd00,0xcfc,0xcff,0x50080,0x1c,0xd01, + 0xcf9,0xd00,0x50051,0x22,0xd4b,0xd43,0x0,0x4006d,0x6,0xd50,0xd4b,0x70050, + 0x10d,0xd51,0xd50,0x10f,0x10f,0x10f,0x4003d,0x108,0xd60,0x12f,0x50063,0xd60, + 0xd01,0xd51,0x2000,0x50080,0x6,0xd0a,0x6ba,0xcfe,0x60041,0x15f,0xd71,0x15c, + 0xd0a,0x6bd,0x3003e,0xd71,0xd4b,0x50051,0x22,0xd75,0xd43,0x1,0x60041,0x15f, + 0xd76,0x162,0xd0a,0x6bd,0x3003e,0xd76,0xd75,0x50051,0x22,0xd7a,0xd43,0x2, + 0x60041,0x15f,0xd7b,0x167,0xd0a,0x6bd,0x3003e,0xd7b,0xd7a,0x50051,0x22,0xd7f, + 0xd43,0x3,0x60041,0x15f,0xd80,0x16c,0xd0a,0x6bd,0x3003e,0xd80,0xd7f,0x200f9, + 0xd0f,0x200f8,0xd0f,0x200f9,0xd10,0x200f8,0xd10,0x300e1,0xe1,0x193,0x400e0,0xe1, + 0xe1,0x194,0x500b0,0x5e,0xd8f,0x5a3,0x158,0x300f7,0xdb5,0x0,0x400fa,0xd8f, + 0xd90,0xdb5,0x200f8,0xd90,0x50084,0x6,0xd92,0x5fb,0x24d,0x50080,0x6,0xd94, + 0xd92,0x601,0x50084,0x6,0xd96,0x601,0x24d,0x60041,0x15f,0xdba,0x15c,0xd94, + 0xd96,0x4003d,0x22,0xdbb,0xdba,0x60041,0x15f,0xdbe,0x162,0xd94,0xd96,0x4003d, + 0x22,0xdbf,0xdbe,0x60041,0x15f,0xdc2,0x167,0xd94,0xd96,0x4003d,0x22,0xdc3, + 0xdc2,0x60041,0x15f,0xdc6,0x16c,0xd94,0xd96,0x4003d,0x22,0xdc7,0xdc6,0x70050, + 0x2e,0xdc8,0xdbb,0xdbf,0xdc3,0xdc7,0x6016e,0x2e,0xdd5,0xe2,0xdc8,0x10f, + 0x6016e,0x2e,0xdd7,0xe2,0xdc8,0xe8,0x6016e,0x2e,0xdd9,0xe2,0xdc8,0xe1, + 0x50081,0x2e,0xde3,0xdc8,0xdd5,0x50081,0x2e,0xde5,0xde3,0xdd7,0x50081,0x2e, + 0xde7,0xde5,0xdd9,0x5008e,0x2e,0xde8,0xde7,0x18f,0x300f7,0xdb4,0x0,0x400fa, + 0x753,0xd9d,0xdb4,0x200f8,0xd9d,0x50084,0x13,0xda0,0x59f,0x15ad,0x4007c,0x1c, + 0xda1,0xda0,0x50086,0x6,0xda3,0x5fb,0xe1,0x4007c,0x1b,0xda4,0xda3,0x50086, + 0x6,0xda6,0x601,0xe1,0x4007c,0x1b,0xda7,0xda6,0x50050,0x1c,0xda8,0xda4, + 0xda7,0x50080,0x1c,0xda9,0xda1,0xda8,0x50051,0x22,0xdf0,0xde8,0x0,0x4006d, + 0x6,0xdf5,0xdf0,0x70050,0x10d,0xdf6,0xdf5,0x10f,0x10f,0x10f,0x4003d,0x108, + 0xe09,0x134,0x50063,0xe09,0xda9,0xdf6,0x2000,0x50080,0x6,0xdb1,0xda3,0x601, + 0x60041,0x15f,0xe16,0x15c,0xdb1,0x10f,0x3003e,0xe16,0xdf0,0x50051,0x22,0xe1a, + 0xde8,0x1,0x60041,0x15f,0xe1b,0x162,0xdb1,0x10f,0x3003e,0xe1b,0xe1a,0x50051, + 0x22,0xe1f,0xde8,0x2,0x60041,0x15f,0xe20,0x167,0xdb1,0x10f,0x3003e,0xe20, + 0xe1f,0x50051,0x22,0xe24,0xde8,0x3,0x60041,0x15f,0xe25,0x16c,0xdb1,0x10f, + 0x3003e,0xe25,0xe24,0x200f9,0xdb4,0x200f8,0xdb4,0x200f9,0xdb5,0x200f8,0xdb5,0x300e1, + 0xe1,0x193,0x400e0,0xe1,0xe1,0x194,0x500b0,0x5e,0xe31,0x5a3,0x24d,0x300f7, + 0xe42,0x0,0x400fa,0xe31,0xe32,0xe42,0x200f8,0xe32,0x60041,0x15f,0xe47,0x15c, + 0x5a3,0x10f,0x4003d,0x22,0xe48,0xe47,0x60041,0x15f,0xe4b,0x162,0x5a3,0x10f, + 0x4003d,0x22,0xe4c,0xe4b,0x60041,0x15f,0xe4f,0x167,0x5a3,0x10f,0x4003d,0x22, + 0xe50,0xe4f,0x60041,0x15f,0xe53,0x16c,0x5a3,0x10f,0x4003d,0x22,0xe54,0xe53, + 0x70050,0x2e,0xe55,0xe48,0xe4c,0xe50,0xe54,0x6016e,0x2e,0xe62,0xe2,0xe55, + 0x10f,0x6016e,0x2e,0xe64,0xe2,0xe55,0xe8,0x6016e,0x2e,0xe66,0xe2,0xe55, + 0xe1,0x50081,0x2e,0xe70,0xe55,0xe62,0x50081,0x2e,0xe72,0xe70,0xe64,0x50081, + 0x2e,0xe74,0xe72,0xe66,0x5008e,0x2e,0xe75,0xe74,0x18f,0x300f7,0xe41,0x0, + 0x400fa,0x753,0xe3a,0xe41,0x200f8,0xe3a,0x4007c,0x1c,0xe3c,0x59f,0x50051,0x22, + 0xe7d,0xe75,0x0,0x4006d,0x6,0xe82,0xe7d,0x70050,0x10d,0xe83,0xe82,0x10f, + 0x10f,0x10f,0x4003d,0x108,0xe9a,0x139,0x50063,0xe9a,0xe3c,0xe83,0x2000,0x200f9, + 0xe41,0x200f8,0xe41,0x200f9,0xe42,0x200f8,0xe42,0x100fd,0x10038, +}; +static const char *of_compute_luminance_pyramid_pass_uav_tex_names[] = {"rw_optical_flow_input", "rw_optical_flow_input_level_1", "rw_optical_flow_input_level_2", "rw_optical_flow_input_level_3", "rw_optical_flow_input_level_4", "rw_optical_flow_input_level_5", "rw_optical_flow_input_level_6"}; +static const uint32_t of_compute_luminance_pyramid_pass_uav_tex_bind[] = {0, 1, 2, 3, 4, 5, 6}; +static const uint32_t of_compute_luminance_pyramid_pass_uav_tex_count[] = {1, 1, 1, 1, 1, 1, 1}; +static const uint32_t of_compute_luminance_pyramid_pass_uav_tex_space[] = {0, 0, 0, 0, 0, 0, 0}; + +static const uint32_t of_generate_scd_histogram_pass_spv[975] = { + 0x7230203,0x10500,0x8000b,0x22a,0x0,0x20011,0x1,0x6000b,0x1,0x4c534c47,0x6474732e,0x3035342e, + 0x0,0x3000e,0x0,0x1,0xb000f,0x5,0x4,0x6e69616d,0x0,0x26,0x2f,0x3a, + 0x79,0x110,0x119,0x60010,0x4,0x11,0x20,0x8,0x1,0x30003,0x2,0x1c2, + 0xb0004,0x455f4c47,0x735f5458,0x6c706d61,0x656c7265,0x745f7373,0x75747865,0x665f6572,0x74636e75,0x736e6f69,0x0,0xb0004, + 0x455f4c47,0x735f5458,0x65646168,0x78655f72,0x63696c70,0x615f7469,0x68746972,0x6974656d,0x79745f63,0x736570,0xa0004,0x475f4c47, + 0x4c474f4f,0x70635f45,0x74735f70,0x5f656c79,0x656e696c,0x7269645f,0x69746365,0x6576,0x80004,0x475f4c47,0x4c474f4f,0x6e695f45, + 0x64756c63,0x69645f65,0x74636572,0x657669,0x40005,0x4,0x6e69616d,0x0,0x40005,0x24,0x464f6263,0x745f, + 0x90006,0x24,0x0,0x706e4969,0x754c7475,0x6552616d,0x756c6f73,0x6e6f6974,0x0,0x40005,0x26,0x464f6263, + 0x0,0x80005,0x2f,0x706f5f72,0x61636974,0x6c665f6c,0x695f776f,0x7475706e,0x0,0xa0005,0x3a,0x6f5f7772, + 0x63697470,0x665f6c61,0x5f776f6c,0x5f646373,0x74736968,0x6172676f,0x6d,0x50005,0x79,0x42646373,0x65666675,0x72, + 0x80005,0x110,0x475f6c67,0x61626f6c,0x766e496c,0x7461636f,0x496e6f69,0x44,0x80005,0x119,0x4c5f6c67,0x6c61636f, + 0x6f766e49,0x69746163,0x6e496e6f,0x786564,0x30047,0x24,0x2,0x50048,0x24,0x0,0x23,0x0, + 0x40047,0x26,0x21,0x2,0x40047,0x26,0x22,0x0,0x40047,0x2f,0x21,0x0, + 0x40047,0x2f,0x22,0x0,0x40047,0x3a,0x21,0x1,0x40047,0x3a,0x22,0x0, + 0x40047,0x110,0xb,0x1c,0x40047,0x119,0xb,0x1d,0x40047,0x12c,0xb,0x19, + 0x20013,0x2,0x30021,0x3,0x2,0x40015,0x6,0x20,0x1,0x40017,0x7,0x6, + 0x2,0x40015,0xc,0x20,0x0,0x40017,0x18,0x6,0x3,0x3001e,0x24,0x7, + 0x40020,0x25,0x2,0x24,0x4003b,0x25,0x26,0x2,0x4002b,0x6,0x27,0x0, + 0x40020,0x28,0x2,0x7,0x90019,0x2d,0xc,0x1,0x0,0x0,0x0,0x1, + 0x0,0x40020,0x2e,0x0,0x2d,0x4003b,0x2e,0x2f,0x0,0x40017,0x32,0xc, + 0x4,0x4002b,0xc,0x34,0x0,0x90019,0x38,0xc,0x1,0x0,0x0,0x0, + 0x2,0x21,0x40020,0x39,0x0,0x38,0x4003b,0x39,0x3a,0x0,0x40020,0x3e, + 0xb,0xc,0x4002b,0xc,0x40,0x1,0x4002b,0xc,0x46,0x3,0x4002b,0xc, + 0x4e,0x2,0x4002b,0x6,0x6a,0xa,0x20014,0x74,0x4002b,0xc,0x76,0xa00, + 0x4001c,0x77,0xc,0x76,0x40020,0x78,0x4,0x77,0x4003b,0x78,0x79,0x4, + 0x40020,0x7e,0x4,0xc,0x4002b,0x6,0x81,0x1,0x4002b,0xc,0x83,0xd48, + 0x4002b,0xc,0x84,0x108,0x4002b,0x6,0x87,0x4,0x5002c,0x7,0xae,0x81, + 0x27,0x4002b,0x6,0xb3,0x2,0x5002c,0x7,0xb4,0xb3,0x27,0x4002b,0x6, + 0xb9,0x3,0x5002c,0x7,0xba,0xb9,0x27,0x4002b,0xc,0xbf,0xa,0x4002b, + 0x6,0xdf,0x80,0x40017,0x10e,0xc,0x3,0x40020,0x10f,0x1,0x10e,0x4003b, + 0x10f,0x110,0x1,0x40020,0x118,0x1,0xc,0x4003b,0x118,0x119,0x1,0x4002b, + 0xc,0x12a,0x20,0x4002b,0xc,0x12b,0x8,0x6002c,0x10e,0x12c,0x12a,0x12b, + 0x40,0x7002c,0x32,0x217,0xbf,0xbf,0xbf,0xbf,0x4002b,0x6,0x229,0x100, + 0x50036,0x2,0x4,0x0,0x3,0x200f8,0x5,0x4003d,0x10e,0x111,0x110,0x4007c, + 0x18,0x112,0x111,0x4003d,0xc,0x11a,0x119,0x4007c,0x6,0x11b,0x11a,0x50041, + 0x28,0x1e2,0x26,0x27,0x4003d,0x7,0x1e3,0x1e2,0x50051,0x6,0x145,0x1e3, + 0x0,0x4007c,0xc,0x146,0x145,0x50086,0xc,0x147,0x146,0x46,0x50051,0x6, + 0x149,0x1e3,0x1,0x4007c,0xc,0x14a,0x149,0x50086,0xc,0x14b,0x14a,0x46, + 0x50051,0x6,0x14d,0x112,0x2,0x4007c,0xc,0x14e,0x14d,0x50089,0xc,0x14f, + 0x14e,0x46,0x50086,0xc,0x153,0x14e,0x46,0x50084,0xc,0x156,0x147,0x14f, + 0x50084,0xc,0x159,0x14b,0x153,0x50080,0xc,0x15c,0x156,0x147,0x50080,0xc, + 0x15f,0x159,0x14b,0x50084,0x6,0x161,0x11b,0x6a,0x4007c,0xc,0x162,0x161, + 0x200f9,0x163,0x200f8,0x163,0x700f5,0x6,0x206,0x27,0x5,0x16f,0x167,0x500b1, + 0x74,0x166,0x206,0x6a,0x400f6,0x170,0x167,0x0,0x400fa,0x166,0x167,0x170, + 0x200f8,0x167,0x4007c,0xc,0x16a,0x206,0x50080,0xc,0x16b,0x162,0x16a,0x50041, + 0x7e,0x16c,0x79,0x16b,0x3003e,0x16c,0x34,0x50080,0x6,0x16f,0x206,0x81, + 0x200f9,0x163,0x200f8,0x170,0x300e1,0x4e,0x83,0x400e0,0x4e,0x4e,0x84,0x50051, + 0x6,0x173,0x112,0x0,0x50084,0x6,0x174,0x87,0x173,0x4007c,0xc,0x175, + 0x174,0x50080,0xc,0x176,0x156,0x175,0x4007c,0x6,0x177,0x176,0x50051,0x6, + 0x17a,0x112,0x1,0x4007c,0xc,0x17b,0x17a,0x50080,0xc,0x17c,0x159,0x17b, + 0x4007c,0x6,0x17d,0x17c,0x50050,0x7,0x17e,0x177,0x17d,0x500b0,0x74,0x183, + 0x176,0x15c,0x300f7,0x1be,0x0,0x400fa,0x183,0x184,0x1be,0x200f8,0x184,0x200f9, + 0x185,0x200f8,0x185,0x700f5,0x7,0x228,0x17e,0x184,0x224,0x18c,0x50051,0x6, + 0x188,0x228,0x1,0x4007c,0xc,0x189,0x188,0x500b0,0x74,0x18b,0x189,0x15f, + 0x400f6,0x1bd,0x18c,0x0,0x400fa,0x18b,0x18c,0x1bd,0x200f8,0x18c,0x4003d,0x2d, + 0x1ea,0x2f,0x7005f,0x32,0x1ec,0x1ea,0x228,0x2002,0x27,0x50051,0xc,0x1ed, + 0x1ec,0x0,0x50080,0x7,0x191,0x228,0xae,0x4003d,0x2d,0x1f0,0x2f,0x7005f, + 0x32,0x1f2,0x1f0,0x191,0x2002,0x27,0x50051,0xc,0x1f3,0x1f2,0x0,0x50080, + 0x7,0x194,0x228,0xb4,0x4003d,0x2d,0x1f6,0x2f,0x7005f,0x32,0x1f8,0x1f6, + 0x194,0x2002,0x27,0x50051,0xc,0x1f9,0x1f8,0x0,0x50080,0x7,0x197,0x228, + 0xba,0x4003d,0x2d,0x1fc,0x2f,0x7005f,0x32,0x1fe,0x1fc,0x197,0x2002,0x27, + 0x50051,0xc,0x1ff,0x1fe,0x0,0x70050,0x32,0x199,0x1ed,0x1f3,0x1f9,0x1ff, + 0x50084,0x32,0x19c,0x199,0x217,0x5008b,0x6,0x19e,0x11b,0x6a,0x4007c,0xc, + 0x19f,0x19e,0x50051,0xc,0x1a1,0x19c,0x0,0x50080,0xc,0x1a3,0x1a1,0x19f, + 0x50041,0x7e,0x1a4,0x79,0x1a3,0x700ea,0xc,0x1a5,0x1a4,0x40,0x34,0x40, + 0x50051,0xc,0x1a7,0x19c,0x1,0x50080,0xc,0x1a9,0x1a7,0x19f,0x50041,0x7e, + 0x1aa,0x79,0x1a9,0x700ea,0xc,0x1ab,0x1aa,0x40,0x34,0x40,0x50051,0xc, + 0x1ad,0x19c,0x2,0x50080,0xc,0x1af,0x1ad,0x19f,0x50041,0x7e,0x1b0,0x79, + 0x1af,0x700ea,0xc,0x1b1,0x1b0,0x40,0x34,0x40,0x50051,0xc,0x1b3,0x19c, + 0x3,0x50080,0xc,0x1b5,0x1b3,0x19f,0x50041,0x7e,0x1b6,0x79,0x1b5,0x700ea, + 0xc,0x1b7,0x1b6,0x40,0x34,0x40,0x50080,0x6,0x1bb,0x188,0xdf,0x60052, + 0x7,0x224,0x1bb,0x228,0x1,0x200f9,0x185,0x200f8,0x1bd,0x200f9,0x1be,0x200f8, + 0x1be,0x300e1,0x4e,0x83,0x400e0,0x4e,0x4e,0x84,0x200f9,0x1bf,0x200f8,0x1bf, + 0x700f5,0xc,0x211,0x34,0x1be,0x1cb,0x1c3,0x700f5,0x6,0x20c,0x27,0x1be, + 0x1ce,0x1c3,0x500b1,0x74,0x1c2,0x20c,0x6a,0x400f6,0x1cf,0x1c3,0x0,0x400fa, + 0x1c2,0x1c3,0x1cf,0x200f8,0x1c3,0x4007c,0xc,0x1c6,0x20c,0x50080,0xc,0x1c7, + 0x162,0x1c6,0x50041,0x7e,0x1c8,0x79,0x1c7,0x4003d,0xc,0x1c9,0x1c8,0x50080, + 0xc,0x1cb,0x211,0x1c9,0x50080,0x6,0x1ce,0x20c,0x81,0x200f9,0x1bf,0x200f8, + 0x1cf,0x50084,0x6,0x1d7,0x229,0x14d,0x4007c,0xc,0x1d8,0x1d7,0x50080,0xc, + 0x1dc,0x1d8,0x11a,0x4007c,0x6,0x1dd,0x1dc,0x50050,0x7,0x202,0x1dd,0x27, + 0x6003c,0x3e,0x204,0x3a,0x202,0x34,0x700ea,0xc,0x205,0x204,0x40,0x34, + 0x211,0x100fd,0x10038, +}; +static const char *of_generate_scd_histogram_pass_cb_names[] = {"cbOF"}; +static const uint32_t of_generate_scd_histogram_pass_cb_bind[] = {2}; +static const uint32_t of_generate_scd_histogram_pass_cb_count[] = {1}; +static const uint32_t of_generate_scd_histogram_pass_cb_space[] = {0}; +static const char *of_generate_scd_histogram_pass_srv_tex_names[] = {"r_optical_flow_input"}; +static const uint32_t of_generate_scd_histogram_pass_srv_tex_bind[] = {0}; +static const uint32_t of_generate_scd_histogram_pass_srv_tex_count[] = {1}; +static const uint32_t of_generate_scd_histogram_pass_srv_tex_space[] = {0}; +static const char *of_generate_scd_histogram_pass_uav_tex_names[] = {"rw_optical_flow_scd_histogram"}; +static const uint32_t of_generate_scd_histogram_pass_uav_tex_bind[] = {1}; +static const uint32_t of_generate_scd_histogram_pass_uav_tex_count[] = {1}; +static const uint32_t of_generate_scd_histogram_pass_uav_tex_space[] = {0}; + +static const uint32_t of_compute_scd_divergence_pass_spv[2287] = { + 0x7230203,0x10500,0x8000b,0x62c,0x0,0x20011,0x1,0x6000b,0x1,0x4c534c47,0x6474732e,0x3035342e, + 0x0,0x3000e,0x0,0x1,0xf000f,0x5,0x4,0x6e69616d,0x0,0x70,0x82,0x91, + 0xa9,0xc0,0x17b,0x19b,0x220,0x2fb,0x304,0x60010,0x4,0x11,0x100,0x1, + 0x1,0x30003,0x2,0x1c2,0xb0004,0x455f4c47,0x735f5458,0x6c706d61,0x656c7265,0x745f7373,0x75747865,0x665f6572, + 0x74636e75,0x736e6f69,0x0,0xb0004,0x455f4c47,0x735f5458,0x65646168,0x78655f72,0x63696c70,0x615f7469,0x68746972,0x6974656d, + 0x79745f63,0x736570,0xa0004,0x475f4c47,0x4c474f4f,0x70635f45,0x74735f70,0x5f656c79,0x656e696c,0x7269645f,0x69746365,0x6576, + 0x80004,0x475f4c47,0x4c474f4f,0x6e695f45,0x64756c63,0x69645f65,0x74636572,0x657669,0x40005,0x4,0x6e69616d,0x0, + 0xa0005,0x70,0x6f5f7772,0x63697470,0x665f6c61,0x5f776f6c,0x5f646373,0x74736968,0x6172676f,0x6d,0xc0005,0x82, + 0x6f5f7772,0x63697470,0x665f6c61,0x5f776f6c,0x5f646373,0x76657270,0x73756f69,0x7369685f,0x72676f74,0x6d61,0x90005,0x91, + 0x6f5f7772,0x63697470,0x665f6c61,0x5f776f6c,0x5f646373,0x706d6574,0x0,0x90005,0xa9,0x6f5f7772,0x63697470,0x665f6c61, + 0x5f776f6c,0x5f646373,0x7074756f,0x7475,0x60005,0xc0,0x72756f73,0x69486563,0x676f7473,0x6d6172,0x70005,0x17b, + 0x746c6966,0x64657265,0x74736948,0x6172676f,0x6d,0x50005,0x19b,0x706d6574,0x66667542,0x7265,0x50005,0x220, + 0x706d6574,0x66667542,0x327265,0x80005,0x2fb,0x475f6c67,0x61626f6c,0x766e496c,0x7461636f,0x496e6f69,0x44,0x80005, + 0x304,0x4c5f6c67,0x6c61636f,0x6f766e49,0x69746163,0x6e496e6f,0x786564,0x40047,0x70,0x21,0x0,0x40047, + 0x70,0x22,0x0,0x40047,0x82,0x21,0x1,0x40047,0x82,0x22,0x0,0x40047, + 0x91,0x21,0x2,0x40047,0x91,0x22,0x0,0x40047,0xa9,0x21,0x3,0x40047, + 0xa9,0x22,0x0,0x40047,0x2fb,0xb,0x1c,0x40047,0x304,0xb,0x1d,0x40047, + 0x318,0xb,0x19,0x20013,0x2,0x30021,0x3,0x2,0x30016,0x6,0x20,0x40015, + 0x8,0x20,0x0,0x40015,0xd,0x20,0x1,0x20014,0x1e,0x40017,0x4a,0xd, + 0x3,0x40017,0x4c,0xd,0x2,0x4002b,0x6,0x6a,0x3ee66666,0x90019,0x6e,0x8, + 0x1,0x0,0x0,0x0,0x2,0x21,0x40020,0x6f,0x0,0x6e,0x4003b,0x6f, + 0x70,0x0,0x4002b,0xd,0x73,0x0,0x40017,0x75,0x8,0x4,0x4002b,0x8, + 0x77,0x0,0x90019,0x80,0x6,0x1,0x0,0x0,0x0,0x2,0x3,0x40020, + 0x81,0x0,0x80,0x4003b,0x81,0x82,0x0,0x40017,0x86,0x6,0x4,0x4002b, + 0x6,0x8f,0x0,0x4003b,0x6f,0x91,0x0,0x40020,0x9c,0xb,0x8,0x4002b, + 0x8,0x9e,0x1,0x5002c,0x4c,0xa1,0x73,0x73,0x7002c,0x75,0xa2,0x77, + 0x77,0x77,0x77,0x4002b,0xd,0xa4,0x1,0x5002c,0x4c,0xa5,0xa4,0x73, + 0x4002b,0xd,0xa7,0x2,0x5002c,0x4c,0xa8,0xa7,0x73,0x4003b,0x6f,0xa9, + 0x0,0x4002b,0x8,0xbd,0x100,0x4001c,0xbe,0x6,0xbd,0x40020,0xbf,0x4, + 0xbe,0x4003b,0xbf,0xc0,0x4,0x40020,0xc7,0x4,0x6,0x4002b,0x8,0xc9, + 0x2,0x4002b,0x8,0xca,0xd48,0x4002b,0x8,0xcb,0x108,0x4002b,0xd,0xce, + 0xfffffffb,0x4002b,0x6,0xd1,0x3c10612b,0x4002b,0xd,0xd2,0xff,0x4002b,0x6,0xe0, + 0x3cde5c35,0x4002b,0x6,0xee,0x3d855a85,0x4002b,0x6,0xfc,0x3df92326,0x4002b,0xd,0xfe, + 0x3,0x4002b,0x6,0x10b,0x3e353f0e,0x4002b,0xd,0x10d,0x4,0x4002b,0x6,0x11a, + 0x3e4d6105,0x4002b,0xd,0x11c,0x5,0x4002b,0xd,0x146,0x8,0x4002b,0x6,0x16f, + 0x3f800000,0x4003b,0xbf,0x17b,0x4,0x4003b,0xbf,0x19b,0x4,0x4002b,0xd,0x1a2, + 0x80,0x4002b,0xd,0x1b0,0x40,0x4002b,0xd,0x1be,0x20,0x4002b,0xd,0x1cc, + 0x10,0x40017,0x21d,0x6,0x2,0x4001c,0x21e,0x21d,0xbd,0x40020,0x21f,0x4, + 0x21e,0x4003b,0x21f,0x220,0x4,0x40020,0x22f,0x4,0x21d,0x4002b,0x8,0x2b4, + 0x1a,0x40017,0x2f9,0x8,0x3,0x40020,0x2fa,0x1,0x2f9,0x4003b,0x2fa,0x2fb, + 0x1,0x40020,0x303,0x1,0x8,0x4003b,0x303,0x304,0x1,0x6002c,0x2f9,0x318, + 0xbd,0x9e,0x9e,0x4002b,0xd,0x625,0xfffffffc,0x4002b,0xd,0x626,0xfffffffd,0x4002b, + 0xd,0x627,0xfffffffe,0x4002b,0xd,0x628,0xffffffff,0x4002b,0x6,0x62a,0x47d9038e,0x4002b, + 0x6,0x62b,0x358637bd,0x50036,0x2,0x4,0x0,0x3,0x200f8,0x5,0x4003d,0x2f9, + 0x2fc,0x2fb,0x4007c,0x4a,0x2fd,0x2fc,0x4003d,0x8,0x305,0x304,0x4007c,0xd, + 0x306,0x305,0x50051,0xd,0x36f,0x2fd,0x0,0x4003d,0x6e,0x52d,0x70,0x50050, + 0x4c,0x52f,0x36f,0x73,0x60062,0x75,0x530,0x52d,0x52f,0x2000,0x50051,0x8, + 0x531,0x530,0x0,0x40070,0x6,0x371,0x531,0x50041,0xc7,0x372,0xc0,0x306, + 0x3003e,0x372,0x371,0x300e1,0xc9,0xca,0x400e0,0xc9,0xc9,0xcb,0x50080,0xd, + 0x374,0x306,0xce,0x7000c,0xd,0x536,0x1,0x27,0xd2,0x374,0x7000c,0xd, + 0x53b,0x1,0x2a,0x73,0x536,0x50041,0xc7,0x379,0xc0,0x53b,0x4003d,0x6, + 0x37a,0x379,0x50085,0x6,0x37b,0xd1,0x37a,0x50080,0xd,0x37f,0x306,0x625, + 0x7000c,0xd,0x540,0x1,0x27,0xd2,0x37f,0x7000c,0xd,0x545,0x1,0x2a, + 0x73,0x540,0x50041,0xc7,0x382,0xc0,0x545,0x4003d,0x6,0x383,0x382,0x50085, + 0x6,0x384,0xe0,0x383,0x50081,0x6,0x386,0x37b,0x384,0x50080,0xd,0x388, + 0x306,0x626,0x7000c,0xd,0x54a,0x1,0x27,0xd2,0x388,0x7000c,0xd,0x54f, + 0x1,0x2a,0x73,0x54a,0x50041,0xc7,0x38b,0xc0,0x54f,0x4003d,0x6,0x38c, + 0x38b,0x50085,0x6,0x38d,0xee,0x38c,0x50081,0x6,0x38f,0x386,0x38d,0x50080, + 0xd,0x391,0x306,0x627,0x7000c,0xd,0x554,0x1,0x27,0xd2,0x391,0x7000c, + 0xd,0x559,0x1,0x2a,0x73,0x554,0x50041,0xc7,0x394,0xc0,0x559,0x4003d, + 0x6,0x395,0x394,0x50085,0x6,0x396,0xfc,0x395,0x50081,0x6,0x398,0x38f, + 0x396,0x50080,0xd,0x39a,0x306,0x628,0x7000c,0xd,0x55e,0x1,0x27,0xd2, + 0x39a,0x7000c,0xd,0x563,0x1,0x2a,0x73,0x55e,0x50041,0xc7,0x39d,0xc0, + 0x563,0x4003d,0x6,0x39e,0x39d,0x50085,0x6,0x39f,0x10b,0x39e,0x50081,0x6, + 0x3a1,0x398,0x39f,0x7000c,0xd,0x568,0x1,0x27,0xd2,0x306,0x7000c,0xd, + 0x56d,0x1,0x2a,0x73,0x568,0x50041,0xc7,0x3a6,0xc0,0x56d,0x4003d,0x6, + 0x3a7,0x3a6,0x50085,0x6,0x3a8,0x11a,0x3a7,0x50081,0x6,0x3aa,0x3a1,0x3a8, + 0x50080,0xd,0x3ac,0x306,0xa4,0x7000c,0xd,0x572,0x1,0x27,0xd2,0x3ac, + 0x7000c,0xd,0x577,0x1,0x2a,0x73,0x572,0x50041,0xc7,0x3af,0xc0,0x577, + 0x4003d,0x6,0x3b0,0x3af,0x50085,0x6,0x3b1,0x10b,0x3b0,0x50081,0x6,0x3b3, + 0x3aa,0x3b1,0x50080,0xd,0x3b5,0x306,0xa7,0x7000c,0xd,0x57c,0x1,0x27, + 0xd2,0x3b5,0x7000c,0xd,0x581,0x1,0x2a,0x73,0x57c,0x50041,0xc7,0x3b8, + 0xc0,0x581,0x4003d,0x6,0x3b9,0x3b8,0x50085,0x6,0x3ba,0xfc,0x3b9,0x50081, + 0x6,0x3bc,0x3b3,0x3ba,0x50080,0xd,0x3be,0x306,0xfe,0x7000c,0xd,0x586, + 0x1,0x27,0xd2,0x3be,0x7000c,0xd,0x58b,0x1,0x2a,0x73,0x586,0x50041, + 0xc7,0x3c1,0xc0,0x58b,0x4003d,0x6,0x3c2,0x3c1,0x50085,0x6,0x3c3,0xee, + 0x3c2,0x50081,0x6,0x3c5,0x3bc,0x3c3,0x50080,0xd,0x3c7,0x306,0x10d,0x7000c, + 0xd,0x590,0x1,0x27,0xd2,0x3c7,0x7000c,0xd,0x595,0x1,0x2a,0x73, + 0x590,0x50041,0xc7,0x3ca,0xc0,0x595,0x4003d,0x6,0x3cb,0x3ca,0x50085,0x6, + 0x3cc,0xe0,0x3cb,0x50081,0x6,0x3ce,0x3c5,0x3cc,0x50080,0xd,0x3d0,0x306, + 0x11c,0x7000c,0xd,0x59a,0x1,0x27,0xd2,0x3d0,0x7000c,0xd,0x59f,0x1, + 0x2a,0x73,0x59a,0x50041,0xc7,0x3d3,0xc0,0x59f,0x4003d,0x6,0x3d4,0x3d3, + 0x50085,0x6,0x3d5,0xd1,0x3d4,0x50081,0x6,0x3d7,0x3ce,0x3d5,0x50081,0x6, + 0x3d9,0x3d7,0x16f,0x50051,0xd,0x3db,0x2fd,0x1,0x500aa,0x1e,0x3dc,0x3db, + 0x73,0x300f7,0x401,0x0,0x400fa,0x3dc,0x3dd,0x3e8,0x200f8,0x3dd,0x500aa,0x1e, + 0x3df,0x306,0x73,0x300f7,0x3e7,0x0,0x400fa,0x3df,0x3e0,0x3e2,0x200f8,0x3e0, + 0x50041,0xc7,0x3e1,0x17b,0xd2,0x3003e,0x3e1,0x16f,0x200f9,0x3e7,0x200f8,0x3e2, + 0x50082,0xd,0x3e4,0x306,0xa4,0x50041,0xc7,0x3e6,0x17b,0x3e4,0x3003e,0x3e6, + 0x3d9,0x200f9,0x3e7,0x200f8,0x3e7,0x200f9,0x401,0x200f8,0x3e8,0x500aa,0x1e,0x3eb, + 0x3db,0xa4,0x300f7,0x400,0x0,0x400fa,0x3eb,0x3ec,0x3f0,0x200f8,0x3ec,0x50041, + 0xc7,0x3ef,0x17b,0x306,0x3003e,0x3ef,0x3d9,0x200f9,0x400,0x200f8,0x3f0,0x500aa, + 0x1e,0x3f3,0x3db,0xa7,0x300f7,0x3ff,0x0,0x400fa,0x3f3,0x3f4,0x3ff,0x200f8, + 0x3f4,0x500aa,0x1e,0x3f6,0x306,0xd2,0x300f7,0x3fe,0x0,0x400fa,0x3f6,0x3f7, + 0x3f9,0x200f8,0x3f7,0x50041,0xc7,0x3f8,0x17b,0x73,0x3003e,0x3f8,0x16f,0x200f9, + 0x3fe,0x200f8,0x3f9,0x50041,0xc7,0x3fd,0x17b,0x3ac,0x3003e,0x3fd,0x3d9,0x200f9, + 0x3fe,0x200f8,0x3fe,0x200f9,0x3ff,0x200f8,0x3ff,0x200f9,0x400,0x200f8,0x400,0x200f9, + 0x401,0x200f8,0x401,0x300e1,0xc9,0xca,0x400e0,0xc9,0xc9,0xcb,0x50041,0xc7, + 0x404,0x17b,0x306,0x4003d,0x6,0x405,0x404,0x50041,0xc7,0x406,0x19b,0x306, + 0x3003e,0x406,0x405,0x300e1,0xc9,0xca,0x400e0,0xc9,0xc9,0xcb,0x500b1,0x1e, + 0x408,0x306,0x1a2,0x300f7,0x413,0x0,0x400fa,0x408,0x409,0x413,0x200f8,0x409, + 0x50080,0xd,0x40c,0x306,0x1a2,0x50041,0xc7,0x40d,0x19b,0x40c,0x4003d,0x6, + 0x40e,0x40d,0x4003d,0x6,0x410,0x406,0x50081,0x6,0x411,0x410,0x40e,0x3003e, + 0x406,0x411,0x200f9,0x413,0x200f8,0x413,0x300e1,0xc9,0xca,0x400e0,0xc9,0xc9, + 0xcb,0x500b1,0x1e,0x415,0x306,0x1b0,0x300f7,0x420,0x0,0x400fa,0x415,0x416, + 0x420,0x200f8,0x416,0x50080,0xd,0x419,0x306,0x1b0,0x50041,0xc7,0x41a,0x19b, + 0x419,0x4003d,0x6,0x41b,0x41a,0x4003d,0x6,0x41d,0x406,0x50081,0x6,0x41e, + 0x41d,0x41b,0x3003e,0x406,0x41e,0x200f9,0x420,0x200f8,0x420,0x300e1,0xc9,0xca, + 0x400e0,0xc9,0xc9,0xcb,0x500b1,0x1e,0x422,0x306,0x1be,0x300f7,0x42d,0x0, + 0x400fa,0x422,0x423,0x42d,0x200f8,0x423,0x50080,0xd,0x426,0x306,0x1be,0x50041, + 0xc7,0x427,0x19b,0x426,0x4003d,0x6,0x428,0x427,0x4003d,0x6,0x42a,0x406, + 0x50081,0x6,0x42b,0x42a,0x428,0x3003e,0x406,0x42b,0x200f9,0x42d,0x200f8,0x42d, + 0x500b1,0x1e,0x42f,0x306,0x1cc,0x300f7,0x43a,0x0,0x400fa,0x42f,0x430,0x43a, + 0x200f8,0x430,0x50080,0xd,0x433,0x306,0x1cc,0x50041,0xc7,0x434,0x19b,0x433, + 0x4003d,0x6,0x435,0x434,0x4003d,0x6,0x437,0x406,0x50081,0x6,0x438,0x437, + 0x435,0x3003e,0x406,0x438,0x200f9,0x43a,0x200f8,0x43a,0x500b1,0x1e,0x43c,0x306, + 0x146,0x300f7,0x447,0x0,0x400fa,0x43c,0x43d,0x447,0x200f8,0x43d,0x50080,0xd, + 0x440,0x306,0x146,0x50041,0xc7,0x441,0x19b,0x440,0x4003d,0x6,0x442,0x441, + 0x4003d,0x6,0x444,0x406,0x50081,0x6,0x445,0x444,0x442,0x3003e,0x406,0x445, + 0x200f9,0x447,0x200f8,0x447,0x500b1,0x1e,0x449,0x306,0x10d,0x300f7,0x454,0x0, + 0x400fa,0x449,0x44a,0x454,0x200f8,0x44a,0x50041,0xc7,0x44e,0x19b,0x3c7,0x4003d, + 0x6,0x44f,0x44e,0x4003d,0x6,0x451,0x406,0x50081,0x6,0x452,0x451,0x44f, + 0x3003e,0x406,0x452,0x200f9,0x454,0x200f8,0x454,0x500b1,0x1e,0x456,0x306,0xa7, + 0x300f7,0x461,0x0,0x400fa,0x456,0x457,0x461,0x200f8,0x457,0x50041,0xc7,0x45b, + 0x19b,0x3b5,0x4003d,0x6,0x45c,0x45b,0x4003d,0x6,0x45e,0x406,0x50081,0x6, + 0x45f,0x45e,0x45c,0x3003e,0x406,0x45f,0x200f9,0x461,0x200f8,0x461,0x500b1,0x1e, + 0x463,0x306,0xa4,0x300f7,0x46e,0x0,0x400fa,0x463,0x464,0x46e,0x200f8,0x464, + 0x50041,0xc7,0x468,0x19b,0x3ac,0x4003d,0x6,0x469,0x468,0x4003d,0x6,0x46b, + 0x406,0x50081,0x6,0x46c,0x46b,0x469,0x3003e,0x406,0x46c,0x200f9,0x46e,0x200f8, + 0x46e,0x300e1,0xc9,0xca,0x400e0,0xc9,0xc9,0xcb,0x50041,0xc7,0x470,0x19b, + 0x73,0x4003d,0x6,0x471,0x470,0x4003d,0x6,0x473,0x404,0x50088,0x6,0x474, + 0x473,0x471,0x3003e,0x404,0x474,0x4003d,0x6,0x478,0x404,0x4003d,0x80,0x5a2, + 0x82,0x50062,0x86,0x5a5,0x5a2,0x52f,0x50051,0x6,0x5a6,0x5a5,0x0,0x50088, + 0x6,0x480,0x478,0x5a6,0x6000c,0x6,0x481,0x1,0x1c,0x480,0x50085,0x6, + 0x482,0x478,0x481,0x50088,0x6,0x486,0x5a6,0x478,0x6000c,0x6,0x487,0x1, + 0x1c,0x486,0x50085,0x6,0x488,0x5a6,0x487,0x50050,0x21d,0x489,0x482,0x488, + 0x50041,0x22f,0x48a,0x220,0x306,0x3003e,0x48a,0x489,0x300e1,0xc9,0xca,0x400e0, + 0xc9,0xc9,0xcb,0x300f7,0x497,0x0,0x400fa,0x408,0x48d,0x497,0x200f8,0x48d, + 0x50080,0xd,0x490,0x306,0x1a2,0x50041,0x22f,0x491,0x220,0x490,0x4003d,0x21d, + 0x492,0x491,0x4003d,0x21d,0x494,0x48a,0x50081,0x21d,0x495,0x494,0x492,0x3003e, + 0x48a,0x495,0x200f9,0x497,0x200f8,0x497,0x300e1,0xc9,0xca,0x400e0,0xc9,0xc9, + 0xcb,0x300f7,0x4a4,0x0,0x400fa,0x415,0x49a,0x4a4,0x200f8,0x49a,0x50080,0xd, + 0x49d,0x306,0x1b0,0x50041,0x22f,0x49e,0x220,0x49d,0x4003d,0x21d,0x49f,0x49e, + 0x4003d,0x21d,0x4a1,0x48a,0x50081,0x21d,0x4a2,0x4a1,0x49f,0x3003e,0x48a,0x4a2, + 0x200f9,0x4a4,0x200f8,0x4a4,0x300e1,0xc9,0xca,0x400e0,0xc9,0xc9,0xcb,0x300f7, + 0x4b1,0x0,0x400fa,0x422,0x4a7,0x4b1,0x200f8,0x4a7,0x50080,0xd,0x4aa,0x306, + 0x1be,0x50041,0x22f,0x4ab,0x220,0x4aa,0x4003d,0x21d,0x4ac,0x4ab,0x4003d,0x21d, + 0x4ae,0x48a,0x50081,0x21d,0x4af,0x4ae,0x4ac,0x3003e,0x48a,0x4af,0x200f9,0x4b1, + 0x200f8,0x4b1,0x300f7,0x4be,0x0,0x400fa,0x42f,0x4b4,0x4be,0x200f8,0x4b4,0x50080, + 0xd,0x4b7,0x306,0x1cc,0x50041,0x22f,0x4b8,0x220,0x4b7,0x4003d,0x21d,0x4b9, + 0x4b8,0x4003d,0x21d,0x4bb,0x48a,0x50081,0x21d,0x4bc,0x4bb,0x4b9,0x3003e,0x48a, + 0x4bc,0x200f9,0x4be,0x200f8,0x4be,0x300f7,0x4cb,0x0,0x400fa,0x43c,0x4c1,0x4cb, + 0x200f8,0x4c1,0x50080,0xd,0x4c4,0x306,0x146,0x50041,0x22f,0x4c5,0x220,0x4c4, + 0x4003d,0x21d,0x4c6,0x4c5,0x4003d,0x21d,0x4c8,0x48a,0x50081,0x21d,0x4c9,0x4c8, + 0x4c6,0x3003e,0x48a,0x4c9,0x200f9,0x4cb,0x200f8,0x4cb,0x300f7,0x4d8,0x0,0x400fa, + 0x449,0x4ce,0x4d8,0x200f8,0x4ce,0x50041,0x22f,0x4d2,0x220,0x3c7,0x4003d,0x21d, + 0x4d3,0x4d2,0x4003d,0x21d,0x4d5,0x48a,0x50081,0x21d,0x4d6,0x4d5,0x4d3,0x3003e, + 0x48a,0x4d6,0x200f9,0x4d8,0x200f8,0x4d8,0x300f7,0x4e5,0x0,0x400fa,0x456,0x4db, + 0x4e5,0x200f8,0x4db,0x50041,0x22f,0x4df,0x220,0x3b5,0x4003d,0x21d,0x4e0,0x4df, + 0x4003d,0x21d,0x4e2,0x48a,0x50081,0x21d,0x4e3,0x4e2,0x4e0,0x3003e,0x48a,0x4e3, + 0x200f9,0x4e5,0x200f8,0x4e5,0x500aa,0x1e,0x4e7,0x306,0x73,0x300f7,0x51e,0x0, + 0x400fa,0x4e7,0x4e8,0x51e,0x200f8,0x4e8,0x50041,0x22f,0x4e9,0x220,0x73,0x4003d, + 0x21d,0x4ea,0x4e9,0x50041,0x22f,0x4eb,0x220,0xa4,0x4003d,0x21d,0x4ec,0x4eb, + 0x50081,0x21d,0x4ed,0x4ea,0x4ec,0x50051,0x6,0x4ef,0x4ed,0x0,0x6000c,0x6, + 0x4f0,0x1,0x4,0x4ef,0x50051,0x6,0x4f2,0x4ed,0x1,0x6000c,0x6,0x4f3, + 0x1,0x4,0x4f2,0x50081,0x6,0x4f4,0x4f0,0x4f3,0x4007f,0x6,0x4f5,0x4f4, + 0x6000c,0x6,0x4f6,0x1,0x1b,0x4f5,0x50083,0x6,0x4f7,0x16f,0x4f6,0x50085, + 0x6,0x4fa,0x4f7,0x62a,0x4006d,0x8,0x4fb,0x4fa,0x50050,0x4c,0x5a9,0x3db, + 0x73,0x6003c,0x9c,0x5ab,0x91,0x5a9,0x77,0x700ea,0x8,0x5ac,0x5ab,0x9e, + 0x77,0x4fb,0x6003c,0x9c,0x5b2,0xa9,0xa8,0x77,0x700ea,0x8,0x5b3,0x5b2, + 0x9e,0x77,0x9e,0x500aa,0x1e,0x502,0x5b3,0x2b4,0x300f7,0x51d,0x0,0x400fa, + 0x502,0x503,0x51d,0x200f8,0x503,0x4003d,0x6e,0x5b6,0x91,0x60062,0x75,0x5b9, + 0x5b6,0xa1,0x2000,0x50051,0x8,0x5ba,0x5b9,0x0,0x4003d,0x6e,0x5bd,0x91, + 0x60062,0x75,0x5c0,0x5bd,0xa5,0x2000,0x50051,0x8,0x5c1,0x5c0,0x0,0x4003d, + 0x6e,0x5c4,0x91,0x60062,0x75,0x5c7,0x5c4,0xa8,0x2000,0x50051,0x8,0x5c8, + 0x5c7,0x0,0x7000c,0x8,0x5cd,0x1,0x26,0x5c1,0x5c8,0x7000c,0x8,0x5d2, + 0x1,0x26,0x5ba,0x5cd,0x40070,0x6,0x50c,0x5d2,0x50085,0x6,0x50d,0x50c, + 0x62b,0x4003d,0x6e,0x5d5,0xa9,0x60062,0x75,0x5d8,0x5d5,0xa5,0x2000,0x50051, + 0x8,0x5d9,0x5d8,0x0,0x500c4,0x8,0x50f,0x5d9,0xa4,0x500ba,0x1e,0x5de, + 0x50d,0x6a,0x300f7,0x515,0x0,0x400fa,0x5de,0x512,0x515,0x200f8,0x512,0x500c5, + 0x8,0x514,0x50f,0x9e,0x200f9,0x515,0x200f8,0x515,0x700f5,0x8,0x61a,0x50f, + 0x503,0x514,0x512,0x4007c,0x8,0x5e2,0x50d,0x4003d,0x6e,0x5e4,0xa9,0x70050, + 0x75,0x5e8,0x5e2,0x77,0x77,0x77,0x50063,0x5e4,0xa1,0x5e8,0x2000,0x4003d, + 0x6e,0x5ea,0xa9,0x70050,0x75,0x5ee,0x61a,0x77,0x77,0x77,0x50063,0x5ea, + 0xa5,0x5ee,0x2000,0x4003d,0x6e,0x5f0,0xa9,0x50063,0x5f0,0xa8,0xa2,0x2000, + 0x4003d,0x6e,0x5f6,0x91,0x50063,0x5f6,0xa1,0xa2,0x2000,0x4003d,0x6e,0x5f7, + 0x91,0x50063,0x5f7,0xa5,0xa2,0x2000,0x4003d,0x6e,0x5f8,0x91,0x50063,0x5f8, + 0xa8,0xa2,0x2000,0x200f9,0x51d,0x200f8,0x51d,0x200f9,0x51e,0x200f8,0x51e,0x500aa, + 0x1e,0x521,0x3db,0xa4,0x300f7,0x52a,0x0,0x400fa,0x521,0x522,0x52a,0x200f8, + 0x522,0x4003d,0x80,0x5fa,0x82,0x70050,0x86,0x5fe,0x478,0x8f,0x8f,0x8f, + 0x40063,0x5fa,0x52f,0x5fe,0x4003d,0x6e,0x600,0x70,0x50063,0x600,0x52f,0xa2, + 0x2000,0x200f9,0x52a,0x200f8,0x52a,0x100fd,0x10038, +}; +static const char *of_compute_scd_divergence_pass_uav_tex_names[] = {"rw_optical_flow_scd_histogram", "rw_optical_flow_scd_previous_histogram", "rw_optical_flow_scd_temp", "rw_optical_flow_scd_output"}; +static const uint32_t of_compute_scd_divergence_pass_uav_tex_bind[] = {0, 1, 2, 3}; +static const uint32_t of_compute_scd_divergence_pass_uav_tex_count[] = {1, 1, 1, 1}; +static const uint32_t of_compute_scd_divergence_pass_uav_tex_space[] = {0, 0, 0, 0}; + +static const uint32_t of_compute_optical_flow_advanced_pass_v5_spv[4860] = { + 0x7230203,0x10500,0x8000b,0xed7,0x0,0x20011,0x1,0x20011,0x31,0x20011,0x3d,0x20011, + 0x3f,0x6000b,0x1,0x4c534c47,0x6474732e,0x3035342e,0x0,0x3000e,0x0,0x1,0x12000f,0x5, + 0x4,0x6e69616d,0x0,0xb2,0x190,0x1a5,0x1ac,0x1b5,0x1c5,0x27d,0x294,0x2c7, + 0x2fc,0x332,0x4c7,0x4cb,0x60010,0x4,0x11,0x40,0x1,0x1,0x30003,0x2, + 0x1c2,0xb0004,0x455f4c47,0x735f5458,0x6c706d61,0x656c7265,0x745f7373,0x75747865,0x665f6572,0x74636e75,0x736e6f69,0x0, + 0xb0004,0x455f4c47,0x735f5458,0x65646168,0x78655f72,0x63696c70,0x615f7469,0x68746972,0x6974656d,0x79745f63,0x736570,0xa0004, + 0x475f4c47,0x4c474f4f,0x70635f45,0x74735f70,0x5f656c79,0x656e696c,0x7269645f,0x69746365,0x6576,0x80004,0x475f4c47,0x4c474f4f, + 0x6e695f45,0x64756c63,0x69645f65,0x74636572,0x657669,0xa0004,0x4b5f4c47,0x735f5248,0x65646168,0x75735f72,0x6f726762,0x615f7075, + 0x68746972,0x6974656d,0x63,0x90004,0x4b5f4c47,0x735f5248,0x65646168,0x75735f72,0x6f726762,0x625f7075,0x6f6c6c61,0x74, + 0x90004,0x4b5f4c47,0x735f5248,0x65646168,0x75735f72,0x6f726762,0x625f7075,0x63697361,0x0,0x80004,0x4b5f4c47,0x735f5248, + 0x65646168,0x75735f72,0x6f726762,0x715f7075,0x646175,0x90004,0x4b5f4c47,0x735f5248,0x65646168,0x75735f72,0x6f726762,0x735f7075, + 0x66667568,0x656c,0x40005,0x4,0x6e69616d,0x0,0x60005,0xb2,0x535f6c67,0x72676275,0x5370756f,0x657a69, + 0x40005,0x18e,0x464f6263,0x745f,0x90006,0x18e,0x0,0x706e4969,0x754c7475,0x6552616d,0x756c6f73,0x6e6f6974, + 0x0,0xa0006,0x18e,0x1,0x74704f75,0x6c616369,0x776f6c46,0x61727950,0x4c64696d,0x6c657665,0x0,0xb0006, + 0x18e,0x2,0x74704f75,0x6c616369,0x776f6c46,0x61727950,0x4c64696d,0x6c657665,0x6e756f43,0x74,0x60006,0x18e, + 0x3,0x61724669,0x6e49656d,0x786564,0x40005,0x190,0x464f6263,0x0,0x80005,0x1a5,0x706f5f72,0x61636974, + 0x6c665f6c,0x695f776f,0x7475706e,0x0,0xa0005,0x1ac,0x706f5f72,0x61636974,0x6c665f6c,0x705f776f,0x69766572,0x5f73756f, + 0x75706e69,0x74,0x60005,0x1b5,0x6f5f7772,0x63697470,0x665f6c61,0x776f6c,0x90005,0x1c5,0x6f5f7772,0x63697470, + 0x665f6c61,0x5f776f6c,0x5f646373,0x7074756f,0x7475,0x50005,0x27d,0x76615773,0x64615365,0x0,0x60005,0x294, + 0x4d646173,0x75427061,0x72656666,0x0,0x50005,0x2c7,0x76615773,0x6e694d65,0x0,0x60005,0x2fc,0x72616573, + 0x75426863,0x72656666,0x0,0x40005,0x332,0x65786970,0x736c,0x60005,0x4c7,0x575f6c67,0x476b726f,0x70756f72, + 0x4449,0x80005,0x4cb,0x4c5f6c67,0x6c61636f,0x6f766e49,0x69746163,0x6e496e6f,0x786564,0x30047,0xb2,0x0, + 0x40047,0xb2,0xb,0x24,0x30047,0x18e,0x2,0x50048,0x18e,0x0,0x23,0x0, + 0x50048,0x18e,0x1,0x23,0x8,0x50048,0x18e,0x2,0x23,0xc,0x50048,0x18e, + 0x3,0x23,0x10,0x40047,0x190,0x21,0x4,0x40047,0x190,0x22,0x0,0x40047, + 0x1a5,0x21,0x0,0x40047,0x1a5,0x22,0x0,0x40047,0x1ac,0x21,0x1,0x40047, + 0x1ac,0x22,0x0,0x40047,0x1b5,0x21,0x2,0x40047,0x1b5,0x22,0x0,0x40047, + 0x1c5,0x21,0x3,0x40047,0x1c5,0x22,0x0,0x40047,0x4c7,0xb,0x1a,0x40047, + 0x4cb,0xb,0x1d,0x40047,0x4d7,0xb,0x19,0x30047,0xc51,0x0,0x20013,0x2, + 0x30021,0x3,0x2,0x40015,0x6,0x20,0x0,0x40017,0x8,0x6,0x4,0x20014, + 0xd,0x40015,0x1b,0x20,0x1,0x40017,0x3e,0x1b,0x2,0x40017,0x7a,0x6, + 0x2,0x4002b,0x6,0xa5,0x3,0x40020,0xb1,0x1,0x6,0x4003b,0xb1,0xb2, + 0x1,0x4002b,0x1b,0xca,0x8,0x4002b,0x1b,0xce,0x10,0x4002b,0x1b,0xd2, + 0x18,0x4002b,0x1b,0xd6,0x0,0x4002b,0x6,0xdc,0xff,0x4002b,0x1b,0xdf, + 0xffffffff,0x4002b,0x1b,0xe8,0xfffffffe,0x4002b,0x1b,0xf1,0xfffffffd,0x4002b,0x1b,0xfc, + 0x4,0x4002b,0x6,0x103,0xff000000,0x4002b,0x1b,0x107,0x3,0x4002b,0x1b,0x112, + 0x2,0x4002b,0x1b,0x11d,0x1,0x4002b,0x6,0x15d,0x0,0x4002b,0x6,0x16c, + 0x1,0x4002b,0x6,0x17b,0x2,0x6001e,0x18e,0x3e,0x6,0x6,0x6,0x40020, + 0x18f,0x2,0x18e,0x4003b,0x18f,0x190,0x2,0x40020,0x191,0x2,0x3e,0x40020, + 0x196,0x2,0x6,0x90019,0x1a3,0x6,0x1,0x0,0x0,0x0,0x1,0x0, + 0x40020,0x1a4,0x0,0x1a3,0x4003b,0x1a4,0x1a5,0x0,0x4003b,0x1a4,0x1ac,0x0, + 0x90019,0x1b3,0x1b,0x1,0x0,0x0,0x0,0x2,0x1a,0x40020,0x1b4,0x0, + 0x1b3,0x4003b,0x1b4,0x1b5,0x0,0x40017,0x1b8,0x1b,0x4,0x90019,0x1c3,0x6, + 0x1,0x0,0x0,0x0,0x2,0x21,0x40020,0x1c4,0x0,0x1c3,0x4003b,0x1c4, + 0x1c5,0x0,0x4002b,0x6,0x1ce,0x5,0x30029,0xd,0x1d2,0x4002b,0x6,0x1d7, + 0xf,0x5002c,0x3e,0x1fe,0xd6,0xd6,0x5002c,0x3e,0x204,0x11d,0xd6,0x5002c, + 0x3e,0x20a,0x112,0xd6,0x5002c,0x3e,0x210,0x107,0xd6,0x4002b,0x6,0x271, + 0x20,0x4001c,0x27b,0x6,0x17b,0x40020,0x27c,0x4,0x27b,0x4003b,0x27c,0x27d, + 0x4,0x40020,0x280,0x4,0x6,0x4002b,0x6,0x282,0xd48,0x4002b,0x6,0x283, + 0x108,0x4001c,0x28e,0x6,0x1ce,0x4002b,0x6,0x28f,0x10,0x4001c,0x290,0x28e, + 0x28f,0x4002b,0x6,0x291,0x4,0x4001c,0x292,0x290,0x291,0x40020,0x293,0x4, + 0x292,0x4003b,0x293,0x294,0x4,0x4003b,0x27c,0x2c7,0x4,0x4002b,0x1b,0x2e6, + 0x90,0x4002b,0x1b,0x2ea,0x6,0x4002b,0x6,0x2f8,0x90,0x4001c,0x2f9,0x6, + 0x2f8,0x4001c,0x2fa,0x2f9,0x16c,0x40020,0x2fb,0x4,0x2fa,0x4003b,0x2fb,0x2fc, + 0x4,0x4002b,0x1b,0x304,0x40,0x4002b,0x6,0x32f,0x8,0x4001c,0x330,0x27b, + 0x32f,0x40020,0x331,0x4,0x330,0x4003b,0x331,0x332,0x4,0x4002b,0x1b,0x352, + 0x1f,0x4002b,0x1b,0x368,0xc,0x5002c,0x3e,0x3fe,0xfc,0x11d,0x4002b,0x1b, + 0x418,0x7,0x40017,0x4bd,0x6,0x3,0x40020,0x4be,0x1,0x4bd,0x4003b,0x4be, + 0x4c7,0x1,0x4003b,0xb1,0x4cb,0x1,0x4002b,0x6,0x4d6,0x40,0x6002c,0x4bd, + 0x4d7,0x4d6,0x16c,0x16c,0x5002c,0x7a,0xdfe,0x291,0x291,0x5002c,0x7a,0xdff, + 0xa5,0xa5,0x7002c,0x1b8,0xe00,0xd6,0xd6,0xd6,0xd6,0x5002c,0x7a,0xe01, + 0x16c,0x16c,0x5002c,0x3e,0xe02,0xca,0xca,0x7002c,0x8,0xe03,0x15d,0x15d, + 0x15d,0x15d,0x5002c,0x3e,0xe04,0x352,0x352,0x40017,0xe05,0xd,0x2,0x30001, + 0x3e,0xe6f,0x50036,0x2,0x4,0x0,0x3,0x200f8,0x5,0x4003d,0x4bd,0x4c8, + 0x4c7,0x7004f,0x7a,0x4c9,0x4c8,0x4c8,0x0,0x1,0x4007c,0x3e,0x4ca,0x4c9, + 0x4003d,0x6,0x4cc,0x4cb,0x4007c,0x1b,0x4cd,0x4cc,0x300f7,0x59d,0x0,0x300fb, + 0x15d,0x50e,0x200f8,0x50e,0x500c7,0x6,0x5cd,0x4cc,0xa5,0x4007c,0x1b,0x5ae, + 0x5cd,0x500c2,0x6,0x5d6,0x4cc,0x17b,0x500c7,0x6,0x5d8,0x5d6,0x1d7,0x4007c, + 0x1b,0x5b2,0x5d8,0x50050,0x3e,0x5b3,0x5ae,0x5b2,0x500c2,0x6,0x5e1,0x4cc, + 0x16c,0x500c7,0x6,0x5e3,0x5e1,0x16c,0x500c2,0x6,0x5ec,0x4cc,0x1ce,0x500c7, + 0x6,0x5ee,0x5ec,0x16c,0x500c4,0x6,0x5ba,0x5ee,0x16c,0x500c5,0x6,0x5bb, + 0x5e3,0x5ba,0x4007c,0x1b,0x5bc,0x5bb,0x500c4,0x3e,0x5bf,0x4ca,0xdfe,0x50084, + 0x3e,0x5c1,0x5b3,0x3fe,0x50080,0x3e,0x5c2,0x5bf,0x5c1,0x500c3,0x3e,0x517, + 0x5c2,0xdff,0x300f7,0x5fd,0x0,0x300fb,0x15d,0x5f4,0x200f8,0x5f4,0x50041,0x196, + 0x601,0x190,0x107,0x4003d,0x6,0x602,0x601,0x500b2,0xd,0x5f6,0x602,0x1ce, + 0x300f7,0x5fc,0x0,0x400fa,0x5f6,0x5f7,0x5f8,0x200f8,0x5f8,0x4003d,0x1c3,0x605, + 0x1c5,0x60062,0x8,0x608,0x605,0x204,0x2000,0x50051,0x6,0x609,0x608,0x0, + 0x500c7,0x6,0x5fa,0x609,0x1d7,0x500ab,0xd,0x5fb,0x5fa,0x15d,0x200f9,0x5fd, + 0x200f8,0x5f7,0x200f9,0x5fd,0x200f8,0x5fc,0x100ff,0x200f8,0x5fd,0x700f5,0xd,0xca0, + 0x1d2,0x5f7,0x5fb,0x5f8,0x300f7,0x529,0x0,0x400fa,0xca0,0x519,0x529,0x200f8, + 0x519,0x500c7,0x1b,0x51c,0x5b2,0x418,0x500aa,0xd,0x51d,0x51c,0xd6,0x300f7, + 0x523,0x0,0x400fa,0x51d,0x51e,0x523,0x200f8,0x51e,0x500c7,0x1b,0x521,0x5ae, + 0x11d,0x500aa,0xd,0x522,0x521,0xd6,0x200f9,0x523,0x200f8,0x523,0x700f5,0xd, + 0x524,0x51d,0x519,0x522,0x51e,0x300f7,0x528,0x0,0x400fa,0x524,0x525,0x528, + 0x200f8,0x525,0x4003d,0x1b3,0x60b,0x1b5,0x50063,0x60b,0x517,0xe00,0x1000,0x200f9, + 0x528,0x200f8,0x528,0x200f9,0x59d,0x200f8,0x529,0x50041,0x196,0x613,0x190,0x11d, + 0x4003d,0x6,0x614,0x613,0x50041,0x196,0x617,0x190,0x112,0x4003d,0x6,0x618, + 0x617,0x50082,0x6,0x52c,0x618,0x16c,0x50041,0x191,0x65f,0x190,0xd6,0x4003d, + 0x3e,0x660,0x65f,0x50051,0x1b,0x635,0x660,0x0,0x500c3,0x1b,0x637,0x635, + 0x614,0x50051,0x1b,0x639,0x660,0x1,0x500c3,0x1b,0x63b,0x639,0x614,0x50082, + 0x1b,0x63d,0x637,0xfc,0x50051,0x1b,0x63f,0x5c2,0x0,0x7000c,0x1b,0x671, + 0x1,0x27,0x63d,0x63f,0x7000c,0x1b,0x676,0x1,0x2a,0xd6,0x671,0x50082, + 0x1b,0x643,0x63b,0x11d,0x50051,0x1b,0x645,0x5c2,0x1,0x7000c,0x1b,0x67b, + 0x1,0x27,0x643,0x645,0x7000c,0x1b,0x680,0x1,0x2a,0xd6,0x67b,0x50050, + 0x3e,0x648,0x676,0x680,0x4003d,0x1a3,0x683,0x1a5,0x7005f,0x8,0x685,0x683, + 0x648,0x2002,0xd6,0x50051,0x6,0x686,0x685,0x0,0x50080,0x3e,0x64d,0x648, + 0x204,0x4003d,0x1a3,0x689,0x1a5,0x7005f,0x8,0x68b,0x689,0x64d,0x2002,0xd6, + 0x50051,0x6,0x68c,0x68b,0x0,0x50080,0x3e,0x650,0x648,0x20a,0x4003d,0x1a3, + 0x68f,0x1a5,0x7005f,0x8,0x691,0x68f,0x650,0x2002,0xd6,0x50051,0x6,0x692, + 0x691,0x0,0x50080,0x3e,0x653,0x648,0x210,0x4003d,0x1a3,0x695,0x1a5,0x7005f, + 0x8,0x697,0x695,0x653,0x2002,0xd6,0x50051,0x6,0x698,0x697,0x0,0x500c4, + 0x6,0x6a0,0x68c,0xca,0x500c5,0x6,0x6a1,0x686,0x6a0,0x500c4,0x6,0x6a3, + 0x692,0xce,0x500c5,0x6,0x6a4,0x6a1,0x6a3,0x500c4,0x6,0x6a6,0x698,0xd2, + 0x500c5,0x6,0x6a7,0x6a4,0x6a6,0x500b1,0xd,0x6a9,0x63f,0xd6,0x300f7,0x6ec, + 0x0,0x400fa,0x6a9,0x6aa,0x6c5,0x200f8,0x6c5,0x500ad,0xd,0x6c9,0x63f,0x63d, + 0x300f7,0x6eb,0x0,0x400fa,0x6c9,0x6ca,0x6eb,0x200f8,0x6ca,0x500c7,0x6,0x6cc, + 0x6a7,0x103,0x50082,0x1b,0x6cf,0x637,0x107,0x500af,0xd,0x6d0,0x63f,0x6cf, + 0x300f7,0x6d6,0x0,0x400fa,0x6d0,0x6d1,0x6d6,0x200f8,0x6d1,0x500c2,0x6,0x6d3, + 0x6a7,0xca,0x500c5,0x6,0x6d5,0x6d3,0x6cc,0x200f9,0x6d6,0x200f8,0x6d6,0x700f5, + 0x6,0xca4,0x6a7,0x6ca,0x6d5,0x6d1,0x50082,0x1b,0x6d9,0x637,0x112,0x500af, + 0xd,0x6da,0x63f,0x6d9,0x300f7,0x6e0,0x0,0x400fa,0x6da,0x6db,0x6e0,0x200f8, + 0x6db,0x500c2,0x6,0x6dd,0xca4,0xca,0x500c5,0x6,0x6df,0x6dd,0x6cc,0x200f9, + 0x6e0,0x200f8,0x6e0,0x700f5,0x6,0xca8,0xca4,0x6d6,0x6df,0x6db,0x50082,0x1b, + 0x6e3,0x637,0x11d,0x500af,0xd,0x6e4,0x63f,0x6e3,0x300f7,0x6ea,0x0,0x400fa, + 0x6e4,0x6e5,0x6ea,0x200f8,0x6e5,0x500c2,0x6,0x6e7,0xca8,0xca,0x500c5,0x6, + 0x6e9,0x6e7,0x6cc,0x200f9,0x6ea,0x200f8,0x6ea,0x700f5,0x6,0xcb3,0xca8,0x6e0, + 0x6e9,0x6e5,0x200f9,0x6eb,0x200f8,0x6eb,0x700f5,0x6,0xcb2,0x6a7,0x6c5,0xcb3, + 0x6ea,0x200f9,0x6ec,0x200f8,0x6aa,0x500c7,0x6,0x6ac,0x6a7,0xdc,0x500b3,0xd, + 0x6ae,0x63f,0xdf,0x300f7,0x6b4,0x0,0x400fa,0x6ae,0x6af,0x6b4,0x200f8,0x6af, + 0x500c4,0x6,0x6b1,0x6a7,0xca,0x500c5,0x6,0x6b3,0x6b1,0x6ac,0x200f9,0x6b4, + 0x200f8,0x6b4,0x700f5,0x6,0xcab,0x6a7,0x6aa,0x6b3,0x6af,0x500b3,0xd,0x6b6, + 0x63f,0xe8,0x300f7,0x6bc,0x0,0x400fa,0x6b6,0x6b7,0x6bc,0x200f8,0x6b7,0x500c4, + 0x6,0x6b9,0xcab,0xca,0x500c5,0x6,0x6bb,0x6b9,0x6ac,0x200f9,0x6bc,0x200f8, + 0x6bc,0x700f5,0x6,0xcae,0xcab,0x6b4,0x6bb,0x6b7,0x500b3,0xd,0x6be,0x63f, + 0xf1,0x300f7,0x6c4,0x0,0x400fa,0x6be,0x6bf,0x6c4,0x200f8,0x6bf,0x500c4,0x6, + 0x6c1,0xcae,0xca,0x500c5,0x6,0x6c3,0x6c1,0x6ac,0x200f9,0x6c4,0x200f8,0x6c4, + 0x700f5,0x6,0xcb1,0xcae,0x6bc,0x6c3,0x6bf,0x200f9,0x6ec,0x200f8,0x6ec,0x700f5, + 0x6,0xcb0,0xcb1,0x6c4,0xcb2,0x6eb,0x4003d,0x1a3,0x758,0x1ac,0x7005f,0x8, + 0x75a,0x758,0x648,0x2002,0xd6,0x50051,0x6,0x75b,0x75a,0x0,0x4003d,0x1a3, + 0x75e,0x1ac,0x7005f,0x8,0x760,0x75e,0x64d,0x2002,0xd6,0x50051,0x6,0x761, + 0x760,0x0,0x4003d,0x1a3,0x764,0x1ac,0x7005f,0x8,0x766,0x764,0x650,0x2002, + 0xd6,0x50051,0x6,0x767,0x766,0x0,0x4003d,0x1a3,0x76a,0x1ac,0x7005f,0x8, + 0x76c,0x76a,0x653,0x2002,0xd6,0x50051,0x6,0x76d,0x76c,0x0,0x500c4,0x6, + 0x775,0x761,0xca,0x500c5,0x6,0x776,0x75b,0x775,0x500c4,0x6,0x778,0x767, + 0xce,0x500c5,0x6,0x779,0x776,0x778,0x500c4,0x6,0x77b,0x76d,0xd2,0x500c5, + 0x6,0x77c,0x779,0x77b,0x300f7,0x7c1,0x0,0x400fa,0x6a9,0x77f,0x79a,0x200f8, + 0x79a,0x500ad,0xd,0x79e,0x63f,0x63d,0x300f7,0x7c0,0x0,0x400fa,0x79e,0x79f, + 0x7c0,0x200f8,0x79f,0x500c7,0x6,0x7a1,0x77c,0x103,0x50082,0x1b,0x7a4,0x637, + 0x107,0x500af,0xd,0x7a5,0x63f,0x7a4,0x300f7,0x7ab,0x0,0x400fa,0x7a5,0x7a6, + 0x7ab,0x200f8,0x7a6,0x500c2,0x6,0x7a8,0x77c,0xca,0x500c5,0x6,0x7aa,0x7a8, + 0x7a1,0x200f9,0x7ab,0x200f8,0x7ab,0x700f5,0x6,0xcbe,0x77c,0x79f,0x7aa,0x7a6, + 0x50082,0x1b,0x7ae,0x637,0x112,0x500af,0xd,0x7af,0x63f,0x7ae,0x300f7,0x7b5, + 0x0,0x400fa,0x7af,0x7b0,0x7b5,0x200f8,0x7b0,0x500c2,0x6,0x7b2,0xcbe,0xca, + 0x500c5,0x6,0x7b4,0x7b2,0x7a1,0x200f9,0x7b5,0x200f8,0x7b5,0x700f5,0x6,0xcc2, + 0xcbe,0x7ab,0x7b4,0x7b0,0x50082,0x1b,0x7b8,0x637,0x11d,0x500af,0xd,0x7b9, + 0x63f,0x7b8,0x300f7,0x7bf,0x0,0x400fa,0x7b9,0x7ba,0x7bf,0x200f8,0x7ba,0x500c2, + 0x6,0x7bc,0xcc2,0xca,0x500c5,0x6,0x7be,0x7bc,0x7a1,0x200f9,0x7bf,0x200f8, + 0x7bf,0x700f5,0x6,0xccd,0xcc2,0x7b5,0x7be,0x7ba,0x200f9,0x7c0,0x200f8,0x7c0, + 0x700f5,0x6,0xccc,0x77c,0x79a,0xccd,0x7bf,0x200f9,0x7c1,0x200f8,0x77f,0x500c7, + 0x6,0x781,0x77c,0xdc,0x500b3,0xd,0x783,0x63f,0xdf,0x300f7,0x789,0x0, + 0x400fa,0x783,0x784,0x789,0x200f8,0x784,0x500c4,0x6,0x786,0x77c,0xca,0x500c5, + 0x6,0x788,0x786,0x781,0x200f9,0x789,0x200f8,0x789,0x700f5,0x6,0xcc5,0x77c, + 0x77f,0x788,0x784,0x500b3,0xd,0x78b,0x63f,0xe8,0x300f7,0x791,0x0,0x400fa, + 0x78b,0x78c,0x791,0x200f8,0x78c,0x500c4,0x6,0x78e,0xcc5,0xca,0x500c5,0x6, + 0x790,0x78e,0x781,0x200f9,0x791,0x200f8,0x791,0x700f5,0x6,0xcc8,0xcc5,0x789, + 0x790,0x78c,0x500b3,0xd,0x793,0x63f,0xf1,0x300f7,0x799,0x0,0x400fa,0x793, + 0x794,0x799,0x200f8,0x794,0x500c4,0x6,0x796,0xcc8,0xca,0x500c5,0x6,0x798, + 0x796,0x781,0x200f9,0x799,0x200f8,0x799,0x700f5,0x6,0xccb,0xcc8,0x791,0x798, + 0x794,0x200f9,0x7c1,0x200f8,0x7c1,0x700f5,0x6,0xcca,0xccb,0x799,0xccc,0x7c0, + 0x500c7,0x6,0x7c7,0xcb0,0xdc,0x4007c,0x1b,0x7c8,0x7c7,0x500c7,0x6,0x7cb, + 0xcca,0xdc,0x4007c,0x1b,0x7cc,0x7cb,0x50082,0x1b,0x7cd,0x7c8,0x7cc,0x6000c, + 0x1b,0x7ce,0x1,0x5,0x7cd,0x500c2,0x6,0x7d0,0xcb0,0xca,0x500c7,0x6, + 0x7d1,0x7d0,0xdc,0x4007c,0x1b,0x7d2,0x7d1,0x500c2,0x6,0x7d4,0xcca,0xca, + 0x500c7,0x6,0x7d5,0x7d4,0xdc,0x4007c,0x1b,0x7d6,0x7d5,0x50082,0x1b,0x7d7, + 0x7d2,0x7d6,0x6000c,0x1b,0x7d8,0x1,0x5,0x7d7,0x50080,0x1b,0x7d9,0x7ce, + 0x7d8,0x500c2,0x6,0x7db,0xcb0,0xce,0x500c7,0x6,0x7dc,0x7db,0xdc,0x4007c, + 0x1b,0x7dd,0x7dc,0x500c2,0x6,0x7df,0xcca,0xce,0x500c7,0x6,0x7e0,0x7df, + 0xdc,0x4007c,0x1b,0x7e1,0x7e0,0x50082,0x1b,0x7e2,0x7dd,0x7e1,0x6000c,0x1b, + 0x7e3,0x1,0x5,0x7e2,0x50080,0x1b,0x7e4,0x7d9,0x7e3,0x500c2,0x6,0x7e6, + 0xcb0,0xd2,0x500c7,0x6,0x7e7,0x7e6,0xdc,0x4007c,0x1b,0x7e8,0x7e7,0x500c2, + 0x6,0x7ea,0xcca,0xd2,0x500c7,0x6,0x7eb,0x7ea,0xdc,0x4007c,0x1b,0x7ec, + 0x7eb,0x50082,0x1b,0x7ed,0x7e8,0x7ec,0x6000c,0x1b,0x7ee,0x1,0x5,0x7ed, + 0x50080,0x1b,0x7ef,0x7e4,0x7ee,0x4007c,0x6,0x7f0,0x7ef,0x500c4,0x3e,0x537, + 0x4ca,0xe01,0x60052,0x3e,0xe14,0xd6,0xe6f,0x1,0x200f9,0x53c,0x200f8,0x53c, + 0x700f5,0x3e,0xe7c,0xe14,0x7c1,0xe69,0x598,0x50051,0x1b,0x53f,0xe7c,0x1, + 0x500b1,0xd,0x540,0x53f,0x112,0x400f6,0x59c,0x598,0x0,0x400fa,0x540,0x541, + 0x59c,0x200f8,0x541,0x60052,0x3e,0xe17,0xd6,0xe7c,0x0,0x200f9,0x543,0x200f8, + 0x543,0x700f5,0x3e,0xe7d,0xe17,0x541,0xe66,0x593,0x50051,0x1b,0x546,0xe7d, + 0x0,0x500b1,0xd,0x547,0x546,0x112,0x400f6,0x597,0x593,0x0,0x400fa,0x547, + 0x548,0x597,0x200f8,0x548,0x50080,0x3e,0x54b,0x537,0xe7d,0x4003d,0x1b3,0x7f3, + 0x1b5,0x60062,0x1b8,0x7f5,0x7f3,0x54b,0x1000,0x7004f,0x3e,0x7f6,0x7f5,0x7f5, + 0x0,0x1,0x500aa,0xd,0x54e,0x614,0x52c,0x50050,0xe05,0xe06,0x54e,0x54e, + 0x600a9,0x3e,0xe07,0xe06,0x1fe,0x7f6,0x50051,0x1b,0x553,0xe7d,0x1,0x50084, + 0x1b,0x554,0x553,0x112,0x50080,0x1b,0x557,0x554,0x546,0x500aa,0xd,0x558, + 0x5bc,0x557,0x300f7,0x562,0x0,0x400fa,0x558,0x559,0x562,0x200f8,0x559,0x500c7, + 0x1b,0x55c,0x5b2,0x418,0x500c7,0x1b,0x55f,0x5ae,0x11d,0x60041,0x280,0x561, + 0x332,0x55c,0x55f,0x3003e,0x561,0xcb0,0x200f9,0x562,0x200f8,0x562,0x50084,0x3e, + 0x566,0xe7d,0xe02,0x50080,0x3e,0x567,0x5bf,0x566,0x50080,0x3e,0x569,0x567, + 0xe07,0x50051,0x1b,0x801,0x569,0x0,0x50082,0x1b,0x802,0x801,0xca,0x50051, + 0x1b,0x804,0x569,0x1,0x50082,0x1b,0x805,0x804,0xca,0x200f9,0x807,0x200f8, + 0x807,0x700f5,0x1b,0xd2d,0x4cd,0x562,0x81f,0x81d,0x500b1,0xd,0x80a,0xd2d, + 0x2e6,0x400f6,0x820,0x81d,0x0,0x400fa,0x80a,0x80b,0x820,0x200f8,0x80b,0x5008b, + 0x1b,0x80d,0xd2d,0x2ea,0x50087,0x1b,0x80f,0xd2d,0x2ea,0x50084,0x1b,0x812, + 0x80d,0xfc,0x50080,0x1b,0x813,0x802,0x812,0x50080,0x1b,0x816,0x805,0x80f, + 0x7000c,0x1b,0x879,0x1,0x27,0x63d,0x813,0x7000c,0x1b,0x87e,0x1,0x2a, + 0xd6,0x879,0x7000c,0x1b,0x883,0x1,0x27,0x643,0x816,0x7000c,0x1b,0x888, + 0x1,0x2a,0xd6,0x883,0x50050,0x3e,0x850,0x87e,0x888,0x4003d,0x1a3,0x88b, + 0x1ac,0x7005f,0x8,0x88d,0x88b,0x850,0x2002,0xd6,0x50051,0x6,0x88e,0x88d, + 0x0,0x50080,0x3e,0x855,0x850,0x204,0x4003d,0x1a3,0x891,0x1ac,0x7005f,0x8, + 0x893,0x891,0x855,0x2002,0xd6,0x50051,0x6,0x894,0x893,0x0,0x50080,0x3e, + 0x858,0x850,0x20a,0x4003d,0x1a3,0x897,0x1ac,0x7005f,0x8,0x899,0x897,0x858, + 0x2002,0xd6,0x50051,0x6,0x89a,0x899,0x0,0x50080,0x3e,0x85b,0x850,0x210, + 0x4003d,0x1a3,0x89d,0x1ac,0x7005f,0x8,0x89f,0x89d,0x85b,0x2002,0xd6,0x50051, + 0x6,0x8a0,0x89f,0x0,0x500c4,0x6,0x8a8,0x894,0xca,0x500c5,0x6,0x8a9, + 0x88e,0x8a8,0x500c4,0x6,0x8ab,0x89a,0xce,0x500c5,0x6,0x8ac,0x8a9,0x8ab, + 0x500c4,0x6,0x8ae,0x8a0,0xd2,0x500c5,0x6,0x8af,0x8ac,0x8ae,0x500b1,0xd, + 0x8b1,0x813,0xd6,0x300f7,0x8f4,0x0,0x400fa,0x8b1,0x8b2,0x8cd,0x200f8,0x8cd, + 0x500ad,0xd,0x8d1,0x813,0x63d,0x300f7,0x8f3,0x0,0x400fa,0x8d1,0x8d2,0x8f3, + 0x200f8,0x8d2,0x500c7,0x6,0x8d4,0x8af,0x103,0x50082,0x1b,0x8d7,0x637,0x107, + 0x500af,0xd,0x8d8,0x813,0x8d7,0x300f7,0x8de,0x0,0x400fa,0x8d8,0x8d9,0x8de, + 0x200f8,0x8d9,0x500c2,0x6,0x8db,0x8af,0xca,0x500c5,0x6,0x8dd,0x8db,0x8d4, + 0x200f9,0x8de,0x200f8,0x8de,0x700f5,0x6,0xd64,0x8af,0x8d2,0x8dd,0x8d9,0x50082, + 0x1b,0x8e1,0x637,0x112,0x500af,0xd,0x8e2,0x813,0x8e1,0x300f7,0x8e8,0x0, + 0x400fa,0x8e2,0x8e3,0x8e8,0x200f8,0x8e3,0x500c2,0x6,0x8e5,0xd64,0xca,0x500c5, + 0x6,0x8e7,0x8e5,0x8d4,0x200f9,0x8e8,0x200f8,0x8e8,0x700f5,0x6,0xd68,0xd64, + 0x8de,0x8e7,0x8e3,0x50082,0x1b,0x8eb,0x637,0x11d,0x500af,0xd,0x8ec,0x813, + 0x8eb,0x300f7,0x8f2,0x0,0x400fa,0x8ec,0x8ed,0x8f2,0x200f8,0x8ed,0x500c2,0x6, + 0x8ef,0xd68,0xca,0x500c5,0x6,0x8f1,0x8ef,0x8d4,0x200f9,0x8f2,0x200f8,0x8f2, + 0x700f5,0x6,0xd73,0xd68,0x8e8,0x8f1,0x8ed,0x200f9,0x8f3,0x200f8,0x8f3,0x700f5, + 0x6,0xd72,0x8af,0x8cd,0xd73,0x8f2,0x200f9,0x8f4,0x200f8,0x8b2,0x500c7,0x6, + 0x8b4,0x8af,0xdc,0x500b3,0xd,0x8b6,0x813,0xdf,0x300f7,0x8bc,0x0,0x400fa, + 0x8b6,0x8b7,0x8bc,0x200f8,0x8b7,0x500c4,0x6,0x8b9,0x8af,0xca,0x500c5,0x6, + 0x8bb,0x8b9,0x8b4,0x200f9,0x8bc,0x200f8,0x8bc,0x700f5,0x6,0xd6b,0x8af,0x8b2, + 0x8bb,0x8b7,0x500b3,0xd,0x8be,0x813,0xe8,0x300f7,0x8c4,0x0,0x400fa,0x8be, + 0x8bf,0x8c4,0x200f8,0x8bf,0x500c4,0x6,0x8c1,0xd6b,0xca,0x500c5,0x6,0x8c3, + 0x8c1,0x8b4,0x200f9,0x8c4,0x200f8,0x8c4,0x700f5,0x6,0xd6e,0xd6b,0x8bc,0x8c3, + 0x8bf,0x500b3,0xd,0x8c6,0x813,0xf1,0x300f7,0x8cc,0x0,0x400fa,0x8c6,0x8c7, + 0x8cc,0x200f8,0x8c7,0x500c4,0x6,0x8c9,0xd6e,0xca,0x500c5,0x6,0x8cb,0x8c9, + 0x8b4,0x200f9,0x8cc,0x200f8,0x8cc,0x700f5,0x6,0xd71,0xd6e,0x8c4,0x8cb,0x8c7, + 0x200f9,0x8f4,0x200f8,0x8f4,0x700f5,0x6,0xd70,0xd71,0x8cc,0xd72,0x8f3,0x60041, + 0x280,0x81c,0x2fc,0xd6,0xd2d,0x3003e,0x81c,0xd70,0x200f9,0x81d,0x200f8,0x81d, + 0x50080,0x1b,0x81f,0xd2d,0x304,0x200f9,0x807,0x200f8,0x820,0x300e1,0x17b,0x282, + 0x400e0,0x17b,0x17b,0x283,0x200f9,0x906,0x200f8,0x906,0x700f5,0x8,0xd2f,0xe03, + 0x820,0x933,0x90a,0x700f5,0x1b,0xd2e,0xd6,0x820,0x936,0x90a,0x500b1,0xd, + 0x909,0xd2e,0xca,0x400f6,0x937,0x90a,0x0,0x400fa,0x909,0x90a,0x937,0x200f8, + 0x90a,0x50080,0x1b,0x90e,0x5b2,0xd2e,0x50084,0x1b,0x90f,0x90e,0x2ea,0x50080, + 0x1b,0x913,0x90f,0x5ae,0x60041,0x280,0x914,0x2fc,0xd6,0x913,0x4003d,0x6, + 0x915,0x914,0x50080,0x1b,0x91a,0x913,0x11d,0x60041,0x280,0x91b,0x2fc,0xd6, + 0x91a,0x4003d,0x6,0x91c,0x91b,0x50080,0x1b,0x921,0x913,0x112,0x60041,0x280, + 0x922,0x2fc,0xd6,0x921,0x4003d,0x6,0x923,0x922,0x60041,0x280,0x927,0x332, + 0xd2e,0xd6,0x4003d,0x6,0x928,0x927,0x500c7,0x6,0x973,0x915,0xdc,0x4007c, + 0x1b,0x974,0x973,0x500c7,0x6,0x977,0x928,0xdc,0x4007c,0x1b,0x978,0x977, + 0x50082,0x1b,0x979,0x974,0x978,0x6000c,0x1b,0x97a,0x1,0x5,0x979,0x500c2, + 0x6,0x97c,0x915,0xca,0x500c7,0x6,0x97d,0x97c,0xdc,0x4007c,0x1b,0x97e, + 0x97d,0x500c2,0x6,0x980,0x928,0xca,0x500c7,0x6,0x981,0x980,0xdc,0x4007c, + 0x1b,0x982,0x981,0x50082,0x1b,0x983,0x97e,0x982,0x6000c,0x1b,0x984,0x1, + 0x5,0x983,0x50080,0x1b,0x985,0x97a,0x984,0x500c2,0x6,0x987,0x915,0xce, + 0x500c7,0x6,0x988,0x987,0xdc,0x4007c,0x1b,0x989,0x988,0x500c2,0x6,0x98b, + 0x928,0xce,0x500c7,0x6,0x98c,0x98b,0xdc,0x4007c,0x1b,0x98d,0x98c,0x50082, + 0x1b,0x98e,0x989,0x98d,0x6000c,0x1b,0x98f,0x1,0x5,0x98e,0x50080,0x1b, + 0x990,0x985,0x98f,0x500c2,0x6,0x992,0x915,0xd2,0x500c7,0x6,0x993,0x992, + 0xdc,0x4007c,0x1b,0x994,0x993,0x500c2,0x6,0x996,0x928,0xd2,0x500c7,0x6, + 0x997,0x996,0xdc,0x4007c,0x1b,0x998,0x997,0x50082,0x1b,0x999,0x994,0x998, + 0x6000c,0x1b,0x99a,0x1,0x5,0x999,0x50080,0x1b,0x99b,0x990,0x99a,0x4007c, + 0x6,0x99c,0x99b,0x500c7,0x6,0x94f,0x91c,0xdc,0x500c4,0x6,0x950,0x94f, + 0xd2,0x500c5,0x6,0x951,0x97c,0x950,0x500c2,0x6,0x953,0x91c,0xca,0x500c7, + 0x6,0x9a1,0x951,0xdc,0x4007c,0x1b,0x9a2,0x9a1,0x50082,0x1b,0x9a7,0x9a2, + 0x978,0x6000c,0x1b,0x9a8,0x1,0x5,0x9a7,0x500c2,0x6,0x9aa,0x951,0xca, + 0x500c7,0x6,0x9ab,0x9aa,0xdc,0x4007c,0x1b,0x9ac,0x9ab,0x50082,0x1b,0x9b1, + 0x9ac,0x982,0x6000c,0x1b,0x9b2,0x1,0x5,0x9b1,0x50080,0x1b,0x9b3,0x9a8, + 0x9b2,0x500c2,0x6,0x9b5,0x951,0xce,0x500c7,0x6,0x9b6,0x9b5,0xdc,0x4007c, + 0x1b,0x9b7,0x9b6,0x50082,0x1b,0x9bc,0x9b7,0x98d,0x6000c,0x1b,0x9bd,0x1, + 0x5,0x9bc,0x50080,0x1b,0x9be,0x9b3,0x9bd,0x500c2,0x6,0x9c0,0x951,0xd2, + 0x500c7,0x6,0x9c1,0x9c0,0xdc,0x4007c,0x1b,0x9c2,0x9c1,0x50082,0x1b,0x9c7, + 0x9c2,0x998,0x6000c,0x1b,0x9c8,0x1,0x5,0x9c7,0x50080,0x1b,0x9c9,0x9be, + 0x9c8,0x4007c,0x6,0x9ca,0x9c9,0x500c7,0x6,0x95b,0x953,0xdc,0x500c4,0x6, + 0x95c,0x95b,0xd2,0x500c5,0x6,0x95d,0x9aa,0x95c,0x500c2,0x6,0x95f,0x953, + 0xca,0x500c7,0x6,0x9cf,0x95d,0xdc,0x4007c,0x1b,0x9d0,0x9cf,0x50082,0x1b, + 0x9d5,0x9d0,0x978,0x6000c,0x1b,0x9d6,0x1,0x5,0x9d5,0x500c2,0x6,0x9d8, + 0x95d,0xca,0x500c7,0x6,0x9d9,0x9d8,0xdc,0x4007c,0x1b,0x9da,0x9d9,0x50082, + 0x1b,0x9df,0x9da,0x982,0x6000c,0x1b,0x9e0,0x1,0x5,0x9df,0x50080,0x1b, + 0x9e1,0x9d6,0x9e0,0x500c2,0x6,0x9e3,0x95d,0xce,0x500c7,0x6,0x9e4,0x9e3, + 0xdc,0x4007c,0x1b,0x9e5,0x9e4,0x50082,0x1b,0x9ea,0x9e5,0x98d,0x6000c,0x1b, + 0x9eb,0x1,0x5,0x9ea,0x50080,0x1b,0x9ec,0x9e1,0x9eb,0x500c2,0x6,0x9ee, + 0x95d,0xd2,0x500c7,0x6,0x9ef,0x9ee,0xdc,0x4007c,0x1b,0x9f0,0x9ef,0x50082, + 0x1b,0x9f5,0x9f0,0x998,0x6000c,0x1b,0x9f6,0x1,0x5,0x9f5,0x50080,0x1b, + 0x9f7,0x9ec,0x9f6,0x4007c,0x6,0x9f8,0x9f7,0x500c7,0x6,0x967,0x95f,0xdc, + 0x500c4,0x6,0x968,0x967,0xd2,0x500c5,0x6,0x969,0x9d8,0x968,0x500c7,0x6, + 0x9fd,0x969,0xdc,0x4007c,0x1b,0x9fe,0x9fd,0x50082,0x1b,0xa03,0x9fe,0x978, + 0x6000c,0x1b,0xa04,0x1,0x5,0xa03,0x500c2,0x6,0xa06,0x969,0xca,0x500c7, + 0x6,0xa07,0xa06,0xdc,0x4007c,0x1b,0xa08,0xa07,0x50082,0x1b,0xa0d,0xa08, + 0x982,0x6000c,0x1b,0xa0e,0x1,0x5,0xa0d,0x50080,0x1b,0xa0f,0xa04,0xa0e, + 0x500c2,0x6,0xa11,0x969,0xce,0x500c7,0x6,0xa12,0xa11,0xdc,0x4007c,0x1b, + 0xa13,0xa12,0x50082,0x1b,0xa18,0xa13,0x98d,0x6000c,0x1b,0xa19,0x1,0x5, + 0xa18,0x50080,0x1b,0xa1a,0xa0f,0xa19,0x500c2,0x6,0xa1c,0x969,0xd2,0x500c7, + 0x6,0xa1d,0xa1c,0xdc,0x4007c,0x1b,0xa1e,0xa1d,0x50082,0x1b,0xa23,0xa1e, + 0x998,0x6000c,0x1b,0xa24,0x1,0x5,0xa23,0x50080,0x1b,0xa25,0xa1a,0xa24, + 0x4007c,0x6,0xa26,0xa25,0x70050,0x8,0xed5,0x99c,0x9ca,0x9f8,0xa26,0x50080, + 0x8,0x92b,0xd2f,0xed5,0x60041,0x280,0x92f,0x332,0xd2e,0x11d,0x4003d,0x6, + 0x930,0x92f,0x4007c,0x1b,0xa5e,0x94f,0x500c7,0x6,0xa61,0x930,0xdc,0x4007c, + 0x1b,0xa62,0xa61,0x50082,0x1b,0xa63,0xa5e,0xa62,0x6000c,0x1b,0xa64,0x1, + 0x5,0xa63,0x4007c,0x1b,0xa68,0x95b,0x500c2,0x6,0xa6a,0x930,0xca,0x500c7, + 0x6,0xa6b,0xa6a,0xdc,0x4007c,0x1b,0xa6c,0xa6b,0x50082,0x1b,0xa6d,0xa68, + 0xa6c,0x6000c,0x1b,0xa6e,0x1,0x5,0xa6d,0x50080,0x1b,0xa6f,0xa64,0xa6e, + 0x500c2,0x6,0xa71,0x91c,0xce,0x500c7,0x6,0xa72,0xa71,0xdc,0x4007c,0x1b, + 0xa73,0xa72,0x500c2,0x6,0xa75,0x930,0xce,0x500c7,0x6,0xa76,0xa75,0xdc, + 0x4007c,0x1b,0xa77,0xa76,0x50082,0x1b,0xa78,0xa73,0xa77,0x6000c,0x1b,0xa79, + 0x1,0x5,0xa78,0x50080,0x1b,0xa7a,0xa6f,0xa79,0x500c2,0x6,0xa7c,0x91c, + 0xd2,0x500c7,0x6,0xa7d,0xa7c,0xdc,0x4007c,0x1b,0xa7e,0xa7d,0x500c2,0x6, + 0xa80,0x930,0xd2,0x500c7,0x6,0xa81,0xa80,0xdc,0x4007c,0x1b,0xa82,0xa81, + 0x50082,0x1b,0xa83,0xa7e,0xa82,0x6000c,0x1b,0xa84,0x1,0x5,0xa83,0x50080, + 0x1b,0xa85,0xa7a,0xa84,0x4007c,0x6,0xa86,0xa85,0x500c7,0x6,0xa39,0x923, + 0xdc,0x500c4,0x6,0xa3a,0xa39,0xd2,0x500c5,0x6,0xa3b,0x953,0xa3a,0x500c2, + 0x6,0xa3d,0x923,0xca,0x500c7,0x6,0xa8b,0xa3b,0xdc,0x4007c,0x1b,0xa8c, + 0xa8b,0x50082,0x1b,0xa91,0xa8c,0xa62,0x6000c,0x1b,0xa92,0x1,0x5,0xa91, + 0x500c2,0x6,0xa94,0xa3b,0xca,0x500c7,0x6,0xa95,0xa94,0xdc,0x4007c,0x1b, + 0xa96,0xa95,0x50082,0x1b,0xa9b,0xa96,0xa6c,0x6000c,0x1b,0xa9c,0x1,0x5, + 0xa9b,0x50080,0x1b,0xa9d,0xa92,0xa9c,0x500c2,0x6,0xa9f,0xa3b,0xce,0x500c7, + 0x6,0xaa0,0xa9f,0xdc,0x4007c,0x1b,0xaa1,0xaa0,0x50082,0x1b,0xaa6,0xaa1, + 0xa77,0x6000c,0x1b,0xaa7,0x1,0x5,0xaa6,0x50080,0x1b,0xaa8,0xa9d,0xaa7, + 0x500c2,0x6,0xaaa,0xa3b,0xd2,0x500c7,0x6,0xaab,0xaaa,0xdc,0x4007c,0x1b, + 0xaac,0xaab,0x50082,0x1b,0xab1,0xaac,0xa82,0x6000c,0x1b,0xab2,0x1,0x5, + 0xab1,0x50080,0x1b,0xab3,0xaa8,0xab2,0x4007c,0x6,0xab4,0xab3,0x500c7,0x6, + 0xa45,0xa3d,0xdc,0x500c4,0x6,0xa46,0xa45,0xd2,0x500c5,0x6,0xa47,0xa94, + 0xa46,0x500c2,0x6,0xa49,0xa3d,0xca,0x500c7,0x6,0xab9,0xa47,0xdc,0x4007c, + 0x1b,0xaba,0xab9,0x50082,0x1b,0xabf,0xaba,0xa62,0x6000c,0x1b,0xac0,0x1, + 0x5,0xabf,0x500c2,0x6,0xac2,0xa47,0xca,0x500c7,0x6,0xac3,0xac2,0xdc, + 0x4007c,0x1b,0xac4,0xac3,0x50082,0x1b,0xac9,0xac4,0xa6c,0x6000c,0x1b,0xaca, + 0x1,0x5,0xac9,0x50080,0x1b,0xacb,0xac0,0xaca,0x500c2,0x6,0xacd,0xa47, + 0xce,0x500c7,0x6,0xace,0xacd,0xdc,0x4007c,0x1b,0xacf,0xace,0x50082,0x1b, + 0xad4,0xacf,0xa77,0x6000c,0x1b,0xad5,0x1,0x5,0xad4,0x50080,0x1b,0xad6, + 0xacb,0xad5,0x500c2,0x6,0xad8,0xa47,0xd2,0x500c7,0x6,0xad9,0xad8,0xdc, + 0x4007c,0x1b,0xada,0xad9,0x50082,0x1b,0xadf,0xada,0xa82,0x6000c,0x1b,0xae0, + 0x1,0x5,0xadf,0x50080,0x1b,0xae1,0xad6,0xae0,0x4007c,0x6,0xae2,0xae1, + 0x500c7,0x6,0xa51,0xa49,0xdc,0x500c4,0x6,0xa52,0xa51,0xd2,0x500c5,0x6, + 0xa53,0xac2,0xa52,0x500c7,0x6,0xae7,0xa53,0xdc,0x4007c,0x1b,0xae8,0xae7, + 0x50082,0x1b,0xaed,0xae8,0xa62,0x6000c,0x1b,0xaee,0x1,0x5,0xaed,0x500c2, + 0x6,0xaf0,0xa53,0xca,0x500c7,0x6,0xaf1,0xaf0,0xdc,0x4007c,0x1b,0xaf2, + 0xaf1,0x50082,0x1b,0xaf7,0xaf2,0xa6c,0x6000c,0x1b,0xaf8,0x1,0x5,0xaf7, + 0x50080,0x1b,0xaf9,0xaee,0xaf8,0x500c2,0x6,0xafb,0xa53,0xce,0x500c7,0x6, + 0xafc,0xafb,0xdc,0x4007c,0x1b,0xafd,0xafc,0x50082,0x1b,0xb02,0xafd,0xa77, + 0x6000c,0x1b,0xb03,0x1,0x5,0xb02,0x50080,0x1b,0xb04,0xaf9,0xb03,0x500c2, + 0x6,0xb06,0xa53,0xd2,0x500c7,0x6,0xb07,0xb06,0xdc,0x4007c,0x1b,0xb08, + 0xb07,0x50082,0x1b,0xb0d,0xb08,0xa82,0x6000c,0x1b,0xb0e,0x1,0x5,0xb0d, + 0x50080,0x1b,0xb0f,0xb04,0xb0e,0x4007c,0x6,0xb10,0xb0f,0x70050,0x8,0xed6, + 0xa86,0xab4,0xae2,0xb10,0x50080,0x8,0x933,0x92b,0xed6,0x50080,0x1b,0x936, + 0xd2e,0x11d,0x200f9,0x906,0x200f8,0x937,0x50051,0x6,0xb1b,0xd2f,0x0,0x500c4, + 0x6,0xb1c,0xb1b,0xce,0x50084,0x1b,0xb1f,0x5ae,0xfc,0x50050,0x3e,0xb23, + 0xb1f,0x5b2,0x50082,0x3e,0xb60,0xb23,0xe02,0x500c3,0x3e,0xb7a,0xb60,0xe04, + 0x50080,0x3e,0xb7d,0xb60,0xb7a,0x500c6,0x3e,0xb7f,0xb7d,0xb7a,0x4007c,0x7a, + 0xb80,0xb7f,0x50051,0x6,0xb63,0xb80,0x1,0x500c4,0x6,0xb64,0xb63,0x368, + 0x50051,0x6,0xb66,0xb80,0x0,0x500c4,0x6,0xb67,0xb66,0xca,0x500c5,0x6, + 0xb68,0xb64,0xb67,0x500c4,0x1b,0xb6b,0x5b2,0xfc,0x4007c,0x6,0xb6c,0xb6b, + 0x500c5,0x6,0xb6d,0xb68,0xb6c,0x4007c,0x6,0xb70,0xb1f,0x500c5,0x6,0xb71, + 0xb6d,0xb70,0x500c5,0x6,0xb25,0xb1c,0xb71,0x70041,0x280,0xb26,0x294,0xd6, + 0x5b2,0x5ae,0x3003e,0xb26,0xb25,0x50051,0x6,0xb2c,0xd2f,0x1,0x500c4,0x6, + 0xb2d,0xb2c,0xce,0x50080,0x1b,0xb31,0xb1f,0x11d,0x50050,0x3e,0xb34,0xb31, + 0x5b2,0x50082,0x3e,0xb88,0xb34,0xe02,0x500c3,0x3e,0xba2,0xb88,0xe04,0x50080, + 0x3e,0xba5,0xb88,0xba2,0x500c6,0x3e,0xba7,0xba5,0xba2,0x4007c,0x7a,0xba8, + 0xba7,0x50051,0x6,0xb8b,0xba8,0x1,0x500c4,0x6,0xb8c,0xb8b,0x368,0x50051, + 0x6,0xb8e,0xba8,0x0,0x500c4,0x6,0xb8f,0xb8e,0xca,0x500c5,0x6,0xb90, + 0xb8c,0xb8f,0x500c4,0x1b,0xb93,0x5b2,0xfc,0x4007c,0x6,0xb94,0xb93,0x500c5, + 0x6,0xb95,0xb90,0xb94,0x4007c,0x6,0xb98,0xb31,0x500c5,0x6,0xb99,0xb95, + 0xb98,0x500c5,0x6,0xb36,0xb2d,0xb99,0x70041,0x280,0xb37,0x294,0x11d,0x5b2, + 0x5ae,0x3003e,0xb37,0xb36,0x50051,0x6,0xb3d,0xd2f,0x2,0x500c4,0x6,0xb3e, + 0xb3d,0xce,0x50080,0x1b,0xb42,0xb1f,0x112,0x50050,0x3e,0xb45,0xb42,0x5b2, + 0x50082,0x3e,0xbb0,0xb45,0xe02,0x500c3,0x3e,0xbca,0xbb0,0xe04,0x50080,0x3e, + 0xbcd,0xbb0,0xbca,0x500c6,0x3e,0xbcf,0xbcd,0xbca,0x4007c,0x7a,0xbd0,0xbcf, + 0x50051,0x6,0xbb3,0xbd0,0x1,0x500c4,0x6,0xbb4,0xbb3,0x368,0x50051,0x6, + 0xbb6,0xbd0,0x0,0x500c4,0x6,0xbb7,0xbb6,0xca,0x500c5,0x6,0xbb8,0xbb4, + 0xbb7,0x500c4,0x1b,0xbbb,0x5b2,0xfc,0x4007c,0x6,0xbbc,0xbbb,0x500c5,0x6, + 0xbbd,0xbb8,0xbbc,0x4007c,0x6,0xbc0,0xb42,0x500c5,0x6,0xbc1,0xbbd,0xbc0, + 0x500c5,0x6,0xb47,0xb3e,0xbc1,0x70041,0x280,0xb48,0x294,0x112,0x5b2,0x5ae, + 0x3003e,0xb48,0xb47,0x50051,0x6,0xb4e,0xd2f,0x3,0x500c4,0x6,0xb4f,0xb4e, + 0xce,0x50080,0x1b,0xb53,0xb1f,0x107,0x50050,0x3e,0xb56,0xb53,0x5b2,0x50082, + 0x3e,0xbd8,0xb56,0xe02,0x500c3,0x3e,0xbf2,0xbd8,0xe04,0x50080,0x3e,0xbf5, + 0xbd8,0xbf2,0x500c6,0x3e,0xbf7,0xbf5,0xbf2,0x4007c,0x7a,0xbf8,0xbf7,0x50051, + 0x6,0xbdb,0xbf8,0x1,0x500c4,0x6,0xbdc,0xbdb,0x368,0x50051,0x6,0xbde, + 0xbf8,0x0,0x500c4,0x6,0xbdf,0xbde,0xca,0x500c5,0x6,0xbe0,0xbdc,0xbdf, + 0x500c4,0x1b,0xbe3,0x5b2,0xfc,0x4007c,0x6,0xbe4,0xbe3,0x500c5,0x6,0xbe5, + 0xbe0,0xbe4,0x4007c,0x6,0xbe8,0xb53,0x500c5,0x6,0xbe9,0xbe5,0xbe8,0x500c5, + 0x6,0xb58,0xb4f,0xbe9,0x70041,0x280,0xb59,0x294,0x107,0x5b2,0x5ae,0x3003e, + 0xb59,0xb58,0x300e1,0x17b,0x282,0x400e0,0x17b,0x17b,0x283,0x4003d,0x6,0xc12, + 0xb26,0x4003d,0x6,0xc14,0xb37,0x7000c,0x6,0xc3f,0x1,0x26,0xc12,0xc14, + 0x4003d,0x6,0xc1f,0xb48,0x4003d,0x6,0xc21,0xb59,0x7000c,0x6,0xc44,0x1, + 0x26,0xc1f,0xc21,0x7000c,0x6,0xc49,0x1,0x26,0xc3f,0xc44,0x60162,0x6, + 0xc4d,0xa5,0x0,0xc49,0x4003d,0x6,0xc51,0xb2,0x500aa,0xd,0xc29,0xc51, + 0x271,0x300f7,0xc39,0x0,0x400fa,0xc29,0xc2a,0xc39,0x200f8,0xc2a,0x500c3,0x1b, + 0xc2c,0x4cd,0x1ce,0x4014d,0xd,0xc55,0xa5,0x300f7,0xc32,0x0,0x400fa,0xc55, + 0xc2e,0xc32,0x200f8,0xc2e,0x50041,0x280,0xc31,0x2c7,0xc2c,0x3003e,0xc31,0xc4d, + 0x200f9,0xc32,0x200f8,0xc32,0x300e1,0x17b,0x282,0x400e0,0x17b,0x17b,0x283,0x500c6, + 0x1b,0xc34,0xc2c,0x11d,0x50041,0x280,0xc36,0x2c7,0xc34,0x4003d,0x6,0xc37, + 0xc36,0x7000c,0x6,0xc5a,0x1,0x26,0xc4d,0xc37,0x200f9,0xc39,0x200f8,0xc39, + 0x700f5,0x6,0xd34,0xc4d,0x937,0xc5a,0xc32,0x500c7,0x6,0xc60,0xd34,0x1d7, + 0x4007c,0x1b,0xc61,0xc60,0x50082,0x1b,0xc62,0xc61,0xca,0x500c2,0x6,0xc64, + 0xd34,0xfc,0x500c7,0x6,0xc65,0xc64,0x1d7,0x4007c,0x1b,0xc66,0xc65,0x50082, + 0x1b,0xc67,0xc66,0xca,0x50050,0x3e,0xc6a,0xc62,0xc67,0x50080,0x3e,0x578, + 0xe07,0xc6a,0x500ab,0xd,0xc71,0x5bc,0x557,0x600a9,0x6,0xe08,0xc71,0x15d, + 0x7f0,0x6015d,0x6,0xc8c,0xa5,0x0,0xe08,0x300f7,0xc87,0x0,0x400fa,0xc29, + 0xc78,0xc87,0x200f8,0xc78,0x500c3,0x1b,0xc7a,0x4cd,0x1ce,0x4014d,0xd,0xc94, + 0xa5,0x300f7,0xc80,0x0,0x400fa,0xc94,0xc7c,0xc80,0x200f8,0xc7c,0x50041,0x280, + 0xc7f,0x27d,0xc7a,0x3003e,0xc7f,0xc8c,0x200f9,0xc80,0x200f8,0xc80,0x300e1,0x17b, + 0x282,0x400e0,0x17b,0x17b,0x283,0x500c6,0x1b,0xc82,0xc7a,0x11d,0x50041,0x280, + 0xc83,0x27d,0xc82,0x4003d,0x6,0xc84,0xc83,0x50080,0x6,0xc86,0xc8c,0xc84, + 0x200f9,0xc87,0x200f8,0xc87,0x700f5,0x6,0xd4c,0xc8c,0xc39,0xc86,0xc80,0x500aa, + 0xd,0x584,0x614,0x15d,0x300f7,0x58a,0x0,0x400fa,0x584,0x585,0x58a,0x200f8, + 0x585,0x500c2,0x6,0x588,0xd34,0x28f,0x500b2,0xd,0x589,0xd4c,0x588,0x200f9, + 0x58a,0x200f8,0x58a,0x700f5,0xd,0x58b,0x584,0xc87,0x589,0x585,0x50050,0xe05, + 0xe09,0x58b,0x58b,0x600a9,0x3e,0xe0a,0xe09,0x1fe,0x578,0x4003d,0x1b3,0xc9a, + 0x1b5,0x50051,0x1b,0xc9d,0xe0a,0x0,0x50051,0x1b,0xc9e,0xe0a,0x1,0x70050, + 0x1b8,0xc9f,0xc9d,0xc9e,0xd6,0xd6,0x50063,0xc9a,0x54b,0xc9f,0x1000,0x200f9, + 0x593,0x200f8,0x593,0x50080,0x1b,0x596,0x546,0x11d,0x60052,0x3e,0xe66,0x596, + 0xe7d,0x0,0x200f9,0x543,0x200f8,0x597,0x200f9,0x598,0x200f8,0x598,0x50051,0x1b, + 0x59a,0xe7d,0x1,0x50080,0x1b,0x59b,0x59a,0x11d,0x60052,0x3e,0xe69,0x59b, + 0xe7d,0x1,0x200f9,0x53c,0x200f8,0x59c,0x200f9,0x59d,0x200f8,0x59d,0x100fd,0x10038, +}; +static const char *of_compute_optical_flow_advanced_pass_v5_cb_names[] = {"cbOF"}; +static const uint32_t of_compute_optical_flow_advanced_pass_v5_cb_bind[] = {4}; +static const uint32_t of_compute_optical_flow_advanced_pass_v5_cb_count[] = {1}; +static const uint32_t of_compute_optical_flow_advanced_pass_v5_cb_space[] = {0}; +static const char *of_compute_optical_flow_advanced_pass_v5_srv_tex_names[] = {"r_optical_flow_input", "r_optical_flow_previous_input"}; +static const uint32_t of_compute_optical_flow_advanced_pass_v5_srv_tex_bind[] = {0, 1}; +static const uint32_t of_compute_optical_flow_advanced_pass_v5_srv_tex_count[] = {1, 1}; +static const uint32_t of_compute_optical_flow_advanced_pass_v5_srv_tex_space[] = {0, 0}; +static const char *of_compute_optical_flow_advanced_pass_v5_uav_tex_names[] = {"rw_optical_flow", "rw_optical_flow_scd_output"}; +static const uint32_t of_compute_optical_flow_advanced_pass_v5_uav_tex_bind[] = {2, 3}; +static const uint32_t of_compute_optical_flow_advanced_pass_v5_uav_tex_count[] = {1, 1}; +static const uint32_t of_compute_optical_flow_advanced_pass_v5_uav_tex_space[] = {0, 0}; + +static const uint32_t of_filter_optical_flow_pass_v5_spv[635] = { + 0x7230203,0x10500,0x8000b,0x139,0x0,0x20011,0x1,0x20011,0x31,0x6000b,0x1,0x4c534c47, + 0x6474732e,0x3035342e,0x0,0x3000e,0x0,0x1,0x8000f,0x5,0x4,0x6e69616d,0x0,0x1c, + 0x27,0x9e,0x60010,0x4,0x11,0x10,0x4,0x1,0x30003,0x2,0x1c2,0xb0004, + 0x455f4c47,0x735f5458,0x6c706d61,0x656c7265,0x745f7373,0x75747865,0x665f6572,0x74636e75,0x736e6f69,0x0,0xb0004,0x455f4c47, + 0x735f5458,0x65646168,0x78655f72,0x63696c70,0x615f7469,0x68746972,0x6974656d,0x79745f63,0x736570,0xa0004,0x475f4c47,0x4c474f4f, + 0x70635f45,0x74735f70,0x5f656c79,0x656e696c,0x7269645f,0x69746365,0x6576,0x80004,0x475f4c47,0x4c474f4f,0x6e695f45,0x64756c63, + 0x69645f65,0x74636572,0x657669,0x40005,0x4,0x6e69616d,0x0,0x80005,0x1c,0x706f5f72,0x61636974,0x6c665f6c, + 0x705f776f,0x69766572,0x73756f,0x60005,0x27,0x6f5f7772,0x63697470,0x665f6c61,0x776f6c,0x80005,0x9e,0x475f6c67, + 0x61626f6c,0x766e496c,0x7461636f,0x496e6f69,0x44,0x40047,0x1c,0x21,0x0,0x40047,0x1c,0x22, + 0x0,0x40047,0x27,0x21,0x1,0x40047,0x27,0x22,0x0,0x40047,0x9e,0xb, + 0x1c,0x40047,0xbe,0xb,0x19,0x20013,0x2,0x30021,0x3,0x2,0x40015,0x6, + 0x20,0x1,0x40017,0x7,0x6,0x2,0x40020,0x8,0x7,0x7,0x90019,0x1a, + 0x6,0x1,0x0,0x0,0x0,0x1,0x0,0x40020,0x1b,0x0,0x1a,0x4003b, + 0x1b,0x1c,0x0,0x4002b,0x6,0x1f,0x0,0x40017,0x20,0x6,0x4,0x90019, + 0x25,0x6,0x1,0x0,0x0,0x0,0x2,0x1a,0x40020,0x26,0x0,0x25, + 0x4003b,0x26,0x27,0x0,0x4002b,0x6,0x30,0xffffffff,0x4002b,0x6,0x37,0x2, + 0x20014,0x38,0x40015,0x42,0x20,0x0,0x4002b,0x42,0x43,0x9,0x4001c,0x44, + 0x7,0x43,0x40020,0x45,0x7,0x44,0x4002b,0x6,0x51,0x1,0x4002b,0x42, + 0x59,0xffffffff,0x4002b,0x6,0x61,0x9,0x4002b,0x42,0x64,0x0,0x4002b,0x42, + 0x7b,0x1,0x4002b,0x6,0x88,0x4,0x4002b,0x42,0x93,0xf,0x40017,0x9c, + 0x42,0x3,0x40020,0x9d,0x1,0x9c,0x4003b,0x9d,0x9e,0x1,0x40017,0x9f, + 0x42,0x2,0x4002b,0x42,0xbc,0x10,0x4002b,0x42,0xbd,0x4,0x6002c,0x9c, + 0xbe,0xbc,0xbd,0x7b,0x50036,0x2,0x4,0x0,0x3,0x200f8,0x5,0x4003b, + 0x45,0xc2,0x7,0x4003d,0x9c,0xa0,0x9e,0x7004f,0x9f,0xa1,0xa0,0xa0, + 0x0,0x1,0x4007c,0x7,0xa2,0xa1,0x200f9,0xcd,0x200f8,0xcd,0x700f5,0x6, + 0x12c,0x30,0x5,0xe7,0xe5,0x700f5,0x6,0x138,0x1f,0x5,0x137,0xe5, + 0x500b1,0x38,0xd0,0x12c,0x37,0x400f6,0xe8,0xe5,0x0,0x400fa,0xd0,0xd1, + 0xe8,0x200f8,0xd1,0x200f9,0xd2,0x200f8,0xd2,0x700f5,0x6,0x137,0x138,0xd1, + 0xe0,0xd6,0x700f5,0x6,0x135,0x30,0xd1,0xe3,0xd6,0x500b1,0x38,0xd5, + 0x135,0x37,0x400f6,0xe4,0xd6,0x0,0x400fa,0xd5,0xd6,0xe4,0x200f8,0xd6, + 0x50050,0x7,0xdb,0x12c,0x135,0x50080,0x7,0xdc,0xa2,0xdb,0x4003d,0x1a, + 0x121,0x1c,0x7005f,0x20,0x123,0x121,0xdc,0x1002,0x1f,0x7004f,0x7,0x124, + 0x123,0x123,0x0,0x1,0x50041,0x8,0xde,0xc2,0x137,0x3003e,0xde,0x124, + 0x50080,0x6,0xe0,0x137,0x51,0x50080,0x6,0xe3,0x135,0x51,0x200f9,0xd2, + 0x200f8,0xe4,0x200f9,0xe5,0x200f8,0xe5,0x50080,0x6,0xe7,0x12c,0x51,0x200f9, + 0xcd,0x200f8,0xe8,0x200f9,0xe9,0x200f8,0xe9,0x700f5,0x42,0x12e,0x59,0xe8, + 0x113,0x114,0x700f5,0x6,0x12d,0x1f,0xe8,0x116,0x114,0x500b1,0x38,0xec, + 0x12d,0x61,0x400f6,0x117,0x114,0x0,0x400fa,0xec,0xed,0x117,0x200f8,0xed, + 0x200f9,0xee,0x200f8,0xee,0x700f5,0x42,0x132,0x64,0xed,0x108,0xf2,0x700f5, + 0x6,0x131,0x1f,0xed,0x10b,0xf2,0x500b1,0x38,0xf1,0x131,0x61,0x400f6, + 0x10c,0xf2,0x0,0x400fa,0xf1,0xf2,0x10c,0x200f8,0xf2,0x50041,0x8,0xf4, + 0xc2,0x12d,0x4003d,0x7,0xf5,0xf4,0x50041,0x8,0xf7,0xc2,0x131,0x4003d, + 0x7,0xf8,0xf7,0x50082,0x7,0xf9,0xf5,0xf8,0x50051,0x6,0xfb,0xf9, + 0x0,0x50084,0x6,0xfe,0xfb,0xfb,0x4007c,0x42,0xff,0xfe,0x50051,0x6, + 0x101,0xf9,0x1,0x50084,0x6,0x104,0x101,0x101,0x4007c,0x42,0x105,0x104, + 0x50080,0x42,0x107,0x105,0x132,0x50080,0x42,0x108,0xff,0x107,0x50080,0x6, + 0x10b,0x131,0x51,0x200f9,0xee,0x200f8,0x10c,0x500c4,0x42,0x10e,0x132,0x88, + 0x4007c,0x42,0x110,0x12d,0x500c5,0x42,0x111,0x10e,0x110,0x7000c,0x42,0x113, + 0x1,0x26,0x111,0x12e,0x200f9,0x114,0x200f8,0x114,0x50080,0x6,0x116,0x12d, + 0x51,0x200f9,0xe9,0x200f8,0x117,0x500c7,0x42,0x119,0x12e,0x93,0x50041,0x8, + 0x11c,0xc2,0x119,0x4003d,0x7,0x11d,0x11c,0x4003d,0x25,0x126,0x27,0x50051, + 0x6,0x129,0x11d,0x0,0x50051,0x6,0x12a,0x11d,0x1,0x70050,0x20,0x12b, + 0x129,0x12a,0x1f,0x1f,0x50063,0x126,0xa2,0x12b,0x1000,0x100fd,0x10038, +}; +static const char *of_filter_optical_flow_pass_v5_srv_tex_names[] = {"r_optical_flow_previous"}; +static const uint32_t of_filter_optical_flow_pass_v5_srv_tex_bind[] = {0}; +static const uint32_t of_filter_optical_flow_pass_v5_srv_tex_count[] = {1}; +static const uint32_t of_filter_optical_flow_pass_v5_srv_tex_space[] = {0}; +static const char *of_filter_optical_flow_pass_v5_uav_tex_names[] = {"rw_optical_flow"}; +static const uint32_t of_filter_optical_flow_pass_v5_uav_tex_bind[] = {1}; +static const uint32_t of_filter_optical_flow_pass_v5_uav_tex_count[] = {1}; +static const uint32_t of_filter_optical_flow_pass_v5_uav_tex_space[] = {0}; + +static const uint32_t of_scale_optical_flow_advanced_pass_v5_spv[2320] = { + 0x7230203,0x10500,0x8000b,0x5e6,0x0,0x20011,0x1,0x20011,0x31,0x6000b,0x1,0x4c534c47, + 0x6474732e,0x3035342e,0x0,0x3000e,0x0,0x1,0x10000f,0x5,0x4,0x6e69616d,0x0,0xee, + 0xff,0x108,0x111,0x11b,0x124,0x1f9,0x224,0x25b,0x29a,0x29d,0x60010,0x4, + 0x11,0x4,0x4,0x4,0x30003,0x2,0x1c2,0xb0004,0x455f4c47,0x735f5458,0x6c706d61,0x656c7265, + 0x745f7373,0x75747865,0x665f6572,0x74636e75,0x736e6f69,0x0,0xb0004,0x455f4c47,0x735f5458,0x65646168,0x78655f72,0x63696c70, + 0x615f7469,0x68746972,0x6974656d,0x79745f63,0x736570,0xa0004,0x475f4c47,0x4c474f4f,0x70635f45,0x74735f70,0x5f656c79,0x656e696c, + 0x7269645f,0x69746365,0x6576,0x80004,0x475f4c47,0x4c474f4f,0x6e695f45,0x64756c63,0x69645f65,0x74636572,0x657669,0x40005, + 0x4,0x6e69616d,0x0,0x40005,0xec,0x464f6263,0x745f,0x90006,0xec,0x0,0x706e4969,0x754c7475, + 0x6552616d,0x756c6f73,0x6e6f6974,0x0,0xa0006,0xec,0x1,0x74704f75,0x6c616369,0x776f6c46,0x61727950,0x4c64696d, + 0x6c657665,0x0,0x60006,0xec,0x2,0x61724669,0x6e49656d,0x786564,0x40005,0xee,0x464f6263,0x0, + 0x80005,0xff,0x706f5f72,0x61636974,0x6c665f6c,0x695f776f,0x7475706e,0x0,0xa0005,0x108,0x706f5f72,0x61636974, + 0x6c665f6c,0x705f776f,0x69766572,0x5f73756f,0x75706e69,0x74,0x60005,0x111,0x706f5f72,0x61636974,0x6c665f6c,0x776f, + 0x90005,0x11b,0x6f5f7772,0x63697470,0x665f6c61,0x5f776f6c,0x7478656e,0x76656c5f,0x6c65,0x90005,0x124,0x6f5f7772, + 0x63697470,0x665f6c61,0x5f776f6c,0x5f646373,0x7074756f,0x7475,0x60005,0x1f9,0x7261656e,0x56747365,0x6f746365,0x7372, + 0x50005,0x224,0x61636f6c,0x6765526c,0x6e6f69,0x40005,0x25b,0x73646173,0x0,0x80005,0x29a,0x475f6c67, + 0x61626f6c,0x766e496c,0x7461636f,0x496e6f69,0x44,0x80005,0x29d,0x4c5f6c67,0x6c61636f,0x6f766e49,0x69746163,0x44496e6f, + 0x0,0x30047,0xec,0x2,0x50048,0xec,0x0,0x23,0x0,0x50048,0xec,0x1, + 0x23,0x8,0x50048,0xec,0x2,0x23,0x10,0x40047,0xee,0x21,0x5,0x40047, + 0xee,0x22,0x0,0x40047,0xff,0x21,0x0,0x40047,0xff,0x22,0x0,0x40047, + 0x108,0x21,0x1,0x40047,0x108,0x22,0x0,0x40047,0x111,0x21,0x2,0x40047, + 0x111,0x22,0x0,0x40047,0x11b,0x21,0x3,0x40047,0x11b,0x22,0x0,0x40047, + 0x124,0x21,0x4,0x40047,0x124,0x22,0x0,0x40047,0x29a,0xb,0x1c,0x40047, + 0x29d,0xb,0x1b,0x40047,0x2a6,0xb,0x19,0x20013,0x2,0x30021,0x3,0x2, + 0x40015,0x6,0x20,0x1,0x40015,0x11,0x20,0x0,0x40017,0x21,0x6,0x2, + 0x20014,0x3f,0x40017,0x49,0x6,0x3,0x4002b,0x6,0x5d,0x8,0x4002b,0x6, + 0x61,0x10,0x4002b,0x6,0x65,0x18,0x4002b,0x6,0x69,0x0,0x4002b,0x11, + 0x6f,0xff,0x4002b,0x6,0x72,0xffffffff,0x4002b,0x6,0x7b,0xfffffffe,0x4002b,0x6, + 0x84,0xfffffffd,0x4002b,0x6,0x8f,0x4,0x4002b,0x11,0x96,0xff000000,0x4002b,0x6, + 0x9a,0x3,0x4002b,0x6,0xa5,0x2,0x4002b,0x6,0xb0,0x1,0x5001e,0xec, + 0x21,0x11,0x11,0x40020,0xed,0x2,0xec,0x4003b,0xed,0xee,0x2,0x40020, + 0xef,0x2,0x21,0x40020,0xf4,0x2,0x11,0x90019,0xfd,0x11,0x1,0x0, + 0x0,0x0,0x1,0x0,0x40020,0xfe,0x0,0xfd,0x4003b,0xfe,0xff,0x0, + 0x40017,0x102,0x11,0x4,0x4002b,0x11,0x104,0x0,0x4003b,0xfe,0x108,0x0, + 0x90019,0x10f,0x6,0x1,0x0,0x0,0x0,0x1,0x0,0x40020,0x110,0x0, + 0x10f,0x4003b,0x110,0x111,0x0,0x40017,0x114,0x6,0x4,0x90019,0x119,0x6, + 0x1,0x0,0x0,0x0,0x2,0x1a,0x40020,0x11a,0x0,0x119,0x4003b,0x11a, + 0x11b,0x0,0x90019,0x122,0x11,0x1,0x0,0x0,0x0,0x2,0x21,0x40020, + 0x123,0x0,0x122,0x4003b,0x123,0x124,0x0,0x4002b,0x11,0x12d,0x5,0x30029, + 0x3f,0x131,0x4002b,0x11,0x136,0xf,0x5002c,0x21,0x164,0xb0,0x69,0x5002c, + 0x21,0x16a,0xa5,0x69,0x5002c,0x21,0x170,0x9a,0x69,0x4002b,0x11,0x1d2, + 0x2,0x4002b,0x11,0x1f4,0x4,0x4001c,0x1f5,0x21,0x1f4,0x4001c,0x1f6,0x1f5, + 0x1f4,0x4001c,0x1f7,0x1f6,0x1f4,0x40020,0x1f8,0x4,0x1f7,0x4003b,0x1f8,0x1f9, + 0x4,0x40020,0x203,0x4,0x21,0x4001c,0x220,0x11,0x1f4,0x4001c,0x221,0x220, + 0x1f4,0x4001c,0x222,0x221,0x1f4,0x40020,0x223,0x4,0x222,0x4003b,0x223,0x224, + 0x4,0x40020,0x22b,0x4,0x11,0x4002b,0x11,0x22f,0xd48,0x4002b,0x11,0x230, + 0x108,0x4003b,0x223,0x25b,0x4,0x4002b,0x11,0x26a,0xffffffff,0x40017,0x298,0x11, + 0x3,0x40020,0x299,0x1,0x298,0x4003b,0x299,0x29a,0x1,0x4003b,0x299,0x29d, + 0x1,0x6002c,0x298,0x2a6,0x1f4,0x1f4,0x1f4,0x7002c,0x114,0x5e4,0x69,0x69, + 0x69,0x69,0x5002c,0x21,0x5e5,0xa5,0xa5,0x50036,0x2,0x4,0x0,0x3, + 0x200f8,0x5,0x4003d,0x298,0x29b,0x29a,0x4007c,0x49,0x29c,0x29b,0x4003d,0x298, + 0x29e,0x29d,0x4007c,0x49,0x29f,0x29e,0x300f7,0x371,0x0,0x300fb,0x104,0x2cc, + 0x200f8,0x2cc,0x300f7,0x380,0x0,0x300fb,0x104,0x377,0x200f8,0x377,0x50041,0xf4, + 0x384,0xee,0x1d2,0x4003d,0x11,0x385,0x384,0x500b2,0x3f,0x379,0x385,0x12d, + 0x300f7,0x37f,0x0,0x400fa,0x379,0x37a,0x37b,0x200f8,0x37b,0x4003d,0x122,0x388, + 0x124,0x60062,0x102,0x38b,0x388,0x164,0x2000,0x50051,0x11,0x38c,0x38b,0x0, + 0x500c7,0x11,0x37d,0x38c,0x136,0x500ab,0x3f,0x37e,0x37d,0x104,0x200f9,0x380, + 0x200f8,0x37a,0x200f9,0x380,0x200f8,0x37f,0x100ff,0x200f8,0x380,0x700f5,0x3f,0x579, + 0x131,0x37a,0x37e,0x37b,0x300f7,0x2d2,0x0,0x400fa,0x579,0x2ce,0x2d2,0x200f8, + 0x2ce,0x7004f,0x21,0x2d0,0x29c,0x29c,0x0,0x1,0x4003d,0x119,0x38e,0x11b, + 0x50063,0x38e,0x2d0,0x5e4,0x1000,0x200f9,0x371,0x200f8,0x2d2,0x50051,0x6,0x2d4, + 0x29f,0x2,0x5008b,0x6,0x2d5,0x2d4,0xa5,0x50082,0x6,0x2d6,0x2d5,0xb0, + 0x50051,0x6,0x2d8,0x29c,0x0,0x5008b,0x6,0x2d9,0x2d8,0xa5,0x50080,0x6, + 0x2da,0x2d6,0x2d9,0x50087,0x6,0x2dd,0x2d4,0xa5,0x50082,0x6,0x2de,0x2dd, + 0xb0,0x50051,0x6,0x2e0,0x29c,0x1,0x5008b,0x6,0x2e1,0x2e0,0xa5,0x50080, + 0x6,0x2e2,0x2de,0x2e1,0x50087,0x6,0x2e5,0x2d8,0xa5,0x50080,0x6,0x2e7, + 0x2e5,0x2da,0x50087,0x6,0x2ea,0x2e0,0xa5,0x50080,0x6,0x2ec,0x2ea,0x2e2, + 0x50050,0x21,0x2ed,0x2e7,0x2ec,0x4003d,0x10f,0x396,0x111,0x7005f,0x114,0x398, + 0x396,0x2ed,0x1002,0x69,0x7004f,0x21,0x399,0x398,0x398,0x0,0x1,0x50051, + 0x6,0x2f3,0x29f,0x1,0x50051,0x6,0x2f5,0x29f,0x0,0x50084,0x21,0x2f8, + 0x399,0x5e5,0x70041,0x203,0x2f9,0x1f9,0x2d4,0x2f3,0x2f5,0x3003e,0x2f9,0x2f8, + 0x200f9,0x2fc,0x200f8,0x2fc,0x700f5,0x6,0x57a,0x2d4,0x2d2,0x317,0x315,0x500b1, + 0x3f,0x300,0x57a,0x8f,0x400f6,0x318,0x315,0x0,0x400fa,0x300,0x301,0x318, + 0x200f8,0x301,0x50084,0x6,0x304,0x2d8,0x8f,0x50084,0x6,0x308,0x2e0,0x8f, + 0x50080,0x6,0x30a,0x308,0x57a,0x50041,0xef,0x3e0,0xee,0x69,0x4003d,0x21, + 0x3e1,0x3e0,0x50051,0x6,0x3b6,0x3e1,0x0,0x50041,0xf4,0x3e4,0xee,0xb0, + 0x4003d,0x11,0x3e5,0x3e4,0x500c3,0x6,0x3b8,0x3b6,0x3e5,0x50051,0x6,0x3ba, + 0x3e1,0x1,0x500c3,0x6,0x3bc,0x3ba,0x3e5,0x50082,0x6,0x3be,0x3b8,0x8f, + 0x7000c,0x6,0x3f2,0x1,0x27,0x3be,0x304,0x7000c,0x6,0x3f7,0x1,0x2a, + 0x69,0x3f2,0x50082,0x6,0x3c4,0x3bc,0xb0,0x7000c,0x6,0x3fc,0x1,0x27, + 0x3c4,0x30a,0x7000c,0x6,0x401,0x1,0x2a,0x69,0x3fc,0x50050,0x21,0x3c9, + 0x3f7,0x401,0x4003d,0xfd,0x404,0xff,0x7005f,0x102,0x406,0x404,0x3c9,0x2002, + 0x69,0x50051,0x11,0x407,0x406,0x0,0x50080,0x21,0x3ce,0x3c9,0x164,0x4003d, + 0xfd,0x40a,0xff,0x7005f,0x102,0x40c,0x40a,0x3ce,0x2002,0x69,0x50051,0x11, + 0x40d,0x40c,0x0,0x50080,0x21,0x3d1,0x3c9,0x16a,0x4003d,0xfd,0x410,0xff, + 0x7005f,0x102,0x412,0x410,0x3d1,0x2002,0x69,0x50051,0x11,0x413,0x412,0x0, + 0x50080,0x21,0x3d4,0x3c9,0x170,0x4003d,0xfd,0x416,0xff,0x7005f,0x102,0x418, + 0x416,0x3d4,0x2002,0x69,0x50051,0x11,0x419,0x418,0x0,0x500c4,0x11,0x421, + 0x40d,0x5d,0x500c5,0x11,0x422,0x407,0x421,0x500c4,0x11,0x424,0x413,0x61, + 0x500c5,0x11,0x425,0x422,0x424,0x500c4,0x11,0x427,0x419,0x65,0x500c5,0x11, + 0x428,0x425,0x427,0x500b1,0x3f,0x42a,0x304,0x69,0x300f7,0x46d,0x0,0x400fa, + 0x42a,0x42b,0x446,0x200f8,0x446,0x500ad,0x3f,0x44a,0x304,0x3be,0x300f7,0x46c, + 0x0,0x400fa,0x44a,0x44b,0x46c,0x200f8,0x44b,0x500c7,0x11,0x44d,0x428,0x96, + 0x50082,0x6,0x450,0x3b8,0x9a,0x500af,0x3f,0x451,0x304,0x450,0x300f7,0x457, + 0x0,0x400fa,0x451,0x452,0x457,0x200f8,0x452,0x500c2,0x11,0x454,0x428,0x5d, + 0x500c5,0x11,0x456,0x454,0x44d,0x200f9,0x457,0x200f8,0x457,0x700f5,0x11,0x5a9, + 0x428,0x44b,0x456,0x452,0x50082,0x6,0x45a,0x3b8,0xa5,0x500af,0x3f,0x45b, + 0x304,0x45a,0x300f7,0x461,0x0,0x400fa,0x45b,0x45c,0x461,0x200f8,0x45c,0x500c2, + 0x11,0x45e,0x5a9,0x5d,0x500c5,0x11,0x460,0x45e,0x44d,0x200f9,0x461,0x200f8, + 0x461,0x700f5,0x11,0x5ad,0x5a9,0x457,0x460,0x45c,0x50082,0x6,0x464,0x3b8, + 0xb0,0x500af,0x3f,0x465,0x304,0x464,0x300f7,0x46b,0x0,0x400fa,0x465,0x466, + 0x46b,0x200f8,0x466,0x500c2,0x11,0x468,0x5ad,0x5d,0x500c5,0x11,0x46a,0x468, + 0x44d,0x200f9,0x46b,0x200f8,0x46b,0x700f5,0x11,0x5b8,0x5ad,0x461,0x46a,0x466, + 0x200f9,0x46c,0x200f8,0x46c,0x700f5,0x11,0x5b7,0x428,0x446,0x5b8,0x46b,0x200f9, + 0x46d,0x200f8,0x42b,0x500c7,0x11,0x42d,0x428,0x6f,0x500b3,0x3f,0x42f,0x304, + 0x72,0x300f7,0x435,0x0,0x400fa,0x42f,0x430,0x435,0x200f8,0x430,0x500c4,0x11, + 0x432,0x428,0x5d,0x500c5,0x11,0x434,0x432,0x42d,0x200f9,0x435,0x200f8,0x435, + 0x700f5,0x11,0x5b0,0x428,0x42b,0x434,0x430,0x500b3,0x3f,0x437,0x304,0x7b, + 0x300f7,0x43d,0x0,0x400fa,0x437,0x438,0x43d,0x200f8,0x438,0x500c4,0x11,0x43a, + 0x5b0,0x5d,0x500c5,0x11,0x43c,0x43a,0x42d,0x200f9,0x43d,0x200f8,0x43d,0x700f5, + 0x11,0x5b3,0x5b0,0x435,0x43c,0x438,0x500b3,0x3f,0x43f,0x304,0x84,0x300f7, + 0x445,0x0,0x400fa,0x43f,0x440,0x445,0x200f8,0x440,0x500c4,0x11,0x442,0x5b3, + 0x5d,0x500c5,0x11,0x444,0x442,0x42d,0x200f9,0x445,0x200f8,0x445,0x700f5,0x11, + 0x5b6,0x5b3,0x43d,0x444,0x440,0x200f9,0x46d,0x200f8,0x46d,0x700f5,0x11,0x5b5, + 0x5b6,0x445,0x5b7,0x46c,0x70041,0x22b,0x314,0x224,0x57a,0x2f3,0x2f5,0x3003e, + 0x314,0x5b5,0x200f9,0x315,0x200f8,0x315,0x50080,0x6,0x317,0x57a,0x8f,0x200f9, + 0x2fc,0x200f8,0x318,0x300e1,0x1d2,0x22f,0x400e0,0x1d2,0x1d2,0x230,0x200f9,0x319, + 0x200f8,0x319,0x700f5,0x11,0x57e,0x104,0x318,0x337,0x338,0x700f5,0x6,0x57c, + 0x69,0x318,0x33a,0x338,0x500b1,0x3f,0x31d,0x57c,0x8f,0x400f6,0x33b,0x338, + 0x0,0x400fa,0x31d,0x31e,0x33b,0x200f8,0x31e,0x50084,0x6,0x321,0x2d8,0x8f, + 0x50084,0x6,0x325,0x2e0,0x8f,0x50080,0x6,0x327,0x325,0x57c,0x50050,0x21, + 0x328,0x321,0x327,0x50080,0x21,0x32a,0x328,0x399,0x50041,0xef,0x4b5,0xee, + 0x69,0x4003d,0x21,0x4b6,0x4b5,0x50051,0x6,0x48b,0x4b6,0x0,0x50041,0xf4, + 0x4b9,0xee,0xb0,0x4003d,0x11,0x4ba,0x4b9,0x500c3,0x6,0x48d,0x48b,0x4ba, + 0x50051,0x6,0x48f,0x4b6,0x1,0x500c3,0x6,0x491,0x48f,0x4ba,0x50082,0x6, + 0x493,0x48d,0x8f,0x50051,0x6,0x495,0x32a,0x0,0x7000c,0x6,0x4c7,0x1, + 0x27,0x493,0x495,0x7000c,0x6,0x4cc,0x1,0x2a,0x69,0x4c7,0x50082,0x6, + 0x499,0x491,0xb0,0x50051,0x6,0x49b,0x32a,0x1,0x7000c,0x6,0x4d1,0x1, + 0x27,0x499,0x49b,0x7000c,0x6,0x4d6,0x1,0x2a,0x69,0x4d1,0x50050,0x21, + 0x49e,0x4cc,0x4d6,0x4003d,0xfd,0x4d9,0x108,0x7005f,0x102,0x4db,0x4d9,0x49e, + 0x2002,0x69,0x50051,0x11,0x4dc,0x4db,0x0,0x50080,0x21,0x4a3,0x49e,0x164, + 0x4003d,0xfd,0x4df,0x108,0x7005f,0x102,0x4e1,0x4df,0x4a3,0x2002,0x69,0x50051, + 0x11,0x4e2,0x4e1,0x0,0x50080,0x21,0x4a6,0x49e,0x16a,0x4003d,0xfd,0x4e5, + 0x108,0x7005f,0x102,0x4e7,0x4e5,0x4a6,0x2002,0x69,0x50051,0x11,0x4e8,0x4e7, + 0x0,0x50080,0x21,0x4a9,0x49e,0x170,0x4003d,0xfd,0x4eb,0x108,0x7005f,0x102, + 0x4ed,0x4eb,0x4a9,0x2002,0x69,0x50051,0x11,0x4ee,0x4ed,0x0,0x500c4,0x11, + 0x4f6,0x4e2,0x5d,0x500c5,0x11,0x4f7,0x4dc,0x4f6,0x500c4,0x11,0x4f9,0x4e8, + 0x61,0x500c5,0x11,0x4fa,0x4f7,0x4f9,0x500c4,0x11,0x4fc,0x4ee,0x65,0x500c5, + 0x11,0x4fd,0x4fa,0x4fc,0x500b1,0x3f,0x4ff,0x495,0x69,0x300f7,0x542,0x0, + 0x400fa,0x4ff,0x500,0x51b,0x200f8,0x51b,0x500ad,0x3f,0x51f,0x495,0x493,0x300f7, + 0x541,0x0,0x400fa,0x51f,0x520,0x541,0x200f8,0x520,0x500c7,0x11,0x522,0x4fd, + 0x96,0x50082,0x6,0x525,0x48d,0x9a,0x500af,0x3f,0x526,0x495,0x525,0x300f7, + 0x52c,0x0,0x400fa,0x526,0x527,0x52c,0x200f8,0x527,0x500c2,0x11,0x529,0x4fd, + 0x5d,0x500c5,0x11,0x52b,0x529,0x522,0x200f9,0x52c,0x200f8,0x52c,0x700f5,0x11, + 0x587,0x4fd,0x520,0x52b,0x527,0x50082,0x6,0x52f,0x48d,0xa5,0x500af,0x3f, + 0x530,0x495,0x52f,0x300f7,0x536,0x0,0x400fa,0x530,0x531,0x536,0x200f8,0x531, + 0x500c2,0x11,0x533,0x587,0x5d,0x500c5,0x11,0x535,0x533,0x522,0x200f9,0x536, + 0x200f8,0x536,0x700f5,0x11,0x58b,0x587,0x52c,0x535,0x531,0x50082,0x6,0x539, + 0x48d,0xb0,0x500af,0x3f,0x53a,0x495,0x539,0x300f7,0x540,0x0,0x400fa,0x53a, + 0x53b,0x540,0x200f8,0x53b,0x500c2,0x11,0x53d,0x58b,0x5d,0x500c5,0x11,0x53f, + 0x53d,0x522,0x200f9,0x540,0x200f8,0x540,0x700f5,0x11,0x596,0x58b,0x536,0x53f, + 0x53b,0x200f9,0x541,0x200f8,0x541,0x700f5,0x11,0x595,0x4fd,0x51b,0x596,0x540, + 0x200f9,0x542,0x200f8,0x500,0x500c7,0x11,0x502,0x4fd,0x6f,0x500b3,0x3f,0x504, + 0x495,0x72,0x300f7,0x50a,0x0,0x400fa,0x504,0x505,0x50a,0x200f8,0x505,0x500c4, + 0x11,0x507,0x4fd,0x5d,0x500c5,0x11,0x509,0x507,0x502,0x200f9,0x50a,0x200f8, + 0x50a,0x700f5,0x11,0x58e,0x4fd,0x500,0x509,0x505,0x500b3,0x3f,0x50c,0x495, + 0x7b,0x300f7,0x512,0x0,0x400fa,0x50c,0x50d,0x512,0x200f8,0x50d,0x500c4,0x11, + 0x50f,0x58e,0x5d,0x500c5,0x11,0x511,0x50f,0x502,0x200f9,0x512,0x200f8,0x512, + 0x700f5,0x11,0x591,0x58e,0x50a,0x511,0x50d,0x500b3,0x3f,0x514,0x495,0x84, + 0x300f7,0x51a,0x0,0x400fa,0x514,0x515,0x51a,0x200f8,0x515,0x500c4,0x11,0x517, + 0x591,0x5d,0x500c5,0x11,0x519,0x517,0x502,0x200f9,0x51a,0x200f8,0x51a,0x700f5, + 0x11,0x594,0x591,0x512,0x519,0x515,0x200f9,0x542,0x200f8,0x542,0x700f5,0x11, + 0x593,0x594,0x51a,0x595,0x541,0x70041,0x22b,0x332,0x224,0x57c,0x2f3,0x2f5, + 0x4003d,0x11,0x333,0x332,0x500c7,0x11,0x548,0x333,0x6f,0x4007c,0x6,0x549, + 0x548,0x500c7,0x11,0x54c,0x593,0x6f,0x4007c,0x6,0x54d,0x54c,0x50082,0x6, + 0x54e,0x549,0x54d,0x6000c,0x6,0x54f,0x1,0x5,0x54e,0x500c2,0x11,0x551, + 0x333,0x5d,0x500c7,0x11,0x552,0x551,0x6f,0x4007c,0x6,0x553,0x552,0x500c2, + 0x11,0x555,0x593,0x5d,0x500c7,0x11,0x556,0x555,0x6f,0x4007c,0x6,0x557, + 0x556,0x50082,0x6,0x558,0x553,0x557,0x6000c,0x6,0x559,0x1,0x5,0x558, + 0x50080,0x6,0x55a,0x54f,0x559,0x500c2,0x11,0x55c,0x333,0x61,0x500c7,0x11, + 0x55d,0x55c,0x6f,0x4007c,0x6,0x55e,0x55d,0x500c2,0x11,0x560,0x593,0x61, + 0x500c7,0x11,0x561,0x560,0x6f,0x4007c,0x6,0x562,0x561,0x50082,0x6,0x563, + 0x55e,0x562,0x6000c,0x6,0x564,0x1,0x5,0x563,0x50080,0x6,0x565,0x55a, + 0x564,0x500c2,0x11,0x567,0x333,0x65,0x500c7,0x11,0x568,0x567,0x6f,0x4007c, + 0x6,0x569,0x568,0x500c2,0x11,0x56b,0x593,0x65,0x500c7,0x11,0x56c,0x56b, + 0x6f,0x4007c,0x6,0x56d,0x56c,0x50082,0x6,0x56e,0x569,0x56d,0x6000c,0x6, + 0x56f,0x1,0x5,0x56e,0x50080,0x6,0x570,0x565,0x56f,0x4007c,0x11,0x571, + 0x570,0x50080,0x11,0x337,0x57e,0x571,0x200f9,0x338,0x200f8,0x338,0x50080,0x6, + 0x33a,0x57c,0xb0,0x200f9,0x319,0x200f8,0x33b,0x70041,0x22b,0x343,0x25b,0x2d4, + 0x2f3,0x2f5,0x3003e,0x343,0x57e,0x300e1,0x1d2,0x22f,0x400e0,0x1d2,0x1d2,0x230, + 0x500aa,0x3f,0x346,0x2d4,0x69,0x300f7,0x370,0x0,0x400fa,0x346,0x347,0x370, + 0x200f8,0x347,0x200f9,0x348,0x200f8,0x348,0x700f5,0x11,0x581,0x26a,0x347,0x5d3, + 0x361,0x700f5,0x11,0x580,0x104,0x347,0x5d2,0x361,0x700f5,0x6,0x57f,0x69, + 0x347,0x363,0x361,0x500b1,0x3f,0x34b,0x57f,0x8f,0x400f6,0x364,0x361,0x0, + 0x400fa,0x34b,0x34c,0x364,0x200f8,0x34c,0x70041,0x22b,0x352,0x25b,0x57f,0x2f3, + 0x2f5,0x4003d,0x11,0x353,0x352,0x500b0,0x3f,0x355,0x353,0x581,0x300f7,0x360, + 0x0,0x400fa,0x355,0x356,0x360,0x200f8,0x356,0x4003d,0x11,0x35d,0x352,0x4007c, + 0x11,0x35f,0x57f,0x200f9,0x360,0x200f8,0x360,0x700f5,0x11,0x5d3,0x581,0x34c, + 0x35d,0x356,0x700f5,0x11,0x5d2,0x580,0x34c,0x35f,0x356,0x200f9,0x361,0x200f8, + 0x361,0x50080,0x6,0x363,0x57f,0xb0,0x200f9,0x348,0x200f8,0x364,0x70041,0x203, + 0x36a,0x1f9,0x580,0x2f3,0x2f5,0x4003d,0x21,0x36b,0x36a,0x7004f,0x21,0x36d, + 0x29c,0x29c,0x0,0x1,0x4003d,0x119,0x573,0x11b,0x50051,0x6,0x576,0x36b, + 0x0,0x50051,0x6,0x577,0x36b,0x1,0x70050,0x114,0x578,0x576,0x577,0x69, + 0x69,0x50063,0x573,0x36d,0x578,0x1000,0x200f9,0x370,0x200f8,0x370,0x200f9,0x371, + 0x200f8,0x371,0x100fd,0x10038, +}; +static const char *of_scale_optical_flow_advanced_pass_v5_cb_names[] = {"cbOF"}; +static const uint32_t of_scale_optical_flow_advanced_pass_v5_cb_bind[] = {5}; +static const uint32_t of_scale_optical_flow_advanced_pass_v5_cb_count[] = {1}; +static const uint32_t of_scale_optical_flow_advanced_pass_v5_cb_space[] = {0}; +static const char *of_scale_optical_flow_advanced_pass_v5_srv_tex_names[] = {"r_optical_flow_input", "r_optical_flow_previous_input", "r_optical_flow"}; +static const uint32_t of_scale_optical_flow_advanced_pass_v5_srv_tex_bind[] = {0, 1, 2}; +static const uint32_t of_scale_optical_flow_advanced_pass_v5_srv_tex_count[] = {1, 1, 1}; +static const uint32_t of_scale_optical_flow_advanced_pass_v5_srv_tex_space[] = {0, 0, 0}; +static const char *of_scale_optical_flow_advanced_pass_v5_uav_tex_names[] = {"rw_optical_flow_next_level", "rw_optical_flow_scd_output"}; +static const uint32_t of_scale_optical_flow_advanced_pass_v5_uav_tex_bind[] = {3, 4}; +static const uint32_t of_scale_optical_flow_advanced_pass_v5_uav_tex_count[] = {1, 1}; +static const uint32_t of_scale_optical_flow_advanced_pass_v5_uav_tex_space[] = {0, 0}; + +// [inverted depth][FfxFrameInterpolationPass] +static const FfxShaderBlob ffx_fi_blobs[2][11] = { + { + {(const uint8_t *)fi_reconstruct_and_dilate_pass_0_spv, sizeof fi_reconstruct_and_dilate_pass_0_spv, 1, 2, 3, 0, 0, 0, 0, fi_reconstruct_and_dilate_pass_0_cb_names, fi_reconstruct_and_dilate_pass_0_cb_bind, fi_reconstruct_and_dilate_pass_0_cb_count, fi_reconstruct_and_dilate_pass_0_cb_space, fi_reconstruct_and_dilate_pass_0_srv_tex_names, fi_reconstruct_and_dilate_pass_0_srv_tex_bind, fi_reconstruct_and_dilate_pass_0_srv_tex_count, fi_reconstruct_and_dilate_pass_0_srv_tex_space, fi_reconstruct_and_dilate_pass_0_uav_tex_names, fi_reconstruct_and_dilate_pass_0_uav_tex_bind, fi_reconstruct_and_dilate_pass_0_uav_tex_count, fi_reconstruct_and_dilate_pass_0_uav_tex_space, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {(const uint8_t *)fi_setup_pass_0_spv, sizeof fi_setup_pass_0_spv, 1, 1, 5, 0, 1, 0, 0, fi_setup_pass_0_cb_names, fi_setup_pass_0_cb_bind, fi_setup_pass_0_cb_count, fi_setup_pass_0_cb_space, fi_setup_pass_0_srv_tex_names, fi_setup_pass_0_srv_tex_bind, fi_setup_pass_0_srv_tex_count, fi_setup_pass_0_srv_tex_space, fi_setup_pass_0_uav_tex_names, fi_setup_pass_0_uav_tex_bind, fi_setup_pass_0_uav_tex_count, fi_setup_pass_0_uav_tex_space, 0, 0, 0, 0, fi_setup_pass_0_uav_buf_names, fi_setup_pass_0_uav_buf_bind, fi_setup_pass_0_uav_buf_count, fi_setup_pass_0_uav_buf_space, 0, 0, 0, 0, 0, 0, 0, 0}, + {(const uint8_t *)fi_reconstruct_previous_depth_pass_0_spv, sizeof fi_reconstruct_previous_depth_pass_0_spv, 1, 3, 1, 0, 0, 1, 0, fi_reconstruct_previous_depth_pass_0_cb_names, fi_reconstruct_previous_depth_pass_0_cb_bind, fi_reconstruct_previous_depth_pass_0_cb_count, fi_reconstruct_previous_depth_pass_0_cb_space, fi_reconstruct_previous_depth_pass_0_srv_tex_names, fi_reconstruct_previous_depth_pass_0_srv_tex_bind, fi_reconstruct_previous_depth_pass_0_srv_tex_count, fi_reconstruct_previous_depth_pass_0_srv_tex_space, fi_reconstruct_previous_depth_pass_0_uav_tex_names, fi_reconstruct_previous_depth_pass_0_uav_tex_bind, fi_reconstruct_previous_depth_pass_0_uav_tex_count, fi_reconstruct_previous_depth_pass_0_uav_tex_space, 0, 0, 0, 0, 0, 0, 0, 0, fi_reconstruct_previous_depth_pass_0_sampler_names, fi_reconstruct_previous_depth_pass_0_sampler_bind, fi_reconstruct_previous_depth_pass_0_sampler_count, fi_reconstruct_previous_depth_pass_0_sampler_space, 0, 0, 0, 0}, + {(const uint8_t *)fi_game_motion_vector_field_pass_0_spv, sizeof fi_game_motion_vector_field_pass_0_spv, 1, 5, 2, 0, 0, 1, 0, fi_game_motion_vector_field_pass_0_cb_names, fi_game_motion_vector_field_pass_0_cb_bind, fi_game_motion_vector_field_pass_0_cb_count, fi_game_motion_vector_field_pass_0_cb_space, fi_game_motion_vector_field_pass_0_srv_tex_names, fi_game_motion_vector_field_pass_0_srv_tex_bind, fi_game_motion_vector_field_pass_0_srv_tex_count, fi_game_motion_vector_field_pass_0_srv_tex_space, fi_game_motion_vector_field_pass_0_uav_tex_names, fi_game_motion_vector_field_pass_0_uav_tex_bind, fi_game_motion_vector_field_pass_0_uav_tex_count, fi_game_motion_vector_field_pass_0_uav_tex_space, 0, 0, 0, 0, 0, 0, 0, 0, fi_game_motion_vector_field_pass_0_sampler_names, fi_game_motion_vector_field_pass_0_sampler_bind, fi_game_motion_vector_field_pass_0_sampler_count, fi_game_motion_vector_field_pass_0_sampler_space, 0, 0, 0, 0}, + {(const uint8_t *)fi_optical_flow_vector_field_pass_0_spv, sizeof fi_optical_flow_vector_field_pass_0_spv, 1, 3, 2, 0, 0, 1, 0, fi_optical_flow_vector_field_pass_0_cb_names, fi_optical_flow_vector_field_pass_0_cb_bind, fi_optical_flow_vector_field_pass_0_cb_count, fi_optical_flow_vector_field_pass_0_cb_space, fi_optical_flow_vector_field_pass_0_srv_tex_names, fi_optical_flow_vector_field_pass_0_srv_tex_bind, fi_optical_flow_vector_field_pass_0_srv_tex_count, fi_optical_flow_vector_field_pass_0_srv_tex_space, fi_optical_flow_vector_field_pass_0_uav_tex_names, fi_optical_flow_vector_field_pass_0_uav_tex_bind, fi_optical_flow_vector_field_pass_0_uav_tex_count, fi_optical_flow_vector_field_pass_0_uav_tex_space, 0, 0, 0, 0, 0, 0, 0, 0, fi_optical_flow_vector_field_pass_0_sampler_names, fi_optical_flow_vector_field_pass_0_sampler_bind, fi_optical_flow_vector_field_pass_0_sampler_count, fi_optical_flow_vector_field_pass_0_sampler_space, 0, 0, 0, 0}, + {(const uint8_t *)fi_disocclusion_mask_pass_0_spv, sizeof fi_disocclusion_mask_pass_0_spv, 1, 7, 1, 0, 0, 1, 0, fi_disocclusion_mask_pass_0_cb_names, fi_disocclusion_mask_pass_0_cb_bind, fi_disocclusion_mask_pass_0_cb_count, fi_disocclusion_mask_pass_0_cb_space, fi_disocclusion_mask_pass_0_srv_tex_names, fi_disocclusion_mask_pass_0_srv_tex_bind, fi_disocclusion_mask_pass_0_srv_tex_count, fi_disocclusion_mask_pass_0_srv_tex_space, fi_disocclusion_mask_pass_0_uav_tex_names, fi_disocclusion_mask_pass_0_uav_tex_bind, fi_disocclusion_mask_pass_0_uav_tex_count, fi_disocclusion_mask_pass_0_uav_tex_space, 0, 0, 0, 0, 0, 0, 0, 0, fi_disocclusion_mask_pass_0_sampler_names, fi_disocclusion_mask_pass_0_sampler_bind, fi_disocclusion_mask_pass_0_sampler_count, fi_disocclusion_mask_pass_0_sampler_space, 0, 0, 0, 0}, + {(const uint8_t *)fi_pass_0_spv, sizeof fi_pass_0_spv, 1, 8, 1, 1, 0, 1, 0, fi_pass_0_cb_names, fi_pass_0_cb_bind, fi_pass_0_cb_count, fi_pass_0_cb_space, fi_pass_0_srv_tex_names, fi_pass_0_srv_tex_bind, fi_pass_0_srv_tex_count, fi_pass_0_srv_tex_space, fi_pass_0_uav_tex_names, fi_pass_0_uav_tex_bind, fi_pass_0_uav_tex_count, fi_pass_0_uav_tex_space, fi_pass_0_srv_buf_names, fi_pass_0_srv_buf_bind, fi_pass_0_srv_buf_count, fi_pass_0_srv_buf_space, 0, 0, 0, 0, fi_pass_0_sampler_names, fi_pass_0_sampler_bind, fi_pass_0_sampler_count, fi_pass_0_sampler_space, 0, 0, 0, 0}, + {(const uint8_t *)fi_compute_inpainting_pyramid_pass_0_spv, sizeof fi_compute_inpainting_pyramid_pass_0_spv, 2, 1, 12, 0, 1, 0, 0, fi_compute_inpainting_pyramid_pass_0_cb_names, fi_compute_inpainting_pyramid_pass_0_cb_bind, fi_compute_inpainting_pyramid_pass_0_cb_count, fi_compute_inpainting_pyramid_pass_0_cb_space, fi_compute_inpainting_pyramid_pass_0_srv_tex_names, fi_compute_inpainting_pyramid_pass_0_srv_tex_bind, fi_compute_inpainting_pyramid_pass_0_srv_tex_count, fi_compute_inpainting_pyramid_pass_0_srv_tex_space, fi_compute_inpainting_pyramid_pass_0_uav_tex_names, fi_compute_inpainting_pyramid_pass_0_uav_tex_bind, fi_compute_inpainting_pyramid_pass_0_uav_tex_count, fi_compute_inpainting_pyramid_pass_0_uav_tex_space, 0, 0, 0, 0, fi_compute_inpainting_pyramid_pass_0_uav_buf_names, fi_compute_inpainting_pyramid_pass_0_uav_buf_bind, fi_compute_inpainting_pyramid_pass_0_uav_buf_count, fi_compute_inpainting_pyramid_pass_0_uav_buf_space, 0, 0, 0, 0, 0, 0, 0, 0}, + {(const uint8_t *)fi_inpainting_pass_0_spv, sizeof fi_inpainting_pass_0_spv, 1, 4, 1, 0, 0, 0, 0, fi_inpainting_pass_0_cb_names, fi_inpainting_pass_0_cb_bind, fi_inpainting_pass_0_cb_count, fi_inpainting_pass_0_cb_space, fi_inpainting_pass_0_srv_tex_names, fi_inpainting_pass_0_srv_tex_bind, fi_inpainting_pass_0_srv_tex_count, fi_inpainting_pass_0_srv_tex_space, fi_inpainting_pass_0_uav_tex_names, fi_inpainting_pass_0_uav_tex_bind, fi_inpainting_pass_0_uav_tex_count, fi_inpainting_pass_0_uav_tex_space, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {(const uint8_t *)fi_compute_game_vector_field_inpainting_pyramid_pass_0_spv, sizeof fi_compute_game_vector_field_inpainting_pyramid_pass_0_spv, 2, 2, 12, 0, 1, 0, 0, fi_compute_game_vector_field_inpainting_pyramid_pass_0_cb_names, fi_compute_game_vector_field_inpainting_pyramid_pass_0_cb_bind, fi_compute_game_vector_field_inpainting_pyramid_pass_0_cb_count, fi_compute_game_vector_field_inpainting_pyramid_pass_0_cb_space, fi_compute_game_vector_field_inpainting_pyramid_pass_0_srv_tex_names, fi_compute_game_vector_field_inpainting_pyramid_pass_0_srv_tex_bind, fi_compute_game_vector_field_inpainting_pyramid_pass_0_srv_tex_count, fi_compute_game_vector_field_inpainting_pyramid_pass_0_srv_tex_space, fi_compute_game_vector_field_inpainting_pyramid_pass_0_uav_tex_names, fi_compute_game_vector_field_inpainting_pyramid_pass_0_uav_tex_bind, fi_compute_game_vector_field_inpainting_pyramid_pass_0_uav_tex_count, fi_compute_game_vector_field_inpainting_pyramid_pass_0_uav_tex_space, 0, 0, 0, 0, fi_compute_game_vector_field_inpainting_pyramid_pass_0_uav_buf_names, fi_compute_game_vector_field_inpainting_pyramid_pass_0_uav_buf_bind, fi_compute_game_vector_field_inpainting_pyramid_pass_0_uav_buf_count, fi_compute_game_vector_field_inpainting_pyramid_pass_0_uav_buf_space, 0, 0, 0, 0, 0, 0, 0, 0}, + {(const uint8_t *)fi_debug_view_pass_0_spv, sizeof fi_debug_view_pass_0_spv, 1, 9, 1, 0, 0, 1, 0, fi_debug_view_pass_0_cb_names, fi_debug_view_pass_0_cb_bind, fi_debug_view_pass_0_cb_count, fi_debug_view_pass_0_cb_space, fi_debug_view_pass_0_srv_tex_names, fi_debug_view_pass_0_srv_tex_bind, fi_debug_view_pass_0_srv_tex_count, fi_debug_view_pass_0_srv_tex_space, fi_debug_view_pass_0_uav_tex_names, fi_debug_view_pass_0_uav_tex_bind, fi_debug_view_pass_0_uav_tex_count, fi_debug_view_pass_0_uav_tex_space, 0, 0, 0, 0, 0, 0, 0, 0, fi_debug_view_pass_0_sampler_names, fi_debug_view_pass_0_sampler_bind, fi_debug_view_pass_0_sampler_count, fi_debug_view_pass_0_sampler_space, 0, 0, 0, 0}, + }, + { + {(const uint8_t *)fi_reconstruct_and_dilate_pass_1_spv, sizeof fi_reconstruct_and_dilate_pass_1_spv, 1, 2, 3, 0, 0, 0, 0, fi_reconstruct_and_dilate_pass_1_cb_names, fi_reconstruct_and_dilate_pass_1_cb_bind, fi_reconstruct_and_dilate_pass_1_cb_count, fi_reconstruct_and_dilate_pass_1_cb_space, fi_reconstruct_and_dilate_pass_1_srv_tex_names, fi_reconstruct_and_dilate_pass_1_srv_tex_bind, fi_reconstruct_and_dilate_pass_1_srv_tex_count, fi_reconstruct_and_dilate_pass_1_srv_tex_space, fi_reconstruct_and_dilate_pass_1_uav_tex_names, fi_reconstruct_and_dilate_pass_1_uav_tex_bind, fi_reconstruct_and_dilate_pass_1_uav_tex_count, fi_reconstruct_and_dilate_pass_1_uav_tex_space, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {(const uint8_t *)fi_setup_pass_1_spv, sizeof fi_setup_pass_1_spv, 1, 1, 5, 0, 1, 0, 0, fi_setup_pass_1_cb_names, fi_setup_pass_1_cb_bind, fi_setup_pass_1_cb_count, fi_setup_pass_1_cb_space, fi_setup_pass_1_srv_tex_names, fi_setup_pass_1_srv_tex_bind, fi_setup_pass_1_srv_tex_count, fi_setup_pass_1_srv_tex_space, fi_setup_pass_1_uav_tex_names, fi_setup_pass_1_uav_tex_bind, fi_setup_pass_1_uav_tex_count, fi_setup_pass_1_uav_tex_space, 0, 0, 0, 0, fi_setup_pass_1_uav_buf_names, fi_setup_pass_1_uav_buf_bind, fi_setup_pass_1_uav_buf_count, fi_setup_pass_1_uav_buf_space, 0, 0, 0, 0, 0, 0, 0, 0}, + {(const uint8_t *)fi_reconstruct_previous_depth_pass_1_spv, sizeof fi_reconstruct_previous_depth_pass_1_spv, 1, 3, 1, 0, 0, 1, 0, fi_reconstruct_previous_depth_pass_1_cb_names, fi_reconstruct_previous_depth_pass_1_cb_bind, fi_reconstruct_previous_depth_pass_1_cb_count, fi_reconstruct_previous_depth_pass_1_cb_space, fi_reconstruct_previous_depth_pass_1_srv_tex_names, fi_reconstruct_previous_depth_pass_1_srv_tex_bind, fi_reconstruct_previous_depth_pass_1_srv_tex_count, fi_reconstruct_previous_depth_pass_1_srv_tex_space, fi_reconstruct_previous_depth_pass_1_uav_tex_names, fi_reconstruct_previous_depth_pass_1_uav_tex_bind, fi_reconstruct_previous_depth_pass_1_uav_tex_count, fi_reconstruct_previous_depth_pass_1_uav_tex_space, 0, 0, 0, 0, 0, 0, 0, 0, fi_reconstruct_previous_depth_pass_1_sampler_names, fi_reconstruct_previous_depth_pass_1_sampler_bind, fi_reconstruct_previous_depth_pass_1_sampler_count, fi_reconstruct_previous_depth_pass_1_sampler_space, 0, 0, 0, 0}, + {(const uint8_t *)fi_game_motion_vector_field_pass_1_spv, sizeof fi_game_motion_vector_field_pass_1_spv, 1, 5, 2, 0, 0, 1, 0, fi_game_motion_vector_field_pass_1_cb_names, fi_game_motion_vector_field_pass_1_cb_bind, fi_game_motion_vector_field_pass_1_cb_count, fi_game_motion_vector_field_pass_1_cb_space, fi_game_motion_vector_field_pass_1_srv_tex_names, fi_game_motion_vector_field_pass_1_srv_tex_bind, fi_game_motion_vector_field_pass_1_srv_tex_count, fi_game_motion_vector_field_pass_1_srv_tex_space, fi_game_motion_vector_field_pass_1_uav_tex_names, fi_game_motion_vector_field_pass_1_uav_tex_bind, fi_game_motion_vector_field_pass_1_uav_tex_count, fi_game_motion_vector_field_pass_1_uav_tex_space, 0, 0, 0, 0, 0, 0, 0, 0, fi_game_motion_vector_field_pass_1_sampler_names, fi_game_motion_vector_field_pass_1_sampler_bind, fi_game_motion_vector_field_pass_1_sampler_count, fi_game_motion_vector_field_pass_1_sampler_space, 0, 0, 0, 0}, + {(const uint8_t *)fi_optical_flow_vector_field_pass_1_spv, sizeof fi_optical_flow_vector_field_pass_1_spv, 1, 3, 2, 0, 0, 1, 0, fi_optical_flow_vector_field_pass_1_cb_names, fi_optical_flow_vector_field_pass_1_cb_bind, fi_optical_flow_vector_field_pass_1_cb_count, fi_optical_flow_vector_field_pass_1_cb_space, fi_optical_flow_vector_field_pass_1_srv_tex_names, fi_optical_flow_vector_field_pass_1_srv_tex_bind, fi_optical_flow_vector_field_pass_1_srv_tex_count, fi_optical_flow_vector_field_pass_1_srv_tex_space, fi_optical_flow_vector_field_pass_1_uav_tex_names, fi_optical_flow_vector_field_pass_1_uav_tex_bind, fi_optical_flow_vector_field_pass_1_uav_tex_count, fi_optical_flow_vector_field_pass_1_uav_tex_space, 0, 0, 0, 0, 0, 0, 0, 0, fi_optical_flow_vector_field_pass_1_sampler_names, fi_optical_flow_vector_field_pass_1_sampler_bind, fi_optical_flow_vector_field_pass_1_sampler_count, fi_optical_flow_vector_field_pass_1_sampler_space, 0, 0, 0, 0}, + {(const uint8_t *)fi_disocclusion_mask_pass_1_spv, sizeof fi_disocclusion_mask_pass_1_spv, 1, 7, 1, 0, 0, 1, 0, fi_disocclusion_mask_pass_1_cb_names, fi_disocclusion_mask_pass_1_cb_bind, fi_disocclusion_mask_pass_1_cb_count, fi_disocclusion_mask_pass_1_cb_space, fi_disocclusion_mask_pass_1_srv_tex_names, fi_disocclusion_mask_pass_1_srv_tex_bind, fi_disocclusion_mask_pass_1_srv_tex_count, fi_disocclusion_mask_pass_1_srv_tex_space, fi_disocclusion_mask_pass_1_uav_tex_names, fi_disocclusion_mask_pass_1_uav_tex_bind, fi_disocclusion_mask_pass_1_uav_tex_count, fi_disocclusion_mask_pass_1_uav_tex_space, 0, 0, 0, 0, 0, 0, 0, 0, fi_disocclusion_mask_pass_1_sampler_names, fi_disocclusion_mask_pass_1_sampler_bind, fi_disocclusion_mask_pass_1_sampler_count, fi_disocclusion_mask_pass_1_sampler_space, 0, 0, 0, 0}, + {(const uint8_t *)fi_pass_1_spv, sizeof fi_pass_1_spv, 1, 8, 1, 1, 0, 1, 0, fi_pass_1_cb_names, fi_pass_1_cb_bind, fi_pass_1_cb_count, fi_pass_1_cb_space, fi_pass_1_srv_tex_names, fi_pass_1_srv_tex_bind, fi_pass_1_srv_tex_count, fi_pass_1_srv_tex_space, fi_pass_1_uav_tex_names, fi_pass_1_uav_tex_bind, fi_pass_1_uav_tex_count, fi_pass_1_uav_tex_space, fi_pass_1_srv_buf_names, fi_pass_1_srv_buf_bind, fi_pass_1_srv_buf_count, fi_pass_1_srv_buf_space, 0, 0, 0, 0, fi_pass_1_sampler_names, fi_pass_1_sampler_bind, fi_pass_1_sampler_count, fi_pass_1_sampler_space, 0, 0, 0, 0}, + {(const uint8_t *)fi_compute_inpainting_pyramid_pass_1_spv, sizeof fi_compute_inpainting_pyramid_pass_1_spv, 2, 1, 12, 0, 1, 0, 0, fi_compute_inpainting_pyramid_pass_1_cb_names, fi_compute_inpainting_pyramid_pass_1_cb_bind, fi_compute_inpainting_pyramid_pass_1_cb_count, fi_compute_inpainting_pyramid_pass_1_cb_space, fi_compute_inpainting_pyramid_pass_1_srv_tex_names, fi_compute_inpainting_pyramid_pass_1_srv_tex_bind, fi_compute_inpainting_pyramid_pass_1_srv_tex_count, fi_compute_inpainting_pyramid_pass_1_srv_tex_space, fi_compute_inpainting_pyramid_pass_1_uav_tex_names, fi_compute_inpainting_pyramid_pass_1_uav_tex_bind, fi_compute_inpainting_pyramid_pass_1_uav_tex_count, fi_compute_inpainting_pyramid_pass_1_uav_tex_space, 0, 0, 0, 0, fi_compute_inpainting_pyramid_pass_1_uav_buf_names, fi_compute_inpainting_pyramid_pass_1_uav_buf_bind, fi_compute_inpainting_pyramid_pass_1_uav_buf_count, fi_compute_inpainting_pyramid_pass_1_uav_buf_space, 0, 0, 0, 0, 0, 0, 0, 0}, + {(const uint8_t *)fi_inpainting_pass_1_spv, sizeof fi_inpainting_pass_1_spv, 1, 4, 1, 0, 0, 0, 0, fi_inpainting_pass_1_cb_names, fi_inpainting_pass_1_cb_bind, fi_inpainting_pass_1_cb_count, fi_inpainting_pass_1_cb_space, fi_inpainting_pass_1_srv_tex_names, fi_inpainting_pass_1_srv_tex_bind, fi_inpainting_pass_1_srv_tex_count, fi_inpainting_pass_1_srv_tex_space, fi_inpainting_pass_1_uav_tex_names, fi_inpainting_pass_1_uav_tex_bind, fi_inpainting_pass_1_uav_tex_count, fi_inpainting_pass_1_uav_tex_space, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {(const uint8_t *)fi_compute_game_vector_field_inpainting_pyramid_pass_1_spv, sizeof fi_compute_game_vector_field_inpainting_pyramid_pass_1_spv, 2, 2, 12, 0, 1, 0, 0, fi_compute_game_vector_field_inpainting_pyramid_pass_1_cb_names, fi_compute_game_vector_field_inpainting_pyramid_pass_1_cb_bind, fi_compute_game_vector_field_inpainting_pyramid_pass_1_cb_count, fi_compute_game_vector_field_inpainting_pyramid_pass_1_cb_space, fi_compute_game_vector_field_inpainting_pyramid_pass_1_srv_tex_names, fi_compute_game_vector_field_inpainting_pyramid_pass_1_srv_tex_bind, fi_compute_game_vector_field_inpainting_pyramid_pass_1_srv_tex_count, fi_compute_game_vector_field_inpainting_pyramid_pass_1_srv_tex_space, fi_compute_game_vector_field_inpainting_pyramid_pass_1_uav_tex_names, fi_compute_game_vector_field_inpainting_pyramid_pass_1_uav_tex_bind, fi_compute_game_vector_field_inpainting_pyramid_pass_1_uav_tex_count, fi_compute_game_vector_field_inpainting_pyramid_pass_1_uav_tex_space, 0, 0, 0, 0, fi_compute_game_vector_field_inpainting_pyramid_pass_1_uav_buf_names, fi_compute_game_vector_field_inpainting_pyramid_pass_1_uav_buf_bind, fi_compute_game_vector_field_inpainting_pyramid_pass_1_uav_buf_count, fi_compute_game_vector_field_inpainting_pyramid_pass_1_uav_buf_space, 0, 0, 0, 0, 0, 0, 0, 0}, + {(const uint8_t *)fi_debug_view_pass_1_spv, sizeof fi_debug_view_pass_1_spv, 1, 9, 1, 0, 0, 1, 0, fi_debug_view_pass_1_cb_names, fi_debug_view_pass_1_cb_bind, fi_debug_view_pass_1_cb_count, fi_debug_view_pass_1_cb_space, fi_debug_view_pass_1_srv_tex_names, fi_debug_view_pass_1_srv_tex_bind, fi_debug_view_pass_1_srv_tex_count, fi_debug_view_pass_1_srv_tex_space, fi_debug_view_pass_1_uav_tex_names, fi_debug_view_pass_1_uav_tex_bind, fi_debug_view_pass_1_uav_tex_count, fi_debug_view_pass_1_uav_tex_space, 0, 0, 0, 0, 0, 0, 0, 0, fi_debug_view_pass_1_sampler_names, fi_debug_view_pass_1_sampler_bind, fi_debug_view_pass_1_sampler_count, fi_debug_view_pass_1_sampler_space, 0, 0, 0, 0}, + }, +}; +// [FfxOpticalflowPass] +static const FfxShaderBlob ffx_of_blobs[7] = { + {(const uint8_t *)of_prepare_luma_pass_spv, sizeof of_prepare_luma_pass_spv, 1, 1, 1, 0, 0, 0, 0, of_prepare_luma_pass_cb_names, of_prepare_luma_pass_cb_bind, of_prepare_luma_pass_cb_count, of_prepare_luma_pass_cb_space, of_prepare_luma_pass_srv_tex_names, of_prepare_luma_pass_srv_tex_bind, of_prepare_luma_pass_srv_tex_count, of_prepare_luma_pass_srv_tex_space, of_prepare_luma_pass_uav_tex_names, of_prepare_luma_pass_uav_tex_bind, of_prepare_luma_pass_uav_tex_count, of_prepare_luma_pass_uav_tex_space, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {(const uint8_t *)of_compute_luminance_pyramid_pass_spv, sizeof of_compute_luminance_pyramid_pass_spv, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, of_compute_luminance_pyramid_pass_uav_tex_names, of_compute_luminance_pyramid_pass_uav_tex_bind, of_compute_luminance_pyramid_pass_uav_tex_count, of_compute_luminance_pyramid_pass_uav_tex_space, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {(const uint8_t *)of_generate_scd_histogram_pass_spv, sizeof of_generate_scd_histogram_pass_spv, 1, 1, 1, 0, 0, 0, 0, of_generate_scd_histogram_pass_cb_names, of_generate_scd_histogram_pass_cb_bind, of_generate_scd_histogram_pass_cb_count, of_generate_scd_histogram_pass_cb_space, of_generate_scd_histogram_pass_srv_tex_names, of_generate_scd_histogram_pass_srv_tex_bind, of_generate_scd_histogram_pass_srv_tex_count, of_generate_scd_histogram_pass_srv_tex_space, of_generate_scd_histogram_pass_uav_tex_names, of_generate_scd_histogram_pass_uav_tex_bind, of_generate_scd_histogram_pass_uav_tex_count, of_generate_scd_histogram_pass_uav_tex_space, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {(const uint8_t *)of_compute_scd_divergence_pass_spv, sizeof of_compute_scd_divergence_pass_spv, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, of_compute_scd_divergence_pass_uav_tex_names, of_compute_scd_divergence_pass_uav_tex_bind, of_compute_scd_divergence_pass_uav_tex_count, of_compute_scd_divergence_pass_uav_tex_space, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {(const uint8_t *)of_compute_optical_flow_advanced_pass_v5_spv, sizeof of_compute_optical_flow_advanced_pass_v5_spv, 1, 2, 2, 0, 0, 0, 0, of_compute_optical_flow_advanced_pass_v5_cb_names, of_compute_optical_flow_advanced_pass_v5_cb_bind, of_compute_optical_flow_advanced_pass_v5_cb_count, of_compute_optical_flow_advanced_pass_v5_cb_space, of_compute_optical_flow_advanced_pass_v5_srv_tex_names, of_compute_optical_flow_advanced_pass_v5_srv_tex_bind, of_compute_optical_flow_advanced_pass_v5_srv_tex_count, of_compute_optical_flow_advanced_pass_v5_srv_tex_space, of_compute_optical_flow_advanced_pass_v5_uav_tex_names, of_compute_optical_flow_advanced_pass_v5_uav_tex_bind, of_compute_optical_flow_advanced_pass_v5_uav_tex_count, of_compute_optical_flow_advanced_pass_v5_uav_tex_space, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {(const uint8_t *)of_filter_optical_flow_pass_v5_spv, sizeof of_filter_optical_flow_pass_v5_spv, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, of_filter_optical_flow_pass_v5_srv_tex_names, of_filter_optical_flow_pass_v5_srv_tex_bind, of_filter_optical_flow_pass_v5_srv_tex_count, of_filter_optical_flow_pass_v5_srv_tex_space, of_filter_optical_flow_pass_v5_uav_tex_names, of_filter_optical_flow_pass_v5_uav_tex_bind, of_filter_optical_flow_pass_v5_uav_tex_count, of_filter_optical_flow_pass_v5_uav_tex_space, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, + {(const uint8_t *)of_scale_optical_flow_advanced_pass_v5_spv, sizeof of_scale_optical_flow_advanced_pass_v5_spv, 1, 3, 2, 0, 0, 0, 0, of_scale_optical_flow_advanced_pass_v5_cb_names, of_scale_optical_flow_advanced_pass_v5_cb_bind, of_scale_optical_flow_advanced_pass_v5_cb_count, of_scale_optical_flow_advanced_pass_v5_cb_space, of_scale_optical_flow_advanced_pass_v5_srv_tex_names, of_scale_optical_flow_advanced_pass_v5_srv_tex_bind, of_scale_optical_flow_advanced_pass_v5_srv_tex_count, of_scale_optical_flow_advanced_pass_v5_srv_tex_space, of_scale_optical_flow_advanced_pass_v5_uav_tex_names, of_scale_optical_flow_advanced_pass_v5_uav_tex_bind, of_scale_optical_flow_advanced_pass_v5_uav_tex_count, of_scale_optical_flow_advanced_pass_v5_uav_tex_space, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, +}; diff --git a/runtime/ui/menu.cpp b/runtime/ui/menu.cpp index 0895e6df..cb52199b 100644 --- a/runtime/ui/menu.cpp +++ b/runtime/ui/menu.cpp @@ -54,6 +54,8 @@ void vk_queue_unlock(void); int vk_exec_replay_workers(void); void res_sizes(unsigned out[2], unsigned scene[2]); double frame_step_limit_hz(void); +uint64_t gfx_presents_shown(void); // gfx_present.c +int gfx_frame_gen_live(void); // vk_backend.c extern const int rt_game_version; extern const char rt_port_version[]; void cheats_frame(uint64_t frame); // cheats.c @@ -831,6 +833,8 @@ static void row_play_time(void) { static void tab_game(float scale) { opt_begin("##game", scale); row_fps_limit(); + static const UiTextId frame_gen[] = {UI_MENU_FRAME_GEN_OFF, UI_MENU_FRAME_GEN_FSR3}; + opt_choice("TOTK_FRAME_GEN", UI_MENU_FRAME_GEN, frame_gen, 2, UI_MENU_FRAME_GEN_DESC); opt_toggle("TOTK_FRAME_QUEUE", UI_MENU_FRAME_QUEUE, UI_MENU_FRAME_QUEUE_DESC); row_game_lang(); static const UiTextId mode[] = {UI_MENU_MODE_DOCKED, UI_MENU_MODE_HANDHELD}; @@ -1579,6 +1583,24 @@ static uint64_t g_perf_last_ns, g_perf_win_ns, g_perf_max_ns; static int g_perf_frames; static char g_perf_text[96]; +// Frame generation shows more pictures than the game draws (vk_backend.c present_pair): the presents a second over the +// last half second while it runs, else 0. The overlay's frame counts stay the frames the game drew. (PR #1089's +// shown_tick, by xellow78-lgtm.) +static double g_shown_fps; + +static void shown_tick(uint64_t now) { + static uint64_t t0, n0; + uint64_t n = gfx_presents_shown(); + int live = gfx_frame_gen_live(); + if (!live || !t0 || now - t0 > 2000000000ull) { + t0 = now, n0 = n; + if (!live) g_shown_fps = 0; + } else if (now - t0 >= 500000000ull) { + g_shown_fps = (double)(n - n0) * 1e9 / (double)(now - t0); + t0 = now, n0 = n; + } +} + static int perf_mode_of(const char *s) { return !strcmp(s, "full") ? 2 : !strcmp(s, "fps") ? 1 : 0; } extern "C" void menu_perf_cycle(void) { @@ -1624,6 +1646,7 @@ static void perf_tick(uint64_t now, const MenuTarget *t) { } g_perf_mode = m; } + if (g_perf_mode) shown_tick(now); if (g_perf_mode != 1) return; uint64_t d = now - g_perf_last_ns; if (!g_perf_last_ns || d > 2000000000ull) { // first frame, or a stall the window should not average in @@ -1634,7 +1657,9 @@ static void perf_tick(uint64_t now, const MenuTarget *t) { g_perf_frames++; if (d > g_perf_max_ns) g_perf_max_ns = d; if (g_perf_win_ns >= 500000000ull) { - snprintf(g_perf_text, sizeof g_perf_text, menu_text(UI_PERF_LINE_FPS), g_perf_frames * 1e9 / g_perf_win_ns); + double drawn = g_perf_frames * 1e9 / g_perf_win_ns; + if (g_shown_fps > 0) snprintf(g_perf_text, sizeof g_perf_text, menu_text(UI_PERF_LINE_FPS_GEN), drawn, g_shown_fps); + else snprintf(g_perf_text, sizeof g_perf_text, menu_text(UI_PERF_LINE_FPS), drawn); g_perf_win_ns = g_perf_max_ns = 0; g_perf_frames = 0; } @@ -1689,7 +1714,7 @@ static float perf_gb(float mb) { return mb < 0 ? -1 : mb / 1024; } static void perf_picture(const MenuTarget *t, const ImVec4 &c) { unsigned out[2], scene[2]; res_sizes(out, scene); - char v[6][64]; + char v[7][64]; snprintf(v[0], sizeof v[0], menu_text(UI_MENU_OV_FMT_SIZE), t->width, t->height); snprintf(v[1], sizeof v[1], menu_text(UI_MENU_OV_FMT_SIZE), (unsigned)t->image_w, (unsigned)t->image_h); snprintf(v[2], sizeof v[2], menu_text(UI_MENU_OV_FMT_SCENE), scene[0], scene[1], scene[0] * 100.0 / out[0]); @@ -1708,14 +1733,17 @@ static void perf_picture(const MenuTarget *t, const ImVec4 &c) { if (hz > 0) snprintf(v[4], sizeof v[4], menu_text(UI_MENU_OV_FPS), hz); const char *pm = present_name(gfx_window_present_mode()); snprintf(v[5], sizeof v[5], "%s", pm ? pm : menu_text(UI_MENU_OV_NONE)); - static const UiTextId labels[6] = {UI_MENU_OV_WINDOW, UI_MENU_OV_OUTPUT, UI_MENU_OV_SCENE, - UI_MENU_OV_SCALING, UI_MENU_OV_LIMIT, UI_MENU_OV_PRESENT}; + // with frame generation: the pictures shown a second, of which the FPS row above counts the ones the game drew + int n = 6; + if (g_shown_fps > 0) snprintf(v[n++], sizeof v[6], menu_text(UI_MENU_OV_FPS), g_shown_fps); + static const UiTextId labels[7] = {UI_MENU_OV_WINDOW, UI_MENU_OV_OUTPUT, UI_MENU_OV_SCENE, UI_MENU_OV_SCALING, + UI_MENU_OV_LIMIT, UI_MENU_OV_PRESENT, UI_MENU_OV_SHOWN}; if (!ImGui::BeginTable("##perfp", 2, ImGuiTableFlags_SizingFixedFit)) return; float vw = 0; - for (auto &s : v) vw = fmaxf(vw, ImGui::CalcTextSize(s).x); + for (int i = 0; i < n; i++) vw = fmaxf(vw, ImGui::CalcTextSize(v[i]).x); ImGui::TableSetupColumn("##p0", ImGuiTableColumnFlags_WidthStretch); ImGui::TableSetupColumn("##p1", ImGuiTableColumnFlags_WidthFixed, vw); - for (int i = 0; i < 6; i++) { + for (int i = 0; i < n; i++) { perf_label(labels[i], c); ImGui::TableNextColumn(); perf_right(v[i], false); diff --git a/runtime/ui_text.c b/runtime/ui_text.c index 57ff6c65..a3ade981 100644 --- a/runtime/ui_text.c +++ b/runtime/ui_text.c @@ -61,6 +61,7 @@ static const char *const text_en[UI_TEXT_COUNT] = { [UI_MENU_PERF_OFF] = "Off", [UI_MENU_PERF_FPS] = "FPS", [UI_MENU_PERF_FULL] = "Full", // printf format of the overlay line in FPS mode: the frame rate [UI_PERF_LINE_FPS] = "%.0f fps", + [UI_PERF_LINE_FPS_GEN] = "%.0f fps drawn, %.0f shown", [UI_MENU_GRAPHICS] = "Picture", [UI_MENU_OUTPUT_RES] = "Game resolution", [UI_MENU_OUTPUT_RES_DESC] = "The size the game draws its picture and interface in. Above 1920 x 1080 the game needs " @@ -193,6 +194,10 @@ static const char *const text_en[UI_TEXT_COUNT] = { [UI_MENU_FRAME_QUEUE] = "Frame queue", [UI_MENU_FRAME_QUEUE_DESC] = "The game starts a frame while the previous one waits for its turn on screen: far fewer " "dropped frames at the limit, up to one frame more input delay. Applies at once.", + [UI_MENU_FRAME_GEN] = "Frame generation", [UI_MENU_FRAME_GEN_OFF] = "Off", [UI_MENU_FRAME_GEN_FSR3] = "AMD FSR 3", + [UI_MENU_FRAME_GEN_DESC] = "A generated picture between each two the game draws: twice the pictures on screen, the " + "game at half the frame limit and the controls about half a frame later. For displays " + "of 120 Hz and more. Not with DLSS or HDR. Applies at once.", [UI_MENU_REALTIME] = "Game speed follows the clock", [UI_MENU_REALTIME_DESC] = "Steps the game by real time, so a slow frame does not slow the game down.", [UI_MENU_CLOTH_REALTIME] = "Cloth on the clock", @@ -600,7 +605,7 @@ static const char *const text_en[UI_TEXT_COUNT] = { [UI_MENU_OV_FMT_MHZ] = "%.0f MHz", [UI_MENU_OV_FMT_GB] = "%.1f GB", [UI_MENU_OV_FMT_GB_OF] = "/ %.1f GB", [UI_MENU_OV_GAME_GB] = "game %.1f GB", [UI_MENU_OV_FMT_MS] = "%.2f ms", [UI_MENU_OV_PER_FRAME] = "%.1f per frame", [UI_MENU_OV_WINDOW] = "Window", [UI_MENU_OV_OUTPUT] = "Game image", [UI_MENU_OV_SCENE] = "3D scene", - [UI_MENU_OV_SCALING] = "Scaling", [UI_MENU_OV_LIMIT] = "Frame limit", [UI_MENU_OV_PRESENT] = "Presentation", + [UI_MENU_OV_SCALING] = "Scaling", [UI_MENU_OV_LIMIT] = "Frame limit", [UI_MENU_OV_PRESENT] = "Presentation", [UI_MENU_OV_SHOWN] = "Shown", [UI_MENU_OV_FMT_SIZE] = "%ux%u", [UI_MENU_OV_FMT_SCENE] = "%ux%u, %.0f%%", [UI_MENU_OV_FMT_FSR] = "AMD FSR 1, sharpness %d%%", [UI_MENU_OV_SCALE_NONE] = "none (1:1)", [UI_MENU_OV_SCALE_BILINEAR] = "bilinear", @@ -690,6 +695,7 @@ static const char *const text_ru[UI_TEXT_COUNT] = { "режимы.", [UI_MENU_PERF_OFF] = "Выкл.", [UI_MENU_PERF_FPS] = "FPS", [UI_MENU_PERF_FULL] = "Полный", [UI_PERF_LINE_FPS] = "%.0f к/с", + [UI_PERF_LINE_FPS_GEN] = "%.0f к/с отрисовано, %.0f показано", [UI_MENU_GRAPHICS] = "Изображение", [UI_MENU_OUTPUT_RES] = "Разрешение игры", [UI_MENU_OUTPUT_RES_DESC] = "Размер, в котором игра рисует картинку и интерфейс. Выше 1920 × 1080 игре нужно больше " @@ -822,6 +828,10 @@ static const char *const text_ru[UI_TEXT_COUNT] = { [UI_MENU_FRAME_QUEUE] = "Очередь кадров", [UI_MENU_FRAME_QUEUE_DESC] = "Игра начинает кадр, пока предыдущий ждёт показа: намного меньше пропущенных кадров на " "лимите, задержка ввода больше не более чем на кадр. Применяется сразу.", + [UI_MENU_FRAME_GEN] = "Генерация кадров", [UI_MENU_FRAME_GEN_OFF] = "Выкл.", [UI_MENU_FRAME_GEN_FSR3] = "AMD FSR 3", + [UI_MENU_FRAME_GEN_DESC] = "Сгенерированный кадр между каждыми двумя, что рисует игра: на экране вдвое больше " + "кадров, игра идёт на половине лимита, управление отвечает примерно на полкадра позже. " + "Для мониторов от 120 Гц. Не работает с DLSS и HDR. Применяется сразу.", [UI_MENU_REALTIME] = "Скорость игры по часам", [UI_MENU_REALTIME_DESC] = "Игра идёт по реальному времени, медленный кадр её не замедляет.", [UI_MENU_CLOTH_REALTIME] = "Ткань по часам", @@ -1234,7 +1244,7 @@ static const char *const text_ru[UI_TEXT_COUNT] = { [UI_MENU_OV_FMT_MHZ] = "%.0f МГц", [UI_MENU_OV_FMT_GB] = "%.1f ГБ", [UI_MENU_OV_FMT_GB_OF] = "/ %.1f ГБ", [UI_MENU_OV_GAME_GB] = "игра %.1f ГБ", [UI_MENU_OV_FMT_MS] = "%.2f мс", [UI_MENU_OV_PER_FRAME] = "%.1f за кадр", [UI_MENU_OV_WINDOW] = "Окно", [UI_MENU_OV_OUTPUT] = "Изображение игры", [UI_MENU_OV_SCENE] = "3D-сцена", - [UI_MENU_OV_SCALING] = "Масштабирование", [UI_MENU_OV_LIMIT] = "Лимит кадров", [UI_MENU_OV_PRESENT] = "Вывод кадров", + [UI_MENU_OV_SCALING] = "Масштабирование", [UI_MENU_OV_LIMIT] = "Лимит кадров", [UI_MENU_OV_PRESENT] = "Вывод кадров", [UI_MENU_OV_SHOWN] = "Показано", [UI_MENU_OV_FMT_SIZE] = "%ux%u", [UI_MENU_OV_FMT_SCENE] = "%ux%u, %.0f%%", [UI_MENU_OV_FMT_FSR] = "AMD FSR 1, резкость %d%%", [UI_MENU_OV_SCALE_NONE] = "нет (1:1)", [UI_MENU_OV_SCALE_BILINEAR] = "билинейное", @@ -1360,6 +1370,7 @@ static const char *const text_pt_br[UI_TEXT_COUNT] = { "renderização. F10 alterna os modos.", [UI_MENU_PERF_OFF] = "Desligado", [UI_MENU_PERF_FPS] = "FPS", [UI_MENU_PERF_FULL] = "Completo", [UI_PERF_LINE_FPS] = "%.0f fps", + [UI_PERF_LINE_FPS_GEN] = "%.0f fps desenhados, %.0f exibidos", [UI_MENU_GRAPHICS] = "Imagem", [UI_MENU_OUTPUT_RES] = "Resolução do jogo", [UI_MENU_OUTPUT_RES_DESC] = "O tamanho em que o jogo desenha a imagem e a interface. Acima de 1920 x 1080 o jogo " @@ -1407,6 +1418,10 @@ static const char *const text_pt_br[UI_TEXT_COUNT] = { [UI_MENU_FRAME_QUEUE] = "Fila de quadros", [UI_MENU_FRAME_QUEUE_DESC] = "O jogo começa um quadro enquanto o anterior espera a vez de aparecer: muito menos quadros " "perdidos no limite, com até um quadro a mais de atraso na entrada. Vale na hora.", + [UI_MENU_FRAME_GEN] = "Geração de quadros", [UI_MENU_FRAME_GEN_OFF] = "Desligado", [UI_MENU_FRAME_GEN_FSR3] = "AMD FSR 3", + [UI_MENU_FRAME_GEN_DESC] = "Um quadro gerado entre cada dois que o jogo desenha: o dobro de quadros na tela, o " + "jogo na metade do limite e os controles cerca de meio quadro mais tarde. Para telas de " + "120 Hz ou mais. Não funciona com DLSS nem HDR. Vale na hora.", [UI_MENU_REALTIME] = "Velocidade do jogo pelo relógio", [UI_MENU_REALTIME_DESC] = "Avança o jogo pelo tempo real, para que um quadro lento não deixe o jogo mais lento.", [UI_MENU_CLOTH_REALTIME] = "Tecidos pelo relógio", @@ -1684,7 +1699,7 @@ static const char *const text_pt_br[UI_TEXT_COUNT] = { [UI_MENU_OV_FMT_MHZ] = "%.0f MHz", [UI_MENU_OV_FMT_GB] = "%.1f GB", [UI_MENU_OV_FMT_GB_OF] = "/ %.1f GB", [UI_MENU_OV_GAME_GB] = "jogo %.1f GB", [UI_MENU_OV_FMT_MS] = "%.2f ms", [UI_MENU_OV_PER_FRAME] = "%.1f por quadro", [UI_MENU_OV_WINDOW] = "Janela", [UI_MENU_OV_OUTPUT] = "Imagem do jogo", [UI_MENU_OV_SCENE] = "Cena 3D", - [UI_MENU_OV_SCALING] = "Escala", [UI_MENU_OV_LIMIT] = "Limite de quadros", [UI_MENU_OV_PRESENT] = "Apresentação", + [UI_MENU_OV_SCALING] = "Escala", [UI_MENU_OV_LIMIT] = "Limite de quadros", [UI_MENU_OV_PRESENT] = "Apresentação", [UI_MENU_OV_SHOWN] = "Exibidos", [UI_MENU_OV_FMT_SIZE] = "%ux%u", [UI_MENU_OV_FMT_SCENE] = "%ux%u, %.0f%%", [UI_MENU_OV_FMT_FSR] = "AMD FSR 1, nitidez %d%%", [UI_MENU_OV_SCALE_NONE] = "nenhuma (1:1)", [UI_MENU_OV_SCALE_BILINEAR] = "bilinear", @@ -2039,6 +2054,7 @@ static const char *const text_zh_hans[UI_TEXT_COUNT] = { [UI_MENU_PERF_FULL] = "完整", [UI_PERF_LINE_FPS] = "%.0f fps", + [UI_PERF_LINE_FPS_GEN] = "绘制 %.0f fps,显示 %.0f", [UI_MENU_GRAPHICS] = "画面", [UI_MENU_OUTPUT_RES] = "游戏分辨率", @@ -2108,6 +2124,8 @@ static const char *const text_zh_hans[UI_TEXT_COUNT] = { [UI_MENU_FPS_DISPLAY_HZ] = "显示器刷新率(%.0f Hz)", [UI_MENU_FRAME_QUEUE] = "帧队列", [UI_MENU_FRAME_QUEUE_DESC] = "前一帧等待显示时游戏就开始绘制下一帧:在帧率上限下掉帧大幅减少,输入延迟最多增加一帧。立即生效。", + [UI_MENU_FRAME_GEN] = "帧生成", [UI_MENU_FRAME_GEN_OFF] = "关", [UI_MENU_FRAME_GEN_FSR3] = "AMD FSR 3", + [UI_MENU_FRAME_GEN_DESC] = "在游戏绘制的每两帧之间插入一帧生成画面:屏幕上的帧数翻倍,游戏以帧率上限的一半运行,操作响应约晚半帧。适合 120 Hz 及以上的显示器。不能与 DLSS 或 HDR 同时使用。立即生效。", [UI_MENU_REALTIME] = "游戏速度跟随时钟", [UI_MENU_REALTIME_DESC] = "按真实时间推进游戏,帧率低时游戏速度也不会变慢。", [UI_MENU_CLOTH_REALTIME] = "布料跟随时钟", @@ -2489,6 +2507,7 @@ static const char *const text_zh_hans[UI_TEXT_COUNT] = { [UI_MENU_OV_SCALING] = "缩放", [UI_MENU_OV_LIMIT] = "帧率上限", [UI_MENU_OV_PRESENT] = "呈现模式", + [UI_MENU_OV_SHOWN] = "显示帧率", [UI_MENU_OV_FMT_SIZE] = "%ux%u", [UI_MENU_OV_FMT_SCENE] = "%ux%u,%.0f%%", [UI_MENU_OV_FMT_FSR] = "AMD FSR 1,锐度 %d%%", diff --git a/runtime/ui_text.h b/runtime/ui_text.h index f4a1b355..09cabce1 100644 --- a/runtime/ui_text.h +++ b/runtime/ui_text.h @@ -32,6 +32,7 @@ typedef enum { UI_MENU_GPU, UI_MENU_GPU_DESC, UI_MENU_GPU_AUTO, UI_MENU_PERF_OVERLAY, UI_MENU_PERF_OVERLAY_DESC, UI_MENU_PERF_OFF, UI_MENU_PERF_FPS, UI_MENU_PERF_FULL, UI_PERF_LINE_FPS, + UI_PERF_LINE_FPS_GEN, // "%.0f fps drawn, %.0f shown": frame generation on UI_MENU_GRAPHICS, // group heading over the resolution rows UI_MENU_OUTPUT_RES, UI_MENU_OUTPUT_RES_DESC, UI_MENU_HUD_WIDTH, UI_MENU_HUD_WIDTH_DESC, UI_MENU_HUD_WIDTH_FULL, @@ -69,6 +70,7 @@ typedef enum { UI_MENU_FPS_120, UI_MENU_FPS_144, UI_MENU_FPS_DISPLAY, UI_MENU_FPS_DISPLAY_HZ, UI_MENU_FRAME_QUEUE, UI_MENU_FRAME_QUEUE_DESC, + UI_MENU_FRAME_GEN, UI_MENU_FRAME_GEN_OFF, UI_MENU_FRAME_GEN_FSR3, UI_MENU_FRAME_GEN_DESC, UI_MENU_REALTIME, UI_MENU_REALTIME_DESC, UI_MENU_CLOTH_REALTIME, UI_MENU_CLOTH_REALTIME_DESC, UI_MENU_HIGHFPS_FIX, UI_MENU_HIGHFPS_FIX_DESC, @@ -284,6 +286,7 @@ typedef enum { UI_MENU_OV_FMT_GB_OF, UI_MENU_OV_GAME_GB, UI_MENU_OV_FMT_MS, UI_MENU_OV_PER_FRAME, // the picture lines: window, game image and 3D scene sizes, the scaling to the window, frame limit and presentation UI_MENU_OV_WINDOW, UI_MENU_OV_OUTPUT, UI_MENU_OV_SCENE, UI_MENU_OV_SCALING, UI_MENU_OV_LIMIT, UI_MENU_OV_PRESENT, + UI_MENU_OV_SHOWN, // frame generation: the pictures shown a second UI_MENU_OV_FMT_SIZE, // "%ux%u" UI_MENU_OV_FMT_SCENE, // "%ux%u, %.0f%%": the scene and its share of the game image's width UI_MENU_OV_FMT_FSR, // "AMD FSR 1, sharpness %d%%" diff --git a/runtime/vk.h b/runtime/vk.h index 25913c93..2ad113f9 100644 --- a/runtime/vk.h +++ b/runtime/vk.h @@ -143,6 +143,9 @@ void vk_present_image(VkImage src, VkImageLayout layout, VkFormat fmt, int w, in // vk_present_image split in two: vk_present_blit submits the blit and leaves the present waiting, vk_present_flip // queues it. The next blit or a swapchain rebuild queues a waiting present first. void vk_present_blit(VkImage src, VkImageLayout layout, VkFormat fmt, int w, int h, const int crop[4]); +// Frame generation's pair: the blit of gen (RGBA8, GENERAL, the size of src), then of src, both left waiting, oldest +// first; each vk_present_flip presents one. 0: gen was not blitted (src went alone, one flip). +int vk_present_blit_pair(VkImage gen, VkImage src, VkFormat fmt, int w, int h, const int crop[4]); // FSR 1 on the present (vk_fsr.c): records EASU (+ RCAS) of src's crop rectangle {x, y, w, h} into the rectangle out // {x, y, w, h} of dst, a swapchain image in TRANSFER_DST; src is in GENERAL and fmt its format. 0 = nothing recorded // (the setting says bilinear, no upscale is needed, or FSR is not available): the caller blits. diff --git a/runtime/vk_backend.c b/runtime/vk_backend.c index 7a418463..64b61ed2 100644 --- a/runtime/vk_backend.c +++ b/runtime/vk_backend.c @@ -11,12 +11,25 @@ // the frame's display time from the pacer (nvn_api_obj.c), so present-to-present intervals stay even whatever the // replay took. The blit is already on the queue, so the wait blocks no submission. // +// Frame generation (vk_fg.cpp, frame_gen = fsr3): a frame that comes with a generated picture (the one between the +// last frame and this) is presented as a pair, both blits submitted at once (present_pair). The display shows a +// picture when the GPU has drawn it, not when the CPU hands it over, and both pictures of a pair are drawn within a +// millisecond of each other: spaced by the CPU clock alone they went on screen together and then left a gap (Savage +// Wind on FIFO and G-SYNC). So each present waits on the timeline until the GPU is done: the generated picture once +// the frame is drawn (and not before the pacer's display time), the game's half the smoothed interval between +// generated pictures after it, as AMD's frame interpolation swapchain and Savage Wind's present_wait_turn do. The game +// draws at half the frame limit meanwhile (frame_rate.c frame_step_cap_ns, gfx_frame_gen_live). The spacing is ported +// from Savage Wind (https://github.com/Revivedx/SavageWindRecomp @ bf6146c14c37fee8781a601e5a544b93dff6d75e, MIT, +// Copyright (c) 2026 Revivedx and the Savage Wind Recomp contributors, Copyright (c) 2026 Peiikai), +// runtime/nvn/vulkan/device.c present_wait_turn. +// // Asynchronous replay (TOTK_REPLAY_ASYNC, default 0; 1 turns it on): nvnQueueSubmitCommands // and nvnQueuePresentTexture only queue. Each item gets its timeline value at enqueue (vk_sync_reserve), in queue // order; the replay thread runs the synchronous submit and present bodies in that order, so every value is signalled // by the submission it was handed out for. The game runs at most one frame ahead: queueing present N waits until the // replay thread handled present N-1. Calls that read or free GPU state that queued work may use drain the queue first // (replay_drain), each cause counted. +#include #include #include #include @@ -30,10 +43,11 @@ #include "vk_exec.h" #include "platform/platform.h" #include "vk_dlaa.h" +#include "vk_fg.h" #define WEAK __attribute__((weak)) -typedef struct { VkImage image; VkFormat format; int w, h, has_crop, crop[4]; uint64_t frame, at, queued, value, pid; } PresentJob; // pid: the frame's present ID (vk_reflex_frame) +typedef struct { VkImage image, gen; VkFormat format; int w, h, has_crop, crop[4]; uint64_t frame, at, queued, value, pid; } PresentJob; // pid: the frame's present ID (vk_reflex_frame); gen: its generated picture (vk_fg_present_gen) static PlatMutex pl = PLAT_MUTEX_INIT; static PlatCond pcv = PLAT_COND_INIT; // job queued, job taken, job submitted @@ -47,6 +61,114 @@ static void wait_until(uint64_t at) { while (kern_now_ns() < at) plat_yield(); } +// ---- Frame generation's presents (present thread only) +static volatile int32_t fg_live; // the last frame went out with a generated picture before it (gfx_frame_gen_live) +int gfx_frame_gen_live(void) { return __atomic_load_n(&fg_live, __ATOMIC_RELAXED); } + +// Present intervals in the world while frame generation is on, logged every FS_EVERY presents and over the run: all of them, from +// a generated picture to the game's frame after it, and from the game's frame to the next generated picture. +// Fixed-size histograms of 0.05 ms bins (bounded whatever the session's length). +#define FS_BINS 2000 +#define FS_BIN_MS 0.05 +#define FS_EVERY 2400 +enum { FS_ALL, FS_GEN_REAL, FS_REAL_GEN, FS_N }; +typedef struct { + uint32_t hist[FS_N][FS_BINS]; + double sum[FS_N], sq[FS_N]; + uint64_t n[FS_N]; + uint64_t pairs, alone, t0, t1; // frames presented as a pair and alone, the window's first and last present + double gpu_wait, late; // ms: waited for the GPU before the generated picture; the game's frame past its time +} FgStats; +static FgStats fs_win, fs_run; +static uint64_t fs_last, fs_last_gen; // the last present (0 after a gap) and the last generated one +static double fs_iv; // ns between generated pictures, smoothed (factor 0.1, Savage Wind's) + +static void fs_add(FgStats *s, int k, double ms) { + unsigned b = ms <= 0 ? 0 : ms / FS_BIN_MS >= FS_BINS ? FS_BINS - 1 : (unsigned)(ms / FS_BIN_MS); + s->hist[k][b]++, s->sum[k] += ms, s->sq[k] += ms * ms, s->n[k]++; +} + +static double fs_p99(const FgStats *s, int k) { + uint64_t want = s->n[k] - s->n[k] / 100, got = 0; + for (unsigned b = 0; b < FS_BINS; b++) + if ((got += s->hist[k][b]) >= want) return (b + 1) * FS_BIN_MS; + return FS_BINS * FS_BIN_MS; +} + +static void fs_log(const FgStats *s, const char *what) { + if (!s->n[FS_ALL] || s->t1 <= s->t0) return; + double wall = (s->t1 - s->t0) / 1e9, m[FS_N], sd[FS_N]; + for (int k = 0; k < FS_N; k++) { + m[k] = s->n[k] ? s->sum[k] / s->n[k] : 0; + double v = s->n[k] ? s->sq[k] / s->n[k] - m[k] * m[k] : 0; + sd[k] = v > 0 ? sqrt(v) : 0; + } + rt_log("fg present %s: %.1f fps shown, %.1f drawn (%llu frames as pairs, %llu alone) over %.1f s; intervals mean %.3f " + "sd %.3f p99 %.2f ms; generated to game's %.3f sd %.3f, game's to generated %.3f sd %.3f; waited for the GPU " + "%.3f ms a pair, game's frame late %.3f ms a pair (means)", what, (s->n[FS_ALL] + 1) / wall, + (s->pairs + s->alone) / wall, (unsigned long long)s->pairs, (unsigned long long)s->alone, wall, m[FS_ALL], + sd[FS_ALL], fs_p99(s, FS_ALL), m[FS_GEN_REAL], sd[FS_GEN_REAL], m[FS_REAL_GEN], sd[FS_REAL_GEN], + s->pairs ? s->gpu_wait / s->pairs : 0, s->pairs ? s->late / s->pairs : 0); +} + +// A present at now of kind k (FS_GEN_REAL: the game's frame after a generated picture; FS_REAL_GEN: a generated +// picture; FS_ALL: a frame alone) +static void fs_present(uint64_t now, int k) { + if (!vk_fg_active()) return; + if (frame_step_world_us() <= 0) { // (the title screen and the first load: not counted) + fs_last = 0; + return; + } + FgStats *both[2] = {&fs_win, &fs_run}; + for (int i = 0; i < 2; i++) { + FgStats *s = both[i]; + if (!s->t0) s->t0 = now; + if (fs_last && now - fs_last < 100000000ull) { // (a gap: a load, a menu's hitch) + double ms = (now - fs_last) / 1e6; + fs_add(s, FS_ALL, ms); + if (k != FS_ALL) fs_add(s, k, ms); + } + s->t1 = now; + s->pairs += k == FS_GEN_REAL, s->alone += k == FS_ALL; + } + fs_last = now; + if (fs_win.n[FS_ALL] >= FS_EVERY) { + fs_log(&fs_win, "last presents"); + memset(&fs_win, 0, sizeof fs_win); + } +} + +static void gpu_wait(uint64_t value) { + VkCtx *c = vk_ctx(); + VkSemaphoreWaitInfo wi = {.sType = VK_STRUCTURE_TYPE_SEMAPHORE_WAIT_INFO, .semaphoreCount = 1, + .pSemaphores = &c->timeline, .pValues = &value}; + vkWaitSemaphores(c->device, &wi, 1000000000ull); // (drawn; a second at most) +} + +// The pair's two presents (both blits submitted): the generated picture once the GPU has drawn the frame (gpu: its +// last submission's value) and the pacer's time has come, the game's frame once its blit is drawn (f) and half the +// smoothed interval between generated pictures has passed. +static void present_pair(const PresentJob *j, uint64_t gpu, uint64_t f) { + uint64_t t0 = kern_now_ns(); + gpu_wait(gpu); + uint64_t t1 = kern_now_ns(); + wait_until(j->at); + uint64_t now = kern_now_ns(); + double dt = fs_last_gen ? (double)(now - fs_last_gen) : 0; + if (dt > 0 && dt < 1e8) fs_iv = fs_iv > 0 ? fs_iv + (dt - fs_iv) * 0.1 : dt; + fs_last_gen = now; + fs_present(now, FS_REAL_GEN); + vk_present_flip(); + gpu_wait(f); + uint64_t at = now + (uint64_t)(fs_iv / 2); + if (fs_iv > 0) wait_until(at); + uint64_t t2 = kern_now_ns(); + fs_present(t2, FS_GEN_REAL); + vk_present_flip(); + fs_win.gpu_wait += (t1 - t0) / 1e6, fs_run.gpu_wait += (t1 - t0) / 1e6; + if (fs_iv > 0 && t2 > at) fs_win.late += (t2 - at) / 1e6, fs_run.late += (t2 - at) / 1e6; +} + static void present_main(void *arg) { (void)arg; perf_core_thread(PCORE_PRESENT); @@ -62,7 +184,10 @@ static void present_main(void *arg) { if (flight_on) vk_thumbs_frame(j.frame); vk_reflex_present_frame(j.pid); // the present of this blit, and the submission after it, are the frame's vk_reflex_submit_frame(j.pid); - vk_present_blit(j.image, VK_IMAGE_LAYOUT_GENERAL, j.format, j.w, j.h, j.has_crop ? j.crop : NULL); + // the frame's last submission, its interpolation included: no submission goes out while busy + uint64_t drawn = j.gen ? vk_sync_issued() : 0; + int pair = j.gen && vk_present_blit_pair(j.gen, j.image, j.format, j.w, j.h, j.has_crop ? j.crop : NULL); + if (!j.gen) vk_present_blit(j.image, VK_IMAGE_LAYOUT_GENERAL, j.format, j.w, j.h, j.has_crop ? j.crop : NULL); uint64_t f = vk_sync_submit(NULL, 0); // a timeline value after the blit: deferred destruction waits for the blit too if (j.value && f != j.value) rt_fatal("vk: the present of frame %llu signalled %llu, queued as %llu", (unsigned long long)j.frame, @@ -72,9 +197,15 @@ static void present_main(void *arg) { plat_cond_broadcast(&pcv); plat_mutex_unlock(&pl); uint64_t t0 = kern_now_ns(); - wait_until(j.at); + if (pair) { + present_pair(&j, drawn, f); + } else { + wait_until(j.at); + fs_last_gen = 0; // (the next generated picture starts the spacing anew) + fs_present(kern_now_ns(), FS_ALL); + } uint64_t t1 = kern_now_ns(); - vk_present_flip(); + if (!pair) vk_present_flip(); // TOTK_TRACE=present: one line per present: the host present's interval, the interval of the game's present // calls (when the host present went out before back-edge pacing), the wait and how far past its target it went if (rt_trace & RT_TRACE_PRESENT) @@ -124,6 +255,10 @@ static void present_image(const tex_t *t, const int crop[4], uint64_t at_ns, uin PresentJob j = {.image = img->image, .format = img->format, .w = (int)img->width, .h = (int)img->height, .frame = frame, .at = at_ns, .queued = queued, .value = value, .pid = pid}; vk_hdr_present_source(img, &j.image, &j.format); // TOTK_HDR: the float picture the game copied into it, same size + vk_fg_present_swap(&j.image, &j.format); // TOTK_FG_TEST (frame generation checks): another picture in its place + j.gen = vk_fg_present_gen(j.image); + if (__atomic_load_n(&fg_live, __ATOMIC_RELAXED) != (j.gen != VK_NULL_HANDLE)) + __atomic_store_n(&fg_live, j.gen != VK_NULL_HANDLE, __ATOMIC_RELAXED); if (crop) { j.has_crop = 1; for (int i = 0; i < 4; i++) j.crop[i] = crop[i]; @@ -338,6 +473,9 @@ static void replay_log(uint64_t frame, int total) { void gfx_exit_log(void) { static int32_t done; rec_check_log(); + vk_fg_exit_log(); + static int32_t fs_done; + if (!plat_xchg32(&fs_done, 1)) fs_log(&fs_run, "over the run"); vk_texture_eager_log(); vk_mem_shadow_read_log(); if (gfx_replay_async() && r_started && !plat_xchg32(&done, 1)) replay_log(game_frames, 1); diff --git a/runtime/vk_device.c b/runtime/vk_device.c index 549b9f5a..e4fbf247 100644 --- a/runtime/vk_device.c +++ b/runtime/vk_device.c @@ -12,6 +12,7 @@ #include "vk.h" #include "platform/platform.h" #include "vk_dlaa.h" +#include "vk_fg.h" static VkCtx g_vk; static int g_ready; @@ -482,6 +483,7 @@ static long g_errors_total; // outlives the device so the probe can print it static void destroy_all(void) { gfx_window_release_vk(); if (g_vk.device) vkDeviceWaitIdle(g_vk.device); + if (g_vk.device) vk_fg_release(); if (g_vk.device) vk_astc_release(); if (g_vk.device) vk_deswz_release(); if (g_vk.device) vk_crumbs_release(); @@ -507,7 +509,7 @@ int vk_init(void) { if (!g_ready) { memset(&g_vk, 0, sizeof g_vk); if (create_instance() && pick_device() && create_device()) - g_ready = 1, vk_mem_host_probe(), vk_upload_pools_init(), vk_headroom_start(), vk_dlaa_init(); + g_ready = 1, vk_mem_host_probe(), vk_upload_pools_init(), vk_headroom_start(), vk_dlaa_init(), vk_fg_init(); else destroy_all(); } int ok = g_ready; diff --git a/runtime/vk_dlaa.c b/runtime/vk_dlaa.c index fd4c04e3..0cbd39b1 100644 --- a/runtime/vk_dlaa.c +++ b/runtime/vk_dlaa.c @@ -22,7 +22,10 @@ #include "platform/platform.h" #include "vk.h" #include "vk_dlaa.h" +#include "input.h" +#include "nvn_api.h" #include "vk_exec.h" +#include "vk_fg.h" #include "vk_rec.h" #include "dlaa_mv_spv.h" @@ -301,6 +304,15 @@ static struct { int ids_ok; unsigned cfg_seen; // cfg_version when preset was read uint64_t last_eval_ns; // plat_now_ns of the previous evaluation (FrameTimeDeltaInMsec) + // frame generation with DLSS off (vk_fg.cpp): the scene is followed for it alone ("frame generation" below) + int fg; // frame generation follows the scene this frame (vk_fg_wanted), read at each present + int bloom; // this frame: the bloom chain began after the scene ended + int hud, hud_wait, fin, gen; // this frame: the picture before the HUD was taken / hud_t is the scaling pass's + // target and its scaling draw came / the copy into the window texture came / the + // generation ran (vk_dlaa_sub_end) + VkExecTarget hud_t, win; // the output-sized target the scene is scaled into; the window texture + float cam_dr[2]; // the viewport depth range of the draw cam_addr was noted at + int fg_mv_ok; // the frame's motion is in the motion image (fg_motion) } D = {.mv_ok = -1, .cfg_seen = ~0u}; #define DLSS_SIZES (sizeof D.sizes / sizeof D.sizes[0]) @@ -308,6 +320,26 @@ const VkTexImage *vk_dlaa_swap_img; VkImageView vk_dlaa_swap_view; static int dl_active(void) { return N.available && !D.failed && D.on; } +// The scene is followed (its G-buffer, light target, end and camera): for DLSS, or with DLSS off for frame generation. +static int track(void) { return dl_active() || D.fg; } +int vk_dlaa_fg_on; // D.fg for vk_exec_draw.c's per-draw test (vk_dlaa_hud) + +// TOTK_FG_OBJECTS (default 1, read once): frame generation's motion image gets the per-object pass over the camera's, +// as DLSS's does. The camera follows Link, so with the camera's motion alone his pixels carry the world's motion and +// the interpolation drew him twice (a soft second outline) and left a trail where he had been. 0 keeps the camera's +// motion alone (stage 2's vectors), for comparisons. +static int fg_objects(void) { + static int on = -1; + if (on < 0) on = rt_knob("FG_OBJECTS", "1"); + return on; +} + +int vk_fg_objects_on(void) { return D.fg && fg_objects(); } + +// The per-object motion's gates (vk_mvprev.c's tables, vk_usnap.c's host copy, vk_exec_draw.c's lock): DLSS once NGX +// came up with it, exactly as vk_dlaa_available, or frame generation following the scene with its objects. Frame +// generation is off with DLSS, so the second term is 0 whenever DLSS runs. +int vk_objmv_wanted(void) { return vk_dlaa_available() || vk_fg_objects_on(); } static void dl_fail(const char *what, NgxResult r) { rt_log("dlaa: %s failed (%08x): DLAA off for this run", what, (unsigned)r); @@ -350,29 +382,11 @@ static void free_size(struct Size *e) { // the target) and motion vectors (RG16F at the scene size, render pixels), both kept in GENERAL like every image of the // back end. TotK's dynamic resolution switches between a few sizes; each keeps its feature, the least recently used // goes for a new one. -static struct Size *size_for(VkCommandBuffer cb, uint32_t w, uint32_t h, uint32_t ow, uint32_t oh) { - struct Size *e = NULL, *lru = &D.sizes[0]; - for (int i = 0; i < 5; i++) { - if (D.sizes[i].w == w && D.sizes[i].h == h && D.sizes[i].ow == ow && D.sizes[i].oh == oh) return &D.sizes[i]; - if (!D.sizes[i].out && !e) e = &D.sizes[i]; - if (D.sizes[i].used < lru->used) lru = &D.sizes[i]; - } - if (!e) { - if (D.last == lru) D.last = NULL; - free_size(e = lru); - } - VkImageUsageFlags u = VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT | - VK_IMAGE_USAGE_TRANSFER_DST_BIT; - VkImageUsageFlags u8 = VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_SAMPLED_BIT; - if (!image2d(ow, oh, VK_FORMAT_R16G16B16A16_SFLOAT, u, &e->out, &e->out_mem, &e->out_view) || - !image2d(w, h, VK_FORMAT_R16G16_SFLOAT, u | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, &e->mv, &e->mv_mem, &e->mv_view) || - !image2d(w, h, VK_FORMAT_R8_UNORM, u8, &e->mask, &e->mask_mem, &e->mask_view) || - !image2d(w, h, VK_FORMAT_R8_UNORM, u8, &e->chars[0], &e->chars_mem[0], &e->chars_view[0]) || - !image2d(w, h, VK_FORMAT_R8_UNORM, u8, &e->chars[1], &e->chars_mem[1], &e->chars_view[1])) - return NULL; +// An entry is taken once it has its motion image. out: DLSS will write the output image; frame generation without DLSS +// (fg_motion) needs none, and an entry it made gets one when DLSS first runs at that size. +static void to_general(VkCommandBuffer cb, const VkImage *im, uint32_t n) { VkImageMemoryBarrier2 ib[5]; - VkImage im[5] = {e->out, e->mv, e->mask, e->chars[0], e->chars[1]}; - for (int i = 0; i < 5; i++) + for (uint32_t i = 0; i < n; i++) ib[i] = (VkImageMemoryBarrier2){.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER_2, .srcStageMask = VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT, .dstStageMask = VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT, @@ -381,9 +395,42 @@ static struct Size *size_for(VkCommandBuffer cb, uint32_t w, uint32_t h, uint32_ .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, .image = im[i], .subresourceRange = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}}; - VkDependencyInfo di = {.sType = VK_STRUCTURE_TYPE_DEPENDENCY_INFO, .imageMemoryBarrierCount = 5, + VkDependencyInfo di = {.sType = VK_STRUCTURE_TYPE_DEPENDENCY_INFO, .imageMemoryBarrierCount = n, .pImageMemoryBarriers = ib}; vkCmdPipelineBarrier2(cb, &di); +} + +static struct Size *size_for(VkCommandBuffer cb, uint32_t w, uint32_t h, uint32_t ow, uint32_t oh, int out) { + VkImageUsageFlags u = VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT | + VK_IMAGE_USAGE_TRANSFER_DST_BIT; + VkImageUsageFlags u8 = VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_SAMPLED_BIT; + struct Size *e = NULL, *lru = &D.sizes[0]; + for (size_t i = 0; i < DLSS_SIZES; i++) { + struct Size *z = &D.sizes[i]; + if (z->mv && z->w == w && z->h == h && z->ow == ow && z->oh == oh) { + if (out && !z->out) { + if (!image2d(ow, oh, VK_FORMAT_R16G16B16A16_SFLOAT, u, &z->out, &z->out_mem, &z->out_view)) return NULL; + to_general(cb, &z->out, 1); + } + return z; + } + if (!z->mv && !e) e = z; + if (z->used < lru->used) lru = z; + } + if (!e) { + if (D.last == lru) D.last = NULL; + free_size(e = lru); + } + if ((out && !image2d(ow, oh, VK_FORMAT_R16G16B16A16_SFLOAT, u, &e->out, &e->out_mem, &e->out_view)) || + !image2d(w, h, VK_FORMAT_R16G16_SFLOAT, u | VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, &e->mv, &e->mv_mem, &e->mv_view) || + !image2d(w, h, VK_FORMAT_R8_UNORM, u8, &e->mask, &e->mask_mem, &e->mask_view) || + !image2d(w, h, VK_FORMAT_R8_UNORM, u8, &e->chars[0], &e->chars_mem[0], &e->chars_view[0]) || + !image2d(w, h, VK_FORMAT_R8_UNORM, u8, &e->chars[1], &e->chars_mem[1], &e->chars_view[1])) { + free_size(e); // the slot is free again, not an entry without its images + return NULL; + } + VkImage im[5] = {e->mv, e->mask, e->chars[0], e->chars[1], e->out}; + to_general(cb, im, out ? 5 : 4); e->w = w, e->h = h, e->ow = ow, e->oh = oh; return e; } @@ -567,9 +614,10 @@ static int inv4(const double m[16], double o[16]) { } // The pass, recorded through the recorder like the replay's own commands. 0: no camera this frame (the vectors stay -// zero and DLSS starts a new history). bias > 0 with this frame's G-buffer classes (D.ids) also writes e->mask, the -// bias mask (dlaa_mv.comp); *masked says whether it did. -static int mv_pass(VkExec *ex, struct Size *e, VkImageView zv, float jx, float jy, float bias, int *masked) { +// zero and DLSS starts a new history). objects: the per-object pass and the TOTK_MV_CHECK hooks after the camera's +// (DLSS, and frame generation unless TOTK_FG_OBJECTS=0). bias > 0 with this frame's G-buffer classes (D.ids) also +// writes e->mask, the bias mask (dlaa_mv.comp); *masked says whether it did. +static int mv_pass(VkExec *ex, struct Size *e, VkImageView zv, float jx, float jy, float bias, int *masked, int objects) { *masked = 0; VkCommandBuffer cb = ex->cb; uint32_t w = e->w, h = e->h; @@ -660,6 +708,11 @@ static int mv_pass(VkExec *ex, struct Size *e, VkImageView zv, float jx, float j vkCmdDispatch(cb, (w + 7) / 8, (h + 7) / 8, 1); full_barrier(cb); times_mark(cb, T_MV1); + if (!objects) { + D.mv_frames++; + e->chars_ok = 0; + return 1; + } vk_mvcheck_camera(cb, e->mv, w, h, jx, jy); // TOTK_MV_CHECK (test) // the characters' own motion over the camera's (vk_exec_draw.c, per-object motion) uint64_t c0 = T.on > 0 ? kern_now_ns() : 0; @@ -687,7 +740,7 @@ static int mv_pass(VkExec *ex, struct Size *e, VkImageView zv, float jx, float j // Last frame's camera block for the per-object motion pass, recorded before this frame's mv_pass: that pass writes // this frame's into slot cam_slot and leaves the other slot, last frame's, as it is. 0: none (no history). int vk_dlaa_prev_camera(VkDescriptorBufferInfo *out, float jitter[2]) { - if (!dl_active() || !D.cam_prev_ok || !D.camb) return 0; + if (!track() || !D.cam_prev_ok || !D.camb) return 0; // DLSS, or frame generation (no jitter: D.jit_* stay 0) *out = (VkDescriptorBufferInfo){D.camb, (VkDeviceSize)(D.cam_slot ^ 1) * CAM_SLOT, CAM_BLOCK}; if (cam_mode()) jitter[0] = D.jit_used ? D.ux : 0.0f, jitter[1] = D.jit_used ? D.uy : 0.0f; else jitter[0] = D.jit_ok ? D.jx : 0.0f, jitter[1] = D.jit_ok ? D.jy : 0.0f; @@ -891,11 +944,12 @@ static void note_camera(const VkExec *ex) { __atomic_store_n(&D.jit_used, j, __ATOMIC_RELAXED); } D.cam_addr = b->addr; + D.cam_dr[0] = ex->depth_range[0], D.cam_dr[1] = ex->depth_range[1]; } } void vk_dlaa_draw(VkExec *ex) { - if (!dl_active() || ended_at(ex)) return; + if (!track() || ended_at(ex)) return; static int survey = -1; // TOTK_DLAA_SURVEY=1 (test): what is drawn into the armed light target if (survey < 0) survey = rt_knob("DLAA_SURVEY", "0"); static uint64_t dfn[16]; // scene draws writing depth, by depth test (reversed depth: GREATER/GEQUAL) @@ -930,7 +984,7 @@ void vk_dlaa_draw(VkExec *ex) { } void vk_dlaa_scan_draw(const VkExec *ex) { - if (dl_active() && !D.ended) note_camera(ex); + if (track() && !D.ended) note_camera(ex); } // The jitter moves on right after DLAA ran, not at the present: the replay can record the next frame's scene before @@ -1006,7 +1060,21 @@ static int in_list(const uint64_t *l, int n, uint64_t a) { return 0; } -void vk_dlaa_game_present(void) { __atomic_add_fetch(&CJ.presents, 1, __ATOMIC_RELEASE); } +void vk_dlaa_game_present(void) { + __atomic_add_fetch(&CJ.presents, 1, __ATOMIC_RELEASE); + // frame generation stops while a menu's background (the map, the pause menu; AppMap_00 is open all through play: + // the minimap) or a loading or event fade is up (the game's screens, read on its thread); + // the frame after it starts without history + if (!vk_fg_active()) return; + static const char *const ui[] = {"AppMenuBG_00", "LoadingFade_00", "EventFade_00"}; + static int last = -1; + int m = 0; + for (int i = 0; i < 3; i++) m |= menu_ui_open(ui[i]) << i; + if (m != last) rt_log("fg: screens open: %s%s%s%s", m & 1 ? "menu background (map, pause menu) " : "", m & 2 ? "loading fade " : "", + m & 4 ? "event fade" : "", m ? "" : "none (frame generation may run)"); + last = m; + vk_fg_menu(m != 0); +} // The game's thread, after a 64-byte memcpy: lr is the copy's return address into the game, dst where it copied to, off // the member's offset in the block. f_70000e31d4 takes each offset from the shader's layout of the block (x8 at both @@ -1203,10 +1271,10 @@ static void evaluate(VkExec *ex, const VkExecTarget *dst) { vk_exec_barrier(ex); // what drew the scene is done (no pass is open here) if (D.preset_dirty) { // another model: features are created with it, so every size gets a new one for (size_t i = 0; i < DLSS_SIZES; i++) - if (D.sizes[i].out) free_size(&D.sizes[i]); + if (D.sizes[i].mv) free_size(&D.sizes[i]); D.last = NULL, D.preset_dirty = 0; } - struct Size *e = size_for(cb, w, h, ow, oh); + struct Size *e = size_for(cb, w, h, ow, oh, 1); if (!e) return dl_fail("work image creation", 0); if (e != D.last) D.reset = 1, D.why[0]++, e->chars_ok = 0; // another size's history is from another moment if (!D.params && !NGX_OK(N.alloc_params(&D.params))) return dl_fail("parameter allocation", 0); @@ -1217,7 +1285,7 @@ static void evaluate(VkExec *ex, const VkExecTarget *dst) { static int no_mv = -1; if (no_mv < 0) no_mv = !rt_knob("DLAA_MV", "1"); // TOTK_DLAA_MV=0: zero motion (test) int masked = 0; - if (no_mv || !mv_pass(ex, e, zv, jx, jy, char_bias(), &masked)) { + if (no_mv || !mv_pass(ex, e, zv, jx, jy, char_bias(), &masked, 1)) { VkClearColorValue zero = {{0, 0, 0, 0}}; VkImageSubresourceRange all = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}; vkCmdClearColorImage(cb, e->mv, VK_IMAGE_LAYOUT_GENERAL, &zero, 1, &all); @@ -1440,7 +1508,11 @@ static void fx_watch(const VkExec *ex) { int vk_dlaa_plan(const VkExec *ex, VkExecJob *j) { const VkExecTarget *c = &ex->color[0], *z = &ex->depth; if (D.fx_open && dl_active()) fx_watch(ex); - if (!dl_active() || D.done) return 0; + // frame generation's picture before the HUD comes after the bloom chain (vk_dlaa_hud): with DLAA before the effects + // the scene ends earlier, and the volumetric fog's composite, a full-screen pass without depth into the light + // target, would pass for the HUD's first + if (D.fg && D.armed && D.ended && !D.bloom && bloom_start(ex, D.color.width)) D.bloom = 1; + if (!track() || D.done) return 0; // The G-buffer: several colour targets with a D32F depth of at least DLAA_SCENE_MIN_W wide. Only the light target drawn after it // arms the frame; at night the game draws into the light target alone with the scene depth before the G-buffer too, // and DLAA then ran at a small pass ahead of the whole scene, which reached the screen jittered. @@ -1496,7 +1568,7 @@ int vk_dlaa_plan(const VkExec *ex, VkExecJob *j) { c->samples <= 1 && !c->is3d && scene_large(c)) { int first = !D.armed; D.color = *c, D.depth = *z, D.armed = 1, D.nodepth = VK_NULL_HANDLE; - if (!first) return 0; + if (!first || !dl_active()) return 0; *j = (VkExecJob){.kind = VK_JOB_DLSS_MASK, .scene = *c}; // the lit scene, before the transparents (reactive mask) return 1; } @@ -1509,11 +1581,12 @@ int vk_dlaa_plan(const VkExec *ex, VkExecJob *j) { if (!bloom_start(ex, D.color.width)) return 0; D.end_fence = ex->fence, D.end_pos = ex->pos; __atomic_store_n(&D.ended, 1, __ATOMIC_RELEASE); + D.bloom = 1; unsigned o[2], s[2]; res_sizes(o, s); - if (D.color.width < o[0]) return 0; // wait for the scaling pass + if (dl_active() && D.color.width < o[0]) return 0; // wait for the scaling pass D.done = 1; - *j = (VkExecJob){.kind = VK_JOB_DLSS}; // DLAA in place + *j = (VkExecJob){.kind = VK_JOB_DLSS}; // DLAA in place; without DLSS frame generation's motion, at any size return 1; } // the game's scaling pass: one colour target of the output size, no depth @@ -1528,6 +1601,124 @@ int vk_dlaa_plan(const VkExec *ex, VkExecJob *j) { return 0; } +// ---------------------------------------------------------------- frame generation (vk_fg.cpp), DLSS off +// The scene is followed as for DLSS (vk_dlaa_plan: armed on the light target, ended at the bloom chain's first pass), +// without the jitter, the reactive mask or NGX. Three points of the frame, in the sequential replay: +// 1. The scene's end (fg_motion, the VK_JOB_DLSS point): the motion vectors at the scene's size (mv_pass: the camera's +// reprojection, as Savage Wind's fg_mv.frag does, then the per-object pass over it unless TOTK_FG_OBJECTS=0) and +// the SDK's prepare, which reads them with the scene depth while that still holds the scene. +// 2. The picture before the HUD (vk_dlaa_hud, before a draw): measured in a frame dump of 1.4.3 (PR #1089, a 1920x1080 +// scene and output), after the bloom chain the game draws its bloom composite and FXAA into the light target with +// the scene depth attached; then the HUD, in passes on the light target alone without depth, with the HUD's own +// small targets in between; and one last draw copies the light target into the 8-bit window texture. With a scene +// smaller than the output the game's scaling draw comes first, alone, into an output-sized target without depth, +// and the HUD is drawn over that. So, after the scene's end and the bloom chain's start, the picture is what the +// HUD's target holds before the first draw into the light target in a pass without depth (the scene as large as +// the output), before the second draw into the scaling pass's target (smaller), or, in a frame without HUD (a +// cutscene), before the draw into an 8-bit target of the output's size, the copy into the window texture. +// (The rule is PR #1089's vk_dlaa_hud_plan, by xellow78-lgtm.) +// 3. The submission's end after the copy into the window texture (vk_dlaa_sub_end): the optical flow and the +// interpolation, which read the window texture as the picture with the HUD. +static void fg_motion(VkExec *ex) { + const VkExecTarget *t = &D.color, *z = &D.depth; + uint32_t w = t->width, h = t->height; + VkCommandBuffer cb = ex->cb; + uint64_t c0 = kern_now_ns(); + D.done = 1; + vk_exec_barrier(ex); // what drew the scene is done (no pass is open here) + D.jdepth = z->image; // the scene depth note_camera knows the scene's draws by in the next frame + static int said; + if (z->level || z->base_layer || z->format != VK_FORMAT_D32_SFLOAT || z->width != w || z->height != h) { + if (!said) said = 1, rt_log("fg: the scene depth is not the first level and layer of a D32F image of the light " + "target's size (format %d, level %u, layer %u): no frame generation", + (int)z->format, z->level, z->base_layer); + return; + } + struct Size *e = size_for(cb, w, h, w, h, 0); + if (!e) { + if (!said) said = 1, rt_log("fg: no memory for the motion image at %ux%u: no frame generation", w, h); + return; + } + e->used = D.evals + 1; + VkImageView zv = vk_exec_target_view(z->img, z->format, VK_IMAGE_VIEW_TYPE_2D, VK_IMAGE_ASPECT_DEPTH_BIT, z->level, + z->base_layer, 1, 0); + unsigned o[2], sc[2]; + res_sizes(o, sc); + VkFgScene s = {.depth = z->image, .mv = e->mv, .w = w, .h = h, .ow = o[0], .oh = o[1]}; + // the camera as the snapshot holds it (rows 0-10: view, view-projection, projection), read before mv_pass keeps + // this frame's view-projection as last frame's + const float *cam = D.cam_addr ? (const float *)vk_usnap_bytes(D.cam_addr, 11 * 16) : NULL; + int cut = cam ? vk_fg_camera(cam, nvn_depth_minus_w(), D.cam_dr, &s) : 1; + vk_fg_mark(cb, FG_T_MV0); + int masked = 0, have = cam && mv_pass(ex, e, zv, 0.0f, 0.0f, 0.0f, &masked, fg_objects()); + if (!have) { // no camera or no last frame: zero motion, and the SDK starts over + VkClearColorValue zero = {{0, 0, 0, 0}}; + VkImageSubresourceRange all = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}; + vkCmdClearColorImage(cb, e->mv, VK_IMAGE_LAYOUT_GENERAL, &zero, 1, &all); + full_barrier(cb); + } + vk_fg_mark(cb, FG_T_MV1); + s.reset = !have || cut; + D.fg_mv_ok = vk_fg_prepare(cb, &s); + ex->recorded += 6; + vk_exec_draw_new_cb(ex); // the passes bound pipelines and descriptors of their own: the next draw binds everything again + vk_fg_cpu(kern_now_ns() - c0); +} + +static int rgba8(VkFormat f) { + return f == VK_FORMAT_R8G8B8A8_SRGB || f == VK_FORMAT_R8G8B8A8_UNORM || f == VK_FORMAT_B8G8R8A8_SRGB || + f == VK_FORMAT_B8G8R8A8_UNORM; +} + +void vk_dlaa_hud(VkExec *ex) { + if (!D.fg_mv_ok || !D.armed || !D.ended || !D.bloom || D.fin || ex->chunked) return; + const VkExecTarget *c = &ex->color[0]; + if (ex->pass_ncolor != 1 || !c->image || ex->depth.image || c->level || c->is3d || c->samples > 1) return; + unsigned o[2], sc[2]; + res_sizes(o, sc); + if (c->width != o[0] || c->height != o[1]) return; + if (D.hud) { // after the picture: the copy into the window texture + if (rgba8(c->format)) D.win = *c, D.fin = 1; + return; + } + int scaled = D.color.width < o[0]; + const VkExecTarget *pic = scaled ? &D.hud_t : &D.color; + if (scene_color(c->format)) { + if (scaled && !D.hud_wait) { // the scaling draw + D.hud_t = *c, D.hud_wait = 1; + return; + } + if (c->image != pic->image) return; + } else if (!rgba8(c->format) || (scaled && !D.hud_wait) || D.color.width > o[0]) { + return; + } + D.hud = 1; + if (rgba8(c->format)) D.win = *c, D.fin = 1; // no HUD this frame: this draw is the copy + uint64_t c0 = kern_now_ns(); + VkExecTarget p = *pic; + vk_exec_pass_end(ex); + vk_exec_barrier(ex); // what drew the picture is done + vk_fg_hudless(ex->cb, p.image, p.format, p.level, p.base_layer, p.width, p.height); + ex->recorded += 4; + ex->dirty = VK_EXEC_DIRTY_ALL; + vk_exec_pass_begin(ex); + vk_fg_cpu(kern_now_ns() - c0); +} + +void vk_dlaa_sub_end(VkExec *ex) { + if (!D.fin || D.gen || ex->chunked) return; + D.gen = 1; + uint64_t c0 = kern_now_ns(); + vk_exec_barrier(ex); // the window texture is drawn + const VkExecTarget *w = &D.win; + if (!w->level && !w->base_layer) + vk_fg_generate(ex->cb, ex->fence, __atomic_load_n(&gfx_counters.frames, __ATOMIC_RELAXED) + 1, w->image, w->format, + w->width, w->height); + ex->recorded += 4; + vk_exec_draw_new_cb(ex); // the SDK bound pipelines and descriptor sets of its own + vk_fg_cpu(kern_now_ns() - c0); +} + // The scan resolved its targets without making entries (vk_texture_revive); a record made on a chunk takes their images // now, as the scan's pointers may be stale by then. static void target_now(VkExecTarget *t) { @@ -1542,6 +1733,7 @@ void vk_dlaa_exec(VkExec *ex, const VkExecJob *j) { if (D.ids_ok) target_now(&D.ids); } if (j->kind == VK_JOB_DLSS_MASK) return mask_snapshot(ex, &t); + if (!dl_active()) return fg_motion(ex); if (!t.tex) return evaluate(ex, NULL); D.up = 1; evaluate(ex, &t); @@ -1591,9 +1783,13 @@ void vk_dlaa_frame(void) { dlss_mode(); preset_check(); int on = N.available && cfg_bool("TOTK_DLAA"); - if (on != D.on) { - rt_log("dlaa: %s", on ? "on" : "off"); - D.on = on; + vk_fg_frame(); + int fg = vk_fg_wanted(on && !D.failed); + D.bloom = D.hud = D.hud_wait = D.fin = D.gen = D.fg_mv_ok = 0; + if (on != D.on || fg != D.fg) { + if (on != D.on) rt_log("dlaa: %s", on ? "on" : "off"); + if (fg != D.fg) rt_log("dlaa: the scene is %s for frame generation", fg ? "followed" : "no longer followed"); + D.on = on, D.fg = vk_dlaa_fg_on = fg; // either way the next DLAA frame starts a new history from an unjittered frame D.reset = 1, D.cam_prev_ok = 0, D.jit_ok = D.jit_used = D.armed = D.done = D.gbuf = D.ended = D.up = 0; D.fx_seen = D.fx_open = D.fx_bad = 0, D.fx_steady = 0; @@ -1601,8 +1797,8 @@ void vk_dlaa_frame(void) { D.hold = 0; return; } - if (!dl_active()) return; - D.fx_on = cfg_bool("TOTK_DLAA_EFFECTS_AFTER"); + if (!track()) return; + D.fx_on = dl_active() && cfg_bool("TOTK_DLAA_EFFECTS_AFTER"); // DLSS's point alone if (!D.done) D.frames_missed++; else D.fx_steady = D.fx_seen ? D.fx_steady + (D.fx_steady < FX_STEADY) : 0; D.fx_seen = D.fx_open = D.fx_bad = 0; diff --git a/runtime/vk_dlaa.h b/runtime/vk_dlaa.h index 1275c27e..b6c7eb95 100644 --- a/runtime/vk_dlaa.h +++ b/runtime/vk_dlaa.h @@ -14,6 +14,10 @@ void vk_dlaa_device_exts(const VkExtensionProperties *have, uint32_t nhave, cons void vk_dlaa_init(void); // 1 when dlaa is on and NGX came up with DLSS (after vk_dlaa_init): a DLSS mode's smaller scene is scaled up by DLSS. int vk_dlaa_available(void); +// 1 when the per-object motion runs this frame: vk_dlaa_available, or frame generation following the scene with its +// objects (vk_fg_objects_on: TOTK_FG_OBJECTS, default 1). +int vk_objmv_wanted(void); +int vk_fg_objects_on(void); // vk_exec.c vk_exec_pass_begin, once the pass's targets are resolved and before its barrier: arms the frame on the // scene's light target or, at the first quarter-width pass after it, runs DLAA on that target. Each present ends the // frame (vk_dlaa_frame). @@ -25,6 +29,12 @@ void vk_dlaa_pass(VkExec *ex); int vk_dlaa_plan(const VkExec *ex, VkExecJob *j); void vk_dlaa_exec(VkExec *ex, const VkExecJob *j); void vk_dlaa_frame(void); +// Frame generation without DLSS (vk_dlaa.c, "frame generation"), sequential replay: vk_dlaa_hud before each draw once +// its pass has begun (vk_exec_draw.c prepare_draw, while vk_dlaa_fg_on), vk_dlaa_sub_end at the end of each +// submission's replay with no pass open (vk_exec.c vk_exec_record). +extern int vk_dlaa_fg_on; +void vk_dlaa_hud(VkExec *ex); +void vk_dlaa_sub_end(VkExec *ex); // vk_exec_draw.c, each draw before its fixed state is recorded: notes the scene camera block (vk_dlaa_draw), and moves // the viewport of the scene's draws by the frame's jitter (vk_dlaa_viewport, when the viewport is recorded). void vk_dlaa_draw(VkExec *ex); diff --git a/runtime/vk_exec.c b/runtime/vk_exec.c index 0ef4a57c..c16812cb 100644 --- a/runtime/vk_exec.c +++ b/runtime/vk_exec.c @@ -1787,6 +1787,7 @@ int vk_exec_record(VkCommandBuffer cb, const uint64_t *handles, int n, uint64_t for (int i = 0; i < n; i++) walk(ex, nvn_op_first(handles[i]), 0, NULL); } vk_exec_pass_end(ex); + if (vk_dlaa_fg_on) vk_dlaa_sub_end(ex); // frame generation after the frame's window texture (vk_dlaa.c) x_cur = NULL; if (ex->recorded) vk_exec_barrier(ex); // later submissions see this one's writes if (n) ex->recorded += vk_mem_mirror_end(ex->cb, fence), vk_usnap_end(fence); // VRAM mirror bytes the GPU wrote go back to guest memory diff --git a/runtime/vk_exec_draw.c b/runtime/vk_exec_draw.c index a87bd64c..d65e9be5 100644 --- a/runtime/vk_exec_draw.c +++ b/runtime/vk_exec_draw.c @@ -3340,6 +3340,7 @@ static int prepare_draw(VkExec *ex, int prim, int32_t count, int restart) { } if (!ex->in_pass) ex->dirty |= VK_EXEC_DIRTY_VIEWPORT | VK_EXEC_DIRTY_SCISSOR; vk_exec_pass_begin(ex); + if (vk_dlaa_fg_on) vk_dlaa_hud(ex); // frame generation: the picture before the HUD's first draw (vk_dlaa.c) VkRect2D sc = vk_exec_scissor(ex); if (!sc.extent.width || !sc.extent.height) return 0; if (!ex->prog) return warn_once(W_PROGRAM, "a draw without a bound program is skipped"), 0; @@ -3526,7 +3527,7 @@ static int prepare_draw(VkExec *ex, int prim, int32_t count, int restart) { } D->B.st_pm = D->PM.valid; // st is this draw's state, which PM holds while valid vk_dlaa_draw(ex); - int mo = ex->chunked && vk_dlaa_available(); + int mo = ex->chunked && vk_objmv_wanted(); if (mo) plat_mutex_lock(&mo_lock); vk_mvsurvey_draw(ex); vk_mvprev_draw(ex); diff --git a/runtime/vk_fg.cpp b/runtime/vk_fg.cpp new file mode 100644 index 00000000..40ccc38d --- /dev/null +++ b/runtime/vk_fg.cpp @@ -0,0 +1,833 @@ +// AMD FSR 3 frame generation (frame_gen = fsr3): the FidelityFX SDK 1.1.4's frame interpolation and optical flow +// (third_party/FidelityFX, MIT) on its Vulkan backend, driven directly instead of through the SDK's frame +// interpolation swapchain (Windows only, and it would own the present). +// +// Ported from Savage Wind (https://github.com/Revivedx/SavageWindRecomp @ bf6146c14c37fee8781a601e5a544b93dff6d75e, +// MIT), runtime/nvn/vulkan/framegen.cpp: the blob lookup, the backend set-up, the contexts as it makes them (what the +// SDK's ffx-api provider, ffx_provider_framegeneration.cpp, does: a shared backend context for the resources the two +// effects exchange, the optical flow context and the frame interpolation context on a second backend interface) and +// the parameters of fg_dispatch's three calls; its exec.c vk_fg_generate for the camera, the cut test and the HUD-less +// copy's encoding. +// +// Per frame, all in the replay's command buffer (vk_dlaa.c finds the places, with DLSS off): +// 1. vk_fg_prepare at the scene's end: the SDK dilates the scene's depth and the camera motion vectors (made there by +// vk_dlaa.c mv_pass, at the scene's size), and reconstructs the previous frame's depth from them. +// 2. vk_fg_hudless before the HUD's first draw: the game's float picture, blitted into an R8G8B8A8_SRGB image (the +// blit encodes as the game's last draw encodes the picture into its sRGB window texture) and copied byte for byte +// into an RGBA8 UNORM image, which the SDK reads. Its bytes then equal the window texture's wherever the HUD is not, +// which is how the SDK tells the HUD apart (it compares the two) and keeps it out of the interpolation. +// 3. vk_fg_generate at the end of the submission that drew the window texture: the optical flow over the HUD-less +// picture, then the interpolation between the last frame and this one, with this frame's window texture as the +// picture with the HUD, into an RGBA8 image holding bytes as the window texture does (sRGB transfer function). +// The present (vk_backend.c present_pair) shows it before the frame, through vk_fg_present_gen (TOTK_FG_TEST shows it, or +// the picture before the HUD, in place of the frame instead, for checks only). +#include "vk_fg.h" + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +extern "C" { +#include "cfg.h" +#include "host.h" +#include "vk.h" +} + +// The shaders: tools/ffx_shaders.py's blobs (wave32, 32-bit floats; frame interpolation for low-resolution motion +// vectors without jitter, both depth directions) in place of the SDK's FidelityFX_SC permutation tables +#include "ffx_shaders_vk.h" + +enum { FI_PERM_DEPTH_INVERTED = 1 << 2 }; // ffx_frameinterpolation_private.h FRAMEINTERPOLATION_SHADER_PERMUTATION_* + +extern "C" FfxErrorCode ffxGetPermutationBlobByIndex(FfxEffect effect, FfxPass pass, FfxBindStage, uint32_t options, + FfxShaderBlob *out) { + if (effect == FFX_EFFECT_FRAMEINTERPOLATION && pass < FFX_FRAMEINTERPOLATION_PASS_COUNT) { + memcpy(out, &ffx_fi_blobs[(options & FI_PERM_DEPTH_INVERTED) ? 1 : 0][pass], sizeof *out); + return FFX_OK; + } + if (effect == FFX_EFFECT_OPTICALFLOW && pass < FFX_OPTICALFLOW_PASS_COUNT) { + memcpy(out, &ffx_of_blobs[pass], sizeof *out); + return FFX_OK; + } + rt_log("fg: no shader for effect %d pass %d", (int)effect, (int)pass); + return FFX_ERROR_INVALID_ARGUMENT; +} + +extern "C" FfxErrorCode ffxIsWave64(FfxEffect, uint32_t, bool &wave64) { + wave64 = false; // (only wave32 blobs: the backend then asks for no subgroup size) + return FFX_OK; +} + +// The backend's hook into its frame interpolation swapchain, which isn't built +FfxErrorCode ffxSetFrameGenerationConfigToSwapchainVK(FfxFrameGenerationConfig const *) { return FFX_OK; } + +enum { R_OF_VECTOR, R_OF_SCD, R_DILATED_DEPTH, R_DILATED_MV = R_DILATED_DEPTH + 2, R_PREV_DEPTH = R_DILATED_MV + 2, + R_COUNT = R_PREV_DEPTH + 2 }; + +// What the contexts are made for; a change makes them again, but for the scene's size, which only has to fit +// (vk_fg_prepare) +typedef struct { + uint32_t display_w, display_h; // the window texture's (the interpolated frame's) + uint32_t render_w, render_h; // the largest scene (depth and motion vectors): the output's, or a larger scene's + VkFormat color_format; // the window texture's bytes (its UNORM twin) + uint32_t inverted, infinite; +} FgConfig; + +struct Img { + VkImage img; + VmaAllocation mem; +}; + +#define TSLOTS 8u // frames of timestamps in flight: a slot is read when it comes round again +#define CPU_RING 65536u // frames of replay-thread times kept for the median and p99 +#define LOG_EVERY 600u // generated frames between two summary lines + +static struct { + bool live, failed; + FgConfig cfg; + FfxInterface shared, fi_if; + void *scratch_shared, *scratch_fi; + uint32_t shared_id; + FfxOpticalflowContext of; + FfxFrameInterpolationContext fi; + FfxResourceInternal res[R_COUNT]; + unsigned toggle; + uint64_t frame_id, last_prep_ns, made; + // settings read at start (vk_fg_init) + int workers, sync_ahead, hdr, test, debug, times; + uint64_t shot_at; // TOTK_FG_SHOT: the first present shot, or (shot_w) the first after that world time + int64_t shot_w; + char shot_dir[260]; + unsigned said; // vk_fg_wanted's reasons logged (bits) + volatile int menu; // vk_fg_menu + // this frame + bool prepared, hl_ok, gen_ok, chain, reset; + float near_m, far_m, fov_y, dt_ms; + uint32_t rw, rh; // this frame's scene size (the SDK's renderSize), at most cfg.render_w x render_h + VkFormat win_fmt; // the window texture's format as last seen (UNORM twin) + int k; // the pair of hudless/out images this frame writes + VkImage gen_win; // the window texture this frame's picture was generated against (vk_fg_generate) + VkImage show_out, show_hl, show_win; // the frame just ended (vk_fg_frame), for vk_fg_present_swap / _gen + // images + uint32_t iw, ih; + Img hl_srgb, hl[2], out[2]; + // timing + VkQueryPool qp; + uint32_t qslot, qmask[TSLOTS]; + double gpu[4]; // ms summed: camera motion, prepare, hudless copy, optical flow + interpolation + double gpu_run[4]; + uint64_t timed, timed_run; + uint64_t cpu_frame; // ns this frame + uint32_t *cpu_us; // per frame with frame generation work, microseconds + uint64_t ncpu; + uint64_t gens, resets, skipped, gens_logged, resized; // resized: prepares at another scene size than the last + uint64_t drain_ns, sdk_ns, split_frames; // since the last summary: recorder drains, the SDK's own recording + uint64_t drain_run, sdk_run, prep_ns, prep_run; // prep: the prepare's share of sdk +} g; + +#define TRY(x) do { FfxErrorCode e_ = (x); if (e_ != FFX_OK) { rt_log("fg: %s failed: %#x", #x, (unsigned)e_); return false; } } while (0) + +// The backend calls a few extension functions unchecked: the debug labels (VK_EXT_debug_utils, an instance +// extension the runtime enables only with validation) and vkGetBufferMemoryRequirements2KHR (core since 1.1 without +// the suffix) +static VKAPI_ATTR void VKAPI_CALL no_label(VkCommandBuffer, const VkDebugUtilsLabelEXT *) {} +static VKAPI_ATTR void VKAPI_CALL no_label_end(VkCommandBuffer) {} +static VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL device_proc(VkDevice d, const char *name) { + PFN_vkVoidFunction f = vkGetDeviceProcAddr(d, name); + if (f) return f; + if (!strcmp(name, "vkGetBufferMemoryRequirements2KHR")) return vkGetDeviceProcAddr(d, "vkGetBufferMemoryRequirements2"); + if (!strcmp(name, "vkCmdBeginDebugUtilsLabelEXT")) return (PFN_vkVoidFunction)no_label; + if (!strcmp(name, "vkCmdEndDebugUtilsLabelEXT")) return (PFN_vkVoidFunction)no_label_end; + return nullptr; +} + +// (the backend's context in it has members the compiler aligns past malloc's 16 bytes) +static void *scratch_alloc(size_t n) { +#ifdef _WIN32 + void *p = _aligned_malloc(n, 256); +#else + void *p = aligned_alloc(256, n); +#endif + if (p) memset(p, 0, n); + return p; +} + +static void scratch_free(void *p) { +#ifdef _WIN32 + _aligned_free(p); +#else + free(p); +#endif +} + +static bool make_backend(VkCtx *c, FfxInterface *i, void **scratch, size_t contexts) { + size_t n = (ffxGetScratchMemorySizeVK(c->phys, contexts) + 255) & ~(size_t)255; + *scratch = scratch_alloc(n); + if (!*scratch) return false; + VkDeviceContext dc = {c->device, c->phys, device_proc}; + TRY(ffxGetInterfaceVK(i, ffxGetDeviceVK(&dc), *scratch, n, contexts)); + return true; +} + +// The SDK's objects (not this file's images): the device is idle or the contexts were never used. +static void sdk_destroy(void) { + if (g.live) { + for (int i = 0; i < R_COUNT; i++) g.shared.fpDestroyResource(&g.shared, g.res[i], g.shared_id); + ffxFrameInterpolationContextDestroy(&g.fi); + ffxOpticalflowContextDestroy(&g.of); + g.shared.fpDestroyBackendContext(&g.shared, g.shared_id); + } + scratch_free(g.scratch_shared); + scratch_free(g.scratch_fi); + g.scratch_shared = g.scratch_fi = nullptr; + memset(&g.of, 0, sizeof g.of); + memset(&g.fi, 0, sizeof g.fi); + memset(g.res, 0, sizeof g.res); + g.live = false; +} + +static void img_free(VkCtx *c, Img *m) { + if (m->img) vmaDestroyImage(c->vma, m->img, m->mem); + *m = Img{}; +} + +static void times_log(const char *what, const double *gpu, uint64_t timed); +static void cpu_log(const char *what, uint64_t from); + +extern "C" void vk_fg_release(void) { + VkCtx *c = vk_ctx(); + if (!c || !c->device) return; + if (!g.live && !g.scratch_shared && !g.hl_srgb.img && !g.qp) return; + vkDeviceWaitIdle(c->device); + vk_fg_exit_log(); + if (g.live) rt_log("fg: frame interpolation contexts destroyed"); + sdk_destroy(); + img_free(c, &g.hl_srgb); + for (int i = 0; i < 2; i++) img_free(c, &g.hl[i]), img_free(c, &g.out[i]); + if (g.qp) vkDestroyQueryPool(c->device, g.qp, NULL); + free(g.cpu_us); + memset(&g, 0, sizeof g); +} + +static bool create(VkCtx *c, const FgConfig *cf) { + g.cfg = *cf; + if (!make_backend(c, &g.shared, &g.scratch_shared, 1) || !make_backend(c, &g.fi_if, &g.scratch_fi, 2)) return false; + TRY(g.shared.fpCreateBackendContext(&g.shared, FFX_EFFECT_SHAREDAPIBACKEND, nullptr, &g.shared_id)); + FfxOpticalflowContextDescription od = {}; + od.backendInterface = g.fi_if; + od.resolution = {cf->display_w, cf->display_h}; + TRY(ffxOpticalflowContextCreate(&g.of, &od)); + FfxFrameInterpolationContextDescription fd = {}; + fd.backendInterface = g.fi_if; + fd.flags = (cf->inverted ? FFX_FRAMEINTERPOLATION_ENABLE_DEPTH_INVERTED : 0) | + (cf->infinite ? FFX_FRAMEINTERPOLATION_ENABLE_DEPTH_INFINITE : 0); + fd.maxRenderSize = {cf->render_w, cf->render_h}; + fd.displaySize = {cf->display_w, cf->display_h}; + fd.backBufferFormat = ffxGetSurfaceFormatVK(cf->color_format); + fd.previousInterpolationSourceFormat = ffxGetSurfaceFormatVK(VK_FORMAT_R8G8B8A8_UNORM); // the HUD-less copy's + TRY(ffxFrameInterpolationContextCreate(&g.fi, &fd)); + FfxOpticalflowSharedResourceDescriptions ord = {}; + TRY(ffxOpticalflowGetSharedResourceDescriptions(&g.of, &ord)); + TRY(g.shared.fpCreateResource(&g.shared, &ord.opticalFlowVector, g.shared_id, &g.res[R_OF_VECTOR])); + TRY(g.shared.fpCreateResource(&g.shared, &ord.opticalFlowSCD, g.shared_id, &g.res[R_OF_SCD])); + FfxFrameInterpolationSharedResourceDescriptions frd = {}; + TRY(ffxFrameInterpolationGetSharedResourceDescriptions(&g.fi, &frd)); + for (int i = 0; i < 2; i++) { + TRY(g.shared.fpCreateResource(&g.shared, &frd.dilatedDepth, g.shared_id, &g.res[R_DILATED_DEPTH + i])); + TRY(g.shared.fpCreateResource(&g.shared, &frd.dilatedMotionVectors, g.shared_id, &g.res[R_DILATED_MV + i])); + TRY(g.shared.fpCreateResource(&g.shared, &frd.reconstructedPrevNearestDepth, g.shared_id, &g.res[R_PREV_DEPTH + i])); + } + g.live = true; + return true; +} + +static int knob_int(const char *key) { + const char *v = cfg_get(key); + return v && *v ? atoi(v) : 0; +} + +extern "C" VkFgEngine vk_fg_engine(void) { + static volatile int e = VK_FG_OFF; + static volatile unsigned seen; // the cfg_version read, + 1 (0: never) + unsigned v = cfg_version(); + if (__atomic_load_n(&seen, __ATOMIC_ACQUIRE) != v + 1) { + const char *s = cfg_value("TOTK_FRAME_GEN"); + int n = !strcmp(s, "fsr3") ? VK_FG_FSR3 : VK_FG_OFF; + static char said[16]; + if (strncmp(said, s, sizeof said - 1)) { + snprintf(said, sizeof said, "%s", s); + if (n == VK_FG_OFF && strcmp(s, "off")) rt_log("fg: frame_gen = %s is not off or fsr3: off", s); + else if (seen) rt_log("fg: frame_gen = %s", s); + } + e = n; + __atomic_store_n(&seen, v + 1, __ATOMIC_RELEASE); + } + return (VkFgEngine)e; +} + +// The settings and the contexts, once: at start with frame_gen = fsr3, else at the first frame after the menu turns it +// on (vk_fg_wanted). +static bool started; +static void start(void) { + started = true; + VkCtx *c = vk_ctx(); + if (!c) return; + // The first contexts at the output size from the settings; vk_fg_prepare makes them again for the real scene + uint32_t w = 1920, h = 1080; + sscanf(cfg_value("TOTK_OUTPUT_RES"), "%ux%u", &w, &h); + if (w < 64 || h < 64 || w > 16384 || h > 16384) w = 1920, h = 1080; + FgConfig cf = {w, h, w, h, VK_FORMAT_R8G8B8A8_UNORM, 0, 0}; + if (!create(c, &cf)) { + rt_log("fg: frame interpolation unavailable (the contexts could not be made)"); + g.live = false; // (a half-made set is not destroyed through its context functions: only its memory is freed) + sdk_destroy(); + g.failed = true; + return; + } + g.win_fmt = VK_FORMAT_R8G8B8A8_UNORM; + g.workers = cfg_int("TOTK_REPLAY_WORKERS"); + g.sync_ahead = cfg_bool("TOTK_SYNC_AHEAD"); + g.hdr = vk_hdr_wanted(); + g.test = knob_int("TOTK_FG_TEST"); + g.debug = knob_int("TOTK_FG_DEBUG"); + g.times = !cfg_get("TOTK_FG_TIMES") || knob_int("TOTK_FG_TIMES"); + const char *sh = cfg_get("TOTK_FG_SHOT"); + if (sh && (sh[0] == 'w' || sh[0] == 'W')) g.shot_w = (int64_t)(atof(sh + 1) * 1e6); + else g.shot_at = (uint64_t)knob_int("TOTK_FG_SHOT"); + const char *d = cfg_get("TOTK_FG_SHOT_DIR"); + snprintf(g.shot_dir, sizeof g.shot_dir, "%s", d && *d ? d : "."); + g.cpu_us = (uint32_t *)calloc(CPU_RING, sizeof *g.cpu_us); + if (g.times) { + VkQueryPoolCreateInfo qi = {VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO, NULL, 0, VK_QUERY_TYPE_TIMESTAMP, + TSLOTS * FG_T_N, 0}; + if (vkCreateQueryPool(c->device, &qi, NULL, &g.qp) != VK_SUCCESS) g.qp = VK_NULL_HANDLE; + } + rt_log("fg: FSR 3 frame interpolation contexts created at %ux%u (FidelityFX SDK 1.1.4)%s%s", w, h, + g.test == 1 ? "; TOTK_FG_TEST=1: the generated frame is shown in place of the game's" + : g.test == 2 ? "; TOTK_FG_TEST=2: the picture before the HUD is shown in place of the game's" : "", + g.debug ? "; TOTK_FG_DEBUG: the SDK's debug view" : ""); +} + +extern "C" void vk_fg_init(void) { + if (vk_fg_engine() == VK_FG_FSR3) start(); +} + +extern "C" int vk_fg_active(void) { return g.live && vk_fg_engine() != VK_FG_OFF; } + +extern "C" void vk_fg_menu(int open) { __atomic_store_n(&g.menu, open, __ATOMIC_RELAXED); } + +extern "C" int vk_fg_wanted(int dlss) { + if (vk_fg_engine() != VK_FG_FSR3) return 0; + if (!started) start(); // turned on in the menu: the contexts now; the first prepare makes them for the scene + if (!g.live || g.failed) return 0; + // the inputs are this frame's, recorded in replay order: one frame in flight more or chunks recording side by + // side are not handled yet + int why = dlss ? 1 : g.workers > 0 ? 2 : g.sync_ahead ? 3 : g.hdr ? 4 : 0; + if (why) { + if (!(g.said & 1u << why)) { + g.said |= 1u << why; + static const char *const r[] = {"", "DLSS runs (dlaa = 1)", "the replay records in chunks (replay_workers > 0)", + "sync_ahead = 1", "HDR output (hdr = 1)"}; + rt_log("fg: frame generation off while %s", r[why]); + } + return 0; + } + return !__atomic_load_n(&g.menu, __ATOMIC_RELAXED); +} + +// ---------------------------------------------------------------- the camera +static struct { + bool have, logged; + float pos[3], fwd[3]; + int inverted, infinite; +} cam; + +extern "C" int vk_fg_camera(const float *r, int minus_w, const float dr[2], VkFgScene *s) { + // rows 0-2: the view, 3x4 by rows (right, up, back; the translation in .w); rows 7-10: the projection + const float *v0 = r, *v1 = r + 4, *v2 = r + 8, *py = r + 8 * 4, *pz = r + 9 * 4, *pw = r + 10 * 4; + for (int k = 0; k < 3; k++) { + s->right[k] = v0[k], s->up[k] = v1[k], s->fwd[k] = -v2[k]; + s->pos[k] = -(v0[k] * v0[3] + v1[k] * v1[3] + v2[k] * v2[3]); + } + s->fov_y = 2.0f * atanf(1.0f / (py[1] > 1e-3f ? py[1] : 1.0f)); + // A point on the view axis at distance t: its clip z and w, the depth before the viewport's range (d01) and the + // device depth the depth image holds + auto d01 = [&](double t) { + double zc = -pz[2] * t + pz[3], wc = -pw[2] * t + pw[3]; + double z = wc != 0 ? zc / wc : 0; + return minus_w ? z * 0.5 + 0.5 : z; + }; + auto dev = [&](double t) { return dr[0] + (dr[1] - dr[0]) * d01(t); }; + int inv01 = d01(1.0) > d01(100.0); + s->inverted = dev(1.0) > dev(100.0); + // the planes: where d01 reaches its near and far ends, in clip z: t = (tz * pw.w - pz.w) / (tz * pw.z - pz.z) + auto plane = [&](double end) { + double tz = minus_w ? end * 2 - 1 : end, den = tz * pw[2] - pz[2]; + return fabs(den) > 1e-12 ? (tz * pw[3] - pz[3]) / den : -1.0; + }; + double tn = plane(inv01 ? 1.0 : 0.0), tf = plane(inv01 ? 0.0 : 1.0); + s->infinite = !(tf > 0 && tf < 1e7); + s->near_m = tn > 0 ? (float)tn : 0.1f; + s->far_m = s->infinite ? 1e7f : (float)tf; + if (!cam.logged || s->inverted != cam.inverted || s->infinite != cam.infinite) { + cam.logged = true, cam.inverted = s->inverted, cam.infinite = s->infinite; + rt_log("fg: camera from the scene block: near %.4g m, far %s%.6g m, vertical field of view %.1f degrees; depth %s " + "(NVN depth mode %s, viewport depth range %g..%g; device depth at 1 m %.6f, 100 m %.6f, 10 km %.6f); " + "projection z row %g %g %g %g, w row %g %g %g %g; view axes |right| %.3f |up| %.3f |back| %.3f; camera " + "at %.1f %.1f %.1f", s->near_m, s->infinite ? "infinite, " : "", tf, s->fov_y * 57.29578f, + s->inverted ? "inverted (1 near)" : "standard (0 near)", minus_w ? "-w..w" : "0..w", dr[0], dr[1], + dev(1.0), dev(100.0), dev(10000.0), pz[0], pz[1], pz[2], pz[3], pw[0], pw[1], pw[2], pw[3], + sqrtf(v0[0] * v0[0] + v0[1] * v0[1] + v0[2] * v0[2]), sqrtf(v1[0] * v1[0] + v1[1] * v1[1] + v1[2] * v1[2]), + sqrtf(v2[0] * v2[0] + v2[1] * v2[1] + v2[2] * v2[2]), s->pos[0], s->pos[1], s->pos[2]); + if (!minus_w || fabsf(dr[0]) > 1e-6f || fabsf(dr[1] - 1.0f) > 1e-6f) + rt_log("fg: the camera motion pass (shaders/dlaa_mv.comp) takes depth as z_ndc * 0.5 + 0.5 over 0..1: this " + "depth mode or range does not fit it, its vectors are off for anything the camera moves past"); + } + // a cut: no history (a jump of over 10 m, or the view turned over ~35 degrees in a frame) + float dp = 0, dot = 0; + for (int k = 0; k < 3; k++) + dp += (s->pos[k] - cam.pos[k]) * (s->pos[k] - cam.pos[k]), dot += s->fwd[k] * cam.fwd[k]; + int cut = !cam.have || dp > 100.0f || dot < 0.82f; + cam.have = true; + memcpy(cam.pos, s->pos, sizeof cam.pos), memcpy(cam.fwd, s->fwd, sizeof cam.fwd); + return cut; +} + +// ---------------------------------------------------------------- timing +static void times_log(const char *what, const double *gpu, uint64_t timed) { + double n = timed ? (double)timed : 1.0; + rt_log("fg times %s: gpu camera motion %.3f ms, prepare %.3f ms, HUD-less copy %.3f ms, optical flow + " + "interpolation %.3f ms (%llu frames timed)", what, gpu[0] / n, gpu[1] / n, gpu[2] / n, gpu[3] / n, + (unsigned long long)timed); +} + +static int cmp_u32(const void *a, const void *b) { + uint32_t x = *(const uint32_t *)a, y = *(const uint32_t *)b; + return x < y ? -1 : x > y; +} + +static void cpu_log(const char *what, uint64_t from) { + uint64_t n = g.ncpu - from; + if (!n || !g.cpu_us) return; + if (n > CPU_RING) n = CPU_RING, from = g.ncpu - n; + uint32_t *v = (uint32_t *)malloc(n * sizeof *v); + if (!v) return; + for (uint64_t i = 0; i < n; i++) v[i] = g.cpu_us[(from + i) % CPU_RING]; + qsort(v, n, sizeof *v, cmp_u32); + rt_log("fg cpu %s: replay-thread recording %.3f ms median, %.3f ms p99, %.3f ms max a frame (%llu frames)", what, + v[n / 2] / 1e3, v[n * 99 / 100] / 1e3, v[n - 1] / 1e3, (unsigned long long)n); + free(v); +} + +extern "C" void vk_fg_mark(VkCommandBuffer cb, int which) { + if (!g.qp) return; + if (which == FG_T_MV0) { // the frame's slot: its last frame's results are read, then it is reset + g.qslot = (g.qslot + 1) % TSLOTS; + if (g.qmask[g.qslot] == (1u << FG_T_N) - 1) { + uint64_t q[FG_T_N]; + if (vkGetQueryPoolResults(vk_ctx()->device, g.qp, g.qslot * FG_T_N, FG_T_N, sizeof q, q, sizeof q[0], + VK_QUERY_RESULT_64_BIT) == VK_SUCCESS) { + double ms = vk_ctx()->props.limits.timestampPeriod / 1e6; + double d[4] = {(double)(q[FG_T_MV1] - q[FG_T_MV0]) * ms, (double)(q[FG_T_PREP1] - q[FG_T_PREP0]) * ms, + (double)(q[FG_T_HL1] - q[FG_T_HL0]) * ms, (double)(q[FG_T_FI1] - q[FG_T_FI0]) * ms}; + for (int i = 0; i < 4; i++) g.gpu[i] += d[i], g.gpu_run[i] += d[i]; + g.timed++, g.timed_run++; + } + } + g.qmask[g.qslot] = 0; + vkCmdResetQueryPool(cb, g.qp, g.qslot * FG_T_N, FG_T_N); + } + vkCmdWriteTimestamp2(cb, VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT, g.qp, g.qslot * FG_T_N + (uint32_t)which); + g.qmask[g.qslot] |= 1u << which; +} + +extern "C" void vk_fg_cpu(uint64_t ns) { g.cpu_frame += ns; } + +// ---------------------------------------------------------------- images +static void full_barrier(VkCommandBuffer cb) { + VkMemoryBarrier2 mb = {VK_STRUCTURE_TYPE_MEMORY_BARRIER_2, NULL, VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT, + VK_ACCESS_2_MEMORY_WRITE_BIT, VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT, + VK_ACCESS_2_MEMORY_READ_BIT | VK_ACCESS_2_MEMORY_WRITE_BIT}; + VkDependencyInfo di = {}; + di.sType = VK_STRUCTURE_TYPE_DEPENDENCY_INFO, di.memoryBarrierCount = 1, di.pMemoryBarriers = &mb; + vkCmdPipelineBarrier2(cb, &di); +} + +static bool img_make(VkCtx *c, VkCommandBuffer cb, Img *m, uint32_t w, uint32_t h, VkFormat f, VkImageUsageFlags u) { + VkImageCreateInfo ii = {}; + ii.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO, ii.imageType = VK_IMAGE_TYPE_2D, ii.format = f; + ii.extent = {w, h, 1}, ii.mipLevels = 1, ii.arrayLayers = 1, ii.samples = VK_SAMPLE_COUNT_1_BIT; + ii.tiling = VK_IMAGE_TILING_OPTIMAL, ii.usage = u, ii.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; + VmaAllocationCreateInfo ai = {}; + ai.usage = VMA_MEMORY_USAGE_AUTO_PREFER_DEVICE; + if (vmaCreateImage(c->vma, &ii, &ai, &m->img, &m->mem, NULL) != VK_SUCCESS) return m->img = VK_NULL_HANDLE, false; + VkImageMemoryBarrier2 b = {}; + b.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER_2; + b.srcStageMask = b.dstStageMask = VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT; + b.dstAccessMask = VK_ACCESS_2_MEMORY_READ_BIT | VK_ACCESS_2_MEMORY_WRITE_BIT; + b.oldLayout = VK_IMAGE_LAYOUT_UNDEFINED, b.newLayout = VK_IMAGE_LAYOUT_GENERAL; + b.srcQueueFamilyIndex = b.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + b.image = m->img, b.subresourceRange = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1}; + VkDependencyInfo di = {}; + di.sType = VK_STRUCTURE_TYPE_DEPENDENCY_INFO, di.imageMemoryBarrierCount = 1, di.pImageMemoryBarriers = &b; + vkCmdPipelineBarrier2(cb, &di); + return true; +} + +// The HUD-less copies and the generated frames at w x h, two of each (the present of the frame before may still read +// the other pair). Another size: the old ones go once every present and submission before is done. +static bool images_for(VkCommandBuffer cb, uint32_t w, uint32_t h) { + if (g.hl_srgb.img && g.iw == w && g.ih == h) return true; + VkCtx *c = vk_ctx(); + if (g.hl_srgb.img) { + vk_present_drain(); + vk_queue_lock(); + vkDeviceWaitIdle(c->device); + vk_queue_unlock(); + g.show_out = g.show_hl = VK_NULL_HANDLE; + } + img_free(c, &g.hl_srgb); + for (int i = 0; i < 2; i++) img_free(c, &g.hl[i]), img_free(c, &g.out[i]); + const VkImageUsageFlags t = VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT; + bool ok = img_make(c, cb, &g.hl_srgb, w, h, VK_FORMAT_R8G8B8A8_SRGB, t); + for (int i = 0; i < 2 && ok; i++) + ok = img_make(c, cb, &g.hl[i], w, h, VK_FORMAT_R8G8B8A8_UNORM, t | VK_IMAGE_USAGE_SAMPLED_BIT) && + img_make(c, cb, &g.out[i], w, h, VK_FORMAT_R8G8B8A8_UNORM, + t | VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_STORAGE_BIT); + if (!ok) { + rt_log("fg: no memory for the %ux%u pictures: frame generation off for this run", w, h); + g.failed = true; + return false; + } + g.iw = w, g.ih = h; + return true; +} + +static FfxResource res(VkImage img, VkFormat f, uint32_t w, uint32_t h, bool write, const wchar_t *name) { + VkImageCreateInfo ci = {}; + ci.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO; + ci.imageType = VK_IMAGE_TYPE_2D; + ci.format = f; + ci.extent = {w, h, 1}; + ci.mipLevels = 1; + ci.arrayLayers = 1; + ci.samples = VK_SAMPLE_COUNT_1_BIT; + ci.usage = VK_IMAGE_USAGE_SAMPLED_BIT | (write ? VK_IMAGE_USAGE_STORAGE_BIT : 0); + // (every image of the runtime is in GENERAL: the backend takes both states as GENERAL and leaves them so) + return ffxGetResourceVK((void *)img, ffxGetImageResourceDescriptionVK(img, ci, write ? FFX_RESOURCE_USAGE_UAV + : FFX_RESOURCE_USAGE_READ_ONLY), name, write ? FFX_RESOURCE_STATE_UNORDERED_ACCESS + : FFX_RESOURCE_STATE_GENERIC_READ); +} + +static FfxResource shared(int i) { return g.shared.fpGetResource(&g.shared, g.res[i]); } + +static VkFormat unorm_of(VkFormat f) { // (the bytes as written: an sRGB image is interpolated as stored) + return f == VK_FORMAT_R8G8B8A8_SRGB ? VK_FORMAT_R8G8B8A8_UNORM : f == VK_FORMAT_B8G8R8A8_SRGB ? VK_FORMAT_B8G8R8A8_UNORM : f; +} + +// ---------------------------------------------------------------- the frame +extern "C" int vk_fg_prepare(VkCommandBuffer cb, const VkFgScene *s) { + g.prepared = false; + if (g.failed || !g.scratch_shared) return 0; + // The game's dynamic resolution moves the scene between sizes (1600x896, 1432x808 and 1280x720 under a 1920x1080 + // output, seen within seconds in the town) and each remake waits for the device to idle (89 ms measured). The + // contexts are made for a largest scene, the output's size (or a larger scene's, once one comes), and each frame + // passes its own size as the SDK's renderSize: the SDK sizes its own images by maxRenderSize, dispatches over + // renderSize and divides the motion vector scale by it, as its dynamic resolution path intends. + FgConfig want = {s->ow, s->oh, s->w > s->ow ? s->w : s->ow, s->h > s->oh ? s->h : s->oh, g.win_fmt, + (uint32_t)s->inverted, (uint32_t)s->infinite}; + if (g.live) { // a scene the contexts hold keeps them; a larger one makes them for the largest of both + if (g.cfg.render_w > want.render_w) want.render_w = g.cfg.render_w; + if (g.cfg.render_h > want.render_h) want.render_h = g.cfg.render_h; + } + if (!g.live || memcmp(&g.cfg, &want, sizeof want)) { + // what the old contexts recorded is queued or submitted: every submission done before they go + VkCtx *c = vk_ctx(); + vk_queue_lock(); + vkDeviceWaitIdle(c->device); + vk_queue_unlock(); + sdk_destroy(); + if (!create(c, &want)) { + rt_log("fg: the contexts could not be made again: frame generation off for this run"); + sdk_destroy(); + g.failed = true; + return 0; + } + g.chain = false; + rt_log("fg: contexts %llu made for a %ux%u output from scenes up to %ux%u, %s depth%s, window texture format %d", + (unsigned long long)++g.made, want.display_w, want.display_h, want.render_w, want.render_h, + want.inverted ? "inverted" : "standard", want.infinite ? " without a far plane" : "", (int)want.color_format); + } + uint64_t now = kern_now_ns(); + double dt = g.last_prep_ns ? (double)(now - g.last_prep_ns) / 1e6 : 0.0; + g.last_prep_ns = now; + g.dt_ms = dt > 0.0 && dt < 100.0 ? (float)dt : 16.67f; + g.near_m = s->near_m, g.far_m = s->far_m, g.fov_y = s->fov_y; + // a frame at another scene size than the last: last frame's dilated depth and vectors are of the other size, and + // the interpolation starts over from this one + bool resized = s->w != g.rw || s->h != g.rh; + g.rw = s->w, g.rh = s->h; + g.toggle ^= 1; + FfxFrameInterpolationPrepareDescription pd = {}; + pd.commandList = ffxGetCommandListVK(cb); + pd.renderSize = {s->w, s->h}; + // the vectors are last frame's window position minus this frame's in scene pixels, y down: the SDK's convention + // at a scale of one (its constant divides by the render size); no jitter without an upscaler + pd.motionVectorScale = {1.0f, 1.0f}; + pd.frameTimeDelta = g.dt_ms; + pd.cameraNear = s->near_m; + pd.cameraFar = s->far_m; + pd.viewSpaceToMetersFactor = 1; // (TotK's units are metres) + pd.cameraFovAngleVertical = s->fov_y; + pd.depth = res(s->depth, VK_FORMAT_D32_SFLOAT, s->w, s->h, false, L"FG_Depth"); + pd.motionVectors = res(s->mv, VK_FORMAT_R16G16_SFLOAT, s->w, s->h, false, L"FG_MotionVectors"); + pd.frameID = ++g.frame_id; + pd.dilatedDepth = shared(R_DILATED_DEPTH + g.toggle); + pd.dilatedMotionVectors = shared(R_DILATED_MV + g.toggle); + pd.reconstructedPrevDepth = shared(R_PREV_DEPTH + g.toggle); + memcpy(pd.cameraPosition, s->pos, sizeof pd.cameraPosition); + memcpy(pd.cameraUp, s->up, sizeof pd.cameraUp); + memcpy(pd.cameraRight, s->right, sizeof pd.cameraRight); + memcpy(pd.cameraForward, s->fwd, sizeof pd.cameraForward); + vk_fg_mark(cb, FG_T_PREP0); + uint64_t t0 = kern_now_ns(); + rec_drain(); // the SDK records into cb itself: the recorder must have made every call queued before + uint64_t t1 = kern_now_ns(); + FfxErrorCode e = ffxFrameInterpolationPrepare(&g.fi, &pd); + uint64_t t2 = kern_now_ns(); + g.drain_ns += t1 - t0, g.sdk_ns += t2 - t1, g.prep_ns += t2 - t1; + vk_fg_mark(cb, FG_T_PREP1); + if (e != FFX_OK) { + rt_log("fg: the SDK's prepare failed (%#x): frame generation off for this run", (unsigned)e); + g.failed = true; + return 0; + } + g.reset = s->reset || !g.chain || resized; + g.resized += resized && g.chain; + g.prepared = true; + return 1; +} + +extern "C" int vk_fg_hudless(VkCommandBuffer cb, VkImage src, VkFormat fmt, uint32_t level, uint32_t layer, uint32_t w, + uint32_t h) { + (void)fmt; + if (!g.prepared || g.failed || !images_for(cb, w, h)) return 0; + vk_fg_mark(cb, FG_T_HL0); + VkImageBlit b = {}; + b.srcSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, level, layer, 1}; + b.srcOffsets[1] = {(int32_t)w, (int32_t)h, 1}; + b.dstSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1}; + b.dstOffsets[1] = {(int32_t)w, (int32_t)h, 1}; + vkCmdBlitImage(cb, src, VK_IMAGE_LAYOUT_GENERAL, g.hl_srgb.img, VK_IMAGE_LAYOUT_GENERAL, 1, &b, VK_FILTER_NEAREST); + full_barrier(cb); + VkImageCopy cp = {}; + cp.srcSubresource = cp.dstSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1}; + cp.extent = {w, h, 1}; + vkCmdCopyImage(cb, g.hl_srgb.img, VK_IMAGE_LAYOUT_GENERAL, g.hl[g.k].img, VK_IMAGE_LAYOUT_GENERAL, 1, &cp); + full_barrier(cb); + vk_fg_mark(cb, FG_T_HL1); + g.hl_ok = true; + return 1; +} + +// ---- shots (TOTK_FG_SHOT=): the window texture, the generated and the HUD-less picture of three frames from +// there, as PNGs in TOTK_FG_SHOT_DIR (fg__real.png, _gen.png, _hudless.png) +struct Shot { + VkBuffer buf; + VmaAllocation mem; + void *map; + uint32_t w, h; + int bgra; + char path[300]; +}; + +static void shot_write(void *arg) { + Shot *s = (Shot *)arg; + VkCtx *c = vk_ctx(); + vmaInvalidateAllocation(c->vma, s->mem, 0, VK_WHOLE_SIZE); + uint8_t *p = (uint8_t *)s->map; + if (s->bgra) + for (size_t i = 0; i < (size_t)s->w * s->h; i++) { + uint8_t t = p[4 * i]; + p[4 * i] = p[4 * i + 2], p[4 * i + 2] = t; + } + for (size_t i = 0; i < (size_t)s->w * s->h; i++) p[4 * i + 3] = 255; + rt_write_png(s->path, p, s->w, s->h); + rt_log("fg: shot %s", s->path); + vmaDestroyBuffer(c->vma, s->buf, s->mem); + free(s); +} + +static void shot(VkCommandBuffer cb, uint64_t fence, VkImage img, VkFormat f, uint32_t w, uint32_t h, uint64_t frame, + const char *kind) { + VkCtx *c = vk_ctx(); + Shot *s = (Shot *)calloc(1, sizeof *s); + if (!s) return; + VkBufferCreateInfo bi = {}; + bi.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, bi.size = (VkDeviceSize)w * h * 4; + bi.usage = VK_BUFFER_USAGE_TRANSFER_DST_BIT; + VmaAllocationCreateInfo ai = {}; + ai.usage = VMA_MEMORY_USAGE_AUTO_PREFER_HOST; + ai.flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT | VMA_ALLOCATION_CREATE_MAPPED_BIT; + VmaAllocationInfo info; + if (vmaCreateBuffer(c->vma, &bi, &ai, &s->buf, &s->mem, &info) != VK_SUCCESS) return free(s); + s->map = info.pMappedData, s->w = w, s->h = h; + s->bgra = f == VK_FORMAT_B8G8R8A8_UNORM || f == VK_FORMAT_B8G8R8A8_SRGB; + snprintf(s->path, sizeof s->path, "%s/fg_%llu_%s.png", g.shot_dir, (unsigned long long)frame, kind); + VkBufferImageCopy r = {}; + r.imageSubresource = {VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, 1}; + r.imageExtent = {w, h, 1}; + vkCmdCopyImageToBuffer(cb, img, VK_IMAGE_LAYOUT_GENERAL, s->buf, 1, &r); + vk_completion_add(fence, shot_write, s); +} + +extern "C" int vk_fg_generate(VkCommandBuffer cb, uint64_t fence, uint64_t frame, VkImage win, VkFormat fmt, uint32_t w, + uint32_t h) { + if (!g.prepared || !g.hl_ok || g.failed) return 0; + VkFormat wf = unorm_of(fmt); + if (wf != VK_FORMAT_R8G8B8A8_UNORM && wf != VK_FORMAT_B8G8R8A8_UNORM) { + static int said; + if (!said) said = 1, rt_log("fg: the window texture's format %d is not 8-bit RGBA: no frame generated", (int)fmt); + return 0; + } + if (wf != g.cfg.color_format || w != g.cfg.display_w || h != g.cfg.display_h || w != g.iw || h != g.ih) { + g.win_fmt = wf; // the next prepare makes the contexts for it + static int said; + if (said++ < 4) + rt_log("fg: window texture %ux%u format %d against contexts for %ux%u format %d, HUD-less picture %ux%u: " + "no frame generated this time", w, h, (int)fmt, g.cfg.display_w, g.cfg.display_h, + (int)g.cfg.color_format, g.iw, g.ih); + return 0; + } + VkImage hl = g.hl[g.k].img, out = g.out[g.k].img; + vk_fg_mark(cb, FG_T_FI0); + uint64_t t0 = kern_now_ns(); + rec_drain(); // the SDK records into cb itself + uint64_t t1 = kern_now_ns(); + FfxCommandList cl = ffxGetCommandListVK(cb); + FfxResource hud_less = res(hl, VK_FORMAT_R8G8B8A8_UNORM, w, h, false, L"FG_HudlessColor"); + FfxOpticalflowDispatchDescription od = {}; + od.commandList = cl; + od.color = hud_less; + od.reset = g.reset; + od.backbufferTransferFunction = FFX_BACKBUFFER_TRANSFER_FUNCTION_SRGB; + od.opticalFlowVector = shared(R_OF_VECTOR); + od.opticalFlowSCD = shared(R_OF_SCD); + FfxErrorCode e = ffxOpticalflowContextDispatch(&g.of, &od); + if (e == FFX_OK) { + FfxFrameInterpolationDispatchDescription dd = {}; + dd.flags = g.debug ? FFX_FRAMEINTERPOLATION_DISPATCH_DRAW_DEBUG_VIEW : 0; + dd.commandList = cl; + dd.displaySize = {w, h}; + dd.renderSize = {g.rw, g.rh}; + dd.currentBackBuffer = res(win, wf, w, h, false, L"FG_Color"); + dd.currentBackBuffer_HUDLess = hud_less; + dd.output = res(out, VK_FORMAT_R8G8B8A8_UNORM, w, h, true, L"FG_Output"); + dd.interpolationRect = {0, 0, (int)w, (int)h}; + dd.opticalFlowVector = shared(R_OF_VECTOR); + dd.opticalFlowSceneChangeDetection = shared(R_OF_SCD); + dd.opticalFlowBufferSize = {w / 8, h / 8}; // (unused by the shaders: the SDK's provider leaves it too) + dd.opticalFlowScale = {1.0f / w, 1.0f / h}; + dd.opticalFlowBlockSize = 8; + dd.cameraNear = g.near_m; + dd.cameraFar = g.far_m; + dd.cameraFovAngleVertical = g.fov_y; + dd.viewSpaceToMetersFactor = 1; + dd.frameTimeDelta = g.dt_ms; + dd.reset = g.reset; + dd.backBufferTransferFunction = FFX_BACKBUFFER_TRANSFER_FUNCTION_SRGB; + dd.minMaxLuminance[0] = 0; + dd.minMaxLuminance[1] = 1; + dd.frameID = g.frame_id; + dd.dilatedDepth = shared(R_DILATED_DEPTH + g.toggle); + dd.dilatedMotionVectors = shared(R_DILATED_MV + g.toggle); + dd.reconstructedPrevDepth = shared(R_PREV_DEPTH + g.toggle); + e = ffxFrameInterpolationDispatch(&g.fi, &dd); + } + g.drain_ns += t1 - t0, g.sdk_ns += kern_now_ns() - t1; + full_barrier(cb); + vk_fg_mark(cb, FG_T_FI1); + if (e != FFX_OK) { + rt_log("fg: the SDK's optical flow or interpolation failed (%#x): frame generation off for this run", (unsigned)e); + g.failed = true; + return 0; + } + g.gen_ok = true; + g.gen_win = win; + g.gens++, g.resets += g.reset; + if (g.gens == 1) + rt_log("fg: first frame generated: %ux%u from a %ux%u scene (near %g m, far %g m, vertical field of view %.1f " + "degrees), window texture format %d", w, h, g.rw, g.rh, g.near_m, g.far_m, + g.fov_y * 57.29578f, (int)fmt); + if (g.shot_w > 0 && !g.shot_at && frame_step_world_us() >= g.shot_w) g.shot_at = frame; + if (g.shot_at && frame >= g.shot_at && frame < g.shot_at + 3) { + shot(cb, fence, win, fmt, w, h, frame, "real"); + shot(cb, fence, out, VK_FORMAT_R8G8B8A8_UNORM, w, h, frame, g.reset ? "gen-reset" : "gen"); + shot(cb, fence, hl, VK_FORMAT_R8G8B8A8_UNORM, w, h, frame, "hudless"); + full_barrier(cb); + } + return 1; +} + +extern "C" void vk_fg_frame(void) { + if (g.prepared || g.cpu_frame) { + if (g.cpu_us) g.cpu_us[g.ncpu % CPU_RING] = (uint32_t)(g.cpu_frame / 1000); + g.ncpu++; + if (!g.gen_ok) g.skipped++; + } + g.show_out = g.gen_ok ? g.out[g.k].img : VK_NULL_HANDLE; + g.show_win = g.gen_ok ? g.gen_win : VK_NULL_HANDLE; + g.show_hl = g.hl_ok ? g.hl[g.k].img : VK_NULL_HANDLE; + if (g.hl_ok) g.k ^= 1; + g.chain = g.gen_ok; // a frame without a generated picture breaks the chain: the next one starts over + g.prepared = g.hl_ok = g.gen_ok = false; + g.cpu_frame = 0; + if (g.gens >= g.gens_logged + LOG_EVERY) { + static uint64_t from; + rt_log("fg: %llu frames generated (%llu without history, %llu of them at a new scene size), %llu frames prepared " + "without one", (unsigned long long)g.gens, (unsigned long long)g.resets, (unsigned long long)g.resized, + (unsigned long long)g.skipped); + if (g.timed) times_log("last frames", g.gpu, g.timed); + cpu_log("last frames", from); + uint64_t n = g.ncpu - from ? g.ncpu - from : 1; + rt_log("fg cpu last frames: of it recorder drains %.3f ms, the SDK's recording %.3f ms (prepare %.3f ms) a frame " + "(means)", g.drain_ns / 1e6 / n, g.sdk_ns / 1e6 / n, g.prep_ns / 1e6 / n); + g.drain_run += g.drain_ns, g.sdk_run += g.sdk_ns, g.prep_run += g.prep_ns, g.drain_ns = g.sdk_ns = g.prep_ns = 0; + from = g.ncpu; + memset(g.gpu, 0, sizeof g.gpu), g.timed = 0; + g.gens_logged = g.gens; + } +} + +extern "C" void vk_fg_exit_log(void) { + static int done; + if (done || !g.ncpu) return; + done = 1; + rt_log("fg: over the run %llu frames generated (%llu without history, %llu of them at a new scene size), %llu " + "frames prepared without one", (unsigned long long)g.gens, (unsigned long long)g.resets, + (unsigned long long)g.resized, (unsigned long long)g.skipped); + if (g.timed_run) times_log("over the run", g.gpu_run, g.timed_run); + cpu_log("over the run", 0); + rt_log("fg cpu over the run: of it recorder drains %.3f ms, the SDK's recording %.3f ms (prepare %.3f ms) a frame " + "(means)", (g.drain_run + g.drain_ns) / 1e6 / g.ncpu, (g.sdk_run + g.sdk_ns) / 1e6 / g.ncpu, + (g.prep_run + g.prep_ns) / 1e6 / g.ncpu); +} + +extern "C" VkImage vk_fg_present_gen(VkImage presented) { + if (g.test || !g.show_out || presented != g.show_win) return VK_NULL_HANDLE; + return g.show_out; +} + +extern "C" int vk_fg_present_swap(VkImage *img, VkFormat *fmt) { + VkImage s = g.test == 1 ? g.show_out : g.test == 2 ? g.show_hl : VK_NULL_HANDLE; + if (!s) return 0; + *img = s, *fmt = VK_FORMAT_R8G8B8A8_UNORM; + return 1; +} diff --git a/runtime/vk_fg.h b/runtime/vk_fg.h new file mode 100644 index 00000000..a45e7cf6 --- /dev/null +++ b/runtime/vk_fg.h @@ -0,0 +1,85 @@ +// AMD FSR 3 frame generation (vk_fg.cpp): the FidelityFX SDK 1.1.4's frame interpolation and optical flow +// (third_party/FidelityFX, MIT) on its Vulkan backend. Plain C interface: the SDK is C++. +// +// The frame's inputs come from the replay (vk_dlaa.c follows the scene for it, with DLSS off): at the scene's end the +// camera motion vectors and the SDK's prepare step (vk_fg_prepare), before the HUD's first draw the picture without +// the HUD (vk_fg_hudless), at the end of the submission that copied the picture into the window texture the optical +// flow and the interpolation (vk_fg_generate). All of it goes into the replay's command buffer. +#pragma once + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +// The frame generator frame_gen names (TOTK_FRAME_GEN, live: read again after a settings change): off, or AMD FSR 3 on +// the FidelityFX SDK. The one place that reads the string; an unknown value is off. +typedef enum { VK_FG_OFF, VK_FG_FSR3 } VkFgEngine; +VkFgEngine vk_fg_engine(void); +// vk_device.c, after the device exists: with frame_gen = fsr3 makes the shared backend, the optical flow and the +// frame interpolation contexts and logs one line; otherwise does nothing, and vk_fg_wanted makes them at the first +// frame after the menu turns frame generation on. Turned off, the contexts stay until exit (unused). +void vk_fg_init(void); +// 1 while the contexts exist and frame_gen names a generator. +int vk_fg_active(void); +// vk_device.c destroy_all, before the device goes away; harmless when nothing was made. +void vk_fg_release(void); + +// vk_dlaa.c vk_dlaa_frame, once per present: 1 when frame generation follows the scene in the next frame. 0 while +// DLSS runs (dlss), with replay workers or sync_ahead = 1 (the inputs are per frame and recorded in replay order), +// with HDR output, or while the game shows a menu without its world (vk_fg_menu); each reason is logged once. +int vk_fg_wanted(int dlss); +// vk_dlaa.c, the game's thread at each present: 1 while the map or a loading or event fade is open (sampled there, +// read by vk_fg_wanted). +void vk_fg_menu(int open); + +// What the scene end hands over: this frame's depth and camera motion, and the camera. +typedef struct { + VkImage depth, mv; // D32F scene depth (level 0, layer 0) and RG16F camera motion, w x h, GENERAL: last + // frame's window position minus this frame's, scene pixels (vk_dlaa.c mv_pass) + uint32_t w, h; // the scene's size + uint32_t ow, oh; // the output's (the window texture's) + float near_m, far_m, fov_y; // the camera's planes (far 0: none) and vertical field of view (radians) + int inverted, infinite; // device depth 1 is the near plane; the far plane is at infinity + float pos[3], up[3], right[3], fwd[3]; // the camera in world space + int reset; // no history: no camera motion this frame, or a cut (vk_fg_camera) +} VkFgScene; +// The camera from the scene's uniform block rows 0-10 (view 3x4, view-projection, projection, row-major, as in +// vk_dlaa.c note_camera's block), the NVN depth mode (minus_w: clip z -w..w) and the viewport depth range dr: fills s's +// camera fields. Returns 1 at a cut against the last call (over 10 m or 35 degrees, as Savage Wind's frame +// generation tests it), else 0. +int vk_fg_camera(const float *rows, int minus_w, const float dr[2], VkFgScene *s); +// Records the SDK's prepare (dilated depth and motion) into cb, recorder drained here. Makes the contexts again when +// the sizes, the depth convention or the window texture's format changed. 1: done; 0: frame generation off this +// frame (logged). +int vk_fg_prepare(VkCommandBuffer cb, const VkFgScene *s); +// The picture before the HUD: src (level, layer) copied, sRGB-encoded as the game's last draw encodes it into the +// window texture, into an RGBA8 image of the SDK's. No pass open, earlier writes visible (vk_exec_barrier). +int vk_fg_hudless(VkCommandBuffer cb, VkImage src, VkFormat fmt, uint32_t level, uint32_t layer, uint32_t w, uint32_t h); +// The optical flow and the interpolation into cb, after the frame's last draw into the window texture win (fmt, w x h, +// GENERAL, level 0); fence: the submission's timeline value, frame: the present this frame will be (TOTK_FG_SHOT). +// 1: a frame between the last one and this was made. +int vk_fg_generate(VkCommandBuffer cb, uint64_t fence, uint64_t frame, VkImage win, VkFormat fmt, uint32_t w, + uint32_t h); +// GPU timestamps of the frame's steps (TOTK_FG_TIMES, default on with frame generation): FG_T_MV0 resets the frame's +// slot, so it comes first in the frame. +enum { FG_T_MV0, FG_T_MV1, FG_T_PREP0, FG_T_PREP1, FG_T_HL0, FG_T_HL1, FG_T_FI0, FG_T_FI1, FG_T_N }; +void vk_fg_mark(VkCommandBuffer cb, int which); +void vk_fg_cpu(uint64_t ns); // replay-thread time the frame generation recording took, added to the frame's +// vk_dlaa.c vk_dlaa_frame, each present before the frame state is cleared: the frame's counts and times. +void vk_fg_frame(void); +void vk_fg_exit_log(void); // vk_backend.c gfx_exit_log: the run's counts and times, once +// vk_backend.c present_image (testing, TOTK_FG_TEST): 1 = the frame's generated picture, 2 = its picture before the +// HUD in place of the window texture (*img, *fmt). 0: the present is left as it is. +int vk_fg_present_swap(VkImage *img, VkFormat *fmt); +// vk_backend.c present_image, after vk_dlaa_frame: the picture generated between the last frame and the one just +// ended, when presented is the window texture it was generated against (RGBA8 holding the window texture's bytes, +// GENERAL, its size), else VK_NULL_HANDLE (none made, a test swap, or another texture presented). It stays unwritten +// until the replay of the frame after next: its blit is on the queue before the next frame's submissions. +VkImage vk_fg_present_gen(VkImage presented); + +#ifdef __cplusplus +} +#endif diff --git a/runtime/vk_mvprev.c b/runtime/vk_mvprev.c index 386c48c9..86d43b42 100644 --- a/runtime/vk_mvprev.c +++ b/runtime/vk_mvprev.c @@ -1,6 +1,6 @@ -// Last frame's object and bone blocks, for per-object motion vectors (TOTK_DLAA_OBJMV, on with DLAA). The banks kept -// start as c5, c7 and c14 and grow with what the vertex shader variants read (vk_mvprev_want); c7 and c5 are described -// here, the others follow the same two-copy rule. +// Last frame's object and bone blocks, for per-object motion vectors (TOTK_DLAA_OBJMV, on with DLAA, and with frame +// generation unless TOTK_FG_OBJECTS=0). The banks kept start as c5, c7 and c14 and grow with what the vertex shader +// variants read (vk_mvprev_want); c7 and c5 are described here, the others follow the same two-copy rule. // // The scene's vertex shaders read an object's place from bank c7 (gsys_shape: one 3x4 matrix at the start of a // 0x100 block) and a skinned object's bones from c5 (gsys_skeleton: a run of 3x4 matrices), of this frame only. The @@ -172,8 +172,9 @@ static void mvprev_draw_(VkExec *ex) { } void vk_mvprev_frame(void) { - // without DLSS (no NGX, no RTX GPU, dlaa = 0) nothing reads last frame's blocks: P.on stays 0, no tables - if (!vk_dlaa_available()) return; + // without DLSS (no NGX, no RTX GPU, dlaa = 0) and without frame generation's object motion nothing reads last + // frame's blocks: P.on stays 0, no tables + if (!vk_objmv_wanted()) return; if (P.knob < 0) { P.knob = rt_knob("DLAA_OBJMV", "1"); if (P.knob) { @@ -186,7 +187,9 @@ void vk_mvprev_frame(void) { P.timed = rt_knob("MVOBJ_TIMES", "0"); } } - int on = P.knob && cfg_bool("TOTK_DLAA"); + // DLSS: dlaa on (as before frame generation came); frame generation: while it follows the scene with its objects + // (it is off with DLSS) + int on = P.knob && ((vk_dlaa_available() && cfg_bool("TOTK_DLAA")) || vk_fg_objects_on()); if (on != (P.on > 0)) { P.on = on ? 1 : -1; if (P.t[0]) memset(P.t[0], 0, TABLE * sizeof(Seen)), memset(P.t[1], 0, TABLE * sizeof(Seen)); diff --git a/runtime/vk_usnap.c b/runtime/vk_usnap.c index 43356141..fffa84b1 100644 --- a/runtime/vk_usnap.c +++ b/runtime/vk_usnap.c @@ -37,9 +37,10 @@ typedef struct Arena { VkBuffer buf; VmaAllocation alloc; uint8_t *map; - uint8_t *cpu; // with DLSS (vk_dlaa_available), the same bytes in host memory for the CPU's reads (vk_usnap_bytes): - // map is often device memory through the BAR, written fast but read back at about a microsecond a - // cache line. Without DLSS nothing reads them back, and the bytes go into map in one copy. + uint8_t *cpu; // with the per-object motion (vk_objmv_wanted: DLSS, or frame generation with its objects), + // the same bytes in host memory for the CPU's reads (vk_usnap_bytes): map is often device memory + // through the BAR, written fast but read back at about a microsecond a cache line. Without it + // nothing reads them back in bulk, and the bytes go into map in one copy. uint64_t size; } Arena; @@ -52,6 +53,7 @@ static struct { int on; // this submission has a snapshot uint64_t fence, gen; Arena *arena; + uint8_t *host; // the arena's copy the CPU reads: cpu or map (vk_usnap_begin) Rng *col; // collected ranges int ncol, ccol; Reg *reg; // merged, sorted by lo, disjoint @@ -289,10 +291,11 @@ void vk_usnap_begin(const uint64_t *handles, int n, uint64_t fence) { if (!U.nreg) return; if (!(U.arena = arena_get(total))) return; uint8_t *dst = U.arena->map; - if (vk_dlaa_available()) { + if (vk_objmv_wanted()) { if (!U.arena->cpu && !(U.arena->cpu = malloc(U.arena->size))) rt_fatal("vk_usnap: out of memory"); dst = U.arena->cpu; } + U.host = dst; // frame generation turns on and off live: an arena's old host copy may be stale for (int i = 0; i < U.nreg; i++) memcpy(dst + U.reg[i].off, (const void *)(uintptr_t)U.reg[i].lo, U.reg[i].hi - U.reg[i].lo); if (dst != U.arena->map) memcpy(U.arena->map, dst, total); // one sequential write into the device copy @@ -350,8 +353,8 @@ void vk_usnap_drop_at(uint64_t addr, uint64_t n, uint32_t at) { drop(addr, n, at uint64_t vk_usnap_gen(void) { return __atomic_load_n(&U.gen, __ATOMIC_RELAXED); } -// the host copy where there is one (DLSS), else the device copy -static uint8_t *host_copy(void) { return U.arena->cpu ? U.arena->cpu : U.arena->map; } +// the copy vk_usnap_begin wrote this time: the host copy with the per-object motion, else the device copy +static uint8_t *host_copy(void) { return U.host; } const uint8_t *vk_usnap_map(void) { return U.arena ? host_copy() : NULL; } diff --git a/tools/build_game.py b/tools/build_game.py index 8537c550..e8d2aaf3 100644 --- a/tools/build_game.py +++ b/tools/build_game.py @@ -360,7 +360,8 @@ def runtime_sources(skip=()): """Every runtime/*.c, *.cpp, platform/*.c, *.rc, the in-game menu (ui/*.cpp) and Dear ImGui of this OS except the names in skip, so a task adds a file without editing this script.""" pats = ('*.c', '*.cpp', 'platform/*.c', '*.rc', 'ui/*.cpp', 'third_party/imgui/*.cpp', - 'third_party/imgui/backends/*.cpp') + 'third_party/imgui/backends/*.cpp', 'third_party/FidelityFX/sdk/src/shared/*.cpp', 'third_party/FidelityFX/sdk/src/backends/vk/*.cpp', + 'third_party/FidelityFX/sdk/src/components/*/*.cpp') return sorted(p for pat in pats for p in RUNTIME.glob(pat) if p.name not in skip and not other_os(p.name)) @@ -485,7 +486,10 @@ def ninja_file(gen, out, mods, pool_depth, skip=(), prebuilt=(), runtime_lib=Non inc = f'-I {cmd_path(RUNTIME)} -I {cmd_path(gen)}' vma = f'{cmd_path(DEPS / "include")} -I {cmd_path(DEPS / "include" / "vma")}' if DEPS else cmd_path(vma_include()) imgui = cmd_path(RUNTIME / 'third_party' / 'imgui') - rt_inc = f'{inc} -I {cmd_path(out)} -I {vma} -I {imgui}' # romfs_config.h, vk_mem_alloc.h (+ deps headers), imgui.h + ffx = RUNTIME / 'third_party' / 'FidelityFX' + ffx_inc = ' '.join(f'-I {cmd_path(d)}' for d in (ffx / 'sdk' / 'include', ffx / 'sdk' / 'src' / 'backends' / 'shared', + ffx / 'spirv')) # FidelityFX/host headers, ffx_shader_blobs.h, ffx_shaders_vk.h + rt_inc = f'{inc} -I {cmd_path(out)} -I {vma} -I {imgui} {ffx_inc}' # romfs_config.h, vk_mem_alloc.h (+ deps headers), imgui.h libs = [f'-L {cmd_path(DEPS / "lib")}'] + (LLVM_LINK_LIBS if WIN else LINK_LIBS) if DEPS else LINK_LIBS lines = [ '# Written by tools/build_game.py; do not edit.', @@ -508,6 +512,14 @@ def ninja_file(gen, out, mods, pool_depth, skip=(), prebuilt=(), runtime_lib=Non ' depfile = $out.d', ' description = CC $in', '', + # AMD's FidelityFX SDK sources (runtime/third_party/FidelityFX/sdk/src): ffx_compat.h is force-included so they + # build with clang (what MSVC's headers bring in on their own, the _s string functions); -w: AMD's code is not ours to fix + 'rule cc_ffx', + f' command = $cc $rtflags -include ffx_compat.h -I {cmd_path(ffx)} -I {cmd_path(ffx / "sdk" / "src" / "shared")} -w -MD -MF $out.d -c $in -o $out', + ' deps = gcc', + ' depfile = $out.d', + ' description = CC $in', + '', 'rule rc', f' command = {tool_arg(WINDRES)} -I {cmd_path(RUNTIME)} -O coff $in -o $out', ' description = RC $in', @@ -544,7 +556,8 @@ def ninja_file(gen, out, mods, pool_depth, skip=(), prebuilt=(), runtime_lib=Non f'{ninja_path(RUNTIME / "totk.ico")}') else: stamp_dep = (' | ' if not pgo else ' ') + ninja_path(stamp) if stamp else '' - lines.append(f'build {ninja_path(o)}: cc_rt {ninja_path(src)}{pgo}{stamp_dep}') + rule = 'cc_ffx' if src.is_relative_to(ffx / 'sdk') else 'cc_rt' + lines.append(f'build {ninja_path(o)}: {rule} {ninja_path(src)}{pgo}{stamp_dep}') rt.append(o) objs['runtime'] = rt every = [o for v in objs.values() for o in v] diff --git a/tools/ffx_shaders.py b/tools/ffx_shaders.py new file mode 100644 index 00000000..47e6983b --- /dev/null +++ b/tools/ffx_shaders.py @@ -0,0 +1,201 @@ +#!/usr/bin/env python3 +"""FidelityFX frame interpolation and optical flow shaders -> one C header (runtime/vk_fg.cpp). + +Ported from Savage Wind (https://github.com/Revivedx/SavageWindRecomp, MIT), tools/ffx_shaders.py, without its FSR 3 +upscaler effect. + +The SDK builds its shader "permutation" headers with FidelityFX_SC.exe (a Windows-only wrapper around glslang that +also writes each shader's resource bindings). This does the same with glslangValidator and a small SPIR-V reader, +for the permutations used here only: wave32, 32-bit floats, low-resolution motion vectors without jitter, and both +depth directions (frame interpolation); SDR luma (optical flow). The backend (ffx_vk.cpp) takes each blob with its +bindings by name, as FidelityFX_SC writes them. The header is committed (AMD shader builds, no game data), so building +totk.exe needs no shader compiler; run this after changing the GLSL or this script: + + python tools/ffx_shaders.py [] [] + +The defaults are runtime/third_party/FidelityFX/spirv/ffx_shaders_vk.h and glslangValidator from MSYS2 UCRT64 +(C:/msys64/ucrt64/bin) or PATH; the Vulkan SDK's works too. +""" +import os +import struct +import subprocess +import sys +import tempfile +from pathlib import Path + +ROOT = Path(__file__).resolve().parent.parent + +FI_PASSES = [ # FfxFrameInterpolationPass order + 'reconstruct_and_dilate_pass', 'setup_pass', 'reconstruct_previous_depth_pass', 'game_motion_vector_field_pass', + 'optical_flow_vector_field_pass', 'disocclusion_mask_pass', 'pass', 'compute_inpainting_pyramid_pass', + 'inpainting_pass', 'compute_game_vector_field_inpainting_pyramid_pass', 'debug_view_pass'] +OF_PASSES = [ # FfxOpticalflowPass order + 'prepare_luma_pass', 'compute_luminance_pyramid_pass', 'generate_scd_histogram_pass', 'compute_scd_divergence_pass', + 'compute_optical_flow_advanced_pass_v5', 'filter_optical_flow_pass_v5', 'scale_optical_flow_advanced_pass_v5'] + +FI_DEFS = ['-DFFX_FRAMEINTERPOLATION_OPTION_UPSAMPLE_SAMPLERS_USE_DATA_HALF=0', + '-DFFX_FRAMEINTERPOLATION_OPTION_ACCUMULATE_SAMPLERS_USE_DATA_HALF=0', + '-DFFX_FRAMEINTERPOLATION_OPTION_REPROJECT_SAMPLERS_USE_DATA_HALF=1', + '-DFFX_FRAMEINTERPOLATION_OPTION_POSTPROCESSLOCKSTATUS_SAMPLERS_USE_DATA_HALF=0', + '-DFFX_FRAMEINTERPOLATION_OPTION_UPSAMPLE_USE_LANCZOS_TYPE=2', + '-DFFX_FRAMEINTERPOLATION_OPTION_LOW_RES_MOTION_VECTORS=1', + '-DFFX_FRAMEINTERPOLATION_OPTION_JITTER_MOTION_VECTORS=0'] +OF_DEFS = ['-DFFX_OPTICALFLOW_OPTION_HDR_COLOR_INPUT=0'] + +# SPIR-V opcodes / enums used below +OP_NAME, OP_ENTRY, OP_CONSTANT, OP_DECORATE, OP_MEMBER_DECORATE = 5, 15, 43, 71, 72 +OP_TYPE_IMAGE, OP_TYPE_SAMPLER, OP_TYPE_ARRAY, OP_TYPE_RUNTIME_ARRAY, OP_TYPE_STRUCT, OP_TYPE_POINTER, OP_VARIABLE = \ + 25, 26, 28, 29, 30, 32, 59 +DEC_BLOCK, DEC_BUFFER_BLOCK, DEC_NON_WRITABLE, DEC_BINDING, DEC_SET = 2, 3, 24, 33, 34 +SC_UNIFORM_CONSTANT, SC_UNIFORM, SC_STORAGE_BUFFER = 0, 2, 12 +KINDS = ['cb', 'srv_tex', 'uav_tex', 'srv_buf', 'uav_buf', 'sampler'] + + +def spirv_string(words): + b = struct.pack('<%dI' % len(words), *words) + return b[:b.index(0)].decode() + + +def reflect(spv): + """{kind: [(name, binding, count, set)]} for the resources the entry point uses""" + w = struct.unpack('<%dI' % (len(spv) // 4), spv) + names, deco, mdeco, types, consts, ptrs, vars_, iface = {}, {}, {}, {}, {}, {}, [], set() + i = 5 + while i < len(w): + op, n = w[i] & 0xffff, w[i] >> 16 + a = w[i + 1:i + n] + if op == OP_NAME: + names[a[0]] = spirv_string(a[1:]) + elif op == OP_ENTRY: + s = spirv_string(a[2:]) + iface.update(a[2 + (len(s) + 4) // 4:]) + elif op == OP_DECORATE: + deco.setdefault(a[0], {})[a[1]] = a[2] if len(a) > 2 else True + elif op == OP_MEMBER_DECORATE: + mdeco.setdefault(a[0], {}).setdefault(a[1], set()).add(a[2]) + elif op == OP_CONSTANT: + consts[a[1]] = a[2] + elif op in (OP_TYPE_IMAGE, OP_TYPE_SAMPLER, OP_TYPE_ARRAY, OP_TYPE_RUNTIME_ARRAY, OP_TYPE_STRUCT): + types[a[0]] = (op, a[1:]) + elif op == OP_TYPE_POINTER: + ptrs[a[0]] = a[2] + elif op == OP_VARIABLE: + vars_.append((a[1], a[0], a[2])) + i += n + out = {k: [] for k in KINDS} + for v, ptype, sc in vars_: + d = deco.get(v, {}) + if v not in iface or DEC_BINDING not in d: + continue + t, count = ptrs[ptype], 1 + while types.get(t, (0,))[0] == OP_TYPE_ARRAY: + count *= consts[types[t][1][1]] + t = types[t][1][0] + op, args = types[t] + name = names.get(v) or names.get(t) + if op == OP_TYPE_STRUCT: + td = deco.get(t, {}) + members = mdeco.get(t, {}) + ro = len(members) == len(args) and all(DEC_NON_WRITABLE in m for m in members.values()) + if sc == SC_UNIFORM and DEC_BLOCK in td: + kind = 'cb' + else: + kind = 'srv_buf' if ro else 'uav_buf' + elif op == OP_TYPE_IMAGE: + kind = 'uav_tex' if args[5] == 2 else 'srv_tex' + elif op == OP_TYPE_SAMPLER: + kind = 'sampler' + else: + raise SystemExit('unknown resource type for %s' % name) + out[kind].append((name, d[DEC_BINDING], count, d.get(DEC_SET, 0))) + for k in KINDS: + out[k].sort(key=lambda r: r[1]) + return out + + +def compile_glsl(glslang, src, incs, defs, half=0): + with tempfile.TemporaryDirectory() as td: + o = os.path.join(td, 'out.spv') + cmd = [glslang, '-V', '--target-env', 'vulkan1.2', '-S', 'comp', '-Os', '-DFFX_GLSL=1', '-DFFX_GPU=1', + '-DFFX_HALF=%d' % half] + defs + ['-I' + i for i in incs] + ['-o', o, src] + r = subprocess.run(cmd, capture_output=True, text=True) + if r.returncode: + raise SystemExit('%s\n%s%s' % (' '.join(cmd), r.stdout, r.stderr)) + with open(o, 'rb') as f: + return f.read() + + +def default_glslang(): + """glslangValidator from MSYS2 UCRT64 (the toolchain tools/build_shaders.py uses), else PATH.""" + msys = Path('C:/msys64/ucrt64/bin/glslangValidator.exe') + return str(msys) if msys.is_file() else 'glslangValidator' + + +def main(): + args = sys.argv[1:] + effects = {'fi', 'of'} + sdk = str(ROOT / 'runtime' / 'third_party' / 'FidelityFX' / 'sdk') + out = args[0] if args else str(ROOT / 'runtime' / 'third_party' / 'FidelityFX' / 'spirv' / 'ffx_shaders_vk.h') + glslang = args[1] if len(args) > 1 else default_glslang() + gpu = os.path.join(sdk, 'include', 'FidelityFX', 'gpu') + shaders = os.path.join(sdk, 'src', 'backends', 'vk', 'shaders') + blobs = [] # (c name, spv, reflection) + for inv in (0, 1) if 'fi' in effects else (): + for p in FI_PASSES: + src = os.path.join(shaders, 'frameinterpolation', 'ffx_frameinterpolation_%s.glsl' % p) + spv = compile_glsl(glslang, src, [gpu, os.path.join(gpu, 'frameinterpolation')], + FI_DEFS + ['-DFFX_FRAMEINTERPOLATION_OPTION_INVERTED_DEPTH=%d' % inv]) + blobs.append(('fi_%s_%d' % (p, inv), spv, reflect(spv))) + for p in OF_PASSES if 'of' in effects else (): + src = os.path.join(shaders, 'opticalflow', 'ffx_opticalflow_%s.glsl' % p) + spv = compile_glsl(glslang, src, [gpu, os.path.join(gpu, 'opticalflow')], OF_DEFS) + blobs.append(('of_%s' % p, spv, reflect(spv))) + L = ['// Generated by tools/ffx_shaders.py from the AMD FidelityFX SDK (MIT, see runtime/third_party/FidelityFX/LICENSE.txt).', + '// Do not edit.', '#pragma once', '#include ', ''] + for cname, spv, refl in blobs: + words = struct.unpack('<%dI' % (len(spv) // 4), spv) + L.append('static const uint32_t %s_spv[%d] = {' % (cname, len(words))) + for j in range(0, len(words), 12): + L.append(' ' + ','.join('0x%x' % x for x in words[j:j + 12]) + ',') + L.append('};') + for k in KINDS: + r = refl[k] + if not r: + continue + L.append('static const char *%s_%s_names[] = {%s};' % (cname, k, ', '.join('"%s"' % x[0] for x in r))) + for f, idx in (('bind', 1), ('count', 2), ('space', 3)): + L.append('static const uint32_t %s_%s_%s[] = {%s};' % (cname, k, f, ', '.join(str(x[idx]) for x in r))) + L.append('') + + def blob(cname, refl): # FfxShaderBlob's fields in order + f = ['(const uint8_t *)%s_spv' % cname, 'sizeof %s_spv' % cname] + f += [str(len(refl[k])) for k in KINDS[:5]] + [str(len(refl['sampler'])), '0'] + for k in ['cb', 'srv_tex', 'uav_tex', 'srv_buf', 'uav_buf', 'sampler']: + if refl[k]: + f += ['%s_%s_names' % (cname, k)] + ['%s_%s_%s' % (cname, k, x) for x in ('bind', 'count', 'space')] + else: + f += ['0'] * 4 + f += ['0'] * 4 # (ray tracing acceleration structures) + return ' {' + ', '.join(f) + '},' + + if 'fi' in effects: + L.append('// [inverted depth][FfxFrameInterpolationPass]') + L.append('static const FfxShaderBlob ffx_fi_blobs[2][%d] = {' % len(FI_PASSES)) + for inv in (0, 1): + L.append(' {') + L += [blob(c, r) for c, _, r in blobs if c.startswith('fi_') and c.endswith('_%d' % inv)] + L.append(' },') + L.append('};') + if 'of' in effects: + L.append('// [FfxOpticalflowPass]') + L.append('static const FfxShaderBlob ffx_of_blobs[%d] = {' % len(OF_PASSES)) + L += [blob(c, r) for c, _, r in blobs if c.startswith('of_')] + L.append('};') + with open(out, 'w', newline='\n') as f: + f.write('\n'.join(L) + '\n') + total = sum(len(s) for _, s, _ in blobs) + print('%s: %d shaders, %d KB of SPIR-V' % (out, len(blobs), total // 1024)) + + +if __name__ == '__main__': + main() diff --git a/tools/make_release.py b/tools/make_release.py index 35fb77ee..a6c1b5a8 100644 --- a/tools/make_release.py +++ b/tools/make_release.py @@ -368,6 +368,7 @@ def collect_licenses(out): (unpack('sdl3-dll') / 'LICENSE.txt', 'SDL3-LICENSE.txt'), (unpack('zstd') / 'ucrt64' / 'share' / 'licenses' / 'zstd' / 'LICENSE', 'zstd-LICENSE.txt'), (ROOT / 'runtime' / 'shaders' / 'ffx' / 'LICENSE.txt', 'FidelityFX-FSR-LICENSE.txt'), + (ROOT / 'runtime' / 'third_party' / 'FidelityFX' / 'LICENSE.txt', 'FidelityFX-SDK-LICENSE.txt'), (MAIN_ROOT / 'toolchain' / 'hactool' / 'LICENSE', 'hactool-LICENSE.txt'), (MAIN_ROOT / 'refs' / 'MacNativeGames' / 'LICENSE', 'MacNativeGames-LICENSE.txt'), ] diff --git a/tools/make_release_linux.py b/tools/make_release_linux.py index 7e344b41..d56d90c4 100644 --- a/tools/make_release_linux.py +++ b/tools/make_release_linux.py @@ -408,6 +408,7 @@ def collect_licenses(out, sysroot): (WORK / 'zstd' / 'LICENSE', 'zstd-LICENSE.txt'), (out / 'python' / 'lib' / f'python{sys_version(out)}' / 'LICENSE.txt', 'python-LICENSE.txt'), (ROOT / 'runtime' / 'shaders' / 'ffx' / 'LICENSE.txt', 'FidelityFX-FSR-LICENSE.txt'), + (ROOT / 'runtime' / 'third_party' / 'FidelityFX' / 'LICENSE.txt', 'FidelityFX-SDK-LICENSE.txt'), (WORK / 'hactool-linux' / 'LICENSE', 'hactool-LICENSE.txt'), (MAIN_ROOT / 'refs' / 'MacNativeGames' / 'LICENSE', 'MacNativeGames-LICENSE.txt'), ] diff --git a/totk.ini.example b/totk.ini.example index e6a9b805..9e34fb70 100644 --- a/totk.ini.example +++ b/totk.ini.example @@ -20,6 +20,11 @@ # Frame queue: the game starts a frame while the previous one waits for its display time, so a frame that runs long # still makes its turn. Far fewer dropped frames at the limit for up to one frame more input delay. Takes effect at once. # frame_queue = 0 +# Frame generation: off, or fsr3 (AMD FSR 3 frame interpolation). A generated picture goes on screen between each two +# the game draws: twice the pictures, the game at half of fps_limit (the limit counts the pictures shown), the controls +# about half a frame later. For displays of 120 Hz and more; off with DLSS or HDR, and in menus and fades. Applies at +# once. +# frame_gen = off # Real-time frame step: game speed follows the clock instead of the frame count. # realtime = 1 # Cloth simulation on the real-time clock. Needs realtime = 1.