Skip to content

Commit 5e7ef50

Browse files
authored
fix issue when running canvas renderMode (#450)
Fixed an issue where running the examples test with renderMode as canvas. Upon loading the SdfShader no properties are passed as parameter causing issues with when creating the UnsupportedShader for canvas. This is mostly a temporary solution as the shaders are resolved differently in the shader rework i'm working on.
2 parents 1d7f7c7 + 2573e33 commit 5e7ef50

File tree

4 files changed

+11
-3
lines changed

4 files changed

+11
-3
lines changed

src/core/CoreShaderManager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ export class CoreShaderManager {
198198

199199
if (shType === 'DynamicShader') {
200200
return this.loadDynamicShader(
201-
props!,
201+
props as DynamicShaderProps,
202202
) as unknown as ShaderController<Type>;
203203
}
204204

src/core/renderers/webgl/shaders/SdfShader.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ export class SdfShader extends WebGlCoreShader {
7979
});
8080
}
8181

82+
static z$__type__Props: SdfShaderProps;
83+
8284
override bindTextures(textures: WebGlCoreCtxTexture[]) {
8385
const { glw } = this;
8486
glw.activeTexture(0);

src/core/text-rendering/renderers/SdfTextRenderer/SdfTextRenderer.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,14 @@ export class SdfTextRenderer extends TextRenderer<SdfTextRendererState> {
146146

147147
constructor(stage: Stage) {
148148
super(stage);
149-
this.sdfShader = this.stage.shManager.loadShader('SdfShader').shader;
149+
this.sdfShader = this.stage.shManager.loadShader('SdfShader', {
150+
transform: new Float32Array(),
151+
color: 0,
152+
size: 0,
153+
scrollY: 0,
154+
distanceRange: 0,
155+
debug: false,
156+
}).shader;
150157
this.rendererBounds = {
151158
x1: 0,
152159
y1: 0,

src/main-api/ShaderController.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ export class ShaderController<S extends keyof ShaderMap>
5555
stage: Stage,
5656
) {
5757
this.resolvedProps = props;
58-
5958
const keys = Object.keys(props);
6059
const l = keys.length;
6160

0 commit comments

Comments
 (0)