Skip to content

Commit

Permalink
[Fix] Fix the shader linking after the lost context has been restored. (
Browse files Browse the repository at this point in the history
#6146)

Co-authored-by: Martin Valigursky <mvaligursky@snapchat.com>
  • Loading branch information
mvaligursky and Martin Valigursky authored Mar 12, 2024
1 parent 3cea420 commit c46868c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/platform/graphics/webgl/webgl-graphics-device.js
Original file line number Diff line number Diff line change
Expand Up @@ -1360,7 +1360,7 @@ class WebglGraphicsDevice extends GraphicsDevice {
this.initializeRenderState();
this.initializeContextCaches();

// Recompile all shaders (they'll be linked when they're next actually used)
// Recompile all shaders
for (const shader of this.shaders) {
shader.restoreContext();
}
Expand Down
1 change: 1 addition & 0 deletions src/platform/graphics/webgl/webgl-shader.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ class WebglShader {
*/
restoreContext(device, shader) {
this.compile(device, shader);
this.link(device, shader);
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/scene/skybox/sky-mesh.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class SkyMesh {
constructor(device, scene, node, texture, type) {

const material = new Material();
material.name = 'SkyMaterial';

material.getShaderVariant = function (dev, sc, defs, unused, pass, sortedLights, viewUniformFormat, viewBindGroupFormat) {

Expand Down

0 comments on commit c46868c

Please sign in to comment.