520 lines
19 KiB
C
520 lines
19 KiB
C
/*
|
|
Copyright (C) 2026 kbz_8 (contact@kbz8.me)
|
|
This file is part of the "SPIR-V Interpreter - FFI C Bindings" project
|
|
|
|
MIT License
|
|
|
|
Copyright (c) 2026 kbz_8
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
in the Software without restriction, including without limitation the rights
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
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 Software.
|
|
|
|
THE SOFTWARE IS 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 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
SOFTWARE.
|
|
*/
|
|
|
|
#ifndef SPIRV_INTERPRETER_H
|
|
#define SPIRV_INTERPRETER_H
|
|
|
|
#ifndef SPV_API
|
|
#define SPV_API extern
|
|
#endif /* SPV_API */
|
|
|
|
#ifdef __cplusplus
|
|
extern "C"
|
|
{
|
|
#endif
|
|
|
|
#ifndef spirv_H
|
|
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,
|
|
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,
|
|
SpvBuiltInSubgroupSize = 36,
|
|
SpvBuiltInSubgroupMaxSize = 37,
|
|
SpvBuiltInNumSubgroups = 38,
|
|
SpvBuiltInNumEnqueuedSubgroups = 39,
|
|
SpvBuiltInSubgroupId = 40,
|
|
SpvBuiltInSubgroupLocalInvocationId = 41,
|
|
SpvBuiltInVertexIndex = 42,
|
|
SpvBuiltInInstanceIndex = 43,
|
|
SpvBuiltInCoreIDARM = 4160,
|
|
SpvBuiltInCoreCountARM = 4161,
|
|
SpvBuiltInCoreMaxIDARM = 4162,
|
|
SpvBuiltInWarpIDARM = 4163,
|
|
SpvBuiltInWarpMaxIDARM = 4164,
|
|
SpvBuiltInSubgroupEqMask = 4416,
|
|
SpvBuiltInSubgroupEqMaskKHR = 4416,
|
|
SpvBuiltInSubgroupGeMask = 4417,
|
|
SpvBuiltInSubgroupGeMaskKHR = 4417,
|
|
SpvBuiltInSubgroupGtMask = 4418,
|
|
SpvBuiltInSubgroupGtMaskKHR = 4418,
|
|
SpvBuiltInSubgroupLeMask = 4419,
|
|
SpvBuiltInSubgroupLeMaskKHR = 4419,
|
|
SpvBuiltInSubgroupLtMask = 4420,
|
|
SpvBuiltInSubgroupLtMaskKHR = 4420,
|
|
SpvBuiltInBaseVertex = 4424,
|
|
SpvBuiltInBaseInstance = 4425,
|
|
SpvBuiltInDrawIndex = 4426,
|
|
SpvBuiltInPrimitiveShadingRateKHR = 4432,
|
|
SpvBuiltInDeviceIndex = 4438,
|
|
SpvBuiltInViewIndex = 4440,
|
|
SpvBuiltInShadingRateKHR = 4444,
|
|
SpvBuiltInTileOffsetQCOM = 4492,
|
|
SpvBuiltInTileDimensionQCOM = 4493,
|
|
SpvBuiltInTileApronSizeQCOM = 4494,
|
|
SpvBuiltInBaryCoordNoPerspAMD = 4992,
|
|
SpvBuiltInBaryCoordNoPerspCentroidAMD = 4993,
|
|
SpvBuiltInBaryCoordNoPerspSampleAMD = 4994,
|
|
SpvBuiltInBaryCoordSmoothAMD = 4995,
|
|
SpvBuiltInBaryCoordSmoothCentroidAMD = 4996,
|
|
SpvBuiltInBaryCoordSmoothSampleAMD = 4997,
|
|
SpvBuiltInBaryCoordPullModelAMD = 4998,
|
|
SpvBuiltInFragStencilRefEXT = 5014,
|
|
SpvBuiltInRemainingRecursionLevelsAMDX = 5021,
|
|
SpvBuiltInShaderIndexAMDX = 5073,
|
|
SpvBuiltInSamplerHeapEXT = 5122,
|
|
SpvBuiltInResourceHeapEXT = 5123,
|
|
SpvBuiltInViewportMaskNV = 5253,
|
|
SpvBuiltInSecondaryPositionNV = 5257,
|
|
SpvBuiltInSecondaryViewportMaskNV = 5258,
|
|
SpvBuiltInPositionPerViewNV = 5261,
|
|
SpvBuiltInViewportMaskPerViewNV = 5262,
|
|
SpvBuiltInFullyCoveredEXT = 5264,
|
|
SpvBuiltInTaskCountNV = 5274,
|
|
SpvBuiltInPrimitiveCountNV = 5275,
|
|
SpvBuiltInPrimitiveIndicesNV = 5276,
|
|
SpvBuiltInClipDistancePerViewNV = 5277,
|
|
SpvBuiltInCullDistancePerViewNV = 5278,
|
|
SpvBuiltInLayerPerViewNV = 5279,
|
|
SpvBuiltInMeshViewCountNV = 5280,
|
|
SpvBuiltInMeshViewIndicesNV = 5281,
|
|
SpvBuiltInBaryCoordKHR = 5286,
|
|
SpvBuiltInBaryCoordNV = 5286,
|
|
SpvBuiltInBaryCoordNoPerspKHR = 5287,
|
|
SpvBuiltInBaryCoordNoPerspNV = 5287,
|
|
SpvBuiltInFragSizeEXT = 5292,
|
|
SpvBuiltInFragmentSizeNV = 5292,
|
|
SpvBuiltInFragInvocationCountEXT = 5293,
|
|
SpvBuiltInInvocationsPerPixelNV = 5293,
|
|
SpvBuiltInPrimitivePointIndicesEXT = 5294,
|
|
SpvBuiltInPrimitiveLineIndicesEXT = 5295,
|
|
SpvBuiltInPrimitiveTriangleIndicesEXT = 5296,
|
|
SpvBuiltInCullPrimitiveEXT = 5299,
|
|
SpvBuiltInLaunchIdKHR = 5319,
|
|
SpvBuiltInLaunchIdNV = 5319,
|
|
SpvBuiltInLaunchSizeKHR = 5320,
|
|
SpvBuiltInLaunchSizeNV = 5320,
|
|
SpvBuiltInWorldRayOriginKHR = 5321,
|
|
SpvBuiltInWorldRayOriginNV = 5321,
|
|
SpvBuiltInWorldRayDirectionKHR = 5322,
|
|
SpvBuiltInWorldRayDirectionNV = 5322,
|
|
SpvBuiltInObjectRayOriginKHR = 5323,
|
|
SpvBuiltInObjectRayOriginNV = 5323,
|
|
SpvBuiltInObjectRayDirectionKHR = 5324,
|
|
SpvBuiltInObjectRayDirectionNV = 5324,
|
|
SpvBuiltInRayTminKHR = 5325,
|
|
SpvBuiltInRayTminNV = 5325,
|
|
SpvBuiltInRayTmaxKHR = 5326,
|
|
SpvBuiltInRayTmaxNV = 5326,
|
|
SpvBuiltInInstanceCustomIndexKHR = 5327,
|
|
SpvBuiltInInstanceCustomIndexNV = 5327,
|
|
SpvBuiltInObjectToWorldKHR = 5330,
|
|
SpvBuiltInObjectToWorldNV = 5330,
|
|
SpvBuiltInWorldToObjectKHR = 5331,
|
|
SpvBuiltInWorldToObjectNV = 5331,
|
|
SpvBuiltInHitTNV = 5332,
|
|
SpvBuiltInHitKindKHR = 5333,
|
|
SpvBuiltInHitKindNV = 5333,
|
|
SpvBuiltInCurrentRayTimeNV = 5334,
|
|
SpvBuiltInHitTriangleVertexPositionsKHR = 5335,
|
|
SpvBuiltInHitMicroTriangleVertexPositionsNV = 5337,
|
|
SpvBuiltInHitMicroTriangleVertexBarycentricsNV = 5344,
|
|
SpvBuiltInIncomingRayFlagsKHR = 5351,
|
|
SpvBuiltInIncomingRayFlagsNV = 5351,
|
|
SpvBuiltInRayGeometryIndexKHR = 5352,
|
|
SpvBuiltInHitIsSphereNV = 5359,
|
|
SpvBuiltInHitIsLSSNV = 5360,
|
|
SpvBuiltInHitSpherePositionNV = 5361,
|
|
SpvBuiltInWarpsPerSMNV = 5374,
|
|
SpvBuiltInSMCountNV = 5375,
|
|
SpvBuiltInWarpIDNV = 5376,
|
|
SpvBuiltInSMIDNV = 5377,
|
|
SpvBuiltInHitLSSPositionsNV = 5396,
|
|
SpvBuiltInHitKindFrontFacingMicroTriangleNV = 5405,
|
|
SpvBuiltInHitKindBackFacingMicroTriangleNV = 5406,
|
|
SpvBuiltInHitSphereRadiusNV = 5420,
|
|
SpvBuiltInHitLSSRadiiNV = 5421,
|
|
SpvBuiltInClusterIDNV = 5436,
|
|
SpvBuiltInCullMaskKHR = 6021,
|
|
SpvBuiltInMax = 0x7fffffff
|
|
} SpvBuiltIn;
|
|
|
|
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,
|
|
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,
|
|
SpvDecorationUniformId = 27,
|
|
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,
|
|
SpvDecorationInputAttachmentIndex = 43,
|
|
SpvDecorationAlignment = 44,
|
|
SpvDecorationMaxByteOffset = 45,
|
|
SpvDecorationAlignmentId = 46,
|
|
SpvDecorationMaxByteOffsetId = 47,
|
|
SpvDecorationSaturatedToLargestFloat8NormalConversionEXT = 4216,
|
|
SpvDecorationNoSignedWrap = 4469,
|
|
SpvDecorationNoUnsignedWrap = 4470,
|
|
SpvDecorationWeightTextureQCOM = 4487,
|
|
SpvDecorationBlockMatchTextureQCOM = 4488,
|
|
SpvDecorationBlockMatchSamplerQCOM = 4499,
|
|
SpvDecorationExplicitInterpAMD = 4999,
|
|
SpvDecorationNodeSharesPayloadLimitsWithAMDX = 5019,
|
|
SpvDecorationNodeMaxPayloadsAMDX = 5020,
|
|
SpvDecorationTrackFinishWritingAMDX = 5078,
|
|
SpvDecorationPayloadNodeNameAMDX = 5091,
|
|
SpvDecorationPayloadNodeBaseIndexAMDX = 5098,
|
|
SpvDecorationPayloadNodeSparseArrayAMDX = 5099,
|
|
SpvDecorationPayloadNodeArraySizeAMDX = 5100,
|
|
SpvDecorationPayloadDispatchIndirectAMDX = 5105,
|
|
SpvDecorationArrayStrideIdEXT = 5124,
|
|
SpvDecorationOffsetIdEXT = 5125,
|
|
SpvDecorationUTFEncodedKHR = 5145,
|
|
SpvDecorationOverrideCoverageNV = 5248,
|
|
SpvDecorationPassthroughNV = 5250,
|
|
SpvDecorationViewportRelativeNV = 5252,
|
|
SpvDecorationSecondaryViewportRelativeNV = 5256,
|
|
SpvDecorationPerPrimitiveEXT = 5271,
|
|
SpvDecorationPerPrimitiveNV = 5271,
|
|
SpvDecorationPerViewNV = 5272,
|
|
SpvDecorationPerTaskNV = 5273,
|
|
SpvDecorationPerVertexKHR = 5285,
|
|
SpvDecorationPerVertexNV = 5285,
|
|
SpvDecorationNonUniform = 5300,
|
|
SpvDecorationNonUniformEXT = 5300,
|
|
SpvDecorationRestrictPointer = 5355,
|
|
SpvDecorationRestrictPointerEXT = 5355,
|
|
SpvDecorationAliasedPointer = 5356,
|
|
SpvDecorationAliasedPointerEXT = 5356,
|
|
SpvDecorationMemberOffsetNV = 5358,
|
|
SpvDecorationHitObjectShaderRecordBufferNV = 5386,
|
|
SpvDecorationHitObjectShaderRecordBufferEXT = 5389,
|
|
SpvDecorationBankNV = 5397,
|
|
SpvDecorationBindlessSamplerNV = 5398,
|
|
SpvDecorationBindlessImageNV = 5399,
|
|
SpvDecorationBoundSamplerNV = 5400,
|
|
SpvDecorationBoundImageNV = 5401,
|
|
SpvDecorationSIMTCallINTEL = 5599,
|
|
SpvDecorationReferencedIndirectlyINTEL = 5602,
|
|
SpvDecorationClobberINTEL = 5607,
|
|
SpvDecorationSideEffectsINTEL = 5608,
|
|
SpvDecorationVectorComputeVariableINTEL = 5624,
|
|
SpvDecorationFuncParamIOKindINTEL = 5625,
|
|
SpvDecorationVectorComputeFunctionINTEL = 5626,
|
|
SpvDecorationStackCallINTEL = 5627,
|
|
SpvDecorationGlobalVariableOffsetINTEL = 5628,
|
|
SpvDecorationCounterBuffer = 5634,
|
|
SpvDecorationHlslCounterBufferGOOGLE = 5634,
|
|
SpvDecorationHlslSemanticGOOGLE = 5635,
|
|
SpvDecorationUserSemantic = 5635,
|
|
SpvDecorationUserTypeGOOGLE = 5636,
|
|
SpvDecorationFunctionRoundingModeINTEL = 5822,
|
|
SpvDecorationFunctionDenormModeINTEL = 5823,
|
|
SpvDecorationRegisterALTERA = 5825,
|
|
SpvDecorationRegisterINTEL = 5825,
|
|
SpvDecorationMemoryALTERA = 5826,
|
|
SpvDecorationMemoryINTEL = 5826,
|
|
SpvDecorationNumbanksALTERA = 5827,
|
|
SpvDecorationNumbanksINTEL = 5827,
|
|
SpvDecorationBankwidthALTERA = 5828,
|
|
SpvDecorationBankwidthINTEL = 5828,
|
|
SpvDecorationMaxPrivateCopiesALTERA = 5829,
|
|
SpvDecorationMaxPrivateCopiesINTEL = 5829,
|
|
SpvDecorationSinglepumpALTERA = 5830,
|
|
SpvDecorationSinglepumpINTEL = 5830,
|
|
SpvDecorationDoublepumpALTERA = 5831,
|
|
SpvDecorationDoublepumpINTEL = 5831,
|
|
SpvDecorationMaxReplicatesALTERA = 5832,
|
|
SpvDecorationMaxReplicatesINTEL = 5832,
|
|
SpvDecorationSimpleDualPortALTERA = 5833,
|
|
SpvDecorationSimpleDualPortINTEL = 5833,
|
|
SpvDecorationMergeALTERA = 5834,
|
|
SpvDecorationMergeINTEL = 5834,
|
|
SpvDecorationBankBitsALTERA = 5835,
|
|
SpvDecorationBankBitsINTEL = 5835,
|
|
SpvDecorationForcePow2DepthALTERA = 5836,
|
|
SpvDecorationForcePow2DepthINTEL = 5836,
|
|
SpvDecorationStridesizeALTERA = 5883,
|
|
SpvDecorationStridesizeINTEL = 5883,
|
|
SpvDecorationWordsizeALTERA = 5884,
|
|
SpvDecorationWordsizeINTEL = 5884,
|
|
SpvDecorationTrueDualPortALTERA = 5885,
|
|
SpvDecorationTrueDualPortINTEL = 5885,
|
|
SpvDecorationBurstCoalesceALTERA = 5899,
|
|
SpvDecorationBurstCoalesceINTEL = 5899,
|
|
SpvDecorationCacheSizeALTERA = 5900,
|
|
SpvDecorationCacheSizeINTEL = 5900,
|
|
SpvDecorationDontStaticallyCoalesceALTERA = 5901,
|
|
SpvDecorationDontStaticallyCoalesceINTEL = 5901,
|
|
SpvDecorationPrefetchALTERA = 5902,
|
|
SpvDecorationPrefetchINTEL = 5902,
|
|
SpvDecorationStallEnableALTERA = 5905,
|
|
SpvDecorationStallEnableINTEL = 5905,
|
|
SpvDecorationFuseLoopsInFunctionALTERA = 5907,
|
|
SpvDecorationFuseLoopsInFunctionINTEL = 5907,
|
|
SpvDecorationMathOpDSPModeALTERA = 5909,
|
|
SpvDecorationMathOpDSPModeINTEL = 5909,
|
|
SpvDecorationAliasScopeINTEL = 5914,
|
|
SpvDecorationNoAliasINTEL = 5915,
|
|
SpvDecorationInitiationIntervalALTERA = 5917,
|
|
SpvDecorationInitiationIntervalINTEL = 5917,
|
|
SpvDecorationMaxConcurrencyALTERA = 5918,
|
|
SpvDecorationMaxConcurrencyINTEL = 5918,
|
|
SpvDecorationPipelineEnableALTERA = 5919,
|
|
SpvDecorationPipelineEnableINTEL = 5919,
|
|
SpvDecorationBufferLocationALTERA = 5921,
|
|
SpvDecorationBufferLocationINTEL = 5921,
|
|
SpvDecorationIOPipeStorageALTERA = 5944,
|
|
SpvDecorationIOPipeStorageINTEL = 5944,
|
|
SpvDecorationFunctionFloatingPointModeINTEL = 6080,
|
|
SpvDecorationSingleElementVectorINTEL = 6085,
|
|
SpvDecorationVectorComputeCallableFunctionINTEL = 6087,
|
|
SpvDecorationMediaBlockIOINTEL = 6140,
|
|
SpvDecorationStallFreeALTERA = 6151,
|
|
SpvDecorationStallFreeINTEL = 6151,
|
|
SpvDecorationFPMaxErrorDecorationINTEL = 6170,
|
|
SpvDecorationLatencyControlLabelALTERA = 6172,
|
|
SpvDecorationLatencyControlLabelINTEL = 6172,
|
|
SpvDecorationLatencyControlConstraintALTERA = 6173,
|
|
SpvDecorationLatencyControlConstraintINTEL = 6173,
|
|
SpvDecorationConduitKernelArgumentALTERA = 6175,
|
|
SpvDecorationConduitKernelArgumentINTEL = 6175,
|
|
SpvDecorationRegisterMapKernelArgumentALTERA = 6176,
|
|
SpvDecorationRegisterMapKernelArgumentINTEL = 6176,
|
|
SpvDecorationMMHostInterfaceAddressWidthALTERA = 6177,
|
|
SpvDecorationMMHostInterfaceAddressWidthINTEL = 6177,
|
|
SpvDecorationMMHostInterfaceDataWidthALTERA = 6178,
|
|
SpvDecorationMMHostInterfaceDataWidthINTEL = 6178,
|
|
SpvDecorationMMHostInterfaceLatencyALTERA = 6179,
|
|
SpvDecorationMMHostInterfaceLatencyINTEL = 6179,
|
|
SpvDecorationMMHostInterfaceReadWriteModeALTERA = 6180,
|
|
SpvDecorationMMHostInterfaceReadWriteModeINTEL = 6180,
|
|
SpvDecorationMMHostInterfaceMaxBurstALTERA = 6181,
|
|
SpvDecorationMMHostInterfaceMaxBurstINTEL = 6181,
|
|
SpvDecorationMMHostInterfaceWaitRequestALTERA = 6182,
|
|
SpvDecorationMMHostInterfaceWaitRequestINTEL = 6182,
|
|
SpvDecorationStableKernelArgumentALTERA = 6183,
|
|
SpvDecorationStableKernelArgumentINTEL = 6183,
|
|
SpvDecorationHostAccessINTEL = 6188,
|
|
SpvDecorationInitModeALTERA = 6190,
|
|
SpvDecorationInitModeINTEL = 6190,
|
|
SpvDecorationImplementInRegisterMapALTERA = 6191,
|
|
SpvDecorationImplementInRegisterMapINTEL = 6191,
|
|
SpvDecorationConditionalINTEL = 6247,
|
|
SpvDecorationCacheControlLoadINTEL = 6442,
|
|
SpvDecorationCacheControlStoreINTEL = 6443,
|
|
SpvDecorationMax = 0x7fffffff
|
|
} SpvDecoration;
|
|
|
|
typedef enum SpvDim_ {
|
|
_1D = 0,
|
|
_2D = 1,
|
|
_3D = 2,
|
|
Cube = 3,
|
|
Rect = 4,
|
|
Buffer = 5,
|
|
SubpassData = 6,
|
|
TileImageDataEXT = 4173,
|
|
Max = 0x7fffffff
|
|
} SpvDim;
|
|
#endif /* spirv_H */
|
|
|
|
typedef int SpvBool;
|
|
typedef unsigned char SpvByte;
|
|
typedef unsigned long SpvWord;
|
|
typedef unsigned long SpvSize;
|
|
|
|
typedef enum
|
|
{
|
|
SPV_RESULT_SUCCESS = 0,
|
|
SPV_RESULT_DIVISION_BY_ZERO = -1,
|
|
SPV_RESULT_INVALID_ENTRY_POINT = -2,
|
|
SPV_RESULT_INVALID_SPIRV = -3,
|
|
SPV_RESULT_INVALID_VALUE_TYPE = -4,
|
|
SPV_RESULT_KILLED = -5,
|
|
SPV_RESULT_NOT_FOUND = -6,
|
|
SPV_RESULT_OUT_OF_MEMORY = -7,
|
|
SPV_RESULT_OUT_OF_BOUNDS = -8,
|
|
SPV_RESULT_TODO = -9,
|
|
SPV_RESULT_UNREACHABLE = -10,
|
|
SPV_RESULT_UNSUPPORTED_SPIRV = -11,
|
|
SPV_RESULT_UNSUPPORTED_EXTENSION = -12,
|
|
SPV_RESULT_UNSUPPORTED_ENDIANNESS = -13,
|
|
SPV_RESULT_INVALID_MAGIC = -14,
|
|
SPV_RESULT_UNKNOWN = -15
|
|
} SpvResult;
|
|
|
|
typedef struct
|
|
{
|
|
SpvBool use_simd_vectors_specializations;
|
|
} SpvModuleOptions;
|
|
|
|
typedef struct
|
|
{
|
|
SpvWord id;
|
|
SpvSize offset;
|
|
SpvSize size;
|
|
} SpvRuntimeSpecializationEntry;
|
|
|
|
typedef enum
|
|
{
|
|
SPV_LOCATION_INPUT = 0,
|
|
SPV_LOCATION_OUTPUT = 1
|
|
} SpvLocationType;
|
|
|
|
typedef struct
|
|
{
|
|
float x;
|
|
float y;
|
|
float z;
|
|
float w;
|
|
} SpvVec4f;
|
|
|
|
typedef struct
|
|
{
|
|
unsigned int x;
|
|
unsigned int y;
|
|
unsigned int z;
|
|
unsigned int w;
|
|
} SpvVec4u;
|
|
|
|
typedef SpvResult (*SpvReadImageFloat4_PFN)(void* driver_image, SpvDim dim, int x, int y, int z, SpvVec4f* dst);
|
|
typedef SpvResult (*SpvReadImageInt4_PFN)(void* driver_image, SpvDim dim, int x, int y, int z, SpvVec4u* dst);
|
|
typedef SpvResult (*SpvWriteImageFloat4_PFN)(void* driver_image, SpvDim dim, int x, int y, int z, SpvVec4f src);
|
|
typedef SpvResult (*SpvWriteImageInt4_PFN)(void* driver_image, SpvDim dim, int x, int y, int z, SpvVec4u src);
|
|
typedef SpvResult (*SpvSampleImageFloat4_PFN)(void* driver_image, void* driver_sampler, SpvDim dim, float x, float y, float z, SpvVec4f* dst);
|
|
typedef SpvResult (*SpvQueryImageSize_PFN)(void* driver_image, SpvDim dim, SpvBool arrayed, SpvVec4u* dst);
|
|
|
|
typedef struct
|
|
{
|
|
SpvReadImageFloat4_PFN SpvReadImageFloat4;
|
|
SpvReadImageInt4_PFN SpvReadImageInt4;
|
|
SpvWriteImageFloat4_PFN SpvWriteImageFloat4;
|
|
SpvWriteImageInt4_PFN SpvWriteImageInt4;
|
|
SpvSampleImageFloat4_PFN SpvSampleImageFloat4;
|
|
SpvQueryImageSize_PFN SpvQueryImageSize;
|
|
} SpvImageAPI;
|
|
|
|
typedef void* SpvModule;
|
|
typedef void* SpvRuntime;
|
|
|
|
SPV_API SpvResult SpvInitModule(SpvModule* module, const SpvWord* source, SpvSize source_len, SpvModuleOptions options);
|
|
SPV_API void SpvDeinitModule(SpvModule module);
|
|
|
|
SPV_API SpvResult SpvInitRuntime(SpvRuntime* runtime, SpvModule module, SpvImageAPI image_api);
|
|
SPV_API void SpvDeinitRuntime(SpvRuntime runtime);
|
|
|
|
SPV_API SpvResult SpvFlushDescriptorSets(SpvRuntime runtime);
|
|
|
|
SPV_API SpvResult SpvAddSpecializationInfo(SpvRuntime runtime, SpvRuntimeSpecializationEntry entry, const SpvByte* data, SpvSize data_size);
|
|
|
|
SPV_API SpvResult SpvGetResultByName(SpvRuntime runtime, const char* name, SpvWord* result);
|
|
SPV_API SpvResult SpvGetResultLocation(SpvRuntime runtime, SpvWord location, SpvLocationType type, SpvWord* result);
|
|
SPV_API SpvResult SpvGetEntryPointByName(SpvRuntime runtime, const char* name, SpvWord* result);
|
|
SPV_API SpvResult SpvGetResultMemorySize(SpvRuntime runtime, SpvWord result, SpvSize* size);
|
|
SPV_API SpvBool SpvHasResultDecoration(SpvRuntime runtime, SpvWord result, SpvDecoration decoration);
|
|
|
|
SPV_API SpvResult SpvCallEntryPoint(SpvRuntime runtime, SpvWord entry_point_index);
|
|
|
|
SPV_API SpvResult SpvReadOutput(SpvRuntime runtime, SpvByte* output, SpvSize output_size, SpvWord result);
|
|
SPV_API SpvResult SpvReadBuiltIn(SpvRuntime runtime, SpvByte* output, SpvSize output_size, SpvBuiltIn builtin);
|
|
|
|
SPV_API SpvResult SpvWriteInput(SpvRuntime runtime, const SpvByte* input, SpvSize input_size, SpvWord result);
|
|
SPV_API SpvResult SpvWriteBuiltIn(SpvRuntime runtime, const SpvByte* input, SpvSize input_size, SpvBuiltIn builtin);
|
|
SPV_API SpvResult SpvWriteDescriptorSet(SpvRuntime runtime, const SpvByte* input, SpvSize input_size, SpvWord set, SpvWord binding, SpvWord descriptor_index);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* SPIRV_INTERPRETER_H */
|