Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix slipmode shader for macOS #13256

Merged
merged 1 commit into from
May 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions src/shaders/slipmodeshader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ using namespace mixxx;

void SlipModeShader::init() {
QString vertexShaderCode = QStringLiteral(R"--(
#version 150
attribute highp vec4 position; // use vec4 here (will be padded) to assign directly to gl_Position

out highp vec4 vposition;
varying highp vec4 vposition;

void main()
{
Expand All @@ -17,12 +16,11 @@ void main()
)--");

QString fragmentShaderCode = QStringLiteral(R"--(
#version 120
uniform highp vec4 color;
uniform highp vec2 borders;
uniform highp vec2 dimension;

in highp vec4 vposition;
varying highp vec4 vposition;

void main()
{
Expand All @@ -32,21 +30,21 @@ void main()
float upperBoard = borders.x;
float lowerBoard = borders.y;

if (yBorder < 0){
if (yBorder < 0.0){
float borderAlpha = max(
0,
0.0,
lowerBoard + yBorder
) / lowerBoard;
gl_FragColor = vec4(color.xyz, mix(0, color.w, borderAlpha));
gl_FragColor = vec4(color.xyz, mix(0.0, color.w, borderAlpha));

} else if( (xBorder > dimension.x - upperBoard && yBorder >= 0) || yBorder > dimension.y - upperBoard)
} else if( (xBorder > dimension.x - upperBoard && yBorder >= 0.0) || yBorder > dimension.y - upperBoard)
{
float borderAlpha = max(0, max(
float borderAlpha = max(0.0, max(
yBorder - dimension.y,
xBorder - dimension.x) + upperBoard) / upperBoard;
gl_FragColor = vec4(mix(vec3(0, 0, 0), color.rgb, min(color.w, borderAlpha)), 1);
gl_FragColor = vec4(mix(vec3(0.0, 0.0, 0.0), color.rgb, min(color.w, borderAlpha)), 1.0);
} else {
gl_FragColor = vec4(0, 0, 0, 1);
gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
}
}
)--");
Expand Down