mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-04 05:51:27 +12:00
VK: ReSharper warning fixes
This commit is contained in:
parent
a50be7a912
commit
1f295bba5b
14 changed files with 27 additions and 50 deletions
|
@ -154,7 +154,7 @@ namespace vk
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_async_command_queue.push_back({});
|
m_async_command_queue.emplace_back();
|
||||||
m_current_cb = &m_async_command_queue.back();
|
m_current_cb = &m_async_command_queue.back();
|
||||||
m_current_cb->create(m_command_pool, true);
|
m_current_cb->create(m_command_pool, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace vk
|
||||||
case rsx::texture_dimension_extended::texture_dimension_3d:
|
case rsx::texture_dimension_extended::texture_dimension_3d:
|
||||||
return VK_IMAGE_VIEW_TYPE_3D;
|
return VK_IMAGE_VIEW_TYPE_3D;
|
||||||
default: fmt::throw_exception("Unreachable");
|
default: fmt::throw_exception("Unreachable");
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VkCompareOp get_compare_func(rsx::comparison_function op, bool reverse_direction = false)
|
VkCompareOp get_compare_func(rsx::comparison_function op, bool reverse_direction = false)
|
||||||
|
|
|
@ -42,11 +42,9 @@ namespace vk
|
||||||
case rsx::texture_minify_filter::linear_linear: return { VK_FILTER_LINEAR, VK_SAMPLER_MIPMAP_MODE_LINEAR, true };
|
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 };
|
case rsx::texture_minify_filter::convolution_min: return { VK_FILTER_LINEAR, VK_SAMPLER_MIPMAP_MODE_NEAREST, false };
|
||||||
default:
|
default:
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
fmt::throw_exception("Invalid min filter");
|
fmt::throw_exception("Invalid min filter");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
VkFilter get_mag_filter(rsx::texture_magnify_filter mag_filter)
|
VkFilter get_mag_filter(rsx::texture_magnify_filter mag_filter)
|
||||||
{
|
{
|
||||||
|
@ -80,22 +78,20 @@ namespace vk
|
||||||
}
|
}
|
||||||
default:
|
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 ((color4.r + color4.g + color4.b) > 1.35f)
|
||||||
{
|
{
|
||||||
//If color elements are brighter than roughly 0.5 average, use white border
|
//If color elements are brighter than roughly 0.5 average, use white border
|
||||||
return VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE;
|
return VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if (color4.a > 0.5f)
|
if (color4.a > 0.5f)
|
||||||
return VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK;
|
return VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK;
|
||||||
else
|
|
||||||
return VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK;
|
return VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
VkSamplerAddressMode vk_wrap_mode(rsx::texture_wrap_mode gcm_wrap)
|
VkSamplerAddressMode vk_wrap_mode(rsx::texture_wrap_mode gcm_wrap)
|
||||||
{
|
{
|
||||||
|
@ -110,11 +106,9 @@ 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_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;
|
case rsx::texture_wrap_mode::mirror_once_clamp: return VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE;
|
||||||
default:
|
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)
|
float max_aniso(rsx::texture_max_anisotropy gcm_aniso)
|
||||||
{
|
{
|
||||||
|
|
|
@ -70,7 +70,6 @@ public:
|
||||||
/**
|
/**
|
||||||
* Decompile a fragment shader located in the PS3's Memory. This function operates synchronously.
|
* 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 prog RSXShaderProgram specifying the location and size of the shader in memory
|
||||||
* @param td texture dimensions of input textures
|
|
||||||
*/
|
*/
|
||||||
void Decompile(const RSXFragmentProgram& prog);
|
void Decompile(const RSXFragmentProgram& prog);
|
||||||
|
|
||||||
|
|
|
@ -13,8 +13,6 @@
|
||||||
#include "vkutils/scratch.h"
|
#include "vkutils/scratch.h"
|
||||||
#include "vkutils/device.h"
|
#include "vkutils/device.h"
|
||||||
#include "Emu/RSX/rsx_methods.h"
|
#include "Emu/RSX/rsx_methods.h"
|
||||||
#include "Utilities/mutex.h"
|
|
||||||
#include "Utilities/lockless.h"
|
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
namespace vk
|
namespace vk
|
||||||
|
|
|
@ -151,13 +151,11 @@ namespace vk
|
||||||
|
|
||||||
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 u.name == uniform_name;
|
||||||
return true;
|
});
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void program::bind_uniform(const VkDescriptorImageInfo &image_descriptor, const std::string& uniform_name, VkDescriptorType type, VkDescriptorSet &descriptor_set)
|
void program::bind_uniform(const VkDescriptorImageInfo &image_descriptor, const std::string& uniform_name, VkDescriptorType type, VkDescriptorSet &descriptor_set)
|
||||||
|
|
|
@ -9,8 +9,8 @@ namespace vk
|
||||||
{
|
{
|
||||||
struct cs_resolve_base : compute_task
|
struct cs_resolve_base : compute_task
|
||||||
{
|
{
|
||||||
vk::viewable_image* multisampled;
|
vk::viewable_image* multisampled = nullptr;
|
||||||
vk::viewable_image* resolve;
|
vk::viewable_image* resolve = nullptr;
|
||||||
|
|
||||||
u32 cs_wave_x = 1;
|
u32 cs_wave_x = 1;
|
||||||
u32 cs_wave_y = 1;
|
u32 cs_wave_y = 1;
|
||||||
|
|
|
@ -53,7 +53,7 @@ namespace vk
|
||||||
const auto& binding_table = vk::get_current_renderer()->get_pipeline_binding_table();
|
const auto& binding_table = vk::get_current_renderer()->get_pipeline_binding_table();
|
||||||
vk::glsl::program_input in;
|
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.domain = ::glsl::glsl_vertex_program;
|
||||||
in.name = "VertexContextBuffer";
|
in.name = "VertexContextBuffer";
|
||||||
in.type = vk::glsl::input_type_uniform_buffer;
|
in.type = vk::glsl::input_type_uniform_buffer;
|
||||||
|
|
|
@ -772,7 +772,6 @@ namespace vk
|
||||||
|
|
||||||
// Define desirable attributes based on type
|
// Define desirable attributes based on type
|
||||||
VkImageType image_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;
|
VkImageUsageFlags usage_flags = VK_IMAGE_USAGE_TRANSFER_DST_BIT | VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_SAMPLED_BIT;
|
||||||
u8 layer = 0;
|
u8 layer = 0;
|
||||||
|
|
||||||
|
@ -780,26 +779,22 @@ namespace vk
|
||||||
{
|
{
|
||||||
case rsx::texture_dimension_extended::texture_dimension_1d:
|
case rsx::texture_dimension_extended::texture_dimension_1d:
|
||||||
image_type = VK_IMAGE_TYPE_1D;
|
image_type = VK_IMAGE_TYPE_1D;
|
||||||
image_view_type = VK_IMAGE_VIEW_TYPE_1D;
|
|
||||||
height = 1;
|
height = 1;
|
||||||
depth = 1;
|
depth = 1;
|
||||||
layer = 1;
|
layer = 1;
|
||||||
break;
|
break;
|
||||||
case rsx::texture_dimension_extended::texture_dimension_2d:
|
case rsx::texture_dimension_extended::texture_dimension_2d:
|
||||||
image_type = VK_IMAGE_TYPE_2D;
|
image_type = VK_IMAGE_TYPE_2D;
|
||||||
image_view_type = VK_IMAGE_VIEW_TYPE_2D;
|
|
||||||
depth = 1;
|
depth = 1;
|
||||||
layer = 1;
|
layer = 1;
|
||||||
break;
|
break;
|
||||||
case rsx::texture_dimension_extended::texture_dimension_cubemap:
|
case rsx::texture_dimension_extended::texture_dimension_cubemap:
|
||||||
image_type = VK_IMAGE_TYPE_2D;
|
image_type = VK_IMAGE_TYPE_2D;
|
||||||
image_view_type = VK_IMAGE_VIEW_TYPE_CUBE;
|
|
||||||
depth = 1;
|
depth = 1;
|
||||||
layer = 6;
|
layer = 6;
|
||||||
break;
|
break;
|
||||||
case rsx::texture_dimension_extended::texture_dimension_3d:
|
case rsx::texture_dimension_extended::texture_dimension_3d:
|
||||||
image_type = VK_IMAGE_TYPE_3D;
|
image_type = VK_IMAGE_TYPE_3D;
|
||||||
image_view_type = VK_IMAGE_VIEW_TYPE_3D;
|
|
||||||
layer = 1;
|
layer = 1;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -66,7 +66,7 @@ void VKVertexDecompilerThread::insertHeader(std::stringstream &OS)
|
||||||
OS << "};\n\n";
|
OS << "};\n\n";
|
||||||
|
|
||||||
vk::glsl::program_input in;
|
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.domain = glsl::glsl_vertex_program;
|
||||||
in.name = "VertexContextBuffer";
|
in.name = "VertexContextBuffer";
|
||||||
in.type = vk::glsl::input_type_uniform_buffer;
|
in.type = vk::glsl::input_type_uniform_buffer;
|
||||||
|
|
|
@ -22,7 +22,7 @@ struct VKVertexDecompilerThread : public VertexProgramDecompiler
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
bool emulate_conditional_rendering;
|
bool emulate_conditional_rendering{false};
|
||||||
}
|
}
|
||||||
m_device_props;
|
m_device_props;
|
||||||
|
|
||||||
|
|
|
@ -120,9 +120,9 @@ namespace vk
|
||||||
barrier.dstAccessMask = VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_INPUT_ATTACHMENT_READ_BIT;
|
barrier.dstAccessMask = VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_INPUT_ATTACHMENT_READ_BIT;
|
||||||
dst_stage = VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT;
|
dst_stage = VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT;
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
case VK_IMAGE_LAYOUT_UNDEFINED:
|
case VK_IMAGE_LAYOUT_UNDEFINED:
|
||||||
case VK_IMAGE_LAYOUT_PREINITIALIZED:
|
case VK_IMAGE_LAYOUT_PREINITIALIZED:
|
||||||
|
default:
|
||||||
fmt::throw_exception("Attempted to transition to an invalid layout");
|
fmt::throw_exception("Attempted to transition to an invalid layout");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -621,13 +621,7 @@ namespace vk
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkExtent2D swapchainExtent;
|
if (surface_descriptors.currentExtent.width != UINT32_MAX)
|
||||||
if (surface_descriptors.currentExtent.width == UINT32_MAX)
|
|
||||||
{
|
|
||||||
swapchainExtent.width = m_width;
|
|
||||||
swapchainExtent.height = m_height;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
if (surface_descriptors.currentExtent.width == 0 || surface_descriptors.currentExtent.height == 0)
|
if (surface_descriptors.currentExtent.width == 0 || surface_descriptors.currentExtent.height == 0)
|
||||||
{
|
{
|
||||||
|
@ -635,7 +629,6 @@ namespace vk
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
swapchainExtent = surface_descriptors.currentExtent;
|
|
||||||
m_width = surface_descriptors.currentExtent.width;
|
m_width = surface_descriptors.currentExtent.width;
|
||||||
m_height = surface_descriptors.currentExtent.height;
|
m_height = surface_descriptors.currentExtent.height;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue