Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
40daca5684 | ||
|
981e0c082d | ||
|
cebfa54467 |
File diff suppressed because it is too large
Load Diff
@@ -6,4 +6,4 @@ namespace Ryujinx.Graphics.Texture.Astc
|
||||
{
|
||||
public AstcDecoderException(string exMsg) : base(exMsg) { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -47,7 +47,7 @@ namespace Ryujinx.Graphics.Texture.Astc
|
||||
Components[index] = (short)value;
|
||||
}
|
||||
|
||||
public int Pack()
|
||||
public readonly int Pack()
|
||||
{
|
||||
return A << 24 |
|
||||
B << 16 |
|
||||
|
@@ -6,7 +6,9 @@ namespace Ryujinx.Graphics.Texture.Astc
|
||||
{
|
||||
public struct BitStream128
|
||||
{
|
||||
#pragma warning disable IDE0044 // Make field readonly
|
||||
private Buffer16 _data;
|
||||
#pragma warning restore IDE0044
|
||||
public int BitsLeft { get; set; }
|
||||
|
||||
public BitStream128(Buffer16 data)
|
||||
@@ -42,7 +44,10 @@ namespace Ryujinx.Graphics.Texture.Astc
|
||||
{
|
||||
Debug.Assert(bitCount < 32);
|
||||
|
||||
if (bitCount == 0) return;
|
||||
if (bitCount == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ulong maskedValue = (uint)(value & ((1 << bitCount) - 1));
|
||||
|
||||
@@ -69,4 +74,4 @@ namespace Ryujinx.Graphics.Texture.Astc
|
||||
BitsLeft += bitCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -29,8 +29,15 @@
|
||||
|
||||
public static int Replicate(int value, int numberBits, int toBit)
|
||||
{
|
||||
if (numberBits == 0) return 0;
|
||||
if (toBit == 0) return 0;
|
||||
if (numberBits == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (toBit == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int tempValue = value & ((1 << numberBits) - 1);
|
||||
int retValue = tempValue;
|
||||
@@ -60,7 +67,10 @@
|
||||
b |= a & 0x80;
|
||||
a >>= 1;
|
||||
a &= 0x3F;
|
||||
if ((a & 0x20) != 0) a -= 0x40;
|
||||
if ((a & 0x20) != 0)
|
||||
{
|
||||
a -= 0x40;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -6,7 +6,7 @@ namespace Ryujinx.Graphics.Texture.Astc
|
||||
internal struct IntegerEncoded
|
||||
{
|
||||
internal const int StructSize = 8;
|
||||
private static readonly IntegerEncoded[] Encodings;
|
||||
private static readonly IntegerEncoded[] _encodings;
|
||||
|
||||
public enum EIntegerEncoding : byte
|
||||
{
|
||||
@@ -15,7 +15,7 @@ namespace Ryujinx.Graphics.Texture.Astc
|
||||
Trit
|
||||
}
|
||||
|
||||
EIntegerEncoding _encoding;
|
||||
readonly EIntegerEncoding _encoding;
|
||||
public byte NumberBits { get; private set; }
|
||||
public byte TritValue { get; private set; }
|
||||
public byte QuintValue { get; private set; }
|
||||
@@ -23,11 +23,11 @@ namespace Ryujinx.Graphics.Texture.Astc
|
||||
|
||||
static IntegerEncoded()
|
||||
{
|
||||
Encodings = new IntegerEncoded[0x100];
|
||||
_encodings = new IntegerEncoded[0x100];
|
||||
|
||||
for (int i = 0; i < Encodings.Length; i++)
|
||||
for (int i = 0; i < _encodings.Length; i++)
|
||||
{
|
||||
Encodings[i] = CreateEncodingCalc(i);
|
||||
_encodings[i] = CreateEncodingCalc(i);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,17 +40,17 @@ namespace Ryujinx.Graphics.Texture.Astc
|
||||
QuintValue = 0;
|
||||
}
|
||||
|
||||
public bool MatchesEncoding(IntegerEncoded other)
|
||||
public readonly bool MatchesEncoding(IntegerEncoded other)
|
||||
{
|
||||
return _encoding == other._encoding && NumberBits == other.NumberBits;
|
||||
}
|
||||
|
||||
public EIntegerEncoding GetEncoding()
|
||||
public readonly EIntegerEncoding GetEncoding()
|
||||
{
|
||||
return _encoding;
|
||||
}
|
||||
|
||||
public int GetBitLength(int numberVals)
|
||||
public readonly int GetBitLength(int numberVals)
|
||||
{
|
||||
int totalBits = NumberBits * numberVals;
|
||||
if (_encoding == EIntegerEncoding.Trit)
|
||||
@@ -66,7 +66,7 @@ namespace Ryujinx.Graphics.Texture.Astc
|
||||
|
||||
public static IntegerEncoded CreateEncoding(int maxVal)
|
||||
{
|
||||
return Encodings[maxVal];
|
||||
return _encodings[maxVal];
|
||||
}
|
||||
|
||||
private static IntegerEncoded CreateEncodingCalc(int maxVal)
|
||||
@@ -122,7 +122,7 @@ namespace Ryujinx.Graphics.Texture.Astc
|
||||
|
||||
ReadOnlySpan<byte> encodings = GetTritEncoding(encoded);
|
||||
|
||||
IntegerEncoded intEncoded = new IntegerEncoded(EIntegerEncoding.Trit, numberBitsPerValue);
|
||||
IntegerEncoded intEncoded = new(EIntegerEncoding.Trit, numberBitsPerValue);
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
@@ -159,7 +159,7 @@ namespace Ryujinx.Graphics.Texture.Astc
|
||||
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
IntegerEncoded intEncoded = new IntegerEncoded(EIntegerEncoding.Quint, numberBitsPerValue)
|
||||
IntegerEncoded intEncoded = new(EIntegerEncoding.Quint, numberBitsPerValue)
|
||||
{
|
||||
BitValue = m[i],
|
||||
QuintValue = encodings[i]
|
||||
@@ -185,29 +185,29 @@ namespace Ryujinx.Graphics.Texture.Astc
|
||||
switch (intEncoded.GetEncoding())
|
||||
{
|
||||
case EIntegerEncoding.Quint:
|
||||
{
|
||||
DecodeQuintBlock(ref bitStream, ref decodeIntegerSequence, intEncoded.NumberBits);
|
||||
numberValuesDecoded += 3;
|
||||
{
|
||||
DecodeQuintBlock(ref bitStream, ref decodeIntegerSequence, intEncoded.NumberBits);
|
||||
numberValuesDecoded += 3;
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case EIntegerEncoding.Trit:
|
||||
{
|
||||
DecodeTritBlock(ref bitStream, ref decodeIntegerSequence, intEncoded.NumberBits);
|
||||
numberValuesDecoded += 5;
|
||||
{
|
||||
DecodeTritBlock(ref bitStream, ref decodeIntegerSequence, intEncoded.NumberBits);
|
||||
numberValuesDecoded += 5;
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case EIntegerEncoding.JustBits:
|
||||
{
|
||||
intEncoded.BitValue = bitStream.ReadBits(intEncoded.NumberBits);
|
||||
decodeIntegerSequence.Add(ref intEncoded);
|
||||
numberValuesDecoded++;
|
||||
{
|
||||
intEncoded.BitValue = bitStream.ReadBits(intEncoded.NumberBits);
|
||||
decodeIntegerSequence.Add(ref intEncoded);
|
||||
numberValuesDecoded++;
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -27,7 +27,7 @@ namespace Ryujinx.Graphics.Texture
|
||||
int x2 = x * 4;
|
||||
int bw = Math.Min(4, width - x2);
|
||||
|
||||
DecodeBlock(blocks[y * wInBlocks + x], output64.Slice(y2 * width + x2), bw, bh, width, signed);
|
||||
DecodeBlock(blocks[y * wInBlocks + x], output64[(y2 * width + x2)..], bw, bh, width, signed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -27,7 +27,7 @@ namespace Ryujinx.Graphics.Texture
|
||||
int x2 = x * 4;
|
||||
int bw = Math.Min(4, width - x2);
|
||||
|
||||
DecodeBlock(blocks[y * wInBlocks + x], output32.Slice(y2 * width + x2), bw, bh, width);
|
||||
DecodeBlock(blocks[y * wInBlocks + x], output32[(y2 * width + x2)..], bw, bh, width);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -177,9 +177,18 @@ namespace Ryujinx.Graphics.Texture
|
||||
|
||||
switch (rotation)
|
||||
{
|
||||
case 1: color.A = color.R; color.R = a; break;
|
||||
case 2: color.A = color.G; color.G = a; break;
|
||||
case 3: color.A = color.B; color.B = a; break;
|
||||
case 1:
|
||||
color.A = color.R;
|
||||
color.R = a;
|
||||
break;
|
||||
case 2:
|
||||
color.A = color.G;
|
||||
color.G = a;
|
||||
break;
|
||||
case 3:
|
||||
color.A = color.B;
|
||||
color.B = a;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -54,10 +54,10 @@ namespace Ryujinx.Graphics.Texture
|
||||
|
||||
if (copyHeight == 4)
|
||||
{
|
||||
outputLine0 = MemoryMarshal.Cast<uint, Vector128<byte>>(outputAsUint.Slice(lineBaseOOffs));
|
||||
outputLine1 = MemoryMarshal.Cast<uint, Vector128<byte>>(outputAsUint.Slice(lineBaseOOffs + width));
|
||||
outputLine2 = MemoryMarshal.Cast<uint, Vector128<byte>>(outputAsUint.Slice(lineBaseOOffs + width * 2));
|
||||
outputLine3 = MemoryMarshal.Cast<uint, Vector128<byte>>(outputAsUint.Slice(lineBaseOOffs + width * 3));
|
||||
outputLine0 = MemoryMarshal.Cast<uint, Vector128<byte>>(outputAsUint[lineBaseOOffs..]);
|
||||
outputLine1 = MemoryMarshal.Cast<uint, Vector128<byte>>(outputAsUint[(lineBaseOOffs + width)..]);
|
||||
outputLine2 = MemoryMarshal.Cast<uint, Vector128<byte>>(outputAsUint[(lineBaseOOffs + width * 2)..]);
|
||||
outputLine3 = MemoryMarshal.Cast<uint, Vector128<byte>>(outputAsUint[(lineBaseOOffs + width * 3)..]);
|
||||
}
|
||||
|
||||
for (int x = 0; x < w; x++)
|
||||
@@ -84,7 +84,7 @@ namespace Ryujinx.Graphics.Texture
|
||||
}
|
||||
}
|
||||
|
||||
data = data.Slice(8);
|
||||
data = data[8..];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -142,10 +142,10 @@ namespace Ryujinx.Graphics.Texture
|
||||
|
||||
if (copyHeight == 4)
|
||||
{
|
||||
outputLine0 = MemoryMarshal.Cast<uint, Vector128<byte>>(outputAsUint.Slice(lineBaseOOffs));
|
||||
outputLine1 = MemoryMarshal.Cast<uint, Vector128<byte>>(outputAsUint.Slice(lineBaseOOffs + width));
|
||||
outputLine2 = MemoryMarshal.Cast<uint, Vector128<byte>>(outputAsUint.Slice(lineBaseOOffs + width * 2));
|
||||
outputLine3 = MemoryMarshal.Cast<uint, Vector128<byte>>(outputAsUint.Slice(lineBaseOOffs + width * 3));
|
||||
outputLine0 = MemoryMarshal.Cast<uint, Vector128<byte>>(outputAsUint[lineBaseOOffs..]);
|
||||
outputLine1 = MemoryMarshal.Cast<uint, Vector128<byte>>(outputAsUint[(lineBaseOOffs + width)..]);
|
||||
outputLine2 = MemoryMarshal.Cast<uint, Vector128<byte>>(outputAsUint[(lineBaseOOffs + width * 2)..]);
|
||||
outputLine3 = MemoryMarshal.Cast<uint, Vector128<byte>>(outputAsUint[(lineBaseOOffs + width * 3)..]);
|
||||
}
|
||||
|
||||
for (int x = 0; x < w; x++)
|
||||
@@ -153,7 +153,7 @@ namespace Ryujinx.Graphics.Texture
|
||||
int baseX = x * BlockWidth;
|
||||
int copyWidth = Math.Min(BlockWidth, width - baseX);
|
||||
|
||||
BC23DecodeTileRgb(tile, data.Slice(8));
|
||||
BC23DecodeTileRgb(tile, data[8..]);
|
||||
|
||||
ulong block = BinaryPrimitives.ReadUInt64LittleEndian(data);
|
||||
|
||||
@@ -179,7 +179,7 @@ namespace Ryujinx.Graphics.Texture
|
||||
}
|
||||
}
|
||||
|
||||
data = data.Slice(16);
|
||||
data = data[16..];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -238,10 +238,10 @@ namespace Ryujinx.Graphics.Texture
|
||||
|
||||
if (copyHeight == 4)
|
||||
{
|
||||
outputLine0 = MemoryMarshal.Cast<uint, Vector128<byte>>(outputAsUint.Slice(lineBaseOOffs));
|
||||
outputLine1 = MemoryMarshal.Cast<uint, Vector128<byte>>(outputAsUint.Slice(lineBaseOOffs + width));
|
||||
outputLine2 = MemoryMarshal.Cast<uint, Vector128<byte>>(outputAsUint.Slice(lineBaseOOffs + width * 2));
|
||||
outputLine3 = MemoryMarshal.Cast<uint, Vector128<byte>>(outputAsUint.Slice(lineBaseOOffs + width * 3));
|
||||
outputLine0 = MemoryMarshal.Cast<uint, Vector128<byte>>(outputAsUint[lineBaseOOffs..]);
|
||||
outputLine1 = MemoryMarshal.Cast<uint, Vector128<byte>>(outputAsUint[(lineBaseOOffs + width)..]);
|
||||
outputLine2 = MemoryMarshal.Cast<uint, Vector128<byte>>(outputAsUint[(lineBaseOOffs + width * 2)..]);
|
||||
outputLine3 = MemoryMarshal.Cast<uint, Vector128<byte>>(outputAsUint[(lineBaseOOffs + width * 3)..]);
|
||||
}
|
||||
|
||||
for (int x = 0; x < w; x++)
|
||||
@@ -249,7 +249,7 @@ namespace Ryujinx.Graphics.Texture
|
||||
int baseX = x * BlockWidth;
|
||||
int copyWidth = Math.Min(BlockWidth, width - baseX);
|
||||
|
||||
BC23DecodeTileRgb(tile, data.Slice(8));
|
||||
BC23DecodeTileRgb(tile, data[8..]);
|
||||
|
||||
ulong block = BinaryPrimitives.ReadUInt64LittleEndian(data);
|
||||
|
||||
@@ -276,7 +276,7 @@ namespace Ryujinx.Graphics.Texture
|
||||
}
|
||||
}
|
||||
|
||||
data = data.Slice(16);
|
||||
data = data[16..];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -305,7 +305,7 @@ namespace Ryujinx.Graphics.Texture
|
||||
int alignedWidth = BitUtils.AlignUp(width, 4);
|
||||
|
||||
byte[] output = new byte[size];
|
||||
Span<byte> outputSpan = new Span<byte>(output);
|
||||
Span<byte> outputSpan = new(output);
|
||||
|
||||
ReadOnlySpan<ulong> data64 = MemoryMarshal.Cast<byte, ulong>(data);
|
||||
|
||||
@@ -338,10 +338,10 @@ namespace Ryujinx.Graphics.Texture
|
||||
|
||||
if (copyHeight == 4)
|
||||
{
|
||||
outputLine0 = MemoryMarshal.Cast<byte, uint>(outputSpan.Slice(lineBaseOOffs));
|
||||
outputLine1 = MemoryMarshal.Cast<byte, uint>(outputSpan.Slice(lineBaseOOffs + alignedWidth));
|
||||
outputLine2 = MemoryMarshal.Cast<byte, uint>(outputSpan.Slice(lineBaseOOffs + alignedWidth * 2));
|
||||
outputLine3 = MemoryMarshal.Cast<byte, uint>(outputSpan.Slice(lineBaseOOffs + alignedWidth * 3));
|
||||
outputLine0 = MemoryMarshal.Cast<byte, uint>(outputSpan[lineBaseOOffs..]);
|
||||
outputLine1 = MemoryMarshal.Cast<byte, uint>(outputSpan[(lineBaseOOffs + alignedWidth)..]);
|
||||
outputLine2 = MemoryMarshal.Cast<byte, uint>(outputSpan[(lineBaseOOffs + alignedWidth * 2)..]);
|
||||
outputLine3 = MemoryMarshal.Cast<byte, uint>(outputSpan[(lineBaseOOffs + alignedWidth * 3)..]);
|
||||
}
|
||||
|
||||
for (int x = 0; x < w; x++)
|
||||
@@ -382,7 +382,7 @@ namespace Ryujinx.Graphics.Texture
|
||||
}
|
||||
}
|
||||
|
||||
data64 = data64.Slice(1);
|
||||
data64 = data64[1..];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -450,10 +450,10 @@ namespace Ryujinx.Graphics.Texture
|
||||
|
||||
if (copyHeight == 4)
|
||||
{
|
||||
outputLine0 = MemoryMarshal.Cast<ushort, ulong>(outputAsUshort.Slice(lineBaseOOffs));
|
||||
outputLine1 = MemoryMarshal.Cast<ushort, ulong>(outputAsUshort.Slice(lineBaseOOffs + alignedWidth));
|
||||
outputLine2 = MemoryMarshal.Cast<ushort, ulong>(outputAsUshort.Slice(lineBaseOOffs + alignedWidth * 2));
|
||||
outputLine3 = MemoryMarshal.Cast<ushort, ulong>(outputAsUshort.Slice(lineBaseOOffs + alignedWidth * 3));
|
||||
outputLine0 = MemoryMarshal.Cast<ushort, ulong>(outputAsUshort[lineBaseOOffs..]);
|
||||
outputLine1 = MemoryMarshal.Cast<ushort, ulong>(outputAsUshort[(lineBaseOOffs + alignedWidth)..]);
|
||||
outputLine2 = MemoryMarshal.Cast<ushort, ulong>(outputAsUshort[(lineBaseOOffs + alignedWidth * 2)..]);
|
||||
outputLine3 = MemoryMarshal.Cast<ushort, ulong>(outputAsUshort[(lineBaseOOffs + alignedWidth * 3)..]);
|
||||
}
|
||||
|
||||
for (int x = 0; x < w; x++)
|
||||
@@ -507,7 +507,7 @@ namespace Ryujinx.Graphics.Texture
|
||||
}
|
||||
}
|
||||
|
||||
data64 = data64.Slice(2);
|
||||
data64 = data64[2..];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -548,7 +548,7 @@ namespace Ryujinx.Graphics.Texture
|
||||
{
|
||||
for (int z = 0; z < depth; z++)
|
||||
{
|
||||
BC6Decoder.Decode(output.AsSpan().Slice(outputOffset), data.Slice(inputOffset), width, height, signed);
|
||||
BC6Decoder.Decode(output.AsSpan()[outputOffset..], data[inputOffset..], width, height, signed);
|
||||
|
||||
inputOffset += w * h * 16;
|
||||
outputOffset += width * height * 8;
|
||||
@@ -586,7 +586,7 @@ namespace Ryujinx.Graphics.Texture
|
||||
{
|
||||
for (int z = 0; z < depth; z++)
|
||||
{
|
||||
BC7Decoder.Decode(output.AsSpan().Slice(outputOffset), data.Slice(inputOffset), width, height);
|
||||
BC7Decoder.Decode(output.AsSpan()[outputOffset..], data[inputOffset..], width, height);
|
||||
|
||||
inputOffset += w * h * 16;
|
||||
outputOffset += width * height * 4;
|
||||
@@ -813,7 +813,7 @@ namespace Ryujinx.Graphics.Texture
|
||||
{
|
||||
Span<uint> outputAsUint = MemoryMarshal.Cast<byte, uint>(output);
|
||||
|
||||
uint indices = BinaryPrimitives.ReadUInt32LittleEndian(input.Slice(4));
|
||||
uint indices = BinaryPrimitives.ReadUInt32LittleEndian(input[4..]);
|
||||
|
||||
for (int i = 0; i < BlockWidth * BlockHeight; i++, indices >>= 2)
|
||||
{
|
||||
@@ -891,4 +891,4 @@ namespace Ryujinx.Graphics.Texture
|
||||
return r | (g & 0xff00) | (b & 0xff0000);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -28,8 +28,6 @@ namespace Ryujinx.Graphics.Texture
|
||||
|
||||
for (int l = 0; l < levels; l++)
|
||||
{
|
||||
int rgba8Size = width * height * depth * layers * 4;
|
||||
|
||||
int w = BitUtils.DivRoundUp(width, BlockWidth);
|
||||
int h = BitUtils.DivRoundUp(height, BlockHeight);
|
||||
|
||||
@@ -38,8 +36,8 @@ namespace Ryujinx.Graphics.Texture
|
||||
for (int z = 0; z < depth; z++)
|
||||
{
|
||||
BC7Encoder.Encode(
|
||||
output.AsMemory().Slice(imageBaseOOffs),
|
||||
data.AsMemory().Slice(imageBaseIOffs),
|
||||
output.AsMemory()[imageBaseOOffs..],
|
||||
data.AsMemory()[imageBaseIOffs..],
|
||||
width,
|
||||
height,
|
||||
EncodeMode.Fast | EncodeMode.Multithreaded);
|
||||
@@ -57,4 +55,4 @@ namespace Ryujinx.Graphics.Texture
|
||||
return output;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -7,4 +7,4 @@ namespace Ryujinx.Graphics.Texture
|
||||
|
||||
public const int GobSize = GobStride * GobHeight;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -15,24 +15,24 @@ namespace Ryujinx.Graphics.Texture
|
||||
|
||||
public RobAndSliceSizes(int robSize, int sliceSize)
|
||||
{
|
||||
RobSize = robSize;
|
||||
RobSize = robSize;
|
||||
SliceSize = sliceSize;
|
||||
}
|
||||
}
|
||||
|
||||
private int _texBpp;
|
||||
private readonly int _texBpp;
|
||||
|
||||
private int _bhMask;
|
||||
private int _bdMask;
|
||||
private readonly int _bhMask;
|
||||
private readonly int _bdMask;
|
||||
|
||||
private int _bhShift;
|
||||
private int _bdShift;
|
||||
private int _bppShift;
|
||||
private readonly int _bhShift;
|
||||
private readonly int _bdShift;
|
||||
private readonly int _bppShift;
|
||||
|
||||
private int _xShift;
|
||||
private readonly int _xShift;
|
||||
|
||||
private int _robSize;
|
||||
private int _sliceSize;
|
||||
private readonly int _robSize;
|
||||
private readonly int _sliceSize;
|
||||
|
||||
// Variables for built in iteration.
|
||||
private int _yPart;
|
||||
@@ -60,7 +60,7 @@ namespace Ryujinx.Graphics.Texture
|
||||
|
||||
RobAndSliceSizes rsSizes = GetRobAndSliceSizes(width, height, gobBlocksInY, gobBlocksInZ);
|
||||
|
||||
_robSize = rsSizes.RobSize;
|
||||
_robSize = rsSizes.RobSize;
|
||||
_sliceSize = rsSizes.SliceSize;
|
||||
}
|
||||
|
||||
@@ -192,4 +192,4 @@ namespace Ryujinx.Graphics.Texture
|
||||
return offset + _yzPart;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -3,9 +3,9 @@
|
||||
namespace Ryujinx.Graphics.Texture
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1, Size = 12)]
|
||||
public struct Bpp12Pixel
|
||||
public readonly struct Bpp12Pixel
|
||||
{
|
||||
private ulong _elem1;
|
||||
private uint _elem2;
|
||||
private readonly ulong _elem1;
|
||||
private readonly uint _elem2;
|
||||
}
|
||||
}
|
||||
|
@@ -119,12 +119,12 @@ namespace Ryujinx.Graphics.Texture.Encoders
|
||||
{
|
||||
uint c = tile[i];
|
||||
|
||||
if (!uniqueRGB.Slice(0, uniqueRGBCount).Contains(c & rgbMask))
|
||||
if (!uniqueRGB[..uniqueRGBCount].Contains(c & rgbMask))
|
||||
{
|
||||
uniqueRGB[uniqueRGBCount++] = c & rgbMask;
|
||||
}
|
||||
|
||||
if (!uniqueAlpha.Slice(0, uniqueAlphaCount).Contains(c & alphaMask))
|
||||
if (!uniqueAlpha[..uniqueAlphaCount].Contains(c & alphaMask))
|
||||
{
|
||||
uniqueAlpha[uniqueAlphaCount++] = c & alphaMask;
|
||||
}
|
||||
@@ -356,7 +356,7 @@ namespace Ryujinx.Graphics.Texture.Encoders
|
||||
|
||||
bool alphaSwapSubset = alphaIndices[0] >= (alphaIndexCount >> 1);
|
||||
|
||||
Block block = new Block();
|
||||
Block block = new();
|
||||
|
||||
int offset = 0;
|
||||
|
||||
@@ -591,7 +591,7 @@ namespace Ryujinx.Graphics.Texture.Encoders
|
||||
RgbaColor32 e132 = RgbaColor8.FromUInt32(c1).GetColor32();
|
||||
|
||||
palette[0] = e032;
|
||||
palette[palette.Length - 1] = e132;
|
||||
palette[^1] = e132;
|
||||
|
||||
for (int i = 1; i < palette.Length - 1; i++)
|
||||
{
|
||||
@@ -888,7 +888,7 @@ namespace Ryujinx.Graphics.Texture.Encoders
|
||||
|
||||
int distRange = Math.Max(1, maxDist - minDist);
|
||||
|
||||
RgbaColor32 nV = new RgbaColor32(n);
|
||||
RgbaColor32 nV = new(n);
|
||||
|
||||
int bestErrorSum = int.MaxValue;
|
||||
RgbaColor8 bestE0 = default;
|
||||
@@ -922,8 +922,8 @@ namespace Ryujinx.Graphics.Texture.Encoders
|
||||
|
||||
for (int start = 0; start < numInterpolatedColors - maxIndex; start++)
|
||||
{
|
||||
RgbaColor32 sumY = new RgbaColor32(0);
|
||||
RgbaColor32 sumXY = new RgbaColor32(0);
|
||||
RgbaColor32 sumY = new(0);
|
||||
RgbaColor32 sumXY = new(0);
|
||||
|
||||
for (int i = 0; i < indices.Length; i++)
|
||||
{
|
||||
@@ -933,8 +933,8 @@ namespace Ryujinx.Graphics.Texture.Encoders
|
||||
sumXY += new RgbaColor32(start + indices[i]) * y;
|
||||
}
|
||||
|
||||
RgbaColor32 sumXV = new RgbaColor32(sumX);
|
||||
RgbaColor32 sumXXV = new RgbaColor32(sumXX);
|
||||
RgbaColor32 sumXV = new(sumX);
|
||||
RgbaColor32 sumXXV = new(sumXX);
|
||||
RgbaColor32 m = RgbaColor32.DivideGuarded((nV * sumXY - sumXV * sumY) << 6, nV * sumXXV - sumXV * sumXV, 0);
|
||||
RgbaColor32 b = ((sumY << 6) - m * sumXV) / nV;
|
||||
|
||||
|
@@ -31,7 +31,7 @@ namespace Ryujinx.Graphics.Texture
|
||||
|
||||
int wAligned = BitUtils.AlignUp(width, alignment);
|
||||
|
||||
BlockLinearLayout layoutConverter = new BlockLinearLayout(wAligned, height, gobBlocksInY, 1, bytesPerPixel);
|
||||
BlockLinearLayout layoutConverter = new(wAligned, height, gobBlocksInY, 1, bytesPerPixel);
|
||||
|
||||
unsafe bool Convert<T>(Span<byte> output, ReadOnlySpan<byte> data) where T : unmanaged
|
||||
{
|
||||
@@ -126,14 +126,14 @@ namespace Ryujinx.Graphics.Texture
|
||||
int mipGobBlocksInY = gobBlocksInY;
|
||||
int mipGobBlocksInZ = gobBlocksInZ;
|
||||
|
||||
int gobWidth = (GobStride / bytesPerPixel) * gobBlocksInTileX;
|
||||
int gobWidth = (GobStride / bytesPerPixel) * gobBlocksInTileX;
|
||||
int gobHeight = gobBlocksInY * GobHeight;
|
||||
|
||||
for (int level = 0; level < levels; level++)
|
||||
{
|
||||
int w = Math.Max(1, width >> level);
|
||||
int w = Math.Max(1, width >> level);
|
||||
int h = Math.Max(1, height >> level);
|
||||
int d = Math.Max(1, depth >> level);
|
||||
int d = Math.Max(1, depth >> level);
|
||||
|
||||
w = BitUtils.DivRoundUp(w, blockWidth);
|
||||
h = BitUtils.DivRoundUp(h, blockHeight);
|
||||
@@ -166,7 +166,7 @@ namespace Ryujinx.Graphics.Texture
|
||||
|
||||
int wAligned = BitUtils.AlignUp(w, alignment);
|
||||
|
||||
BlockLinearLayout layoutConverter = new BlockLinearLayout(
|
||||
BlockLinearLayout layoutConverter = new(
|
||||
wAligned,
|
||||
h,
|
||||
mipGobBlocksInY,
|
||||
@@ -256,7 +256,7 @@ namespace Ryujinx.Graphics.Texture
|
||||
int bytesPerPixel,
|
||||
ReadOnlySpan<byte> data)
|
||||
{
|
||||
int w = BitUtils.DivRoundUp(width, blockWidth);
|
||||
int w = BitUtils.DivRoundUp(width, blockWidth);
|
||||
int h = BitUtils.DivRoundUp(height, blockHeight);
|
||||
|
||||
int outStride = BitUtils.AlignUp(w * bytesPerPixel, HostStrideAlignment);
|
||||
@@ -301,7 +301,7 @@ namespace Ryujinx.Graphics.Texture
|
||||
|
||||
int wAligned = BitUtils.AlignUp(width, alignment);
|
||||
|
||||
BlockLinearLayout layoutConverter = new BlockLinearLayout(wAligned, height, gobBlocksInY, 1, bytesPerPixel);
|
||||
BlockLinearLayout layoutConverter = new(wAligned, height, gobBlocksInY, 1, bytesPerPixel);
|
||||
|
||||
unsafe bool Convert<T>(Span<byte> output, ReadOnlySpan<byte> data) where T : unmanaged
|
||||
{
|
||||
@@ -390,14 +390,14 @@ namespace Ryujinx.Graphics.Texture
|
||||
int mipGobBlocksInY = gobBlocksInY;
|
||||
int mipGobBlocksInZ = gobBlocksInZ;
|
||||
|
||||
int gobWidth = (GobStride / bytesPerPixel) * gobBlocksInTileX;
|
||||
int gobWidth = (GobStride / bytesPerPixel) * gobBlocksInTileX;
|
||||
int gobHeight = gobBlocksInY * GobHeight;
|
||||
|
||||
for (int level = 0; level < levels; level++)
|
||||
{
|
||||
int w = Math.Max(1, width >> level);
|
||||
int w = Math.Max(1, width >> level);
|
||||
int h = Math.Max(1, height >> level);
|
||||
int d = Math.Max(1, depth >> level);
|
||||
int d = Math.Max(1, depth >> level);
|
||||
|
||||
w = BitUtils.DivRoundUp(w, blockWidth);
|
||||
h = BitUtils.DivRoundUp(h, blockHeight);
|
||||
@@ -430,7 +430,7 @@ namespace Ryujinx.Graphics.Texture
|
||||
|
||||
int wAligned = BitUtils.AlignUp(w, alignment);
|
||||
|
||||
BlockLinearLayout layoutConverter = new BlockLinearLayout(
|
||||
BlockLinearLayout layoutConverter = new(
|
||||
wAligned,
|
||||
h,
|
||||
mipGobBlocksInY,
|
||||
@@ -521,7 +521,7 @@ namespace Ryujinx.Graphics.Texture
|
||||
int bytesPerPixel,
|
||||
ReadOnlySpan<byte> data)
|
||||
{
|
||||
int w = BitUtils.DivRoundUp(width, blockWidth);
|
||||
int w = BitUtils.DivRoundUp(width, blockWidth);
|
||||
int h = BitUtils.DivRoundUp(height, blockHeight);
|
||||
|
||||
int inStride = BitUtils.AlignUp(w * bytesPerPixel, HostStrideAlignment);
|
||||
@@ -573,9 +573,9 @@ namespace Ryujinx.Graphics.Texture
|
||||
|
||||
for (int level = 0; level < levels; level++)
|
||||
{
|
||||
int w = Math.Max(1, width >> level);
|
||||
int w = Math.Max(1, width >> level);
|
||||
int h = Math.Max(1, height >> level);
|
||||
int d = Math.Max(1, depth >> level);
|
||||
int d = Math.Max(1, depth >> level);
|
||||
|
||||
w = BitUtils.DivRoundUp(w, blockWidth);
|
||||
h = BitUtils.DivRoundUp(h, blockHeight);
|
||||
@@ -588,4 +588,4 @@ namespace Ryujinx.Graphics.Texture
|
||||
return layerSize * layers;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -7,30 +7,30 @@ namespace Ryujinx.Graphics.Texture
|
||||
{
|
||||
public class OffsetCalculator
|
||||
{
|
||||
private int _width;
|
||||
private int _height;
|
||||
private int _stride;
|
||||
private bool _isLinear;
|
||||
private int _bytesPerPixel;
|
||||
private readonly int _width;
|
||||
private readonly int _height;
|
||||
private readonly int _stride;
|
||||
private readonly bool _isLinear;
|
||||
private readonly int _bytesPerPixel;
|
||||
|
||||
private BlockLinearLayout _layoutConverter;
|
||||
private readonly BlockLinearLayout _layoutConverter;
|
||||
|
||||
// Variables for built in iteration.
|
||||
private int _yPart;
|
||||
|
||||
public OffsetCalculator(
|
||||
int width,
|
||||
int height,
|
||||
int stride,
|
||||
int width,
|
||||
int height,
|
||||
int stride,
|
||||
bool isLinear,
|
||||
int gobBlocksInY,
|
||||
int gobBlocksInZ,
|
||||
int bytesPerPixel)
|
||||
int gobBlocksInY,
|
||||
int gobBlocksInZ,
|
||||
int bytesPerPixel)
|
||||
{
|
||||
_width = width;
|
||||
_height = height;
|
||||
_stride = stride;
|
||||
_isLinear = isLinear;
|
||||
_width = width;
|
||||
_height = height;
|
||||
_stride = stride;
|
||||
_isLinear = isLinear;
|
||||
_bytesPerPixel = bytesPerPixel;
|
||||
|
||||
int wAlignment = GobStride / bytesPerPixel;
|
||||
@@ -138,4 +138,4 @@ namespace Ryujinx.Graphics.Texture
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -87,9 +87,9 @@ namespace Ryujinx.Graphics.Texture
|
||||
{
|
||||
uint packed = inputSpan[offset++];
|
||||
|
||||
uint outputPacked = 0xff000000;
|
||||
outputPacked |= (packed << 3) & 0x000000f8;
|
||||
outputPacked |= (packed << 8) & 0x00f80000;
|
||||
uint outputPacked = 0xff000000;
|
||||
outputPacked |= (packed << 3) & 0x000000f8;
|
||||
outputPacked |= (packed << 8) & 0x00f80000;
|
||||
|
||||
// Replicate 5 bit components.
|
||||
outputPacked |= (outputPacked >> 5) & 0x00070007;
|
||||
@@ -126,10 +126,10 @@ namespace Ryujinx.Graphics.Texture
|
||||
|
||||
uint a = forceAlpha ? 1 : (packed >> 15);
|
||||
|
||||
uint outputPacked = a * 0xff000000;
|
||||
outputPacked |= (packed << 3) & 0x000000f8;
|
||||
outputPacked |= (packed << 6) & 0x0000f800;
|
||||
outputPacked |= (packed << 9) & 0x00f80000;
|
||||
uint outputPacked = a * 0xff000000;
|
||||
outputPacked |= (packed << 3) & 0x000000f8;
|
||||
outputPacked |= (packed << 6) & 0x0000f800;
|
||||
outputPacked |= (packed << 9) & 0x00f80000;
|
||||
|
||||
// Replicate 5 bit components.
|
||||
outputPacked |= (outputPacked >> 5) & 0x00070707;
|
||||
@@ -198,10 +198,10 @@ namespace Ryujinx.Graphics.Texture
|
||||
{
|
||||
uint packed = inputSpan[offset++];
|
||||
|
||||
uint outputPacked = packed & 0x0000000f;
|
||||
outputPacked |= (packed << 4) & 0x00000f00;
|
||||
outputPacked |= (packed << 8) & 0x000f0000;
|
||||
outputPacked |= (packed << 12) & 0x0f000000;
|
||||
uint outputPacked = packed & 0x0000000f;
|
||||
outputPacked |= (packed << 4) & 0x00000f00;
|
||||
outputPacked |= (packed << 8) & 0x000f0000;
|
||||
outputPacked |= (packed << 12) & 0x0f000000;
|
||||
|
||||
outputSpan[outOffset++] = outputPacked * 0x11;
|
||||
}
|
||||
|
@@ -2,15 +2,15 @@ namespace Ryujinx.Graphics.Texture
|
||||
{
|
||||
public readonly struct Size
|
||||
{
|
||||
public int Width { get; }
|
||||
public int Width { get; }
|
||||
public int Height { get; }
|
||||
public int Depth { get; }
|
||||
public int Depth { get; }
|
||||
|
||||
public Size(int width, int height, int depth)
|
||||
{
|
||||
Width = width;
|
||||
Width = width;
|
||||
Height = height;
|
||||
Depth = depth;
|
||||
Depth = depth;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,6 +1,5 @@
|
||||
using Ryujinx.Common;
|
||||
using System;
|
||||
|
||||
using static Ryujinx.Graphics.Texture.BlockLinearConstants;
|
||||
|
||||
namespace Ryujinx.Graphics.Texture
|
||||
@@ -48,16 +47,16 @@ namespace Ryujinx.Graphics.Texture
|
||||
int mipGobBlocksInY = gobBlocksInY;
|
||||
int mipGobBlocksInZ = gobBlocksInZ;
|
||||
|
||||
int gobWidth = (GobStride / bytesPerPixel) * gobBlocksInTileX;
|
||||
int gobWidth = (GobStride / bytesPerPixel) * gobBlocksInTileX;
|
||||
int gobHeight = gobBlocksInY * GobHeight;
|
||||
|
||||
int depthLevelOffset = 0;
|
||||
|
||||
for (int level = 0; level < levels; level++)
|
||||
{
|
||||
int w = Math.Max(1, width >> level);
|
||||
int w = Math.Max(1, width >> level);
|
||||
int h = Math.Max(1, height >> level);
|
||||
int d = Math.Max(1, depth >> level);
|
||||
int d = Math.Max(1, depth >> level);
|
||||
|
||||
w = BitUtils.DivRoundUp(w, blockWidth);
|
||||
h = BitUtils.DivRoundUp(h, blockHeight);
|
||||
@@ -104,7 +103,7 @@ namespace Ryujinx.Graphics.Texture
|
||||
|
||||
for (int z = 0; z < d; z++)
|
||||
{
|
||||
int zLow = z & mask;
|
||||
int zLow = z & mask;
|
||||
int zHigh = z & ~mask;
|
||||
|
||||
allOffsets[z + depthLevelOffset] = baseOffset + zLow * gobSize + zHigh * sliceSize;
|
||||
@@ -159,7 +158,7 @@ namespace Ryujinx.Graphics.Texture
|
||||
{
|
||||
for (int layer = 0; layer < layers; layer++)
|
||||
{
|
||||
int baseIndex = layer * levels;
|
||||
int baseIndex = layer * levels;
|
||||
int baseOffset = layer * layerSize;
|
||||
|
||||
for (int level = 0; level < levels; level++)
|
||||
@@ -234,10 +233,10 @@ namespace Ryujinx.Graphics.Texture
|
||||
int gobBlocksInZ,
|
||||
int gobBlocksInTileX)
|
||||
{
|
||||
width = BitUtils.DivRoundUp(width, blockWidth);
|
||||
width = BitUtils.DivRoundUp(width, blockWidth);
|
||||
height = BitUtils.DivRoundUp(height, blockHeight);
|
||||
|
||||
int gobWidth = (GobStride / bytesPerPixel) * gobBlocksInTileX;
|
||||
int gobWidth = (GobStride / bytesPerPixel) * gobBlocksInTileX;
|
||||
int gobHeight = gobBlocksInY * GobHeight;
|
||||
|
||||
int alignment = gobWidth;
|
||||
@@ -251,11 +250,11 @@ namespace Ryujinx.Graphics.Texture
|
||||
(gobBlocksInY, gobBlocksInZ) = GetMipGobBlockSizes(height, depth, 1, gobBlocksInY, gobBlocksInZ);
|
||||
|
||||
int blockOfGobsHeight = gobBlocksInY * GobHeight;
|
||||
int blockOfGobsDepth = gobBlocksInZ;
|
||||
int blockOfGobsDepth = gobBlocksInZ;
|
||||
|
||||
width = BitUtils.AlignUp(width, alignment);
|
||||
width = BitUtils.AlignUp(width, alignment);
|
||||
height = BitUtils.AlignUp(height, blockOfGobsHeight);
|
||||
depth = BitUtils.AlignUp(depth, blockOfGobsDepth);
|
||||
depth = BitUtils.AlignUp(depth, blockOfGobsDepth);
|
||||
|
||||
return new Size(width, height, depth);
|
||||
}
|
||||
@@ -267,7 +266,7 @@ namespace Ryujinx.Graphics.Texture
|
||||
int blockHeight,
|
||||
int bytesPerPixel)
|
||||
{
|
||||
width = BitUtils.DivRoundUp(width, blockWidth);
|
||||
width = BitUtils.DivRoundUp(width, blockWidth);
|
||||
height = BitUtils.DivRoundUp(height, blockHeight);
|
||||
|
||||
int widthAlignment = StrideAlignment / bytesPerPixel;
|
||||
@@ -300,4 +299,4 @@ namespace Ryujinx.Graphics.Texture
|
||||
return (gobBlocksInY, gobBlocksInZ);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -20,14 +20,14 @@ namespace Ryujinx.Graphics.Texture
|
||||
public SizeInfo(int size)
|
||||
{
|
||||
_mipOffsets = new int[] { 0 };
|
||||
AllOffsets = new int[] { 0 };
|
||||
SliceSizes = new int[] { size };
|
||||
LevelSizes = new int[] { size };
|
||||
_depth = 1;
|
||||
_levels = 1;
|
||||
LayerSize = size;
|
||||
TotalSize = size;
|
||||
_is3D = false;
|
||||
AllOffsets = new int[] { 0 };
|
||||
SliceSizes = new int[] { size };
|
||||
LevelSizes = new int[] { size };
|
||||
_depth = 1;
|
||||
_levels = 1;
|
||||
LayerSize = size;
|
||||
TotalSize = size;
|
||||
_is3D = false;
|
||||
}
|
||||
|
||||
internal SizeInfo(
|
||||
@@ -35,21 +35,21 @@ namespace Ryujinx.Graphics.Texture
|
||||
int[] allOffsets,
|
||||
int[] sliceSizes,
|
||||
int[] levelSizes,
|
||||
int depth,
|
||||
int levels,
|
||||
int layerSize,
|
||||
int totalSize,
|
||||
bool is3D)
|
||||
int depth,
|
||||
int levels,
|
||||
int layerSize,
|
||||
int totalSize,
|
||||
bool is3D)
|
||||
{
|
||||
_mipOffsets = mipOffsets;
|
||||
AllOffsets = allOffsets;
|
||||
SliceSizes = sliceSizes;
|
||||
LevelSizes = levelSizes;
|
||||
_depth = depth;
|
||||
_levels = levels;
|
||||
LayerSize = layerSize;
|
||||
TotalSize = totalSize;
|
||||
_is3D = is3D;
|
||||
AllOffsets = allOffsets;
|
||||
SliceSizes = sliceSizes;
|
||||
LevelSizes = levelSizes;
|
||||
_depth = depth;
|
||||
_levels = levels;
|
||||
LayerSize = layerSize;
|
||||
TotalSize = totalSize;
|
||||
_is3D = is3D;
|
||||
}
|
||||
|
||||
public int GetMipOffset(int level)
|
||||
@@ -116,4 +116,4 @@ namespace Ryujinx.Graphics.Texture
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -8,8 +8,8 @@ namespace Ryujinx.Graphics.Texture.Utils
|
||||
{
|
||||
static class BC67Utils
|
||||
{
|
||||
private static byte[][] _quantizationLut;
|
||||
private static byte[][] _quantizationLutNoPBit;
|
||||
private static readonly byte[][] _quantizationLut;
|
||||
private static readonly byte[][] _quantizationLutNoPBit;
|
||||
|
||||
static BC67Utils()
|
||||
{
|
||||
@@ -46,7 +46,7 @@ namespace Ryujinx.Graphics.Texture.Utils
|
||||
}
|
||||
else
|
||||
{
|
||||
RgbaColor8 minColor = new RgbaColor8(255, 255, 255, 255);
|
||||
RgbaColor8 minColor = new(255, 255, 255, 255);
|
||||
RgbaColor8 maxColor = default;
|
||||
|
||||
for (int i = 0; i < tile.Length; i++)
|
||||
@@ -1176,8 +1176,8 @@ namespace Ryujinx.Graphics.Texture.Utils
|
||||
|
||||
int weight = (((weightIndex << 7) / ((1 << indexBitCount) - 1)) + 1) >> 1;
|
||||
|
||||
RgbaColor32 weightV = new RgbaColor32(weight);
|
||||
RgbaColor32 invWeightV = new RgbaColor32(64 - weight);
|
||||
RgbaColor32 weightV = new(weight);
|
||||
RgbaColor32 invWeightV = new(64 - weight);
|
||||
|
||||
return (color1 * invWeightV + color2 * weightV + new RgbaColor32(32)) >> 6;
|
||||
}
|
||||
@@ -1197,8 +1197,10 @@ namespace Ryujinx.Graphics.Texture.Utils
|
||||
int colorWeight = BC67Tables.Weights[colorIndexBitCount - 2][colorWeightIndex];
|
||||
int alphaWeight = BC67Tables.Weights[alphaIndexBitCount - 2][alphaWeightIndex];
|
||||
|
||||
RgbaColor32 weightV = new RgbaColor32(colorWeight);
|
||||
weightV.A = alphaWeight;
|
||||
RgbaColor32 weightV = new(colorWeight)
|
||||
{
|
||||
A = alphaWeight
|
||||
};
|
||||
RgbaColor32 invWeightV = new RgbaColor32(64) - weightV;
|
||||
|
||||
return (color1 * invWeightV + color2 * weightV + new RgbaColor32(32)) >> 6;
|
||||
|
@@ -34,4 +34,4 @@ namespace Ryujinx.Graphics.Texture.Utils
|
||||
AlphaDepth = alphaDepth;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -25,7 +25,7 @@ namespace Ryujinx.Graphics.Texture.Utils
|
||||
offset += bits;
|
||||
}
|
||||
|
||||
public ulong Decode(ref int offset, int bits)
|
||||
public readonly ulong Decode(ref int offset, int bits)
|
||||
{
|
||||
ulong value;
|
||||
ulong mask = bits == 64 ? ulong.MaxValue : (1UL << bits) - 1;
|
||||
@@ -52,4 +52,4 @@ namespace Ryujinx.Graphics.Texture.Utils
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -11,25 +11,25 @@ namespace Ryujinx.Graphics.Texture.Utils
|
||||
|
||||
public int R
|
||||
{
|
||||
get => _color.GetElement(0);
|
||||
readonly get => _color.GetElement(0);
|
||||
set => _color = _color.WithElement(0, value);
|
||||
}
|
||||
|
||||
public int G
|
||||
{
|
||||
get => _color.GetElement(1);
|
||||
readonly get => _color.GetElement(1);
|
||||
set => _color = _color.WithElement(1, value);
|
||||
}
|
||||
|
||||
public int B
|
||||
{
|
||||
get => _color.GetElement(2);
|
||||
readonly get => _color.GetElement(2);
|
||||
set => _color = _color.WithElement(2, value);
|
||||
}
|
||||
|
||||
public int A
|
||||
{
|
||||
get => _color.GetElement(3);
|
||||
readonly get => _color.GetElement(3);
|
||||
set => _color = _color.WithElement(3, value);
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ namespace Ryujinx.Graphics.Texture.Utils
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public RgbaColor8 GetColor8()
|
||||
public readonly RgbaColor8 GetColor8()
|
||||
{
|
||||
if (Sse41.IsSupported)
|
||||
{
|
||||
@@ -211,17 +211,17 @@ namespace Ryujinx.Graphics.Texture.Utils
|
||||
return (byte)Math.Clamp(value, 0, 255);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
public readonly override int GetHashCode()
|
||||
{
|
||||
return HashCode.Combine(R, G, B, A);
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
public readonly override bool Equals(object obj)
|
||||
{
|
||||
return obj is RgbaColor32 other && Equals(other);
|
||||
}
|
||||
|
||||
public bool Equals(RgbaColor32 other)
|
||||
public readonly bool Equals(RgbaColor32 other)
|
||||
{
|
||||
return _color.Equals(other._color);
|
||||
}
|
||||
|
@@ -54,22 +54,22 @@ namespace Ryujinx.Graphics.Texture.Utils
|
||||
return Unsafe.As<RgbaColor8, uint>(ref this);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
public readonly override int GetHashCode()
|
||||
{
|
||||
return HashCode.Combine(R, G, B, A);
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
public readonly override bool Equals(object obj)
|
||||
{
|
||||
return obj is RgbaColor8 other && Equals(other);
|
||||
}
|
||||
|
||||
public bool Equals(RgbaColor8 other)
|
||||
public readonly bool Equals(RgbaColor8 other)
|
||||
{
|
||||
return R == other.R && G == other.G && B == other.B && A == other.A;
|
||||
}
|
||||
|
||||
public byte GetComponent(int index)
|
||||
public readonly byte GetComponent(int index)
|
||||
{
|
||||
return index switch
|
||||
{
|
||||
|
@@ -12,8 +12,8 @@ namespace Ryujinx.Headless.SDL2
|
||||
private bool _canProcessInput;
|
||||
|
||||
public event DynamicTextChangedHandler TextChangedEvent;
|
||||
public event KeyPressedHandler KeyPressedEvent { add { } remove { } }
|
||||
public event KeyReleasedHandler KeyReleasedEvent { add { } remove { } }
|
||||
public event KeyPressedHandler KeyPressedEvent { add { } remove { } }
|
||||
public event KeyReleasedHandler KeyReleasedEvent { add { } remove { } }
|
||||
|
||||
public bool TextProcessingEnabled
|
||||
{
|
||||
@@ -48,4 +48,4 @@ namespace Ryujinx.Headless.SDL2
|
||||
|
||||
public void Dispose() { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -6,12 +6,10 @@ namespace Ryujinx.Headless.SDL2
|
||||
{
|
||||
public string FontFamily => "sans-serif";
|
||||
|
||||
public ThemeColor DefaultBackgroundColor => new ThemeColor(1, 0, 0, 0);
|
||||
public ThemeColor DefaultForegroundColor => new ThemeColor(1, 1, 1, 1);
|
||||
public ThemeColor DefaultBorderColor => new ThemeColor(1, 1, 1, 1);
|
||||
public ThemeColor SelectionBackgroundColor => new ThemeColor(1, 1, 1, 1);
|
||||
public ThemeColor SelectionForegroundColor => new ThemeColor(1, 0, 0, 0);
|
||||
|
||||
public HeadlessHostUiTheme() { }
|
||||
public ThemeColor DefaultBackgroundColor => new(1, 0, 0, 0);
|
||||
public ThemeColor DefaultForegroundColor => new(1, 1, 1, 1);
|
||||
public ThemeColor DefaultBorderColor => new(1, 1, 1, 1);
|
||||
public ThemeColor SelectionBackgroundColor => new(1, 1, 1, 1);
|
||||
public ThemeColor SelectionForegroundColor => new(1, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -11,23 +11,31 @@ namespace Ryujinx.Headless.SDL2.OpenGL
|
||||
{
|
||||
class OpenGLWindow : WindowBase
|
||||
{
|
||||
private static void CheckResult(int result)
|
||||
{
|
||||
if (result < 0)
|
||||
{
|
||||
throw new InvalidOperationException($"SDL_GL function returned an error: {SDL_GetError()}");
|
||||
}
|
||||
}
|
||||
|
||||
private static void SetupOpenGLAttributes(bool sharedContext, GraphicsDebugLevel debugLevel)
|
||||
{
|
||||
SDL_GL_SetAttribute(SDL_GLattr.SDL_GL_CONTEXT_MAJOR_VERSION, 3);
|
||||
SDL_GL_SetAttribute(SDL_GLattr.SDL_GL_CONTEXT_MINOR_VERSION, 3);
|
||||
SDL_GL_SetAttribute(SDL_GLattr.SDL_GL_CONTEXT_PROFILE_MASK, SDL_GLprofile.SDL_GL_CONTEXT_PROFILE_COMPATIBILITY);
|
||||
SDL_GL_SetAttribute(SDL_GLattr.SDL_GL_CONTEXT_FLAGS, debugLevel != GraphicsDebugLevel.None ? (int)SDL_GLcontext.SDL_GL_CONTEXT_DEBUG_FLAG : 0);
|
||||
SDL_GL_SetAttribute(SDL_GLattr.SDL_GL_SHARE_WITH_CURRENT_CONTEXT, sharedContext ? 1 : 0);
|
||||
CheckResult(SDL_GL_SetAttribute(SDL_GLattr.SDL_GL_CONTEXT_MAJOR_VERSION, 3));
|
||||
CheckResult(SDL_GL_SetAttribute(SDL_GLattr.SDL_GL_CONTEXT_MINOR_VERSION, 3));
|
||||
CheckResult(SDL_GL_SetAttribute(SDL_GLattr.SDL_GL_CONTEXT_PROFILE_MASK, SDL_GLprofile.SDL_GL_CONTEXT_PROFILE_COMPATIBILITY));
|
||||
CheckResult(SDL_GL_SetAttribute(SDL_GLattr.SDL_GL_CONTEXT_FLAGS, debugLevel != GraphicsDebugLevel.None ? (int)SDL_GLcontext.SDL_GL_CONTEXT_DEBUG_FLAG : 0));
|
||||
CheckResult(SDL_GL_SetAttribute(SDL_GLattr.SDL_GL_SHARE_WITH_CURRENT_CONTEXT, sharedContext ? 1 : 0));
|
||||
|
||||
SDL_GL_SetAttribute(SDL_GLattr.SDL_GL_ACCELERATED_VISUAL, 1);
|
||||
SDL_GL_SetAttribute(SDL_GLattr.SDL_GL_RED_SIZE, 8);
|
||||
SDL_GL_SetAttribute(SDL_GLattr.SDL_GL_GREEN_SIZE, 8);
|
||||
SDL_GL_SetAttribute(SDL_GLattr.SDL_GL_BLUE_SIZE, 8);
|
||||
SDL_GL_SetAttribute(SDL_GLattr.SDL_GL_ALPHA_SIZE, 8);
|
||||
SDL_GL_SetAttribute(SDL_GLattr.SDL_GL_DEPTH_SIZE, 16);
|
||||
SDL_GL_SetAttribute(SDL_GLattr.SDL_GL_STENCIL_SIZE, 0);
|
||||
SDL_GL_SetAttribute(SDL_GLattr.SDL_GL_DOUBLEBUFFER, 1);
|
||||
SDL_GL_SetAttribute(SDL_GLattr.SDL_GL_STEREO, 0);
|
||||
CheckResult(SDL_GL_SetAttribute(SDL_GLattr.SDL_GL_ACCELERATED_VISUAL, 1));
|
||||
CheckResult(SDL_GL_SetAttribute(SDL_GLattr.SDL_GL_RED_SIZE, 8));
|
||||
CheckResult(SDL_GL_SetAttribute(SDL_GLattr.SDL_GL_GREEN_SIZE, 8));
|
||||
CheckResult(SDL_GL_SetAttribute(SDL_GLattr.SDL_GL_BLUE_SIZE, 8));
|
||||
CheckResult(SDL_GL_SetAttribute(SDL_GLattr.SDL_GL_ALPHA_SIZE, 8));
|
||||
CheckResult(SDL_GL_SetAttribute(SDL_GLattr.SDL_GL_DEPTH_SIZE, 16));
|
||||
CheckResult(SDL_GL_SetAttribute(SDL_GLattr.SDL_GL_STENCIL_SIZE, 0));
|
||||
CheckResult(SDL_GL_SetAttribute(SDL_GLattr.SDL_GL_DOUBLEBUFFER, 1));
|
||||
CheckResult(SDL_GL_SetAttribute(SDL_GLattr.SDL_GL_STEREO, 0));
|
||||
}
|
||||
|
||||
private class OpenToolkitBindingsContext : IBindingsContext
|
||||
@@ -40,9 +48,9 @@ namespace Ryujinx.Headless.SDL2.OpenGL
|
||||
|
||||
private class SDL2OpenGLContext : IOpenGLContext
|
||||
{
|
||||
private IntPtr _context;
|
||||
private IntPtr _window;
|
||||
private bool _shouldDisposeWindow;
|
||||
private readonly IntPtr _context;
|
||||
private readonly IntPtr _window;
|
||||
private readonly bool _shouldDisposeWindow;
|
||||
|
||||
public SDL2OpenGLContext(IntPtr context, IntPtr window, bool shouldDisposeWindow = true)
|
||||
{
|
||||
@@ -62,9 +70,9 @@ namespace Ryujinx.Headless.SDL2.OpenGL
|
||||
|
||||
GL.LoadBindings(new OpenToolkitBindingsContext());
|
||||
|
||||
SDL_GL_SetAttribute(SDL_GLattr.SDL_GL_SHARE_WITH_CURRENT_CONTEXT, 0);
|
||||
CheckResult(SDL_GL_SetAttribute(SDL_GLattr.SDL_GL_SHARE_WITH_CURRENT_CONTEXT, 0));
|
||||
|
||||
SDL_GL_MakeCurrent(windowHandle, IntPtr.Zero);
|
||||
CheckResult(SDL_GL_MakeCurrent(windowHandle, IntPtr.Zero));
|
||||
|
||||
return new SDL2OpenGLContext(context, windowHandle);
|
||||
}
|
||||
@@ -99,7 +107,7 @@ namespace Ryujinx.Headless.SDL2.OpenGL
|
||||
}
|
||||
}
|
||||
|
||||
private GraphicsDebugLevel _glLogLevel;
|
||||
private readonly GraphicsDebugLevel _glLogLevel;
|
||||
private SDL2OpenGLContext _openGLContext;
|
||||
|
||||
public OpenGLWindow(
|
||||
@@ -120,7 +128,7 @@ namespace Ryujinx.Headless.SDL2.OpenGL
|
||||
// Ensure to not share this context with other contexts before this point.
|
||||
SetupOpenGLAttributes(false, _glLogLevel);
|
||||
IntPtr context = SDL_GL_CreateContext(WindowHandle);
|
||||
SDL_GL_SetSwapInterval(1);
|
||||
CheckResult(SDL_GL_SetSwapInterval(1));
|
||||
|
||||
if (context == IntPtr.Zero)
|
||||
{
|
||||
@@ -157,7 +165,7 @@ namespace Ryujinx.Headless.SDL2.OpenGL
|
||||
Device.DisposeGpu();
|
||||
|
||||
// Unbind context and destroy everything
|
||||
SDL_GL_MakeCurrent(WindowHandle, IntPtr.Zero);
|
||||
CheckResult(SDL_GL_MakeCurrent(WindowHandle, IntPtr.Zero));
|
||||
_openGLContext.Dispose();
|
||||
}
|
||||
|
||||
@@ -166,4 +174,4 @@ namespace Ryujinx.Headless.SDL2.OpenGL
|
||||
SDL_GL_SwapWindow(WindowHandle);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -88,7 +88,7 @@ namespace Ryujinx.Headless.SDL2
|
||||
// System
|
||||
|
||||
[Option("disable-ptc", Required = false, HelpText = "Disables profiled persistent translation cache.")]
|
||||
public bool DisablePtc { get; set; }
|
||||
public bool DisablePTC { get; set; }
|
||||
|
||||
[Option("enable-internet-connection", Required = false, Default = false, HelpText = "Enables guest Internet connection.")]
|
||||
public bool EnableInternetAccess { get; set; }
|
||||
@@ -100,7 +100,7 @@ namespace Ryujinx.Headless.SDL2
|
||||
public int FsGlobalAccessLogMode { get; set; }
|
||||
|
||||
[Option("disable-vsync", Required = false, HelpText = "Disables Vertical Sync.")]
|
||||
public bool DisableVsync { get; set; }
|
||||
public bool DisableVSync { get; set; }
|
||||
|
||||
[Option("disable-shader-cache", Required = false, HelpText = "Disables Shader cache.")]
|
||||
public bool DisableShaderCache { get; set; }
|
||||
@@ -126,7 +126,7 @@ namespace Ryujinx.Headless.SDL2
|
||||
[Option("memory-manager-mode", Required = false, Default = MemoryManagerMode.HostMappedUnsafe, HelpText = "The selected memory manager mode.")]
|
||||
public MemoryManagerMode MemoryManagerMode { get; set; }
|
||||
|
||||
[Option("audio-volume", Required = false, Default = 1.0f, HelpText ="The audio level (0 to 1).")]
|
||||
[Option("audio-volume", Required = false, Default = 1.0f, HelpText = "The audio level (0 to 1).")]
|
||||
public float AudioVolume { get; set; }
|
||||
|
||||
[Option("use-hypervisor", Required = false, Default = true, HelpText = "Uses Hypervisor over JIT if available.")]
|
||||
@@ -181,7 +181,7 @@ namespace Ryujinx.Headless.SDL2
|
||||
[Option("backend-threading", Required = false, Default = BackendThreading.Auto, HelpText = "Whether or not backend threading is enabled. The \"Auto\" setting will determine whether threading should be enabled at runtime.")]
|
||||
public BackendThreading BackendThreading { get; set; }
|
||||
|
||||
[Option("disable-macro-hle", Required= false, HelpText = "Disables high-level emulation of Macro code. Leaving this enabled improves performance but may cause graphical glitches in some games.")]
|
||||
[Option("disable-macro-hle", Required = false, HelpText = "Disables high-level emulation of Macro code. Leaving this enabled improves performance but may cause graphical glitches in some games.")]
|
||||
public bool DisableMacroHLE { get; set; }
|
||||
|
||||
[Option("graphics-shaders-dump-path", Required = false, HelpText = "Dumps shaders in this local directory. (Developer only)")]
|
||||
@@ -191,12 +191,12 @@ namespace Ryujinx.Headless.SDL2
|
||||
public GraphicsBackend GraphicsBackend { get; set; }
|
||||
|
||||
[Option("preferred-gpu-vendor", Required = false, Default = "", HelpText = "When using the Vulkan backend, prefer using the GPU from the specified vendor.")]
|
||||
public string PreferredGpuVendor { get; set; }
|
||||
public string PreferredGPUVendor { get; set; }
|
||||
|
||||
// Hacks
|
||||
|
||||
[Option("expand-ram", Required = false, Default = false, HelpText = "Expands the RAM amount on the emulated system from 4GiB to 6GiB.")]
|
||||
public bool ExpandRam { get; set; }
|
||||
public bool ExpandRAM { get; set; }
|
||||
|
||||
[Option("ignore-missing-services", Required = false, Default = false, HelpText = "Enable ignoring missing services.")]
|
||||
public bool IgnoreMissingServices { get; set; }
|
||||
@@ -206,4 +206,4 @@ namespace Ryujinx.Headless.SDL2
|
||||
[Value(0, MetaName = "input", HelpText = "Input to load.", Required = true)]
|
||||
public string InputPath { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -28,6 +28,7 @@ using Ryujinx.HLE.HOS.Services.Account.Acc;
|
||||
using Ryujinx.Input;
|
||||
using Ryujinx.Input.HLE;
|
||||
using Ryujinx.Input.SDL2;
|
||||
using Ryujinx.SDL2.Common;
|
||||
using Silk.NET.Vulkan;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -57,7 +58,7 @@ namespace Ryujinx.Headless.SDL2
|
||||
private static bool _enableKeyboard;
|
||||
private static bool _enableMouse;
|
||||
|
||||
private static readonly InputConfigJsonSerializerContext SerializerContext = new(JsonHelper.GetDefaultSerializerOptions());
|
||||
private static readonly InputConfigJsonSerializerContext _serializerContext = new(JsonHelper.GetDefaultSerializerOptions());
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
@@ -67,10 +68,10 @@ namespace Ryujinx.Headless.SDL2
|
||||
|
||||
if (OperatingSystem.IsMacOS() || OperatingSystem.IsLinux())
|
||||
{
|
||||
AutoResetEvent invoked = new AutoResetEvent(false);
|
||||
AutoResetEvent invoked = new(false);
|
||||
|
||||
// MacOS must perform SDL polls from the main thread.
|
||||
Ryujinx.SDL2.Common.SDL2Driver.MainThreadDispatcher = (Action action) =>
|
||||
SDL2Driver.MainThreadDispatcher = action =>
|
||||
{
|
||||
invoked.Reset();
|
||||
|
||||
@@ -140,53 +141,53 @@ namespace Ryujinx.Headless.SDL2
|
||||
{
|
||||
config = new StandardKeyboardInputConfig
|
||||
{
|
||||
Version = InputConfig.CurrentVersion,
|
||||
Backend = InputBackendType.WindowKeyboard,
|
||||
Id = null,
|
||||
ControllerType = ControllerType.JoyconPair,
|
||||
LeftJoycon = new LeftJoyconCommonConfig<Key>
|
||||
Version = InputConfig.CurrentVersion,
|
||||
Backend = InputBackendType.WindowKeyboard,
|
||||
Id = null,
|
||||
ControllerType = ControllerType.JoyconPair,
|
||||
LeftJoycon = new LeftJoyconCommonConfig<Key>
|
||||
{
|
||||
DpadUp = Key.Up,
|
||||
DpadDown = Key.Down,
|
||||
DpadLeft = Key.Left,
|
||||
DpadRight = Key.Right,
|
||||
ButtonMinus = Key.Minus,
|
||||
ButtonL = Key.E,
|
||||
ButtonZl = Key.Q,
|
||||
ButtonSl = Key.Unbound,
|
||||
ButtonSr = Key.Unbound
|
||||
DpadUp = Key.Up,
|
||||
DpadDown = Key.Down,
|
||||
DpadLeft = Key.Left,
|
||||
DpadRight = Key.Right,
|
||||
ButtonMinus = Key.Minus,
|
||||
ButtonL = Key.E,
|
||||
ButtonZl = Key.Q,
|
||||
ButtonSl = Key.Unbound,
|
||||
ButtonSr = Key.Unbound,
|
||||
},
|
||||
|
||||
LeftJoyconStick = new JoyconConfigKeyboardStick<Key>
|
||||
LeftJoyconStick = new JoyconConfigKeyboardStick<Key>
|
||||
{
|
||||
StickUp = Key.W,
|
||||
StickDown = Key.S,
|
||||
StickLeft = Key.A,
|
||||
StickRight = Key.D,
|
||||
StickButton = Key.F,
|
||||
StickUp = Key.W,
|
||||
StickDown = Key.S,
|
||||
StickLeft = Key.A,
|
||||
StickRight = Key.D,
|
||||
StickButton = Key.F,
|
||||
},
|
||||
|
||||
RightJoycon = new RightJoyconCommonConfig<Key>
|
||||
RightJoycon = new RightJoyconCommonConfig<Key>
|
||||
{
|
||||
ButtonA = Key.Z,
|
||||
ButtonB = Key.X,
|
||||
ButtonX = Key.C,
|
||||
ButtonY = Key.V,
|
||||
ButtonPlus = Key.Plus,
|
||||
ButtonR = Key.U,
|
||||
ButtonZr = Key.O,
|
||||
ButtonSl = Key.Unbound,
|
||||
ButtonSr = Key.Unbound
|
||||
ButtonA = Key.Z,
|
||||
ButtonB = Key.X,
|
||||
ButtonX = Key.C,
|
||||
ButtonY = Key.V,
|
||||
ButtonPlus = Key.Plus,
|
||||
ButtonR = Key.U,
|
||||
ButtonZr = Key.O,
|
||||
ButtonSl = Key.Unbound,
|
||||
ButtonSr = Key.Unbound,
|
||||
},
|
||||
|
||||
RightJoyconStick = new JoyconConfigKeyboardStick<Key>
|
||||
{
|
||||
StickUp = Key.I,
|
||||
StickDown = Key.K,
|
||||
StickLeft = Key.J,
|
||||
StickRight = Key.L,
|
||||
StickButton = Key.H,
|
||||
}
|
||||
StickUp = Key.I,
|
||||
StickDown = Key.K,
|
||||
StickLeft = Key.J,
|
||||
StickRight = Key.L,
|
||||
StickButton = Key.H,
|
||||
},
|
||||
};
|
||||
}
|
||||
else
|
||||
@@ -195,72 +196,72 @@ namespace Ryujinx.Headless.SDL2
|
||||
|
||||
config = new StandardControllerInputConfig
|
||||
{
|
||||
Version = InputConfig.CurrentVersion,
|
||||
Backend = InputBackendType.GamepadSDL2,
|
||||
Id = null,
|
||||
ControllerType = ControllerType.JoyconPair,
|
||||
DeadzoneLeft = 0.1f,
|
||||
DeadzoneRight = 0.1f,
|
||||
RangeLeft = 1.0f,
|
||||
RangeRight = 1.0f,
|
||||
Version = InputConfig.CurrentVersion,
|
||||
Backend = InputBackendType.GamepadSDL2,
|
||||
Id = null,
|
||||
ControllerType = ControllerType.JoyconPair,
|
||||
DeadzoneLeft = 0.1f,
|
||||
DeadzoneRight = 0.1f,
|
||||
RangeLeft = 1.0f,
|
||||
RangeRight = 1.0f,
|
||||
TriggerThreshold = 0.5f,
|
||||
LeftJoycon = new LeftJoyconCommonConfig<ConfigGamepadInputId>
|
||||
{
|
||||
DpadUp = ConfigGamepadInputId.DpadUp,
|
||||
DpadDown = ConfigGamepadInputId.DpadDown,
|
||||
DpadLeft = ConfigGamepadInputId.DpadLeft,
|
||||
DpadRight = ConfigGamepadInputId.DpadRight,
|
||||
ButtonMinus = ConfigGamepadInputId.Minus,
|
||||
ButtonL = ConfigGamepadInputId.LeftShoulder,
|
||||
ButtonZl = ConfigGamepadInputId.LeftTrigger,
|
||||
ButtonSl = ConfigGamepadInputId.Unbound,
|
||||
ButtonSr = ConfigGamepadInputId.Unbound,
|
||||
DpadUp = ConfigGamepadInputId.DpadUp,
|
||||
DpadDown = ConfigGamepadInputId.DpadDown,
|
||||
DpadLeft = ConfigGamepadInputId.DpadLeft,
|
||||
DpadRight = ConfigGamepadInputId.DpadRight,
|
||||
ButtonMinus = ConfigGamepadInputId.Minus,
|
||||
ButtonL = ConfigGamepadInputId.LeftShoulder,
|
||||
ButtonZl = ConfigGamepadInputId.LeftTrigger,
|
||||
ButtonSl = ConfigGamepadInputId.Unbound,
|
||||
ButtonSr = ConfigGamepadInputId.Unbound,
|
||||
},
|
||||
|
||||
LeftJoyconStick = new JoyconConfigControllerStick<ConfigGamepadInputId, ConfigStickInputId>
|
||||
{
|
||||
Joystick = ConfigStickInputId.Left,
|
||||
StickButton = ConfigGamepadInputId.LeftStick,
|
||||
Joystick = ConfigStickInputId.Left,
|
||||
StickButton = ConfigGamepadInputId.LeftStick,
|
||||
InvertStickX = false,
|
||||
InvertStickY = false,
|
||||
Rotate90CW = false,
|
||||
Rotate90CW = false,
|
||||
},
|
||||
|
||||
RightJoycon = new RightJoyconCommonConfig<ConfigGamepadInputId>
|
||||
{
|
||||
ButtonA = isNintendoStyle ? ConfigGamepadInputId.A : ConfigGamepadInputId.B,
|
||||
ButtonB = isNintendoStyle ? ConfigGamepadInputId.B : ConfigGamepadInputId.A,
|
||||
ButtonX = isNintendoStyle ? ConfigGamepadInputId.X : ConfigGamepadInputId.Y,
|
||||
ButtonY = isNintendoStyle ? ConfigGamepadInputId.Y : ConfigGamepadInputId.X,
|
||||
ButtonPlus = ConfigGamepadInputId.Plus,
|
||||
ButtonR = ConfigGamepadInputId.RightShoulder,
|
||||
ButtonZr = ConfigGamepadInputId.RightTrigger,
|
||||
ButtonSl = ConfigGamepadInputId.Unbound,
|
||||
ButtonSr = ConfigGamepadInputId.Unbound,
|
||||
ButtonA = isNintendoStyle ? ConfigGamepadInputId.A : ConfigGamepadInputId.B,
|
||||
ButtonB = isNintendoStyle ? ConfigGamepadInputId.B : ConfigGamepadInputId.A,
|
||||
ButtonX = isNintendoStyle ? ConfigGamepadInputId.X : ConfigGamepadInputId.Y,
|
||||
ButtonY = isNintendoStyle ? ConfigGamepadInputId.Y : ConfigGamepadInputId.X,
|
||||
ButtonPlus = ConfigGamepadInputId.Plus,
|
||||
ButtonR = ConfigGamepadInputId.RightShoulder,
|
||||
ButtonZr = ConfigGamepadInputId.RightTrigger,
|
||||
ButtonSl = ConfigGamepadInputId.Unbound,
|
||||
ButtonSr = ConfigGamepadInputId.Unbound,
|
||||
},
|
||||
|
||||
RightJoyconStick = new JoyconConfigControllerStick<ConfigGamepadInputId, ConfigStickInputId>
|
||||
{
|
||||
Joystick = ConfigStickInputId.Right,
|
||||
StickButton = ConfigGamepadInputId.RightStick,
|
||||
Joystick = ConfigStickInputId.Right,
|
||||
StickButton = ConfigGamepadInputId.RightStick,
|
||||
InvertStickX = false,
|
||||
InvertStickY = false,
|
||||
Rotate90CW = false,
|
||||
Rotate90CW = false,
|
||||
},
|
||||
|
||||
Motion = new StandardMotionConfigController
|
||||
{
|
||||
MotionBackend = MotionInputBackendType.GamepadDriver,
|
||||
EnableMotion = true,
|
||||
Sensitivity = 100,
|
||||
Sensitivity = 100,
|
||||
GyroDeadzone = 1,
|
||||
},
|
||||
Rumble = new RumbleConfigController
|
||||
{
|
||||
StrongRumble = 1f,
|
||||
WeakRumble = 1f,
|
||||
EnableRumble = false
|
||||
}
|
||||
EnableRumble = false,
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -288,7 +289,7 @@ namespace Ryujinx.Headless.SDL2
|
||||
|
||||
try
|
||||
{
|
||||
config = JsonHelper.DeserializeFromFile(path, SerializerContext.InputConfig);
|
||||
config = JsonHelper.DeserializeFromFile(path, _serializerContext.InputConfig);
|
||||
}
|
||||
catch (JsonException)
|
||||
{
|
||||
@@ -310,7 +311,7 @@ namespace Ryujinx.Headless.SDL2
|
||||
{
|
||||
if (controllerConfig.RangeLeft <= 0.0f && controllerConfig.RangeRight <= 0.0f)
|
||||
{
|
||||
controllerConfig.RangeLeft = 1.0f;
|
||||
controllerConfig.RangeLeft = 1.0f;
|
||||
controllerConfig.RangeRight = 1.0f;
|
||||
|
||||
Logger.Info?.Print(LogClass.Application, $"{config.PlayerIndex} stick range reset. Save the profile now to update your configuration");
|
||||
@@ -387,7 +388,7 @@ namespace Ryujinx.Headless.SDL2
|
||||
_enableKeyboard = option.EnableKeyboard;
|
||||
_enableMouse = option.EnableMouse;
|
||||
|
||||
void LoadPlayerConfiguration(string inputProfileName, string inputId, PlayerIndex index)
|
||||
static void LoadPlayerConfiguration(string inputProfileName, string inputId, PlayerIndex index)
|
||||
{
|
||||
InputConfig inputConfig = HandlePlayerConfiguration(inputProfileName, inputId, index);
|
||||
|
||||
@@ -468,19 +469,12 @@ namespace Ryujinx.Headless.SDL2
|
||||
|
||||
private static void ProgressHandler<T>(T state, int current, int total) where T : Enum
|
||||
{
|
||||
string label;
|
||||
|
||||
switch (state)
|
||||
string label = state switch
|
||||
{
|
||||
case LoadState ptcState:
|
||||
label = $"PTC : {current}/{total}";
|
||||
break;
|
||||
case ShaderCacheState shaderCacheState:
|
||||
label = $"Shaders : {current}/{total}";
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentException($"Unknown Progress Handler type {typeof(T)}");
|
||||
}
|
||||
LoadState => $"PTC : {current}/{total}",
|
||||
ShaderCacheState => $"Shaders : {current}/{total}",
|
||||
_ => throw new ArgumentException($"Unknown Progress Handler type {typeof(T)}"),
|
||||
};
|
||||
|
||||
Logger.Info?.Print(LogClass.Application, label);
|
||||
}
|
||||
@@ -499,9 +493,9 @@ namespace Ryujinx.Headless.SDL2
|
||||
string preferredGpuId = string.Empty;
|
||||
Vk api = Vk.GetApi();
|
||||
|
||||
if (!string.IsNullOrEmpty(options.PreferredGpuVendor))
|
||||
if (!string.IsNullOrEmpty(options.PreferredGPUVendor))
|
||||
{
|
||||
string preferredGpuVendor = options.PreferredGpuVendor.ToLowerInvariant();
|
||||
string preferredGpuVendor = options.PreferredGPUVendor.ToLowerInvariant();
|
||||
var devices = VulkanRenderer.GetPhysicalDevices(api);
|
||||
|
||||
foreach (var device in devices)
|
||||
@@ -520,10 +514,8 @@ namespace Ryujinx.Headless.SDL2
|
||||
vulkanWindow.GetRequiredInstanceExtensions,
|
||||
preferredGpuId);
|
||||
}
|
||||
else
|
||||
{
|
||||
return new OpenGLRenderer();
|
||||
}
|
||||
|
||||
return new OpenGLRenderer();
|
||||
}
|
||||
|
||||
private static Switch InitializeEmulationContext(WindowBase window, IRenderer renderer, Options options)
|
||||
@@ -537,31 +529,31 @@ namespace Ryujinx.Headless.SDL2
|
||||
renderer = new ThreadedRenderer(renderer);
|
||||
}
|
||||
|
||||
HLEConfiguration configuration = new HLEConfiguration(_virtualFileSystem,
|
||||
_libHacHorizonManager,
|
||||
_contentManager,
|
||||
_accountManager,
|
||||
_userChannelPersistence,
|
||||
renderer,
|
||||
new SDL2HardwareDeviceDriver(),
|
||||
options.ExpandRam ? MemoryConfiguration.MemoryConfiguration6GiB : MemoryConfiguration.MemoryConfiguration4GiB,
|
||||
window,
|
||||
options.SystemLanguage,
|
||||
options.SystemRegion,
|
||||
!options.DisableVsync,
|
||||
!options.DisableDockedMode,
|
||||
!options.DisablePtc,
|
||||
options.EnableInternetAccess,
|
||||
!options.DisableFsIntegrityChecks ? IntegrityCheckLevel.ErrorOnInvalid : IntegrityCheckLevel.None,
|
||||
options.FsGlobalAccessLogMode,
|
||||
options.SystemTimeOffset,
|
||||
options.SystemTimeZone,
|
||||
options.MemoryManagerMode,
|
||||
options.IgnoreMissingServices,
|
||||
options.AspectRatio,
|
||||
options.AudioVolume,
|
||||
options.UseHypervisor ?? true,
|
||||
options.MultiplayerLanInterfaceId);
|
||||
HLEConfiguration configuration = new(_virtualFileSystem,
|
||||
_libHacHorizonManager,
|
||||
_contentManager,
|
||||
_accountManager,
|
||||
_userChannelPersistence,
|
||||
renderer,
|
||||
new SDL2HardwareDeviceDriver(),
|
||||
options.ExpandRAM ? MemoryConfiguration.MemoryConfiguration6GiB : MemoryConfiguration.MemoryConfiguration4GiB,
|
||||
window,
|
||||
options.SystemLanguage,
|
||||
options.SystemRegion,
|
||||
!options.DisableVSync,
|
||||
!options.DisableDockedMode,
|
||||
!options.DisablePTC,
|
||||
options.EnableInternetAccess,
|
||||
!options.DisableFsIntegrityChecks ? IntegrityCheckLevel.ErrorOnInvalid : IntegrityCheckLevel.None,
|
||||
options.FsGlobalAccessLogMode,
|
||||
options.SystemTimeOffset,
|
||||
options.SystemTimeZone,
|
||||
options.MemoryManagerMode,
|
||||
options.IgnoreMissingServices,
|
||||
options.AspectRatio,
|
||||
options.AudioVolume,
|
||||
options.UseHypervisor ?? true,
|
||||
options.MultiplayerLanInterfaceId);
|
||||
|
||||
return new Switch(configuration);
|
||||
}
|
||||
@@ -713,4 +705,4 @@ namespace Ryujinx.Headless.SDL2
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -87,4 +87,4 @@ namespace Ryujinx.Headless.SDL2
|
||||
_driver = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,4 +1,5 @@
|
||||
using Ryujinx.Common.Configuration;
|
||||
using Ryujinx.Common.Configuration;
|
||||
using Ryujinx.Common.Logging;
|
||||
using Ryujinx.Input;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
@@ -14,7 +15,7 @@ namespace Ryujinx.Headless.SDL2
|
||||
private const int CursorHideIdleTime = 5; // seconds
|
||||
|
||||
private bool _isDisposed;
|
||||
private HideCursorMode _hideCursorMode;
|
||||
private readonly HideCursorMode _hideCursorMode;
|
||||
private bool _isHidden;
|
||||
private long _lastCursorMoveTime;
|
||||
|
||||
@@ -22,7 +23,7 @@ namespace Ryujinx.Headless.SDL2
|
||||
|
||||
public Vector2 CurrentPosition { get; private set; }
|
||||
public Vector2 Scroll { get; private set; }
|
||||
public Size _clientSize;
|
||||
public Size ClientSize;
|
||||
|
||||
public SDL2MouseDriver(HideCursorMode hideCursorMode)
|
||||
{
|
||||
@@ -31,7 +32,11 @@ namespace Ryujinx.Headless.SDL2
|
||||
|
||||
if (_hideCursorMode == HideCursorMode.Always)
|
||||
{
|
||||
SDL_ShowCursor(SDL_DISABLE);
|
||||
if (SDL_ShowCursor(SDL_DISABLE) != SDL_DISABLE)
|
||||
{
|
||||
Logger.Error?.PrintMsg(LogClass.Application, "Failed to disable the cursor.");
|
||||
}
|
||||
|
||||
_isHidden = true;
|
||||
}
|
||||
}
|
||||
@@ -46,7 +51,7 @@ namespace Ryujinx.Headless.SDL2
|
||||
|
||||
public void UpdatePosition()
|
||||
{
|
||||
SDL_GetMouseState(out int posX, out int posY);
|
||||
_ = SDL_GetMouseState(out int posX, out int posY);
|
||||
Vector2 position = new(posX, posY);
|
||||
|
||||
if (CurrentPosition != position)
|
||||
@@ -71,7 +76,11 @@ namespace Ryujinx.Headless.SDL2
|
||||
{
|
||||
if (!_isHidden)
|
||||
{
|
||||
SDL_ShowCursor(SDL_DISABLE);
|
||||
if (SDL_ShowCursor(SDL_DISABLE) != SDL_DISABLE)
|
||||
{
|
||||
Logger.Error?.PrintMsg(LogClass.Application, "Failed to disable the cursor.");
|
||||
}
|
||||
|
||||
_isHidden = true;
|
||||
}
|
||||
}
|
||||
@@ -79,7 +88,11 @@ namespace Ryujinx.Headless.SDL2
|
||||
{
|
||||
if (_isHidden)
|
||||
{
|
||||
SDL_ShowCursor(SDL_ENABLE);
|
||||
if (SDL_ShowCursor(SDL_ENABLE) != SDL_ENABLE)
|
||||
{
|
||||
Logger.Error?.PrintMsg(LogClass.Application, "Failed to enable the cursor.");
|
||||
}
|
||||
|
||||
_isHidden = false;
|
||||
}
|
||||
}
|
||||
@@ -118,7 +131,7 @@ namespace Ryujinx.Headless.SDL2
|
||||
|
||||
public void SetClientSize(int width, int height)
|
||||
{
|
||||
_clientSize = new Size(width, height);
|
||||
ClientSize = new Size(width, height);
|
||||
}
|
||||
|
||||
public bool IsButtonPressed(MouseButton button)
|
||||
@@ -128,7 +141,7 @@ namespace Ryujinx.Headless.SDL2
|
||||
|
||||
public Size GetClientSize()
|
||||
{
|
||||
return _clientSize;
|
||||
return ClientSize;
|
||||
}
|
||||
|
||||
public string DriverName => "SDL2";
|
||||
@@ -162,4 +175,4 @@ namespace Ryujinx.Headless.SDL2
|
||||
_isDisposed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -10,7 +10,7 @@ namespace Ryujinx.Headless.SDL2.Vulkan
|
||||
{
|
||||
class VulkanWindow : WindowBase
|
||||
{
|
||||
private GraphicsDebugLevel _glLogLevel;
|
||||
private readonly GraphicsDebugLevel _glLogLevel;
|
||||
|
||||
public VulkanWindow(
|
||||
InputManager inputManager,
|
||||
@@ -33,16 +33,16 @@ namespace Ryujinx.Headless.SDL2.Vulkan
|
||||
MouseDriver.SetClientSize(DefaultWidth, DefaultHeight);
|
||||
}
|
||||
|
||||
private void BasicInvoke(Action action)
|
||||
private static void BasicInvoke(Action action)
|
||||
{
|
||||
action();
|
||||
}
|
||||
|
||||
public unsafe IntPtr CreateWindowSurface(IntPtr instance)
|
||||
public IntPtr CreateWindowSurface(IntPtr instance)
|
||||
{
|
||||
ulong surfaceHandle = 0;
|
||||
|
||||
Action createSurface = () =>
|
||||
void CreateSurface()
|
||||
{
|
||||
if (SDL_Vulkan_CreateSurface(WindowHandle, instance, out surfaceHandle) == SDL_bool.SDL_FALSE)
|
||||
{
|
||||
@@ -52,15 +52,15 @@ namespace Ryujinx.Headless.SDL2.Vulkan
|
||||
|
||||
throw new Exception(errorMessage);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
if (SDL2Driver.MainThreadDispatcher != null)
|
||||
{
|
||||
SDL2Driver.MainThreadDispatcher(createSurface);
|
||||
SDL2Driver.MainThreadDispatcher(CreateSurface);
|
||||
}
|
||||
else
|
||||
{
|
||||
createSurface();
|
||||
CreateSurface();
|
||||
}
|
||||
|
||||
return (IntPtr)surfaceHandle;
|
||||
@@ -101,4 +101,4 @@ namespace Ryujinx.Headless.SDL2.Vulkan
|
||||
|
||||
protected override void SwapBuffers() { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -4,6 +4,8 @@ using Ryujinx.Common.Configuration.Hid;
|
||||
using Ryujinx.Common.Logging;
|
||||
using Ryujinx.Graphics.GAL;
|
||||
using Ryujinx.Graphics.GAL.Multithreading;
|
||||
using Ryujinx.Graphics.Gpu;
|
||||
using Ryujinx.Graphics.OpenGL;
|
||||
using Ryujinx.HLE.HOS.Applets;
|
||||
using Ryujinx.HLE.HOS.Services.Am.AppletOE.ApplicationProxyService.ApplicationProxy.Types;
|
||||
using Ryujinx.HLE.Ui;
|
||||
@@ -30,7 +32,7 @@ namespace Ryujinx.Headless.SDL2
|
||||
private const SDL_WindowFlags DefaultFlags = SDL_WindowFlags.SDL_WINDOW_ALLOW_HIGHDPI | SDL_WindowFlags.SDL_WINDOW_RESIZABLE | SDL_WindowFlags.SDL_WINDOW_INPUT_FOCUS | SDL_WindowFlags.SDL_WINDOW_SHOWN;
|
||||
private const int TargetFps = 60;
|
||||
|
||||
private static ConcurrentQueue<Action> MainThreadActions = new ConcurrentQueue<Action>();
|
||||
private static readonly ConcurrentQueue<Action> _mainThreadActions = new();
|
||||
|
||||
[LibraryImport("SDL2")]
|
||||
// TODO: Remove this as soon as SDL2-CS was updated to expose this method publicly
|
||||
@@ -38,7 +40,7 @@ namespace Ryujinx.Headless.SDL2
|
||||
|
||||
public static void QueueMainThreadAction(Action action)
|
||||
{
|
||||
MainThreadActions.Enqueue(action);
|
||||
_mainThreadActions.Enqueue(action);
|
||||
}
|
||||
|
||||
public NpadManager NpadManager { get; }
|
||||
@@ -55,9 +57,9 @@ namespace Ryujinx.Headless.SDL2
|
||||
public int Height { get; private set; }
|
||||
|
||||
protected SDL2MouseDriver MouseDriver;
|
||||
private InputManager _inputManager;
|
||||
private IKeyboard _keyboardInterface;
|
||||
private GraphicsDebugLevel _glLogLevel;
|
||||
private readonly InputManager _inputManager;
|
||||
private readonly IKeyboard _keyboardInterface;
|
||||
private readonly GraphicsDebugLevel _glLogLevel;
|
||||
private readonly Stopwatch _chrono;
|
||||
private readonly long _ticksPerFrame;
|
||||
private readonly CancellationTokenSource _gpuCancellationTokenSource;
|
||||
@@ -71,8 +73,8 @@ namespace Ryujinx.Headless.SDL2
|
||||
|
||||
private string _gpuVendorName;
|
||||
|
||||
private AspectRatio _aspectRatio;
|
||||
private bool _enableMouse;
|
||||
private readonly AspectRatio _aspectRatio;
|
||||
private readonly bool _enableMouse;
|
||||
|
||||
public WindowBase(
|
||||
InputManager inputManager,
|
||||
@@ -192,9 +194,6 @@ namespace Ryujinx.Headless.SDL2
|
||||
case SDL_WindowEventID.SDL_WINDOWEVENT_CLOSE:
|
||||
Exit();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -260,7 +259,7 @@ namespace Ryujinx.Headless.SDL2
|
||||
if (_ticks >= _ticksPerFrame)
|
||||
{
|
||||
string dockedMode = Device.System.State.DockedMode ? "Docked" : "Handheld";
|
||||
float scale = Graphics.Gpu.GraphicsConfig.ResScale;
|
||||
float scale = GraphicsConfig.ResScale;
|
||||
if (scale != 1)
|
||||
{
|
||||
dockedMode += $" ({scale}x)";
|
||||
@@ -309,9 +308,9 @@ namespace Ryujinx.Headless.SDL2
|
||||
_exitEvent.Dispose();
|
||||
}
|
||||
|
||||
public void ProcessMainThreadQueue()
|
||||
public static void ProcessMainThreadQueue()
|
||||
{
|
||||
while (MainThreadActions.TryDequeue(out Action action))
|
||||
while (_mainThreadActions.TryDequeue(out Action action))
|
||||
{
|
||||
action();
|
||||
}
|
||||
@@ -334,7 +333,7 @@ namespace Ryujinx.Headless.SDL2
|
||||
_exitEvent.Set();
|
||||
}
|
||||
|
||||
private void NVStutterWorkaround()
|
||||
private void NvidiaStutterWorkaround()
|
||||
{
|
||||
while (_isActive)
|
||||
{
|
||||
@@ -348,7 +347,7 @@ namespace Ryujinx.Headless.SDL2
|
||||
|
||||
// TODO: This should be removed when the issue with the GateThread is resolved.
|
||||
|
||||
ThreadPool.QueueUserWorkItem((state) => { });
|
||||
ThreadPool.QueueUserWorkItem(state => { });
|
||||
Thread.Sleep(300);
|
||||
}
|
||||
}
|
||||
@@ -396,20 +395,20 @@ namespace Ryujinx.Headless.SDL2
|
||||
|
||||
InitializeWindow();
|
||||
|
||||
Thread renderLoopThread = new Thread(Render)
|
||||
Thread renderLoopThread = new(Render)
|
||||
{
|
||||
Name = "GUI.RenderLoop"
|
||||
Name = "GUI.RenderLoop",
|
||||
};
|
||||
renderLoopThread.Start();
|
||||
|
||||
Thread nvStutterWorkaround = null;
|
||||
if (Renderer is Graphics.OpenGL.OpenGLRenderer)
|
||||
Thread nvidiaStutterWorkaround = null;
|
||||
if (Renderer is OpenGLRenderer)
|
||||
{
|
||||
nvStutterWorkaround = new Thread(NVStutterWorkaround)
|
||||
nvidiaStutterWorkaround = new Thread(NvidiaStutterWorkaround)
|
||||
{
|
||||
Name = "GUI.NVStutterWorkaround"
|
||||
Name = "GUI.NvidiaStutterWorkaround",
|
||||
};
|
||||
nvStutterWorkaround.Start();
|
||||
nvidiaStutterWorkaround.Start();
|
||||
}
|
||||
|
||||
MainLoop();
|
||||
@@ -418,7 +417,7 @@ namespace Ryujinx.Headless.SDL2
|
||||
// We only need to wait for all commands submitted during the main gpu loop to be processed.
|
||||
_gpuDoneEvent.WaitOne();
|
||||
_gpuDoneEvent.Dispose();
|
||||
nvStutterWorkaround?.Join();
|
||||
nvidiaStutterWorkaround?.Join();
|
||||
|
||||
Exit();
|
||||
}
|
||||
@@ -465,13 +464,13 @@ namespace Ryujinx.Headless.SDL2
|
||||
|
||||
public bool DisplayErrorAppletDialog(string title, string message, string[] buttonsText)
|
||||
{
|
||||
SDL_MessageBoxData data = new SDL_MessageBoxData
|
||||
SDL_MessageBoxData data = new()
|
||||
{
|
||||
title = title,
|
||||
message = message,
|
||||
buttons = new SDL_MessageBoxButtonData[buttonsText.Length],
|
||||
numbuttons = buttonsText.Length,
|
||||
window = WindowHandle
|
||||
window = WindowHandle,
|
||||
};
|
||||
|
||||
for (int i = 0; i < buttonsText.Length; i++)
|
||||
@@ -479,7 +478,7 @@ namespace Ryujinx.Headless.SDL2
|
||||
data.buttons[i] = new SDL_MessageBoxButtonData
|
||||
{
|
||||
buttonid = i,
|
||||
text = buttonsText[i]
|
||||
text = buttonsText[i],
|
||||
};
|
||||
}
|
||||
|
||||
@@ -509,4 +508,4 @@ namespace Ryujinx.Headless.SDL2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -180,7 +180,7 @@ namespace Spv.Generator
|
||||
return result;
|
||||
}
|
||||
|
||||
public Instruction Decorate(Instruction target, Decoration decoration, Operand parameter)
|
||||
public Instruction Decorate(Instruction target, Decoration decoration, IOperand parameter)
|
||||
{
|
||||
Instruction result = NewInstruction(Op.OpDecorate);
|
||||
|
||||
@@ -192,7 +192,7 @@ namespace Spv.Generator
|
||||
return result;
|
||||
}
|
||||
|
||||
public Instruction Decorate(Instruction target, Decoration decoration, params Operand[] parameters)
|
||||
public Instruction Decorate(Instruction target, Decoration decoration, params IOperand[] parameters)
|
||||
{
|
||||
Instruction result = NewInstruction(Op.OpDecorate);
|
||||
|
||||
@@ -216,7 +216,7 @@ namespace Spv.Generator
|
||||
return result;
|
||||
}
|
||||
|
||||
public Instruction MemberDecorate(Instruction structureType, LiteralInteger member, Decoration decoration, Operand parameter)
|
||||
public Instruction MemberDecorate(Instruction structureType, LiteralInteger member, Decoration decoration, IOperand parameter)
|
||||
{
|
||||
Instruction result = NewInstruction(Op.OpMemberDecorate);
|
||||
|
||||
@@ -229,7 +229,7 @@ namespace Spv.Generator
|
||||
return result;
|
||||
}
|
||||
|
||||
public Instruction MemberDecorate(Instruction structureType, LiteralInteger member, Decoration decoration, params Operand[] parameters)
|
||||
public Instruction MemberDecorate(Instruction structureType, LiteralInteger member, Decoration decoration, params IOperand[] parameters)
|
||||
{
|
||||
Instruction result = NewInstruction(Op.OpMemberDecorate);
|
||||
|
||||
@@ -262,7 +262,7 @@ namespace Spv.Generator
|
||||
return result;
|
||||
}
|
||||
|
||||
public Instruction GroupMemberDecorate(Instruction decorationGroup, params Operand[] targets)
|
||||
public Instruction GroupMemberDecorate(Instruction decorationGroup, params IOperand[] targets)
|
||||
{
|
||||
Instruction result = NewInstruction(Op.OpGroupMemberDecorate);
|
||||
|
||||
@@ -273,7 +273,7 @@ namespace Spv.Generator
|
||||
return result;
|
||||
}
|
||||
|
||||
public Instruction DecorateId(Instruction target, Decoration decoration, params Operand[] parameters)
|
||||
public Instruction DecorateId(Instruction target, Decoration decoration, params IOperand[] parameters)
|
||||
{
|
||||
Instruction result = NewInstruction(Op.OpDecorateId);
|
||||
|
||||
@@ -285,7 +285,7 @@ namespace Spv.Generator
|
||||
return result;
|
||||
}
|
||||
|
||||
public Instruction DecorateString(Instruction target, Decoration decoration, params Operand[] parameters)
|
||||
public Instruction DecorateString(Instruction target, Decoration decoration, params IOperand[] parameters)
|
||||
{
|
||||
Instruction result = NewInstruction(Op.OpDecorateString);
|
||||
|
||||
@@ -297,7 +297,7 @@ namespace Spv.Generator
|
||||
return result;
|
||||
}
|
||||
|
||||
public Instruction DecorateStringGOOGLE(Instruction target, Decoration decoration, params Operand[] parameters)
|
||||
public Instruction DecorateStringGOOGLE(Instruction target, Decoration decoration, params IOperand[] parameters)
|
||||
{
|
||||
Instruction result = NewInstruction(Op.OpDecorateStringGOOGLE);
|
||||
|
||||
@@ -309,7 +309,7 @@ namespace Spv.Generator
|
||||
return result;
|
||||
}
|
||||
|
||||
public Instruction MemberDecorateString(Instruction structType, LiteralInteger member, Decoration decoration, params Operand[] parameters)
|
||||
public Instruction MemberDecorateString(Instruction structType, LiteralInteger member, Decoration decoration, params IOperand[] parameters)
|
||||
{
|
||||
Instruction result = NewInstruction(Op.OpMemberDecorateString);
|
||||
|
||||
@@ -322,7 +322,7 @@ namespace Spv.Generator
|
||||
return result;
|
||||
}
|
||||
|
||||
public Instruction MemberDecorateStringGOOGLE(Instruction structType, LiteralInteger member, Decoration decoration, params Operand[] parameters)
|
||||
public Instruction MemberDecorateStringGOOGLE(Instruction structType, LiteralInteger member, Decoration decoration, params IOperand[] parameters)
|
||||
{
|
||||
Instruction result = NewInstruction(Op.OpMemberDecorateStringGOOGLE);
|
||||
|
||||
@@ -2815,7 +2815,7 @@ namespace Spv.Generator
|
||||
return result;
|
||||
}
|
||||
|
||||
public Instruction Switch(Instruction selector, Instruction defaultObj, params Operand[] target)
|
||||
public Instruction Switch(Instruction selector, Instruction defaultObj, params IOperand[] target)
|
||||
{
|
||||
Instruction result = NewInstruction(Op.OpSwitch);
|
||||
|
||||
|
@@ -26,8 +26,6 @@
|
||||
// IN THE MATERIALS.
|
||||
#endregion
|
||||
|
||||
using static Spv.Specification;
|
||||
|
||||
namespace Spv.Generator
|
||||
{
|
||||
public partial class Module
|
||||
@@ -36,406 +34,406 @@ namespace Spv.Generator
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 1, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslRoundEven(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 2, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslTrunc(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 3, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslFAbs(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 4, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslSAbs(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 5, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslFSign(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 6, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslSSign(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 7, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslFloor(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 8, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslCeil(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 9, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslFract(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 10, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslRadians(Instruction resultType, Instruction degrees)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 11, degrees);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslDegrees(Instruction resultType, Instruction radians)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 12, radians);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslSin(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 13, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslCos(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 14, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslTan(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 15, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslAsin(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 16, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslAcos(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 17, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslAtan(Instruction resultType, Instruction y_over_x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 18, y_over_x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslSinh(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 19, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslCosh(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 20, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslTanh(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 21, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslAsinh(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 22, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslAcosh(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 23, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslAtanh(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 24, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslAtan2(Instruction resultType, Instruction y, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 25, y, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslPow(Instruction resultType, Instruction x, Instruction y)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 26, x, y);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslExp(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 27, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslLog(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 28, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslExp2(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 29, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslLog2(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 30, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslSqrt(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 31, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslInverseSqrt(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 32, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslDeterminant(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 33, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslMatrixInverse(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 34, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslModf(Instruction resultType, Instruction x, Instruction i)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 35, x, i);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslModfStruct(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 36, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslFMin(Instruction resultType, Instruction x, Instruction y)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 37, x, y);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslUMin(Instruction resultType, Instruction x, Instruction y)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 38, x, y);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslSMin(Instruction resultType, Instruction x, Instruction y)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 39, x, y);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslFMax(Instruction resultType, Instruction x, Instruction y)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 40, x, y);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslUMax(Instruction resultType, Instruction x, Instruction y)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 41, x, y);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslSMax(Instruction resultType, Instruction x, Instruction y)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 42, x, y);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslFClamp(Instruction resultType, Instruction x, Instruction minVal, Instruction maxVal)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 43, x, minVal, maxVal);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslUClamp(Instruction resultType, Instruction x, Instruction minVal, Instruction maxVal)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 44, x, minVal, maxVal);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslSClamp(Instruction resultType, Instruction x, Instruction minVal, Instruction maxVal)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 45, x, minVal, maxVal);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslFMix(Instruction resultType, Instruction x, Instruction y, Instruction a)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 46, x, y, a);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslIMix(Instruction resultType, Instruction x, Instruction y, Instruction a)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 47, x, y, a);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslStep(Instruction resultType, Instruction edge, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 48, edge, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslSmoothStep(Instruction resultType, Instruction edge0, Instruction edge1, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 49, edge0, edge1, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslFma(Instruction resultType, Instruction a, Instruction b, Instruction c)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 50, a, b, c);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslFrexp(Instruction resultType, Instruction x, Instruction exp)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 51, x, exp);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslFrexpStruct(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 52, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslLdexp(Instruction resultType, Instruction x, Instruction exp)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 53, x, exp);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslPackSnorm4x8(Instruction resultType, Instruction v)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 54, v);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslPackUnorm4x8(Instruction resultType, Instruction v)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 55, v);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslPackSnorm2x16(Instruction resultType, Instruction v)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 56, v);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslPackUnorm2x16(Instruction resultType, Instruction v)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 57, v);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslPackHalf2x16(Instruction resultType, Instruction v)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 58, v);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslPackDouble2x32(Instruction resultType, Instruction v)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 59, v);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslUnpackSnorm2x16(Instruction resultType, Instruction p)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 60, p);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslUnpackUnorm2x16(Instruction resultType, Instruction p)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 61, p);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslUnpackHalf2x16(Instruction resultType, Instruction v)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 62, v);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslUnpackSnorm4x8(Instruction resultType, Instruction p)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 63, p);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslUnpackUnorm4x8(Instruction resultType, Instruction p)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 64, p);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslUnpackDouble2x32(Instruction resultType, Instruction v)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 65, v);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslLength(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 66, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslDistance(Instruction resultType, Instruction p0, Instruction p1)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 67, p0, p1);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslCross(Instruction resultType, Instruction x, Instruction y)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 68, x, y);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslNormalize(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 69, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslFaceForward(Instruction resultType, Instruction n, Instruction i, Instruction nref)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 70, n, i, nref);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslReflect(Instruction resultType, Instruction i, Instruction n)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 71, i, n);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslRefract(Instruction resultType, Instruction i, Instruction n, Instruction eta)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 72, i, n, eta);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslFindILsb(Instruction resultType, Instruction value)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 73, value);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslFindSMsb(Instruction resultType, Instruction value)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 74, value);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslFindUMsb(Instruction resultType, Instruction value)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 75, value);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslInterpolateAtCentroid(Instruction resultType, Instruction interpolant)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 76, interpolant);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslInterpolateAtSample(Instruction resultType, Instruction interpolant, Instruction sample)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 77, interpolant, sample);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslInterpolateAtOffset(Instruction resultType, Instruction interpolant, Instruction offset)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 78, interpolant, offset);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslNMin(Instruction resultType, Instruction x, Instruction y)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 79, x, y);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslNMax(Instruction resultType, Instruction x, Instruction y)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 80, x, y);
|
||||
}
|
||||
|
||||
|
||||
public Instruction GlslNClamp(Instruction resultType, Instruction x, Instruction minVal, Instruction maxVal)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("GLSL.std.450"), 81, x, minVal, maxVal);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -36,806 +36,806 @@ namespace Spv.Generator
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 0, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClAcosh(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 1, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClAcospi(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 2, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClAsin(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 3, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClAsinh(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 4, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClAsinpi(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 5, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClAtan(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 6, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClAtan2(Instruction resultType, Instruction y, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 7, y, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClAtanh(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 8, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClAtanpi(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 9, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClAtan2pi(Instruction resultType, Instruction y, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 10, y, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClCbrt(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 11, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClCeil(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 12, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClCopysign(Instruction resultType, Instruction x, Instruction y)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 13, x, y);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClCos(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 14, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClCosh(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 15, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClCospi(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 16, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClErfc(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 17, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClErf(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 18, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClExp(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 19, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClExp2(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 20, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClExp10(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 21, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClExpm1(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 22, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClFabs(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 23, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClFdim(Instruction resultType, Instruction x, Instruction y)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 24, x, y);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClFloor(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 25, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClFma(Instruction resultType, Instruction a, Instruction b, Instruction c)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 26, a, b, c);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClFmax(Instruction resultType, Instruction x, Instruction y)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 27, x, y);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClFmin(Instruction resultType, Instruction x, Instruction y)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 28, x, y);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClFmod(Instruction resultType, Instruction x, Instruction y)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 29, x, y);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClFract(Instruction resultType, Instruction x, Instruction ptr)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 30, x, ptr);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClFrexp(Instruction resultType, Instruction x, Instruction exp)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 31, x, exp);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClHypot(Instruction resultType, Instruction x, Instruction y)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 32, x, y);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClIlogb(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 33, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClLdexp(Instruction resultType, Instruction x, Instruction k)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 34, x, k);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClLgamma(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 35, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClLgamma_r(Instruction resultType, Instruction x, Instruction signp)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 36, x, signp);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClLog(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 37, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClLog2(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 38, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClLog10(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 39, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClLog1p(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 40, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClLogb(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 41, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClMad(Instruction resultType, Instruction a, Instruction b, Instruction c)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 42, a, b, c);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClMaxmag(Instruction resultType, Instruction x, Instruction y)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 43, x, y);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClMinmag(Instruction resultType, Instruction x, Instruction y)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 44, x, y);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClModf(Instruction resultType, Instruction x, Instruction iptr)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 45, x, iptr);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClNan(Instruction resultType, Instruction nancode)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 46, nancode);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClNextafter(Instruction resultType, Instruction x, Instruction y)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 47, x, y);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClPow(Instruction resultType, Instruction x, Instruction y)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 48, x, y);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClPown(Instruction resultType, Instruction x, Instruction y)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 49, x, y);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClPowr(Instruction resultType, Instruction x, Instruction y)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 50, x, y);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClRemainder(Instruction resultType, Instruction x, Instruction y)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 51, x, y);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClRemquo(Instruction resultType, Instruction x, Instruction y, Instruction quo)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 52, x, y, quo);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClRint(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 53, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClRootn(Instruction resultType, Instruction x, Instruction y)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 54, x, y);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClRound(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 55, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClRsqrt(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 56, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClSin(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 57, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClSincos(Instruction resultType, Instruction x, Instruction cosval)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 58, x, cosval);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClSinh(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 59, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClSinpi(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 60, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClSqrt(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 61, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClTan(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 62, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClTanh(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 63, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClTanpi(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 64, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClTgamma(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 65, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClTrunc(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 66, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClHalf_cos(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 67, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClHalf_divide(Instruction resultType, Instruction x, Instruction y)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 68, x, y);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClHalf_exp(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 69, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClHalf_exp2(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 70, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClHalf_exp10(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 71, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClHalf_log(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 72, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClHalf_log2(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 73, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClHalf_log10(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 74, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClHalf_powr(Instruction resultType, Instruction x, Instruction y)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 75, x, y);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClHalf_recip(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 76, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClHalf_rsqrt(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 77, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClHalf_sin(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 78, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClHalf_sqrt(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 79, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClHalf_tan(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 80, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClNative_cos(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 81, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClNative_divide(Instruction resultType, Instruction x, Instruction y)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 82, x, y);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClNative_exp(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 83, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClNative_exp2(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 84, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClNative_exp10(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 85, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClNative_log(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 86, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClNative_log2(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 87, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClNative_log10(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 88, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClNative_powr(Instruction resultType, Instruction x, Instruction y)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 89, x, y);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClNative_recip(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 90, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClNative_rsqrt(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 91, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClNative_sin(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 92, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClNative_sqrt(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 93, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClNative_tan(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 94, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClS_abs(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 141, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClS_abs_diff(Instruction resultType, Instruction x, Instruction y)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 142, x, y);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClS_add_sat(Instruction resultType, Instruction x, Instruction y)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 143, x, y);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClU_add_sat(Instruction resultType, Instruction x, Instruction y)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 144, x, y);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClS_hadd(Instruction resultType, Instruction x, Instruction y)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 145, x, y);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClU_hadd(Instruction resultType, Instruction x, Instruction y)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 146, x, y);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClS_rhadd(Instruction resultType, Instruction x, Instruction y)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 147, x, y);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClU_rhadd(Instruction resultType, Instruction x, Instruction y)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 148, x, y);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClS_clamp(Instruction resultType, Instruction x, Instruction minval, Instruction maxval)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 149, x, minval, maxval);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClU_clamp(Instruction resultType, Instruction x, Instruction minval, Instruction maxval)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 150, x, minval, maxval);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClClz(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 151, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClCtz(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 152, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClS_mad_hi(Instruction resultType, Instruction a, Instruction b, Instruction c)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 153, a, b, c);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClU_mad_sat(Instruction resultType, Instruction x, Instruction y, Instruction z)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 154, x, y, z);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClS_mad_sat(Instruction resultType, Instruction x, Instruction y, Instruction z)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 155, x, y, z);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClS_max(Instruction resultType, Instruction x, Instruction y)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 156, x, y);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClU_max(Instruction resultType, Instruction x, Instruction y)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 157, x, y);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClS_min(Instruction resultType, Instruction x, Instruction y)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 158, x, y);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClU_min(Instruction resultType, Instruction x, Instruction y)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 159, x, y);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClS_mul_hi(Instruction resultType, Instruction x, Instruction y)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 160, x, y);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClRotate(Instruction resultType, Instruction v, Instruction i)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 161, v, i);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClS_sub_sat(Instruction resultType, Instruction x, Instruction y)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 162, x, y);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClU_sub_sat(Instruction resultType, Instruction x, Instruction y)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 163, x, y);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClU_upsample(Instruction resultType, Instruction hi, Instruction lo)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 164, hi, lo);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClS_upsample(Instruction resultType, Instruction hi, Instruction lo)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 165, hi, lo);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClPopcount(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 166, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClS_mad24(Instruction resultType, Instruction x, Instruction y, Instruction z)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 167, x, y, z);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClU_mad24(Instruction resultType, Instruction x, Instruction y, Instruction z)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 168, x, y, z);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClS_mul24(Instruction resultType, Instruction x, Instruction y)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 169, x, y);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClU_mul24(Instruction resultType, Instruction x, Instruction y)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 170, x, y);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClU_abs(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 201, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClU_abs_diff(Instruction resultType, Instruction x, Instruction y)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 202, x, y);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClU_mul_hi(Instruction resultType, Instruction x, Instruction y)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 203, x, y);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClU_mad_hi(Instruction resultType, Instruction a, Instruction b, Instruction c)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 204, a, b, c);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClFclamp(Instruction resultType, Instruction x, Instruction minval, Instruction maxval)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 95, x, minval, maxval);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClDegrees(Instruction resultType, Instruction radians)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 96, radians);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClFmax_common(Instruction resultType, Instruction x, Instruction y)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 97, x, y);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClFmin_common(Instruction resultType, Instruction x, Instruction y)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 98, x, y);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClMix(Instruction resultType, Instruction x, Instruction y, Instruction a)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 99, x, y, a);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClRadians(Instruction resultType, Instruction degrees)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 100, degrees);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClStep(Instruction resultType, Instruction edge, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 101, edge, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClSmoothstep(Instruction resultType, Instruction edge0, Instruction edge1, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 102, edge0, edge1, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClSign(Instruction resultType, Instruction x)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 103, x);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClCross(Instruction resultType, Instruction p0, Instruction p1)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 104, p0, p1);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClDistance(Instruction resultType, Instruction p0, Instruction p1)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 105, p0, p1);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClLength(Instruction resultType, Instruction p)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 106, p);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClNormalize(Instruction resultType, Instruction p)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 107, p);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClFast_distance(Instruction resultType, Instruction p0, Instruction p1)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 108, p0, p1);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClFast_length(Instruction resultType, Instruction p)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 109, p);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClFast_normalize(Instruction resultType, Instruction p)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 110, p);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClBitselect(Instruction resultType, Instruction a, Instruction b, Instruction c)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 186, a, b, c);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClSelect(Instruction resultType, Instruction a, Instruction b, Instruction c)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 187, a, b, c);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClVloadn(Instruction resultType, Instruction offset, Instruction p, LiteralInteger n)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 171, offset, p, n);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClVstoren(Instruction resultType, Instruction data, Instruction offset, Instruction p)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 172, data, offset, p);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClVload_half(Instruction resultType, Instruction offset, Instruction p)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 173, offset, p);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClVload_halfn(Instruction resultType, Instruction offset, Instruction p, LiteralInteger n)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 174, offset, p, n);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClVstore_half(Instruction resultType, Instruction data, Instruction offset, Instruction p)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 175, data, offset, p);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClVstore_half_r(Instruction resultType, Instruction data, Instruction offset, Instruction p, FPRoundingMode mode)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 176, data, offset, p, LiteralInteger.CreateForEnum(mode));
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClVstore_halfn(Instruction resultType, Instruction data, Instruction offset, Instruction p)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 177, data, offset, p);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClVstore_halfn_r(Instruction resultType, Instruction data, Instruction offset, Instruction p, FPRoundingMode mode)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 178, data, offset, p, LiteralInteger.CreateForEnum(mode));
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClVloada_halfn(Instruction resultType, Instruction offset, Instruction p, LiteralInteger n)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 179, offset, p, n);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClVstorea_halfn(Instruction resultType, Instruction data, Instruction offset, Instruction p)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 180, data, offset, p);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClVstorea_halfn_r(Instruction resultType, Instruction data, Instruction offset, Instruction p, FPRoundingMode mode)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 181, data, offset, p, LiteralInteger.CreateForEnum(mode));
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClShuffle(Instruction resultType, Instruction x, Instruction shufflemask)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 182, x, shufflemask);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClShuffle2(Instruction resultType, Instruction x, Instruction y, Instruction shufflemask)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 183, x, y, shufflemask);
|
||||
}
|
||||
|
||||
|
||||
public Instruction OpenClPrefetch(Instruction resultType, Instruction ptr, Instruction numelements)
|
||||
{
|
||||
return ExtInst(resultType, AddExtInstImport("OpenCL.std"), 185, ptr, numelements);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@ using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Spv.Generator
|
||||
{
|
||||
internal struct ConstantKey : IEquatable<ConstantKey>
|
||||
internal readonly struct ConstantKey : IEquatable<ConstantKey>
|
||||
{
|
||||
private readonly Instruction _constant;
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Spv.Generator
|
||||
|
||||
public override bool Equals([NotNullWhen(true)] object obj)
|
||||
{
|
||||
return obj is ConstantKey && Equals((ConstantKey)obj);
|
||||
return obj is ConstantKey key && Equals(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Spv.Generator
|
||||
{
|
||||
@@ -19,12 +18,12 @@ namespace Spv.Generator
|
||||
|
||||
public bool Equals(DeterministicStringKey other)
|
||||
{
|
||||
return _value == other._value;
|
||||
return _value == other?._value;
|
||||
}
|
||||
|
||||
public override bool Equals([NotNullWhen(true)] object obj)
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
return obj is DeterministicStringKey && Equals((DeterministicStringKey)obj);
|
||||
return obj is DeterministicStringKey key && Equals(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -4,17 +4,15 @@ namespace Spv.Generator
|
||||
{
|
||||
public class GeneratorPool<T> where T : class, new()
|
||||
{
|
||||
private List<T[]> _pool;
|
||||
private readonly List<T[]> _pool;
|
||||
private int _chunkIndex = -1;
|
||||
private int _poolIndex = -1;
|
||||
private int _initialSize;
|
||||
private int _poolSizeIncrement;
|
||||
private readonly int _poolSizeIncrement;
|
||||
|
||||
public GeneratorPool(): this(1000, 200) { }
|
||||
public GeneratorPool() : this(1000, 200) { }
|
||||
|
||||
public GeneratorPool(int chunkSizeLimit, int poolSizeIncrement)
|
||||
{
|
||||
_initialSize = chunkSizeLimit;
|
||||
_poolSizeIncrement = poolSizeIncrement;
|
||||
|
||||
_pool = new(chunkSizeLimit * 2);
|
||||
|
@@ -3,7 +3,7 @@ using System.IO;
|
||||
|
||||
namespace Spv.Generator
|
||||
{
|
||||
public interface Operand : IEquatable<Operand>
|
||||
public interface IOperand : IEquatable<IOperand>
|
||||
{
|
||||
OperandType Type { get; }
|
||||
|
@@ -5,7 +5,7 @@ using System.IO;
|
||||
|
||||
namespace Spv.Generator
|
||||
{
|
||||
public sealed class Instruction : Operand, IEquatable<Instruction>
|
||||
public sealed class Instruction : IOperand, IEquatable<Instruction>
|
||||
{
|
||||
public const uint InvalidId = uint.MaxValue;
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace Spv.Generator
|
||||
result += _resultType.WordCount;
|
||||
}
|
||||
|
||||
Span<Operand> operands = _operands.AsSpan();
|
||||
Span<IOperand> operands = _operands.AsSpan();
|
||||
for (int i = 0; i < operands.Length; i++)
|
||||
{
|
||||
result += operands[i].WordCount;
|
||||
@@ -58,15 +58,15 @@ namespace Spv.Generator
|
||||
|
||||
public ushort WordCount => 1;
|
||||
|
||||
public void AddOperand(Operand value)
|
||||
public void AddOperand(IOperand value)
|
||||
{
|
||||
Debug.Assert(value != null);
|
||||
_operands.Add(value);
|
||||
}
|
||||
|
||||
public void AddOperand(Operand[] value)
|
||||
public void AddOperand(IOperand[] value)
|
||||
{
|
||||
foreach (Operand instruction in value)
|
||||
foreach (IOperand instruction in value)
|
||||
{
|
||||
AddOperand(instruction);
|
||||
}
|
||||
@@ -82,7 +82,7 @@ namespace Spv.Generator
|
||||
|
||||
public void AddOperand(LiteralInteger value)
|
||||
{
|
||||
AddOperand((Operand)value);
|
||||
AddOperand((IOperand)value);
|
||||
}
|
||||
|
||||
public void AddOperand(Instruction[] value)
|
||||
@@ -95,7 +95,7 @@ namespace Spv.Generator
|
||||
|
||||
public void AddOperand(Instruction value)
|
||||
{
|
||||
AddOperand((Operand)value);
|
||||
AddOperand((IOperand)value);
|
||||
}
|
||||
|
||||
public void AddOperand(string value)
|
||||
@@ -103,7 +103,7 @@ namespace Spv.Generator
|
||||
AddOperand(new LiteralString(value));
|
||||
}
|
||||
|
||||
public void AddOperand<T>(T value) where T: Enum
|
||||
public void AddOperand<T>(T value) where T : Enum
|
||||
{
|
||||
AddOperand(LiteralInteger.CreateForEnum(value));
|
||||
}
|
||||
@@ -121,7 +121,7 @@ namespace Spv.Generator
|
||||
writer.Write(Id);
|
||||
}
|
||||
|
||||
Span<Operand> operands = _operands.AsSpan();
|
||||
Span<IOperand> operands = _operands.AsSpan();
|
||||
for (int i = 0; i < operands.Length; i++)
|
||||
{
|
||||
operands[i].WriteOperand(writer);
|
||||
@@ -186,8 +186,8 @@ namespace Spv.Generator
|
||||
|
||||
public bool EqualsContent(Instruction cmpObj)
|
||||
{
|
||||
Span<Operand> thisOperands = _operands.AsSpan();
|
||||
Span<Operand> cmpOperands = cmpObj._operands.AsSpan();
|
||||
Span<IOperand> thisOperands = _operands.AsSpan();
|
||||
Span<IOperand> cmpOperands = cmpObj._operands.AsSpan();
|
||||
|
||||
if (thisOperands.Length != cmpOperands.Length)
|
||||
{
|
||||
@@ -212,7 +212,7 @@ namespace Spv.Generator
|
||||
|
||||
public int GetHashCodeContent()
|
||||
{
|
||||
return DeterministicHashCode.Combine<Operand>(_operands.AsSpan());
|
||||
return DeterministicHashCode.Combine<IOperand>(_operands.AsSpan());
|
||||
}
|
||||
|
||||
public int GetHashCodeResultType()
|
||||
@@ -222,14 +222,14 @@ namespace Spv.Generator
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return DeterministicHashCode.Combine(Opcode, Id, _resultType, DeterministicHashCode.Combine<Operand>(_operands.AsSpan()));
|
||||
return DeterministicHashCode.Combine(Opcode, Id, _resultType, DeterministicHashCode.Combine<IOperand>(_operands.AsSpan()));
|
||||
}
|
||||
|
||||
public bool Equals(Operand obj)
|
||||
public bool Equals(IOperand obj)
|
||||
{
|
||||
return obj is Instruction instruction && Equals(instruction);
|
||||
}
|
||||
|
||||
|
||||
private static readonly Dictionary<Specification.Op, string[]> _operandLabels = new()
|
||||
{
|
||||
{ Specification.Op.OpConstant, new [] { "Value" } },
|
||||
|
@@ -10,14 +10,14 @@ namespace Spv.Generator
|
||||
private const int InternalCount = 5;
|
||||
|
||||
public int Count;
|
||||
public Operand Operand1;
|
||||
public Operand Operand2;
|
||||
public Operand Operand3;
|
||||
public Operand Operand4;
|
||||
public Operand Operand5;
|
||||
public Operand[] Overflow;
|
||||
public IOperand Operand1;
|
||||
public IOperand Operand2;
|
||||
public IOperand Operand3;
|
||||
public IOperand Operand4;
|
||||
public IOperand Operand5;
|
||||
public IOperand[] Overflow;
|
||||
|
||||
public Span<Operand> AsSpan()
|
||||
public Span<IOperand> AsSpan()
|
||||
{
|
||||
if (Count > InternalCount)
|
||||
{
|
||||
@@ -29,7 +29,7 @@ namespace Spv.Generator
|
||||
}
|
||||
}
|
||||
|
||||
public void Add(Operand operand)
|
||||
public void Add(IOperand operand)
|
||||
{
|
||||
if (Count < InternalCount)
|
||||
{
|
||||
@@ -40,7 +40,7 @@ namespace Spv.Generator
|
||||
{
|
||||
if (Overflow == null)
|
||||
{
|
||||
Overflow = new Operand[InternalCount * 2];
|
||||
Overflow = new IOperand[InternalCount * 2];
|
||||
MemoryMarshal.CreateSpan(ref this.Operand1, InternalCount).CopyTo(Overflow.AsSpan());
|
||||
}
|
||||
else if (Count == Overflow.Length)
|
||||
@@ -52,16 +52,16 @@ namespace Spv.Generator
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerable<Operand> AllOperands => new[] { Operand1, Operand2, Operand3, Operand4, Operand5 }
|
||||
.Concat(Overflow ?? Array.Empty<Operand>())
|
||||
private readonly IEnumerable<IOperand> AllOperands => new[] { Operand1, Operand2, Operand3, Operand4, Operand5 }
|
||||
.Concat(Overflow ?? Array.Empty<IOperand>())
|
||||
.Take(Count);
|
||||
|
||||
public override string ToString()
|
||||
public readonly override string ToString()
|
||||
{
|
||||
return $"({string.Join(", ", AllOperands)})";
|
||||
}
|
||||
|
||||
public string ToString(string[] labels)
|
||||
public readonly string ToString(string[] labels)
|
||||
{
|
||||
var labeledParams = AllOperands.Zip(labels, (op, label) => $"{label}: {op}");
|
||||
var unlabeledParams = AllOperands.Skip(labels.Length).Select(op => op.ToString());
|
||||
|
@@ -3,7 +3,7 @@ using System.IO;
|
||||
|
||||
namespace Spv.Generator
|
||||
{
|
||||
public class LiteralInteger : Operand, IEquatable<LiteralInteger>
|
||||
public class LiteralInteger : IOperand, IEquatable<LiteralInteger>
|
||||
{
|
||||
[ThreadStatic]
|
||||
private static GeneratorPool<LiteralInteger> _pool;
|
||||
@@ -95,7 +95,7 @@ namespace Spv.Generator
|
||||
return DeterministicHashCode.Combine(Type, _data);
|
||||
}
|
||||
|
||||
public bool Equals(Operand obj)
|
||||
public bool Equals(IOperand obj)
|
||||
{
|
||||
return obj is LiteralInteger literalInteger && Equals(literalInteger);
|
||||
}
|
||||
|
@@ -4,7 +4,7 @@ using System.Text;
|
||||
|
||||
namespace Spv.Generator
|
||||
{
|
||||
public class LiteralString : Operand, IEquatable<LiteralString>
|
||||
public class LiteralString : IOperand, IEquatable<LiteralString>
|
||||
{
|
||||
public OperandType Type => OperandType.String;
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace Spv.Generator
|
||||
return DeterministicHashCode.Combine(Type, DeterministicHashCode.GetHashCode(_value));
|
||||
}
|
||||
|
||||
public bool Equals(Operand obj)
|
||||
public bool Equals(IOperand obj)
|
||||
{
|
||||
return obj is LiteralString literalString && Equals(literalString);
|
||||
}
|
||||
|
@@ -15,30 +15,30 @@ namespace Spv.Generator
|
||||
private uint _bound;
|
||||
|
||||
// Follow spec order here while keeping it as simple as possible.
|
||||
private List<Capability> _capabilities;
|
||||
private List<string> _extensions;
|
||||
private Dictionary<DeterministicStringKey, Instruction> _extInstImports;
|
||||
private readonly List<Capability> _capabilities;
|
||||
private readonly List<string> _extensions;
|
||||
private readonly Dictionary<DeterministicStringKey, Instruction> _extInstImports;
|
||||
private AddressingModel _addressingModel;
|
||||
private MemoryModel _memoryModel;
|
||||
|
||||
private List<Instruction> _entrypoints;
|
||||
private List<Instruction> _executionModes;
|
||||
private List<Instruction> _debug;
|
||||
private List<Instruction> _annotations;
|
||||
private readonly List<Instruction> _entrypoints;
|
||||
private readonly List<Instruction> _executionModes;
|
||||
private readonly List<Instruction> _debug;
|
||||
private readonly List<Instruction> _annotations;
|
||||
|
||||
// In the declaration block.
|
||||
private Dictionary<TypeDeclarationKey, Instruction> _typeDeclarations;
|
||||
private readonly Dictionary<TypeDeclarationKey, Instruction> _typeDeclarations;
|
||||
// In the declaration block.
|
||||
private List<Instruction> _globals;
|
||||
private readonly List<Instruction> _globals;
|
||||
// In the declaration block.
|
||||
private Dictionary<ConstantKey, Instruction> _constants;
|
||||
private readonly Dictionary<ConstantKey, Instruction> _constants;
|
||||
// In the declaration block, for function that aren't defined in the module.
|
||||
private List<Instruction> _functionsDeclarations;
|
||||
private readonly List<Instruction> _functionsDeclarations;
|
||||
|
||||
private List<Instruction> _functionsDefinitions;
|
||||
private readonly List<Instruction> _functionsDefinitions;
|
||||
|
||||
private GeneratorPool<Instruction> _instPool;
|
||||
private GeneratorPool<LiteralInteger> _integerPool;
|
||||
private readonly GeneratorPool<Instruction> _instPool;
|
||||
private readonly GeneratorPool<LiteralInteger> _integerPool;
|
||||
|
||||
public Module(uint version, GeneratorPool<Instruction> instPool = null, GeneratorPool<LiteralInteger> integerPool = null)
|
||||
{
|
||||
@@ -143,7 +143,7 @@ namespace Spv.Generator
|
||||
_entrypoints.Add(entryPoint);
|
||||
}
|
||||
|
||||
public void AddExecutionMode(Instruction function, ExecutionMode mode, params Operand[] parameters)
|
||||
public void AddExecutionMode(Instruction function, ExecutionMode mode, params IOperand[] parameters)
|
||||
{
|
||||
Debug.Assert(function.Opcode == Op.OpFunction);
|
||||
|
||||
@@ -225,7 +225,7 @@ namespace Spv.Generator
|
||||
_constants.Add(key, constant);
|
||||
}
|
||||
|
||||
public Instruction ExtInst(Instruction resultType, Instruction set, LiteralInteger instruction, params Operand[] parameters)
|
||||
public Instruction ExtInst(Instruction resultType, Instruction set, LiteralInteger instruction, params IOperand[] parameters)
|
||||
{
|
||||
Instruction result = NewInstruction(Op.OpExtInst, GetNewId(), resultType);
|
||||
|
||||
@@ -262,104 +262,103 @@ namespace Spv.Generator
|
||||
// Estimate the size needed for the generated code, to avoid expanding the MemoryStream.
|
||||
int sizeEstimate = 1024 + _functionsDefinitions.Count * 32;
|
||||
|
||||
using (MemoryStream stream = new MemoryStream(sizeEstimate))
|
||||
using MemoryStream stream = new(sizeEstimate);
|
||||
|
||||
BinaryWriter writer = new(stream, System.Text.Encoding.ASCII);
|
||||
|
||||
// Header
|
||||
writer.Write(MagicNumber);
|
||||
writer.Write(_version);
|
||||
writer.Write(GeneratorId);
|
||||
writer.Write(_bound);
|
||||
writer.Write(0u);
|
||||
|
||||
// 1.
|
||||
foreach (Capability capability in _capabilities)
|
||||
{
|
||||
BinaryWriter writer = new BinaryWriter(stream, System.Text.Encoding.ASCII);
|
||||
Instruction capabilityInstruction = NewInstruction(Op.OpCapability);
|
||||
|
||||
// Header
|
||||
writer.Write(MagicNumber);
|
||||
writer.Write(_version);
|
||||
writer.Write(GeneratorId);
|
||||
writer.Write(_bound);
|
||||
writer.Write(0u);
|
||||
|
||||
// 1.
|
||||
foreach (Capability capability in _capabilities)
|
||||
{
|
||||
Instruction capabilityInstruction = NewInstruction(Op.OpCapability);
|
||||
|
||||
capabilityInstruction.AddOperand(capability);
|
||||
capabilityInstruction.Write(writer);
|
||||
}
|
||||
|
||||
// 2.
|
||||
foreach (string extension in _extensions)
|
||||
{
|
||||
Instruction extensionInstruction = NewInstruction(Op.OpExtension);
|
||||
|
||||
extensionInstruction.AddOperand(extension);
|
||||
extensionInstruction.Write(writer);
|
||||
}
|
||||
|
||||
// 3.
|
||||
foreach (Instruction extInstImport in _extInstImports.Values)
|
||||
{
|
||||
extInstImport.Write(writer);
|
||||
}
|
||||
|
||||
// 4.
|
||||
Instruction memoryModelInstruction = NewInstruction(Op.OpMemoryModel);
|
||||
memoryModelInstruction.AddOperand(_addressingModel);
|
||||
memoryModelInstruction.AddOperand(_memoryModel);
|
||||
memoryModelInstruction.Write(writer);
|
||||
|
||||
// 5.
|
||||
foreach (Instruction entrypoint in _entrypoints)
|
||||
{
|
||||
entrypoint.Write(writer);
|
||||
}
|
||||
|
||||
// 6.
|
||||
foreach (Instruction executionMode in _executionModes)
|
||||
{
|
||||
executionMode.Write(writer);
|
||||
}
|
||||
|
||||
// 7.
|
||||
// TODO: Order debug information correctly.
|
||||
foreach (Instruction debug in _debug)
|
||||
{
|
||||
debug.Write(writer);
|
||||
}
|
||||
|
||||
// 8.
|
||||
foreach (Instruction annotation in _annotations)
|
||||
{
|
||||
annotation.Write(writer);
|
||||
}
|
||||
|
||||
// Ensure that everything is in the right order in the declarations section.
|
||||
List<Instruction> declarations = new List<Instruction>();
|
||||
declarations.AddRange(_typeDeclarations.Values);
|
||||
declarations.AddRange(_globals);
|
||||
declarations.AddRange(_constants.Values);
|
||||
declarations.Sort((Instruction x, Instruction y) => x.Id.CompareTo(y.Id));
|
||||
|
||||
// 9.
|
||||
foreach (Instruction declaration in declarations)
|
||||
{
|
||||
declaration.Write(writer);
|
||||
}
|
||||
|
||||
// 10.
|
||||
foreach (Instruction functionDeclaration in _functionsDeclarations)
|
||||
{
|
||||
functionDeclaration.Write(writer);
|
||||
}
|
||||
|
||||
// 11.
|
||||
foreach (Instruction functionDefinition in _functionsDefinitions)
|
||||
{
|
||||
functionDefinition.Write(writer);
|
||||
}
|
||||
|
||||
_instPool.Clear();
|
||||
_integerPool.Clear();
|
||||
|
||||
LiteralInteger.UnregisterPool();
|
||||
|
||||
return stream.ToArray();
|
||||
capabilityInstruction.AddOperand(capability);
|
||||
capabilityInstruction.Write(writer);
|
||||
}
|
||||
|
||||
// 2.
|
||||
foreach (string extension in _extensions)
|
||||
{
|
||||
Instruction extensionInstruction = NewInstruction(Op.OpExtension);
|
||||
|
||||
extensionInstruction.AddOperand(extension);
|
||||
extensionInstruction.Write(writer);
|
||||
}
|
||||
|
||||
// 3.
|
||||
foreach (Instruction extInstImport in _extInstImports.Values)
|
||||
{
|
||||
extInstImport.Write(writer);
|
||||
}
|
||||
|
||||
// 4.
|
||||
Instruction memoryModelInstruction = NewInstruction(Op.OpMemoryModel);
|
||||
memoryModelInstruction.AddOperand(_addressingModel);
|
||||
memoryModelInstruction.AddOperand(_memoryModel);
|
||||
memoryModelInstruction.Write(writer);
|
||||
|
||||
// 5.
|
||||
foreach (Instruction entrypoint in _entrypoints)
|
||||
{
|
||||
entrypoint.Write(writer);
|
||||
}
|
||||
|
||||
// 6.
|
||||
foreach (Instruction executionMode in _executionModes)
|
||||
{
|
||||
executionMode.Write(writer);
|
||||
}
|
||||
|
||||
// 7.
|
||||
// TODO: Order debug information correctly.
|
||||
foreach (Instruction debug in _debug)
|
||||
{
|
||||
debug.Write(writer);
|
||||
}
|
||||
|
||||
// 8.
|
||||
foreach (Instruction annotation in _annotations)
|
||||
{
|
||||
annotation.Write(writer);
|
||||
}
|
||||
|
||||
// Ensure that everything is in the right order in the declarations section.
|
||||
List<Instruction> declarations = new();
|
||||
declarations.AddRange(_typeDeclarations.Values);
|
||||
declarations.AddRange(_globals);
|
||||
declarations.AddRange(_constants.Values);
|
||||
declarations.Sort((Instruction x, Instruction y) => x.Id.CompareTo(y.Id));
|
||||
|
||||
// 9.
|
||||
foreach (Instruction declaration in declarations)
|
||||
{
|
||||
declaration.Write(writer);
|
||||
}
|
||||
|
||||
// 10.
|
||||
foreach (Instruction functionDeclaration in _functionsDeclarations)
|
||||
{
|
||||
functionDeclaration.Write(writer);
|
||||
}
|
||||
|
||||
// 11.
|
||||
foreach (Instruction functionDefinition in _functionsDefinitions)
|
||||
{
|
||||
functionDefinition.Write(writer);
|
||||
}
|
||||
|
||||
_instPool.Clear();
|
||||
_integerPool.Clear();
|
||||
|
||||
LiteralInteger.UnregisterPool();
|
||||
|
||||
return stream.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -3,7 +3,7 @@ using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Spv.Generator
|
||||
{
|
||||
internal struct TypeDeclarationKey : IEquatable<TypeDeclarationKey>
|
||||
internal readonly struct TypeDeclarationKey : IEquatable<TypeDeclarationKey>
|
||||
{
|
||||
private readonly Instruction _typeDeclaration;
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Spv.Generator
|
||||
|
||||
public override bool Equals([NotNullWhen(true)] object obj)
|
||||
{
|
||||
return obj is TypeDeclarationKey && Equals((TypeDeclarationKey)obj);
|
||||
return obj is TypeDeclarationKey key && Equals(key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -75,17 +75,17 @@ namespace Spv
|
||||
TaskNV = 5267,
|
||||
MeshNV = 5268,
|
||||
RayGenerationKHR = 5313,
|
||||
RayGenerationNV = 5313,
|
||||
RayGenerationNV = RayGenerationKHR,
|
||||
IntersectionKHR = 5314,
|
||||
IntersectionNV = 5314,
|
||||
IntersectionNV = IntersectionKHR,
|
||||
AnyHitKHR = 5315,
|
||||
AnyHitNV = 5315,
|
||||
AnyHitNV = AnyHitKHR,
|
||||
ClosestHitKHR = 5316,
|
||||
ClosestHitNV = 5316,
|
||||
ClosestHitNV = ClosestHitKHR,
|
||||
MissKHR = 5317,
|
||||
MissNV = 5317,
|
||||
MissNV = MissKHR,
|
||||
CallableKHR = 5318,
|
||||
CallableNV = 5318,
|
||||
CallableNV = CallableKHR,
|
||||
}
|
||||
|
||||
public enum AddressingModel
|
||||
@@ -94,7 +94,7 @@ namespace Spv
|
||||
Physical32 = 1,
|
||||
Physical64 = 2,
|
||||
PhysicalStorageBuffer64 = 5348,
|
||||
PhysicalStorageBuffer64EXT = 5348,
|
||||
PhysicalStorageBuffer64EXT = PhysicalStorageBuffer64,
|
||||
}
|
||||
|
||||
public enum MemoryModel
|
||||
@@ -103,7 +103,7 @@ namespace Spv
|
||||
GLSL450 = 1,
|
||||
OpenCL = 2,
|
||||
Vulkan = 3,
|
||||
VulkanKHR = 3,
|
||||
VulkanKHR = Vulkan,
|
||||
}
|
||||
|
||||
public enum ExecutionMode
|
||||
@@ -186,19 +186,19 @@ namespace Spv
|
||||
Image = 11,
|
||||
StorageBuffer = 12,
|
||||
CallableDataKHR = 5328,
|
||||
CallableDataNV = 5328,
|
||||
CallableDataNV = CallableDataKHR,
|
||||
IncomingCallableDataKHR = 5329,
|
||||
IncomingCallableDataNV = 5329,
|
||||
IncomingCallableDataNV = IncomingCallableDataKHR,
|
||||
RayPayloadKHR = 5338,
|
||||
RayPayloadNV = 5338,
|
||||
RayPayloadNV = RayPayloadKHR,
|
||||
HitAttributeKHR = 5339,
|
||||
HitAttributeNV = 5339,
|
||||
HitAttributeNV = HitAttributeKHR,
|
||||
IncomingRayPayloadKHR = 5342,
|
||||
IncomingRayPayloadNV = 5342,
|
||||
IncomingRayPayloadNV = IncomingRayPayloadKHR,
|
||||
ShaderRecordBufferKHR = 5343,
|
||||
ShaderRecordBufferNV = 5343,
|
||||
ShaderRecordBufferNV = ShaderRecordBufferKHR,
|
||||
PhysicalStorageBuffer = 5349,
|
||||
PhysicalStorageBufferEXT = 5349,
|
||||
PhysicalStorageBufferEXT = PhysicalStorageBuffer,
|
||||
CodeSectionINTEL = 5605,
|
||||
}
|
||||
|
||||
@@ -330,13 +330,13 @@ namespace Spv
|
||||
Sample = 6,
|
||||
MinLod = 7,
|
||||
MakeTexelAvailable = 8,
|
||||
MakeTexelAvailableKHR = 8,
|
||||
MakeTexelAvailableKHR = MakeTexelAvailable,
|
||||
MakeTexelVisible = 9,
|
||||
MakeTexelVisibleKHR = 9,
|
||||
MakeTexelVisibleKHR = MakeTexelVisible,
|
||||
NonPrivateTexel = 10,
|
||||
NonPrivateTexelKHR = 10,
|
||||
NonPrivateTexelKHR = NonPrivateTexel,
|
||||
VolatileTexel = 11,
|
||||
VolatileTexelKHR = 11,
|
||||
VolatileTexelKHR = VolatileTexel,
|
||||
SignExtend = 12,
|
||||
ZeroExtend = 13,
|
||||
}
|
||||
@@ -353,13 +353,13 @@ namespace Spv
|
||||
Sample = 0x00000040,
|
||||
MinLod = 0x00000080,
|
||||
MakeTexelAvailable = 0x00000100,
|
||||
MakeTexelAvailableKHR = 0x00000100,
|
||||
MakeTexelAvailableKHR = MakeTexelAvailable,
|
||||
MakeTexelVisible = 0x00000200,
|
||||
MakeTexelVisibleKHR = 0x00000200,
|
||||
MakeTexelVisibleKHR = MakeTexelVisible,
|
||||
NonPrivateTexel = 0x00000400,
|
||||
NonPrivateTexelKHR = 0x00000400,
|
||||
NonPrivateTexelKHR = NonPrivateTexel,
|
||||
VolatileTexel = 0x00000800,
|
||||
VolatileTexelKHR = 0x00000800,
|
||||
VolatileTexelKHR = VolatileTexel,
|
||||
SignExtend = 0x00001000,
|
||||
ZeroExtend = 0x00002000,
|
||||
Offsets = 0x00010000,
|
||||
@@ -478,16 +478,16 @@ namespace Spv
|
||||
PerTaskNV = 5273,
|
||||
PerVertexNV = 5285,
|
||||
NonUniform = 5300,
|
||||
NonUniformEXT = 5300,
|
||||
NonUniformEXT = NonUniform,
|
||||
RestrictPointer = 5355,
|
||||
RestrictPointerEXT = 5355,
|
||||
RestrictPointerEXT = RestrictPointer,
|
||||
AliasedPointer = 5356,
|
||||
AliasedPointerEXT = 5356,
|
||||
AliasedPointerEXT = AliasedPointer,
|
||||
ReferencedIndirectlyINTEL = 5602,
|
||||
CounterBuffer = 5634,
|
||||
HlslCounterBufferGOOGLE = 5634,
|
||||
HlslCounterBufferGOOGLE = CounterBuffer,
|
||||
HlslSemanticGOOGLE = 5635,
|
||||
UserSemantic = 5635,
|
||||
UserSemantic = HlslSemanticGOOGLE,
|
||||
UserTypeGOOGLE = 5636,
|
||||
RegisterINTEL = 5825,
|
||||
MemoryINTEL = 5826,
|
||||
@@ -547,15 +547,15 @@ namespace Spv
|
||||
VertexIndex = 42,
|
||||
InstanceIndex = 43,
|
||||
SubgroupEqMask = 4416,
|
||||
SubgroupEqMaskKHR = 4416,
|
||||
SubgroupEqMaskKHR = SubgroupEqMask,
|
||||
SubgroupGeMask = 4417,
|
||||
SubgroupGeMaskKHR = 4417,
|
||||
SubgroupGeMaskKHR = SubgroupGeMask,
|
||||
SubgroupGtMask = 4418,
|
||||
SubgroupGtMaskKHR = 4418,
|
||||
SubgroupGtMaskKHR = SubgroupGtMask,
|
||||
SubgroupLeMask = 4419,
|
||||
SubgroupLeMaskKHR = 4419,
|
||||
SubgroupLeMaskKHR = SubgroupLeMask,
|
||||
SubgroupLtMask = 4420,
|
||||
SubgroupLtMaskKHR = 4420,
|
||||
SubgroupLtMaskKHR = SubgroupLtMask,
|
||||
BaseVertex = 4424,
|
||||
BaseInstance = 4425,
|
||||
DrawIndex = 4426,
|
||||
@@ -588,36 +588,36 @@ namespace Spv
|
||||
BaryCoordNV = 5286,
|
||||
BaryCoordNoPerspNV = 5287,
|
||||
FragSizeEXT = 5292,
|
||||
FragmentSizeNV = 5292,
|
||||
FragmentSizeNV = FragSizeEXT,
|
||||
FragInvocationCountEXT = 5293,
|
||||
InvocationsPerPixelNV = 5293,
|
||||
InvocationsPerPixelNV = FragInvocationCountEXT,
|
||||
LaunchIdKHR = 5319,
|
||||
LaunchIdNV = 5319,
|
||||
LaunchIdNV = LaunchIdKHR,
|
||||
LaunchSizeKHR = 5320,
|
||||
LaunchSizeNV = 5320,
|
||||
LaunchSizeNV = LaunchSizeKHR,
|
||||
WorldRayOriginKHR = 5321,
|
||||
WorldRayOriginNV = 5321,
|
||||
WorldRayOriginNV = WorldRayOriginKHR,
|
||||
WorldRayDirectionKHR = 5322,
|
||||
WorldRayDirectionNV = 5322,
|
||||
WorldRayDirectionNV = WorldRayDirectionKHR,
|
||||
ObjectRayOriginKHR = 5323,
|
||||
ObjectRayOriginNV = 5323,
|
||||
ObjectRayOriginNV = ObjectRayOriginKHR,
|
||||
ObjectRayDirectionKHR = 5324,
|
||||
ObjectRayDirectionNV = 5324,
|
||||
ObjectRayDirectionNV = ObjectRayDirectionKHR,
|
||||
RayTminKHR = 5325,
|
||||
RayTminNV = 5325,
|
||||
RayTminNV = RayTminKHR,
|
||||
RayTmaxKHR = 5326,
|
||||
RayTmaxNV = 5326,
|
||||
RayTmaxNV = RayTmaxKHR,
|
||||
InstanceCustomIndexKHR = 5327,
|
||||
InstanceCustomIndexNV = 5327,
|
||||
InstanceCustomIndexNV = InstanceCustomIndexKHR,
|
||||
ObjectToWorldKHR = 5330,
|
||||
ObjectToWorldNV = 5330,
|
||||
ObjectToWorldNV = ObjectToWorldKHR,
|
||||
WorldToObjectKHR = 5331,
|
||||
WorldToObjectNV = 5331,
|
||||
WorldToObjectNV = WorldToObjectKHR,
|
||||
HitTNV = 5332,
|
||||
HitKindKHR = 5333,
|
||||
HitKindNV = 5333,
|
||||
HitKindNV = HitKindKHR,
|
||||
IncomingRayFlagsKHR = 5351,
|
||||
IncomingRayFlagsNV = 5351,
|
||||
IncomingRayFlagsNV = IncomingRayFlagsKHR,
|
||||
RayGeometryIndexKHR = 5352,
|
||||
WarpsPerSMNV = 5374,
|
||||
SMCountNV = 5375,
|
||||
@@ -709,11 +709,11 @@ namespace Spv
|
||||
AtomicCounterMemory = 10,
|
||||
ImageMemory = 11,
|
||||
OutputMemory = 12,
|
||||
OutputMemoryKHR = 12,
|
||||
OutputMemoryKHR = OutputMemory,
|
||||
MakeAvailable = 13,
|
||||
MakeAvailableKHR = 13,
|
||||
MakeAvailableKHR = MakeAvailable,
|
||||
MakeVisible = 14,
|
||||
MakeVisibleKHR = 14,
|
||||
MakeVisibleKHR = MakeVisible,
|
||||
Volatile = 15,
|
||||
}
|
||||
|
||||
@@ -731,11 +731,11 @@ namespace Spv
|
||||
AtomicCounterMemory = 0x00000400,
|
||||
ImageMemory = 0x00000800,
|
||||
OutputMemory = 0x00001000,
|
||||
OutputMemoryKHR = 0x00001000,
|
||||
OutputMemoryKHR = OutputMemory,
|
||||
MakeAvailable = 0x00002000,
|
||||
MakeAvailableKHR = 0x00002000,
|
||||
MakeAvailableKHR = MakeAvailable,
|
||||
MakeVisible = 0x00004000,
|
||||
MakeVisibleKHR = 0x00004000,
|
||||
MakeVisibleKHR = MakeVisible,
|
||||
Volatile = 0x00008000,
|
||||
}
|
||||
|
||||
@@ -745,11 +745,11 @@ namespace Spv
|
||||
Aligned = 1,
|
||||
Nontemporal = 2,
|
||||
MakePointerAvailable = 3,
|
||||
MakePointerAvailableKHR = 3,
|
||||
MakePointerAvailableKHR = MakePointerAvailable,
|
||||
MakePointerVisible = 4,
|
||||
MakePointerVisibleKHR = 4,
|
||||
MakePointerVisibleKHR = MakePointerVisible,
|
||||
NonPrivatePointer = 5,
|
||||
NonPrivatePointerKHR = 5,
|
||||
NonPrivatePointerKHR = NonPrivatePointer,
|
||||
}
|
||||
|
||||
public enum MemoryAccessMask
|
||||
@@ -759,11 +759,11 @@ namespace Spv
|
||||
Aligned = 0x00000002,
|
||||
Nontemporal = 0x00000004,
|
||||
MakePointerAvailable = 0x00000008,
|
||||
MakePointerAvailableKHR = 0x00000008,
|
||||
MakePointerAvailableKHR = MakePointerAvailable,
|
||||
MakePointerVisible = 0x00000010,
|
||||
MakePointerVisibleKHR = 0x00000010,
|
||||
MakePointerVisibleKHR = MakePointerVisible,
|
||||
NonPrivatePointer = 0x00000020,
|
||||
NonPrivatePointerKHR = 0x00000020,
|
||||
NonPrivatePointerKHR = NonPrivatePointer,
|
||||
}
|
||||
|
||||
public enum Scope
|
||||
@@ -774,7 +774,7 @@ namespace Spv
|
||||
Subgroup = 3,
|
||||
Invocation = 4,
|
||||
QueueFamily = 5,
|
||||
QueueFamilyKHR = 5,
|
||||
QueueFamilyKHR = QueueFamily,
|
||||
ShaderCallKHR = 6,
|
||||
}
|
||||
|
||||
@@ -883,9 +883,9 @@ namespace Spv
|
||||
DrawParameters = 4427,
|
||||
SubgroupVoteKHR = 4431,
|
||||
StorageBuffer16BitAccess = 4433,
|
||||
StorageUniformBufferBlock16 = 4433,
|
||||
StorageUniformBufferBlock16 = StorageBuffer16BitAccess,
|
||||
StorageUniform16 = 4434,
|
||||
UniformAndStorageBuffer16BitAccess = 4434,
|
||||
UniformAndStorageBuffer16BitAccess = StorageUniform16,
|
||||
StoragePushConstant16 = 4435,
|
||||
StorageInputOutput16 = 4436,
|
||||
DeviceGroup = 4437,
|
||||
@@ -916,7 +916,7 @@ namespace Spv
|
||||
SampleMaskOverrideCoverageNV = 5249,
|
||||
GeometryShaderPassthroughNV = 5251,
|
||||
ShaderViewportIndexLayerEXT = 5254,
|
||||
ShaderViewportIndexLayerNV = 5254,
|
||||
ShaderViewportIndexLayerNV = ShaderViewportIndexLayerEXT,
|
||||
ShaderViewportMaskNV = 5255,
|
||||
ShaderStereoViewNV = 5259,
|
||||
PerViewAttributesNV = 5260,
|
||||
@@ -926,39 +926,39 @@ namespace Spv
|
||||
FragmentBarycentricNV = 5284,
|
||||
ComputeDerivativeGroupQuadsNV = 5288,
|
||||
FragmentDensityEXT = 5291,
|
||||
ShadingRateNV = 5291,
|
||||
ShadingRateNV = FragmentDensityEXT,
|
||||
GroupNonUniformPartitionedNV = 5297,
|
||||
ShaderNonUniform = 5301,
|
||||
ShaderNonUniformEXT = 5301,
|
||||
ShaderNonUniformEXT = ShaderNonUniform,
|
||||
RuntimeDescriptorArray = 5302,
|
||||
RuntimeDescriptorArrayEXT = 5302,
|
||||
RuntimeDescriptorArrayEXT = RuntimeDescriptorArray,
|
||||
InputAttachmentArrayDynamicIndexing = 5303,
|
||||
InputAttachmentArrayDynamicIndexingEXT = 5303,
|
||||
InputAttachmentArrayDynamicIndexingEXT = InputAttachmentArrayDynamicIndexing,
|
||||
UniformTexelBufferArrayDynamicIndexing = 5304,
|
||||
UniformTexelBufferArrayDynamicIndexingEXT = 5304,
|
||||
UniformTexelBufferArrayDynamicIndexingEXT = UniformTexelBufferArrayDynamicIndexing,
|
||||
StorageTexelBufferArrayDynamicIndexing = 5305,
|
||||
StorageTexelBufferArrayDynamicIndexingEXT = 5305,
|
||||
StorageTexelBufferArrayDynamicIndexingEXT = StorageTexelBufferArrayDynamicIndexing,
|
||||
UniformBufferArrayNonUniformIndexing = 5306,
|
||||
UniformBufferArrayNonUniformIndexingEXT = 5306,
|
||||
UniformBufferArrayNonUniformIndexingEXT = UniformBufferArrayNonUniformIndexing,
|
||||
SampledImageArrayNonUniformIndexing = 5307,
|
||||
SampledImageArrayNonUniformIndexingEXT = 5307,
|
||||
SampledImageArrayNonUniformIndexingEXT = SampledImageArrayNonUniformIndexing,
|
||||
StorageBufferArrayNonUniformIndexing = 5308,
|
||||
StorageBufferArrayNonUniformIndexingEXT = 5308,
|
||||
StorageBufferArrayNonUniformIndexingEXT = StorageBufferArrayNonUniformIndexing,
|
||||
StorageImageArrayNonUniformIndexing = 5309,
|
||||
StorageImageArrayNonUniformIndexingEXT = 5309,
|
||||
StorageImageArrayNonUniformIndexingEXT = StorageImageArrayNonUniformIndexing,
|
||||
InputAttachmentArrayNonUniformIndexing = 5310,
|
||||
InputAttachmentArrayNonUniformIndexingEXT = 5310,
|
||||
InputAttachmentArrayNonUniformIndexingEXT = InputAttachmentArrayNonUniformIndexing,
|
||||
UniformTexelBufferArrayNonUniformIndexing = 5311,
|
||||
UniformTexelBufferArrayNonUniformIndexingEXT = 5311,
|
||||
UniformTexelBufferArrayNonUniformIndexingEXT = UniformTexelBufferArrayNonUniformIndexing,
|
||||
StorageTexelBufferArrayNonUniformIndexing = 5312,
|
||||
StorageTexelBufferArrayNonUniformIndexingEXT = 5312,
|
||||
StorageTexelBufferArrayNonUniformIndexingEXT = StorageTexelBufferArrayNonUniformIndexing,
|
||||
RayTracingNV = 5340,
|
||||
VulkanMemoryModel = 5345,
|
||||
VulkanMemoryModelKHR = 5345,
|
||||
VulkanMemoryModelKHR = VulkanMemoryModel,
|
||||
VulkanMemoryModelDeviceScope = 5346,
|
||||
VulkanMemoryModelDeviceScopeKHR = 5346,
|
||||
VulkanMemoryModelDeviceScopeKHR = VulkanMemoryModelDeviceScope,
|
||||
PhysicalStorageBufferAddresses = 5347,
|
||||
PhysicalStorageBufferAddressesEXT = 5347,
|
||||
PhysicalStorageBufferAddressesEXT = PhysicalStorageBufferAddresses,
|
||||
ComputeDerivativeGroupLinearNV = 5350,
|
||||
RayTracingProvisionalKHR = 5353,
|
||||
CooperativeMatrixNV = 5357,
|
||||
@@ -1433,12 +1433,12 @@ namespace Spv
|
||||
OpGroupNonUniformPartitionNV = 5296,
|
||||
OpWritePackedPrimitiveIndices4x8NV = 5299,
|
||||
OpReportIntersectionKHR = 5334,
|
||||
OpReportIntersectionNV = 5334,
|
||||
OpReportIntersectionNV = OpReportIntersectionKHR,
|
||||
OpIgnoreIntersectionNV = 5335,
|
||||
OpTerminateRayNV = 5336,
|
||||
OpTraceNV = 5337,
|
||||
OpTypeAccelerationStructureKHR = 5341,
|
||||
OpTypeAccelerationStructureNV = 5341,
|
||||
OpTypeAccelerationStructureNV = OpTypeAccelerationStructureKHR,
|
||||
OpExecuteCallableNV = 5344,
|
||||
OpTypeCooperativeMatrixNV = 5358,
|
||||
OpCooperativeMatrixLoadNV = 5359,
|
||||
@@ -1476,9 +1476,9 @@ namespace Spv
|
||||
OpFunctionPointerINTEL = 5600,
|
||||
OpFunctionPointerCallINTEL = 5601,
|
||||
OpDecorateString = 5632,
|
||||
OpDecorateStringGOOGLE = 5632,
|
||||
OpDecorateStringGOOGLE = OpDecorateString,
|
||||
OpMemberDecorateString = 5633,
|
||||
OpMemberDecorateStringGOOGLE = 5633,
|
||||
OpMemberDecorateStringGOOGLE = OpMemberDecorateString,
|
||||
OpVmeImageINTEL = 5699,
|
||||
OpTypeVmeImageINTEL = 5700,
|
||||
OpTypeAvcImePayloadINTEL = 5701,
|
||||
@@ -1622,4 +1622,3 @@ namespace Spv
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user