1
0
Fork 0
forked from suyu/suyu

video_core: Return safe values after an assert hits

This commit is contained in:
ReinUsesLisp 2018-12-21 18:47:22 -03:00
parent 148a6418ed
commit fc46ecddb3
8 changed files with 19 additions and 8 deletions

View file

@ -115,6 +115,7 @@ u32 ShaderIR::DecodeArithmetic(BasicBlock& bb, u32 pc) {
default: default:
UNIMPLEMENTED_MSG("Unhandled MUFU sub op={0:x}", UNIMPLEMENTED_MSG("Unhandled MUFU sub op={0:x}",
static_cast<unsigned>(instr.sub_op.Value())); static_cast<unsigned>(instr.sub_op.Value()));
return Immediate(0);
} }
}(); }();
value = GetSaturatedFloat(value, instr.alu.saturate_d); value = GetSaturatedFloat(value, instr.alu.saturate_d);

View file

@ -62,6 +62,7 @@ void ShaderIR::WriteLogicOperation(BasicBlock& bb, Register dest, LogicOperation
return op_b; return op_b;
default: default:
UNIMPLEMENTED_MSG("Unimplemented logic operation={}", static_cast<u32>(logic_op)); UNIMPLEMENTED_MSG("Unimplemented logic operation={}", static_cast<u32>(logic_op));
return Immediate(0);
} }
}(); }();

View file

@ -24,6 +24,7 @@ u32 ShaderIR::DecodeBfi(BasicBlock& bb, u32 pc) {
return {GetRegister(instr.gpr39), Immediate(instr.alu.GetSignedImm20_20())}; return {GetRegister(instr.gpr39), Immediate(instr.alu.GetSignedImm20_20())};
default: default:
UNREACHABLE(); UNREACHABLE();
return {Immediate(0), Immediate(0)};
} }
}(); }();
const Node insert = GetRegister(instr.gpr8); const Node insert = GetRegister(instr.gpr8);

View file

@ -96,11 +96,10 @@ u32 ShaderIR::DecodeConversion(BasicBlock& 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 {}", UNIMPLEMENTED_MSG("Unimplemented F2F rounding mode {}",
static_cast<u32>(instr.conversion.f2f.rounding.Value())); static_cast<u32>(instr.conversion.f2f.rounding.Value()));
break; return Immediate(0);
}
}(); }();
value = GetSaturatedFloat(value, instr.alu.saturate_d); value = GetSaturatedFloat(value, instr.alu.saturate_d);
@ -135,6 +134,7 @@ u32 ShaderIR::DecodeConversion(BasicBlock& bb, u32 pc) {
default: default:
UNIMPLEMENTED_MSG("Unimplemented F2I rounding mode {}", UNIMPLEMENTED_MSG("Unimplemented F2I rounding mode {}",
static_cast<u32>(instr.conversion.f2i.rounding.Value())); static_cast<u32>(instr.conversion.f2i.rounding.Value()));
return Immediate(0);
} }
}(); }();
const bool is_signed = instr.conversion.is_output_signed; const bool is_signed = instr.conversion.is_output_signed;

View file

@ -42,6 +42,7 @@ u32 ShaderIR::DecodeFfma(BasicBlock& bb, u32 pc) {
return {GetImmediate19(instr), GetRegister(instr.gpr39)}; return {GetImmediate19(instr), GetRegister(instr.gpr39)};
default: default:
UNIMPLEMENTED_MSG("Unhandled FFMA instruction: {}", opcode->get().GetName()); UNIMPLEMENTED_MSG("Unhandled FFMA instruction: {}", opcode->get().GetName());
return {Immediate(0), Immediate(0)};
} }
}(); }();

View file

@ -42,9 +42,9 @@ u32 ShaderIR::DecodeXmad(BasicBlock& bb, u32 pc) {
case OpCode::Id::XMAD_IMM: case OpCode::Id::XMAD_IMM:
return {instr.xmad.merge_37, Immediate(static_cast<u32>(instr.xmad.imm20_16)), return {instr.xmad.merge_37, Immediate(static_cast<u32>(instr.xmad.imm20_16)),
GetRegister(instr.gpr39)}; GetRegister(instr.gpr39)};
default:
UNIMPLEMENTED_MSG("Unhandled XMAD instruction: {}", opcode->get().GetName());
} }
UNIMPLEMENTED_MSG("Unhandled XMAD instruction: {}", opcode->get().GetName());
return {false, Immediate(0), Immediate(0)};
}(); }();
if (instr.xmad.high_a) { if (instr.xmad.high_a) {
@ -85,9 +85,9 @@ u32 ShaderIR::DecodeXmad(BasicBlock& bb, u32 pc) {
NO_PRECISE, original_b, Immediate(16)); NO_PRECISE, original_b, Immediate(16));
return SignedOperation(OperationCode::IAdd, is_signed_c, NO_PRECISE, op_c, shifted_b); return SignedOperation(OperationCode::IAdd, is_signed_c, NO_PRECISE, op_c, shifted_b);
} }
default: { default:
UNIMPLEMENTED_MSG("Unhandled XMAD mode: {}", static_cast<u32>(instr.xmad.mode.Value())); UNIMPLEMENTED_MSG("Unhandled XMAD mode: {}", static_cast<u32>(instr.xmad.mode.Value()));
} return Immediate(0);
} }
}(); }();

View file

@ -353,6 +353,7 @@ private:
return "samplerCube"; return "samplerCube";
default: default:
UNREACHABLE(); UNREACHABLE();
return "sampler2D";
} }
}(); }();
if (sampler.IsArray()) if (sampler.IsArray())
@ -506,6 +507,7 @@ private:
return "// " + comment->GetText(); return "// " + comment->GetText();
} }
UNREACHABLE(); UNREACHABLE();
return {};
} }
std::string ApplyPrecise(Operation operation, const std::string& value) { std::string ApplyPrecise(Operation operation, const std::string& value) {
@ -563,6 +565,7 @@ private:
} }
} }
UNREACHABLE(); UNREACHABLE();
return value;
} }
std::string BitwiseCastResult(std::string value, Type type, bool needs_parenthesis = false) { std::string BitwiseCastResult(std::string value, Type type, bool needs_parenthesis = false) {
@ -581,6 +584,7 @@ private:
return "fromHalf2(" + value + ')'; return "fromHalf2(" + value + ')';
} }
UNREACHABLE(); UNREACHABLE();
return value;
} }
std::string GenerateUnary(Operation operation, const std::string& func, Type result_type, std::string GenerateUnary(Operation operation, const std::string& func, Type result_type,
@ -697,6 +701,7 @@ private:
} }
UNIMPLEMENTED_MSG("Unhandled output attribute: {}", UNIMPLEMENTED_MSG("Unhandled output attribute: {}",
static_cast<u32>(attribute)); static_cast<u32>(attribute));
return "0";
} }
}(); }();

View file

@ -158,6 +158,7 @@ Node ShaderIR::ConvertIntegerSize(Node value, Tegra::Shader::Register::Size size
return value; return value;
default: default:
UNREACHABLE_MSG("Unimplemented conversion size: {}", static_cast<u32>(size)); UNREACHABLE_MSG("Unimplemented conversion size: {}", static_cast<u32>(size));
return value;
} }
} }
@ -403,6 +404,7 @@ void ShaderIR::SetLocalMemory(BasicBlock& bb, Node address, Node value) {
UNREACHABLE_MSG("Can't apply absolute to an unsigned integer"); UNREACHABLE_MSG("Can't apply absolute to an unsigned integer");
} }
UNREACHABLE_MSG("Unknown signed operation with code={}", static_cast<u32>(operation_code)); UNREACHABLE_MSG("Unknown signed operation with code={}", static_cast<u32>(operation_code));
return {};
} }
} // namespace VideoCommon::Shader } // namespace VideoCommon::Shader