-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Extract the canvas from the offscreenCanvases entry #22958
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
bc590ad
fd261b4
13624d4
837c9b7
04668d3
5cf436b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| // Copyright 2024 The Emscripten Authors. All rights reserved. | ||
| // Emscripten is available under two separate licenses, the MIT license and the | ||
| // University of Illinois/NCSA Open Source License. Both these licenses can be | ||
| // found in the LICENSE file. | ||
|
|
||
| #include <GLES2/gl2.h> | ||
| #include <GLES2/gl2ext.h> | ||
| #include <assert.h> | ||
|
|
||
| #include <emscripten/emscripten.h> | ||
| #include <emscripten/html5.h> | ||
|
|
||
| int main() { | ||
| EmscriptenWebGLContextAttributes attrs; | ||
| emscripten_webgl_init_context_attributes(&attrs); | ||
| attrs.explicitSwapControl = true; | ||
| #ifdef USE_OFFSCREEN_FRAMEBUFFER | ||
| attrs.renderViaOffscreenBackBuffer = true; | ||
| #endif | ||
| // Test that creating a context succeeds | ||
| EMSCRIPTEN_WEBGL_CONTEXT_HANDLE context = emscripten_webgl_create_context("#canvas", &attrs); | ||
| assert(context > 0); // Must have received a valid context. | ||
| EMSCRIPTEN_RESULT res = emscripten_webgl_make_context_current(context); | ||
| assert(res == EMSCRIPTEN_RESULT_SUCCESS); | ||
| assert(emscripten_webgl_get_current_context() == context); | ||
| return 0; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2612,6 +2612,15 @@ def test_html5_webgl_create_context(self, args): | |
| def test_html5_webgl_create_context2(self): | ||
| self.btest_exit('webgl_create_context2.cpp') | ||
|
|
||
| @requires_graphics_hardware | ||
| # Verify bug https://github.com/emscripten-core/emscripten/issues/22943: creating a WebGL context with explicit swap control and offscreenCanvas | ||
| @parameterized({ | ||
| 'offscreencanvas': (['-sOFFSCREENCANVAS_SUPPORT'],), | ||
| 'offscreenframebuffer': (['-sOFFSCREEN_FRAMEBUFFER', '-DUSE_OFFSCREEN_FRAMEBUFFER'],), | ||
| }) | ||
kripken marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| def test_html5_webgl_create_context_swapcontrol(self, args): | ||
| self.btest_exit('browser/webgl_create_context_swapcontrol.c', args=args) | ||
|
|
||
| @requires_graphics_hardware | ||
| # Verify bug https://github.com/emscripten-core/emscripten/issues/4556: creating a WebGL context to Module.canvas without an ID explicitly assigned to it. | ||
| # (this only makes sense in the old deprecated -sDISABLE_DEPRECATED_FIND_EVENT_TARGET_BEHAVIOR=0 mode) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.