Mercurial > forks > helix
changeset 6769:744f9134531f
feat: add wgsl built-in functions to `@function.builtin` (#13479)
Co-authored-by: Nik Revenco <[email protected]>
author | Nik Revenco <154856872+nik-rev@users.noreply.github.com> |
---|---|
date | Thu, 08 May 2025 13:56:36 +0100 |
parents | 6f4096734f5b |
children | 7b5782139252 |
files | runtime/queries/wgsl/highlights.scm |
diffstat | 1 files changed, 117 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/runtime/queries/wgsl/highlights.scm Wed May 07 17:38:07 2025 -0500 +++ b/runtime/queries/wgsl/highlights.scm Thu May 08 13:56:36 2025 +0100 @@ -31,8 +31,6 @@ ["(" ")" "[" "]" "{" "}"] @punctuation.bracket -(type_declaration ["<" ">"] @punctuation.bracket) - [ "break" "continue" @@ -115,3 +113,120 @@ (identifier) @attribute) (comment) @comment + +; built-in wgsl functions: https://webgpufundamentals.org/webgpu/lessons/webgpu-wgsl-function-reference.html +( + (identifier) @function.builtin + (#any-of? @function.builtin + "abs" + "abs" + "acos" + "acosh" + "all" + "any" + "arrayLength" + "asin" + "asinh" + "atan" + "atan2" + "atanh" + "atomicAdd" + "atomicLoad" + "atomicStore" + "bitcast" + "ceil" + "clamp" + "cos" + "cosh" + "countLeadingZeros" + "countOneBits" + "countTrailingZeros" + "cross" + "degrees" + "determinant" + "distance" + "dot" + "dpdx" + "dpdxCoarse" + "dpdxFine" + "dpdy" + "dpdyCoarse" + "dpdyFine" + "exp" + "exp2" + "extractBits" + "faceForward" + "firstLeadingBit" + "firstTrailingBit" + "floor" + "fma" + "fract" + "frexp" + "fwidth" + "fwidthCoarse" + "fwidthFine" + "gather_depth_compare" + "gather_x_components" + "insertBits" + "inverseSqrt" + "ldexp" + "length" + "log" + "log2" + "max" + "min" + "mix" + "modf" + "normalize" + "pack2x16float" + "pack2x16snorm" + "pack2x16unorm" + "pack4x8snorm" + "pack4x8unorm" + "pow" + "quantizeToF16" + "radians" + "reflect" + "refract" + "reverseBits" + "round" + "saturate" + "select" + "sign" + "sin" + "sinh" + "smoothstep" + "sqrt" + "step" + "storageBarrier" + "tan" + "tanh" + "textureDimensions" + "textureGather" + "textureGatherCompare" + "textureLoad" + "textureNumLayers" + "textureNumLevels" + "textureNumSamples" + "textureSample" + "textureSampleBaseClampToEdge" + "textureSampleBias" + "textureSampleCompare" + "textureSampleCompareLevel" + "textureSampleGrad" + "textureSampleLevel" + "textureStore" + "transpose" + "trunc" + "unpack2x16float" + "unpack2x16snorm" + "unpack2x16unorm" + "unpack4x8snorm" + "unpack4x8unorm" + "workgroupBarrier" + "workgroupUniformLoad" + ) +) + +(type_declaration ["<" ">"] @punctuation.bracket) +(variable_qualifier ["<" ">"] @punctuation.bracket)