Skip to content

Commit a734c13

Browse files
committed
[shaderlab/hlsl] Add update scripts, minor fixes to OSSREADME (for microsoft#20129)
1 parent 5fb4b1d commit a734c13

6 files changed

Lines changed: 211 additions & 20 deletions

File tree

extensions/hlsl/OSSREADME.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
// ATTENTION - THIS DIRECTORY CONTAINS THIRD PARTY OPEN SOURCE MATERIALS:
22

33
[{
4-
"name": "shaders-tmLanguage-hlsl",
4+
"name": "shaders-tmLanguage",
55
"version": "0.1.0",
66
"license": "MIT",
7-
"repositoryURL": "https://github.com/tgjones/shaders-tmLanguage",
8-
"description": "The file syntaxes/hlsl.json was included from https://github.com/tgjones/shaders-tmLanguage/blob/master/grammars/hlsl.json."
7+
"repositoryURL": "https://github.com/tgjones/shaders-tmLanguage"
98
}]

extensions/hlsl/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
"version": "0.1.0",
44
"publisher": "vscode",
55
"engines": { "vscode": "*" },
6+
"scripts": {
7+
"update-grammar": "node ../../build/npm/update-grammar.js tgjones/shaders-tmLanguage grammars/shaderlab.json ./syntaxes/shaderlab.json"
8+
},
69
"contributes": {
710
"languages": [{
811
"id": "hlsl",
Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
{
2+
"scopeName": "source.shaderlab",
3+
"name": "ShaderLab",
4+
"fileTypes": [
5+
"shader"
6+
],
7+
"patterns": [
8+
{
9+
"name": "comment.line.double-slash.shaderlab",
10+
"begin": "//",
11+
"end": "$"
12+
},
13+
{
14+
"name": "support.type.basic.shaderlab",
15+
"match": "\\b(?i:Range|Float|Int|Color|Vector|2D|3D|Cube|Any)\\b"
16+
},
17+
{
18+
"include": "#numbers"
19+
},
20+
{
21+
"name": "storage.type.structure.shaderlab",
22+
"match": "\\b(?i:Shader|Properties|SubShader|Pass|Category)\\b"
23+
},
24+
{
25+
"name": "support.type.propertyname.shaderlab",
26+
"match": "\\b(?i:Name|Tags|Fallback|CustomEditor|Cull|ZWrite|ZTest|Offset|Blend|BlendOp|ColorMask|AlphaToMask|LOD|Lighting|Stencil|Ref|ReadMask|WriteMask|Comp|CompBack|CompFront|Fail|ZFail|UsePass|GrabPass|Dependency|Material|Diffuse|Ambient|Shininess|Specular|Emission|Fog|Mode|Density|SeparateSpecular|SetTexture|Combine|ConstantColor|Matrix|AlphaTest|ColorMaterial|BindChannels|Bind)\\b"
27+
},
28+
{
29+
"name": "support.constant.property-value.shaderlab",
30+
"match": "\\b(?i:Back|Front|On|Off|[RGBA]{1,3}|AmbientAndDiffuse|Emission)\\b"
31+
},
32+
{
33+
"name": "support.constant.property-value.comparisonfunction.shaderlab",
34+
"match": "\\b(?i:Less|Greater|LEqual|GEqual|Equal|NotEqual|Always|Never)\\b"
35+
},
36+
{
37+
"name": "support.constant.property-value.stenciloperation.shaderlab",
38+
"match": "\\b(?i:Keep|Zero|Replace|IncrSat|DecrSat|Invert|IncrWrap|DecrWrap)\\b"
39+
},
40+
{
41+
"name": "support.constant.property-value.texturecombiners.shaderlab",
42+
"match": "\\b(?i:Previous|Primary|Texture|Constant|Lerp|Double|Quad|Alpha)\\b"
43+
},
44+
{
45+
"name": "support.constant.property-value.fog.shaderlab",
46+
"match": "\\b(?i:Global|Linear|Exp2|Exp)\\b"
47+
},
48+
{
49+
"name": "support.constant.property-value.bindchannels.shaderlab",
50+
"match": "\\b(?i:Vertex|Normal|Tangent|TexCoord0|TexCoord1)\\b"
51+
},
52+
{
53+
"name": "support.constant.property-value.blendoperations.shaderlab",
54+
"match": "\\b(?i:Add|Sub|RevSub|Min|Max|LogicalClear|LogicalSet|LogicalCopyInverted|LogicalCopy|LogicalNoop|LogicalInvert|LogicalAnd|LogicalNand|LogicalOr|LogicalNor|LogicalXor|LogicalEquiv|LogicalAndReverse|LogicalAndInverted|LogicalOrReverse|LogicalOrInverted)\\b"
55+
},
56+
{
57+
"name": "support.constant.property-value.blendfactors.shaderlab",
58+
"match": "\\b(?i:One|Zero|SrcColor|SrcAlpha|DstColor|DstAlpha|OneMinusSrcColor|OneMinusSrcAlpha|OneMinusDstColor|OneMinusDstAlpha)\\b"
59+
},
60+
{
61+
"name": "support.variable.reference.shaderlab",
62+
"match": "\\[([a-zA-Z_][a-zA-Z0-9_]*)\\](?!\\s*[a-zA-Z_][a-zA-Z0-9_]*\\s*\\(\")"
63+
},
64+
{
65+
"name": "meta.attribute.shaderlab",
66+
"begin": "(\\[)",
67+
"end": "(\\])",
68+
"patterns": [
69+
{
70+
"name": "support.type.attributename.shaderlab",
71+
"match": "\\G([a-zA-Z]+)\\b"
72+
},
73+
{
74+
"include": "#numbers"
75+
}
76+
]
77+
},
78+
{
79+
"name": "support.variable.declaration.shaderlab",
80+
"match": "\\b([a-zA-Z_][a-zA-Z0-9_]*)\\s*\\("
81+
},
82+
{
83+
"name": "meta.cgblock",
84+
"begin": "\\b(CGPROGRAM|CGINCLUDE)\\b",
85+
"beginCaptures": {
86+
"1": {
87+
"name": "keyword.other"
88+
}
89+
},
90+
"end": "\\b(ENDCG)\\b",
91+
"endCaptures": {
92+
"1": {
93+
"name": "keyword.other"
94+
}
95+
},
96+
"patterns": [
97+
{
98+
"include": "source.hlsl"
99+
},
100+
{
101+
"name": "storage.type.basic.shaderlab",
102+
"match": "\\b(fixed([1-4](x[1-4])?)?)\\b"
103+
},
104+
{
105+
"name": "support.variable.transformations.shaderlab",
106+
"match": "\\b(UNITY_MATRIX_MVP|UNITY_MATRIX_MV|UNITY_MATRIX_V|UNITY_MATRIX_P|UNITY_MATRIX_VP|UNITY_MATRIX_T_MV|UNITY_MATRIX_IT_MV|_Object2World|_World2Object)\\b"
107+
},
108+
{
109+
"name": "support.variable.camera.shaderlab",
110+
"match": "\\b(_WorldSpaceCameraPos|_ProjectionParams|_ScreenParams|_ZBufferParams|unity_OrthoParams|unity_CameraProjection|unity_CameraInvProjection|unity_CameraWorldClipPlanes)\\b"
111+
},
112+
{
113+
"name": "support.variable.time.shaderlab",
114+
"match": "\\b(_Time|_SinTime|_CosTime|unity_DeltaTime)\\b"
115+
},
116+
{
117+
"name": "support.variable.lighting.shaderlab",
118+
"match": "\\b(_LightColor0|_WorldSpaceLightPos0|_LightMatrix0|unity_4LightPosX0|unity_4LightPosY0|unity_4LightPosZ0|unity_4LightAtten0|unity_LightColor|_LightColor|unity_LightPosition|unity_LightAtten|unity_SpotDirection)\\b"
119+
},
120+
{
121+
"name": "support.variable.fog.shaderlab",
122+
"match": "\\b(unity_AmbientSky|unity_AmbientEquator|unity_AmbientGround|UNITY_LIGHTMODEL_AMBIENT|unity_FogColor|unity_FogParams)\\b"
123+
},
124+
{
125+
"name": "support.variable.various.shaderlab",
126+
"match": "\\b(unity_LODFade)\\b"
127+
},
128+
{
129+
"name": "support.variable.preprocessor.targetplatform.shaderlab",
130+
"match": "\\b(SHADER_API_D3D9|SHADER_API_D3D11|SHADER_API_GLCORE|SHADER_API_OPENGL|SHADER_API_GLES|SHADER_API_GLES3|SHADER_API_METAL|SHADER_API_D3D11_9X|SHADER_API_PSSL|SHADER_API_XBOXONE|SHADER_API_PSP2|SHADER_API_WIIU|SHADER_API_MOBILE|SHADER_API_GLSL)\\b"
131+
},
132+
{
133+
"name": "support.variable.preprocessor.targetmodel.shaderlab",
134+
"match": "\\b(SHADER_TARGET)\\b"
135+
},
136+
{
137+
"name": "support.variable.preprocessor.unityversion.shaderlab",
138+
"match": "\\b(UNITY_VERSION)\\b"
139+
},
140+
{
141+
"name": "support.variable.preprocessor.platformdifference.shaderlab",
142+
"match": "\\b(UNITY_BRANCH|UNITY_FLATTEN|UNITY_NO_SCREENSPACE_SHADOWS|UNITY_NO_LINEAR_COLORSPACE|UNITY_NO_RGBM|UNITY_NO_DXT5nm|UNITY_FRAMEBUFFER_FETCH_AVAILABLE|UNITY_USE_RGBA_FOR_POINT_SHADOWS|UNITY_ATTEN_CHANNEL|UNITY_HALF_TEXEL_OFFSET|UNITY_UV_STARTS_AT_TOP|UNITY_MIGHT_NOT_HAVE_DEPTH_Texture|UNITY_NEAR_CLIP_VALUE|UNITY_VPOS_TYPE|UNITY_CAN_COMPILE_TESSELLATION|UNITY_COMPILER_HLSL|UNITY_COMPILER_HLSL2GLSL|UNITY_COMPILER_CG|UNITY_REVERSED_Z)\\b"
143+
},
144+
{
145+
"name": "support.variable.preprocessor.texture2D.shaderlab",
146+
"match": "\\b(UNITY_PASS_FORWARDBASE|UNITY_PASS_FORWARDADD|UNITY_PASS_DEFERRED|UNITY_PASS_SHADOWCASTER|UNITY_PASS_PREPASSBASE|UNITY_PASS_PREPASSFINAL)\\b"
147+
},
148+
{
149+
"name": "support.class.structures.shaderlab",
150+
"match": "\\b(appdata_base|appdata_tan|appdata_full|appdata_img)\\b"
151+
},
152+
{
153+
"name": "support.class.surface.shaderlab",
154+
"match": "\\b(SurfaceOutputStandardSpecular|SurfaceOutputStandard|SurfaceOutput|Input)\\b"
155+
}
156+
]
157+
},
158+
{
159+
"name": "string.quoted.double.shaderlab",
160+
"begin": "\"",
161+
"end": "\""
162+
}
163+
],
164+
"repository": {
165+
"numbers": {
166+
"patterns": [
167+
{
168+
"name": "constant.numeric.shaderlab",
169+
"match": "\\b([0-9]+\\.?[0-9]*)\\b"
170+
}
171+
]
172+
}
173+
},
174+
"version": "https://github.com/tgjones/shaders-tmLanguage/commit/cd1ef40f549f9ce2b9e6b73498688de114a85382"
175+
}
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
// ATTENTION - THIS DIRECTORY CONTAINS THIRD PARTY OPEN SOURCE MATERIALS:
22

33
[{
4-
"name": "shaders-tmLanguage-shaderlab",
4+
"name": "shaders-tmLanguage",
55
"version": "0.1.0",
66
"license": "MIT",
7-
"repositoryURL": "https://github.com/tgjones/shaders-tmLanguage",
8-
"description": "The file syntaxes/shaderlab.json was included from https://github.com/tgjones/shaders-tmLanguage/blob/master/grammars/shaderlab.json."
7+
"repositoryURL": "https://github.com/tgjones/shaders-tmLanguage"
98
}]

extensions/shaderlab/package.json

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,32 @@
22
"name": "shaderlab",
33
"version": "0.1.0",
44
"publisher": "vscode",
5-
"engines": { "vscode": "*" },
5+
"engines": {
6+
"vscode": "*"
7+
},
8+
"scripts": {
9+
"update-grammar": "node ../../build/npm/update-grammar.js tgjones/shaders-tmLanguage grammars/shaderlab.json ./syntaxes/shaderlab.json"
10+
},
611
"contributes": {
7-
"languages": [{
8-
"id": "shaderlab",
9-
"extensions": [".shader"],
10-
"aliases": ["ShaderLab", "shaderlab"],
11-
"configuration": "./language-configuration.json"
12-
}],
13-
"grammars": [{
14-
"language": "shaderlab",
15-
"path": "./syntaxes/shaderlab.json",
16-
"scopeName":"source.shaderlab"
17-
}]
12+
"languages": [
13+
{
14+
"id": "shaderlab",
15+
"extensions": [
16+
".shader"
17+
],
18+
"aliases": [
19+
"ShaderLab",
20+
"shaderlab"
21+
],
22+
"configuration": "./language-configuration.json"
23+
}
24+
],
25+
"grammars": [
26+
{
27+
"language": "shaderlab",
28+
"path": "./syntaxes/shaderlab.json",
29+
"scopeName": "source.shaderlab"
30+
}
31+
]
1832
}
1933
}

extensions/shaderlab/syntaxes/shaderlab.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@
9797
{
9898
"include": "source.hlsl"
9999
},
100-
{
100+
{
101101
"name": "storage.type.basic.shaderlab",
102102
"match": "\\b(fixed([1-4](x[1-4])?)?)\\b"
103103
},
@@ -170,5 +170,6 @@
170170
}
171171
]
172172
}
173-
}
173+
},
174+
"version": "https://github.com/tgjones/shaders-tmLanguage/commit/cd1ef40f549f9ce2b9e6b73498688de114a85382"
174175
}

0 commit comments

Comments
 (0)