*/
/*
-** Specification revision 33.
** Enumeration tokens for SPIR-V, in various styles:
** C, C++, C++11, JSON, Lua, Python
**
typedef unsigned int SpvId;
+#define SPV_VERSION 0x10000
+#define SPV_REVISION 2
+
static const unsigned int SpvMagicNumber = 0x07230203;
-static const unsigned int SpvVersion = 99;
-static const unsigned int SpvRevision = 33;
+static const unsigned int SpvVersion = 0x00010000;
+static const unsigned int SpvRevision = 2;
static const unsigned int SpvOpCodeMask = 0xffff;
static const unsigned int SpvWordCountShift = 16;
SpvSourceLanguageUnknown = 0,
SpvSourceLanguageESSL = 1,
SpvSourceLanguageGLSL = 2,
- SpvSourceLanguageOpenCL = 3,
+ SpvSourceLanguageOpenCL_C = 3,
+ SpvSourceLanguageOpenCL_CPP = 4,
} SpvSourceLanguage;
typedef enum SpvExecutionModel_ {
SpvExecutionModeInputPoints = 19,
SpvExecutionModeInputLines = 20,
SpvExecutionModeInputLinesAdjacency = 21,
- SpvExecutionModeInputTriangles = 22,
+ SpvExecutionModeTriangles = 22,
SpvExecutionModeInputTrianglesAdjacency = 23,
- SpvExecutionModeInputQuads = 24,
- SpvExecutionModeInputIsolines = 25,
+ SpvExecutionModeQuads = 24,
+ SpvExecutionModeIsolines = 25,
SpvExecutionModeOutputVertices = 26,
SpvExecutionModeOutputPoints = 27,
SpvExecutionModeOutputLineStrip = 28,
SpvExecutionModeOutputTriangleStrip = 29,
SpvExecutionModeVecTypeHint = 30,
SpvExecutionModeContractionOff = 31,
- SpvExecutionModeIndependentForwardProgress = 32,
} SpvExecutionMode;
typedef enum SpvStorageClass_ {
SpvStorageClassInput = 1,
SpvStorageClassUniform = 2,
SpvStorageClassOutput = 3,
- SpvStorageClassWorkgroupLocal = 4,
- SpvStorageClassWorkgroupGlobal = 5,
- SpvStorageClassPrivateGlobal = 6,
+ SpvStorageClassWorkgroup = 4,
+ SpvStorageClassCrossWorkgroup = 5,
+ SpvStorageClassPrivate = 6,
SpvStorageClassFunction = 7,
SpvStorageClassGeneric = 8,
SpvStorageClassPushConstant = 9,
SpvDimCube = 3,
SpvDimRect = 4,
SpvDimBuffer = 5,
- SpvDimInputTarget = 6,
+ SpvDimSubpassData = 6,
} SpvDim;
typedef enum SpvSamplerAddressingMode_ {
SpvImageChannelDataTypeHalfFloat = 13,
SpvImageChannelDataTypeFloat = 14,
SpvImageChannelDataTypeUnormInt24 = 15,
+ SpvImageChannelDataTypeUnormInt101010_2 = 16,
} SpvImageChannelDataType;
typedef enum SpvImageOperandsShift_ {
SpvDecorationGLSLPacked = 9,
SpvDecorationCPacked = 10,
SpvDecorationBuiltIn = 11,
- SpvDecorationSmooth = 12,
SpvDecorationNoPerspective = 13,
SpvDecorationFlat = 14,
SpvDecorationPatch = 15,
SpvDecorationFPFastMathMode = 40,
SpvDecorationLinkageAttributes = 41,
SpvDecorationNoContraction = 42,
- SpvDecorationInputTargetIndex = 43,
+ SpvDecorationInputAttachmentIndex = 43,
SpvDecorationAlignment = 44,
} SpvDecoration;
SpvBuiltInSampleId = 18,
SpvBuiltInSamplePosition = 19,
SpvBuiltInSampleMask = 20,
- SpvBuiltInFragColor = 21,
SpvBuiltInFragDepth = 22,
SpvBuiltInHelperInvocation = 23,
SpvBuiltInNumWorkgroups = 24,
SpvBuiltInEnqueuedWorkgroupSize = 32,
SpvBuiltInGlobalOffset = 33,
SpvBuiltInGlobalLinearId = 34,
- SpvBuiltInWorkgroupLinearId = 35,
SpvBuiltInSubgroupSize = 36,
SpvBuiltInSubgroupMaxSize = 37,
SpvBuiltInNumSubgroups = 38,
SpvMemorySemanticsSequentiallyConsistentShift = 4,
SpvMemorySemanticsUniformMemoryShift = 6,
SpvMemorySemanticsSubgroupMemoryShift = 7,
- SpvMemorySemanticsWorkgroupLocalMemoryShift = 8,
- SpvMemorySemanticsWorkgroupGlobalMemoryShift = 9,
+ SpvMemorySemanticsWorkgroupMemoryShift = 8,
+ SpvMemorySemanticsCrossWorkgroupMemoryShift = 9,
SpvMemorySemanticsAtomicCounterMemoryShift = 10,
SpvMemorySemanticsImageMemoryShift = 11,
} SpvMemorySemanticsShift;
SpvMemorySemanticsSequentiallyConsistentMask = 0x00000010,
SpvMemorySemanticsUniformMemoryMask = 0x00000040,
SpvMemorySemanticsSubgroupMemoryMask = 0x00000080,
- SpvMemorySemanticsWorkgroupLocalMemoryMask = 0x00000100,
- SpvMemorySemanticsWorkgroupGlobalMemoryMask = 0x00000200,
+ SpvMemorySemanticsWorkgroupMemoryMask = 0x00000100,
+ SpvMemorySemanticsCrossWorkgroupMemoryMask = 0x00000200,
SpvMemorySemanticsAtomicCounterMemoryMask = 0x00000400,
SpvMemorySemanticsImageMemoryMask = 0x00000800,
} SpvMemorySemanticsMask;
SpvCapabilityImageBasic = 13,
SpvCapabilityImageReadWrite = 14,
SpvCapabilityImageMipmap = 15,
- SpvCapabilityImageSRGBWrite = 16,
SpvCapabilityPipes = 17,
SpvCapabilityGroups = 18,
SpvCapabilityDeviceEnqueue = 19,
SpvCapabilityTessellationPointSize = 23,
SpvCapabilityGeometryPointSize = 24,
SpvCapabilityImageGatherExtended = 25,
- SpvCapabilityStorageImageExtendedFormats = 26,
SpvCapabilityStorageImageMultisample = 27,
SpvCapabilityUniformBufferArrayDynamicIndexing = 28,
SpvCapabilitySampledImageArrayDynamicIndexing = 29,
SpvCapabilitySampledRect = 37,
SpvCapabilityGenericPointer = 38,
SpvCapabilityInt8 = 39,
- SpvCapabilityInputTarget = 40,
+ SpvCapabilityInputAttachment = 40,
SpvCapabilitySparseResidency = 41,
SpvCapabilityMinLod = 42,
SpvCapabilitySampled1D = 43,
SpvCapabilitySampledBuffer = 46,
SpvCapabilityImageBuffer = 47,
SpvCapabilityImageMSArray = 48,
- SpvCapabilityAdvancedFormats = 49,
+ SpvCapabilityStorageImageExtendedFormats = 49,
SpvCapabilityImageQuery = 50,
SpvCapabilityDerivativeControl = 51,
SpvCapabilityInterpolationFunction = 52,
SpvCapabilityTransformFeedback = 53,
+ SpvCapabilityGeometryStreams = 54,
+ SpvCapabilityStorageImageReadWithoutFormat = 55,
+ SpvCapabilityStorageImageWriteWithoutFormat = 56,
+ SpvCapabilityMultiViewport = 57,
} SpvCapability;
typedef enum SpvOp_ {
SpvOpImageDrefGather = 97,
SpvOpImageRead = 98,
SpvOpImageWrite = 99,
+ SpvOpImage = 100,
SpvOpImageQueryFormat = 101,
SpvOpImageQueryOrder = 102,
SpvOpImageQuerySizeLod = 103,
SpvOpUnreachable = 255,
SpvOpLifetimeStart = 256,
SpvOpLifetimeStop = 257,
- SpvOpAsyncGroupCopy = 259,
- SpvOpWaitGroupEvents = 260,
+ SpvOpGroupAsyncCopy = 259,
+ SpvOpGroupWaitEvents = 260,
SpvOpGroupAll = 261,
SpvOpGroupAny = 262,
SpvOpGroupBroadcast = 263,
switch (dec->decoration) {
case SpvDecorationRelaxedPrecision:
break; /* FIXME: Do nothing with this for now. */
- case SpvDecorationSmooth:
- ctx->fields[member].interpolation = INTERP_QUALIFIER_SMOOTH;
- break;
case SpvDecorationNoPerspective:
ctx->fields[member].interpolation = INTERP_QUALIFIER_NOPERSPECTIVE;
break;
*location = SYSTEM_VALUE_SAMPLE_MASK_IN; /* XXX out? */
set_mode_system_value(mode);
break;
- case SpvBuiltInFragColor:
- *location = FRAG_RESULT_COLOR;
- assert(b->shader->stage == MESA_SHADER_FRAGMENT);
- assert(*mode == nir_var_shader_out);
- break;
case SpvBuiltInFragDepth:
*location = FRAG_RESULT_DEPTH;
assert(b->shader->stage == MESA_SHADER_FRAGMENT);
switch (dec->decoration) {
case SpvDecorationRelaxedPrecision:
break; /* FIXME: Do nothing with this for now. */
- case SpvDecorationSmooth:
- var->data.interpolation = INTERP_QUALIFIER_SMOOTH;
- break;
case SpvDecorationNoPerspective:
var->data.interpolation = INTERP_QUALIFIER_NOPERSPECTIVE;
break;
case SpvStorageClassOutput:
var->data.mode = nir_var_shader_out;
break;
- case SpvStorageClassPrivateGlobal:
+ case SpvStorageClassPrivate:
var->data.mode = nir_var_global;
break;
case SpvStorageClassFunction:
var->data.mode = nir_var_local;
break;
- case SpvStorageClassWorkgroupLocal:
- case SpvStorageClassWorkgroupGlobal:
+ case SpvStorageClassWorkgroup:
+ case SpvStorageClassCrossWorkgroup:
case SpvStorageClassGeneric:
case SpvStorageClassAtomicCounter:
default:
return 1; /* GL_LINES */
case SpvExecutionModeInputLinesAdjacency:
return 0x000A; /* GL_LINE_STRIP_ADJACENCY_ARB */
- case SpvExecutionModeInputTriangles:
+ case SpvExecutionModeTriangles:
return 4; /* GL_TRIANGLES */
case SpvExecutionModeInputTrianglesAdjacency:
return 0x000C; /* GL_TRIANGLES_ADJACENCY_ARB */
- case SpvExecutionModeInputQuads:
+ case SpvExecutionModeQuads:
return 7; /* GL_QUADS */
- case SpvExecutionModeInputIsolines:
+ case SpvExecutionModeIsolines:
return 0x8E7A; /* GL_ISOLINES */
case SpvExecutionModeOutputLineStrip:
return 3; /* GL_LINE_STRIP */
return 2;
case SpvExecutionModeInputLinesAdjacency:
return 4;
- case SpvExecutionModeInputTriangles:
+ case SpvExecutionModeTriangles:
return 3;
case SpvExecutionModeInputTrianglesAdjacency:
return 6;
case SpvExecutionModeInputPoints:
case SpvExecutionModeInputLines:
case SpvExecutionModeInputLinesAdjacency:
- case SpvExecutionModeInputTriangles:
+ case SpvExecutionModeTriangles:
case SpvExecutionModeInputTrianglesAdjacency:
- case SpvExecutionModeInputQuads:
- case SpvExecutionModeInputIsolines:
+ case SpvExecutionModeQuads:
+ case SpvExecutionModeIsolines:
if (b->shader->stage == MESA_SHADER_GEOMETRY) {
b->shader->info.gs.vertices_in =
vertices_in_from_spv_execution_mode(mode);
case SpvExecutionModeVecTypeHint:
case SpvExecutionModeContractionOff:
- case SpvExecutionModeIndependentForwardProgress:
break; /* OpenCL */
}
break;
assert(word_count > 5);
assert(words[0] == SpvMagicNumber);
- assert(words[1] == 99);
+ assert(words[1] >= 0x10000);
/* words[2] == generator magic */
unsigned value_id_bound = words[3];
assert(words[4] == 0);