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

Merge pull request #2322 from ReinUsesLisp/wswitch

video_core: Silent -Wswitch warnings
This commit is contained in:
bunnei 2019-04-28 22:24:58 -04:00 committed by GitHub
commit c52233ec8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 106 additions and 77 deletions

View File

@ -105,6 +105,8 @@ bool DmaPusher::Step() {
dma_state.non_incrementing = false; dma_state.non_incrementing = false;
dma_increment_once = true; dma_increment_once = true;
break; break;
default:
break;
} }
} }
} }

View File

@ -243,9 +243,10 @@ public:
return "10_10_10_2"; return "10_10_10_2";
case Size::Size_11_11_10: case Size::Size_11_11_10:
return "11_11_10"; return "11_11_10";
default:
UNREACHABLE();
return {};
} }
UNREACHABLE();
return {};
} }
std::string TypeString() const { std::string TypeString() const {

View File

@ -305,6 +305,8 @@ void RasterizerOpenGL::SetupShaders(GLenum primitive_mode) {
case Maxwell::ShaderProgram::Geometry: case Maxwell::ShaderProgram::Geometry:
shader_program_manager->UseTrivialGeometryShader(); shader_program_manager->UseTrivialGeometryShader();
break; break;
default:
break;
} }
continue; continue;
} }

View File

@ -27,8 +27,7 @@ using Maxwell = Tegra::Engines::Maxwell3D::Regs;
inline GLenum VertexType(Maxwell::VertexAttribute attrib) { inline GLenum VertexType(Maxwell::VertexAttribute attrib) {
switch (attrib.type) { switch (attrib.type) {
case Maxwell::VertexAttribute::Type::UnsignedInt: case Maxwell::VertexAttribute::Type::UnsignedInt:
case Maxwell::VertexAttribute::Type::UnsignedNorm: { case Maxwell::VertexAttribute::Type::UnsignedNorm:
switch (attrib.size) { switch (attrib.size) {
case Maxwell::VertexAttribute::Size::Size_8: case Maxwell::VertexAttribute::Size::Size_8:
case Maxwell::VertexAttribute::Size::Size_8_8: case Maxwell::VertexAttribute::Size::Size_8_8:
@ -47,16 +46,13 @@ inline GLenum VertexType(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:
LOG_CRITICAL(Render_OpenGL, "Unimplemented vertex size={}", attrib.SizeString());
UNREACHABLE();
return {};
} }
LOG_CRITICAL(Render_OpenGL, "Unimplemented vertex size={}", attrib.SizeString());
UNREACHABLE();
return {};
}
case Maxwell::VertexAttribute::Type::SignedInt: case Maxwell::VertexAttribute::Type::SignedInt:
case Maxwell::VertexAttribute::Type::SignedNorm: { case Maxwell::VertexAttribute::Type::SignedNorm:
switch (attrib.size) { switch (attrib.size) {
case Maxwell::VertexAttribute::Size::Size_8: case Maxwell::VertexAttribute::Size::Size_8:
case Maxwell::VertexAttribute::Size::Size_8_8: case Maxwell::VertexAttribute::Size::Size_8_8:
@ -75,14 +71,12 @@ inline GLenum VertexType(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:
LOG_CRITICAL(Render_OpenGL, "Unimplemented vertex size={}", attrib.SizeString());
UNREACHABLE();
return {};
} }
case Maxwell::VertexAttribute::Type::Float:
LOG_CRITICAL(Render_OpenGL, "Unimplemented vertex size={}", attrib.SizeString());
UNREACHABLE();
return {};
}
case Maxwell::VertexAttribute::Type::Float: {
switch (attrib.size) { switch (attrib.size) {
case Maxwell::VertexAttribute::Size::Size_16: case Maxwell::VertexAttribute::Size::Size_16:
case Maxwell::VertexAttribute::Size::Size_16_16: case Maxwell::VertexAttribute::Size::Size_16_16:
@ -94,13 +88,16 @@ inline GLenum VertexType(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:
LOG_CRITICAL(Render_OpenGL, "Unimplemented vertex size={}", attrib.SizeString());
UNREACHABLE();
return {};
} }
default:
LOG_CRITICAL(Render_OpenGL, "Unimplemented vertex type={}", attrib.TypeString());
UNREACHABLE();
return {};
} }
}
LOG_CRITICAL(Render_OpenGL, "Unimplemented vertex type={}", attrib.TypeString());
UNREACHABLE();
return {};
} }
inline GLenum IndexFormat(Maxwell::IndexFormat index_format) { inline GLenum IndexFormat(Maxwell::IndexFormat index_format) {
@ -129,10 +126,11 @@ inline GLenum PrimitiveTopology(Maxwell::PrimitiveTopology topology) {
return GL_TRIANGLES; return GL_TRIANGLES;
case Maxwell::PrimitiveTopology::TriangleStrip: case Maxwell::PrimitiveTopology::TriangleStrip:
return GL_TRIANGLE_STRIP; return GL_TRIANGLE_STRIP;
default:
LOG_CRITICAL(Render_OpenGL, "Unimplemented topology={}", static_cast<u32>(topology));
UNREACHABLE();
return {};
} }
LOG_CRITICAL(Render_OpenGL, "Unimplemented topology={}", static_cast<u32>(topology));
UNREACHABLE();
return {};
} }
inline GLenum TextureFilterMode(Tegra::Texture::TextureFilter filter_mode, inline GLenum TextureFilterMode(Tegra::Texture::TextureFilter filter_mode,
@ -186,9 +184,10 @@ inline GLenum WrapMode(Tegra::Texture::WrapMode wrap_mode) {
} else { } else {
return GL_MIRROR_CLAMP_TO_EDGE; return GL_MIRROR_CLAMP_TO_EDGE;
} }
default:
LOG_ERROR(Render_OpenGL, "Unimplemented texture wrap mode={}", static_cast<u32>(wrap_mode));
return GL_REPEAT;
} }
LOG_ERROR(Render_OpenGL, "Unimplemented texture wrap mode={}", static_cast<u32>(wrap_mode));
return GL_REPEAT;
} }
inline GLenum DepthCompareFunc(Tegra::Texture::DepthCompareFunc func) { inline GLenum DepthCompareFunc(Tegra::Texture::DepthCompareFunc func) {

View File

@ -62,9 +62,10 @@ vk::SamplerAddressMode WrapMode(Tegra::Texture::WrapMode wrap_mode) {
case Tegra::Texture::WrapMode::MirrorOnceBorder: case Tegra::Texture::WrapMode::MirrorOnceBorder:
UNIMPLEMENTED(); UNIMPLEMENTED();
return vk::SamplerAddressMode::eMirrorClampToEdge; return vk::SamplerAddressMode::eMirrorClampToEdge;
default:
UNIMPLEMENTED_MSG("Unimplemented wrap mode={}", static_cast<u32>(wrap_mode));
return {};
} }
UNIMPLEMENTED_MSG("Unimplemented wrap mode={}", static_cast<u32>(wrap_mode));
return {};
} }
vk::CompareOp DepthCompareFunction(Tegra::Texture::DepthCompareFunc depth_compare_func) { vk::CompareOp DepthCompareFunction(Tegra::Texture::DepthCompareFunc depth_compare_func) {
@ -225,9 +226,10 @@ vk::PrimitiveTopology PrimitiveTopology(Maxwell::PrimitiveTopology topology) {
return vk::PrimitiveTopology::eTriangleList; return vk::PrimitiveTopology::eTriangleList;
case Maxwell::PrimitiveTopology::TriangleStrip: case Maxwell::PrimitiveTopology::TriangleStrip:
return vk::PrimitiveTopology::eTriangleStrip; return vk::PrimitiveTopology::eTriangleStrip;
default:
UNIMPLEMENTED_MSG("Unimplemented topology={}", static_cast<u32>(topology));
return {};
} }
UNIMPLEMENTED_MSG("Unimplemented topology={}", static_cast<u32>(topology));
return {};
} }
vk::Format VertexFormat(Maxwell::VertexAttribute::Type type, Maxwell::VertexAttribute::Size size) { vk::Format VertexFormat(Maxwell::VertexAttribute::Type type, Maxwell::VertexAttribute::Size size) {

View File

@ -116,6 +116,8 @@ ExitMethod ShaderIR::Scan(u32 begin, u32 end, std::set<u32>& labels) {
// Continue scanning for an exit method. // Continue scanning for an exit method.
break; break;
} }
default:
break;
} }
} }
return exit_method = ExitMethod::AlwaysReturn; return exit_method = ExitMethod::AlwaysReturn;
@ -206,4 +208,4 @@ u32 ShaderIR::DecodeInstr(NodeBlock& bb, u32 pc) {
return pc + 1; return pc + 1;
} }
} // namespace VideoCommon::Shader } // namespace VideoCommon::Shader

View File

@ -120,10 +120,11 @@ u32 ShaderIR::DecodeConversion(NodeBlock& bb, u32 pc) {
return Operation(OperationCode::FCeil, PRECISE, value); return Operation(OperationCode::FCeil, PRECISE, value);
case Tegra::Shader::F2fRoundingOp::Trunc: case Tegra::Shader::F2fRoundingOp::Trunc:
return Operation(OperationCode::FTrunc, PRECISE, value); return Operation(OperationCode::FTrunc, PRECISE, value);
default:
UNIMPLEMENTED_MSG("Unimplemented F2F rounding mode {}",
static_cast<u32>(instr.conversion.f2f.rounding.Value()));
return Immediate(0);
} }
UNIMPLEMENTED_MSG("Unimplemented F2F rounding mode {}",
static_cast<u32>(instr.conversion.f2f.rounding.Value()));
return Immediate(0);
}(); }();
value = GetSaturatedFloat(value, instr.alu.saturate_d); value = GetSaturatedFloat(value, instr.alu.saturate_d);

View File

@ -56,9 +56,10 @@ u32 ShaderIR::DecodeXmad(NodeBlock& bb, u32 pc) {
instr.xmad.mode, instr.xmad.mode,
Immediate(static_cast<u32>(instr.xmad.imm20_16)), Immediate(static_cast<u32>(instr.xmad.imm20_16)),
GetRegister(instr.gpr39)}; GetRegister(instr.gpr39)};
default:
UNIMPLEMENTED_MSG("Unhandled XMAD instruction: {}", opcode->get().GetName());
return {false, false, false, Tegra::Shader::XmadMode::None, Immediate(0), Immediate(0)};
} }
UNIMPLEMENTED_MSG("Unhandled XMAD instruction: {}", opcode->get().GetName());
return {false, false, false, Tegra::Shader::XmadMode::None, Immediate(0), Immediate(0)};
}(); }();
op_a = BitfieldExtract(op_a, instr.xmad.high_a ? 16 : 0, 16); op_a = BitfieldExtract(op_a, instr.xmad.high_a ? 16 : 0, 16);

View File

@ -439,11 +439,14 @@ Node ShaderIR::BitfieldExtract(Node value, u32 offset, u32 bits) {
return OperationCode::LogicalUGreaterEqual; return OperationCode::LogicalUGreaterEqual;
case OperationCode::INegate: case OperationCode::INegate:
UNREACHABLE_MSG("Can't negate an unsigned integer"); UNREACHABLE_MSG("Can't negate an unsigned integer");
return {};
case OperationCode::IAbsolute: case OperationCode::IAbsolute:
UNREACHABLE_MSG("Can't apply absolute to an unsigned integer"); UNREACHABLE_MSG("Can't apply absolute to an unsigned integer");
return {};
default:
UNREACHABLE_MSG("Unknown signed operation with code={}", static_cast<u32>(operation_code));
return {};
} }
UNREACHABLE_MSG("Unknown signed operation with code={}", static_cast<u32>(operation_code));
return {};
} }
} // namespace VideoCommon::Shader } // namespace VideoCommon::Shader

View File

@ -178,39 +178,44 @@ PixelFormat PixelFormatFromTextureFormat(Tegra::Texture::TextureFormat format,
return PixelFormat::ABGR8S; return PixelFormat::ABGR8S;
case Tegra::Texture::ComponentType::UINT: case Tegra::Texture::ComponentType::UINT:
return PixelFormat::ABGR8UI; return PixelFormat::ABGR8UI;
default:
break;
} }
LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}", static_cast<u32>(component_type)); break;
UNREACHABLE();
case Tegra::Texture::TextureFormat::B5G6R5: case Tegra::Texture::TextureFormat::B5G6R5:
switch (component_type) { switch (component_type) {
case Tegra::Texture::ComponentType::UNORM: case Tegra::Texture::ComponentType::UNORM:
return PixelFormat::B5G6R5U; return PixelFormat::B5G6R5U;
default:
break;
} }
LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}", static_cast<u32>(component_type)); break;
UNREACHABLE();
case Tegra::Texture::TextureFormat::A2B10G10R10: case Tegra::Texture::TextureFormat::A2B10G10R10:
switch (component_type) { switch (component_type) {
case Tegra::Texture::ComponentType::UNORM: case Tegra::Texture::ComponentType::UNORM:
return PixelFormat::A2B10G10R10U; return PixelFormat::A2B10G10R10U;
default:
break;
} }
LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}", static_cast<u32>(component_type)); break;
UNREACHABLE();
case Tegra::Texture::TextureFormat::A1B5G5R5: case Tegra::Texture::TextureFormat::A1B5G5R5:
switch (component_type) { switch (component_type) {
case Tegra::Texture::ComponentType::UNORM: case Tegra::Texture::ComponentType::UNORM:
return PixelFormat::A1B5G5R5U; return PixelFormat::A1B5G5R5U;
default:
break;
} }
LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}", static_cast<u32>(component_type)); break;
UNREACHABLE();
case Tegra::Texture::TextureFormat::R8: case Tegra::Texture::TextureFormat::R8:
switch (component_type) { switch (component_type) {
case Tegra::Texture::ComponentType::UNORM: case Tegra::Texture::ComponentType::UNORM:
return PixelFormat::R8U; return PixelFormat::R8U;
case Tegra::Texture::ComponentType::UINT: case Tegra::Texture::ComponentType::UINT:
return PixelFormat::R8UI; return PixelFormat::R8UI;
default:
break;
} }
LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}", static_cast<u32>(component_type)); break;
UNREACHABLE();
case Tegra::Texture::TextureFormat::G8R8: case Tegra::Texture::TextureFormat::G8R8:
// TextureFormat::G8R8 is actually ordered red then green, as such we can use // TextureFormat::G8R8 is actually ordered red then green, as such we can use
// PixelFormat::RG8U and PixelFormat::RG8S. This was tested with The Legend of Zelda: Breath // PixelFormat::RG8U and PixelFormat::RG8S. This was tested with The Legend of Zelda: Breath
@ -220,50 +225,55 @@ PixelFormat PixelFormatFromTextureFormat(Tegra::Texture::TextureFormat format,
return PixelFormat::RG8U; return PixelFormat::RG8U;
case Tegra::Texture::ComponentType::SNORM: case Tegra::Texture::ComponentType::SNORM:
return PixelFormat::RG8S; return PixelFormat::RG8S;
default:
break;
} }
LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}", static_cast<u32>(component_type)); break;
UNREACHABLE();
case Tegra::Texture::TextureFormat::R16_G16_B16_A16: case Tegra::Texture::TextureFormat::R16_G16_B16_A16:
switch (component_type) { switch (component_type) {
case Tegra::Texture::ComponentType::UNORM: case Tegra::Texture::ComponentType::UNORM:
return PixelFormat::RGBA16U; return PixelFormat::RGBA16U;
case Tegra::Texture::ComponentType::FLOAT: case Tegra::Texture::ComponentType::FLOAT:
return PixelFormat::RGBA16F; return PixelFormat::RGBA16F;
default:
break;
} }
LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}", static_cast<u32>(component_type)); break;
UNREACHABLE();
case Tegra::Texture::TextureFormat::BF10GF11RF11: case Tegra::Texture::TextureFormat::BF10GF11RF11:
switch (component_type) { switch (component_type) {
case Tegra::Texture::ComponentType::FLOAT: case Tegra::Texture::ComponentType::FLOAT:
return PixelFormat::R11FG11FB10F; return PixelFormat::R11FG11FB10F;
default:
break;
} }
LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}", static_cast<u32>(component_type));
UNREACHABLE();
case Tegra::Texture::TextureFormat::R32_G32_B32_A32: case Tegra::Texture::TextureFormat::R32_G32_B32_A32:
switch (component_type) { switch (component_type) {
case Tegra::Texture::ComponentType::FLOAT: case Tegra::Texture::ComponentType::FLOAT:
return PixelFormat::RGBA32F; return PixelFormat::RGBA32F;
case Tegra::Texture::ComponentType::UINT: case Tegra::Texture::ComponentType::UINT:
return PixelFormat::RGBA32UI; return PixelFormat::RGBA32UI;
default:
break;
} }
LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}", static_cast<u32>(component_type)); break;
UNREACHABLE();
case Tegra::Texture::TextureFormat::R32_G32: case Tegra::Texture::TextureFormat::R32_G32:
switch (component_type) { switch (component_type) {
case Tegra::Texture::ComponentType::FLOAT: case Tegra::Texture::ComponentType::FLOAT:
return PixelFormat::RG32F; return PixelFormat::RG32F;
case Tegra::Texture::ComponentType::UINT: case Tegra::Texture::ComponentType::UINT:
return PixelFormat::RG32UI; return PixelFormat::RG32UI;
default:
break;
} }
LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}", static_cast<u32>(component_type)); break;
UNREACHABLE();
case Tegra::Texture::TextureFormat::R32_G32_B32: case Tegra::Texture::TextureFormat::R32_G32_B32:
switch (component_type) { switch (component_type) {
case Tegra::Texture::ComponentType::FLOAT: case Tegra::Texture::ComponentType::FLOAT:
return PixelFormat::RGB32F; return PixelFormat::RGB32F;
default:
break;
} }
LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}", static_cast<u32>(component_type)); break;
UNREACHABLE();
case Tegra::Texture::TextureFormat::R16: case Tegra::Texture::TextureFormat::R16:
switch (component_type) { switch (component_type) {
case Tegra::Texture::ComponentType::FLOAT: case Tegra::Texture::ComponentType::FLOAT:
@ -276,18 +286,20 @@ PixelFormat PixelFormatFromTextureFormat(Tegra::Texture::TextureFormat format,
return PixelFormat::R16UI; return PixelFormat::R16UI;
case Tegra::Texture::ComponentType::SINT: case Tegra::Texture::ComponentType::SINT:
return PixelFormat::R16I; return PixelFormat::R16I;
default:
break;
} }
LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}", static_cast<u32>(component_type)); break;
UNREACHABLE();
case Tegra::Texture::TextureFormat::R32: case Tegra::Texture::TextureFormat::R32:
switch (component_type) { switch (component_type) {
case Tegra::Texture::ComponentType::FLOAT: case Tegra::Texture::ComponentType::FLOAT:
return PixelFormat::R32F; return PixelFormat::R32F;
case Tegra::Texture::ComponentType::UINT: case Tegra::Texture::ComponentType::UINT:
return PixelFormat::R32UI; return PixelFormat::R32UI;
default:
break;
} }
LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}", static_cast<u32>(component_type)); break;
UNREACHABLE();
case Tegra::Texture::TextureFormat::ZF32: case Tegra::Texture::TextureFormat::ZF32:
return PixelFormat::Z32F; return PixelFormat::Z32F;
case Tegra::Texture::TextureFormat::Z16: case Tegra::Texture::TextureFormat::Z16:
@ -310,9 +322,10 @@ PixelFormat PixelFormatFromTextureFormat(Tegra::Texture::TextureFormat format,
return PixelFormat::DXN2UNORM; return PixelFormat::DXN2UNORM;
case Tegra::Texture::ComponentType::SNORM: case Tegra::Texture::ComponentType::SNORM:
return PixelFormat::DXN2SNORM; return PixelFormat::DXN2SNORM;
default:
break;
} }
LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}", static_cast<u32>(component_type)); break;
UNREACHABLE();
case Tegra::Texture::TextureFormat::BC7U: case Tegra::Texture::TextureFormat::BC7U:
return is_srgb ? PixelFormat::BC7U_SRGB : PixelFormat::BC7U; return is_srgb ? PixelFormat::BC7U_SRGB : PixelFormat::BC7U;
case Tegra::Texture::TextureFormat::BC6H_UF16: case Tegra::Texture::TextureFormat::BC6H_UF16:
@ -343,15 +356,17 @@ PixelFormat PixelFormatFromTextureFormat(Tegra::Texture::TextureFormat format,
return PixelFormat::RG16UI; return PixelFormat::RG16UI;
case Tegra::Texture::ComponentType::SINT: case Tegra::Texture::ComponentType::SINT:
return PixelFormat::RG16I; return PixelFormat::RG16I;
default:
break;
} }
LOG_CRITICAL(HW_GPU, "Unimplemented component_type={}", static_cast<u32>(component_type)); break;
UNREACHABLE();
default: default:
LOG_CRITICAL(HW_GPU, "Unimplemented format={}, component_type={}", static_cast<u32>(format), break;
static_cast<u32>(component_type));
UNREACHABLE();
return PixelFormat::ABGR8U;
} }
LOG_CRITICAL(HW_GPU, "Unimplemented format={}, component_type={}", static_cast<u32>(format),
static_cast<u32>(component_type));
UNREACHABLE();
return PixelFormat::ABGR8U;
} }
ComponentType ComponentTypeFromTexture(Tegra::Texture::ComponentType type) { ComponentType ComponentTypeFromTexture(Tegra::Texture::ComponentType type) {
@ -513,8 +528,9 @@ bool IsFormatBCn(PixelFormat format) {
case PixelFormat::DXT45_SRGB: case PixelFormat::DXT45_SRGB:
case PixelFormat::BC7U_SRGB: case PixelFormat::BC7U_SRGB:
return true; return true;
default:
return false;
} }
return false;
} }
} // namespace VideoCore::Surface } // namespace VideoCore::Surface