1
0
Fork 0
forked from suyu/suyu

Merge pull request #1466 from lioncash/unused

gl_shader_decompiler: Remove unused variables in TMML's implementation
This commit is contained in:
bunnei 2018-10-09 19:03:06 -04:00 committed by GitHub
commit bc6939beaa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2299,8 +2299,7 @@ private:
ASSERT_MSG(!instr.tmml.UsesMiscMode(Tegra::Shader::TextureMiscMode::NDV), ASSERT_MSG(!instr.tmml.UsesMiscMode(Tegra::Shader::TextureMiscMode::NDV),
"NDV is not implemented"); "NDV is not implemented");
const std::string op_a = regs.GetRegisterAsFloat(instr.gpr8); const std::string x = regs.GetRegisterAsFloat(instr.gpr8);
const std::string op_b = regs.GetRegisterAsFloat(instr.gpr8.Value() + 1);
const bool is_array = instr.tmml.array != 0; const bool is_array = instr.tmml.array != 0;
auto texture_type = instr.tmml.texture_type.Value(); auto texture_type = instr.tmml.texture_type.Value();
const std::string sampler = const std::string sampler =
@ -2311,13 +2310,11 @@ private:
std::string coord; std::string coord;
switch (texture_type) { switch (texture_type) {
case Tegra::Shader::TextureType::Texture1D: { case Tegra::Shader::TextureType::Texture1D: {
std::string x = regs.GetRegisterAsFloat(instr.gpr8);
coord = "float coords = " + x + ';'; coord = "float coords = " + x + ';';
break; break;
} }
case Tegra::Shader::TextureType::Texture2D: { case Tegra::Shader::TextureType::Texture2D: {
std::string x = regs.GetRegisterAsFloat(instr.gpr8); const std::string y = regs.GetRegisterAsFloat(instr.gpr8.Value() + 1);
std::string y = regs.GetRegisterAsFloat(instr.gpr8.Value() + 1);
coord = "vec2 coords = vec2(" + x + ", " + y + ");"; coord = "vec2 coords = vec2(" + x + ", " + y + ");";
break; break;
} }
@ -2327,8 +2324,7 @@ private:
UNREACHABLE(); UNREACHABLE();
// Fallback to interpreting as a 2D texture for now // Fallback to interpreting as a 2D texture for now
std::string x = regs.GetRegisterAsFloat(instr.gpr8); const std::string y = regs.GetRegisterAsFloat(instr.gpr8.Value() + 1);
std::string y = regs.GetRegisterAsFloat(instr.gpr8.Value() + 1);
coord = "vec2 coords = vec2(" + x + ", " + y + ");"; coord = "vec2 coords = vec2(" + x + ", " + y + ");";
texture_type = Tegra::Shader::TextureType::Texture2D; texture_type = Tegra::Shader::TextureType::Texture2D;
} }