diff --git a/.github/workflows/build_emscripten.yml b/.github/workflows/build_emscripten.yml index 2bc12135af..505aa1bfc8 100644 --- a/.github/workflows/build_emscripten.yml +++ b/.github/workflows/build_emscripten.yml @@ -22,7 +22,7 @@ jobs: submodules: 'recursive' - name: Setup emsdk - uses: mymindstorm/setup-emsdk@v13 + uses: mymindstorm/setup-emsdk@v14 with: # Make sure to set a version number! version: 3.1.53 diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b9415a5df..e9c01fb2df 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -52,7 +52,7 @@ endif() project(libprojectM LANGUAGES C CXX - VERSION 4.1.4 + VERSION 4.1.5 ) # The API (SO) version for the shared library. Should be incremented whenever the binary interface changes 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], diff --git a/src/playlist/Playlist.cpp b/src/playlist/Playlist.cpp index 0eef28e22a..c9e97c1648 100644 --- a/src/playlist/Playlist.cpp +++ b/src/playlist/Playlist.cpp @@ -220,7 +220,7 @@ auto Playlist::NextPresetIndex() -> uint32_t if (m_shuffle) { - std::uniform_int_distribution randomDistribution(0, static_cast(m_items.size())); + std::uniform_int_distribution randomDistribution(0, static_cast(m_items.size() - 1)); m_currentPosition = randomDistribution(m_randomGenerator); } else @@ -247,7 +247,7 @@ auto Playlist::PreviousPresetIndex() -> uint32_t if (m_shuffle) { - std::uniform_int_distribution randomDistribution(0, static_cast(m_items.size())); + std::uniform_int_distribution randomDistribution(0, static_cast(m_items.size() - 1)); m_currentPosition = randomDistribution(m_randomGenerator); } else diff --git a/vendor/hlslparser/src/GLSLGenerator.cpp b/vendor/hlslparser/src/GLSLGenerator.cpp index f836f381a7..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); @@ -887,9 +890,11 @@ void GLSLGenerator::OutputExpression(HLSLExpression* expression, const HLSLType* } else { + // Array subscript operator in GLSL requires an explicit int parameter + const HLSLType& intType = HLSLType(HLSLBaseType_Int); OutputExpression(arrayAccess->array); m_writer.Write("["); - OutputExpression(arrayAccess->index); + OutputExpression(arrayAccess->index, &intType); m_writer.Write("]"); } diff --git a/vendor/hlslparser/src/HLSLParser.cpp b/vendor/hlslparser/src/HLSLParser.cpp index b769b48023..358df27703 100644 --- a/vendor/hlslparser/src/HLSLParser.cpp +++ b/vendor/hlslparser/src/HLSLParser.cpp @@ -478,6 +478,11 @@ const Intrinsic _intrinsic[] = Intrinsic( "length", HLSLBaseType_Float, HLSLBaseType_Float3 ), Intrinsic( "length", HLSLBaseType_Float, HLSLBaseType_Float4 ), + Intrinsic( "distance", HLSLBaseType_Float, HLSLBaseType_Float , HLSLBaseType_Float ), + Intrinsic( "distance", HLSLBaseType_Float, HLSLBaseType_Float2, HLSLBaseType_Float2 ), + Intrinsic( "distance", HLSLBaseType_Float, HLSLBaseType_Float3, HLSLBaseType_Float3 ), + Intrinsic( "distance", HLSLBaseType_Float, HLSLBaseType_Float4, HLSLBaseType_Float4 ), + INTRINSIC_FLOAT2_FUNCTION( "max" ), INTRINSIC_FLOAT2_FUNCTION( "min" ), diff --git a/vendor/projectm-eval b/vendor/projectm-eval index ee180a2473..612afc49a4 160000 --- a/vendor/projectm-eval +++ b/vendor/projectm-eval @@ -1 +1 @@ -Subproject commit ee180a2473c12856fd25dc754bafdab7e843cc7a +Subproject commit 612afc49a4ee05dcfd68548a5c9bf1aaa031d17d