From 59b7ca9adff07f8d457fba53ba4d67c293229b68 Mon Sep 17 00:00:00 2001 From: skal Date: Tue, 17 Feb 2026 08:50:24 +0100 Subject: 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 --- src/gpu/effect.cc | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'src/gpu/effect.cc') diff --git a/src/gpu/effect.cc b/src/gpu/effect.cc index 117ede2..0e53862 100644 --- a/src/gpu/effect.cc +++ b/src/gpu/effect.cc @@ -44,17 +44,10 @@ void Effect::blit_input_to_output(WGPUCommandEncoder encoder, return; } -#if defined(DEMO_CROSS_COMPILE_WIN32) - WGPUImageCopyTexture src_copy = { + GpuTextureCopyInfo src_copy = { .texture = src, .mipLevel = 0, .origin = {0, 0, 0}}; - WGPUImageCopyTexture dst_copy = { + GpuTextureCopyInfo dst_copy = { .texture = dst, .mipLevel = 0, .origin = {0, 0, 0}}; -#else - WGPUTexelCopyTextureInfo src_copy = { - .texture = src, .mipLevel = 0, .origin = {0, 0, 0}}; - WGPUTexelCopyTextureInfo dst_copy = { - .texture = dst, .mipLevel = 0, .origin = {0, 0, 0}}; -#endif WGPUExtent3D extent = {static_cast(width_), static_cast(height_), 1}; -- cgit v1.2.3