From 50ead86dda19099c65cb18403afcbc074939f261 Mon Sep 17 00:00:00 2001 From: Changkun Ou Date: Tue, 7 Sep 2021 12:24:16 +0200 Subject: [PATCH] internal/driver/mobile: tidy unused GLES3 functions --- internal/driver/mobile/gl/fn.go | 18 --- internal/driver/mobile/gl/gl.go | 145 ---------------------- internal/driver/mobile/gl/interface.go | 24 ---- internal/driver/mobile/gl/work.c | 64 ---------- internal/driver/mobile/gl/work.h | 18 --- internal/driver/mobile/gl/work_windows.go | 5 - 6 files changed, 274 deletions(-) diff --git a/internal/driver/mobile/gl/fn.go b/internal/driver/mobile/gl/fn.go index 066c3a2ada..5606e4bbd8 100644 --- a/internal/driver/mobile/gl/fn.go +++ b/internal/driver/mobile/gl/fn.go @@ -66,7 +66,6 @@ const ( glfnDeleteRenderbuffer glfnDeleteShader glfnDeleteTexture - glfnDeleteVertexArray glfnDepthFunc glfnDepthRangef glfnDepthMask @@ -174,23 +173,6 @@ const ( glfnVertexAttrib4fv glfnVertexAttribPointer glfnViewport - - // ES 3.0 functions - glfnUniformMatrix2x3fv - glfnUniformMatrix3x2fv - glfnUniformMatrix2x4fv - glfnUniformMatrix4x2fv - glfnUniformMatrix3x4fv - glfnUniformMatrix4x3fv - glfnBlitFramebuffer - glfnUniform1ui - glfnUniform2ui - glfnUniform3ui - glfnUniform4ui - glfnUniform1uiv - glfnUniform2uiv - glfnUniform3uiv - glfnUniform4uiv ) func goString(buf []byte) string { diff --git a/internal/driver/mobile/gl/gl.go b/internal/driver/mobile/gl/gl.go index ce0ed5473a..56d621145b 100644 --- a/internal/driver/mobile/gl/gl.go +++ b/internal/driver/mobile/gl/gl.go @@ -460,15 +460,6 @@ func (ctx *context) DeleteTexture(v Texture) { }) } -func (ctx *context) DeleteVertexArray(v VertexArray) { - ctx.enqueue(call{ - args: fnargs{ - fn: glfnDeleteVertexArray, - a0: v.c(), - }, - }) -} - func (ctx *context) DepthFunc(fn Enum) { ctx.enqueue(call{ args: fnargs{ @@ -1692,139 +1683,3 @@ func (ctx *context) Viewport(x, y, width, height int) { }, }) } - -func (ctx context3) UniformMatrix2x3fv(dst Uniform, src []float32) { - ctx.enqueue(call{ - args: fnargs{ - fn: glfnUniformMatrix2x3fv, - a0: dst.c(), - a1: uintptr(len(src) / 6), - }, - parg: unsafe.Pointer(&src[0]), - blocking: true, - }) -} - -func (ctx context3) UniformMatrix3x2fv(dst Uniform, src []float32) { - ctx.enqueue(call{ - args: fnargs{ - fn: glfnUniformMatrix3x2fv, - a0: dst.c(), - a1: uintptr(len(src) / 6), - }, - parg: unsafe.Pointer(&src[0]), - blocking: true, - }) -} - -func (ctx context3) UniformMatrix2x4fv(dst Uniform, src []float32) { - ctx.enqueue(call{ - args: fnargs{ - fn: glfnUniformMatrix2x4fv, - a0: dst.c(), - a1: uintptr(len(src) / 8), - }, - parg: unsafe.Pointer(&src[0]), - blocking: true, - }) -} - -func (ctx context3) UniformMatrix4x2fv(dst Uniform, src []float32) { - ctx.enqueue(call{ - args: fnargs{ - fn: glfnUniformMatrix4x2fv, - a0: dst.c(), - a1: uintptr(len(src) / 8), - }, - parg: unsafe.Pointer(&src[0]), - blocking: true, - }) -} - -func (ctx context3) UniformMatrix3x4fv(dst Uniform, src []float32) { - ctx.enqueue(call{ - args: fnargs{ - fn: glfnUniformMatrix3x4fv, - a0: dst.c(), - a1: uintptr(len(src) / 12), - }, - parg: unsafe.Pointer(&src[0]), - blocking: true, - }) -} - -func (ctx context3) UniformMatrix4x3fv(dst Uniform, src []float32) { - ctx.enqueue(call{ - args: fnargs{ - fn: glfnUniformMatrix4x3fv, - a0: dst.c(), - a1: uintptr(len(src) / 12), - }, - parg: unsafe.Pointer(&src[0]), - blocking: true, - }) -} - -func (ctx context3) BlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1 int, mask uint, filter Enum) { - ctx.enqueue(call{ - args: fnargs{ - fn: glfnBlitFramebuffer, - a0: uintptr(srcX0), - a1: uintptr(srcY0), - a2: uintptr(srcX1), - a3: uintptr(srcY1), - a4: uintptr(dstX0), - a5: uintptr(dstY0), - a6: uintptr(dstX1), - a7: uintptr(dstY1), - a8: uintptr(mask), - a9: filter.c(), - }, - }) -} - -func (ctx context3) Uniform1ui(dst Uniform, v uint32) { - ctx.enqueue(call{ - args: fnargs{ - fn: glfnUniform1ui, - a0: dst.c(), - a1: uintptr(v), - }, - }) -} - -func (ctx context3) Uniform2ui(dst Uniform, v0, v1 uint32) { - ctx.enqueue(call{ - args: fnargs{ - fn: glfnUniform2ui, - a0: dst.c(), - a1: uintptr(v0), - a2: uintptr(v1), - }, - }) -} - -func (ctx context3) Uniform3ui(dst Uniform, v0, v1, v2 uint) { - ctx.enqueue(call{ - args: fnargs{ - fn: glfnUniform3ui, - a0: dst.c(), - a1: uintptr(v0), - a2: uintptr(v1), - a3: uintptr(v2), - }, - }) -} - -func (ctx context3) Uniform4ui(dst Uniform, v0, v1, v2, v3 uint32) { - ctx.enqueue(call{ - args: fnargs{ - fn: glfnUniform4ui, - a0: dst.c(), - a1: uintptr(v0), - a2: uintptr(v1), - a3: uintptr(v2), - a4: uintptr(v3), - }, - }) -} diff --git a/internal/driver/mobile/gl/interface.go b/internal/driver/mobile/gl/interface.go index aa80d5b201..f0138e4639 100644 --- a/internal/driver/mobile/gl/interface.go +++ b/internal/driver/mobile/gl/interface.go @@ -7,12 +7,6 @@ package gl // Context is an OpenGL ES context. // // A Context has a method for every GL function supported by ES 2 or later. -// In a program compiled with ES 3 support, a Context is also a Context3. -// For example, a program can: -// -// func f(glctx gl.Context) { -// glctx.(gl.Context3).BlitFramebuffer(...) -// } // // Calls are not safe for concurrent use. However calls can be made from // any goroutine, the gl package removes the notion of thread-local @@ -234,11 +228,6 @@ type Context interface { // http://www.khronos.org/opengles/sdk/docs/man3/html/glDeleteTextures.xhtml DeleteTexture(v Texture) - // DeleteVertexArray deletes the given render buffer object. - // - // http://www.khronos.org/opengles/sdk/docs/man3/html/glDeleteVertexArrays.xhtml - DeleteVertexArray(v VertexArray) - // DepthFunc sets the function used for depth buffer comparisons. // // Valid fn values: @@ -827,19 +816,6 @@ type Context interface { Viewport(x, y, width, height int) } -// Context3 is an OpenGL ES 3 context. -// -// When the gl package is compiled with GL ES 3 support, the produced -// Context object also implements the Context3 interface. -type Context3 interface { - Context - - // BlitFramebuffer copies a block of pixels between framebuffers. - // - // https://www.khronos.org/opengles/sdk/docs/man3/html/glBlitFramebuffer.xhtml - BlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1 int, mask uint, filter Enum) -} - // Worker is used by display driver code to execute OpenGL calls. // // Typically display driver code creates a gl.Context for an application, diff --git a/internal/driver/mobile/gl/work.c b/internal/driver/mobile/gl/work.c index f68d26b681..03c729fdb5 100644 --- a/internal/driver/mobile/gl/work.c +++ b/internal/driver/mobile/gl/work.c @@ -15,24 +15,8 @@ static void gles3missing() { printf("GLES3 function is missing\n"); exit(2); } -static void glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) { gles3missing(); } -static void glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) { gles3missing(); } -static void glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) { gles3missing(); } -static void glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) { gles3missing(); } -static void glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) { gles3missing(); } -static void glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) { gles3missing(); } -static void glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) { gles3missing(); } -static void glUniform1ui(GLint location, GLuint v0) { gles3missing(); } -static void glUniform2ui(GLint location, GLuint v0, GLuint v1) { gles3missing(); } -static void glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2) { gles3missing(); } -static void glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3) { gles3missing(); } -static void glUniform1uiv(GLint location, GLsizei count, const GLuint *value) { gles3missing(); } -static void glUniform2uiv(GLint location, GLsizei count, const GLuint *value) { gles3missing(); } -static void glUniform3uiv(GLint location, GLsizei count, const GLuint *value) { gles3missing(); } -static void glUniform4uiv(GLint location, GLsizei count, const GLuint *value) { gles3missing(); } static void glBindVertexArray(GLuint array) { gles3missing(); } static void glGenVertexArrays(GLsizei n, GLuint *arrays) { gles3missing(); } -static void glDeleteVertexArrays(GLsizei n, const GLuint *arrays) { gles3missing(); } #endif uintptr_t processFn(struct fnargs* args, char* parg) { @@ -80,9 +64,6 @@ uintptr_t processFn(struct fnargs* args, char* parg) { case glfnBlendFuncSeparate: glBlendFuncSeparate((GLenum)args->a0, (GLenum)args->a1, (GLenum)args->a2, (GLenum)args->a3); break; - case glfnBlitFramebuffer: - glBlitFramebuffer((GLint)args->a0, (GLint)args->a1, (GLint)args->a2, (GLint)args->a3, (GLint)args->a4, (GLint)args->a5, (GLint)args->a6, (GLint)args->a7, (GLbitfield)args->a8, (GLenum)args->a9); - break; case glfnBufferData: glBufferData((GLenum)args->a0, (GLsizeiptr)args->a1, (GLvoid*)parg, (GLenum)args->a2); break; @@ -149,9 +130,6 @@ uintptr_t processFn(struct fnargs* args, char* parg) { case glfnDeleteTexture: glDeleteTextures(1, (const GLuint*)(&args->a0)); break; - case glfnDeleteVertexArray: - glDeleteVertexArrays(1, (const GLuint*)(&args->a0)); - break; case glfnDepthFunc: glDepthFunc((GLenum)args->a0); break; @@ -425,12 +403,6 @@ uintptr_t processFn(struct fnargs* args, char* parg) { case glfnUniform1i: glUniform1i((GLint)args->a0, (GLint)args->a1); break; - case glfnUniform1ui: - glUniform1ui((GLint)args->a0, (GLuint)args->a1); - break; - case glfnUniform1uiv: - glUniform1uiv((GLint)args->a0, (GLsizeiptr)args->a1, (GLuint*)parg); - break; case glfnUniform1iv: glUniform1iv((GLint)args->a0, (GLsizeiptr)args->a1, (GLvoid*)parg); break; @@ -443,12 +415,6 @@ uintptr_t processFn(struct fnargs* args, char* parg) { case glfnUniform2i: glUniform2i((GLint)args->a0, (GLint)args->a1, (GLint)args->a2); break; - case glfnUniform2ui: - glUniform2ui((GLint)args->a0, (GLuint)args->a1, (GLuint)args->a2); - break; - case glfnUniform2uiv: - glUniform2uiv((GLint)args->a0, (GLsizeiptr)args->a1, (GLuint*)parg); - break; case glfnUniform2iv: glUniform2iv((GLint)args->a0, (GLsizeiptr)args->a1, (GLvoid*)parg); break; @@ -461,12 +427,6 @@ uintptr_t processFn(struct fnargs* args, char* parg) { case glfnUniform3i: glUniform3i((GLint)args->a0, (GLint)args->a1, (GLint)args->a2, (GLint)args->a3); break; - case glfnUniform3ui: - glUniform3ui((GLint)args->a0, (GLuint)args->a1, (GLuint)args->a2, (GLuint)args->a3); - break; - case glfnUniform3uiv: - glUniform3uiv((GLint)args->a0, (GLsizeiptr)args->a1, (GLuint*)parg); - break; case glfnUniform3iv: glUniform3iv((GLint)args->a0, (GLsizeiptr)args->a1, (GLvoid*)parg); break; @@ -479,12 +439,6 @@ uintptr_t processFn(struct fnargs* args, char* parg) { case glfnUniform4i: glUniform4i((GLint)args->a0, (GLint)args->a1, (GLint)args->a2, (GLint)args->a3, (GLint)args->a4); break; - case glfnUniform4ui: - glUniform4ui((GLint)args->a0, (GLuint)args->a1, (GLuint)args->a2, (GLuint)args->a3, (GLuint)args->a4); - break; - case glfnUniform4uiv: - glUniform4uiv((GLint)args->a0, (GLsizeiptr)args->a1, (GLuint*)parg); - break; case glfnUniform4iv: glUniform4iv((GLint)args->a0, (GLsizeiptr)args->a1, (GLvoid*)parg); break; @@ -497,24 +451,6 @@ uintptr_t processFn(struct fnargs* args, char* parg) { case glfnUniformMatrix4fv: glUniformMatrix4fv((GLint)args->a0, (GLsizeiptr)args->a1, 0, (GLvoid*)parg); break; - case glfnUniformMatrix2x3fv: - glUniformMatrix2x3fv((GLint)args->a0, (GLsizeiptr)args->a1, 0, (GLvoid*)parg); - break; - case glfnUniformMatrix3x2fv: - glUniformMatrix3x2fv((GLint)args->a0, (GLsizeiptr)args->a1, 0, (GLvoid*)parg); - break; - case glfnUniformMatrix2x4fv: - glUniformMatrix2x4fv((GLint)args->a0, (GLsizeiptr)args->a1, 0, (GLvoid*)parg); - break; - case glfnUniformMatrix4x2fv: - glUniformMatrix4x2fv((GLint)args->a0, (GLsizeiptr)args->a1, 0, (GLvoid*)parg); - break; - case glfnUniformMatrix3x4fv: - glUniformMatrix3x4fv((GLint)args->a0, (GLsizeiptr)args->a1, 0, (GLvoid*)parg); - break; - case glfnUniformMatrix4x3fv: - glUniformMatrix4x3fv((GLint)args->a0, (GLsizeiptr)args->a1, 0, (GLvoid*)parg); - break; case glfnUseProgram: glUseProgram((GLint)args->a0); break; diff --git a/internal/driver/mobile/gl/work.h b/internal/driver/mobile/gl/work.h index 4808632ec7..b6322475f2 100644 --- a/internal/driver/mobile/gl/work.h +++ b/internal/driver/mobile/gl/work.h @@ -73,7 +73,6 @@ typedef enum { glfnDeleteRenderbuffer, glfnDeleteShader, glfnDeleteTexture, - glfnDeleteVertexArray, glfnDepthFunc, glfnDepthRangef, glfnDepthMask, @@ -181,23 +180,6 @@ typedef enum { glfnVertexAttrib4fv, glfnVertexAttribPointer, glfnViewport, - - // ES 3.0 functions - glfnUniformMatrix2x3fv, - glfnUniformMatrix3x2fv, - glfnUniformMatrix2x4fv, - glfnUniformMatrix4x2fv, - glfnUniformMatrix3x4fv, - glfnUniformMatrix4x3fv, - glfnBlitFramebuffer, - glfnUniform1ui, - glfnUniform2ui, - glfnUniform3ui, - glfnUniform4ui, - glfnUniform1uiv, - glfnUniform2uiv, - glfnUniform3uiv, - glfnUniform4uiv, } glfn; // TODO: generate this type from fn.go. diff --git a/internal/driver/mobile/gl/work_windows.go b/internal/driver/mobile/gl/work_windows.go index d76bb3ce7c..c09e54f21c 100644 --- a/internal/driver/mobile/gl/work_windows.go +++ b/internal/driver/mobile/gl/work_windows.go @@ -245,10 +245,6 @@ var glfnMap = map[glfn]func(c call) (ret uintptr){ syscall.Syscall(glDeleteShader.Addr(), 1, c.args.a0, 0, 0) return }, - glfnDeleteVertexArray: func(c call) (ret uintptr) { - syscall.Syscall(glDeleteVertexArrays.Addr(), 2, 1, uintptr(unsafe.Pointer(&c.args.a0)), 0) - return - }, glfnDeleteTexture: func(c call) (ret uintptr) { syscall.Syscall(glDeleteTextures.Addr(), 2, 1, uintptr(unsafe.Pointer(&c.args.a0)), 0) return @@ -745,7 +741,6 @@ var ( glDeleteRenderbuffers = libGLESv2.NewProc("glDeleteRenderbuffers") glDeleteShader = libGLESv2.NewProc("glDeleteShader") glDeleteTextures = libGLESv2.NewProc("glDeleteTextures") - glDeleteVertexArrays = libGLESv2.NewProc("glDeleteVertexArrays") glDepthFunc = libGLESv2.NewProc("glDepthFunc") glDepthRangef = libGLESv2.NewProc("glDepthRangef") glDepthMask = libGLESv2.NewProc("glDepthMask")