diff --git a/src/core/gpu_hw.cpp b/src/core/gpu_hw.cpp index aa2e50fa9..f353e2591 100644 --- a/src/core/gpu_hw.cpp +++ b/src/core/gpu_hw.cpp @@ -204,8 +204,8 @@ bool GPU_HW::Initialize() const GPUDevice::Features features = g_gpu_device->GetFeatures(); - m_resolution_scale = CalculateResolutionScale(); - m_multisamples = std::min(g_settings.gpu_multisamples, g_gpu_device->GetMaxMultisamples()); + m_resolution_scale = Truncate8(CalculateResolutionScale()); + m_multisamples = Truncate8(std::min(g_settings.gpu_multisamples, g_gpu_device->GetMaxMultisamples())); m_supports_dual_source_blend = features.dual_source_blend; m_supports_framebuffer_fetch = features.framebuffer_fetch; m_per_sample_shading = g_settings.gpu_per_sample_shading && features.per_sample_shading; @@ -328,8 +328,8 @@ void GPU_HW::UpdateSettings(const Settings& old_settings) const GPUDevice::Features features = g_gpu_device->GetFeatures(); - const u32 resolution_scale = CalculateResolutionScale(); - const u32 multisamples = std::min(g_settings.gpu_multisamples, g_gpu_device->GetMaxMultisamples()); + const u8 resolution_scale = Truncate8(CalculateResolutionScale()); + const u8 multisamples = Truncate8(std::min(g_settings.gpu_multisamples, g_gpu_device->GetMaxMultisamples())); const bool per_sample_shading = g_settings.gpu_per_sample_shading && features.noperspective_interpolation; const GPUDownsampleMode downsample_mode = GetDownsampleMode(resolution_scale); const GPUWireframeMode wireframe_mode = diff --git a/src/core/gpu_hw.h b/src/core/gpu_hw.h index 659b7fcff..b0d34746c 100644 --- a/src/core/gpu_hw.h +++ b/src/core/gpu_hw.h @@ -232,29 +232,24 @@ private: s32 m_current_depth = 0; float m_last_depth_z = 1.0f; - u32 m_resolution_scale = 1; - u32 m_multisamples = 1; + u8 m_resolution_scale = 1; + u8 m_multisamples = 1; - union - { - BitField m_supports_dual_source_blend; - BitField m_supports_framebuffer_fetch; - BitField m_per_sample_shading; - BitField m_scaled_dithering; - BitField m_chroma_smoothing; - BitField m_disable_color_perspective; - - u8 bits = 0; - }; + bool m_supports_dual_source_blend : 1 = false; + bool m_supports_framebuffer_fetch : 1 = false; + bool m_per_sample_shading : 1 = false; + bool m_scaled_dithering : 1 = false; + bool m_chroma_smoothing : 1 = false; + bool m_disable_color_perspective : 1 = false; GPUTextureFilter m_texture_filtering = GPUTextureFilter::Nearest; GPUDownsampleMode m_downsample_mode = GPUDownsampleMode::Disabled; GPUWireframeMode m_wireframe_mode = GPUWireframeMode::Disabled; - bool m_true_color = true; - bool m_debanding = false; - bool m_clamp_uvs = false; - bool m_compute_uv_range = false; - bool m_pgxp_depth_buffer = false; + bool m_true_color : 1 = true; + bool m_debanding : 1 = false; + bool m_clamp_uvs : 1 = false; + bool m_compute_uv_range : 1 = false; + bool m_pgxp_depth_buffer : 1 = false; u8 m_texpage_dirty = 0; BatchConfig m_batch; diff --git a/src/core/hotkeys.cpp b/src/core/hotkeys.cpp index da0f5be2d..ea076f13a 100644 --- a/src/core/hotkeys.cpp +++ b/src/core/hotkeys.cpp @@ -50,7 +50,7 @@ static void HotkeyModifyResolutionScale(s32 increment) return; const Settings old_settings = g_settings; - g_settings.gpu_resolution_scale = new_resolution_scale; + g_settings.gpu_resolution_scale = Truncate8(new_resolution_scale); if (System::IsValid()) { diff --git a/src/core/settings.cpp b/src/core/settings.cpp index e34d7838c..e37da687c 100644 --- a/src/core/settings.cpp +++ b/src/core/settings.cpp @@ -177,8 +177,8 @@ void Settings::Load(SettingsInterface& si) gpu_renderer = ParseRendererName(si.GetStringValue("GPU", "Renderer", GetRendererName(DEFAULT_GPU_RENDERER)).c_str()) .value_or(DEFAULT_GPU_RENDERER); gpu_adapter = si.GetStringValue("GPU", "Adapter", ""); - gpu_resolution_scale = static_cast(si.GetIntValue("GPU", "ResolutionScale", 1)); - gpu_multisamples = static_cast(si.GetIntValue("GPU", "Multisamples", 1)); + gpu_resolution_scale = static_cast(si.GetIntValue("GPU", "ResolutionScale", 1)); + gpu_multisamples = static_cast(si.GetIntValue("GPU", "Multisamples", 1)); gpu_use_debug_device = si.GetBoolValue("GPU", "UseDebugDevice", false); gpu_disable_shader_cache = si.GetBoolValue("GPU", "DisableShaderCache", false); gpu_disable_dual_source_blend = si.GetBoolValue("GPU", "DisableDualSourceBlend", false); diff --git a/src/core/settings.h b/src/core/settings.h index 01f1506e3..cd37f628f 100644 --- a/src/core/settings.h +++ b/src/core/settings.h @@ -99,8 +99,8 @@ struct Settings GPURenderer gpu_renderer = DEFAULT_GPU_RENDERER; std::string gpu_adapter; - u32 gpu_resolution_scale = 1; - u32 gpu_multisamples = 1; + u8 gpu_resolution_scale = 1; + u8 gpu_multisamples = 1; bool gpu_use_thread : 1 = true; bool gpu_use_software_renderer_for_readbacks : 1 = false; bool gpu_threaded_presentation : 1 = true; diff --git a/src/core/system.cpp b/src/core/system.cpp index a5ba0a227..4dd09b704 100644 --- a/src/core/system.cpp +++ b/src/core/system.cpp @@ -3880,7 +3880,7 @@ void System::LogUnsafeSettingsToConsole(const std::string& messages) void System::CalculateRewindMemoryUsage(u32 num_saves, u32 resolution_scale, u64* ram_usage, u64* vram_usage) { - const u64 real_resolution_scale = static_cast(std::max(g_settings.gpu_resolution_scale, 1u)); + const u64 real_resolution_scale = std::max(g_settings.gpu_resolution_scale, 1u); *ram_usage = MAX_SAVE_STATE_SIZE * static_cast(num_saves); *vram_usage = ((VRAM_WIDTH * real_resolution_scale) * (VRAM_HEIGHT * real_resolution_scale) * 4) * static_cast(g_settings.gpu_multisamples) * static_cast(num_saves);