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" ,
@@ -77,71 +80,34 @@ renodx::utils::settings::Settings settings = {
7780 .default_value = 203 .f ,
7881 .label = " UI Brightness" ,
7982 .section = " Tone Mapping" ,
80- .tooltip = " Sets the value of 100% white in nits" ,
83+ .tooltip = " Sets the brightness of UI and HUD elements in nits" ,
8184 .min = 48 .f ,
8285 .max = 500 .f ,
8386 },
84- new renodx::utils::settings::Setting{
85- .key = " GammaCorrection" ,
86- .binding = &shader_injection.gamma_correction ,
87- .value_type = renodx::utils::settings::SettingValueType::INTEGER ,
88- .default_value = 1 .f ,
89- .label = " Gamma Correction" ,
90- .section = " Tone Mapping" ,
91- .tooltip = " Emulates a display EOTF." ,
92- .labels = {" Off" , " 2.2" , " BT.1886" },
93- .is_visible = []() { return current_settings_mode == 1 ; },
94- },
95- new renodx::utils::settings::Setting{
96- .key = " ToneMapScaling" ,
97- .binding = &shader_injection.tone_map_per_channel ,
98- .value_type = renodx::utils::settings::SettingValueType::INTEGER ,
99- .default_value = 0 .f ,
100- .label = " Scaling" ,
101- .section = " Tone Mapping" ,
102- .tooltip = " Luminance scales colors consistently while per-channel saturates and blows out sooner" ,
103- .labels = {" Luminance" , " Per Channel" },
104- .is_enabled = []() { return shader_injection.tone_map_type >= 1 ; },
105- .is_visible = []() { return current_settings_mode == 1 ; },
106- },
107- new renodx::utils::settings::Setting{
108- .key = " ToneMapHueProcessor" ,
109- .binding = &shader_injection.tone_map_hue_processor ,
110- .value_type = renodx::utils::settings::SettingValueType::INTEGER ,
111- .default_value = 0 .f ,
112- .label = " Hue Processor" ,
113- .section = " Tone Mapping" ,
114- .tooltip = " Selects hue processor" ,
115- .labels = {" OKLab" , " ICtCp" , " darkTable UCS" },
116- .is_enabled = []() { return shader_injection.tone_map_type >= 1 ; },
117- .is_visible = []() { return current_settings_mode == 1 ; },
118- },
119- new renodx::utils::settings::Setting{
120- .key = " ToneMapHueCorrection" ,
121- .binding = &shader_injection.tone_map_hue_correction ,
122- .default_value = 100 .f ,
123- .label = " Hue Correction" ,
124- .section = " Tone Mapping" ,
125- .tooltip = " Hue retention strength." ,
126- .min = 0 .f ,
127- .max = 100 .f ,
128- .is_enabled = []() { return shader_injection.tone_map_type >= 1 ; },
129- .parse = [](float value) { return value * 0 .01f ; },
130- .is_visible = []() { return current_settings_mode == 1 ; },
131- },
13287 new renodx::utils::settings::Setting{
13388 .key = " ToneMapHueShift" ,
13489 .binding = &shader_injection.tone_map_hue_shift ,
135- .default_value = 0 .f ,
90+ .default_value = 100 .f ,
13691 .label = " Hue Shift" ,
13792 .section = " Tone Mapping" ,
13893 .tooltip = " Hue-shift emulation strength." ,
13994 .min = 0 .f ,
14095 .max = 100 .f ,
14196 .is_enabled = []() { return shader_injection.tone_map_type >= 1 ; },
14297 .parse = [](float value) { return value * 0 .01f ; },
143- .is_visible = []() { return current_settings_mode == 1 ; },
98+ .is_visible = []() { return current_settings_mode == 2 ; },
14499 },
100+ new renodx::utils::settings::Setting{
101+ .key = " GammaCorrection" ,
102+ .binding = &shader_injection.gamma_correction ,
103+ .value_type = renodx::utils::settings::SettingValueType::INTEGER ,
104+ .default_value = 1 .f ,
105+ .label = " SDR EOTF Emulation" ,
106+ .section = " Tone Mapping" ,
107+ .tooltip = " Emulates a display EOTF." ,
108+ .labels = {" Off" , " 2.2" , " BT.1886" },
109+ .is_visible = []() { return current_settings_mode >= 1 ; },
110+ },
145111 new renodx::utils::settings::Setting{
146112 .key = " ColorGradeExposure" ,
147113 .binding = &shader_injection.tone_map_exposure ,
@@ -198,7 +164,7 @@ renodx::utils::settings::Settings settings = {
198164 .section = " Color Grading" ,
199165 .tooltip = " Adds or removes highlight color." ,
200166 .max = 100 .f ,
201- .is_enabled = []() { return shader_injection.tone_map_type >= 1 ; },
167+ .is_enabled = []() { return shader_injection.tone_map_type > 0 ; },
202168 .parse = [](float value) { return value * 0 .02f ; },
203169 .is_visible = []() { return current_settings_mode == 1 ; },
204170 },
@@ -220,8 +186,9 @@ renodx::utils::settings::Settings settings = {
220186 .section = " Color Grading" ,
221187 .tooltip = " Flare/Glare Compensation" ,
222188 .max = 100 .f ,
223- .is_enabled = []() { return shader_injection.tone_map_type == 3 ; },
189+ .is_enabled = []() { return shader_injection.tone_map_type > 0 ; },
224190 .parse = [](float value) { return value * 0 .02f ; },
191+ .is_visible = []() { return current_settings_mode == 1 ; },
225192 },
226193 new renodx::utils::settings::Setting{
227194 .key = " ColorGradeScene" ,
@@ -253,9 +220,8 @@ renodx::utils::settings::Settings settings = {
253220 " US CRT" ,
254221 " JPN CRT" ,
255222 },
256- .is_visible = []() { return settings[0 ]->GetValue () == 1 ; },
257223 },
258- new renodx::utils::settings::Setting{
224+ new renodx::utils::settings::Setting{
259225 .key = " FxBloom" ,
260226 .binding = &shader_injection.custom_bloom ,
261227 .default_value = 50 .f ,
@@ -276,12 +242,31 @@ renodx::utils::settings::Settings settings = {
276242 new renodx::utils::settings::Setting{
277243 .key = " FxFilmGrain" ,
278244 .binding = &shader_injection.custom_film_grain ,
279- .default_value = 100 .f ,
280- .label = " Perceptual Film Grain" ,
245+ .default_value = 50 .f ,
246+ .label = " Film Grain Strength " ,
281247 .section = " Effects" ,
282248 .max = 100 .f ,
283249 .parse = [](float value) { return value * 0 .01f ; },
284250 },
251+ new renodx::utils::settings::Setting{
252+ .key = " FxFilmGrainType" ,
253+ .binding = &shader_injection.film_grain_type ,
254+ .value_type = renodx::utils::settings::SettingValueType::INTEGER ,
255+ .default_value = 1 .f ,
256+ .label = " Film Grain Type" ,
257+ .section = " Effects" ,
258+ .labels = {" Perceptual" , " Vanilla" },
259+ },
260+ new renodx::utils::settings::Setting{
261+ .key = " FPSLimit" ,
262+ .binding = &renodx::utils::swapchain::fps_limit,
263+ .default_value = 60 .f ,
264+ .label = " FPS Limit" ,
265+ .section = " FPS Limit" ,
266+ .min = 30 .f ,
267+ .max = 500 .f ,
268+ .parse = [](float value) { return value * 2 .f ; },
269+ },
285270 new renodx::utils::settings::Setting{
286271 .value_type = renodx::utils::settings::SettingValueType::BUTTON ,
287272 .label = " Reset" ,
@@ -314,22 +299,28 @@ renodx::utils::settings::Settings settings = {
314299 renodx::utils::platform::LaunchURL (" https://github.com/clshortfuse/renodx" );
315300 },
316301 },
302+ new renodx::utils::settings::Setting{
303+ .value_type = renodx::utils::settings::SettingValueType::TEXT ,
304+ .label = std::string (" - Turn off Steam Overlay, And external FPS Limiters, Use the one in the mod instead.\n "
305+ " - Set in-game 'Gamma' to '50%' (default)." ),
306+ .section = " About" ,
307+ },
317308};
318309
319310void OnPresetOff () {
320311 renodx::utils::settings::UpdateSetting (" ToneMapType" , 0 .f );
321312 renodx::utils::settings::UpdateSetting (" ToneMapPeakNits" , 203 .f );
322313 renodx::utils::settings::UpdateSetting (" ToneMapGameNits" , 203 .f );
323314 renodx::utils::settings::UpdateSetting (" ToneMapUINits" , 203 .f );
324- renodx::utils::settings::UpdateSetting (" ToneMapGammaCorrection" , 0 );
325315 renodx::utils::settings::UpdateSetting (" ColorGradeExposure" , 1 .f );
326316 renodx::utils::settings::UpdateSetting (" ColorGradeHighlights" , 50 .f );
327317 renodx::utils::settings::UpdateSetting (" ColorGradeShadows" , 50 .f );
328318 renodx::utils::settings::UpdateSetting (" ColorGradeContrast" , 50 .f );
329319 renodx::utils::settings::UpdateSetting (" ColorGradeSaturation" , 50 .f );
330320 renodx::utils::settings::UpdateSetting (" FxBloom" , 50 .f );
331321 renodx::utils::settings::UpdateSetting (" FxVignette" , 50 .f );
332- renodx::utils::settings::UpdateSetting (" FxFilmGrain" , 100 .f );
322+ renodx::utils::settings::UpdateSetting (" FxFilmGrain" , 50 .f );
323+ renodx::utils::settings::UpdateSetting (" FxFilmGrainType" , 1 .f );
333324}
334325
335326bool fired_on_init_swapchain = false ;
@@ -357,33 +348,35 @@ BOOL APIENTRY DllMain(HMODULE h_module, DWORD fdw_reason, LPVOID lpv_reserved) {
357348 switch (fdw_reason) {
358349 case DLL_PROCESS_ATTACH :
359350 if (!reshade::register_addon (h_module)) return FALSE ;
351+ renodx::mods::shader::force_pipeline_cloning = true ;
352+ renodx::mods::shader::expected_constant_buffer_space = 50 ;
353+ renodx::mods::shader::expected_constant_buffer_index = 13 ;
354+ renodx::mods::shader::constant_buffer_offset = 50 * 4 ;
355+
356+ renodx::mods::swapchain::expected_constant_buffer_index = 13 ;
357+ renodx::mods::swapchain::expected_constant_buffer_space = 50 ;
360358 renodx::mods::swapchain::force_borderless = false ;
361359 renodx::mods::swapchain::prevent_full_screen = false ;
362- renodx::mods::swapchain::use_resource_cloning = true ;
363360 renodx::mods::swapchain::force_screen_tearing = false ;
361+ renodx::mods::swapchain::use_resource_cloning = true ;
364362 renodx::mods::swapchain::set_color_space = false ;
365363 renodx::mods::swapchain::use_device_proxy = true ;
366- renodx::mods::shader::constant_buffer_offset = 50 * 4 ;
367- renodx::mods::shader::expected_constant_buffer_space = 50 ;
368- renodx::mods::shader::expected_constant_buffer_index = 13 ;
369- renodx::mods::swapchain::expected_constant_buffer_index = 13 ;
370- renodx::mods::swapchain::expected_constant_buffer_space = 50 ;
371364 renodx::utils::random::binds.push_back (&shader_injection.custom_random );
372365 renodx::mods::swapchain::swap_chain_proxy_vertex_shader = __swap_chain_proxy_vertex_shader_dx11;
373366 renodx::mods::swapchain::swap_chain_proxy_pixel_shader = __swap_chain_proxy_pixel_shader_dx11;
374-
375- renodx::mods::swapchain::swap_chain_upgrade_targets .push_back ({
367+
368+ renodx::mods::swapchain::resource_upgrade_infos .push_back ({
376369 .old_format = reshade::api::format::b8g8r8a8_unorm,
377370 .new_format = reshade::api::format::r16g16b16a16_float,
378- .use_resource_view_cloning = true ,
371+ .aspect_ratio = renodx::mods::swapchain::SwapChainUpgradeTarget:: BACK_BUFFER ,
379372 });
380- renodx::mods::swapchain::swap_chain_upgrade_targets .push_back ({
373+ renodx::mods::swapchain::resource_upgrade_infos .push_back ({
381374 .old_format = reshade::api::format::r16g16b16a16_unorm,
382375 .new_format = reshade::api::format::r16g16b16a16_float,
383- .ignore_size = true ,
384- .use_resource_view_cloning = true ,
385- });
386-
376+ .aspect_ratio = renodx::mods::swapchain::SwapChainUpgradeTarget:: BACK_BUFFER ,
377+ .aspect_ratio_tolerance = 0 . 01f ,
378+ });
379+
387380 reshade::register_event<reshade::addon_event::init_swapchain>(OnInitSwapchain);
388381 break ;
389382 case DLL_PROCESS_DETACH :
0 commit comments