From 49c02854f59197f61fae639f7ce3d89167c0edc1 Mon Sep 17 00:00:00 2001 From: DH Date: Sun, 28 Nov 2021 09:33:24 +0200 Subject: [PATCH] [rsx] reduce size of config structs --- rpcs3/Emu/RSX/Program/GLSLTypes.h | 38 +++++++++++----------- rpcs3/Emu/RSX/VK/vkutils/buffer_object.cpp | 8 ++--- rpcs3/Emu/RSX/VK/vkutils/device.h | 32 +++++++++--------- 3 files changed, 39 insertions(+), 39 deletions(-) diff --git a/rpcs3/Emu/RSX/Program/GLSLTypes.h b/rpcs3/Emu/RSX/Program/GLSLTypes.h index 8c443a19bd..ac9a917f76 100644 --- a/rpcs3/Emu/RSX/Program/GLSLTypes.h +++ b/rpcs3/Emu/RSX/Program/GLSLTypes.h @@ -2,14 +2,14 @@ namespace glsl { - enum program_domain + enum program_domain : unsigned char { glsl_vertex_program = 0, glsl_fragment_program = 1, glsl_compute_program = 2 }; - enum glsl_rules + enum glsl_rules : unsigned char { glsl_rules_opengl4, glsl_rules_spirv @@ -17,25 +17,25 @@ namespace glsl struct shader_properties { - glsl::program_domain domain; + glsl::program_domain domain : 3; // Applicable in vertex stage - bool require_lit_emulation; + bool require_lit_emulation : 1; // Only relevant for fragment programs - bool fp32_outputs; - bool require_wpos; - bool require_depth_conversion; - bool require_texture_ops; - bool require_shadow_ops; - bool require_texture_expand; - bool require_srgb_to_linear; - bool require_linear_to_srgb; - bool emulate_coverage_tests; - bool emulate_shadow_compare; - bool emulate_zclip_transform; - bool emulate_depth_clip_only; - bool low_precision_tests; - bool disable_early_discard; - bool supports_native_fp16; + bool fp32_outputs : 1; + bool require_wpos : 1; + bool require_depth_conversion : 1; + bool require_texture_ops : 1; + bool require_shadow_ops : 1; + bool require_texture_expand : 1; + bool require_srgb_to_linear : 1; + bool require_linear_to_srgb : 1; + bool emulate_coverage_tests : 1; + bool emulate_shadow_compare : 1; + bool emulate_zclip_transform : 1; + bool emulate_depth_clip_only : 1; + bool low_precision_tests : 1; + bool disable_early_discard : 1; + bool supports_native_fp16 : 1; }; }; diff --git a/rpcs3/Emu/RSX/VK/vkutils/buffer_object.cpp b/rpcs3/Emu/RSX/VK/vkutils/buffer_object.cpp index 145192d007..efcc08794f 100644 --- a/rpcs3/Emu/RSX/VK/vkutils/buffer_object.cpp +++ b/rpcs3/Emu/RSX/VK/vkutils/buffer_object.cpp @@ -42,11 +42,11 @@ namespace vk buffer::buffer(const vk::render_device& dev, u64 size, const memory_type_info& memory_type, u32 access_flags, VkBufferUsageFlags usage, VkBufferCreateFlags flags, vmm_allocation_pool allocation_pool) : m_device(dev) { - info.size = size; info.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO; - info.sharingMode = VK_SHARING_MODE_EXCLUSIVE; info.flags = flags; + info.size = size; info.usage = usage; + info.sharingMode = VK_SHARING_MODE_EXCLUSIVE; CHECK_RESULT(vkCreateBuffer(m_device, &info, nullptr, &value)); @@ -67,11 +67,11 @@ namespace vk buffer::buffer(const vk::render_device& dev, VkBufferUsageFlags usage, void* host_pointer, u64 size) : m_device(dev) { - info.size = size; info.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO; - info.sharingMode = VK_SHARING_MODE_EXCLUSIVE; info.flags = 0; + info.size = size; info.usage = usage; + info.sharingMode = VK_SHARING_MODE_EXCLUSIVE; VkExternalMemoryBufferCreateInfoKHR ex_info; ex_info.sType = VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO_KHR; diff --git a/rpcs3/Emu/RSX/VK/vkutils/device.h b/rpcs3/Emu/RSX/VK/vkutils/device.h index fadf71c252..aeae0a14be 100644 --- a/rpcs3/Emu/RSX/VK/vkutils/device.h +++ b/rpcs3/Emu/RSX/VK/vkutils/device.h @@ -15,17 +15,17 @@ namespace vk { struct gpu_formats_support { - bool d24_unorm_s8; - bool d32_sfloat_s8; - bool bgra8_linear; - bool argb8_linear; + bool d24_unorm_s8 : 1; + bool d32_sfloat_s8 : 1; + bool bgra8_linear : 1; + bool argb8_linear : 1; }; struct gpu_shader_types_support { - bool allow_float64; - bool allow_float16; - bool allow_int8; + bool allow_float64 : 1; + bool allow_float16 : 1; + bool allow_int8 : 1; }; struct memory_type_mapping @@ -54,17 +54,17 @@ namespace vk gpu_shader_types_support shader_types_support{}; VkPhysicalDeviceDriverPropertiesKHR driver_properties{}; - bool stencil_export_support = false; - bool conditional_render_support = false; - bool external_memory_host_support = false; - bool unrestricted_depth_range_support = false; - bool surface_capabilities_2_support = false; - bool debug_utils_support = false; - bool sampler_mirror_clamped_support = false; - bool descriptor_indexing_support = false; + bool stencil_export_support : 1 = false; + bool conditional_render_support : 1 = false; + bool external_memory_host_support : 1 = false; + bool unrestricted_depth_range_support : 1 = false; + bool surface_capabilities_2_support : 1 = false; + bool debug_utils_support : 1 = false; + bool sampler_mirror_clamped_support : 1 = false; + bool descriptor_indexing_support : 1 = false; - u64 descriptor_update_after_bind_mask = 0; u32 descriptor_max_draw_calls = DESCRIPTOR_MAX_DRAW_CALLS; + u64 descriptor_update_after_bind_mask = 0; friend class render_device; private: