forked from Mirror/Ryujinx
Fix shader FSWZADD instruction (#4069)
* Fix shader FSWZADD instruction * Shader cache version bump
This commit is contained in:
parent
9a0330f7f8
commit
8428bb6541
3 changed files with 6 additions and 3 deletions
|
@ -22,7 +22,7 @@ namespace Ryujinx.Graphics.Gpu.Shader.DiskCache
|
||||||
private const ushort FileFormatVersionMajor = 1;
|
private const ushort FileFormatVersionMajor = 1;
|
||||||
private const ushort FileFormatVersionMinor = 2;
|
private const ushort FileFormatVersionMinor = 2;
|
||||||
private const uint FileFormatVersionPacked = ((uint)FileFormatVersionMajor << 16) | FileFormatVersionMinor;
|
private const uint FileFormatVersionPacked = ((uint)FileFormatVersionMajor << 16) | FileFormatVersionMinor;
|
||||||
private const uint CodeGenVersion = 4067;
|
private const uint CodeGenVersion = 4069;
|
||||||
|
|
||||||
private const string SharedTocFileName = "shared.toc";
|
private const string SharedTocFileName = "shared.toc";
|
||||||
private const string SharedDataFileName = "shared.data";
|
private const string SharedDataFileName = "shared.data";
|
||||||
|
|
|
@ -2,6 +2,6 @@ float Helper_SwizzleAdd(float x, float y, int mask)
|
||||||
{
|
{
|
||||||
vec4 xLut = vec4(1.0, -1.0, 1.0, 0.0);
|
vec4 xLut = vec4(1.0, -1.0, 1.0, 0.0);
|
||||||
vec4 yLut = vec4(1.0, 1.0, -1.0, 1.0);
|
vec4 yLut = vec4(1.0, 1.0, -1.0, 1.0);
|
||||||
int lutIdx = mask >> int($SUBGROUP_INVOCATION$ & 3u) * 2;
|
int lutIdx = (mask >> (int($SUBGROUP_INVOCATION$ & 3u) * 2)) & 3;
|
||||||
return x * xLut[lutIdx] + y * yLut[lutIdx];
|
return x * xLut[lutIdx] + y * yLut[lutIdx];
|
||||||
}
|
}
|
|
@ -1449,10 +1449,13 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
|
||||||
var xLut = context.ConstantComposite(v4float, one, minusOne, one, zero);
|
var xLut = context.ConstantComposite(v4float, one, minusOne, one, zero);
|
||||||
var yLut = context.ConstantComposite(v4float, one, one, minusOne, one);
|
var yLut = context.ConstantComposite(v4float, one, one, minusOne, one);
|
||||||
|
|
||||||
|
var three = context.Constant(context.TypeU32(), 3);
|
||||||
|
|
||||||
var threadId = context.GetAttribute(AggregateType.U32, AttributeConsts.LaneId, false);
|
var threadId = context.GetAttribute(AggregateType.U32, AttributeConsts.LaneId, false);
|
||||||
var shift = context.BitwiseAnd(context.TypeU32(), threadId, context.Constant(context.TypeU32(), 3));
|
var shift = context.BitwiseAnd(context.TypeU32(), threadId, three);
|
||||||
shift = context.ShiftLeftLogical(context.TypeU32(), shift, context.Constant(context.TypeU32(), 1));
|
shift = context.ShiftLeftLogical(context.TypeU32(), shift, context.Constant(context.TypeU32(), 1));
|
||||||
var lutIdx = context.ShiftRightLogical(context.TypeU32(), mask, shift);
|
var lutIdx = context.ShiftRightLogical(context.TypeU32(), mask, shift);
|
||||||
|
lutIdx = context.BitwiseAnd(context.TypeU32(), lutIdx, three);
|
||||||
|
|
||||||
var xLutValue = context.VectorExtractDynamic(context.TypeFP32(), xLut, lutIdx);
|
var xLutValue = context.VectorExtractDynamic(context.TypeFP32(), xLut, lutIdx);
|
||||||
var yLutValue = context.VectorExtractDynamic(context.TypeFP32(), yLut, lutIdx);
|
var yLutValue = context.VectorExtractDynamic(context.TypeFP32(), yLut, lutIdx);
|
||||||
|
|
Loading…
Reference in a new issue