GPU/HW: Slightly reduce struct size

This commit is contained in:
Stenzek 2024-03-01 13:51:16 +10:00
parent d50ba989ae
commit b34742cdd2
No known key found for this signature in database
6 changed files with 23 additions and 28 deletions

View file

@ -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<u32>(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<u32>(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 =

View file

@ -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<u8, bool, 0, 1> m_supports_dual_source_blend;
BitField<u8, bool, 1, 1> m_supports_framebuffer_fetch;
BitField<u8, bool, 2, 1> m_per_sample_shading;
BitField<u8, bool, 3, 1> m_scaled_dithering;
BitField<u8, bool, 4, 1> m_chroma_smoothing;
BitField<u8, bool, 5, 1> 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;

View file

@ -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())
{

View file

@ -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<u32>(si.GetIntValue("GPU", "ResolutionScale", 1));
gpu_multisamples = static_cast<u32>(si.GetIntValue("GPU", "Multisamples", 1));
gpu_resolution_scale = static_cast<u8>(si.GetIntValue("GPU", "ResolutionScale", 1));
gpu_multisamples = static_cast<u8>(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);

View file

@ -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;

View file

@ -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<u64>(std::max(g_settings.gpu_resolution_scale, 1u));
const u64 real_resolution_scale = std::max<u64>(g_settings.gpu_resolution_scale, 1u);
*ram_usage = MAX_SAVE_STATE_SIZE * static_cast<u64>(num_saves);
*vram_usage = ((VRAM_WIDTH * real_resolution_scale) * (VRAM_HEIGHT * real_resolution_scale) * 4) *
static_cast<u64>(g_settings.gpu_multisamples) * static_cast<u64>(num_saves);