mirror of
https://github.com/Zelda64Recomp/Zelda64Recomp.git
synced 2026-05-08 10:01:38 +00:00
Increase dither noise strength at higher resolutions to make it more noticeable
This commit is contained in:
parent
41ded29eae
commit
a2f75eed58
8 changed files with 38 additions and 1 deletions
|
|
@ -32,6 +32,7 @@ namespace ultramodern {
|
||||||
void shutdown();
|
void shutdown();
|
||||||
void set_dummy_vi();
|
void set_dummy_vi();
|
||||||
uint32_t get_display_framerate();
|
uint32_t get_display_framerate();
|
||||||
|
float get_resolution_scale();
|
||||||
void load_shader_cache(std::span<const char> cache_binary);
|
void load_shader_cache(std::span<const char> cache_binary);
|
||||||
private:
|
private:
|
||||||
RT64SetupResult setup_result;
|
RT64SetupResult setup_result;
|
||||||
|
|
|
||||||
|
|
@ -106,6 +106,12 @@ void Play_DrawMotionBlur(PlayState* this) {
|
||||||
}
|
}
|
||||||
alpha = (s32)(alpha_float * 255.0f);
|
alpha = (s32)(alpha_float * 255.0f);
|
||||||
|
|
||||||
|
// @recomp Set the dither noise strength based on the resolution scale to make it easier to see at higher resolutions.
|
||||||
|
float res_scale = recomp_get_resolution_scale();
|
||||||
|
float dither_noise_strength = CLAMP(1.0 + (res_scale - 1.0f) / 8.0f, 1.0f, 2.0f);
|
||||||
|
// recomp_printf("res scale: %5.3f dither noise strength: %5.3f\n", res_scale, dither_noise_strength);
|
||||||
|
gEXSetDitherNoiseStrength(OVERLAY_DISP++, dither_noise_strength);
|
||||||
|
|
||||||
if (sMotionBlurStatus == MOTION_BLUR_PROCESS) {
|
if (sMotionBlurStatus == MOTION_BLUR_PROCESS) {
|
||||||
func_80170AE0(&this->pauseBgPreRender, &gfx, alpha);
|
func_80170AE0(&this->pauseBgPreRender, &gfx, alpha);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -6,5 +6,6 @@
|
||||||
DECLARE_FUNC(float, recomp_get_aspect_ratio, float);
|
DECLARE_FUNC(float, recomp_get_aspect_ratio, float);
|
||||||
DECLARE_FUNC(s32, recomp_get_target_framerate, s32);
|
DECLARE_FUNC(s32, recomp_get_target_framerate, s32);
|
||||||
DECLARE_FUNC(s32, recomp_high_precision_fb_enabled);
|
DECLARE_FUNC(s32, recomp_high_precision_fb_enabled);
|
||||||
|
DECLARE_FUNC(float, recomp_get_resolution_scale);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -53,3 +53,4 @@ recomp_autosave_enabled = 0x8F00008C;
|
||||||
recomp_load_overlays = 0x8F000090;
|
recomp_load_overlays = 0x8F000090;
|
||||||
osInvalICache_recomp = 0x8F000094;
|
osInvalICache_recomp = 0x8F000094;
|
||||||
recomp_high_precision_fb_enabled = 0x8F0000A8;
|
recomp_high_precision_fb_enabled = 0x8F0000A8;
|
||||||
|
recomp_get_resolution_scale = 0x8F0000AC;
|
||||||
|
|
|
||||||
|
|
@ -107,3 +107,7 @@ extern "C" void recomp_load_overlays(uint8_t * rdram, recomp_context * ctx) {
|
||||||
extern "C" void recomp_high_precision_fb_enabled(uint8_t * rdram, recomp_context * ctx) {
|
extern "C" void recomp_high_precision_fb_enabled(uint8_t * rdram, recomp_context * ctx) {
|
||||||
_return(ctx, static_cast<s32>(ultramodern::RT64HighPrecisionFBEnabled()));
|
_return(ctx, static_cast<s32>(ultramodern::RT64HighPrecisionFBEnabled()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern "C" void recomp_get_resolution_scale(uint8_t* rdram, recomp_context* ctx) {
|
||||||
|
_return(ctx, ultramodern::get_resolution_scale());
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -279,6 +279,7 @@ ultramodern::GraphicsConfig ultramodern::get_graphics_config() {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::atomic_uint32_t display_refresh_rate = 60;
|
std::atomic_uint32_t display_refresh_rate = 60;
|
||||||
|
std::atomic<float> resolution_scale = 1.0f;
|
||||||
|
|
||||||
uint32_t ultramodern::get_target_framerate(uint32_t original) {
|
uint32_t ultramodern::get_target_framerate(uint32_t original) {
|
||||||
ultramodern::GraphicsConfig graphics_config = ultramodern::get_graphics_config();
|
ultramodern::GraphicsConfig graphics_config = ultramodern::get_graphics_config();
|
||||||
|
|
@ -298,6 +299,10 @@ uint32_t ultramodern::get_display_refresh_rate() {
|
||||||
return display_refresh_rate.load();
|
return display_refresh_rate.load();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float ultramodern::get_resolution_scale() {
|
||||||
|
return resolution_scale.load();
|
||||||
|
}
|
||||||
|
|
||||||
void ultramodern::load_shader_cache(std::span<const char> cache_data) {
|
void ultramodern::load_shader_cache(std::span<const char> cache_data) {
|
||||||
events_context.action_queue.enqueue(LoadShaderCacheAction{cache_data});
|
events_context.action_queue.enqueue(LoadShaderCacheAction{cache_data});
|
||||||
}
|
}
|
||||||
|
|
@ -359,6 +364,7 @@ void gfx_thread_func(uint8_t* rdram, moodycamel::LightweightSemaphore* thread_re
|
||||||
events_context.vi.current_buffer = events_context.vi.next_buffer;
|
events_context.vi.current_buffer = events_context.vi.next_buffer;
|
||||||
rt64.update_screen(swap_action->origin);
|
rt64.update_screen(swap_action->origin);
|
||||||
display_refresh_rate = rt64.get_display_framerate();
|
display_refresh_rate = rt64.get_display_framerate();
|
||||||
|
resolution_scale = rt64.get_resolution_scale();
|
||||||
}
|
}
|
||||||
else if (const auto* config_action = std::get_if<UpdateConfigAction>(&action)) {
|
else if (const auto* config_action = std::get_if<UpdateConfigAction>(&action)) {
|
||||||
ultramodern::GraphicsConfig new_config = cur_config;
|
ultramodern::GraphicsConfig new_config = cur_config;
|
||||||
|
|
|
||||||
|
|
@ -278,6 +278,24 @@ uint32_t ultramodern::RT64Context::get_display_framerate() {
|
||||||
return app->presentQueue->ext.sharedResources->swapChainRate;
|
return app->presentQueue->ext.sharedResources->swapChainRate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float ultramodern::RT64Context::get_resolution_scale() {
|
||||||
|
constexpr int ReferenceHeight = 240;
|
||||||
|
switch (app->userConfig.resolution) {
|
||||||
|
case RT64::UserConfiguration::Resolution::WindowIntegerScale:
|
||||||
|
if (app->sharedQueueResources->swapChainHeight > 0) {
|
||||||
|
return std::max(float((app->sharedQueueResources->swapChainHeight + ReferenceHeight - 1) / ReferenceHeight), 1.0f);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return 1.0f;
|
||||||
|
}
|
||||||
|
case RT64::UserConfiguration::Resolution::Manual:
|
||||||
|
return float(app->userConfig.resolutionMultiplier);
|
||||||
|
case RT64::UserConfiguration::Resolution::Original:
|
||||||
|
default:
|
||||||
|
return 1.0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ultramodern::RT64Context::load_shader_cache(std::span<const char> cache_binary) {
|
void ultramodern::RT64Context::load_shader_cache(std::span<const char> cache_binary) {
|
||||||
// TODO figure out how to avoid a copy here.
|
// TODO figure out how to avoid a copy here.
|
||||||
std::istringstream cache_stream{std::string{cache_binary.data(), cache_binary.size()}};
|
std::istringstream cache_stream{std::string{cache_binary.data(), cache_binary.size()}};
|
||||||
|
|
|
||||||
|
|
@ -111,9 +111,9 @@ void sleep_milliseconds(uint32_t millis);
|
||||||
void sleep_until(const std::chrono::high_resolution_clock::time_point& time_point);
|
void sleep_until(const std::chrono::high_resolution_clock::time_point& time_point);
|
||||||
|
|
||||||
// Graphics
|
// Graphics
|
||||||
void get_window_size(uint32_t& width, uint32_t& height);
|
|
||||||
uint32_t get_target_framerate(uint32_t original);
|
uint32_t get_target_framerate(uint32_t original);
|
||||||
uint32_t get_display_refresh_rate();
|
uint32_t get_display_refresh_rate();
|
||||||
|
float get_resolution_scale();
|
||||||
void load_shader_cache(std::span<const char> cache_data);
|
void load_shader_cache(std::span<const char> cache_data);
|
||||||
|
|
||||||
// Audio
|
// Audio
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue