summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/shaders/sequence_uniforms.wgsl2
-rw-r--r--src/gpu/sequence.cc7
-rw-r--r--src/gpu/sequence.h2
-rw-r--r--tools/cnn_test.cc2
4 files changed, 9 insertions, 4 deletions
diff --git a/common/shaders/sequence_uniforms.wgsl b/common/shaders/sequence_uniforms.wgsl
index be47ad9..290f89b 100644
--- a/common/shaders/sequence_uniforms.wgsl
+++ b/common/shaders/sequence_uniforms.wgsl
@@ -8,5 +8,5 @@ struct UniformsSequenceParams {
beat_time: f32,
beat_phase: f32,
audio_intensity: f32,
- _pad: f32,
+ noise: f32,
};
diff --git a/src/gpu/sequence.cc b/src/gpu/sequence.cc
index 901d560..9de4133 100644
--- a/src/gpu/sequence.cc
+++ b/src/gpu/sequence.cc
@@ -4,6 +4,7 @@
#include "gpu/effect.h"
#include "util/fatal_error.h"
#include <algorithm>
+#include <random>
// NodeRegistry implementation
@@ -227,7 +228,11 @@ void Sequence::preprocess(float seq_time, float beat_time, float beat_phase,
params_.beat_time = beat_time;
params_.beat_phase = beat_phase;
params_.audio_intensity = audio_intensity;
- params_._pad = 0.0f;
+
+ static std::random_device rd;
+ static std::mt19937 gen(rd());
+ static std::uniform_real_distribution<float> dis(0.0f, 1.0f);
+ params_.noise = dis(gen);
uniforms_buffer_.update(ctx_.queue, params_);
}
diff --git a/src/gpu/sequence.h b/src/gpu/sequence.h
index 3bb770f..2ad0a8f 100644
--- a/src/gpu/sequence.h
+++ b/src/gpu/sequence.h
@@ -38,7 +38,7 @@ struct UniformsSequenceParams {
float beat_time; // Musical beats
float beat_phase; // Fractional beat 0.0-1.0
float audio_intensity;
- float _pad;
+ float noise; // Random value [0..1]
};
static_assert(sizeof(UniformsSequenceParams) == 32,
"UniformsSequenceParams must be 32 bytes for WGSL alignment");
diff --git a/tools/cnn_test.cc b/tools/cnn_test.cc
index 5694a62..1262021 100644
--- a/tools/cnn_test.cc
+++ b/tools/cnn_test.cc
@@ -1391,7 +1391,7 @@ int main(int argc, char** argv) {
.beat_time = 0.0f,
.beat_phase = 0.0f,
.audio_intensity = 0.0f,
- ._pad = 0.0f,
+ .noise = 0.0f,
};
wgpuQueueWriteBuffer(queue, common_uniform_buffer, 0, &common_u,
sizeof(common_u));