Add support for shader constant buffer slot indexing (#1608)

* Add support for shader constant buffer slot indexing

* Fix typo
This commit is contained in:
gdkchan 2020-10-12 21:40:50 -03:00 committed by GitHub
parent 14fd9aa640
commit b066cfc1a3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 207 additions and 66 deletions

View file

@ -112,7 +112,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
res = context.FPMultiply(res, Attribute(AttributeConsts.PositionW));
}
}
if (op.Mode == InterpolationMode.Default)
{
Operand srcB = GetSrcB(context);
@ -152,7 +152,17 @@ namespace Ryujinx.Graphics.Shader.Instructions
int count = op.Size == IntegerSize.B64 ? 2 : 1;
Operand addr = context.IAdd(GetSrcA(context), Const(op.Offset));
Operand slot = Const(op.Slot);
Operand srcA = GetSrcA(context);
if (op.IndexMode == CbIndexMode.Is ||
op.IndexMode == CbIndexMode.Isl)
{
slot = context.IAdd(slot, context.BitfieldExtractU32(srcA, Const(16), Const(16)));
srcA = context.BitwiseAnd(srcA, Const(0xffff));
}
Operand addr = context.IAdd(srcA, Const(op.Offset));
Operand wordOffset = context.ShiftRightU32(addr, Const(2));
@ -169,7 +179,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
Operand offset = context.IAdd(wordOffset, Const(index));
Operand value = context.LoadConstant(Const(op.Slot), offset);
Operand value = context.LoadConstant(slot, offset);
if (isSmallInt)
{