File tree Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -170,6 +170,8 @@ export class EffectShaderData implements ShaderData {
170
170
}
171
171
172
172
const functionRegExp = / \w + \s + ( \w + ) \( [ \w \s , ] * \) \s * { / g;
173
+ const structRegExp = / s t r u c t \s + ( \w * ) / g;
174
+ const defineRegExp = / ^ \s * # d e f i n e \s + ( \w * ) / gm;
173
175
174
176
if ( vertexShader !== null && effect . hasMainSupportFunction ) {
175
177
@@ -192,13 +194,24 @@ export class EffectShaderData implements ShaderData {
192
194
193
195
}
194
196
195
- // Collect names of functions.
196
197
for ( const m of vertexShader . matchAll ( functionRegExp ) ) {
197
198
198
199
names . add ( m [ 1 ] ) ;
199
200
200
201
}
201
202
203
+ for ( const m of vertexShader . matchAll ( structRegExp ) ) {
204
+
205
+ names . add ( m [ 1 ] ) ;
206
+
207
+ }
208
+
209
+ for ( const m of vertexShader . matchAll ( defineRegExp ) ) {
210
+
211
+ names . add ( m [ 1 ] ) ;
212
+
213
+ }
214
+
202
215
}
203
216
204
217
for ( const m of fragmentShader . matchAll ( functionRegExp ) ) {
@@ -207,6 +220,18 @@ export class EffectShaderData implements ShaderData {
207
220
208
221
}
209
222
223
+ for ( const m of fragmentShader . matchAll ( structRegExp ) ) {
224
+
225
+ names . add ( m [ 1 ] ) ;
226
+
227
+ }
228
+
229
+ for ( const m of fragmentShader . matchAll ( defineRegExp ) ) {
230
+
231
+ names . add ( m [ 1 ] ) ;
232
+
233
+ }
234
+
210
235
for ( const d of effect . input . defines . keys ( ) ) {
211
236
212
237
// Ignore parameters of function-like macros.
You can’t perform that action at this time.
0 commit comments