mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
internal/graphicsdriver/metal: Skip clearing the screen on Metal
This commit is contained in:
parent
9cb1ff9cea
commit
38ce325958
@ -45,6 +45,7 @@ type Graphics interface {
|
||||
SetVsyncEnabled(enabled bool)
|
||||
FramebufferYDirection() YDirection
|
||||
NeedsRestoring() bool
|
||||
NeedsClearingScreen() bool
|
||||
IsGL() bool
|
||||
HasHighPrecisionFloat() bool
|
||||
MaxImageSize() int
|
||||
|
@ -794,7 +794,11 @@ func (g *Graphics) draw(rps mtl.RenderPipelineState, dst *Image, dstRegion drive
|
||||
rpd := mtl.RenderPassDescriptor{}
|
||||
// Even though the destination pixels are not used, mtl.LoadActionDontCare might cause glitches
|
||||
// (#1019). Always using mtl.LoadActionLoad is safe.
|
||||
rpd.ColorAttachments[0].LoadAction = mtl.LoadActionLoad
|
||||
if dst.screen {
|
||||
rpd.ColorAttachments[0].LoadAction = mtl.LoadActionClear
|
||||
} else {
|
||||
rpd.ColorAttachments[0].LoadAction = mtl.LoadActionLoad
|
||||
}
|
||||
rpd.ColorAttachments[0].StoreAction = mtl.StoreActionStore
|
||||
|
||||
t := dst.mtlTexture()
|
||||
@ -1015,6 +1019,10 @@ func (g *Graphics) NeedsRestoring() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (g *Graphics) NeedsClearingScreen() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (g *Graphics) IsGL() bool {
|
||||
return false
|
||||
}
|
||||
|
@ -337,6 +337,10 @@ func (g *Graphics) NeedsRestoring() bool {
|
||||
return g.context.needsRestoring()
|
||||
}
|
||||
|
||||
func (g *Graphics) NeedsClearingScreen() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
func (g *Graphics) IsGL() bool {
|
||||
return true
|
||||
}
|
||||
|
@ -205,8 +205,10 @@ func (c *uiContext) updateImpl(updateCount int) error {
|
||||
}
|
||||
c.game.Draw(c.offscreen)
|
||||
|
||||
// This clear is needed for fullscreen mode or some mobile platforms (#622).
|
||||
c.screen.Clear()
|
||||
if uiDriver().Graphics().NeedsClearingScreen() {
|
||||
// This clear is needed for fullscreen mode or some mobile platforms (#622).
|
||||
c.screen.Clear()
|
||||
}
|
||||
|
||||
op := &DrawImageOptions{}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user