coronalabs / corona

Solar2D Game Engine main repository (ex Corona SDK)
https://solar2d.com/
MIT License
2.53k stars 272 forks source link

MacOS Simulator: GPU Hang #424

Open personalnadir opened 2 years ago

personalnadir commented 2 years ago

Describe the bug The following code produces the message 'GPU hang occurred, CoreAnalytics returned false' before causing the simulator to crash on my machine (produced in an attempt to reproduce an issue which is causing the simulator to hard crash my MacBook)

To Reproduce Steps to reproduce the behavior:

  1. Run the following code:
    
    local group = display.newGroup()
    local c = display.newCircle(group,0,0,400)
    c:setFillColor(1,0,0)
    local topClear=display.newRect(0, 0, display.contentWidth, display.contentHeight/2)
    topClear:setFillColor(0,1,1)

local dot = display.newImage("dot.png") dot:setFillColor(0,1,1) dot.blendMode = "multiply" dot.alpha = 0.4 dot:scale(4,3)

local topTexture, bottomTexture, sharedTexture function create() sharedTexture = graphics.newTexture( { type="canvas", width=display.contentWidth, height=display.contentHeight/2 } ) topTexture = graphics.newTexture( { type="canvas", width=display.contentWidth, height=display.contentHeight/2 } ) bottomTexture = graphics.newTexture( { type="canvas", width=display.contentWidth, height=display.contentHeight/2 } )

local topImg = display.newImageRect(
    sharedTexture.filename,
    sharedTexture.baseDir,
    display.contentWidth,
    display.contentHeight/2
)
topImg.x = display.contentCenterX
topImg.y = display.contentHeight/4
topImg.xScale=-1
topImg.yScale=-1

local bottomImg = display.newImageRect(
    sharedTexture.filename,
    sharedTexture.baseDir,
    display.contentWidth,
    display.contentHeight/2
)
bottomImg.x = display.contentCenterX
bottomImg.y = display.contentHeight*3/4

local topImg = display.newImageRect(
    topTexture.filename,
    topTexture.baseDir,
    display.contentWidth,
    display.contentHeight/2
)
topImg.x = display.contentCenterX
topImg.y = display.contentHeight/4

local bottomImg = display.newImageRect(
    bottomTexture.filename,
    bottomTexture.baseDir,
    display.contentWidth,
    display.contentHeight/2
)
bottomImg.x = display.contentCenterX
bottomImg.y = display.contentHeight*3/4

end

create()

Runtime:addEventListener("enterFrame", function() sharedTexture:setBackground( 0, 0, 1 ) sharedTexture:draw(topClear) sharedTexture:draw(c) sharedTexture:invalidate()

bottomTexture:draw(topClear)
bottomTexture:draw(c)
bottomTexture:draw(dot)
bottomTexture:invalidate()

topTexture:draw(c)
topTexture:draw(dot)
topTexture:invalidate()

end)


2. Wait for crash 
**Target platform and where build was made:**
 - Device: MacOS Simulator 2022.3674
 - OS: MacOS 12.4
personalnadir commented 2 years ago

Here's what the above code looks like for me in the simulator

Screenshot 2022-07-13 at 10 36 19

personalnadir commented 2 years ago

dot The image asset used

personalnadir commented 2 years ago

Adding the line

topClear.alpha = 0.2

after the setBackground call cause the above code to crash my 2018 MacBook Pro

scottrules44 commented 1 year ago

The code above does not crash on my M1 Mac Mini Machine, Does this occur for people on the newest MacOS and Corona Sim?

Test.zip

elpida-v commented 1 year ago

I've tested the code on M1 Mac, with MacOS Ventura 13.3 and Corona Sim v.2023.3688 and it doesn't crash.

sekodev commented 1 year ago

Crashes for me on MBP 2020, Intel device. macOS Ventura 13.3.1. This seems to be an Intel-related issue.

GPU hang occurred, CoreAnalytics returned false
GPU hang occurred, CoreAnalytics returned false
[Finished in 10.5s with exit code -6]