~eliasnaur/gio-patches

gio: app/internal/glimpl: [wasm] remove slow getError calls v1 PROPOSED

~inkeliz
~inkeliz: 1
 app/internal/glimpl: [wasm] remove slow getError calls

 1 files changed, 2 insertions(+), 1 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~eliasnaur/gio-patches/patches/15406/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH gio] app/internal/glimpl: [wasm] remove slow getError calls Export this patch

~inkeliz
From: Inkeliz <inkeliz@inkeliz.com>

The removal of getError significantly improves performance on js/wasm:

Opera 72 (w/ AMD Ryzen 3900X): ~12.29ms per frame to ~8.09ms;
Chrome 87 (w/ Snapdragon 435): ~156.34ms per frame to ~94.31ms;

Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
---
 app/internal/glimpl/gl_js.go | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/app/internal/glimpl/gl_js.go b/app/internal/glimpl/gl_js.go
index e4291d0..0fa7116 100644
--- a/app/internal/glimpl/gl_js.go
+++ b/app/internal/glimpl/gl_js.go
@@ -185,7 +185,8 @@ func (f *Functions) FramebufferTexture2D(target, attachment, texTarget gl.Enum,
	f.Ctx.Call("framebufferTexture2D", int(target), int(attachment), int(texTarget), js.Value(t), level)
}
func (f *Functions) GetError() gl.Enum {
	return gl.Enum(f.Ctx.Call("getError").Int())
	// Avoid slow getError calls. See gio#179.
	return 0
}
func (f *Functions) GetRenderbufferParameteri(target, pname gl.Enum) int {
	return paramVal(f.Ctx.Call("getRenderbufferParameteri", int(pname)))
-- 
2.26.2
Thanks, applied.