diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-17 08:50:24 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-17 08:50:24 +0100 |
| commit | 59b7ca9adff07f8d457fba53ba4d67c293229b68 (patch) | |
| tree | f84cd7fcb42cffa15fad7bc339abfb2b8e13cb3c /src/gpu/gpu.h | |
| parent | 7041babc9e5333d01191f3eb80fd711bd26cd4f7 (diff) | |
refactor: centralize platform-specific code in gpu.h
Move platform-specific type definitions to gpu.h and establish coding rule
that platform ifdefs must be confined to gpu/platform layers.
- gpu.h: add GpuTextureCopyInfo, GpuTextureDataLayout type aliases
- effect.cc: use GpuTextureCopyInfo instead of platform ifdefs
- texture_manager.cc: use type aliases and label_view() helper
- CODING_STYLE.md: add platform-specific code section with rule
Tests: 34/34 passing
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Diffstat (limited to 'src/gpu/gpu.h')
| -rw-r--r-- | src/gpu/gpu.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/gpu/gpu.h b/src/gpu/gpu.h index 41eeb29..5e928b2 100644 --- a/src/gpu/gpu.h +++ b/src/gpu/gpu.h @@ -75,6 +75,15 @@ struct TextureWithView { WGPUTextureView view; }; +// Platform-abstracted texture copy types +#if defined(DEMO_CROSS_COMPILE_WIN32) +using GpuTextureCopyInfo = WGPUImageCopyTexture; +using GpuTextureDataLayout = WGPUTextureDataLayout; +#else +using GpuTextureCopyInfo = WGPUTexelCopyTextureInfo; +using GpuTextureDataLayout = WGPUTexelCopyBufferLayout; +#endif + GpuBuffer gpu_create_buffer(WGPUDevice device, size_t size, uint32_t usage, const void* data = nullptr); TextureWithView gpu_create_texture_2d(WGPUDevice device, uint32_t width, |
