emscripten_webgl_create_context returns EMSCRIPTEN_RESULT_SUCCESS if canvas not found

Created on 12 Sep 2019  路  1Comment  路  Source: emscripten-core/emscripten

emscripten_webgl_create_context returns EMSCRIPTEN_RESULT_SUCCESS (as value 0) when called with an id that doesn't match any canvas in the DOM. The documentation seems to imply that the correct return value should've been an error result, possibly EMSCRIPTEN_RESULT_UNKNOWN_TARGET.

This happens with fastcomp, not latest upstream.

good first bug help wanted

Most helpful comment

The docs of EMSCRIPTEN_WEBGL_CONTEXT_HANDLE actually state "The value 0 denotes an invalid/no context", which is contradicted by the docs of emscripten_webgl_create_context, which (apparently incorrectly) state "On failure, a negative number that can be cast to an EMSCRIPTEN_RESULT field to get the reason why the context creation failed".

>All comments

The docs of EMSCRIPTEN_WEBGL_CONTEXT_HANDLE actually state "The value 0 denotes an invalid/no context", which is contradicted by the docs of emscripten_webgl_create_context, which (apparently incorrectly) state "On failure, a negative number that can be cast to an EMSCRIPTEN_RESULT field to get the reason why the context creation failed".

Was this page helpful?
0 / 5 - 0 ratings