diff options
author | Lei Zhang <antiagainst@google.com> | 2016-04-04 14:30:56 -0400 |
---|---|---|
committer | Lei Zhang <antiagainst@google.com> | 2016-04-04 16:13:06 -0400 |
commit | 80e416ce9174cb294c76eef09a71647277a95ccf (patch) | |
tree | 24540cd655a95a292405bcc2a037cccfa263bcb5 /source/ext_inst.cpp | |
parent | 9ca2d6dcd2f1356895533a4aedc0f1cf765f2963 (diff) | |
download | spirv-tools-80e416ce9174cb294c76eef09a71647277a95ccf.tar.gz |
Use JSON grammar files to generate extended instruction sets.
Diffstat (limited to 'source/ext_inst.cpp')
-rw-r--r-- | source/ext_inst.cpp | 123 |
1 files changed, 2 insertions, 121 deletions
diff --git a/source/ext_inst.cpp b/source/ext_inst.cpp index 67366de0..f612fa99 100644 --- a/source/ext_inst.cpp +++ b/source/ext_inst.cpp @@ -32,131 +32,12 @@ #include "spirv/OpenCL.std.h" #include "spirv_definition.h" -/// Generate a spv_ext_inst_desc_t literal for a GLSL std450 extended -/// instruction with one/two/three <id> parameter(s). -#define GLSL450Inst1(name) \ - #name, GLSLstd450::GLSLstd450##name, 0, { SPV_OPERAND_TYPE_ID } -#define GLSL450Inst1Cap(name, cap) \ - #name, GLSLstd450::GLSLstd450##name, \ - SPV_CAPABILITY_AS_MASK(SpvCapability##cap), { \ - SPV_OPERAND_TYPE_ID \ - } -#define GLSL450Inst2(name) \ - #name, GLSLstd450::GLSLstd450##name, 0, { \ - SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID \ - } -#define GLSL450Inst2Cap(name, cap) \ - #name, GLSLstd450::GLSLstd450##name, \ - SPV_CAPABILITY_AS_MASK(SpvCapability##cap), { \ - SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID \ - } -#define GLSL450Inst3(name) \ - #name, GLSLstd450::GLSLstd450##name, 0, { \ - SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID, SPV_OPERAND_TYPE_ID \ - } - static const spv_ext_inst_desc_t glslStd450Entries[] = { - {GLSL450Inst1(Round)}, - {GLSL450Inst1(RoundEven)}, - {GLSL450Inst1(Trunc)}, - {GLSL450Inst1(FAbs)}, - {GLSL450Inst1(SAbs)}, - {GLSL450Inst1(FSign)}, - {GLSL450Inst1(SSign)}, - {GLSL450Inst1(Floor)}, - {GLSL450Inst1(Ceil)}, - {GLSL450Inst1(Fract)}, - {GLSL450Inst1(Radians)}, - {GLSL450Inst1(Degrees)}, - {GLSL450Inst1(Sin)}, - {GLSL450Inst1(Cos)}, - {GLSL450Inst1(Tan)}, - {GLSL450Inst1(Asin)}, - {GLSL450Inst1(Acos)}, - {GLSL450Inst1(Atan)}, - {GLSL450Inst1(Sinh)}, - {GLSL450Inst1(Cosh)}, - {GLSL450Inst1(Tanh)}, - {GLSL450Inst1(Asinh)}, - {GLSL450Inst1(Acosh)}, - {GLSL450Inst1(Atanh)}, - {GLSL450Inst2(Atan2)}, - {GLSL450Inst2(Pow)}, - {GLSL450Inst1(Exp)}, - {GLSL450Inst1(Log)}, - {GLSL450Inst1(Exp2)}, - {GLSL450Inst1(Log2)}, - {GLSL450Inst1(Sqrt)}, - {GLSL450Inst1(InverseSqrt)}, - {GLSL450Inst1(Determinant)}, - {GLSL450Inst1(MatrixInverse)}, - {GLSL450Inst2(Modf)}, - {GLSL450Inst1(ModfStruct)}, - {GLSL450Inst2(FMin)}, - {GLSL450Inst2(UMin)}, - {GLSL450Inst2(SMin)}, - {GLSL450Inst2(FMax)}, - {GLSL450Inst2(UMax)}, - {GLSL450Inst2(SMax)}, - {GLSL450Inst3(FClamp)}, - {GLSL450Inst3(UClamp)}, - {GLSL450Inst3(SClamp)}, - {GLSL450Inst3(FMix)}, - {GLSL450Inst3(IMix)}, - {GLSL450Inst2(Step)}, - {GLSL450Inst3(SmoothStep)}, - {GLSL450Inst3(Fma)}, - {GLSL450Inst2(Frexp)}, - {GLSL450Inst1(FrexpStruct)}, - {GLSL450Inst2(Ldexp)}, - {GLSL450Inst1(PackSnorm4x8)}, - {GLSL450Inst1(PackUnorm4x8)}, - {GLSL450Inst1(PackSnorm2x16)}, - {GLSL450Inst1(PackUnorm2x16)}, - {GLSL450Inst1(PackHalf2x16)}, - {GLSL450Inst1Cap(PackDouble2x32, Float64)}, - {GLSL450Inst1(UnpackSnorm2x16)}, - {GLSL450Inst1(UnpackUnorm2x16)}, - {GLSL450Inst1(UnpackHalf2x16)}, - {GLSL450Inst1(UnpackSnorm4x8)}, - {GLSL450Inst1(UnpackUnorm4x8)}, - {GLSL450Inst1(UnpackDouble2x32)}, - {GLSL450Inst1(Length)}, - {GLSL450Inst2(Distance)}, - {GLSL450Inst2(Cross)}, - {GLSL450Inst1(Normalize)}, - {GLSL450Inst3(FaceForward)}, - {GLSL450Inst2(Reflect)}, - {GLSL450Inst3(Refract)}, - {GLSL450Inst1(FindILsb)}, - {GLSL450Inst1(FindSMsb)}, - {GLSL450Inst1(FindUMsb)}, - {GLSL450Inst1Cap(InterpolateAtCentroid, InterpolationFunction)}, - {GLSL450Inst2Cap(InterpolateAtSample, InterpolationFunction)}, - {GLSL450Inst2Cap(InterpolateAtOffset, InterpolationFunction)}, - {GLSL450Inst2(NMin)}, - {GLSL450Inst2(NMax)}, - {GLSL450Inst2(NClamp)}, +#include "glsl.std.450.insts.inc" }; static const spv_ext_inst_desc_t openclEntries[] = { -#define ExtInst(Name, Opcode, OperandList) {#Name, Opcode, 0, OperandList}, -#define EmptyList \ - {} -#define List(...) \ - { __VA_ARGS__ } -#define OperandId SPV_OPERAND_TYPE_ID -#define OperandLiteralNumber SPV_OPERAND_TYPE_LITERAL_INTEGER -#define OperandFPRoundingMode SPV_OPERAND_TYPE_FP_ROUNDING_MODE -#define OperandVariableIds SPV_OPERAND_TYPE_VARIABLE_ID -#include "opencl_std_ext_inst.inc" -#undef ExtList -#undef EmptyList -#undef List -#undef OperandId -#undef OperandLiteralNumber -#undef OperandFPRoundingMode -#undef OperandVariableIds +#include "opencl.std.insts.inc" }; spv_result_t spvExtInstTableGet(spv_ext_inst_table* pExtInstTable) { |