Make common/ compile with Emscripten
Projects using Dawn that are compiled with Emscripten may use some of our common headers and utilities. ex.) creating a ShaderModule from SPIR-V. Add handling for __EMSCRIPTEN__ to Platform.h so compiling to WASM works. Also, implement GetExecutablePath on Emscripten as unreachable. This is only ever used to search native paths in the Vulkan backend. Bug: none Change-Id: I5d9d6e27e287cb34e7af3214add1c4bc8c6a0f70 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/25064 Reviewed-by: Kai Ninomiya <kainino@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Austin Eng <enga@chromium.org>
This commit is contained in:
parent
7f4980e7d2
commit
e01dd678d3
|
@ -41,6 +41,10 @@
|
|||
# define DAWN_PLATFORM_FUCHSIA 1
|
||||
# define DAWN_PLATFORM_POSIX 1
|
||||
|
||||
#elif defined(__EMSCRIPTEN__)
|
||||
# define DAWN_PLATFORM_EMSCRIPTEN 1
|
||||
# define DAWN_PLATFORM_POSIX 1
|
||||
|
||||
#else
|
||||
# error "Unsupported platform."
|
||||
#endif
|
||||
|
@ -60,7 +64,7 @@
|
|||
# define DAWN_PLATFORM_64_BIT 1
|
||||
static_assert(sizeof(sizeof(char)) == 8, "Expect sizeof(size_t) == 8");
|
||||
#elif defined(_WIN32) || defined(__arm__) || defined(__i386__) || defined(__mips32__) || \
|
||||
defined(__s390__)
|
||||
defined(__s390__) || defined(__EMSCRIPTEN__)
|
||||
# define DAWN_PLATFORM_32_BIT 1
|
||||
static_assert(sizeof(sizeof(char)) == 4, "Expect sizeof(size_t) == 4");
|
||||
#else
|
||||
|
|
|
@ -108,6 +108,11 @@ std::string GetExecutablePath() {
|
|||
// TODO: Implement on Fuchsia
|
||||
return "";
|
||||
}
|
||||
#elif defined(DAWN_PLATFORM_EMSCRIPTEN)
|
||||
std::string GetExecutablePath() {
|
||||
UNREACHABLE();
|
||||
return "";
|
||||
}
|
||||
#else
|
||||
# error "Implement GetExecutablePath for your platform."
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue