Harbor

branch main
showing the latest snapshot on main
spirv_spec.odin 7.6 KB · Plain text
shader/spirv_spec.odin 0644 Raw
package shader

// SPIR-V 1.5 specification constants.
// Subset needed for Luma shader compilation.

SPIRV_MAGIC :: 0x07230203
SPIRV_VERSION :: 0x00010500 // 1.5
SPIRV_GENERATOR :: 0x4C554D41 // "LUMA"

// Opcodes

SpvOp_Nop                    :: 0
SpvOp_Undef                  :: 1
SpvOp_Source                 :: 3
SpvOp_Name                   :: 5
SpvOp_MemberName             :: 6
SpvOp_String                 :: 7
SpvOp_Line                   :: 8
SpvOp_ModuleProcessed        :: 330
SpvOp_ExtInstImport          :: 11
SpvOp_ExtInst                :: 12
SpvOp_MemoryModel            :: 14
SpvOp_EntryPoint             :: 15
SpvOp_ExecutionMode          :: 16
SpvOp_Capability             :: 17
SpvOp_TypeVoid               :: 19
SpvOp_TypeBool               :: 20
SpvOp_TypeInt                :: 21
SpvOp_TypeFloat              :: 22
SpvOp_TypeVector             :: 23
SpvOp_TypeMatrix             :: 24
SpvOp_TypeImage              :: 25
SpvOp_TypeSampledImage       :: 27
SpvOp_TypeArray              :: 28
SpvOp_TypeRuntimeArray       :: 29
SpvOp_TypeStruct             :: 30
SpvOp_TypePointer            :: 32
SpvOp_TypeFunction           :: 33
SpvOp_ConstantTrue           :: 41
SpvOp_ConstantFalse          :: 42
SpvOp_Constant               :: 43
SpvOp_ConstantComposite      :: 44
SpvOp_SpecConstantTrue       :: 48
SpvOp_SpecConstantFalse      :: 49
SpvOp_SpecConstant           :: 50
SpvOp_Function               :: 54
SpvOp_FunctionParameter      :: 55
SpvOp_FunctionEnd            :: 56
SpvOp_FunctionCall           :: 57
SpvOp_Variable               :: 59
SpvOp_Load                   :: 61
SpvOp_Store                  :: 62
SpvOp_AccessChain            :: 65
SpvOp_Decorate               :: 71
SpvOp_MemberDecorate         :: 72
SpvOp_VectorExtractDynamic   :: 77
SpvOp_VectorShuffle          :: 79
SpvOp_CompositeConstruct     :: 80
SpvOp_CompositeExtract       :: 81
SpvOp_CompositeInsert        :: 82
SpvOp_Transpose              :: 84
SpvOp_ImageSampleImplicitLod :: 87
SpvOp_ImageSampleExplicitLod     :: 88
SpvOp_ImageSampleDrefImplicitLod :: 89
SpvOp_ConvertFToU            :: 109
SpvOp_ConvertFToS            :: 110
SpvOp_ConvertSToF            :: 111
SpvOp_ConvertUToF            :: 112
SpvOp_UConvert               :: 113
SpvOp_SConvert               :: 114
SpvOp_FConvert               :: 115
SpvOp_Bitcast                :: 124
SpvOp_SNegate                :: 126
SpvOp_FNegate                :: 127
SpvOp_IAdd                   :: 128
SpvOp_FAdd                   :: 129
SpvOp_ISub                   :: 130
SpvOp_FSub                   :: 131
SpvOp_IMul                   :: 132
SpvOp_FMul                   :: 133
SpvOp_UDiv                   :: 134
SpvOp_SDiv                   :: 135
SpvOp_FDiv                   :: 136
SpvOp_UMod                   :: 137
SpvOp_SRem                   :: 138
SpvOp_SMod                   :: 139
SpvOp_FRem                   :: 140
SpvOp_FMod                   :: 141
SpvOp_VectorTimesScalar      :: 142
SpvOp_MatrixTimesScalar      :: 143
SpvOp_VectorTimesMatrix      :: 144
SpvOp_MatrixTimesVector      :: 145
SpvOp_MatrixTimesMatrix      :: 146
SpvOp_Dot                    :: 148
SpvOp_LogicalEqual           :: 164
SpvOp_LogicalNotEqual        :: 165
SpvOp_LogicalOr              :: 166
SpvOp_LogicalAnd             :: 167
SpvOp_LogicalNot             :: 168
SpvOp_Select                 :: 169
SpvOp_IEqual                 :: 170
SpvOp_INotEqual              :: 171
SpvOp_UGreaterThan           :: 172
SpvOp_SGreaterThan           :: 173
SpvOp_UGreaterThanEqual      :: 174
SpvOp_SGreaterThanEqual      :: 175
SpvOp_ULessThan              :: 176
SpvOp_SLessThan              :: 177
SpvOp_ULessThanEqual         :: 178
SpvOp_SLessThanEqual         :: 179
SpvOp_FOrdEqual              :: 180
SpvOp_FOrdNotEqual           :: 182
SpvOp_FOrdLessThan           :: 184
SpvOp_FOrdGreaterThan        :: 186
SpvOp_FOrdLessThanEqual      :: 188
SpvOp_FOrdGreaterThanEqual   :: 190
SpvOp_Phi                    :: 245
SpvOp_LoopMerge              :: 246
SpvOp_SelectionMerge         :: 247
SpvOp_Label                  :: 248
SpvOp_Branch                 :: 249
SpvOp_BranchConditional      :: 250
SpvOp_ControlBarrier         :: 224
SpvOp_Return                 :: 253
SpvOp_ReturnValue            :: 254
SpvOp_Kill                   :: 252
SpvOp_DPdx                   :: 207
SpvOp_DPdy                   :: 208
SpvOp_Fwidth                 :: 209
SpvOp_ImageFetch             :: 95
SpvOp_ImageQuerySizeLod      :: 103

// Source Language

SpvSourceLanguage_Unknown :: 0

// Capabilities

SpvCapability_Shader :: 1

// Addressing/Memory Models

SpvAddressingModel_Logical :: 0
SpvMemoryModel_GLSL450     :: 1

// Execution Model

SpvExecutionModel_Vertex   :: 0
SpvExecutionModel_Fragment :: 4
SpvExecutionModel_GLCompute :: 5

// Execution Mode

SpvExecutionMode_OriginUpperLeft :: 7
SpvExecutionMode_LocalSize       :: 17

// Storage Class

SpvStorageClass_UniformConstant :: 0
SpvStorageClass_Input           :: 1
SpvStorageClass_Uniform         :: 2
SpvStorageClass_Output          :: 3
SpvStorageClass_Workgroup       :: 4
SpvStorageClass_Function        :: 7
SpvStorageClass_PushConstant    :: 9
SpvStorageClass_StorageBuffer    :: 12

// Decoration

SpvDecoration_SpecId         :: 1
SpvDecoration_Block          :: 2
SpvDecoration_ColMajor       :: 5
SpvDecoration_ArrayStride    :: 6
SpvDecoration_MatrixStride   :: 7
SpvDecoration_BuiltIn        :: 11
SpvDecoration_NoPerspective  :: 13
SpvDecoration_Flat           :: 14
SpvDecoration_Location       :: 30
SpvDecoration_Binding        :: 33
SpvDecoration_DescriptorSet  :: 34
SpvDecoration_Offset         :: 35

// Built-In

SpvBuiltIn_Position             :: 0
SpvBuiltIn_PointSize            :: 1
SpvBuiltIn_VertexIndex          :: 42
SpvBuiltIn_InstanceIndex        :: 43
SpvBuiltIn_FragCoord            :: 15
SpvBuiltIn_FrontFacing          :: 17
SpvBuiltIn_FragDepth            :: 22
SpvBuiltIn_LocalInvocationId    :: 27
SpvBuiltIn_GlobalInvocationId   :: 28
SpvBuiltIn_WorkgroupId          :: 26
SpvBuiltIn_NumWorkgroups        :: 24
SpvBuiltIn_LocalInvocationIndex :: 29

// Function Control

SpvFunctionControl_None :: 0

// Selection Control

SpvSelectionControl_None :: 0

// Loop Control

SpvLoopControl_None :: 0

// Scope

SpvScope_Workgroup :: 2

// Memory Semantics

SpvMemorySemantics_AcquireRelease   :: 0x8
SpvMemorySemantics_WorkgroupMemory  :: 0x100

// Image Dimensionality

SpvDim_2D   :: 1
SpvDim_3D   :: 2
SpvDim_Cube :: 3

// Image Format

SpvImageFormat_Unknown :: 0

// GLSL.std.450 Extended Instruction Set

GLSLstd450_Round       :: 1
GLSLstd450_Trunc       :: 3
GLSLstd450_FAbs        :: 4
GLSLstd450_SAbs        :: 5
GLSLstd450_FSign       :: 6
GLSLstd450_SSign       :: 7
GLSLstd450_Floor       :: 8
GLSLstd450_Ceil        :: 9
GLSLstd450_Fract       :: 10
GLSLstd450_Sin         :: 13
GLSLstd450_Cos         :: 14
GLSLstd450_Tan         :: 15
GLSLstd450_Asin        :: 16
GLSLstd450_Acos        :: 17
GLSLstd450_Atan        :: 18
GLSLstd450_Atan2       :: 25
GLSLstd450_Pow         :: 26
GLSLstd450_Exp         :: 27
GLSLstd450_Log         :: 28
GLSLstd450_Exp2        :: 29
GLSLstd450_Log2        :: 30
GLSLstd450_Sqrt        :: 31
GLSLstd450_InverseSqrt  :: 32
GLSLstd450_Determinant  :: 33
GLSLstd450_MatrixInverse :: 34
GLSLstd450_FMin         :: 37
GLSLstd450_UMin        :: 38
GLSLstd450_SMin        :: 39
GLSLstd450_FMax        :: 40
GLSLstd450_UMax        :: 41
GLSLstd450_SMax        :: 42
GLSLstd450_FClamp      :: 43
GLSLstd450_UClamp      :: 44
GLSLstd450_SClamp      :: 45
GLSLstd450_FMix        :: 46
GLSLstd450_Step        :: 48
GLSLstd450_SmoothStep  :: 49
GLSLstd450_Length      :: 66
GLSLstd450_Distance    :: 67
GLSLstd450_Cross       :: 68
GLSLstd450_Normalize   :: 69
GLSLstd450_Reflect     :: 71
GLSLstd450_Refract     :: 72