From 2a8e8d0eb66ec909486b75c4717ff00d33c1b2d8 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Thu, 24 Jun 2021 12:49:36 +0900 Subject: [PATCH] internal/graphicsdriver/opengl: Stop using PBO PBO was introduced to improve the performance at ReplacePixels, but we found that PBO can degrades the performance. Also, now multiple glTexImage2Ds are called successively like a batch, so the situation is now different from that time when PBO was introduced. Let's remove PBO usages and wait and see. Closes #1678 --- internal/graphicsdriver/opengl/context_desktop.go | 2 +- internal/graphicsdriver/opengl/context_js.go | 2 +- internal/graphicsdriver/opengl/image.go | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/graphicsdriver/opengl/context_desktop.go b/internal/graphicsdriver/opengl/context_desktop.go index eaf4bec3e..b412eb39c 100644 --- a/internal/graphicsdriver/opengl/context_desktop.go +++ b/internal/graphicsdriver/opengl/context_desktop.go @@ -449,7 +449,7 @@ func (c *context) needsRestoring() bool { } func (c *context) canUsePBO() bool { - return isPBOAvailable() + return false } func (c *context) texSubImage2D(t textureNative, args []*driver.ReplacePixelsArgs) { diff --git a/internal/graphicsdriver/opengl/context_js.go b/internal/graphicsdriver/opengl/context_js.go index 33bf47c6a..cf863bc31 100644 --- a/internal/graphicsdriver/opengl/context_js.go +++ b/internal/graphicsdriver/opengl/context_js.go @@ -530,7 +530,7 @@ func (c *context) needsRestoring() bool { } func (c *context) canUsePBO() bool { - return isWebGL2Available + return false } func (c *context) texSubImage2D(t textureNative, args []*driver.ReplacePixelsArgs) { diff --git a/internal/graphicsdriver/opengl/image.go b/internal/graphicsdriver/opengl/image.go index 48f151539..3a9a6295c 100644 --- a/internal/graphicsdriver/opengl/image.go +++ b/internal/graphicsdriver/opengl/image.go @@ -120,6 +120,7 @@ func (i *Image) ReplacePixels(args []*driver.ReplacePixelsArgs) { } i.graphics.drawCalled = false + // TODO: Now canUsePBO always returns false (#1678). Remove the code for PBO. if !i.graphics.context.canUsePBO() { i.graphics.context.texSubImage2D(i.textureNative, args) return