diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-28 09:25:35 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-28 09:25:35 +0100 |
| commit | bc1beb58ba259263eb98d43d2aa742307764591c (patch) | |
| tree | eae97b1496811ed6f2fde60b1b914f2bcf2d825f /tools/shadertoy/template.h | |
| parent | 34bee8b09566a52cedced99b7bd13d29907512ce (diff) | |
fix(tools/shadertoy): sync templates and script to current codebase conventions
- template.h/cc: new Effect constructor/render signatures, RAII wrappers,
HEADLESS_RETURN_IF_NULL, #pragma once
- template.wgsl: sequence_uniforms + render/fullscreen_uv_vs includes,
UniformsSequenceParams at binding 2, VertexOutput in fs_main
- convert_shadertoy.py: paths src/effects/ + src/shaders/, new Effect
pattern (create_post_process_pipeline, pp_update_bind_group), correct
field names (beat_time/beat_phase), updated next-steps instructions
- README.md: streamlined to quick-ref; accurate GLSL→WGSL table and uniforms
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'tools/shadertoy/template.h')
| -rw-r--r-- | tools/shadertoy/template.h | 39 |
1 files changed, 12 insertions, 27 deletions
diff --git a/tools/shadertoy/template.h b/tools/shadertoy/template.h index 74be9f2..5f105d5 100644 --- a/tools/shadertoy/template.h +++ b/tools/shadertoy/template.h @@ -2,40 +2,25 @@ // ShaderToy effect boilerplate - REPLACE THIS LINE WITH DESCRIPTION // TODO: Update description, rename class, adjust parameters -#ifndef SHADERTOY_EFFECT_H_ -#define SHADERTOY_EFFECT_H_ +#pragma once #include "gpu/effect.h" -#include "gpu/post_process_helper.h" -#include "gpu/uniform_helper.h" +#include "gpu/wgpu_resource.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; + // TODO: Rename class, keep same constructor signature + ShaderToyEffect(const GpuContext& ctx, + const std::vector<std::string>& inputs, + const std::vector<std::string>& outputs, + float start_time, float end_time); - void init(MainSequence* demo) override; - void render(WGPURenderPassEncoder pass, float time, float beat, - float intensity, float aspect_ratio) override; + void render(WGPUCommandEncoder encoder, + const UniformsSequenceParams& params, + NodeRegistry& nodes) 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_; + RenderPipeline pipeline_; + BindGroup bind_group_; }; - -#endif /* SHADERTOY_EFFECT_H_ */ |
