summaryrefslogtreecommitdiff
path: root/src/tests/gpu
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-14 15:14:25 +0100
committerskal <pascal.massimino@gmail.com>2026-02-14 15:14:25 +0100
commit8ce27b7e15f0fc65c8ee78950c7501660b936178 (patch)
tree391f32111b9a30a0156709b6c1ed2fae7b435d57 /src/tests/gpu
parente38be0dbf5816338ff97e2ee2f9adfff2902dc2b (diff)
style: Apply clang-format to codebase
Diffstat (limited to 'src/tests/gpu')
-rw-r--r--src/tests/gpu/test_demo_effects.cc4
-rw-r--r--src/tests/gpu/test_effect_base.cc4
-rw-r--r--src/tests/gpu/test_gpu_composite.cc18
-rw-r--r--src/tests/gpu/test_post_process_helper.cc27
-rw-r--r--src/tests/gpu/test_shader_assets.cc22
-rw-r--r--src/tests/gpu/test_texture_manager.cc2
6 files changed, 40 insertions, 37 deletions
diff --git a/src/tests/gpu/test_demo_effects.cc b/src/tests/gpu/test_demo_effects.cc
index 7c61691..4234901 100644
--- a/src/tests/gpu/test_demo_effects.cc
+++ b/src/tests/gpu/test_demo_effects.cc
@@ -11,10 +11,10 @@
// test_scene_effects()
#include "../common/effect_test_helpers.h"
+#include "../common/webgpu_test_fixture.h"
+#include "effects/cnn_effect.h"
#include "gpu/demo_effects.h"
#include "gpu/effect.h"
-#include "effects/cnn_effect.h"
-#include "../common/webgpu_test_fixture.h"
#include <cassert>
#include <cstdio>
#include <cstring>
diff --git a/src/tests/gpu/test_effect_base.cc b/src/tests/gpu/test_effect_base.cc
index 08cf0a1..f049dff 100644
--- a/src/tests/gpu/test_effect_base.cc
+++ b/src/tests/gpu/test_effect_base.cc
@@ -3,10 +3,10 @@
// Verifies effect initialization, activation, and basic rendering.
#include "../common/effect_test_helpers.h"
-#include "gpu/demo_effects.h"
-#include "gpu/effect.h"
#include "../common/offscreen_render_target.h"
#include "../common/webgpu_test_fixture.h"
+#include "gpu/demo_effects.h"
+#include "gpu/effect.h"
#include <cassert>
#include <cstdio>
#include <memory>
diff --git a/src/tests/gpu/test_gpu_composite.cc b/src/tests/gpu/test_gpu_composite.cc
index e5ac788..28c76df 100644
--- a/src/tests/gpu/test_gpu_composite.cc
+++ b/src/tests/gpu/test_gpu_composite.cc
@@ -52,9 +52,9 @@ int main() {
} blend_uni = {256, 256, 0.5f, 0.0f};
std::vector<std::string> blend_inputs = {"noise_a", "noise_b"};
- tex_mgr.create_gpu_composite_texture("blended", "gen_blend",
- gen_blend_compute_wgsl, &blend_uni,
- sizeof(blend_uni), 256, 256, blend_inputs);
+ tex_mgr.create_gpu_composite_texture(
+ "blended", "gen_blend", gen_blend_compute_wgsl, &blend_uni,
+ sizeof(blend_uni), 256, 256, blend_inputs);
WGPUTextureView blended_view = tex_mgr.get_texture_view("blended");
if (!blended_view) {
@@ -72,9 +72,9 @@ int main() {
} mask_uni = {256, 256};
std::vector<std::string> mask_inputs = {"noise_a", "grid"};
- tex_mgr.create_gpu_composite_texture("masked", "gen_mask", gen_mask_compute_wgsl,
- &mask_uni, sizeof(mask_uni), 256, 256,
- mask_inputs);
+ tex_mgr.create_gpu_composite_texture("masked", "gen_mask",
+ gen_mask_compute_wgsl, &mask_uni,
+ sizeof(mask_uni), 256, 256, mask_inputs);
WGPUTextureView masked_view = tex_mgr.get_texture_view("masked");
if (!masked_view) {
@@ -92,9 +92,9 @@ int main() {
} blend2_uni = {256, 256, 0.7f, 0.0f};
std::vector<std::string> blend2_inputs = {"blended", "masked"};
- tex_mgr.create_gpu_composite_texture("final", "gen_blend",
- gen_blend_compute_wgsl, &blend2_uni,
- sizeof(blend2_uni), 256, 256, blend2_inputs);
+ tex_mgr.create_gpu_composite_texture(
+ "final", "gen_blend", gen_blend_compute_wgsl, &blend2_uni,
+ sizeof(blend2_uni), 256, 256, blend2_inputs);
WGPUTextureView final_view = tex_mgr.get_texture_view("final");
if (!final_view) {
diff --git a/src/tests/gpu/test_post_process_helper.cc b/src/tests/gpu/test_post_process_helper.cc
index 42b5d79..575291d 100644
--- a/src/tests/gpu/test_post_process_helper.cc
+++ b/src/tests/gpu/test_post_process_helper.cc
@@ -2,10 +2,10 @@
// It tests post-processing helper functions (pipeline and bind group creation).
// Validates that helpers can create valid WebGPU resources.
-#include "gpu/demo_effects.h"
-#include "gpu/gpu.h"
#include "../common/offscreen_render_target.h"
#include "../common/webgpu_test_fixture.h"
+#include "gpu/demo_effects.h"
+#include "gpu/gpu.h"
#include <cassert>
#include <cstdio>
@@ -15,10 +15,11 @@ extern WGPURenderPipeline create_post_process_pipeline(WGPUDevice device,
const char* shader_code);
extern void pp_update_bind_group(WGPUDevice device, WGPURenderPipeline pipeline,
WGPUBindGroup* bind_group,
- WGPUTextureView input_view,
- GpuBuffer uniforms, GpuBuffer effect_params);
+ WGPUTextureView input_view, GpuBuffer uniforms,
+ GpuBuffer effect_params);
-// Helpers are now in gpu.h (gpu_create_post_process_texture, gpu_create_texture_view_2d)
+// Helpers are now in gpu.h (gpu_create_post_process_texture,
+// gpu_create_texture_view_2d)
// Minimal valid post-process shader for testing
static const char* test_shader = R"(
@@ -66,8 +67,8 @@ static void test_bind_group_creation(WebGPUTestFixture& fixture) {
assert(pipeline != nullptr && "Pipeline required for bind group test");
// Create input texture with TEXTURE_BINDING usage
- TextureWithView input =
- gpu_create_post_process_texture(fixture.device(), 256, 256, fixture.format());
+ TextureWithView input = gpu_create_post_process_texture(
+ fixture.device(), 256, 256, fixture.format());
// Create uniform buffers using gpu_create_buffer
GpuBuffer uniforms = gpu_create_buffer(
@@ -103,10 +104,10 @@ static void test_bind_group_update(WebGPUTestFixture& fixture) {
WGPURenderPipeline pipeline = create_post_process_pipeline(
fixture.device(), fixture.format(), test_shader);
- TextureWithView texture1 =
- gpu_create_post_process_texture(fixture.device(), 256, 256, fixture.format());
- TextureWithView texture2 =
- gpu_create_post_process_texture(fixture.device(), 512, 512, fixture.format());
+ TextureWithView texture1 = gpu_create_post_process_texture(
+ fixture.device(), 256, 256, fixture.format());
+ TextureWithView texture2 = gpu_create_post_process_texture(
+ fixture.device(), 512, 512, fixture.format());
GpuBuffer uniforms = gpu_create_buffer(
fixture.device(), 16, WGPUBufferUsage_Uniform | WGPUBufferUsage_CopyDst);
@@ -150,8 +151,8 @@ static void test_full_setup(WebGPUTestFixture& fixture) {
assert(pipeline != nullptr && "Pipeline creation failed");
// Create input texture (with TEXTURE_BINDING usage)
- TextureWithView input =
- gpu_create_post_process_texture(fixture.device(), 256, 256, fixture.format());
+ TextureWithView input = gpu_create_post_process_texture(
+ fixture.device(), 256, 256, fixture.format());
// Create output texture (can use OffscreenRenderTarget for this)
OffscreenRenderTarget output_target(fixture.instance(), fixture.device(), 256,
diff --git a/src/tests/gpu/test_shader_assets.cc b/src/tests/gpu/test_shader_assets.cc
index 5619a61..7f2811e 100644
--- a/src/tests/gpu/test_shader_assets.cc
+++ b/src/tests/gpu/test_shader_assets.cc
@@ -70,16 +70,18 @@ int main() {
all_passed &=
validate_shader(AssetId::ASSET_SHADER_GAUSSIAN_BLUR, "GAUSSIAN_BLUR",
{"@vertex", "vs_main", "@fragment", "fs_main"});
- all_passed &= validate_shader(AssetId::ASSET_SHADER_SOLARIZE, "SOLARIZE",
- {"#include \"render/fullscreen_vs\"", "@fragment", "fs_main"});
- all_passed &= validate_shader(AssetId::ASSET_SHADER_DISTORT, "DISTORT",
- {"#include \"render/fullscreen_vs\"", "@fragment", "fs_main"});
- all_passed &= validate_shader(AssetId::ASSET_SHADER_CHROMA_ABERRATION,
- "CHROMA_ABERRATION",
- {"#include \"render/fullscreen_vs\"", "@fragment", "fs_main"});
- all_passed &= validate_shader(AssetId::ASSET_SHADER_VIGNETTE,
- "VIGNETTE",
- {"#include \"render/fullscreen_vs\"", "@fragment", "fs_main"});
+ all_passed &= validate_shader(
+ AssetId::ASSET_SHADER_SOLARIZE, "SOLARIZE",
+ {"#include \"render/fullscreen_vs\"", "@fragment", "fs_main"});
+ all_passed &= validate_shader(
+ AssetId::ASSET_SHADER_DISTORT, "DISTORT",
+ {"#include \"render/fullscreen_vs\"", "@fragment", "fs_main"});
+ all_passed &= validate_shader(
+ AssetId::ASSET_SHADER_CHROMA_ABERRATION, "CHROMA_ABERRATION",
+ {"#include \"render/fullscreen_vs\"", "@fragment", "fs_main"});
+ all_passed &= validate_shader(
+ AssetId::ASSET_SHADER_VIGNETTE, "VIGNETTE",
+ {"#include \"render/fullscreen_vs\"", "@fragment", "fs_main"});
all_passed &=
validate_shader(AssetId::ASSET_SHADER_VISUAL_DEBUG, "VISUAL_DEBUG",
{"@vertex", "vs_main", "@fragment", "fs_main"});
diff --git a/src/tests/gpu/test_texture_manager.cc b/src/tests/gpu/test_texture_manager.cc
index 54a1a8a..b38e69f 100644
--- a/src/tests/gpu/test_texture_manager.cc
+++ b/src/tests/gpu/test_texture_manager.cc
@@ -2,9 +2,9 @@
// It tests the TextureManager for procedural texture generation and management.
// Tests all public methods with both success and failure cases.
+#include "../common/webgpu_test_fixture.h"
#include "gpu/texture_manager.h"
#include "procedural/generator.h"
-#include "../common/webgpu_test_fixture.h"
#include <cassert>
#include <cstdio>
#include <cstring>