stringify stuff

This commit is contained in:
Eliza Velasquez
2024-02-14 17:11:24 -08:00
parent 300f80448d
commit 0f34603cfc
2 changed files with 670 additions and 1571 deletions

View File

@@ -39,16 +39,12 @@ enum class BranchOperator : uint8_t {
Default,
};
// Represents an operation whose syntax differs from a function call. For example, addition,
// equality. GLSL is not Lisp, unfortunately.
enum class RValueOperator : uint16_t {
Ternary,
//
// Unary operators
//
// Unary
Negative,
LogicalNot,
VectorLogicalNot,
BitwiseNot,
PostIncrement,
@@ -56,212 +52,7 @@ enum class RValueOperator : uint16_t {
PreIncrement,
PreDecrement,
CopyObject,
Declare, // Used by debugging to force declaration of variable in correct scope
// (u)int* -> bool
ConvInt8ToBool,
ConvUint8ToBool,
ConvInt16ToBool,
ConvUint16ToBool,
ConvIntToBool,
ConvUintToBool,
ConvInt64ToBool,
ConvUint64ToBool,
// float* -> bool
ConvFloat16ToBool,
ConvFloatToBool,
ConvDoubleToBool,
// bool -> (u)int*
ConvBoolToInt8,
ConvBoolToUint8,
ConvBoolToInt16,
ConvBoolToUint16,
ConvBoolToInt,
ConvBoolToUint,
ConvBoolToInt64,
ConvBoolToUint64,
// bool -> float*
ConvBoolToFloat16,
ConvBoolToFloat,
ConvBoolToDouble,
// int8_t -> (u)int*
ConvInt8ToInt16,
ConvInt8ToInt,
ConvInt8ToInt64,
ConvInt8ToUint8,
ConvInt8ToUint16,
ConvInt8ToUint,
ConvInt8ToUint64,
// uint8_t -> (u)int*
ConvUint8ToInt8,
ConvUint8ToInt16,
ConvUint8ToInt,
ConvUint8ToInt64,
ConvUint8ToUint16,
ConvUint8ToUint,
ConvUint8ToUint64,
// int8_t -> float*
ConvInt8ToFloat16,
ConvInt8ToFloat,
ConvInt8ToDouble,
// uint8_t -> float*
ConvUint8ToFloat16,
ConvUint8ToFloat,
ConvUint8ToDouble,
// int16_t -> (u)int*
ConvInt16ToInt8,
ConvInt16ToInt,
ConvInt16ToInt64,
ConvInt16ToUint8,
ConvInt16ToUint16,
ConvInt16ToUint,
ConvInt16ToUint64,
// uint16_t -> (u)int*
ConvUint16ToInt8,
ConvUint16ToInt16,
ConvUint16ToInt,
ConvUint16ToInt64,
ConvUint16ToUint8,
ConvUint16ToUint,
ConvUint16ToUint64,
// int16_t -> float*
ConvInt16ToFloat16,
ConvInt16ToFloat,
ConvInt16ToDouble,
// uint16_t -> float*
ConvUint16ToFloat16,
ConvUint16ToFloat,
ConvUint16ToDouble,
// int32_t -> (u)int*
ConvIntToInt8,
ConvIntToInt16,
ConvIntToInt64,
ConvIntToUint8,
ConvIntToUint16,
ConvIntToUint,
ConvIntToUint64,
// uint32_t -> (u)int*
ConvUintToInt8,
ConvUintToInt16,
ConvUintToInt,
ConvUintToInt64,
ConvUintToUint8,
ConvUintToUint16,
ConvUintToUint64,
// int32_t -> float*
ConvIntToFloat16,
ConvIntToFloat,
ConvIntToDouble,
// uint32_t -> float*
ConvUintToFloat16,
ConvUintToFloat,
ConvUintToDouble,
// int64_t -> (u)int*
ConvInt64ToInt8,
ConvInt64ToInt16,
ConvInt64ToInt,
ConvInt64ToUint8,
ConvInt64ToUint16,
ConvInt64ToUint,
ConvInt64ToUint64,
// uint64_t -> (u)int*
ConvUint64ToInt8,
ConvUint64ToInt16,
ConvUint64ToInt,
ConvUint64ToInt64,
ConvUint64ToUint8,
ConvUint64ToUint16,
ConvUint64ToUint,
// int64_t -> float*
ConvInt64ToFloat16,
ConvInt64ToFloat,
ConvInt64ToDouble,
// uint64_t -> float*
ConvUint64ToFloat16,
ConvUint64ToFloat,
ConvUint64ToDouble,
// float16_t -> (u)int*
ConvFloat16ToInt8,
ConvFloat16ToInt16,
ConvFloat16ToInt,
ConvFloat16ToInt64,
ConvFloat16ToUint8,
ConvFloat16ToUint16,
ConvFloat16ToUint,
ConvFloat16ToUint64,
// float16_t -> float*
ConvFloat16ToFloat,
ConvFloat16ToDouble,
// float -> (u)int*
ConvFloatToInt8,
ConvFloatToInt16,
ConvFloatToInt,
ConvFloatToInt64,
ConvFloatToUint8,
ConvFloatToUint16,
ConvFloatToUint,
ConvFloatToUint64,
// float -> float*
ConvFloatToFloat16,
ConvFloatToDouble,
// float64 _t-> (u)int*
ConvDoubleToInt8,
ConvDoubleToInt16,
ConvDoubleToInt,
ConvDoubleToInt64,
ConvDoubleToUint8,
ConvDoubleToUint16,
ConvDoubleToUint,
ConvDoubleToUint64,
// float64_t -> float*
ConvDoubleToFloat16,
ConvDoubleToFloat,
// uint64_t <-> pointer
ConvUint64ToPtr,
ConvPtrToUint64,
// uvec2 <-> pointer
ConvUvec2ToPtr,
ConvPtrToUvec2,
// uint64_t -> accelerationStructureEXT
ConvUint64ToAccStruct,
// uvec2 -> accelerationStructureEXT
ConvUvec2ToAccStruct,
//
// binary operations
//
// Binary
Add,
Sub,
Mul,
@@ -281,454 +72,13 @@ enum class RValueOperator : uint16_t {
LessThanEqual,
GreaterThanEqual,
Comma,
VectorTimesScalar,
VectorTimesMatrix,
MatrixTimesVector,
MatrixTimesScalar,
LogicalOr,
LogicalXor,
LogicalAnd,
IndexDirect,
IndexIndirect,
IndexDirectStruct,
VectorSwizzle,
Method,
Scoping,
//
// Built-in functions mapped to operators
//
Radians,
Degrees,
Sin,
Cos,
Tan,
Asin,
Acos,
Atan,
Sinh,
Cosh,
Tanh,
Asinh,
Acosh,
Atanh,
Pow,
Exp,
Log,
Exp2,
Log2,
Sqrt,
InverseSqrt,
Abs,
Sign,
Floor,
Trunc,
Round,
RoundEven,
Ceil,
Fract,
Modf,
Min,
Max,
Clamp,
Mix,
Step,
SmoothStep,
IsNan,
IsInf,
Fma,
Frexp,
Ldexp,
FloatBitsToInt,
FloatBitsToUint,
IntBitsToFloat,
UintBitsToFloat,
DoubleBitsToInt64,
DoubleBitsToUint64,
Int64BitsToDouble,
Uint64BitsToDouble,
Float16BitsToInt16,
Float16BitsToUint16,
Int16BitsToFloat16,
Uint16BitsToFloat16,
PackSnorm2x16,
UnpackSnorm2x16,
PackUnorm2x16,
UnpackUnorm2x16,
PackSnorm4x8,
UnpackSnorm4x8,
PackUnorm4x8,
UnpackUnorm4x8,
PackHalf2x16,
UnpackHalf2x16,
PackDouble2x32,
UnpackDouble2x32,
PackInt2x32,
UnpackInt2x32,
PackUint2x32,
UnpackUint2x32,
PackFloat2x16,
UnpackFloat2x16,
PackInt2x16,
UnpackInt2x16,
PackUint2x16,
UnpackUint2x16,
PackInt4x16,
UnpackInt4x16,
PackUint4x16,
UnpackUint4x16,
Pack16,
Pack32,
Pack64,
Unpack32,
Unpack16,
Unpack8,
Length,
Distance,
Dot,
Cross,
Normalize,
FaceForward,
Reflect,
Refract,
Min3,
Max3,
Mid3,
DPdx, // Fragment only
DPdy, // Fragment only
Fwidth, // Fragment only
DPdxFine, // Fragment only
DPdyFine, // Fragment only
FwidthFine, // Fragment only
DPdxCoarse, // Fragment only
DPdyCoarse, // Fragment only
FwidthCoarse, // Fragment only
InterpolateAtCentroid, // Fragment only
InterpolateAtSample, // Fragment only
InterpolateAtOffset, // Fragment only
InterpolateAtVertex,
MatrixTimesMatrix,
OuterProduct,
Determinant,
MatrixInverse,
Transpose,
Ftransform,
Noise,
EmitVertex, // geometry only
EndPrimitive, // geometry only
EmitStreamVertex, // geometry only
EndStreamPrimitive, // geometry only
Barrier,
MemoryBarrier,
MemoryBarrierAtomicCounter,
MemoryBarrierBuffer,
MemoryBarrierImage,
MemoryBarrierShared, // compute only
GroupMemoryBarrier, // compute only
Ballot,
ReadInvocation,
ReadFirstInvocation,
AnyInvocation,
AllInvocations,
AllInvocationsEqual,
SubgroupGuardStart,
SubgroupBarrier,
SubgroupMemoryBarrier,
SubgroupMemoryBarrierBuffer,
SubgroupMemoryBarrierImage,
SubgroupMemoryBarrierShared, // compute only
SubgroupElect,
SubgroupAll,
SubgroupAny,
SubgroupAllEqual,
SubgroupBroadcast,
SubgroupBroadcastFirst,
SubgroupBallot,
SubgroupInverseBallot,
SubgroupBallotBitExtract,
SubgroupBallotBitCount,
SubgroupBallotInclusiveBitCount,
SubgroupBallotExclusiveBitCount,
SubgroupBallotFindLSB,
SubgroupBallotFindMSB,
SubgroupShuffle,
SubgroupShuffleXor,
SubgroupShuffleUp,
SubgroupShuffleDown,
SubgroupAdd,
SubgroupMul,
SubgroupMin,
SubgroupMax,
SubgroupAnd,
SubgroupOr,
SubgroupXor,
SubgroupInclusiveAdd,
SubgroupInclusiveMul,
SubgroupInclusiveMin,
SubgroupInclusiveMax,
SubgroupInclusiveAnd,
SubgroupInclusiveOr,
SubgroupInclusiveXor,
SubgroupExclusiveAdd,
SubgroupExclusiveMul,
SubgroupExclusiveMin,
SubgroupExclusiveMax,
SubgroupExclusiveAnd,
SubgroupExclusiveOr,
SubgroupExclusiveXor,
SubgroupClusteredAdd,
SubgroupClusteredMul,
SubgroupClusteredMin,
SubgroupClusteredMax,
SubgroupClusteredAnd,
SubgroupClusteredOr,
SubgroupClusteredXor,
SubgroupQuadBroadcast,
SubgroupQuadSwapHorizontal,
SubgroupQuadSwapVertical,
SubgroupQuadSwapDiagonal,
SubgroupPartition,
SubgroupPartitionedAdd,
SubgroupPartitionedMul,
SubgroupPartitionedMin,
SubgroupPartitionedMax,
SubgroupPartitionedAnd,
SubgroupPartitionedOr,
SubgroupPartitionedXor,
SubgroupPartitionedInclusiveAdd,
SubgroupPartitionedInclusiveMul,
SubgroupPartitionedInclusiveMin,
SubgroupPartitionedInclusiveMax,
SubgroupPartitionedInclusiveAnd,
SubgroupPartitionedInclusiveOr,
SubgroupPartitionedInclusiveXor,
SubgroupPartitionedExclusiveAdd,
SubgroupPartitionedExclusiveMul,
SubgroupPartitionedExclusiveMin,
SubgroupPartitionedExclusiveMax,
SubgroupPartitionedExclusiveAnd,
SubgroupPartitionedExclusiveOr,
SubgroupPartitionedExclusiveXor,
SubgroupGuardStop,
MinInvocations,
MaxInvocations,
AddInvocations,
MinInvocationsNonUniform,
MaxInvocationsNonUniform,
AddInvocationsNonUniform,
MinInvocationsInclusiveScan,
MaxInvocationsInclusiveScan,
AddInvocationsInclusiveScan,
MinInvocationsInclusiveScanNonUniform,
MaxInvocationsInclusiveScanNonUniform,
AddInvocationsInclusiveScanNonUniform,
MinInvocationsExclusiveScan,
MaxInvocationsExclusiveScan,
AddInvocationsExclusiveScan,
MinInvocationsExclusiveScanNonUniform,
MaxInvocationsExclusiveScanNonUniform,
AddInvocationsExclusiveScanNonUniform,
SwizzleInvocations,
SwizzleInvocationsMasked,
WriteInvocation,
Mbcnt,
CubeFaceIndex,
CubeFaceCoord,
Time,
AtomicAdd,
AtomicSubtract,
AtomicMin,
AtomicMax,
AtomicAnd,
AtomicOr,
AtomicXor,
AtomicExchange,
AtomicCompSwap,
AtomicLoad,
AtomicStore,
AtomicCounterIncrement, // results in pre-increment value
AtomicCounterDecrement, // results in post-decrement value
AtomicCounter,
AtomicCounterAdd,
AtomicCounterSubtract,
AtomicCounterMin,
AtomicCounterMax,
AtomicCounterAnd,
AtomicCounterOr,
AtomicCounterXor,
AtomicCounterExchange,
AtomicCounterCompSwap,
Any,
All,
CooperativeMatrixLoad,
CooperativeMatrixStore,
CooperativeMatrixMulAdd,
CooperativeMatrixLoadNV,
CooperativeMatrixStoreNV,
CooperativeMatrixMulAddNV,
BeginInvocationInterlock, // Fragment only
EndInvocationInterlock, // Fragment only
IsHelperInvocation,
DebugPrintf,
//
// Constructors
//
ConstructGuardStart,
ConstructInt, // these first scalar forms also identify what implicit conversion is needed
ConstructUint,
ConstructInt8,
ConstructUint8,
ConstructInt16,
ConstructUint16,
ConstructInt64,
ConstructUint64,
ConstructBool,
ConstructFloat,
ConstructDouble,
// Keep vector and matrix constructors in a consistent relative order for
// TParseContext::constructBuiltIn, which converts between 8/16/32 bit
// vector constructors
ConstructVec2,
ConstructVec3,
ConstructVec4,
ConstructMat2x2,
ConstructMat2x3,
ConstructMat2x4,
ConstructMat3x2,
ConstructMat3x3,
ConstructMat3x4,
ConstructMat4x2,
ConstructMat4x3,
ConstructMat4x4,
ConstructDVec2,
ConstructDVec3,
ConstructDVec4,
ConstructBVec2,
ConstructBVec3,
ConstructBVec4,
ConstructI8Vec2,
ConstructI8Vec3,
ConstructI8Vec4,
ConstructU8Vec2,
ConstructU8Vec3,
ConstructU8Vec4,
ConstructI16Vec2,
ConstructI16Vec3,
ConstructI16Vec4,
ConstructU16Vec2,
ConstructU16Vec3,
ConstructU16Vec4,
ConstructIVec2,
ConstructIVec3,
ConstructIVec4,
ConstructUVec2,
ConstructUVec3,
ConstructUVec4,
ConstructI64Vec2,
ConstructI64Vec3,
ConstructI64Vec4,
ConstructU64Vec2,
ConstructU64Vec3,
ConstructU64Vec4,
ConstructDMat2x2,
ConstructDMat2x3,
ConstructDMat2x4,
ConstructDMat3x2,
ConstructDMat3x3,
ConstructDMat3x4,
ConstructDMat4x2,
ConstructDMat4x3,
ConstructDMat4x4,
ConstructIMat2x2,
ConstructIMat2x3,
ConstructIMat2x4,
ConstructIMat3x2,
ConstructIMat3x3,
ConstructIMat3x4,
ConstructIMat4x2,
ConstructIMat4x3,
ConstructIMat4x4,
ConstructUMat2x2,
ConstructUMat2x3,
ConstructUMat2x4,
ConstructUMat3x2,
ConstructUMat3x3,
ConstructUMat3x4,
ConstructUMat4x2,
ConstructUMat4x3,
ConstructUMat4x4,
ConstructBMat2x2,
ConstructBMat2x3,
ConstructBMat2x4,
ConstructBMat3x2,
ConstructBMat3x3,
ConstructBMat3x4,
ConstructBMat4x2,
ConstructBMat4x3,
ConstructBMat4x4,
ConstructFloat16,
ConstructF16Vec2,
ConstructF16Vec3,
ConstructF16Vec4,
ConstructF16Mat2x2,
ConstructF16Mat2x3,
ConstructF16Mat2x4,
ConstructF16Mat3x2,
ConstructF16Mat3x3,
ConstructF16Mat3x4,
ConstructF16Mat4x2,
ConstructF16Mat4x3,
ConstructF16Mat4x4,
ConstructStruct,
ConstructTextureSampler,
ConstructNonuniform, // expected to be transformed away, not present in final AST
ConstructReference,
ConstructCooperativeMatrixNV,
ConstructCooperativeMatrixKHR,
ConstructAccStruct,
ConstructGuardEnd,
//
// moves
//
Assign,
AddAssign,
SubAssign,
@@ -744,223 +94,13 @@ enum class RValueOperator : uint16_t {
ExclusiveOrAssign,
LeftShiftAssign,
RightShiftAssign,
//
// Array operators
//
// Can apply to arrays, vectors, or matrices.
// Can be decomposed to a constant at compile time, but this does not always happen,
// due to link-time effects. So, consumer can expect either a link-time sized or
// run-time sized array.
ArrayLength,
//
// Image operations
//
// Ternary
Ternary,
ImageGuardBegin,
ImageQuerySize,
ImageQuerySamples,
ImageLoad,
ImageStore,
ImageLoadLod,
ImageStoreLod,
ImageAtomicAdd,
ImageAtomicMin,
ImageAtomicMax,
ImageAtomicAnd,
ImageAtomicOr,
ImageAtomicXor,
ImageAtomicExchange,
ImageAtomicCompSwap,
ImageAtomicLoad,
ImageAtomicStore,
SubpassLoad,
SubpassLoadMS,
SparseImageLoad,
SparseImageLoadLod,
ColorAttachmentReadEXT, // Fragment only
ImageGuardEnd,
//
// Texture operations
//
TextureGuardBegin,
TextureQuerySize,
TextureQueryLod,
TextureQueryLevels,
TextureQuerySamples,
SamplingGuardBegin,
Texture,
TextureProj,
TextureLod,
TextureOffset,
TextureFetch,
TextureFetchOffset,
TextureProjOffset,
TextureLodOffset,
TextureProjLod,
TextureProjLodOffset,
TextureGrad,
TextureGradOffset,
TextureProjGrad,
TextureProjGradOffset,
TextureGather,
TextureGatherOffset,
TextureGatherOffsets,
TextureClamp,
TextureOffsetClamp,
TextureGradClamp,
TextureGradOffsetClamp,
TextureGatherLod,
TextureGatherLodOffset,
TextureGatherLodOffsets,
FragmentMaskFetch,
FragmentFetch,
SparseTextureGuardBegin,
SparseTexture,
SparseTextureLod,
SparseTextureOffset,
SparseTextureFetch,
SparseTextureFetchOffset,
SparseTextureLodOffset,
SparseTextureGrad,
SparseTextureGradOffset,
SparseTextureGather,
SparseTextureGatherOffset,
SparseTextureGatherOffsets,
SparseTexelsResident,
SparseTextureClamp,
SparseTextureOffsetClamp,
SparseTextureGradClamp,
SparseTextureGradOffsetClamp,
SparseTextureGatherLod,
SparseTextureGatherLodOffset,
SparseTextureGatherLodOffsets,
SparseTextureGuardEnd,
ImageFootprintGuardBegin,
ImageSampleFootprintNV,
ImageSampleFootprintClampNV,
ImageSampleFootprintLodNV,
ImageSampleFootprintGradNV,
ImageSampleFootprintGradClampNV,
ImageFootprintGuardEnd,
SamplingGuardEnd,
TextureGuardEnd,
//
// Integer operations
//
AddCarry,
SubBorrow,
UMulExtended,
IMulExtended,
BitfieldExtract,
BitfieldInsert,
BitFieldReverse,
BitCount,
FindLSB,
FindMSB,
CountLeadingZeros,
CountTrailingZeros,
AbsDifference,
AddSaturate,
SubSaturate,
Average,
AverageRounded,
Mul32x16,
TraceNV,
TraceRayMotionNV,
TraceKHR,
ReportIntersection,
IgnoreIntersectionNV,
TerminateRayNV,
ExecuteCallableNV,
ExecuteCallableKHR,
WritePackedPrimitiveIndices4x8NV,
EmitMeshTasksEXT,
SetMeshOutputsEXT,
//
// GL_EXT_ray_query operations
//
RayQueryInitialize,
RayQueryTerminate,
RayQueryGenerateIntersection,
RayQueryConfirmIntersection,
RayQueryProceed,
RayQueryGetIntersectionType,
RayQueryGetRayTMin,
RayQueryGetRayFlags,
RayQueryGetIntersectionT,
RayQueryGetIntersectionInstanceCustomIndex,
RayQueryGetIntersectionInstanceId,
RayQueryGetIntersectionInstanceShaderBindingTableRecordOffset,
RayQueryGetIntersectionGeometryIndex,
RayQueryGetIntersectionPrimitiveIndex,
RayQueryGetIntersectionBarycentrics,
RayQueryGetIntersectionFrontFace,
RayQueryGetIntersectionCandidateAABBOpaque,
RayQueryGetIntersectionObjectRayDirection,
RayQueryGetIntersectionObjectRayOrigin,
RayQueryGetWorldRayDirection,
RayQueryGetWorldRayOrigin,
RayQueryGetIntersectionObjectToWorld,
RayQueryGetIntersectionWorldToObject,
//
// GL_NV_shader_invocation_reorder
//
HitObjectTraceRayNV,
HitObjectTraceRayMotionNV,
HitObjectRecordHitNV,
HitObjectRecordHitMotionNV,
HitObjectRecordHitWithIndexNV,
HitObjectRecordHitWithIndexMotionNV,
HitObjectRecordMissNV,
HitObjectRecordMissMotionNV,
HitObjectRecordEmptyNV,
HitObjectExecuteShaderNV,
HitObjectIsEmptyNV,
HitObjectIsMissNV,
HitObjectIsHitNV,
HitObjectGetRayTMinNV,
HitObjectGetRayTMaxNV,
HitObjectGetObjectRayOriginNV,
HitObjectGetObjectRayDirectionNV,
HitObjectGetWorldRayOriginNV,
HitObjectGetWorldRayDirectionNV,
HitObjectGetWorldToObjectNV,
HitObjectGetObjectToWorldNV,
HitObjectGetInstanceCustomIndexNV,
HitObjectGetInstanceIdNV,
HitObjectGetGeometryIndexNV,
HitObjectGetPrimitiveIndexNV,
HitObjectGetHitKindNV,
HitObjectGetShaderBindingTableRecordIndexNV,
HitObjectGetShaderRecordBufferHandleNV,
HitObjectGetAttributesNV,
HitObjectGetCurrentTimeNV,
ReorderThreadNV,
FetchMicroTriangleVertexPositionNV,
FetchMicroTriangleVertexBarycentricNV,
// Misc
ConstructStruct,
};
// The order of the fields in this enum is very important due to a hack in glslangTypeToType.

File diff suppressed because it is too large Load Diff