From 5a36b4bb48205676e37f0332e3e914df13c0d08d Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Tue, 9 Jan 2024 02:33:47 +0900 Subject: [PATCH] internal/graphicsdriver/opengl/gl: remove IsTexture Updates #805 --- internal/graphicsdriver/opengl/context.go | 3 --- internal/graphicsdriver/opengl/gl/debug.go | 9 --------- internal/graphicsdriver/opengl/gl/default_cgo.go | 11 ----------- internal/graphicsdriver/opengl/gl/default_js.go | 6 ------ internal/graphicsdriver/opengl/gl/default_purego.go | 7 ------- internal/graphicsdriver/opengl/gl/interface.go | 1 - 6 files changed, 37 deletions(-) diff --git a/internal/graphicsdriver/opengl/context.go b/internal/graphicsdriver/opengl/context.go index ea766afc3..57bc4bffb 100644 --- a/internal/graphicsdriver/opengl/context.go +++ b/internal/graphicsdriver/opengl/context.go @@ -275,9 +275,6 @@ func (c *context) framebufferPixelsToBuffer(f *framebuffer, buffer buffer, width } func (c *context) deleteTexture(t textureNative) { - if !c.ctx.IsTexture(uint32(t)) { - return - } if c.lastTexture == t { c.lastTexture = 0 } diff --git a/internal/graphicsdriver/opengl/gl/debug.go b/internal/graphicsdriver/opengl/gl/debug.go index 5ab601d64..df71d288a 100644 --- a/internal/graphicsdriver/opengl/gl/debug.go +++ b/internal/graphicsdriver/opengl/gl/debug.go @@ -433,15 +433,6 @@ func (d *DebugContext) IsRenderbuffer(arg0 uint32) bool { return out0 } -func (d *DebugContext) IsTexture(arg0 uint32) bool { - out0 := d.Context.IsTexture(arg0) - fmt.Fprintln(os.Stderr, "IsTexture") - if e := d.Context.GetError(); e != NO_ERROR { - panic(fmt.Sprintf("gl: GetError() returned %d at IsTexture", e)) - } - return out0 -} - func (d *DebugContext) LinkProgram(arg0 uint32) { d.Context.LinkProgram(arg0) fmt.Fprintln(os.Stderr, "LinkProgram") diff --git a/internal/graphicsdriver/opengl/gl/default_cgo.go b/internal/graphicsdriver/opengl/gl/default_cgo.go index 4f6c77207..c9f5a58aa 100644 --- a/internal/graphicsdriver/opengl/gl/default_cgo.go +++ b/internal/graphicsdriver/opengl/gl/default_cgo.go @@ -212,10 +212,6 @@ package gl // typedef GLboolean (*fn)(GLuint renderbuffer); // return ((fn)(fnptr))(renderbuffer); // } -// static GLboolean glowIsTexture(uintptr_t fnptr, GLuint texture) { -// typedef GLboolean (*fn)(GLuint texture); -// return ((fn)(fnptr))(texture); -// } // static void glowLinkProgram(uintptr_t fnptr, GLuint program) { // typedef void (*fn)(GLuint program); // ((fn)(fnptr))(program); @@ -376,7 +372,6 @@ type defaultContext struct { gpIsFramebuffer C.uintptr_t gpIsProgram C.uintptr_t gpIsRenderbuffer C.uintptr_t - gpIsTexture C.uintptr_t gpLinkProgram C.uintptr_t gpPixelStorei C.uintptr_t gpReadPixels C.uintptr_t @@ -653,11 +648,6 @@ func (c *defaultContext) IsRenderbuffer(renderbuffer uint32) bool { return ret == TRUE } -func (c *defaultContext) IsTexture(texture uint32) bool { - ret := C.glowIsTexture(c.gpIsTexture, C.GLuint(texture)) - return ret == TRUE -} - func (c *defaultContext) LinkProgram(program uint32) { C.glowLinkProgram(c.gpLinkProgram, C.GLuint(program)) } @@ -832,7 +822,6 @@ func (c *defaultContext) LoadFunctions() error { c.gpIsFramebuffer = C.uintptr_t(g.get("glIsFramebuffer")) c.gpIsProgram = C.uintptr_t(g.get("glIsProgram")) c.gpIsRenderbuffer = C.uintptr_t(g.get("glIsRenderbuffer")) - c.gpIsTexture = C.uintptr_t(g.get("glIsTexture")) c.gpLinkProgram = C.uintptr_t(g.get("glLinkProgram")) c.gpPixelStorei = C.uintptr_t(g.get("glPixelStorei")) c.gpReadPixels = C.uintptr_t(g.get("glReadPixels")) diff --git a/internal/graphicsdriver/opengl/gl/default_js.go b/internal/graphicsdriver/opengl/gl/default_js.go index 2665847ae..4926dcd7c 100644 --- a/internal/graphicsdriver/opengl/gl/default_js.go +++ b/internal/graphicsdriver/opengl/gl/default_js.go @@ -70,7 +70,6 @@ type defaultContext struct { fnIsFramebuffer js.Value fnIsProgram js.Value fnIsRenderbuffer js.Value - fnIsTexture js.Value fnLinkProgram js.Value fnPixelStorei js.Value fnReadPixels js.Value @@ -201,7 +200,6 @@ func NewDefaultContext(v js.Value) (Context, error) { fnIsFramebuffer: v.Get("isFramebuffer").Call("bind", v), fnIsProgram: v.Get("isProgram").Call("bind", v), fnIsRenderbuffer: v.Get("isRenderbuffer").Call("bind", v), - fnIsTexture: v.Get("isTexture").Call("bind", v), fnLinkProgram: v.Get("linkProgram").Call("bind", v), fnPixelStorei: v.Get("pixelStorei").Call("bind", v), fnReadPixels: v.Get("readPixels").Call("bind", v), @@ -495,10 +493,6 @@ func (c *defaultContext) IsRenderbuffer(renderbuffer uint32) bool { return c.fnIsRenderbuffer.Invoke(c.renderbuffers.get(renderbuffer)).Bool() } -func (c *defaultContext) IsTexture(texture uint32) bool { - return c.fnIsTexture.Invoke(c.textures.get(texture)).Bool() -} - func (c *defaultContext) LinkProgram(program uint32) { c.fnLinkProgram.Invoke(c.programs.get(program)) } diff --git a/internal/graphicsdriver/opengl/gl/default_purego.go b/internal/graphicsdriver/opengl/gl/default_purego.go index b6a22daca..179cd8f4e 100644 --- a/internal/graphicsdriver/opengl/gl/default_purego.go +++ b/internal/graphicsdriver/opengl/gl/default_purego.go @@ -72,7 +72,6 @@ type defaultContext struct { gpIsFramebuffer uintptr gpIsProgram uintptr gpIsRenderbuffer uintptr - gpIsTexture uintptr gpLinkProgram uintptr gpPixelStorei uintptr gpReadPixels uintptr @@ -349,11 +348,6 @@ func (c *defaultContext) IsRenderbuffer(renderbuffer uint32) bool { return byte(ret) != 0 } -func (c *defaultContext) IsTexture(texture uint32) bool { - ret, _, _ := purego.SyscallN(c.gpIsTexture, uintptr(texture)) - return byte(ret) != 0 -} - func (c *defaultContext) LinkProgram(program uint32) { purego.SyscallN(c.gpLinkProgram, uintptr(program)) } @@ -528,7 +522,6 @@ func (c *defaultContext) LoadFunctions() error { c.gpIsFramebuffer = g.get("glIsFramebuffer") c.gpIsProgram = g.get("glIsProgram") c.gpIsRenderbuffer = g.get("glIsRenderbuffer") - c.gpIsTexture = g.get("glIsTexture") c.gpLinkProgram = g.get("glLinkProgram") c.gpPixelStorei = g.get("glPixelStorei") c.gpReadPixels = g.get("glReadPixels") diff --git a/internal/graphicsdriver/opengl/gl/interface.go b/internal/graphicsdriver/opengl/gl/interface.go index 7b01fc186..a13ff3812 100644 --- a/internal/graphicsdriver/opengl/gl/interface.go +++ b/internal/graphicsdriver/opengl/gl/interface.go @@ -75,7 +75,6 @@ type Context interface { IsFramebuffer(framebuffer uint32) bool IsProgram(program uint32) bool IsRenderbuffer(renderbuffer uint32) bool - IsTexture(texture uint32) bool LinkProgram(program uint32) PixelStorei(pname uint32, param int32) ReadPixels(dst []byte, x int32, y int32, width int32, height int32, format uint32, xtype uint32)