summaryrefslogtreecommitdiff
path: root/src/gpu
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu')
-rw-r--r--src/gpu/bind_group_builder.h3
-rw-r--r--src/gpu/demo_effects.h4
-rw-r--r--src/gpu/effect.cc2
-rw-r--r--src/gpu/gpu.cc2
-rw-r--r--src/gpu/post_process_helper.cc6
-rw-r--r--src/gpu/post_process_helper.h3
-rw-r--r--src/gpu/sequence.cc38
-rw-r--r--src/gpu/sequence.h6
8 files changed, 39 insertions, 25 deletions
diff --git a/src/gpu/bind_group_builder.h b/src/gpu/bind_group_builder.h
index 49b7ebe..7481f34 100644
--- a/src/gpu/bind_group_builder.h
+++ b/src/gpu/bind_group_builder.h
@@ -94,7 +94,8 @@ class BindGroupLayoutBuilder {
}
WGPUBindGroupLayout build(WGPUDevice device) {
- // Headless mode: skip bind group layout creation (compiled out in STRIP_ALL)
+ // Headless mode: skip bind group layout creation (compiled out in
+ // STRIP_ALL)
HEADLESS_RETURN_VAL_IF_NULL(device, nullptr);
WGPUBindGroupLayoutDescriptor desc{};
desc.entryCount = entries_.size();
diff --git a/src/gpu/demo_effects.h b/src/gpu/demo_effects.h
index d98045e..85299ca 100644
--- a/src/gpu/demo_effects.h
+++ b/src/gpu/demo_effects.h
@@ -9,14 +9,15 @@
#include "3d/scene.h"
// Base effect classes (v2)
+#include "effects/shaders.h"
#include "gpu/effect.h"
#include "gpu/post_process_helper.h"
#include "gpu/sequence.h"
-#include "effects/shaders.h"
#include "gpu/texture_manager.h"
#include "gpu/uniform_helper.h"
// Individual Effect Headers (v2)
+#include "effects/flash_effect.h"
#include "effects/gaussian_blur_effect.h"
#include "effects/heptagon_effect.h"
#include "effects/hybrid3_d_effect.h"
@@ -25,7 +26,6 @@
#include "effects/peak_meter_effect.h"
#include "effects/placeholder_effect.h"
#include "effects/rotating_cube_effect.h"
-#include "effects/flash_effect.h"
// TODO: Port CNN effects to v2
// #include "../../cnn_v1/src/cnn_v1_effect.h"
// #include "../../cnn_v2/src/cnn_v2_effect.h"
diff --git a/src/gpu/effect.cc b/src/gpu/effect.cc
index e4d3a90..b729321 100644
--- a/src/gpu/effect.cc
+++ b/src/gpu/effect.cc
@@ -4,7 +4,7 @@
#include "util/fatal_error.h"
Effect::Effect(const GpuContext& ctx, const std::vector<std::string>& inputs,
- const std::vector<std::string>& outputs)
+ const std::vector<std::string>& outputs)
: ctx_(ctx), input_nodes_(inputs), output_nodes_(outputs) {
FATAL_CHECK(!inputs.empty(), "Effect must have at least one input\n");
FATAL_CHECK(!outputs.empty(), "Effect must have at least one output\n");
diff --git a/src/gpu/gpu.cc b/src/gpu/gpu.cc
index 9955169..2226889 100644
--- a/src/gpu/gpu.cc
+++ b/src/gpu/gpu.cc
@@ -3,9 +3,9 @@
// Driven by audio peaks for synchronized visual effects.
#include "gpu.h"
+#include "effects/shaders.h"
#include "generated/timeline.h"
#include "gpu/shader_composer.h"
-#include "effects/shaders.h"
#include "platform/platform.h"
#include <cassert>
diff --git a/src/gpu/post_process_helper.cc b/src/gpu/post_process_helper.cc
index 281fde6..9e7803c 100644
--- a/src/gpu/post_process_helper.cc
+++ b/src/gpu/post_process_helper.cc
@@ -41,9 +41,9 @@ WGPURenderPipeline create_post_process_pipeline(WGPUDevice device,
}
// Helper to create a simple post-processing pipeline (no effect params)
-WGPURenderPipeline create_post_process_pipeline_simple(WGPUDevice device,
- WGPUTextureFormat format,
- const char* shader_code) {
+WGPURenderPipeline
+create_post_process_pipeline_simple(WGPUDevice device, WGPUTextureFormat format,
+ const char* shader_code) {
// Headless mode: skip pipeline creation (compiled out in STRIP_ALL)
HEADLESS_RETURN_VAL_IF_NULL(device, nullptr);
diff --git a/src/gpu/post_process_helper.h b/src/gpu/post_process_helper.h
index 963f671..9a71046 100644
--- a/src/gpu/post_process_helper.h
+++ b/src/gpu/post_process_helper.h
@@ -21,7 +21,8 @@ WGPURenderPipeline create_post_process_pipeline(WGPUDevice device,
WGPUTextureFormat format,
const char* shader_code);
-// Helper to create a simple post-processing pipeline (no effect params, 3 bindings only)
+// Helper to create a simple post-processing pipeline (no effect params, 3
+// bindings only)
WGPURenderPipeline create_post_process_pipeline_simple(WGPUDevice device,
WGPUTextureFormat format,
const char* shader_code);
diff --git a/src/gpu/sequence.cc b/src/gpu/sequence.cc
index 0a0cb1e..5348992 100644
--- a/src/gpu/sequence.cc
+++ b/src/gpu/sequence.cc
@@ -42,9 +42,9 @@ NodeRegistry::~NodeRegistry() {
}
void NodeRegistry::declare_node(const std::string& name, NodeType type,
- int width, int height) {
- FATAL_CHECK(nodes_.find(name) == nodes_.end(),
- "Node already declared: %s\n", name.c_str());
+ int width, int height) {
+ FATAL_CHECK(nodes_.find(name) == nodes_.end(), "Node already declared: %s\n",
+ name.c_str());
if (width <= 0)
width = default_width_;
@@ -64,8 +64,8 @@ void NodeRegistry::declare_aliased_node(const std::string& name,
const std::string& alias_of) {
FATAL_CHECK(nodes_.find(alias_of) != nodes_.end(),
"Alias target does not exist: %s\n", alias_of.c_str());
- FATAL_CHECK(aliases_.find(name) == aliases_.end(), "Alias already exists: %s\n",
- name.c_str());
+ FATAL_CHECK(aliases_.find(name) == aliases_.end(),
+ "Alias already exists: %s\n", name.c_str());
aliases_[name] = alias_of;
}
@@ -131,7 +131,7 @@ bool NodeRegistry::has_node(const std::string& name) const {
}
void NodeRegistry::set_external_view(const std::string& name,
- WGPUTextureView view) {
+ WGPUTextureView view) {
// Register external view (texture not owned by registry)
Node node = {};
node.view = view;
@@ -151,15 +151,25 @@ void NodeRegistry::create_texture(Node& node) {
switch (node.type) {
case NodeType::U8X4_NORM:
format = WGPUTextureFormat_RGBA8Unorm;
- usage = (WGPUTextureUsage)(WGPUTextureUsage_RenderAttachment | WGPUTextureUsage_TextureBinding | WGPUTextureUsage_CopySrc | WGPUTextureUsage_CopyDst);
+ usage =
+ (WGPUTextureUsage)(WGPUTextureUsage_RenderAttachment |
+ WGPUTextureUsage_TextureBinding |
+ WGPUTextureUsage_CopySrc | WGPUTextureUsage_CopyDst);
break;
case NodeType::F32X4:
format = WGPUTextureFormat_RGBA32Float;
- usage = (WGPUTextureUsage)(WGPUTextureUsage_RenderAttachment | WGPUTextureUsage_TextureBinding | WGPUTextureUsage_CopySrc | WGPUTextureUsage_CopyDst);
+ usage =
+ (WGPUTextureUsage)(WGPUTextureUsage_RenderAttachment |
+ WGPUTextureUsage_TextureBinding |
+ WGPUTextureUsage_CopySrc | WGPUTextureUsage_CopyDst);
break;
case NodeType::F16X8:
- format = WGPUTextureFormat_RGBA16Float; // WebGPU doesn't have 8-channel, use RGBA16
- usage = (WGPUTextureUsage)(WGPUTextureUsage_RenderAttachment | WGPUTextureUsage_TextureBinding | WGPUTextureUsage_CopySrc | WGPUTextureUsage_CopyDst);
+ format = WGPUTextureFormat_RGBA16Float; // WebGPU doesn't have 8-channel,
+ // use RGBA16
+ usage =
+ (WGPUTextureUsage)(WGPUTextureUsage_RenderAttachment |
+ WGPUTextureUsage_TextureBinding |
+ WGPUTextureUsage_CopySrc | WGPUTextureUsage_CopyDst);
break;
case NodeType::DEPTH24:
format = WGPUTextureFormat_Depth24Plus;
@@ -167,7 +177,8 @@ void NodeRegistry::create_texture(Node& node) {
break;
case NodeType::COMPUTE_F32:
format = WGPUTextureFormat_RGBA32Float;
- usage = (WGPUTextureUsage)(WGPUTextureUsage_StorageBinding | WGPUTextureUsage_TextureBinding);
+ usage = (WGPUTextureUsage)(WGPUTextureUsage_StorageBinding |
+ WGPUTextureUsage_TextureBinding);
break;
}
@@ -207,8 +218,9 @@ Sequence::Sequence(const GpuContext& ctx, int width, int height)
}
void Sequence::preprocess(float seq_time, float beat_time, float beat_phase,
- float audio_intensity) {
- params_.resolution = {static_cast<float>(width_), static_cast<float>(height_)};
+ float audio_intensity) {
+ params_.resolution = {static_cast<float>(width_),
+ static_cast<float>(height_)};
params_.aspect_ratio =
static_cast<float>(width_) / static_cast<float>(height_);
params_.time = seq_time;
diff --git a/src/gpu/sequence.h b/src/gpu/sequence.h
index e96e183..0f448ce 100644
--- a/src/gpu/sequence.h
+++ b/src/gpu/sequence.h
@@ -35,9 +35,9 @@ struct Node {
struct UniformsSequenceParams {
vec2 resolution;
float aspect_ratio;
- float time; // Per-sequence relative time
- float beat_time; // Musical beats
- float beat_phase; // Fractional beat 0.0-1.0
+ float time; // Per-sequence relative time
+ float beat_time; // Musical beats
+ float beat_phase; // Fractional beat 0.0-1.0
float audio_intensity;
float _pad;
};