diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-03 18:44:41 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-03 18:44:41 +0100 |
| commit | bf46e44e1cb6027a072819a2a3aa3be32651f6e1 (patch) | |
| tree | 21267e7ef52fd91e7b99271ed87e275e91b3de3c /src/tests/test_texture_manager.cc | |
| parent | 815c428dea14a6a1ea5c421c400985d0c14d473d (diff) | |
refactor: Task #20 - Platform & Code Hygiene
- Consolidated all WebGPU shims and platform-specific logic into src/platform.h.
- Refactored platform_init to return PlatformState by value and platform_poll to automatically refresh time and aspect_ratio.
- Removed STL dependencies (std::map, std::vector, std::string) from AssetManager and Procedural subsystems.
- Fixed Windows cross-compilation by adjusting include paths and linker flags in CMakeLists.txt and updating build_win.sh.
- Removed redundant direct inclusions of GLFW/glfw3.h and WebGPU headers across the project.
- Applied clang-format and updated documentation.
handoff(Gemini): Completed Task #20 and 20.1. Platform abstraction is now unified, and core paths are STL-free. Windows build is stable.
Diffstat (limited to 'src/tests/test_texture_manager.cc')
| -rw-r--r-- | src/tests/test_texture_manager.cc | 34 |
1 files changed, 6 insertions, 28 deletions
diff --git a/src/tests/test_texture_manager.cc b/src/tests/test_texture_manager.cc index 5741d8c..75d897d 100644 --- a/src/tests/test_texture_manager.cc +++ b/src/tests/test_texture_manager.cc @@ -3,40 +3,18 @@ // with valid device). #include "gpu/texture_manager.h" +#include "platform.h" #include "procedural/generator.h" -#include <iostream> - -#include <GLFW/glfw3.h> -#if defined(DEMO_CROSS_COMPILE_WIN32) -#include <webgpu/webgpu.h> -#else -#include <webgpu.h> -#endif - -// Forward decls from platform.h or similar (simplifying for test) -// Note: This test requires a valid WebGPU device, which is hard in CI/headless. -// We will structure it to compile, but runtime might skip if no device. -// For now, we just test the C++ side logic if possible, but TextureManager -// depends heavily on WGPU calls. - -// We will use a "Headless" approach if possible, or just skip if Init fails. -// Actually, let's just make it a compilation test + basic logic check if we can -// mock or stub. Since we don't have a mocking framework, we'll try to init -// wgpu-native. +#include <cstdio> int main() { - // Need to init GLFW for surface creation usually, even for headless in some - // impls? - if (!glfwInit()) { - std::cerr << "Failed to init GLFW" << std::endl; + PlatformState state = platform_init(false, 100, 100); + if (!state.window) { + fprintf(stderr, "Failed to init platform\n"); return 1; } - // NOTE: In a real CI environment without GPU, this will likely fail or hang. - // For this "demo" context, we assume the user has a GPU or we just verify it - // compiles. We'll skip actual GPU init for this simple test to avoid hanging - // the agent if no GPU. - std::cout << "TextureManager Compilation Test Passed." << std::endl; + fprintf(stdout, "TextureManager Compilation Test Passed.\n"); /* TextureManager tm; |
