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)
|
SetVsyncEnabled(enabled bool)
|
||||||
FramebufferYDirection() YDirection
|
FramebufferYDirection() YDirection
|
||||||
NeedsRestoring() bool
|
NeedsRestoring() bool
|
||||||
|
NeedsClearingScreen() bool
|
||||||
IsGL() bool
|
IsGL() bool
|
||||||
HasHighPrecisionFloat() bool
|
HasHighPrecisionFloat() bool
|
||||||
MaxImageSize() int
|
MaxImageSize() int
|
||||||
|
@ -794,7 +794,11 @@ func (g *Graphics) draw(rps mtl.RenderPipelineState, dst *Image, dstRegion drive
|
|||||||
rpd := mtl.RenderPassDescriptor{}
|
rpd := mtl.RenderPassDescriptor{}
|
||||||
// Even though the destination pixels are not used, mtl.LoadActionDontCare might cause glitches
|
// Even though the destination pixels are not used, mtl.LoadActionDontCare might cause glitches
|
||||||
// (#1019). Always using mtl.LoadActionLoad is safe.
|
// (#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
|
rpd.ColorAttachments[0].StoreAction = mtl.StoreActionStore
|
||||||
|
|
||||||
t := dst.mtlTexture()
|
t := dst.mtlTexture()
|
||||||
@ -1015,6 +1019,10 @@ func (g *Graphics) NeedsRestoring() bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (g *Graphics) NeedsClearingScreen() bool {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
func (g *Graphics) IsGL() bool {
|
func (g *Graphics) IsGL() bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -337,6 +337,10 @@ func (g *Graphics) NeedsRestoring() bool {
|
|||||||
return g.context.needsRestoring()
|
return g.context.needsRestoring()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (g *Graphics) NeedsClearingScreen() bool {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
func (g *Graphics) IsGL() bool {
|
func (g *Graphics) IsGL() bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -205,8 +205,10 @@ func (c *uiContext) updateImpl(updateCount int) error {
|
|||||||
}
|
}
|
||||||
c.game.Draw(c.offscreen)
|
c.game.Draw(c.offscreen)
|
||||||
|
|
||||||
// This clear is needed for fullscreen mode or some mobile platforms (#622).
|
if uiDriver().Graphics().NeedsClearingScreen() {
|
||||||
c.screen.Clear()
|
// This clear is needed for fullscreen mode or some mobile platforms (#622).
|
||||||
|
c.screen.Clear()
|
||||||
|
}
|
||||||
|
|
||||||
op := &DrawImageOptions{}
|
op := &DrawImageOptions{}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user