nir/spirv: Update to SPIR-V version 1.0
This commit is contained in:
+29
-26
@@ -30,7 +30,6 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
** Specification revision 33.
|
||||
** Enumeration tokens for SPIR-V, in various styles:
|
||||
** C, C++, C++11, JSON, Lua, Python
|
||||
**
|
||||
@@ -51,9 +50,12 @@
|
||||
|
||||
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;
|
||||
|
||||
@@ -61,7 +63,8 @@ typedef enum SpvSourceLanguage_ {
|
||||
SpvSourceLanguageUnknown = 0,
|
||||
SpvSourceLanguageESSL = 1,
|
||||
SpvSourceLanguageGLSL = 2,
|
||||
SpvSourceLanguageOpenCL = 3,
|
||||
SpvSourceLanguageOpenCL_C = 3,
|
||||
SpvSourceLanguageOpenCL_CPP = 4,
|
||||
} SpvSourceLanguage;
|
||||
|
||||
typedef enum SpvExecutionModel_ {
|
||||
@@ -108,17 +111,16 @@ typedef enum SpvExecutionMode_ {
|
||||
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_ {
|
||||
@@ -126,9 +128,9 @@ 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,
|
||||
@@ -143,7 +145,7 @@ typedef enum SpvDim_ {
|
||||
SpvDimCube = 3,
|
||||
SpvDimRect = 4,
|
||||
SpvDimBuffer = 5,
|
||||
SpvDimInputTarget = 6,
|
||||
SpvDimSubpassData = 6,
|
||||
} SpvDim;
|
||||
|
||||
typedef enum SpvSamplerAddressingMode_ {
|
||||
@@ -241,6 +243,7 @@ typedef enum SpvImageChannelDataType_ {
|
||||
SpvImageChannelDataTypeHalfFloat = 13,
|
||||
SpvImageChannelDataTypeFloat = 14,
|
||||
SpvImageChannelDataTypeUnormInt24 = 15,
|
||||
SpvImageChannelDataTypeUnormInt101010_2 = 16,
|
||||
} SpvImageChannelDataType;
|
||||
|
||||
typedef enum SpvImageOperandsShift_ {
|
||||
@@ -325,7 +328,6 @@ typedef enum SpvDecoration_ {
|
||||
SpvDecorationGLSLPacked = 9,
|
||||
SpvDecorationCPacked = 10,
|
||||
SpvDecorationBuiltIn = 11,
|
||||
SpvDecorationSmooth = 12,
|
||||
SpvDecorationNoPerspective = 13,
|
||||
SpvDecorationFlat = 14,
|
||||
SpvDecorationPatch = 15,
|
||||
@@ -355,7 +357,7 @@ typedef enum SpvDecoration_ {
|
||||
SpvDecorationFPFastMathMode = 40,
|
||||
SpvDecorationLinkageAttributes = 41,
|
||||
SpvDecorationNoContraction = 42,
|
||||
SpvDecorationInputTargetIndex = 43,
|
||||
SpvDecorationInputAttachmentIndex = 43,
|
||||
SpvDecorationAlignment = 44,
|
||||
} SpvDecoration;
|
||||
|
||||
@@ -380,7 +382,6 @@ typedef enum SpvBuiltIn_ {
|
||||
SpvBuiltInSampleId = 18,
|
||||
SpvBuiltInSamplePosition = 19,
|
||||
SpvBuiltInSampleMask = 20,
|
||||
SpvBuiltInFragColor = 21,
|
||||
SpvBuiltInFragDepth = 22,
|
||||
SpvBuiltInHelperInvocation = 23,
|
||||
SpvBuiltInNumWorkgroups = 24,
|
||||
@@ -394,7 +395,6 @@ typedef enum SpvBuiltIn_ {
|
||||
SpvBuiltInEnqueuedWorkgroupSize = 32,
|
||||
SpvBuiltInGlobalOffset = 33,
|
||||
SpvBuiltInGlobalLinearId = 34,
|
||||
SpvBuiltInWorkgroupLinearId = 35,
|
||||
SpvBuiltInSubgroupSize = 36,
|
||||
SpvBuiltInSubgroupMaxSize = 37,
|
||||
SpvBuiltInNumSubgroups = 38,
|
||||
@@ -449,8 +449,8 @@ typedef enum SpvMemorySemanticsShift_ {
|
||||
SpvMemorySemanticsSequentiallyConsistentShift = 4,
|
||||
SpvMemorySemanticsUniformMemoryShift = 6,
|
||||
SpvMemorySemanticsSubgroupMemoryShift = 7,
|
||||
SpvMemorySemanticsWorkgroupLocalMemoryShift = 8,
|
||||
SpvMemorySemanticsWorkgroupGlobalMemoryShift = 9,
|
||||
SpvMemorySemanticsWorkgroupMemoryShift = 8,
|
||||
SpvMemorySemanticsCrossWorkgroupMemoryShift = 9,
|
||||
SpvMemorySemanticsAtomicCounterMemoryShift = 10,
|
||||
SpvMemorySemanticsImageMemoryShift = 11,
|
||||
} SpvMemorySemanticsShift;
|
||||
@@ -463,8 +463,8 @@ typedef enum SpvMemorySemanticsMask_ {
|
||||
SpvMemorySemanticsSequentiallyConsistentMask = 0x00000010,
|
||||
SpvMemorySemanticsUniformMemoryMask = 0x00000040,
|
||||
SpvMemorySemanticsSubgroupMemoryMask = 0x00000080,
|
||||
SpvMemorySemanticsWorkgroupLocalMemoryMask = 0x00000100,
|
||||
SpvMemorySemanticsWorkgroupGlobalMemoryMask = 0x00000200,
|
||||
SpvMemorySemanticsWorkgroupMemoryMask = 0x00000100,
|
||||
SpvMemorySemanticsCrossWorkgroupMemoryMask = 0x00000200,
|
||||
SpvMemorySemanticsAtomicCounterMemoryMask = 0x00000400,
|
||||
SpvMemorySemanticsImageMemoryMask = 0x00000800,
|
||||
} SpvMemorySemanticsMask;
|
||||
@@ -528,7 +528,6 @@ typedef enum SpvCapability_ {
|
||||
SpvCapabilityImageBasic = 13,
|
||||
SpvCapabilityImageReadWrite = 14,
|
||||
SpvCapabilityImageMipmap = 15,
|
||||
SpvCapabilityImageSRGBWrite = 16,
|
||||
SpvCapabilityPipes = 17,
|
||||
SpvCapabilityGroups = 18,
|
||||
SpvCapabilityDeviceEnqueue = 19,
|
||||
@@ -538,7 +537,6 @@ typedef enum SpvCapability_ {
|
||||
SpvCapabilityTessellationPointSize = 23,
|
||||
SpvCapabilityGeometryPointSize = 24,
|
||||
SpvCapabilityImageGatherExtended = 25,
|
||||
SpvCapabilityStorageImageExtendedFormats = 26,
|
||||
SpvCapabilityStorageImageMultisample = 27,
|
||||
SpvCapabilityUniformBufferArrayDynamicIndexing = 28,
|
||||
SpvCapabilitySampledImageArrayDynamicIndexing = 29,
|
||||
@@ -552,7 +550,7 @@ typedef enum SpvCapability_ {
|
||||
SpvCapabilitySampledRect = 37,
|
||||
SpvCapabilityGenericPointer = 38,
|
||||
SpvCapabilityInt8 = 39,
|
||||
SpvCapabilityInputTarget = 40,
|
||||
SpvCapabilityInputAttachment = 40,
|
||||
SpvCapabilitySparseResidency = 41,
|
||||
SpvCapabilityMinLod = 42,
|
||||
SpvCapabilitySampled1D = 43,
|
||||
@@ -561,11 +559,15 @@ typedef enum SpvCapability_ {
|
||||
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_ {
|
||||
@@ -660,6 +662,7 @@ typedef enum SpvOp_ {
|
||||
SpvOpImageDrefGather = 97,
|
||||
SpvOpImageRead = 98,
|
||||
SpvOpImageWrite = 99,
|
||||
SpvOpImage = 100,
|
||||
SpvOpImageQueryFormat = 101,
|
||||
SpvOpImageQueryOrder = 102,
|
||||
SpvOpImageQuerySizeLod = 103,
|
||||
@@ -804,8 +807,8 @@ typedef enum SpvOp_ {
|
||||
SpvOpUnreachable = 255,
|
||||
SpvOpLifetimeStart = 256,
|
||||
SpvOpLifetimeStop = 257,
|
||||
SpvOpAsyncGroupCopy = 259,
|
||||
SpvOpWaitGroupEvents = 260,
|
||||
SpvOpGroupAsyncCopy = 259,
|
||||
SpvOpGroupWaitEvents = 260,
|
||||
SpvOpGroupAll = 261,
|
||||
SpvOpGroupAny = 262,
|
||||
SpvOpGroupBroadcast = 263,
|
||||
|
||||
@@ -85,7 +85,11 @@ handle_glsl450_alu(struct vtn_builder *b, enum GLSLstd450 entrypoint,
|
||||
|
||||
case GLSLstd450Modf: op = nir_op_fmod; break;
|
||||
case GLSLstd450FMin: op = nir_op_fmin; break;
|
||||
case GLSLstd450UMin: op = nir_op_umin; break;
|
||||
case GLSLstd450SMin: op = nir_op_imin; break;
|
||||
case GLSLstd450FMax: op = nir_op_fmax; break;
|
||||
case GLSLstd450UMax: op = nir_op_umax; break;
|
||||
case GLSLstd450SMax: op = nir_op_imax; break;
|
||||
case GLSLstd450FMix: op = nir_op_flrp; break;
|
||||
case GLSLstd450Step:
|
||||
val->ssa->def = nir_sge(&b->nb, src[1], src[0]);
|
||||
|
||||
+11
-23
@@ -343,9 +343,6 @@ struct_member_decoration_cb(struct vtn_builder *b,
|
||||
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;
|
||||
@@ -815,11 +812,6 @@ vtn_get_builtin_location(struct vtn_builder *b,
|
||||
*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);
|
||||
@@ -860,9 +852,6 @@ var_decoration_cb(struct vtn_builder *b, struct vtn_value *val, int member,
|
||||
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;
|
||||
@@ -1565,14 +1554,14 @@ vtn_handle_variables(struct vtn_builder *b, SpvOp opcode,
|
||||
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:
|
||||
@@ -3001,13 +2990,13 @@ gl_primitive_from_spv_execution_mode(SpvExecutionMode mode)
|
||||
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 */
|
||||
@@ -3029,7 +3018,7 @@ vertices_in_from_spv_execution_mode(SpvExecutionMode mode)
|
||||
return 2;
|
||||
case SpvExecutionModeInputLinesAdjacency:
|
||||
return 4;
|
||||
case SpvExecutionModeInputTriangles:
|
||||
case SpvExecutionModeTriangles:
|
||||
return 3;
|
||||
case SpvExecutionModeInputTrianglesAdjacency:
|
||||
return 6;
|
||||
@@ -3133,10 +3122,10 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, SpvOp opcode,
|
||||
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);
|
||||
@@ -3169,7 +3158,6 @@ vtn_handle_preamble_instruction(struct vtn_builder *b, SpvOp opcode,
|
||||
|
||||
case SpvExecutionModeVecTypeHint:
|
||||
case SpvExecutionModeContractionOff:
|
||||
case SpvExecutionModeIndependentForwardProgress:
|
||||
break; /* OpenCL */
|
||||
}
|
||||
break;
|
||||
@@ -3746,7 +3734,7 @@ spirv_to_nir(const uint32_t *words, size_t word_count,
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user