Initial support for shader attribute indexing (#2546)
* Initial support for shader attribute indexing * Support output indexing too, other improvements * Fix order * Address feedback
This commit is contained in:
parent
ec3e848d79
commit
ee1038e542
22 changed files with 298 additions and 86 deletions
|
@ -511,9 +511,9 @@ namespace Ryujinx.Graphics.Shader.Translation
|
|||
return context.Add(Instruction.IsNan, Local(), a);
|
||||
}
|
||||
|
||||
public static Operand LoadAttribute(this EmitterContext context, Operand a, Operand b)
|
||||
public static Operand LoadAttribute(this EmitterContext context, Operand a, Operand b, Operand c)
|
||||
{
|
||||
return context.Add(Instruction.LoadAttribute, Local(), a, b);
|
||||
return context.Add(Instruction.LoadAttribute, Local(), a, b, c);
|
||||
}
|
||||
|
||||
public static Operand LoadConstant(this EmitterContext context, Operand a, Operand b)
|
||||
|
@ -617,6 +617,11 @@ namespace Ryujinx.Graphics.Shader.Translation
|
|||
return context.Add(Instruction.ShuffleXor, (Local(), Local()), a, b, c);
|
||||
}
|
||||
|
||||
public static Operand StoreAttribute(this EmitterContext context, Operand a, Operand b, Operand c)
|
||||
{
|
||||
return context.Add(Instruction.StoreAttribute, null, a, b, c);
|
||||
}
|
||||
|
||||
public static Operand StoreGlobal(this EmitterContext context, Operand a, Operand b, Operand c)
|
||||
{
|
||||
return context.Add(Instruction.StoreGlobal, null, a, b, c);
|
||||
|
|
|
@ -17,6 +17,8 @@ namespace Ryujinx.Graphics.Shader.Translation
|
|||
|
||||
Bindless = 1 << 2,
|
||||
InstanceId = 1 << 3,
|
||||
CbIndexing = 1 << 4
|
||||
CbIndexing = 1 << 4,
|
||||
IaIndexing = 1 << 5,
|
||||
OaIndexing = 1 << 6
|
||||
}
|
||||
}
|
||||
|
|
|
@ -219,6 +219,16 @@ namespace Ryujinx.Graphics.Shader.Translation
|
|||
}
|
||||
}
|
||||
|
||||
public void SetAllInputUserAttributes()
|
||||
{
|
||||
UsedInputAttributes |= Constants.AllAttributesMask;
|
||||
}
|
||||
|
||||
public void SetAllOutputUserAttributes()
|
||||
{
|
||||
UsedOutputAttributes |= Constants.AllAttributesMask;
|
||||
}
|
||||
|
||||
public void SetClipDistanceWritten(int index)
|
||||
{
|
||||
ClipDistancesWritten |= (byte)(1 << index);
|
||||
|
|
|
@ -103,17 +103,7 @@ namespace Ryujinx.Graphics.Shader.Translation
|
|||
|
||||
if (temp != null)
|
||||
{
|
||||
// TODO: LoadAttribute should accept any integer value as first argument,
|
||||
// then we don't need special case here. Right now it expects the first
|
||||
// operand to be of type "attribute".
|
||||
if ((operation.Inst & Instruction.Mask) == Instruction.LoadAttribute)
|
||||
{
|
||||
operation.TurnIntoCopy(temp);
|
||||
}
|
||||
else
|
||||
{
|
||||
operation.SetSource(srcIndex, temp);
|
||||
}
|
||||
operation.SetSource(srcIndex, temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue