mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2025-02-21 16:43:35 +00:00
Fix inverse viewport transform vector type on SPIR-V
This commit is contained in:
parent
281f16aa36
commit
c832f55618
3 changed files with 9 additions and 8 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 = 7;
|
private const uint CodeGenVersion = 8;
|
||||||
|
|
||||||
private const string SharedTocFileName = "shared.toc";
|
private const string SharedTocFileName = "shared.toc";
|
||||||
private const string SharedDataFileName = "shared.data";
|
private const string SharedDataFileName = "shared.data";
|
||||||
|
|
|
@ -141,12 +141,13 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
|
||||||
}
|
}
|
||||||
|
|
||||||
var isBgraArrayType = context.TypeArray(context.TypeU32(), context.Constant(context.TypeU32(), SupportBuffer.FragmentIsBgraCount));
|
var isBgraArrayType = context.TypeArray(context.TypeU32(), context.Constant(context.TypeU32(), SupportBuffer.FragmentIsBgraCount));
|
||||||
|
var viewportInverseVectorType = context.TypeVector(context.TypeFP32(), 4);
|
||||||
var renderScaleArrayType = context.TypeArray(context.TypeFP32(), context.Constant(context.TypeU32(), SupportBuffer.RenderScaleMaxCount));
|
var renderScaleArrayType = context.TypeArray(context.TypeFP32(), context.Constant(context.TypeU32(), SupportBuffer.RenderScaleMaxCount));
|
||||||
|
|
||||||
context.Decorate(isBgraArrayType, Decoration.ArrayStride, (LiteralInteger)SupportBuffer.FieldSize);
|
context.Decorate(isBgraArrayType, Decoration.ArrayStride, (LiteralInteger)SupportBuffer.FieldSize);
|
||||||
context.Decorate(renderScaleArrayType, Decoration.ArrayStride, (LiteralInteger)SupportBuffer.FieldSize);
|
context.Decorate(renderScaleArrayType, Decoration.ArrayStride, (LiteralInteger)SupportBuffer.FieldSize);
|
||||||
|
|
||||||
var supportBufferStructType = context.TypeStruct(false, context.TypeU32(), isBgraArrayType, context.GetType(AggregateType.FP32 | AggregateType.Vector), context.TypeS32(), renderScaleArrayType);
|
var supportBufferStructType = context.TypeStruct(false, context.TypeU32(), isBgraArrayType, viewportInverseVectorType, context.TypeS32(), renderScaleArrayType);
|
||||||
|
|
||||||
context.MemberDecorate(supportBufferStructType, 0, Decoration.Offset, (LiteralInteger)SupportBuffer.FragmentAlphaTestOffset);
|
context.MemberDecorate(supportBufferStructType, 0, Decoration.Offset, (LiteralInteger)SupportBuffer.FragmentAlphaTestOffset);
|
||||||
context.MemberDecorate(supportBufferStructType, 1, Decoration.Offset, (LiteralInteger)SupportBuffer.FragmentIsBgraOffset);
|
context.MemberDecorate(supportBufferStructType, 1, Decoration.Offset, (LiteralInteger)SupportBuffer.FragmentIsBgraOffset);
|
||||||
|
|
|
@ -1434,16 +1434,16 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
|
||||||
var y = context.Get(AggregateType.FP32, operation.GetSource(1));
|
var y = context.Get(AggregateType.FP32, operation.GetSource(1));
|
||||||
var mask = context.Get(AggregateType.U32, operation.GetSource(2));
|
var mask = context.Get(AggregateType.U32, operation.GetSource(2));
|
||||||
|
|
||||||
var v4float = context.TypeVector(context.TypeFP32(), (SpvLiteralInteger)4);
|
var v4float = context.TypeVector(context.TypeFP32(), 4);
|
||||||
var one = context.Constant(context.TypeFP32(), (SpvLiteralInteger)1.0f);
|
var one = context.Constant(context.TypeFP32(), 1.0f);
|
||||||
var minusOne = context.Constant(context.TypeFP32(), (SpvLiteralInteger)(-1.0f));
|
var minusOne = context.Constant(context.TypeFP32(), -1.0f);
|
||||||
var zero = context.Constant(context.TypeFP32(), (SpvLiteralInteger)0.0f);
|
var zero = context.Constant(context.TypeFP32(), 0.0f);
|
||||||
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 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(), (SpvLiteralInteger)3));
|
var shift = context.BitwiseAnd(context.TypeU32(), threadId, context.Constant(context.TypeU32(), 3));
|
||||||
shift = context.ShiftLeftLogical(context.TypeU32(), shift, context.Constant(context.TypeU32(), (SpvLiteralInteger)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);
|
||||||
|
|
||||||
var xLutValue = context.VectorExtractDynamic(context.TypeFP32(), xLut, lutIdx);
|
var xLutValue = context.VectorExtractDynamic(context.TypeFP32(), xLut, lutIdx);
|
||||||
|
|
Loading…
Reference in a new issue