From f83b1aef5accbc3fa864f1ad4036fd22297e8768 Mon Sep 17 00:00:00 2001 From: Carlos Lopez Date: Sat, 11 Jan 2025 15:12:58 -0500 Subject: [PATCH] feat(tunic): rewrite with renodx::draw --- src/games/tunic/addon.cpp | 285 +++++++++++++----- .../tunic/booklet_0xB274BE4D.ps_4_0.hlsl | 101 ------- .../tunic/final00_0x49E25D6C.ps_4_0.hlsl | 26 -- .../tunic/final01_0x55B0DCB7.ps_4_0.hlsl | 85 ------ .../tunic/final02_0x5439FB55.ps_4_0.hlsl | 39 --- .../tunic/final03_0x54E583C8.ps_4_0.hlsl | 31 -- ...s_4_0.hlsl => glow_0x4AC5CC39.ps_4_0.hlsl} | 41 ++- src/games/tunic/intro_0x1CCE11A3.ps_4_0.hlsl | 37 --- .../tunic/lutsample2_0xAA66A0B6.ps_4_0.hlsl | 52 ++-- .../tunic/lutsample_0xEEFE9737.ps_4_0.hlsl | 52 ++-- src/games/tunic/shared.h | 69 +++-- .../swap_chain_proxy_pixel_shader.ps_4_0.hlsl | 8 + ...swap_chain_proxy_vertex_shader.vs_4_0.hlsl | 6 + 13 files changed, 334 insertions(+), 498 deletions(-) delete mode 100644 src/games/tunic/booklet_0xB274BE4D.ps_4_0.hlsl delete mode 100644 src/games/tunic/final00_0x49E25D6C.ps_4_0.hlsl delete mode 100644 src/games/tunic/final01_0x55B0DCB7.ps_4_0.hlsl delete mode 100644 src/games/tunic/final02_0x5439FB55.ps_4_0.hlsl delete mode 100644 src/games/tunic/final03_0x54E583C8.ps_4_0.hlsl rename src/games/tunic/{final04_0x4AC5CC39.ps_4_0.hlsl => glow_0x4AC5CC39.ps_4_0.hlsl} (71%) delete mode 100644 src/games/tunic/intro_0x1CCE11A3.ps_4_0.hlsl create mode 100644 src/games/tunic/swap_chain_proxy_pixel_shader.ps_4_0.hlsl create mode 100644 src/games/tunic/swap_chain_proxy_vertex_shader.vs_4_0.hlsl diff --git a/src/games/tunic/addon.cpp b/src/games/tunic/addon.cpp index ac019bc6..baa3c4fb 100644 --- a/src/games/tunic/addon.cpp +++ b/src/games/tunic/addon.cpp @@ -7,19 +7,11 @@ #define DEBUG_LEVEL_0 -#include -#include -#include -#include -#include -#include -#include -#include -#include - #include #include +#include + #include "../../mods/shader.hpp" #include "../../mods/swapchain.hpp" #include "../../utils/settings.hpp" @@ -28,34 +20,38 @@ namespace { renodx::mods::shader::CustomShaders custom_shaders = { - CustomShaderEntry(0x49E25D6C), // final - CustomShaderEntry(0x1CCE11A3), // UI/video - CustomShaderEntry(0xB274BE4D), // booklet - CustomShaderEntry(0x55B0DCB7), CustomShaderEntry(0xEEFE9737), // LUT CustomShaderEntry(0xAA66A0B6), // LUT + Noise - CustomShaderEntry(0x5439FB55), - CustomShaderEntry(0x54E583C8), // glow effect - CustomShaderEntry(0x4AC5CC39) // tonemapper + CustomShaderEntry(0x4AC5CC39) // glow }; ShaderInjectData shader_injection; renodx::utils::settings::Settings settings = { new renodx::utils::settings::Setting{ - .key = "toneMapType", - .binding = &shader_injection.toneMapType, + .key = "SettingsMode", .value_type = renodx::utils::settings::SettingValueType::INTEGER, - .default_value = 3.f, + .default_value = 0.f, .can_reset = false, + .label = "Settings Mode", + .labels = {"Simple", "Intermediate", "Advanced"}, + .is_global = true, + }, + new renodx::utils::settings::Setting{ + .key = "ToneMapType", + .binding = &RENODX_TONE_MAP_TYPE, + .value_type = renodx::utils::settings::SettingValueType::INTEGER, + .default_value = 3.f, + .can_reset = true, .label = "Tone Mapper", .section = "Tone Mapping", .tooltip = "Sets the tone mapper type", .labels = {"Vanilla", "None", "ACES", "RenoDRT"}, + .is_visible = []() { return settings[0]->GetValue() >= 1; }, }, new renodx::utils::settings::Setting{ - .key = "toneMapPeakNits", - .binding = &shader_injection.toneMapPeakNits, + .key = "ToneMapPeakNits", + .binding = &RENODX_PEAK_WHITE_NITS, .default_value = 1000.f, .can_reset = false, .label = "Peak Brightness", @@ -65,8 +61,8 @@ renodx::utils::settings::Settings settings = { .max = 4000.f, }, new renodx::utils::settings::Setting{ - .key = "toneMapGameNits", - .binding = &shader_injection.toneMapGameNits, + .key = "ToneMapGameNits", + .binding = &RENODX_DIFFUSE_WHITE_NITS, .default_value = 203.f, .label = "Game Brightness", .section = "Tone Mapping", @@ -75,8 +71,8 @@ renodx::utils::settings::Settings settings = { .max = 500.f, }, new renodx::utils::settings::Setting{ - .key = "toneMapUINits", - .binding = &shader_injection.toneMapUINits, + .key = "ToneMapUINits", + .binding = &RENODX_GRAPHICS_WHITE_NITS, .default_value = 203.f, .label = "UI Brightness", .section = "Tone Mapping", @@ -85,46 +81,110 @@ renodx::utils::settings::Settings settings = { .max = 500.f, }, new renodx::utils::settings::Setting{ - .key = "toneMapHueCorrection", - .binding = &shader_injection.toneMapHueCorrection, + .key = "ToneMapHueProcessor", + .binding = &RENODX_TONE_MAP_HUE_PROCESSOR, + .value_type = renodx::utils::settings::SettingValueType::INTEGER, + .default_value = 0.f, + .label = "Hue Processor", + .section = "Tone Mapping", + .tooltip = "Selects hue processor", + .labels = {"OKLab", "ICtCp", "darkTable UCS"}, + .is_enabled = []() { return RENODX_TONE_MAP_TYPE >= 1; }, + .is_visible = []() { return settings[0]->GetValue() >= 2; }, + }, + new renodx::utils::settings::Setting{ + .key = "ToneMapHueShift", + .binding = &RENODX_TONE_MAP_HUE_SHIFT, + .default_value = 100.f, + .label = "Hue Shift", + .section = "Tone Mapping", + .tooltip = "Hue-shift emulation strength.", + .min = 0.f, + .max = 100.f, + .is_enabled = []() { return RENODX_TONE_MAP_TYPE >= 1; }, + .parse = [](float value) { return value * 0.01f; }, + .is_visible = []() { return settings[0]->GetValue() >= 1; }, + }, + new renodx::utils::settings::Setting{ + .key = "ToneMapWorkingColorSpace", + .binding = &RENODX_TONE_MAP_WORKING_COLOR_SPACE, + .value_type = renodx::utils::settings::SettingValueType::INTEGER, + .default_value = 0.f, + .label = "Working Color Space", + .section = "Tone Mapping", + .labels = {"BT709", "BT2020", "AP1"}, + .is_enabled = []() { return RENODX_TONE_MAP_TYPE >= 1; }, + .is_visible = []() { return settings[0]->GetValue() >= 2; }, + }, + new renodx::utils::settings::Setting{ + .key = "ToneMapHueCorrection", + .binding = &RENODX_TONE_MAP_HUE_CORRECTION, .default_value = 100.f, .label = "Hue Correction", .section = "Tone Mapping", - .tooltip = "Emulates Vanilla hue shifts.", + .tooltip = "Hue retention strength.", .min = 0.f, .max = 100.f, + .is_enabled = []() { return RENODX_TONE_MAP_TYPE >= 1; }, .parse = [](float value) { return value * 0.01f; }, + .is_visible = []() { return settings[0]->GetValue() >= 2; }, + }, + new renodx::utils::settings::Setting{ + .key = "GammaCorrection", + .binding = &RENODX_GAMMA_CORRECTION, + .value_type = renodx::utils::settings::SettingValueType::INTEGER, + .default_value = 1.f, + .label = "Gamma Correction", + .section = "Tone Mapping", + .tooltip = "Emulates a display EOTF.", + .labels = {"Off", "2.2", "BT.1886"}, + .is_visible = []() { return settings[0]->GetValue() >= 1; }, + }, + new renodx::utils::settings::Setting{ + .key = "ToneMapScaling", + .binding = &RENODX_TONE_MAP_PER_CHANNEL, + .value_type = renodx::utils::settings::SettingValueType::INTEGER, + .default_value = 0.f, + .label = "Scaling", + .section = "Tone Mapping", + .tooltip = "Luminance scales colors consistently while per-channel saturates and blows out sooner", + .labels = {"Luminance", "Per Channel"}, + .is_enabled = []() { return RENODX_TONE_MAP_TYPE >= 1; }, + .is_visible = []() { return settings[0]->GetValue() >= 2; }, }, new renodx::utils::settings::Setting{ - .key = "colorGradeExposure", - .binding = &shader_injection.colorGradeExposure, + .key = "ColorGradeExposure", + .binding = &RENODX_TONE_MAP_EXPOSURE, .default_value = 1.f, .label = "Exposure", .section = "Color Grading", - .max = 10.f, + .max = 2.f, .format = "%.2f", + .is_visible = []() { return settings[0]->GetValue() >= 1; }, }, new renodx::utils::settings::Setting{ - .key = "colorGradeHighlights", - .binding = &shader_injection.colorGradeHighlights, + .key = "ColorGradeHighlights", + .binding = &RENODX_TONE_MAP_HIGHLIGHTS, .default_value = 50.f, .label = "Highlights", .section = "Color Grading", .max = 100.f, .parse = [](float value) { return value * 0.02f; }, + .is_visible = []() { return settings[0]->GetValue() >= 1; }, }, new renodx::utils::settings::Setting{ - .key = "colorGradeShadows", - .binding = &shader_injection.colorGradeShadows, + .key = "ColorGradeShadows", + .binding = &RENODX_TONE_MAP_SHADOWS, .default_value = 50.f, .label = "Shadows", .section = "Color Grading", .max = 100.f, .parse = [](float value) { return value * 0.02f; }, + .is_visible = []() { return settings[0]->GetValue() >= 1; }, }, new renodx::utils::settings::Setting{ - .key = "colorGradeContrast", - .binding = &shader_injection.colorGradeContrast, + .key = "ColorGradeContrast", + .binding = &RENODX_TONE_MAP_CONTRAST, .default_value = 50.f, .label = "Contrast", .section = "Color Grading", @@ -132,8 +192,8 @@ renodx::utils::settings::Settings settings = { .parse = [](float value) { return value * 0.02f; }, }, new renodx::utils::settings::Setting{ - .key = "colorGradeSaturation", - .binding = &shader_injection.colorGradeSaturation, + .key = "ColorGradeSaturation", + .binding = &RENODX_TONE_MAP_SATURATION, .default_value = 50.f, .label = "Saturation", .section = "Color Grading", @@ -141,9 +201,21 @@ renodx::utils::settings::Settings settings = { .parse = [](float value) { return value * 0.02f; }, }, new renodx::utils::settings::Setting{ - .key = "colorGradeBlowout", - .binding = &shader_injection.colorGradeBlowout, + .key = "ColorGradeHighlightSaturation", + .binding = &RENODX_TONE_MAP_HIGHLIGHT_SATURATION, .default_value = 50.f, + .label = "Highlight Saturation", + .section = "Color Grading", + .tooltip = "Adds or removes highlight color.", + .max = 100.f, + .is_enabled = []() { return RENODX_TONE_MAP_TYPE >= 1; }, + .parse = [](float value) { return value * 0.02f; }, + .is_visible = []() { return settings[0]->GetValue() >= 1; }, + }, + new renodx::utils::settings::Setting{ + .key = "ColorGradeBlowout", + .binding = &RENODX_TONE_MAP_BLOWOUT, + .default_value = 0.f, .label = "Blowout", .section = "Color Grading", .tooltip = "Controls highlight desaturation due to overexposure.", @@ -151,17 +223,29 @@ renodx::utils::settings::Settings settings = { .parse = [](float value) { return value * 0.01f; }, }, new renodx::utils::settings::Setting{ - .key = "colorGradeLUTStrength", - .binding = &shader_injection.colorGradeLUTStrength, + .key = "ColorGradeFlare", + .binding = &RENODX_TONE_MAP_FLARE, + .default_value = 0.f, + .label = "Flare", + .section = "Color Grading", + .tooltip = "Flare/Glare Compensation", + .max = 100.f, + .is_enabled = []() { return RENODX_TONE_MAP_TYPE == 3; }, + .parse = [](float value) { return value * 0.02f; }, + }, + new renodx::utils::settings::Setting{ + .key = "ColorGradeLUTStrength", + .binding = &CUSTOM_LUT_STRENGTH, .default_value = 100.f, .label = "LUT Strength", .section = "Color Grading", .max = 100.f, .parse = [](float value) { return value * 0.01f; }, + .is_visible = []() { return settings[0]->GetValue() >= 1; }, }, new renodx::utils::settings::Setting{ - .key = "colorGradeLUTScaling", - .binding = &shader_injection.colorGradeLUTScaling, + .key = "ColorGradeLUTScaling", + .binding = &CUSTOM_LUT_SCALING, .default_value = 100.f, .label = "LUT Scaling", .section = "Color Grading", @@ -170,8 +254,8 @@ renodx::utils::settings::Settings settings = { .parse = [](float value) { return value * 0.01f; }, }, new renodx::utils::settings::Setting{ - .key = "fxNoise", - .binding = &shader_injection.fxNoise, + .key = "FxNoise", + .binding = &CUSTOM_NOISE, .default_value = 50.f, .label = "Noise", .section = "Effects", @@ -180,50 +264,101 @@ renodx::utils::settings::Settings settings = { .parse = [](float value) { return value * 0.02f; }, }, new renodx::utils::settings::Setting{ - .key = "fxScreenGlow", - .binding = &shader_injection.fxScreenGlow, + .key = "FxScreenGlow", + .binding = &CUSTOM_SCREEN_GLOW, .default_value = 100.f, .label = "Screen Glow", .section = "Effects", .max = 100.f, .parse = [](float value) { return value * 0.01f; }, }, + new renodx::utils::settings::Setting{ + .key = "FxMotionBlur", + .binding = &CUSTOM_MOTION_BLUR, + .default_value = 100.f, + .label = "Motion Blur", + .section = "Effects", + .max = 100.f, + .parse = [](float value) { return value * 0.01f; }, + .is_visible = []() { return settings[0]->GetValue() >= 1; }, + }, new renodx::utils::settings::Setting{ .value_type = renodx::utils::settings::SettingValueType::BUTTON, - .label = "Discord", - .section = "Links", + .label = "Reset All", + .section = "Options", + .group = "button-line-1", + .on_change = []() { + for (auto setting : settings) { + if (setting->key.empty()) continue; + if (!setting->can_reset) continue; + renodx::utils::settings::UpdateSetting(setting->key, setting->default_value); + } + }, + }, + new renodx::utils::settings::Setting{ + .value_type = renodx::utils::settings::SettingValueType::BUTTON, + .label = "HDR Look", + .section = "Options", .group = "button-line-1", + .on_change = []() { + for (auto setting : settings) { + if (setting->key.empty()) continue; + if (!setting->can_reset) continue; + if (setting->key == "ColorGradeSaturation" || setting->key == "ColorGradeContrast" || setting->key == "ColorGradeBlowout") { + renodx::utils::settings::UpdateSetting(setting->key, 80.f); + } else { + renodx::utils::settings::UpdateSetting(setting->key, setting->default_value); + } + } + }, + }, + new renodx::utils::settings::Setting{ + .value_type = renodx::utils::settings::SettingValueType::BUTTON, + .label = "Discord", + .section = "Options", + .group = "button-line-2", .tint = 0x5865F2, .on_change = []() { - system("start https://discord.gg/5WZXDpmbpP"); + renodx::utils::platform::Launch( + "https://discord.gg/" + "5WZXDpmbpP"); }, }, new renodx::utils::settings::Setting{ .value_type = renodx::utils::settings::SettingValueType::BUTTON, .label = "Github", - .section = "Links", - .group = "button-line-1", + .section = "Options", + .group = "button-line-2", .on_change = []() { - system("start https://github.com/clshortfuse/renodx"); + renodx::utils::platform::Launch("https://github.com/clshortfuse/renodx"); }, }, }; void OnPresetOff() { - renodx::utils::settings::UpdateSetting("toneMapType", 0.f); - renodx::utils::settings::UpdateSetting("toneMapPeakNits", 203.f); - renodx::utils::settings::UpdateSetting("toneMapGameNits", 203.f); - renodx::utils::settings::UpdateSetting("toneMapUINits", 203.f); - renodx::utils::settings::UpdateSetting("colorGradeExposure", 1.f); - renodx::utils::settings::UpdateSetting("colorGradeHighlights", 50.f); - renodx::utils::settings::UpdateSetting("colorGradeShadows", 50.f); - renodx::utils::settings::UpdateSetting("colorGradeContrast", 50.f); - renodx::utils::settings::UpdateSetting("colorGradeSaturation", 50.f); - renodx::utils::settings::UpdateSetting("colorGradeBlowout", 0.f); - renodx::utils::settings::UpdateSetting("colorGradeLUTStrength", 100.f); - renodx::utils::settings::UpdateSetting("colorGradeLUTScaling", 0.f); - renodx::utils::settings::UpdateSetting("fxNoise", 50.f); - renodx::utils::settings::UpdateSetting("fxScreenGlow", 100.f); + renodx::utils::settings::UpdateSetting("ToneMapType", 0.f); + renodx::utils::settings::UpdateSetting("ToneMapPeakNits", 203.f); + renodx::utils::settings::UpdateSetting("ToneMapGameNits", 203.f); + renodx::utils::settings::UpdateSetting("ToneMapUINits", 203.f); + // renodx::utils::settings::UpdateSetting("ToneMapHueProcessor", 1.f); + // renodx::utils::settings::UpdateSetting("ToneMapHueShift", 1.f); + // renodx::utils::settings::UpdateSetting("ToneMapWorkingColorSpace", 1.f); + // renodx::utils::settings::UpdateSetting("ToneMapHueCorrection", 1.f); + renodx::utils::settings::UpdateSetting("GammaCorrection", 0.f); + // renodx::utils::settings::UpdateSetting("ToneMapScaling", 1.f); + // renodx::utils::settings::UpdateSetting("ColorGradeExposure", 1.f); + // renodx::utils::settings::UpdateSetting("ColorGradeHighlights", 1.f); + // renodx::utils::settings::UpdateSetting("ColorGradeShadows", 1.f); + // renodx::utils::settings::UpdateSetting("ColorGradeContrast", 1.f); + // renodx::utils::settings::UpdateSetting("ColorGradeSaturation", 1.f); + // renodx::utils::settings::UpdateSetting("ColorGradeHighlightSaturation", 1.f); + // renodx::utils::settings::UpdateSetting("ColorGradeBlowout", 1.f); + // renodx::utils::settings::UpdateSetting("ColorGradeFlare", 1.f); + renodx::utils::settings::UpdateSetting("ColorGradeLUTStrength", 100.f); + renodx::utils::settings::UpdateSetting("ColorGradeLUTScaling", 0.f); + renodx::utils::settings::UpdateSetting("FxNoise", 50.f); + renodx::utils::settings::UpdateSetting("FxScreenGlow", 100.f); + renodx::utils::settings::UpdateSetting("FxMotionBlur", 100.f); } bool fired_on_init_swapchain = false; @@ -233,8 +368,8 @@ void OnInitSwapchain(reshade::api::swapchain* swapchain) { fired_on_init_swapchain = true; auto peak = renodx::utils::swapchain::GetPeakNits(swapchain); if (peak.has_value()) { - settings[1]->default_value = peak.value(); - settings[1]->can_reset = true; + settings[2]->default_value = peak.value(); + settings[2]->can_reset = true; } } @@ -248,6 +383,10 @@ BOOL APIENTRY DllMain(HMODULE h_module, DWORD fdw_reason, LPVOID lpv_reserved) { case DLL_PROCESS_ATTACH: if (!reshade::register_addon(h_module)) return FALSE; + renodx::mods::swapchain::use_resource_cloning = true; + renodx::mods::swapchain::swap_chain_proxy_vertex_shader = __swap_chain_proxy_vertex_shader; + renodx::mods::swapchain::swap_chain_proxy_pixel_shader = __swap_chain_proxy_pixel_shader; + // Always upgrade first of format renodx::mods::swapchain::swap_chain_upgrade_targets.push_back({ .old_format = reshade::api::format::r8g8b8a8_typeless, @@ -271,7 +410,7 @@ BOOL APIENTRY DllMain(HMODULE h_module, DWORD fdw_reason, LPVOID lpv_reserved) { renodx::utils::settings::Use(fdw_reason, &settings, &OnPresetOff); - renodx::mods::swapchain::Use(fdw_reason); + renodx::mods::swapchain::Use(fdw_reason, &shader_injection); renodx::mods::shader::Use(fdw_reason, custom_shaders, &shader_injection); diff --git a/src/games/tunic/booklet_0xB274BE4D.ps_4_0.hlsl b/src/games/tunic/booklet_0xB274BE4D.ps_4_0.hlsl deleted file mode 100644 index c6fe0802..00000000 --- a/src/games/tunic/booklet_0xB274BE4D.ps_4_0.hlsl +++ /dev/null @@ -1,101 +0,0 @@ -// booklet - -#include "./shared.h" - -Texture2D t1 : register(t1); - -Texture2D t0 : register(t0); - -SamplerState s1_s : register(s1); - -SamplerState s0_s : register(s0); - -cbuffer cb0 : register(b0) { - float4 cb0[5]; -} - -// 3Dmigoto declarations -#define cmp - - -void main( - float4 v0 : SV_POSITION0, - float2 v1 : TEXCOORD0, - float2 w1 : TEXCOORD1, - out float4 o0 : SV_Target0 -) { - const float4 icb[] = { - { 0.624630, 0.543370, 0.827900, 0}, - {-0.134140, -0.944880, 0.954350, 0}, - { 0.387720, -0.434750, 0.582530, 0}, - { 0.121260, -0.192820, 0.227780, 0}, - {-0.203880, 0.111330, 0.232300, 0}, - { 0.831140, -0.292180, 0.881000, 0}, - { 0.107590, -0.578390, 0.588310, 0}, - { 0.282850, 0.790360, 0.839450, 0}, - {-0.366220, 0.395160, 0.538760, 0}, - { 0.755910, 0.219160, 0.787040, 0}, - {-0.526100, 0.023860, 0.526640, 0}, - {-0.882160, -0.244710, 0.915470, 0}, - {-0.488880, -0.293300, 0.570110, 0}, - { 0.440140, -0.085580, 0.448380, 0}, - { 0.211790, 0.513730, 0.555670, 0}, - { 0.054830, 0.957010, 0.958580, 0}, - {-0.590010, -0.705090, 0.919380, 0}, - {-0.800650, 0.246310, 0.837680, 0}, - {-0.194240, -0.184020, 0.267570, 0}, - {-0.436670, 0.767510, 0.883040, 0}, - { 0.216660, 0.116020, 0.245770, 0}, - { 0.156960, -0.856000, 0.870270, 0}, - {-0.758210, 0.583630, 0.956820, 0}, - { 0.992840, -0.029040, 0.993270, 0}, - {-0.222340, -0.579070, 0.620290, 0}, - { 0.550520, -0.669840, 0.867040, 0}, - { 0.464310, 0.281150, 0.542800, 0}, - {-0.072140, 0.605540, 0.609820, 0} - }; - float4 r0, r1, r2, r3, r4, r5; - uint4 bitmask, uiDest; - float4 fDest; - - r0.xyzw = t0.Sample(s1_s, w1.xy).xyzw; - r1.xyzw = t1.Sample(s0_s, w1.xy).xyzw; - r2.xy = cb0[3].xy * r1.ww; - r2.xy = cb0[4].ww * r2.xy; - r0.w = 0.25 * r1.w; - r0.w = max(0.100000001, r0.w); - r3.xyz = r1.xyz * r0.www; - r4.xyz = r3.xyz; - r2.z = r0.w; - r2.w = 0; - while (true) { - r3.w = cmp((int)r2.w >= 28); - if (r3.w != 0) break; - r5.xy = icb[r2.w + 0].xy * r2.xy + w1.xy; - r5.xyzw = t1.Sample(s0_s, r5.xy).xyzw; - r3.w = -r1.w * icb[r2.w + 0].z + r5.w; - r3.w = 0.264999986 + r3.w; - r3.w = saturate(3.77358508 * r3.w); - r4.w = r3.w * -2 + 3; - r3.w = r3.w * r3.w; - r5.w = r4.w * r3.w; - r4.xyz = r5.xyz * r5.www + r4.xyz; - r2.z = r4.w * r3.w + r2.z; - r2.w = (int)r2.w + 1; - } - r0.w = 9.99999975e-06 + r2.z; - r2.xyz = r4.xyz / r0.www; - r0.w = -0.649999976 + r1.w; - r0.w = saturate(4.99999905 * r0.w); - r2.w = r0.w * -2 + 3; - r0.w = r0.w * r0.w; - r0.w = r2.w * r0.w; - r0.xyz = -r2.xyz + r0.xyz; - r0.xyz = r0.www * r0.xyz + r2.xyz; - r2.x = cmp(r1.w < 0.00999999978); - r0.w = r1.w; - o0.xyzw = r2.xxxx ? r1.xyzw : r0.xyzw; - - o0.rgb = pow(saturate(o0.rgb), 2.2f); - o0.rgb *= injectedData.toneMapUINits / 80.f; - return; -} diff --git a/src/games/tunic/final00_0x49E25D6C.ps_4_0.hlsl b/src/games/tunic/final00_0x49E25D6C.ps_4_0.hlsl deleted file mode 100644 index 49e5ed76..00000000 --- a/src/games/tunic/final00_0x49E25D6C.ps_4_0.hlsl +++ /dev/null @@ -1,26 +0,0 @@ -// Final render (everything) - -#include "./shared.h" - -Texture2D t0 : register(t0); - -SamplerState s0_s : register(s0); - -cbuffer cb0 : register(b0) { - float4 cb0[4]; -} - -// 3Dmigoto declarations -#define cmp - - -float4 main(float4 v0 : SV_POSITION0, float2 v1 : TEXCOORD0) : SV_Target0 { - float4 r0; - - const float4 inputColor = t0.Sample(s0_s, v1.xy).xyzw; - - r0.xyzw = inputColor; - - float4 outputColor = cb0[3].xyzw * r0.xyzw; - - return outputColor; -} diff --git a/src/games/tunic/final01_0x55B0DCB7.ps_4_0.hlsl b/src/games/tunic/final01_0x55B0DCB7.ps_4_0.hlsl deleted file mode 100644 index ad8eeb5c..00000000 --- a/src/games/tunic/final01_0x55B0DCB7.ps_4_0.hlsl +++ /dev/null @@ -1,85 +0,0 @@ -#include "./shared.h" - -Texture2D t2 : register(t2); - -Texture2D t1 : register(t1); - -Texture2D t0 : register(t0); - -SamplerState s2_s : register(s2); - -SamplerState s1_s : register(s1); - -SamplerState s0_s : register(s0); - -cbuffer cb1 : register(b1) -{ - float4 cb1[1]; -} - -cbuffer cb0 : register(b0) -{ - float4 cb0[23]; -} - - - - -// 3Dmigoto declarations -#define cmp - - - -void main( - float4 v0 : SV_POSITION0, - float4 v1 : COLOR0, - float4 v2 : TEXCOORD0, - float4 v3 : TEXCOORD1, - float4 v4 : TEXCOORD2, - float4 v5 : TEXCOORD3, - float4 v6 : TEXCOORD5, - out float4 o0 : SV_Target0) -{ - float4 r0,r1,r2,r3; - uint4 bitmask, uiDest; - float4 fDest; - - r0.xyzw = t0.Sample(s2_s, v2.xy).xyzw; - r0.x = -v3.x + r0.w; - r0.y = v3.z + -r0.w; - r0.x = cmp(r0.x < 0); - if (r0.x != 0) discard; - r0.x = cb0[22].w * cb0[6].x; - r0.x = v3.y * r0.x; - r0.z = min(1, r0.x); - r0.x = 0.5 * r0.x; - r0.z = sqrt(r0.z); - r0.w = saturate(r0.y * v3.y + r0.x); - r0.x = r0.y * v3.y + -r0.x; - r0.y = r0.w * r0.z; - r0.zw = cb0[4].zw * cb1[0].yy + v6.zw; - r1.xyzw = t2.Sample(s1_s, r0.zw).xyzw; - r1.xyzw = cb0[5].xyzw * r1.xyzw; - r1.xyz = r1.xyz * r1.www; - r2.xyz = cb0[3].xyz * v1.xyz; - r0.zw = cb0[2].xy * cb1[0].yy + v6.xy; - r3.xyzw = t1.Sample(s0_s, r0.zw).xyzw; - r2.xyz = r3.xyz * r2.xyz; - r3.w = cb0[3].w * r3.w; - r3.xyz = r3.www * r2.xyz; - r1.xyzw = -r3.xyzw + r1.xyzw; - r1.xyzw = r0.yyyy * r1.xyzw + r3.xyzw; - r0.y = cb0[22].w * cb0[4].y; - r0.z = v3.y * r0.y; - r0.y = r0.y * v3.y + 1; - r0.x = r0.z * 0.5 + r0.x; - r0.x = saturate(r0.x / r0.y); - r0.x = 1 + -r0.x; - r0.xyzw = r1.xyzw * r0.xxxx; - o0.xyzw = v1.wwww * r0.xyzw; - - - o0.rgb = pow(saturate(o0.rgb), 2.2f); - o0.rgb *= injectedData.toneMapUINits / 80.f; - - return; -} \ No newline at end of file diff --git a/src/games/tunic/final02_0x5439FB55.ps_4_0.hlsl b/src/games/tunic/final02_0x5439FB55.ps_4_0.hlsl deleted file mode 100644 index fc1a6285..00000000 --- a/src/games/tunic/final02_0x5439FB55.ps_4_0.hlsl +++ /dev/null @@ -1,39 +0,0 @@ -// UI Component - -#include "./shared.h" - -Texture2D t0 : register(t0); - -SamplerState s0_s : register(s0); - -cbuffer cb0 : register(b0) -{ - float4 cb0[4]; -} - -// 3Dmigoto declarations -#define cmp - - -void main( - float4 v0 : SV_POSITION0, - float4 v1 : COLOR0, - float4 v2 : TEXCOORD0, - float4 v3 : TEXCOORD1, - float4 v4 : TEXCOORD2, - out float4 o0 : SV_Target0) -{ - float4 r0; - uint4 bitmask, uiDest; - float4 fDest; - - const float4 inputColor = t0.Sample(s0_s, v2.xy).xyzw; - r0.xyzw = inputColor; - r0.xyzw = cb0[3].xyzw + r0.xyzw; - r0.xyzw = v1.xyzw * r0.xyzw; - o0.xyz = r0.xyz * r0.www; - o0.w = r0.w; - - o0.rgb = pow(saturate(o0.rgb), 2.2f); - o0.rgb *= injectedData.toneMapUINits / 80.f; - return; -} \ No newline at end of file diff --git a/src/games/tunic/final03_0x54E583C8.ps_4_0.hlsl b/src/games/tunic/final03_0x54E583C8.ps_4_0.hlsl deleted file mode 100644 index ac364bbe..00000000 --- a/src/games/tunic/final03_0x54E583C8.ps_4_0.hlsl +++ /dev/null @@ -1,31 +0,0 @@ -#include "./shared.h" - -Texture2D t0 : register(t0); - -SamplerState s0_s : register(s0); - -// 3Dmigoto declarations -#define cmp - - - -void main( - float4 v0 : SV_POSITION0, - float2 v1 : TEXCOORD0, - float4 v2 : COLOR0, - out float4 o0 : SV_Target0) -{ - float4 r0,r1; - uint4 bitmask, uiDest; - float4 fDest; - - r0.xyzw = t0.Sample(s0_s, v1.xy).xyzw; - r1.x = r0.w * v2.w + -0.00999999978; - r0.xyzw = v2.xyzw * r0.xyzw; - o0.xyzw = r0.xyzw; - r0.x = cmp(r1.x < 0); - if (r0.x != 0) discard; - - o0.rgb = pow(saturate(o0.rgb), 2.2f); - o0.rgb *= injectedData.toneMapUINits / 80.f; - return; -} \ No newline at end of file diff --git a/src/games/tunic/final04_0x4AC5CC39.ps_4_0.hlsl b/src/games/tunic/glow_0x4AC5CC39.ps_4_0.hlsl similarity index 71% rename from src/games/tunic/final04_0x4AC5CC39.ps_4_0.hlsl rename to src/games/tunic/glow_0x4AC5CC39.ps_4_0.hlsl index d492095a..c6dc922f 100644 --- a/src/games/tunic/final04_0x4AC5CC39.ps_4_0.hlsl +++ b/src/games/tunic/glow_0x4AC5CC39.ps_4_0.hlsl @@ -25,7 +25,7 @@ cbuffer cb0 : register(b0) { // 3Dmigoto declarations #define cmp - -void main(float4 v0 : SV_POSITION0, float2 v1 : TEXCOORD0, out float4 o0 : SV_Target0) { +void main(float4 v0: SV_POSITION0, float2 v1: TEXCOORD0, out float4 o0: SV_Target0) { float4 r0, r1, r2; uint4 bitmask, uiDest; float4 fDest; @@ -67,22 +67,20 @@ void main(float4 v0 : SV_POSITION0, float2 v1 : TEXCOORD0, out float4 o0 : SV_Ta r0.y = -r0.y * r1.z + 1; r1.y = v1.y; r1.xy = r1.xy * cb0[4].xy + cb0[4].zw; + r1.xyzw = t0.Sample(s0_s, r1.xy).xyzw; - const float4 inputColor = t0.Sample(s0_s, r1.xy).xyzw; + const float3 inputColor = r1.rgb; // Expects the frame buffer to be in gamma - r1.xyzw = inputColor; + r0.xyz = r0.yyy * r1.xyz + r0.xzw; r1.xy = float2(-0.5, -0.5) + v1.xy; r1.xy = r1.xy * r1.xy; r0.w = r1.x + r1.y; r0.w = log2(r0.w); - r0.w = cb2[2].y * r0.w; // cb2[2].y + r0.w = cb2[2].y * r0.w; r0.w = exp2(r0.w); r1.x = saturate(cb2[2].x); - - const float3 colorFilter = cb2[1].xyz; - - r1.xyz = colorFilter * r1.xxx; + r1.xyz = cb2[1].xyz * r1.xxx; r2.xyz = r1.xyz * r0.www + -r0.xyz; r1.w = r1.x * r0.w; r0.xyz = r1.www * r2.xyz + r0.xyz; @@ -91,6 +89,7 @@ void main(float4 v0 : SV_POSITION0, float2 v1 : TEXCOORD0, out float4 o0 : SV_Ta // r1.xyz = saturate(r0.xyz); r1.xyz = r0.xyz; + // r0.w = dot(r1.xyz, float3(0.300000012, 0.589999974, 0.109999999)); r0.w = renodx::color::y::from::BT709(abs(r1.xyz)); r2.xyz = r0.www + -r1.xyz; @@ -105,25 +104,19 @@ void main(float4 v0 : SV_POSITION0, float2 v1 : TEXCOORD0, out float4 o0 : SV_Ta r0.xyz = cb2[8].yyy * r0.xyz + r1.xyz; r0.xyz = cb2[3].yyy + r0.xyz; r0.xyz = -cb2[3].zzz + r0.xyz; - r1.xy = v1.xy * cb0[5].xy + cb0[5].zw; - - float4 t1Color = t1.Sample(s1_s, r1.xy).xyzw; // last frame - r1.xyzw = t1Color; - t1Color *= 80.f / injectedData.toneMapGameNits; // reduce paperwhite sclaing - r1.xyzw = sign(t1Color) * pow(abs(t1Color), 1.f / 2.2f); // Convert raw framebuffer to gamma - r1.xyz = r1.xyz - r0.xyz; // delta - float scaleStrength = saturate(cb2[6].y); // scaler? + // Custom + r0.xyz = lerp(inputColor.rgb, r0.xyz, CUSTOM_SCREEN_GLOW); - o0.xyz = scaleStrength * r1.xyz + r0.xyz; - o0.w = 1; + r1.xy = v1.xy * cb0[5].xy + cb0[5].zw; + r1.xyzw = t1.Sample(s1_s, r1.xy).xyzw; - o0.rgb = lerp(inputColor.rgb, o0.rgb, injectedData.fxScreenGlow); + // r1.xyz = r1.xyz + -r0.xyz; + // r0.w = saturate(cb2[6].y); + // o0.xyz = r0.www * r1.xyz + r0.xyz; - o0.rgb = sign(o0.rgb) * pow(abs(o0.rgb), 2.2f); // linear - o0.rgb *= injectedData.toneMapGameNits / 80.f; + o0.xyz = lerp(r0.xyz, r1.xyz, saturate(cb2[6].y) * CUSTOM_MOTION_BLUR); - // Clamp needed before effects happen after tone mapping... - o0.rgb = min(o0.rgb, injectedData.toneMapPeakNits / 80.f); + o0.w = 1; return; -} \ No newline at end of file +} diff --git a/src/games/tunic/intro_0x1CCE11A3.ps_4_0.hlsl b/src/games/tunic/intro_0x1CCE11A3.ps_4_0.hlsl deleted file mode 100644 index 8d1a4256..00000000 --- a/src/games/tunic/intro_0x1CCE11A3.ps_4_0.hlsl +++ /dev/null @@ -1,37 +0,0 @@ -#include "./shared.h" - -Texture2D t0 : register(t0); - -SamplerState s0_s : register(s0); - -cbuffer cb0 : register(b0) -{ - float4 cb0[4]; -} - -// 3Dmigoto declarations -#define cmp - - - -void main( - float4 v0 : SV_POSITION0, - float2 v1 : TEXCOORD0, - float4 v2 : COLOR0, - uint v3 : SV_IsFrontFace0, - out float4 o0 : SV_Target0) -{ - float4 r0; - uint4 bitmask, uiDest; - float4 fDest; - - r0.xy = v1.xy * cb0[2].xy + cb0[2].zw; - r0.xyzw = t0.Sample(s0_s, r0.xy).xyzw; - r0.xyzw = cb0[3].xyzw * r0.xyzw; - r0.xyzw = v2.xyzw * r0.xyzw; - o0.xyz = r0.xyz * r0.www; - o0.w = 1; - - o0.rgb = pow(saturate(o0.rgb), 2.2f); - o0.rgb *= injectedData.toneMapUINits / 80.f; - return; -} \ No newline at end of file diff --git a/src/games/tunic/lutsample2_0xAA66A0B6.ps_4_0.hlsl b/src/games/tunic/lutsample2_0xAA66A0B6.ps_4_0.hlsl index ede2d481..c2253cdd 100644 --- a/src/games/tunic/lutsample2_0xAA66A0B6.ps_4_0.hlsl +++ b/src/games/tunic/lutsample2_0xAA66A0B6.ps_4_0.hlsl @@ -17,7 +17,7 @@ cbuffer cb0 : register(b0) { // 3Dmigoto declarations #define cmp - -void main(float4 v0 : SV_POSITION0, float4 v1 : TEXCOORD0, float4 v2 : TEXCOORD1, float4 v3 : TEXCOORD2, out float4 o0 : SV_Target0) { +void main(float4 v0: SV_POSITION0, float4 v1: TEXCOORD0, float4 v2: TEXCOORD1, float4 v3: TEXCOORD2, out float4 o0: SV_Target0) { float4 r0, r1, r2; uint4 bitmask, uiDest; float4 fDest; @@ -32,48 +32,36 @@ void main(float4 v0 : SV_POSITION0, float4 v1 : TEXCOORD0, float4 v2 : TEXCOORD1 o0.w = r1.w; // r0.xyz = saturate(r1.xyz * cb0[6].yyy + r0.xyz); - r0.xyz = (r1.xyz * cb0[6].yyy + r0.xyz * injectedData.fxNoise); + r0.xyz = (r1.xyz * cb0[6].yyy + r0.xyz * CUSTOM_NOISE); - float3 untonemapped = r0.rgb; + float3 gamma_input = max(0, r0.rgb); - untonemapped = max(0, renodx::color::srgb::Decode(untonemapped)); - - renodx::tonemap::Config config = renodx::tonemap::config::Create(); - - config.type = injectedData.toneMapType; - config.peak_nits = injectedData.toneMapPeakNits; - config.game_nits = injectedData.toneMapGameNits; - config.exposure = injectedData.colorGradeExposure; - config.highlights = injectedData.colorGradeHighlights; - config.shadows = injectedData.colorGradeShadows; - config.contrast = injectedData.colorGradeContrast; - config.saturation = injectedData.colorGradeSaturation; - config.hue_correction_type = renodx::tonemap::config::hue_correction_type::CUSTOM; - config.hue_correction_color = lerp( - untonemapped, - renodx::tonemap::Reinhard(untonemapped), - injectedData.toneMapHueCorrection); - - config.reno_drt_contrast = 1.1f; - config.reno_drt_saturation = 1.05f; - config.reno_drt_dechroma = injectedData.colorGradeBlowout; + float3 untonemapped = renodx::color::srgb::Decode(gamma_input); renodx::lut::Config lut_config = renodx::lut::config::Create( s1_s, - injectedData.colorGradeLUTStrength, - injectedData.colorGradeLUTScaling, + CUSTOM_LUT_STRENGTH, + CUSTOM_LUT_SCALING, renodx::lut::config::type::SRGB, renodx::lut::config::type::SRGB, 32.f); - if (injectedData.toneMapType == 0.f) { - untonemapped = saturate(untonemapped); + float3 outputColor; + if (RENODX_TONE_MAP_TYPE == 0.f) { + outputColor = renodx::lut::Sample( + saturate(untonemapped), + lut_config, + t1); + } else { + outputColor = renodx::draw::ToneMapPass( + untonemapped, + renodx::lut::Sample( + renodx::tonemap::renodrt::NeutralSDR(untonemapped), + lut_config, + t1)); } - - float3 outputColor = renodx::tonemap::config::Apply(untonemapped, config, lut_config, t1); - - outputColor = sign(outputColor) * pow(abs(outputColor), 1.f / 2.2f); + outputColor = renodx::draw::RenderIntermediatePass(outputColor); o0.rgb = outputColor.rgb; return; diff --git a/src/games/tunic/lutsample_0xEEFE9737.ps_4_0.hlsl b/src/games/tunic/lutsample_0xEEFE9737.ps_4_0.hlsl index 63a07ccc..e7bb18b1 100644 --- a/src/games/tunic/lutsample_0xEEFE9737.ps_4_0.hlsl +++ b/src/games/tunic/lutsample_0xEEFE9737.ps_4_0.hlsl @@ -17,7 +17,7 @@ cbuffer cb0 : register(b0) { // 3Dmigoto declarations #define cmp - -void main(float4 v0 : SV_POSITION0, float4 v1 : TEXCOORD0, float4 v2 : TEXCOORD1, float4 v3 : TEXCOORD2, out float4 o0 : SV_Target0) { +void main(float4 v0: SV_POSITION0, float4 v1: TEXCOORD0, float4 v2: TEXCOORD1, float4 v3: TEXCOORD2, out float4 o0: SV_Target0) { float4 r0, r1, r2; uint4 bitmask, uiDest; float4 fDest; @@ -26,45 +26,35 @@ void main(float4 v0 : SV_POSITION0, float4 v1 : TEXCOORD0, float4 v2 : TEXCOORD1 o0.w = r0.w; r0.xyz = cb0[6].yyy * r0.xyz; // scale - float3 untonemapped = r0.rgb; - - untonemapped = max(0, renodx::color::srgb::Decode(untonemapped)); - - renodx::tonemap::Config config = renodx::tonemap::config::Create(); - - config.type = injectedData.toneMapType; - config.peak_nits = injectedData.toneMapPeakNits; - config.game_nits = injectedData.toneMapGameNits; - config.exposure = injectedData.colorGradeExposure; - config.highlights = injectedData.colorGradeHighlights; - config.shadows = injectedData.colorGradeShadows; - config.contrast = injectedData.colorGradeContrast; - config.saturation = injectedData.colorGradeSaturation; - config.hue_correction_type = renodx::tonemap::config::hue_correction_type::CUSTOM; - config.hue_correction_color = lerp( - untonemapped, - renodx::tonemap::Reinhard(untonemapped), - injectedData.toneMapHueCorrection); - - config.reno_drt_contrast = 1.1f; - config.reno_drt_saturation = 1.05f; - config.reno_drt_dechroma = injectedData.colorGradeBlowout; + + float3 gamma_input = max(0, r0.rgb); + + float3 untonemapped = renodx::color::srgb::Decode(gamma_input); renodx::lut::Config lut_config = renodx::lut::config::Create( s1_s, - injectedData.colorGradeLUTStrength, - injectedData.colorGradeLUTScaling, + CUSTOM_LUT_STRENGTH, + CUSTOM_LUT_SCALING, renodx::lut::config::type::SRGB, renodx::lut::config::type::SRGB, 32.f); - if (injectedData.toneMapType == 0.f) { - untonemapped = saturate(untonemapped); + float3 outputColor; + if (RENODX_TONE_MAP_TYPE == 0.f) { + outputColor = renodx::lut::Sample( + saturate(untonemapped), + lut_config, + t1); + } else { + outputColor = renodx::draw::ToneMapPass( + untonemapped, + renodx::lut::Sample( + renodx::tonemap::renodrt::NeutralSDR(untonemapped), + lut_config, + t1)); } - float3 outputColor = renodx::tonemap::config::Apply(untonemapped, config, lut_config, t1); - - outputColor = sign(outputColor) * pow(abs(outputColor), 1.f / 2.2f); + outputColor = renodx::draw::RenderIntermediatePass(outputColor); o0.rgb = outputColor.rgb; return; diff --git a/src/games/tunic/shared.h b/src/games/tunic/shared.h index c0219394..f17cb7d9 100644 --- a/src/games/tunic/shared.h +++ b/src/games/tunic/shared.h @@ -1,34 +1,65 @@ #ifndef SRC_TUNIC_SHARED_H_ #define SRC_TUNIC_SHARED_H_ -#ifndef __cplusplus -#include "../../shaders/renodx.hlsl" -#endif +#define RENODX_PEAK_WHITE_NITS shader_injection.peak_white_nits +#define RENODX_DIFFUSE_WHITE_NITS shader_injection.diffuse_white_nits +#define RENODX_GRAPHICS_WHITE_NITS shader_injection.graphics_white_nits +#define RENODX_TONE_MAP_TYPE shader_injection.tone_map_type +#define RENODX_TONE_MAP_EXPOSURE shader_injection.tone_map_exposure +#define RENODX_TONE_MAP_HIGHLIGHTS shader_injection.tone_map_highlights +#define RENODX_TONE_MAP_SHADOWS shader_injection.tone_map_shadows +#define RENODX_TONE_MAP_CONTRAST shader_injection.tone_map_contrast +#define RENODX_TONE_MAP_SATURATION shader_injection.tone_map_saturation +#define RENODX_TONE_MAP_HIGHLIGHT_SATURATION shader_injection.tone_map_highlight_saturation +#define RENODX_TONE_MAP_BLOWOUT shader_injection.tone_map_blowout +#define RENODX_TONE_MAP_FLARE shader_injection.tone_map_flare +#define RENODX_TONE_MAP_HUE_CORRECTION shader_injection.tone_map_hue_correction +#define RENODX_TONE_MAP_HUE_SHIFT shader_injection.tone_map_hue_shift +#define RENODX_TONE_MAP_WORKING_COLOR_SPACE shader_injection.tone_map_working_color_space +#define RENODX_TONE_MAP_HUE_PROCESSOR shader_injection.tone_map_hue_processor +#define RENODX_TONE_MAP_PER_CHANNEL shader_injection.tone_map_per_channel +#define RENODX_GAMMA_CORRECTION shader_injection.gamma_correction +#define CUSTOM_LUT_STRENGTH shader_injection.custom_lut_strength +#define CUSTOM_LUT_SCALING shader_injection.custom_lut_scaling +#define CUSTOM_NOISE shader_injection.custom_noise +#define CUSTOM_SCREEN_GLOW shader_injection.custom_screen_glow +#define CUSTOM_MOTION_BLUR shader_injection.custom_motion_blur // Must be 32bit aligned // Should be 4x32 struct ShaderInjectData { - float toneMapType; - float toneMapPeakNits; - float toneMapGameNits; - float toneMapUINits; - float toneMapHueCorrection; - float colorGradeExposure; - float colorGradeHighlights; - float colorGradeShadows; - float colorGradeContrast; - float colorGradeSaturation; - float colorGradeBlowout; - float colorGradeLUTStrength; - float colorGradeLUTScaling; - float fxNoise; - float fxScreenGlow; + float peak_white_nits; + float diffuse_white_nits; + float graphics_white_nits; + float tone_map_type; + float tone_map_exposure; + float tone_map_highlights; + float tone_map_shadows; + float tone_map_contrast; + float tone_map_saturation; + float tone_map_highlight_saturation; + float tone_map_blowout; + float tone_map_flare; + float tone_map_hue_correction; + float tone_map_hue_shift; + float tone_map_working_color_space; + float tone_map_hue_processor; + float tone_map_per_channel; + float gamma_correction; + float custom_lut_scaling; + float custom_lut_strength; + float custom_noise; + float custom_screen_glow; + float custom_motion_blur; }; #ifndef __cplusplus cbuffer cb13 : register(b13) { - ShaderInjectData injectedData : packoffset(c0); + ShaderInjectData shader_injection : packoffset(c0); } + +#include "../../shaders/renodx.hlsl" + #endif #endif // SRC_TUNIC_SHARED_H_ diff --git a/src/games/tunic/swap_chain_proxy_pixel_shader.ps_4_0.hlsl b/src/games/tunic/swap_chain_proxy_pixel_shader.ps_4_0.hlsl new file mode 100644 index 00000000..93e3b603 --- /dev/null +++ b/src/games/tunic/swap_chain_proxy_pixel_shader.ps_4_0.hlsl @@ -0,0 +1,8 @@ +#include "./shared.h" + +Texture2D t0 : register(t0); +SamplerState s0 : register(s0); +float4 main(float4 vpos: SV_POSITION, float2 uv: TEXCOORD0) + : SV_TARGET { + return renodx::draw::SwapChainPass(t0.Sample(s0, uv)); +} diff --git a/src/games/tunic/swap_chain_proxy_vertex_shader.vs_4_0.hlsl b/src/games/tunic/swap_chain_proxy_vertex_shader.vs_4_0.hlsl new file mode 100644 index 00000000..aaee1e17 --- /dev/null +++ b/src/games/tunic/swap_chain_proxy_vertex_shader.vs_4_0.hlsl @@ -0,0 +1,6 @@ +void main(uint id : SV_VERTEXID, out float4 pos : SV_POSITION, + out float2 uv : TEXCOORD0) { + uv.x = (id == 1) ? 2.0 : 0.0; + uv.y = (id == 2) ? 2.0 : 0.0; + pos = float4(uv * float2(2.0, -2.0) + float2(-1.0, 1.0), 0.0, 1.0); +} \ No newline at end of file