Skip to content

Commit 6dc8bc4

Browse files
committed
Fix emscripten_webgl_make_context_current under wasm64/CAN_ADDRESS_2GB
1 parent 876ae7c commit 6dc8bc4

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

.circleci/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -803,6 +803,7 @@ jobs:
803803
test_targets: "
804804
browser_2gb.test_gles2_uniform_arrays
805805
browser_2gb.test_fetch_to_memory
806+
browser_2gb.test_emscripten_animate_canvas_element_size_manual_css
806807
browser skip:browser.test_4gb_fail
807808
"
808809
test-browser-chrome-wasm64:

src/library_html5_webgl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ var LibraryHtml5WebGL = {
184184
},
185185
#if PTHREADS && OFFSCREEN_FRAMEBUFFER
186186
// Runs on the calling thread, proxies if needed.
187-
emscripten_webgl_make_context_current_calling_thread__sig: 'ii',
187+
emscripten_webgl_make_context_current_calling_thread__sig: 'ip',
188188
emscripten_webgl_make_context_current_calling_thread: (contextHandle) => {
189189
var success = GL.makeContextCurrent(contextHandle);
190190
if (success) GL.currentContextIsProxied = false; // If succeeded above, we will have a local GL context from this thread (worker or main).

test/canvas_animate_resize.cpp

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ int program;
3333
int frameNumber = 0;
3434
EMSCRIPTEN_WEBGL_CONTEXT_HANDLE ctx;
3535

36-
void tick()
37-
{
36+
void tick() {
3837
double sizeScale = 21.0 + 20.0 * sin(emscripten_get_now()*0.001);
3938
double w = 18.0*sizeScale;
4039
double h = 11.0*sizeScale;
@@ -73,8 +72,7 @@ void tick()
7372
#endif
7473

7574
++frameNumber;
76-
if (frameNumber >= NUM_FRAMES_TO_RENDER)
77-
{
75+
if (frameNumber >= NUM_FRAMES_TO_RENDER) {
7876
#if TEST_EMSCRIPTEN_SET_MAIN_LOOP
7977
emscripten_cancel_main_loop();
8078
#endif
@@ -85,8 +83,8 @@ void tick()
8583
}
8684
}
8785

88-
void init()
89-
{
86+
void init() {
87+
printf("init\n");
9088
glGenBuffers(1, &vb);
9189
glBindBuffer(GL_ARRAY_BUFFER, vb);
9290
float vertices[] = { -1, -1, -1, 1, 1, -1, 1, 1 };
@@ -123,9 +121,8 @@ int main()
123121
attr.explicitSwapControl = EM_TRUE;
124122
#endif
125123
ctx = emscripten_webgl_create_context("#canvas", &attr);
126-
printf("Created context with handle %u\n", (unsigned int)ctx);
127-
if (!ctx)
128-
{
124+
printf("Created context with handle %#lx\n", ctx);
125+
if (!ctx) {
129126
if (!emscripten_supports_offscreencanvas()) {
130127
EM_ASM({
131128
xhr = new XMLHttpRequest();
@@ -144,8 +141,7 @@ int main()
144141
#if TEST_EMSCRIPTEN_SET_MAIN_LOOP
145142
emscripten_set_main_loop(tick, 0, 0);
146143
#else
147-
for(int i = 0; i < NUM_FRAMES_TO_RENDER; ++i)
148-
{
144+
for(int i = 0; i < NUM_FRAMES_TO_RENDER; ++i) {
149145
tick();
150146
emscripten_current_thread_process_queued_calls();
151147
usleep(16*1000);

0 commit comments

Comments
 (0)