Skip to content

Commit

Permalink
Fixes Emscripten wasm64 compile error in glcontext_html5.cpp. (#3282)
Browse files Browse the repository at this point in the history
Fixes compile error:

```
glcontext_html5.cpp:74:45: error: cast from pointer to smaller type
'EMSCRIPTEN_WEBGL_CONTEXT_HANDLE' (aka 'int') loses information
74 |                 EMSCRIPTEN_WEBGL_CONTEXT_HANDLE context =
reinterpret_cast<EMSCRIPTEN_WEBGL_CONTEXT_HANDLE>(g_platformData.context);
|
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
```
  • Loading branch information
tritao authored Apr 30, 2024
1 parent 1138cc0 commit 57d8a08
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/glcontext_html5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ namespace bgfx { namespace gl

const char* canvas = (const char*) g_platformData.nwh;

EMSCRIPTEN_WEBGL_CONTEXT_HANDLE context = (EMSCRIPTEN_WEBGL_CONTEXT_HANDLE) g_platformData.context;
EMSCRIPTEN_WEBGL_CONTEXT_HANDLE context = bx::narrowCast<EMSCRIPTEN_WEBGL_CONTEXT_HANDLE>((uintptr_t) g_platformData.context);
if (context > 0)
{
if (emscripten_webgl_get_context_attributes(context, &s_attrs) >= 0)
Expand Down

0 comments on commit 57d8a08

Please sign in to comment.