summaryrefslogtreecommitdiff
path: root/src/effects
diff options
context:
space:
mode:
Diffstat (limited to 'src/effects')
-rw-r--r--src/effects/gaussian_blur_effect.cc7
-rw-r--r--src/effects/heptagon_effect.cc7
-rw-r--r--src/effects/hybrid3_d_effect.cc7
-rw-r--r--src/effects/particles_effect.cc7
-rw-r--r--src/effects/passthrough_effect.cc7
-rw-r--r--src/effects/placeholder_effect.cc27
-rw-r--r--src/effects/rotating_cube_effect.cc7
7 files changed, 32 insertions, 37 deletions
diff --git a/src/effects/gaussian_blur_effect.cc b/src/effects/gaussian_blur_effect.cc
index fdf1807..657c283 100644
--- a/src/effects/gaussian_blur_effect.cc
+++ b/src/effects/gaussian_blur_effect.cc
@@ -1,6 +1,7 @@
// Gaussian blur effect v2 implementation
#include "effects/gaussian_blur_effect.h"
+#include "util/fatal_error.h"
#include "gpu/post_process_helper.h"
#include "gpu/shaders.h"
@@ -9,10 +10,8 @@ GaussianBlurEffect::GaussianBlurEffect(const GpuContext& ctx,
const std::vector<std::string>& outputs)
: Effect(ctx, inputs, outputs), pipeline_(nullptr), bind_group_(nullptr),
sampler_(nullptr) {
- // Headless mode: skip GPU resource creation
- if (ctx_.device == nullptr) {
- return;
- }
+ // Headless mode: skip GPU resource creation (compiled out in STRIP_ALL)
+ HEADLESS_RETURN_IF_NULL(ctx_.device);
// Create pipeline
pipeline_ = create_post_process_pipeline(ctx_.device, WGPUTextureFormat_RGBA8Unorm,
diff --git a/src/effects/heptagon_effect.cc b/src/effects/heptagon_effect.cc
index 3321517..31e94e7 100644
--- a/src/effects/heptagon_effect.cc
+++ b/src/effects/heptagon_effect.cc
@@ -1,6 +1,7 @@
// Heptagon effect v2 implementation
#include "effects/heptagon_effect.h"
+#include "util/fatal_error.h"
#include "gpu/gpu.h"
#include "gpu/post_process_helper.h"
#include "gpu/shaders.h"
@@ -9,10 +10,8 @@ HeptagonEffect::HeptagonEffect(const GpuContext& ctx,
const std::vector<std::string>& inputs,
const std::vector<std::string>& outputs)
: Effect(ctx, inputs, outputs), pipeline_(nullptr), bind_group_(nullptr), sampler_(nullptr) {
- // Headless mode: skip GPU resource creation
- if (ctx_.device == nullptr) {
- return;
- }
+ // Headless mode: skip GPU resource creation (compiled out in STRIP_ALL)
+ HEADLESS_RETURN_IF_NULL(ctx_.device);
// Init uniforms
uniforms_buffer_.init(ctx_.device);
diff --git a/src/effects/hybrid3_d_effect.cc b/src/effects/hybrid3_d_effect.cc
index 2a015a0..0e6ea35 100644
--- a/src/effects/hybrid3_d_effect.cc
+++ b/src/effects/hybrid3_d_effect.cc
@@ -1,6 +1,7 @@
// This file is part of the 64k demo project.
// It implements Hybrid3DEffect (simplified v2 port).
// TODO: Full Renderer3D integration with texture manager, noise assets
+#include "util/fatal_error.h"
#include "effects/hybrid3_d_effect.h"
#include <cmath>
@@ -10,10 +11,8 @@ Hybrid3DEffect::Hybrid3DEffect(const GpuContext& ctx,
const std::vector<std::string>& outputs)
: Effect(ctx, inputs, outputs), depth_node_(outputs[0] + "_depth"),
dummy_texture_(nullptr), dummy_texture_view_(nullptr) {
- // Headless mode: skip GPU resource creation
- if (ctx_.device == nullptr) {
- return;
- }
+ // Headless mode: skip GPU resource creation (compiled out in STRIP_ALL)
+ HEADLESS_RETURN_IF_NULL(ctx_.device);
// Initialize renderer (format is always RGBA8Unorm for v2)
renderer_.init(ctx_.device, ctx_.queue, WGPUTextureFormat_RGBA8Unorm);
diff --git a/src/effects/particles_effect.cc b/src/effects/particles_effect.cc
index 709acbf..a98d7e5 100644
--- a/src/effects/particles_effect.cc
+++ b/src/effects/particles_effect.cc
@@ -1,6 +1,7 @@
// This file is part of the 64k demo project.
// It implements the ParticlesEffect.
+#include "util/fatal_error.h"
#include "effects/particles_effect.h"
#include "gpu/gpu.h"
#include "gpu/shaders.h"
@@ -10,10 +11,8 @@ ParticlesEffect::ParticlesEffect(const GpuContext& ctx,
const std::vector<std::string>& inputs,
const std::vector<std::string>& outputs)
: Effect(ctx, inputs, outputs) {
- // Headless mode: skip GPU resource creation
- if (ctx_.device == nullptr) {
- return;
- }
+ // Headless mode: skip GPU resource creation (compiled out in STRIP_ALL)
+ HEADLESS_RETURN_IF_NULL(ctx_.device);
// Initialize uniforms
uniforms_.init(ctx_.device);
diff --git a/src/effects/passthrough_effect.cc b/src/effects/passthrough_effect.cc
index c4106b1..8cbd425 100644
--- a/src/effects/passthrough_effect.cc
+++ b/src/effects/passthrough_effect.cc
@@ -1,6 +1,7 @@
// Passthrough effect v2 implementation
#include "effects/passthrough_effect.h"
+#include "util/fatal_error.h"
#include "gpu/post_process_helper.h"
#include "gpu/shaders.h"
@@ -9,10 +10,8 @@ PassthroughEffect::PassthroughEffect(const GpuContext& ctx,
const std::vector<std::string>& outputs)
: Effect(ctx, inputs, outputs), pipeline_(nullptr), bind_group_(nullptr),
sampler_(nullptr) {
- // Headless mode: skip GPU resource creation
- if (ctx_.device == nullptr) {
- return;
- }
+ // Headless mode: skip GPU resource creation (compiled out in STRIP_ALL)
+ HEADLESS_RETURN_IF_NULL(ctx_.device);
// Init uniform buffer
uniforms_buffer_.init(ctx_.device);
diff --git a/src/effects/placeholder_effect.cc b/src/effects/placeholder_effect.cc
index a83d922..a014a71 100644
--- a/src/effects/placeholder_effect.cc
+++ b/src/effects/placeholder_effect.cc
@@ -1,6 +1,7 @@
// Placeholder effect v2 implementation - logs TODO warning once
#include "effects/placeholder_effect.h"
+#include "util/fatal_error.h"
#include "gpu/post_process_helper.h"
#include "gpu/shaders.h"
#include <cstdio>
@@ -13,23 +14,23 @@ PlaceholderEffect::PlaceholderEffect(const GpuContext& ctx,
sampler_(nullptr), name_(placeholder_name) {
// Log once on construction
fprintf(stderr, "TODO: %s not yet ported to v2, using passthrough\n", name_);
-
+
+ // Headless mode: skip GPU resource creation (compiled out in STRIP_ALL)
+ HEADLESS_RETURN_IF_NULL(ctx_.device);
+
uniforms_buffer_.init(ctx_.device);
pipeline_ = create_post_process_pipeline(ctx_.device, WGPUTextureFormat_RGBA8Unorm,
passthrough_v2_shader_wgsl);
- // Headless mode: skip sampler creation
- if (ctx_.device != nullptr) {
- WGPUSamplerDescriptor sampler_desc = {};
- sampler_desc.addressModeU = WGPUAddressMode_ClampToEdge;
- sampler_desc.addressModeV = WGPUAddressMode_ClampToEdge;
- sampler_desc.addressModeW = WGPUAddressMode_ClampToEdge;
- sampler_desc.magFilter = WGPUFilterMode_Linear;
- sampler_desc.minFilter = WGPUFilterMode_Linear;
- sampler_desc.mipmapFilter = WGPUMipmapFilterMode_Nearest;
- sampler_desc.maxAnisotropy = 1;
- sampler_ = wgpuDeviceCreateSampler(ctx_.device, &sampler_desc);
- }
+ WGPUSamplerDescriptor sampler_desc = {};
+ sampler_desc.addressModeU = WGPUAddressMode_ClampToEdge;
+ sampler_desc.addressModeV = WGPUAddressMode_ClampToEdge;
+ sampler_desc.addressModeW = WGPUAddressMode_ClampToEdge;
+ sampler_desc.magFilter = WGPUFilterMode_Linear;
+ sampler_desc.minFilter = WGPUFilterMode_Linear;
+ sampler_desc.mipmapFilter = WGPUMipmapFilterMode_Nearest;
+ sampler_desc.maxAnisotropy = 1;
+ sampler_ = wgpuDeviceCreateSampler(ctx_.device, &sampler_desc);
}
void PlaceholderEffect::render(WGPUCommandEncoder encoder,
diff --git a/src/effects/rotating_cube_effect.cc b/src/effects/rotating_cube_effect.cc
index e7ed52e..4bd79fe 100644
--- a/src/effects/rotating_cube_effect.cc
+++ b/src/effects/rotating_cube_effect.cc
@@ -1,6 +1,7 @@
// This file is part of the 64k demo project.
// It implements RotatingCubeEffect (simplified v2 port).
+#include "util/fatal_error.h"
#include "effects/rotating_cube_effect.h"
#include "gpu/bind_group_builder.h"
#include "gpu/gpu.h"
@@ -10,10 +11,8 @@ RotatingCubeEffect::RotatingCubeEffect(const GpuContext& ctx,
const std::vector<std::string>& inputs,
const std::vector<std::string>& outputs)
: Effect(ctx, inputs, outputs), depth_node_(outputs[0] + "_depth") {
- // Headless mode: skip GPU resource creation
- if (ctx_.device == nullptr) {
- return;
- }
+ // Headless mode: skip GPU resource creation (compiled out in STRIP_ALL)
+ HEADLESS_RETURN_IF_NULL(ctx_.device);
// Create uniform buffers
uniform_buffer_ =