summaryrefslogtreecommitdiff
path: root/tools/shadertoy/template.h
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-02-10 17:47:15 +0100
committerskal <pascal.massimino@gmail.com>2026-02-10 17:47:15 +0100
commitae810e1a9c68d05bee254ef570fbb0e783e25931 (patch)
tree407f3d7d8e03da07d8f7995df78d37be7d1f32c1 /tools/shadertoy/template.h
parentf3c7ef8cd612f5ac908f39310c4c11566879313f (diff)
feat: Add ShaderToy conversion tools
Add automated conversion pipeline for ShaderToy shaders to demo effects: - convert_shadertoy.py: Automated code generation script - Manual templates: Header, implementation, and WGSL boilerplate - Example shader: Test case for conversion workflow - README: Complete conversion guide with examples Handles basic GLSL→WGSL conversion (types, uniforms, mainImage extraction). Manual fixes needed for fragColor returns and complex type inference. Organized under tools/shadertoy/ for maintainability. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Diffstat (limited to 'tools/shadertoy/template.h')
-rw-r--r--tools/shadertoy/template.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/tools/shadertoy/template.h b/tools/shadertoy/template.h
new file mode 100644
index 0000000..2e4af5f
--- /dev/null
+++ b/tools/shadertoy/template.h
@@ -0,0 +1,41 @@
+// This file is part of the 64k demo project.
+// ShaderToy effect boilerplate - REPLACE THIS LINE WITH DESCRIPTION
+// TODO: Update description, rename class, adjust parameters
+
+#ifndef SHADERTOY_EFFECT_H_
+#define SHADERTOY_EFFECT_H_
+
+#include "gpu/effect.h"
+#include "gpu/effects/post_process_helper.h"
+#include "gpu/uniform_helper.h"
+
+// TODO: Rename class to match your effect (e.g., TunnelEffect, PlasmaEffect)
+class ShaderToyEffect : public Effect {
+ public:
+ // TODO: Add constructor parameters for tunable values
+ ShaderToyEffect(const GpuContext& ctx);
+ ~ShaderToyEffect() override;
+
+ void init(MainSequence* demo) override;
+ void render(WGPURenderPassEncoder pass, float time, float beat,
+ float intensity, float aspect_ratio) override;
+
+ private:
+ // TODO: Add effect-specific parameters here
+ // Must match WGSL struct exactly - use padding for 16-byte alignment
+ struct ShaderToyParams {
+ float param1;
+ float param2;
+ float _pad[2]; // Padding to 16 bytes
+ };
+ static_assert(sizeof(ShaderToyParams) == 16,
+ "ShaderToyParams must be 16 bytes for WGSL alignment");
+
+ MainSequence* demo_ = nullptr;
+ WGPURenderPipeline pipeline_ = nullptr;
+ WGPUBindGroup bind_group_ = nullptr;
+ WGPUSampler sampler_ = nullptr;
+ UniformBuffer<ShaderToyParams> params_;
+};
+
+#endif /* SHADERTOY_EFFECT_H_ */