summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorConnor Abbott <[email protected]>2015-07-13 10:19:32 -0700
committerConnor Abbott <[email protected]>2015-07-13 15:01:01 -0700
commitffb51fd112393b4bfa67da0d7c42964c83d8a9da (patch)
tree1b922c55245392bbb405af15cd0909c04811e26a /src
parent45f8723f448859a48d51fc3d5a555d4bc7a4eeb9 (diff)
nir/spirv: update to SPIR-V revision 31
This means that now the internal version of glslangValidator is required. This includes some changes due to the sampler/texture rework, but doesn't actually enable anything more yet. We also don't yet handle UBO's correctly, and don't handle matrix stride and row major/column major yet.
Diffstat (limited to 'src')
-rw-r--r--src/glsl/nir/spirv.h1474
-rw-r--r--src/glsl/nir/spirv_to_nir.c217
2 files changed, 599 insertions, 1092 deletions
diff --git a/src/glsl/nir/spirv.h b/src/glsl/nir/spirv.h
index da717ecd342..55bdcbee8b5 100644
--- a/src/glsl/nir/spirv.h
+++ b/src/glsl/nir/spirv.h
@@ -1,20 +1,20 @@
/*
** Copyright (c) 2015 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/
-**
+** 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
@@ -30,11 +30,16 @@
*/
/*
-** Specification revision 30.
-** Enumeration tokens for SPIR-V, in three styles: C, C++, generic.
-** - C++ will have the tokens in the "spv" name space, with no prefix.
-** - C will have tokens with as "Spv" prefix.
-**
+** Specification revision 31.
+** Enumeration tokens for SPIR-V, in various styles:
+** C, C++, C++11, JSON, Lua, Python
+**
+** - C will have tokens with a "Spv" prefix, e.g.: SpvSourceLanguageGLSL
+** - C++ will have tokens in the "spv" name space, e.g.: spv::SourceLanguageGLSL
+** - C++11 will use enum classes in the spv namespace, e.g.: spv::SourceLanguage::GLSL
+** - Lua will use tables, e.g.: spv.SourceLanguage.GLSL
+** - Python will use dictionaries, e.g.: spv['SourceLanguage']['GLSL']
+**
** Some tokens act like mask values, which can be OR'd together,
** while others are mutually exclusive. The mask-like ones have
** "Mask" in their name, and a parallel enum that has the shift
@@ -44,645 +49,11 @@
#ifndef spirv_H
#define spirv_H
-#ifdef __cplusplus
-
-namespace spv {
-
-static const int MagicNumber = 0x07230203;
-static const int Version = 99;
-
-typedef unsigned int Id;
-
-static const unsigned int OpCodeMask = 0xFFFF;
-static const unsigned int WordCountShift = 16;
-
-enum SourceLanguage {
- SourceLanguageUnknown = 0,
- SourceLanguageESSL = 1,
- SourceLanguageGLSL = 2,
- SourceLanguageOpenCL = 3,
-};
-
-enum ExecutionModel {
- ExecutionModelVertex = 0,
- ExecutionModelTessellationControl = 1,
- ExecutionModelTessellationEvaluation = 2,
- ExecutionModelGeometry = 3,
- ExecutionModelFragment = 4,
- ExecutionModelGLCompute = 5,
- ExecutionModelKernel = 6,
-};
-
-enum AddressingModel {
- AddressingModelLogical = 0,
- AddressingModelPhysical32 = 1,
- AddressingModelPhysical64 = 2,
-};
-
-enum MemoryModel {
- MemoryModelSimple = 0,
- MemoryModelGLSL450 = 1,
- MemoryModelOpenCL12 = 2,
- MemoryModelOpenCL20 = 3,
- MemoryModelOpenCL21 = 4,
-};
-
-enum ExecutionMode {
- ExecutionModeInvocations = 0,
- ExecutionModeSpacingEqual = 1,
- ExecutionModeSpacingFractionalEven = 2,
- ExecutionModeSpacingFractionalOdd = 3,
- ExecutionModeVertexOrderCw = 4,
- ExecutionModeVertexOrderCcw = 5,
- ExecutionModePixelCenterInteger = 6,
- ExecutionModeOriginUpperLeft = 7,
- ExecutionModeEarlyFragmentTests = 8,
- ExecutionModePointMode = 9,
- ExecutionModeXfb = 10,
- ExecutionModeDepthReplacing = 11,
- ExecutionModeDepthAny = 12,
- ExecutionModeDepthGreater = 13,
- ExecutionModeDepthLess = 14,
- ExecutionModeDepthUnchanged = 15,
- ExecutionModeLocalSize = 16,
- ExecutionModeLocalSizeHint = 17,
- ExecutionModeInputPoints = 18,
- ExecutionModeInputLines = 19,
- ExecutionModeInputLinesAdjacency = 20,
- ExecutionModeInputTriangles = 21,
- ExecutionModeInputTrianglesAdjacency = 22,
- ExecutionModeInputQuads = 23,
- ExecutionModeInputIsolines = 24,
- ExecutionModeOutputVertices = 25,
- ExecutionModeOutputPoints = 26,
- ExecutionModeOutputLineStrip = 27,
- ExecutionModeOutputTriangleStrip = 28,
- ExecutionModeVecTypeHint = 29,
- ExecutionModeContractionOff = 30,
-};
-
-enum StorageClass {
- StorageClassUniformConstant = 0,
- StorageClassInput = 1,
- StorageClassUniform = 2,
- StorageClassOutput = 3,
- StorageClassWorkgroupLocal = 4,
- StorageClassWorkgroupGlobal = 5,
- StorageClassPrivateGlobal = 6,
- StorageClassFunction = 7,
- StorageClassGeneric = 8,
- StorageClassPrivate = 9,
- StorageClassAtomicCounter = 10,
-};
-
-enum Dim {
- Dim1D = 0,
- Dim2D = 1,
- Dim3D = 2,
- DimCube = 3,
- DimRect = 4,
- DimBuffer = 5,
-};
-
-enum SamplerAddressingMode {
- SamplerAddressingModeNone = 0,
- SamplerAddressingModeClampToEdge = 1,
- SamplerAddressingModeClamp = 2,
- SamplerAddressingModeRepeat = 3,
- SamplerAddressingModeRepeatMirrored = 4,
-};
-
-enum SamplerFilterMode {
- SamplerFilterModeNearest = 0,
- SamplerFilterModeLinear = 1,
-};
-
-enum FPFastMathModeShift {
- FPFastMathModeNotNaNShift = 0,
- FPFastMathModeNotInfShift = 1,
- FPFastMathModeNSZShift = 2,
- FPFastMathModeAllowRecipShift = 3,
- FPFastMathModeFastShift = 4,
-};
-
-enum FPFastMathModeMask {
- FPFastMathModeMaskNone = 0,
- FPFastMathModeNotNaNMask = 0x00000001,
- FPFastMathModeNotInfMask = 0x00000002,
- FPFastMathModeNSZMask = 0x00000004,
- FPFastMathModeAllowRecipMask = 0x00000008,
- FPFastMathModeFastMask = 0x00000010,
-};
-
-enum FPRoundingMode {
- FPRoundingModeRTE = 0,
- FPRoundingModeRTZ = 1,
- FPRoundingModeRTP = 2,
- FPRoundingModeRTN = 3,
-};
-
-enum LinkageType {
- LinkageTypeExport = 0,
- LinkageTypeImport = 1,
-};
-
-enum AccessQualifier {
- AccessQualifierReadOnly = 0,
- AccessQualifierWriteOnly = 1,
- AccessQualifierReadWrite = 2,
-};
-
-enum FunctionParameterAttribute {
- FunctionParameterAttributeZext = 0,
- FunctionParameterAttributeSext = 1,
- FunctionParameterAttributeByVal = 2,
- FunctionParameterAttributeSret = 3,
- FunctionParameterAttributeNoAlias = 4,
- FunctionParameterAttributeNoCapture = 5,
- FunctionParameterAttributeSVM = 6,
- FunctionParameterAttributeNoWrite = 7,
- FunctionParameterAttributeNoReadWrite = 8,
-};
-
-enum Decoration {
- DecorationPrecisionLow = 0,
- DecorationPrecisionMedium = 1,
- DecorationPrecisionHigh = 2,
- DecorationBlock = 3,
- DecorationBufferBlock = 4,
- DecorationRowMajor = 5,
- DecorationColMajor = 6,
- DecorationGLSLShared = 7,
- DecorationGLSLStd140 = 8,
- DecorationGLSLStd430 = 9,
- DecorationGLSLPacked = 10,
- DecorationSmooth = 11,
- DecorationNoperspective = 12,
- DecorationFlat = 13,
- DecorationPatch = 14,
- DecorationCentroid = 15,
- DecorationSample = 16,
- DecorationInvariant = 17,
- DecorationRestrict = 18,
- DecorationAliased = 19,
- DecorationVolatile = 20,
- DecorationConstant = 21,
- DecorationCoherent = 22,
- DecorationNonwritable = 23,
- DecorationNonreadable = 24,
- DecorationUniform = 25,
- DecorationNoStaticUse = 26,
- DecorationCPacked = 27,
- DecorationSaturatedConversion = 28,
- DecorationStream = 29,
- DecorationLocation = 30,
- DecorationComponent = 31,
- DecorationIndex = 32,
- DecorationBinding = 33,
- DecorationDescriptorSet = 34,
- DecorationOffset = 35,
- DecorationAlignment = 36,
- DecorationXfbBuffer = 37,
- DecorationStride = 38,
- DecorationBuiltIn = 39,
- DecorationFuncParamAttr = 40,
- DecorationFPRoundingMode = 41,
- DecorationFPFastMathMode = 42,
- DecorationLinkageAttributes = 43,
- DecorationSpecId = 44,
-};
-
-enum BuiltIn {
- BuiltInPosition = 0,
- BuiltInPointSize = 1,
- BuiltInClipVertex = 2,
- BuiltInClipDistance = 3,
- BuiltInCullDistance = 4,
- BuiltInVertexId = 5,
- BuiltInInstanceId = 6,
- BuiltInPrimitiveId = 7,
- BuiltInInvocationId = 8,
- BuiltInLayer = 9,
- BuiltInViewportIndex = 10,
- BuiltInTessLevelOuter = 11,
- BuiltInTessLevelInner = 12,
- BuiltInTessCoord = 13,
- BuiltInPatchVertices = 14,
- BuiltInFragCoord = 15,
- BuiltInPointCoord = 16,
- BuiltInFrontFacing = 17,
- BuiltInSampleId = 18,
- BuiltInSamplePosition = 19,
- BuiltInSampleMask = 20,
- BuiltInFragColor = 21,
- BuiltInFragDepth = 22,
- BuiltInHelperInvocation = 23,
- BuiltInNumWorkgroups = 24,
- BuiltInWorkgroupSize = 25,
- BuiltInWorkgroupId = 26,
- BuiltInLocalInvocationId = 27,
- BuiltInGlobalInvocationId = 28,
- BuiltInLocalInvocationIndex = 29,
- BuiltInWorkDim = 30,
- BuiltInGlobalSize = 31,
- BuiltInEnqueuedWorkgroupSize = 32,
- BuiltInGlobalOffset = 33,
- BuiltInGlobalLinearId = 34,
- BuiltInWorkgroupLinearId = 35,
- BuiltInSubgroupSize = 36,
- BuiltInSubgroupMaxSize = 37,
- BuiltInNumSubgroups = 38,
- BuiltInNumEnqueuedSubgroups = 39,
- BuiltInSubgroupId = 40,
- BuiltInSubgroupLocalInvocationId = 41,
-};
-
-enum SelectionControlShift {
- SelectionControlFlattenShift = 0,
- SelectionControlDontFlattenShift = 1,
-};
-
-enum SelectionControlMask {
- SelectionControlMaskNone = 0,
- SelectionControlFlattenMask = 0x00000001,
- SelectionControlDontFlattenMask = 0x00000002,
-};
-
-enum LoopControlShift {
- LoopControlUnrollShift = 0,
- LoopControlDontUnrollShift = 1,
-};
-
-enum LoopControlMask {
- LoopControlMaskNone = 0,
- LoopControlUnrollMask = 0x00000001,
- LoopControlDontUnrollMask = 0x00000002,
-};
-
-enum FunctionControlShift {
- FunctionControlInlineShift = 0,
- FunctionControlDontInlineShift = 1,
- FunctionControlPureShift = 2,
- FunctionControlConstShift = 3,
-};
-
-enum FunctionControlMask {
- FunctionControlMaskNone = 0,
- FunctionControlInlineMask = 0x00000001,
- FunctionControlDontInlineMask = 0x00000002,
- FunctionControlPureMask = 0x00000004,
- FunctionControlConstMask = 0x00000008,
-};
-
-enum MemorySemanticsShift {
- MemorySemanticsRelaxedShift = 0,
- MemorySemanticsSequentiallyConsistentShift = 1,
- MemorySemanticsAcquireShift = 2,
- MemorySemanticsReleaseShift = 3,
- MemorySemanticsUniformMemoryShift = 4,
- MemorySemanticsSubgroupMemoryShift = 5,
- MemorySemanticsWorkgroupLocalMemoryShift = 6,
- MemorySemanticsWorkgroupGlobalMemoryShift = 7,
- MemorySemanticsAtomicCounterMemoryShift = 8,
- MemorySemanticsImageMemoryShift = 9,
-};
-
-enum MemorySemanticsMask {
- MemorySemanticsMaskNone = 0,
- MemorySemanticsRelaxedMask = 0x00000001,
- MemorySemanticsSequentiallyConsistentMask = 0x00000002,
- MemorySemanticsAcquireMask = 0x00000004,
- MemorySemanticsReleaseMask = 0x00000008,
- MemorySemanticsUniformMemoryMask = 0x00000010,
- MemorySemanticsSubgroupMemoryMask = 0x00000020,
- MemorySemanticsWorkgroupLocalMemoryMask = 0x00000040,
- MemorySemanticsWorkgroupGlobalMemoryMask = 0x00000080,
- MemorySemanticsAtomicCounterMemoryMask = 0x00000100,
- MemorySemanticsImageMemoryMask = 0x00000200,
-};
-
-enum MemoryAccessShift {
- MemoryAccessVolatileShift = 0,
- MemoryAccessAlignedShift = 1,
-};
-
-enum MemoryAccessMask {
- MemoryAccessMaskNone = 0,
- MemoryAccessVolatileMask = 0x00000001,
- MemoryAccessAlignedMask = 0x00000002,
-};
-
-enum ExecutionScope {
- ExecutionScopeCrossDevice = 0,
- ExecutionScopeDevice = 1,
- ExecutionScopeWorkgroup = 2,
- ExecutionScopeSubgroup = 3,
-};
-
-enum GroupOperation {
- GroupOperationReduce = 0,
- GroupOperationInclusiveScan = 1,
- GroupOperationExclusiveScan = 2,
-};
-
-enum KernelEnqueueFlags {
- KernelEnqueueFlagsNoWait = 0,
- KernelEnqueueFlagsWaitKernel = 1,
- KernelEnqueueFlagsWaitWorkGroup = 2,
-};
-
-enum KernelProfilingInfoShift {
- KernelProfilingInfoCmdExecTimeShift = 0,
-};
-
-enum KernelProfilingInfoMask {
- KernelProfilingInfoMaskNone = 0,
- KernelProfilingInfoCmdExecTimeMask = 0x00000001,
-};
-
-enum Op {
- OpNop = 0,
- OpSource = 1,
- OpSourceExtension = 2,
- OpExtension = 3,
- OpExtInstImport = 4,
- OpMemoryModel = 5,
- OpEntryPoint = 6,
- OpExecutionMode = 7,
- OpTypeVoid = 8,
- OpTypeBool = 9,
- OpTypeInt = 10,
- OpTypeFloat = 11,
- OpTypeVector = 12,
- OpTypeMatrix = 13,
- OpTypeSampler = 14,
- OpTypeFilter = 15,
- OpTypeArray = 16,
- OpTypeRuntimeArray = 17,
- OpTypeStruct = 18,
- OpTypeOpaque = 19,
- OpTypePointer = 20,
- OpTypeFunction = 21,
- OpTypeEvent = 22,
- OpTypeDeviceEvent = 23,
- OpTypeReserveId = 24,
- OpTypeQueue = 25,
- OpTypePipe = 26,
- OpConstantTrue = 27,
- OpConstantFalse = 28,
- OpConstant = 29,
- OpConstantComposite = 30,
- OpConstantSampler = 31,
- OpConstantNullPointer = 32,
- OpConstantNullObject = 33,
- OpSpecConstantTrue = 34,
- OpSpecConstantFalse = 35,
- OpSpecConstant = 36,
- OpSpecConstantComposite = 37,
- OpVariable = 38,
- OpVariableArray = 39,
- OpFunction = 40,
- OpFunctionParameter = 41,
- OpFunctionEnd = 42,
- OpFunctionCall = 43,
- OpExtInst = 44,
- OpUndef = 45,
- OpLoad = 46,
- OpStore = 47,
- OpPhi = 48,
- OpDecorationGroup = 49,
- OpDecorate = 50,
- OpMemberDecorate = 51,
- OpGroupDecorate = 52,
- OpGroupMemberDecorate = 53,
- OpName = 54,
- OpMemberName = 55,
- OpString = 56,
- OpLine = 57,
- OpVectorExtractDynamic = 58,
- OpVectorInsertDynamic = 59,
- OpVectorShuffle = 60,
- OpCompositeConstruct = 61,
- OpCompositeExtract = 62,
- OpCompositeInsert = 63,
- OpCopyObject = 64,
- OpCopyMemory = 65,
- OpCopyMemorySized = 66,
- OpSampler = 67,
- OpTextureSample = 68,
- OpTextureSampleDref = 69,
- OpTextureSampleLod = 70,
- OpTextureSampleProj = 71,
- OpTextureSampleGrad = 72,
- OpTextureSampleOffset = 73,
- OpTextureSampleProjLod = 74,
- OpTextureSampleProjGrad = 75,
- OpTextureSampleLodOffset = 76,
- OpTextureSampleProjOffset = 77,
- OpTextureSampleGradOffset = 78,
- OpTextureSampleProjLodOffset = 79,
- OpTextureSampleProjGradOffset = 80,
- OpTextureFetchTexelLod = 81,
- OpTextureFetchTexelOffset = 82,
- OpTextureFetchSample = 83,
- OpTextureFetchTexel = 84,
- OpTextureGather = 85,
- OpTextureGatherOffset = 86,
- OpTextureGatherOffsets = 87,
- OpTextureQuerySizeLod = 88,
- OpTextureQuerySize = 89,
- OpTextureQueryLod = 90,
- OpTextureQueryLevels = 91,
- OpTextureQuerySamples = 92,
- OpAccessChain = 93,
- OpInBoundsAccessChain = 94,
- OpSNegate = 95,
- OpFNegate = 96,
- OpNot = 97,
- OpAny = 98,
- OpAll = 99,
- OpConvertFToU = 100,
- OpConvertFToS = 101,
- OpConvertSToF = 102,
- OpConvertUToF = 103,
- OpUConvert = 104,
- OpSConvert = 105,
- OpFConvert = 106,
- OpConvertPtrToU = 107,
- OpConvertUToPtr = 108,
- OpPtrCastToGeneric = 109,
- OpGenericCastToPtr = 110,
- OpBitcast = 111,
- OpTranspose = 112,
- OpIsNan = 113,
- OpIsInf = 114,
- OpIsFinite = 115,
- OpIsNormal = 116,
- OpSignBitSet = 117,
- OpLessOrGreater = 118,
- OpOrdered = 119,
- OpUnordered = 120,
- OpArrayLength = 121,
- OpIAdd = 122,
- OpFAdd = 123,
- OpISub = 124,
- OpFSub = 125,
- OpIMul = 126,
- OpFMul = 127,
- OpUDiv = 128,
- OpSDiv = 129,
- OpFDiv = 130,
- OpUMod = 131,
- OpSRem = 132,
- OpSMod = 133,
- OpFRem = 134,
- OpFMod = 135,
- OpVectorTimesScalar = 136,
- OpMatrixTimesScalar = 137,
- OpVectorTimesMatrix = 138,
- OpMatrixTimesVector = 139,
- OpMatrixTimesMatrix = 140,
- OpOuterProduct = 141,
- OpDot = 142,
- OpShiftRightLogical = 143,
- OpShiftRightArithmetic = 144,
- OpShiftLeftLogical = 145,
- OpLogicalOr = 146,
- OpLogicalXor = 147,
- OpLogicalAnd = 148,
- OpBitwiseOr = 149,
- OpBitwiseXor = 150,
- OpBitwiseAnd = 151,
- OpSelect = 152,
- OpIEqual = 153,
- OpFOrdEqual = 154,
- OpFUnordEqual = 155,
- OpINotEqual = 156,
- OpFOrdNotEqual = 157,
- OpFUnordNotEqual = 158,
- OpULessThan = 159,
- OpSLessThan = 160,
- OpFOrdLessThan = 161,
- OpFUnordLessThan = 162,
- OpUGreaterThan = 163,
- OpSGreaterThan = 164,
- OpFOrdGreaterThan = 165,
- OpFUnordGreaterThan = 166,
- OpULessThanEqual = 167,
- OpSLessThanEqual = 168,
- OpFOrdLessThanEqual = 169,
- OpFUnordLessThanEqual = 170,
- OpUGreaterThanEqual = 171,
- OpSGreaterThanEqual = 172,
- OpFOrdGreaterThanEqual = 173,
- OpFUnordGreaterThanEqual = 174,
- OpDPdx = 175,
- OpDPdy = 176,
- OpFwidth = 177,
- OpDPdxFine = 178,
- OpDPdyFine = 179,
- OpFwidthFine = 180,
- OpDPdxCoarse = 181,
- OpDPdyCoarse = 182,
- OpFwidthCoarse = 183,
- OpEmitVertex = 184,
- OpEndPrimitive = 185,
- OpEmitStreamVertex = 186,
- OpEndStreamPrimitive = 187,
- OpControlBarrier = 188,
- OpMemoryBarrier = 189,
- OpImagePointer = 190,
- OpAtomicInit = 191,
- OpAtomicLoad = 192,
- OpAtomicStore = 193,
- OpAtomicExchange = 194,
- OpAtomicCompareExchange = 195,
- OpAtomicCompareExchangeWeak = 196,
- OpAtomicIIncrement = 197,
- OpAtomicIDecrement = 198,
- OpAtomicIAdd = 199,
- OpAtomicISub = 200,
- OpAtomicUMin = 201,
- OpAtomicUMax = 202,
- OpAtomicAnd = 203,
- OpAtomicOr = 204,
- OpAtomicXor = 205,
- OpLoopMerge = 206,
- OpSelectionMerge = 207,
- OpLabel = 208,
- OpBranch = 209,
- OpBranchConditional = 210,
- OpSwitch = 211,
- OpKill = 212,
- OpReturn = 213,
- OpReturnValue = 214,
- OpUnreachable = 215,
- OpLifetimeStart = 216,
- OpLifetimeStop = 217,
- OpCompileFlag = 218,
- OpAsyncGroupCopy = 219,
- OpWaitGroupEvents = 220,
- OpGroupAll = 221,
- OpGroupAny = 222,
- OpGroupBroadcast = 223,
- OpGroupIAdd = 224,
- OpGroupFAdd = 225,
- OpGroupFMin = 226,
- OpGroupUMin = 227,
- OpGroupSMin = 228,
- OpGroupFMax = 229,
- OpGroupUMax = 230,
- OpGroupSMax = 231,
- OpGenericCastToPtrExplicit = 232,
- OpGenericPtrMemSemantics = 233,
- OpReadPipe = 234,
- OpWritePipe = 235,
- OpReservedReadPipe = 236,
- OpReservedWritePipe = 237,
- OpReserveReadPipePackets = 238,
- OpReserveWritePipePackets = 239,
- OpCommitReadPipe = 240,
- OpCommitWritePipe = 241,
- OpIsValidReserveId = 242,
- OpGetNumPipePackets = 243,
- OpGetMaxPipePackets = 244,
- OpGroupReserveReadPipePackets = 245,
- OpGroupReserveWritePipePackets = 246,
- OpGroupCommitReadPipe = 247,
- OpGroupCommitWritePipe = 248,
- OpEnqueueMarker = 249,
- OpEnqueueKernel = 250,
- OpGetKernelNDrangeSubGroupCount = 251,
- OpGetKernelNDrangeMaxSubGroupSize = 252,
- OpGetKernelWorkGroupSize = 253,
- OpGetKernelPreferredWorkGroupSizeMultiple = 254,
- OpRetainEvent = 255,
- OpReleaseEvent = 256,
- OpCreateUserEvent = 257,
- OpIsValidEvent = 258,
- OpSetUserEventStatus = 259,
- OpCaptureEventProfilingInfo = 260,
- OpGetDefaultQueue = 261,
- OpBuildNDRange = 262,
- OpSatConvertSToU = 263,
- OpSatConvertUToS = 264,
- OpAtomicIMin = 265,
- OpAtomicIMax = 266,
-};
-
-}; // end namespace spv
-
-#endif // #ifdef __cplusplus
-
-
-#ifndef __cplusplus
-
-static const int SpvMagicNumber = 0x07230203;
-static const int SpvVersion = 99;
-
typedef unsigned int SpvId;
-static const unsigned int SpvOpCodeMask = 0xFFFF;
+static const unsigned int SpvMagicNumber = 0x07230203;
+static const unsigned int SpvVersion = 99;
+static const unsigned int SpvOpCodeMask = 0xffff;
static const unsigned int SpvWordCountShift = 16;
typedef enum SpvSourceLanguage_ {
@@ -711,9 +82,7 @@ typedef enum SpvAddressingModel_ {
typedef enum SpvMemoryModel_ {
SpvMemoryModelSimple = 0,
SpvMemoryModelGLSL450 = 1,
- SpvMemoryModelOpenCL12 = 2,
- SpvMemoryModelOpenCL20 = 3,
- SpvMemoryModelOpenCL21 = 4,
+ SpvMemoryModelOpenCL = 2,
} SpvMemoryModel;
typedef enum SpvExecutionMode_ {
@@ -725,29 +94,30 @@ typedef enum SpvExecutionMode_ {
SpvExecutionModeVertexOrderCcw = 5,
SpvExecutionModePixelCenterInteger = 6,
SpvExecutionModeOriginUpperLeft = 7,
- SpvExecutionModeEarlyFragmentTests = 8,
- SpvExecutionModePointMode = 9,
- SpvExecutionModeXfb = 10,
- SpvExecutionModeDepthReplacing = 11,
- SpvExecutionModeDepthAny = 12,
- SpvExecutionModeDepthGreater = 13,
- SpvExecutionModeDepthLess = 14,
- SpvExecutionModeDepthUnchanged = 15,
- SpvExecutionModeLocalSize = 16,
- SpvExecutionModeLocalSizeHint = 17,
- SpvExecutionModeInputPoints = 18,
- SpvExecutionModeInputLines = 19,
- SpvExecutionModeInputLinesAdjacency = 20,
- SpvExecutionModeInputTriangles = 21,
- SpvExecutionModeInputTrianglesAdjacency = 22,
- SpvExecutionModeInputQuads = 23,
- SpvExecutionModeInputIsolines = 24,
- SpvExecutionModeOutputVertices = 25,
- SpvExecutionModeOutputPoints = 26,
- SpvExecutionModeOutputLineStrip = 27,
- SpvExecutionModeOutputTriangleStrip = 28,
- SpvExecutionModeVecTypeHint = 29,
- SpvExecutionModeContractionOff = 30,
+ SpvExecutionModeOriginLowerLeft = 8,
+ SpvExecutionModeEarlyFragmentTests = 9,
+ SpvExecutionModePointMode = 10,
+ SpvExecutionModeXfb = 11,
+ SpvExecutionModeDepthReplacing = 12,
+ SpvExecutionModeDepthAny = 13,
+ SpvExecutionModeDepthGreater = 14,
+ SpvExecutionModeDepthLess = 15,
+ SpvExecutionModeDepthUnchanged = 16,
+ SpvExecutionModeLocalSize = 17,
+ SpvExecutionModeLocalSizeHint = 18,
+ SpvExecutionModeInputPoints = 19,
+ SpvExecutionModeInputLines = 20,
+ SpvExecutionModeInputLinesAdjacency = 21,
+ SpvExecutionModeInputTriangles = 22,
+ SpvExecutionModeInputTrianglesAdjacency = 23,
+ SpvExecutionModeInputQuads = 24,
+ SpvExecutionModeInputIsolines = 25,
+ SpvExecutionModeOutputVertices = 26,
+ SpvExecutionModeOutputPoints = 27,
+ SpvExecutionModeOutputLineStrip = 28,
+ SpvExecutionModeOutputTriangleStrip = 29,
+ SpvExecutionModeVecTypeHint = 30,
+ SpvExecutionModeContractionOff = 31,
} SpvExecutionMode;
typedef enum SpvStorageClass_ {
@@ -760,8 +130,9 @@ typedef enum SpvStorageClass_ {
SpvStorageClassPrivateGlobal = 6,
SpvStorageClassFunction = 7,
SpvStorageClassGeneric = 8,
- SpvStorageClassPrivate = 9,
+ SpvStorageClassPushConstant = 9,
SpvStorageClassAtomicCounter = 10,
+ SpvStorageClassImage = 11,
} SpvStorageClass;
typedef enum SpvDim_ {
@@ -786,6 +157,109 @@ typedef enum SpvSamplerFilterMode_ {
SpvSamplerFilterModeLinear = 1,
} SpvSamplerFilterMode;
+typedef enum SpvImageFormat_ {
+ SpvImageFormatUnknown = 0,
+ SpvImageFormatRgba32f = 1,
+ SpvImageFormatRgba16f = 2,
+ SpvImageFormatR32f = 3,
+ SpvImageFormatRgba8 = 4,
+ SpvImageFormatRgba8Snorm = 5,
+ SpvImageFormatRg32f = 6,
+ SpvImageFormatRg16f = 7,
+ SpvImageFormatR11fG11fB10f = 8,
+ SpvImageFormatR16f = 9,
+ SpvImageFormatRgba16 = 10,
+ SpvImageFormatRgb10A2 = 11,
+ SpvImageFormatRg16 = 12,
+ SpvImageFormatRg8 = 13,
+ SpvImageFormatR16 = 14,
+ SpvImageFormatR8 = 15,
+ SpvImageFormatRgba16Snorm = 16,
+ SpvImageFormatRg16Snorm = 17,
+ SpvImageFormatRg8Snorm = 18,
+ SpvImageFormatR16Snorm = 19,
+ SpvImageFormatR8Snorm = 20,
+ SpvImageFormatRgba32i = 21,
+ SpvImageFormatRgba16i = 22,
+ SpvImageFormatRgba8i = 23,
+ SpvImageFormatR32i = 24,
+ SpvImageFormatRg32i = 25,
+ SpvImageFormatRg16i = 26,
+ SpvImageFormatRg8i = 27,
+ SpvImageFormatR16i = 28,
+ SpvImageFormatR8i = 29,
+ SpvImageFormatRgba32ui = 30,
+ SpvImageFormatRgba16ui = 31,
+ SpvImageFormatRgba8ui = 32,
+ SpvImageFormatR32ui = 33,
+ SpvImageFormatRgb10a2ui = 34,
+ SpvImageFormatRg32ui = 35,
+ SpvImageFormatRg16ui = 36,
+ SpvImageFormatRg8ui = 37,
+ SpvImageFormatR16ui = 38,
+ SpvImageFormatR8ui = 39,
+} SpvImageFormat;
+
+typedef enum SpvImageChannelOrder_ {
+ SpvImageChannelOrderR = 0,
+ SpvImageChannelOrderA = 1,
+ SpvImageChannelOrderRG = 2,
+ SpvImageChannelOrderRA = 3,
+ SpvImageChannelOrderRGB = 4,
+ SpvImageChannelOrderRGBA = 5,
+ SpvImageChannelOrderBGRA = 6,
+ SpvImageChannelOrderARGB = 7,
+ SpvImageChannelOrderIntensity = 8,
+ SpvImageChannelOrderLuminance = 9,
+ SpvImageChannelOrderRx = 10,
+ SpvImageChannelOrderRGx = 11,
+ SpvImageChannelOrderRGBx = 12,
+ SpvImageChannelOrderDepth = 13,
+ SpvImageChannelOrderDepthStencil = 14,
+ SpvImageChannelOrdersRGB = 15,
+ SpvImageChannelOrdersRGBx = 16,
+ SpvImageChannelOrdersRGBA = 17,
+ SpvImageChannelOrdersBGRA = 18,
+} SpvImageChannelOrder;
+
+typedef enum SpvImageChannelDataType_ {
+ SpvImageChannelDataTypeSnormInt8 = 0,
+ SpvImageChannelDataTypeSnormInt16 = 1,
+ SpvImageChannelDataTypeUnormInt8 = 2,
+ SpvImageChannelDataTypeUnormInt16 = 3,
+ SpvImageChannelDataTypeUnormShort565 = 4,
+ SpvImageChannelDataTypeUnormShort555 = 5,
+ SpvImageChannelDataTypeUnormInt101010 = 6,
+ SpvImageChannelDataTypeSignedInt8 = 7,
+ SpvImageChannelDataTypeSignedInt16 = 8,
+ SpvImageChannelDataTypeSignedInt32 = 9,
+ SpvImageChannelDataTypeUnsignedInt8 = 10,
+ SpvImageChannelDataTypeUnsignedInt16 = 11,
+ SpvImageChannelDataTypeUnsignedInt32 = 12,
+ SpvImageChannelDataTypeHalfFloat = 13,
+ SpvImageChannelDataTypeFloat = 14,
+ SpvImageChannelDataTypeUnormInt24 = 15,
+} SpvImageChannelDataType;
+
+typedef enum SpvImageOperandsShift_ {
+ SpvImageOperandsBiasShift = 0,
+ SpvImageOperandsLodShift = 1,
+ SpvImageOperandsGradShift = 2,
+ SpvImageOperandsOffsetShift = 3,
+ SpvImageOperandsOffsetsShift = 4,
+ SpvImageOperandsSampleShift = 5,
+} SpvImageOperandsShift;
+
+typedef enum SpvImageOperandsMask_ {
+ SpvImageOperandsMaskNone = 0,
+ SpvImageOperandsBiasMask = 0x00000001,
+ SpvImageOperandsLodMask = 0x00000002,
+ SpvImageOperandsGradMask = 0x00000004,
+ SpvImageOperandsOffsetMask = 0x00000008,
+ SpvImageOperandsOffsetsMask = 0x00000010,
+ SpvImageOperandsSampleMask = 0x00000020,
+} SpvImageOperandsMask;
+
typedef enum SpvFPFastMathModeShift_ {
SpvFPFastMathModeNotNaNShift = 0,
SpvFPFastMathModeNotInfShift = 1,
@@ -834,34 +308,34 @@ typedef enum SpvFunctionParameterAttribute_ {
} SpvFunctionParameterAttribute;
typedef enum SpvDecoration_ {
- SpvDecorationPrecisionLow = 0,
- SpvDecorationPrecisionMedium = 1,
- SpvDecorationPrecisionHigh = 2,
- SpvDecorationBlock = 3,
- SpvDecorationBufferBlock = 4,
- SpvDecorationRowMajor = 5,
- SpvDecorationColMajor = 6,
- SpvDecorationGLSLShared = 7,
- SpvDecorationGLSLStd140 = 8,
- SpvDecorationGLSLStd430 = 9,
- SpvDecorationGLSLPacked = 10,
- SpvDecorationSmooth = 11,
- SpvDecorationNoperspective = 12,
- SpvDecorationFlat = 13,
- SpvDecorationPatch = 14,
- SpvDecorationCentroid = 15,
- SpvDecorationSample = 16,
- SpvDecorationInvariant = 17,
- SpvDecorationRestrict = 18,
- SpvDecorationAliased = 19,
- SpvDecorationVolatile = 20,
- SpvDecorationConstant = 21,
- SpvDecorationCoherent = 22,
- SpvDecorationNonwritable = 23,
- SpvDecorationNonreadable = 24,
- SpvDecorationUniform = 25,
- SpvDecorationNoStaticUse = 26,
- SpvDecorationCPacked = 27,
+ SpvDecorationRelaxedPrecision = 0,
+ SpvDecorationSpecId = 1,
+ SpvDecorationBlock = 2,
+ SpvDecorationBufferBlock = 3,
+ SpvDecorationRowMajor = 4,
+ SpvDecorationColMajor = 5,
+ SpvDecorationArrayStride = 6,
+ SpvDecorationMatrixStride = 7,
+ SpvDecorationGLSLShared = 8,
+ SpvDecorationGLSLPacked = 9,
+ SpvDecorationCPacked = 10,
+ SpvDecorationBuiltIn = 11,
+ SpvDecorationSmooth = 12,
+ SpvDecorationNoperspective = 13,
+ SpvDecorationFlat = 14,
+ SpvDecorationPatch = 15,
+ SpvDecorationCentroid = 16,
+ SpvDecorationSample = 17,
+ SpvDecorationInvariant = 18,
+ SpvDecorationRestrict = 19,
+ SpvDecorationAliased = 20,
+ SpvDecorationVolatile = 21,
+ SpvDecorationConstant = 22,
+ SpvDecorationCoherent = 23,
+ SpvDecorationNonwritable = 24,
+ SpvDecorationNonreadable = 25,
+ SpvDecorationUniform = 26,
+ SpvDecorationNoStaticUse = 27,
SpvDecorationSaturatedConversion = 28,
SpvDecorationStream = 29,
SpvDecorationLocation = 30,
@@ -870,15 +344,12 @@ typedef enum SpvDecoration_ {
SpvDecorationBinding = 33,
SpvDecorationDescriptorSet = 34,
SpvDecorationOffset = 35,
- SpvDecorationAlignment = 36,
- SpvDecorationXfbBuffer = 37,
- SpvDecorationStride = 38,
- SpvDecorationBuiltIn = 39,
- SpvDecorationFuncParamAttr = 40,
- SpvDecorationFPRoundingMode = 41,
- SpvDecorationFPFastMathMode = 42,
- SpvDecorationLinkageAttributes = 43,
- SpvDecorationSpecId = 44,
+ SpvDecorationXfbBuffer = 36,
+ SpvDecorationXfbStride = 37,
+ SpvDecorationFuncParamAttr = 38,
+ SpvDecorationFPRoundingMode = 39,
+ SpvDecorationFPFastMathMode = 40,
+ SpvDecorationLinkageAttributes = 41,
} SpvDecoration;
typedef enum SpvBuiltIn_ {
@@ -1001,12 +472,13 @@ typedef enum SpvMemoryAccessMask_ {
SpvMemoryAccessAlignedMask = 0x00000002,
} SpvMemoryAccessMask;
-typedef enum SpvExecutionScope_ {
- SpvExecutionScopeCrossDevice = 0,
- SpvExecutionScopeDevice = 1,
- SpvExecutionScopeWorkgroup = 2,
- SpvExecutionScopeSubgroup = 3,
-} SpvExecutionScope;
+typedef enum SpvScope_ {
+ SpvScopeCrossDevice = 0,
+ SpvScopeDevice = 1,
+ SpvScopeWorkgroup = 2,
+ SpvScopeSubgroup = 3,
+ SpvScopeInvocation = 4,
+} SpvScope;
typedef enum SpvGroupOperation_ {
SpvGroupOperationReduce = 0,
@@ -1029,276 +501,308 @@ typedef enum SpvKernelProfilingInfoMask_ {
SpvKernelProfilingInfoCmdExecTimeMask = 0x00000001,
} SpvKernelProfilingInfoMask;
+typedef enum SpvCapability_ {
+ SpvCapabilityMatrix = 0,
+ SpvCapabilityShader = 1,
+ SpvCapabilityGeometry = 2,
+ SpvCapabilityTessellation = 3,
+ SpvCapabilityAddresses = 4,
+ SpvCapabilityLinkage = 5,
+ SpvCapabilityKernel = 6,
+ SpvCapabilityVector16 = 7,
+ SpvCapabilityFloat16Buffer = 8,
+ SpvCapabilityFloat16 = 9,
+ SpvCapabilityFloat64 = 10,
+ SpvCapabilityInt64 = 11,
+ SpvCapabilityInt64Atomics = 12,
+ SpvCapabilityImageBasic = 13,
+ SpvCapabilityImageReadWrite = 14,
+ SpvCapabilityImageMipmap = 15,
+ SpvCapabilityImageSRGBWrite = 16,
+ SpvCapabilityPipes = 17,
+ SpvCapabilityGroups = 18,
+ SpvCapabilityDeviceEnqueue = 19,
+ SpvCapabilityLiteralSampler = 20,
+ SpvCapabilityAtomicStorage = 21,
+ SpvCapabilityInt16 = 22,
+} SpvCapability;
+
typedef enum SpvOp_ {
SpvOpNop = 0,
- SpvOpSource = 1,
- SpvOpSourceExtension = 2,
- SpvOpExtension = 3,
- SpvOpExtInstImport = 4,
- SpvOpMemoryModel = 5,
- SpvOpEntryPoint = 6,
- SpvOpExecutionMode = 7,
- SpvOpTypeVoid = 8,
- SpvOpTypeBool = 9,
- SpvOpTypeInt = 10,
- SpvOpTypeFloat = 11,
- SpvOpTypeVector = 12,
- SpvOpTypeMatrix = 13,
- SpvOpTypeSampler = 14,
- SpvOpTypeFilter = 15,
- SpvOpTypeArray = 16,
- SpvOpTypeRuntimeArray = 17,
- SpvOpTypeStruct = 18,
- SpvOpTypeOpaque = 19,
- SpvOpTypePointer = 20,
- SpvOpTypeFunction = 21,
- SpvOpTypeEvent = 22,
- SpvOpTypeDeviceEvent = 23,
- SpvOpTypeReserveId = 24,
- SpvOpTypeQueue = 25,
- SpvOpTypePipe = 26,
- SpvOpConstantTrue = 27,
- SpvOpConstantFalse = 28,
- SpvOpConstant = 29,
- SpvOpConstantComposite = 30,
- SpvOpConstantSampler = 31,
- SpvOpConstantNullPointer = 32,
- SpvOpConstantNullObject = 33,
- SpvOpSpecConstantTrue = 34,
- SpvOpSpecConstantFalse = 35,
- SpvOpSpecConstant = 36,
- SpvOpSpecConstantComposite = 37,
- SpvOpVariable = 38,
- SpvOpVariableArray = 39,
- SpvOpFunction = 40,
- SpvOpFunctionParameter = 41,
- SpvOpFunctionEnd = 42,
- SpvOpFunctionCall = 43,
- SpvOpExtInst = 44,
- SpvOpUndef = 45,
- SpvOpLoad = 46,
- SpvOpStore = 47,
- SpvOpPhi = 48,
- SpvOpDecorationGroup = 49,
- SpvOpDecorate = 50,
- SpvOpMemberDecorate = 51,
- SpvOpGroupDecorate = 52,
- SpvOpGroupMemberDecorate = 53,
- SpvOpName = 54,
- SpvOpMemberName = 55,
- SpvOpString = 56,
- SpvOpLine = 57,
- SpvOpVectorExtractDynamic = 58,
- SpvOpVectorInsertDynamic = 59,
- SpvOpVectorShuffle = 60,
- SpvOpCompositeConstruct = 61,
- SpvOpCompositeExtract = 62,
- SpvOpCompositeInsert = 63,
- SpvOpCopyObject = 64,
- SpvOpCopyMemory = 65,
- SpvOpCopyMemorySized = 66,
- SpvOpSampler = 67,
- SpvOpTextureSample = 68,
- SpvOpTextureSampleDref = 69,
- SpvOpTextureSampleLod = 70,
- SpvOpTextureSampleProj = 71,
- SpvOpTextureSampleGrad = 72,
- SpvOpTextureSampleOffset = 73,
- SpvOpTextureSampleProjLod = 74,
- SpvOpTextureSampleProjGrad = 75,
- SpvOpTextureSampleLodOffset = 76,
- SpvOpTextureSampleProjOffset = 77,
- SpvOpTextureSampleGradOffset = 78,
- SpvOpTextureSampleProjLodOffset = 79,
- SpvOpTextureSampleProjGradOffset = 80,
- SpvOpTextureFetchTexelLod = 81,
- SpvOpTextureFetchTexelOffset = 82,
- SpvOpTextureFetchSample = 83,
- SpvOpTextureFetchTexel = 84,
- SpvOpTextureGather = 85,
- SpvOpTextureGatherOffset = 86,
- SpvOpTextureGatherOffsets = 87,
- SpvOpTextureQuerySizeLod = 88,
- SpvOpTextureQuerySize = 89,
- SpvOpTextureQueryLod = 90,
- SpvOpTextureQueryLevels = 91,
- SpvOpTextureQuerySamples = 92,
- SpvOpAccessChain = 93,
- SpvOpInBoundsAccessChain = 94,
- SpvOpSNegate = 95,
- SpvOpFNegate = 96,
- SpvOpNot = 97,
- SpvOpAny = 98,
- SpvOpAll = 99,
- SpvOpConvertFToU = 100,
- SpvOpConvertFToS = 101,
- SpvOpConvertSToF = 102,
- SpvOpConvertUToF = 103,
- SpvOpUConvert = 104,
- SpvOpSConvert = 105,
- SpvOpFConvert = 106,
- SpvOpConvertPtrToU = 107,
- SpvOpConvertUToPtr = 108,
- SpvOpPtrCastToGeneric = 109,
- SpvOpGenericCastToPtr = 110,
- SpvOpBitcast = 111,
- SpvOpTranspose = 112,
- SpvOpIsNan = 113,
- SpvOpIsInf = 114,
- SpvOpIsFinite = 115,
- SpvOpIsNormal = 116,
- SpvOpSignBitSet = 117,
- SpvOpLessOrGreater = 118,
- SpvOpOrdered = 119,
- SpvOpUnordered = 120,
- SpvOpArrayLength = 121,
- SpvOpIAdd = 122,
- SpvOpFAdd = 123,
- SpvOpISub = 124,
- SpvOpFSub = 125,
- SpvOpIMul = 126,
- SpvOpFMul = 127,
- SpvOpUDiv = 128,
- SpvOpSDiv = 129,
- SpvOpFDiv = 130,
- SpvOpUMod = 131,
- SpvOpSRem = 132,
- SpvOpSMod = 133,
- SpvOpFRem = 134,
- SpvOpFMod = 135,
- SpvOpVectorTimesScalar = 136,
- SpvOpMatrixTimesScalar = 137,
- SpvOpVectorTimesMatrix = 138,
- SpvOpMatrixTimesVector = 139,
- SpvOpMatrixTimesMatrix = 140,
- SpvOpOuterProduct = 141,
- SpvOpDot = 142,
- SpvOpShiftRightLogical = 143,
- SpvOpShiftRightArithmetic = 144,
- SpvOpShiftLeftLogical = 145,
- SpvOpLogicalOr = 146,
- SpvOpLogicalXor = 147,
- SpvOpLogicalAnd = 148,
- SpvOpBitwiseOr = 149,
- SpvOpBitwiseXor = 150,
- SpvOpBitwiseAnd = 151,
- SpvOpSelect = 152,
- SpvOpIEqual = 153,
- SpvOpFOrdEqual = 154,
- SpvOpFUnordEqual = 155,
- SpvOpINotEqual = 156,
- SpvOpFOrdNotEqual = 157,
- SpvOpFUnordNotEqual = 158,
- SpvOpULessThan = 159,
- SpvOpSLessThan = 160,
- SpvOpFOrdLessThan = 161,
- SpvOpFUnordLessThan = 162,
- SpvOpUGreaterThan = 163,
- SpvOpSGreaterThan = 164,
- SpvOpFOrdGreaterThan = 165,
- SpvOpFUnordGreaterThan = 166,
- SpvOpULessThanEqual = 167,
- SpvOpSLessThanEqual = 168,
- SpvOpFOrdLessThanEqual = 169,
- SpvOpFUnordLessThanEqual = 170,
- SpvOpUGreaterThanEqual = 171,
- SpvOpSGreaterThanEqual = 172,
- SpvOpFOrdGreaterThanEqual = 173,
- SpvOpFUnordGreaterThanEqual = 174,
- SpvOpDPdx = 175,
- SpvOpDPdy = 176,
- SpvOpFwidth = 177,
- SpvOpDPdxFine = 178,
- SpvOpDPdyFine = 179,
- SpvOpFwidthFine = 180,
- SpvOpDPdxCoarse = 181,
- SpvOpDPdyCoarse = 182,
- SpvOpFwidthCoarse = 183,
- SpvOpEmitVertex = 184,
- SpvOpEndPrimitive = 185,
- SpvOpEmitStreamVertex = 186,
- SpvOpEndStreamPrimitive = 187,
- SpvOpControlBarrier = 188,
- SpvOpMemoryBarrier = 189,
- SpvOpImagePointer = 190,
- SpvOpAtomicInit = 191,
- SpvOpAtomicLoad = 192,
- SpvOpAtomicStore = 193,
- SpvOpAtomicExchange = 194,
- SpvOpAtomicCompareExchange = 195,
- SpvOpAtomicCompareExchangeWeak = 196,
- SpvOpAtomicIIncrement = 197,
- SpvOpAtomicIDecrement = 198,
- SpvOpAtomicIAdd = 199,
- SpvOpAtomicISub = 200,
- SpvOpAtomicUMin = 201,
- SpvOpAtomicUMax = 202,
- SpvOpAtomicAnd = 203,
- SpvOpAtomicOr = 204,
- SpvOpAtomicXor = 205,
- SpvOpLoopMerge = 206,
- SpvOpSelectionMerge = 207,
- SpvOpLabel = 208,
- SpvOpBranch = 209,
- SpvOpBranchConditional = 210,
- SpvOpSwitch = 211,
- SpvOpKill = 212,
- SpvOpReturn = 213,
- SpvOpReturnValue = 214,
- SpvOpUnreachable = 215,
- SpvOpLifetimeStart = 216,
- SpvOpLifetimeStop = 217,
- SpvOpCompileFlag = 218,
- SpvOpAsyncGroupCopy = 219,
- SpvOpWaitGroupEvents = 220,
- SpvOpGroupAll = 221,
- SpvOpGroupAny = 222,
- SpvOpGroupBroadcast = 223,
- SpvOpGroupIAdd = 224,
- SpvOpGroupFAdd = 225,
- SpvOpGroupFMin = 226,
- SpvOpGroupUMin = 227,
- SpvOpGroupSMin = 228,
- SpvOpGroupFMax = 229,
- SpvOpGroupUMax = 230,
- SpvOpGroupSMax = 231,
- SpvOpGenericCastToPtrExplicit = 232,
- SpvOpGenericPtrMemSemantics = 233,
- SpvOpReadPipe = 234,
- SpvOpWritePipe = 235,
- SpvOpReservedReadPipe = 236,
- SpvOpReservedWritePipe = 237,
- SpvOpReserveReadPipePackets = 238,
- SpvOpReserveWritePipePackets = 239,
- SpvOpCommitReadPipe = 240,
- SpvOpCommitWritePipe = 241,
- SpvOpIsValidReserveId = 242,
- SpvOpGetNumPipePackets = 243,
- SpvOpGetMaxPipePackets = 244,
- SpvOpGroupReserveReadPipePackets = 245,
- SpvOpGroupReserveWritePipePackets = 246,
- SpvOpGroupCommitReadPipe = 247,
- SpvOpGroupCommitWritePipe = 248,
- SpvOpEnqueueMarker = 249,
- SpvOpEnqueueKernel = 250,
- SpvOpGetKernelNDrangeSubGroupCount = 251,
- SpvOpGetKernelNDrangeMaxSubGroupSize = 252,
- SpvOpGetKernelWorkGroupSize = 253,
- SpvOpGetKernelPreferredWorkGroupSizeMultiple = 254,
- SpvOpRetainEvent = 255,
- SpvOpReleaseEvent = 256,
- SpvOpCreateUserEvent = 257,
- SpvOpIsValidEvent = 258,
- SpvOpSetUserEventStatus = 259,
- SpvOpCaptureEventProfilingInfo = 260,
- SpvOpGetDefaultQueue = 261,
- SpvOpBuildNDRange = 262,
- SpvOpSatConvertSToU = 263,
- SpvOpSatConvertUToS = 264,
- SpvOpAtomicIMin = 265,
- SpvOpAtomicIMax = 266,
+ SpvOpUndef = 1,
+ SpvOpSource = 3,
+ SpvOpSourceExtension = 4,
+ SpvOpName = 5,
+ SpvOpMemberName = 6,
+ SpvOpString = 7,
+ SpvOpLine = 8,
+ SpvOpExtension = 10,
+ SpvOpExtInstImport = 11,
+ SpvOpExtInst = 12,
+ SpvOpMemoryModel = 14,
+ SpvOpEntryPoint = 15,
+ SpvOpExecutionMode = 16,
+ SpvOpCapability = 17,
+ SpvOpTypeVoid = 19,
+ SpvOpTypeBool = 20,
+ SpvOpTypeInt = 21,
+ SpvOpTypeFloat = 22,
+ SpvOpTypeVector = 23,
+ SpvOpTypeMatrix = 24,
+ SpvOpTypeImage = 25,
+ SpvOpTypeSampler = 26,
+ SpvOpTypeSampledImage = 27,
+ SpvOpTypeArray = 28,
+ SpvOpTypeRuntimeArray = 29,
+ SpvOpTypeStruct = 30,
+ SpvOpTypeOpaque = 31,
+ SpvOpTypePointer = 32,
+ SpvOpTypeFunction = 33,
+ SpvOpTypeEvent = 34,
+ SpvOpTypeDeviceEvent = 35,
+ SpvOpTypeReserveId = 36,
+ SpvOpTypeQueue = 37,
+ SpvOpTypePipe = 38,
+ SpvOpConstantTrue = 41,
+ SpvOpConstantFalse = 42,
+ SpvOpConstant = 43,
+ SpvOpConstantComposite = 44,
+ SpvOpConstantSampler = 45,
+ SpvOpConstantNull = 46,
+ SpvOpSpecConstantTrue = 48,
+ SpvOpSpecConstantFalse = 49,
+ SpvOpSpecConstant = 50,
+ SpvOpSpecConstantComposite = 51,
+ SpvOpSpecConstantOp = 52,
+ SpvOpFunction = 54,
+ SpvOpFunctionParameter = 55,
+ SpvOpFunctionEnd = 56,
+ SpvOpFunctionCall = 57,
+ SpvOpVariable = 59,
+ SpvOpImageTexelPointer = 60,
+ SpvOpLoad = 61,
+ SpvOpStore = 62,
+ SpvOpCopyMemory = 63,
+ SpvOpCopyMemorySized = 64,
+ SpvOpAccessChain = 65,
+ SpvOpInBoundsAccessChain = 66,
+ SpvOpPtrAccessChain = 67,
+ SpvOpArrayLength = 68,
+ SpvOpGenericPtrMemSemantics = 69,
+ SpvOpDecorate = 71,
+ SpvOpMemberDecorate = 72,
+ SpvOpDecorationGroup = 73,
+ SpvOpGroupDecorate = 74,
+ SpvOpGroupMemberDecorate = 75,
+ SpvOpVectorExtractDynamic = 77,
+ SpvOpVectorInsertDynamic = 78,
+ SpvOpVectorShuffle = 79,
+ SpvOpCompositeConstruct = 80,
+ SpvOpCompositeExtract = 81,
+ SpvOpCompositeInsert = 82,
+ SpvOpCopyObject = 83,
+ SpvOpTranspose = 84,
+ SpvOpSampledImage = 86,
+ SpvOpImageSampleImplicitLod = 87,
+ SpvOpImageSampleExplicitLod = 88,
+ SpvOpImageSampleDrefImplicitLod = 89,
+ SpvOpImageSampleDrefExplicitLod = 90,
+ SpvOpImageSampleProjImplicitLod = 91,
+ SpvOpImageSampleProjExplicitLod = 92,
+ SpvOpImageSampleProjDrefImplicitLod = 93,
+ SpvOpImageSampleProjDrefExplicitLod = 94,
+ SpvOpImageFetch = 95,
+ SpvOpImageGather = 96,
+ SpvOpImageDrefGather = 97,
+ SpvOpImageRead = 98,
+ SpvOpImageWrite = 99,
+ SpvOpImageQueryDim = 100,
+ SpvOpImageQueryFormat = 101,
+ SpvOpImageQueryOrder = 102,
+ SpvOpImageQuerySizeLod = 103,
+ SpvOpImageQuerySize = 104,
+ SpvOpImageQueryLod = 105,
+ SpvOpImageQueryLevels = 106,
+ SpvOpImageQuerySamples = 107,
+ SpvOpConvertFToU = 109,
+ SpvOpConvertFToS = 110,
+ SpvOpConvertSToF = 111,
+ SpvOpConvertUToF = 112,
+ SpvOpUConvert = 113,
+ SpvOpSConvert = 114,
+ SpvOpFConvert = 115,
+ SpvOpQuantizeToF16 = 116,
+ SpvOpConvertPtrToU = 117,
+ SpvOpSatConvertSToU = 118,
+ SpvOpSatConvertUToS = 119,
+ SpvOpConvertUToPtr = 120,
+ SpvOpPtrCastToGeneric = 121,
+ SpvOpGenericCastToPtr = 122,
+ SpvOpGenericCastToPtrExplicit = 123,
+ SpvOpBitcast = 124,
+ SpvOpSNegate = 126,
+ SpvOpFNegate = 127,
+ SpvOpIAdd = 128,
+ SpvOpFAdd = 129,
+ SpvOpISub = 130,
+ SpvOpFSub = 131,
+ SpvOpIMul = 132,
+ SpvOpFMul = 133,
+ SpvOpUDiv = 134,
+ SpvOpSDiv = 135,
+ SpvOpFDiv = 136,
+ SpvOpUMod = 137,
+ SpvOpSRem = 138,
+ SpvOpSMod = 139,
+ SpvOpFRem = 140,
+ SpvOpFMod = 141,
+ SpvOpVectorTimesScalar = 142,
+ SpvOpMatrixTimesScalar = 143,
+ SpvOpVectorTimesMatrix = 144,
+ SpvOpMatrixTimesVector = 145,
+ SpvOpMatrixTimesMatrix = 146,
+ SpvOpOuterProduct = 147,
+ SpvOpDot = 148,
+ SpvOpIAddCarry = 149,
+ SpvOpISubBorrow = 150,
+ SpvOpIMulExtended = 151,
+ SpvOpAny = 154,
+ SpvOpAll = 155,
+ SpvOpIsNan = 156,
+ SpvOpIsInf = 157,
+ SpvOpIsFinite = 158,
+ SpvOpIsNormal = 159,
+ SpvOpSignBitSet = 160,
+ SpvOpLessOrGreater = 161,
+ SpvOpOrdered = 162,
+ SpvOpUnordered = 163,
+ SpvOpLogicalEqual = 164,
+ SpvOpLogicalNotEqual = 165,
+ SpvOpLogicalOr = 166,
+ SpvOpLogicalAnd = 167,
+ SpvOpLogicalNot = 168,
+ SpvOpSelect = 169,
+ SpvOpIEqual = 170,
+ SpvOpINotEqual = 171,
+ SpvOpUGreaterThan = 172,
+ SpvOpSGreaterThan = 173,
+ SpvOpUGreaterThanEqual = 174,
+ SpvOpSGreaterThanEqual = 175,
+ SpvOpULessThan = 176,
+ SpvOpSLessThan = 177,
+ SpvOpULessThanEqual = 178,
+ SpvOpSLessThanEqual = 179,
+ SpvOpFOrdEqual = 180,
+ SpvOpFUnordEqual = 181,
+ SpvOpFOrdNotEqual = 182,
+ SpvOpFUnordNotEqual = 183,
+ SpvOpFOrdLessThan = 184,
+ SpvOpFUnordLessThan = 185,
+ SpvOpFOrdGreaterThan = 186,
+ SpvOpFUnordGreaterThan = 187,
+ SpvOpFOrdLessThanEqual = 188,
+ SpvOpFUnordLessThanEqual = 189,
+ SpvOpFOrdGreaterThanEqual = 190,
+ SpvOpFUnordGreaterThanEqual = 191,
+ SpvOpShiftRightLogical = 194,
+ SpvOpShiftRightArithmetic = 195,
+ SpvOpShiftLeftLogical = 196,
+ SpvOpBitwiseOr = 197,
+ SpvOpBitwiseXor = 198,
+ SpvOpBitwiseAnd = 199,
+ SpvOpNot = 200,
+ SpvOpBitFieldInsert = 201,
+ SpvOpBitFieldSExtract = 202,
+ SpvOpBitFieldUExtract = 203,
+ SpvOpBitReverse = 204,
+ SpvOpBitCount = 205,
+ SpvOpDPdx = 207,
+ SpvOpDPdy = 208,
+ SpvOpFwidth = 209,
+ SpvOpDPdxFine = 210,
+ SpvOpDPdyFine = 211,
+ SpvOpFwidthFine = 212,
+ SpvOpDPdxCoarse = 213,
+ SpvOpDPdyCoarse = 214,
+ SpvOpFwidthCoarse = 215,
+ SpvOpEmitVertex = 218,
+ SpvOpEndPrimitive = 219,
+ SpvOpEmitStreamVertex = 220,
+ SpvOpEndStreamPrimitive = 221,
+ SpvOpControlBarrier = 224,
+ SpvOpMemoryBarrier = 225,
+ SpvOpAtomicLoad = 227,
+ SpvOpAtomicStore = 228,
+ SpvOpAtomicExchange = 229,
+ SpvOpAtomicCompareExchange = 230,
+ SpvOpAtomicCompareExchangeWeak = 231,
+ SpvOpAtomicIIncrement = 232,
+ SpvOpAtomicIDecrement = 233,
+ SpvOpAtomicIAdd = 234,
+ SpvOpAtomicISub = 235,
+ SpvOpAtomicIMin = 236,
+ SpvOpAtomicUMin = 237,
+ SpvOpAtomicIMax = 238,
+ SpvOpAtomicUMax = 239,
+ SpvOpAtomicAnd = 240,
+ SpvOpAtomicOr = 241,
+ SpvOpAtomicXor = 242,
+ SpvOpPhi = 245,
+ SpvOpLoopMerge = 246,
+ SpvOpSelectionMerge = 247,
+ SpvOpLabel = 248,
+ SpvOpBranch = 249,
+ SpvOpBranchConditional = 250,
+ SpvOpSwitch = 251,
+ SpvOpKill = 252,
+ SpvOpReturn = 253,
+ SpvOpReturnValue = 254,
+ SpvOpUnreachable = 255,
+ SpvOpLifetimeStart = 256,
+ SpvOpLifetimeStop = 257,
+ SpvOpAsyncGroupCopy = 259,
+ SpvOpWaitGroupEvents = 260,
+ SpvOpGroupAll = 261,
+ SpvOpGroupAny = 262,
+ SpvOpGroupBroadcast = 263,
+ SpvOpGroupIAdd = 264,
+ SpvOpGroupFAdd = 265,
+ SpvOpGroupFMin = 266,
+ SpvOpGroupUMin = 267,
+ SpvOpGroupSMin = 268,
+ SpvOpGroupFMax = 269,
+ SpvOpGroupUMax = 270,
+ SpvOpGroupSMax = 271,
+ SpvOpReadPipe = 274,
+ SpvOpWritePipe = 275,
+ SpvOpReservedReadPipe = 276,
+ SpvOpReservedWritePipe = 277,
+ SpvOpReserveReadPipePackets = 278,
+ SpvOpReserveWritePipePackets = 279,
+ SpvOpCommitReadPipe = 280,
+ SpvOpCommitWritePipe = 281,
+ SpvOpIsValidReserveId = 282,
+ SpvOpGetNumPipePackets = 283,
+ SpvOpGetMaxPipePackets = 284,
+ SpvOpGroupReserveReadPipePackets = 285,
+ SpvOpGroupReserveWritePipePackets = 286,
+ SpvOpGroupCommitReadPipe = 287,
+ SpvOpGroupCommitWritePipe = 288,
+ SpvOpEnqueueMarker = 291,
+ SpvOpEnqueueKernel = 292,
+ SpvOpGetKernelNDrangeSubGroupCount = 293,
+ SpvOpGetKernelNDrangeMaxSubGroupSize = 294,
+ SpvOpGetKernelWorkGroupSize = 295,
+ SpvOpGetKernelPreferredWorkGroupSizeMultiple = 296,
+ SpvOpRetainEvent = 297,
+ SpvOpReleaseEvent = 298,
+ SpvOpCreateUserEvent = 299,
+ SpvOpIsValidEvent = 300,
+ SpvOpSetUserEventStatus = 301,
+ SpvOpCaptureEventProfilingInfo = 302,
+ SpvOpGetDefaultQueue = 303,
+ SpvOpBuildNDRange = 304,
} SpvOp;
-#endif // #ifndef __cplusplus
-
#endif // #ifndef spirv_H
+
diff --git a/src/glsl/nir/spirv_to_nir.c b/src/glsl/nir/spirv_to_nir.c
index 6819f88833a..3b9253d2aef 100644
--- a/src/glsl/nir/spirv_to_nir.c
+++ b/src/glsl/nir/spirv_to_nir.c
@@ -334,10 +334,8 @@ struct_member_decoration_cb(struct vtn_builder *b,
return;
switch (dec->decoration) {
- case SpvDecorationPrecisionLow:
- case SpvDecorationPrecisionMedium:
- case SpvDecorationPrecisionHigh:
- break; /* FIXME: Do nothing with these for now. */
+ case SpvDecorationRelaxedPrecision:
+ break; /* FIXME: Do nothing with this for now. */
case SpvDecorationSmooth:
ctx->fields[member].interpolation = INTERP_QUALIFIER_SMOOTH;
break;
@@ -362,12 +360,33 @@ struct_member_decoration_cb(struct vtn_builder *b,
ctx->type->members[member]->is_builtin = true;
ctx->type->members[member]->builtin = dec->literals[0];
break;
+ case SpvDecorationOffset:
+ ctx->type->offsets[member] = dec->literals[0];
+ break;
default:
unreachable("Unhandled member decoration");
}
}
static void
+array_decoration_cb(struct vtn_builder *b,
+ struct vtn_value *val, int member,
+ const struct vtn_decoration *dec, void *ctx)
+{
+ struct vtn_type *type = val->type;
+
+ assert(member == -1);
+ switch (dec->decoration) {
+ case SpvDecorationArrayStride:
+ type->stride = dec->literals[0];
+ break;
+
+ default:
+ unreachable("Unhandled array type decoration");
+ }
+}
+
+static void
vtn_handle_type(struct vtn_builder *b, SpvOp opcode,
const uint32_t *w, unsigned count)
{
@@ -421,12 +440,14 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode,
val->type->type = glsl_array_type(array_element->type, w[3]);
val->type->array_element = array_element;
val->type->stride = 0;
+ vtn_foreach_decoration(b, val, array_decoration_cb, NULL);
return;
}
case SpvOpTypeStruct: {
unsigned num_fields = count - 2;
val->type->members = ralloc_array(b, struct vtn_type *, num_fields);
+ val->type->offsets = ralloc_array(b, unsigned, num_fields);
NIR_VLA(struct glsl_struct_field, fields, count);
for (unsigned i = 0; i < num_fields; i++) {
@@ -479,7 +500,7 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode,
val->type = vtn_value(b, w[3], vtn_value_type_type)->type;
return;
- case SpvOpTypeSampler: {
+ case SpvOpTypeImage: {
const struct glsl_type *sampled_type =
vtn_value(b, w[2], vtn_value_type_type)->type->type;
@@ -497,19 +518,21 @@ vtn_handle_type(struct vtn_builder *b, SpvOp opcode,
unreachable("Invalid SPIR-V Sampler dimension");
}
- /* TODO: Handle the various texture image/filter options */
- (void)w[4];
-
+ bool is_shadow = w[4];
bool is_array = w[5];
- bool is_shadow = w[6];
- assert(w[7] == 0 && "FIXME: Handl multi-sampled textures");
+ assert(w[6] == 0 && "FIXME: Handl multi-sampled textures");
+ assert(w[7] == 1 && "FIXME: Add support for non-sampled images");
val->type->type = glsl_sampler_type(dim, is_shadow, is_array,
glsl_get_base_type(sampled_type));
return;
}
+ case SpvOpTypeSampledImage:
+ val->type = vtn_value(b, w[2], vtn_value_type_type)->type;
+ break;
+
case SpvOpTypeRuntimeArray:
case SpvOpTypeOpaque:
case SpvOpTypeEvent:
@@ -693,10 +716,8 @@ var_decoration_cb(struct vtn_builder *b, struct vtn_value *val, int member,
nir_variable *var = void_var;
switch (dec->decoration) {
- case SpvDecorationPrecisionLow:
- case SpvDecorationPrecisionMedium:
- case SpvDecorationPrecisionHigh:
- break; /* FIXME: Do nothing with these for now. */
+ case SpvDecorationRelaxedPrecision:
+ break; /* FIXME: Do nothing with this for now. */
case SpvDecorationSmooth:
var->data.interpolation = INTERP_QUALIFIER_SMOOTH;
break;
@@ -758,9 +779,6 @@ var_decoration_cb(struct vtn_builder *b, struct vtn_value *val, int member,
case SpvDecorationRowMajor:
case SpvDecorationColMajor:
case SpvDecorationGLSLShared:
- case SpvDecorationGLSLStd140:
- case SpvDecorationGLSLStd430:
- case SpvDecorationGLSLPacked:
case SpvDecorationPatch:
case SpvDecorationRestrict:
case SpvDecorationAliased:
@@ -773,9 +791,7 @@ var_decoration_cb(struct vtn_builder *b, struct vtn_value *val, int member,
case SpvDecorationSaturatedConversion:
case SpvDecorationStream:
case SpvDecorationOffset:
- case SpvDecorationAlignment:
case SpvDecorationXfbBuffer:
- case SpvDecorationStride:
case SpvDecorationFuncParamAttr:
case SpvDecorationFPRoundingMode:
case SpvDecorationFPFastMathMode:
@@ -1118,7 +1134,6 @@ vtn_handle_variables(struct vtn_builder *b, SpvOp opcode,
case SpvStorageClassWorkgroupLocal:
case SpvStorageClassWorkgroupGlobal:
case SpvStorageClassGeneric:
- case SpvStorageClassPrivate:
case SpvStorageClassAtomicCounter:
default:
unreachable("Unhandled variable storage class");
@@ -1270,10 +1285,9 @@ vtn_handle_variables(struct vtn_builder *b, SpvOp opcode,
break;
}
- case SpvOpVariableArray:
case SpvOpCopyMemorySized:
case SpvOpArrayLength:
- case SpvOpImagePointer:
+ case SpvOpImageTexelPointer:
default:
unreachable("Unhandled opcode");
}
@@ -1342,31 +1356,24 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode,
nir_tex_src srcs[8]; /* 8 should be enough */
nir_tex_src *p = srcs;
+ unsigned idx = 4;
+
unsigned coord_components = 0;
switch (opcode) {
- case SpvOpTextureSample:
- case SpvOpTextureSampleDref:
- case SpvOpTextureSampleLod:
- case SpvOpTextureSampleProj:
- case SpvOpTextureSampleGrad:
- case SpvOpTextureSampleOffset:
- case SpvOpTextureSampleProjLod:
- case SpvOpTextureSampleProjGrad:
- case SpvOpTextureSampleLodOffset:
- case SpvOpTextureSampleProjOffset:
- case SpvOpTextureSampleGradOffset:
- case SpvOpTextureSampleProjLodOffset:
- case SpvOpTextureSampleProjGradOffset:
- case SpvOpTextureFetchTexelLod:
- case SpvOpTextureFetchTexelOffset:
- case SpvOpTextureFetchSample:
- case SpvOpTextureFetchTexel:
- case SpvOpTextureGather:
- case SpvOpTextureGatherOffset:
- case SpvOpTextureGatherOffsets:
- case SpvOpTextureQueryLod: {
+ case SpvOpImageSampleImplicitLod:
+ case SpvOpImageSampleExplicitLod:
+ case SpvOpImageSampleDrefImplicitLod:
+ case SpvOpImageSampleDrefExplicitLod:
+ case SpvOpImageSampleProjImplicitLod:
+ case SpvOpImageSampleProjExplicitLod:
+ case SpvOpImageSampleProjDrefImplicitLod:
+ case SpvOpImageSampleProjDrefExplicitLod:
+ case SpvOpImageFetch:
+ case SpvOpImageGather:
+ case SpvOpImageDrefGather:
+ case SpvOpImageQueryLod: {
/* All these types have the coordinate as their first real argument */
- struct vtn_ssa_value *coord = vtn_ssa_value(b, w[4]);
+ struct vtn_ssa_value *coord = vtn_ssa_value(b, w[idx++]);
coord_components = glsl_get_vector_elements(coord->type);
p->src = nir_src_for_ssa(coord->def);
p->src_type = nir_tex_src_coord;
@@ -1380,43 +1387,36 @@ vtn_handle_texture(struct vtn_builder *b, SpvOp opcode,
nir_texop texop;
switch (opcode) {
- case SpvOpTextureSample:
+ case SpvOpImageSampleImplicitLod:
texop = nir_texop_tex;
-
- if (count == 6) {
- texop = nir_texop_txb;
- *p++ = vtn_tex_src(b, w[5], nir_tex_src_bias);
- }
break;
- case SpvOpTextureSampleDref:
- case SpvOpTextureSampleLod:
- case SpvOpTextureSampleProj:
- case SpvOpTextureSampleGrad:
- case SpvOpTextureSampleOffset:
- case SpvOpTextureSampleProjLod:
- case SpvOpTextureSampleProjGrad:
- case SpvOpTextureSampleLodOffset:
- case SpvOpTextureSampleProjOffset:
- case SpvOpTextureSampleGradOffset:
- case SpvOpTextureSampleProjLodOffset:
- case SpvOpTextureSampleProjGradOffset:
- case SpvOpTextureFetchTexelLod:
- case SpvOpTextureFetchTexelOffset:
- case SpvOpTextureFetchSample:
- case SpvOpTextureFetchTexel:
- case SpvOpTextureGather:
- case SpvOpTextureGatherOffset:
- case SpvOpTextureGatherOffsets:
- case SpvOpTextureQuerySizeLod:
- case SpvOpTextureQuerySize:
- case SpvOpTextureQueryLod:
- case SpvOpTextureQueryLevels:
- case SpvOpTextureQuerySamples:
+ case SpvOpImageSampleExplicitLod:
+ case SpvOpImageSampleDrefImplicitLod:
+ case SpvOpImageSampleDrefExplicitLod:
+ case SpvOpImageSampleProjImplicitLod:
+ case SpvOpImageSampleProjExplicitLod:
+ case SpvOpImageSampleProjDrefImplicitLod:
+ case SpvOpImageSampleProjDrefExplicitLod:
+ case SpvOpImageFetch:
+ case SpvOpImageGather:
+ case SpvOpImageDrefGather:
+ case SpvOpImageQuerySizeLod:
+ case SpvOpImageQuerySize:
+ case SpvOpImageQueryLod:
+ case SpvOpImageQueryLevels:
+ case SpvOpImageQuerySamples:
default:
unreachable("Unhandled opcode");
}
+ /* From now on, the remaining sources are "Optional Image Operands." */
+ if (idx < count) {
+ /* XXX handle these (bias, lod, etc.) */
+ assert(0);
+ }
+
+
nir_tex_instr *instr = nir_tex_instr_create(b->shader, p - srcs);
const struct glsl_type *sampler_type = nir_deref_tail(&sampler->deref)->type;
@@ -1742,7 +1742,8 @@ vtn_handle_alu(struct vtn_builder *b, SpvOp opcode,
case SpvOpShiftRightArithmetic: op = nir_op_ishr; break;
case SpvOpShiftLeftLogical: op = nir_op_ishl; break;
case SpvOpLogicalOr: op = nir_op_ior; break;
- case SpvOpLogicalXor: op = nir_op_ixor; break;
+ case SpvOpLogicalEqual: op = nir_op_ieq; break;
+ case SpvOpLogicalNotEqual: op = nir_op_ine; break;
case SpvOpLogicalAnd: op = nir_op_iand; break;
case SpvOpBitwiseOr: op = nir_op_ior; break;
case SpvOpBitwiseXor: op = nir_op_ixor; break;
@@ -2200,11 +2201,19 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, SpvOp opcode,
switch (opcode) {
case SpvOpSource:
case SpvOpSourceExtension:
- case SpvOpCompileFlag:
case SpvOpExtension:
/* Unhandled, but these are for debug so that's ok. */
break;
+ case SpvOpCapability:
+ /*
+ * TODO properly handle these and give a real error if asking for too
+ * much.
+ */
+ assert(w[1] == SpvCapabilityMatrix ||
+ w[1] == SpvCapabilityShader);
+ break;
+
case SpvOpExtInstImport:
vtn_handle_extension(b, opcode, w, count);
break;
@@ -2221,7 +2230,10 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, SpvOp opcode,
break;
case SpvOpExecutionMode:
- unreachable("Execution modes not yet implemented");
+ /*
+ * TODO handle these - for Vulkan OriginUpperLeft is always set for
+ * fragment shaders, so we can ignore this for now
+ */
break;
case SpvOpString:
@@ -2254,7 +2266,9 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, SpvOp opcode,
case SpvOpTypeFloat:
case SpvOpTypeVector:
case SpvOpTypeMatrix:
+ case SpvOpTypeImage:
case SpvOpTypeSampler:
+ case SpvOpTypeSampledImage:
case SpvOpTypeArray:
case SpvOpTypeRuntimeArray:
case SpvOpTypeStruct:
@@ -2274,8 +2288,6 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, SpvOp opcode,
case SpvOpConstant:
case SpvOpConstantComposite:
case SpvOpConstantSampler:
- case SpvOpConstantNullPointer:
- case SpvOpConstantNullObject:
case SpvOpSpecConstantTrue:
case SpvOpSpecConstantFalse:
case SpvOpSpecConstant:
@@ -2422,7 +2434,6 @@ vtn_handle_body_instruction(struct vtn_builder *b, SpvOp opcode,
break;
case SpvOpVariable:
- case SpvOpVariableArray:
case SpvOpLoad:
case SpvOpStore:
case SpvOpCopyMemory:
@@ -2430,7 +2441,7 @@ vtn_handle_body_instruction(struct vtn_builder *b, SpvOp opcode,
case SpvOpAccessChain:
case SpvOpInBoundsAccessChain:
case SpvOpArrayLength:
- case SpvOpImagePointer:
+ case SpvOpImageTexelPointer:
vtn_handle_variables(b, opcode, w, count);
break;
@@ -2438,31 +2449,22 @@ vtn_handle_body_instruction(struct vtn_builder *b, SpvOp opcode,
vtn_handle_function_call(b, opcode, w, count);
break;
- case SpvOpTextureSample:
- case SpvOpTextureSampleDref:
- case SpvOpTextureSampleLod:
- case SpvOpTextureSampleProj:
- case SpvOpTextureSampleGrad:
- case SpvOpTextureSampleOffset:
- case SpvOpTextureSampleProjLod:
- case SpvOpTextureSampleProjGrad:
- case SpvOpTextureSampleLodOffset:
- case SpvOpTextureSampleProjOffset:
- case SpvOpTextureSampleGradOffset:
- case SpvOpTextureSampleProjLodOffset:
- case SpvOpTextureSampleProjGradOffset:
- case SpvOpTextureFetchTexelLod:
- case SpvOpTextureFetchTexelOffset:
- case SpvOpTextureFetchSample:
- case SpvOpTextureFetchTexel:
- case SpvOpTextureGather:
- case SpvOpTextureGatherOffset:
- case SpvOpTextureGatherOffsets:
- case SpvOpTextureQuerySizeLod:
- case SpvOpTextureQuerySize:
- case SpvOpTextureQueryLod:
- case SpvOpTextureQueryLevels:
- case SpvOpTextureQuerySamples:
+ case SpvOpImageSampleImplicitLod:
+ case SpvOpImageSampleExplicitLod:
+ case SpvOpImageSampleDrefImplicitLod:
+ case SpvOpImageSampleDrefExplicitLod:
+ case SpvOpImageSampleProjImplicitLod:
+ case SpvOpImageSampleProjExplicitLod:
+ case SpvOpImageSampleProjDrefImplicitLod:
+ case SpvOpImageSampleProjDrefExplicitLod:
+ case SpvOpImageFetch:
+ case SpvOpImageGather:
+ case SpvOpImageDrefGather:
+ case SpvOpImageQuerySizeLod:
+ case SpvOpImageQuerySize:
+ case SpvOpImageQueryLod:
+ case SpvOpImageQueryLevels:
+ case SpvOpImageQuerySamples:
vtn_handle_texture(b, opcode, w, count);
break;
@@ -2511,7 +2513,8 @@ vtn_handle_body_instruction(struct vtn_builder *b, SpvOp opcode,
case SpvOpShiftRightArithmetic:
case SpvOpShiftLeftLogical:
case SpvOpLogicalOr:
- case SpvOpLogicalXor:
+ case SpvOpLogicalEqual:
+ case SpvOpLogicalNotEqual:
case SpvOpLogicalAnd:
case SpvOpBitwiseOr:
case SpvOpBitwiseXor: