1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-25 04:02:42 +01:00

VK: ReSharper warning fixes

This commit is contained in:
Megamouse 2021-04-11 16:51:57 +02:00
parent a50be7a912
commit 1f295bba5b
14 changed files with 27 additions and 50 deletions

View File

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

View File

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

View File

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

View File

@ -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<u8, u8> get_format_element_size(VkFormat format);

View File

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

View File

@ -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 <unordered_map>
namespace vk

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -22,7 +22,7 @@ struct VKVertexDecompilerThread : public VertexProgramDecompiler
struct
{
bool emulate_conditional_rendering;
bool emulate_conditional_rendering{false};
}
m_device_props;

View File

@ -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");
}

View File

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