File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -993,6 +993,11 @@ for (/**@suppress{duplicate}*/var i = 0; i <= {{{ GL_POOL_TEMP_BUFFERS_SIZE }}};
993993
994994 var prevProgram = gl . getParameter ( 0x8B8D /*GL_CURRENT_PROGRAM*/ ) ;
995995 gl . useProgram ( context . blitProgram ) ;
996+ // If prevProgram was already marked for deletion, then, since it was
997+ // still bound, it was not *actually* deleted. Binding a new program
998+ // just now, thus, deleted the old one. This makes it impossible to
999+ // restore. Hopefully the application didn't actually need it!
1000+ if ( ! gl . isProgram ( prevProgram ) ) prevProgram = null ;
9961001
9971002 var prevVB = gl . getParameter ( 0x8894 /*GL_ARRAY_BUFFER_BINDING*/ ) ;
9981003 gl . bindBuffer ( 0x8892 /*GL_ARRAY_BUFFER*/ , context . blitVB ) ;
Original file line number Diff line number Diff line change 55 * found in the LICENSE file.
66 */
77
8+ #include <assert.h>
89#include <stdio.h>
910#include <stdlib.h>
1011#include <emscripten/emscripten.h>
@@ -104,8 +105,13 @@ int main() {
104105 glDrawArrays (GL_TRIANGLES , 0 , 3 );
105106
106107#ifdef EXPLICIT_SWAP
108+ // Mark the program for deletion, first, as a regression test for the state
109+ // restoration. https://github.com/emscripten-core/emscripten/issues/23654
110+ glDeleteProgram (program );
111+
107112 emscripten_webgl_commit_frame ();
108113#endif
109114
115+ assert (glGetError () == GL_NO_ERROR );
110116 return 0 ;
111117}
You can’t perform that action at this time.
0 commit comments