emscripten.h 1.2 KB

123456789101112131415161718192021222324252627282930313233
  1. /*
  2. * Copyright 2011-2021 Branimir Karadzic. All rights reserved.
  3. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
  4. */
  5. #ifndef BGFX_EMSCRIPTEN_H_HEADER_GUARD
  6. #define BGFX_EMSCRIPTEN_H_HEADER_GUARD
  7. #if BX_PLATFORM_EMSCRIPTEN
  8. # include <emscripten/emscripten.h>
  9. # include <emscripten/html5.h>
  10. # define _EMSCRIPTEN_CHECK(_check, _call) \
  11. BX_MACRO_BLOCK_BEGIN \
  12. EMSCRIPTEN_RESULT __result__ = _call; \
  13. _check(EMSCRIPTEN_RESULT_SUCCESS == __result__, #_call " FAILED 0x%08x\n", (uint32_t)__result__); \
  14. BX_UNUSED(__result__); \
  15. BX_MACRO_BLOCK_END
  16. # if BGFX_CONFIG_DEBUG
  17. # define EMSCRIPTEN_CHECK(_call) _EMSCRIPTEN_CHECK(BX_ASSERT, _call)
  18. # else
  19. # define EMSCRIPTEN_CHECK(_call) _call
  20. # endif // BGFX_CONFIG_DEBUG
  21. # ifndef HTML5_TARGET_CANVAS_SELECTOR
  22. # define HTML5_TARGET_CANVAS_SELECTOR "#canvas"
  23. # endif // HTML5_TARGET_CANVAS_SELECTOR
  24. #endif // BX_PLATFORM_EMSCRIPTEN
  25. #endif // BGFX_EMSCRIPTEN_H_HEADER_GUARD