Skip to content

Commit b4eee32

Browse files
authored
fix: Accessor of static value has unknown type (#1964)
1 parent 55bbb41 commit b4eee32

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

packages/typegpu/src/core/slot/accessor.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
} from '../../shared/symbols.ts';
1414
import {
1515
getOwnSnippet,
16+
NormalState,
1617
type ResolutionCtx,
1718
type SelfResolvable,
1819
} from '../../types.ts';
@@ -94,11 +95,17 @@ export class TgpuAccessorImpl<T extends AnyWgslData>
9495
return ownSnippet;
9596
}
9697

97-
// Doing a deep copy each time so that we don't have to deal with refs
98-
return schemaCallWrapper(
99-
this.schema,
100-
snip(value, this.schema, /* origin */ 'constant'),
101-
);
98+
ctx.pushMode(new NormalState());
99+
try {
100+
// Doing a deep copy each time so that we don't have to deal with refs
101+
const cloned = schemaCallWrapper(
102+
this.schema,
103+
value,
104+
);
105+
return snip(cloned, this.schema, 'constant');
106+
} finally {
107+
ctx.popMode('normal');
108+
}
102109
}
103110

104111
$name(label: string) {

0 commit comments

Comments
 (0)