55
66#define ImTextureID ImU64
77
8- #define DEBUG_LEVEL_0
8+ // #define DEBUG_LEVEL_0
9+
10+ #define RENODX_FPS_LIMIT_HR_TIMER
11+
12+ #define RENODX_MODS_SWAPCHAIN_VERSION 2
913
1014#include < deps/imgui/imgui.h>
1115#include < include/reshade.hpp>
@@ -43,13 +47,12 @@ renodx::utils::settings::Settings settings = {
4347 .key = " ToneMapType" ,
4448 .binding = &shader_injection.tone_map_type ,
4549 .value_type = renodx::utils::settings::SettingValueType::INTEGER ,
46- .default_value = 3 .f ,
50+ .default_value = 1 .f ,
4751 .can_reset = true ,
4852 .label = " Tone Mapper" ,
4953 .section = " Tone Mapping" ,
5054 .tooltip = " Sets the tone mapper type" ,
51- .labels = {" Vanilla" , " None" , " ACES" , " RenoDRT" },
52- .is_visible = []() { return current_settings_mode == 1 ; },
55+ .labels = {" Vanilla" , " Neutwo" },
5356 },
5457 new renodx::utils::settings::Setting{
5558 .key = " ToneMapPeakNits" ,
@@ -72,53 +75,16 @@ renodx::utils::settings::Settings settings = {
7275 .max = 500 .f ,
7376 },
7477 new renodx::utils::settings::Setting{
75- .key = " GammaCorrection" ,
76- .binding = &shader_injection.gamma_correction ,
77- .value_type = renodx::utils::settings::SettingValueType::INTEGER ,
78- .default_value = 1 .f ,
79- .label = " Gamma Correction" ,
80- .section = " Tone Mapping" ,
81- .tooltip = " Emulates a display EOTF." ,
82- .labels = {" Off" , " 2.2" , " BT.1886" },
83- .is_visible = []() { return current_settings_mode == 1 ; },
84- },
85- new renodx::utils::settings::Setting{
86- .key = " ToneMapScaling" ,
87- .binding = &shader_injection.tone_map_per_channel ,
88- .value_type = renodx::utils::settings::SettingValueType::INTEGER ,
89- .default_value = 0 .f ,
90- .label = " Scaling" ,
91- .section = " Tone Mapping" ,
92- .tooltip = " Luminance scales colors consistently while per-channel saturates and blows out sooner" ,
93- .labels = {" Luminance" , " Per Channel" },
94- .is_enabled = []() { return shader_injection.tone_map_type >= 1 ; },
95- .is_visible = []() { return current_settings_mode == 1 ; },
96- },
97- new renodx::utils::settings::Setting{
98- .key = " ToneMapHueProcessor" ,
99- .binding = &shader_injection.tone_map_hue_processor ,
100- .value_type = renodx::utils::settings::SettingValueType::INTEGER ,
101- .default_value = 0 .f ,
102- .label = " Hue Processor" ,
103- .section = " Tone Mapping" ,
104- .tooltip = " Selects hue processor" ,
105- .labels = {" OKLab" , " ICtCp" , " darkTable UCS" },
106- .is_enabled = []() { return shader_injection.tone_map_type >= 1 ; },
107- .is_visible = []() { return current_settings_mode == 1 ; },
108- },
109- new renodx::utils::settings::Setting{
110- .key = " ToneMapHueCorrection" ,
111- .binding = &shader_injection.tone_map_hue_correction ,
112- .default_value = 100 .f ,
113- .label = " Hue Correction" ,
78+ .key = " ToneMapUINits" ,
79+ .binding = &shader_injection.graphics_white_nits ,
80+ .default_value = 203 .f ,
81+ .label = " UI Brightness" ,
11482 .section = " Tone Mapping" ,
115- .tooltip = " Hue retention strength." ,
116- .min = 0 .f ,
117- .max = 100 .f ,
118- .is_enabled = []() { return shader_injection.tone_map_type >= 1 ; },
119- .parse = [](float value) { return value * 0 .01f ; },
120- .is_visible = []() { return current_settings_mode == 1 ; },
121- },
83+ .tooltip = " Sets the brightness of UI and HUD elements in nits" ,
84+ .min = 48 .f ,
85+ .max = 500 .f ,
86+ .is_visible = []() { return current_settings_mode == 2 ; },
87+ },
12288 new renodx::utils::settings::Setting{
12389 .key = " ToneMapHueShift" ,
12490 .binding = &shader_injection.tone_map_hue_shift ,
@@ -130,8 +96,19 @@ renodx::utils::settings::Settings settings = {
13096 .max = 100 .f ,
13197 .is_enabled = []() { return shader_injection.tone_map_type >= 1 ; },
13298 .parse = [](float value) { return value * 0 .01f ; },
133- .is_visible = []() { return current_settings_mode == 1 ; },
99+ .is_visible = []() { return current_settings_mode == 2 ; },
134100 },
101+ new renodx::utils::settings::Setting{
102+ .key = " GammaCorrection" ,
103+ .binding = &shader_injection.gamma_correction ,
104+ .value_type = renodx::utils::settings::SettingValueType::INTEGER ,
105+ .default_value = 1 .f ,
106+ .label = " SDR EOTF Emulation" ,
107+ .section = " Tone Mapping" ,
108+ .tooltip = " Emulates a display EOTF." ,
109+ .labels = {" Off" , " 2.2" , " BT.1886" },
110+ .is_visible = []() { return current_settings_mode >= 1 ; },
111+ },
135112 new renodx::utils::settings::Setting{
136113 .key = " ColorGradeExposure" ,
137114 .binding = &shader_injection.tone_map_exposure ,
@@ -188,7 +165,7 @@ renodx::utils::settings::Settings settings = {
188165 .section = " Color Grading" ,
189166 .tooltip = " Adds or removes highlight color." ,
190167 .max = 100 .f ,
191- .is_enabled = []() { return shader_injection.tone_map_type >= 1 ; },
168+ .is_enabled = []() { return shader_injection.tone_map_type > 0 ; },
192169 .parse = [](float value) { return value * 0 .02f ; },
193170 .is_visible = []() { return current_settings_mode == 1 ; },
194171 },
@@ -210,8 +187,9 @@ renodx::utils::settings::Settings settings = {
210187 .section = " Color Grading" ,
211188 .tooltip = " Flare/Glare Compensation" ,
212189 .max = 100 .f ,
213- .is_enabled = []() { return shader_injection.tone_map_type == 3 ; },
190+ .is_enabled = []() { return shader_injection.tone_map_type > 0 ; },
214191 .parse = [](float value) { return value * 0 .02f ; },
192+ .is_visible = []() { return current_settings_mode == 1 ; },
215193 },
216194 new renodx::utils::settings::Setting{
217195 .key = " ColorGradeScene" ,
@@ -243,7 +221,6 @@ renodx::utils::settings::Settings settings = {
243221 " US CRT" ,
244222 " JPN CRT" ,
245223 },
246- .is_visible = []() { return settings[0 ]->GetValue () == 1 ; },
247224 },
248225 new renodx::utils::settings::Setting{
249226 .key = " FxBloom" ,
@@ -263,6 +240,15 @@ renodx::utils::settings::Settings settings = {
263240 .max = 100 .f ,
264241 .parse = [](float value) { return value * 0 .02f ; },
265242 },
243+ new renodx::utils::settings::Setting{
244+ .key = " FxLensFlare" ,
245+ .binding = &shader_injection.custom_lens_flare ,
246+ .default_value = 50 .f ,
247+ .label = " Lens Flare" ,
248+ .section = " Effects" ,
249+ .max = 100 .f ,
250+ .parse = [](float value) { return value * 0 .02f ; },
251+ },
266252 new renodx::utils::settings::Setting{
267253 .key = " FxFilmGrain" ,
268254 .binding = &shader_injection.custom_film_grain ,
@@ -272,6 +258,16 @@ renodx::utils::settings::Settings settings = {
272258 .max = 100 .f ,
273259 .parse = [](float value) { return value * 0 .01f ; },
274260 },
261+ new renodx::utils::settings::Setting{
262+ .key = " FPSLimit" ,
263+ .binding = &renodx::utils::swapchain::fps_limit,
264+ .default_value = 60 .f ,
265+ .label = " FPS Limit" ,
266+ .section = " FPS Limit" ,
267+ .min = 30 .f ,
268+ .max = 500 .f ,
269+ .parse = [](float value) { return value * 2 .f ; },
270+ },
275271 new renodx::utils::settings::Setting{
276272 .value_type = renodx::utils::settings::SettingValueType::BUTTON ,
277273 .label = " Reset" ,
@@ -304,14 +300,18 @@ renodx::utils::settings::Settings settings = {
304300 renodx::utils::platform::LaunchURL (" https://github.com/clshortfuse/renodx" );
305301 },
306302 },
303+ new renodx::utils::settings::Setting{
304+ .value_type = renodx::utils::settings::SettingValueType::TEXT ,
305+ .label = std::string (" - Turn off Steam Overlay, And external FPS Limiters, Use the one in the mod instead.\n "
306+ " - Set in-game 'GAMMA' to the Defaults." ),
307+ .section = " About" ,
308+ },
307309};
308310
309311void OnPresetOff () {
310312 renodx::utils::settings::UpdateSetting (" ToneMapType" , 0 .f );
311313 renodx::utils::settings::UpdateSetting (" ToneMapPeakNits" , 203 .f );
312314 renodx::utils::settings::UpdateSetting (" ToneMapGameNits" , 203 .f );
313- renodx::utils::settings::UpdateSetting (" ToneMapUINits" , 203 .f );
314- renodx::utils::settings::UpdateSetting (" ToneMapGammaCorrection" , 0 );
315315 renodx::utils::settings::UpdateSetting (" ColorGradeExposure" , 1 .f );
316316 renodx::utils::settings::UpdateSetting (" ColorGradeHighlights" , 50 .f );
317317 renodx::utils::settings::UpdateSetting (" ColorGradeShadows" , 50 .f );
@@ -320,6 +320,7 @@ void OnPresetOff() {
320320 renodx::utils::settings::UpdateSetting (" SwapChainCustomColorSpace" , 0 .f );
321321 renodx::utils::settings::UpdateSetting (" FxBloom" , 50 .f );
322322 renodx::utils::settings::UpdateSetting (" FxVignette" , 50 .f );
323+ renodx::utils::settings::UpdateSetting (" FxLensFlare" , 50 .f );
323324 renodx::utils::settings::UpdateSetting (" FxFilmGrain" , 0 .f );
324325}
325326
@@ -334,9 +335,9 @@ void OnInitSwapchain(reshade::api::swapchain* swapchain, bool resize) {
334335 settings[2 ]->default_value = roundf (peak.value ());
335336 } else {
336337 settings[2 ]->default_value = 1000 .f ;
337-
338- fired_on_init_swapchain = true ;
339338 }
339+
340+ fired_on_init_swapchain = true ;
340341}
341342
342343} // namespace
@@ -348,28 +349,43 @@ BOOL APIENTRY DllMain(HMODULE h_module, DWORD fdw_reason, LPVOID lpv_reserved) {
348349 switch (fdw_reason) {
349350 case DLL_PROCESS_ATTACH :
350351 if (!reshade::register_addon (h_module)) return FALSE ;
352+ renodx::mods::shader::force_pipeline_cloning = true ;
353+ renodx::mods::shader::expected_constant_buffer_space = 50 ;
354+ renodx::mods::shader::expected_constant_buffer_index = 13 ;
355+ renodx::mods::shader::constant_buffer_offset = 50 * 4 ;
356+
357+ renodx::mods::swapchain::expected_constant_buffer_index = 13 ;
358+ renodx::mods::swapchain::expected_constant_buffer_space = 50 ;
351359 renodx::mods::swapchain::force_borderless = false ;
352360 renodx::mods::swapchain::prevent_full_screen = false ;
353- renodx::mods::swapchain::use_resource_cloning = true ;
354361 renodx::mods::swapchain::force_screen_tearing = false ;
362+ renodx::mods::swapchain::use_resource_cloning = true ;
355363 renodx::mods::swapchain::set_color_space = false ;
356364 renodx::mods::swapchain::use_device_proxy = true ;
357- renodx::mods::shader::constant_buffer_offset = 50 * 4 ;
358- renodx::mods::shader::expected_constant_buffer_space = 50 ;
359- renodx::mods::shader::expected_constant_buffer_index = 13 ;
360- renodx::mods::swapchain::expected_constant_buffer_index = 13 ;
361- renodx::mods::swapchain::expected_constant_buffer_space = 50 ;
362365 renodx::utils::random::binds.push_back (&shader_injection.custom_random );
363366 renodx::mods::swapchain::swap_chain_proxy_vertex_shader = __swap_chain_proxy_vertex_shader_dx11;
364367 renodx::mods::swapchain::swap_chain_proxy_pixel_shader = __swap_chain_proxy_pixel_shader_dx11;
365368
366- renodx::mods::swapchain::swap_chain_upgrade_targets.push_back ({
369+ renodx::mods::swapchain::resource_upgrade_infos.push_back ({
370+ .old_format = reshade::api::format::b8g8r8a8_unorm,
371+ .new_format = reshade::api::format::r16g16b16a16_float,
372+ });
373+ renodx::mods::swapchain::resource_upgrade_infos.push_back ({
374+ .old_format = reshade::api::format::b8g8r8a8_unorm,
375+ .new_format = reshade::api::format::r16g16b16a16_float,
376+ .dimensions = {
377+ .width = 256 ,
378+ .height = 16 ,
379+ },
380+ .usage_include = reshade::api::resource_usage::render_target,
381+ });
382+ renodx::mods::swapchain::resource_upgrade_infos.push_back ({
367383 .old_format = reshade::api::format::r16g16b16a16_unorm,
368384 .new_format = reshade::api::format::r16g16b16a16_float,
369- .ignore_size = true ,
370- .use_resource_view_cloning = true ,
385+ .aspect_ratio = renodx::mods::swapchain::SwapChainUpgradeTarget:: BACK_BUFFER ,
386+ .aspect_ratio_tolerance = 0 . 01f ,
371387 });
372-
388+
373389 reshade::register_event<reshade::addon_event::init_swapchain>(OnInitSwapchain);
374390 break ;
375391 case DLL_PROCESS_DETACH :
0 commit comments