Further simplify shader decompiler output

This commit is contained in:
wheremyfoodat 2024-07-26 01:15:03 +03:00
parent 2fc09223aa
commit 213183895a

View file

@ -182,7 +182,6 @@ std::string ShaderDecompiler::getSwizzlePattern(u32 swizzle) const {
std::string ShaderDecompiler::getDestSwizzle(u32 destinationMask) const { std::string ShaderDecompiler::getDestSwizzle(u32 destinationMask) const {
std::string ret = "."; std::string ret = ".";
if (destinationMask & 0b1000) { if (destinationMask & 0b1000) {
ret += "x"; ret += "x";
} }
@ -214,7 +213,8 @@ void ShaderDecompiler::setDest(u32 operandDescriptor, const std::string& dest, c
return; return;
} }
decompiledShader += dest + destSwizzle + " = "; // Don't write destination swizzle if all lanes are getting written to
decompiledShader += fmt::format("{}{} = ", dest, writtenLaneCount == 4 ? "" : destSwizzle);
if (writtenLaneCount == 1) { if (writtenLaneCount == 1) {
decompiledShader += "float(" + value + ");\n"; decompiledShader += "float(" + value + ");\n";
} else if (writtenLaneCount <= 3) { // We don't need to cast for vec4, as we guarantee the rhs will be a vec4 } else if (writtenLaneCount <= 3) { // We don't need to cast for vec4, as we guarantee the rhs will be a vec4