Skip to content
2 changes: 1 addition & 1 deletion .github/workflows/build_emscripten.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions src/libprojectM/MilkdropPreset/MilkdropShader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
4 changes: 2 additions & 2 deletions src/playlist/Playlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ auto Playlist::NextPresetIndex() -> uint32_t

if (m_shuffle)
{
std::uniform_int_distribution<uint32_t> randomDistribution(0, static_cast<uint32_t>(m_items.size()));
std::uniform_int_distribution<uint32_t> randomDistribution(0, static_cast<uint32_t>(m_items.size() - 1));
m_currentPosition = randomDistribution(m_randomGenerator);
}
else
Expand All @@ -247,7 +247,7 @@ auto Playlist::PreviousPresetIndex() -> uint32_t

if (m_shuffle)
{
std::uniform_int_distribution<uint32_t> randomDistribution(0, static_cast<uint32_t>(m_items.size()));
std::uniform_int_distribution<uint32_t> randomDistribution(0, static_cast<uint32_t>(m_items.size() - 1));
m_currentPosition = randomDistribution(m_randomGenerator);
}
else
Expand Down
7 changes: 6 additions & 1 deletion vendor/hlslparser/src/GLSLGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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("]");
}

Expand Down
5 changes: 5 additions & 0 deletions vendor/hlslparser/src/HLSLParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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" ),

Expand Down
Loading