Skip to content

Commit bcbdf33

Browse files
authored
fix: Extract shader layout after modules have been resolved (#2344)
1 parent 610b011 commit bcbdf33

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

modules/engine/src/model/model.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,6 @@ export class Model {
252252
// TODO - this is wrong, compile a single shader
253253
if (isWebGPU && this.props.source) {
254254
// WGSL
255-
this.props.shaderLayout ||= getShaderLayoutFromWGSL(this.props.source);
256255
const {source, getUniforms} = this.props.shaderAssembler.assembleWGSLShader({
257256
platformInfo,
258257
...this.props,
@@ -261,6 +260,8 @@ export class Model {
261260
this.source = source;
262261
// @ts-expect-error
263262
this._getModuleUniforms = getUniforms;
263+
// Extract shader layout after modules have been added to WGSL source, to include any bindings added by modules
264+
this.props.shaderLayout ||= getShaderLayoutFromWGSL(this.source);
264265
} else {
265266
// GLSL
266267
const {vs, fs, getUniforms} = this.props.shaderAssembler.assembleGLSLShaderPair({

0 commit comments

Comments
 (0)