Skip to content

Commit

Permalink
opengl: only populate Shader:getWarnings string when there are warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
slime73 committed Feb 28, 2024
1 parent 57fab45 commit ff06718
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/modules/graphics/opengl/Shader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ std::string Shader::getWarnings() const

const std::string &stagewarnings = stage->getWarnings();

if (ShaderStage::getConstant(stage->getStageType(), stagestr))
if (!stagewarnings.empty() && ShaderStage::getConstant(stage->getStageType(), stagestr))
warnings += std::string(stagestr) + std::string(" shader:\n") + stagewarnings;
}

Expand Down
2 changes: 1 addition & 1 deletion testing/tests/graphics.lua
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ love.test.graphics.Shader = function(test)
]]
local shader1 = love.graphics.newShader(pixelcode1, vertexcode1, {debugname = 'testshader'})
test:assertObject(shader1)
test:assertEquals('vertex shader:\npixel shader:\n', shader1:getWarnings(), 'check shader valid')
test:assertEquals('', shader1:getWarnings(), 'check shader valid')
test:assertFalse(shader1:hasUniform('tex1'), 'check invalid uniform')
test:assertTrue(shader1:hasUniform('tex2'), 'check valid uniform')
test:assertEquals('testshader', shader1:getDebugName())
Expand Down

0 comments on commit ff06718

Please sign in to comment.