mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
graphicsdriver/metal: Bug fix: Sync textures before replacing a region
Updates #1213
This commit is contained in:
parent
7b6182d05a
commit
2bc1475a15
@ -440,7 +440,7 @@ func (g *Graphics) NewImage(width, height int) (driver.Image, error) {
|
||||
Width: graphics.InternalImageSize(width),
|
||||
Height: graphics.InternalImageSize(height),
|
||||
StorageMode: storageMode,
|
||||
Usage: textureUsage,
|
||||
Usage: mtl.TextureUsageShaderRead | mtl.TextureUsageRenderTarget,
|
||||
}
|
||||
var t mtl.Texture
|
||||
g.t.Call(func() error {
|
||||
@ -873,6 +873,10 @@ func (i *Image) ReplacePixels(args []*driver.ReplacePixelsArgs) {
|
||||
if g.drawCalled {
|
||||
g.flush(true, false)
|
||||
g.drawCalled = false
|
||||
|
||||
// When mtl.TextureUsageRenderTarget is specified, synchronizing the texture memory before replacing
|
||||
// a region seems necessary (#1213).
|
||||
i.syncTexture()
|
||||
}
|
||||
|
||||
g.t.Call(func() error {
|
||||
|
@ -58,8 +58,6 @@ func (v *view) update() {
|
||||
}
|
||||
|
||||
const (
|
||||
textureUsage = mtl.TextureUsageShaderRead | mtl.TextureUsageRenderTarget
|
||||
|
||||
storageMode = mtl.StorageModeShared
|
||||
resourceStorageMode = mtl.ResourceStorageModeShared
|
||||
)
|
||||
|
@ -46,9 +46,6 @@ func (v *view) update() {
|
||||
}
|
||||
|
||||
const (
|
||||
// MTLTextureUsageRenderTarget might cause a problematic render result. Not sure the reason.
|
||||
textureUsage = mtl.TextureUsageShaderRead
|
||||
|
||||
storageMode = mtl.StorageModeManaged
|
||||
resourceStorageMode = mtl.ResourceStorageModeManaged
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user