love2d / love

LÖVE is an awesome 2D game framework for Lua.
https://love2d.org
Other
4.72k stars 385 forks source link

Canvas mipmaps freeze #1585

Closed Luke100000 closed 3 years ago

Luke100000 commented 4 years ago

Updating Canvas mipmaps (Either when manually updating via generateMipmaps() or by using "auto" mode and then switching canvas) freezes the game for around 2 sec, then continues, but will not update the window content. lg.setMode() or fullscreen toggle wont fix it again.

Happens on an Intel UHD 620, love2d 11.3, up to date Windows 10.

Image mipmaps work properly.

Following code shows a timer freezing after space being hit on affected systems:

local canvas = love.graphics.newCanvas(256, 256, {mipmaps = "manual"})

function love.draw()
    love.graphics.print(love.timer.getTime())
end

function love.keypressed(key)
    if key == "space" then
        canvas:generateMipmaps()
    end
end
MikuAuahDark commented 3 years ago

Are you happen to be in 26.20.100.7985 driver? Since I'm just affected by this bug recently. I have Visual Studio lying around so I can directly test patches. One thing to note is this bug is specific to 11.3, current 12.0-development branch (as of writing) doesn't have this problem.

On unrelated note, tou'll see something is logged to the event viewer when it hangs, which probably indicate the whole graphics stack hangs or something.

Luke100000 commented 3 years ago

25.20.100.6446, I am unable to update the driver. I can confirm the event, Display driver igfx stopped working and recovered.

slime73 commented 3 years ago

One thing to test - just to help confirm what's causing the issue - would be to add a nb_mips = 1; line here: https://github.com/love2d/love/blob/master/src/modules/graphics/opengl/Canvas.cpp#L58

MikuAuahDark commented 3 years ago

The problem disappear when I add that line. I also tried to experiment with nb_mips = nb_mips > 2 ? 2 : nb_mips; instead and no crashes. However as soon as I change 2 to 3, it crashes.

slime73 commented 3 years ago

I just pushed this change – I'm not positive whether it'll fix the issue or not though, so testing would be appreciated: https://github.com/love2d/love/commit/4f730e930be0f7e814cadb4ac103e2457533ce2b

MikuAuahDark commented 3 years ago

It did not fix the issue.

slime73 commented 3 years ago

I hate driver bugs...