From 8ce27b7e15f0fc65c8ee78950c7501660b936178 Mon Sep 17 00:00:00 2001 From: skal Date: Sat, 14 Feb 2026 15:14:25 +0100 Subject: style: Apply clang-format to codebase --- src/gpu/texture_readback.cc | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) (limited to 'src/gpu/texture_readback.cc') diff --git a/src/gpu/texture_readback.cc b/src/gpu/texture_readback.cc index e25da9e..bd3c79c 100644 --- a/src/gpu/texture_readback.cc +++ b/src/gpu/texture_readback.cc @@ -15,13 +15,9 @@ struct MapState { WGPUMapAsyncStatus status = WGPUMapAsyncStatus_Unknown; }; -std::vector read_texture_pixels( - WGPUInstance instance, - WGPUDevice device, - WGPUTexture texture, - int width, - int height) { - +std::vector read_texture_pixels(WGPUInstance instance, + WGPUDevice device, WGPUTexture texture, + int width, int height) { // Align bytes per row to 256 (COPY_BYTES_PER_ROW_ALIGNMENT) const uint32_t bytes_per_pixel = 4; // BGRA8 const uint32_t unaligned_bytes_per_row = width * bytes_per_pixel; @@ -99,7 +95,8 @@ std::vector read_texture_pixels( state->done = true; }; WGPUBufferMapCallbackInfo map_info = {}; - map_info.mode = WGPUCallbackMode_AllowProcessEvents; // Fire during ProcessEvents + map_info.mode = + WGPUCallbackMode_AllowProcessEvents; // Fire during ProcessEvents map_info.callback = map_cb; map_info.userdata1 = &map_state; wgpuBufferMapAsync(staging, WGPUMapMode_Read, 0, buffer_size, map_info); @@ -178,13 +175,10 @@ static float fp16_to_float(uint16_t h) { return result; } -std::vector texture_readback_fp16_to_u8( - WGPUDevice device, - WGPUQueue queue, - WGPUTexture texture, - int width, - int height) { - +std::vector texture_readback_fp16_to_u8(WGPUDevice device, + WGPUQueue queue, + WGPUTexture texture, int width, + int height) { // Align bytes per row to 256 const uint32_t bytes_per_pixel = 8; // RGBA16Float = 4 × 2 bytes const uint32_t unaligned_bytes_per_row = width * bytes_per_pixel; @@ -271,10 +265,9 @@ std::vector texture_readback_fp16_to_u8( std::vector pixels(width * height * 4); if (mapped_data) { for (int y = 0; y < height; ++y) { - const uint16_t* src_row = - reinterpret_cast( - reinterpret_cast(mapped_data) + - y * aligned_bytes_per_row); + const uint16_t* src_row = reinterpret_cast( + reinterpret_cast(mapped_data) + + y * aligned_bytes_per_row); for (int x = 0; x < width; ++x) { float r = fp16_to_float(src_row[x * 4 + 0]); float g = fp16_to_float(src_row[x * 4 + 1]); -- cgit v1.2.3