Revert "Remove indexed path."

This reverts commit 25ec4eddfa.
This commit is contained in:
riperiperi 2020-03-29 17:03:54 +01:00
parent 25ec4eddfa
commit 7cd52fecb5

View file

@ -116,12 +116,20 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl
private static string GetVec4Indexed(string vectorName, string indexExpr) private static string GetVec4Indexed(string vectorName, string indexExpr)
{ {
string result = $"{vectorName}.x"; bool canIndexVec4 = false;
for (int i = 1; i < 4; i++) if (canIndexVec4)
{ {
result = $"(({indexExpr}) == {i}) ? ({vectorName}.{GetSwizzleMask(i)}) : ({result})"; return $"{vectorName}[{indexExpr}]";
}
else
{
string result = $"{vectorName}.x";
for (int i = 1; i < 4; i++)
{
result = $"(({indexExpr}) == {i}) ? ({vectorName}.{GetSwizzleMask(i)}) : ({result})";
}
return $"({result})";
} }
return $"({result})";
} }
public static string GetConstantBufferName(IAstNode slot, string offsetExpr, ShaderStage stage) public static string GetConstantBufferName(IAstNode slot, string offsetExpr, ShaderStage stage)