From 7050626be0a5e06eb11a35b923c4ac6d5a362735 Mon Sep 17 00:00:00 2001 From: yoyofr Date: Sun, 2 Nov 2025 15:04:41 +0100 Subject: [PATCH 1/2] Add additional alternates for the mult() function with int as arguments Required to propagate NaNs as SM3/DX9 does. Signed-off-by: Kai Blaschke --- vendor/hlslparser/src/GLSLGenerator.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vendor/hlslparser/src/GLSLGenerator.cpp b/vendor/hlslparser/src/GLSLGenerator.cpp index 47a0838864..c8afbd797d 100644 --- a/vendor/hlslparser/src/GLSLGenerator.cpp +++ b/vendor/hlslparser/src/GLSLGenerator.cpp @@ -426,6 +426,9 @@ bool GLSLGenerator::Generate(HLSLTree* tree, Target target, Version version, con if (m_options.flags & Flag_AlternateNanPropagation) { /* Implement alternate functions that propagate NaNs like shader model 3 and DX9. */ + m_writer.WriteLine(0, "float %s(int i_x, int i_y) { float x=float(i_x); float y=float(i_y); if (x == 0.0 || y == 0.0) { return 0.0; } else { return (x * y); } }", m_altMultFunction); + m_writer.WriteLine(0, "float %s(int i_x, float y) { float x=float(i_x); if (x == 0.0 || y == 0.0) { return 0.0; } else { return (x * y); } }", m_altMultFunction); + m_writer.WriteLine(0, "float %s(float x, int i_y) { float y=float(i_y); if (x == 0.0 || y == 0.0) { return 0.0; } else { return (x * y); } }", m_altMultFunction); m_writer.WriteLine(0, "float %s(float x, float y) { if (x == 0.0 || y == 0.0) { return 0.0; } else { return (x * y); } }", m_altMultFunction); m_writer.WriteLine(0, "vec2 %s(vec2 x, vec2 y) { return vec2(%s(x.x, y.x), %s(x.y, y.y)); }", m_altMultFunction, m_altMultFunction, m_altMultFunction); m_writer.WriteLine(0, "vec3 %s(vec3 x, vec3 y) { return vec3(%s(x.x, y.x), %s(x.y, y.y), %s(x.z, y.z)); }", m_altMultFunction, m_altMultFunction, m_altMultFunction, m_altMultFunction); From 48ad45851ea82719e6b6e7e88a21177060a4f7a6 Mon Sep 17 00:00:00 2001 From: yoyofr Date: Sun, 2 Nov 2025 14:56:25 +0100 Subject: [PATCH 2/2] Fix values for bass/middle/treble/volume params for shaders Since earlier projectM versions had values in these args which were way higher than they should've been, they were divided by 100. Since the audio processing refactor, this is no longer required, but these divisions were overlooked and thus shaders got only 1% of the actual magnitude expected. Signed-off-by: Kai Blaschke --- .../MilkdropPreset/MilkdropShader.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/libprojectM/MilkdropPreset/MilkdropShader.cpp b/src/libprojectM/MilkdropPreset/MilkdropShader.cpp index 1dadec3405..345ef69ff9 100644 --- a/src/libprojectM/MilkdropPreset/MilkdropShader.cpp +++ b/src/libprojectM/MilkdropPreset/MilkdropShader.cpp @@ -186,14 +186,14 @@ void MilkdropShader::LoadVariables(const PresetState& presetState, const PerFram presetState.renderContext.fps, presetState.renderContext.frame, presetState.renderContext.progress}); - m_shader.SetUniformFloat4("_c3", {presetState.audioData.bass / 100, - presetState.audioData.mid / 100, - presetState.audioData.treb / 100, - presetState.audioData.vol / 100}); - m_shader.SetUniformFloat4("_c4", {presetState.audioData.bassAtt / 100, - presetState.audioData.midAtt / 100, - presetState.audioData.trebAtt / 100, - presetState.audioData.volAtt / 100}); + m_shader.SetUniformFloat4("_c3", {presetState.audioData.bass, + presetState.audioData.mid, + presetState.audioData.treb, + presetState.audioData.vol}); + m_shader.SetUniformFloat4("_c4", {presetState.audioData.bassAtt, + presetState.audioData.midAtt, + presetState.audioData.trebAtt, + presetState.audioData.volAtt}); m_shader.SetUniformFloat4("_c5", {blurMax[0] - blurMin[0], blurMin[0], blurMax[1] - blurMin[1],