summaryrefslogtreecommitdiff
path: root/src/gpu/texture_manager.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/texture_manager.cc')
-rw-r--r--src/gpu/texture_manager.cc21
1 files changed, 4 insertions, 17 deletions
diff --git a/src/gpu/texture_manager.cc b/src/gpu/texture_manager.cc
index 5bca95b..bdeb508 100644
--- a/src/gpu/texture_manager.cc
+++ b/src/gpu/texture_manager.cc
@@ -2,22 +2,13 @@
// It implements the TextureManager.
#include "gpu/texture_manager.h"
+#include "gpu/gpu.h"
#include "gpu/shader_composer.h"
#include "platform/platform.h"
#include <cstdio>
#include <cstring>
#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;
@@ -79,22 +70,18 @@ void TextureManager::create_texture(const std::string& name, int width,
tex_desc.format = WGPUTextureFormat_RGBA8Unorm;
tex_desc.mipLevelCount = 1;
tex_desc.sampleCount = 1;
-#if defined(DEMO_CROSS_COMPILE_WIN32)
- tex_desc.label = nullptr;
-#else
- tex_desc.label = {nullptr, 0};
-#endif
+ tex_desc.label = label_view(nullptr);
WGPUTexture texture = wgpuDeviceCreateTexture(device_, &tex_desc);
// 3. Upload Data
- WGPU_TEX_COPY_INFO destination = {};
+ GpuTextureCopyInfo destination = {};
destination.texture = texture;
destination.mipLevel = 0;
destination.origin = {0, 0, 0};
destination.aspect = WGPUTextureAspect_All;
- WGPU_TEX_DATA_LAYOUT source_layout = {};
+ GpuTextureDataLayout source_layout = {};
source_layout.offset = 0;
source_layout.bytesPerRow = width * 4;
source_layout.rowsPerImage = height;