Skip to content

Commit

Permalink
internal/driver/mobile: tidy unused GLES3 functions
Browse files Browse the repository at this point in the history
  • Loading branch information
changkun committed Sep 8, 2021
1 parent 43c8280 commit 50ead86
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 274 deletions.
18 changes: 0 additions & 18 deletions internal/driver/mobile/gl/fn.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ const (
glfnDeleteRenderbuffer
glfnDeleteShader
glfnDeleteTexture
glfnDeleteVertexArray
glfnDepthFunc
glfnDepthRangef
glfnDepthMask
Expand Down Expand Up @@ -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 {
Expand Down
145 changes: 0 additions & 145 deletions internal/driver/mobile/gl/gl.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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),
},
})
}
24 changes: 0 additions & 24 deletions internal/driver/mobile/gl/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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,
Expand Down
64 changes: 0 additions & 64 deletions internal/driver/mobile/gl/work.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down
18 changes: 0 additions & 18 deletions internal/driver/mobile/gl/work.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ typedef enum {
glfnDeleteRenderbuffer,
glfnDeleteShader,
glfnDeleteTexture,
glfnDeleteVertexArray,
glfnDepthFunc,
glfnDepthRangef,
glfnDepthMask,
Expand Down Expand Up @@ -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.
Expand Down
Loading

0 comments on commit 50ead86

Please sign in to comment.