Selaa lähdekoodia

Remove unused code that breaks clang builds (#558)

* fix(build): remove unused code breaking clang builds

* fix: remove unused particleName local and capture

---------

Co-authored-by: Alexis Maiquez <wpengine@alma.mu>
wchoe 4 kuukautta sitten
vanhempi
commit
0ec83fb471

+ 0 - 2
src/WallpaperEngine/Audio/AudioStream.h

@@ -173,8 +173,6 @@ private:
     int m_audioStream = NO_AUDIO_STREAM;
     /** File data pointer */
     ReadStreamSharedPtr m_buffer = nullptr;
-    /** The length of the file data pointer */
-    uint32_t m_length = 0;
 
     struct MyAVPacketList {
 	AVPacket* packet;

+ 8 - 11
src/WallpaperEngine/Render/Objects/CParticle.cpp

@@ -413,16 +413,14 @@ EmitterFunc CParticle::createBoxEmitter (const ParticleEmitter& emitter) {
     bool randomPeriodicEmission = (emitter.flags & 4) != 0;
 
     return [this, emitter, transformedEmitterOrigin, controlPointIndex, rate, flippedDirections, limitOnePerFrame,
-	    randomPeriodicEmission, emissionTimer = 0.0f, elapsedTime = 0.0f, delayTimer = emitter.delay,
-	    durationTimer = 0.0f, periodicTimer = 0.0f, periodicDuration = 0.0f, periodicDelay = 0.0f, emitting = false,
+	    randomPeriodicEmission, emissionTimer = 0.0f, delayTimer = emitter.delay, durationTimer = 0.0f,
+	    periodicTimer = 0.0f, periodicDuration = 0.0f, periodicDelay = 0.0f, emitting = false,
 	    instantaneousEmitted
 	    = false] (std::vector<ParticleInstance>& particles, uint32_t& count, float dt) mutable {
 	if (count >= particles.size ()) {
 	    return;
 	}
 
-	elapsedTime += dt;
-
 	// Handle delay
 	if (delayTimer > 0.0f) {
 	    delayTimer -= dt;
@@ -561,12 +559,11 @@ EmitterFunc CParticle::createSphereEmitter (const ParticleEmitter& emitter) {
     }
 
     bool limitOnePerFrame = (emitter.flags & 2) != 0;
-    bool isRope = m_useRopeRenderer;
-    std::string particleName = m_particle.name;
 
-    return [this, emitter, transformedEmitterOrigin, controlPointIndex, rate, lifetime, limitOnePerFrame, isRope,
-	    particleName, emissionTimer = 0.0f, remaining = emitter.instantaneous, lastSpawnTime = -1.0f,
-	    noEmitFrames = 0u] (std::vector<ParticleInstance>& particles, uint32_t& count, float dt) mutable {
+    return [this, emitter, transformedEmitterOrigin, controlPointIndex, rate, lifetime, limitOnePerFrame,
+	    emissionTimer = 0.0f,
+	    remaining
+	    = emitter.instantaneous] (std::vector<ParticleInstance>& particles, uint32_t& count, float dt) mutable {
 	if (count >= particles.size ()) {
 	    return;
 	}
@@ -1328,7 +1325,7 @@ OperatorFunc CParticle::createVortexOperator (const VortexOperator& op) {
     bool maintainDistance = (flags & 2) != 0;
     bool ringShape = (flags & 4) != 0;
 
-    return [this, controlPoint, axisValue, offsetValue, distanceInnerValue, distanceOuterValue, speedInnerValue,
+    return [controlPoint, axisValue, offsetValue, distanceInnerValue, distanceOuterValue, speedInnerValue,
 	    speedOuterValue, centerForceValue, ringRadiusValue, ringWidthValue, ringPullDistanceValue,
 	    ringPullForceValue, audioMode, infiniteAxis, maintainDistance, ringShape, speedOverride] (
 	       std::vector<ParticleInstance>& particles, uint32_t count,
@@ -1469,7 +1466,7 @@ OperatorFunc CParticle::createControlPointAttractOperator (const ControlPointAtt
     DynamicValue* thresholdValue = op.threshold->value.get ();
     DynamicValue* speedOverride = m_particle.instanceOverride.speed->value.get ();
 
-    return [this, controlPoint, originValue, scaleValue, thresholdValue, speedOverride] (
+    return [controlPoint, originValue, scaleValue, thresholdValue, speedOverride] (
 	       std::vector<ParticleInstance>& particles, uint32_t count,
 	       const std::vector<ControlPointData>& controlPoints, float currentTime, float dt
 	   ) {

+ 1 - 2
src/WallpaperEngine/Render/Shaders/Shader.cpp

@@ -28,8 +28,7 @@ Shader::Shader (
 	GLSLContext::UnitType_Fragment, filename, assetLocator.fragmentShader (filename), assetLocator, constants,
 	textures, overrideTextures, combos, overrideCombos
     ),
-    m_file (std::move (filename)), m_combos (combos), m_overrideCombos (overrideCombos), m_passTextures (textures),
-    m_overrideTextures (overrideTextures) {
+    m_file (std::move (filename)), m_combos (combos), m_passTextures (textures) {
     // link shaders between them
     this->m_vertex.linkToUnit (&this->m_fragment);
     this->m_fragment.linkToUnit (&this->m_vertex);

+ 0 - 8
src/WallpaperEngine/Render/Shaders/Shader.h

@@ -92,17 +92,9 @@ private:
      * The combos the shader should be generated with
      */
     const ComboMap& m_combos;
-    /**
-     * The overriden combos
-     */
-    const ComboMap& m_overrideCombos;
     /**
      * The list of textures the pass knows about
      */
     const TextureMap m_passTextures;
-    /**
-     * The list of the override textures
-     */
-    const TextureMap& m_overrideTextures;
 };
 } // namespace WallpaperEngine::Render::Shaders

+ 7 - 7
src/WallpaperEngine/Render/Shaders/ShaderUnit.cpp

@@ -105,10 +105,12 @@ void ShaderUnit::preprocessVariables () {
 
 	if (combo != std::string::npos) {
 	    this->parseComboConfiguration (line.substr (combo + strlen ("// [COMBO] ")), 0);
-	} else if (uniform != std::string::npos && comment != std::string::npos && semicolon != std::string::npos &&
-		   // this check ensures that the comment is after the semicolon (so it's not a commented-out line)
-		   // this needs further refining as it's not taking into account block comments
-		   semicolon < comment) {
+	} else if (
+	    uniform != std::string::npos && comment != std::string::npos && semicolon != std::string::npos &&
+	    // this check ensures that the comment is after the semicolon (so it's not a commented-out line)
+	    // this needs further refining as it's not taking into account block comments
+	    semicolon < comment
+	) {
 	    // uniforms with comments should never have a value assigned, use this fact to detect the required parts
 	    const size_t last_space = line.find_last_of (' ', semicolon);
 
@@ -262,8 +264,7 @@ void ShaderUnit::preprocessIncludes () {
 	size_t current = 0;
 
 	while (
-	    std::regex_search (this->m_preprocessed.cbegin () + current, this->m_preprocessed.cend (), match, ifdef)
-	) {
+	    std::regex_search (this->m_preprocessed.cbegin () + current, this->m_preprocessed.cend (), match, ifdef)) {
 	    current += match.position ();
 
 	    // if it's opening an #ifdef keep track of the start of the block
@@ -532,7 +533,6 @@ void ShaderUnit::parseParameterConfiguration (
 	// if needed
 	const auto textureName = data.find ("default");
 	// TODO: CREATE TEXTURE WITH THE GIVEN COLOR
-	const auto paintDefaultColor = data.find ("paintdefaultcolor");
 	// extract the texture number from the name
 	const char value = name.at (std::string ("g_Texture").length ());
 	const auto requireany = data.find ("requireany");