| 1 |
{ |
| 2 |
"information_for_contributors": [ |
| 3 |
"This file has been converted from https://github.com/tgjones/shaders-tmLanguage/blob/master/grammars/hlsl.json", |
| 4 |
"If you want to provide a fix or improvement, please create a pull request against the original repository.", |
| 5 |
"Once accepted there, we are happy to receive an update request." |
| 6 |
], |
| 7 |
"version": "https://github.com/tgjones/shaders-tmLanguage/commit/87c0dca3a39170dbd7ee7e277db4f915fb2de14a", |
| 8 |
"name": "hlsl", |
| 9 |
"scopeName": "source.hlsl", |
| 10 |
"patterns": [ |
| 11 |
{ |
| 12 |
"name": "comment.line.block.hlsl", |
| 13 |
"begin": "/\\*", |
| 14 |
"end": "\\*/" |
| 15 |
}, |
| 16 |
{ |
| 17 |
"name": "comment.line.double-slash.hlsl", |
| 18 |
"begin": "//", |
| 19 |
"end": "$" |
| 20 |
}, |
| 21 |
{ |
| 22 |
"name": "constant.numeric.decimal.hlsl", |
| 23 |
"match": "\\b[0-9]+\\.[0-9]*(F|f)?\\b" |
| 24 |
}, |
| 25 |
{ |
| 26 |
"name": "constant.numeric.decimal.hlsl", |
| 27 |
"match": "(\\.([0-9]+)(F|f)?)\\b" |
| 28 |
}, |
| 29 |
{ |
| 30 |
"name": "constant.numeric.decimal.hlsl", |
| 31 |
"match": "\\b([0-9]+(F|f)?)\\b" |
| 32 |
}, |
| 33 |
{ |
| 34 |
"name": "constant.numeric.hex.hlsl", |
| 35 |
"match": "\\b(0(x|X)[0-9a-fA-F]+)\\b" |
| 36 |
}, |
| 37 |
{ |
| 38 |
"name": "constant.language.hlsl", |
| 39 |
"match": "\\b(false|true)\\b" |
| 40 |
}, |
| 41 |
{ |
| 42 |
"name": "keyword.preprocessor.hlsl", |
| 43 |
"match": "^\\s*#\\s*(define|elif|else|endif|ifdef|ifndef|if|undef|include|line|error|pragma)" |
| 44 |
}, |
| 45 |
{ |
| 46 |
"name": "keyword.control.hlsl", |
| 47 |
"match": "\\b(break|case|continue|default|discard|do|else|for|if|return|switch|while)\\b" |
| 48 |
}, |
| 49 |
{ |
| 50 |
"name": "keyword.control.fx.hlsl", |
| 51 |
"match": "\\b(compile)\\b" |
| 52 |
}, |
| 53 |
{ |
| 54 |
"name": "keyword.typealias.hlsl", |
| 55 |
"match": "\\b(typedef)\\b" |
| 56 |
}, |
| 57 |
{ |
| 58 |
"name": "storage.type.basic.hlsl", |
| 59 |
"match": "\\b(bool([1-4](x[1-4])?)?|double([1-4](x[1-4])?)?|dword|float([1-4](x[1-4])?)?|half([1-4](x[1-4])?)?|int([1-4](x[1-4])?)?|matrix|min10float([1-4](x[1-4])?)?|min12int([1-4](x[1-4])?)?|min16float([1-4](x[1-4])?)?|min16int([1-4](x[1-4])?)?|min16uint([1-4](x[1-4])?)?|unsigned|uint([1-4](x[1-4])?)?|vector|void)\\b" |
| 60 |
}, |
| 61 |
{ |
| 62 |
"name": "support.function.hlsl", |
| 63 |
"match": "\\b([a-zA-Z_][a-zA-Z0-9_]*)(?=[\\s]*\\()" |
| 64 |
}, |
| 65 |
{ |
| 66 |
"name": "support.variable.semantic.hlsl", |
| 67 |
"match": "(?<=\\:\\s|\\:)(?i:BINORMAL[0-9]*|BLENDINDICES[0-9]*|BLENDWEIGHT[0-9]*|COLOR[0-9]*|NORMAL[0-9]*|POSITIONT|POSITION|PSIZE[0-9]*|TANGENT[0-9]*|TEXCOORD[0-9]*|FOG|TESSFACTOR[0-9]*|VFACE|VPOS|DEPTH[0-9]*)\\b" |
| 68 |
}, |
| 69 |
{ |
| 70 |
"name": "support.variable.semantic.sm4.hlsl", |
| 71 |
"match": "(?<=\\:\\s|\\:)(?i:SV_ClipDistance[0-9]*|SV_CullDistance[0-9]*|SV_Coverage|SV_Depth|SV_DepthGreaterEqual[0-9]*|SV_DepthLessEqual[0-9]*|SV_InstanceID|SV_IsFrontFace|SV_Position|SV_RenderTargetArrayIndex|SV_SampleIndex|SV_StencilRef|SV_Target[0-7]?|SV_VertexID|SV_ViewportArrayIndex)\\b" |
| 72 |
}, |
| 73 |
{ |
| 74 |
"name": "support.variable.semantic.sm5.hlsl", |
| 75 |
"match": "(?<=\\:\\s|\\:)(?i:SV_DispatchThreadID|SV_DomainLocation|SV_GroupID|SV_GroupIndex|SV_GroupThreadID|SV_GSInstanceID|SV_InsideTessFactor|SV_OutputControlPointID|SV_TessFactor)\\b" |
| 76 |
}, |
| 77 |
{ |
| 78 |
"name": "support.variable.semantic.sm5_1.hlsl", |
| 79 |
"match": "(?<=\\:\\s|\\:)(?i:SV_InnerCoverage|SV_StencilRef)\\b" |
| 80 |
}, |
| 81 |
{ |
| 82 |
"name": "storage.modifier.hlsl", |
| 83 |
"match": "\\b(column_major|const|export|extern|globallycoherent|groupshared|inline|inout|in|out|precise|row_major|shared|static|uniform|volatile)\\b" |
| 84 |
}, |
| 85 |
{ |
| 86 |
"name": "storage.modifier.float.hlsl", |
| 87 |
"match": "\\b(snorm|unorm)\\b" |
| 88 |
}, |
| 89 |
{ |
| 90 |
"name": "storage.modifier.postfix.hlsl", |
| 91 |
"match": "\\b(packoffset|register)\\b" |
| 92 |
}, |
| 93 |
{ |
| 94 |
"name": "storage.modifier.interpolation.hlsl", |
| 95 |
"match": "\\b(centroid|linear|nointerpolation|noperspective|sample)\\b" |
| 96 |
}, |
| 97 |
{ |
| 98 |
"name": "storage.modifier.geometryshader.hlsl", |
| 99 |
"match": "\\b(lineadj|line|point|triangle|triangleadj)\\b" |
| 100 |
}, |
| 101 |
{ |
| 102 |
"name": "support.type.other.hlsl", |
| 103 |
"match": "\\b(string)\\b" |
| 104 |
}, |
| 105 |
{ |
| 106 |
"name": "support.type.object.hlsl", |
| 107 |
"match": "\\b(AppendStructuredBuffer|Buffer|ByteAddressBuffer|ConstantBuffer|ConsumeStructuredBuffer|InputPatch|OutputPatch)\\b" |
| 108 |
}, |
| 109 |
{ |
| 110 |
"name": "support.type.object.rasterizerordered.hlsl", |
| 111 |
"match": "\\b(RasterizerOrderedBuffer|RasterizerOrderedByteAddressBuffer|RasterizerOrderedStructuredBuffer|RasterizerOrderedTexture1D|RasterizerOrderedTexture1DArray|RasterizerOrderedTexture2D|RasterizerOrderedTexture2DArray|RasterizerOrderedTexture3D)\\b" |
| 112 |
}, |
| 113 |
{ |
| 114 |
"name": "support.type.object.rw.hlsl", |
| 115 |
"match": "\\b(RWBuffer|RWByteAddressBuffer|RWStructuredBuffer|RWTexture1D|RWTexture1DArray|RWTexture2D|RWTexture2DArray|RWTexture3D)\\b" |
| 116 |
}, |
| 117 |
{ |
| 118 |
"name": "support.type.object.geometryshader.hlsl", |
| 119 |
"match": "\\b(LineStream|PointStream|TriangleStream)\\b" |
| 120 |
}, |
| 121 |
{ |
| 122 |
"name": "support.type.sampler.legacy.hlsl", |
| 123 |
"match": "\\b(sampler|sampler1D|sampler2D|sampler3D|samplerCUBE|sampler_state)\\b" |
| 124 |
}, |
| 125 |
{ |
| 126 |
"name": "support.type.sampler.hlsl", |
| 127 |
"match": "\\b(SamplerState|SamplerComparisonState)\\b" |
| 128 |
}, |
| 129 |
{ |
| 130 |
"name": "support.type.texture.legacy.hlsl", |
| 131 |
"match": "\\b(texture2D|textureCUBE)\\b" |
| 132 |
}, |
| 133 |
{ |
| 134 |
"name": "support.type.texture.hlsl", |
| 135 |
"match": "\\b(Texture1D|Texture1DArray|Texture2D|Texture2DArray|Texture2DMS|Texture2DMSArray|Texture3D|TextureCube|TextureCubeArray)\\b" |
| 136 |
}, |
| 137 |
{ |
| 138 |
"name": "storage.type.structured.hlsl", |
| 139 |
"match": "\\b(cbuffer|class|interface|namespace|struct|tbuffer)\\b" |
| 140 |
}, |
| 141 |
{ |
| 142 |
"name": "support.constant.property-value.fx.hlsl", |
| 143 |
"match": "\\b(FALSE|TRUE|NULL)\\b" |
| 144 |
}, |
| 145 |
{ |
| 146 |
"name": "support.type.fx.hlsl", |
| 147 |
"match": "\\b(BlendState|DepthStencilState|RasterizerState)\\b" |
| 148 |
}, |
| 149 |
{ |
| 150 |
"name": "storage.type.fx.technique.hlsl", |
| 151 |
"match": "\\b(technique|Technique|technique10|technique11|pass)\\b" |
| 152 |
}, |
| 153 |
{ |
| 154 |
"name": "meta.object-literal.key.fx.blendstate.hlsl", |
| 155 |
"match": "\\b(AlphaToCoverageEnable|BlendEnable|SrcBlend|DestBlend|BlendOp|SrcBlendAlpha|DestBlendAlpha|BlendOpAlpha|RenderTargetWriteMask)\\b" |
| 156 |
}, |
| 157 |
{ |
| 158 |
"name": "meta.object-literal.key.fx.depthstencilstate.hlsl", |
| 159 |
"match": "\\b(DepthEnable|DepthWriteMask|DepthFunc|StencilEnable|StencilReadMask|StencilWriteMask|FrontFaceStencilFail|FrontFaceStencilZFail|FrontFaceStencilPass|FrontFaceStencilFunc|BackFaceStencilFail|BackFaceStencilZFail|BackFaceStencilPass|BackFaceStencilFunc)\\b" |
| 160 |
}, |
| 161 |
{ |
| 162 |
"name": "meta.object-literal.key.fx.rasterizerstate.hlsl", |
| 163 |
"match": "\\b(FillMode|CullMode|FrontCounterClockwise|DepthBias|DepthBiasClamp|SlopeScaleDepthBias|ZClipEnable|ScissorEnable|MultiSampleEnable|AntiAliasedLineEnable)\\b" |
| 164 |
}, |
| 165 |
{ |
| 166 |
"name": "meta.object-literal.key.fx.samplerstate.hlsl", |
| 167 |
"match": "\\b(Filter|AddressU|AddressV|AddressW|MipLODBias|MaxAnisotropy|ComparisonFunc|BorderColor|MinLOD|MaxLOD)\\b" |
| 168 |
}, |
| 169 |
{ |
| 170 |
"name": "support.constant.property-value.fx.blend.hlsl", |
| 171 |
"match": "\\b(?i:ZERO|ONE|SRC_COLOR|INV_SRC_COLOR|SRC_ALPHA|INV_SRC_ALPHA|DEST_ALPHA|INV_DEST_ALPHA|DEST_COLOR|INV_DEST_COLOR|SRC_ALPHA_SAT|BLEND_FACTOR|INV_BLEND_FACTOR|SRC1_COLOR|INV_SRC1_COLOR|SRC1_ALPHA|INV_SRC1_ALPHA)\\b" |
| 172 |
}, |
| 173 |
{ |
| 174 |
"name": "support.constant.property-value.fx.blendop.hlsl", |
| 175 |
"match": "\\b(?i:ADD|SUBTRACT|REV_SUBTRACT|MIN|MAX)\\b" |
| 176 |
}, |
| 177 |
{ |
| 178 |
"name": "support.constant.property-value.fx.depthwritemask.hlsl", |
| 179 |
"match": "\\b(?i:ALL)\\b" |
| 180 |
}, |
| 181 |
{ |
| 182 |
"name": "support.constant.property-value.fx.comparisonfunc.hlsl", |
| 183 |
"match": "\\b(?i:NEVER|LESS|EQUAL|LESS_EQUAL|GREATER|NOT_EQUAL|GREATER_EQUAL|ALWAYS)\\b" |
| 184 |
}, |
| 185 |
{ |
| 186 |
"name": "support.constant.property-value.fx.stencilop.hlsl", |
| 187 |
"match": "\\b(?i:KEEP|REPLACE|INCR_SAT|DECR_SAT|INVERT|INCR|DECR)\\b" |
| 188 |
}, |
| 189 |
{ |
| 190 |
"name": "support.constant.property-value.fx.fillmode.hlsl", |
| 191 |
"match": "\\b(?i:WIREFRAME|SOLID)\\b" |
| 192 |
}, |
| 193 |
{ |
| 194 |
"name": "support.constant.property-value.fx.cullmode.hlsl", |
| 195 |
"match": "\\b(?i:NONE|FRONT|BACK)\\b" |
| 196 |
}, |
| 197 |
{ |
| 198 |
"name": "support.constant.property-value.fx.filter.hlsl", |
| 199 |
"match": "\\b(?i:MIN_MAG_MIP_POINT|MIN_MAG_POINT_MIP_LINEAR|MIN_POINT_MAG_LINEAR_MIP_POINT|MIN_POINT_MAG_MIP_LINEAR|MIN_LINEAR_MAG_MIP_POINT|MIN_LINEAR_MAG_POINT_MIP_LINEAR|MIN_MAG_LINEAR_MIP_POINT|MIN_MAG_MIP_LINEAR|ANISOTROPIC|COMPARISON_MIN_MAG_MIP_POINT|COMPARISON_MIN_MAG_POINT_MIP_LINEAR|COMPARISON_MIN_POINT_MAG_LINEAR_MIP_POINT|COMPARISON_MIN_POINT_MAG_MIP_LINEAR|COMPARISON_MIN_LINEAR_MAG_MIP_POINT|COMPARISON_MIN_LINEAR_MAG_POINT_MIP_LINEAR|COMPARISON_MIN_MAG_LINEAR_MIP_POINT|COMPARISON_MIN_MAG_MIP_LINEAR|COMPARISON_ANISOTROPIC|TEXT_1BIT)\\b" |
| 200 |
}, |
| 201 |
{ |
| 202 |
"name": "support.constant.property-value.fx.textureaddressmode.hlsl", |
| 203 |
"match": "\\b(?i:WRAP|MIRROR|CLAMP|BORDER|MIRROR_ONCE)\\b" |
| 204 |
}, |
| 205 |
{ |
| 206 |
"name": "string.quoted.double.hlsl", |
| 207 |
"begin": "\"", |
| 208 |
"end": "\"", |
| 209 |
"patterns": [ |
| 210 |
{ |
| 211 |
"name": "constant.character.escape.hlsl", |
| 212 |
"match": "\\\\." |
| 213 |
} |
| 214 |
] |
| 215 |
} |
| 216 |
] |
| 217 |
} |
| 218 |
|