diff --git a/rpcs3/Emu/RSX/VK/VKAsyncScheduler.cpp b/rpcs3/Emu/RSX/VK/VKAsyncScheduler.cpp index d1e72e4214..5f08968fd6 100644 --- a/rpcs3/Emu/RSX/VK/VKAsyncScheduler.cpp +++ b/rpcs3/Emu/RSX/VK/VKAsyncScheduler.cpp @@ -154,7 +154,7 @@ namespace vk } else { - m_async_command_queue.push_back({}); + m_async_command_queue.emplace_back(); m_current_cb = &m_async_command_queue.back(); m_current_cb->create(m_command_pool, true); } diff --git a/rpcs3/Emu/RSX/VK/VKDraw.cpp b/rpcs3/Emu/RSX/VK/VKDraw.cpp index 97108fe572..83663e999e 100644 --- a/rpcs3/Emu/RSX/VK/VKDraw.cpp +++ b/rpcs3/Emu/RSX/VK/VKDraw.cpp @@ -21,7 +21,7 @@ namespace vk case rsx::texture_dimension_extended::texture_dimension_3d: return VK_IMAGE_VIEW_TYPE_3D; default: fmt::throw_exception("Unreachable"); - }; + } } VkCompareOp get_compare_func(rsx::comparison_function op, bool reverse_direction = false) diff --git a/rpcs3/Emu/RSX/VK/VKFormats.cpp b/rpcs3/Emu/RSX/VK/VKFormats.cpp index d11c91f908..f94cc2e2fe 100644 --- a/rpcs3/Emu/RSX/VK/VKFormats.cpp +++ b/rpcs3/Emu/RSX/VK/VKFormats.cpp @@ -5,7 +5,7 @@ namespace vk { - VkFormat get_compatible_depth_surface_format(const gpu_formats_support &support, rsx::surface_depth_format2 format) + VkFormat get_compatible_depth_surface_format(const gpu_formats_support& support, rsx::surface_depth_format2 format) { switch (format) { @@ -42,10 +42,8 @@ namespace vk case rsx::texture_minify_filter::linear_linear: return { VK_FILTER_LINEAR, VK_SAMPLER_MIPMAP_MODE_LINEAR, true }; case rsx::texture_minify_filter::convolution_min: return { VK_FILTER_LINEAR, VK_SAMPLER_MIPMAP_MODE_NEAREST, false }; default: - break; + fmt::throw_exception("Invalid min filter"); } - - fmt::throw_exception("Invalid min filter"); } VkFilter get_mag_filter(rsx::texture_magnify_filter mag_filter) @@ -80,19 +78,17 @@ namespace vk } default: { - auto color4 = rsx::decode_border_color(color); + const auto color4 = rsx::decode_border_color(color); if ((color4.r + color4.g + color4.b) > 1.35f) { //If color elements are brighter than roughly 0.5 average, use white border return VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE; } - else - { - if (color4.a > 0.5f) - return VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK; - else - return VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK; - } + + if (color4.a > 0.5f) + return VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK; + + return VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK; } } } @@ -110,10 +106,8 @@ namespace vk case rsx::texture_wrap_mode::mirror_once_border: return VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE; case rsx::texture_wrap_mode::mirror_once_clamp: return VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE; default: - break; + fmt::throw_exception("Unhandled texture clamp mode"); } - - fmt::throw_exception("Unhandled texture clamp mode"); } float max_aniso(rsx::texture_max_anisotropy gcm_aniso) @@ -207,7 +201,7 @@ namespace vk return mapping; } - VkFormat get_compatible_sampler_format(const gpu_formats_support &support, u32 format) + VkFormat get_compatible_sampler_format(const gpu_formats_support& support, u32 format) { switch (format) { diff --git a/rpcs3/Emu/RSX/VK/VKFormats.h b/rpcs3/Emu/RSX/VK/VKFormats.h index 5bf21971a6..17d8834972 100644 --- a/rpcs3/Emu/RSX/VK/VKFormats.h +++ b/rpcs3/Emu/RSX/VK/VKFormats.h @@ -17,8 +17,8 @@ namespace vk VkBorderColor get_border_color(u32 color); - VkFormat get_compatible_depth_surface_format(const gpu_formats_support &support, rsx::surface_depth_format2 format); - VkFormat get_compatible_sampler_format(const gpu_formats_support &support, u32 format); + VkFormat get_compatible_depth_surface_format(const gpu_formats_support& support, rsx::surface_depth_format2 format); + VkFormat get_compatible_sampler_format(const gpu_formats_support& support, u32 format); VkFormat get_compatible_srgb_format(VkFormat rgb_format); u8 get_format_texel_width(VkFormat format); std::pair get_format_element_size(VkFormat format); diff --git a/rpcs3/Emu/RSX/VK/VKFragmentProgram.h b/rpcs3/Emu/RSX/VK/VKFragmentProgram.h index 8d25998c88..8252a45037 100644 --- a/rpcs3/Emu/RSX/VK/VKFragmentProgram.h +++ b/rpcs3/Emu/RSX/VK/VKFragmentProgram.h @@ -70,7 +70,6 @@ public: /** * Decompile a fragment shader located in the PS3's Memory. This function operates synchronously. * @param prog RSXShaderProgram specifying the location and size of the shader in memory - * @param td texture dimensions of input textures */ void Decompile(const RSXFragmentProgram& prog); diff --git a/rpcs3/Emu/RSX/VK/VKHelpers.cpp b/rpcs3/Emu/RSX/VK/VKHelpers.cpp index db337ce87e..78c2b71021 100644 --- a/rpcs3/Emu/RSX/VK/VKHelpers.cpp +++ b/rpcs3/Emu/RSX/VK/VKHelpers.cpp @@ -13,8 +13,6 @@ #include "vkutils/scratch.h" #include "vkutils/device.h" #include "Emu/RSX/rsx_methods.h" -#include "Utilities/mutex.h" -#include "Utilities/lockless.h" #include namespace vk diff --git a/rpcs3/Emu/RSX/VK/VKProgramPipeline.cpp b/rpcs3/Emu/RSX/VK/VKProgramPipeline.cpp index ebc764748b..38afcec690 100644 --- a/rpcs3/Emu/RSX/VK/VKProgramPipeline.cpp +++ b/rpcs3/Emu/RSX/VK/VKProgramPipeline.cpp @@ -149,15 +149,13 @@ namespace vk return *this; } - bool program::has_uniform(program_input_type type, const std::string &uniform_name) + bool program::has_uniform(program_input_type type, const std::string& uniform_name) { - for (const auto &uniform : uniforms[type]) + const auto& uniform = uniforms[type]; + return std::any_of(uniform.cbegin(), uniform.cend(), [&uniform_name](const auto& u) { - if (uniform.name == uniform_name) - return true; - } - - return false; + return u.name == uniform_name; + }); } void program::bind_uniform(const VkDescriptorImageInfo &image_descriptor, const std::string& uniform_name, VkDescriptorType type, VkDescriptorSet &descriptor_set) diff --git a/rpcs3/Emu/RSX/VK/VKResolveHelper.h b/rpcs3/Emu/RSX/VK/VKResolveHelper.h index 922d1ccfaa..4a59127f11 100644 --- a/rpcs3/Emu/RSX/VK/VKResolveHelper.h +++ b/rpcs3/Emu/RSX/VK/VKResolveHelper.h @@ -9,8 +9,8 @@ namespace vk { struct cs_resolve_base : compute_task { - vk::viewable_image* multisampled; - vk::viewable_image* resolve; + vk::viewable_image* multisampled = nullptr; + vk::viewable_image* resolve = nullptr; u32 cs_wave_x = 1; u32 cs_wave_y = 1; diff --git a/rpcs3/Emu/RSX/VK/VKShaderInterpreter.cpp b/rpcs3/Emu/RSX/VK/VKShaderInterpreter.cpp index cf782a99c5..fb0118654b 100644 --- a/rpcs3/Emu/RSX/VK/VKShaderInterpreter.cpp +++ b/rpcs3/Emu/RSX/VK/VKShaderInterpreter.cpp @@ -53,7 +53,7 @@ namespace vk const auto& binding_table = vk::get_current_renderer()->get_pipeline_binding_table(); vk::glsl::program_input in; - in.location = binding_table.vertex_params_bind_slot;; + in.location = binding_table.vertex_params_bind_slot; in.domain = ::glsl::glsl_vertex_program; in.name = "VertexContextBuffer"; in.type = vk::glsl::input_type_uniform_buffer; diff --git a/rpcs3/Emu/RSX/VK/VKTextureCache.h b/rpcs3/Emu/RSX/VK/VKTextureCache.h index f1f8ce6f17..ba8ee54ccc 100644 --- a/rpcs3/Emu/RSX/VK/VKTextureCache.h +++ b/rpcs3/Emu/RSX/VK/VKTextureCache.h @@ -765,14 +765,13 @@ namespace vk dst->pop_layout(cmd); } - cached_texture_section* create_new_texture(vk::command_buffer& cmd, const utils::address_range &rsx_range, u16 width, u16 height, u16 depth, u16 mipmaps, u16 pitch, + cached_texture_section* create_new_texture(vk::command_buffer& cmd, const utils::address_range &rsx_range, u16 width, u16 height, u16 depth, u16 mipmaps, u16 pitch, u32 gcm_format, rsx::texture_upload_context context, rsx::texture_dimension_extended type, bool swizzled, rsx::texture_create_flags flags) override { const auto section_depth = depth; // Define desirable attributes based on type VkImageType image_type; - [[maybe_unused]] VkImageViewType image_view_type; VkImageUsageFlags usage_flags = VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_SAMPLED_BIT; u8 layer = 0; @@ -780,26 +779,22 @@ namespace vk { case rsx::texture_dimension_extended::texture_dimension_1d: image_type = VK_IMAGE_TYPE_1D; - image_view_type = VK_IMAGE_VIEW_TYPE_1D; height = 1; depth = 1; layer = 1; break; case rsx::texture_dimension_extended::texture_dimension_2d: image_type = VK_IMAGE_TYPE_2D; - image_view_type = VK_IMAGE_VIEW_TYPE_2D; depth = 1; layer = 1; break; case rsx::texture_dimension_extended::texture_dimension_cubemap: image_type = VK_IMAGE_TYPE_2D; - image_view_type = VK_IMAGE_VIEW_TYPE_CUBE; depth = 1; layer = 6; break; case rsx::texture_dimension_extended::texture_dimension_3d: image_type = VK_IMAGE_TYPE_3D; - image_view_type = VK_IMAGE_VIEW_TYPE_3D; layer = 1; break; default: diff --git a/rpcs3/Emu/RSX/VK/VKVertexProgram.cpp b/rpcs3/Emu/RSX/VK/VKVertexProgram.cpp index 081a1e50ad..9e4e3324e3 100644 --- a/rpcs3/Emu/RSX/VK/VKVertexProgram.cpp +++ b/rpcs3/Emu/RSX/VK/VKVertexProgram.cpp @@ -66,7 +66,7 @@ void VKVertexDecompilerThread::insertHeader(std::stringstream &OS) OS << "};\n\n"; vk::glsl::program_input in; - in.location = m_binding_table.vertex_params_bind_slot;; + in.location = m_binding_table.vertex_params_bind_slot; in.domain = glsl::glsl_vertex_program; in.name = "VertexContextBuffer"; in.type = vk::glsl::input_type_uniform_buffer; diff --git a/rpcs3/Emu/RSX/VK/VKVertexProgram.h b/rpcs3/Emu/RSX/VK/VKVertexProgram.h index fb47125d94..044249ddfd 100644 --- a/rpcs3/Emu/RSX/VK/VKVertexProgram.h +++ b/rpcs3/Emu/RSX/VK/VKVertexProgram.h @@ -22,7 +22,7 @@ struct VKVertexDecompilerThread : public VertexProgramDecompiler struct { - bool emulate_conditional_rendering; + bool emulate_conditional_rendering{false}; } m_device_props; diff --git a/rpcs3/Emu/RSX/VK/vkutils/image_helpers.cpp b/rpcs3/Emu/RSX/VK/vkutils/image_helpers.cpp index b6e2a8aafa..cf5131b205 100644 --- a/rpcs3/Emu/RSX/VK/vkutils/image_helpers.cpp +++ b/rpcs3/Emu/RSX/VK/vkutils/image_helpers.cpp @@ -120,9 +120,9 @@ namespace vk barrier.dstAccessMask = VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_INPUT_ATTACHMENT_READ_BIT; dst_stage = VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT; break; - default: case VK_IMAGE_LAYOUT_UNDEFINED: case VK_IMAGE_LAYOUT_PREINITIALIZED: + default: fmt::throw_exception("Attempted to transition to an invalid layout"); } diff --git a/rpcs3/Emu/RSX/VK/vkutils/swapchain.hpp b/rpcs3/Emu/RSX/VK/vkutils/swapchain.hpp index 4ce4680f08..c8bd84a0ed 100644 --- a/rpcs3/Emu/RSX/VK/vkutils/swapchain.hpp +++ b/rpcs3/Emu/RSX/VK/vkutils/swapchain.hpp @@ -621,13 +621,7 @@ namespace vk return false; } - VkExtent2D swapchainExtent; - if (surface_descriptors.currentExtent.width == UINT32_MAX) - { - swapchainExtent.width = m_width; - swapchainExtent.height = m_height; - } - else + if (surface_descriptors.currentExtent.width != UINT32_MAX) { if (surface_descriptors.currentExtent.width == 0 || surface_descriptors.currentExtent.height == 0) { @@ -635,7 +629,6 @@ namespace vk return false; } - swapchainExtent = surface_descriptors.currentExtent; m_width = surface_descriptors.currentExtent.width; m_height = surface_descriptors.currentExtent.height; }