Update Spv.Generator

This commit is contained in:
gdk 2021-12-11 20:12:44 -03:00 committed by riperiperi
parent adfba37a3f
commit 9a95c3c3bc
19 changed files with 1819 additions and 382 deletions

View file

@ -15,8 +15,6 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
{ {
public ShaderConfig Config { get; } public ShaderConfig Config { get; }
public Instruction ExtSet { get; }
public Dictionary<int, Instruction> UniformBuffers { get; } = new Dictionary<int, Instruction>(); public Dictionary<int, Instruction> UniformBuffers { get; } = new Dictionary<int, Instruction>();
public Instruction StorageBuffersArray { get; set; } public Instruction StorageBuffersArray { get; set; }
public Instruction LocalMemory { get; set; } public Instruction LocalMemory { get; set; }
@ -68,8 +66,6 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
AddCapability(Capability.Shader); AddCapability(Capability.Shader);
AddCapability(Capability.Float64); AddCapability(Capability.Float64);
ExtSet = AddExtInstImport("GLSL.std.450");
SetMemoryModel(AddressingModel.Logical, MemoryModel.GLSL450); SetMemoryModel(AddressingModel.Logical, MemoryModel.GLSL450);
} }
@ -277,10 +273,6 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
return _functions[funcIndex]; return _functions[funcIndex];
} }
protected override void Construct()
{
}
public Instruction GetType(AggregateType type, int length = 1) public Instruction GetType(AggregateType type, int length = 1)
{ {
if (type.HasFlag(AggregateType.Array)) if (type.HasFlag(AggregateType.Array))

View file

@ -449,8 +449,8 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
AttributeConsts.ClipDistance0 => BuiltIn.ClipDistance, AttributeConsts.ClipDistance0 => BuiltIn.ClipDistance,
AttributeConsts.PointCoordX => BuiltIn.PointCoord, AttributeConsts.PointCoordX => BuiltIn.PointCoord,
AttributeConsts.TessCoordX => BuiltIn.TessCoord, AttributeConsts.TessCoordX => BuiltIn.TessCoord,
AttributeConsts.InstanceId => BuiltIn.InstanceId, AttributeConsts.InstanceId => BuiltIn.InstanceId, // FIXME: Invalid
AttributeConsts.VertexId => BuiltIn.VertexId, AttributeConsts.VertexId => BuiltIn.VertexId, // FIXME: Invalid
AttributeConsts.FrontFacing => BuiltIn.FrontFacing, AttributeConsts.FrontFacing => BuiltIn.FrontFacing,
AttributeConsts.FragmentOutputDepth => BuiltIn.FragDepth, AttributeConsts.FragmentOutputDepth => BuiltIn.FragDepth,
AttributeConsts.ThreadKill => BuiltIn.HelperInvocation, AttributeConsts.ThreadKill => BuiltIn.HelperInvocation,

View file

@ -143,7 +143,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
private static OperationResult GenerateAbsolute(CodeGenContext context, AstOperation operation) private static OperationResult GenerateAbsolute(CodeGenContext context, AstOperation operation)
{ {
return GenerateUnaryExtInst(context, operation, 4, 5); return GenerateUnary(context, operation, context.GlslFAbs, context.GlslSAbs);
} }
private static OperationResult GenerateAdd(CodeGenContext context, AstOperation operation) private static OperationResult GenerateAdd(CodeGenContext context, AstOperation operation)
@ -306,17 +306,17 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
private static OperationResult GenerateCeiling(CodeGenContext context, AstOperation operation) private static OperationResult GenerateCeiling(CodeGenContext context, AstOperation operation)
{ {
return GenerateUnaryExtInst(context, operation, 9); return GenerateUnary(context, operation, context.GlslCeil, null);
} }
private static OperationResult GenerateClamp(CodeGenContext context, AstOperation operation) private static OperationResult GenerateClamp(CodeGenContext context, AstOperation operation)
{ {
return GenerateTernaryExtInst(context, operation, 43, 45); return GenerateTernary(context, operation, context.GlslFClamp, context.GlslSClamp);
} }
private static OperationResult GenerateClampU32(CodeGenContext context, AstOperation operation) private static OperationResult GenerateClampU32(CodeGenContext context, AstOperation operation)
{ {
return GenerateTernaryExtInstU32(context, operation, 44); return GenerateTernaryU32(context, operation, context.GlslUClamp);
} }
private static OperationResult GenerateComment(CodeGenContext context, AstOperation operation) private static OperationResult GenerateComment(CodeGenContext context, AstOperation operation)
@ -468,7 +468,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
private static OperationResult GenerateCosine(CodeGenContext context, AstOperation operation) private static OperationResult GenerateCosine(CodeGenContext context, AstOperation operation)
{ {
return GenerateUnaryExtInst(context, operation, 14); return GenerateUnary(context, operation, context.GlslCos, null);
} }
private static OperationResult GenerateDdx(CodeGenContext context, AstOperation operation) private static OperationResult GenerateDdx(CodeGenContext context, AstOperation operation)
@ -494,35 +494,35 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
private static OperationResult GenerateExponentB2(CodeGenContext context, AstOperation operation) private static OperationResult GenerateExponentB2(CodeGenContext context, AstOperation operation)
{ {
return GenerateUnaryExtInst(context, operation, 29); return GenerateUnary(context, operation, context.GlslExp2, null);
} }
private static OperationResult GenerateFindLSB(CodeGenContext context, AstOperation operation) private static OperationResult GenerateFindLSB(CodeGenContext context, AstOperation operation)
{ {
var source = context.GetU32(operation.GetSource(0)); var source = context.GetU32(operation.GetSource(0));
return new OperationResult(AggregateType.U32, context.ExtInst(context.TypeU32(), context.ExtSet, 74, source)); return new OperationResult(AggregateType.U32, context.GlslFindILsb(context.TypeU32(), source));
} }
private static OperationResult GenerateFindMSBS32(CodeGenContext context, AstOperation operation) private static OperationResult GenerateFindMSBS32(CodeGenContext context, AstOperation operation)
{ {
var source = context.GetS32(operation.GetSource(0)); var source = context.GetS32(operation.GetSource(0));
return new OperationResult(AggregateType.U32, context.ExtInst(context.TypeU32(), context.ExtSet, 75, source)); return new OperationResult(AggregateType.U32, context.GlslFindSMsb(context.TypeU32(), source));
} }
private static OperationResult GenerateFindMSBU32(CodeGenContext context, AstOperation operation) private static OperationResult GenerateFindMSBU32(CodeGenContext context, AstOperation operation)
{ {
var source = context.GetU32(operation.GetSource(0)); var source = context.GetU32(operation.GetSource(0));
return new OperationResult(AggregateType.U32, context.ExtInst(context.TypeU32(), context.ExtSet, 75, source)); return new OperationResult(AggregateType.U32, context.GlslFindUMsb(context.TypeU32(), source));
} }
private static OperationResult GenerateFloor(CodeGenContext context, AstOperation operation) private static OperationResult GenerateFloor(CodeGenContext context, AstOperation operation)
{ {
return GenerateUnaryExtInst(context, operation, 8); return GenerateUnary(context, operation, context.GlslFloor, null);
} }
private static OperationResult GenerateFusedMultiplyAdd(CodeGenContext context, AstOperation operation) private static OperationResult GenerateFusedMultiplyAdd(CodeGenContext context, AstOperation operation)
{ {
return GenerateTernaryExtInst(context, operation, 50); return GenerateTernary(context, operation, context.GlslFma, null);
} }
private static OperationResult GenerateGroupMemoryBarrier(CodeGenContext context, AstOperation operation) private static OperationResult GenerateGroupMemoryBarrier(CodeGenContext context, AstOperation operation)
@ -596,7 +596,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
var image = context.Load(imageType, imageVariable); var image = context.Load(imageType, imageVariable);
var texel = context.ImageRead(context.TypeVector(context.GetType(componentType.Convert()), 4), image, pCoords); var texel = context.ImageRead(context.TypeVector(context.GetType(componentType.Convert()), 4), image, pCoords, ImageOperandsMask.MaskNone);
var result = context.CompositeExtract(context.TypeFP32(), texel, (SpvLiteralInteger)texOp.Index); var result = context.CompositeExtract(context.TypeFP32(), texel, (SpvLiteralInteger)texOp.Index);
return new OperationResult(componentType.Convert(), result); return new OperationResult(componentType.Convert(), result);
@ -683,7 +683,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
var image = context.Load(imageType, imageVariable); var image = context.Load(imageType, imageVariable);
context.ImageWrite(image, pCoords, texel); context.ImageWrite(image, pCoords, texel, ImageOperandsMask.MaskNone);
return OperationResult.Invalid; return OperationResult.Invalid;
} }
@ -831,7 +831,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
private static OperationResult GenerateLogarithmB2(CodeGenContext context, AstOperation operation) private static OperationResult GenerateLogarithmB2(CodeGenContext context, AstOperation operation)
{ {
return GenerateUnaryExtInst(context, operation, 30); return GenerateUnary(context, operation, context.GlslLog2, null);
} }
private static OperationResult GenerateLogicalAnd(CodeGenContext context, AstOperation operation) private static OperationResult GenerateLogicalAnd(CodeGenContext context, AstOperation operation)
@ -864,12 +864,12 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
private static OperationResult GenerateMaximum(CodeGenContext context, AstOperation operation) private static OperationResult GenerateMaximum(CodeGenContext context, AstOperation operation)
{ {
return GenerateBinaryExtInst(context, operation, 40, 42); return GenerateBinary(context, operation, context.GlslFMax, context.GlslSMax);
} }
private static OperationResult GenerateMaximumU32(CodeGenContext context, AstOperation operation) private static OperationResult GenerateMaximumU32(CodeGenContext context, AstOperation operation)
{ {
return GenerateBinaryExtInstU32(context, operation, 41); return GenerateBinaryU32(context, operation, context.GlslUMax);
} }
private static OperationResult GenerateMemoryBarrier(CodeGenContext context, AstOperation operation) private static OperationResult GenerateMemoryBarrier(CodeGenContext context, AstOperation operation)
@ -880,12 +880,12 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
private static OperationResult GenerateMinimum(CodeGenContext context, AstOperation operation) private static OperationResult GenerateMinimum(CodeGenContext context, AstOperation operation)
{ {
return GenerateBinaryExtInst(context, operation, 37, 39); return GenerateBinary(context, operation, context.GlslFMin, context.GlslSMin);
} }
private static OperationResult GenerateMinimumU32(CodeGenContext context, AstOperation operation) private static OperationResult GenerateMinimumU32(CodeGenContext context, AstOperation operation)
{ {
return GenerateBinaryExtInstU32(context, operation, 38); return GenerateBinaryU32(context, operation, context.GlslUMin);
} }
private static OperationResult GenerateMultiply(CodeGenContext context, AstOperation operation) private static OperationResult GenerateMultiply(CodeGenContext context, AstOperation operation)
@ -903,14 +903,14 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
var value0 = context.GetFP32(operation.GetSource(0)); var value0 = context.GetFP32(operation.GetSource(0));
var value1 = context.GetFP32(operation.GetSource(1)); var value1 = context.GetFP32(operation.GetSource(1));
var vector = context.CompositeConstruct(context.TypeVector(context.TypeFP32(), 2), value0, value1); var vector = context.CompositeConstruct(context.TypeVector(context.TypeFP32(), 2), value0, value1);
var result = context.ExtInst(context.TypeU32(), context.ExtSet, 58, vector); var result = context.GlslPackHalf2x16(context.TypeU32(), vector);
return new OperationResult(AggregateType.U32, result); return new OperationResult(AggregateType.U32, result);
} }
private static OperationResult GenerateReciprocalSquareRoot(CodeGenContext context, AstOperation operation) private static OperationResult GenerateReciprocalSquareRoot(CodeGenContext context, AstOperation operation)
{ {
return GenerateUnaryExtInst(context, operation, 32); return GenerateUnary(context, operation, context.GlslInverseSqrt, null);
} }
private static OperationResult GenerateReturn(CodeGenContext context, AstOperation operation) private static OperationResult GenerateReturn(CodeGenContext context, AstOperation operation)
@ -921,7 +921,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
private static OperationResult GenerateRound(CodeGenContext context, AstOperation operation) private static OperationResult GenerateRound(CodeGenContext context, AstOperation operation)
{ {
return GenerateUnaryExtInst(context, operation, 2); return GenerateUnary(context, operation, context.GlslRoundEven, null);
} }
private static OperationResult GenerateShiftLeft(CodeGenContext context, AstOperation operation) private static OperationResult GenerateShiftLeft(CodeGenContext context, AstOperation operation)
@ -1064,12 +1064,12 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
private static OperationResult GenerateSine(CodeGenContext context, AstOperation operation) private static OperationResult GenerateSine(CodeGenContext context, AstOperation operation)
{ {
return GenerateUnaryExtInst(context, operation, 13); return GenerateUnary(context, operation, context.GlslSin, null);
} }
private static OperationResult GenerateSquareRoot(CodeGenContext context, AstOperation operation) private static OperationResult GenerateSquareRoot(CodeGenContext context, AstOperation operation)
{ {
return GenerateUnaryExtInst(context, operation, 31); return GenerateUnary(context, operation, context.GlslSqrt, null);
} }
private static OperationResult GenerateStoreLocal(CodeGenContext context, AstOperation operation) private static OperationResult GenerateStoreLocal(CodeGenContext context, AstOperation operation)
@ -1461,13 +1461,13 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
private static OperationResult GenerateTruncate(CodeGenContext context, AstOperation operation) private static OperationResult GenerateTruncate(CodeGenContext context, AstOperation operation)
{ {
return GenerateUnaryExtInst(context, operation, 3); return GenerateUnary(context, operation, context.GlslTrunc, null);
} }
private static OperationResult GenerateUnpackHalf2x16(CodeGenContext context, AstOperation operation) private static OperationResult GenerateUnpackHalf2x16(CodeGenContext context, AstOperation operation)
{ {
var value = context.GetU32(operation.GetSource(0)); var value = context.GetU32(operation.GetSource(0));
var vector = context.ExtInst(context.TypeVector(context.TypeFP32(), 2), context.ExtSet, 62, value); var vector = context.GlslUnpackHalf2x16(context.TypeVector(context.TypeFP32(), 2), value);
var result = context.CompositeExtract(context.TypeFP32(), vector, operation.Index); var result = context.CompositeExtract(context.TypeFP32(), vector, operation.Index);
return new OperationResult(AggregateType.FP32, result); return new OperationResult(AggregateType.FP32, result);
@ -1648,38 +1648,6 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
return new OperationResult(AggregateType.S32, emitS(context.TypeS32(), context.GetS32(source))); return new OperationResult(AggregateType.S32, emitS(context.TypeS32(), context.GetS32(source)));
} }
private static OperationResult GenerateUnaryExtInst(CodeGenContext context, AstOperation operation, int instruction)
{
var source = operation.GetSource(0);
if (operation.Inst.HasFlag(Instruction.FP64))
{
return new OperationResult(AggregateType.FP64, context.ExtInst(context.TypeFP64(), context.ExtSet, instruction, context.GetFP64(source)));
}
else
{
return new OperationResult(AggregateType.FP32, context.ExtInst(context.TypeFP32(), context.ExtSet, instruction, context.GetFP32(source)));
}
}
private static OperationResult GenerateUnaryExtInst(CodeGenContext context, AstOperation operation, int instF, int instS)
{
var source = operation.GetSource(0);
if (operation.Inst.HasFlag(Instruction.FP64))
{
return new OperationResult(AggregateType.FP64, context.ExtInst(context.TypeFP64(), context.ExtSet, instF, context.GetFP64(source)));
}
else if (operation.Inst.HasFlag(Instruction.FP32))
{
return new OperationResult(AggregateType.FP32, context.ExtInst(context.TypeFP32(), context.ExtSet, instF, context.GetFP32(source)));
}
else
{
return new OperationResult(AggregateType.S32, context.ExtInst(context.TypeS32(), context.ExtSet, instS, context.GetS32(source)));
}
}
private static OperationResult GenerateBinary( private static OperationResult GenerateBinary(
CodeGenContext context, CodeGenContext context,
AstOperation operation, AstOperation operation,
@ -1729,33 +1697,45 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
return new OperationResult(AggregateType.S32, emitS(context.TypeS32(), context.GetS32(src1), context.GetS32(src2))); return new OperationResult(AggregateType.S32, emitS(context.TypeS32(), context.GetS32(src1), context.GetS32(src2)));
} }
private static OperationResult GenerateBinaryExtInst(CodeGenContext context, AstOperation operation, int instF, int instS) private static OperationResult GenerateBinaryU32(
CodeGenContext context,
AstOperation operation,
Func<SpvInstruction, SpvInstruction, SpvInstruction, SpvInstruction> emitU)
{ {
var src1 = operation.GetSource(0); var src1 = operation.GetSource(0);
var src2 = operation.GetSource(1); var src2 = operation.GetSource(1);
return new OperationResult(AggregateType.U32, emitU(context.TypeU32(), context.GetU32(src1), context.GetU32(src2)));
}
private static OperationResult GenerateTernary(
CodeGenContext context,
AstOperation operation,
Func<SpvInstruction, SpvInstruction, SpvInstruction, SpvInstruction, SpvInstruction> emitF,
Func<SpvInstruction, SpvInstruction, SpvInstruction, SpvInstruction, SpvInstruction> emitI)
{
var src1 = operation.GetSource(0);
var src2 = operation.GetSource(1);
var src3 = operation.GetSource(2);
if (operation.Inst.HasFlag(Instruction.FP64)) if (operation.Inst.HasFlag(Instruction.FP64))
{ {
return new OperationResult(AggregateType.FP64, context.ExtInst(context.TypeFP64(), context.ExtSet, instF, context.GetFP64(src1), context.GetFP64(src2))); var result = emitF(context.TypeFP64(), context.GetFP64(src1), context.GetFP64(src2), context.GetFP64(src3));
context.Decorate(result, Decoration.NoContraction);
return new OperationResult(AggregateType.FP64, result);
} }
else if (operation.Inst.HasFlag(Instruction.FP32)) else if (operation.Inst.HasFlag(Instruction.FP32))
{ {
return new OperationResult(AggregateType.FP32, context.ExtInst(context.TypeFP32(), context.ExtSet, instF, context.GetFP32(src1), context.GetFP32(src2))); var result = emitF(context.TypeFP32(), context.GetFP32(src1), context.GetFP32(src2), context.GetFP32(src3));
context.Decorate(result, Decoration.NoContraction);
return new OperationResult(AggregateType.FP32, result);
} }
else else
{ {
return new OperationResult(AggregateType.S32, context.ExtInst(context.TypeS32(), context.ExtSet, instS, context.GetS32(src1), context.GetS32(src2))); return new OperationResult(AggregateType.S32, emitI(context.TypeS32(), context.GetS32(src1), context.GetS32(src2), context.GetS32(src3)));
} }
} }
private static OperationResult GenerateBinaryExtInstU32(CodeGenContext context, AstOperation operation, int instU)
{
var src1 = operation.GetSource(0);
var src2 = operation.GetSource(1);
return new OperationResult(AggregateType.U32, context.ExtInst(context.TypeU32(), context.ExtSet, instU, context.GetU32(src1), context.GetU32(src2)));
}
private static OperationResult GenerateTernaryS32( private static OperationResult GenerateTernaryS32(
CodeGenContext context, CodeGenContext context,
AstOperation operation, AstOperation operation,
@ -1772,82 +1752,17 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Spirv
context.GetS32(src3))); context.GetS32(src3)));
} }
private static OperationResult GenerateTernaryExtInst(CodeGenContext context, AstOperation operation, int instF) private static OperationResult GenerateTernaryU32(
CodeGenContext context,
AstOperation operation,
Func<SpvInstruction, SpvInstruction, SpvInstruction, SpvInstruction, SpvInstruction> emitU)
{ {
var src1 = operation.GetSource(0); var src1 = operation.GetSource(0);
var src2 = operation.GetSource(1); var src2 = operation.GetSource(1);
var src3 = operation.GetSource(2); var src3 = operation.GetSource(2);
if (operation.Inst.HasFlag(Instruction.FP64)) return new OperationResult(AggregateType.U32, emitU(
{
return new OperationResult(AggregateType.FP64, context.ExtInst(
context.TypeFP64(),
context.ExtSet,
instF,
context.GetFP64(src1),
context.GetFP64(src2),
context.GetFP64(src3)));
}
else
{
return new OperationResult(AggregateType.FP32, context.ExtInst(
context.TypeFP32(),
context.ExtSet,
instF,
context.GetFP32(src1),
context.GetFP32(src2),
context.GetFP32(src3)));
}
}
private static OperationResult GenerateTernaryExtInst(CodeGenContext context, AstOperation operation, int instF, int instS)
{
var src1 = operation.GetSource(0);
var src2 = operation.GetSource(1);
var src3 = operation.GetSource(2);
if (operation.Inst.HasFlag(Instruction.FP64))
{
return new OperationResult(AggregateType.FP64, context.ExtInst(
context.TypeFP64(),
context.ExtSet,
instF,
context.GetFP64(src1),
context.GetFP64(src2),
context.GetFP64(src3)));
}
else if (operation.Inst.HasFlag(Instruction.FP32))
{
return new OperationResult(AggregateType.FP32, context.ExtInst(
context.TypeFP32(),
context.ExtSet,
instF,
context.GetFP32(src1),
context.GetFP32(src2),
context.GetFP32(src3)));
}
else
{
return new OperationResult(AggregateType.S32, context.ExtInst(
context.TypeS32(),
context.ExtSet,
instS,
context.GetS32(src1),
context.GetS32(src2),
context.GetS32(src3)));
}
}
private static OperationResult GenerateTernaryExtInstU32(CodeGenContext context, AstOperation operation, int instU)
{
var src1 = operation.GetSource(0);
var src2 = operation.GetSource(1);
var src3 = operation.GetSource(2);
return new OperationResult(AggregateType.U32, context.ExtInst(
context.TypeU32(), context.TypeU32(),
context.ExtSet,
instU,
context.GetU32(src1), context.GetU32(src1),
context.GetU32(src2), context.GetU32(src2),
context.GetU32(src3))); context.GetU32(src3)));

View file

@ -10,7 +10,7 @@
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Ryujinx.Common\Ryujinx.Common.csproj" /> <ProjectReference Include="..\Ryujinx.Common\Ryujinx.Common.csproj" />
<ProjectReference Include="..\SpvGen\Spv.Generator.csproj" /> <ProjectReference Include="..\Spv.Generator\Spv.Generator.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View file

@ -7,44 +7,44 @@ namespace Ryujinx.Graphics.Shader.Translation
{ {
private static readonly Dictionary<int, AttributeInfo> BuiltInAttributes = new Dictionary<int, AttributeInfo>() private static readonly Dictionary<int, AttributeInfo> BuiltInAttributes = new Dictionary<int, AttributeInfo>()
{ {
{ AttributeConsts.Layer, new AttributeInfo(AttributeConsts.Layer, 1, AggregateType.S32) }, { AttributeConsts.Layer, new AttributeInfo(AttributeConsts.Layer, 0, 1, AggregateType.S32) },
{ AttributeConsts.ViewportIndex, new AttributeInfo(AttributeConsts.ViewportIndex, 1, AggregateType.S32) }, { AttributeConsts.ViewportIndex, new AttributeInfo(AttributeConsts.ViewportIndex, 0, 1, AggregateType.S32) },
{ AttributeConsts.PointSize, new AttributeInfo(AttributeConsts.PointSize, 1, AggregateType.FP32) }, { AttributeConsts.PointSize, new AttributeInfo(AttributeConsts.PointSize, 0, 1, AggregateType.FP32) },
{ AttributeConsts.PositionX, new AttributeInfo(AttributeConsts.PositionX, 4, AggregateType.Vector | AggregateType.FP32) }, { AttributeConsts.PositionX, new AttributeInfo(AttributeConsts.PositionX, 0, 4, AggregateType.Vector | AggregateType.FP32) },
{ AttributeConsts.PositionY, new AttributeInfo(AttributeConsts.PositionY, 4, AggregateType.Vector | AggregateType.FP32) }, { AttributeConsts.PositionY, new AttributeInfo(AttributeConsts.PositionX, 1, 4, AggregateType.Vector | AggregateType.FP32) },
{ AttributeConsts.PositionZ, new AttributeInfo(AttributeConsts.PositionZ, 4, AggregateType.Vector | AggregateType.FP32) }, { AttributeConsts.PositionZ, new AttributeInfo(AttributeConsts.PositionX, 2, 4, AggregateType.Vector | AggregateType.FP32) },
{ AttributeConsts.PositionW, new AttributeInfo(AttributeConsts.PositionW, 4, AggregateType.Vector | AggregateType.FP32) }, { AttributeConsts.PositionW, new AttributeInfo(AttributeConsts.PositionX, 3, 4, AggregateType.Vector | AggregateType.FP32) },
{ AttributeConsts.ClipDistance0, new AttributeInfo(AttributeConsts.ClipDistance0, 8, AggregateType.Array | AggregateType.FP32) }, { AttributeConsts.ClipDistance0, new AttributeInfo(AttributeConsts.ClipDistance0, 0, 8, AggregateType.Array | AggregateType.FP32) },
{ AttributeConsts.ClipDistance1, new AttributeInfo(AttributeConsts.ClipDistance1, 8, AggregateType.Array | AggregateType.FP32) }, { AttributeConsts.ClipDistance1, new AttributeInfo(AttributeConsts.ClipDistance0, 1, 8, AggregateType.Array | AggregateType.FP32) },
{ AttributeConsts.ClipDistance2, new AttributeInfo(AttributeConsts.ClipDistance2, 8, AggregateType.Array | AggregateType.FP32) }, { AttributeConsts.ClipDistance2, new AttributeInfo(AttributeConsts.ClipDistance0, 2, 8, AggregateType.Array | AggregateType.FP32) },
{ AttributeConsts.ClipDistance3, new AttributeInfo(AttributeConsts.ClipDistance3, 8, AggregateType.Array | AggregateType.FP32) }, { AttributeConsts.ClipDistance3, new AttributeInfo(AttributeConsts.ClipDistance0, 3, 8, AggregateType.Array | AggregateType.FP32) },
{ AttributeConsts.ClipDistance4, new AttributeInfo(AttributeConsts.ClipDistance4, 8, AggregateType.Array | AggregateType.FP32) }, { AttributeConsts.ClipDistance4, new AttributeInfo(AttributeConsts.ClipDistance0, 4, 8, AggregateType.Array | AggregateType.FP32) },
{ AttributeConsts.ClipDistance5, new AttributeInfo(AttributeConsts.ClipDistance5, 8, AggregateType.Array | AggregateType.FP32) }, { AttributeConsts.ClipDistance5, new AttributeInfo(AttributeConsts.ClipDistance0, 5, 8, AggregateType.Array | AggregateType.FP32) },
{ AttributeConsts.ClipDistance6, new AttributeInfo(AttributeConsts.ClipDistance6, 8, AggregateType.Array | AggregateType.FP32) }, { AttributeConsts.ClipDistance6, new AttributeInfo(AttributeConsts.ClipDistance0, 6, 8, AggregateType.Array | AggregateType.FP32) },
{ AttributeConsts.ClipDistance7, new AttributeInfo(AttributeConsts.ClipDistance7, 8, AggregateType.Array | AggregateType.FP32) }, { AttributeConsts.ClipDistance7, new AttributeInfo(AttributeConsts.ClipDistance0, 7, 8, AggregateType.Array | AggregateType.FP32) },
{ AttributeConsts.PointCoordX, new AttributeInfo(AttributeConsts.PointCoordX, 2, AggregateType.Vector | AggregateType.FP32) }, { AttributeConsts.PointCoordX, new AttributeInfo(AttributeConsts.PointCoordX, 0, 2, AggregateType.Vector | AggregateType.FP32) },
{ AttributeConsts.PointCoordY, new AttributeInfo(AttributeConsts.PointCoordY, 2, AggregateType.Vector | AggregateType.FP32) }, { AttributeConsts.PointCoordY, new AttributeInfo(AttributeConsts.PointCoordX, 1, 2, AggregateType.Vector | AggregateType.FP32) },
{ AttributeConsts.TessCoordX, new AttributeInfo(AttributeConsts.TessCoordX, 2, AggregateType.Vector | AggregateType.FP32) }, { AttributeConsts.TessCoordX, new AttributeInfo(AttributeConsts.TessCoordX, 0, 2, AggregateType.Vector | AggregateType.FP32) },
{ AttributeConsts.TessCoordY, new AttributeInfo(AttributeConsts.TessCoordY, 2, AggregateType.Vector | AggregateType.FP32) }, { AttributeConsts.TessCoordY, new AttributeInfo(AttributeConsts.TessCoordX, 1, 2, AggregateType.Vector | AggregateType.FP32) },
{ AttributeConsts.InstanceId, new AttributeInfo(AttributeConsts.InstanceId, 1, AggregateType.S32) }, { AttributeConsts.InstanceId, new AttributeInfo(AttributeConsts.InstanceId, 0, 1, AggregateType.S32) },
{ AttributeConsts.VertexId, new AttributeInfo(AttributeConsts.VertexId, 1, AggregateType.S32) }, { AttributeConsts.VertexId, new AttributeInfo(AttributeConsts.VertexId, 0, 1, AggregateType.S32) },
{ AttributeConsts.FrontFacing, new AttributeInfo(AttributeConsts.FrontFacing, 1, AggregateType.Bool) }, { AttributeConsts.FrontFacing, new AttributeInfo(AttributeConsts.FrontFacing, 0, 1, AggregateType.Bool) },
// Special. // Special.
{ AttributeConsts.FragmentOutputDepth, new AttributeInfo(AttributeConsts.FragmentOutputDepth, 1, AggregateType.FP32) }, { AttributeConsts.FragmentOutputDepth, new AttributeInfo(AttributeConsts.FragmentOutputDepth, 0, 1, AggregateType.FP32) },
{ AttributeConsts.ThreadKill, new AttributeInfo(AttributeConsts.ThreadKill, 1, AggregateType.Bool) }, { AttributeConsts.ThreadKill, new AttributeInfo(AttributeConsts.ThreadKill, 0, 1, AggregateType.Bool) },
{ AttributeConsts.ThreadIdX, new AttributeInfo(AttributeConsts.ThreadIdX, 3, AggregateType.Vector | AggregateType.U32) }, { AttributeConsts.ThreadIdX, new AttributeInfo(AttributeConsts.ThreadIdX, 0, 3, AggregateType.Vector | AggregateType.U32) },
{ AttributeConsts.ThreadIdY, new AttributeInfo(AttributeConsts.ThreadIdY, 3, AggregateType.Vector | AggregateType.U32) }, { AttributeConsts.ThreadIdY, new AttributeInfo(AttributeConsts.ThreadIdX, 1, 3, AggregateType.Vector | AggregateType.U32) },
{ AttributeConsts.ThreadIdZ, new AttributeInfo(AttributeConsts.ThreadIdZ, 3, AggregateType.Vector | AggregateType.U32) }, { AttributeConsts.ThreadIdZ, new AttributeInfo(AttributeConsts.ThreadIdX, 2, 3, AggregateType.Vector | AggregateType.U32) },
{ AttributeConsts.CtaIdX, new AttributeInfo(AttributeConsts.CtaIdX, 3, AggregateType.Vector | AggregateType.U32) }, { AttributeConsts.CtaIdX, new AttributeInfo(AttributeConsts.CtaIdX, 0, 3, AggregateType.Vector | AggregateType.U32) },
{ AttributeConsts.CtaIdY, new AttributeInfo(AttributeConsts.CtaIdY, 3, AggregateType.Vector | AggregateType.U32) }, { AttributeConsts.CtaIdY, new AttributeInfo(AttributeConsts.CtaIdX, 1, 3, AggregateType.Vector | AggregateType.U32) },
{ AttributeConsts.CtaIdZ, new AttributeInfo(AttributeConsts.CtaIdZ, 3, AggregateType.Vector | AggregateType.U32) }, { AttributeConsts.CtaIdZ, new AttributeInfo(AttributeConsts.CtaIdX, 2, 3, AggregateType.Vector | AggregateType.U32) },
{ AttributeConsts.LaneId, new AttributeInfo(AttributeConsts.LaneId, 1, AggregateType.U32) }, { AttributeConsts.LaneId, new AttributeInfo(AttributeConsts.LaneId, 0, 1, AggregateType.U32) },
{ AttributeConsts.EqMask, new AttributeInfo(AttributeConsts.EqMask, 1, AggregateType.U32) }, { AttributeConsts.EqMask, new AttributeInfo(AttributeConsts.EqMask, 0, 4, AggregateType.Vector | AggregateType.U32) },
{ AttributeConsts.GeMask, new AttributeInfo(AttributeConsts.GeMask, 1, AggregateType.U32) }, { AttributeConsts.GeMask, new AttributeInfo(AttributeConsts.GeMask, 0, 4, AggregateType.Vector | AggregateType.U32) },
{ AttributeConsts.GtMask, new AttributeInfo(AttributeConsts.GtMask, 1, AggregateType.U32) }, { AttributeConsts.GtMask, new AttributeInfo(AttributeConsts.GtMask, 0, 4, AggregateType.Vector | AggregateType.U32) },
{ AttributeConsts.LeMask, new AttributeInfo(AttributeConsts.LeMask, 1, AggregateType.U32) }, { AttributeConsts.LeMask, new AttributeInfo(AttributeConsts.LeMask, 0, 4, AggregateType.Vector | AggregateType.U32) },
{ AttributeConsts.LtMask, new AttributeInfo(AttributeConsts.LtMask, 1, AggregateType.U32) }, { AttributeConsts.LtMask, new AttributeInfo(AttributeConsts.LtMask, 0, 4, AggregateType.Vector | AggregateType.U32) },
}; };
public int BaseValue { get; } public int BaseValue { get; }
@ -54,10 +54,10 @@ namespace Ryujinx.Graphics.Shader.Translation
public bool IsBuiltin { get; } public bool IsBuiltin { get; }
public bool IsValid => Type != AggregateType.Invalid; public bool IsValid => Type != AggregateType.Invalid;
public AttributeInfo(int value, int length, AggregateType type, bool isBuiltin = true) public AttributeInfo(int baseValue, int index, int length, AggregateType type, bool isBuiltin = true)
{ {
BaseValue = value & ~(BitUtils.Pow2RoundUp(length) * 4 - 1); BaseValue = baseValue;
Value = value; Value = baseValue + index * 4;
Length = length; Length = length;
Type = type; Type = type;
IsBuiltin = isBuiltin; IsBuiltin = isBuiltin;
@ -82,18 +82,18 @@ namespace Ryujinx.Graphics.Shader.Translation
_ => AggregateType.FP32 _ => AggregateType.FP32
}; };
return new AttributeInfo(value, 4, AggregateType.Vector | elemType, false); return new AttributeInfo(value & ~0xf, (value >> 2) & 3, 4, AggregateType.Vector | elemType, false);
} }
else if (value >= AttributeConsts.FragmentOutputColorBase && value < AttributeConsts.FragmentOutputColorEnd) else if (value >= AttributeConsts.FragmentOutputColorBase && value < AttributeConsts.FragmentOutputColorEnd)
{ {
return new AttributeInfo(value, 4, AggregateType.Vector | AggregateType.FP32, false); return new AttributeInfo(value & ~0xf, (value >> 2) & 3, 4, AggregateType.Vector | AggregateType.FP32, false);
} }
else if (BuiltInAttributes.TryGetValue(value, out AttributeInfo info)) else if (BuiltInAttributes.TryGetValue(value, out AttributeInfo info))
{ {
return info; return info;
} }
return new AttributeInfo(value, 0, AggregateType.Invalid); return new AttributeInfo(value, 0, 0, AggregateType.Invalid);
} }
} }
} }

View file

@ -76,7 +76,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Ryujinx.Horizon.Generators"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ryujinx.Graphics.Vulkan", "Ryujinx.Graphics.Vulkan\Ryujinx.Graphics.Vulkan.csproj", "{D4D09B08-D580-4D69-B886-C35D2853F6C8}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Ryujinx.Graphics.Vulkan", "Ryujinx.Graphics.Vulkan\Ryujinx.Graphics.Vulkan.csproj", "{D4D09B08-D580-4D69-B886-C35D2853F6C8}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Spv.Generator", "SpvGen\Spv.Generator.csproj", "{D0720AC9-8AE7-417C-AB39-82CE984045C4}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Spv.Generator", "Spv.Generator\Spv.Generator.csproj", "{2BCB3D7A-38C0-4FE7-8FDA-374C6AD56D0E}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -220,10 +220,10 @@ Global
{D4D09B08-D580-4D69-B886-C35D2853F6C8}.Debug|Any CPU.Build.0 = Debug|Any CPU {D4D09B08-D580-4D69-B886-C35D2853F6C8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D4D09B08-D580-4D69-B886-C35D2853F6C8}.Release|Any CPU.ActiveCfg = Release|Any CPU {D4D09B08-D580-4D69-B886-C35D2853F6C8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D4D09B08-D580-4D69-B886-C35D2853F6C8}.Release|Any CPU.Build.0 = Release|Any CPU {D4D09B08-D580-4D69-B886-C35D2853F6C8}.Release|Any CPU.Build.0 = Release|Any CPU
{D0720AC9-8AE7-417C-AB39-82CE984045C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {2BCB3D7A-38C0-4FE7-8FDA-374C6AD56D0E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D0720AC9-8AE7-417C-AB39-82CE984045C4}.Debug|Any CPU.Build.0 = Debug|Any CPU {2BCB3D7A-38C0-4FE7-8FDA-374C6AD56D0E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D0720AC9-8AE7-417C-AB39-82CE984045C4}.Release|Any CPU.ActiveCfg = Release|Any CPU {2BCB3D7A-38C0-4FE7-8FDA-374C6AD56D0E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D0720AC9-8AE7-417C-AB39-82CE984045C4}.Release|Any CPU.Build.0 = Release|Any CPU {2BCB3D7A-38C0-4FE7-8FDA-374C6AD56D0E}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View file

@ -1,5 +1,5 @@
// AUTOGENERATED: DO NOT EDIT // AUTOGENERATED: DO NOT EDIT
// Last update date: 2020-05-20 22:58:10.704809 // Last update date: 2021-01-06 23:02:26.837899
#region Grammar License #region Grammar License
// Copyright (c) 2014-2020 The Khronos Group Inc. // Copyright (c) 2014-2020 The Khronos Group Inc.
// //
@ -62,18 +62,6 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction ExtInst(Instruction resultType, Instruction set, LiteralInteger instruction, params Instruction[] parameters)
{
Instruction result = new Instruction(Op.OpExtInst, GetNewId(), resultType);
result.AddOperand(set);
result.AddOperand(instruction);
result.AddOperand(parameters);
AddToFunctionDefinitions(result);
return result;
}
// Debug // Debug
public Instruction SourceContinued(string continuedSource) public Instruction SourceContinued(string continuedSource)
@ -901,53 +889,62 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction ImageSampleImplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] operands) public Instruction ImageSampleImplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = new Instruction(Op.OpImageSampleImplicitLod, GetNewId(), resultType); Instruction result = new Instruction(Op.OpImageSampleImplicitLod, GetNewId(), resultType);
result.AddOperand(sampledImage); result.AddOperand(sampledImage);
result.AddOperand(coordinate); result.AddOperand(coordinate);
if (imageOperands != ImageOperandsMask.MaskNone) if (imageOperands != (ImageOperandsMask)int.MaxValue)
{ {
result.AddOperand(imageOperands); result.AddOperand(imageOperands);
result.AddOperand(operands); }
if (imageOperands != (ImageOperandsMask)int.MaxValue)
{
result.AddOperand(imageOperandIds);
} }
AddToFunctionDefinitions(result); AddToFunctionDefinitions(result);
return result; return result;
} }
public Instruction ImageSampleExplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] operands) public Instruction ImageSampleExplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = new Instruction(Op.OpImageSampleExplicitLod, GetNewId(), resultType); Instruction result = new Instruction(Op.OpImageSampleExplicitLod, GetNewId(), resultType);
result.AddOperand(sampledImage); result.AddOperand(sampledImage);
result.AddOperand(coordinate); result.AddOperand(coordinate);
result.AddOperand(imageOperands); result.AddOperand(imageOperands);
result.AddOperand(operands); if (imageOperands != (ImageOperandsMask)int.MaxValue)
{
result.AddOperand(imageOperandIds);
}
AddToFunctionDefinitions(result); AddToFunctionDefinitions(result);
return result; return result;
} }
public Instruction ImageSampleDrefImplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params Instruction[] operands) public Instruction ImageSampleDrefImplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = new Instruction(Op.OpImageSampleDrefImplicitLod, GetNewId(), resultType); Instruction result = new Instruction(Op.OpImageSampleDrefImplicitLod, GetNewId(), resultType);
result.AddOperand(sampledImage); result.AddOperand(sampledImage);
result.AddOperand(coordinate); result.AddOperand(coordinate);
result.AddOperand(dRef); result.AddOperand(dRef);
if (imageOperands != ImageOperandsMask.MaskNone) if (imageOperands != (ImageOperandsMask)int.MaxValue)
{ {
result.AddOperand(imageOperands); result.AddOperand(imageOperands);
result.AddOperand(operands); }
if (imageOperands != (ImageOperandsMask)int.MaxValue)
{
result.AddOperand(imageOperandIds);
} }
AddToFunctionDefinitions(result); AddToFunctionDefinitions(result);
return result; return result;
} }
public Instruction ImageSampleDrefExplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params Instruction[] operands) public Instruction ImageSampleDrefExplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = new Instruction(Op.OpImageSampleDrefExplicitLod, GetNewId(), resultType); Instruction result = new Instruction(Op.OpImageSampleDrefExplicitLod, GetNewId(), resultType);
@ -955,59 +952,71 @@ namespace Spv.Generator
result.AddOperand(coordinate); result.AddOperand(coordinate);
result.AddOperand(dRef); result.AddOperand(dRef);
result.AddOperand(imageOperands); result.AddOperand(imageOperands);
result.AddOperand(operands); if (imageOperands != (ImageOperandsMask)int.MaxValue)
{
result.AddOperand(imageOperandIds);
}
AddToFunctionDefinitions(result); AddToFunctionDefinitions(result);
return result; return result;
} }
public Instruction ImageSampleProjImplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] operands) public Instruction ImageSampleProjImplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = new Instruction(Op.OpImageSampleProjImplicitLod, GetNewId(), resultType); Instruction result = new Instruction(Op.OpImageSampleProjImplicitLod, GetNewId(), resultType);
result.AddOperand(sampledImage); result.AddOperand(sampledImage);
result.AddOperand(coordinate); result.AddOperand(coordinate);
if (imageOperands != ImageOperandsMask.MaskNone) if (imageOperands != (ImageOperandsMask)int.MaxValue)
{ {
result.AddOperand(imageOperands); result.AddOperand(imageOperands);
result.AddOperand(operands); }
if (imageOperands != (ImageOperandsMask)int.MaxValue)
{
result.AddOperand(imageOperandIds);
} }
AddToFunctionDefinitions(result); AddToFunctionDefinitions(result);
return result; return result;
} }
public Instruction ImageSampleProjExplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] operands) public Instruction ImageSampleProjExplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = new Instruction(Op.OpImageSampleProjExplicitLod, GetNewId(), resultType); Instruction result = new Instruction(Op.OpImageSampleProjExplicitLod, GetNewId(), resultType);
result.AddOperand(sampledImage); result.AddOperand(sampledImage);
result.AddOperand(coordinate); result.AddOperand(coordinate);
result.AddOperand(imageOperands); result.AddOperand(imageOperands);
result.AddOperand(operands); if (imageOperands != (ImageOperandsMask)int.MaxValue)
{
result.AddOperand(imageOperandIds);
}
AddToFunctionDefinitions(result); AddToFunctionDefinitions(result);
return result; return result;
} }
public Instruction ImageSampleProjDrefImplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params Instruction[] operands) public Instruction ImageSampleProjDrefImplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = new Instruction(Op.OpImageSampleProjDrefImplicitLod, GetNewId(), resultType); Instruction result = new Instruction(Op.OpImageSampleProjDrefImplicitLod, GetNewId(), resultType);
result.AddOperand(sampledImage); result.AddOperand(sampledImage);
result.AddOperand(coordinate); result.AddOperand(coordinate);
result.AddOperand(dRef); result.AddOperand(dRef);
if (imageOperands != ImageOperandsMask.MaskNone) if (imageOperands != (ImageOperandsMask)int.MaxValue)
{ {
result.AddOperand(imageOperands); result.AddOperand(imageOperands);
result.AddOperand(operands); }
if (imageOperands != (ImageOperandsMask)int.MaxValue)
{
result.AddOperand(imageOperandIds);
} }
AddToFunctionDefinitions(result); AddToFunctionDefinitions(result);
return result; return result;
} }
public Instruction ImageSampleProjDrefExplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params Instruction[] operands) public Instruction ImageSampleProjDrefExplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = new Instruction(Op.OpImageSampleProjDrefExplicitLod, GetNewId(), resultType); Instruction result = new Instruction(Op.OpImageSampleProjDrefExplicitLod, GetNewId(), resultType);
@ -1015,63 +1024,75 @@ namespace Spv.Generator
result.AddOperand(coordinate); result.AddOperand(coordinate);
result.AddOperand(dRef); result.AddOperand(dRef);
result.AddOperand(imageOperands); result.AddOperand(imageOperands);
result.AddOperand(operands); if (imageOperands != (ImageOperandsMask)int.MaxValue)
{
result.AddOperand(imageOperandIds);
}
AddToFunctionDefinitions(result); AddToFunctionDefinitions(result);
return result; return result;
} }
public Instruction ImageFetch(Instruction resultType, Instruction image, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] operands) public Instruction ImageFetch(Instruction resultType, Instruction image, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = new Instruction(Op.OpImageFetch, GetNewId(), resultType); Instruction result = new Instruction(Op.OpImageFetch, GetNewId(), resultType);
result.AddOperand(image); result.AddOperand(image);
result.AddOperand(coordinate); result.AddOperand(coordinate);
if (imageOperands != ImageOperandsMask.MaskNone) if (imageOperands != (ImageOperandsMask)int.MaxValue)
{ {
result.AddOperand(imageOperands); result.AddOperand(imageOperands);
result.AddOperand(operands); }
if (imageOperands != (ImageOperandsMask)int.MaxValue)
{
result.AddOperand(imageOperandIds);
} }
AddToFunctionDefinitions(result); AddToFunctionDefinitions(result);
return result; return result;
} }
public Instruction ImageGather(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction component, ImageOperandsMask imageOperands, params Instruction[] operands) public Instruction ImageGather(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction component, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = new Instruction(Op.OpImageGather, GetNewId(), resultType); Instruction result = new Instruction(Op.OpImageGather, GetNewId(), resultType);
result.AddOperand(sampledImage); result.AddOperand(sampledImage);
result.AddOperand(coordinate); result.AddOperand(coordinate);
result.AddOperand(component); result.AddOperand(component);
if (imageOperands != ImageOperandsMask.MaskNone) if (imageOperands != (ImageOperandsMask)int.MaxValue)
{ {
result.AddOperand(imageOperands); result.AddOperand(imageOperands);
result.AddOperand(operands); }
if (imageOperands != (ImageOperandsMask)int.MaxValue)
{
result.AddOperand(imageOperandIds);
} }
AddToFunctionDefinitions(result); AddToFunctionDefinitions(result);
return result; return result;
} }
public Instruction ImageDrefGather(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params Instruction[] operands) public Instruction ImageDrefGather(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = new Instruction(Op.OpImageDrefGather, GetNewId(), resultType); Instruction result = new Instruction(Op.OpImageDrefGather, GetNewId(), resultType);
result.AddOperand(sampledImage); result.AddOperand(sampledImage);
result.AddOperand(coordinate); result.AddOperand(coordinate);
result.AddOperand(dRef); result.AddOperand(dRef);
if (imageOperands != ImageOperandsMask.MaskNone) if (imageOperands != (ImageOperandsMask)int.MaxValue)
{ {
result.AddOperand(imageOperands); result.AddOperand(imageOperands);
result.AddOperand(operands); }
if (imageOperands != (ImageOperandsMask)int.MaxValue)
{
result.AddOperand(imageOperandIds);
} }
AddToFunctionDefinitions(result); AddToFunctionDefinitions(result);
return result; return result;
} }
public Instruction ImageRead(Instruction resultType, Instruction image, Instruction coordinate, ImageOperandsMask imageOperands = (ImageOperandsMask)int.MaxValue) public Instruction ImageRead(Instruction resultType, Instruction image, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = new Instruction(Op.OpImageRead, GetNewId(), resultType); Instruction result = new Instruction(Op.OpImageRead, GetNewId(), resultType);
@ -1081,12 +1102,16 @@ namespace Spv.Generator
{ {
result.AddOperand(imageOperands); result.AddOperand(imageOperands);
} }
if (imageOperands != (ImageOperandsMask)int.MaxValue)
{
result.AddOperand(imageOperandIds);
}
AddToFunctionDefinitions(result); AddToFunctionDefinitions(result);
return result; return result;
} }
public Instruction ImageWrite(Instruction image, Instruction coordinate, Instruction texel, ImageOperandsMask imageOperands = (ImageOperandsMask)int.MaxValue) public Instruction ImageWrite(Instruction image, Instruction coordinate, Instruction texel, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = new Instruction(Op.OpImageWrite); Instruction result = new Instruction(Op.OpImageWrite);
@ -1097,6 +1122,10 @@ namespace Spv.Generator
{ {
result.AddOperand(imageOperands); result.AddOperand(imageOperands);
} }
if (imageOperands != (ImageOperandsMask)int.MaxValue)
{
result.AddOperand(imageOperandIds);
}
AddToFunctionDefinitions(result); AddToFunctionDefinitions(result);
return result; return result;
@ -1184,7 +1213,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction ImageSparseSampleImplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, ImageOperandsMask imageOperands = (ImageOperandsMask)int.MaxValue) public Instruction ImageSparseSampleImplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = new Instruction(Op.OpImageSparseSampleImplicitLod, GetNewId(), resultType); Instruction result = new Instruction(Op.OpImageSparseSampleImplicitLod, GetNewId(), resultType);
@ -1194,24 +1223,32 @@ namespace Spv.Generator
{ {
result.AddOperand(imageOperands); result.AddOperand(imageOperands);
} }
if (imageOperands != (ImageOperandsMask)int.MaxValue)
{
result.AddOperand(imageOperandIds);
}
AddToFunctionDefinitions(result); AddToFunctionDefinitions(result);
return result; return result;
} }
public Instruction ImageSparseSampleExplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, ImageOperandsMask imageOperands) public Instruction ImageSparseSampleExplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = new Instruction(Op.OpImageSparseSampleExplicitLod, GetNewId(), resultType); Instruction result = new Instruction(Op.OpImageSparseSampleExplicitLod, GetNewId(), resultType);
result.AddOperand(sampledImage); result.AddOperand(sampledImage);
result.AddOperand(coordinate); result.AddOperand(coordinate);
result.AddOperand(imageOperands); result.AddOperand(imageOperands);
if (imageOperands != (ImageOperandsMask)int.MaxValue)
{
result.AddOperand(imageOperandIds);
}
AddToFunctionDefinitions(result); AddToFunctionDefinitions(result);
return result; return result;
} }
public Instruction ImageSparseSampleDrefImplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands = (ImageOperandsMask)int.MaxValue) public Instruction ImageSparseSampleDrefImplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = new Instruction(Op.OpImageSparseSampleDrefImplicitLod, GetNewId(), resultType); Instruction result = new Instruction(Op.OpImageSparseSampleDrefImplicitLod, GetNewId(), resultType);
@ -1222,12 +1259,16 @@ namespace Spv.Generator
{ {
result.AddOperand(imageOperands); result.AddOperand(imageOperands);
} }
if (imageOperands != (ImageOperandsMask)int.MaxValue)
{
result.AddOperand(imageOperandIds);
}
AddToFunctionDefinitions(result); AddToFunctionDefinitions(result);
return result; return result;
} }
public Instruction ImageSparseSampleDrefExplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands) public Instruction ImageSparseSampleDrefExplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = new Instruction(Op.OpImageSparseSampleDrefExplicitLod, GetNewId(), resultType); Instruction result = new Instruction(Op.OpImageSparseSampleDrefExplicitLod, GetNewId(), resultType);
@ -1235,12 +1276,16 @@ namespace Spv.Generator
result.AddOperand(coordinate); result.AddOperand(coordinate);
result.AddOperand(dRef); result.AddOperand(dRef);
result.AddOperand(imageOperands); result.AddOperand(imageOperands);
if (imageOperands != (ImageOperandsMask)int.MaxValue)
{
result.AddOperand(imageOperandIds);
}
AddToFunctionDefinitions(result); AddToFunctionDefinitions(result);
return result; return result;
} }
public Instruction ImageSparseSampleProjImplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, ImageOperandsMask imageOperands = (ImageOperandsMask)int.MaxValue) public Instruction ImageSparseSampleProjImplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = new Instruction(Op.OpImageSparseSampleProjImplicitLod, GetNewId(), resultType); Instruction result = new Instruction(Op.OpImageSparseSampleProjImplicitLod, GetNewId(), resultType);
@ -1250,24 +1295,32 @@ namespace Spv.Generator
{ {
result.AddOperand(imageOperands); result.AddOperand(imageOperands);
} }
if (imageOperands != (ImageOperandsMask)int.MaxValue)
{
result.AddOperand(imageOperandIds);
}
AddToFunctionDefinitions(result); AddToFunctionDefinitions(result);
return result; return result;
} }
public Instruction ImageSparseSampleProjExplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, ImageOperandsMask imageOperands) public Instruction ImageSparseSampleProjExplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = new Instruction(Op.OpImageSparseSampleProjExplicitLod, GetNewId(), resultType); Instruction result = new Instruction(Op.OpImageSparseSampleProjExplicitLod, GetNewId(), resultType);
result.AddOperand(sampledImage); result.AddOperand(sampledImage);
result.AddOperand(coordinate); result.AddOperand(coordinate);
result.AddOperand(imageOperands); result.AddOperand(imageOperands);
if (imageOperands != (ImageOperandsMask)int.MaxValue)
{
result.AddOperand(imageOperandIds);
}
AddToFunctionDefinitions(result); AddToFunctionDefinitions(result);
return result; return result;
} }
public Instruction ImageSparseSampleProjDrefImplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands = (ImageOperandsMask)int.MaxValue) public Instruction ImageSparseSampleProjDrefImplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = new Instruction(Op.OpImageSparseSampleProjDrefImplicitLod, GetNewId(), resultType); Instruction result = new Instruction(Op.OpImageSparseSampleProjDrefImplicitLod, GetNewId(), resultType);
@ -1278,12 +1331,16 @@ namespace Spv.Generator
{ {
result.AddOperand(imageOperands); result.AddOperand(imageOperands);
} }
if (imageOperands != (ImageOperandsMask)int.MaxValue)
{
result.AddOperand(imageOperandIds);
}
AddToFunctionDefinitions(result); AddToFunctionDefinitions(result);
return result; return result;
} }
public Instruction ImageSparseSampleProjDrefExplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands) public Instruction ImageSparseSampleProjDrefExplicitLod(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = new Instruction(Op.OpImageSparseSampleProjDrefExplicitLod, GetNewId(), resultType); Instruction result = new Instruction(Op.OpImageSparseSampleProjDrefExplicitLod, GetNewId(), resultType);
@ -1291,12 +1348,16 @@ namespace Spv.Generator
result.AddOperand(coordinate); result.AddOperand(coordinate);
result.AddOperand(dRef); result.AddOperand(dRef);
result.AddOperand(imageOperands); result.AddOperand(imageOperands);
if (imageOperands != (ImageOperandsMask)int.MaxValue)
{
result.AddOperand(imageOperandIds);
}
AddToFunctionDefinitions(result); AddToFunctionDefinitions(result);
return result; return result;
} }
public Instruction ImageSparseFetch(Instruction resultType, Instruction image, Instruction coordinate, ImageOperandsMask imageOperands = (ImageOperandsMask)int.MaxValue) public Instruction ImageSparseFetch(Instruction resultType, Instruction image, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = new Instruction(Op.OpImageSparseFetch, GetNewId(), resultType); Instruction result = new Instruction(Op.OpImageSparseFetch, GetNewId(), resultType);
@ -1306,12 +1367,16 @@ namespace Spv.Generator
{ {
result.AddOperand(imageOperands); result.AddOperand(imageOperands);
} }
if (imageOperands != (ImageOperandsMask)int.MaxValue)
{
result.AddOperand(imageOperandIds);
}
AddToFunctionDefinitions(result); AddToFunctionDefinitions(result);
return result; return result;
} }
public Instruction ImageSparseGather(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction component, ImageOperandsMask imageOperands = (ImageOperandsMask)int.MaxValue) public Instruction ImageSparseGather(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction component, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = new Instruction(Op.OpImageSparseGather, GetNewId(), resultType); Instruction result = new Instruction(Op.OpImageSparseGather, GetNewId(), resultType);
@ -1322,12 +1387,16 @@ namespace Spv.Generator
{ {
result.AddOperand(imageOperands); result.AddOperand(imageOperands);
} }
if (imageOperands != (ImageOperandsMask)int.MaxValue)
{
result.AddOperand(imageOperandIds);
}
AddToFunctionDefinitions(result); AddToFunctionDefinitions(result);
return result; return result;
} }
public Instruction ImageSparseDrefGather(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands = (ImageOperandsMask)int.MaxValue) public Instruction ImageSparseDrefGather(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction dRef, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = new Instruction(Op.OpImageSparseDrefGather, GetNewId(), resultType); Instruction result = new Instruction(Op.OpImageSparseDrefGather, GetNewId(), resultType);
@ -1338,6 +1407,10 @@ namespace Spv.Generator
{ {
result.AddOperand(imageOperands); result.AddOperand(imageOperands);
} }
if (imageOperands != (ImageOperandsMask)int.MaxValue)
{
result.AddOperand(imageOperandIds);
}
AddToFunctionDefinitions(result); AddToFunctionDefinitions(result);
return result; return result;
@ -1353,7 +1426,7 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction ImageSparseRead(Instruction resultType, Instruction image, Instruction coordinate, ImageOperandsMask imageOperands = (ImageOperandsMask)int.MaxValue) public Instruction ImageSparseRead(Instruction resultType, Instruction image, Instruction coordinate, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = new Instruction(Op.OpImageSparseRead, GetNewId(), resultType); Instruction result = new Instruction(Op.OpImageSparseRead, GetNewId(), resultType);
@ -1363,12 +1436,16 @@ namespace Spv.Generator
{ {
result.AddOperand(imageOperands); result.AddOperand(imageOperands);
} }
if (imageOperands != (ImageOperandsMask)int.MaxValue)
{
result.AddOperand(imageOperandIds);
}
AddToFunctionDefinitions(result); AddToFunctionDefinitions(result);
return result; return result;
} }
public Instruction ImageSampleFootprintNV(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction granularity, Instruction coarse, ImageOperandsMask imageOperands = (ImageOperandsMask)int.MaxValue) public Instruction ImageSampleFootprintNV(Instruction resultType, Instruction sampledImage, Instruction coordinate, Instruction granularity, Instruction coarse, ImageOperandsMask imageOperands, params Instruction[] imageOperandIds)
{ {
Instruction result = new Instruction(Op.OpImageSampleFootprintNV, GetNewId(), resultType); Instruction result = new Instruction(Op.OpImageSampleFootprintNV, GetNewId(), resultType);
@ -1380,6 +1457,10 @@ namespace Spv.Generator
{ {
result.AddOperand(imageOperands); result.AddOperand(imageOperands);
} }
if (imageOperands != (ImageOperandsMask)int.MaxValue)
{
result.AddOperand(imageOperandIds);
}
AddToFunctionDefinitions(result); AddToFunctionDefinitions(result);
return result; return result;
@ -2721,6 +2802,15 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction TerminateInvocation()
{
Instruction result = new Instruction(Op.OpTerminateInvocation);
AddToFunctionDefinitions(result);
return result;
}
// Atomic // Atomic
public Instruction AtomicLoad(Instruction resultType, Instruction pointer, Instruction memory, Instruction semantics) public Instruction AtomicLoad(Instruction resultType, Instruction pointer, Instruction memory, Instruction semantics)
@ -2956,6 +3046,19 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction AtomicFAddEXT(Instruction resultType, Instruction pointer, Instruction memory, Instruction semantics, Instruction value)
{
Instruction result = new Instruction(Op.OpAtomicFAddEXT, GetNewId(), resultType);
result.AddOperand(pointer);
result.AddOperand(memory);
result.AddOperand(semantics);
result.AddOperand(value);
AddToFunctionDefinitions(result);
return result;
}
// Primitive // Primitive
public Instruction EmitVertex() public Instruction EmitVertex()
@ -3897,6 +4000,28 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction ReadPipeBlockingINTEL(Instruction resultType, Instruction packetSize, Instruction packetAlignment)
{
Instruction result = new Instruction(Op.OpReadPipeBlockingINTEL, GetNewId(), resultType);
result.AddOperand(packetSize);
result.AddOperand(packetAlignment);
AddToFunctionDefinitions(result);
return result;
}
public Instruction WritePipeBlockingINTEL(Instruction resultType, Instruction packetSize, Instruction packetAlignment)
{
Instruction result = new Instruction(Op.OpWritePipeBlockingINTEL, GetNewId(), resultType);
result.AddOperand(packetSize);
result.AddOperand(packetAlignment);
AddToFunctionDefinitions(result);
return result;
}
// Non-Uniform // Non-Uniform
public Instruction GroupNonUniformElect(Instruction resultType, Instruction execution) public Instruction GroupNonUniformElect(Instruction resultType, Instruction execution)
@ -4373,9 +4498,68 @@ namespace Spv.Generator
// Reserved // Reserved
public Instruction TypeRayQueryProvisionalKHR() public Instruction TraceRayKHR(Instruction accel, Instruction rayFlags, Instruction cullMask, Instruction sBTOffset, Instruction sBTStride, Instruction missIndex, Instruction rayOrigin, Instruction rayTmin, Instruction rayDirection, Instruction rayTmax, Instruction payload)
{ {
Instruction result = new Instruction(Op.OpTypeRayQueryProvisionalKHR, GetNewId()); Instruction result = new Instruction(Op.OpTraceRayKHR);
result.AddOperand(accel);
result.AddOperand(rayFlags);
result.AddOperand(cullMask);
result.AddOperand(sBTOffset);
result.AddOperand(sBTStride);
result.AddOperand(missIndex);
result.AddOperand(rayOrigin);
result.AddOperand(rayTmin);
result.AddOperand(rayDirection);
result.AddOperand(rayTmax);
result.AddOperand(payload);
AddToFunctionDefinitions(result);
return result;
}
public Instruction ExecuteCallableKHR(Instruction sBTIndex, Instruction callableData)
{
Instruction result = new Instruction(Op.OpExecuteCallableKHR);
result.AddOperand(sBTIndex);
result.AddOperand(callableData);
AddToFunctionDefinitions(result);
return result;
}
public Instruction ConvertUToAccelerationStructureKHR(Instruction resultType, Instruction accel)
{
Instruction result = new Instruction(Op.OpConvertUToAccelerationStructureKHR, GetNewId(), resultType);
result.AddOperand(accel);
AddToFunctionDefinitions(result);
return result;
}
public Instruction IgnoreIntersectionKHR()
{
Instruction result = new Instruction(Op.OpIgnoreIntersectionKHR);
AddToFunctionDefinitions(result);
return result;
}
public Instruction TerminateRayKHR()
{
Instruction result = new Instruction(Op.OpTerminateRayKHR);
AddToFunctionDefinitions(result);
return result;
}
public Instruction TypeRayQueryKHR()
{
Instruction result = new Instruction(Op.OpTypeRayQueryKHR, GetNewId());
AddToFunctionDefinitions(result); AddToFunctionDefinitions(result);
@ -4526,15 +4710,6 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction IgnoreIntersectionKHR()
{
Instruction result = new Instruction(Op.OpIgnoreIntersectionKHR);
AddToFunctionDefinitions(result);
return result;
}
public Instruction TerminateRayNV() public Instruction TerminateRayNV()
{ {
Instruction result = new Instruction(Op.OpTerminateRayNV); Instruction result = new Instruction(Op.OpTerminateRayNV);
@ -4544,15 +4719,6 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction TerminateRayKHR()
{
Instruction result = new Instruction(Op.OpTerminateRayKHR);
AddToFunctionDefinitions(result);
return result;
}
public Instruction TraceNV(Instruction accel, Instruction rayFlags, Instruction cullMask, Instruction sBTOffset, Instruction sBTStride, Instruction missIndex, Instruction rayOrigin, Instruction rayTmin, Instruction rayDirection, Instruction rayTmax, Instruction payloadId) public Instruction TraceNV(Instruction accel, Instruction rayFlags, Instruction cullMask, Instruction sBTOffset, Instruction sBTStride, Instruction missIndex, Instruction rayOrigin, Instruction rayTmin, Instruction rayDirection, Instruction rayTmax, Instruction payloadId)
{ {
Instruction result = new Instruction(Op.OpTraceNV); Instruction result = new Instruction(Op.OpTraceNV);
@ -4573,26 +4739,6 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction TraceRayKHR(Instruction accel, Instruction rayFlags, Instruction cullMask, Instruction sBTOffset, Instruction sBTStride, Instruction missIndex, Instruction rayOrigin, Instruction rayTmin, Instruction rayDirection, Instruction rayTmax, Instruction payloadId)
{
Instruction result = new Instruction(Op.OpTraceRayKHR);
result.AddOperand(accel);
result.AddOperand(rayFlags);
result.AddOperand(cullMask);
result.AddOperand(sBTOffset);
result.AddOperand(sBTStride);
result.AddOperand(missIndex);
result.AddOperand(rayOrigin);
result.AddOperand(rayTmin);
result.AddOperand(rayDirection);
result.AddOperand(rayTmax);
result.AddOperand(payloadId);
AddToFunctionDefinitions(result);
return result;
}
public Instruction TypeAccelerationStructureNV() public Instruction TypeAccelerationStructureNV()
{ {
Instruction result = new Instruction(Op.OpTypeAccelerationStructureNV, GetNewId()); Instruction result = new Instruction(Op.OpTypeAccelerationStructureNV, GetNewId());
@ -4622,17 +4768,6 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction ExecuteCallableKHR(Instruction sBTIndex, Instruction callableDataId)
{
Instruction result = new Instruction(Op.OpExecuteCallableKHR);
result.AddOperand(sBTIndex);
result.AddOperand(callableDataId);
AddToFunctionDefinitions(result);
return result;
}
public Instruction TypeCooperativeMatrixNV(Instruction componentType, Instruction execution, Instruction rows, Instruction columns) public Instruction TypeCooperativeMatrixNV(Instruction componentType, Instruction execution, Instruction rows, Instruction columns)
{ {
Instruction result = new Instruction(Op.OpTypeCooperativeMatrixNV, GetNewId()); Instruction result = new Instruction(Op.OpTypeCooperativeMatrixNV, GetNewId());
@ -4889,6 +5024,27 @@ namespace Spv.Generator
return result; return result;
} }
public Instruction LoopControlINTEL(params LiteralInteger[] loopControlParameters)
{
Instruction result = new Instruction(Op.OpLoopControlINTEL);
result.AddOperand(loopControlParameters);
AddToFunctionDefinitions(result);
return result;
}
public Instruction FPGARegINTEL(Instruction resultType, Instruction resultObj, Instruction input)
{
Instruction result = new Instruction(Op.OpFPGARegINTEL, GetNewId(), resultType);
result.AddOperand(resultObj);
result.AddOperand(input);
AddToFunctionDefinitions(result);
return result;
}
public Instruction RayQueryGetRayTMinKHR(Instruction resultType, Instruction rayQuery) public Instruction RayQueryGetRayTMinKHR(Instruction resultType, Instruction rayQuery)
{ {
Instruction result = new Instruction(Op.OpRayQueryGetRayTMinKHR, GetNewId(), resultType); Instruction result = new Instruction(Op.OpRayQueryGetRayTMinKHR, GetNewId(), resultType);

View file

@ -0,0 +1,441 @@
// AUTOGENERATED: DO NOT EDIT
// Last update date: 2021-01-06 23:02:26.955269
#region Grammar License
// Copyright (c) 2014-2016 The Khronos Group Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and/or associated documentation files (the "Materials"),
// to deal in the Materials without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Materials, and to permit persons to whom the
// Materials are furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Materials.
//
// MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS
// STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND
// HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/
//
// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS
// IN THE MATERIALS.
#endregion
using static Spv.Specification;
namespace Spv.Generator
{
public partial class Module
{
public Instruction GlslRound(Instruction resultType, Instruction x)
{
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);
}
}
}

View file

@ -0,0 +1,841 @@
// AUTOGENERATED: DO NOT EDIT
// Last update date: 2021-01-06 23:02:27.020534
#region Grammar License
// Copyright (c) 2014-2016 The Khronos Group Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and/or associated documentation files (the "Materials"),
// to deal in the Materials without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Materials, and to permit persons to whom the
// Materials are furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Materials.
//
// MODIFICATIONS TO THIS FILE MAY MEAN IT NO LONGER ACCURATELY REFLECTS KHRONOS
// STANDARDS. THE UNMODIFIED, NORMATIVE VERSIONS OF KHRONOS SPECIFICATIONS AND
// HEADER INFORMATION ARE LOCATED AT https://www.khronos.org/registry/
//
// THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM,OUT OF OR IN CONNECTION WITH THE MATERIALS OR THE USE OR OTHER DEALINGS
// IN THE MATERIALS.
#endregion
using static Spv.Specification;
namespace Spv.Generator
{
public partial class Module
{
public Instruction OpenClAcos(Instruction resultType, Instruction x)
{
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);
}
}
}

View file

@ -188,16 +188,16 @@ namespace Spv.Generator
return result; return result;
} }
public bool EqualsResultType(Instruction cmpObj)
{
return _resultType.Opcode == cmpObj._resultType.Opcode && _resultType.EqualsContent(cmpObj._resultType);
}
public bool EqualsContent(Instruction cmpObj) public bool EqualsContent(Instruction cmpObj)
{ {
return _operands.SequenceEqual(cmpObj._operands); return _operands.SequenceEqual(cmpObj._operands);
} }
public bool EqualsResultType(Instruction cmpObj)
{
return _resultType.Opcode == cmpObj._resultType.Opcode && _resultType.EqualsContent(cmpObj._resultType);
}
public override int GetHashCode() public override int GetHashCode()
{ {
return HashCode.Combine(Opcode, Id, _resultType, _operands); return HashCode.Combine(Opcode, Id, _resultType, _operands);

View file

@ -2,6 +2,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq;
using static Spv.Specification; using static Spv.Specification;
namespace Spv.Generator namespace Spv.Generator
@ -164,6 +165,7 @@ namespace Spv.Generator
AddToFunctionDefinitions(label); AddToFunctionDefinitions(label);
} }
public void AddLocalVariable(Instruction variable) public void AddLocalVariable(Instruction variable)
{ {
// TODO: ensure it has the local modifier // TODO: ensure it has the local modifier
@ -195,7 +197,7 @@ namespace Spv.Generator
foreach (Instruction global in _globals) foreach (Instruction global in _globals)
{ {
if (global.Opcode == constant.Opcode && global.EqualsResultType(constant) && global.EqualsContent(constant)) if (global.Opcode == constant.Opcode && global.EqualsContent(constant) && global.EqualsResultType(constant))
{ {
// update the duplicate instance to use the good id so it ends up being encoded right. // update the duplicate instance to use the good id so it ends up being encoded right.
constant.SetId(global.Id); constant.SetId(global.Id);
@ -209,21 +211,40 @@ namespace Spv.Generator
_globals.Add(constant); _globals.Add(constant);
} }
public Instruction ExtInst(Instruction resultType, Instruction set, LiteralInteger instruction, params Operand[] parameters)
{
Instruction result = new Instruction(Op.OpExtInst, GetNewId(), resultType);
result.AddOperand(set);
result.AddOperand(instruction);
result.AddOperand(parameters);
AddToFunctionDefinitions(result);
return result;
}
public void SetMemoryModel(AddressingModel addressingModel, MemoryModel memoryModel) public void SetMemoryModel(AddressingModel addressingModel, MemoryModel memoryModel)
{ {
_addressingModel = addressingModel; _addressingModel = addressingModel;
_memoryModel = memoryModel; _memoryModel = memoryModel;
} }
protected virtual void Construct() // TODO: Found a way to make the auto generate one used.
public Instruction OpenClPrintf(Instruction resultType, Instruction format, params Instruction[] additionalarguments)
{ {
throw new NotSupportedException("Construct should be overriden."); Instruction result = new Instruction(Op.OpExtInst, GetNewId(), resultType);
result.AddOperand(AddExtInstImport("OpenCL.std"));
result.AddOperand((LiteralInteger)184);
result.AddOperand(format);
result.AddOperand(additionalarguments);
AddToFunctionDefinitions(result);
return result;
} }
public byte[] Generate() public byte[] Generate()
{ {
Construct();
using (MemoryStream stream = new MemoryStream()) using (MemoryStream stream = new MemoryStream())
{ {
BinaryWriter writer = new BinaryWriter(stream); BinaryWriter writer = new BinaryWriter(stream);

View file

@ -0,0 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>
</Project>

View file

@ -1,4 +1,4 @@
// Copyright (c) 2014-2020 The Khronos Group Inc. // Copyright (c) 2014-2020 The Khronos Group Inc.
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and/or associated documentation files (the "Materials"), // of this software and/or associated documentation files (the "Materials"),
@ -49,7 +49,7 @@ namespace Spv
{ {
public const uint MagicNumber = 0x07230203; public const uint MagicNumber = 0x07230203;
public const uint Version = 0x00010500; public const uint Version = 0x00010500;
public const uint Revision = 3; public const uint Revision = 4;
public const uint OpCodeMask = 0xffff; public const uint OpCodeMask = 0xffff;
public const uint WordCountShift = 16; public const uint WordCountShift = 16;
@ -164,6 +164,10 @@ namespace Spv
SampleInterlockUnorderedEXT = 5369, SampleInterlockUnorderedEXT = 5369,
ShadingRateInterlockOrderedEXT = 5370, ShadingRateInterlockOrderedEXT = 5370,
ShadingRateInterlockUnorderedEXT = 5371, ShadingRateInterlockUnorderedEXT = 5371,
MaxWorkgroupSizeINTEL = 5893,
MaxWorkDimINTEL = 5894,
NoGlobalOffsetINTEL = 5895,
NumSIMDWorkitemsINTEL = 5896,
} }
public enum StorageClass public enum StorageClass
@ -195,6 +199,7 @@ namespace Spv
ShaderRecordBufferNV = 5343, ShaderRecordBufferNV = 5343,
PhysicalStorageBuffer = 5349, PhysicalStorageBuffer = 5349,
PhysicalStorageBufferEXT = 5349, PhysicalStorageBufferEXT = 5349,
CodeSectionINTEL = 5605,
} }
public enum Dim public enum Dim
@ -265,6 +270,8 @@ namespace Spv
Rg8ui = 37, Rg8ui = 37,
R16ui = 38, R16ui = 38,
R8ui = 39, R8ui = 39,
R64ui = 40,
R64i = 41,
} }
public enum ImageChannelOrder public enum ImageChannelOrder
@ -475,11 +482,24 @@ namespace Spv
RestrictPointerEXT = 5355, RestrictPointerEXT = 5355,
AliasedPointer = 5356, AliasedPointer = 5356,
AliasedPointerEXT = 5356, AliasedPointerEXT = 5356,
ReferencedIndirectlyINTEL = 5602,
CounterBuffer = 5634, CounterBuffer = 5634,
HlslCounterBufferGOOGLE = 5634, HlslCounterBufferGOOGLE = 5634,
HlslSemanticGOOGLE = 5635, HlslSemanticGOOGLE = 5635,
UserSemantic = 5635, UserSemantic = 5635,
UserTypeGOOGLE = 5636, UserTypeGOOGLE = 5636,
RegisterINTEL = 5825,
MemoryINTEL = 5826,
NumbanksINTEL = 5827,
BankwidthINTEL = 5828,
MaxPrivateCopiesINTEL = 5829,
SinglepumpINTEL = 5830,
DoublepumpINTEL = 5831,
MaxReplicatesINTEL = 5832,
SimpleDualPortINTEL = 5833,
MergeINTEL = 5834,
BankBitsINTEL = 5835,
ForcePow2DepthINTEL = 5836,
} }
public enum BuiltIn public enum BuiltIn
@ -538,8 +558,10 @@ namespace Spv
BaseVertex = 4424, BaseVertex = 4424,
BaseInstance = 4425, BaseInstance = 4425,
DrawIndex = 4426, DrawIndex = 4426,
PrimitiveShadingRateKHR = 4432,
DeviceIndex = 4438, DeviceIndex = 4438,
ViewIndex = 4440, ViewIndex = 4440,
ShadingRateKHR = 4444,
BaryCoordNoPerspAMD = 4992, BaryCoordNoPerspAMD = 4992,
BaryCoordNoPerspCentroidAMD = 4993, BaryCoordNoPerspCentroidAMD = 4993,
BaryCoordNoPerspSampleAMD = 4994, BaryCoordNoPerspSampleAMD = 4994,
@ -590,7 +612,6 @@ namespace Spv
ObjectToWorldNV = 5330, ObjectToWorldNV = 5330,
WorldToObjectKHR = 5331, WorldToObjectKHR = 5331,
WorldToObjectNV = 5331, WorldToObjectNV = 5331,
HitTKHR = 5332,
HitTNV = 5332, HitTNV = 5332,
HitKindKHR = 5333, HitKindKHR = 5333,
HitKindNV = 5333, HitKindNV = 5333,
@ -627,6 +648,13 @@ namespace Spv
IterationMultiple = 6, IterationMultiple = 6,
PeelCount = 7, PeelCount = 7,
PartialCount = 8, PartialCount = 8,
InitiationIntervalINTEL = 16,
MaxConcurrencyINTEL = 17,
DependencyArrayINTEL = 18,
PipelineEnableINTEL = 19,
LoopCoalesceINTEL = 20,
MaxInterleavingINTEL = 21,
SpeculatedIterationsINTEL = 22,
} }
public enum LoopControlMask public enum LoopControlMask
@ -641,6 +669,13 @@ namespace Spv
IterationMultiple = 0x00000040, IterationMultiple = 0x00000040,
PeelCount = 0x00000080, PeelCount = 0x00000080,
PartialCount = 0x00000100, PartialCount = 0x00000100,
InitiationIntervalINTEL = 0x00010000,
MaxConcurrencyINTEL = 0x00020000,
DependencyArrayINTEL = 0x00040000,
PipelineEnableINTEL = 0x00080000,
LoopCoalesceINTEL = 0x00100000,
MaxInterleavingINTEL = 0x00200000,
SpeculatedIterationsINTEL = 0x00400000,
} }
public enum FunctionControlShift public enum FunctionControlShift
@ -842,6 +877,7 @@ namespace Spv
GroupNonUniformQuad = 68, GroupNonUniformQuad = 68,
ShaderLayer = 69, ShaderLayer = 69,
ShaderViewportIndex = 70, ShaderViewportIndex = 70,
FragmentShadingRateKHR = 4422,
SubgroupBallotKHR = 4423, SubgroupBallotKHR = 4423,
DrawParameters = 4427, DrawParameters = 4427,
SubgroupVoteKHR = 4431, SubgroupVoteKHR = 4431,
@ -866,12 +902,15 @@ namespace Spv
RoundingModeRTE = 4467, RoundingModeRTE = 4467,
RoundingModeRTZ = 4468, RoundingModeRTZ = 4468,
RayQueryProvisionalKHR = 4471, RayQueryProvisionalKHR = 4471,
RayTraversalPrimitiveCullingProvisionalKHR = 4478, RayQueryKHR = 4472,
RayTraversalPrimitiveCullingKHR = 4478,
RayTracingKHR = 4479,
Float16ImageAMD = 5008, Float16ImageAMD = 5008,
ImageGatherBiasLodAMD = 5009, ImageGatherBiasLodAMD = 5009,
FragmentMaskAMD = 5010, FragmentMaskAMD = 5010,
StencilExportEXT = 5013, StencilExportEXT = 5013,
ImageReadWriteLodAMD = 5015, ImageReadWriteLodAMD = 5015,
Int64ImageEXT = 5016,
ShaderClockKHR = 5055, ShaderClockKHR = 5055,
SampleMaskOverrideCoverageNV = 5249, SampleMaskOverrideCoverageNV = 5249,
GeometryShaderPassthroughNV = 5251, GeometryShaderPassthroughNV = 5251,
@ -932,9 +971,20 @@ namespace Spv
SubgroupImageBlockIOINTEL = 5570, SubgroupImageBlockIOINTEL = 5570,
SubgroupImageMediaBlockIOINTEL = 5579, SubgroupImageMediaBlockIOINTEL = 5579,
IntegerFunctions2INTEL = 5584, IntegerFunctions2INTEL = 5584,
FunctionPointersINTEL = 5603,
IndirectReferencesINTEL = 5604,
SubgroupAvcMotionEstimationINTEL = 5696, SubgroupAvcMotionEstimationINTEL = 5696,
SubgroupAvcMotionEstimationIntraINTEL = 5697, SubgroupAvcMotionEstimationIntraINTEL = 5697,
SubgroupAvcMotionEstimationChromaINTEL = 5698, SubgroupAvcMotionEstimationChromaINTEL = 5698,
FPGAMemoryAttributesINTEL = 5824,
UnstructuredLoopControlsINTEL = 5886,
FPGALoopControlsINTEL = 5888,
KernelAttributesINTEL = 5892,
FPGAKernelAttributesINTEL = 5897,
BlockingPipesINTEL = 5945,
FPGARegINTEL = 5948,
AtomicFloat32AddEXT = 6033,
AtomicFloat64AddEXT = 6034,
} }
public enum RayFlagsShift public enum RayFlagsShift
@ -985,6 +1035,23 @@ namespace Spv
RayQueryCandidateIntersectionAABBKHR = 1, RayQueryCandidateIntersectionAABBKHR = 1,
} }
public enum FragmentShadingRateShift
{
Vertical2Pixels = 0,
Vertical4Pixels = 1,
Horizontal2Pixels = 2,
Horizontal4Pixels = 3,
}
public enum FragmentShadingRateMask
{
MaskNone = 0,
Vertical2Pixels = 0x00000001,
Vertical4Pixels = 0x00000002,
Horizontal2Pixels = 0x00000004,
Horizontal4Pixels = 0x00000008,
}
public enum Op public enum Op
{ {
OpNop = 0, OpNop = 0,
@ -1331,13 +1398,19 @@ namespace Spv
OpPtrEqual = 401, OpPtrEqual = 401,
OpPtrNotEqual = 402, OpPtrNotEqual = 402,
OpPtrDiff = 403, OpPtrDiff = 403,
OpTerminateInvocation = 4416,
OpSubgroupBallotKHR = 4421, OpSubgroupBallotKHR = 4421,
OpSubgroupFirstInvocationKHR = 4422, OpSubgroupFirstInvocationKHR = 4422,
OpSubgroupAllKHR = 4428, OpSubgroupAllKHR = 4428,
OpSubgroupAnyKHR = 4429, OpSubgroupAnyKHR = 4429,
OpSubgroupAllEqualKHR = 4430, OpSubgroupAllEqualKHR = 4430,
OpSubgroupReadInvocationKHR = 4432, OpSubgroupReadInvocationKHR = 4432,
OpTypeRayQueryProvisionalKHR = 4472, OpTraceRayKHR = 4445,
OpExecuteCallableKHR = 4446,
OpConvertUToAccelerationStructureKHR = 4447,
OpIgnoreIntersectionKHR = 4448,
OpTerminateRayKHR = 4449,
OpTypeRayQueryKHR = 4472,
OpRayQueryInitializeKHR = 4473, OpRayQueryInitializeKHR = 4473,
OpRayQueryTerminateKHR = 4474, OpRayQueryTerminateKHR = 4474,
OpRayQueryGenerateIntersectionKHR = 4475, OpRayQueryGenerateIntersectionKHR = 4475,
@ -1360,15 +1433,11 @@ namespace Spv
OpWritePackedPrimitiveIndices4x8NV = 5299, OpWritePackedPrimitiveIndices4x8NV = 5299,
OpReportIntersectionKHR = 5334, OpReportIntersectionKHR = 5334,
OpReportIntersectionNV = 5334, OpReportIntersectionNV = 5334,
OpIgnoreIntersectionKHR = 5335,
OpIgnoreIntersectionNV = 5335, OpIgnoreIntersectionNV = 5335,
OpTerminateRayKHR = 5336,
OpTerminateRayNV = 5336, OpTerminateRayNV = 5336,
OpTraceNV = 5337, OpTraceNV = 5337,
OpTraceRayKHR = 5337,
OpTypeAccelerationStructureKHR = 5341, OpTypeAccelerationStructureKHR = 5341,
OpTypeAccelerationStructureNV = 5341, OpTypeAccelerationStructureNV = 5341,
OpExecuteCallableKHR = 5344,
OpExecuteCallableNV = 5344, OpExecuteCallableNV = 5344,
OpTypeCooperativeMatrixNV = 5358, OpTypeCooperativeMatrixNV = 5358,
OpCooperativeMatrixLoadNV = 5359, OpCooperativeMatrixLoadNV = 5359,
@ -1403,6 +1472,8 @@ namespace Spv
OpUSubSatINTEL = 5596, OpUSubSatINTEL = 5596,
OpIMul32x16INTEL = 5597, OpIMul32x16INTEL = 5597,
OpUMul32x16INTEL = 5598, OpUMul32x16INTEL = 5598,
OpFunctionPointerINTEL = 5600,
OpFunctionPointerCallINTEL = 5601,
OpDecorateString = 5632, OpDecorateString = 5632,
OpDecorateStringGOOGLE = 5632, OpDecorateStringGOOGLE = 5632,
OpMemberDecorateString = 5633, OpMemberDecorateString = 5633,
@ -1525,6 +1596,10 @@ namespace Spv
OpSubgroupAvcSicGetPackedSkcLumaCountThresholdINTEL = 5814, OpSubgroupAvcSicGetPackedSkcLumaCountThresholdINTEL = 5814,
OpSubgroupAvcSicGetPackedSkcLumaSumThresholdINTEL = 5815, OpSubgroupAvcSicGetPackedSkcLumaSumThresholdINTEL = 5815,
OpSubgroupAvcSicGetInterRawSadsINTEL = 5816, OpSubgroupAvcSicGetInterRawSadsINTEL = 5816,
OpLoopControlINTEL = 5887,
OpReadPipeBlockingINTEL = 5946,
OpWritePipeBlockingINTEL = 5947,
OpFPGARegINTEL = 5949,
OpRayQueryGetRayTMinKHR = 6016, OpRayQueryGetRayTMinKHR = 6016,
OpRayQueryGetRayFlagsKHR = 6017, OpRayQueryGetRayFlagsKHR = 6017,
OpRayQueryGetIntersectionTKHR = 6018, OpRayQueryGetIntersectionTKHR = 6018,
@ -1542,6 +1617,7 @@ namespace Spv
OpRayQueryGetWorldRayOriginKHR = 6030, OpRayQueryGetWorldRayOriginKHR = 6030,
OpRayQueryGetIntersectionObjectToWorldKHR = 6031, OpRayQueryGetIntersectionObjectToWorldKHR = 6031,
OpRayQueryGetIntersectionWorldToObjectKHR = 6032, OpRayQueryGetIntersectionWorldToObjectKHR = 6032,
OpAtomicFAddEXT = 6035,
} }
} }
} }

View file

@ -1,12 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<LangVersion>8.0</LangVersion>
<RuntimeIdentifiers>win-x64;osx-x64;linux-x64</RuntimeIdentifiers>
<ApplicationIcon />
<StartupObject />
</PropertyGroup>
</Project>