Fix WebGLShader recovery from WebGL context loss.

This commit is contained in:
Ben Richards 2024-02-02 20:50:39 +13:00
parent 6f36e8201d
commit 4fd8fc94c3

View file

@ -1206,6 +1206,7 @@ var WebGLPipeline = new Class({
restoreContext: function ()
{
var shaders = this.shaders;
var hasVertexBuffer = !!this.vertexBuffer;
// Deactivate all invalidated state.
this.activeBuffer = null;
@ -1215,9 +1216,19 @@ var WebGLPipeline = new Class({
this.currentTexture = null;
this.currentUnit = 0;
if (hasVertexBuffer)
{
this.setVertexBuffer();
}
for (var i = 0; i < shaders.length; i++)
{
shaders[i].syncUniforms();
var shader = shaders[i];
shader.syncUniforms();
if (hasVertexBuffer)
{
shader.rebind();
}
}
},