mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2025-01-11 17:10:06 +00:00
Use spirv.h instead of spirv.hpp.
This is a part of the effort to make libspirv.h C-compatible.
This commit is contained in:
parent
9f79d789ec
commit
b36e704a47
866
external/include/headers/spirv.h
vendored
Normal file
866
external/include/headers/spirv.h
vendored
Normal file
@ -0,0 +1,866 @@
|
|||||||
|
/*
|
||||||
|
** Copyright (c) 2014-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/
|
||||||
|
**
|
||||||
|
** 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
** This header is automatically generated by the same tool that creates
|
||||||
|
** the Binary Section of the SPIR-V specification.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Specification revision 32.
|
||||||
|
** 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
|
||||||
|
** amount (1 << x) for each corresponding enumerant.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef spirv_H
|
||||||
|
#define spirv_H
|
||||||
|
|
||||||
|
typedef unsigned int SpvId;
|
||||||
|
|
||||||
|
static const unsigned int SpvMagicNumber = 0x07230203;
|
||||||
|
static const unsigned int SpvVersion = 99;
|
||||||
|
static const unsigned int SpvRevision = 32;
|
||||||
|
static const unsigned int SpvOpCodeMask = 0xffff;
|
||||||
|
static const unsigned int SpvWordCountShift = 16;
|
||||||
|
|
||||||
|
typedef enum SpvSourceLanguage_ {
|
||||||
|
SpvSourceLanguageUnknown = 0,
|
||||||
|
SpvSourceLanguageESSL = 1,
|
||||||
|
SpvSourceLanguageGLSL = 2,
|
||||||
|
SpvSourceLanguageOpenCL = 3,
|
||||||
|
} SpvSourceLanguage;
|
||||||
|
|
||||||
|
typedef enum SpvExecutionModel_ {
|
||||||
|
SpvExecutionModelVertex = 0,
|
||||||
|
SpvExecutionModelTessellationControl = 1,
|
||||||
|
SpvExecutionModelTessellationEvaluation = 2,
|
||||||
|
SpvExecutionModelGeometry = 3,
|
||||||
|
SpvExecutionModelFragment = 4,
|
||||||
|
SpvExecutionModelGLCompute = 5,
|
||||||
|
SpvExecutionModelKernel = 6,
|
||||||
|
} SpvExecutionModel;
|
||||||
|
|
||||||
|
typedef enum SpvAddressingModel_ {
|
||||||
|
SpvAddressingModelLogical = 0,
|
||||||
|
SpvAddressingModelPhysical32 = 1,
|
||||||
|
SpvAddressingModelPhysical64 = 2,
|
||||||
|
} SpvAddressingModel;
|
||||||
|
|
||||||
|
typedef enum SpvMemoryModel_ {
|
||||||
|
SpvMemoryModelSimple = 0,
|
||||||
|
SpvMemoryModelGLSL450 = 1,
|
||||||
|
SpvMemoryModelOpenCL = 2,
|
||||||
|
} SpvMemoryModel;
|
||||||
|
|
||||||
|
typedef enum SpvExecutionMode_ {
|
||||||
|
SpvExecutionModeInvocations = 0,
|
||||||
|
SpvExecutionModeSpacingEqual = 1,
|
||||||
|
SpvExecutionModeSpacingFractionalEven = 2,
|
||||||
|
SpvExecutionModeSpacingFractionalOdd = 3,
|
||||||
|
SpvExecutionModeVertexOrderCw = 4,
|
||||||
|
SpvExecutionModeVertexOrderCcw = 5,
|
||||||
|
SpvExecutionModePixelCenterInteger = 6,
|
||||||
|
SpvExecutionModeOriginUpperLeft = 7,
|
||||||
|
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,
|
||||||
|
SpvExecutionModeIndependentForwardProgress = 32,
|
||||||
|
} SpvExecutionMode;
|
||||||
|
|
||||||
|
typedef enum SpvStorageClass_ {
|
||||||
|
SpvStorageClassUniformConstant = 0,
|
||||||
|
SpvStorageClassInput = 1,
|
||||||
|
SpvStorageClassUniform = 2,
|
||||||
|
SpvStorageClassOutput = 3,
|
||||||
|
SpvStorageClassWorkgroupLocal = 4,
|
||||||
|
SpvStorageClassWorkgroupGlobal = 5,
|
||||||
|
SpvStorageClassPrivateGlobal = 6,
|
||||||
|
SpvStorageClassFunction = 7,
|
||||||
|
SpvStorageClassGeneric = 8,
|
||||||
|
SpvStorageClassPushConstant = 9,
|
||||||
|
SpvStorageClassAtomicCounter = 10,
|
||||||
|
SpvStorageClassImage = 11,
|
||||||
|
} SpvStorageClass;
|
||||||
|
|
||||||
|
typedef enum SpvDim_ {
|
||||||
|
SpvDim1D = 0,
|
||||||
|
SpvDim2D = 1,
|
||||||
|
SpvDim3D = 2,
|
||||||
|
SpvDimCube = 3,
|
||||||
|
SpvDimRect = 4,
|
||||||
|
SpvDimBuffer = 5,
|
||||||
|
SpvDimInputTarget = 6,
|
||||||
|
} SpvDim;
|
||||||
|
|
||||||
|
typedef enum SpvSamplerAddressingMode_ {
|
||||||
|
SpvSamplerAddressingModeNone = 0,
|
||||||
|
SpvSamplerAddressingModeClampToEdge = 1,
|
||||||
|
SpvSamplerAddressingModeClamp = 2,
|
||||||
|
SpvSamplerAddressingModeRepeat = 3,
|
||||||
|
SpvSamplerAddressingModeRepeatMirrored = 4,
|
||||||
|
} SpvSamplerAddressingMode;
|
||||||
|
|
||||||
|
typedef enum SpvSamplerFilterMode_ {
|
||||||
|
SpvSamplerFilterModeNearest = 0,
|
||||||
|
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,
|
||||||
|
SpvImageOperandsConstOffsetShift = 3,
|
||||||
|
SpvImageOperandsOffsetShift = 4,
|
||||||
|
SpvImageOperandsConstOffsetsShift = 5,
|
||||||
|
SpvImageOperandsSampleShift = 6,
|
||||||
|
SpvImageOperandsMinLodShift = 7,
|
||||||
|
} SpvImageOperandsShift;
|
||||||
|
|
||||||
|
typedef enum SpvImageOperandsMask_ {
|
||||||
|
SpvImageOperandsMaskNone = 0,
|
||||||
|
SpvImageOperandsBiasMask = 0x00000001,
|
||||||
|
SpvImageOperandsLodMask = 0x00000002,
|
||||||
|
SpvImageOperandsGradMask = 0x00000004,
|
||||||
|
SpvImageOperandsConstOffsetMask = 0x00000008,
|
||||||
|
SpvImageOperandsOffsetMask = 0x00000010,
|
||||||
|
SpvImageOperandsConstOffsetsMask = 0x00000020,
|
||||||
|
SpvImageOperandsSampleMask = 0x00000040,
|
||||||
|
SpvImageOperandsMinLodMask = 0x00000080,
|
||||||
|
} SpvImageOperandsMask;
|
||||||
|
|
||||||
|
typedef enum SpvFPFastMathModeShift_ {
|
||||||
|
SpvFPFastMathModeNotNaNShift = 0,
|
||||||
|
SpvFPFastMathModeNotInfShift = 1,
|
||||||
|
SpvFPFastMathModeNSZShift = 2,
|
||||||
|
SpvFPFastMathModeAllowRecipShift = 3,
|
||||||
|
SpvFPFastMathModeFastShift = 4,
|
||||||
|
} SpvFPFastMathModeShift;
|
||||||
|
|
||||||
|
typedef enum SpvFPFastMathModeMask_ {
|
||||||
|
SpvFPFastMathModeMaskNone = 0,
|
||||||
|
SpvFPFastMathModeNotNaNMask = 0x00000001,
|
||||||
|
SpvFPFastMathModeNotInfMask = 0x00000002,
|
||||||
|
SpvFPFastMathModeNSZMask = 0x00000004,
|
||||||
|
SpvFPFastMathModeAllowRecipMask = 0x00000008,
|
||||||
|
SpvFPFastMathModeFastMask = 0x00000010,
|
||||||
|
} SpvFPFastMathModeMask;
|
||||||
|
|
||||||
|
typedef enum SpvFPRoundingMode_ {
|
||||||
|
SpvFPRoundingModeRTE = 0,
|
||||||
|
SpvFPRoundingModeRTZ = 1,
|
||||||
|
SpvFPRoundingModeRTP = 2,
|
||||||
|
SpvFPRoundingModeRTN = 3,
|
||||||
|
} SpvFPRoundingMode;
|
||||||
|
|
||||||
|
typedef enum SpvLinkageType_ {
|
||||||
|
SpvLinkageTypeExport = 0,
|
||||||
|
SpvLinkageTypeImport = 1,
|
||||||
|
} SpvLinkageType;
|
||||||
|
|
||||||
|
typedef enum SpvAccessQualifier_ {
|
||||||
|
SpvAccessQualifierReadOnly = 0,
|
||||||
|
SpvAccessQualifierWriteOnly = 1,
|
||||||
|
SpvAccessQualifierReadWrite = 2,
|
||||||
|
} SpvAccessQualifier;
|
||||||
|
|
||||||
|
typedef enum SpvFunctionParameterAttribute_ {
|
||||||
|
SpvFunctionParameterAttributeZext = 0,
|
||||||
|
SpvFunctionParameterAttributeSext = 1,
|
||||||
|
SpvFunctionParameterAttributeByVal = 2,
|
||||||
|
SpvFunctionParameterAttributeSret = 3,
|
||||||
|
SpvFunctionParameterAttributeNoAlias = 4,
|
||||||
|
SpvFunctionParameterAttributeNoCapture = 5,
|
||||||
|
SpvFunctionParameterAttributeNoWrite = 6,
|
||||||
|
SpvFunctionParameterAttributeNoReadWrite = 7,
|
||||||
|
} SpvFunctionParameterAttribute;
|
||||||
|
|
||||||
|
typedef enum SpvDecoration_ {
|
||||||
|
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,
|
||||||
|
SpvDecorationSaturatedConversion = 28,
|
||||||
|
SpvDecorationStream = 29,
|
||||||
|
SpvDecorationLocation = 30,
|
||||||
|
SpvDecorationComponent = 31,
|
||||||
|
SpvDecorationIndex = 32,
|
||||||
|
SpvDecorationBinding = 33,
|
||||||
|
SpvDecorationDescriptorSet = 34,
|
||||||
|
SpvDecorationOffset = 35,
|
||||||
|
SpvDecorationXfbBuffer = 36,
|
||||||
|
SpvDecorationXfbStride = 37,
|
||||||
|
SpvDecorationFuncParamAttr = 38,
|
||||||
|
SpvDecorationFPRoundingMode = 39,
|
||||||
|
SpvDecorationFPFastMathMode = 40,
|
||||||
|
SpvDecorationLinkageAttributes = 41,
|
||||||
|
SpvDecorationNoContraction = 42,
|
||||||
|
SpvDecorationInputTargetIndex = 43,
|
||||||
|
SpvDecorationAlignment = 44,
|
||||||
|
} SpvDecoration;
|
||||||
|
|
||||||
|
typedef enum SpvBuiltIn_ {
|
||||||
|
SpvBuiltInPosition = 0,
|
||||||
|
SpvBuiltInPointSize = 1,
|
||||||
|
SpvBuiltInClipDistance = 3,
|
||||||
|
SpvBuiltInCullDistance = 4,
|
||||||
|
SpvBuiltInVertexId = 5,
|
||||||
|
SpvBuiltInInstanceId = 6,
|
||||||
|
SpvBuiltInPrimitiveId = 7,
|
||||||
|
SpvBuiltInInvocationId = 8,
|
||||||
|
SpvBuiltInLayer = 9,
|
||||||
|
SpvBuiltInViewportIndex = 10,
|
||||||
|
SpvBuiltInTessLevelOuter = 11,
|
||||||
|
SpvBuiltInTessLevelInner = 12,
|
||||||
|
SpvBuiltInTessCoord = 13,
|
||||||
|
SpvBuiltInPatchVertices = 14,
|
||||||
|
SpvBuiltInFragCoord = 15,
|
||||||
|
SpvBuiltInPointCoord = 16,
|
||||||
|
SpvBuiltInFrontFacing = 17,
|
||||||
|
SpvBuiltInSampleId = 18,
|
||||||
|
SpvBuiltInSamplePosition = 19,
|
||||||
|
SpvBuiltInSampleMask = 20,
|
||||||
|
SpvBuiltInFragColor = 21,
|
||||||
|
SpvBuiltInFragDepth = 22,
|
||||||
|
SpvBuiltInHelperInvocation = 23,
|
||||||
|
SpvBuiltInNumWorkgroups = 24,
|
||||||
|
SpvBuiltInWorkgroupSize = 25,
|
||||||
|
SpvBuiltInWorkgroupId = 26,
|
||||||
|
SpvBuiltInLocalInvocationId = 27,
|
||||||
|
SpvBuiltInGlobalInvocationId = 28,
|
||||||
|
SpvBuiltInLocalInvocationIndex = 29,
|
||||||
|
SpvBuiltInWorkDim = 30,
|
||||||
|
SpvBuiltInGlobalSize = 31,
|
||||||
|
SpvBuiltInEnqueuedWorkgroupSize = 32,
|
||||||
|
SpvBuiltInGlobalOffset = 33,
|
||||||
|
SpvBuiltInGlobalLinearId = 34,
|
||||||
|
SpvBuiltInWorkgroupLinearId = 35,
|
||||||
|
SpvBuiltInSubgroupSize = 36,
|
||||||
|
SpvBuiltInSubgroupMaxSize = 37,
|
||||||
|
SpvBuiltInNumSubgroups = 38,
|
||||||
|
SpvBuiltInNumEnqueuedSubgroups = 39,
|
||||||
|
SpvBuiltInSubgroupId = 40,
|
||||||
|
SpvBuiltInSubgroupLocalInvocationId = 41,
|
||||||
|
SpvBuiltInVertexIndex = 42,
|
||||||
|
SpvBuiltInInstanceIndex = 43,
|
||||||
|
} SpvBuiltIn;
|
||||||
|
|
||||||
|
typedef enum SpvSelectionControlShift_ {
|
||||||
|
SpvSelectionControlFlattenShift = 0,
|
||||||
|
SpvSelectionControlDontFlattenShift = 1,
|
||||||
|
} SpvSelectionControlShift;
|
||||||
|
|
||||||
|
typedef enum SpvSelectionControlMask_ {
|
||||||
|
SpvSelectionControlMaskNone = 0,
|
||||||
|
SpvSelectionControlFlattenMask = 0x00000001,
|
||||||
|
SpvSelectionControlDontFlattenMask = 0x00000002,
|
||||||
|
} SpvSelectionControlMask;
|
||||||
|
|
||||||
|
typedef enum SpvLoopControlShift_ {
|
||||||
|
SpvLoopControlUnrollShift = 0,
|
||||||
|
SpvLoopControlDontUnrollShift = 1,
|
||||||
|
} SpvLoopControlShift;
|
||||||
|
|
||||||
|
typedef enum SpvLoopControlMask_ {
|
||||||
|
SpvLoopControlMaskNone = 0,
|
||||||
|
SpvLoopControlUnrollMask = 0x00000001,
|
||||||
|
SpvLoopControlDontUnrollMask = 0x00000002,
|
||||||
|
} SpvLoopControlMask;
|
||||||
|
|
||||||
|
typedef enum SpvFunctionControlShift_ {
|
||||||
|
SpvFunctionControlInlineShift = 0,
|
||||||
|
SpvFunctionControlDontInlineShift = 1,
|
||||||
|
SpvFunctionControlPureShift = 2,
|
||||||
|
SpvFunctionControlConstShift = 3,
|
||||||
|
} SpvFunctionControlShift;
|
||||||
|
|
||||||
|
typedef enum SpvFunctionControlMask_ {
|
||||||
|
SpvFunctionControlMaskNone = 0,
|
||||||
|
SpvFunctionControlInlineMask = 0x00000001,
|
||||||
|
SpvFunctionControlDontInlineMask = 0x00000002,
|
||||||
|
SpvFunctionControlPureMask = 0x00000004,
|
||||||
|
SpvFunctionControlConstMask = 0x00000008,
|
||||||
|
} SpvFunctionControlMask;
|
||||||
|
|
||||||
|
typedef enum SpvMemorySemanticsShift_ {
|
||||||
|
SpvMemorySemanticsAcquireShift = 0,
|
||||||
|
SpvMemorySemanticsReleaseShift = 1,
|
||||||
|
SpvMemorySemanticsSequentiallyConsistentShift = 2,
|
||||||
|
SpvMemorySemanticsUniformMemoryShift = 3,
|
||||||
|
SpvMemorySemanticsSubgroupMemoryShift = 4,
|
||||||
|
SpvMemorySemanticsWorkgroupLocalMemoryShift = 5,
|
||||||
|
SpvMemorySemanticsWorkgroupGlobalMemoryShift = 6,
|
||||||
|
SpvMemorySemanticsAtomicCounterMemoryShift = 7,
|
||||||
|
SpvMemorySemanticsImageMemoryShift = 8,
|
||||||
|
} SpvMemorySemanticsShift;
|
||||||
|
|
||||||
|
typedef enum SpvMemorySemanticsMask_ {
|
||||||
|
SpvMemorySemanticsMaskNone = 0,
|
||||||
|
SpvMemorySemanticsAcquireMask = 0x00000001,
|
||||||
|
SpvMemorySemanticsReleaseMask = 0x00000002,
|
||||||
|
SpvMemorySemanticsSequentiallyConsistentMask = 0x00000004,
|
||||||
|
SpvMemorySemanticsUniformMemoryMask = 0x00000008,
|
||||||
|
SpvMemorySemanticsSubgroupMemoryMask = 0x00000010,
|
||||||
|
SpvMemorySemanticsWorkgroupLocalMemoryMask = 0x00000020,
|
||||||
|
SpvMemorySemanticsWorkgroupGlobalMemoryMask = 0x00000040,
|
||||||
|
SpvMemorySemanticsAtomicCounterMemoryMask = 0x00000080,
|
||||||
|
SpvMemorySemanticsImageMemoryMask = 0x00000100,
|
||||||
|
} SpvMemorySemanticsMask;
|
||||||
|
|
||||||
|
typedef enum SpvMemoryAccessShift_ {
|
||||||
|
SpvMemoryAccessVolatileShift = 0,
|
||||||
|
SpvMemoryAccessAlignedShift = 1,
|
||||||
|
SpvMemoryAccessNontemporalShift = 2,
|
||||||
|
} SpvMemoryAccessShift;
|
||||||
|
|
||||||
|
typedef enum SpvMemoryAccessMask_ {
|
||||||
|
SpvMemoryAccessMaskNone = 0,
|
||||||
|
SpvMemoryAccessVolatileMask = 0x00000001,
|
||||||
|
SpvMemoryAccessAlignedMask = 0x00000002,
|
||||||
|
SpvMemoryAccessNontemporalMask = 0x00000004,
|
||||||
|
} SpvMemoryAccessMask;
|
||||||
|
|
||||||
|
typedef enum SpvScope_ {
|
||||||
|
SpvScopeCrossDevice = 0,
|
||||||
|
SpvScopeDevice = 1,
|
||||||
|
SpvScopeWorkgroup = 2,
|
||||||
|
SpvScopeSubgroup = 3,
|
||||||
|
SpvScopeInvocation = 4,
|
||||||
|
} SpvScope;
|
||||||
|
|
||||||
|
typedef enum SpvGroupOperation_ {
|
||||||
|
SpvGroupOperationReduce = 0,
|
||||||
|
SpvGroupOperationInclusiveScan = 1,
|
||||||
|
SpvGroupOperationExclusiveScan = 2,
|
||||||
|
} SpvGroupOperation;
|
||||||
|
|
||||||
|
typedef enum SpvKernelEnqueueFlags_ {
|
||||||
|
SpvKernelEnqueueFlagsNoWait = 0,
|
||||||
|
SpvKernelEnqueueFlagsWaitKernel = 1,
|
||||||
|
SpvKernelEnqueueFlagsWaitWorkGroup = 2,
|
||||||
|
} SpvKernelEnqueueFlags;
|
||||||
|
|
||||||
|
typedef enum SpvKernelProfilingInfoShift_ {
|
||||||
|
SpvKernelProfilingInfoCmdExecTimeShift = 0,
|
||||||
|
} SpvKernelProfilingInfoShift;
|
||||||
|
|
||||||
|
typedef enum SpvKernelProfilingInfoMask_ {
|
||||||
|
SpvKernelProfilingInfoMaskNone = 0,
|
||||||
|
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,
|
||||||
|
SpvCapabilityTessellationPointSize = 23,
|
||||||
|
SpvCapabilityGeometryPointSize = 24,
|
||||||
|
SpvCapabilityImageGatherExtended = 25,
|
||||||
|
SpvCapabilityStorageImageExtendedFormats = 26,
|
||||||
|
SpvCapabilityStorageImageMultisample = 27,
|
||||||
|
SpvCapabilityUniformBufferArrayDynamicIndexing = 28,
|
||||||
|
SpvCapabilitySampledImageArrayDynamicIndexing = 29,
|
||||||
|
SpvCapabilityStorageBufferArrayDynamicIndexing = 30,
|
||||||
|
SpvCapabilityStorageImageArrayDynamicIndexing = 31,
|
||||||
|
SpvCapabilityClipDistance = 32,
|
||||||
|
SpvCapabilityCullDistance = 33,
|
||||||
|
SpvCapabilityImageCubeArray = 34,
|
||||||
|
SpvCapabilitySampleRateShading = 35,
|
||||||
|
SpvCapabilityImageRect = 36,
|
||||||
|
SpvCapabilitySampledRect = 37,
|
||||||
|
SpvCapabilityGenericPointer = 38,
|
||||||
|
SpvCapabilityInt8 = 39,
|
||||||
|
SpvCapabilityInputTarget = 40,
|
||||||
|
SpvCapabilitySparseResidency = 41,
|
||||||
|
SpvCapabilityMinLod = 42,
|
||||||
|
SpvCapabilitySampled1D = 43,
|
||||||
|
SpvCapabilityImage1D = 44,
|
||||||
|
SpvCapabilitySampledCubeArray = 45,
|
||||||
|
SpvCapabilitySampledBuffer = 46,
|
||||||
|
SpvCapabilityImageBuffer = 47,
|
||||||
|
SpvCapabilityImageMSArray = 48,
|
||||||
|
SpvCapabilityAdvancedFormats = 49,
|
||||||
|
SpvCapabilityImageQuery = 50,
|
||||||
|
SpvCapabilityDerivativeControl = 51,
|
||||||
|
SpvCapabilityInterpolationFunction = 52,
|
||||||
|
SpvCapabilityTransformFeedback = 53,
|
||||||
|
} SpvCapability;
|
||||||
|
|
||||||
|
typedef enum SpvOp_ {
|
||||||
|
SpvOpNop = 0,
|
||||||
|
SpvOpUndef = 1,
|
||||||
|
SpvOpSourceContinued = 2,
|
||||||
|
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,
|
||||||
|
SpvOpTypeForwardPointer = 39,
|
||||||
|
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,
|
||||||
|
SpvOpInBoundsPtrAccessChain = 70,
|
||||||
|
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,
|
||||||
|
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,
|
||||||
|
SpvOpUMulExtended = 151,
|
||||||
|
SpvOpSMulExtended = 152,
|
||||||
|
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,
|
||||||
|
SpvOpAtomicSMin = 236,
|
||||||
|
SpvOpAtomicUMin = 237,
|
||||||
|
SpvOpAtomicSMax = 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,
|
||||||
|
SpvOpImageSparseSampleImplicitLod = 305,
|
||||||
|
SpvOpImageSparseSampleExplicitLod = 306,
|
||||||
|
SpvOpImageSparseSampleDrefImplicitLod = 307,
|
||||||
|
SpvOpImageSparseSampleDrefExplicitLod = 308,
|
||||||
|
SpvOpImageSparseSampleProjImplicitLod = 309,
|
||||||
|
SpvOpImageSparseSampleProjExplicitLod = 310,
|
||||||
|
SpvOpImageSparseSampleProjDrefImplicitLod = 311,
|
||||||
|
SpvOpImageSparseSampleProjDrefExplicitLod = 312,
|
||||||
|
SpvOpImageSparseFetch = 313,
|
||||||
|
SpvOpImageSparseGather = 314,
|
||||||
|
SpvOpImageSparseDrefGather = 315,
|
||||||
|
SpvOpImageSparseTexelsResident = 316,
|
||||||
|
SpvOpNoLine = 317,
|
||||||
|
SpvOpAtomicFlagTestAndSet = 318,
|
||||||
|
SpvOpAtomicFlagClear = 319,
|
||||||
|
} SpvOp;
|
||||||
|
|
||||||
|
#endif // #ifndef spirv_H
|
||||||
|
|
875
external/include/headers/spirv.hpp
vendored
875
external/include/headers/spirv.hpp
vendored
@ -1,875 +0,0 @@
|
|||||||
// Copyright (c) 2014-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/
|
|
||||||
//
|
|
||||||
// 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.
|
|
||||||
|
|
||||||
// This header is automatically generated by the same tool that creates
|
|
||||||
// the Binary Section of the SPIR-V specification.
|
|
||||||
|
|
||||||
// Specification revision 32.
|
|
||||||
// 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
|
|
||||||
// amount (1 << x) for each corresponding enumerant.
|
|
||||||
|
|
||||||
#ifndef spirv_H
|
|
||||||
#define spirv_H
|
|
||||||
|
|
||||||
namespace spv {
|
|
||||||
|
|
||||||
typedef unsigned int Id;
|
|
||||||
|
|
||||||
static const unsigned int MagicNumber = 0x07230203;
|
|
||||||
static const unsigned int Version = 99;
|
|
||||||
static const unsigned int Revision = 32;
|
|
||||||
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,
|
|
||||||
MemoryModelOpenCL = 2,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum ExecutionMode {
|
|
||||||
ExecutionModeInvocations = 0,
|
|
||||||
ExecutionModeSpacingEqual = 1,
|
|
||||||
ExecutionModeSpacingFractionalEven = 2,
|
|
||||||
ExecutionModeSpacingFractionalOdd = 3,
|
|
||||||
ExecutionModeVertexOrderCw = 4,
|
|
||||||
ExecutionModeVertexOrderCcw = 5,
|
|
||||||
ExecutionModePixelCenterInteger = 6,
|
|
||||||
ExecutionModeOriginUpperLeft = 7,
|
|
||||||
ExecutionModeOriginLowerLeft = 8,
|
|
||||||
ExecutionModeEarlyFragmentTests = 9,
|
|
||||||
ExecutionModePointMode = 10,
|
|
||||||
ExecutionModeXfb = 11,
|
|
||||||
ExecutionModeDepthReplacing = 12,
|
|
||||||
ExecutionModeDepthAny = 13,
|
|
||||||
ExecutionModeDepthGreater = 14,
|
|
||||||
ExecutionModeDepthLess = 15,
|
|
||||||
ExecutionModeDepthUnchanged = 16,
|
|
||||||
ExecutionModeLocalSize = 17,
|
|
||||||
ExecutionModeLocalSizeHint = 18,
|
|
||||||
ExecutionModeInputPoints = 19,
|
|
||||||
ExecutionModeInputLines = 20,
|
|
||||||
ExecutionModeInputLinesAdjacency = 21,
|
|
||||||
ExecutionModeInputTriangles = 22,
|
|
||||||
ExecutionModeInputTrianglesAdjacency = 23,
|
|
||||||
ExecutionModeInputQuads = 24,
|
|
||||||
ExecutionModeInputIsolines = 25,
|
|
||||||
ExecutionModeOutputVertices = 26,
|
|
||||||
ExecutionModeOutputPoints = 27,
|
|
||||||
ExecutionModeOutputLineStrip = 28,
|
|
||||||
ExecutionModeOutputTriangleStrip = 29,
|
|
||||||
ExecutionModeVecTypeHint = 30,
|
|
||||||
ExecutionModeContractionOff = 31,
|
|
||||||
ExecutionModeIndependentForwardProgress = 32,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum StorageClass {
|
|
||||||
StorageClassUniformConstant = 0,
|
|
||||||
StorageClassInput = 1,
|
|
||||||
StorageClassUniform = 2,
|
|
||||||
StorageClassOutput = 3,
|
|
||||||
StorageClassWorkgroupLocal = 4,
|
|
||||||
StorageClassWorkgroupGlobal = 5,
|
|
||||||
StorageClassPrivateGlobal = 6,
|
|
||||||
StorageClassFunction = 7,
|
|
||||||
StorageClassGeneric = 8,
|
|
||||||
StorageClassPushConstant = 9,
|
|
||||||
StorageClassAtomicCounter = 10,
|
|
||||||
StorageClassImage = 11,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum Dim {
|
|
||||||
Dim1D = 0,
|
|
||||||
Dim2D = 1,
|
|
||||||
Dim3D = 2,
|
|
||||||
DimCube = 3,
|
|
||||||
DimRect = 4,
|
|
||||||
DimBuffer = 5,
|
|
||||||
DimInputTarget = 6,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum SamplerAddressingMode {
|
|
||||||
SamplerAddressingModeNone = 0,
|
|
||||||
SamplerAddressingModeClampToEdge = 1,
|
|
||||||
SamplerAddressingModeClamp = 2,
|
|
||||||
SamplerAddressingModeRepeat = 3,
|
|
||||||
SamplerAddressingModeRepeatMirrored = 4,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum SamplerFilterMode {
|
|
||||||
SamplerFilterModeNearest = 0,
|
|
||||||
SamplerFilterModeLinear = 1,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum ImageFormat {
|
|
||||||
ImageFormatUnknown = 0,
|
|
||||||
ImageFormatRgba32f = 1,
|
|
||||||
ImageFormatRgba16f = 2,
|
|
||||||
ImageFormatR32f = 3,
|
|
||||||
ImageFormatRgba8 = 4,
|
|
||||||
ImageFormatRgba8Snorm = 5,
|
|
||||||
ImageFormatRg32f = 6,
|
|
||||||
ImageFormatRg16f = 7,
|
|
||||||
ImageFormatR11fG11fB10f = 8,
|
|
||||||
ImageFormatR16f = 9,
|
|
||||||
ImageFormatRgba16 = 10,
|
|
||||||
ImageFormatRgb10A2 = 11,
|
|
||||||
ImageFormatRg16 = 12,
|
|
||||||
ImageFormatRg8 = 13,
|
|
||||||
ImageFormatR16 = 14,
|
|
||||||
ImageFormatR8 = 15,
|
|
||||||
ImageFormatRgba16Snorm = 16,
|
|
||||||
ImageFormatRg16Snorm = 17,
|
|
||||||
ImageFormatRg8Snorm = 18,
|
|
||||||
ImageFormatR16Snorm = 19,
|
|
||||||
ImageFormatR8Snorm = 20,
|
|
||||||
ImageFormatRgba32i = 21,
|
|
||||||
ImageFormatRgba16i = 22,
|
|
||||||
ImageFormatRgba8i = 23,
|
|
||||||
ImageFormatR32i = 24,
|
|
||||||
ImageFormatRg32i = 25,
|
|
||||||
ImageFormatRg16i = 26,
|
|
||||||
ImageFormatRg8i = 27,
|
|
||||||
ImageFormatR16i = 28,
|
|
||||||
ImageFormatR8i = 29,
|
|
||||||
ImageFormatRgba32ui = 30,
|
|
||||||
ImageFormatRgba16ui = 31,
|
|
||||||
ImageFormatRgba8ui = 32,
|
|
||||||
ImageFormatR32ui = 33,
|
|
||||||
ImageFormatRgb10a2ui = 34,
|
|
||||||
ImageFormatRg32ui = 35,
|
|
||||||
ImageFormatRg16ui = 36,
|
|
||||||
ImageFormatRg8ui = 37,
|
|
||||||
ImageFormatR16ui = 38,
|
|
||||||
ImageFormatR8ui = 39,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum ImageChannelOrder {
|
|
||||||
ImageChannelOrderR = 0,
|
|
||||||
ImageChannelOrderA = 1,
|
|
||||||
ImageChannelOrderRG = 2,
|
|
||||||
ImageChannelOrderRA = 3,
|
|
||||||
ImageChannelOrderRGB = 4,
|
|
||||||
ImageChannelOrderRGBA = 5,
|
|
||||||
ImageChannelOrderBGRA = 6,
|
|
||||||
ImageChannelOrderARGB = 7,
|
|
||||||
ImageChannelOrderIntensity = 8,
|
|
||||||
ImageChannelOrderLuminance = 9,
|
|
||||||
ImageChannelOrderRx = 10,
|
|
||||||
ImageChannelOrderRGx = 11,
|
|
||||||
ImageChannelOrderRGBx = 12,
|
|
||||||
ImageChannelOrderDepth = 13,
|
|
||||||
ImageChannelOrderDepthStencil = 14,
|
|
||||||
ImageChannelOrdersRGB = 15,
|
|
||||||
ImageChannelOrdersRGBx = 16,
|
|
||||||
ImageChannelOrdersRGBA = 17,
|
|
||||||
ImageChannelOrdersBGRA = 18,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum ImageChannelDataType {
|
|
||||||
ImageChannelDataTypeSnormInt8 = 0,
|
|
||||||
ImageChannelDataTypeSnormInt16 = 1,
|
|
||||||
ImageChannelDataTypeUnormInt8 = 2,
|
|
||||||
ImageChannelDataTypeUnormInt16 = 3,
|
|
||||||
ImageChannelDataTypeUnormShort565 = 4,
|
|
||||||
ImageChannelDataTypeUnormShort555 = 5,
|
|
||||||
ImageChannelDataTypeUnormInt101010 = 6,
|
|
||||||
ImageChannelDataTypeSignedInt8 = 7,
|
|
||||||
ImageChannelDataTypeSignedInt16 = 8,
|
|
||||||
ImageChannelDataTypeSignedInt32 = 9,
|
|
||||||
ImageChannelDataTypeUnsignedInt8 = 10,
|
|
||||||
ImageChannelDataTypeUnsignedInt16 = 11,
|
|
||||||
ImageChannelDataTypeUnsignedInt32 = 12,
|
|
||||||
ImageChannelDataTypeHalfFloat = 13,
|
|
||||||
ImageChannelDataTypeFloat = 14,
|
|
||||||
ImageChannelDataTypeUnormInt24 = 15,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum ImageOperandsShift {
|
|
||||||
ImageOperandsBiasShift = 0,
|
|
||||||
ImageOperandsLodShift = 1,
|
|
||||||
ImageOperandsGradShift = 2,
|
|
||||||
ImageOperandsConstOffsetShift = 3,
|
|
||||||
ImageOperandsOffsetShift = 4,
|
|
||||||
ImageOperandsConstOffsetsShift = 5,
|
|
||||||
ImageOperandsSampleShift = 6,
|
|
||||||
ImageOperandsMinLodShift = 7,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum ImageOperandsMask {
|
|
||||||
ImageOperandsMaskNone = 0,
|
|
||||||
ImageOperandsBiasMask = 0x00000001,
|
|
||||||
ImageOperandsLodMask = 0x00000002,
|
|
||||||
ImageOperandsGradMask = 0x00000004,
|
|
||||||
ImageOperandsConstOffsetMask = 0x00000008,
|
|
||||||
ImageOperandsOffsetMask = 0x00000010,
|
|
||||||
ImageOperandsConstOffsetsMask = 0x00000020,
|
|
||||||
ImageOperandsSampleMask = 0x00000040,
|
|
||||||
ImageOperandsMinLodMask = 0x00000080,
|
|
||||||
};
|
|
||||||
|
|
||||||
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,
|
|
||||||
FunctionParameterAttributeNoWrite = 6,
|
|
||||||
FunctionParameterAttributeNoReadWrite = 7,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum Decoration {
|
|
||||||
DecorationRelaxedPrecision = 0,
|
|
||||||
DecorationSpecId = 1,
|
|
||||||
DecorationBlock = 2,
|
|
||||||
DecorationBufferBlock = 3,
|
|
||||||
DecorationRowMajor = 4,
|
|
||||||
DecorationColMajor = 5,
|
|
||||||
DecorationArrayStride = 6,
|
|
||||||
DecorationMatrixStride = 7,
|
|
||||||
DecorationGLSLShared = 8,
|
|
||||||
DecorationGLSLPacked = 9,
|
|
||||||
DecorationCPacked = 10,
|
|
||||||
DecorationBuiltIn = 11,
|
|
||||||
DecorationSmooth = 12,
|
|
||||||
DecorationNoPerspective = 13,
|
|
||||||
DecorationFlat = 14,
|
|
||||||
DecorationPatch = 15,
|
|
||||||
DecorationCentroid = 16,
|
|
||||||
DecorationSample = 17,
|
|
||||||
DecorationInvariant = 18,
|
|
||||||
DecorationRestrict = 19,
|
|
||||||
DecorationAliased = 20,
|
|
||||||
DecorationVolatile = 21,
|
|
||||||
DecorationConstant = 22,
|
|
||||||
DecorationCoherent = 23,
|
|
||||||
DecorationNonWritable = 24,
|
|
||||||
DecorationNonReadable = 25,
|
|
||||||
DecorationUniform = 26,
|
|
||||||
DecorationSaturatedConversion = 28,
|
|
||||||
DecorationStream = 29,
|
|
||||||
DecorationLocation = 30,
|
|
||||||
DecorationComponent = 31,
|
|
||||||
DecorationIndex = 32,
|
|
||||||
DecorationBinding = 33,
|
|
||||||
DecorationDescriptorSet = 34,
|
|
||||||
DecorationOffset = 35,
|
|
||||||
DecorationXfbBuffer = 36,
|
|
||||||
DecorationXfbStride = 37,
|
|
||||||
DecorationFuncParamAttr = 38,
|
|
||||||
DecorationFPRoundingMode = 39,
|
|
||||||
DecorationFPFastMathMode = 40,
|
|
||||||
DecorationLinkageAttributes = 41,
|
|
||||||
DecorationNoContraction = 42,
|
|
||||||
DecorationInputTargetIndex = 43,
|
|
||||||
DecorationAlignment = 44,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum BuiltIn {
|
|
||||||
BuiltInPosition = 0,
|
|
||||||
BuiltInPointSize = 1,
|
|
||||||
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,
|
|
||||||
BuiltInVertexIndex = 42,
|
|
||||||
BuiltInInstanceIndex = 43,
|
|
||||||
};
|
|
||||||
|
|
||||||
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 {
|
|
||||||
MemorySemanticsAcquireShift = 0,
|
|
||||||
MemorySemanticsReleaseShift = 1,
|
|
||||||
MemorySemanticsSequentiallyConsistentShift = 2,
|
|
||||||
MemorySemanticsUniformMemoryShift = 3,
|
|
||||||
MemorySemanticsSubgroupMemoryShift = 4,
|
|
||||||
MemorySemanticsWorkgroupLocalMemoryShift = 5,
|
|
||||||
MemorySemanticsWorkgroupGlobalMemoryShift = 6,
|
|
||||||
MemorySemanticsAtomicCounterMemoryShift = 7,
|
|
||||||
MemorySemanticsImageMemoryShift = 8,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum MemorySemanticsMask {
|
|
||||||
MemorySemanticsMaskNone = 0,
|
|
||||||
MemorySemanticsAcquireMask = 0x00000001,
|
|
||||||
MemorySemanticsReleaseMask = 0x00000002,
|
|
||||||
MemorySemanticsSequentiallyConsistentMask = 0x00000004,
|
|
||||||
MemorySemanticsUniformMemoryMask = 0x00000008,
|
|
||||||
MemorySemanticsSubgroupMemoryMask = 0x00000010,
|
|
||||||
MemorySemanticsWorkgroupLocalMemoryMask = 0x00000020,
|
|
||||||
MemorySemanticsWorkgroupGlobalMemoryMask = 0x00000040,
|
|
||||||
MemorySemanticsAtomicCounterMemoryMask = 0x00000080,
|
|
||||||
MemorySemanticsImageMemoryMask = 0x00000100,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum MemoryAccessShift {
|
|
||||||
MemoryAccessVolatileShift = 0,
|
|
||||||
MemoryAccessAlignedShift = 1,
|
|
||||||
MemoryAccessNontemporalShift = 2,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum MemoryAccessMask {
|
|
||||||
MemoryAccessMaskNone = 0,
|
|
||||||
MemoryAccessVolatileMask = 0x00000001,
|
|
||||||
MemoryAccessAlignedMask = 0x00000002,
|
|
||||||
MemoryAccessNontemporalMask = 0x00000004,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum Scope {
|
|
||||||
ScopeCrossDevice = 0,
|
|
||||||
ScopeDevice = 1,
|
|
||||||
ScopeWorkgroup = 2,
|
|
||||||
ScopeSubgroup = 3,
|
|
||||||
ScopeInvocation = 4,
|
|
||||||
};
|
|
||||||
|
|
||||||
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 Capability {
|
|
||||||
CapabilityMatrix = 0,
|
|
||||||
CapabilityShader = 1,
|
|
||||||
CapabilityGeometry = 2,
|
|
||||||
CapabilityTessellation = 3,
|
|
||||||
CapabilityAddresses = 4,
|
|
||||||
CapabilityLinkage = 5,
|
|
||||||
CapabilityKernel = 6,
|
|
||||||
CapabilityVector16 = 7,
|
|
||||||
CapabilityFloat16Buffer = 8,
|
|
||||||
CapabilityFloat16 = 9,
|
|
||||||
CapabilityFloat64 = 10,
|
|
||||||
CapabilityInt64 = 11,
|
|
||||||
CapabilityInt64Atomics = 12,
|
|
||||||
CapabilityImageBasic = 13,
|
|
||||||
CapabilityImageReadWrite = 14,
|
|
||||||
CapabilityImageMipmap = 15,
|
|
||||||
CapabilityImageSRGBWrite = 16,
|
|
||||||
CapabilityPipes = 17,
|
|
||||||
CapabilityGroups = 18,
|
|
||||||
CapabilityDeviceEnqueue = 19,
|
|
||||||
CapabilityLiteralSampler = 20,
|
|
||||||
CapabilityAtomicStorage = 21,
|
|
||||||
CapabilityInt16 = 22,
|
|
||||||
CapabilityTessellationPointSize = 23,
|
|
||||||
CapabilityGeometryPointSize = 24,
|
|
||||||
CapabilityImageGatherExtended = 25,
|
|
||||||
CapabilityStorageImageExtendedFormats = 26,
|
|
||||||
CapabilityStorageImageMultisample = 27,
|
|
||||||
CapabilityUniformBufferArrayDynamicIndexing = 28,
|
|
||||||
CapabilitySampledImageArrayDynamicIndexing = 29,
|
|
||||||
CapabilityStorageBufferArrayDynamicIndexing = 30,
|
|
||||||
CapabilityStorageImageArrayDynamicIndexing = 31,
|
|
||||||
CapabilityClipDistance = 32,
|
|
||||||
CapabilityCullDistance = 33,
|
|
||||||
CapabilityImageCubeArray = 34,
|
|
||||||
CapabilitySampleRateShading = 35,
|
|
||||||
CapabilityImageRect = 36,
|
|
||||||
CapabilitySampledRect = 37,
|
|
||||||
CapabilityGenericPointer = 38,
|
|
||||||
CapabilityInt8 = 39,
|
|
||||||
CapabilityInputTarget = 40,
|
|
||||||
CapabilitySparseResidency = 41,
|
|
||||||
CapabilityMinLod = 42,
|
|
||||||
CapabilitySampled1D = 43,
|
|
||||||
CapabilityImage1D = 44,
|
|
||||||
CapabilitySampledCubeArray = 45,
|
|
||||||
CapabilitySampledBuffer = 46,
|
|
||||||
CapabilityImageBuffer = 47,
|
|
||||||
CapabilityImageMSArray = 48,
|
|
||||||
CapabilityAdvancedFormats = 49,
|
|
||||||
CapabilityImageQuery = 50,
|
|
||||||
CapabilityDerivativeControl = 51,
|
|
||||||
CapabilityInterpolationFunction = 52,
|
|
||||||
CapabilityTransformFeedback = 53,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum Op {
|
|
||||||
OpNop = 0,
|
|
||||||
OpUndef = 1,
|
|
||||||
OpSourceContinued = 2,
|
|
||||||
OpSource = 3,
|
|
||||||
OpSourceExtension = 4,
|
|
||||||
OpName = 5,
|
|
||||||
OpMemberName = 6,
|
|
||||||
OpString = 7,
|
|
||||||
OpLine = 8,
|
|
||||||
OpExtension = 10,
|
|
||||||
OpExtInstImport = 11,
|
|
||||||
OpExtInst = 12,
|
|
||||||
OpMemoryModel = 14,
|
|
||||||
OpEntryPoint = 15,
|
|
||||||
OpExecutionMode = 16,
|
|
||||||
OpCapability = 17,
|
|
||||||
OpTypeVoid = 19,
|
|
||||||
OpTypeBool = 20,
|
|
||||||
OpTypeInt = 21,
|
|
||||||
OpTypeFloat = 22,
|
|
||||||
OpTypeVector = 23,
|
|
||||||
OpTypeMatrix = 24,
|
|
||||||
OpTypeImage = 25,
|
|
||||||
OpTypeSampler = 26,
|
|
||||||
OpTypeSampledImage = 27,
|
|
||||||
OpTypeArray = 28,
|
|
||||||
OpTypeRuntimeArray = 29,
|
|
||||||
OpTypeStruct = 30,
|
|
||||||
OpTypeOpaque = 31,
|
|
||||||
OpTypePointer = 32,
|
|
||||||
OpTypeFunction = 33,
|
|
||||||
OpTypeEvent = 34,
|
|
||||||
OpTypeDeviceEvent = 35,
|
|
||||||
OpTypeReserveId = 36,
|
|
||||||
OpTypeQueue = 37,
|
|
||||||
OpTypePipe = 38,
|
|
||||||
OpTypeForwardPointer = 39,
|
|
||||||
OpConstantTrue = 41,
|
|
||||||
OpConstantFalse = 42,
|
|
||||||
OpConstant = 43,
|
|
||||||
OpConstantComposite = 44,
|
|
||||||
OpConstantSampler = 45,
|
|
||||||
OpConstantNull = 46,
|
|
||||||
OpSpecConstantTrue = 48,
|
|
||||||
OpSpecConstantFalse = 49,
|
|
||||||
OpSpecConstant = 50,
|
|
||||||
OpSpecConstantComposite = 51,
|
|
||||||
OpSpecConstantOp = 52,
|
|
||||||
OpFunction = 54,
|
|
||||||
OpFunctionParameter = 55,
|
|
||||||
OpFunctionEnd = 56,
|
|
||||||
OpFunctionCall = 57,
|
|
||||||
OpVariable = 59,
|
|
||||||
OpImageTexelPointer = 60,
|
|
||||||
OpLoad = 61,
|
|
||||||
OpStore = 62,
|
|
||||||
OpCopyMemory = 63,
|
|
||||||
OpCopyMemorySized = 64,
|
|
||||||
OpAccessChain = 65,
|
|
||||||
OpInBoundsAccessChain = 66,
|
|
||||||
OpPtrAccessChain = 67,
|
|
||||||
OpArrayLength = 68,
|
|
||||||
OpGenericPtrMemSemantics = 69,
|
|
||||||
OpInBoundsPtrAccessChain = 70,
|
|
||||||
OpDecorate = 71,
|
|
||||||
OpMemberDecorate = 72,
|
|
||||||
OpDecorationGroup = 73,
|
|
||||||
OpGroupDecorate = 74,
|
|
||||||
OpGroupMemberDecorate = 75,
|
|
||||||
OpVectorExtractDynamic = 77,
|
|
||||||
OpVectorInsertDynamic = 78,
|
|
||||||
OpVectorShuffle = 79,
|
|
||||||
OpCompositeConstruct = 80,
|
|
||||||
OpCompositeExtract = 81,
|
|
||||||
OpCompositeInsert = 82,
|
|
||||||
OpCopyObject = 83,
|
|
||||||
OpTranspose = 84,
|
|
||||||
OpSampledImage = 86,
|
|
||||||
OpImageSampleImplicitLod = 87,
|
|
||||||
OpImageSampleExplicitLod = 88,
|
|
||||||
OpImageSampleDrefImplicitLod = 89,
|
|
||||||
OpImageSampleDrefExplicitLod = 90,
|
|
||||||
OpImageSampleProjImplicitLod = 91,
|
|
||||||
OpImageSampleProjExplicitLod = 92,
|
|
||||||
OpImageSampleProjDrefImplicitLod = 93,
|
|
||||||
OpImageSampleProjDrefExplicitLod = 94,
|
|
||||||
OpImageFetch = 95,
|
|
||||||
OpImageGather = 96,
|
|
||||||
OpImageDrefGather = 97,
|
|
||||||
OpImageRead = 98,
|
|
||||||
OpImageWrite = 99,
|
|
||||||
OpImageQueryFormat = 101,
|
|
||||||
OpImageQueryOrder = 102,
|
|
||||||
OpImageQuerySizeLod = 103,
|
|
||||||
OpImageQuerySize = 104,
|
|
||||||
OpImageQueryLod = 105,
|
|
||||||
OpImageQueryLevels = 106,
|
|
||||||
OpImageQuerySamples = 107,
|
|
||||||
OpConvertFToU = 109,
|
|
||||||
OpConvertFToS = 110,
|
|
||||||
OpConvertSToF = 111,
|
|
||||||
OpConvertUToF = 112,
|
|
||||||
OpUConvert = 113,
|
|
||||||
OpSConvert = 114,
|
|
||||||
OpFConvert = 115,
|
|
||||||
OpQuantizeToF16 = 116,
|
|
||||||
OpConvertPtrToU = 117,
|
|
||||||
OpSatConvertSToU = 118,
|
|
||||||
OpSatConvertUToS = 119,
|
|
||||||
OpConvertUToPtr = 120,
|
|
||||||
OpPtrCastToGeneric = 121,
|
|
||||||
OpGenericCastToPtr = 122,
|
|
||||||
OpGenericCastToPtrExplicit = 123,
|
|
||||||
OpBitcast = 124,
|
|
||||||
OpSNegate = 126,
|
|
||||||
OpFNegate = 127,
|
|
||||||
OpIAdd = 128,
|
|
||||||
OpFAdd = 129,
|
|
||||||
OpISub = 130,
|
|
||||||
OpFSub = 131,
|
|
||||||
OpIMul = 132,
|
|
||||||
OpFMul = 133,
|
|
||||||
OpUDiv = 134,
|
|
||||||
OpSDiv = 135,
|
|
||||||
OpFDiv = 136,
|
|
||||||
OpUMod = 137,
|
|
||||||
OpSRem = 138,
|
|
||||||
OpSMod = 139,
|
|
||||||
OpFRem = 140,
|
|
||||||
OpFMod = 141,
|
|
||||||
OpVectorTimesScalar = 142,
|
|
||||||
OpMatrixTimesScalar = 143,
|
|
||||||
OpVectorTimesMatrix = 144,
|
|
||||||
OpMatrixTimesVector = 145,
|
|
||||||
OpMatrixTimesMatrix = 146,
|
|
||||||
OpOuterProduct = 147,
|
|
||||||
OpDot = 148,
|
|
||||||
OpIAddCarry = 149,
|
|
||||||
OpISubBorrow = 150,
|
|
||||||
OpUMulExtended = 151,
|
|
||||||
OpSMulExtended = 152,
|
|
||||||
OpAny = 154,
|
|
||||||
OpAll = 155,
|
|
||||||
OpIsNan = 156,
|
|
||||||
OpIsInf = 157,
|
|
||||||
OpIsFinite = 158,
|
|
||||||
OpIsNormal = 159,
|
|
||||||
OpSignBitSet = 160,
|
|
||||||
OpLessOrGreater = 161,
|
|
||||||
OpOrdered = 162,
|
|
||||||
OpUnordered = 163,
|
|
||||||
OpLogicalEqual = 164,
|
|
||||||
OpLogicalNotEqual = 165,
|
|
||||||
OpLogicalOr = 166,
|
|
||||||
OpLogicalAnd = 167,
|
|
||||||
OpLogicalNot = 168,
|
|
||||||
OpSelect = 169,
|
|
||||||
OpIEqual = 170,
|
|
||||||
OpINotEqual = 171,
|
|
||||||
OpUGreaterThan = 172,
|
|
||||||
OpSGreaterThan = 173,
|
|
||||||
OpUGreaterThanEqual = 174,
|
|
||||||
OpSGreaterThanEqual = 175,
|
|
||||||
OpULessThan = 176,
|
|
||||||
OpSLessThan = 177,
|
|
||||||
OpULessThanEqual = 178,
|
|
||||||
OpSLessThanEqual = 179,
|
|
||||||
OpFOrdEqual = 180,
|
|
||||||
OpFUnordEqual = 181,
|
|
||||||
OpFOrdNotEqual = 182,
|
|
||||||
OpFUnordNotEqual = 183,
|
|
||||||
OpFOrdLessThan = 184,
|
|
||||||
OpFUnordLessThan = 185,
|
|
||||||
OpFOrdGreaterThan = 186,
|
|
||||||
OpFUnordGreaterThan = 187,
|
|
||||||
OpFOrdLessThanEqual = 188,
|
|
||||||
OpFUnordLessThanEqual = 189,
|
|
||||||
OpFOrdGreaterThanEqual = 190,
|
|
||||||
OpFUnordGreaterThanEqual = 191,
|
|
||||||
OpShiftRightLogical = 194,
|
|
||||||
OpShiftRightArithmetic = 195,
|
|
||||||
OpShiftLeftLogical = 196,
|
|
||||||
OpBitwiseOr = 197,
|
|
||||||
OpBitwiseXor = 198,
|
|
||||||
OpBitwiseAnd = 199,
|
|
||||||
OpNot = 200,
|
|
||||||
OpBitFieldInsert = 201,
|
|
||||||
OpBitFieldSExtract = 202,
|
|
||||||
OpBitFieldUExtract = 203,
|
|
||||||
OpBitReverse = 204,
|
|
||||||
OpBitCount = 205,
|
|
||||||
OpDPdx = 207,
|
|
||||||
OpDPdy = 208,
|
|
||||||
OpFwidth = 209,
|
|
||||||
OpDPdxFine = 210,
|
|
||||||
OpDPdyFine = 211,
|
|
||||||
OpFwidthFine = 212,
|
|
||||||
OpDPdxCoarse = 213,
|
|
||||||
OpDPdyCoarse = 214,
|
|
||||||
OpFwidthCoarse = 215,
|
|
||||||
OpEmitVertex = 218,
|
|
||||||
OpEndPrimitive = 219,
|
|
||||||
OpEmitStreamVertex = 220,
|
|
||||||
OpEndStreamPrimitive = 221,
|
|
||||||
OpControlBarrier = 224,
|
|
||||||
OpMemoryBarrier = 225,
|
|
||||||
OpAtomicLoad = 227,
|
|
||||||
OpAtomicStore = 228,
|
|
||||||
OpAtomicExchange = 229,
|
|
||||||
OpAtomicCompareExchange = 230,
|
|
||||||
OpAtomicCompareExchangeWeak = 231,
|
|
||||||
OpAtomicIIncrement = 232,
|
|
||||||
OpAtomicIDecrement = 233,
|
|
||||||
OpAtomicIAdd = 234,
|
|
||||||
OpAtomicISub = 235,
|
|
||||||
OpAtomicSMin = 236,
|
|
||||||
OpAtomicUMin = 237,
|
|
||||||
OpAtomicSMax = 238,
|
|
||||||
OpAtomicUMax = 239,
|
|
||||||
OpAtomicAnd = 240,
|
|
||||||
OpAtomicOr = 241,
|
|
||||||
OpAtomicXor = 242,
|
|
||||||
OpPhi = 245,
|
|
||||||
OpLoopMerge = 246,
|
|
||||||
OpSelectionMerge = 247,
|
|
||||||
OpLabel = 248,
|
|
||||||
OpBranch = 249,
|
|
||||||
OpBranchConditional = 250,
|
|
||||||
OpSwitch = 251,
|
|
||||||
OpKill = 252,
|
|
||||||
OpReturn = 253,
|
|
||||||
OpReturnValue = 254,
|
|
||||||
OpUnreachable = 255,
|
|
||||||
OpLifetimeStart = 256,
|
|
||||||
OpLifetimeStop = 257,
|
|
||||||
OpAsyncGroupCopy = 259,
|
|
||||||
OpWaitGroupEvents = 260,
|
|
||||||
OpGroupAll = 261,
|
|
||||||
OpGroupAny = 262,
|
|
||||||
OpGroupBroadcast = 263,
|
|
||||||
OpGroupIAdd = 264,
|
|
||||||
OpGroupFAdd = 265,
|
|
||||||
OpGroupFMin = 266,
|
|
||||||
OpGroupUMin = 267,
|
|
||||||
OpGroupSMin = 268,
|
|
||||||
OpGroupFMax = 269,
|
|
||||||
OpGroupUMax = 270,
|
|
||||||
OpGroupSMax = 271,
|
|
||||||
OpReadPipe = 274,
|
|
||||||
OpWritePipe = 275,
|
|
||||||
OpReservedReadPipe = 276,
|
|
||||||
OpReservedWritePipe = 277,
|
|
||||||
OpReserveReadPipePackets = 278,
|
|
||||||
OpReserveWritePipePackets = 279,
|
|
||||||
OpCommitReadPipe = 280,
|
|
||||||
OpCommitWritePipe = 281,
|
|
||||||
OpIsValidReserveId = 282,
|
|
||||||
OpGetNumPipePackets = 283,
|
|
||||||
OpGetMaxPipePackets = 284,
|
|
||||||
OpGroupReserveReadPipePackets = 285,
|
|
||||||
OpGroupReserveWritePipePackets = 286,
|
|
||||||
OpGroupCommitReadPipe = 287,
|
|
||||||
OpGroupCommitWritePipe = 288,
|
|
||||||
OpEnqueueMarker = 291,
|
|
||||||
OpEnqueueKernel = 292,
|
|
||||||
OpGetKernelNDrangeSubGroupCount = 293,
|
|
||||||
OpGetKernelNDrangeMaxSubGroupSize = 294,
|
|
||||||
OpGetKernelWorkGroupSize = 295,
|
|
||||||
OpGetKernelPreferredWorkGroupSizeMultiple = 296,
|
|
||||||
OpRetainEvent = 297,
|
|
||||||
OpReleaseEvent = 298,
|
|
||||||
OpCreateUserEvent = 299,
|
|
||||||
OpIsValidEvent = 300,
|
|
||||||
OpSetUserEventStatus = 301,
|
|
||||||
OpCaptureEventProfilingInfo = 302,
|
|
||||||
OpGetDefaultQueue = 303,
|
|
||||||
OpBuildNDRange = 304,
|
|
||||||
OpImageSparseSampleImplicitLod = 305,
|
|
||||||
OpImageSparseSampleExplicitLod = 306,
|
|
||||||
OpImageSparseSampleDrefImplicitLod = 307,
|
|
||||||
OpImageSparseSampleDrefExplicitLod = 308,
|
|
||||||
OpImageSparseSampleProjImplicitLod = 309,
|
|
||||||
OpImageSparseSampleProjExplicitLod = 310,
|
|
||||||
OpImageSparseSampleProjDrefImplicitLod = 311,
|
|
||||||
OpImageSparseSampleProjDrefExplicitLod = 312,
|
|
||||||
OpImageSparseFetch = 313,
|
|
||||||
OpImageSparseGather = 314,
|
|
||||||
OpImageSparseDrefGather = 315,
|
|
||||||
OpImageSparseTexelsResident = 316,
|
|
||||||
OpNoLine = 317,
|
|
||||||
OpAtomicFlagTestAndSet = 318,
|
|
||||||
OpAtomicFlagClear = 319,
|
|
||||||
};
|
|
||||||
|
|
||||||
// Overload operator| for mask bit combining
|
|
||||||
|
|
||||||
inline ImageOperandsMask operator|(ImageOperandsMask a, ImageOperandsMask b) { return ImageOperandsMask(unsigned(a) | unsigned(b)); }
|
|
||||||
inline FPFastMathModeMask operator|(FPFastMathModeMask a, FPFastMathModeMask b) { return FPFastMathModeMask(unsigned(a) | unsigned(b)); }
|
|
||||||
inline SelectionControlMask operator|(SelectionControlMask a, SelectionControlMask b) { return SelectionControlMask(unsigned(a) | unsigned(b)); }
|
|
||||||
inline LoopControlMask operator|(LoopControlMask a, LoopControlMask b) { return LoopControlMask(unsigned(a) | unsigned(b)); }
|
|
||||||
inline FunctionControlMask operator|(FunctionControlMask a, FunctionControlMask b) { return FunctionControlMask(unsigned(a) | unsigned(b)); }
|
|
||||||
inline MemorySemanticsMask operator|(MemorySemanticsMask a, MemorySemanticsMask b) { return MemorySemanticsMask(unsigned(a) | unsigned(b)); }
|
|
||||||
inline MemoryAccessMask operator|(MemoryAccessMask a, MemoryAccessMask b) { return MemoryAccessMask(unsigned(a) | unsigned(b)); }
|
|
||||||
inline KernelProfilingInfoMask operator|(KernelProfilingInfoMask a, KernelProfilingInfoMask b) { return KernelProfilingInfoMask(unsigned(a) | unsigned(b)); }
|
|
||||||
|
|
||||||
} // end namespace spv
|
|
||||||
|
|
||||||
#endif // #ifndef spirv_H
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
|||||||
#ifndef LIBSPIRV_LIBSPIRV_LIBSPIRV_H_
|
#ifndef LIBSPIRV_LIBSPIRV_LIBSPIRV_H_
|
||||||
#define LIBSPIRV_LIBSPIRV_LIBSPIRV_H_
|
#define LIBSPIRV_LIBSPIRV_LIBSPIRV_H_
|
||||||
|
|
||||||
#include <headers/spirv.hpp>
|
#include <headers/spirv.h>
|
||||||
#include <headers/spirv_operands.hpp>
|
#include <headers/spirv_operands.hpp>
|
||||||
#include <headers/GLSL.std.450.h>
|
#include <headers/GLSL.std.450.h>
|
||||||
#include <headers/OpenCL.std.h>
|
#include <headers/OpenCL.std.h>
|
||||||
@ -296,7 +296,7 @@ typedef struct spv_header_t {
|
|||||||
|
|
||||||
typedef struct spv_opcode_desc_t {
|
typedef struct spv_opcode_desc_t {
|
||||||
const char *name;
|
const char *name;
|
||||||
const Op opcode;
|
const SpvOp opcode;
|
||||||
const spv_capability_mask_t
|
const spv_capability_mask_t
|
||||||
capabilities; // Bitfield of SPV_CAPABILITY_AS_MASK(spv::Capability)
|
capabilities; // Bitfield of SPV_CAPABILITY_AS_MASK(spv::Capability)
|
||||||
// operandTypes[0..numTypes-1] describe logical operands for the instruction.
|
// operandTypes[0..numTypes-1] describe logical operands for the instruction.
|
||||||
|
@ -95,7 +95,7 @@ spv_result_t AssemblyGrammar::lookupOpcode(const char *name,
|
|||||||
return spvOpcodeTableNameLookup(opcodeTable_, name, desc);
|
return spvOpcodeTableNameLookup(opcodeTable_, name, desc);
|
||||||
}
|
}
|
||||||
|
|
||||||
spv_result_t AssemblyGrammar::lookupOpcode(Op opcode,
|
spv_result_t AssemblyGrammar::lookupOpcode(SpvOp opcode,
|
||||||
spv_opcode_desc *desc) const {
|
spv_opcode_desc *desc) const {
|
||||||
return spvOpcodeTableValueLookup(opcodeTable_, opcode, desc);
|
return spvOpcodeTableValueLookup(opcodeTable_, opcode, desc);
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,7 @@ class AssemblyGrammar {
|
|||||||
// Fills in the desc parameter with the information about the opcode
|
// Fills in the desc parameter with the information about the opcode
|
||||||
// of the valid. Returns SPV_SUCCESS if the opcode was found, and
|
// of the valid. Returns SPV_SUCCESS if the opcode was found, and
|
||||||
// SPV_ERROR_INVALID_LOOKUP if the opcode does not exist.
|
// SPV_ERROR_INVALID_LOOKUP if the opcode does not exist.
|
||||||
spv_result_t lookupOpcode(Op opcode, spv_opcode_desc *desc) const;
|
spv_result_t lookupOpcode(SpvOp opcode, spv_opcode_desc *desc) const;
|
||||||
|
|
||||||
// Fills in the desc parameter with the information about the given
|
// Fills in the desc parameter with the information about the given
|
||||||
// operand. Returns SPV_SUCCESS if the operand was found, and
|
// operand. Returns SPV_SUCCESS if the operand was found, and
|
||||||
|
@ -88,7 +88,7 @@ spv_operand_type_t spvBinaryOperandInfo(const uint32_t word,
|
|||||||
// NOTE: Use specified operand entry operand type for this word
|
// NOTE: Use specified operand entry operand type for this word
|
||||||
uint16_t index = operandIndex - opcodeEntry->numTypes;
|
uint16_t index = operandIndex - opcodeEntry->numTypes;
|
||||||
type = (*pOperandEntry)->operandTypes[index];
|
type = (*pOperandEntry)->operandTypes[index];
|
||||||
} else if (OpSwitch == opcodeEntry->opcode) {
|
} else if (SpvOpSwitch == opcodeEntry->opcode) {
|
||||||
// NOTE: OpSwitch is a special case which expects a list of paired extra
|
// NOTE: OpSwitch is a special case which expects a list of paired extra
|
||||||
// operands
|
// operands
|
||||||
assert(0 &&
|
assert(0 &&
|
||||||
@ -120,7 +120,7 @@ spv_operand_type_t spvBinaryOperandInfo(const uint32_t word,
|
|||||||
///
|
///
|
||||||
/// @return result code
|
/// @return result code
|
||||||
spv_result_t spvBinaryDecodeOperand(
|
spv_result_t spvBinaryDecodeOperand(
|
||||||
const Op opcode, const spv_operand_type_t type, const uint32_t *words,
|
const SpvOp opcode, const spv_operand_type_t type, const uint32_t *words,
|
||||||
uint16_t numWords, const spv_endianness_t endian, const uint32_t options,
|
uint16_t numWords, const spv_endianness_t endian, const uint32_t options,
|
||||||
const libspirv::AssemblyGrammar& grammar,
|
const libspirv::AssemblyGrammar& grammar,
|
||||||
spv_operand_pattern_t *pExpectedOperands, spv_ext_inst_type_t *pExtInstType,
|
spv_operand_pattern_t *pExpectedOperands, spv_ext_inst_type_t *pExtInstType,
|
||||||
@ -152,7 +152,7 @@ spv_result_t spvBinaryDecodeOperand(
|
|||||||
position->index++;
|
position->index++;
|
||||||
} break;
|
} break;
|
||||||
case SPV_OPERAND_TYPE_EXTENSION_INSTRUCTION_NUMBER: {
|
case SPV_OPERAND_TYPE_EXTENSION_INSTRUCTION_NUMBER: {
|
||||||
if (OpExtInst == opcode) {
|
if (SpvOpExtInst == opcode) {
|
||||||
spv_ext_inst_desc extInst;
|
spv_ext_inst_desc extInst;
|
||||||
if (grammar.lookupExtInst(*pExtInstType, words[0], &extInst)) {
|
if (grammar.lookupExtInst(*pExtInstType, words[0], &extInst)) {
|
||||||
DIAGNOSTIC << "Invalid extended instruction '" << words[0] << "'.";
|
DIAGNOSTIC << "Invalid extended instruction '" << words[0] << "'.";
|
||||||
@ -194,7 +194,7 @@ spv_result_t spvBinaryDecodeOperand(
|
|||||||
uint64_t stringOperandCount = (strlen(string) / 4) + 1;
|
uint64_t stringOperandCount = (strlen(string) / 4) + 1;
|
||||||
|
|
||||||
// NOTE: Special case for extended instruction import
|
// NOTE: Special case for extended instruction import
|
||||||
if (OpExtInstImport == opcode) {
|
if (SpvOpExtInstImport == opcode) {
|
||||||
*pExtInstType = spvExtInstImportTypeGet(string);
|
*pExtInstType = spvExtInstImportTypeGet(string);
|
||||||
if (SPV_EXT_INST_TYPE_NONE == *pExtInstType) {
|
if (SPV_EXT_INST_TYPE_NONE == *pExtInstType) {
|
||||||
DIAGNOSTIC << "Invalid extended instruction import'" << string
|
DIAGNOSTIC << "Invalid extended instruction import'" << string
|
||||||
@ -327,11 +327,11 @@ spv_result_t spvRegisterIdForOpcode(const spv_instruction_t* pInst,
|
|||||||
spv_diagnostic* pDiagnostic) {
|
spv_diagnostic* pDiagnostic) {
|
||||||
libspirv::IdType detected_type = libspirv::kUnknownType;
|
libspirv::IdType detected_type = libspirv::kUnknownType;
|
||||||
if (spvOpcodeIsType(pOpcodeEntry->opcode)) {
|
if (spvOpcodeIsType(pOpcodeEntry->opcode)) {
|
||||||
if (spv::OpTypeInt == pOpcodeEntry->opcode) {
|
if (SpvOpTypeInt == pOpcodeEntry->opcode) {
|
||||||
detected_type.type_class = libspirv::IdTypeClass::kScalarIntegerType;
|
detected_type.type_class = libspirv::IdTypeClass::kScalarIntegerType;
|
||||||
detected_type.bitwidth = pInst->words[2];
|
detected_type.bitwidth = pInst->words[2];
|
||||||
detected_type.isSigned = (pInst->words[3] != 0);
|
detected_type.isSigned = (pInst->words[3] != 0);
|
||||||
} else if (spv::OpTypeFloat == pOpcodeEntry->opcode) {
|
} else if (SpvOpTypeFloat == pOpcodeEntry->opcode) {
|
||||||
detected_type.type_class = libspirv::IdTypeClass::kScalarIntegerType;
|
detected_type.type_class = libspirv::IdTypeClass::kScalarIntegerType;
|
||||||
detected_type.bitwidth = pInst->words[2];
|
detected_type.bitwidth = pInst->words[2];
|
||||||
detected_type.isSigned = true;
|
detected_type.isSigned = true;
|
||||||
@ -389,7 +389,7 @@ spv_result_t spvBinaryDecodeOpcode(spv_instruction_t* pInst,
|
|||||||
spv_position_t instructionStart = *position;
|
spv_position_t instructionStart = *position;
|
||||||
|
|
||||||
uint16_t wordCount;
|
uint16_t wordCount;
|
||||||
Op opcode;
|
SpvOp opcode;
|
||||||
spvOpcodeSplit(spvFixWord(pInst->words[0], endian), &wordCount, &opcode);
|
spvOpcodeSplit(spvFixWord(pInst->words[0], endian), &wordCount, &opcode);
|
||||||
|
|
||||||
spv_opcode_desc opcodeEntry;
|
spv_opcode_desc opcodeEntry;
|
||||||
@ -585,7 +585,7 @@ spv_result_t spvBinaryToTextWithFormat(
|
|||||||
while (position.index < binary.wordCount) {
|
while (position.index < binary.wordCount) {
|
||||||
uint64_t index = position.index;
|
uint64_t index = position.index;
|
||||||
uint16_t wordCount;
|
uint16_t wordCount;
|
||||||
Op opcode;
|
SpvOp opcode;
|
||||||
spvOpcodeSplit(spvFixWord(words[position.index], endian), &wordCount,
|
spvOpcodeSplit(spvFixWord(words[position.index], endian), &wordCount,
|
||||||
&opcode);
|
&opcode);
|
||||||
|
|
||||||
|
@ -30,14 +30,14 @@
|
|||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <headers/spirv.hpp>
|
#include <headers/spirv.h>
|
||||||
|
|
||||||
// Describes an instruction.
|
// Describes an instruction.
|
||||||
struct spv_instruction_t {
|
struct spv_instruction_t {
|
||||||
// Normally, both opcode and extInstType contain valid data.
|
// Normally, both opcode and extInstType contain valid data.
|
||||||
// However, when the assembler parses !<number> as the first word in
|
// However, when the assembler parses !<number> as the first word in
|
||||||
// an instruction and opcode and extInstType are invalid.
|
// an instruction and opcode and extInstType are invalid.
|
||||||
Op opcode;
|
SpvOp opcode;
|
||||||
spv_ext_inst_type_t extInstType;
|
spv_ext_inst_type_t extInstType;
|
||||||
|
|
||||||
// The Id of the result type, if this instruction has one. Zero otherwise.
|
// The Id of the result type, if this instruction has one. Zero otherwise.
|
||||||
|
@ -46,12 +46,12 @@ namespace {
|
|||||||
spv_opcode_desc_t opcodeTableEntries[] = {
|
spv_opcode_desc_t opcodeTableEntries[] = {
|
||||||
#define EmptyList {}
|
#define EmptyList {}
|
||||||
#define List(...) {__VA_ARGS__}
|
#define List(...) {__VA_ARGS__}
|
||||||
#define Capability(X) SPV_CAPABILITY_AS_MASK(Capability##X)
|
#define Capability(X) SPV_CAPABILITY_AS_MASK(SpvCapability##X)
|
||||||
#define Capability2(X,Y) Capability(X)|Capability(Y)
|
#define Capability2(X,Y) Capability(X)|Capability(Y)
|
||||||
#define CapabilityNone 0 // Needed so Capability(None) still expands to valid syntax.
|
#define SpvCapabilityNone 0 // Needed so Capability(None) still expands to valid syntax.
|
||||||
#define Instruction(Name,HasResult,HasType,NumLogicalOperands,NumCapabilities,CapabilityRequired,IsVariable,LogicalArgsList) \
|
#define Instruction(Name,HasResult,HasType,NumLogicalOperands,NumCapabilities,CapabilityRequired,IsVariable,LogicalArgsList) \
|
||||||
{ #Name, \
|
{ #Name, \
|
||||||
Op##Name, \
|
SpvOp##Name, \
|
||||||
(NumCapabilities) ? (CapabilityRequired) : 0, \
|
(NumCapabilities) ? (CapabilityRequired) : 0, \
|
||||||
0, {}, /* Filled in later. Operand list, including result id and type id, if needed */ \
|
0, {}, /* Filled in later. Operand list, including result id and type id, if needed */ \
|
||||||
HasResult, \
|
HasResult, \
|
||||||
@ -75,27 +75,27 @@ bool opcodeTableInitialized = false;
|
|||||||
// Converts the given operand class enum (from the SPIR-V document generation
|
// Converts the given operand class enum (from the SPIR-V document generation
|
||||||
// logic) to the operand type required by the parser.
|
// logic) to the operand type required by the parser.
|
||||||
// This only applies to logical operands.
|
// This only applies to logical operands.
|
||||||
spv_operand_type_t convertOperandClassToType(spv::Op opcode,
|
spv_operand_type_t convertOperandClassToType(SpvOp opcode,
|
||||||
spv::OperandClass operandClass) {
|
OperandClass operandClass) {
|
||||||
// The spec document generator uses OptionalOperandLiteral for several kinds
|
// The spec document generator uses OptionalOperandLiteral for several kinds
|
||||||
// of repeating values. Our parser needs more specific information about
|
// of repeating values. Our parser needs more specific information about
|
||||||
// what is being repeated.
|
// what is being repeated.
|
||||||
if (operandClass == OperandOptionalLiteral) {
|
if (operandClass == OperandOptionalLiteral) {
|
||||||
switch (opcode) {
|
switch (opcode) {
|
||||||
case spv::OpLoad:
|
case SpvOpLoad:
|
||||||
case spv::OpStore:
|
case SpvOpStore:
|
||||||
case spv::OpCopyMemory:
|
case SpvOpCopyMemory:
|
||||||
case spv::OpCopyMemorySized:
|
case SpvOpCopyMemorySized:
|
||||||
// Expect an optional mask. When the Aligned bit is set in the mask,
|
// Expect an optional mask. When the Aligned bit is set in the mask,
|
||||||
// we will later add the expectation of a literal number operand.
|
// we will later add the expectation of a literal number operand.
|
||||||
return SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS;
|
return SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS;
|
||||||
case spv::OpExecutionMode:
|
case SpvOpExecutionMode:
|
||||||
return SPV_OPERAND_TYPE_VARIABLE_EXECUTION_MODE;
|
return SPV_OPERAND_TYPE_VARIABLE_EXECUTION_MODE;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (operandClass == OperandVariableLiterals) {
|
} else if (operandClass == OperandVariableLiterals) {
|
||||||
if (opcode == spv::OpConstant || opcode == spv::OpSpecConstant)
|
if (opcode == SpvOpConstant || opcode == SpvOpSpecConstant)
|
||||||
return SPV_OPERAND_TYPE_MULTIWORD_LITERAL_NUMBER;
|
return SPV_OPERAND_TYPE_MULTIWORD_LITERAL_NUMBER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ spv_operand_type_t convertOperandClassToType(spv::Op opcode,
|
|||||||
// This is only used for sequences of literal numbers.
|
// This is only used for sequences of literal numbers.
|
||||||
case OperandVariableLiterals: return SPV_OPERAND_TYPE_VARIABLE_LITERAL_INTEGER;
|
case OperandVariableLiterals: return SPV_OPERAND_TYPE_VARIABLE_LITERAL_INTEGER;
|
||||||
case OperandLiteralNumber:
|
case OperandLiteralNumber:
|
||||||
if (opcode == spv::OpExtInst) {
|
if (opcode == SpvOpExtInst) {
|
||||||
// We use a special operand type for the extension instruction number.
|
// We use a special operand type for the extension instruction number.
|
||||||
// For now, we assume there is only one LiteraNumber argument to OpExtInst,
|
// For now, we assume there is only one LiteraNumber argument to OpExtInst,
|
||||||
// and it is the extension instruction argument.
|
// and it is the extension instruction argument.
|
||||||
@ -242,16 +242,16 @@ const char *spvGeneratorStr(uint32_t generator) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t spvOpcodeMake(uint16_t wordCount, Op opcode) {
|
uint32_t spvOpcodeMake(uint16_t wordCount, SpvOp opcode) {
|
||||||
return ((uint32_t)opcode) | (((uint32_t)wordCount) << 16);
|
return ((uint32_t)opcode) | (((uint32_t)wordCount) << 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
void spvOpcodeSplit(const uint32_t word, uint16_t *pWordCount, Op *pOpcode) {
|
void spvOpcodeSplit(const uint32_t word, uint16_t *pWordCount, SpvOp *pOpcode) {
|
||||||
if (pWordCount) {
|
if (pWordCount) {
|
||||||
*pWordCount = (uint16_t)((0xffff0000 & word) >> 16);
|
*pWordCount = (uint16_t)((0xffff0000 & word) >> 16);
|
||||||
}
|
}
|
||||||
if (pOpcode) {
|
if (pOpcode) {
|
||||||
*pOpcode = (Op)(0x0000ffff & word);
|
*pOpcode = (SpvOp)(0x0000ffff & word);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,7 +295,7 @@ spv_result_t spvOpcodeTableNameLookup(const spv_opcode_table table,
|
|||||||
}
|
}
|
||||||
|
|
||||||
spv_result_t spvOpcodeTableValueLookup(const spv_opcode_table table,
|
spv_result_t spvOpcodeTableValueLookup(const spv_opcode_table table,
|
||||||
const Op opcode,
|
const SpvOp opcode,
|
||||||
spv_opcode_desc *pEntry) {
|
spv_opcode_desc *pEntry) {
|
||||||
if (!table) return SPV_ERROR_INVALID_TABLE;
|
if (!table) return SPV_ERROR_INVALID_TABLE;
|
||||||
if (!pEntry) return SPV_ERROR_INVALID_POINTER;
|
if (!pEntry) return SPV_ERROR_INVALID_POINTER;
|
||||||
@ -323,7 +323,7 @@ int32_t spvOpcodeRequiresCapabilities(spv_opcode_desc entry) {
|
|||||||
return entry->capabilities != 0;
|
return entry->capabilities != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void spvInstructionCopy(const uint32_t *words, const Op opcode,
|
void spvInstructionCopy(const uint32_t *words, const SpvOp opcode,
|
||||||
const uint16_t wordCount, const spv_endianness_t endian,
|
const uint16_t wordCount, const spv_endianness_t endian,
|
||||||
spv_instruction_t *pInst) {
|
spv_instruction_t *pInst) {
|
||||||
pInst->opcode = opcode;
|
pInst->opcode = opcode;
|
||||||
@ -332,7 +332,7 @@ void spvInstructionCopy(const uint32_t *words, const Op opcode,
|
|||||||
pInst->words[wordIndex] = spvFixWord(words[wordIndex], endian);
|
pInst->words[wordIndex] = spvFixWord(words[wordIndex], endian);
|
||||||
if (!wordIndex) {
|
if (!wordIndex) {
|
||||||
uint16_t thisWordCount;
|
uint16_t thisWordCount;
|
||||||
Op thisOpcode;
|
SpvOp thisOpcode;
|
||||||
spvOpcodeSplit(pInst->words[wordIndex], &thisWordCount, &thisOpcode);
|
spvOpcodeSplit(pInst->words[wordIndex], &thisWordCount, &thisOpcode);
|
||||||
assert(opcode == thisOpcode && wordCount == thisWordCount &&
|
assert(opcode == thisOpcode && wordCount == thisWordCount &&
|
||||||
"Endianness failed!");
|
"Endianness failed!");
|
||||||
@ -340,9 +340,9 @@ void spvInstructionCopy(const uint32_t *words, const Op opcode,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *spvOpcodeString(const Op opcode) {
|
const char *spvOpcodeString(const SpvOp opcode) {
|
||||||
#define CASE(OPCODE) \
|
#define CASE(OPCODE) \
|
||||||
case OPCODE: \
|
case Spv##OPCODE: \
|
||||||
return #OPCODE;
|
return #OPCODE;
|
||||||
switch (opcode) {
|
switch (opcode) {
|
||||||
CASE(OpNop)
|
CASE(OpNop)
|
||||||
@ -582,69 +582,69 @@ const char *spvOpcodeString(const Op opcode) {
|
|||||||
return "unknown";
|
return "unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t spvOpcodeIsType(const Op opcode) {
|
int32_t spvOpcodeIsType(const SpvOp opcode) {
|
||||||
switch (opcode) {
|
switch (opcode) {
|
||||||
case OpTypeVoid:
|
case SpvOpTypeVoid:
|
||||||
case OpTypeBool:
|
case SpvOpTypeBool:
|
||||||
case OpTypeInt:
|
case SpvOpTypeInt:
|
||||||
case OpTypeFloat:
|
case SpvOpTypeFloat:
|
||||||
case OpTypeVector:
|
case SpvOpTypeVector:
|
||||||
case OpTypeMatrix:
|
case SpvOpTypeMatrix:
|
||||||
case OpTypeSampler:
|
case SpvOpTypeSampler:
|
||||||
case OpTypeSampledImage:
|
case SpvOpTypeSampledImage:
|
||||||
case OpTypeArray:
|
case SpvOpTypeArray:
|
||||||
case OpTypeRuntimeArray:
|
case SpvOpTypeRuntimeArray:
|
||||||
case OpTypeStruct:
|
case SpvOpTypeStruct:
|
||||||
case OpTypeOpaque:
|
case SpvOpTypeOpaque:
|
||||||
case OpTypePointer:
|
case SpvOpTypePointer:
|
||||||
case OpTypeFunction:
|
case SpvOpTypeFunction:
|
||||||
case OpTypeEvent:
|
case SpvOpTypeEvent:
|
||||||
case OpTypeDeviceEvent:
|
case SpvOpTypeDeviceEvent:
|
||||||
case OpTypeReserveId:
|
case SpvOpTypeReserveId:
|
||||||
case OpTypeQueue:
|
case SpvOpTypeQueue:
|
||||||
case OpTypePipe:
|
case SpvOpTypePipe:
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t spvOpcodeIsScalarType(const Op opcode) {
|
int32_t spvOpcodeIsScalarType(const SpvOp opcode) {
|
||||||
switch (opcode) {
|
switch (opcode) {
|
||||||
case OpTypeInt:
|
case SpvOpTypeInt:
|
||||||
case OpTypeFloat:
|
case SpvOpTypeFloat:
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t spvOpcodeIsConstant(const Op opcode) {
|
int32_t spvOpcodeIsConstant(const SpvOp opcode) {
|
||||||
switch (opcode) {
|
switch (opcode) {
|
||||||
case OpConstantTrue:
|
case SpvOpConstantTrue:
|
||||||
case OpConstantFalse:
|
case SpvOpConstantFalse:
|
||||||
case OpConstant:
|
case SpvOpConstant:
|
||||||
case OpConstantComposite:
|
case SpvOpConstantComposite:
|
||||||
case OpConstantSampler:
|
case SpvOpConstantSampler:
|
||||||
// case OpConstantNull:
|
// case SpvOpConstantNull:
|
||||||
case OpConstantNull:
|
case SpvOpConstantNull:
|
||||||
case OpSpecConstantTrue:
|
case SpvOpSpecConstantTrue:
|
||||||
case OpSpecConstantFalse:
|
case SpvOpSpecConstantFalse:
|
||||||
case OpSpecConstant:
|
case SpvOpSpecConstant:
|
||||||
case OpSpecConstantComposite:
|
case SpvOpSpecConstantComposite:
|
||||||
// case OpSpecConstantOp:
|
// case SpvOpSpecConstantOp:
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t spvOpcodeIsComposite(const Op opcode) {
|
int32_t spvOpcodeIsComposite(const SpvOp opcode) {
|
||||||
switch (opcode) {
|
switch (opcode) {
|
||||||
case OpTypeVector:
|
case SpvOpTypeVector:
|
||||||
case OpTypeMatrix:
|
case SpvOpTypeMatrix:
|
||||||
case OpTypeArray:
|
case SpvOpTypeArray:
|
||||||
case OpTypeStruct:
|
case SpvOpTypeStruct:
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
@ -658,143 +658,143 @@ int32_t spvOpcodeAreTypesEqual(const spv_instruction_t *pTypeInst0,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t spvOpcodeIsPointer(const Op opcode) {
|
int32_t spvOpcodeIsPointer(const SpvOp opcode) {
|
||||||
switch (opcode) {
|
switch (opcode) {
|
||||||
case OpVariable:
|
case SpvOpVariable:
|
||||||
case OpAccessChain:
|
case SpvOpAccessChain:
|
||||||
case OpInBoundsAccessChain:
|
case SpvOpInBoundsAccessChain:
|
||||||
case OpFunctionParameter:
|
case SpvOpFunctionParameter:
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t spvOpcodeIsObject(const Op opcode) {
|
int32_t spvOpcodeIsObject(const SpvOp opcode) {
|
||||||
switch (opcode) {
|
switch (opcode) {
|
||||||
case OpConstantTrue:
|
case SpvOpConstantTrue:
|
||||||
case OpConstantFalse:
|
case SpvOpConstantFalse:
|
||||||
case OpConstant:
|
case SpvOpConstant:
|
||||||
case OpConstantComposite:
|
case SpvOpConstantComposite:
|
||||||
// TODO: case OpConstantSampler:
|
// TODO: case SpvOpConstantSampler:
|
||||||
case OpConstantNull:
|
case SpvOpConstantNull:
|
||||||
case OpSpecConstantTrue:
|
case SpvOpSpecConstantTrue:
|
||||||
case OpSpecConstantFalse:
|
case SpvOpSpecConstantFalse:
|
||||||
case OpSpecConstant:
|
case SpvOpSpecConstant:
|
||||||
case OpSpecConstantComposite:
|
case SpvOpSpecConstantComposite:
|
||||||
// TODO: case OpSpecConstantOp:
|
// TODO: case SpvOpSpecConstantOp:
|
||||||
case OpVariable:
|
case SpvOpVariable:
|
||||||
case OpAccessChain:
|
case SpvOpAccessChain:
|
||||||
case OpInBoundsAccessChain:
|
case SpvOpInBoundsAccessChain:
|
||||||
case OpConvertFToU:
|
case SpvOpConvertFToU:
|
||||||
case OpConvertFToS:
|
case SpvOpConvertFToS:
|
||||||
case OpConvertSToF:
|
case SpvOpConvertSToF:
|
||||||
case OpConvertUToF:
|
case SpvOpConvertUToF:
|
||||||
case OpUConvert:
|
case SpvOpUConvert:
|
||||||
case OpSConvert:
|
case SpvOpSConvert:
|
||||||
case OpFConvert:
|
case SpvOpFConvert:
|
||||||
case OpConvertPtrToU:
|
case SpvOpConvertPtrToU:
|
||||||
// TODO: case OpConvertUToPtr:
|
// TODO: case SpvOpConvertUToPtr:
|
||||||
case OpPtrCastToGeneric:
|
case SpvOpPtrCastToGeneric:
|
||||||
// TODO: case OpGenericCastToPtr:
|
// TODO: case SpvOpGenericCastToPtr:
|
||||||
case OpBitcast:
|
case SpvOpBitcast:
|
||||||
// TODO: case OpGenericCastToPtrExplicit:
|
// TODO: case SpvOpGenericCastToPtrExplicit:
|
||||||
case OpSatConvertSToU:
|
case SpvOpSatConvertSToU:
|
||||||
case OpSatConvertUToS:
|
case SpvOpSatConvertUToS:
|
||||||
case OpVectorExtractDynamic:
|
case SpvOpVectorExtractDynamic:
|
||||||
case OpCompositeConstruct:
|
case SpvOpCompositeConstruct:
|
||||||
case OpCompositeExtract:
|
case SpvOpCompositeExtract:
|
||||||
case OpCopyObject:
|
case SpvOpCopyObject:
|
||||||
case OpTranspose:
|
case SpvOpTranspose:
|
||||||
case OpSNegate:
|
case SpvOpSNegate:
|
||||||
case OpFNegate:
|
case SpvOpFNegate:
|
||||||
case OpNot:
|
case SpvOpNot:
|
||||||
case OpIAdd:
|
case SpvOpIAdd:
|
||||||
case OpFAdd:
|
case SpvOpFAdd:
|
||||||
case OpISub:
|
case SpvOpISub:
|
||||||
case OpFSub:
|
case SpvOpFSub:
|
||||||
case OpIMul:
|
case SpvOpIMul:
|
||||||
case OpFMul:
|
case SpvOpFMul:
|
||||||
case OpUDiv:
|
case SpvOpUDiv:
|
||||||
case OpSDiv:
|
case SpvOpSDiv:
|
||||||
case OpFDiv:
|
case SpvOpFDiv:
|
||||||
case OpUMod:
|
case SpvOpUMod:
|
||||||
case OpSRem:
|
case SpvOpSRem:
|
||||||
case OpSMod:
|
case SpvOpSMod:
|
||||||
case OpVectorTimesScalar:
|
case SpvOpVectorTimesScalar:
|
||||||
case OpMatrixTimesScalar:
|
case SpvOpMatrixTimesScalar:
|
||||||
case OpVectorTimesMatrix:
|
case SpvOpVectorTimesMatrix:
|
||||||
case OpMatrixTimesVector:
|
case SpvOpMatrixTimesVector:
|
||||||
case OpMatrixTimesMatrix:
|
case SpvOpMatrixTimesMatrix:
|
||||||
case OpOuterProduct:
|
case SpvOpOuterProduct:
|
||||||
case OpDot:
|
case SpvOpDot:
|
||||||
case OpShiftRightLogical:
|
case SpvOpShiftRightLogical:
|
||||||
case OpShiftRightArithmetic:
|
case SpvOpShiftRightArithmetic:
|
||||||
case OpShiftLeftLogical:
|
case SpvOpShiftLeftLogical:
|
||||||
case OpBitwiseOr:
|
case SpvOpBitwiseOr:
|
||||||
case OpBitwiseXor:
|
case SpvOpBitwiseXor:
|
||||||
case OpBitwiseAnd:
|
case SpvOpBitwiseAnd:
|
||||||
case OpAny:
|
case SpvOpAny:
|
||||||
case OpAll:
|
case SpvOpAll:
|
||||||
case OpIsNan:
|
case SpvOpIsNan:
|
||||||
case OpIsInf:
|
case SpvOpIsInf:
|
||||||
case OpIsFinite:
|
case SpvOpIsFinite:
|
||||||
case OpIsNormal:
|
case SpvOpIsNormal:
|
||||||
case OpSignBitSet:
|
case SpvOpSignBitSet:
|
||||||
case OpLessOrGreater:
|
case SpvOpLessOrGreater:
|
||||||
case OpOrdered:
|
case SpvOpOrdered:
|
||||||
case OpUnordered:
|
case SpvOpUnordered:
|
||||||
case OpLogicalOr:
|
case SpvOpLogicalOr:
|
||||||
case OpLogicalAnd:
|
case SpvOpLogicalAnd:
|
||||||
case OpSelect:
|
case SpvOpSelect:
|
||||||
case OpIEqual:
|
case SpvOpIEqual:
|
||||||
case OpFOrdEqual:
|
case SpvOpFOrdEqual:
|
||||||
case OpFUnordEqual:
|
case SpvOpFUnordEqual:
|
||||||
case OpINotEqual:
|
case SpvOpINotEqual:
|
||||||
case OpFOrdNotEqual:
|
case SpvOpFOrdNotEqual:
|
||||||
case OpFUnordNotEqual:
|
case SpvOpFUnordNotEqual:
|
||||||
case OpULessThan:
|
case SpvOpULessThan:
|
||||||
case OpSLessThan:
|
case SpvOpSLessThan:
|
||||||
case OpFOrdLessThan:
|
case SpvOpFOrdLessThan:
|
||||||
case OpFUnordLessThan:
|
case SpvOpFUnordLessThan:
|
||||||
case OpUGreaterThan:
|
case SpvOpUGreaterThan:
|
||||||
case OpSGreaterThan:
|
case SpvOpSGreaterThan:
|
||||||
case OpFOrdGreaterThan:
|
case SpvOpFOrdGreaterThan:
|
||||||
case OpFUnordGreaterThan:
|
case SpvOpFUnordGreaterThan:
|
||||||
case OpULessThanEqual:
|
case SpvOpULessThanEqual:
|
||||||
case OpSLessThanEqual:
|
case SpvOpSLessThanEqual:
|
||||||
case OpFOrdLessThanEqual:
|
case SpvOpFOrdLessThanEqual:
|
||||||
case OpFUnordLessThanEqual:
|
case SpvOpFUnordLessThanEqual:
|
||||||
case OpUGreaterThanEqual:
|
case SpvOpUGreaterThanEqual:
|
||||||
case OpSGreaterThanEqual:
|
case SpvOpSGreaterThanEqual:
|
||||||
case OpFOrdGreaterThanEqual:
|
case SpvOpFOrdGreaterThanEqual:
|
||||||
case OpFUnordGreaterThanEqual:
|
case SpvOpFUnordGreaterThanEqual:
|
||||||
case OpDPdx:
|
case SpvOpDPdx:
|
||||||
case OpDPdy:
|
case SpvOpDPdy:
|
||||||
case OpFwidth:
|
case SpvOpFwidth:
|
||||||
case OpDPdxFine:
|
case SpvOpDPdxFine:
|
||||||
case OpDPdyFine:
|
case SpvOpDPdyFine:
|
||||||
case OpFwidthFine:
|
case SpvOpFwidthFine:
|
||||||
case OpDPdxCoarse:
|
case SpvOpDPdxCoarse:
|
||||||
case OpDPdyCoarse:
|
case SpvOpDPdyCoarse:
|
||||||
case OpFwidthCoarse:
|
case SpvOpFwidthCoarse:
|
||||||
case OpReturnValue:
|
case SpvOpReturnValue:
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t spvOpcodeIsBasicTypeNullable(Op opcode) {
|
int32_t spvOpcodeIsBasicTypeNullable(SpvOp opcode) {
|
||||||
switch (opcode) {
|
switch (opcode) {
|
||||||
case OpTypeBool:
|
case SpvOpTypeBool:
|
||||||
case OpTypeInt:
|
case SpvOpTypeInt:
|
||||||
case OpTypeFloat:
|
case SpvOpTypeFloat:
|
||||||
case OpTypePointer:
|
case SpvOpTypePointer:
|
||||||
case OpTypeEvent:
|
case SpvOpTypeEvent:
|
||||||
case OpTypeDeviceEvent:
|
case SpvOpTypeDeviceEvent:
|
||||||
case OpTypeReserveId:
|
case SpvOpTypeReserveId:
|
||||||
case OpTypeQueue:
|
case SpvOpTypeQueue:
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
@ -804,18 +804,18 @@ int32_t spvOpcodeIsBasicTypeNullable(Op opcode) {
|
|||||||
int32_t spvInstructionIsInBasicBlock(const spv_instruction_t *pFirstInst,
|
int32_t spvInstructionIsInBasicBlock(const spv_instruction_t *pFirstInst,
|
||||||
const spv_instruction_t *pInst) {
|
const spv_instruction_t *pInst) {
|
||||||
while (pFirstInst != pInst) {
|
while (pFirstInst != pInst) {
|
||||||
if (OpFunction == pInst->opcode) break;
|
if (SpvOpFunction == pInst->opcode) break;
|
||||||
pInst--;
|
pInst--;
|
||||||
}
|
}
|
||||||
if (OpFunction != pInst->opcode) return false;
|
if (SpvOpFunction != pInst->opcode) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t spvOpcodeIsValue(Op opcode) {
|
int32_t spvOpcodeIsValue(SpvOp opcode) {
|
||||||
if (spvOpcodeIsPointer(opcode)) return true;
|
if (spvOpcodeIsPointer(opcode)) return true;
|
||||||
if (spvOpcodeIsConstant(opcode)) return true;
|
if (spvOpcodeIsConstant(opcode)) return true;
|
||||||
switch (opcode) {
|
switch (opcode) {
|
||||||
case OpLoad:
|
case SpvOpLoad:
|
||||||
// TODO: Other Opcode's resulting in a value
|
// TODO: Other Opcode's resulting in a value
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
@ -823,29 +823,29 @@ int32_t spvOpcodeIsValue(Op opcode) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t spvOpcodeGeneratesType(Op op) {
|
int32_t spvOpcodeGeneratesType(SpvOp op) {
|
||||||
switch(op) {
|
switch(op) {
|
||||||
case OpTypeVoid:
|
case SpvOpTypeVoid:
|
||||||
case OpTypeBool:
|
case SpvOpTypeBool:
|
||||||
case OpTypeInt:
|
case SpvOpTypeInt:
|
||||||
case OpTypeFloat:
|
case SpvOpTypeFloat:
|
||||||
case OpTypeVector:
|
case SpvOpTypeVector:
|
||||||
case OpTypeMatrix:
|
case SpvOpTypeMatrix:
|
||||||
case OpTypeImage:
|
case SpvOpTypeImage:
|
||||||
case OpTypeSampler:
|
case SpvOpTypeSampler:
|
||||||
case OpTypeSampledImage:
|
case SpvOpTypeSampledImage:
|
||||||
case OpTypeArray:
|
case SpvOpTypeArray:
|
||||||
case OpTypeRuntimeArray:
|
case SpvOpTypeRuntimeArray:
|
||||||
case OpTypeStruct:
|
case SpvOpTypeStruct:
|
||||||
case OpTypeOpaque:
|
case SpvOpTypeOpaque:
|
||||||
case OpTypePointer:
|
case SpvOpTypePointer:
|
||||||
case OpTypeFunction:
|
case SpvOpTypeFunction:
|
||||||
case OpTypeEvent:
|
case SpvOpTypeEvent:
|
||||||
case OpTypeDeviceEvent:
|
case SpvOpTypeDeviceEvent:
|
||||||
case OpTypeReserveId:
|
case SpvOpTypeReserveId:
|
||||||
case OpTypeQueue:
|
case SpvOpTypeQueue:
|
||||||
case OpTypePipe:
|
case SpvOpTypePipe:
|
||||||
case OpTypeForwardPointer:
|
case SpvOpTypeForwardPointer:
|
||||||
return true;
|
return true;
|
||||||
default:;
|
default:;
|
||||||
}
|
}
|
||||||
|
@ -48,14 +48,14 @@ const char *spvGeneratorStr(uint32_t generator);
|
|||||||
/// @param[in] opcode enumerant value
|
/// @param[in] opcode enumerant value
|
||||||
///
|
///
|
||||||
/// @return Opcode word
|
/// @return Opcode word
|
||||||
uint32_t spvOpcodeMake(uint16_t wordCount, Op opcode);
|
uint32_t spvOpcodeMake(uint16_t wordCount, SpvOp opcode);
|
||||||
|
|
||||||
/// @brief Split the binary opcode into its constituent parts
|
/// @brief Split the binary opcode into its constituent parts
|
||||||
///
|
///
|
||||||
/// @param[in] word binary opcode to split
|
/// @param[in] word binary opcode to split
|
||||||
/// @param[out] wordCount the returned number of words (optional)
|
/// @param[out] wordCount the returned number of words (optional)
|
||||||
/// @param[out] opcode the returned opcode enumerant (optional)
|
/// @param[out] opcode the returned opcode enumerant (optional)
|
||||||
void spvOpcodeSplit(const uint32_t word, uint16_t *wordCount, Op *opcode);
|
void spvOpcodeSplit(const uint32_t word, uint16_t *wordCount, SpvOp *opcode);
|
||||||
|
|
||||||
/// @brief Find the named Opcode in the table
|
/// @brief Find the named Opcode in the table
|
||||||
///
|
///
|
||||||
@ -76,7 +76,7 @@ spv_result_t spvOpcodeTableNameLookup(const spv_opcode_table table,
|
|||||||
///
|
///
|
||||||
/// @return result code
|
/// @return result code
|
||||||
spv_result_t spvOpcodeTableValueLookup(const spv_opcode_table table,
|
spv_result_t spvOpcodeTableValueLookup(const spv_opcode_table table,
|
||||||
const Op opcode,
|
const SpvOp opcode,
|
||||||
spv_opcode_desc *pEntry);
|
spv_opcode_desc *pEntry);
|
||||||
|
|
||||||
/// @brief Get the argument index for the <result-id> operand, if any.
|
/// @brief Get the argument index for the <result-id> operand, if any.
|
||||||
@ -107,7 +107,7 @@ int32_t spvOpcodeRequiresCapabilities(spv_opcode_desc entry);
|
|||||||
/// @param[in] wordCount the number of words to copy
|
/// @param[in] wordCount the number of words to copy
|
||||||
/// @param[in] endian the endianness of the stream
|
/// @param[in] endian the endianness of the stream
|
||||||
/// @param[out] pInst the returned instruction
|
/// @param[out] pInst the returned instruction
|
||||||
void spvInstructionCopy(const uint32_t *words, const Op opcode,
|
void spvInstructionCopy(const uint32_t *words, const SpvOp opcode,
|
||||||
const uint16_t wordCount, const spv_endianness_t endian,
|
const uint16_t wordCount, const spv_endianness_t endian,
|
||||||
spv_instruction_t *pInst);
|
spv_instruction_t *pInst);
|
||||||
|
|
||||||
@ -116,35 +116,35 @@ void spvInstructionCopy(const uint32_t *words, const Op opcode,
|
|||||||
/// @param[in] opcode the opcode
|
/// @param[in] opcode the opcode
|
||||||
///
|
///
|
||||||
/// @return the opcode string
|
/// @return the opcode string
|
||||||
const char *spvOpcodeString(const Op opcode);
|
const char *spvOpcodeString(const SpvOp opcode);
|
||||||
|
|
||||||
/// @brief Determine if the Opcode is a type
|
/// @brief Determine if the Opcode is a type
|
||||||
///
|
///
|
||||||
/// @param[in] opcode the opcode
|
/// @param[in] opcode the opcode
|
||||||
///
|
///
|
||||||
/// @return zero if false, non-zero otherwise
|
/// @return zero if false, non-zero otherwise
|
||||||
int32_t spvOpcodeIsType(const Op opcode);
|
int32_t spvOpcodeIsType(const SpvOp opcode);
|
||||||
|
|
||||||
/// @brief Determine if the OpCode is a scalar type
|
/// @brief Determine if the OpCode is a scalar type
|
||||||
///
|
///
|
||||||
/// @param[in] opcode the opcode
|
/// @param[in] opcode the opcode
|
||||||
///
|
///
|
||||||
/// @return zero if false, non-zero otherwise
|
/// @return zero if false, non-zero otherwise
|
||||||
int32_t spvOpcodeIsScalarType(const Op opcode);
|
int32_t spvOpcodeIsScalarType(const SpvOp opcode);
|
||||||
|
|
||||||
/// @brief Determine if the Opcode is a constant
|
/// @brief Determine if the Opcode is a constant
|
||||||
///
|
///
|
||||||
/// @param[in] opcode the opcode
|
/// @param[in] opcode the opcode
|
||||||
///
|
///
|
||||||
/// @return zero if false, non-zero otherwise
|
/// @return zero if false, non-zero otherwise
|
||||||
int32_t spvOpcodeIsConstant(const Op opcode);
|
int32_t spvOpcodeIsConstant(const SpvOp opcode);
|
||||||
|
|
||||||
/// @brief Determine if the Opcode is a composite type
|
/// @brief Determine if the Opcode is a composite type
|
||||||
///
|
///
|
||||||
/// @param[in] opcode the opcode
|
/// @param[in] opcode the opcode
|
||||||
///
|
///
|
||||||
/// @return zero if false, non-zero otherwise
|
/// @return zero if false, non-zero otherwise
|
||||||
int32_t spvOpcodeIsComposite(const Op opcode);
|
int32_t spvOpcodeIsComposite(const SpvOp opcode);
|
||||||
|
|
||||||
/// @brief Deep comparison of type declaration instructions
|
/// @brief Deep comparison of type declaration instructions
|
||||||
///
|
///
|
||||||
@ -160,21 +160,21 @@ int32_t spvOpcodeAreTypesEqual(const spv_instruction_t *pTypeInst0,
|
|||||||
/// @param[in] opcode the opcode
|
/// @param[in] opcode the opcode
|
||||||
///
|
///
|
||||||
/// @return zero if false, non-zero otherwise
|
/// @return zero if false, non-zero otherwise
|
||||||
int32_t spvOpcodeIsPointer(const Op opcode);
|
int32_t spvOpcodeIsPointer(const SpvOp opcode);
|
||||||
|
|
||||||
/// @brief Determine if the Opcode results in a instantation of a non-void type
|
/// @brief Determine if the Opcode results in a instantation of a non-void type
|
||||||
///
|
///
|
||||||
/// @param[in] opcode the opcode
|
/// @param[in] opcode the opcode
|
||||||
///
|
///
|
||||||
/// @return zero if false, non-zero otherwise
|
/// @return zero if false, non-zero otherwise
|
||||||
int32_t spvOpcodeIsObject(const Op opcode);
|
int32_t spvOpcodeIsObject(const SpvOp opcode);
|
||||||
|
|
||||||
/// @brief Determine if the scalar type Opcode is nullable
|
/// @brief Determine if the scalar type Opcode is nullable
|
||||||
///
|
///
|
||||||
/// @param[in] opcode the opcode
|
/// @param[in] opcode the opcode
|
||||||
///
|
///
|
||||||
/// @return zero if false, non-zero otherwise
|
/// @return zero if false, non-zero otherwise
|
||||||
int32_t spvOpcodeIsBasicTypeNullable(Op opcode);
|
int32_t spvOpcodeIsBasicTypeNullable(SpvOp opcode);
|
||||||
|
|
||||||
/// @brief Determine if instruction is in a basic block
|
/// @brief Determine if instruction is in a basic block
|
||||||
///
|
///
|
||||||
@ -190,13 +190,13 @@ int32_t spvInstructionIsInBasicBlock(const spv_instruction_t *pFirstInst,
|
|||||||
/// @param[in] opcode the opcode
|
/// @param[in] opcode the opcode
|
||||||
///
|
///
|
||||||
/// @return zero if false, non-zero otherwise
|
/// @return zero if false, non-zero otherwise
|
||||||
int32_t spvOpcodeIsValue(Op opcode);
|
int32_t spvOpcodeIsValue(SpvOp opcode);
|
||||||
|
|
||||||
/// @brief Determine if the Opcode generates a type
|
/// @brief Determine if the Opcode generates a type
|
||||||
///
|
///
|
||||||
/// @param[in] opcode the opcode
|
/// @param[in] opcode the opcode
|
||||||
///
|
///
|
||||||
/// @return zero if false, non-zero otherwise
|
/// @return zero if false, non-zero otherwise
|
||||||
int32_t spvOpcodeGeneratesType(Op op);
|
int32_t spvOpcodeGeneratesType(SpvOp op);
|
||||||
|
|
||||||
#endif // LIBSPIRV_OPCODE_H_
|
#endif // LIBSPIRV_OPCODE_H_
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -263,7 +263,8 @@ spv_result_t spvTextEncodeOperand(const libspirv::AssemblyGrammar& grammar,
|
|||||||
// The encoding for OpConstant, OpSpecConstant and OpSwitch all
|
// The encoding for OpConstant, OpSpecConstant and OpSwitch all
|
||||||
// depend on either their own result-id or the result-id of
|
// depend on either their own result-id or the result-id of
|
||||||
// one of their parameters.
|
// one of their parameters.
|
||||||
if (OpConstant == pInst->opcode || OpSpecConstant == pInst->opcode) {
|
if (SpvOpConstant == pInst->opcode ||
|
||||||
|
SpvOpSpecConstant == pInst->opcode) {
|
||||||
// Special cases for encoding possibly non-32-bit literals here.
|
// Special cases for encoding possibly non-32-bit literals here.
|
||||||
expected_type =
|
expected_type =
|
||||||
context->getTypeOfTypeGeneratingValue(pInst->resultTypeId);
|
context->getTypeOfTypeGeneratingValue(pInst->resultTypeId);
|
||||||
@ -278,7 +279,7 @@ spv_result_t spvTextEncodeOperand(const libspirv::AssemblyGrammar& grammar,
|
|||||||
<< "Type for " << opcode_name
|
<< "Type for " << opcode_name
|
||||||
<< " must be a scalar floating point or integer type";
|
<< " must be a scalar floating point or integer type";
|
||||||
}
|
}
|
||||||
} else if (pInst->opcode == OpSwitch) {
|
} else if (pInst->opcode == SpvOpSwitch) {
|
||||||
// We need to know the type of the selector.
|
// We need to know the type of the selector.
|
||||||
expected_type = context->getTypeOfValueInstruction(pInst->words[1]);
|
expected_type = context->getTypeOfValueInstruction(pInst->words[1]);
|
||||||
if (!libspirv::isScalarIntegral(expected_type)) {
|
if (!libspirv::isScalarIntegral(expected_type)) {
|
||||||
@ -311,7 +312,7 @@ spv_result_t spvTextEncodeOperand(const libspirv::AssemblyGrammar& grammar,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: Special case for extended instruction library import
|
// NOTE: Special case for extended instruction library import
|
||||||
if (OpExtInstImport == pInst->opcode) {
|
if (SpvOpExtInstImport == pInst->opcode) {
|
||||||
pInst->extInstType = spvExtInstImportTypeGet(literal.value.str);
|
pInst->extInstType = spvExtInstImportTypeGet(literal.value.str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,12 +319,12 @@ spv_result_t AssemblyContext::recordTypeDefinition(
|
|||||||
<< "Value " << value << " has already been used to generate a type";
|
<< "Value " << value << " has already been used to generate a type";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pInst->opcode == OpTypeInt) {
|
if (pInst->opcode == SpvOpTypeInt) {
|
||||||
if (pInst->words.size() != 4)
|
if (pInst->words.size() != 4)
|
||||||
return diagnostic() << "Invalid OpTypeInt instruction";
|
return diagnostic() << "Invalid OpTypeInt instruction";
|
||||||
types_[value] = {pInst->words[2], pInst->words[3] != 0,
|
types_[value] = {pInst->words[2], pInst->words[3] != 0,
|
||||||
IdTypeClass::kScalarIntegerType};
|
IdTypeClass::kScalarIntegerType};
|
||||||
} else if (pInst->opcode == OpTypeFloat) {
|
} else if (pInst->opcode == SpvOpTypeFloat) {
|
||||||
if (pInst->words.size() != 3)
|
if (pInst->words.size() != 3)
|
||||||
return diagnostic() << "Invalid OpTypeFloat instruction";
|
return diagnostic() << "Invalid OpTypeFloat instruction";
|
||||||
types_[value] = {pInst->words[2], false, IdTypeClass::kScalarFloatType};
|
types_[value] = {pInst->words[2], false, IdTypeClass::kScalarFloatType};
|
||||||
|
@ -134,7 +134,7 @@ spv_result_t spvValidateBasic(const spv_instruction_t *pInsts,
|
|||||||
for (uint64_t instIndex = 0; instIndex < instCount; ++instIndex) {
|
for (uint64_t instIndex = 0; instIndex < instCount; ++instIndex) {
|
||||||
const uint32_t *words = pInsts[instIndex].words.data();
|
const uint32_t *words = pInsts[instIndex].words.data();
|
||||||
uint16_t wordCount;
|
uint16_t wordCount;
|
||||||
Op opcode;
|
SpvOp opcode;
|
||||||
spvOpcodeSplit(words[0], &wordCount, &opcode);
|
spvOpcodeSplit(words[0], &wordCount, &opcode);
|
||||||
|
|
||||||
spv_opcode_desc opcodeEntry = nullptr;
|
spv_opcode_desc opcodeEntry = nullptr;
|
||||||
@ -194,7 +194,7 @@ spv_result_t spvValidateIDs(const spv_instruction_t *pInsts,
|
|||||||
|
|
||||||
for (uint64_t instIndex = 0; instIndex < count; ++instIndex) {
|
for (uint64_t instIndex = 0; instIndex < count; ++instIndex) {
|
||||||
const uint32_t *words = pInsts[instIndex].words.data();
|
const uint32_t *words = pInsts[instIndex].words.data();
|
||||||
Op opcode;
|
SpvOp opcode;
|
||||||
spvOpcodeSplit(words[0], nullptr, &opcode);
|
spvOpcodeSplit(words[0], nullptr, &opcode);
|
||||||
|
|
||||||
spv_opcode_desc opcodeEntry = nullptr;
|
spv_opcode_desc opcodeEntry = nullptr;
|
||||||
@ -285,7 +285,7 @@ spv_result_t spvValidate(const spv_binary binary,
|
|||||||
uint64_t index = SPV_INDEX_INSTRUCTION;
|
uint64_t index = SPV_INDEX_INSTRUCTION;
|
||||||
while (index < binary->wordCount) {
|
while (index < binary->wordCount) {
|
||||||
uint16_t wordCount;
|
uint16_t wordCount;
|
||||||
Op opcode;
|
SpvOp opcode;
|
||||||
spvOpcodeSplit(spvFixWord(binary->code[index], endian), &wordCount,
|
spvOpcodeSplit(spvFixWord(binary->code[index], endian), &wordCount,
|
||||||
&opcode);
|
&opcode);
|
||||||
spv_instruction_t inst;
|
spv_instruction_t inst;
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
typedef struct spv_id_info_t {
|
typedef struct spv_id_info_t {
|
||||||
uint32_t id;
|
uint32_t id;
|
||||||
Op opcode;
|
SpvOp opcode;
|
||||||
const spv_instruction_t *inst;
|
const spv_instruction_t *inst;
|
||||||
spv_position_t position;
|
spv_position_t position;
|
||||||
} spv_id_info_t;
|
} spv_id_info_t;
|
||||||
|
@ -68,7 +68,7 @@ class idUsage {
|
|||||||
|
|
||||||
bool isValid(const spv_instruction_t *inst);
|
bool isValid(const spv_instruction_t *inst);
|
||||||
|
|
||||||
template <Op>
|
template <SpvOp>
|
||||||
bool isValid(const spv_instruction_t *inst, const spv_opcode_desc);
|
bool isValid(const spv_instruction_t *inst, const spv_opcode_desc);
|
||||||
|
|
||||||
std::unordered_map<uint32_t, spv_id_info_t>::iterator find(
|
std::unordered_map<uint32_t, spv_id_info_t>::iterator find(
|
||||||
@ -123,16 +123,16 @@ class idUsage {
|
|||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
template <>
|
template <>
|
||||||
bool idUsage::isValid<OpUndef>(const spv_instruction_t *inst,
|
bool idUsage::isValid<SpvOpUndef>(const spv_instruction_t *inst,
|
||||||
const spv_opcode_desc) {
|
const spv_opcode_desc) {
|
||||||
assert(0 && "Unimplemented!");
|
assert(0 && "Unimplemented!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
bool idUsage::isValid<OpName>(const spv_instruction_t *inst,
|
bool idUsage::isValid<SpvOpName>(const spv_instruction_t *inst,
|
||||||
const spv_opcode_desc) {
|
const spv_opcode_desc) {
|
||||||
auto targetIndex = 1;
|
auto targetIndex = 1;
|
||||||
auto target = find(inst->words[targetIndex]);
|
auto target = find(inst->words[targetIndex]);
|
||||||
spvCheck(!found(target), DIAG(targetIndex) << "OpName Target <id> '"
|
spvCheck(!found(target), DIAG(targetIndex) << "OpName Target <id> '"
|
||||||
@ -143,15 +143,15 @@ bool idUsage::isValid<OpName>(const spv_instruction_t *inst,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
bool idUsage::isValid<OpMemberName>(const spv_instruction_t *inst,
|
bool idUsage::isValid<SpvOpMemberName>(const spv_instruction_t *inst,
|
||||||
const spv_opcode_desc) {
|
const spv_opcode_desc) {
|
||||||
auto typeIndex = 1;
|
auto typeIndex = 1;
|
||||||
auto type = find(inst->words[typeIndex]);
|
auto type = find(inst->words[typeIndex]);
|
||||||
spvCheck(!found(type), DIAG(typeIndex) << "OpMemberName Type <id> '"
|
spvCheck(!found(type), DIAG(typeIndex) << "OpMemberName Type <id> '"
|
||||||
<< inst->words[typeIndex]
|
<< inst->words[typeIndex]
|
||||||
<< "' is not defined.";
|
<< "' is not defined.";
|
||||||
return false);
|
return false);
|
||||||
spvCheck(OpTypeStruct != type->second.opcode,
|
spvCheck(SpvOpTypeStruct != type->second.opcode,
|
||||||
DIAG(typeIndex) << "OpMemberName Type <id> '"
|
DIAG(typeIndex) << "OpMemberName Type <id> '"
|
||||||
<< inst->words[typeIndex]
|
<< inst->words[typeIndex]
|
||||||
<< "' is not a struct type.";
|
<< "' is not a struct type.";
|
||||||
@ -169,15 +169,15 @@ bool idUsage::isValid<OpMemberName>(const spv_instruction_t *inst,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
bool idUsage::isValid<OpLine>(const spv_instruction_t *inst,
|
bool idUsage::isValid<SpvOpLine>(const spv_instruction_t *inst,
|
||||||
const spv_opcode_desc) {
|
const spv_opcode_desc) {
|
||||||
auto fileIndex = 1;
|
auto fileIndex = 1;
|
||||||
auto file = find(inst->words[fileIndex]);
|
auto file = find(inst->words[fileIndex]);
|
||||||
spvCheck(!found(file), DIAG(fileIndex) << "OpLine Target <id> '"
|
spvCheck(!found(file), DIAG(fileIndex) << "OpLine Target <id> '"
|
||||||
<< inst->words[fileIndex]
|
<< inst->words[fileIndex]
|
||||||
<< "' is not defined.";
|
<< "' is not defined.";
|
||||||
return false);
|
return false);
|
||||||
spvCheck(OpString != file->second.opcode,
|
spvCheck(SpvOpString != file->second.opcode,
|
||||||
DIAG(fileIndex) << "OpLine Target <id> '" << inst->words[fileIndex]
|
DIAG(fileIndex) << "OpLine Target <id> '" << inst->words[fileIndex]
|
||||||
<< "' is not an OpString.";
|
<< "' is not an OpString.";
|
||||||
return false);
|
return false);
|
||||||
@ -185,8 +185,8 @@ bool idUsage::isValid<OpLine>(const spv_instruction_t *inst,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
bool idUsage::isValid<OpDecorate>(const spv_instruction_t *inst,
|
bool idUsage::isValid<SpvOpDecorate>(const spv_instruction_t *inst,
|
||||||
const spv_opcode_desc) {
|
const spv_opcode_desc) {
|
||||||
auto targetIndex = 1;
|
auto targetIndex = 1;
|
||||||
auto target = find(inst->words[targetIndex]);
|
auto target = find(inst->words[targetIndex]);
|
||||||
spvCheck(!found(target), DIAG(targetIndex) << "OpDecorate Target <id> '"
|
spvCheck(!found(target), DIAG(targetIndex) << "OpDecorate Target <id> '"
|
||||||
@ -197,8 +197,8 @@ bool idUsage::isValid<OpDecorate>(const spv_instruction_t *inst,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
bool idUsage::isValid<OpMemberDecorate>(const spv_instruction_t *inst,
|
bool idUsage::isValid<SpvOpMemberDecorate>(const spv_instruction_t *inst,
|
||||||
const spv_opcode_desc) {
|
const spv_opcode_desc) {
|
||||||
auto structTypeIndex = 1;
|
auto structTypeIndex = 1;
|
||||||
auto structType = find(inst->words[structTypeIndex]);
|
auto structType = find(inst->words[structTypeIndex]);
|
||||||
spvCheck(!found(structType), DIAG(structTypeIndex)
|
spvCheck(!found(structType), DIAG(structTypeIndex)
|
||||||
@ -206,7 +206,7 @@ bool idUsage::isValid<OpMemberDecorate>(const spv_instruction_t *inst,
|
|||||||
<< inst->words[structTypeIndex]
|
<< inst->words[structTypeIndex]
|
||||||
<< "' is not defined.";
|
<< "' is not defined.";
|
||||||
return false);
|
return false);
|
||||||
spvCheck(OpTypeStruct != structType->second.inst->opcode,
|
spvCheck(SpvOpTypeStruct != structType->second.inst->opcode,
|
||||||
DIAG(structTypeIndex) << "OpMemberDecorate Structure type <id> '"
|
DIAG(structTypeIndex) << "OpMemberDecorate Structure type <id> '"
|
||||||
<< inst->words[structTypeIndex]
|
<< inst->words[structTypeIndex]
|
||||||
<< "' is not a struct type.";
|
<< "' is not a struct type.";
|
||||||
@ -223,8 +223,8 @@ bool idUsage::isValid<OpMemberDecorate>(const spv_instruction_t *inst,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
bool idUsage::isValid<OpGroupDecorate>(const spv_instruction_t *inst,
|
bool idUsage::isValid<SpvOpGroupDecorate>(const spv_instruction_t *inst,
|
||||||
const spv_opcode_desc) {
|
const spv_opcode_desc) {
|
||||||
auto decorationGroupIndex = 1;
|
auto decorationGroupIndex = 1;
|
||||||
auto decorationGroup = find(inst->words[decorationGroupIndex]);
|
auto decorationGroup = find(inst->words[decorationGroupIndex]);
|
||||||
spvCheck(!found(decorationGroup),
|
spvCheck(!found(decorationGroup),
|
||||||
@ -232,7 +232,7 @@ bool idUsage::isValid<OpGroupDecorate>(const spv_instruction_t *inst,
|
|||||||
<< "OpGroupDecorate Decoration group <id> '"
|
<< "OpGroupDecorate Decoration group <id> '"
|
||||||
<< inst->words[decorationGroupIndex] << "' is not defined.";
|
<< inst->words[decorationGroupIndex] << "' is not defined.";
|
||||||
return false);
|
return false);
|
||||||
spvCheck(OpDecorationGroup != decorationGroup->second.opcode,
|
spvCheck(SpvOpDecorationGroup != decorationGroup->second.opcode,
|
||||||
DIAG(decorationGroupIndex)
|
DIAG(decorationGroupIndex)
|
||||||
<< "OpGroupDecorate Decoration group <id> '"
|
<< "OpGroupDecorate Decoration group <id> '"
|
||||||
<< inst->words[decorationGroupIndex]
|
<< inst->words[decorationGroupIndex]
|
||||||
@ -251,19 +251,19 @@ bool idUsage::isValid<OpGroupDecorate>(const spv_instruction_t *inst,
|
|||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
template <>
|
template <>
|
||||||
bool idUsage::isValid<OpGroupMemberDecorate>(
|
bool idUsage::isValid<SpvOpGroupMemberDecorate>(
|
||||||
const spv_instruction_t *inst, const spv_opcode_desc opcodeEntry) {}
|
const spv_instruction_t *inst, const spv_opcode_desc opcodeEntry) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
template <>
|
template <>
|
||||||
bool idUsage::isValid<OpExtInst>(const spv_instruction_t *inst,
|
bool idUsage::isValid<SpvOpExtInst>(const spv_instruction_t *inst,
|
||||||
const spv_opcode_desc opcodeEntry) {}
|
const spv_opcode_desc opcodeEntry) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
bool idUsage::isValid<OpEntryPoint>(const spv_instruction_t *inst,
|
bool idUsage::isValid<SpvOpEntryPoint>(const spv_instruction_t *inst,
|
||||||
const spv_opcode_desc) {
|
const spv_opcode_desc) {
|
||||||
auto entryPointIndex = 2;
|
auto entryPointIndex = 2;
|
||||||
auto entryPoint = find(inst->words[entryPointIndex]);
|
auto entryPoint = find(inst->words[entryPointIndex]);
|
||||||
spvCheck(!found(entryPoint), DIAG(entryPointIndex)
|
spvCheck(!found(entryPoint), DIAG(entryPointIndex)
|
||||||
@ -271,7 +271,7 @@ bool idUsage::isValid<OpEntryPoint>(const spv_instruction_t *inst,
|
|||||||
<< inst->words[entryPointIndex]
|
<< inst->words[entryPointIndex]
|
||||||
<< "' is not defined.";
|
<< "' is not defined.";
|
||||||
return false);
|
return false);
|
||||||
spvCheck(OpFunction != entryPoint->second.opcode,
|
spvCheck(SpvOpFunction != entryPoint->second.opcode,
|
||||||
DIAG(entryPointIndex) << "OpEntryPoint Entry Point <id> '"
|
DIAG(entryPointIndex) << "OpEntryPoint Entry Point <id> '"
|
||||||
<< inst->words[entryPointIndex]
|
<< inst->words[entryPointIndex]
|
||||||
<< "' is not a function.";
|
<< "' is not a function.";
|
||||||
@ -287,7 +287,7 @@ bool idUsage::isValid<OpEntryPoint>(const spv_instruction_t *inst,
|
|||||||
return false);
|
return false);
|
||||||
auto returnType = find(entryPoint->second.inst->words[1]);
|
auto returnType = find(entryPoint->second.inst->words[1]);
|
||||||
spvCheck(!found(returnType), assert(0 && "Unreachable!"));
|
spvCheck(!found(returnType), assert(0 && "Unreachable!"));
|
||||||
spvCheck(OpTypeVoid != returnType->second.opcode,
|
spvCheck(SpvOpTypeVoid != returnType->second.opcode,
|
||||||
DIAG(entryPointIndex) << "OpEntryPoint Entry Point <id> '"
|
DIAG(entryPointIndex) << "OpEntryPoint Entry Point <id> '"
|
||||||
<< inst->words[entryPointIndex]
|
<< inst->words[entryPointIndex]
|
||||||
<< "'s function return type is not void.";
|
<< "'s function return type is not void.";
|
||||||
@ -296,8 +296,8 @@ bool idUsage::isValid<OpEntryPoint>(const spv_instruction_t *inst,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
bool idUsage::isValid<OpExecutionMode>(const spv_instruction_t *inst,
|
bool idUsage::isValid<SpvOpExecutionMode>(const spv_instruction_t *inst,
|
||||||
const spv_opcode_desc) {
|
const spv_opcode_desc) {
|
||||||
auto entryPointIndex = 1;
|
auto entryPointIndex = 1;
|
||||||
auto entryPoint = find(inst->words[entryPointIndex]);
|
auto entryPoint = find(inst->words[entryPointIndex]);
|
||||||
spvCheck(!found(entryPoint), DIAG(entryPointIndex)
|
spvCheck(!found(entryPoint), DIAG(entryPointIndex)
|
||||||
@ -309,7 +309,7 @@ bool idUsage::isValid<OpExecutionMode>(const spv_instruction_t *inst,
|
|||||||
spvCheck(!foundUses(entryPointUses), assert(0 && "Unreachable!"));
|
spvCheck(!foundUses(entryPointUses), assert(0 && "Unreachable!"));
|
||||||
bool foundEntryPointUse = false;
|
bool foundEntryPointUse = false;
|
||||||
for (auto use : entryPointUses->second) {
|
for (auto use : entryPointUses->second) {
|
||||||
if (OpEntryPoint == use.opcode) {
|
if (SpvOpEntryPoint == use.opcode) {
|
||||||
foundEntryPointUse = true;
|
foundEntryPointUse = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -323,8 +323,8 @@ bool idUsage::isValid<OpExecutionMode>(const spv_instruction_t *inst,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
bool idUsage::isValid<OpTypeVector>(const spv_instruction_t *inst,
|
bool idUsage::isValid<SpvOpTypeVector>(const spv_instruction_t *inst,
|
||||||
const spv_opcode_desc) {
|
const spv_opcode_desc) {
|
||||||
auto componentIndex = 2;
|
auto componentIndex = 2;
|
||||||
auto componentType = find(inst->words[componentIndex]);
|
auto componentType = find(inst->words[componentIndex]);
|
||||||
spvCheck(!found(componentType), DIAG(componentIndex)
|
spvCheck(!found(componentType), DIAG(componentIndex)
|
||||||
@ -341,8 +341,8 @@ bool idUsage::isValid<OpTypeVector>(const spv_instruction_t *inst,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
bool idUsage::isValid<OpTypeMatrix>(const spv_instruction_t *inst,
|
bool idUsage::isValid<SpvOpTypeMatrix>(const spv_instruction_t *inst,
|
||||||
const spv_opcode_desc) {
|
const spv_opcode_desc) {
|
||||||
auto columnTypeIndex = 2;
|
auto columnTypeIndex = 2;
|
||||||
auto columnType = find(inst->words[columnTypeIndex]);
|
auto columnType = find(inst->words[columnTypeIndex]);
|
||||||
spvCheck(!found(columnType), DIAG(columnTypeIndex)
|
spvCheck(!found(columnType), DIAG(columnTypeIndex)
|
||||||
@ -350,7 +350,7 @@ bool idUsage::isValid<OpTypeMatrix>(const spv_instruction_t *inst,
|
|||||||
<< inst->words[columnTypeIndex]
|
<< inst->words[columnTypeIndex]
|
||||||
<< "' is not defined.";
|
<< "' is not defined.";
|
||||||
return false);
|
return false);
|
||||||
spvCheck(OpTypeVector != columnType->second.opcode,
|
spvCheck(SpvOpTypeVector != columnType->second.opcode,
|
||||||
DIAG(columnTypeIndex) << "OpTypeMatrix Column Type <id> '"
|
DIAG(columnTypeIndex) << "OpTypeMatrix Column Type <id> '"
|
||||||
<< inst->words[columnTypeIndex]
|
<< inst->words[columnTypeIndex]
|
||||||
<< "' is not a vector.";
|
<< "' is not a vector.";
|
||||||
@ -359,15 +359,15 @@ bool idUsage::isValid<OpTypeMatrix>(const spv_instruction_t *inst,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
bool idUsage::isValid<OpTypeSampler>(const spv_instruction_t *,
|
bool idUsage::isValid<SpvOpTypeSampler>(const spv_instruction_t *,
|
||||||
const spv_opcode_desc) {
|
const spv_opcode_desc) {
|
||||||
// OpTypeSampler takes no arguments in Rev31 and beyond.
|
// OpTypeSampler takes no arguments in Rev31 and beyond.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
bool idUsage::isValid<OpTypeArray>(const spv_instruction_t *inst,
|
bool idUsage::isValid<SpvOpTypeArray>(const spv_instruction_t *inst,
|
||||||
const spv_opcode_desc) {
|
const spv_opcode_desc) {
|
||||||
auto elementTypeIndex = 2;
|
auto elementTypeIndex = 2;
|
||||||
auto elementType = find(inst->words[elementTypeIndex]);
|
auto elementType = find(inst->words[elementTypeIndex]);
|
||||||
spvCheck(!found(elementType), DIAG(elementTypeIndex)
|
spvCheck(!found(elementType), DIAG(elementTypeIndex)
|
||||||
@ -386,8 +386,8 @@ bool idUsage::isValid<OpTypeArray>(const spv_instruction_t *inst,
|
|||||||
<< inst->words[lengthIndex]
|
<< inst->words[lengthIndex]
|
||||||
<< "' is not defined.";
|
<< "' is not defined.";
|
||||||
return false);
|
return false);
|
||||||
spvCheck(OpConstant != length->second.opcode &&
|
spvCheck(SpvOpConstant != length->second.opcode &&
|
||||||
OpSpecConstant != length->second.opcode,
|
SpvOpSpecConstant != length->second.opcode,
|
||||||
DIAG(lengthIndex) << "OpTypeArray Length <id> '"
|
DIAG(lengthIndex) << "OpTypeArray Length <id> '"
|
||||||
<< inst->words[lengthIndex]
|
<< inst->words[lengthIndex]
|
||||||
<< "' is not a scalar constant type.";
|
<< "' is not a scalar constant type.";
|
||||||
@ -402,7 +402,7 @@ bool idUsage::isValid<OpTypeArray>(const spv_instruction_t *inst,
|
|||||||
<< inst->words[constResultTypeIndex]
|
<< inst->words[constResultTypeIndex]
|
||||||
<< "' result type is not defined.";
|
<< "' result type is not defined.";
|
||||||
return false);
|
return false);
|
||||||
spvCheck(OpTypeInt != constResultType->second.opcode,
|
spvCheck(SpvOpTypeInt != constResultType->second.opcode,
|
||||||
DIAG(lengthIndex) << "OpTypeArray Length <id> '"
|
DIAG(lengthIndex) << "OpTypeArray Length <id> '"
|
||||||
<< inst->words[lengthIndex]
|
<< inst->words[lengthIndex]
|
||||||
<< "' is not a constant integer type.";
|
<< "' is not a constant integer type.";
|
||||||
@ -434,8 +434,8 @@ bool idUsage::isValid<OpTypeArray>(const spv_instruction_t *inst,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
bool idUsage::isValid<OpTypeRuntimeArray>(const spv_instruction_t *inst,
|
bool idUsage::isValid<SpvOpTypeRuntimeArray>(const spv_instruction_t *inst,
|
||||||
const spv_opcode_desc) {
|
const spv_opcode_desc) {
|
||||||
auto elementTypeIndex = 2;
|
auto elementTypeIndex = 2;
|
||||||
auto elementType = find(inst->words[elementTypeIndex]);
|
auto elementType = find(inst->words[elementTypeIndex]);
|
||||||
spvCheck(!found(elementType), DIAG(elementTypeIndex)
|
spvCheck(!found(elementType), DIAG(elementTypeIndex)
|
||||||
@ -452,8 +452,8 @@ bool idUsage::isValid<OpTypeRuntimeArray>(const spv_instruction_t *inst,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
bool idUsage::isValid<OpTypeStruct>(const spv_instruction_t *inst,
|
bool idUsage::isValid<SpvOpTypeStruct>(const spv_instruction_t *inst,
|
||||||
const spv_opcode_desc) {
|
const spv_opcode_desc) {
|
||||||
for (size_t memberTypeIndex = 2; memberTypeIndex < inst->words.size();
|
for (size_t memberTypeIndex = 2; memberTypeIndex < inst->words.size();
|
||||||
++memberTypeIndex) {
|
++memberTypeIndex) {
|
||||||
auto memberType = find(inst->words[memberTypeIndex]);
|
auto memberType = find(inst->words[memberTypeIndex]);
|
||||||
@ -472,8 +472,8 @@ bool idUsage::isValid<OpTypeStruct>(const spv_instruction_t *inst,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
bool idUsage::isValid<OpTypePointer>(const spv_instruction_t *inst,
|
bool idUsage::isValid<SpvOpTypePointer>(const spv_instruction_t *inst,
|
||||||
const spv_opcode_desc) {
|
const spv_opcode_desc) {
|
||||||
auto typeIndex = 3;
|
auto typeIndex = 3;
|
||||||
auto type = find(inst->words[typeIndex]);
|
auto type = find(inst->words[typeIndex]);
|
||||||
spvCheck(!found(type), DIAG(typeIndex) << "OpTypePointer Type <id> '"
|
spvCheck(!found(type), DIAG(typeIndex) << "OpTypePointer Type <id> '"
|
||||||
@ -488,8 +488,8 @@ bool idUsage::isValid<OpTypePointer>(const spv_instruction_t *inst,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
bool idUsage::isValid<OpTypeFunction>(const spv_instruction_t *inst,
|
bool idUsage::isValid<SpvOpTypeFunction>(const spv_instruction_t *inst,
|
||||||
const spv_opcode_desc) {
|
const spv_opcode_desc) {
|
||||||
auto returnTypeIndex = 2;
|
auto returnTypeIndex = 2;
|
||||||
auto returnType = find(inst->words[returnTypeIndex]);
|
auto returnType = find(inst->words[returnTypeIndex]);
|
||||||
spvCheck(!found(returnType), DIAG(returnTypeIndex)
|
spvCheck(!found(returnType), DIAG(returnTypeIndex)
|
||||||
@ -520,15 +520,15 @@ bool idUsage::isValid<OpTypeFunction>(const spv_instruction_t *inst,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
bool idUsage::isValid<OpTypePipe>(const spv_instruction_t *,
|
bool idUsage::isValid<SpvOpTypePipe>(const spv_instruction_t *,
|
||||||
const spv_opcode_desc) {
|
const spv_opcode_desc) {
|
||||||
// OpTypePipe has no ID arguments.
|
// OpTypePipe has no ID arguments.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
bool idUsage::isValid<OpConstantTrue>(const spv_instruction_t *inst,
|
bool idUsage::isValid<SpvOpConstantTrue>(const spv_instruction_t *inst,
|
||||||
const spv_opcode_desc) {
|
const spv_opcode_desc) {
|
||||||
auto resultTypeIndex = 1;
|
auto resultTypeIndex = 1;
|
||||||
auto resultType = find(inst->words[resultTypeIndex]);
|
auto resultType = find(inst->words[resultTypeIndex]);
|
||||||
spvCheck(!found(resultType), DIAG(resultTypeIndex)
|
spvCheck(!found(resultType), DIAG(resultTypeIndex)
|
||||||
@ -536,7 +536,7 @@ bool idUsage::isValid<OpConstantTrue>(const spv_instruction_t *inst,
|
|||||||
<< inst->words[resultTypeIndex]
|
<< inst->words[resultTypeIndex]
|
||||||
<< "' is not defined.";
|
<< "' is not defined.";
|
||||||
return false);
|
return false);
|
||||||
spvCheck(OpTypeBool != resultType->second.opcode,
|
spvCheck(SpvOpTypeBool != resultType->second.opcode,
|
||||||
DIAG(resultTypeIndex) << "OpConstantTrue Result Type <id> '"
|
DIAG(resultTypeIndex) << "OpConstantTrue Result Type <id> '"
|
||||||
<< inst->words[resultTypeIndex]
|
<< inst->words[resultTypeIndex]
|
||||||
<< "' is not a boolean type.";
|
<< "' is not a boolean type.";
|
||||||
@ -545,8 +545,8 @@ bool idUsage::isValid<OpConstantTrue>(const spv_instruction_t *inst,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
bool idUsage::isValid<OpConstantFalse>(const spv_instruction_t *inst,
|
bool idUsage::isValid<SpvOpConstantFalse>(const spv_instruction_t *inst,
|
||||||
const spv_opcode_desc) {
|
const spv_opcode_desc) {
|
||||||
auto resultTypeIndex = 1;
|
auto resultTypeIndex = 1;
|
||||||
auto resultType = find(inst->words[resultTypeIndex]);
|
auto resultType = find(inst->words[resultTypeIndex]);
|
||||||
spvCheck(!found(resultType), DIAG(resultTypeIndex)
|
spvCheck(!found(resultType), DIAG(resultTypeIndex)
|
||||||
@ -554,7 +554,7 @@ bool idUsage::isValid<OpConstantFalse>(const spv_instruction_t *inst,
|
|||||||
<< inst->words[resultTypeIndex]
|
<< inst->words[resultTypeIndex]
|
||||||
<< "' is not defined.";
|
<< "' is not defined.";
|
||||||
return false);
|
return false);
|
||||||
spvCheck(OpTypeBool != resultType->second.opcode,
|
spvCheck(SpvOpTypeBool != resultType->second.opcode,
|
||||||
DIAG(resultTypeIndex) << "OpConstantFalse Result Type <id> '"
|
DIAG(resultTypeIndex) << "OpConstantFalse Result Type <id> '"
|
||||||
<< inst->words[resultTypeIndex]
|
<< inst->words[resultTypeIndex]
|
||||||
<< "' is not a boolean type.";
|
<< "' is not a boolean type.";
|
||||||
@ -563,8 +563,8 @@ bool idUsage::isValid<OpConstantFalse>(const spv_instruction_t *inst,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
bool idUsage::isValid<OpConstant>(const spv_instruction_t *inst,
|
bool idUsage::isValid<SpvOpConstant>(const spv_instruction_t *inst,
|
||||||
const spv_opcode_desc) {
|
const spv_opcode_desc) {
|
||||||
auto resultTypeIndex = 1;
|
auto resultTypeIndex = 1;
|
||||||
auto resultType = find(inst->words[resultTypeIndex]);
|
auto resultType = find(inst->words[resultTypeIndex]);
|
||||||
spvCheck(!found(resultType), DIAG(resultTypeIndex)
|
spvCheck(!found(resultType), DIAG(resultTypeIndex)
|
||||||
@ -582,8 +582,8 @@ bool idUsage::isValid<OpConstant>(const spv_instruction_t *inst,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
bool idUsage::isValid<OpConstantComposite>(const spv_instruction_t *inst,
|
bool idUsage::isValid<SpvOpConstantComposite>(const spv_instruction_t *inst,
|
||||||
const spv_opcode_desc) {
|
const spv_opcode_desc) {
|
||||||
auto resultTypeIndex = 1;
|
auto resultTypeIndex = 1;
|
||||||
auto resultType = find(inst->words[resultTypeIndex]);
|
auto resultType = find(inst->words[resultTypeIndex]);
|
||||||
spvCheck(!found(resultType), DIAG(resultTypeIndex)
|
spvCheck(!found(resultType), DIAG(resultTypeIndex)
|
||||||
@ -599,7 +599,7 @@ bool idUsage::isValid<OpConstantComposite>(const spv_instruction_t *inst,
|
|||||||
|
|
||||||
uint32_t constituentCount = inst->words.size() - 3;
|
uint32_t constituentCount = inst->words.size() - 3;
|
||||||
switch (resultType->second.opcode) {
|
switch (resultType->second.opcode) {
|
||||||
case OpTypeVector: {
|
case SpvOpTypeVector: {
|
||||||
auto componentCount = resultType->second.inst->words[3];
|
auto componentCount = resultType->second.inst->words[3];
|
||||||
spvCheck(
|
spvCheck(
|
||||||
componentCount != constituentCount,
|
componentCount != constituentCount,
|
||||||
@ -632,7 +632,7 @@ bool idUsage::isValid<OpConstantComposite>(const spv_instruction_t *inst,
|
|||||||
return false);
|
return false);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case OpTypeMatrix: {
|
case SpvOpTypeMatrix: {
|
||||||
auto columnCount = resultType->second.inst->words[3];
|
auto columnCount = resultType->second.inst->words[3];
|
||||||
spvCheck(
|
spvCheck(
|
||||||
columnCount != constituentCount,
|
columnCount != constituentCount,
|
||||||
@ -657,7 +657,7 @@ bool idUsage::isValid<OpConstantComposite>(const spv_instruction_t *inst,
|
|||||||
<< "OpConstantComposite Constituent <id> '"
|
<< "OpConstantComposite Constituent <id> '"
|
||||||
<< inst->words[constituentIndex] << "' is not defined.";
|
<< inst->words[constituentIndex] << "' is not defined.";
|
||||||
return false);
|
return false);
|
||||||
spvCheck(OpConstantComposite != constituent->second.opcode,
|
spvCheck(SpvOpConstantComposite != constituent->second.opcode,
|
||||||
DIAG(constituentIndex)
|
DIAG(constituentIndex)
|
||||||
<< "OpConstantComposite Constituent <id> '"
|
<< "OpConstantComposite Constituent <id> '"
|
||||||
<< inst->words[constituentIndex]
|
<< inst->words[constituentIndex]
|
||||||
@ -693,7 +693,7 @@ bool idUsage::isValid<OpConstantComposite>(const spv_instruction_t *inst,
|
|||||||
return false);
|
return false);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case OpTypeArray: {
|
case SpvOpTypeArray: {
|
||||||
auto elementType = find(resultType->second.inst->words[2]);
|
auto elementType = find(resultType->second.inst->words[2]);
|
||||||
spvCheck(!found(elementType), assert(0 && "Unreachable!"));
|
spvCheck(!found(elementType), assert(0 && "Unreachable!"));
|
||||||
auto length = find(resultType->second.inst->words[3]);
|
auto length = find(resultType->second.inst->words[3]);
|
||||||
@ -729,7 +729,7 @@ bool idUsage::isValid<OpConstantComposite>(const spv_instruction_t *inst,
|
|||||||
return false);
|
return false);
|
||||||
}
|
}
|
||||||
} break;
|
} break;
|
||||||
case OpTypeStruct: {
|
case SpvOpTypeStruct: {
|
||||||
uint32_t memberCount = resultType->second.inst->words.size() - 2;
|
uint32_t memberCount = resultType->second.inst->words.size() - 2;
|
||||||
spvCheck(memberCount != constituentCount,
|
spvCheck(memberCount != constituentCount,
|
||||||
DIAG(resultTypeIndex)
|
DIAG(resultTypeIndex)
|
||||||
@ -773,8 +773,8 @@ bool idUsage::isValid<OpConstantComposite>(const spv_instruction_t *inst,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
bool idUsage::isValid<OpConstantSampler>(const spv_instruction_t *inst,
|
bool idUsage::isValid<SpvOpConstantSampler>(const spv_instruction_t *inst,
|
||||||
const spv_opcode_desc) {
|
const spv_opcode_desc) {
|
||||||
auto resultTypeIndex = 1;
|
auto resultTypeIndex = 1;
|
||||||
auto resultType = find(inst->words[resultTypeIndex]);
|
auto resultType = find(inst->words[resultTypeIndex]);
|
||||||
spvCheck(!found(resultType), DIAG(resultTypeIndex)
|
spvCheck(!found(resultType), DIAG(resultTypeIndex)
|
||||||
@ -782,7 +782,7 @@ bool idUsage::isValid<OpConstantSampler>(const spv_instruction_t *inst,
|
|||||||
<< inst->words[resultTypeIndex]
|
<< inst->words[resultTypeIndex]
|
||||||
<< "' is not defined.";
|
<< "' is not defined.";
|
||||||
return false);
|
return false);
|
||||||
spvCheck(OpTypeSampler != resultType->second.opcode,
|
spvCheck(SpvOpTypeSampler != resultType->second.opcode,
|
||||||
DIAG(resultTypeIndex) << "OpConstantSampler Result Type <id> '"
|
DIAG(resultTypeIndex) << "OpConstantSampler Result Type <id> '"
|
||||||
<< inst->words[resultTypeIndex]
|
<< inst->words[resultTypeIndex]
|
||||||
<< "' is not a sampler type.";
|
<< "' is not a sampler type.";
|
||||||
@ -791,8 +791,8 @@ bool idUsage::isValid<OpConstantSampler>(const spv_instruction_t *inst,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
bool idUsage::isValid<OpConstantNull>(const spv_instruction_t *inst,
|
bool idUsage::isValid<SpvOpConstantNull>(const spv_instruction_t *inst,
|
||||||
const spv_opcode_desc) {
|
const spv_opcode_desc) {
|
||||||
auto resultTypeIndex = 1;
|
auto resultTypeIndex = 1;
|
||||||
auto resultType = find(inst->words[resultTypeIndex]);
|
auto resultType = find(inst->words[resultTypeIndex]);
|
||||||
spvCheck(!found(resultType), DIAG(resultTypeIndex)
|
spvCheck(!found(resultType), DIAG(resultTypeIndex)
|
||||||
@ -808,7 +808,7 @@ bool idUsage::isValid<OpConstantNull>(const spv_instruction_t *inst,
|
|||||||
<< "' can not be null.";
|
<< "' can not be null.";
|
||||||
return false);
|
return false);
|
||||||
} break;
|
} break;
|
||||||
case OpTypeVector: {
|
case SpvOpTypeVector: {
|
||||||
auto type = find(resultType->second.inst->words[2]);
|
auto type = find(resultType->second.inst->words[2]);
|
||||||
spvCheck(!found(type), assert(0 && "Unreachable!"));
|
spvCheck(!found(type), assert(0 && "Unreachable!"));
|
||||||
spvCheck(!spvOpcodeIsBasicTypeNullable(type->second.inst->opcode),
|
spvCheck(!spvOpcodeIsBasicTypeNullable(type->second.inst->opcode),
|
||||||
@ -818,7 +818,7 @@ bool idUsage::isValid<OpConstantNull>(const spv_instruction_t *inst,
|
|||||||
<< "'s vector component type can not be null.";
|
<< "'s vector component type can not be null.";
|
||||||
return false);
|
return false);
|
||||||
} break;
|
} break;
|
||||||
case OpTypeArray: {
|
case SpvOpTypeArray: {
|
||||||
auto type = find(resultType->second.inst->words[2]);
|
auto type = find(resultType->second.inst->words[2]);
|
||||||
spvCheck(!found(type), assert(0 && "Unreachable!"));
|
spvCheck(!found(type), assert(0 && "Unreachable!"));
|
||||||
spvCheck(!spvOpcodeIsBasicTypeNullable(type->second.inst->opcode),
|
spvCheck(!spvOpcodeIsBasicTypeNullable(type->second.inst->opcode),
|
||||||
@ -828,7 +828,7 @@ bool idUsage::isValid<OpConstantNull>(const spv_instruction_t *inst,
|
|||||||
<< "'s array element type can not be null.";
|
<< "'s array element type can not be null.";
|
||||||
return false);
|
return false);
|
||||||
} break;
|
} break;
|
||||||
case OpTypeMatrix: {
|
case SpvOpTypeMatrix: {
|
||||||
auto columnType = find(resultType->second.inst->words[2]);
|
auto columnType = find(resultType->second.inst->words[2]);
|
||||||
spvCheck(!found(columnType), assert(0 && "Unreachable!"));
|
spvCheck(!found(columnType), assert(0 && "Unreachable!"));
|
||||||
auto type = find(columnType->second.inst->words[2]);
|
auto type = find(columnType->second.inst->words[2]);
|
||||||
@ -840,7 +840,7 @@ bool idUsage::isValid<OpConstantNull>(const spv_instruction_t *inst,
|
|||||||
<< "'s matrix component type cna not be null.";
|
<< "'s matrix component type cna not be null.";
|
||||||
return false);
|
return false);
|
||||||
} break;
|
} break;
|
||||||
case OpTypeStruct: {
|
case SpvOpTypeStruct: {
|
||||||
for (size_t elementIndex = 2;
|
for (size_t elementIndex = 2;
|
||||||
elementIndex < resultType->second.inst->words.size(); ++elementIndex) {
|
elementIndex < resultType->second.inst->words.size(); ++elementIndex) {
|
||||||
auto element = find(resultType->second.inst->words[elementIndex]);
|
auto element = find(resultType->second.inst->words[elementIndex]);
|
||||||
@ -858,8 +858,8 @@ bool idUsage::isValid<OpConstantNull>(const spv_instruction_t *inst,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
bool idUsage::isValid<OpSpecConstantTrue>(const spv_instruction_t *inst,
|
bool idUsage::isValid<SpvOpSpecConstantTrue>(const spv_instruction_t *inst,
|
||||||
const spv_opcode_desc) {
|
const spv_opcode_desc) {
|
||||||
auto resultTypeIndex = 1;
|
auto resultTypeIndex = 1;
|
||||||
auto resultType = find(inst->words[resultTypeIndex]);
|
auto resultType = find(inst->words[resultTypeIndex]);
|
||||||
spvCheck(!found(resultType), DIAG(resultTypeIndex)
|
spvCheck(!found(resultType), DIAG(resultTypeIndex)
|
||||||
@ -867,7 +867,7 @@ bool idUsage::isValid<OpSpecConstantTrue>(const spv_instruction_t *inst,
|
|||||||
<< inst->words[resultTypeIndex]
|
<< inst->words[resultTypeIndex]
|
||||||
<< "' is not defined.";
|
<< "' is not defined.";
|
||||||
return false);
|
return false);
|
||||||
spvCheck(OpTypeBool != resultType->second.opcode,
|
spvCheck(SpvOpTypeBool != resultType->second.opcode,
|
||||||
DIAG(resultTypeIndex) << "OpSpecConstantTrue Result Type <id> '"
|
DIAG(resultTypeIndex) << "OpSpecConstantTrue Result Type <id> '"
|
||||||
<< inst->words[resultTypeIndex]
|
<< inst->words[resultTypeIndex]
|
||||||
<< "' is not a boolean type.";
|
<< "' is not a boolean type.";
|
||||||
@ -876,8 +876,8 @@ bool idUsage::isValid<OpSpecConstantTrue>(const spv_instruction_t *inst,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
bool idUsage::isValid<OpSpecConstantFalse>(const spv_instruction_t *inst,
|
bool idUsage::isValid<SpvOpSpecConstantFalse>(const spv_instruction_t *inst,
|
||||||
const spv_opcode_desc) {
|
const spv_opcode_desc) {
|
||||||
auto resultTypeIndex = 1;
|
auto resultTypeIndex = 1;
|
||||||
auto resultType = find(inst->words[resultTypeIndex]);
|
auto resultType = find(inst->words[resultTypeIndex]);
|
||||||
spvCheck(!found(resultType), DIAG(resultTypeIndex)
|
spvCheck(!found(resultType), DIAG(resultTypeIndex)
|
||||||
@ -885,7 +885,7 @@ bool idUsage::isValid<OpSpecConstantFalse>(const spv_instruction_t *inst,
|
|||||||
<< inst->words[resultTypeIndex]
|
<< inst->words[resultTypeIndex]
|
||||||
<< "' is not defined.";
|
<< "' is not defined.";
|
||||||
return false);
|
return false);
|
||||||
spvCheck(OpTypeBool != resultType->second.opcode,
|
spvCheck(SpvOpTypeBool != resultType->second.opcode,
|
||||||
DIAG(resultTypeIndex) << "OpSpecConstantFalse Result Type <id> '"
|
DIAG(resultTypeIndex) << "OpSpecConstantFalse Result Type <id> '"
|
||||||
<< inst->words[resultTypeIndex]
|
<< inst->words[resultTypeIndex]
|
||||||
<< "' is not a boolean type.";
|
<< "' is not a boolean type.";
|
||||||
@ -894,8 +894,8 @@ bool idUsage::isValid<OpSpecConstantFalse>(const spv_instruction_t *inst,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
bool idUsage::isValid<OpSpecConstant>(const spv_instruction_t *inst,
|
bool idUsage::isValid<SpvOpSpecConstant>(const spv_instruction_t *inst,
|
||||||
const spv_opcode_desc) {
|
const spv_opcode_desc) {
|
||||||
auto resultTypeIndex = 1;
|
auto resultTypeIndex = 1;
|
||||||
auto resultType = find(inst->words[resultTypeIndex]);
|
auto resultType = find(inst->words[resultTypeIndex]);
|
||||||
spvCheck(!found(resultType), DIAG(resultTypeIndex)
|
spvCheck(!found(resultType), DIAG(resultTypeIndex)
|
||||||
@ -913,18 +913,18 @@ bool idUsage::isValid<OpSpecConstant>(const spv_instruction_t *inst,
|
|||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
template <>
|
template <>
|
||||||
bool idUsage::isValid<OpSpecConstantComposite>(
|
bool idUsage::isValid<SpvOpSpecConstantComposite>(
|
||||||
const spv_instruction_t *inst, const spv_opcode_desc opcodeEntry) {}
|
const spv_instruction_t *inst, const spv_opcode_desc opcodeEntry) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
template <>
|
template <>
|
||||||
bool idUsage::isValid<OpSpecConstantOp>(const spv_instruction_t *inst) {}
|
bool idUsage::isValid<SpvOpSpecConstantOp>(const spv_instruction_t *inst) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
bool idUsage::isValid<OpVariable>(const spv_instruction_t *inst,
|
bool idUsage::isValid<SpvOpVariable>(const spv_instruction_t *inst,
|
||||||
const spv_opcode_desc opcodeEntry) {
|
const spv_opcode_desc opcodeEntry) {
|
||||||
auto resultTypeIndex = 1;
|
auto resultTypeIndex = 1;
|
||||||
auto resultType = find(inst->words[resultTypeIndex]);
|
auto resultType = find(inst->words[resultTypeIndex]);
|
||||||
spvCheck(!found(resultType), DIAG(resultTypeIndex)
|
spvCheck(!found(resultType), DIAG(resultTypeIndex)
|
||||||
@ -932,7 +932,7 @@ bool idUsage::isValid<OpVariable>(const spv_instruction_t *inst,
|
|||||||
<< inst->words[resultTypeIndex]
|
<< inst->words[resultTypeIndex]
|
||||||
<< "' is not defined.";
|
<< "' is not defined.";
|
||||||
return false);
|
return false);
|
||||||
spvCheck(OpTypePointer != resultType->second.opcode,
|
spvCheck(SpvOpTypePointer != resultType->second.opcode,
|
||||||
DIAG(resultTypeIndex) << "OpVariable Result Type <id> '"
|
DIAG(resultTypeIndex) << "OpVariable Result Type <id> '"
|
||||||
<< inst->words[resultTypeIndex]
|
<< inst->words[resultTypeIndex]
|
||||||
<< "' is not a pointer type.";
|
<< "' is not a pointer type.";
|
||||||
@ -955,8 +955,8 @@ bool idUsage::isValid<OpVariable>(const spv_instruction_t *inst,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
bool idUsage::isValid<OpLoad>(const spv_instruction_t *inst,
|
bool idUsage::isValid<SpvOpLoad>(const spv_instruction_t *inst,
|
||||||
const spv_opcode_desc) {
|
const spv_opcode_desc) {
|
||||||
auto resultTypeIndex = 1;
|
auto resultTypeIndex = 1;
|
||||||
auto resultType = find(inst->words[resultTypeIndex]);
|
auto resultType = find(inst->words[resultTypeIndex]);
|
||||||
spvCheck(!found(resultType), DIAG(resultTypeIndex)
|
spvCheck(!found(resultType), DIAG(resultTypeIndex)
|
||||||
@ -987,8 +987,8 @@ bool idUsage::isValid<OpLoad>(const spv_instruction_t *inst,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
bool idUsage::isValid<OpStore>(const spv_instruction_t *inst,
|
bool idUsage::isValid<SpvOpStore>(const spv_instruction_t *inst,
|
||||||
const spv_opcode_desc) {
|
const spv_opcode_desc) {
|
||||||
auto pointerIndex = 1;
|
auto pointerIndex = 1;
|
||||||
auto pointer = find(inst->words[pointerIndex]);
|
auto pointer = find(inst->words[pointerIndex]);
|
||||||
spvCheck(!found(pointer), DIAG(pointerIndex) << "OpStore Pointer <id> '"
|
spvCheck(!found(pointer), DIAG(pointerIndex) << "OpStore Pointer <id> '"
|
||||||
@ -1004,7 +1004,7 @@ bool idUsage::isValid<OpStore>(const spv_instruction_t *inst,
|
|||||||
spvCheck(!found(pointerType), assert(0 && "Unreachable!"));
|
spvCheck(!found(pointerType), assert(0 && "Unreachable!"));
|
||||||
auto type = find(pointerType->second.inst->words[3]);
|
auto type = find(pointerType->second.inst->words[3]);
|
||||||
spvCheck(!found(type), assert(0 && "Unreachable!"));
|
spvCheck(!found(type), assert(0 && "Unreachable!"));
|
||||||
spvCheck(OpTypeVoid == type->second.opcode, DIAG(pointerIndex)
|
spvCheck(SpvOpTypeVoid == type->second.opcode, DIAG(pointerIndex)
|
||||||
<< "OpStore Pointer <id> '"
|
<< "OpStore Pointer <id> '"
|
||||||
<< inst->words[pointerIndex]
|
<< inst->words[pointerIndex]
|
||||||
<< "'s type is void.";
|
<< "'s type is void.";
|
||||||
@ -1023,7 +1023,7 @@ bool idUsage::isValid<OpStore>(const spv_instruction_t *inst,
|
|||||||
return false);
|
return false);
|
||||||
auto objectType = find(object->second.inst->words[1]);
|
auto objectType = find(object->second.inst->words[1]);
|
||||||
spvCheck(!found(objectType), assert(0 && "Unreachable!"));
|
spvCheck(!found(objectType), assert(0 && "Unreachable!"));
|
||||||
spvCheck(OpTypeVoid == objectType->second.opcode,
|
spvCheck(SpvOpTypeVoid == objectType->second.opcode,
|
||||||
DIAG(objectIndex) << "OpStore Object <id> '"
|
DIAG(objectIndex) << "OpStore Object <id> '"
|
||||||
<< inst->words[objectIndex] << "'s type is void.";
|
<< inst->words[objectIndex] << "'s type is void.";
|
||||||
return false);
|
return false);
|
||||||
@ -1038,8 +1038,8 @@ bool idUsage::isValid<OpStore>(const spv_instruction_t *inst,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
bool idUsage::isValid<OpCopyMemory>(const spv_instruction_t *inst,
|
bool idUsage::isValid<SpvOpCopyMemory>(const spv_instruction_t *inst,
|
||||||
const spv_opcode_desc) {
|
const spv_opcode_desc) {
|
||||||
auto targetIndex = 1;
|
auto targetIndex = 1;
|
||||||
auto target = find(inst->words[targetIndex]);
|
auto target = find(inst->words[targetIndex]);
|
||||||
spvCheck(!found(target), DIAG(targetIndex) << "OpCopyMemory Target <id> '"
|
spvCheck(!found(target), DIAG(targetIndex) << "OpCopyMemory Target <id> '"
|
||||||
@ -1071,8 +1071,8 @@ bool idUsage::isValid<OpCopyMemory>(const spv_instruction_t *inst,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
bool idUsage::isValid<OpCopyMemorySized>(const spv_instruction_t *inst,
|
bool idUsage::isValid<SpvOpCopyMemorySized>(const spv_instruction_t *inst,
|
||||||
const spv_opcode_desc) {
|
const spv_opcode_desc) {
|
||||||
auto targetIndex = 1;
|
auto targetIndex = 1;
|
||||||
auto target = find(inst->words[targetIndex]);
|
auto target = find(inst->words[targetIndex]);
|
||||||
spvCheck(!found(target),
|
spvCheck(!found(target),
|
||||||
@ -1093,14 +1093,14 @@ bool idUsage::isValid<OpCopyMemorySized>(const spv_instruction_t *inst,
|
|||||||
return false);
|
return false);
|
||||||
auto targetPointerType = find(target->second.inst->words[1]);
|
auto targetPointerType = find(target->second.inst->words[1]);
|
||||||
spvCheck(!found(targetPointerType), assert(0 && "Unreachable!"));
|
spvCheck(!found(targetPointerType), assert(0 && "Unreachable!"));
|
||||||
spvCheck(OpTypePointer != targetPointerType->second.opcode,
|
spvCheck(SpvOpTypePointer != targetPointerType->second.opcode,
|
||||||
DIAG(targetIndex) << "OpCopyMemorySized Target <id> '"
|
DIAG(targetIndex) << "OpCopyMemorySized Target <id> '"
|
||||||
<< inst->words[targetIndex]
|
<< inst->words[targetIndex]
|
||||||
<< "' is not a pointer.";
|
<< "' is not a pointer.";
|
||||||
return false);
|
return false);
|
||||||
auto sourcePointerType = find(source->second.inst->words[1]);
|
auto sourcePointerType = find(source->second.inst->words[1]);
|
||||||
spvCheck(!found(sourcePointerType), assert(0 && "Unreachable!"));
|
spvCheck(!found(sourcePointerType), assert(0 && "Unreachable!"));
|
||||||
spvCheck(OpTypePointer != sourcePointerType->second.opcode,
|
spvCheck(SpvOpTypePointer != sourcePointerType->second.opcode,
|
||||||
DIAG(sourceIndex) << "OpCopyMemorySized Source <id> '"
|
DIAG(sourceIndex) << "OpCopyMemorySized Source <id> '"
|
||||||
<< inst->words[sourceIndex]
|
<< inst->words[sourceIndex]
|
||||||
<< "' is not a pointer.";
|
<< "' is not a pointer.";
|
||||||
@ -1109,22 +1109,22 @@ bool idUsage::isValid<OpCopyMemorySized>(const spv_instruction_t *inst,
|
|||||||
// TODO: The following opcode's are assumed to be valid, refer to the
|
// TODO: The following opcode's are assumed to be valid, refer to the
|
||||||
// following bug https://cvs.khronos.org/bugzilla/show_bug.cgi?id=13871 for
|
// following bug https://cvs.khronos.org/bugzilla/show_bug.cgi?id=13871 for
|
||||||
// clarification
|
// clarification
|
||||||
case OpConstant:
|
case SpvOpConstant:
|
||||||
case OpSpecConstant: {
|
case SpvOpSpecConstant: {
|
||||||
auto sizeType = find(size->second.inst->words[1]);
|
auto sizeType = find(size->second.inst->words[1]);
|
||||||
spvCheck(!found(sizeType), assert(0 && "Unreachable!"));
|
spvCheck(!found(sizeType), assert(0 && "Unreachable!"));
|
||||||
spvCheck(OpTypeInt != sizeType->second.opcode,
|
spvCheck(SpvOpTypeInt != sizeType->second.opcode,
|
||||||
DIAG(sizeIndex) << "OpCopyMemorySized Size <id> '"
|
DIAG(sizeIndex) << "OpCopyMemorySized Size <id> '"
|
||||||
<< inst->words[sizeIndex]
|
<< inst->words[sizeIndex]
|
||||||
<< "'s type is not an integer type.";
|
<< "'s type is not an integer type.";
|
||||||
return false);
|
return false);
|
||||||
} break;
|
} break;
|
||||||
case OpVariable: {
|
case SpvOpVariable: {
|
||||||
auto pointerType = find(size->second.inst->words[1]);
|
auto pointerType = find(size->second.inst->words[1]);
|
||||||
spvCheck(!found(pointerType), assert(0 && "Unreachable!"));
|
spvCheck(!found(pointerType), assert(0 && "Unreachable!"));
|
||||||
auto sizeType = find(pointerType->second.inst->words[1]);
|
auto sizeType = find(pointerType->second.inst->words[1]);
|
||||||
spvCheck(!found(sizeType), assert(0 && "Unreachable!"));
|
spvCheck(!found(sizeType), assert(0 && "Unreachable!"));
|
||||||
spvCheck(OpTypeInt != sizeType->second.opcode,
|
spvCheck(SpvOpTypeInt != sizeType->second.opcode,
|
||||||
DIAG(sizeIndex) << "OpCopyMemorySized Size <id> '"
|
DIAG(sizeIndex) << "OpCopyMemorySized Size <id> '"
|
||||||
<< inst->words[sizeIndex]
|
<< inst->words[sizeIndex]
|
||||||
<< "'s variable type is not an integer type.";
|
<< "'s variable type is not an integer type.";
|
||||||
@ -1143,37 +1143,37 @@ bool idUsage::isValid<OpCopyMemorySized>(const spv_instruction_t *inst,
|
|||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
template <>
|
template <>
|
||||||
bool idUsage::isValid<OpAccessChain>(const spv_instruction_t *inst,
|
bool idUsage::isValid<SpvOpAccessChain>(const spv_instruction_t *inst,
|
||||||
const spv_opcode_desc opcodeEntry) {}
|
const spv_opcode_desc opcodeEntry) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
template <>
|
template <>
|
||||||
bool idUsage::isValid<OpInBoundsAccessChain>(
|
bool idUsage::isValid<SpvOpInBoundsAccessChain>(
|
||||||
const spv_instruction_t *inst, const spv_opcode_desc opcodeEntry) {}
|
const spv_instruction_t *inst, const spv_opcode_desc opcodeEntry) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
template <>
|
template <>
|
||||||
bool idUsage::isValid<OpArrayLength>(const spv_instruction_t *inst,
|
bool idUsage::isValid<SpvOpArrayLength>(const spv_instruction_t *inst,
|
||||||
const spv_opcode_desc opcodeEntry) {}
|
const spv_opcode_desc opcodeEntry) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
template <>
|
template <>
|
||||||
bool idUsage::isValid<OpImagePointer>(const spv_instruction_t *inst,
|
bool idUsage::isValid<SpvOpImagePointer>(const spv_instruction_t *inst,
|
||||||
const spv_opcode_desc opcodeEntry) {}
|
const spv_opcode_desc opcodeEntry) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
template <>
|
template <>
|
||||||
bool idUsage::isValid<OpGenericPtrMemSemantics>(
|
bool idUsage::isValid<SpvOpGenericPtrMemSemantics>(
|
||||||
const spv_instruction_t *inst, const spv_opcode_desc opcodeEntry) {}
|
const spv_instruction_t *inst, const spv_opcode_desc opcodeEntry) {}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
bool idUsage::isValid<OpFunction>(const spv_instruction_t *inst,
|
bool idUsage::isValid<SpvOpFunction>(const spv_instruction_t *inst,
|
||||||
const spv_opcode_desc) {
|
const spv_opcode_desc) {
|
||||||
auto resultTypeIndex = 1;
|
auto resultTypeIndex = 1;
|
||||||
auto resultType = find(inst->words[resultTypeIndex]);
|
auto resultType = find(inst->words[resultTypeIndex]);
|
||||||
spvCheck(!found(resultType), DIAG(resultTypeIndex)
|
spvCheck(!found(resultType), DIAG(resultTypeIndex)
|
||||||
@ -1188,7 +1188,7 @@ bool idUsage::isValid<OpFunction>(const spv_instruction_t *inst,
|
|||||||
<< inst->words[functionTypeIndex]
|
<< inst->words[functionTypeIndex]
|
||||||
<< "' is not defined.";
|
<< "' is not defined.";
|
||||||
return false);
|
return false);
|
||||||
spvCheck(OpTypeFunction != functionType->second.opcode,
|
spvCheck(SpvOpTypeFunction != functionType->second.opcode,
|
||||||
DIAG(functionTypeIndex) << "OpFunction Function Type <id> '"
|
DIAG(functionTypeIndex) << "OpFunction Function Type <id> '"
|
||||||
<< inst->words[functionTypeIndex]
|
<< inst->words[functionTypeIndex]
|
||||||
<< "' is not a function type.";
|
<< "' is not a function type.";
|
||||||
@ -1205,8 +1205,8 @@ bool idUsage::isValid<OpFunction>(const spv_instruction_t *inst,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
bool idUsage::isValid<OpFunctionParameter>(const spv_instruction_t *inst,
|
bool idUsage::isValid<SpvOpFunctionParameter>(const spv_instruction_t *inst,
|
||||||
const spv_opcode_desc) {
|
const spv_opcode_desc) {
|
||||||
auto resultTypeIndex = 1;
|
auto resultTypeIndex = 1;
|
||||||
auto resultType = find(inst->words[resultTypeIndex]);
|
auto resultType = find(inst->words[resultTypeIndex]);
|
||||||
spvCheck(!found(resultType), DIAG(resultTypeIndex)
|
spvCheck(!found(resultType), DIAG(resultTypeIndex)
|
||||||
@ -1218,12 +1218,12 @@ bool idUsage::isValid<OpFunctionParameter>(const spv_instruction_t *inst,
|
|||||||
// NOTE: Find OpFunction & ensure OpFunctionParameter is not out of place.
|
// NOTE: Find OpFunction & ensure OpFunctionParameter is not out of place.
|
||||||
size_t paramIndex = 0;
|
size_t paramIndex = 0;
|
||||||
while (firstInst != function) {
|
while (firstInst != function) {
|
||||||
spvCheck(OpFunction != function->opcode &&
|
spvCheck(SpvOpFunction != function->opcode &&
|
||||||
OpFunctionParameter != function->opcode,
|
SpvOpFunctionParameter != function->opcode,
|
||||||
DIAG(0) << "OpFunctionParameter is not preceded by OpFunction or "
|
DIAG(0) << "OpFunctionParameter is not preceded by OpFunction or "
|
||||||
"OpFunctionParameter sequence.";
|
"OpFunctionParameter sequence.";
|
||||||
return false);
|
return false);
|
||||||
if (OpFunction == function->opcode) {
|
if (SpvOpFunction == function->opcode) {
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
paramIndex++;
|
paramIndex++;
|
||||||
@ -1244,8 +1244,8 @@ bool idUsage::isValid<OpFunctionParameter>(const spv_instruction_t *inst,
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
bool idUsage::isValid<OpFunctionCall>(const spv_instruction_t *inst,
|
bool idUsage::isValid<SpvOpFunctionCall>(const spv_instruction_t *inst,
|
||||||
const spv_opcode_desc) {
|
const spv_opcode_desc) {
|
||||||
auto resultTypeIndex = 1;
|
auto resultTypeIndex = 1;
|
||||||
auto resultType = find(inst->words[resultTypeIndex]);
|
auto resultType = find(inst->words[resultTypeIndex]);
|
||||||
spvCheck(!found(resultType), DIAG(resultTypeIndex)
|
spvCheck(!found(resultType), DIAG(resultTypeIndex)
|
||||||
@ -1260,7 +1260,7 @@ bool idUsage::isValid<OpFunctionCall>(const spv_instruction_t *inst,
|
|||||||
<< inst->words[functionIndex]
|
<< inst->words[functionIndex]
|
||||||
<< "' is not defined.";
|
<< "' is not defined.";
|
||||||
return false);
|
return false);
|
||||||
spvCheck(OpFunction != function->second.opcode,
|
spvCheck(SpvOpFunction != function->second.opcode,
|
||||||
DIAG(functionIndex) << "OpFunctionCall Function <id> '"
|
DIAG(functionIndex) << "OpFunctionCall Function <id> '"
|
||||||
<< inst->words[functionIndex]
|
<< inst->words[functionIndex]
|
||||||
<< "' is not a function.";
|
<< "' is not a function.";
|
||||||
@ -1935,8 +1935,8 @@ bool idUsage::isValid<OpSwitch>(const spv_instruction_t *inst,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
bool idUsage::isValid<OpReturnValue>(const spv_instruction_t *inst,
|
bool idUsage::isValid<SpvOpReturnValue>(const spv_instruction_t *inst,
|
||||||
const spv_opcode_desc) {
|
const spv_opcode_desc) {
|
||||||
auto valueIndex = 1;
|
auto valueIndex = 1;
|
||||||
auto value = find(inst->words[valueIndex]);
|
auto value = find(inst->words[valueIndex]);
|
||||||
spvCheck(!found(value), DIAG(valueIndex) << "OpReturnValue Value <id> '"
|
spvCheck(!found(value), DIAG(valueIndex) << "OpReturnValue Value <id> '"
|
||||||
@ -1953,15 +1953,15 @@ bool idUsage::isValid<OpReturnValue>(const spv_instruction_t *inst,
|
|||||||
// NOTE: Find OpFunction
|
// NOTE: Find OpFunction
|
||||||
const spv_instruction_t *function = inst - 1;
|
const spv_instruction_t *function = inst - 1;
|
||||||
while (firstInst != function) {
|
while (firstInst != function) {
|
||||||
spvCheck(OpFunction == function->opcode, break);
|
spvCheck(SpvOpFunction == function->opcode, break);
|
||||||
function--;
|
function--;
|
||||||
}
|
}
|
||||||
spvCheck(OpFunction != function->opcode,
|
spvCheck(SpvOpFunction != function->opcode,
|
||||||
DIAG(valueIndex) << "OpReturnValue is not in a basic block.";
|
DIAG(valueIndex) << "OpReturnValue is not in a basic block.";
|
||||||
return false);
|
return false);
|
||||||
auto returnType = find(function->words[1]);
|
auto returnType = find(function->words[1]);
|
||||||
spvCheck(!found(returnType), assert(0 && "Unreachable!"));
|
spvCheck(!found(returnType), assert(0 && "Unreachable!"));
|
||||||
if (OpTypePointer == valueType->second.opcode) {
|
if (SpvOpTypePointer == valueType->second.opcode) {
|
||||||
auto pointerValueType = find(valueType->second.inst->words[3]);
|
auto pointerValueType = find(valueType->second.inst->words[3]);
|
||||||
spvCheck(!found(pointerValueType), assert(0 && "Unreachable!"));
|
spvCheck(!found(pointerValueType), assert(0 && "Unreachable!"));
|
||||||
spvCheck(!spvOpcodeAreTypesEqual(returnType->second.inst,
|
spvCheck(!spvOpcodeAreTypesEqual(returnType->second.inst,
|
||||||
@ -2368,11 +2368,11 @@ bool idUsage::isValid(const spv_instruction_t *inst) {
|
|||||||
spv_opcode_desc opcodeEntry = nullptr;
|
spv_opcode_desc opcodeEntry = nullptr;
|
||||||
spvCheck(spvOpcodeTableValueLookup(opcodeTable, inst->opcode, &opcodeEntry),
|
spvCheck(spvOpcodeTableValueLookup(opcodeTable, inst->opcode, &opcodeEntry),
|
||||||
return false);
|
return false);
|
||||||
#define CASE(OpCode) \
|
#define CASE(OpCode) \
|
||||||
case OpCode: \
|
case Spv##OpCode: \
|
||||||
return isValid<OpCode>(inst, opcodeEntry);
|
return isValid<Spv##OpCode>(inst, opcodeEntry);
|
||||||
#define FAIL(OpCode) \
|
#define FAIL(OpCode) \
|
||||||
case OpCode: \
|
case Spv##OpCode: \
|
||||||
std::cerr << "Not implemented: " << #OpCode << "\n"; \
|
std::cerr << "Not implemented: " << #OpCode << "\n"; \
|
||||||
return false;
|
return false;
|
||||||
switch (inst->opcode) {
|
switch (inst->opcode) {
|
||||||
|
@ -157,15 +157,15 @@ TEST_P(BinaryToTextFail, EncodeSuccessfullyDecodeFailed) {
|
|||||||
INSTANTIATE_TEST_CASE_P(InvalidIds, BinaryToTextFail,
|
INSTANTIATE_TEST_CASE_P(InvalidIds, BinaryToTextFail,
|
||||||
::testing::ValuesIn(std::vector<FailedDecodeCase>{
|
::testing::ValuesIn(std::vector<FailedDecodeCase>{
|
||||||
{"%1 = OpTypeVoid",
|
{"%1 = OpTypeVoid",
|
||||||
spvtest::MakeInstruction(spv::OpTypeVoid, {1}),
|
spvtest::MakeInstruction(SpvOpTypeVoid, {1}),
|
||||||
"Id 1 is defined more than once"},
|
"Id 1 is defined more than once"},
|
||||||
{"%1 = OpTypeVoid\n"
|
{"%1 = OpTypeVoid\n"
|
||||||
"%2 = OpNot %1 %foo",
|
"%2 = OpNot %1 %foo",
|
||||||
spvtest::MakeInstruction(spv::OpNot, {1, 2, 3}),
|
spvtest::MakeInstruction(SpvOpNot, {1, 2, 3}),
|
||||||
"Id 2 is defined more than once"},
|
"Id 2 is defined more than once"},
|
||||||
{"%1 = OpTypeVoid\n"
|
{"%1 = OpTypeVoid\n"
|
||||||
"%2 = OpNot %1 %foo",
|
"%2 = OpNot %1 %foo",
|
||||||
spvtest::MakeInstruction(spv::OpNot, {1, 1, 3}),
|
spvtest::MakeInstruction(SpvOpNot, {1, 1, 3}),
|
||||||
"Id 1 is defined more than once"},
|
"Id 1 is defined more than once"},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -57,8 +57,8 @@ TEST_P(ExtInstOpenCLStdRoundTripTest, ParameterizedExtInst) {
|
|||||||
EXPECT_THAT(
|
EXPECT_THAT(
|
||||||
CompiledInstructions(input),
|
CompiledInstructions(input),
|
||||||
Eq(Concatenate(
|
Eq(Concatenate(
|
||||||
{MakeInstruction(spv::OpExtInstImport, {1}, MakeVector("OpenCL.std")),
|
{MakeInstruction(SpvOpExtInstImport, {1}, MakeVector("OpenCL.std")),
|
||||||
MakeInstruction(spv::OpExtInst, {2, 3, 1, GetParam().opcode},
|
MakeInstruction(SpvOpExtInst, {2, 3, 1, GetParam().opcode},
|
||||||
GetParam().expected_operands)})))
|
GetParam().expected_operands)})))
|
||||||
<< input;
|
<< input;
|
||||||
// Now check the round trip through the disassembler.
|
// Now check the round trip through the disassembler.
|
||||||
@ -92,7 +92,7 @@ TEST_P(ExtInstOpenCLStdRoundTripTest, ParameterizedExtInst) {
|
|||||||
#define CASE3Round(Enum, Name, Mode) \
|
#define CASE3Round(Enum, Name, Mode) \
|
||||||
{ \
|
{ \
|
||||||
uint32_t(OpenCLLIB::Entrypoints::Enum), #Name, "%4 %5 %6 " #Mode, { \
|
uint32_t(OpenCLLIB::Entrypoints::Enum), #Name, "%4 %5 %6 " #Mode, { \
|
||||||
4, 5, 6, uint32_t(spv::FPRoundingMode##Mode) \
|
4, 5, 6, uint32_t(SpvFPRoundingMode##Mode) \
|
||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -394,13 +394,13 @@ TEST_F(TextToBinaryTest, DISABLED_ExtInstFromTwoDifferentImports) {
|
|||||||
EXPECT_THAT(
|
EXPECT_THAT(
|
||||||
CompiledInstructions(input),
|
CompiledInstructions(input),
|
||||||
Eq(Concatenate({
|
Eq(Concatenate({
|
||||||
MakeInstruction(spv::OpExtInstImport, {1}, MakeVector("OpenCL.std")),
|
MakeInstruction(SpvOpExtInstImport, {1}, MakeVector("OpenCL.std")),
|
||||||
MakeInstruction(spv::OpExtInstImport, {2},
|
MakeInstruction(SpvOpExtInstImport, {2},
|
||||||
MakeVector("GLSL.std.450")),
|
MakeVector("GLSL.std.450")),
|
||||||
MakeInstruction(
|
MakeInstruction(
|
||||||
spv::OpExtInst,
|
SpvOpExtInst,
|
||||||
{3, 4, 1, uint32_t(OpenCLLIB::Entrypoints::Native_sqrt), 5}),
|
{3, 4, 1, uint32_t(OpenCLLIB::Entrypoints::Native_sqrt), 5}),
|
||||||
MakeInstruction(spv::OpExtInst,
|
MakeInstruction(SpvOpExtInst,
|
||||||
{6, 7, 2, uint32_t(GLSLstd450MatrixInverse), 8}),
|
{6, 7, 2, uint32_t(GLSLstd450MatrixInverse), 8}),
|
||||||
})));
|
})));
|
||||||
}
|
}
|
||||||
|
@ -72,34 +72,34 @@ using ImmediateIntTest = TextToBinaryTest;
|
|||||||
|
|
||||||
TEST_F(ImmediateIntTest, AnyWordInSimpleStatement) {
|
TEST_F(ImmediateIntTest, AnyWordInSimpleStatement) {
|
||||||
EXPECT_THAT(CompiledInstructions("!0x00040018 %a %b %123", kCAF),
|
EXPECT_THAT(CompiledInstructions("!0x00040018 %a %b %123", kCAF),
|
||||||
Eq(MakeInstruction(spv::OpTypeMatrix, {1, 2, 3})));
|
Eq(MakeInstruction(SpvOpTypeMatrix, {1, 2, 3})));
|
||||||
EXPECT_THAT(CompiledInstructions("OpTypeMatrix !1 %b %123", kCAF),
|
EXPECT_THAT(CompiledInstructions("OpTypeMatrix !1 %b %123", kCAF),
|
||||||
Eq(MakeInstruction(spv::OpTypeMatrix, {1, 1, 2})));
|
Eq(MakeInstruction(SpvOpTypeMatrix, {1, 1, 2})));
|
||||||
EXPECT_THAT(CompiledInstructions("OpTypeMatrix %1 !2 %123", kCAF),
|
EXPECT_THAT(CompiledInstructions("OpTypeMatrix %1 !2 %123", kCAF),
|
||||||
Eq(MakeInstruction(spv::OpTypeMatrix, {1, 2, 2})));
|
Eq(MakeInstruction(SpvOpTypeMatrix, {1, 2, 2})));
|
||||||
EXPECT_THAT(CompiledInstructions("OpTypeMatrix %a %b !123", kCAF),
|
EXPECT_THAT(CompiledInstructions("OpTypeMatrix %a %b !123", kCAF),
|
||||||
Eq(MakeInstruction(spv::OpTypeMatrix, {1, 2, 123})));
|
Eq(MakeInstruction(SpvOpTypeMatrix, {1, 2, 123})));
|
||||||
EXPECT_THAT(CompiledInstructions("!0x00040018 %1 !2 %123", kCAF),
|
EXPECT_THAT(CompiledInstructions("!0x00040018 %1 !2 %123", kCAF),
|
||||||
Eq(MakeInstruction(spv::OpTypeMatrix, {1, 2, 2})));
|
Eq(MakeInstruction(SpvOpTypeMatrix, {1, 2, 2})));
|
||||||
EXPECT_THAT(CompiledInstructions("OpTypeMatrix !1 %b !123", kCAF),
|
EXPECT_THAT(CompiledInstructions("OpTypeMatrix !1 %b !123", kCAF),
|
||||||
Eq(MakeInstruction(spv::OpTypeMatrix, {1, 1, 123})));
|
Eq(MakeInstruction(SpvOpTypeMatrix, {1, 1, 123})));
|
||||||
EXPECT_THAT(CompiledInstructions("!0x00040018 !1 !2 !123", kCAF),
|
EXPECT_THAT(CompiledInstructions("!0x00040018 !1 !2 !123", kCAF),
|
||||||
Eq(MakeInstruction(spv::OpTypeMatrix, {1, 2, 123})));
|
Eq(MakeInstruction(SpvOpTypeMatrix, {1, 2, 123})));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ImmediateIntTest, AnyWordAfterEqualsAndOpCode) {
|
TEST_F(ImmediateIntTest, AnyWordAfterEqualsAndOpCode) {
|
||||||
EXPECT_THAT(CompiledInstructions("%a = OpArrayLength !2 %c 123"),
|
EXPECT_THAT(CompiledInstructions("%a = OpArrayLength !2 %c 123"),
|
||||||
Eq(MakeInstruction(spv::OpArrayLength, {2, 1, 2, 123})));
|
Eq(MakeInstruction(SpvOpArrayLength, {2, 1, 2, 123})));
|
||||||
EXPECT_THAT(CompiledInstructions("%a = OpArrayLength %b !3 123"),
|
EXPECT_THAT(CompiledInstructions("%a = OpArrayLength %b !3 123"),
|
||||||
Eq(MakeInstruction(spv::OpArrayLength, {1, 2, 3, 123})));
|
Eq(MakeInstruction(SpvOpArrayLength, {1, 2, 3, 123})));
|
||||||
EXPECT_THAT(CompiledInstructions("%a = OpArrayLength %b %c !123"),
|
EXPECT_THAT(CompiledInstructions("%a = OpArrayLength %b %c !123"),
|
||||||
Eq(MakeInstruction(spv::OpArrayLength, {1, 2, 3, 123})));
|
Eq(MakeInstruction(SpvOpArrayLength, {1, 2, 3, 123})));
|
||||||
EXPECT_THAT(CompiledInstructions("%a = OpArrayLength %b !3 !123"),
|
EXPECT_THAT(CompiledInstructions("%a = OpArrayLength %b !3 !123"),
|
||||||
Eq(MakeInstruction(spv::OpArrayLength, {1, 2, 3, 123})));
|
Eq(MakeInstruction(SpvOpArrayLength, {1, 2, 3, 123})));
|
||||||
EXPECT_THAT(CompiledInstructions("%a = OpArrayLength !2 !3 123"),
|
EXPECT_THAT(CompiledInstructions("%a = OpArrayLength !2 !3 123"),
|
||||||
Eq(MakeInstruction(spv::OpArrayLength, {2, 1, 3, 123})));
|
Eq(MakeInstruction(SpvOpArrayLength, {2, 1, 3, 123})));
|
||||||
EXPECT_THAT(CompiledInstructions("%a = OpArrayLength !2 !3 !123"),
|
EXPECT_THAT(CompiledInstructions("%a = OpArrayLength !2 !3 !123"),
|
||||||
Eq(MakeInstruction(spv::OpArrayLength, {2, 1, 3, 123})));
|
Eq(MakeInstruction(SpvOpArrayLength, {2, 1, 3, 123})));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ImmediateIntTest, ResultIdInAssignment) {
|
TEST_F(ImmediateIntTest, ResultIdInAssignment) {
|
||||||
@ -123,8 +123,8 @@ TEST_F(ImmediateIntTest, IntegerFollowingImmediate) {
|
|||||||
// With !<integer>, we can (and can only) accept 32-bit number literals,
|
// With !<integer>, we can (and can only) accept 32-bit number literals,
|
||||||
// even when we declare the return type is 64-bit.
|
// even when we declare the return type is 64-bit.
|
||||||
EXPECT_EQ(Concatenate({
|
EXPECT_EQ(Concatenate({
|
||||||
MakeInstruction(OpTypeInt, {1, 64, 0}),
|
MakeInstruction(SpvOpTypeInt, {1, 64, 0}),
|
||||||
MakeInstruction(OpConstant, {1, 2, 4294967295}),
|
MakeInstruction(SpvOpConstant, {1, 2, 4294967295}),
|
||||||
}),
|
}),
|
||||||
CompiledInstructions("OpTypeInt %i64 64 0\n"
|
CompiledInstructions("OpTypeInt %i64 64 0\n"
|
||||||
"OpConstant %i64 !2 4294967295",
|
"OpConstant %i64 !2 4294967295",
|
||||||
@ -169,15 +169,15 @@ TEST_F(ImmediateIntTest, FloatFollowingImmediate) {
|
|||||||
CompiledInstructions("OpTypeFloat %1 32\nOpConstant %1 %2 -0.5", kCAF),
|
CompiledInstructions("OpTypeFloat %1 32\nOpConstant %1 %2 -0.5", kCAF),
|
||||||
CompiledInstructions("OpTypeFloat %1 32\n!0x0004002b %1 %2 -0.5", kCAF));
|
CompiledInstructions("OpTypeFloat %1 32\n!0x0004002b %1 %2 -0.5", kCAF));
|
||||||
|
|
||||||
EXPECT_EQ(
|
EXPECT_EQ(Concatenate({
|
||||||
Concatenate({
|
MakeInstruction(SpvOpTypeInt, {1, 64, 0}),
|
||||||
MakeInstruction(OpTypeInt, {1, 64, 0}),
|
MakeInstruction(SpvOpConstant, {1, 2, 0xb, 0xa}),
|
||||||
MakeInstruction(OpConstant, {1, 2, 0xb, 0xa}),
|
MakeInstruction(SpvOpSwitch,
|
||||||
MakeInstruction(OpSwitch, {2, 1234, BitwiseCast<uint32_t>(2.5f), 3}),
|
{2, 1234, BitwiseCast<uint32_t>(2.5f), 3}),
|
||||||
}),
|
}),
|
||||||
CompiledInstructions("%i64 = OpTypeInt 64 0\n"
|
CompiledInstructions("%i64 = OpTypeInt 64 0\n"
|
||||||
"%big = OpConstant %i64 0xa0000000b\n"
|
"%big = OpConstant %i64 0xa0000000b\n"
|
||||||
"OpSwitch %big !1234 2.5 %target\n"));
|
"OpSwitch %big !1234 2.5 %target\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Literal strings after !<integer> are handled correctly.
|
// Literal strings after !<integer> are handled correctly.
|
||||||
@ -193,7 +193,7 @@ TEST_F(ImmediateIntTest, StringFollowingImmediate) {
|
|||||||
CompiledInstructions("OpMemberName !1 !4 \"" + name + "\"", kCAF))
|
CompiledInstructions("OpMemberName !1 !4 \"" + name + "\"", kCAF))
|
||||||
<< name;
|
<< name;
|
||||||
const uint32_t wordCount = 4 + name.size() / 4;
|
const uint32_t wordCount = 4 + name.size() / 4;
|
||||||
const uint32_t firstWord = spvOpcodeMake(wordCount, spv::OpMemberName);
|
const uint32_t firstWord = spvOpcodeMake(wordCount, SpvOpMemberName);
|
||||||
EXPECT_EQ(original, CompiledInstructions("!" + std::to_string(firstWord) +
|
EXPECT_EQ(original, CompiledInstructions("!" + std::to_string(firstWord) +
|
||||||
" %10 !4 \"" + name + "\"",
|
" %10 !4 \"" + name + "\"",
|
||||||
kCAF))
|
kCAF))
|
||||||
@ -227,8 +227,8 @@ TEST_F(ImmediateIntTest, InvalidStatementBetweenValidOnes) {
|
|||||||
EXPECT_THAT(Subvector(CompileSuccessfully(
|
EXPECT_THAT(Subvector(CompileSuccessfully(
|
||||||
"OpTypeFloat %10 32 !5 !6 !7 OpEmitVertex", kCAF),
|
"OpTypeFloat %10 32 !5 !6 !7 OpEmitVertex", kCAF),
|
||||||
kFirstInstruction),
|
kFirstInstruction),
|
||||||
ElementsAre(spvOpcodeMake(3, spv::OpTypeFloat), 1, 32, 5, 6, 7,
|
ElementsAre(spvOpcodeMake(3, SpvOpTypeFloat), 1, 32, 5, 6, 7,
|
||||||
spvOpcodeMake(1, spv::OpEmitVertex)));
|
spvOpcodeMake(1, SpvOpEmitVertex)));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(ImmediateIntTest, NextOpcodeRecognized) {
|
TEST_F(ImmediateIntTest, NextOpcodeRecognized) {
|
||||||
|
@ -46,7 +46,7 @@ TEST(OpcodeMake, Samples) {
|
|||||||
uint32_t word = 0;
|
uint32_t word = 0;
|
||||||
word |= uint32_t(opcode);
|
word |= uint32_t(opcode);
|
||||||
word |= uint32_t(wordCount) << 16;
|
word |= uint32_t(wordCount) << 16;
|
||||||
EXPECT_EQ(word, spvOpcodeMake(wordCount, Op(opcode)));
|
EXPECT_EQ(word, spvOpcodeMake(wordCount, SpvOp(opcode)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,11 +28,11 @@
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
class Requires : public ::testing::TestWithParam<Capability> {
|
class Requires : public ::testing::TestWithParam<SpvCapability> {
|
||||||
public:
|
public:
|
||||||
Requires()
|
Requires()
|
||||||
: entry({nullptr,
|
: entry({nullptr,
|
||||||
(Op)0,
|
(SpvOp)0,
|
||||||
SPV_CAPABILITY_AS_MASK(GetParam()),
|
SPV_CAPABILITY_AS_MASK(GetParam()),
|
||||||
0,
|
0,
|
||||||
{},
|
{},
|
||||||
@ -51,41 +51,43 @@ TEST_P(Requires, Capabilityabilities) {
|
|||||||
ASSERT_NE(0, spvOpcodeRequiresCapabilities(&entry));
|
ASSERT_NE(0, spvOpcodeRequiresCapabilities(&entry));
|
||||||
}
|
}
|
||||||
|
|
||||||
INSTANTIATE_TEST_CASE_P(Op, Requires,
|
INSTANTIATE_TEST_CASE_P(
|
||||||
::testing::Values(CapabilityMatrix, CapabilityShader,
|
Op, Requires,
|
||||||
CapabilityGeometry,
|
::testing::Values(SpvCapabilityMatrix, SpvCapabilityShader,
|
||||||
CapabilityTessellation,
|
SpvCapabilityGeometry, SpvCapabilityTessellation,
|
||||||
CapabilityAddresses,
|
SpvCapabilityAddresses, SpvCapabilityLinkage,
|
||||||
CapabilityLinkage, CapabilityKernel,
|
SpvCapabilityKernel,
|
||||||
// ClipDistance has enum value 32.
|
// ClipDistance has enum value 32.
|
||||||
// So it tests that we are sensitive
|
// So it tests that we are sensitive
|
||||||
// to more than just the least
|
// to more than just the least
|
||||||
// significant 32 bits of the
|
// significant 32 bits of the
|
||||||
// capability mask.
|
// capability mask.
|
||||||
CapabilityClipDistance,
|
SpvCapabilityClipDistance,
|
||||||
// Transformfeedback has value 53,
|
// Transformfeedback has value 53,
|
||||||
// and is the last capability.
|
// and is the last capability.
|
||||||
CapabilityTransformFeedback));
|
SpvCapabilityTransformFeedback));
|
||||||
|
|
||||||
TEST(OpcodeRequiresCapability, None) {
|
TEST(OpcodeRequiresCapability, None) {
|
||||||
spv_opcode_desc_t entry = {
|
spv_opcode_desc_t entry = {nullptr, (SpvOp)0, 0, 0, {}, false, false, {}};
|
||||||
nullptr, (Op)0, 0, 0, {}, false, false, {}};
|
|
||||||
ASSERT_EQ(0, spvOpcodeRequiresCapabilities(&entry));
|
ASSERT_EQ(0, spvOpcodeRequiresCapabilities(&entry));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Test SPV_CAPBILITY_AS_MASK
|
/// Test SPV_CAPBILITY_AS_MASK
|
||||||
|
|
||||||
TEST(CapabilityAsMaskMacro, Sample) {
|
TEST(CapabilityAsMaskMacro, Sample) {
|
||||||
EXPECT_EQ(uint64_t(1), SPV_CAPABILITY_AS_MASK(spv::CapabilityMatrix));
|
EXPECT_EQ(uint64_t(1), SPV_CAPABILITY_AS_MASK(SpvCapabilityMatrix));
|
||||||
EXPECT_EQ(uint64_t(0x10000), SPV_CAPABILITY_AS_MASK(spv::CapabilityImageSRGBWrite));
|
EXPECT_EQ(uint64_t(0x10000),
|
||||||
EXPECT_EQ(uint64_t(0x100000000ULL), SPV_CAPABILITY_AS_MASK(spv::CapabilityClipDistance));
|
SPV_CAPABILITY_AS_MASK(SpvCapabilityImageSRGBWrite));
|
||||||
EXPECT_EQ(uint64_t(1) << 53, SPV_CAPABILITY_AS_MASK(spv::CapabilityTransformFeedback));
|
EXPECT_EQ(uint64_t(0x100000000ULL),
|
||||||
|
SPV_CAPABILITY_AS_MASK(SpvCapabilityClipDistance));
|
||||||
|
EXPECT_EQ(uint64_t(1) << 53,
|
||||||
|
SPV_CAPABILITY_AS_MASK(SpvCapabilityTransformFeedback));
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Capabilities required by an Opcode.
|
/// Capabilities required by an Opcode.
|
||||||
struct ExpectedOpCodeCapabilities {
|
struct ExpectedOpCodeCapabilities {
|
||||||
spv::Op opcode;
|
SpvOp opcode;
|
||||||
uint64_t capabilities; //< Bitfield of spv::Capability.
|
uint64_t capabilities; //< Bitfield of SpvCapability.
|
||||||
};
|
};
|
||||||
|
|
||||||
using OpcodeTableCapabilitiesTest =
|
using OpcodeTableCapabilitiesTest =
|
||||||
@ -100,11 +102,11 @@ TEST_P(OpcodeTableCapabilitiesTest, TableEntryMatchesExpectedCapabilities) {
|
|||||||
EXPECT_EQ(GetParam().capabilities, entry->capabilities);
|
EXPECT_EQ(GetParam().capabilities, entry->capabilities);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Translates a spv::Capability into a bitfield.
|
/// Translates a SpvCapability into a bitfield.
|
||||||
inline uint64_t mask(spv::Capability c) { return SPV_CAPABILITY_AS_MASK(c); }
|
inline uint64_t mask(SpvCapability c) { return SPV_CAPABILITY_AS_MASK(c); }
|
||||||
|
|
||||||
/// Combines two spv::Capabilities into a bitfield.
|
/// Combines two SpvCapabilities into a bitfield.
|
||||||
inline uint64_t mask(spv::Capability c1, spv::Capability c2) {
|
inline uint64_t mask(SpvCapability c1, SpvCapability c2) {
|
||||||
return SPV_CAPABILITY_AS_MASK(c1) | SPV_CAPABILITY_AS_MASK(c2);
|
return SPV_CAPABILITY_AS_MASK(c1) | SPV_CAPABILITY_AS_MASK(c2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,24 +115,23 @@ INSTANTIATE_TEST_CASE_P(
|
|||||||
// Spot-check a few opcodes.
|
// Spot-check a few opcodes.
|
||||||
::testing::Values(
|
::testing::Values(
|
||||||
ExpectedOpCodeCapabilities{
|
ExpectedOpCodeCapabilities{
|
||||||
spv::OpImageQuerySize,
|
SpvOpImageQuerySize,
|
||||||
mask(spv::CapabilityKernel, spv::CapabilityImageQuery)},
|
mask(SpvCapabilityKernel, SpvCapabilityImageQuery)},
|
||||||
ExpectedOpCodeCapabilities{
|
ExpectedOpCodeCapabilities{
|
||||||
spv::OpImageQuerySizeLod,
|
SpvOpImageQuerySizeLod,
|
||||||
mask(spv::CapabilityKernel, spv::CapabilityImageQuery)},
|
mask(SpvCapabilityKernel, SpvCapabilityImageQuery)},
|
||||||
ExpectedOpCodeCapabilities{
|
ExpectedOpCodeCapabilities{
|
||||||
spv::OpImageQueryLevels,
|
SpvOpImageQueryLevels,
|
||||||
mask(spv::CapabilityKernel, spv::CapabilityImageQuery)},
|
mask(SpvCapabilityKernel, SpvCapabilityImageQuery)},
|
||||||
ExpectedOpCodeCapabilities{
|
ExpectedOpCodeCapabilities{
|
||||||
spv::OpImageQuerySamples,
|
SpvOpImageQuerySamples,
|
||||||
mask(spv::CapabilityKernel, spv::CapabilityImageQuery)},
|
mask(SpvCapabilityKernel, SpvCapabilityImageQuery)},
|
||||||
ExpectedOpCodeCapabilities{spv::OpImageSparseSampleImplicitLod,
|
ExpectedOpCodeCapabilities{SpvOpImageSparseSampleImplicitLod,
|
||||||
mask(spv::CapabilitySparseResidency)},
|
mask(SpvCapabilitySparseResidency)},
|
||||||
ExpectedOpCodeCapabilities{spv::OpCopyMemorySized,
|
ExpectedOpCodeCapabilities{SpvOpCopyMemorySized,
|
||||||
mask(spv::CapabilityAddresses)},
|
mask(SpvCapabilityAddresses)},
|
||||||
ExpectedOpCodeCapabilities{spv::OpArrayLength,
|
ExpectedOpCodeCapabilities{SpvOpArrayLength, mask(SpvCapabilityShader)},
|
||||||
mask(spv::CapabilityShader)},
|
ExpectedOpCodeCapabilities{SpvOpFunction, 0},
|
||||||
ExpectedOpCodeCapabilities{spv::OpFunction, 0},
|
ExpectedOpCodeCapabilities{SpvOpConvertFToS, 0}));
|
||||||
ExpectedOpCodeCapabilities{spv::OpConvertFToS, 0}));
|
|
||||||
|
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
@ -29,9 +29,9 @@
|
|||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
TEST(OpcodeSplit, Default) {
|
TEST(OpcodeSplit, Default) {
|
||||||
uint32_t word = spvOpcodeMake(42, (Op)23);
|
uint32_t word = spvOpcodeMake(42, (SpvOp)23);
|
||||||
uint16_t wordCount = 0;
|
uint16_t wordCount = 0;
|
||||||
Op opcode;
|
SpvOp opcode;
|
||||||
spvOpcodeSplit(word, &wordCount, &opcode);
|
spvOpcodeSplit(word, &wordCount, &opcode);
|
||||||
ASSERT_EQ(42, wordCount);
|
ASSERT_EQ(42, wordCount);
|
||||||
ASSERT_EQ(23, opcode);
|
ASSERT_EQ(23, opcode);
|
||||||
|
@ -50,17 +50,17 @@ TEST_P(EnumCapabilityTest, Sample) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define CASE0(TYPE, VALUE) \
|
#define CASE0(TYPE, VALUE) \
|
||||||
{ SPV_OPERAND_TYPE_##TYPE, uint32_t(spv::VALUE), 0 }
|
{ SPV_OPERAND_TYPE_##TYPE, uint32_t(Spv##VALUE), 0 }
|
||||||
#define CASE1(TYPE, VALUE, CAP) \
|
#define CASE1(TYPE, VALUE, CAP) \
|
||||||
{ \
|
{ \
|
||||||
SPV_OPERAND_TYPE_##TYPE, uint32_t(spv::VALUE), \
|
SPV_OPERAND_TYPE_##TYPE, uint32_t(Spv##VALUE), \
|
||||||
SPV_CAPABILITY_AS_MASK(spv::Capability##CAP) \
|
SPV_CAPABILITY_AS_MASK(SpvCapability##CAP) \
|
||||||
}
|
}
|
||||||
#define CASE2(TYPE, VALUE, CAP1, CAP2) \
|
#define CASE2(TYPE, VALUE, CAP1, CAP2) \
|
||||||
{ \
|
{ \
|
||||||
SPV_OPERAND_TYPE_##TYPE, uint32_t(spv::VALUE), \
|
SPV_OPERAND_TYPE_##TYPE, uint32_t(Spv##VALUE), \
|
||||||
(SPV_CAPABILITY_AS_MASK(spv::Capability##CAP1) | \
|
(SPV_CAPABILITY_AS_MASK(SpvCapability##CAP1) | \
|
||||||
SPV_CAPABILITY_AS_MASK(spv::Capability##CAP2)) \
|
SPV_CAPABILITY_AS_MASK(SpvCapability##CAP2)) \
|
||||||
}
|
}
|
||||||
|
|
||||||
// See SPIR-V Section 3.3 Execution Model
|
// See SPIR-V Section 3.3 Execution Model
|
||||||
|
@ -105,17 +105,17 @@ INSTANTIATE_TEST_CASE_P(
|
|||||||
{SUFFIX1}},
|
{SUFFIX1}},
|
||||||
// Volatile has no operands.
|
// Volatile has no operands.
|
||||||
{SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS,
|
{SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS,
|
||||||
spv::MemoryAccessVolatileMask,
|
SpvMemoryAccessVolatileMask,
|
||||||
{SUFFIX0},
|
{SUFFIX0},
|
||||||
{SUFFIX0}},
|
{SUFFIX0}},
|
||||||
// Aligned has one literal number operand.
|
// Aligned has one literal number operand.
|
||||||
{SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS,
|
{SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS,
|
||||||
spv::MemoryAccessAlignedMask,
|
SpvMemoryAccessAlignedMask,
|
||||||
{SUFFIX1},
|
{SUFFIX1},
|
||||||
{SPV_OPERAND_TYPE_LITERAL_INTEGER, SUFFIX1}},
|
{SPV_OPERAND_TYPE_LITERAL_INTEGER, SUFFIX1}},
|
||||||
// Volatile with Aligned still has just one literal number operand.
|
// Volatile with Aligned still has just one literal number operand.
|
||||||
{SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS,
|
{SPV_OPERAND_TYPE_OPTIONAL_MEMORY_ACCESS,
|
||||||
spv::MemoryAccessVolatileMask | spv::MemoryAccessAlignedMask,
|
SpvMemoryAccessVolatileMask | SpvMemoryAccessAlignedMask,
|
||||||
{SUFFIX1},
|
{SUFFIX1},
|
||||||
{SPV_OPERAND_TYPE_LITERAL_INTEGER, SUFFIX1}},
|
{SPV_OPERAND_TYPE_LITERAL_INTEGER, SUFFIX1}},
|
||||||
}));
|
}));
|
||||||
|
@ -45,7 +45,7 @@ using ::testing::Eq;
|
|||||||
// Test OpDecorate
|
// Test OpDecorate
|
||||||
|
|
||||||
using OpDecorateSimpleTest = spvtest::TextToBinaryTestBase<
|
using OpDecorateSimpleTest = spvtest::TextToBinaryTestBase<
|
||||||
::testing::TestWithParam<EnumCase<spv::Decoration>>>;
|
::testing::TestWithParam<EnumCase<SpvDecoration>>>;
|
||||||
|
|
||||||
TEST_P(OpDecorateSimpleTest, AnySimpleDecoration) {
|
TEST_P(OpDecorateSimpleTest, AnySimpleDecoration) {
|
||||||
// This string should assemble, but should not validate.
|
// This string should assemble, but should not validate.
|
||||||
@ -54,14 +54,14 @@ TEST_P(OpDecorateSimpleTest, AnySimpleDecoration) {
|
|||||||
for (auto operand : GetParam().operands()) input << " " << operand;
|
for (auto operand : GetParam().operands()) input << " " << operand;
|
||||||
EXPECT_THAT(
|
EXPECT_THAT(
|
||||||
CompiledInstructions(input.str()),
|
CompiledInstructions(input.str()),
|
||||||
Eq(MakeInstruction(spv::OpDecorate, {1, uint32_t(GetParam().value())},
|
Eq(MakeInstruction(SpvOpDecorate, {1, uint32_t(GetParam().value())},
|
||||||
GetParam().operands())));
|
GetParam().operands())));
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CASE(NAME) spv::Decoration##NAME, #NAME
|
#define CASE(NAME) SpvDecoration##NAME, #NAME
|
||||||
INSTANTIATE_TEST_CASE_P(
|
INSTANTIATE_TEST_CASE_P(
|
||||||
TextToBinaryDecorateSimple, OpDecorateSimpleTest,
|
TextToBinaryDecorateSimple, OpDecorateSimpleTest,
|
||||||
::testing::ValuesIn(std::vector<EnumCase<spv::Decoration>>{
|
::testing::ValuesIn(std::vector<EnumCase<SpvDecoration>>{
|
||||||
// The operand literal values are arbitrarily chosen,
|
// The operand literal values are arbitrarily chosen,
|
||||||
// but there are the right number of them.
|
// but there are the right number of them.
|
||||||
{CASE(RelaxedPrecision), {}},
|
{CASE(RelaxedPrecision), {}},
|
||||||
@ -129,14 +129,14 @@ TEST_P(OpDecorateEnumTest, AnyEnumDecoration) {
|
|||||||
const std::string input =
|
const std::string input =
|
||||||
"OpDecorate %1 " + GetParam().enum_name + " " + GetParam().name;
|
"OpDecorate %1 " + GetParam().enum_name + " " + GetParam().name;
|
||||||
EXPECT_THAT(CompiledInstructions(input),
|
EXPECT_THAT(CompiledInstructions(input),
|
||||||
Eq(MakeInstruction(spv::OpDecorate, {1, GetParam().enum_value,
|
Eq(MakeInstruction(SpvOpDecorate, {1, GetParam().enum_value,
|
||||||
GetParam().value})));
|
GetParam().value})));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test OpDecorate BuiltIn.
|
// Test OpDecorate BuiltIn.
|
||||||
// clang-format off
|
// clang-format off
|
||||||
#define CASE(NAME) \
|
#define CASE(NAME) \
|
||||||
{ spv::BuiltIn##NAME, #NAME, spv::DecorationBuiltIn, "BuiltIn" }
|
{ SpvBuiltIn##NAME, #NAME, SpvDecorationBuiltIn, "BuiltIn" }
|
||||||
INSTANTIATE_TEST_CASE_P(TextToBinaryDecorateBuiltIn, OpDecorateEnumTest,
|
INSTANTIATE_TEST_CASE_P(TextToBinaryDecorateBuiltIn, OpDecorateEnumTest,
|
||||||
::testing::ValuesIn(std::vector<DecorateEnumCase>{
|
::testing::ValuesIn(std::vector<DecorateEnumCase>{
|
||||||
CASE(Position),
|
CASE(Position),
|
||||||
@ -194,7 +194,7 @@ TEST_F(OpDecorateEnumTest, WrongBuiltIn) {
|
|||||||
// Test OpDecorate FuncParamAttr
|
// Test OpDecorate FuncParamAttr
|
||||||
// clang-format off
|
// clang-format off
|
||||||
#define CASE(NAME) \
|
#define CASE(NAME) \
|
||||||
{ spv::FunctionParameterAttribute##NAME, #NAME, spv::DecorationFuncParamAttr, "FuncParamAttr" }
|
{ SpvFunctionParameterAttribute##NAME, #NAME, SpvDecorationFuncParamAttr, "FuncParamAttr" }
|
||||||
INSTANTIATE_TEST_CASE_P(TextToBinaryDecorateFuncParamAttr, OpDecorateEnumTest,
|
INSTANTIATE_TEST_CASE_P(TextToBinaryDecorateFuncParamAttr, OpDecorateEnumTest,
|
||||||
::testing::ValuesIn(std::vector<DecorateEnumCase>{
|
::testing::ValuesIn(std::vector<DecorateEnumCase>{
|
||||||
CASE(Zext),
|
CASE(Zext),
|
||||||
@ -217,7 +217,7 @@ TEST_F(OpDecorateEnumTest, WrongFuncParamAttr) {
|
|||||||
// Test OpDecorate FPRoundingMode
|
// Test OpDecorate FPRoundingMode
|
||||||
// clang-format off
|
// clang-format off
|
||||||
#define CASE(NAME) \
|
#define CASE(NAME) \
|
||||||
{ spv::FPRoundingMode##NAME, #NAME, spv::DecorationFPRoundingMode, "FPRoundingMode" }
|
{ SpvFPRoundingMode##NAME, #NAME, SpvDecorationFPRoundingMode, "FPRoundingMode" }
|
||||||
INSTANTIATE_TEST_CASE_P(TextToBinaryDecorateFPRoundingMode, OpDecorateEnumTest,
|
INSTANTIATE_TEST_CASE_P(TextToBinaryDecorateFPRoundingMode, OpDecorateEnumTest,
|
||||||
::testing::ValuesIn(std::vector<DecorateEnumCase>{
|
::testing::ValuesIn(std::vector<DecorateEnumCase>{
|
||||||
CASE(RTE),
|
CASE(RTE),
|
||||||
@ -240,7 +240,7 @@ TEST_F(OpDecorateEnumTest, WrongFPRoundingMode) {
|
|||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
#define CASE(ENUM,NAME) \
|
#define CASE(ENUM,NAME) \
|
||||||
{ spv::FPFastMathMode##ENUM, #NAME, spv::DecorationFPFastMathMode, "FPFastMathMode" }
|
{ SpvFPFastMathMode##ENUM, #NAME, SpvDecorationFPFastMathMode, "FPFastMathMode" }
|
||||||
INSTANTIATE_TEST_CASE_P(TextToBinaryDecorateFPFastMathMode, OpDecorateEnumTest,
|
INSTANTIATE_TEST_CASE_P(TextToBinaryDecorateFPFastMathMode, OpDecorateEnumTest,
|
||||||
::testing::ValuesIn(std::vector<DecorateEnumCase>{
|
::testing::ValuesIn(std::vector<DecorateEnumCase>{
|
||||||
CASE(MaskNone, None),
|
CASE(MaskNone, None),
|
||||||
@ -257,13 +257,13 @@ TEST_F(OpDecorateEnumTest, CombinedFPFastMathMask) {
|
|||||||
// Sample a single combination. This ensures we've integrated
|
// Sample a single combination. This ensures we've integrated
|
||||||
// the instruction parsing logic with spvTextParseMask.
|
// the instruction parsing logic with spvTextParseMask.
|
||||||
const std::string input = "OpDecorate %1 FPFastMathMode NotNaN|NotInf|NSZ";
|
const std::string input = "OpDecorate %1 FPFastMathMode NotNaN|NotInf|NSZ";
|
||||||
const uint32_t expected_enum = spv::DecorationFPFastMathMode;
|
const uint32_t expected_enum = SpvDecorationFPFastMathMode;
|
||||||
const uint32_t expected_mask = spv::FPFastMathModeNotNaNMask |
|
const uint32_t expected_mask = SpvFPFastMathModeNotNaNMask |
|
||||||
spv::FPFastMathModeNotInfMask |
|
SpvFPFastMathModeNotInfMask |
|
||||||
spv::FPFastMathModeNSZMask;
|
SpvFPFastMathModeNSZMask;
|
||||||
EXPECT_THAT(
|
EXPECT_THAT(
|
||||||
CompiledInstructions(input),
|
CompiledInstructions(input),
|
||||||
Eq(MakeInstruction(spv::OpDecorate, {1, expected_enum, expected_mask})));
|
Eq(MakeInstruction(SpvOpDecorate, {1, expected_enum, expected_mask})));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(OpDecorateEnumTest, WrongFPFastMathMode) {
|
TEST_F(OpDecorateEnumTest, WrongFPFastMathMode) {
|
||||||
@ -288,7 +288,7 @@ TEST_P(OpDecorateLinkageTest, AnyLinkageDecoration) {
|
|||||||
const std::string input = "OpDecorate %1 LinkageAttributes \"" +
|
const std::string input = "OpDecorate %1 LinkageAttributes \"" +
|
||||||
GetParam().external_name + "\" " +
|
GetParam().external_name + "\" " +
|
||||||
GetParam().linkage_type_name;
|
GetParam().linkage_type_name;
|
||||||
std::vector<uint32_t> expected_operands{1, spv::DecorationLinkageAttributes};
|
std::vector<uint32_t> expected_operands{1, SpvDecorationLinkageAttributes};
|
||||||
std::vector<uint32_t> encoded_external_name =
|
std::vector<uint32_t> encoded_external_name =
|
||||||
MakeVector(GetParam().external_name);
|
MakeVector(GetParam().external_name);
|
||||||
expected_operands.insert(expected_operands.end(),
|
expected_operands.insert(expected_operands.end(),
|
||||||
@ -296,11 +296,11 @@ TEST_P(OpDecorateLinkageTest, AnyLinkageDecoration) {
|
|||||||
encoded_external_name.end());
|
encoded_external_name.end());
|
||||||
expected_operands.push_back(GetParam().linkage_type_value);
|
expected_operands.push_back(GetParam().linkage_type_value);
|
||||||
EXPECT_THAT(CompiledInstructions(input),
|
EXPECT_THAT(CompiledInstructions(input),
|
||||||
Eq(MakeInstruction(spv::OpDecorate, expected_operands)));
|
Eq(MakeInstruction(SpvOpDecorate, expected_operands)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
#define CASE(ENUM) spv::LinkageType##ENUM, #ENUM
|
#define CASE(ENUM) SpvLinkageType##ENUM, #ENUM
|
||||||
INSTANTIATE_TEST_CASE_P(TextToBinaryDecorateLinkage, OpDecorateLinkageTest,
|
INSTANTIATE_TEST_CASE_P(TextToBinaryDecorateLinkage, OpDecorateLinkageTest,
|
||||||
::testing::ValuesIn(std::vector<DecorateLinkageCase>{
|
::testing::ValuesIn(std::vector<DecorateLinkageCase>{
|
||||||
{ CASE(Import), "a" },
|
{ CASE(Import), "a" },
|
||||||
@ -320,13 +320,13 @@ TEST_F(OpDecorateLinkageTest, WrongType) {
|
|||||||
|
|
||||||
TEST_F(TextToBinaryTest, GroupMemberDecorateGoodOneTarget) {
|
TEST_F(TextToBinaryTest, GroupMemberDecorateGoodOneTarget) {
|
||||||
EXPECT_THAT(CompiledInstructions("OpGroupMemberDecorate %group %id0 42"),
|
EXPECT_THAT(CompiledInstructions("OpGroupMemberDecorate %group %id0 42"),
|
||||||
Eq(MakeInstruction(spv::OpGroupMemberDecorate, {1, 2, 42})));
|
Eq(MakeInstruction(SpvOpGroupMemberDecorate, {1, 2, 42})));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(TextToBinaryTest, GroupMemberDecorateGoodTwoTargets) {
|
TEST_F(TextToBinaryTest, GroupMemberDecorateGoodTwoTargets) {
|
||||||
EXPECT_THAT(
|
EXPECT_THAT(
|
||||||
CompiledInstructions("OpGroupMemberDecorate %group %id0 96 %id1 42"),
|
CompiledInstructions("OpGroupMemberDecorate %group %id0 96 %id1 42"),
|
||||||
Eq(MakeInstruction(spv::OpGroupMemberDecorate, {1, 2, 96, 3, 42})));
|
Eq(MakeInstruction(SpvOpGroupMemberDecorate, {1, 2, 96, 3, 42})));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(TextToBinaryTest, GroupMemberDecorateMissingGroupId) {
|
TEST_F(TextToBinaryTest, GroupMemberDecorateMissingGroupId) {
|
||||||
|
@ -45,7 +45,7 @@ using OpMemoryBarrier = spvtest::TextToBinaryTest;
|
|||||||
TEST_F(OpMemoryBarrier, Good) {
|
TEST_F(OpMemoryBarrier, Good) {
|
||||||
const std::string input = "OpMemoryBarrier %1 %2\n";
|
const std::string input = "OpMemoryBarrier %1 %2\n";
|
||||||
EXPECT_THAT(CompiledInstructions(input),
|
EXPECT_THAT(CompiledInstructions(input),
|
||||||
Eq(MakeInstruction(spv::OpMemoryBarrier, {1, 2})));
|
Eq(MakeInstruction(SpvOpMemoryBarrier, {1, 2})));
|
||||||
EXPECT_THAT(EncodeAndDecodeSuccessfully(input), Eq(input));
|
EXPECT_THAT(EncodeAndDecodeSuccessfully(input), Eq(input));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,21 +45,21 @@ using ::testing::Eq;
|
|||||||
// Test Sampler Addressing Mode enum values
|
// Test Sampler Addressing Mode enum values
|
||||||
|
|
||||||
using SamplerAddressingModeTest = spvtest::TextToBinaryTestBase<
|
using SamplerAddressingModeTest = spvtest::TextToBinaryTestBase<
|
||||||
::testing::TestWithParam<EnumCase<spv::SamplerAddressingMode>>>;
|
::testing::TestWithParam<EnumCase<SpvSamplerAddressingMode>>>;
|
||||||
|
|
||||||
TEST_P(SamplerAddressingModeTest, AnySamplerAddressingMode) {
|
TEST_P(SamplerAddressingModeTest, AnySamplerAddressingMode) {
|
||||||
const std::string input =
|
const std::string input =
|
||||||
"%result = OpConstantSampler %type " + GetParam().name() + " 0 Nearest";
|
"%result = OpConstantSampler %type " + GetParam().name() + " 0 Nearest";
|
||||||
EXPECT_THAT(CompiledInstructions(input),
|
EXPECT_THAT(CompiledInstructions(input),
|
||||||
Eq(MakeInstruction(spv::OpConstantSampler,
|
Eq(MakeInstruction(SpvOpConstantSampler,
|
||||||
{1, 2, GetParam().value(), 0, 0})));
|
{1, 2, GetParam().value(), 0, 0})));
|
||||||
}
|
}
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
#define CASE(NAME) { spv::SamplerAddressingMode##NAME, #NAME }
|
#define CASE(NAME) { SpvSamplerAddressingMode##NAME, #NAME }
|
||||||
INSTANTIATE_TEST_CASE_P(
|
INSTANTIATE_TEST_CASE_P(
|
||||||
TextToBinarySamplerAddressingMode, SamplerAddressingModeTest,
|
TextToBinarySamplerAddressingMode, SamplerAddressingModeTest,
|
||||||
::testing::ValuesIn(std::vector<EnumCase<spv::SamplerAddressingMode>>{
|
::testing::ValuesIn(std::vector<EnumCase<SpvSamplerAddressingMode>>{
|
||||||
CASE(None),
|
CASE(None),
|
||||||
CASE(ClampToEdge),
|
CASE(ClampToEdge),
|
||||||
CASE(Clamp),
|
CASE(Clamp),
|
||||||
@ -77,21 +77,21 @@ TEST_F(SamplerAddressingModeTest, WrongMode) {
|
|||||||
// Test Sampler Filter Mode enum values
|
// Test Sampler Filter Mode enum values
|
||||||
|
|
||||||
using SamplerFilterModeTest = spvtest::TextToBinaryTestBase<
|
using SamplerFilterModeTest = spvtest::TextToBinaryTestBase<
|
||||||
::testing::TestWithParam<EnumCase<spv::SamplerFilterMode>>>;
|
::testing::TestWithParam<EnumCase<SpvSamplerFilterMode>>>;
|
||||||
|
|
||||||
TEST_P(SamplerFilterModeTest, AnySamplerFilterMode) {
|
TEST_P(SamplerFilterModeTest, AnySamplerFilterMode) {
|
||||||
const std::string input =
|
const std::string input =
|
||||||
"%result = OpConstantSampler %type Clamp 0 " + GetParam().name();
|
"%result = OpConstantSampler %type Clamp 0 " + GetParam().name();
|
||||||
EXPECT_THAT(CompiledInstructions(input),
|
EXPECT_THAT(CompiledInstructions(input),
|
||||||
Eq(MakeInstruction(spv::OpConstantSampler,
|
Eq(MakeInstruction(SpvOpConstantSampler,
|
||||||
{1, 2, 2, 0, GetParam().value()})));
|
{1, 2, 2, 0, GetParam().value()})));
|
||||||
}
|
}
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
#define CASE(NAME) { spv::SamplerFilterMode##NAME, #NAME}
|
#define CASE(NAME) { SpvSamplerFilterMode##NAME, #NAME}
|
||||||
INSTANTIATE_TEST_CASE_P(
|
INSTANTIATE_TEST_CASE_P(
|
||||||
TextToBinarySamplerFilterMode, SamplerFilterModeTest,
|
TextToBinarySamplerFilterMode, SamplerFilterModeTest,
|
||||||
::testing::ValuesIn(std::vector<EnumCase<spv::SamplerFilterMode>>{
|
::testing::ValuesIn(std::vector<EnumCase<SpvSamplerFilterMode>>{
|
||||||
CASE(Nearest),
|
CASE(Nearest),
|
||||||
CASE(Linear),
|
CASE(Linear),
|
||||||
}));
|
}));
|
||||||
@ -128,53 +128,53 @@ INSTANTIATE_TEST_CASE_P(
|
|||||||
::testing::ValuesIn(std::vector<ConstantTestCase>{
|
::testing::ValuesIn(std::vector<ConstantTestCase>{
|
||||||
// Check 16 bits
|
// Check 16 bits
|
||||||
{"OpTypeInt 16 0", "0x1234",
|
{"OpTypeInt 16 0", "0x1234",
|
||||||
Concatenate({MakeInstruction(spv::OpTypeInt, {1, 16, 0}),
|
Concatenate({MakeInstruction(SpvOpTypeInt, {1, 16, 0}),
|
||||||
MakeInstruction(spv::OpConstant, {1, 2, 0x1234})})},
|
MakeInstruction(SpvOpConstant, {1, 2, 0x1234})})},
|
||||||
{"OpTypeInt 16 0", "0x8000",
|
{"OpTypeInt 16 0", "0x8000",
|
||||||
Concatenate({MakeInstruction(spv::OpTypeInt, {1, 16, 0}),
|
Concatenate({MakeInstruction(SpvOpTypeInt, {1, 16, 0}),
|
||||||
MakeInstruction(spv::OpConstant, {1, 2, 0x8000})})},
|
MakeInstruction(SpvOpConstant, {1, 2, 0x8000})})},
|
||||||
{"OpTypeInt 16 1", "0x8000", // Test sign extension.
|
{"OpTypeInt 16 1", "0x8000", // Test sign extension.
|
||||||
Concatenate({MakeInstruction(spv::OpTypeInt, {1, 16, 1}),
|
Concatenate({MakeInstruction(SpvOpTypeInt, {1, 16, 1}),
|
||||||
MakeInstruction(spv::OpConstant, {1, 2, 0xffff8000})})},
|
MakeInstruction(SpvOpConstant, {1, 2, 0xffff8000})})},
|
||||||
{"OpTypeInt 16 1", "-32",
|
{"OpTypeInt 16 1", "-32",
|
||||||
Concatenate({MakeInstruction(spv::OpTypeInt, {1, 16, 1}),
|
Concatenate({MakeInstruction(SpvOpTypeInt, {1, 16, 1}),
|
||||||
MakeInstruction(spv::OpConstant, {1, 2, uint32_t(-32)})})},
|
MakeInstruction(SpvOpConstant, {1, 2, uint32_t(-32)})})},
|
||||||
// Check 32 bits
|
// Check 32 bits
|
||||||
{"OpTypeInt 32 0", "42",
|
{"OpTypeInt 32 0", "42",
|
||||||
Concatenate({MakeInstruction(spv::OpTypeInt, {1, 32, 0}),
|
Concatenate({MakeInstruction(SpvOpTypeInt, {1, 32, 0}),
|
||||||
MakeInstruction(spv::OpConstant, {1, 2, 42})})},
|
MakeInstruction(SpvOpConstant, {1, 2, 42})})},
|
||||||
{"OpTypeInt 32 1", "-32",
|
{"OpTypeInt 32 1", "-32",
|
||||||
Concatenate({MakeInstruction(spv::OpTypeInt, {1, 32, 1}),
|
Concatenate({MakeInstruction(SpvOpTypeInt, {1, 32, 1}),
|
||||||
MakeInstruction(spv::OpConstant, {1, 2, uint32_t(-32)})})},
|
MakeInstruction(SpvOpConstant, {1, 2, uint32_t(-32)})})},
|
||||||
{"OpTypeFloat 32", "1.0",
|
{"OpTypeFloat 32", "1.0",
|
||||||
Concatenate({MakeInstruction(spv::OpTypeFloat, {1, 32}),
|
Concatenate({MakeInstruction(SpvOpTypeFloat, {1, 32}),
|
||||||
MakeInstruction(spv::OpConstant, {1, 2, 0x3f800000})})},
|
MakeInstruction(SpvOpConstant, {1, 2, 0x3f800000})})},
|
||||||
{"OpTypeFloat 32", "10.0",
|
{"OpTypeFloat 32", "10.0",
|
||||||
Concatenate({MakeInstruction(spv::OpTypeFloat, {1, 32}),
|
Concatenate({MakeInstruction(SpvOpTypeFloat, {1, 32}),
|
||||||
MakeInstruction(spv::OpConstant, {1, 2, 0x41200000})})},
|
MakeInstruction(SpvOpConstant, {1, 2, 0x41200000})})},
|
||||||
// Check 48 bits
|
// Check 48 bits
|
||||||
{"OpTypeInt 48 0", "0x1234",
|
{"OpTypeInt 48 0", "0x1234",
|
||||||
Concatenate({MakeInstruction(spv::OpTypeInt, {1, 48, 0}),
|
Concatenate({MakeInstruction(SpvOpTypeInt, {1, 48, 0}),
|
||||||
MakeInstruction(spv::OpConstant, {1, 2, 0x1234, 0})})},
|
MakeInstruction(SpvOpConstant, {1, 2, 0x1234, 0})})},
|
||||||
{"OpTypeInt 48 0", "0x800000000001",
|
{"OpTypeInt 48 0", "0x800000000001",
|
||||||
Concatenate({MakeInstruction(spv::OpTypeInt, {1, 48, 0}),
|
Concatenate({MakeInstruction(SpvOpTypeInt, {1, 48, 0}),
|
||||||
MakeInstruction(spv::OpConstant, {1, 2, 1, 0x00008000})})},
|
MakeInstruction(SpvOpConstant, {1, 2, 1, 0x00008000})})},
|
||||||
{"OpTypeInt 48 1", "0x800000000000", // Test sign extension.
|
{"OpTypeInt 48 1", "0x800000000000", // Test sign extension.
|
||||||
Concatenate({MakeInstruction(spv::OpTypeInt, {1, 48, 1}),
|
Concatenate({MakeInstruction(SpvOpTypeInt, {1, 48, 1}),
|
||||||
MakeInstruction(spv::OpConstant, {1, 2, 0, 0xffff8000})})},
|
MakeInstruction(SpvOpConstant, {1, 2, 0, 0xffff8000})})},
|
||||||
{"OpTypeInt 48 1", "-32",
|
{"OpTypeInt 48 1", "-32",
|
||||||
Concatenate({MakeInstruction(spv::OpTypeInt, {1, 48, 1}),
|
Concatenate({MakeInstruction(SpvOpTypeInt, {1, 48, 1}),
|
||||||
MakeInstruction(spv::OpConstant, {1, 2, uint32_t(-32), uint32_t(-1)})})},
|
MakeInstruction(SpvOpConstant, {1, 2, uint32_t(-32), uint32_t(-1)})})},
|
||||||
// Check 64 bits
|
// Check 64 bits
|
||||||
{"OpTypeInt 64 0", "0x1234",
|
{"OpTypeInt 64 0", "0x1234",
|
||||||
Concatenate({MakeInstruction(spv::OpTypeInt, {1, 64, 0}),
|
Concatenate({MakeInstruction(SpvOpTypeInt, {1, 64, 0}),
|
||||||
MakeInstruction(spv::OpConstant, {1, 2, 0x1234, 0})})},
|
MakeInstruction(SpvOpConstant, {1, 2, 0x1234, 0})})},
|
||||||
{"OpTypeInt 64 1", "0x1234",
|
{"OpTypeInt 64 1", "0x1234",
|
||||||
Concatenate({MakeInstruction(spv::OpTypeInt, {1, 64, 1}),
|
Concatenate({MakeInstruction(SpvOpTypeInt, {1, 64, 1}),
|
||||||
MakeInstruction(spv::OpConstant, {1, 2, 0x1234, 0})})},
|
MakeInstruction(SpvOpConstant, {1, 2, 0x1234, 0})})},
|
||||||
{"OpTypeInt 64 1", "-42",
|
{"OpTypeInt 64 1", "-42",
|
||||||
Concatenate({MakeInstruction(spv::OpTypeInt, {1, 64, 1}),
|
Concatenate({MakeInstruction(SpvOpTypeInt, {1, 64, 1}),
|
||||||
MakeInstruction(spv::OpConstant, {1, 2, uint32_t(-42), uint32_t(-1)})})},
|
MakeInstruction(SpvOpConstant, {1, 2, uint32_t(-42), uint32_t(-1)})})},
|
||||||
}));
|
}));
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
@ -239,53 +239,53 @@ INSTANTIATE_TEST_CASE_P(
|
|||||||
::testing::ValuesIn(std::vector<ConstantTestCase>{
|
::testing::ValuesIn(std::vector<ConstantTestCase>{
|
||||||
// Check 16 bits
|
// Check 16 bits
|
||||||
{"OpTypeInt 16 0", "0x1234",
|
{"OpTypeInt 16 0", "0x1234",
|
||||||
Concatenate({MakeInstruction(spv::OpTypeInt, {1, 16, 0}),
|
Concatenate({MakeInstruction(SpvOpTypeInt, {1, 16, 0}),
|
||||||
MakeInstruction(spv::OpSpecConstant, {1, 2, 0x1234})})},
|
MakeInstruction(SpvOpSpecConstant, {1, 2, 0x1234})})},
|
||||||
{"OpTypeInt 16 0", "0x8000",
|
{"OpTypeInt 16 0", "0x8000",
|
||||||
Concatenate({MakeInstruction(spv::OpTypeInt, {1, 16, 0}),
|
Concatenate({MakeInstruction(SpvOpTypeInt, {1, 16, 0}),
|
||||||
MakeInstruction(spv::OpSpecConstant, {1, 2, 0x8000})})},
|
MakeInstruction(SpvOpSpecConstant, {1, 2, 0x8000})})},
|
||||||
{"OpTypeInt 16 1", "0x8000", // Test sign extension.
|
{"OpTypeInt 16 1", "0x8000", // Test sign extension.
|
||||||
Concatenate({MakeInstruction(spv::OpTypeInt, {1, 16, 1}),
|
Concatenate({MakeInstruction(SpvOpTypeInt, {1, 16, 1}),
|
||||||
MakeInstruction(spv::OpSpecConstant, {1, 2, 0xffff8000})})},
|
MakeInstruction(SpvOpSpecConstant, {1, 2, 0xffff8000})})},
|
||||||
{"OpTypeInt 16 1", "-32",
|
{"OpTypeInt 16 1", "-32",
|
||||||
Concatenate({MakeInstruction(spv::OpTypeInt, {1, 16, 1}),
|
Concatenate({MakeInstruction(SpvOpTypeInt, {1, 16, 1}),
|
||||||
MakeInstruction(spv::OpSpecConstant, {1, 2, uint32_t(-32)})})},
|
MakeInstruction(SpvOpSpecConstant, {1, 2, uint32_t(-32)})})},
|
||||||
// Check 32 bits
|
// Check 32 bits
|
||||||
{"OpTypeInt 32 0", "42",
|
{"OpTypeInt 32 0", "42",
|
||||||
Concatenate({MakeInstruction(spv::OpTypeInt, {1, 32, 0}),
|
Concatenate({MakeInstruction(SpvOpTypeInt, {1, 32, 0}),
|
||||||
MakeInstruction(spv::OpSpecConstant, {1, 2, 42})})},
|
MakeInstruction(SpvOpSpecConstant, {1, 2, 42})})},
|
||||||
{"OpTypeInt 32 1", "-32",
|
{"OpTypeInt 32 1", "-32",
|
||||||
Concatenate({MakeInstruction(spv::OpTypeInt, {1, 32, 1}),
|
Concatenate({MakeInstruction(SpvOpTypeInt, {1, 32, 1}),
|
||||||
MakeInstruction(spv::OpSpecConstant, {1, 2, uint32_t(-32)})})},
|
MakeInstruction(SpvOpSpecConstant, {1, 2, uint32_t(-32)})})},
|
||||||
{"OpTypeFloat 32", "1.0",
|
{"OpTypeFloat 32", "1.0",
|
||||||
Concatenate({MakeInstruction(spv::OpTypeFloat, {1, 32}),
|
Concatenate({MakeInstruction(SpvOpTypeFloat, {1, 32}),
|
||||||
MakeInstruction(spv::OpSpecConstant, {1, 2, 0x3f800000})})},
|
MakeInstruction(SpvOpSpecConstant, {1, 2, 0x3f800000})})},
|
||||||
{"OpTypeFloat 32", "10.0",
|
{"OpTypeFloat 32", "10.0",
|
||||||
Concatenate({MakeInstruction(spv::OpTypeFloat, {1, 32}),
|
Concatenate({MakeInstruction(SpvOpTypeFloat, {1, 32}),
|
||||||
MakeInstruction(spv::OpSpecConstant, {1, 2, 0x41200000})})},
|
MakeInstruction(SpvOpSpecConstant, {1, 2, 0x41200000})})},
|
||||||
// Check 48 bits
|
// Check 48 bits
|
||||||
{"OpTypeInt 48 0", "0x1234",
|
{"OpTypeInt 48 0", "0x1234",
|
||||||
Concatenate({MakeInstruction(spv::OpTypeInt, {1, 48, 0}),
|
Concatenate({MakeInstruction(SpvOpTypeInt, {1, 48, 0}),
|
||||||
MakeInstruction(spv::OpSpecConstant, {1, 2, 0x1234, 0})})},
|
MakeInstruction(SpvOpSpecConstant, {1, 2, 0x1234, 0})})},
|
||||||
{"OpTypeInt 48 0", "0x800000000001",
|
{"OpTypeInt 48 0", "0x800000000001",
|
||||||
Concatenate({MakeInstruction(spv::OpTypeInt, {1, 48, 0}),
|
Concatenate({MakeInstruction(SpvOpTypeInt, {1, 48, 0}),
|
||||||
MakeInstruction(spv::OpSpecConstant, {1, 2, 1, 0x00008000})})},
|
MakeInstruction(SpvOpSpecConstant, {1, 2, 1, 0x00008000})})},
|
||||||
{"OpTypeInt 48 1", "0x800000000000", // Test sign extension.
|
{"OpTypeInt 48 1", "0x800000000000", // Test sign extension.
|
||||||
Concatenate({MakeInstruction(spv::OpTypeInt, {1, 48, 1}),
|
Concatenate({MakeInstruction(SpvOpTypeInt, {1, 48, 1}),
|
||||||
MakeInstruction(spv::OpSpecConstant, {1, 2, 0, 0xffff8000})})},
|
MakeInstruction(SpvOpSpecConstant, {1, 2, 0, 0xffff8000})})},
|
||||||
{"OpTypeInt 48 1", "-32",
|
{"OpTypeInt 48 1", "-32",
|
||||||
Concatenate({MakeInstruction(spv::OpTypeInt, {1, 48, 1}),
|
Concatenate({MakeInstruction(SpvOpTypeInt, {1, 48, 1}),
|
||||||
MakeInstruction(spv::OpSpecConstant, {1, 2, uint32_t(-32), uint32_t(-1)})})},
|
MakeInstruction(SpvOpSpecConstant, {1, 2, uint32_t(-32), uint32_t(-1)})})},
|
||||||
// Check 64 bits
|
// Check 64 bits
|
||||||
{"OpTypeInt 64 0", "0x1234",
|
{"OpTypeInt 64 0", "0x1234",
|
||||||
Concatenate({MakeInstruction(spv::OpTypeInt, {1, 64, 0}),
|
Concatenate({MakeInstruction(SpvOpTypeInt, {1, 64, 0}),
|
||||||
MakeInstruction(spv::OpSpecConstant, {1, 2, 0x1234, 0})})},
|
MakeInstruction(SpvOpSpecConstant, {1, 2, 0x1234, 0})})},
|
||||||
{"OpTypeInt 64 1", "0x1234",
|
{"OpTypeInt 64 1", "0x1234",
|
||||||
Concatenate({MakeInstruction(spv::OpTypeInt, {1, 64, 1}),
|
Concatenate({MakeInstruction(SpvOpTypeInt, {1, 64, 1}),
|
||||||
MakeInstruction(spv::OpSpecConstant, {1, 2, 0x1234, 0})})},
|
MakeInstruction(SpvOpSpecConstant, {1, 2, 0x1234, 0})})},
|
||||||
{"OpTypeInt 64 1", "-42",
|
{"OpTypeInt 64 1", "-42",
|
||||||
Concatenate({MakeInstruction(spv::OpTypeInt, {1, 64, 1}),
|
Concatenate({MakeInstruction(SpvOpTypeInt, {1, 64, 1}),
|
||||||
MakeInstruction(spv::OpSpecConstant, {1, 2, uint32_t(-42), uint32_t(-1)})})},
|
MakeInstruction(SpvOpSpecConstant, {1, 2, uint32_t(-42), uint32_t(-1)})})},
|
||||||
}));
|
}));
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
|
@ -43,19 +43,19 @@ using ::testing::Eq;
|
|||||||
// Test OpSelectionMerge
|
// Test OpSelectionMerge
|
||||||
|
|
||||||
using OpSelectionMergeTest = spvtest::TextToBinaryTestBase<
|
using OpSelectionMergeTest = spvtest::TextToBinaryTestBase<
|
||||||
::testing::TestWithParam<EnumCase<spv::SelectionControlMask>>>;
|
::testing::TestWithParam<EnumCase<SpvSelectionControlMask>>>;
|
||||||
|
|
||||||
TEST_P(OpSelectionMergeTest, AnySingleSelectionControlMask) {
|
TEST_P(OpSelectionMergeTest, AnySingleSelectionControlMask) {
|
||||||
const std::string input = "OpSelectionMerge %1 " + GetParam().name();
|
const std::string input = "OpSelectionMerge %1 " + GetParam().name();
|
||||||
EXPECT_THAT(
|
EXPECT_THAT(
|
||||||
CompiledInstructions(input),
|
CompiledInstructions(input),
|
||||||
Eq(MakeInstruction(spv::OpSelectionMerge, {1, GetParam().value()})));
|
Eq(MakeInstruction(SpvOpSelectionMerge, {1, GetParam().value()})));
|
||||||
}
|
}
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
#define CASE(VALUE,NAME) { spv::SelectionControl##VALUE, NAME}
|
#define CASE(VALUE,NAME) { SpvSelectionControl##VALUE, NAME}
|
||||||
INSTANTIATE_TEST_CASE_P(TextToBinarySelectionMerge, OpSelectionMergeTest,
|
INSTANTIATE_TEST_CASE_P(TextToBinarySelectionMerge, OpSelectionMergeTest,
|
||||||
::testing::ValuesIn(std::vector<EnumCase<spv::SelectionControlMask>>{
|
::testing::ValuesIn(std::vector<EnumCase<SpvSelectionControlMask>>{
|
||||||
CASE(MaskNone, "None"),
|
CASE(MaskNone, "None"),
|
||||||
CASE(FlattenMask, "Flatten"),
|
CASE(FlattenMask, "Flatten"),
|
||||||
CASE(DontFlattenMask, "DontFlatten"),
|
CASE(DontFlattenMask, "DontFlatten"),
|
||||||
@ -66,9 +66,9 @@ INSTANTIATE_TEST_CASE_P(TextToBinarySelectionMerge, OpSelectionMergeTest,
|
|||||||
TEST_F(OpSelectionMergeTest, CombinedSelectionControlMask) {
|
TEST_F(OpSelectionMergeTest, CombinedSelectionControlMask) {
|
||||||
const std::string input = "OpSelectionMerge %1 Flatten|DontFlatten";
|
const std::string input = "OpSelectionMerge %1 Flatten|DontFlatten";
|
||||||
const uint32_t expected_mask =
|
const uint32_t expected_mask =
|
||||||
spv::SelectionControlFlattenMask | spv::SelectionControlDontFlattenMask;
|
SpvSelectionControlFlattenMask | SpvSelectionControlDontFlattenMask;
|
||||||
EXPECT_THAT(CompiledInstructions(input),
|
EXPECT_THAT(CompiledInstructions(input),
|
||||||
Eq(MakeInstruction(spv::OpSelectionMerge, {1, expected_mask})));
|
Eq(MakeInstruction(SpvOpSelectionMerge, {1, expected_mask})));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(OpSelectionMergeTest, WrongSelectionControl) {
|
TEST_F(OpSelectionMergeTest, WrongSelectionControl) {
|
||||||
@ -80,19 +80,19 @@ TEST_F(OpSelectionMergeTest, WrongSelectionControl) {
|
|||||||
// Test OpLoopMerge
|
// Test OpLoopMerge
|
||||||
|
|
||||||
using OpLoopMergeTest = spvtest::TextToBinaryTestBase<
|
using OpLoopMergeTest = spvtest::TextToBinaryTestBase<
|
||||||
::testing::TestWithParam<EnumCase<spv::LoopControlMask>>>;
|
::testing::TestWithParam<EnumCase<SpvLoopControlMask>>>;
|
||||||
|
|
||||||
TEST_P(OpLoopMergeTest, AnySingleLoopControlMask) {
|
TEST_P(OpLoopMergeTest, AnySingleLoopControlMask) {
|
||||||
const std::string input = "OpLoopMerge %merge %continue " + GetParam().name();
|
const std::string input = "OpLoopMerge %merge %continue " + GetParam().name();
|
||||||
EXPECT_THAT(
|
EXPECT_THAT(
|
||||||
CompiledInstructions(input),
|
CompiledInstructions(input),
|
||||||
Eq(MakeInstruction(spv::OpLoopMerge, {1, 2, GetParam().value()})));
|
Eq(MakeInstruction(SpvOpLoopMerge, {1, 2, GetParam().value()})));
|
||||||
}
|
}
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
#define CASE(VALUE,NAME) { spv::LoopControl##VALUE, NAME}
|
#define CASE(VALUE,NAME) { SpvLoopControl##VALUE, NAME}
|
||||||
INSTANTIATE_TEST_CASE_P(TextToBinaryLoopMerge, OpLoopMergeTest,
|
INSTANTIATE_TEST_CASE_P(TextToBinaryLoopMerge, OpLoopMergeTest,
|
||||||
::testing::ValuesIn(std::vector<EnumCase<spv::LoopControlMask>>{
|
::testing::ValuesIn(std::vector<EnumCase<SpvLoopControlMask>>{
|
||||||
CASE(MaskNone, "None"),
|
CASE(MaskNone, "None"),
|
||||||
CASE(UnrollMask, "Unroll"),
|
CASE(UnrollMask, "Unroll"),
|
||||||
CASE(DontUnrollMask, "DontUnroll"),
|
CASE(DontUnrollMask, "DontUnroll"),
|
||||||
@ -103,9 +103,9 @@ INSTANTIATE_TEST_CASE_P(TextToBinaryLoopMerge, OpLoopMergeTest,
|
|||||||
TEST_F(OpLoopMergeTest, CombinedLoopControlMask) {
|
TEST_F(OpLoopMergeTest, CombinedLoopControlMask) {
|
||||||
const std::string input = "OpLoopMerge %merge %continue Unroll|DontUnroll";
|
const std::string input = "OpLoopMerge %merge %continue Unroll|DontUnroll";
|
||||||
const uint32_t expected_mask =
|
const uint32_t expected_mask =
|
||||||
spv::LoopControlUnrollMask | spv::LoopControlDontUnrollMask;
|
SpvLoopControlUnrollMask | SpvLoopControlDontUnrollMask;
|
||||||
EXPECT_THAT(CompiledInstructions(input),
|
EXPECT_THAT(CompiledInstructions(input),
|
||||||
Eq(MakeInstruction(spv::OpLoopMerge, {1, 2, expected_mask})));
|
Eq(MakeInstruction(SpvOpLoopMerge, {1, 2, expected_mask})));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(OpLoopMergeTest, WrongLoopControl) {
|
TEST_F(OpLoopMergeTest, WrongLoopControl) {
|
||||||
@ -117,16 +117,16 @@ TEST_F(OpLoopMergeTest, WrongLoopControl) {
|
|||||||
|
|
||||||
TEST_F(TextToBinaryTest, SwitchGoodZeroTargets) {
|
TEST_F(TextToBinaryTest, SwitchGoodZeroTargets) {
|
||||||
EXPECT_THAT(CompiledInstructions("OpSwitch %selector %default"),
|
EXPECT_THAT(CompiledInstructions("OpSwitch %selector %default"),
|
||||||
Eq(MakeInstruction(spv::OpSwitch, {1, 2})));
|
Eq(MakeInstruction(SpvOpSwitch, {1, 2})));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(TextToBinaryTest, SwitchGoodOneTarget) {
|
TEST_F(TextToBinaryTest, SwitchGoodOneTarget) {
|
||||||
EXPECT_THAT(CompiledInstructions("%1 = OpTypeInt 32 0\n"
|
EXPECT_THAT(CompiledInstructions("%1 = OpTypeInt 32 0\n"
|
||||||
"%2 = OpConstant %1 52\n"
|
"%2 = OpConstant %1 52\n"
|
||||||
"OpSwitch %2 %default 12 %target0"),
|
"OpSwitch %2 %default 12 %target0"),
|
||||||
Eq(Concatenate({MakeInstruction(spv::OpTypeInt, {1, 32, 0}),
|
Eq(Concatenate({MakeInstruction(SpvOpTypeInt, {1, 32, 0}),
|
||||||
MakeInstruction(spv::OpConstant, {1, 2, 52}),
|
MakeInstruction(SpvOpConstant, {1, 2, 52}),
|
||||||
MakeInstruction(spv::OpSwitch, {2, 3, 12, 4})})));
|
MakeInstruction(SpvOpSwitch, {2, 3, 12, 4})})));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(TextToBinaryTest, SwitchGoodTwoTargets) {
|
TEST_F(TextToBinaryTest, SwitchGoodTwoTargets) {
|
||||||
@ -135,9 +135,9 @@ TEST_F(TextToBinaryTest, SwitchGoodTwoTargets) {
|
|||||||
"%2 = OpConstant %1 52\n"
|
"%2 = OpConstant %1 52\n"
|
||||||
"OpSwitch %2 %default 12 %target0 42 %target1"),
|
"OpSwitch %2 %default 12 %target0 42 %target1"),
|
||||||
Eq(Concatenate({
|
Eq(Concatenate({
|
||||||
MakeInstruction(spv::OpTypeInt, {1, 32, 0}),
|
MakeInstruction(SpvOpTypeInt, {1, 32, 0}),
|
||||||
MakeInstruction(spv::OpConstant, {1, 2, 52}),
|
MakeInstruction(SpvOpConstant, {1, 2, 52}),
|
||||||
MakeInstruction(spv::OpSwitch, {2, 3, 12, 4, 42, 5}),
|
MakeInstruction(SpvOpSwitch, {2, 3, 12, 4, 42, 5}),
|
||||||
})));
|
})));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -233,11 +233,11 @@ SwitchTestCase MakeSwitchTestCase(uint32_t integer_width,
|
|||||||
constant_str,
|
constant_str,
|
||||||
case_value_str,
|
case_value_str,
|
||||||
{Concatenate(
|
{Concatenate(
|
||||||
{MakeInstruction(spv::OpTypeInt,
|
{MakeInstruction(SpvOpTypeInt,
|
||||||
{1, integer_width, integer_signedness}),
|
{1, integer_width, integer_signedness}),
|
||||||
MakeInstruction(spv::OpConstant,
|
MakeInstruction(SpvOpConstant,
|
||||||
Concatenate({{1, 2}, encoded_constant})),
|
Concatenate({{1, 2}, encoded_constant})),
|
||||||
MakeInstruction(spv::OpSwitch,
|
MakeInstruction(SpvOpSwitch,
|
||||||
Concatenate({{2, 3}, encoded_case_value, {4}}))})}};
|
Concatenate({{2, 3}, encoded_case_value, {4}}))})}};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ struct LanguageCase {
|
|||||||
return static_cast<uint32_t>(language_value);
|
return static_cast<uint32_t>(language_value);
|
||||||
}
|
}
|
||||||
const char* language_name;
|
const char* language_name;
|
||||||
spv::SourceLanguage language_value;
|
SpvSourceLanguage language_value;
|
||||||
uint32_t version;
|
uint32_t version;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ struct LanguageCase {
|
|||||||
// The list of OpSource cases to use.
|
// The list of OpSource cases to use.
|
||||||
const LanguageCase kLanguageCases[] = {
|
const LanguageCase kLanguageCases[] = {
|
||||||
#define CASE(NAME, VERSION) \
|
#define CASE(NAME, VERSION) \
|
||||||
{ #NAME, spv::SourceLanguage##NAME, VERSION }
|
{ #NAME, SpvSourceLanguage##NAME, VERSION }
|
||||||
CASE(Unknown, 0),
|
CASE(Unknown, 0),
|
||||||
CASE(Unknown, 999),
|
CASE(Unknown, 999),
|
||||||
CASE(ESSL, 310),
|
CASE(ESSL, 310),
|
||||||
@ -76,7 +76,7 @@ TEST_P(OpSourceTest, AnyLanguage) {
|
|||||||
std::to_string(GetParam().version);
|
std::to_string(GetParam().version);
|
||||||
EXPECT_THAT(
|
EXPECT_THAT(
|
||||||
CompiledInstructions(input),
|
CompiledInstructions(input),
|
||||||
Eq(MakeInstruction(spv::OpSource, {GetParam().get_language_value(),
|
Eq(MakeInstruction(SpvOpSource, {GetParam().get_language_value(),
|
||||||
GetParam().version})));
|
GetParam().version})));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ TEST_F(TextToBinaryTest, OpSourceAcceptsOptionalFileId) {
|
|||||||
const std::string input = "OpSource GLSL 450 %file_id";
|
const std::string input = "OpSource GLSL 450 %file_id";
|
||||||
EXPECT_THAT(
|
EXPECT_THAT(
|
||||||
CompiledInstructions(input),
|
CompiledInstructions(input),
|
||||||
Eq(MakeInstruction(spv::OpSource, {spv::SourceLanguageGLSL, 450, 1})));
|
Eq(MakeInstruction(SpvOpSource, {SpvSourceLanguageGLSL, 450, 1})));
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(TextToBinaryTest, OpSourceAcceptsOptionalSourceText) {
|
TEST_F(TextToBinaryTest, OpSourceAcceptsOptionalSourceText) {
|
||||||
@ -102,7 +102,7 @@ TEST_F(TextToBinaryTest, OpSourceAcceptsOptionalSourceText) {
|
|||||||
"OpSource GLSL 450 %file_id \"" + fake_source + "\"";
|
"OpSource GLSL 450 %file_id \"" + fake_source + "\"";
|
||||||
EXPECT_THAT(
|
EXPECT_THAT(
|
||||||
CompiledInstructions(input),
|
CompiledInstructions(input),
|
||||||
Eq(MakeInstruction(spv::OpSource, {spv::SourceLanguageGLSL, 450, 1},
|
Eq(MakeInstruction(SpvOpSource, {SpvSourceLanguageGLSL, 450, 1},
|
||||||
MakeVector(fake_source))));
|
MakeVector(fake_source))));
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -117,7 +117,7 @@ TEST_P(OpSourceContinuedTest, AnyExtension) {
|
|||||||
std::string("OpSourceContinued \"") + GetParam() + "\"";
|
std::string("OpSourceContinued \"") + GetParam() + "\"";
|
||||||
EXPECT_THAT(
|
EXPECT_THAT(
|
||||||
CompiledInstructions(input),
|
CompiledInstructions(input),
|
||||||
Eq(MakeInstruction(spv::OpSourceContinued, MakeVector(GetParam()))));
|
Eq(MakeInstruction(SpvOpSourceContinued, MakeVector(GetParam()))));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(dneto): utf-8, quoting, escaping
|
// TODO(dneto): utf-8, quoting, escaping
|
||||||
@ -136,7 +136,7 @@ TEST_P(OpSourceExtensionTest, AnyExtension) {
|
|||||||
std::string("OpSourceExtension \"") + GetParam() + "\"";
|
std::string("OpSourceExtension \"") + GetParam() + "\"";
|
||||||
EXPECT_THAT(
|
EXPECT_THAT(
|
||||||
CompiledInstructions(input),
|
CompiledInstructions(input),
|
||||||
Eq(MakeInstruction(spv::OpSourceExtension, MakeVector(GetParam()))));
|
Eq(MakeInstruction(SpvOpSourceExtension, MakeVector(GetParam()))));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(dneto): utf-8, quoting, escaping
|
// TODO(dneto): utf-8, quoting, escaping
|
||||||
@ -146,12 +146,12 @@ INSTANTIATE_TEST_CASE_P(TextToBinaryTestDebug, OpSourceExtensionTest,
|
|||||||
|
|
||||||
TEST_F(TextToBinaryTest, OpLine) {
|
TEST_F(TextToBinaryTest, OpLine) {
|
||||||
EXPECT_THAT(CompiledInstructions("OpLine %srcfile 42 99"),
|
EXPECT_THAT(CompiledInstructions("OpLine %srcfile 42 99"),
|
||||||
Eq(MakeInstruction(spv::OpLine, {1, 42, 99})));
|
Eq(MakeInstruction(SpvOpLine, {1, 42, 99})));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(TextToBinaryTest, OpNoLine) {
|
TEST_F(TextToBinaryTest, OpNoLine) {
|
||||||
EXPECT_THAT(CompiledInstructions("OpNoLine"),
|
EXPECT_THAT(CompiledInstructions("OpNoLine"),
|
||||||
Eq(MakeInstruction(spv::OpNoLine, {})));
|
Eq(MakeInstruction(SpvOpNoLine, {})));
|
||||||
}
|
}
|
||||||
|
|
||||||
using OpStringTest =
|
using OpStringTest =
|
||||||
@ -162,7 +162,7 @@ TEST_P(OpStringTest, AnyString) {
|
|||||||
const std::string input =
|
const std::string input =
|
||||||
std::string("%result = OpString \"") + GetParam() + "\"";
|
std::string("%result = OpString \"") + GetParam() + "\"";
|
||||||
EXPECT_THAT(CompiledInstructions(input),
|
EXPECT_THAT(CompiledInstructions(input),
|
||||||
Eq(MakeInstruction(spv::OpString, {1}, MakeVector(GetParam()))));
|
Eq(MakeInstruction(SpvOpString, {1}, MakeVector(GetParam()))));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(dneto): utf-8, quoting, escaping
|
// TODO(dneto): utf-8, quoting, escaping
|
||||||
@ -178,7 +178,7 @@ TEST_P(OpNameTest, AnyString) {
|
|||||||
const std::string input =
|
const std::string input =
|
||||||
std::string("OpName %target \"") + GetParam() + "\"";
|
std::string("OpName %target \"") + GetParam() + "\"";
|
||||||
EXPECT_THAT(CompiledInstructions(input),
|
EXPECT_THAT(CompiledInstructions(input),
|
||||||
Eq(MakeInstruction(spv::OpName, {1}, MakeVector(GetParam()))));
|
Eq(MakeInstruction(SpvOpName, {1}, MakeVector(GetParam()))));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(dneto): utf-8, quoting, escaping
|
// TODO(dneto): utf-8, quoting, escaping
|
||||||
@ -195,7 +195,7 @@ TEST_P(OpMemberNameTest, AnyString) {
|
|||||||
std::string("OpMemberName %type 42 \"") + GetParam() + "\"";
|
std::string("OpMemberName %type 42 \"") + GetParam() + "\"";
|
||||||
EXPECT_THAT(
|
EXPECT_THAT(
|
||||||
CompiledInstructions(input),
|
CompiledInstructions(input),
|
||||||
Eq(MakeInstruction(spv::OpMemberName, {1, 42}, MakeVector(GetParam()))));
|
Eq(MakeInstruction(SpvOpMemberName, {1, 42}, MakeVector(GetParam()))));
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(dneto): utf-8, quoting, escaping
|
// TODO(dneto): utf-8, quoting, escaping
|
||||||
|
@ -53,7 +53,7 @@ TEST_P(OpEnqueueKernelGood, Sample) {
|
|||||||
" %wait_events %ret_event %invoke %param %param_size %param_align " +
|
" %wait_events %ret_event %invoke %param %param_size %param_align " +
|
||||||
GetParam().local_size_source;
|
GetParam().local_size_source;
|
||||||
EXPECT_THAT(CompiledInstructions(input),
|
EXPECT_THAT(CompiledInstructions(input),
|
||||||
Eq(MakeInstruction(spv::OpEnqueueKernel,
|
Eq(MakeInstruction(SpvOpEnqueueKernel,
|
||||||
{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12},
|
{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12},
|
||||||
GetParam().local_size_operands)));
|
GetParam().local_size_operands)));
|
||||||
}
|
}
|
||||||
|
@ -42,20 +42,20 @@ using ::testing::Eq;
|
|||||||
// Test OpFunction
|
// Test OpFunction
|
||||||
|
|
||||||
using OpFunctionControlTest = spvtest::TextToBinaryTestBase<
|
using OpFunctionControlTest = spvtest::TextToBinaryTestBase<
|
||||||
::testing::TestWithParam<EnumCase<spv::FunctionControlMask>>>;
|
::testing::TestWithParam<EnumCase<SpvFunctionControlMask>>>;
|
||||||
|
|
||||||
TEST_P(OpFunctionControlTest, AnySingleFunctionControlMask) {
|
TEST_P(OpFunctionControlTest, AnySingleFunctionControlMask) {
|
||||||
const std::string input = "%result_id = OpFunction %result_type " +
|
const std::string input = "%result_id = OpFunction %result_type " +
|
||||||
GetParam().name() + " %function_type ";
|
GetParam().name() + " %function_type ";
|
||||||
EXPECT_THAT(
|
EXPECT_THAT(
|
||||||
CompiledInstructions(input),
|
CompiledInstructions(input),
|
||||||
Eq(MakeInstruction(spv::OpFunction, {1, 2, GetParam().value(), 3})));
|
Eq(MakeInstruction(SpvOpFunction, {1, 2, GetParam().value(), 3})));
|
||||||
}
|
}
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
#define CASE(VALUE,NAME) { spv::FunctionControl##VALUE, NAME }
|
#define CASE(VALUE,NAME) { SpvFunctionControl##VALUE, NAME }
|
||||||
INSTANTIATE_TEST_CASE_P(TextToBinaryFunctionTest, OpFunctionControlTest,
|
INSTANTIATE_TEST_CASE_P(TextToBinaryFunctionTest, OpFunctionControlTest,
|
||||||
::testing::ValuesIn(std::vector<EnumCase<spv::FunctionControlMask>>{
|
::testing::ValuesIn(std::vector<EnumCase<SpvFunctionControlMask>>{
|
||||||
CASE(MaskNone, "None"),
|
CASE(MaskNone, "None"),
|
||||||
CASE(InlineMask, "Inline"),
|
CASE(InlineMask, "Inline"),
|
||||||
CASE(DontInlineMask, "DontInline"),
|
CASE(DontInlineMask, "DontInline"),
|
||||||
@ -70,11 +70,11 @@ TEST_F(OpFunctionControlTest, CombinedFunctionControlMask) {
|
|||||||
// the instruction parsing logic with spvTextParseMask.
|
// the instruction parsing logic with spvTextParseMask.
|
||||||
const std::string input =
|
const std::string input =
|
||||||
"%result_id = OpFunction %result_type Inline|Pure|Const %function_type";
|
"%result_id = OpFunction %result_type Inline|Pure|Const %function_type";
|
||||||
const uint32_t expected_mask = spv::FunctionControlInlineMask |
|
const uint32_t expected_mask = SpvFunctionControlInlineMask |
|
||||||
spv::FunctionControlPureMask |
|
SpvFunctionControlPureMask |
|
||||||
spv::FunctionControlConstMask;
|
SpvFunctionControlConstMask;
|
||||||
EXPECT_THAT(CompiledInstructions(input),
|
EXPECT_THAT(CompiledInstructions(input),
|
||||||
Eq(MakeInstruction(spv::OpFunction, {1, 2, expected_mask, 3})));
|
Eq(MakeInstruction(SpvOpFunction, {1, 2, expected_mask, 3})));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(OpFunctionControlTest, WrongFunctionControl) {
|
TEST_F(OpFunctionControlTest, WrongFunctionControl) {
|
||||||
|
@ -41,20 +41,20 @@ using ::testing::Eq;
|
|||||||
// Test GroupOperation enum
|
// Test GroupOperation enum
|
||||||
|
|
||||||
using GroupOperationTest = spvtest::TextToBinaryTestBase<
|
using GroupOperationTest = spvtest::TextToBinaryTestBase<
|
||||||
::testing::TestWithParam<EnumCase<spv::GroupOperation>>>;
|
::testing::TestWithParam<EnumCase<SpvGroupOperation>>>;
|
||||||
|
|
||||||
TEST_P(GroupOperationTest, AnyGroupOperation) {
|
TEST_P(GroupOperationTest, AnyGroupOperation) {
|
||||||
const std::string input =
|
const std::string input =
|
||||||
"%result = OpGroupIAdd %type %scope " + GetParam().name() + " %x";
|
"%result = OpGroupIAdd %type %scope " + GetParam().name() + " %x";
|
||||||
EXPECT_THAT(
|
EXPECT_THAT(
|
||||||
CompiledInstructions(input),
|
CompiledInstructions(input),
|
||||||
Eq(MakeInstruction(spv::OpGroupIAdd, {1, 2, 3, GetParam().value(), 4})));
|
Eq(MakeInstruction(SpvOpGroupIAdd, {1, 2, 3, GetParam().value(), 4})));
|
||||||
}
|
}
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
#define CASE(NAME) { spv::GroupOperation##NAME, #NAME}
|
#define CASE(NAME) { SpvGroupOperation##NAME, #NAME}
|
||||||
INSTANTIATE_TEST_CASE_P(TextToBinaryGroupOperation, GroupOperationTest,
|
INSTANTIATE_TEST_CASE_P(TextToBinaryGroupOperation, GroupOperationTest,
|
||||||
::testing::ValuesIn(std::vector<EnumCase<spv::GroupOperation>>{
|
::testing::ValuesIn(std::vector<EnumCase<SpvGroupOperation>>{
|
||||||
CASE(Reduce),
|
CASE(Reduce),
|
||||||
CASE(InclusiveScan),
|
CASE(InclusiveScan),
|
||||||
CASE(ExclusiveScan),
|
CASE(ExclusiveScan),
|
||||||
|
@ -53,11 +53,11 @@ TEST_P(ImageOperandsTest, Sample) {
|
|||||||
const std::string input =
|
const std::string input =
|
||||||
"%result = OpImageFetch %type %image %coord " + GetParam().image_operands;
|
"%result = OpImageFetch %type %image %coord " + GetParam().image_operands;
|
||||||
EXPECT_THAT(CompiledInstructions(input),
|
EXPECT_THAT(CompiledInstructions(input),
|
||||||
Eq(MakeInstruction(spv::OpImageFetch, {1, 2, 3, 4},
|
Eq(MakeInstruction(SpvOpImageFetch, {1, 2, 3, 4},
|
||||||
GetParam().expected_mask_and_operands)));
|
GetParam().expected_mask_and_operands)));
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MASK(NAME) spv::ImageOperands##NAME##Mask
|
#define MASK(NAME) SpvImageOperands##NAME##Mask
|
||||||
INSTANTIATE_TEST_CASE_P(
|
INSTANTIATE_TEST_CASE_P(
|
||||||
TextToBinaryImageOperandsAny, ImageOperandsTest,
|
TextToBinaryImageOperandsAny, ImageOperandsTest,
|
||||||
::testing::ValuesIn(std::vector<ImageOperandsCase>{
|
::testing::ValuesIn(std::vector<ImageOperandsCase>{
|
||||||
@ -76,7 +76,7 @@ INSTANTIATE_TEST_CASE_P(
|
|||||||
{"MinLod %17", {MASK(MinLod), 5}},
|
{"MinLod %17", {MASK(MinLod), 5}},
|
||||||
}));
|
}));
|
||||||
#undef MASK
|
#undef MASK
|
||||||
#define MASK(NAME) static_cast<uint32_t>(spv::ImageOperands##NAME##Mask)
|
#define MASK(NAME) static_cast<uint32_t>(SpvImageOperands##NAME##Mask)
|
||||||
INSTANTIATE_TEST_CASE_P(
|
INSTANTIATE_TEST_CASE_P(
|
||||||
TextToBinaryImageOperandsCombination, ImageOperandsTest,
|
TextToBinaryImageOperandsCombination, ImageOperandsTest,
|
||||||
::testing::ValuesIn(std::vector<ImageOperandsCase>{
|
::testing::ValuesIn(std::vector<ImageOperandsCase>{
|
||||||
|
@ -44,51 +44,51 @@ using ::testing::Eq;
|
|||||||
// Test assembly of Memory Access masks
|
// Test assembly of Memory Access masks
|
||||||
|
|
||||||
using MemoryAccessTest = spvtest::TextToBinaryTestBase<
|
using MemoryAccessTest = spvtest::TextToBinaryTestBase<
|
||||||
::testing::TestWithParam<EnumCase<spv::MemoryAccessMask>>>;
|
::testing::TestWithParam<EnumCase<SpvMemoryAccessMask>>>;
|
||||||
|
|
||||||
TEST_P(MemoryAccessTest, AnySingleMemoryAccessMask) {
|
TEST_P(MemoryAccessTest, AnySingleMemoryAccessMask) {
|
||||||
std::stringstream input;
|
std::stringstream input;
|
||||||
input << "OpStore %ptr %value " << GetParam().name();
|
input << "OpStore %ptr %value " << GetParam().name();
|
||||||
for (auto operand : GetParam().operands()) input << " " << operand;
|
for (auto operand : GetParam().operands()) input << " " << operand;
|
||||||
EXPECT_THAT(CompiledInstructions(input.str()),
|
EXPECT_THAT(CompiledInstructions(input.str()),
|
||||||
Eq(MakeInstruction(spv::OpStore, {1, 2, GetParam().value()},
|
Eq(MakeInstruction(SpvOpStore, {1, 2, GetParam().value()},
|
||||||
GetParam().operands())));
|
GetParam().operands())));
|
||||||
}
|
}
|
||||||
|
|
||||||
INSTANTIATE_TEST_CASE_P(
|
INSTANTIATE_TEST_CASE_P(
|
||||||
TextToBinaryMemoryAccessTest, MemoryAccessTest,
|
TextToBinaryMemoryAccessTest, MemoryAccessTest,
|
||||||
::testing::ValuesIn(std::vector<EnumCase<spv::MemoryAccessMask>>{
|
::testing::ValuesIn(std::vector<EnumCase<SpvMemoryAccessMask>>{
|
||||||
{spv::MemoryAccessMaskNone, "None", {}},
|
{SpvMemoryAccessMaskNone, "None", {}},
|
||||||
{spv::MemoryAccessVolatileMask, "Volatile", {}},
|
{SpvMemoryAccessVolatileMask, "Volatile", {}},
|
||||||
{spv::MemoryAccessAlignedMask, "Aligned", {16}},
|
{SpvMemoryAccessAlignedMask, "Aligned", {16}},
|
||||||
{spv::MemoryAccessNontemporalMask, "Nontemporal", {}},
|
{SpvMemoryAccessNontemporalMask, "Nontemporal", {}},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
TEST_F(TextToBinaryTest, CombinedMemoryAccessMask) {
|
TEST_F(TextToBinaryTest, CombinedMemoryAccessMask) {
|
||||||
const std::string input = "OpStore %ptr %value Volatile|Aligned 16";
|
const std::string input = "OpStore %ptr %value Volatile|Aligned 16";
|
||||||
const uint32_t expected_mask =
|
const uint32_t expected_mask =
|
||||||
spv::MemoryAccessVolatileMask | spv::MemoryAccessAlignedMask;
|
SpvMemoryAccessVolatileMask | SpvMemoryAccessAlignedMask;
|
||||||
EXPECT_THAT(expected_mask, Eq(3));
|
EXPECT_THAT(expected_mask, Eq(3));
|
||||||
EXPECT_THAT(CompiledInstructions(input),
|
EXPECT_THAT(CompiledInstructions(input),
|
||||||
Eq(MakeInstruction(spv::OpStore, {1, 2, expected_mask, 16})));
|
Eq(MakeInstruction(SpvOpStore, {1, 2, expected_mask, 16})));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Test Storage Class enum values
|
// Test Storage Class enum values
|
||||||
|
|
||||||
using StorageClassTest = spvtest::TextToBinaryTestBase<
|
using StorageClassTest = spvtest::TextToBinaryTestBase<
|
||||||
::testing::TestWithParam<EnumCase<spv::StorageClass>>>;
|
::testing::TestWithParam<EnumCase<SpvStorageClass>>>;
|
||||||
|
|
||||||
TEST_P(StorageClassTest, AnyStorageClass) {
|
TEST_P(StorageClassTest, AnyStorageClass) {
|
||||||
const std::string input = "%1 = OpVariable %2 " + GetParam().name();
|
const std::string input = "%1 = OpVariable %2 " + GetParam().name();
|
||||||
EXPECT_THAT(CompiledInstructions(input),
|
EXPECT_THAT(CompiledInstructions(input),
|
||||||
Eq(MakeInstruction(spv::OpVariable, {1, 2, GetParam().value()})));
|
Eq(MakeInstruction(SpvOpVariable, {1, 2, GetParam().value()})));
|
||||||
}
|
}
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
#define CASE(NAME) { spv::StorageClass##NAME, #NAME, {} }
|
#define CASE(NAME) { SpvStorageClass##NAME, #NAME, {} }
|
||||||
INSTANTIATE_TEST_CASE_P(
|
INSTANTIATE_TEST_CASE_P(
|
||||||
TextToBinaryStorageClassTest, StorageClassTest,
|
TextToBinaryStorageClassTest, StorageClassTest,
|
||||||
::testing::ValuesIn(std::vector<EnumCase<spv::StorageClass>>{
|
::testing::ValuesIn(std::vector<EnumCase<SpvStorageClass>>{
|
||||||
CASE(UniformConstant),
|
CASE(UniformConstant),
|
||||||
CASE(Input),
|
CASE(Input),
|
||||||
CASE(Uniform),
|
CASE(Uniform),
|
||||||
|
@ -35,13 +35,12 @@
|
|||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
using SpirvVector = spvtest::TextToBinaryTest::SpirvVector;
|
using SpirvVector = spvtest::TextToBinaryTest::SpirvVector;
|
||||||
using spv::Op;
|
|
||||||
using spvtest::MakeInstruction;
|
using spvtest::MakeInstruction;
|
||||||
using ::testing::Eq;
|
using ::testing::Eq;
|
||||||
using TextToBinaryMisc = spvtest::TextToBinaryTest;
|
using TextToBinaryMisc = spvtest::TextToBinaryTest;
|
||||||
|
|
||||||
TEST_F(TextToBinaryMisc, OpNop) {
|
TEST_F(TextToBinaryMisc, OpNop) {
|
||||||
EXPECT_THAT(CompiledInstructions("OpNop"), Eq(MakeInstruction(OpNop, {})));
|
EXPECT_THAT(CompiledInstructions("OpNop"), Eq(MakeInstruction(SpvOpNop, {})));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(TextToBinaryMisc, OpUndef) {
|
TEST_F(TextToBinaryMisc, OpUndef) {
|
||||||
@ -49,7 +48,7 @@ TEST_F(TextToBinaryMisc, OpUndef) {
|
|||||||
%u = OpUndef %f32)");
|
%u = OpUndef %f32)");
|
||||||
const uint32_t typeID = 1;
|
const uint32_t typeID = 1;
|
||||||
EXPECT_THAT(code[1], Eq(typeID));
|
EXPECT_THAT(code[1], Eq(typeID));
|
||||||
EXPECT_THAT(Subvector(code, 3), Eq(MakeInstruction(OpUndef, {typeID, 2})));
|
EXPECT_THAT(Subvector(code, 3), Eq(MakeInstruction(SpvOpUndef, {typeID, 2})));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
@ -49,9 +49,9 @@ struct MemoryModelCase {
|
|||||||
uint32_t get_memory_value() const {
|
uint32_t get_memory_value() const {
|
||||||
return static_cast<uint32_t>(memory_value);
|
return static_cast<uint32_t>(memory_value);
|
||||||
}
|
}
|
||||||
spv::AddressingModel addressing_value;
|
SpvAddressingModel addressing_value;
|
||||||
std::string addressing_name;
|
std::string addressing_name;
|
||||||
spv::MemoryModel memory_value;
|
SpvMemoryModel memory_value;
|
||||||
std::string memory_name;
|
std::string memory_name;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -63,13 +63,13 @@ TEST_P(OpMemoryModelTest, AnyMemoryModelCase) {
|
|||||||
" " + GetParam().memory_name;
|
" " + GetParam().memory_name;
|
||||||
EXPECT_THAT(
|
EXPECT_THAT(
|
||||||
CompiledInstructions(input),
|
CompiledInstructions(input),
|
||||||
Eq(MakeInstruction(spv::OpMemoryModel, {GetParam().get_addressing_value(),
|
Eq(MakeInstruction(SpvOpMemoryModel, {GetParam().get_addressing_value(),
|
||||||
GetParam().get_memory_value()})));
|
GetParam().get_memory_value()})));
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CASE(ADDRESSING, MEMORY) \
|
#define CASE(ADDRESSING, MEMORY) \
|
||||||
{ \
|
{ \
|
||||||
spv::AddressingModel##ADDRESSING, #ADDRESSING, spv::MemoryModel##MEMORY, \
|
SpvAddressingModel##ADDRESSING, #ADDRESSING, SpvMemoryModel##MEMORY, \
|
||||||
#MEMORY \
|
#MEMORY \
|
||||||
}
|
}
|
||||||
// clang-format off
|
// clang-format off
|
||||||
@ -100,7 +100,7 @@ struct EntryPointCase {
|
|||||||
uint32_t get_execution_value() const {
|
uint32_t get_execution_value() const {
|
||||||
return static_cast<uint32_t>(execution_value);
|
return static_cast<uint32_t>(execution_value);
|
||||||
}
|
}
|
||||||
spv::ExecutionModel execution_value;
|
SpvExecutionModel execution_value;
|
||||||
std::string execution_name;
|
std::string execution_name;
|
||||||
std::string entry_point_name;
|
std::string entry_point_name;
|
||||||
};
|
};
|
||||||
@ -113,13 +113,13 @@ TEST_P(OpEntryPointTest, AnyEntryPointCase) {
|
|||||||
const std::string input = "OpEntryPoint " + GetParam().execution_name +
|
const std::string input = "OpEntryPoint " + GetParam().execution_name +
|
||||||
" %1 \"" + GetParam().entry_point_name + "\"";
|
" %1 \"" + GetParam().entry_point_name + "\"";
|
||||||
EXPECT_THAT(CompiledInstructions(input),
|
EXPECT_THAT(CompiledInstructions(input),
|
||||||
Eq(MakeInstruction(spv::OpEntryPoint,
|
Eq(MakeInstruction(SpvOpEntryPoint,
|
||||||
{GetParam().get_execution_value(), 1},
|
{GetParam().get_execution_value(), 1},
|
||||||
MakeVector(GetParam().entry_point_name))));
|
MakeVector(GetParam().entry_point_name))));
|
||||||
}
|
}
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
#define CASE(NAME) spv::ExecutionModel##NAME, #NAME
|
#define CASE(NAME) SpvExecutionModel##NAME, #NAME
|
||||||
INSTANTIATE_TEST_CASE_P(TextToBinaryEntryPoint, OpEntryPointTest,
|
INSTANTIATE_TEST_CASE_P(TextToBinaryEntryPoint, OpEntryPointTest,
|
||||||
::testing::ValuesIn(std::vector<EntryPointCase>{
|
::testing::ValuesIn(std::vector<EntryPointCase>{
|
||||||
{ CASE(Vertex), "" },
|
{ CASE(Vertex), "" },
|
||||||
@ -141,7 +141,7 @@ TEST_F(OpEntryPointTest, WrongModel) {
|
|||||||
// Test OpExecutionMode
|
// Test OpExecutionMode
|
||||||
|
|
||||||
using OpExecutionModeTest = spvtest::TextToBinaryTestBase<
|
using OpExecutionModeTest = spvtest::TextToBinaryTestBase<
|
||||||
::testing::TestWithParam<EnumCase<spv::ExecutionMode>>>;
|
::testing::TestWithParam<EnumCase<SpvExecutionMode>>>;
|
||||||
|
|
||||||
TEST_P(OpExecutionModeTest, AnyExecutionMode) {
|
TEST_P(OpExecutionModeTest, AnyExecutionMode) {
|
||||||
// This string should assemble, but should not validate.
|
// This string should assemble, but should not validate.
|
||||||
@ -149,14 +149,14 @@ TEST_P(OpExecutionModeTest, AnyExecutionMode) {
|
|||||||
input << "OpExecutionMode %1 " << GetParam().name();
|
input << "OpExecutionMode %1 " << GetParam().name();
|
||||||
for (auto operand : GetParam().operands()) input << " " << operand;
|
for (auto operand : GetParam().operands()) input << " " << operand;
|
||||||
EXPECT_THAT(CompiledInstructions(input.str()),
|
EXPECT_THAT(CompiledInstructions(input.str()),
|
||||||
Eq(MakeInstruction(spv::OpExecutionMode, {1, GetParam().value()},
|
Eq(MakeInstruction(SpvOpExecutionMode, {1, GetParam().value()},
|
||||||
GetParam().operands())));
|
GetParam().operands())));
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CASE(NAME) spv::ExecutionMode##NAME, #NAME
|
#define CASE(NAME) SpvExecutionMode##NAME, #NAME
|
||||||
INSTANTIATE_TEST_CASE_P(
|
INSTANTIATE_TEST_CASE_P(
|
||||||
TextToBinaryExecutionMode, OpExecutionModeTest,
|
TextToBinaryExecutionMode, OpExecutionModeTest,
|
||||||
::testing::ValuesIn(std::vector<EnumCase<spv::ExecutionMode>>{
|
::testing::ValuesIn(std::vector<EnumCase<SpvExecutionMode>>{
|
||||||
// The operand literal values are arbitrarily chosen,
|
// The operand literal values are arbitrarily chosen,
|
||||||
// but there are the right number of them.
|
// but there are the right number of them.
|
||||||
{CASE(Invocations), {101}},
|
{CASE(Invocations), {101}},
|
||||||
@ -202,18 +202,18 @@ TEST_F(OpExecutionModeTest, WrongMode) {
|
|||||||
// Test OpCapability
|
// Test OpCapability
|
||||||
|
|
||||||
using OpCapabilityTest = spvtest::TextToBinaryTestBase<
|
using OpCapabilityTest = spvtest::TextToBinaryTestBase<
|
||||||
::testing::TestWithParam<EnumCase<spv::Capability>>>;
|
::testing::TestWithParam<EnumCase<SpvCapability>>>;
|
||||||
|
|
||||||
TEST_P(OpCapabilityTest, AnyCapability) {
|
TEST_P(OpCapabilityTest, AnyCapability) {
|
||||||
const std::string input = "OpCapability " + GetParam().name();
|
const std::string input = "OpCapability " + GetParam().name();
|
||||||
EXPECT_THAT(CompiledInstructions(input),
|
EXPECT_THAT(CompiledInstructions(input),
|
||||||
Eq(MakeInstruction(spv::OpCapability, {GetParam().value()})));
|
Eq(MakeInstruction(SpvOpCapability, {GetParam().value()})));
|
||||||
}
|
}
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
#define CASE(NAME) { spv::Capability##NAME, #NAME }
|
#define CASE(NAME) { SpvCapability##NAME, #NAME }
|
||||||
INSTANTIATE_TEST_CASE_P(TextToBinaryCapability, OpCapabilityTest,
|
INSTANTIATE_TEST_CASE_P(TextToBinaryCapability, OpCapabilityTest,
|
||||||
::testing::ValuesIn(std::vector<EnumCase<spv::Capability>>{
|
::testing::ValuesIn(std::vector<EnumCase<SpvCapability>>{
|
||||||
CASE(Matrix),
|
CASE(Matrix),
|
||||||
CASE(Shader),
|
CASE(Shader),
|
||||||
CASE(Geometry),
|
CASE(Geometry),
|
||||||
|
@ -41,22 +41,22 @@ using ::testing::Eq;
|
|||||||
// Test Dim enums via OpTypeImage
|
// Test Dim enums via OpTypeImage
|
||||||
|
|
||||||
using DimTest =
|
using DimTest =
|
||||||
spvtest::TextToBinaryTestBase<::testing::TestWithParam<EnumCase<spv::Dim>>>;
|
spvtest::TextToBinaryTestBase<::testing::TestWithParam<EnumCase<SpvDim>>>;
|
||||||
|
|
||||||
TEST_P(DimTest, AnyDim) {
|
TEST_P(DimTest, AnyDim) {
|
||||||
const std::string input = "%imageType = OpTypeImage %sampledType " +
|
const std::string input = "%imageType = OpTypeImage %sampledType " +
|
||||||
GetParam().name() + " 2 3 0 4 Rgba8";
|
GetParam().name() + " 2 3 0 4 Rgba8";
|
||||||
EXPECT_THAT(
|
EXPECT_THAT(
|
||||||
CompiledInstructions(input),
|
CompiledInstructions(input),
|
||||||
Eq(MakeInstruction(spv::OpTypeImage, {1, 2, GetParam().value(), 2, 3, 0,
|
Eq(MakeInstruction(SpvOpTypeImage, {1, 2, GetParam().value(), 2, 3, 0,
|
||||||
4, spv::ImageFormatRgba8})));
|
4, SpvImageFormatRgba8})));
|
||||||
}
|
}
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
#define CASE(NAME) {spv::Dim##NAME, #NAME}
|
#define CASE(NAME) {SpvDim##NAME, #NAME}
|
||||||
INSTANTIATE_TEST_CASE_P(
|
INSTANTIATE_TEST_CASE_P(
|
||||||
TextToBinaryDim, DimTest,
|
TextToBinaryDim, DimTest,
|
||||||
::testing::ValuesIn(std::vector<EnumCase<spv::Dim>>{
|
::testing::ValuesIn(std::vector<EnumCase<SpvDim>>{
|
||||||
CASE(1D),
|
CASE(1D),
|
||||||
CASE(2D),
|
CASE(2D),
|
||||||
CASE(3D),
|
CASE(3D),
|
||||||
@ -76,21 +76,21 @@ TEST_F(DimTest, WrongDim) {
|
|||||||
// Test ImageFormat enums via OpTypeImage
|
// Test ImageFormat enums via OpTypeImage
|
||||||
|
|
||||||
using ImageFormatTest = spvtest::TextToBinaryTestBase<
|
using ImageFormatTest = spvtest::TextToBinaryTestBase<
|
||||||
::testing::TestWithParam<EnumCase<spv::ImageFormat>>>;
|
::testing::TestWithParam<EnumCase<SpvImageFormat>>>;
|
||||||
|
|
||||||
TEST_P(ImageFormatTest, AnyImageFormat) {
|
TEST_P(ImageFormatTest, AnyImageFormat) {
|
||||||
const std::string input =
|
const std::string input =
|
||||||
"%imageType = OpTypeImage %sampledType 1D 2 3 0 4 " + GetParam().name();
|
"%imageType = OpTypeImage %sampledType 1D 2 3 0 4 " + GetParam().name();
|
||||||
EXPECT_THAT(CompiledInstructions(input),
|
EXPECT_THAT(CompiledInstructions(input),
|
||||||
Eq(MakeInstruction(spv::OpTypeImage, {1, 2, spv::Dim1D, 2, 3, 0,
|
Eq(MakeInstruction(SpvOpTypeImage, {1, 2, SpvDim1D, 2, 3, 0,
|
||||||
4, GetParam().value()})));
|
4, GetParam().value()})));
|
||||||
}
|
}
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
#define CASE(NAME) {spv::ImageFormat##NAME, #NAME}
|
#define CASE(NAME) {SpvImageFormat##NAME, #NAME}
|
||||||
INSTANTIATE_TEST_CASE_P(
|
INSTANTIATE_TEST_CASE_P(
|
||||||
TextToBinaryImageFormat, ImageFormatTest,
|
TextToBinaryImageFormat, ImageFormatTest,
|
||||||
::testing::ValuesIn(std::vector<EnumCase<spv::ImageFormat>>{
|
::testing::ValuesIn(std::vector<EnumCase<SpvImageFormat>>{
|
||||||
CASE(Unknown),
|
CASE(Unknown),
|
||||||
CASE(Rgba32f),
|
CASE(Rgba32f),
|
||||||
CASE(Rgba16f),
|
CASE(Rgba16f),
|
||||||
@ -143,19 +143,19 @@ TEST_F(ImageFormatTest, WrongFormat) {
|
|||||||
// Test AccessQualifier enums via OpTypePipe.
|
// Test AccessQualifier enums via OpTypePipe.
|
||||||
|
|
||||||
using OpTypePipeTest = spvtest::TextToBinaryTestBase<
|
using OpTypePipeTest = spvtest::TextToBinaryTestBase<
|
||||||
::testing::TestWithParam<EnumCase<spv::AccessQualifier>>>;
|
::testing::TestWithParam<EnumCase<SpvAccessQualifier>>>;
|
||||||
|
|
||||||
TEST_P(OpTypePipeTest, AnyAccessQualifier) {
|
TEST_P(OpTypePipeTest, AnyAccessQualifier) {
|
||||||
const std::string input = "%1 = OpTypePipe " + GetParam().name();
|
const std::string input = "%1 = OpTypePipe " + GetParam().name();
|
||||||
EXPECT_THAT(CompiledInstructions(input),
|
EXPECT_THAT(CompiledInstructions(input),
|
||||||
Eq(MakeInstruction(spv::OpTypePipe, {1, GetParam().value()})));
|
Eq(MakeInstruction(SpvOpTypePipe, {1, GetParam().value()})));
|
||||||
}
|
}
|
||||||
|
|
||||||
// clang-format off
|
// clang-format off
|
||||||
#define CASE(NAME) {spv::AccessQualifier##NAME, #NAME}
|
#define CASE(NAME) {SpvAccessQualifier##NAME, #NAME}
|
||||||
INSTANTIATE_TEST_CASE_P(
|
INSTANTIATE_TEST_CASE_P(
|
||||||
TextToBinaryTypePipe, OpTypePipeTest,
|
TextToBinaryTypePipe, OpTypePipeTest,
|
||||||
::testing::ValuesIn(std::vector<EnumCase<spv::AccessQualifier>>{
|
::testing::ValuesIn(std::vector<EnumCase<SpvAccessQualifier>>{
|
||||||
CASE(ReadOnly),
|
CASE(ReadOnly),
|
||||||
CASE(WriteOnly),
|
CASE(WriteOnly),
|
||||||
CASE(ReadWrite),
|
CASE(ReadWrite),
|
||||||
@ -174,8 +174,8 @@ using OpTypeForwardPointerTest = spvtest::TextToBinaryTest;
|
|||||||
do { \
|
do { \
|
||||||
EXPECT_THAT( \
|
EXPECT_THAT( \
|
||||||
CompiledInstructions("OpTypeForwardPointer %pt " #storage_class), \
|
CompiledInstructions("OpTypeForwardPointer %pt " #storage_class), \
|
||||||
Eq(MakeInstruction(spv::OpTypeForwardPointer, \
|
Eq(MakeInstruction(SpvOpTypeForwardPointer, \
|
||||||
{1, StorageClass##storage_class}))); \
|
{1, SpvStorageClass##storage_class}))); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
TEST_F(OpTypeForwardPointerTest, ValidStorageClass) {
|
TEST_F(OpTypeForwardPointerTest, ValidStorageClass) {
|
||||||
|
@ -197,17 +197,17 @@ TEST(TextToBinary, Default) {
|
|||||||
|
|
||||||
uint64_t instIndex = SPV_INDEX_INSTRUCTION;
|
uint64_t instIndex = SPV_INDEX_INSTRUCTION;
|
||||||
|
|
||||||
ASSERT_EQ(spvOpcodeMake(3, OpSource), binary->code[instIndex++]);
|
ASSERT_EQ(spvOpcodeMake(3, SpvOpSource), binary->code[instIndex++]);
|
||||||
ASSERT_EQ(SourceLanguageOpenCL, binary->code[instIndex++]);
|
ASSERT_EQ(SpvSourceLanguageOpenCL, binary->code[instIndex++]);
|
||||||
ASSERT_EQ(12, binary->code[instIndex++]);
|
ASSERT_EQ(12, binary->code[instIndex++]);
|
||||||
|
|
||||||
ASSERT_EQ(spvOpcodeMake(3, OpMemoryModel), binary->code[instIndex++]);
|
ASSERT_EQ(spvOpcodeMake(3, SpvOpMemoryModel), binary->code[instIndex++]);
|
||||||
ASSERT_EQ(AddressingModelPhysical64, binary->code[instIndex++]);
|
ASSERT_EQ(SpvAddressingModelPhysical64, binary->code[instIndex++]);
|
||||||
ASSERT_EQ(MemoryModelOpenCL, binary->code[instIndex++]);
|
ASSERT_EQ(SpvMemoryModelOpenCL, binary->code[instIndex++]);
|
||||||
|
|
||||||
uint16_t sourceExtensionWordCount =
|
uint16_t sourceExtensionWordCount =
|
||||||
(uint16_t)((strlen("PlaceholderExtensionName") / sizeof(uint32_t)) + 2);
|
(uint16_t)((strlen("PlaceholderExtensionName") / sizeof(uint32_t)) + 2);
|
||||||
ASSERT_EQ(spvOpcodeMake(sourceExtensionWordCount, OpSourceExtension),
|
ASSERT_EQ(spvOpcodeMake(sourceExtensionWordCount, SpvOpSourceExtension),
|
||||||
binary->code[instIndex++]);
|
binary->code[instIndex++]);
|
||||||
// TODO: This only works on little endian systems!
|
// TODO: This only works on little endian systems!
|
||||||
char_word_t cw = {{'P', 'l', 'a', 'c'}};
|
char_word_t cw = {{'P', 'l', 'a', 'c'}};
|
||||||
@ -224,78 +224,78 @@ TEST(TextToBinary, Default) {
|
|||||||
ASSERT_EQ(spvFixWord(cw.u, endian), binary->code[instIndex++]);
|
ASSERT_EQ(spvFixWord(cw.u, endian), binary->code[instIndex++]);
|
||||||
ASSERT_EQ(0, binary->code[instIndex++]);
|
ASSERT_EQ(0, binary->code[instIndex++]);
|
||||||
|
|
||||||
ASSERT_EQ(spvOpcodeMake(4, OpEntryPoint), binary->code[instIndex++]);
|
ASSERT_EQ(spvOpcodeMake(4, SpvOpEntryPoint), binary->code[instIndex++]);
|
||||||
ASSERT_EQ(ExecutionModelKernel, binary->code[instIndex++]);
|
ASSERT_EQ(SpvExecutionModelKernel, binary->code[instIndex++]);
|
||||||
ASSERT_EQ(1, binary->code[instIndex++]);
|
ASSERT_EQ(1, binary->code[instIndex++]);
|
||||||
cw = {{'f', 'o', 'o', 0}};
|
cw = {{'f', 'o', 'o', 0}};
|
||||||
ASSERT_EQ(spvFixWord(cw.u, endian), binary->code[instIndex++]);
|
ASSERT_EQ(spvFixWord(cw.u, endian), binary->code[instIndex++]);
|
||||||
|
|
||||||
ASSERT_EQ(spvOpcodeMake(6, OpExecutionMode), binary->code[instIndex++]);
|
ASSERT_EQ(spvOpcodeMake(6, SpvOpExecutionMode), binary->code[instIndex++]);
|
||||||
ASSERT_EQ(1, binary->code[instIndex++]);
|
ASSERT_EQ(1, binary->code[instIndex++]);
|
||||||
ASSERT_EQ(ExecutionModeLocalSizeHint, binary->code[instIndex++]);
|
ASSERT_EQ(SpvExecutionModeLocalSizeHint, binary->code[instIndex++]);
|
||||||
ASSERT_EQ(1, binary->code[instIndex++]);
|
ASSERT_EQ(1, binary->code[instIndex++]);
|
||||||
ASSERT_EQ(1, binary->code[instIndex++]);
|
ASSERT_EQ(1, binary->code[instIndex++]);
|
||||||
ASSERT_EQ(1, binary->code[instIndex++]);
|
ASSERT_EQ(1, binary->code[instIndex++]);
|
||||||
|
|
||||||
ASSERT_EQ(spvOpcodeMake(2, OpTypeVoid), binary->code[instIndex++]);
|
ASSERT_EQ(spvOpcodeMake(2, SpvOpTypeVoid), binary->code[instIndex++]);
|
||||||
ASSERT_EQ(2, binary->code[instIndex++]);
|
ASSERT_EQ(2, binary->code[instIndex++]);
|
||||||
|
|
||||||
ASSERT_EQ(spvOpcodeMake(2, OpTypeBool), binary->code[instIndex++]);
|
ASSERT_EQ(spvOpcodeMake(2, SpvOpTypeBool), binary->code[instIndex++]);
|
||||||
ASSERT_EQ(3, binary->code[instIndex++]);
|
ASSERT_EQ(3, binary->code[instIndex++]);
|
||||||
|
|
||||||
ASSERT_EQ(spvOpcodeMake(4, OpTypeInt), binary->code[instIndex++]);
|
ASSERT_EQ(spvOpcodeMake(4, SpvOpTypeInt), binary->code[instIndex++]);
|
||||||
ASSERT_EQ(4, binary->code[instIndex++]);
|
ASSERT_EQ(4, binary->code[instIndex++]);
|
||||||
ASSERT_EQ(8, binary->code[instIndex++]); // NOTE: 8 bits wide
|
ASSERT_EQ(8, binary->code[instIndex++]); // NOTE: 8 bits wide
|
||||||
ASSERT_EQ(0, binary->code[instIndex++]); // NOTE: Unsigned
|
ASSERT_EQ(0, binary->code[instIndex++]); // NOTE: Unsigned
|
||||||
|
|
||||||
ASSERT_EQ(spvOpcodeMake(4, OpTypeInt), binary->code[instIndex++]);
|
ASSERT_EQ(spvOpcodeMake(4, SpvOpTypeInt), binary->code[instIndex++]);
|
||||||
ASSERT_EQ(5, binary->code[instIndex++]);
|
ASSERT_EQ(5, binary->code[instIndex++]);
|
||||||
ASSERT_EQ(8, binary->code[instIndex++]); // NOTE: 8 bits wide
|
ASSERT_EQ(8, binary->code[instIndex++]); // NOTE: 8 bits wide
|
||||||
ASSERT_EQ(1, binary->code[instIndex++]); // NOTE: Signed
|
ASSERT_EQ(1, binary->code[instIndex++]); // NOTE: Signed
|
||||||
|
|
||||||
ASSERT_EQ(spvOpcodeMake(4, OpTypeInt), binary->code[instIndex++]);
|
ASSERT_EQ(spvOpcodeMake(4, SpvOpTypeInt), binary->code[instIndex++]);
|
||||||
ASSERT_EQ(6, binary->code[instIndex++]);
|
ASSERT_EQ(6, binary->code[instIndex++]);
|
||||||
ASSERT_EQ(16, binary->code[instIndex++]); // NOTE: 16 bits wide
|
ASSERT_EQ(16, binary->code[instIndex++]); // NOTE: 16 bits wide
|
||||||
ASSERT_EQ(0, binary->code[instIndex++]); // NOTE: Unsigned
|
ASSERT_EQ(0, binary->code[instIndex++]); // NOTE: Unsigned
|
||||||
|
|
||||||
ASSERT_EQ(spvOpcodeMake(4, OpTypeInt), binary->code[instIndex++]);
|
ASSERT_EQ(spvOpcodeMake(4, SpvOpTypeInt), binary->code[instIndex++]);
|
||||||
ASSERT_EQ(7, binary->code[instIndex++]);
|
ASSERT_EQ(7, binary->code[instIndex++]);
|
||||||
ASSERT_EQ(16, binary->code[instIndex++]); // NOTE: 16 bits wide
|
ASSERT_EQ(16, binary->code[instIndex++]); // NOTE: 16 bits wide
|
||||||
ASSERT_EQ(1, binary->code[instIndex++]); // NOTE: Signed
|
ASSERT_EQ(1, binary->code[instIndex++]); // NOTE: Signed
|
||||||
|
|
||||||
ASSERT_EQ(spvOpcodeMake(4, OpTypeInt), binary->code[instIndex++]);
|
ASSERT_EQ(spvOpcodeMake(4, SpvOpTypeInt), binary->code[instIndex++]);
|
||||||
ASSERT_EQ(8, binary->code[instIndex++]);
|
ASSERT_EQ(8, binary->code[instIndex++]);
|
||||||
ASSERT_EQ(32, binary->code[instIndex++]); // NOTE: 32 bits wide
|
ASSERT_EQ(32, binary->code[instIndex++]); // NOTE: 32 bits wide
|
||||||
ASSERT_EQ(0, binary->code[instIndex++]); // NOTE: Unsigned
|
ASSERT_EQ(0, binary->code[instIndex++]); // NOTE: Unsigned
|
||||||
|
|
||||||
ASSERT_EQ(spvOpcodeMake(4, OpTypeInt), binary->code[instIndex++]);
|
ASSERT_EQ(spvOpcodeMake(4, SpvOpTypeInt), binary->code[instIndex++]);
|
||||||
ASSERT_EQ(9, binary->code[instIndex++]);
|
ASSERT_EQ(9, binary->code[instIndex++]);
|
||||||
ASSERT_EQ(32, binary->code[instIndex++]); // NOTE: 32 bits wide
|
ASSERT_EQ(32, binary->code[instIndex++]); // NOTE: 32 bits wide
|
||||||
ASSERT_EQ(1, binary->code[instIndex++]); // NOTE: Signed
|
ASSERT_EQ(1, binary->code[instIndex++]); // NOTE: Signed
|
||||||
|
|
||||||
ASSERT_EQ(spvOpcodeMake(4, OpTypeInt), binary->code[instIndex++]);
|
ASSERT_EQ(spvOpcodeMake(4, SpvOpTypeInt), binary->code[instIndex++]);
|
||||||
ASSERT_EQ(10, binary->code[instIndex++]);
|
ASSERT_EQ(10, binary->code[instIndex++]);
|
||||||
ASSERT_EQ(64, binary->code[instIndex++]); // NOTE: 64 bits wide
|
ASSERT_EQ(64, binary->code[instIndex++]); // NOTE: 64 bits wide
|
||||||
ASSERT_EQ(0, binary->code[instIndex++]); // NOTE: Unsigned
|
ASSERT_EQ(0, binary->code[instIndex++]); // NOTE: Unsigned
|
||||||
|
|
||||||
ASSERT_EQ(spvOpcodeMake(4, OpTypeInt), binary->code[instIndex++]);
|
ASSERT_EQ(spvOpcodeMake(4, SpvOpTypeInt), binary->code[instIndex++]);
|
||||||
ASSERT_EQ(11, binary->code[instIndex++]);
|
ASSERT_EQ(11, binary->code[instIndex++]);
|
||||||
ASSERT_EQ(64, binary->code[instIndex++]); // NOTE: 64 bits wide
|
ASSERT_EQ(64, binary->code[instIndex++]); // NOTE: 64 bits wide
|
||||||
ASSERT_EQ(1, binary->code[instIndex++]); // NOTE: Signed
|
ASSERT_EQ(1, binary->code[instIndex++]); // NOTE: Signed
|
||||||
|
|
||||||
ASSERT_EQ(spvOpcodeMake(3, OpTypeFloat), binary->code[instIndex++]);
|
ASSERT_EQ(spvOpcodeMake(3, SpvOpTypeFloat), binary->code[instIndex++]);
|
||||||
ASSERT_EQ(12, binary->code[instIndex++]);
|
ASSERT_EQ(12, binary->code[instIndex++]);
|
||||||
ASSERT_EQ(16, binary->code[instIndex++]); // NOTE: 16 bits wide
|
ASSERT_EQ(16, binary->code[instIndex++]); // NOTE: 16 bits wide
|
||||||
|
|
||||||
ASSERT_EQ(spvOpcodeMake(3, OpTypeFloat), binary->code[instIndex++]);
|
ASSERT_EQ(spvOpcodeMake(3, SpvOpTypeFloat), binary->code[instIndex++]);
|
||||||
ASSERT_EQ(13, binary->code[instIndex++]);
|
ASSERT_EQ(13, binary->code[instIndex++]);
|
||||||
ASSERT_EQ(32, binary->code[instIndex++]); // NOTE: 32 bits wide
|
ASSERT_EQ(32, binary->code[instIndex++]); // NOTE: 32 bits wide
|
||||||
|
|
||||||
ASSERT_EQ(spvOpcodeMake(3, OpTypeFloat), binary->code[instIndex++]);
|
ASSERT_EQ(spvOpcodeMake(3, SpvOpTypeFloat), binary->code[instIndex++]);
|
||||||
ASSERT_EQ(14, binary->code[instIndex++]);
|
ASSERT_EQ(14, binary->code[instIndex++]);
|
||||||
ASSERT_EQ(64, binary->code[instIndex++]); // NOTE: 64 bits wide
|
ASSERT_EQ(64, binary->code[instIndex++]); // NOTE: 64 bits wide
|
||||||
|
|
||||||
ASSERT_EQ(spvOpcodeMake(4, OpTypeVector), binary->code[instIndex++]);
|
ASSERT_EQ(spvOpcodeMake(4, SpvOpTypeVector), binary->code[instIndex++]);
|
||||||
ASSERT_EQ(15, binary->code[instIndex++]);
|
ASSERT_EQ(15, binary->code[instIndex++]);
|
||||||
ASSERT_EQ(4, binary->code[instIndex++]);
|
ASSERT_EQ(4, binary->code[instIndex++]);
|
||||||
ASSERT_EQ(2, binary->code[instIndex++]);
|
ASSERT_EQ(2, binary->code[instIndex++]);
|
||||||
|
@ -114,7 +114,7 @@ inline void PrintTo(const WordVector& words, ::std::ostream* os) {
|
|||||||
// Returns a vector of words representing a single instruction with the
|
// Returns a vector of words representing a single instruction with the
|
||||||
// given opcode and operand words as a vector.
|
// given opcode and operand words as a vector.
|
||||||
inline std::vector<uint32_t> MakeInstruction(
|
inline std::vector<uint32_t> MakeInstruction(
|
||||||
spv::Op opcode, const std::vector<uint32_t>& args) {
|
SpvOp opcode, const std::vector<uint32_t>& args) {
|
||||||
std::vector<uint32_t> result{
|
std::vector<uint32_t> result{
|
||||||
spvOpcodeMake(uint16_t(args.size() + 1), opcode)};
|
spvOpcodeMake(uint16_t(args.size() + 1), opcode)};
|
||||||
result.insert(result.end(), args.begin(), args.end());
|
result.insert(result.end(), args.begin(), args.end());
|
||||||
@ -126,7 +126,7 @@ inline std::vector<uint32_t> MakeInstruction(
|
|||||||
// given opcode and whose operands are the concatenation of the two given
|
// given opcode and whose operands are the concatenation of the two given
|
||||||
// argument lists.
|
// argument lists.
|
||||||
inline std::vector<uint32_t> MakeInstruction(
|
inline std::vector<uint32_t> MakeInstruction(
|
||||||
spv::Op opcode, std::vector<uint32_t> args,
|
SpvOp opcode, std::vector<uint32_t> args,
|
||||||
const std::vector<uint32_t>& extra_args) {
|
const std::vector<uint32_t>& extra_args) {
|
||||||
args.insert(args.end(), extra_args.begin(), extra_args.end());
|
args.insert(args.end(), extra_args.begin(), extra_args.end());
|
||||||
return MakeInstruction(opcode, args);
|
return MakeInstruction(opcode, args);
|
||||||
|
Loading…
Reference in New Issue
Block a user