gl_shader_decompiler: Cleanup logging, updating to NGLOG_*.

master
bunnei 2018-04-17 16:28:47 +07:00
parent ef2d5ab0c1
commit ed542a7309
1 changed files with 22 additions and 24 deletions

@ -167,7 +167,7 @@ private:
return "input_attribute_" + std::to_string(index); return "input_attribute_" + std::to_string(index);
} }
LOG_CRITICAL(HW_GPU, "Unhandled input attribute: 0x%02x", index); NGLOG_CRITICAL(HW_GPU, "Unhandled input attribute: {}", index);
UNREACHABLE(); UNREACHABLE();
} }
} }
@ -185,7 +185,7 @@ private:
return "output_attribute_" + std::to_string(index); return "output_attribute_" + std::to_string(index);
} }
LOG_CRITICAL(HW_GPU, "Unhandled output attribute: 0x%02x", index); NGLOG_CRITICAL(HW_GPU, "Unhandled output attribute: {}", index);
UNREACHABLE(); UNREACHABLE();
} }
} }
@ -325,17 +325,17 @@ private:
SetDest(0, dest, "min(" + op_a + "," + op_b + ")", 1, 1, instr.alu.abs_d); SetDest(0, dest, "min(" + op_a + "," + op_b + ")", 1, 1, instr.alu.abs_d);
break; break;
default: default:
LOG_ERROR(HW_GPU, "Unhandled sub op: 0x%02x", (int)instr.sub_op.Value()); NGLOG_CRITICAL(HW_GPU, "Unhandled MUFU sub op: {}",
throw DecompileFail("Unhandled sub op"); static_cast<unsigned>(instr.sub_op.Value()));
UNREACHABLE();
} }
break; break;
} }
default: { default: {
LOG_CRITICAL(HW_GPU, "Unhandled arithmetic instruction: 0x%02x (%s): 0x%08x", NGLOG_CRITICAL(HW_GPU, "Unhandled arithmetic instruction: {} ({}): {}",
static_cast<unsigned>(instr.opcode.EffectiveOpCode()), static_cast<unsigned>(instr.opcode.EffectiveOpCode()),
OpCode::GetInfo(instr.opcode).name.c_str(), instr.hex); OpCode::GetInfo(instr.opcode).name, instr.hex);
throw DecompileFail("Unhandled instruction"); UNREACHABLE();
break;
} }
} }
break; break;
@ -368,11 +368,10 @@ private:
break; break;
} }
default: { default: {
LOG_CRITICAL(HW_GPU, "Unhandled arithmetic FFMA instruction: 0x%02x (%s): 0x%08x", NGLOG_CRITICAL(HW_GPU, "Unhandled FFMA instruction: {} ({}): {}",
static_cast<unsigned>(instr.opcode.EffectiveOpCode()), static_cast<unsigned>(instr.opcode.EffectiveOpCode()),
OpCode::GetInfo(instr.opcode).name.c_str(), instr.hex); OpCode::GetInfo(instr.opcode).name, instr.hex);
throw DecompileFail("Unhandled instruction"); UNREACHABLE();
break;
} }
} }
@ -407,11 +406,10 @@ private:
break; break;
} }
default: { default: {
LOG_CRITICAL(HW_GPU, "Unhandled memory instruction: 0x%02x (%s): 0x%08x", NGLOG_CRITICAL(HW_GPU, "Unhandled memory instruction: {} ({}): {}",
static_cast<unsigned>(instr.opcode.EffectiveOpCode()), static_cast<unsigned>(instr.opcode.EffectiveOpCode()),
OpCode::GetInfo(instr.opcode).name.c_str(), instr.hex); OpCode::GetInfo(instr.opcode).name, instr.hex);
throw DecompileFail("Unhandled instruction"); UNREACHABLE();
break;
} }
} }
break; break;
@ -431,10 +429,10 @@ private:
break; break;
} }
default: { default: {
LOG_CRITICAL(HW_GPU, "Unhandled instruction: 0x%02x (%s): 0x%08x", NGLOG_CRITICAL(HW_GPU, "Unhandled instruction: {} ({}): {}",
static_cast<unsigned>(instr.opcode.EffectiveOpCode()), static_cast<unsigned>(instr.opcode.EffectiveOpCode()),
OpCode::GetInfo(instr.opcode).name.c_str(), instr.hex); OpCode::GetInfo(instr.opcode).name, instr.hex);
break; UNREACHABLE();
} }
} }
@ -600,7 +598,7 @@ boost::optional<ProgramResult> DecompileProgram(const ProgramCode& program_code,
GLSLGenerator generator(subroutines, program_code, main_offset, stage); GLSLGenerator generator(subroutines, program_code, main_offset, stage);
return ProgramResult{generator.GetShaderCode(), generator.GetEntries()}; return ProgramResult{generator.GetShaderCode(), generator.GetEntries()};
} catch (const DecompileFail& exception) { } catch (const DecompileFail& exception) {
LOG_ERROR(HW_GPU, "Shader decompilation failed: %s", exception.what()); NGLOG_ERROR(HW_GPU, "Shader decompilation failed: {}", exception.what());
} }
return boost::none; return boost::none;
} }