Merge pull request #1648 from FernandoS27/texs-3-array

Implement 3 coordinate array in TEXS instruction
This commit is contained in:
bunnei 2018-11-11 08:18:27 -08:00 committed by GitHub
commit 1916213311
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2742,12 +2742,12 @@ private:
} }
case 3: { case 3: {
if (is_array) { if (is_array) {
UNIMPLEMENTED_MSG("3-coordinate arrays not fully implemented"); const std::string index = regs.GetRegisterAsInteger(instr.gpr8);
const std::string x = regs.GetRegisterAsFloat(instr.gpr8); const std::string x = regs.GetRegisterAsFloat(instr.gpr8.Value() + 1);
const std::string y = regs.GetRegisterAsFloat(instr.gpr20); const std::string y = regs.GetRegisterAsFloat(instr.gpr8.Value() + 2);
coord = "vec2 coords = vec2(" + x + ", " + y + ");"; const std::string z = regs.GetRegisterAsFloat(instr.gpr20);
texture_type = Tegra::Shader::TextureType::Texture2D; coord =
is_array = false; "vec4 coords = vec4(" + x + ", " + y + ", " + z + ", " + index + ");";
} else { } else {
const std::string x = regs.GetRegisterAsFloat(instr.gpr8); const std::string x = regs.GetRegisterAsFloat(instr.gpr8);
const std::string y = regs.GetRegisterAsFloat(instr.gpr8.Value() + 1); const std::string y = regs.GetRegisterAsFloat(instr.gpr8.Value() + 1);
@ -2777,7 +2777,11 @@ private:
break; break;
} }
case Tegra::Shader::TextureProcessMode::LZ: { case Tegra::Shader::TextureProcessMode::LZ: {
texture = "textureLod(" + sampler + ", coords, 0.0)"; if (depth_compare && is_array) {
texture = "texture(" + sampler + ", coords)";
} else {
texture = "textureLod(" + sampler + ", coords, 0.0)";
}
break; break;
} }
case Tegra::Shader::TextureProcessMode::LL: { case Tegra::Shader::TextureProcessMode::LL: {