Fix warnings related to -Wswitch

Add default cases.
Move default breaks to newline
Add proper handling in some instances.
Add missing enums to switches
This commit is contained in:
JohnHolmesII 2019-05-10 22:36:16 -07:00 committed by Nekotekina
parent be521ff0ab
commit 23094b48bb
12 changed files with 69 additions and 4 deletions

View File

@ -124,6 +124,7 @@ void fmt_class_string<CellSysutilParamId>::format(std::string& out, u64 arg)
case CELL_SYSUTIL_SYSTEMPARAM_ID_JAPANESE_KEYBOARD_ENTRY_METHOD: return "ID_JAPANESE_KEYBOARD_ENTRY_METHOD";
case CELL_SYSUTIL_SYSTEMPARAM_ID_CHINESE_KEYBOARD_ENTRY_METHOD: return "ID_CHINESE_KEYBOARD_ENTRY_METHOD";
case CELL_SYSUTIL_SYSTEMPARAM_ID_PAD_AUTOOFF: return "ID_PAD_AUTOOFF";
case CELL_SYSUTIL_SYSTEMPARAM_ID_MAGNETOMETER: return "ID_MAGNETOMETER";
case CELL_SYSUTIL_SYSTEMPARAM_ID_NICKNAME: return "ID_NICKNAME";
case CELL_SYSUTIL_SYSTEMPARAM_ID_CURRENT_USERNAME: return "ID_CURRENT_USERNAME";
}

View File

@ -913,6 +913,7 @@ void fmt_class_string<CellError>::format(std::string& out, u64 arg)
STR_CASE(CELL_ETIMEDOUT);
STR_CASE(CELL_EABORT);
STR_CASE(CELL_EFAULT);
STR_CASE(CELL_ENOCHILD);
STR_CASE(CELL_ESTAT);
STR_CASE(CELL_EALIGN);
STR_CASE(CELL_EKRESOURCE);

View File

@ -212,6 +212,8 @@ namespace gl
case gl::texture::type::f32:
gcm_format = CELL_GCM_TEXTURE_W32_Z32_Y32_X32_FLOAT;
break;
default:
break;
}
}
}

View File

@ -397,6 +397,8 @@ namespace rsx
}
break;
}
default:
break;
}
}

View File

@ -118,6 +118,8 @@ namespace rsx
return sizeof(u16) * size;
case 3:
return sizeof(u16) * 4;
default:
break;
}
fmt::throw_exception("Wrong vector size" HERE);
case vertex_base_type::f: return sizeof(f32) * size;
@ -130,6 +132,8 @@ namespace rsx
return sizeof(f16) * size;
case 3:
return sizeof(f16) * 4;
default:
break;
}
fmt::throw_exception("Wrong vector size" HERE);
case vertex_base_type::ub:
@ -141,10 +145,14 @@ namespace rsx
return sizeof(u8) * size;
case 3:
return sizeof(u8) * 4;
default:
break;
}
fmt::throw_exception("Wrong vector size" HERE);
case vertex_base_type::cmp: return 4;
case vertex_base_type::ub256: verify(HERE), (size == 4); return sizeof(u8) * 4;
default:
break;
}
fmt::throw_exception("RSXVertexData::GetTypeSize: Bad vertex data type (%d)!" HERE, (u8)type);
}
@ -2036,6 +2044,8 @@ namespace rsx
// These are single byte formats, but inverted order (BGRA vs ARGB) when passed via registers
to_swap_bytes = (layout.attribute_placement[index] == attribute_buffer_placement::transient);
break;
default:
break;
}
if (to_swap_bytes) attrib1 |= swap_storage_mask;
@ -2451,6 +2461,8 @@ namespace rsx
case frame_limit_type::_60: limit = 60.; break;
case frame_limit_type::_30: limit = 30.; break;
case frame_limit_type::_auto: limit = fps_limit; break; // TODO
default:
break;
}
if (limit)

View File

@ -42,6 +42,8 @@ namespace vk
if (support.d32_sfloat_s8) return VK_FORMAT_D32_SFLOAT_S8_UINT;
fmt::throw_exception("No hardware support for z24s8" HERE);
}
default:
break;
}
fmt::throw_exception("Invalid format (0x%x)" HERE, (u32)format);
}
@ -57,6 +59,9 @@ namespace vk
case rsx::texture_minify_filter::nearest_linear: return std::make_tuple(VK_FILTER_NEAREST, VK_SAMPLER_MIPMAP_MODE_LINEAR);
case rsx::texture_minify_filter::linear_linear: return std::make_tuple(VK_FILTER_LINEAR, VK_SAMPLER_MIPMAP_MODE_LINEAR);
case rsx::texture_minify_filter::convolution_min: return std::make_tuple(VK_FILTER_LINEAR, VK_SAMPLER_MIPMAP_MODE_LINEAR);
default:
ASSUME(0);
break;
}
fmt::throw_exception("Invalid max filter" HERE);
}
@ -68,6 +73,9 @@ namespace vk
case rsx::texture_magnify_filter::nearest: return VK_FILTER_NEAREST;
case rsx::texture_magnify_filter::linear: return VK_FILTER_LINEAR;
case rsx::texture_magnify_filter::convolution_mag: return VK_FILTER_LINEAR;
default:
ASSUME(0);
break;
}
fmt::throw_exception("Invalid mag filter (0x%x)" HERE, (u32)mag_filter);
}
@ -119,6 +127,9 @@ namespace vk
case rsx::texture_wrap_mode::mirror_once_clamp_to_edge: 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;
default:
ASSUME(0);
break;
}
fmt::throw_exception("unhandled texture clamp mode" HERE);
}
@ -135,6 +146,9 @@ namespace vk
case rsx::texture_max_anisotropy::x10: return 10.0f;
case rsx::texture_max_anisotropy::x12: return 12.0f;
case rsx::texture_max_anisotropy::x16: return 16.0f;
default:
ASSUME(0);
break;
}
fmt::throw_exception("Texture anisotropy error: bad max aniso (%d)" HERE, (u32)gcm_aniso);
@ -188,7 +202,7 @@ namespace vk
case CELL_GCM_TEXTURE_W16_Z16_Y16_X16_FLOAT:
case CELL_GCM_TEXTURE_W32_Z32_Y32_X32_FLOAT:
mapping = { VK_COMPONENT_SWIZZLE_A, VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_G, VK_COMPONENT_SWIZZLE_B }; break;
case CELL_GCM_TEXTURE_D8R8G8B8:
mapping = { VK_COMPONENT_SWIZZLE_ONE, VK_COMPONENT_SWIZZLE_G, VK_COMPONENT_SWIZZLE_R, VK_COMPONENT_SWIZZLE_A }; break;
@ -209,7 +223,7 @@ namespace vk
default:
fmt::throw_exception("Invalid or unsupported component mapping for texture format (0x%x)" HERE, format);
}
return mapping;
}
@ -244,6 +258,8 @@ namespace vk
case CELL_GCM_TEXTURE_COMPRESSED_HILO_S8: return VK_FORMAT_R8G8_SNORM;
case CELL_GCM_TEXTURE_COMPRESSED_B8R8_G8R8: return VK_FORMAT_B8G8R8A8_UNORM;
case CELL_GCM_TEXTURE_COMPRESSED_R8B8_R8G8: return VK_FORMAT_B8G8R8A8_UNORM;
default:
break;
}
fmt::throw_exception("Invalid or unsupported sampler format for texture format (0x%x)" HERE, format);
}
@ -305,6 +321,8 @@ namespace vk
case VK_FORMAT_D32_SFLOAT_S8_UINT: //TODO: Translate to D24S8
case VK_FORMAT_D24_UNORM_S8_UINT:
return 4;
default:
break;
}
fmt::throw_exception("Unexpected vkFormat 0x%X", (u32)format);
@ -364,6 +382,8 @@ namespace vk
case VK_FORMAT_D32_SFLOAT_S8_UINT:
case VK_FORMAT_D24_UNORM_S8_UINT:
return{ 4, 1 };
default:
break;
}
fmt::throw_exception("Unexpected vkFormat 0x%X", (u32)format);
@ -414,6 +434,8 @@ namespace vk
case VK_FORMAT_D32_SFLOAT_S8_UINT:
case VK_FORMAT_D24_UNORM_S8_UINT:
return{ true, 4 };
default:
break;
}
fmt::throw_exception("Unknown vkFormat 0x%x" HERE, (u32)format);

View File

@ -17,6 +17,9 @@ namespace
{
case rsx::surface_depth_format::z16: return 0xFFFF;
case rsx::surface_depth_format::z24s8: return 0xFFFFFF;
default:
ASSUME(0);
break;
}
fmt::throw_exception("Unknown depth format" HERE);
}
@ -27,6 +30,9 @@ namespace
{
case rsx::surface_depth_format::z16: return 2;
case rsx::surface_depth_format::z24s8: return 4;
default:
ASSUME(0);
break;
}
fmt::throw_exception("Unknown depth format" HERE);
}
@ -1068,7 +1074,7 @@ void VKGSRender::emit_geometry(u32 sub_index)
}
else if (draw_call.execute_pipeline_dependencies() & rsx::vertex_base_changed)
{
// Rebase vertex bases instead of
// Rebase vertex bases instead of
for (auto &info : m_vertex_layout.interleaved_blocks)
{
const auto vertex_base_offset = rsx::method_registers.vertex_data_base_offset();

View File

@ -504,6 +504,7 @@ 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:
fmt::throw_exception("Attempted to transition to an invalid layout");
@ -575,6 +576,8 @@ namespace vk
barrier.srcAccessMask = VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_INPUT_ATTACHMENT_READ_BIT;
src_stage = VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT;
break;
default:
break; //TODO Investigate what happens here
}
vkCmdPipelineBarrier(cmd, src_stage, dst_stage, 0, 0, nullptr, 0, nullptr, 1, &barrier);
@ -856,11 +859,14 @@ namespace vk
switch (severity)
{
default:
case 0:
fmt::throw_exception("Assertion Failed! Vulkan API call failed with unrecoverable error: %s%s", error_message.c_str(), faulting_addr);
case 1:
LOG_ERROR(RSX, "Vulkan API call has failed with an error but will continue: %s%s", error_message.c_str(), faulting_addr);
break;
case 2:
break;
}
}

View File

@ -1215,6 +1215,9 @@ private:
case VK_IMAGE_TYPE_3D:
info.viewType = VK_IMAGE_VIEW_TYPE_3D;
break;
default:
ASSUME(0);
break;
}
create_impl();

View File

@ -476,6 +476,9 @@ namespace vk
stretch_image_typeless_safe(src, dst, typeless_stencil->value, src_rect, dst_rect, depth_stencil, VK_IMAGE_ASPECT_STENCIL_BIT);
break;
}
default:
fmt::throw_exception("Unreachable" HERE);
break;
}
}
}

View File

@ -140,7 +140,7 @@ namespace vk
return managed_texture.get();
}
std::unique_ptr<vk::viewable_image>& get_texture()
std::unique_ptr<vk::viewable_image>& get_texture()
{
return managed_texture;
}
@ -914,6 +914,9 @@ namespace vk
image_view_type = VK_IMAGE_VIEW_TYPE_3D;
layer = 1;
break;
default:
ASSUME(0);
break;
}
switch (gcm_format)
@ -991,6 +994,8 @@ namespace vk
case VK_FORMAT_D24_UNORM_S8_UINT:
subres_range.aspectMask |= VK_IMAGE_ASPECT_STENCIL_BIT;
break;
default:
break;
}
change_image_layout(cmd, image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, subres_range);

View File

@ -245,6 +245,8 @@ namespace rsx
// Get BE data
arg = be_t<u32>{arg}.raw();
break;
default:
break;
}
if (rsx->in_begin_end)