From d89e8995fbbe5e43612c2790f3ea1734f150d7ec Mon Sep 17 00:00:00 2001 From: m0dB <79429057+m0dB@users.noreply.github.com> Date: Fri, 15 Sep 2023 22:28:53 +0200 Subject: [PATCH] skip options --- src/util/cmdlineargs.cpp | 17 +++++++ src/widget/wspinnyglsl.cpp | 93 +++++++++++++++++++++----------------- src/widget/wspinnyglsl.h | 3 ++ 3 files changed, 72 insertions(+), 41 deletions(-) diff --git a/src/util/cmdlineargs.cpp b/src/util/cmdlineargs.cpp index ad43dd602e0..251888e6e89 100644 --- a/src/util/cmdlineargs.cpp +++ b/src/util/cmdlineargs.cpp @@ -16,6 +16,7 @@ #include "defs_urls.h" #include "sources/soundsourceproxy.h" #include "util/assert.h" +#include "widget/wspinnyglsl.h" CmdlineArgs::CmdlineArgs() : m_startInFullscreen(false), // Initialize vars @@ -178,6 +179,18 @@ bool CmdlineArgs::parse(const QStringList& arguments, CmdlineArgs::ParseMode mod : QString()); parser.addOption(enableVuMeterGL); + const QCommandLineOption skipSpinnyTextures(QStringLiteral("skipSpinnyTextures"), + forUserFeedback ? QCoreApplication::translate("CmdlineArgs", + "Skip Spinny Textures") + : QString()); + parser.addOption(skipSpinnyTextures); + + const QCommandLineOption skipSpinnyVinylQuality(QStringLiteral("skipSpinnyVinylQuality"), + forUserFeedback ? QCoreApplication::translate("CmdlineArgs", + "Skip Spinny Vinyl Quality") + : QString()); + parser.addOption(skipSpinnyVinylQuality); + const QCommandLineOption controllerDebug(QStringLiteral("controller-debug"), forUserFeedback ? QCoreApplication::translate("CmdlineArgs", "Causes Mixxx to display/log all of the controller data it " @@ -339,6 +352,10 @@ bool CmdlineArgs::parse(const QStringList& arguments, CmdlineArgs::ParseMode mod } m_useVuMeterGL = parser.isSet(enableVuMeterGL); + + WSpinnyGLSL::sSkipTextures = parser.isSet(skipSpinnyTextures); + WSpinnyGLSL::sSkipVinylQuality = parser.isSet(skipSpinnyVinylQuality); + m_controllerDebug = parser.isSet(controllerDebug) || parser.isSet(controllerDebugDeprecated); m_controllerAbortOnWarning = parser.isSet(controllerAbortOnWarning); m_developer = parser.isSet(developer); diff --git a/src/widget/wspinnyglsl.cpp b/src/widget/wspinnyglsl.cpp index 13023667c5e..435ce416070 100644 --- a/src/widget/wspinnyglsl.cpp +++ b/src/widget/wspinnyglsl.cpp @@ -3,6 +3,9 @@ #include "util/assert.h" #include "util/texture.h" +bool WSpinnyGLSL::sSkipTextures = false; +bool WSpinnyGLSL::sSkipVinylQuality = false; + WSpinnyGLSL::WSpinnyGLSL( QWidget* parent, const QString& group, @@ -28,6 +31,8 @@ void WSpinnyGLSL::cleanupGL() { } void WSpinnyGLSL::coverChanged() { + if (sSkipTextures) + return; if (isContextValid()) { makeCurrentIfNeeded(); m_pLoadedCoverTextureScaled.reset(createTexture(m_loadedCoverScaled)); @@ -48,10 +53,14 @@ void WSpinnyGLSL::resizeGL(int w, int h) { Q_UNUSED(w); Q_UNUSED(h); // The images were resized in WSpinnyBase::resizeEvent. + if (sSkipTextures) + return; updateTextures(); } void WSpinnyGLSL::updateTextures() { + if (sSkipTextures) + return; m_pBgTexture.reset(createTexture(m_pBgImage)); m_pMaskTexture.reset(createTexture(m_pMaskImage)); m_pFgTextureScaled.reset(createTexture(m_fgImageScaled)); @@ -64,6 +73,8 @@ void WSpinnyGLSL::setupVinylSignalQuality() { void WSpinnyGLSL::updateVinylSignalQualityImage( const QColor& qual_color, const unsigned char* data) { + if (sSkipVinylQuality) + return; m_vinylQualityColor = qual_color; if (m_pQTexture) { makeCurrentIfNeeded(); @@ -106,54 +117,51 @@ void WSpinnyGLSL::paintGL() { return; } - if (m_state == 3) { - drawTextureFromWaveformRenderMark(0.f, 0.f, m_testTexture.get()); - return; - } + if (!sSkipTextures) { + glClearColor(0.f, 0.f, 0.f, 1.f); + glClear(GL_COLOR_BUFFER_BIT); - m_textureShader.bind(); + if (m_state == 3) { + drawTextureFromWaveformRenderMark(0.f, 0.f, m_testTexture.get()); + return; + } - int matrixLocation = m_textureShader.matrixLocation(); - int samplerLocation = m_textureShader.samplerLocation(); - int positionLocation = m_textureShader.positionLocation(); - int texcoordLocation = m_textureShader.texcoordLocation(); + m_textureShader.bind(); - QMatrix4x4 matrix; - m_textureShader.setUniformValue(matrixLocation, matrix); + int matrixLocation = m_textureShader.matrixLocation(); + int samplerLocation = m_textureShader.samplerLocation(); + int positionLocation = m_textureShader.positionLocation(); + int texcoordLocation = m_textureShader.texcoordLocation(); - m_textureShader.enableAttributeArray(positionLocation); - m_textureShader.enableAttributeArray(texcoordLocation); + QMatrix4x4 matrix; + m_textureShader.setUniformValue(matrixLocation, matrix); - m_textureShader.setUniformValue(samplerLocation, 0); + m_textureShader.enableAttributeArray(positionLocation); + m_textureShader.enableAttributeArray(texcoordLocation); + + m_textureShader.setUniformValue(samplerLocation, 0); - if (m_state == 11 || m_state == 4) { if (m_pBgTexture) { drawTexture(m_pBgTexture.get()); } - } - if (m_state == 11 || m_state == 5 || m_state == 10 || m_state == 12) { - if (m_state == 12) { - glClearColor(1.f, 1.f, 0.f, 1.f); - glClear(GL_COLOR_BUFFER_BIT); - } if (m_bShowCover && m_pLoadedCoverTextureScaled) { drawTexture(m_pLoadedCoverTextureScaled.get()); } - } - if (m_state == 11 || m_state == 6 || m_state == 10) { if (m_pMaskTexture) { drawTexture(m_pMaskTexture.get()); } } - if (m_state == 11 || m_state == 7) { + if (!sSkipVinylQuality) { // Overlay the signal quality drawing if vinyl is active if (shouldDrawVinylQuality()) { - m_textureShader.release(); + if (!sSkipTextures) + m_textureShader.release(); drawVinylQuality(); - m_textureShader.bind(); + if (!sSkipTextures) + m_textureShader.bind(); } } @@ -163,8 +171,9 @@ void WSpinnyGLSL::paintGL() { // and draw the image at the corner. // p.translate(width() / 2, height() / 2); - if (m_state == 11 || m_state == 8) { + if (!sSkipTextures) { bool paintGhost = m_bGhostPlayback && m_pGhostTextureScaled; + int matrixLocation = m_textureShader.matrixLocation(); if (paintGhost) { QMatrix4x4 rotate; @@ -173,9 +182,7 @@ void WSpinnyGLSL::paintGL() { drawTexture(m_pGhostTextureScaled.get()); } - } - if (m_state == 11 || m_state == 9) { if (m_pFgTextureScaled) { QMatrix4x4 rotate; rotate.rotate(m_fAngle, 0, 0, -1); @@ -183,24 +190,28 @@ void WSpinnyGLSL::paintGL() { drawTexture(m_pFgTextureScaled.get()); } - } - m_textureShader.release(); + m_textureShader.release(); + } } void WSpinnyGLSL::initializeGL() { - updateTextures(); + if (!sSkipTextures) { + updateTextures(); - m_pQTexture.reset(new QOpenGLTexture(QOpenGLTexture::Target2D)); - m_pQTexture->setMinMagFilters(QOpenGLTexture::Linear, QOpenGLTexture::Linear); - m_pQTexture->setSize(m_iVinylScopeSize, m_iVinylScopeSize); - m_pQTexture->setFormat(QOpenGLTexture::R8_UNorm); - m_pQTexture->allocateStorage(QOpenGLTexture::Red, QOpenGLTexture::UInt8); + m_pQTexture.reset(new QOpenGLTexture(QOpenGLTexture::Target2D)); + m_pQTexture->setMinMagFilters(QOpenGLTexture::Linear, QOpenGLTexture::Linear); + m_pQTexture->setSize(m_iVinylScopeSize, m_iVinylScopeSize); + m_pQTexture->setFormat(QOpenGLTexture::R8_UNorm); + m_pQTexture->allocateStorage(QOpenGLTexture::Red, QOpenGLTexture::UInt8); - generateTestTexture(); + generateTestTexture(); - m_textureShader.init(); - m_vinylQualityShader.init(); + m_textureShader.init(); + } + if (!sSkipVinylQuality) { + m_vinylQualityShader.init(); + } } void WSpinnyGLSL::drawTexture(QOpenGLTexture* texture) { @@ -285,7 +296,7 @@ void WSpinnyGLSL::mouseMoveEvent(QMouseEvent*) { void WSpinnyGLSL::mousePressEvent(QMouseEvent*) { m_state++; - if (m_state == 13) { + if (m_state == 5) { m_state = 0; } } diff --git a/src/widget/wspinnyglsl.h b/src/widget/wspinnyglsl.h index b180ae62281..bc05e0c7d79 100644 --- a/src/widget/wspinnyglsl.h +++ b/src/widget/wspinnyglsl.h @@ -19,6 +19,9 @@ class WSpinnyGLSL : public WSpinnyBase { void mousePressEvent(QMouseEvent* e) override; void mouseReleaseEvent(QMouseEvent* e) override; + static bool sSkipTextures; + static bool sSkipVinylQuality; + private: void draw() override; void coverChanged() override;