diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/generated/timeline.cc | 30 | ||||
| -rw-r--r-- | src/gpu/gpu.h | 32 |
2 files changed, 49 insertions, 13 deletions
diff --git a/src/generated/timeline.cc b/src/generated/timeline.cc index c7aad2f..2e060fb 100644 --- a/src/generated/timeline.cc +++ b/src/generated/timeline.cc @@ -2,21 +2,33 @@ #include "gpu/demo_effects.h" #include "gpu/effect.h" -void LoadTimeline(MainSequence& main_seq, WGPUDevice device, WGPUQueue queue, WGPUTextureFormat format) { +void LoadTimeline(MainSequence &main_seq, WGPUDevice device, WGPUQueue queue, + WGPUTextureFormat format) { { auto seq = std::make_shared<Sequence>(); - seq->add_effect(std::make_shared<HeptagonEffect>(device, queue, format), 0.0f, 1000.0f, 0); - seq->add_effect(std::make_shared<MovingEllipseEffect>(device, queue, format), 0.0f, 1000.0f, 1); - seq->add_effect(std::make_shared<ParticlesEffect>(device, queue, format), 0.0f, 1000.0f, 2); - seq->add_effect(std::make_shared<ParticleSprayEffect>(device, queue, format), 0.0f, 1000.0f, 3); + seq->add_effect(std::make_shared<HeptagonEffect>(device, queue, format), + 0.0f, 1000.0f, 0); + seq->add_effect( + std::make_shared<MovingEllipseEffect>(device, queue, format), 0.0f, + 1000.0f, 1); + seq->add_effect(std::make_shared<ParticlesEffect>(device, queue, format), + 0.0f, 1000.0f, 2); + seq->add_effect( + std::make_shared<ParticleSprayEffect>(device, queue, format), 0.0f, + 1000.0f, 3); main_seq.add_sequence(seq, 0.0f, 0); } { auto seq = std::make_shared<Sequence>(); - seq->add_effect(std::make_shared<SolarizeEffect>(device, queue, format), 5.0f, 10.0f, 0); - seq->add_effect(std::make_shared<GaussianBlurEffect>(device, queue, format), 10.0f, 15.0f, 0); - seq->add_effect(std::make_shared<DistortEffect>(device, queue, format), 15.0f, 20.0f, 0); - seq->add_effect(std::make_shared<ChromaAberrationEffect>(device, queue, format), 20.0f, 25.0f, 0); + seq->add_effect(std::make_shared<SolarizeEffect>(device, queue, format), + 5.0f, 10.0f, 0); + seq->add_effect(std::make_shared<GaussianBlurEffect>(device, queue, format), + 10.0f, 15.0f, 0); + seq->add_effect(std::make_shared<DistortEffect>(device, queue, format), + 15.0f, 20.0f, 0); + seq->add_effect( + std::make_shared<ChromaAberrationEffect>(device, queue, format), 20.0f, + 25.0f, 0); main_seq.add_sequence(seq, 0.0f, 1); } } diff --git a/src/gpu/gpu.h b/src/gpu/gpu.h index 8aa290a..ce233fa 100644 --- a/src/gpu/gpu.h +++ b/src/gpu/gpu.h @@ -9,37 +9,61 @@ #include <cstring> // For strlen #if defined(DEMO_CROSS_COMPILE_WIN32) + // Windows (MinGW) using wgpu-native v0.19.4.1 -#include <webgpu/webgpu.h> -#include <webgpu/wgpu.h> + +#include <webgpu/webgpu.h> // Reverted to angle brackets + +#include <webgpu/wgpu.h> // Reverted to angle brackets + using WGPUStringView = const char *; + static inline const char *str_view(const char *str) { return str; } + static inline const char *label_view(const char *str) { return str; } + #define WGPUSType_ShaderSourceWGSL WGPUSType_ShaderModuleWGSLDescriptor + using WGPUShaderSourceWGSL = WGPUShaderModuleWGSLDescriptor; + #else + // Native (macOS/Linux) using newer wgpu-native -#include <webgpu.h> -#include <wgpu.h> + +#include <webgpu.h> // Reverted to angle brackets + +#include <wgpu.h> // Reverted to angle brackets + static inline WGPUStringView str_view(const char *str) { + if (!str) return {nullptr, 0}; + return {str, strlen(str)}; } + static inline WGPUStringView label_view(const char *str) { + #ifndef STRIP_ALL + if (!str) return {nullptr, 0}; + return {str, strlen(str)}; + #else + (void)str; + return {nullptr, 0}; + #endif } + #endif struct GLFWwindow; |
