summaryrefslogtreecommitdiff
path: root/src/gpu/texture_manager.cc
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-08 09:12:48 +0100
committerskal <pascal.massimino@gmail.com>2026-02-08 09:12:48 +0100
commitec98466b62797fe7e71f35f009a891e72f4ae85a (patch)
tree0f86391c020a6d223ccd4a46ccc9c45aa87fe866 /src/gpu/texture_manager.cc
parent16c2cdce6ad1d89d3c537f2c2cff743449925125 (diff)
Revert "feat(platform): Centralize platform-specific WebGPU code and improve shader composition"
This reverts commit 16c2cdce6ad1d89d3c537f2c2cff743449925125.
Diffstat (limited to 'src/gpu/texture_manager.cc')
-rw-r--r--src/gpu/texture_manager.cc17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/gpu/texture_manager.cc b/src/gpu/texture_manager.cc
index e69425f..0c30c94 100644
--- a/src/gpu/texture_manager.cc
+++ b/src/gpu/texture_manager.cc
@@ -2,10 +2,19 @@
// It implements the TextureManager.
#include "gpu/texture_manager.h"
-#include "platform/platform.h" // Include for WGPU_TEX_COPY_INFO and WGPU_TEX_DATA_LAYOUT
#include <cstdio>
#include <vector>
+#if defined(DEMO_CROSS_COMPILE_WIN32)
+// Old API
+#define WGPU_TEX_COPY_INFO WGPUImageCopyTexture
+#define WGPU_TEX_DATA_LAYOUT WGPUTextureDataLayout
+#else
+// New API
+#define WGPU_TEX_COPY_INFO WGPUTexelCopyTextureInfo
+#define WGPU_TEX_DATA_LAYOUT WGPUTexelCopyBufferLayout
+#endif
+
void TextureManager::init(WGPUDevice device, WGPUQueue queue) {
device_ = device;
queue_ = queue;
@@ -51,7 +60,11 @@ void TextureManager::create_texture(const std::string& name, int width,
tex_desc.format = WGPUTextureFormat_RGBA8Unorm;
tex_desc.mipLevelCount = 1;
tex_desc.sampleCount = 1;
- tex_desc.label = label_view(name.c_str());
+#if defined(DEMO_CROSS_COMPILE_WIN32)
+ tex_desc.label = nullptr;
+#else
+ tex_desc.label = {nullptr, 0};
+#endif
WGPUTexture texture = wgpuDeviceCreateTexture(device_, &tex_desc);