yuzu-emu
/
yuzu-android
Archived
1
0
Fork 0

Merge pull request #4663 from ReinUsesLisp/wswitch

video_core: Enforce -Werror=switch
This commit is contained in:
bunnei 2020-09-16 20:43:23 -07:00 committed by GitHub
commit 1eae35621e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 59 additions and 10 deletions

View File

@ -269,5 +269,5 @@ endif()
if (MSVC) if (MSVC)
target_compile_options(video_core PRIVATE /we4267) target_compile_options(video_core PRIVATE /we4267)
else() else()
target_compile_options(video_core PRIVATE -Werror=conversion -Wno-error=sign-conversion) target_compile_options(video_core PRIVATE -Werror=conversion -Wno-error=sign-conversion -Werror=switch)
endif() endif()

View File

@ -1443,8 +1443,10 @@ private:
return expr + ", vec2(0.0), vec2(0.0))"; return expr + ", vec2(0.0), vec2(0.0))";
case TextureType::TextureCube: case TextureType::TextureCube:
return expr + ", vec3(0.0), vec3(0.0))"; return expr + ", vec3(0.0), vec3(0.0))";
} default:
UNREACHABLE(); UNREACHABLE();
break;
}
} }
for (const auto& variant : extras) { for (const auto& variant : extras) {

View File

@ -47,6 +47,8 @@ inline GLenum VertexFormat(Maxwell::VertexAttribute attrib) {
return GL_UNSIGNED_INT; return GL_UNSIGNED_INT;
case Maxwell::VertexAttribute::Size::Size_10_10_10_2: case Maxwell::VertexAttribute::Size::Size_10_10_10_2:
return GL_UNSIGNED_INT_2_10_10_10_REV; return GL_UNSIGNED_INT_2_10_10_10_REV;
default:
break;
} }
break; break;
case Maxwell::VertexAttribute::Type::SignedNorm: case Maxwell::VertexAttribute::Type::SignedNorm:
@ -70,6 +72,8 @@ inline GLenum VertexFormat(Maxwell::VertexAttribute attrib) {
return GL_INT; return GL_INT;
case Maxwell::VertexAttribute::Size::Size_10_10_10_2: case Maxwell::VertexAttribute::Size::Size_10_10_10_2:
return GL_INT_2_10_10_10_REV; return GL_INT_2_10_10_10_REV;
default:
break;
} }
break; break;
case Maxwell::VertexAttribute::Type::Float: case Maxwell::VertexAttribute::Type::Float:
@ -84,6 +88,8 @@ inline GLenum VertexFormat(Maxwell::VertexAttribute attrib) {
case Maxwell::VertexAttribute::Size::Size_32_32_32: case Maxwell::VertexAttribute::Size::Size_32_32_32:
case Maxwell::VertexAttribute::Size::Size_32_32_32_32: case Maxwell::VertexAttribute::Size::Size_32_32_32_32:
return GL_FLOAT; return GL_FLOAT;
default:
break;
} }
break; break;
} }

View File

@ -78,9 +78,10 @@ VkSamplerAddressMode WrapMode(const VKDevice& device, Tegra::Texture::WrapMode w
case Tegra::Texture::WrapMode::MirrorOnceBorder: case Tegra::Texture::WrapMode::MirrorOnceBorder:
UNIMPLEMENTED(); UNIMPLEMENTED();
return VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE; return VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE;
} default:
UNIMPLEMENTED_MSG("Unimplemented wrap mode={}", static_cast<u32>(wrap_mode)); UNIMPLEMENTED_MSG("Unimplemented wrap mode={}", static_cast<u32>(wrap_mode));
return {}; return {};
}
} }
VkCompareOp DepthCompareFunction(Tegra::Texture::DepthCompareFunc depth_compare_func) { VkCompareOp DepthCompareFunction(Tegra::Texture::DepthCompareFunc depth_compare_func) {
@ -298,9 +299,10 @@ VkPrimitiveTopology PrimitiveTopology([[maybe_unused]] const VKDevice& device,
return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST; return VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
case Maxwell::PrimitiveTopology::Patches: case Maxwell::PrimitiveTopology::Patches:
return VK_PRIMITIVE_TOPOLOGY_PATCH_LIST; return VK_PRIMITIVE_TOPOLOGY_PATCH_LIST;
} default:
UNIMPLEMENTED_MSG("Unimplemented topology={}", static_cast<u32>(topology)); UNIMPLEMENTED_MSG("Unimplemented topology={}", static_cast<u32>(topology));
return {}; return {};
}
} }
VkFormat VertexFormat(Maxwell::VertexAttribute::Type type, Maxwell::VertexAttribute::Size size) { VkFormat VertexFormat(Maxwell::VertexAttribute::Type type, Maxwell::VertexAttribute::Size size) {
@ -325,6 +327,8 @@ VkFormat VertexFormat(Maxwell::VertexAttribute::Type type, Maxwell::VertexAttrib
return VK_FORMAT_R16G16B16A16_UNORM; return VK_FORMAT_R16G16B16A16_UNORM;
case Maxwell::VertexAttribute::Size::Size_10_10_10_2: case Maxwell::VertexAttribute::Size::Size_10_10_10_2:
return VK_FORMAT_A2B10G10R10_UNORM_PACK32; return VK_FORMAT_A2B10G10R10_UNORM_PACK32;
default:
break;
} }
break; break;
case Maxwell::VertexAttribute::Type::SignedNorm: case Maxwell::VertexAttribute::Type::SignedNorm:
@ -347,6 +351,8 @@ VkFormat VertexFormat(Maxwell::VertexAttribute::Type type, Maxwell::VertexAttrib
return VK_FORMAT_R16G16B16A16_SNORM; return VK_FORMAT_R16G16B16A16_SNORM;
case Maxwell::VertexAttribute::Size::Size_10_10_10_2: case Maxwell::VertexAttribute::Size::Size_10_10_10_2:
return VK_FORMAT_A2B10G10R10_SNORM_PACK32; return VK_FORMAT_A2B10G10R10_SNORM_PACK32;
default:
break;
} }
break; break;
case Maxwell::VertexAttribute::Type::UnsignedScaled: case Maxwell::VertexAttribute::Type::UnsignedScaled:
@ -369,6 +375,8 @@ VkFormat VertexFormat(Maxwell::VertexAttribute::Type type, Maxwell::VertexAttrib
return VK_FORMAT_R16G16B16A16_USCALED; return VK_FORMAT_R16G16B16A16_USCALED;
case Maxwell::VertexAttribute::Size::Size_10_10_10_2: case Maxwell::VertexAttribute::Size::Size_10_10_10_2:
return VK_FORMAT_A2B10G10R10_USCALED_PACK32; return VK_FORMAT_A2B10G10R10_USCALED_PACK32;
default:
break;
} }
break; break;
case Maxwell::VertexAttribute::Type::SignedScaled: case Maxwell::VertexAttribute::Type::SignedScaled:
@ -391,6 +399,8 @@ VkFormat VertexFormat(Maxwell::VertexAttribute::Type type, Maxwell::VertexAttrib
return VK_FORMAT_R16G16B16A16_SSCALED; return VK_FORMAT_R16G16B16A16_SSCALED;
case Maxwell::VertexAttribute::Size::Size_10_10_10_2: case Maxwell::VertexAttribute::Size::Size_10_10_10_2:
return VK_FORMAT_A2B10G10R10_SSCALED_PACK32; return VK_FORMAT_A2B10G10R10_SSCALED_PACK32;
default:
break;
} }
break; break;
case Maxwell::VertexAttribute::Type::UnsignedInt: case Maxwell::VertexAttribute::Type::UnsignedInt:
@ -421,6 +431,8 @@ VkFormat VertexFormat(Maxwell::VertexAttribute::Type type, Maxwell::VertexAttrib
return VK_FORMAT_R32G32B32A32_UINT; return VK_FORMAT_R32G32B32A32_UINT;
case Maxwell::VertexAttribute::Size::Size_10_10_10_2: case Maxwell::VertexAttribute::Size::Size_10_10_10_2:
return VK_FORMAT_A2B10G10R10_UINT_PACK32; return VK_FORMAT_A2B10G10R10_UINT_PACK32;
default:
break;
} }
break; break;
case Maxwell::VertexAttribute::Type::SignedInt: case Maxwell::VertexAttribute::Type::SignedInt:
@ -451,6 +463,8 @@ VkFormat VertexFormat(Maxwell::VertexAttribute::Type type, Maxwell::VertexAttrib
return VK_FORMAT_R32G32B32A32_SINT; return VK_FORMAT_R32G32B32A32_SINT;
case Maxwell::VertexAttribute::Size::Size_10_10_10_2: case Maxwell::VertexAttribute::Size::Size_10_10_10_2:
return VK_FORMAT_A2B10G10R10_SINT_PACK32; return VK_FORMAT_A2B10G10R10_SINT_PACK32;
default:
break;
} }
break; break;
case Maxwell::VertexAttribute::Type::Float: case Maxwell::VertexAttribute::Type::Float:
@ -471,6 +485,8 @@ VkFormat VertexFormat(Maxwell::VertexAttribute::Type type, Maxwell::VertexAttrib
return VK_FORMAT_R32G32B32_SFLOAT; return VK_FORMAT_R32G32B32_SFLOAT;
case Maxwell::VertexAttribute::Size::Size_32_32_32_32: case Maxwell::VertexAttribute::Size::Size_32_32_32_32:
return VK_FORMAT_R32G32B32A32_SFLOAT; return VK_FORMAT_R32G32B32A32_SFLOAT;
default:
break;
} }
break; break;
} }

View File

@ -262,6 +262,22 @@ const char* ToString(VkResult result) noexcept {
return "VK_ERROR_INVALID_DEVICE_ADDRESS_EXT"; return "VK_ERROR_INVALID_DEVICE_ADDRESS_EXT";
case VkResult::VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT: case VkResult::VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT:
return "VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT"; return "VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT";
case VkResult::VK_ERROR_UNKNOWN:
return "VK_ERROR_UNKNOWN";
case VkResult::VK_ERROR_INCOMPATIBLE_VERSION_KHR:
return "VK_ERROR_INCOMPATIBLE_VERSION_KHR";
case VkResult::VK_THREAD_IDLE_KHR:
return "VK_THREAD_IDLE_KHR";
case VkResult::VK_THREAD_DONE_KHR:
return "VK_THREAD_DONE_KHR";
case VkResult::VK_OPERATION_DEFERRED_KHR:
return "VK_OPERATION_DEFERRED_KHR";
case VkResult::VK_OPERATION_NOT_DEFERRED_KHR:
return "VK_OPERATION_NOT_DEFERRED_KHR";
case VkResult::VK_PIPELINE_COMPILE_REQUIRED_EXT:
return "VK_PIPELINE_COMPILE_REQUIRED_EXT";
case VkResult::VK_RESULT_MAX_ENUM:
return "VK_RESULT_MAX_ENUM";
} }
return "Unknown"; return "Unknown";
} }

View File

@ -53,6 +53,9 @@ u32 ShaderIR::DecodeArithmeticHalf(NodeBlock& bb, u32 pc) {
absolute_a = ((instr.value >> 44) & 1) != 0; absolute_a = ((instr.value >> 44) & 1) != 0;
absolute_b = ((instr.value >> 54) & 1) != 0; absolute_b = ((instr.value >> 54) & 1) != 0;
break; break;
default:
UNREACHABLE();
break;
} }
Node op_a = UnpackHalfFloat(GetRegister(instr.gpr8), instr.alu_half.type_a); Node op_a = UnpackHalfFloat(GetRegister(instr.gpr8), instr.alu_half.type_a);

View File

@ -119,6 +119,8 @@ ComponentType GetComponentType(Tegra::Engines::SamplerDescriptor descriptor,
return descriptor.r_type; return descriptor.r_type;
} }
break; break;
default:
break;
} }
UNIMPLEMENTED_MSG("Texture format not implemented={}", format); UNIMPLEMENTED_MSG("Texture format not implemented={}", format);
return ComponentType::FLOAT; return ComponentType::FLOAT;
@ -220,9 +222,10 @@ u32 GetComponentSize(TextureFormat format, std::size_t component) {
return (component == 0 || component == 1) ? 8 : 0; return (component == 0 || component == 1) ? 8 : 0;
case TextureFormat::G4R4: case TextureFormat::G4R4:
return (component == 0 || component == 1) ? 4 : 0; return (component == 0 || component == 1) ? 4 : 0;
} default:
UNIMPLEMENTED_MSG("Texture format not implemented={}", format); UNIMPLEMENTED_MSG("Texture format not implemented={}", format);
return 0; return 0;
}
} }
std::size_t GetImageComponentMask(TextureFormat format) { std::size_t GetImageComponentMask(TextureFormat format) {
@ -257,9 +260,10 @@ std::size_t GetImageComponentMask(TextureFormat format) {
case TextureFormat::R8: case TextureFormat::R8:
case TextureFormat::R1: case TextureFormat::R1:
return std::size_t{R}; return std::size_t{R};
} default:
UNIMPLEMENTED_MSG("Texture format not implemented={}", format); UNIMPLEMENTED_MSG("Texture format not implemented={}", format);
return std::size_t{R | G | B | A}; return std::size_t{R | G | B | A};
}
} }
std::size_t GetImageTypeNumCoordinates(Tegra::Shader::ImageType image_type) { std::size_t GetImageTypeNumCoordinates(Tegra::Shader::ImageType image_type) {
@ -463,6 +467,8 @@ u32 ShaderIR::DecodeImage(NodeBlock& bb, u32 pc) {
return OperationCode::AtomicImageXor; return OperationCode::AtomicImageXor;
case Tegra::Shader::ImageAtomicOperation::Exch: case Tegra::Shader::ImageAtomicOperation::Exch:
return OperationCode::AtomicImageExchange; return OperationCode::AtomicImageExchange;
default:
break;
} }
default: default:
break; break;