From 0233ce7549f5d0ef1df53157ed102e48f25c954e Mon Sep 17 00:00:00 2001 From: Brett Laptop Date: Fri, 26 Apr 2024 01:41:53 -0400 Subject: [PATCH] emscripten, mostly working --- CMakeLists.txt | 2 +- libraries/BLT | 2 +- src/blt/gfx/renderer/resource_manager.cpp | 12 ++++++++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5400020..b283787 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.25) -set(BLT_GRAPHICS_VERSION 0.10.2) +set(BLT_GRAPHICS_VERSION 0.11.0) set(BLT_GRAPHICS_TEST_VERSION 0.0.1) project(BLT_WITH_GRAPHICS VERSION ${BLT_GRAPHICS_VERSION}) diff --git a/libraries/BLT b/libraries/BLT index 1772e9a..c8ce910 160000 --- a/libraries/BLT +++ b/libraries/BLT @@ -1 +1 @@ -Subproject commit 1772e9a6d7fe3bd866c4daac5546347634178cb4 +Subproject commit c8ce910fe17ecbc64ad728aac731c1fda8e84c33 diff --git a/src/blt/gfx/renderer/resource_manager.cpp b/src/blt/gfx/renderer/resource_manager.cpp index 2a45177..0cb1875 100644 --- a/src/blt/gfx/renderer/resource_manager.cpp +++ b/src/blt/gfx/renderer/resource_manager.cpp @@ -35,6 +35,7 @@ namespace blt::gfx void resource_manager::load_resources(std::size_t threads) { +#ifndef __EMSCRIPTEN__ blt::thread_pool pool{threads, [&]() { loadable_texture texture; { @@ -71,8 +72,19 @@ namespace blt::gfx } } } while (true); +#else + for (const auto& texture : textures_to_load) + { + BLT_DEBUG("Loading texture file %s", texture.path.c_str()); + loaded_textures.push_back(new texture_file(texture.path, texture.name)); + } + textures_to_load.clear(); +#endif + +#ifndef __EMSCRIPTEN__ pool.stop(); while (!pool.complete()); +#endif while (!loaded_textures.empty()) { auto* back = loaded_textures.back();