diff options
Diffstat (limited to 'plugins/language_glsl.lua')
-rw-r--r-- | plugins/language_glsl.lua | 501 |
1 files changed, 202 insertions, 299 deletions
diff --git a/plugins/language_glsl.lua b/plugins/language_glsl.lua index f8983d4..da69ebd 100644 --- a/plugins/language_glsl.lua +++ b/plugins/language_glsl.lua @@ -2,8 +2,6 @@ local style = require "core.style" local common = require "core.common" -style.syntax["forbiddenbuiltin"] = { common.color "#ee0000" } -style.syntax["builtin"] = { common.color "#77eecc" } local syntax = require "core.syntax" syntax.add { @@ -20,42 +18,6 @@ syntax.add { { pattern = "-?%.?%d+f?", type = "number" }, { pattern = "[%+%-=/%*%^%%<>!~|&]", type = "operator" }, - { pattern = "int[1-9]x[1-9]", type = "forbiddenbuiltin" }, - { pattern = "int1[0-6]x[1-9]", type = "forbiddenbuiltin" }, - { pattern = "int[1-9]x1[0-6]", type = "forbiddenbuiltin" }, - { pattern = "int1[0-6]x1[0-6]", type = "forbiddenbuiltin" }, - { pattern = "int[1-4]", type = "forbiddenbuiltin" }, - - { pattern = "uint[1-9]x[1-9]", type = "forbiddenbuiltin" }, - { pattern = "uint1[0-6]x[1-9]", type = "forbiddenbuiltin" }, - { pattern = "uint[1-9]x1[0-6]", type = "forbiddenbuiltin" }, - { pattern = "uint1[0-6]x1[0-6]", type = "forbiddenbuiltin" }, - { pattern = "uint[1-4]", type = "forbiddenbuiltin" }, - - { pattern = "dword[1-9]x[1-9]", type = "forbiddenbuiltin" }, - { pattern = "dword1[0-6]x[1-9]", type = "forbiddenbuiltin" }, - { pattern = "dword[1-9]x1[0-6]", type = "forbiddenbuiltin" }, - { pattern = "dword1[0-6]x1[0-6]", type = "forbiddenbuiltin" }, - { pattern = "dword[1-4]", type = "forbiddenbuiltin" }, - - { pattern = "half[1-9]x[1-9]", type = "forbiddenbuiltin" }, - { pattern = "half1[0-6]x[1-9]", type = "forbiddenbuiltin" }, - { pattern = "half[1-9]x1[0-6]", type = "forbiddenbuiltin" }, - { pattern = "half1[0-6]x1[0-6]", type = "forbiddenbuiltin" }, - { pattern = "half[1-4]", type = "forbiddenbuiltin" }, - - { pattern = "float[1-9]x[1-9]", type = "forbiddenbuiltin" }, - { pattern = "float1[0-6]x[1-9]", type = "forbiddenbuiltin" }, - { pattern = "float[1-9]x1[0-6]", type = "forbiddenbuiltin" }, - { pattern = "float1[0-6]x1[0-6]", type = "forbiddenbuiltin" }, - { pattern = "float[1-4]", type = "forbiddenbuiltin" }, - - { pattern = "double[1-9]x[1-9]", type = "forbiddenbuiltin" }, - { pattern = "double1[0-6]x[1-9]", type = "forbiddenbuiltin" }, - { pattern = "double[1-9]x1[0-6]", type = "forbiddenbuiltin" }, - { pattern = "double1[0-6]x1[0-6]", type = "forbiddenbuiltin" }, - { pattern = "double[1-4]", type = "forbiddenbuiltin" }, - { pattern = "ivec[2-4]", type = "keyword2" }, { pattern = "bvec[2-4]", type = "keyword2" }, { pattern = "uvec[2-4]", type = "keyword2" }, @@ -198,220 +160,220 @@ syntax.add { ["atomic_uint"] = "keyword2", - ["radians"] = "builtin", - ["degrees"] = "builtin", - ["sin"] = "builtin", - ["cos"] = "builtin", - ["tan"] = "builtin", - ["asin"] = "builtin", - ["acos"] = "builtin", - ["atan"] = "builtin", - ["sinh"] = "builtin", - ["cosh"] = "builtin", - ["tanh"] = "builtin", - ["asinh"] = "builtin", - ["acosh"] = "builtin", - ["pow"] = "builtin", - ["exp"] = "builtin", - ["exp2"] = "builtin", - ["log2"] = "builtin", - ["sqrt"] = "builtin", - ["inversesqrt"] = "forbiddenbuiltin", - ["abs"] = "builtin", - ["sign"] = "builtin", - ["floor"] = "builtin", - ["trunc"] = "builtin", - ["round"] = "builtin", - ["roundEven"] = "builtin", - ["ceil"] = "builtin", - ["fract"] = "builtin", - ["mod"] = "builtin", - ["modf"] = "builtin", - ["min"] = "builtin", - ["max"] = "builtin", - ["clamp"] = "builtin", - ["mix"] = "builtin", - ["step"] = "builtin", - ["smoothstep"] = "builtin", - ["isnan"] = "builtin", - ["isinf"] = "builtin", - ["floatBitsToInt"] = "builtin", - ["floatBitsToUint"] = "builtin", - ["intBitsToFloat"] = "builtin", - ["uintBitsToFloat"] = "builtin", - ["fma"] = "builtin", - ["frexp"] = "builtin", - ["ldexp"] = "builtin", - ["packUnorm2x16"] = "builtin", - ["packSnorm2x16"] = "builtin", - ["packUnorm4x8"] = "builtin", - ["packSnorm4x8"] = "builtin", - ["unpackUnorm2x16"] = "builtin", - ["unpackSnorm2x16"] = "builtin", - ["unpackUnorm4x8"] = "builtin", - ["unpackSnorm4x8"] = "builtin", - ["packHalf2x16"] = "builtin", - ["unpackHalf2x16"] = "builtin", - ["packDouble2x32"] = "builtin", - ["unpackDouble2x32"] = "builtin", - ["length"] = "builtin", - ["distance"] = "builtin", - ["dot"] = "builtin", - ["cross"] = "builtin", - ["normalize"] = "builtin", - ["ftransform"] = "builtin", - ["faceforward"] = "builtin", - ["reflect"] = "builtin", - ["refract"] = "builtin", - ["matrixCompMult"] = "builtin", - ["outerProduct"] = "builtin", - ["transpose"] = "builtin", - ["determinant"] = "builtin", - ["inverse"] = "builtin", - ["lessThan"] = "builtin", - ["lessThanEqual"] = "builtin", - ["greaterThan"] = "builtin", - ["greaterThanEqual"] = "builtin", - ["equal"] = "builtin", - ["notEqual"] = "builtin", - ["any"] = "builtin", - ["all"] = "builtin", - ["not"] = "builtin", - ["uaddCarry"] = "builtin", - ["usubBorrow"] = "builtin", - ["umulExtended"] = "builtin", - ["imulExtended"] = "builtin", - ["bitfieldExtract"] = "builtin", - ["bitfieldInsert"] = "builtin", - ["bitfieldReverse"] = "builtin", - ["bitCount"] = "builtin", - ["findLSB"] = "builtin", - ["findMSB"] = "builtin", - ["textureSize"] = "builtin", - ["textureQueryLod"] = "builtin", - ["textureQueryLevels"] = "builtin", - ["textureSamples"] = "builtin", - ["texture"] = "builtin", - ["textureProj"] = "builtin", - ["textureLod"] = "builtin", - ["textureOffset"] = "builtin", - ["texelFetch"] = "builtin", - ["texelFetchOffset"] = "builtin", - ["textureProjOffset"] = "builtin", - ["textureLodOffset"] = "builtin", - ["textureProjLod"] = "builtin", - ["textureProjLodOffset"] = "builtin", - ["textureGrad"] = "builtin", - ["textureGradOffset"] = "builtin", - ["textureProjGrad"] = "builtin", - ["textureProjGradOffset"]= "builtin", - ["textureGather"] = "builtin", - ["textureGatherOffset"] = "builtin", - ["textureGatherOffsets"] = "builtin", + ["radians"] = "keyword", + ["degrees"] = "keyword", + ["sin"] = "keyword", + ["cos"] = "keyword", + ["tan"] = "keyword", + ["asin"] = "keyword", + ["acos"] = "keyword", + ["atan"] = "keyword", + ["sinh"] = "keyword", + ["cosh"] = "keyword", + ["tanh"] = "keyword", + ["asinh"] = "keyword", + ["acosh"] = "keyword", + ["pow"] = "keyword", + ["exp"] = "keyword", + ["exp2"] = "keyword", + ["log2"] = "keyword", + ["sqrt"] = "keyword", + ["inversesqrt"] = "keyword", + ["abs"] = "keyword", + ["sign"] = "keyword", + ["floor"] = "keyword", + ["trunc"] = "keyword", + ["round"] = "keyword", + ["roundEven"] = "keyword", + ["ceil"] = "keyword", + ["fract"] = "keyword", + ["mod"] = "keyword", + ["modf"] = "keyword", + ["min"] = "keyword", + ["max"] = "keyword", + ["clamp"] = "keyword", + ["mix"] = "keyword", + ["step"] = "keyword", + ["smoothstep"] = "keyword", + ["isnan"] = "keyword", + ["isinf"] = "keyword", + ["floatBitsToInt"] = "keyword", + ["floatBitsToUint"] = "keyword", + ["intBitsToFloat"] = "keyword", + ["uintBitsToFloat"] = "keyword", + ["fma"] = "keyword", + ["frexp"] = "keyword", + ["ldexp"] = "keyword", + ["packUnorm2x16"] = "keyword", + ["packSnorm2x16"] = "keyword", + ["packUnorm4x8"] = "keyword", + ["packSnorm4x8"] = "keyword", + ["unpackUnorm2x16"] = "keyword", + ["unpackSnorm2x16"] = "keyword", + ["unpackUnorm4x8"] = "keyword", + ["unpackSnorm4x8"] = "keyword", + ["packHalf2x16"] = "keyword", + ["unpackHalf2x16"] = "keyword", + ["packDouble2x32"] = "keyword", + ["unpackDouble2x32"] = "keyword", + ["length"] = "keyword", + ["distance"] = "keyword", + ["dot"] = "keyword", + ["cross"] = "keyword", + ["normalize"] = "keyword", + ["ftransform"] = "keyword", + ["faceforward"] = "keyword", + ["reflect"] = "keyword", + ["refract"] = "keyword", + ["matrixCompMult"] = "keyword", + ["outerProduct"] = "keyword", + ["transpose"] = "keyword", + ["determinant"] = "keyword", + ["inverse"] = "keyword", + ["lessThan"] = "keyword", + ["lessThanEqual"] = "keyword", + ["greaterThan"] = "keyword", + ["greaterThanEqual"] = "keyword", + ["equal"] = "keyword", + ["notEqual"] = "keyword", + ["any"] = "keyword", + ["all"] = "keyword", + ["not"] = "keyword", + ["uaddCarry"] = "keyword", + ["usubBorrow"] = "keyword", + ["umulExtended"] = "keyword", + ["imulExtended"] = "keyword", + ["bitfieldExtract"] = "keyword", + ["bitfieldInsert"] = "keyword", + ["bitfieldReverse"] = "keyword", + ["bitCount"] = "keyword", + ["findLSB"] = "keyword", + ["findMSB"] = "keyword", + ["textureSize"] = "keyword", + ["textureQueryLod"] = "keyword", + ["textureQueryLevels"] = "keyword", + ["textureSamples"] = "keyword", + ["texture"] = "keyword", + ["textureProj"] = "keyword", + ["textureLod"] = "keyword", + ["textureOffset"] = "keyword", + ["texelFetch"] = "keyword", + ["texelFetchOffset"] = "keyword", + ["textureProjOffset"] = "keyword", + ["textureLodOffset"] = "keyword", + ["textureProjLod"] = "keyword", + ["textureProjLodOffset"] = "keyword", + ["textureGrad"] = "keyword", + ["textureGradOffset"] = "keyword", + ["textureProjGrad"] = "keyword", + ["textureProjGradOffset"]= "keyword", + ["textureGather"] = "keyword", + ["textureGatherOffset"] = "keyword", + ["textureGatherOffsets"] = "keyword", --Atomic Counter Functions - ["atomicCounterIncrement"]= "builtin", - ["atomicCounterDecrement"]= "builtin", - ["atomicCounter"] = "builtin", - ["atomicCounterAdd"] = "builtin", - ["atomicCounterSubtract"] = "builtin", - ["atomicCounterMin"] = "builtin", - ["atomicCounterMax"] = "builtin", - ["atomicCounterAnd"] = "builtin", - ["atomicCounterOr"] = "builtin", - ["atomicCounterXor"] = "builtin", - ["atomicCounterExchange"] = "builtin", - ["atomicCounterCompSwap"] = "builtin", + ["atomicCounterIncrement"]= "keyword", + ["atomicCounterDecrement"]= "keyword", + ["atomicCounter"] = "keyword", + ["atomicCounterAdd"] = "keyword", + ["atomicCounterSubtract"] = "keyword", + ["atomicCounterMin"] = "keyword", + ["atomicCounterMax"] = "keyword", + ["atomicCounterAnd"] = "keyword", + ["atomicCounterOr"] = "keyword", + ["atomicCounterXor"] = "keyword", + ["atomicCounterExchange"] = "keyword", + ["atomicCounterCompSwap"] = "keyword", --Atomic Memory Functions - ["atomicAdd"] = "builtin", - ["atomicMin"] = "builtin", - ["atomicMax"] = "builtin", - ["atomicAnd"] = "builtin", - ["atomicOr"] = "builtin", - ["atomicXor"] = "builtin", - ["atomicExchange"]= "builtin", - ["atomicCompSwap"]= "builtin", + ["atomicAdd"] = "keyword", + ["atomicMin"] = "keyword", + ["atomicMax"] = "keyword", + ["atomicAnd"] = "keyword", + ["atomicOr"] = "keyword", + ["atomicXor"] = "keyword", + ["atomicExchange"]= "keyword", + ["atomicCompSwap"]= "keyword", --Image Functions - ["imageSize"] = "builtin", - ["imageSamples"] = "builtin", - ["imageLoad"] = "builtin", - ["imageStore"] = "builtin", - ["imageAtomicAdd"] = "builtin", - ["imageAtomicMin"] = "builtin", - ["imageAtomicMax"] = "builtin", - ["imageAtomicAnd"] = "builtin", - ["imageAtomicOr"] = "builtin", - ["imageAtomicXor"] = "builtin", - ["imageAtomicExchange"]= "builtin", - ["imageAtomicCompSwap"]= "builtin", + ["imageSize"] = "keyword", + ["imageSamples"] = "keyword", + ["imageLoad"] = "keyword", + ["imageStore"] = "keyword", + ["imageAtomicAdd"] = "keyword", + ["imageAtomicMin"] = "keyword", + ["imageAtomicMax"] = "keyword", + ["imageAtomicAnd"] = "keyword", + ["imageAtomicOr"] = "keyword", + ["imageAtomicXor"] = "keyword", + ["imageAtomicExchange"]= "keyword", + ["imageAtomicCompSwap"]= "keyword", --Geometry Shader Functions - ["EmitStreamVertex"] = "builtin", - ["EndStreamPrimitive"] = "builtin", - ["EmitVertex"] = "builtin", - ["EndPrimitive"] = "builtin", + ["EmitStreamVertex"] = "keyword", + ["EndStreamPrimitive"] = "keyword", + ["EmitVertex"] = "keyword", + ["EndPrimitive"] = "keyword", --Fragment Processing Functions - ["dFdx"] = "builtin", - ["dFdy"] = "builtin", - ["dFdxFine"] = "builtin", - ["dFdyFine"] = "builtin", - ["dFdxCoarse"] = "builtin", - ["dFdyCoarse"] = "builtin", - ["fwidth"] = "builtin", - ["fwidthFine"] = "builtin", - ["fwidthCoarse"] = "builtin", - ["interpolateAtCentroid"]= "builtin", - ["interpolateAtSample"] = "builtin", - ["interpolateAtOffset"] = "builtin", + ["dFdx"] = "keyword", + ["dFdy"] = "keyword", + ["dFdxFine"] = "keyword", + ["dFdyFine"] = "keyword", + ["dFdxCoarse"] = "keyword", + ["dFdyCoarse"] = "keyword", + ["fwidth"] = "keyword", + ["fwidthFine"] = "keyword", + ["fwidthCoarse"] = "keyword", + ["interpolateAtCentroid"]= "keyword", + ["interpolateAtSample"] = "keyword", + ["interpolateAtOffset"] = "keyword", --Shader Invocation Control Functions - ["barrier"] = "builtin", + ["barrier"] = "keyword", --Shader Memory Control Functions - ["memoryBarrier"] = "builtin", - ["memoryBarrierAtomicCounter"]= "builtin", - ["memoryBarrierBuffer"] = "builtin", - ["memoryBarrierShared"] = "builtin", - ["memoryBarrierImage"] = "builtin", - ["groupMemoryBarrier"] = "builtin", + ["memoryBarrier"] = "keyword", + ["memoryBarrierAtomicCounter"]= "keyword", + ["memoryBarrierBuffer"] = "keyword", + ["memoryBarrierShared"] = "keyword", + ["memoryBarrierImage"] = "keyword", + ["groupMemoryBarrier"] = "keyword", --Subpass-Input Functions - ["subpassLoad"] = "builtin", + ["subpassLoad"] = "keyword", --Shader Invocation Group Functions - ["anyInvocation"] = "builtin", - ["allInvocations"] = "builtin", - ["allInvocationsEqual"]= "builtin", + ["anyInvocation"] = "keyword", + ["allInvocations"] = "keyword", + ["allInvocationsEqual"]= "keyword", --"In addition, when targeting Vulkan, the following keywords also exist:" - ["texture1D"] = "builtin", - ["texture1DArray"] = "builtin", - ["itexture1D"] = "builtin", - ["itexture1DArray"] = "builtin", - ["utexture1D"] = "builtin", - ["utexture1DArray"] = "builtin", - ["texture2D"] = "builtin", - ["texture2DArray"] = "builtin", - ["itexture2D"] = "builtin", - ["itexture2DArray"] = "builtin", - ["utexture2D"] = "builtin", - ["utexture2DArray"] = "builtin", - ["texture2DRect"] = "builtin", - ["itexture2DRect"] = "builtin", - ["utexture2DRect"] = "builtin", - ["texture2DMS"] = "builtin", - ["itexture2DMS"] = "builtin", - ["utexture2DMS"] = "builtin", - ["texture2DMSArray"] = "builtin", - ["itexture2DMSArray"]= "builtin", - ["utexture2DMSArray"]= "builtin", - ["texture3D"] = "builtin", - ["itexture3D"] = "builtin", - ["utexture3D"] = "builtin", - ["textureCube"] = "builtin", - ["itextureCube"] = "builtin", - ["utextureCube"] = "builtin", - ["textureCubeArray"] = "builtin", - ["itextureCubeArray"]= "builtin", - ["utextureCubeArray"]= "builtin", - ["textureBuffer"] = "builtin", - ["itextureBuffer"] = "builtin", - ["utextureBuffer"] = "builtin", + ["texture1D"] = "keyword", + ["texture1DArray"] = "keyword", + ["itexture1D"] = "keyword", + ["itexture1DArray"] = "keyword", + ["utexture1D"] = "keyword", + ["utexture1DArray"] = "keyword", + ["texture2D"] = "keyword", + ["texture2DArray"] = "keyword", + ["itexture2D"] = "keyword", + ["itexture2DArray"] = "keyword", + ["utexture2D"] = "keyword", + ["utexture2DArray"] = "keyword", + ["texture2DRect"] = "keyword", + ["itexture2DRect"] = "keyword", + ["utexture2DRect"] = "keyword", + ["texture2DMS"] = "keyword", + ["itexture2DMS"] = "keyword", + ["utexture2DMS"] = "keyword", + ["texture2DMSArray"] = "keyword", + ["itexture2DMSArray"]= "keyword", + ["utexture2DMSArray"]= "keyword", + ["texture3D"] = "keyword", + ["itexture3D"] = "keyword", + ["utexture3D"] = "keyword", + ["textureCube"] = "keyword", + ["itextureCube"] = "keyword", + ["utextureCube"] = "keyword", + ["textureCubeArray"] = "keyword", + ["itextureCubeArray"]= "keyword", + ["utextureCubeArray"]= "keyword", + ["textureBuffer"] = "keyword", + ["itextureBuffer"] = "keyword", + ["utextureBuffer"] = "keyword", ["sampler"] = "keyword2", ["samplerShadow"] = "keyword2", ["subpassInput"] = "keyword2", @@ -420,65 +382,6 @@ syntax.add { ["subpassInputMS"] = "keyword2", ["isubpassInputMS"] = "keyword2", ["usubpassInputMS"] = "keyword2", - - --"The following are the keywords reserved for future use. Using them will result in a compile-time error:" - ["common"] = "forbiddenbuiltin", - ["partition"] = "forbiddenbuiltin", - ["active"] = "forbiddenbuiltin", - ["asm"] = "forbiddenbuiltin", - ["class"] = "forbiddenbuiltin", - ["union"] = "forbiddenbuiltin", - ["enum"] = "forbiddenbuiltin", - ["typedef"] = "forbiddenbuiltin", - ["template"] = "forbiddenbuiltin", - ["this"] = "forbiddenbuiltin", - ["resource"] = "forbiddenbuiltin", - ["goto"] = "forbiddenbuiltin", - ["inline"] = "forbiddenbuiltin", - ["noinline"] = "forbiddenbuiltin", - ["public"] = "forbiddenbuiltin", - ["static"] = "forbiddenbuiltin", - ["extern"] = "forbiddenbuiltin", - ["external"] = "forbiddenbuiltin", - ["interface"] = "forbiddenbuiltin", - ["long"] = "forbiddenbuiltin", - ["short"] = "forbiddenbuiltin", - ["half"] = "forbiddenbuiltin", - ["fixed"] = "forbiddenbuiltin", - ["unsigned"] = "forbiddenbuiltin", - ["superp"] = "forbiddenbuiltin", - ["input"] = "forbiddenbuiltin", - ["output"] = "forbiddenbuiltin", - ["hvec2"] = "forbiddenbuiltin", - ["hvec3"] = "forbiddenbuiltin", - ["hvec4"] = "forbiddenbuiltin", - ["fvec2"] = "forbiddenbuiltin", - ["fvec3"] = "forbiddenbuiltin", - ["fvec4"] = "forbiddenbuiltin", - ["filter"] = "forbiddenbuiltin", - ["sizeof"] = "forbiddenbuiltin", - ["cast"] = "forbiddenbuiltin", - ["namespace"] = "forbiddenbuiltin", - ["using"] = "forbiddenbuiltin", - ["sampler3DRect"]= "forbiddenbuiltin", - - --common symbols in HLSL that don't exist in GLSL - ["frac"] = "forbiddenbuiltin", - ["lerp"] = "forbiddenbuiltin", - ["mul"] = "forbiddenbuiltin", - ["min16float"] = "forbiddenbuiltin", - ["min10float"] = "forbiddenbuiltin", - ["min16int"] = "forbiddenbuiltin", - ["min12int"] = "forbiddenbuiltin", - ["min16uint"] = "forbiddenbuiltin", - ["rsqrt"] = "forbiddenbuiltin", - ["ddx"] = "forbiddenbuiltin", - ["ddx_coarse"] = "forbiddenbuiltin", - ["ddx_fine"] = "forbiddenbuiltin", - ["ddy"] = "forbiddenbuiltin", - ["ddy_coarse"] = "forbiddenbuiltin", - ["ddy_fine"] = "forbiddenbuiltin", - }, } |