From cee948048d38cae13dc6e5845c5ed5d9767b1a51 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sat, 12 Nov 2022 19:25:26 +0900 Subject: [PATCH] internal/graphicsdriver/opengl: remove unused functions --- internal/graphicsdriver/opengl/context_gl.go | 9 --------- internal/graphicsdriver/opengl/context_gles.go | 9 --------- internal/graphicsdriver/opengl/context_js.go | 10 ---------- .../graphicsdriver/opengl/gl/package_notpurego.go | 13 ------------- internal/graphicsdriver/opengl/gl/package_purego.go | 9 --------- internal/graphicsdriver/opengl/gl_js.go | 2 -- internal/graphicsdriver/opengl/gles/default.go | 4 ---- internal/graphicsdriver/opengl/gles/gomobile.go | 4 ---- internal/graphicsdriver/opengl/gles/interface.go | 1 - 9 files changed, 61 deletions(-) diff --git a/internal/graphicsdriver/opengl/context_gl.go b/internal/graphicsdriver/opengl/context_gl.go index 2f415f49f..aeb234f8a 100644 --- a/internal/graphicsdriver/opengl/context_gl.go +++ b/internal/graphicsdriver/opengl/context_gl.go @@ -375,15 +375,6 @@ func (c *context) uniformInt(p program, location string, v int) bool { return true } -func (c *context) uniformFloat(p program, location string, v float32) bool { - l := int32(c.locationCache.GetUniformLocation(c, p, location)) - if l == invalidUniform { - return false - } - gl.Uniform1f(l, v) - return true -} - func (c *context) uniformFloats(p program, location string, v []float32, typ shaderir.Type) bool { l := int32(c.locationCache.GetUniformLocation(c, p, location)) if l == invalidUniform { diff --git a/internal/graphicsdriver/opengl/context_gles.go b/internal/graphicsdriver/opengl/context_gles.go index 1b896a61d..d5208c93e 100644 --- a/internal/graphicsdriver/opengl/context_gles.go +++ b/internal/graphicsdriver/opengl/context_gles.go @@ -344,15 +344,6 @@ func (c *context) uniformInt(p program, location string, v int) bool { return true } -func (c *context) uniformFloat(p program, location string, v float32) bool { - l := c.locationCache.GetUniformLocation(c, p, location) - if l == invalidUniform { - return false - } - c.ctx.Uniform1f(int32(l), v) - return true -} - func (c *context) uniformFloats(p program, location string, v []float32, typ shaderir.Type) bool { l := c.locationCache.GetUniformLocation(c, p, location) if l == invalidUniform { diff --git a/internal/graphicsdriver/opengl/context_js.go b/internal/graphicsdriver/opengl/context_js.go index 1197e2377..8704e1f8b 100644 --- a/internal/graphicsdriver/opengl/context_js.go +++ b/internal/graphicsdriver/opengl/context_js.go @@ -451,16 +451,6 @@ func (c *context) uniformInt(p program, location string, v int) bool { return true } -func (c *context) uniformFloat(p program, location string, v float32) bool { - gl := c.gl - l := c.locationCache.GetUniformLocation(c, p, location) - if l.equal(invalidUniform) { - return false - } - gl.uniform1f.Invoke(js.Value(l), v) - return true -} - func (c *context) uniformFloats(p program, location string, v []float32, typ shaderir.Type) bool { gl := c.gl l := c.locationCache.GetUniformLocation(c, p, location) diff --git a/internal/graphicsdriver/opengl/gl/package_notpurego.go b/internal/graphicsdriver/opengl/gl/package_notpurego.go index deaa63672..4255bedd2 100644 --- a/internal/graphicsdriver/opengl/gl/package_notpurego.go +++ b/internal/graphicsdriver/opengl/gl/package_notpurego.go @@ -163,7 +163,6 @@ package gl // typedef void (APIENTRYP GPTEXIMAGE2D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void * pixels); // typedef void (APIENTRYP GPTEXPARAMETERI)(GLenum target, GLenum pname, GLint param); // typedef void (APIENTRYP GPTEXSUBIMAGE2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void * pixels); -// typedef void (APIENTRYP GPUNIFORM1F)(GLint location, GLfloat v0); // typedef void (APIENTRYP GPUNIFORM1I)(GLint location, GLint v0); // typedef void (APIENTRYP GPUNIFORM1FV)(GLint location, GLsizei count, const GLfloat * value); // typedef void (APIENTRYP GPUNIFORM2FV)(GLint location, GLsizei count, const GLfloat * value); @@ -383,9 +382,6 @@ package gl // static void glowTexSubImage2D(GPTEXSUBIMAGE2D fnptr, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void * pixels) { // (*fnptr)(target, level, xoffset, yoffset, width, height, format, type, pixels); // } -// static void glowUniform1f(GPUNIFORM1F fnptr, GLint location, GLfloat v0) { -// (*fnptr)(location, v0); -// } // static void glowUniform1i(GPUNIFORM1I fnptr, GLint location, GLint v0) { // (*fnptr)(location, v0); // } @@ -498,7 +494,6 @@ var ( gpTexImage2D C.GPTEXIMAGE2D gpTexParameteri C.GPTEXPARAMETERI gpTexSubImage2D C.GPTEXSUBIMAGE2D - gpUniform1f C.GPUNIFORM1F gpUniform1i C.GPUNIFORM1I gpUniform1fv C.GPUNIFORM1FV gpUniform2fv C.GPUNIFORM2FV @@ -796,10 +791,6 @@ func TexSubImage2D(target uint32, level int32, xoffset int32, yoffset int32, wid C.glowTexSubImage2D(gpTexSubImage2D, (C.GLenum)(target), (C.GLint)(level), (C.GLint)(xoffset), (C.GLint)(yoffset), (C.GLsizei)(width), (C.GLsizei)(height), (C.GLenum)(format), (C.GLenum)(xtype), pixels) } -func Uniform1f(location int32, v0 float32) { - C.glowUniform1f(gpUniform1f, (C.GLint)(location), (C.GLfloat)(v0)) -} - func Uniform1i(location int32, v0 int32) { C.glowUniform1i(gpUniform1i, (C.GLint)(location), (C.GLint)(v0)) } @@ -1053,10 +1044,6 @@ func InitWithProcAddrFunc(getProcAddr func(name string) unsafe.Pointer) error { if gpTexSubImage2D == nil { return errors.New("gl: glTexSubImage2D is missing") } - gpUniform1f = (C.GPUNIFORM1F)(getProcAddr("glUniform1f")) - if gpUniform1f == nil { - return errors.New("gl: glUniform1f is missing") - } gpUniform1i = (C.GPUNIFORM1I)(getProcAddr("glUniform1i")) if gpUniform1i == nil { return errors.New("gl: glUniform1i is missing") diff --git a/internal/graphicsdriver/opengl/gl/package_purego.go b/internal/graphicsdriver/opengl/gl/package_purego.go index b678b49d9..ef6654e11 100644 --- a/internal/graphicsdriver/opengl/gl/package_purego.go +++ b/internal/graphicsdriver/opengl/gl/package_purego.go @@ -81,7 +81,6 @@ var ( gpTexImage2D uintptr gpTexParameteri uintptr gpTexSubImage2D uintptr - gpUniform1f uintptr gpUniform1i uintptr gpUniform1fv uintptr gpUniform2fv uintptr @@ -379,10 +378,6 @@ func TexSubImage2D(target uint32, level int32, xoffset int32, yoffset int32, wid purego.SyscallN(gpTexSubImage2D, uintptr(target), uintptr(level), uintptr(xoffset), uintptr(yoffset), uintptr(width), uintptr(height), uintptr(format), uintptr(xtype), uintptr(pixels)) } -func Uniform1f(location int32, v0 float32) { - Uniform1fv(location, 1, (*float32)(Ptr([]float32{v0}))) -} - func Uniform1i(location int32, v0 int32) { purego.SyscallN(gpUniform1i, uintptr(location), uintptr(v0)) } @@ -636,10 +631,6 @@ func InitWithProcAddrFunc(getProcAddr func(name string) uintptr) error { if gpTexSubImage2D == 0 { return errors.New("gl: glTexSubImage2D is missing") } - gpUniform1f = getProcAddr("glUniform1f") - if gpUniform1f == 0 { - return errors.New("gl: glUniform1f is missing") - } gpUniform1i = getProcAddr("glUniform1i") if gpUniform1i == 0 { return errors.New("gl: glUniform1i is missing") diff --git a/internal/graphicsdriver/opengl/gl_js.go b/internal/graphicsdriver/opengl/gl_js.go index 96ec82be6..ce4c60fb2 100644 --- a/internal/graphicsdriver/opengl/gl_js.go +++ b/internal/graphicsdriver/opengl/gl_js.go @@ -79,7 +79,6 @@ type gl struct { texImage2D js.Value texSubImage2D js.Value texParameteri js.Value - uniform1f js.Value uniform1fv js.Value uniform2fv js.Value uniform3fv js.Value @@ -156,7 +155,6 @@ func (c *context) newGL(v js.Value) *gl { texImage2D: v.Get("texImage2D").Call("bind", v), texSubImage2D: v.Get("texSubImage2D").Call("bind", v), texParameteri: v.Get("texParameteri").Call("bind", v), - uniform1f: v.Get("uniform1f").Call("bind", v), uniform1fv: v.Get("uniform1fv").Call("bind", v), uniform2fv: v.Get("uniform2fv").Call("bind", v), uniform3fv: v.Get("uniform3fv").Call("bind", v), diff --git a/internal/graphicsdriver/opengl/gles/default.go b/internal/graphicsdriver/opengl/gles/default.go index 9cbca4146..860c18817 100644 --- a/internal/graphicsdriver/opengl/gles/default.go +++ b/internal/graphicsdriver/opengl/gles/default.go @@ -324,10 +324,6 @@ func (DefaultContext) TexSubImage2D(target uint32, level int32, xoffset int32, y C.glTexSubImage2D(C.GLenum(target), C.GLint(level), C.GLint(xoffset), C.GLint(yoffset), C.GLsizei(width), C.GLsizei(height), C.GLenum(format), C.GLenum(xtype), unsafe.Pointer(&pixels[0])) } -func (DefaultContext) Uniform1f(location int32, v0 float32) { - C.glUniform1f(C.GLint(location), C.GLfloat(v0)) -} - func (DefaultContext) Uniform1fv(location int32, value []float32) { C.glUniform1fv(C.GLint(location), C.GLsizei(len(value)), (*C.GLfloat)(unsafe.Pointer(&value[0]))) } diff --git a/internal/graphicsdriver/opengl/gles/gomobile.go b/internal/graphicsdriver/opengl/gles/gomobile.go index 88298193a..c6d4fae0f 100644 --- a/internal/graphicsdriver/opengl/gles/gomobile.go +++ b/internal/graphicsdriver/opengl/gles/gomobile.go @@ -298,10 +298,6 @@ func (g *GomobileContext) TexSubImage2D(target uint32, level int32, xoffset int3 g.ctx.TexSubImage2D(gl.Enum(target), int(level), int(xoffset), int(yoffset), int(width), int(height), gl.Enum(format), gl.Enum(xtype), pixels) } -func (g *GomobileContext) Uniform1f(location int32, v0 float32) { - g.ctx.Uniform1f(gl.Uniform{Value: location}, v0) -} - func (g *GomobileContext) Uniform1fv(location int32, value []float32) { g.ctx.Uniform1fv(gl.Uniform{Value: location}, value) } diff --git a/internal/graphicsdriver/opengl/gles/interface.go b/internal/graphicsdriver/opengl/gles/interface.go index be2c563ce..40735cbc7 100644 --- a/internal/graphicsdriver/opengl/gles/interface.go +++ b/internal/graphicsdriver/opengl/gles/interface.go @@ -74,7 +74,6 @@ type Context interface { TexImage2D(target uint32, level int32, internalformat int32, width int32, height int32, format uint32, xtype uint32, pixels []byte) TexParameteri(target uint32, pname uint32, param int32) TexSubImage2D(target uint32, level int32, xoffset int32, yoffset int32, width int32, height int32, format uint32, xtype uint32, pixels []byte) - Uniform1f(location int32, v0 float32) Uniform1fv(location int32, value []float32) Uniform1i(location int32, v0 int32) Uniform2fv(location int32, value []float32)