summaryrefslogtreecommitdiff
path: root/src/tests/offscreen_render_target.cc
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-08 07:40:29 +0100
committerskal <pascal.massimino@gmail.com>2026-02-08 07:40:29 +0100
commitc9195f997f3e797f03ab90464e4158717198a167 (patch)
tree331304f42870246efdc64cc97ad42de59444ef3a /src/tests/offscreen_render_target.cc
parentb8e6929cafa41681f0b27ac104c9cf1d4e510837 (diff)
style: Apply clang-format to all source files
Diffstat (limited to 'src/tests/offscreen_render_target.cc')
-rw-r--r--src/tests/offscreen_render_target.cc20
1 files changed, 8 insertions, 12 deletions
diff --git a/src/tests/offscreen_render_target.cc b/src/tests/offscreen_render_target.cc
index 81ad082..36b7b26 100644
--- a/src/tests/offscreen_render_target.cc
+++ b/src/tests/offscreen_render_target.cc
@@ -2,7 +2,7 @@
// It implements offscreen rendering for headless GPU testing.
// Provides pixel readback for validation.
-#if !defined(STRIP_ALL) // Test code only - zero size impact on final binary
+#if !defined(STRIP_ALL) // Test code only - zero size impact on final binary
#include "offscreen_render_target.h"
#include <cassert>
@@ -10,14 +10,10 @@
#include <cstring>
OffscreenRenderTarget::OffscreenRenderTarget(WGPUInstance instance,
- WGPUDevice device,
- int width,
+ WGPUDevice device, int width,
int height,
WGPUTextureFormat format)
- : instance_(instance),
- device_(device),
- width_(width),
- height_(height),
+ : instance_(instance), device_(device), width_(width), height_(height),
format_(format) {
// Create offscreen texture
const WGPUTextureDescriptor texture_desc = {
@@ -61,7 +57,7 @@ void OffscreenRenderTarget::map_callback(WGPUMapAsyncStatus status,
}
WGPUBuffer OffscreenRenderTarget::create_staging_buffer() {
- const size_t buffer_size = width_ * height_ * 4; // BGRA8 = 4 bytes/pixel
+ const size_t buffer_size = width_ * height_ * 4; // BGRA8 = 4 bytes/pixel
const WGPUBufferDescriptor buffer_desc = {
.usage = WGPUBufferUsage_CopyDst | WGPUBufferUsage_MapRead,
.size = buffer_size,
@@ -70,7 +66,7 @@ WGPUBuffer OffscreenRenderTarget::create_staging_buffer() {
}
std::vector<uint8_t> OffscreenRenderTarget::read_pixels() {
- const size_t buffer_size = width_ * height_ * 4; // BGRA8
+ const size_t buffer_size = width_ * height_ * 4; // BGRA8
std::vector<uint8_t> pixels(buffer_size);
// Create staging buffer for readback
@@ -99,7 +95,7 @@ std::vector<uint8_t> OffscreenRenderTarget::read_pixels() {
};
const WGPUExtent3D copy_size = {static_cast<uint32_t>(width_),
- static_cast<uint32_t>(height_), 1};
+ static_cast<uint32_t>(height_), 1};
wgpuCommandEncoderCopyTextureToBuffer(encoder, &src, &dst, &copy_size);
@@ -150,7 +146,7 @@ std::vector<uint8_t> OffscreenRenderTarget::read_pixels() {
if (map_state.status != WGPUMapAsyncStatus_Success) {
fprintf(stderr, "Buffer mapping failed: %d\n", map_state.status);
wgpuBufferRelease(staging);
- return pixels; // Return empty
+ return pixels; // Return empty
}
// Copy data from mapped buffer
@@ -167,4 +163,4 @@ std::vector<uint8_t> OffscreenRenderTarget::read_pixels() {
return pixels;
}
-#endif /* !defined(STRIP_ALL) */
+#endif /* !defined(STRIP_ALL) */