From c5fb6fa23fb0706373c619cf4f8ab04924db1363 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sun, 13 Nov 2022 02:24:21 +0900 Subject: [PATCH] internal/graphicsdriver/opengl/gl: remove unused functions --- .../opengl/gl/package_notpurego.go | 250 +++++------------- .../opengl/gl/package_purego.go | 202 +++++--------- .../graphicsdriver/opengl/gles/default.go | 12 +- .../graphicsdriver/opengl/gles/gomobile.go | 12 +- .../graphicsdriver/opengl/gles/interface.go | 4 +- 5 files changed, 152 insertions(+), 328 deletions(-) diff --git a/internal/graphicsdriver/opengl/gl/package_notpurego.go b/internal/graphicsdriver/opengl/gl/package_notpurego.go index f0ac72d6b..2f3c3373a 100644 --- a/internal/graphicsdriver/opengl/gl/package_notpurego.go +++ b/internal/graphicsdriver/opengl/gl/package_notpurego.go @@ -129,25 +129,13 @@ package gl // typedef void (APIENTRYP GPGENFRAMEBUFFERSEXT)(GLsizei n, GLuint * framebuffers); // typedef void (APIENTRYP GPGENRENDERBUFFERSEXT)(GLsizei n, GLuint * renderbuffers); // typedef void (APIENTRYP GPGENTEXTURES)(GLsizei n, GLuint * textures); -// typedef void (APIENTRYP GPGETDOUBLEI_V)(GLenum target, GLuint index, GLdouble * data); -// typedef void (APIENTRYP GPGETDOUBLEI_VEXT)(GLenum pname, GLuint index, GLdouble * params); // typedef GLenum (APIENTRYP GPGETERROR)(); -// typedef void (APIENTRYP GPGETFLOATI_V)(GLenum target, GLuint index, GLfloat * data); -// typedef void (APIENTRYP GPGETFLOATI_VEXT)(GLenum pname, GLuint index, GLfloat * params); -// typedef void (APIENTRYP GPGETINTEGERI_V)(GLenum target, GLuint index, GLint * data); -// typedef void (APIENTRYP GPGETINTEGERUI64I_VNV)(GLenum value, GLuint index, GLuint64EXT * result); // typedef void (APIENTRYP GPGETINTEGERV)(GLenum pname, GLint * data); -// typedef void (APIENTRYP GPGETPOINTERI_VEXT)(GLenum pname, GLuint index, void ** params); // typedef void (APIENTRYP GPGETPROGRAMINFOLOG)(GLuint program, GLsizei bufSize, GLsizei * length, GLchar * infoLog); // typedef void (APIENTRYP GPGETPROGRAMIV)(GLuint program, GLenum pname, GLint * params); // typedef void (APIENTRYP GPGETSHADERINFOLOG)(GLuint shader, GLsizei bufSize, GLsizei * length, GLchar * infoLog); // typedef void (APIENTRYP GPGETSHADERIV)(GLuint shader, GLenum pname, GLint * params); -// typedef void (APIENTRYP GPGETTRANSFORMFEEDBACKI64_V)(GLuint xfb, GLenum pname, GLuint index, GLint64 * param); -// typedef void (APIENTRYP GPGETTRANSFORMFEEDBACKI_V)(GLuint xfb, GLenum pname, GLuint index, GLint * param); // typedef GLint (APIENTRYP GPGETUNIFORMLOCATION)(GLuint program, const GLchar * name); -// typedef void (APIENTRYP GPGETUNSIGNEDBYTEI_VEXT)(GLenum target, GLuint index, GLubyte * data); -// typedef void (APIENTRYP GPGETVERTEXARRAYINTEGERI_VEXT)(GLuint vaobj, GLuint index, GLenum pname, GLint * param); -// typedef void (APIENTRYP GPGETVERTEXARRAYPOINTERI_VEXT)(GLuint vaobj, GLuint index, GLenum pname, void ** param); // typedef GLboolean (APIENTRYP GPISFRAMEBUFFEREXT)(GLuint framebuffer); // typedef GLboolean (APIENTRYP GPISPROGRAM)(GLuint program); // typedef GLboolean (APIENTRYP GPISRENDERBUFFEREXT)(GLuint renderbuffer); @@ -281,33 +269,12 @@ package gl // static void glowGenTextures(GPGENTEXTURES fnptr, GLsizei n, GLuint * textures) { // (*fnptr)(n, textures); // } -// static void glowGetDoublei_v(GPGETDOUBLEI_V fnptr, GLenum target, GLuint index, GLdouble * data) { -// (*fnptr)(target, index, data); -// } -// static void glowGetDoublei_vEXT(GPGETDOUBLEI_VEXT fnptr, GLenum pname, GLuint index, GLdouble * params) { -// (*fnptr)(pname, index, params); -// } // static GLenum glowGetError(GPGETERROR fnptr) { // return (*fnptr)(); // } -// static void glowGetFloati_v(GPGETFLOATI_V fnptr, GLenum target, GLuint index, GLfloat * data) { -// (*fnptr)(target, index, data); -// } -// static void glowGetFloati_vEXT(GPGETFLOATI_VEXT fnptr, GLenum pname, GLuint index, GLfloat * params) { -// (*fnptr)(pname, index, params); -// } -// static void glowGetIntegeri_v(GPGETINTEGERI_V fnptr, GLenum target, GLuint index, GLint * data) { -// (*fnptr)(target, index, data); -// } -// static void glowGetIntegerui64i_vNV(GPGETINTEGERUI64I_VNV fnptr, GLenum value, GLuint index, GLuint64EXT * result) { -// (*fnptr)(value, index, result); -// } // static void glowGetIntegerv(GPGETINTEGERV fnptr, GLenum pname, GLint * data) { // (*fnptr)(pname, data); // } -// static void glowGetPointeri_vEXT(GPGETPOINTERI_VEXT fnptr, GLenum pname, GLuint index, void ** params) { -// (*fnptr)(pname, index, params); -// } // static void glowGetProgramInfoLog(GPGETPROGRAMINFOLOG fnptr, GLuint program, GLsizei bufSize, GLsizei * length, GLchar * infoLog) { // (*fnptr)(program, bufSize, length, infoLog); // } @@ -320,24 +287,9 @@ package gl // static void glowGetShaderiv(GPGETSHADERIV fnptr, GLuint shader, GLenum pname, GLint * params) { // (*fnptr)(shader, pname, params); // } -// static void glowGetTransformFeedbacki64_v(GPGETTRANSFORMFEEDBACKI64_V fnptr, GLuint xfb, GLenum pname, GLuint index, GLint64 * param) { -// (*fnptr)(xfb, pname, index, param); -// } -// static void glowGetTransformFeedbacki_v(GPGETTRANSFORMFEEDBACKI_V fnptr, GLuint xfb, GLenum pname, GLuint index, GLint * param) { -// (*fnptr)(xfb, pname, index, param); -// } // static GLint glowGetUniformLocation(GPGETUNIFORMLOCATION fnptr, GLuint program, const GLchar * name) { // return (*fnptr)(program, name); // } -// static void glowGetUnsignedBytei_vEXT(GPGETUNSIGNEDBYTEI_VEXT fnptr, GLenum target, GLuint index, GLubyte * data) { -// (*fnptr)(target, index, data); -// } -// static void glowGetVertexArrayIntegeri_vEXT(GPGETVERTEXARRAYINTEGERI_VEXT fnptr, GLuint vaobj, GLuint index, GLenum pname, GLint * param) { -// (*fnptr)(vaobj, index, pname, param); -// } -// static void glowGetVertexArrayPointeri_vEXT(GPGETVERTEXARRAYPOINTERI_VEXT fnptr, GLuint vaobj, GLuint index, GLenum pname, void ** param) { -// (*fnptr)(vaobj, index, pname, param); -// } // static GLboolean glowIsFramebufferEXT(GPISFRAMEBUFFEREXT fnptr, GLuint framebuffer) { // return (*fnptr)(framebuffer); // } @@ -429,87 +381,75 @@ import ( ) var ( - gpActiveTexture C.GPACTIVETEXTURE - gpAttachShader C.GPATTACHSHADER - gpBindAttribLocation C.GPBINDATTRIBLOCATION - gpBindBuffer C.GPBINDBUFFER - gpBindFramebufferEXT C.GPBINDFRAMEBUFFEREXT - gpBindRenderbufferEXT C.GPBINDRENDERBUFFEREXT - gpBindTexture C.GPBINDTEXTURE - gpBlendEquationSeparate C.GPBLENDEQUATIONSEPARATE - gpBlendFuncSeparate C.GPBLENDFUNCSEPARATE - gpBufferData C.GPBUFFERDATA - gpBufferSubData C.GPBUFFERSUBDATA - gpCheckFramebufferStatusEXT C.GPCHECKFRAMEBUFFERSTATUSEXT - gpClear C.GPCLEAR - gpColorMask C.GPCOLORMASK - gpCompileShader C.GPCOMPILESHADER - gpCreateProgram C.GPCREATEPROGRAM - gpCreateShader C.GPCREATESHADER - gpDeleteBuffers C.GPDELETEBUFFERS - gpDeleteFramebuffersEXT C.GPDELETEFRAMEBUFFERSEXT - gpDeleteProgram C.GPDELETEPROGRAM - gpDeleteRenderbuffersEXT C.GPDELETERENDERBUFFERSEXT - gpDeleteShader C.GPDELETESHADER - gpDeleteTextures C.GPDELETETEXTURES - gpDisable C.GPDISABLE - gpDisableVertexAttribArray C.GPDISABLEVERTEXATTRIBARRAY - gpDrawElements C.GPDRAWELEMENTS - gpEnable C.GPENABLE - gpEnableVertexAttribArray C.GPENABLEVERTEXATTRIBARRAY - gpFlush C.GPFLUSH - gpFramebufferRenderbufferEXT C.GPFRAMEBUFFERRENDERBUFFEREXT - gpFramebufferTexture2DEXT C.GPFRAMEBUFFERTEXTURE2DEXT - gpGenBuffers C.GPGENBUFFERS - gpGenFramebuffersEXT C.GPGENFRAMEBUFFERSEXT - gpGenRenderbuffersEXT C.GPGENRENDERBUFFERSEXT - gpGenTextures C.GPGENTEXTURES - gpGetDoublei_v C.GPGETDOUBLEI_V - gpGetDoublei_vEXT C.GPGETDOUBLEI_VEXT - gpGetError C.GPGETERROR - gpGetFloati_v C.GPGETFLOATI_V - gpGetFloati_vEXT C.GPGETFLOATI_VEXT - gpGetIntegeri_v C.GPGETINTEGERI_V - gpGetIntegerui64i_vNV C.GPGETINTEGERUI64I_VNV - gpGetIntegerv C.GPGETINTEGERV - gpGetPointeri_vEXT C.GPGETPOINTERI_VEXT - gpGetProgramInfoLog C.GPGETPROGRAMINFOLOG - gpGetProgramiv C.GPGETPROGRAMIV - gpGetShaderInfoLog C.GPGETSHADERINFOLOG - gpGetShaderiv C.GPGETSHADERIV - gpGetTransformFeedbacki64_v C.GPGETTRANSFORMFEEDBACKI64_V - gpGetTransformFeedbacki_v C.GPGETTRANSFORMFEEDBACKI_V - gpGetUniformLocation C.GPGETUNIFORMLOCATION - gpGetUnsignedBytei_vEXT C.GPGETUNSIGNEDBYTEI_VEXT - gpGetVertexArrayIntegeri_vEXT C.GPGETVERTEXARRAYINTEGERI_VEXT - gpGetVertexArrayPointeri_vEXT C.GPGETVERTEXARRAYPOINTERI_VEXT - gpIsFramebufferEXT C.GPISFRAMEBUFFEREXT - gpIsProgram C.GPISPROGRAM - gpIsRenderbufferEXT C.GPISRENDERBUFFEREXT - gpIsTexture C.GPISTEXTURE - gpLinkProgram C.GPLINKPROGRAM - gpPixelStorei C.GPPIXELSTOREI - gpReadPixels C.GPREADPIXELS - gpRenderbufferStorageEXT C.GPRENDERBUFFERSTORAGEEXT - gpScissor C.GPSCISSOR - gpShaderSource C.GPSHADERSOURCE - gpStencilFunc C.GPSTENCILFUNC - gpStencilOp C.GPSTENCILOP - gpTexImage2D C.GPTEXIMAGE2D - gpTexParameteri C.GPTEXPARAMETERI - gpTexSubImage2D C.GPTEXSUBIMAGE2D - gpUniform1fv C.GPUNIFORM1FV - gpUniform1i C.GPUNIFORM1I - gpUniform1iv C.GPUNIFORM1IV - gpUniform2fv C.GPUNIFORM2FV - gpUniform3fv C.GPUNIFORM3FV - gpUniform4fv C.GPUNIFORM4FV - gpUniformMatrix2fv C.GPUNIFORMMATRIX2FV - gpUniformMatrix3fv C.GPUNIFORMMATRIX3FV - gpUniformMatrix4fv C.GPUNIFORMMATRIX4FV - gpUseProgram C.GPUSEPROGRAM - gpVertexAttribPointer C.GPVERTEXATTRIBPOINTER - gpViewport C.GPVIEWPORT + gpActiveTexture C.GPACTIVETEXTURE + gpAttachShader C.GPATTACHSHADER + gpBindAttribLocation C.GPBINDATTRIBLOCATION + gpBindBuffer C.GPBINDBUFFER + gpBindFramebufferEXT C.GPBINDFRAMEBUFFEREXT + gpBindRenderbufferEXT C.GPBINDRENDERBUFFEREXT + gpBindTexture C.GPBINDTEXTURE + gpBlendEquationSeparate C.GPBLENDEQUATIONSEPARATE + gpBlendFuncSeparate C.GPBLENDFUNCSEPARATE + gpBufferData C.GPBUFFERDATA + gpBufferSubData C.GPBUFFERSUBDATA + gpCheckFramebufferStatusEXT C.GPCHECKFRAMEBUFFERSTATUSEXT + gpClear C.GPCLEAR + gpColorMask C.GPCOLORMASK + gpCompileShader C.GPCOMPILESHADER + gpCreateProgram C.GPCREATEPROGRAM + gpCreateShader C.GPCREATESHADER + gpDeleteBuffers C.GPDELETEBUFFERS + gpDeleteFramebuffersEXT C.GPDELETEFRAMEBUFFERSEXT + gpDeleteProgram C.GPDELETEPROGRAM + gpDeleteRenderbuffersEXT C.GPDELETERENDERBUFFERSEXT + gpDeleteShader C.GPDELETESHADER + gpDeleteTextures C.GPDELETETEXTURES + gpDisable C.GPDISABLE + gpDisableVertexAttribArray C.GPDISABLEVERTEXATTRIBARRAY + gpDrawElements C.GPDRAWELEMENTS + gpEnable C.GPENABLE + gpEnableVertexAttribArray C.GPENABLEVERTEXATTRIBARRAY + gpFlush C.GPFLUSH + gpFramebufferRenderbufferEXT C.GPFRAMEBUFFERRENDERBUFFEREXT + gpFramebufferTexture2DEXT C.GPFRAMEBUFFERTEXTURE2DEXT + gpGenBuffers C.GPGENBUFFERS + gpGenFramebuffersEXT C.GPGENFRAMEBUFFERSEXT + gpGenRenderbuffersEXT C.GPGENRENDERBUFFERSEXT + gpGenTextures C.GPGENTEXTURES + gpGetError C.GPGETERROR + gpGetIntegerv C.GPGETINTEGERV + gpGetProgramInfoLog C.GPGETPROGRAMINFOLOG + gpGetProgramiv C.GPGETPROGRAMIV + gpGetShaderInfoLog C.GPGETSHADERINFOLOG + gpGetShaderiv C.GPGETSHADERIV + gpGetUniformLocation C.GPGETUNIFORMLOCATION + gpIsFramebufferEXT C.GPISFRAMEBUFFEREXT + gpIsProgram C.GPISPROGRAM + gpIsRenderbufferEXT C.GPISRENDERBUFFEREXT + gpIsTexture C.GPISTEXTURE + gpLinkProgram C.GPLINKPROGRAM + gpPixelStorei C.GPPIXELSTOREI + gpReadPixels C.GPREADPIXELS + gpRenderbufferStorageEXT C.GPRENDERBUFFERSTORAGEEXT + gpScissor C.GPSCISSOR + gpShaderSource C.GPSHADERSOURCE + gpStencilFunc C.GPSTENCILFUNC + gpStencilOp C.GPSTENCILOP + gpTexImage2D C.GPTEXIMAGE2D + gpTexParameteri C.GPTEXPARAMETERI + gpTexSubImage2D C.GPTEXSUBIMAGE2D + gpUniform1fv C.GPUNIFORM1FV + gpUniform1i C.GPUNIFORM1I + gpUniform1iv C.GPUNIFORM1IV + gpUniform2fv C.GPUNIFORM2FV + gpUniform3fv C.GPUNIFORM3FV + gpUniform4fv C.GPUNIFORM4FV + gpUniformMatrix2fv C.GPUNIFORMMATRIX2FV + gpUniformMatrix3fv C.GPUNIFORMMATRIX3FV + gpUniformMatrix4fv C.GPUNIFORMMATRIX4FV + gpUseProgram C.GPUSEPROGRAM + gpVertexAttribPointer C.GPVERTEXATTRIBPOINTER + gpViewport C.GPVIEWPORT ) func boolToInt(b bool) int { @@ -662,38 +602,15 @@ func GenTextures(n int32, textures *uint32) { C.glowGenTextures(gpGenTextures, (C.GLsizei)(n), (*C.GLuint)(unsafe.Pointer(textures))) } -func GetDoublei_v(target uint32, index uint32, data *float64) { - C.glowGetDoublei_v(gpGetDoublei_v, (C.GLenum)(target), (C.GLuint)(index), (*C.GLdouble)(unsafe.Pointer(data))) -} -func GetDoublei_vEXT(pname uint32, index uint32, params *float64) { - C.glowGetDoublei_vEXT(gpGetDoublei_vEXT, (C.GLenum)(pname), (C.GLuint)(index), (*C.GLdouble)(unsafe.Pointer(params))) -} - func GetError() uint32 { ret := C.glowGetError(gpGetError) return (uint32)(ret) } -func GetFloati_v(target uint32, index uint32, data *float32) { - C.glowGetFloati_v(gpGetFloati_v, (C.GLenum)(target), (C.GLuint)(index), (*C.GLfloat)(unsafe.Pointer(data))) -} -func GetFloati_vEXT(pname uint32, index uint32, params *float32) { - C.glowGetFloati_vEXT(gpGetFloati_vEXT, (C.GLenum)(pname), (C.GLuint)(index), (*C.GLfloat)(unsafe.Pointer(params))) -} -func GetIntegeri_v(target uint32, index uint32, data *int32) { - C.glowGetIntegeri_v(gpGetIntegeri_v, (C.GLenum)(target), (C.GLuint)(index), (*C.GLint)(unsafe.Pointer(data))) -} -func GetIntegerui64i_vNV(value uint32, index uint32, result *uint64) { - C.glowGetIntegerui64i_vNV(gpGetIntegerui64i_vNV, (C.GLenum)(value), (C.GLuint)(index), (*C.GLuint64EXT)(unsafe.Pointer(result))) -} func GetIntegerv(pname uint32, data *int32) { C.glowGetIntegerv(gpGetIntegerv, (C.GLenum)(pname), (*C.GLint)(unsafe.Pointer(data))) } -func GetPointeri_vEXT(pname uint32, index uint32, params *unsafe.Pointer) { - C.glowGetPointeri_vEXT(gpGetPointeri_vEXT, (C.GLenum)(pname), (C.GLuint)(index), params) -} - func GetProgramInfoLog(program uint32, bufSize int32, length *int32, infoLog *uint8) { C.glowGetProgramInfoLog(gpGetProgramInfoLog, (C.GLuint)(program), (C.GLsizei)(bufSize), (*C.GLsizei)(unsafe.Pointer(length)), (*C.GLchar)(unsafe.Pointer(infoLog))) } @@ -710,28 +627,11 @@ func GetShaderiv(shader uint32, pname uint32, params *int32) { C.glowGetShaderiv(gpGetShaderiv, (C.GLuint)(shader), (C.GLenum)(pname), (*C.GLint)(unsafe.Pointer(params))) } -func GetTransformFeedbacki64_v(xfb uint32, pname uint32, index uint32, param *int64) { - C.glowGetTransformFeedbacki64_v(gpGetTransformFeedbacki64_v, (C.GLuint)(xfb), (C.GLenum)(pname), (C.GLuint)(index), (*C.GLint64)(unsafe.Pointer(param))) -} -func GetTransformFeedbacki_v(xfb uint32, pname uint32, index uint32, param *int32) { - C.glowGetTransformFeedbacki_v(gpGetTransformFeedbacki_v, (C.GLuint)(xfb), (C.GLenum)(pname), (C.GLuint)(index), (*C.GLint)(unsafe.Pointer(param))) -} - func GetUniformLocation(program uint32, name *uint8) int32 { ret := C.glowGetUniformLocation(gpGetUniformLocation, (C.GLuint)(program), (*C.GLchar)(unsafe.Pointer(name))) return (int32)(ret) } -func GetUnsignedBytei_vEXT(target uint32, index uint32, data *uint8) { - C.glowGetUnsignedBytei_vEXT(gpGetUnsignedBytei_vEXT, (C.GLenum)(target), (C.GLuint)(index), (*C.GLubyte)(unsafe.Pointer(data))) -} -func GetVertexArrayIntegeri_vEXT(vaobj uint32, index uint32, pname uint32, param *int32) { - C.glowGetVertexArrayIntegeri_vEXT(gpGetVertexArrayIntegeri_vEXT, (C.GLuint)(vaobj), (C.GLuint)(index), (C.GLenum)(pname), (*C.GLint)(unsafe.Pointer(param))) -} -func GetVertexArrayPointeri_vEXT(vaobj uint32, index uint32, pname uint32, param *unsafe.Pointer) { - C.glowGetVertexArrayPointeri_vEXT(gpGetVertexArrayPointeri_vEXT, (C.GLuint)(vaobj), (C.GLuint)(index), (C.GLenum)(pname), param) -} - func IsFramebufferEXT(framebuffer uint32) bool { ret := C.glowIsFramebufferEXT(gpIsFramebufferEXT, (C.GLuint)(framebuffer)) return ret == glconst.TRUE @@ -962,21 +862,14 @@ func InitWithProcAddrFunc(getProcAddr func(name string) unsafe.Pointer) error { if gpGenTextures == nil { return errors.New("gl: glGenTextures is missing") } - gpGetDoublei_v = (C.GPGETDOUBLEI_V)(getProcAddr("glGetDoublei_v")) - gpGetDoublei_vEXT = (C.GPGETDOUBLEI_VEXT)(getProcAddr("glGetDoublei_vEXT")) gpGetError = (C.GPGETERROR)(getProcAddr("glGetError")) if gpGetError == nil { return errors.New("gl: glGetError is missing") } - gpGetFloati_v = (C.GPGETFLOATI_V)(getProcAddr("glGetFloati_v")) - gpGetFloati_vEXT = (C.GPGETFLOATI_VEXT)(getProcAddr("glGetFloati_vEXT")) - gpGetIntegeri_v = (C.GPGETINTEGERI_V)(getProcAddr("glGetIntegeri_v")) - gpGetIntegerui64i_vNV = (C.GPGETINTEGERUI64I_VNV)(getProcAddr("glGetIntegerui64i_vNV")) gpGetIntegerv = (C.GPGETINTEGERV)(getProcAddr("glGetIntegerv")) if gpGetIntegerv == nil { return errors.New("gl: glGetIntegerv is missing") } - gpGetPointeri_vEXT = (C.GPGETPOINTERI_VEXT)(getProcAddr("glGetPointeri_vEXT")) gpGetProgramInfoLog = (C.GPGETPROGRAMINFOLOG)(getProcAddr("glGetProgramInfoLog")) if gpGetProgramInfoLog == nil { return errors.New("gl: glGetProgramInfoLog is missing") @@ -993,15 +886,10 @@ func InitWithProcAddrFunc(getProcAddr func(name string) unsafe.Pointer) error { if gpGetShaderiv == nil { return errors.New("gl: glGetShaderiv is missing") } - gpGetTransformFeedbacki64_v = (C.GPGETTRANSFORMFEEDBACKI64_V)(getProcAddr("glGetTransformFeedbacki64_v")) - gpGetTransformFeedbacki_v = (C.GPGETTRANSFORMFEEDBACKI_V)(getProcAddr("glGetTransformFeedbacki_v")) gpGetUniformLocation = (C.GPGETUNIFORMLOCATION)(getProcAddr("glGetUniformLocation")) if gpGetUniformLocation == nil { return errors.New("gl: glGetUniformLocation is missing") } - gpGetUnsignedBytei_vEXT = (C.GPGETUNSIGNEDBYTEI_VEXT)(getProcAddr("glGetUnsignedBytei_vEXT")) - gpGetVertexArrayIntegeri_vEXT = (C.GPGETVERTEXARRAYINTEGERI_VEXT)(getProcAddr("glGetVertexArrayIntegeri_vEXT")) - gpGetVertexArrayPointeri_vEXT = (C.GPGETVERTEXARRAYPOINTERI_VEXT)(getProcAddr("glGetVertexArrayPointeri_vEXT")) gpIsFramebufferEXT = (C.GPISFRAMEBUFFEREXT)(getProcAddr("glIsFramebufferEXT")) gpIsProgram = (C.GPISPROGRAM)(getProcAddr("glIsProgram")) if gpIsProgram == nil { diff --git a/internal/graphicsdriver/opengl/gl/package_purego.go b/internal/graphicsdriver/opengl/gl/package_purego.go index 4f09be316..93205005c 100644 --- a/internal/graphicsdriver/opengl/gl/package_purego.go +++ b/internal/graphicsdriver/opengl/gl/package_purego.go @@ -12,87 +12,75 @@ import ( ) var ( - gpActiveTexture uintptr - gpAttachShader uintptr - gpBindAttribLocation uintptr - gpBindBuffer uintptr - gpBindFramebufferEXT uintptr - gpBindRenderbufferEXT uintptr - gpBindTexture uintptr - gpBlendEquationSeparate uintptr - gpBlendFuncSeparate uintptr - gpBufferData uintptr - gpBufferSubData uintptr - gpCheckFramebufferStatusEXT uintptr - gpClear uintptr - gpColorMask uintptr - gpCompileShader uintptr - gpCreateProgram uintptr - gpCreateShader uintptr - gpDeleteBuffers uintptr - gpDeleteFramebuffersEXT uintptr - gpDeleteProgram uintptr - gpDeleteRenderbuffersEXT uintptr - gpDeleteShader uintptr - gpDeleteTextures uintptr - gpDisable uintptr - gpDisableVertexAttribArray uintptr - gpDrawElements uintptr - gpEnable uintptr - gpEnableVertexAttribArray uintptr - gpFlush uintptr - gpFramebufferRenderbufferEXT uintptr - gpFramebufferTexture2DEXT uintptr - gpGenBuffers uintptr - gpGenFramebuffersEXT uintptr - gpGenRenderbuffersEXT uintptr - gpGenTextures uintptr - gpGetDoublei_v uintptr - gpGetDoublei_vEXT uintptr - gpGetError uintptr - gpGetFloati_v uintptr - gpGetFloati_vEXT uintptr - gpGetIntegeri_v uintptr - gpGetIntegerui64i_vNV uintptr - gpGetIntegerv uintptr - gpGetPointeri_vEXT uintptr - gpGetProgramInfoLog uintptr - gpGetProgramiv uintptr - gpGetShaderInfoLog uintptr - gpGetShaderiv uintptr - gpGetTransformFeedbacki64_v uintptr - gpGetTransformFeedbacki_v uintptr - gpGetUniformLocation uintptr - gpGetUnsignedBytei_vEXT uintptr - gpGetVertexArrayIntegeri_vEXT uintptr - gpGetVertexArrayPointeri_vEXT uintptr - gpIsFramebufferEXT uintptr - gpIsProgram uintptr - gpIsRenderbufferEXT uintptr - gpIsTexture uintptr - gpLinkProgram uintptr - gpPixelStorei uintptr - gpReadPixels uintptr - gpRenderbufferStorageEXT uintptr - gpScissor uintptr - gpShaderSource uintptr - gpStencilFunc uintptr - gpStencilOp uintptr - gpTexImage2D uintptr - gpTexParameteri uintptr - gpTexSubImage2D uintptr - gpUniform1fv uintptr - gpUniform1i uintptr - gpUniform1iv uintptr - gpUniform2fv uintptr - gpUniform3fv uintptr - gpUniform4fv uintptr - gpUniformMatrix2fv uintptr - gpUniformMatrix3fv uintptr - gpUniformMatrix4fv uintptr - gpUseProgram uintptr - gpVertexAttribPointer uintptr - gpViewport uintptr + gpActiveTexture uintptr + gpAttachShader uintptr + gpBindAttribLocation uintptr + gpBindBuffer uintptr + gpBindFramebufferEXT uintptr + gpBindRenderbufferEXT uintptr + gpBindTexture uintptr + gpBlendEquationSeparate uintptr + gpBlendFuncSeparate uintptr + gpBufferData uintptr + gpBufferSubData uintptr + gpCheckFramebufferStatusEXT uintptr + gpClear uintptr + gpColorMask uintptr + gpCompileShader uintptr + gpCreateProgram uintptr + gpCreateShader uintptr + gpDeleteBuffers uintptr + gpDeleteFramebuffersEXT uintptr + gpDeleteProgram uintptr + gpDeleteRenderbuffersEXT uintptr + gpDeleteShader uintptr + gpDeleteTextures uintptr + gpDisable uintptr + gpDisableVertexAttribArray uintptr + gpDrawElements uintptr + gpEnable uintptr + gpEnableVertexAttribArray uintptr + gpFlush uintptr + gpFramebufferRenderbufferEXT uintptr + gpFramebufferTexture2DEXT uintptr + gpGenBuffers uintptr + gpGenFramebuffersEXT uintptr + gpGenRenderbuffersEXT uintptr + gpGenTextures uintptr + gpGetError uintptr + gpGetIntegerv uintptr + gpGetProgramInfoLog uintptr + gpGetProgramiv uintptr + gpGetShaderInfoLog uintptr + gpGetShaderiv uintptr + gpGetUniformLocation uintptr + gpIsFramebufferEXT uintptr + gpIsProgram uintptr + gpIsRenderbufferEXT uintptr + gpIsTexture uintptr + gpLinkProgram uintptr + gpPixelStorei uintptr + gpReadPixels uintptr + gpRenderbufferStorageEXT uintptr + gpScissor uintptr + gpShaderSource uintptr + gpStencilFunc uintptr + gpStencilOp uintptr + gpTexImage2D uintptr + gpTexParameteri uintptr + gpTexSubImage2D uintptr + gpUniform1fv uintptr + gpUniform1i uintptr + gpUniform1iv uintptr + gpUniform2fv uintptr + gpUniform3fv uintptr + gpUniform4fv uintptr + gpUniformMatrix2fv uintptr + gpUniformMatrix3fv uintptr + gpUniformMatrix4fv uintptr + gpUseProgram uintptr + gpVertexAttribPointer uintptr + gpViewport uintptr ) func boolToInt(b bool) int { @@ -245,38 +233,15 @@ func GenTextures(n int32, textures *uint32) { purego.SyscallN(gpGenTextures, uintptr(n), uintptr(unsafe.Pointer(textures))) } -func GetDoublei_v(target uint32, index uint32, data *float64) { - purego.SyscallN(gpGetDoublei_v, uintptr(target), uintptr(index), uintptr(unsafe.Pointer(data))) -} -func GetDoublei_vEXT(pname uint32, index uint32, params *float64) { - purego.SyscallN(gpGetDoublei_vEXT, uintptr(pname), uintptr(index), uintptr(unsafe.Pointer(params))) -} - func GetError() uint32 { ret, _, _ := purego.SyscallN(gpGetError) return uint32(ret) } -func GetFloati_v(target uint32, index uint32, data *float32) { - purego.SyscallN(gpGetFloati_v, uintptr(target), uintptr(index), uintptr(unsafe.Pointer(data))) -} -func GetFloati_vEXT(pname uint32, index uint32, params *float32) { - purego.SyscallN(gpGetFloati_vEXT, uintptr(pname), uintptr(index), uintptr(unsafe.Pointer(params))) -} -func GetIntegeri_v(target uint32, index uint32, data *int32) { - purego.SyscallN(gpGetIntegeri_v, uintptr(target), uintptr(index), uintptr(unsafe.Pointer(data))) -} -func GetIntegerui64i_vNV(value uint32, index uint32, result *uint64) { - purego.SyscallN(gpGetIntegerui64i_vNV, uintptr(value), uintptr(index), uintptr(unsafe.Pointer(result))) -} func GetIntegerv(pname uint32, data *int32) { purego.SyscallN(gpGetIntegerv, uintptr(pname), uintptr(unsafe.Pointer(data))) } -func GetPointeri_vEXT(pname uint32, index uint32, params *unsafe.Pointer) { - purego.SyscallN(gpGetPointeri_vEXT, uintptr(pname), uintptr(index), uintptr(unsafe.Pointer(params))) -} - func GetProgramInfoLog(program uint32, bufSize int32, length *int32, infoLog *uint8) { purego.SyscallN(gpGetProgramInfoLog, uintptr(program), uintptr(bufSize), uintptr(unsafe.Pointer(length)), uintptr(unsafe.Pointer(infoLog))) } @@ -293,28 +258,11 @@ func GetShaderiv(shader uint32, pname uint32, params *int32) { purego.SyscallN(gpGetShaderiv, uintptr(shader), uintptr(pname), uintptr(unsafe.Pointer(params))) } -func GetTransformFeedbacki64_v(xfb uint32, pname uint32, index uint32, param *int64) { - purego.SyscallN(gpGetTransformFeedbacki64_v, uintptr(xfb), uintptr(pname), uintptr(index), uintptr(unsafe.Pointer(param))) -} -func GetTransformFeedbacki_v(xfb uint32, pname uint32, index uint32, param *int32) { - purego.SyscallN(gpGetTransformFeedbacki_v, uintptr(xfb), uintptr(pname), uintptr(index), uintptr(unsafe.Pointer(param))) -} - func GetUniformLocation(program uint32, name *uint8) int32 { ret, _, _ := purego.SyscallN(gpGetUniformLocation, uintptr(program), uintptr(unsafe.Pointer(name))) return int32(ret) } -func GetUnsignedBytei_vEXT(target uint32, index uint32, data *uint8) { - purego.SyscallN(gpGetUnsignedBytei_vEXT, uintptr(target), uintptr(index), uintptr(unsafe.Pointer(data))) -} -func GetVertexArrayIntegeri_vEXT(vaobj uint32, index uint32, pname uint32, param *int32) { - purego.SyscallN(gpGetVertexArrayIntegeri_vEXT, uintptr(vaobj), uintptr(index), uintptr(pname), uintptr(unsafe.Pointer(param))) -} -func GetVertexArrayPointeri_vEXT(vaobj uint32, index uint32, pname uint32, param *unsafe.Pointer) { - purego.SyscallN(gpGetVertexArrayPointeri_vEXT, uintptr(vaobj), uintptr(index), uintptr(pname), uintptr(unsafe.Pointer(param))) -} - func IsFramebufferEXT(framebuffer uint32) bool { ret, _, _ := purego.SyscallN(gpIsFramebufferEXT, uintptr(framebuffer)) return byte(ret) != 0 @@ -545,21 +493,14 @@ func InitWithProcAddrFunc(getProcAddr func(name string) uintptr) error { if gpGenTextures == 0 { return errors.New("gl: glGenTextures is missing") } - gpGetDoublei_v = getProcAddr("glGetDoublei_v") - gpGetDoublei_vEXT = getProcAddr("glGetDoublei_vEXT") gpGetError = getProcAddr("glGetError") if gpGetError == 0 { return errors.New("gl: glGetError is missing") } - gpGetFloati_v = getProcAddr("glGetFloati_v") - gpGetFloati_vEXT = getProcAddr("glGetFloati_vEXT") - gpGetIntegeri_v = getProcAddr("glGetIntegeri_v") - gpGetIntegerui64i_vNV = getProcAddr("glGetIntegerui64i_vNV") gpGetIntegerv = getProcAddr("glGetIntegerv") if gpGetIntegerv == 0 { return errors.New("gl: glGetIntegerv is missing") } - gpGetPointeri_vEXT = getProcAddr("glGetPointeri_vEXT") gpGetProgramInfoLog = getProcAddr("glGetProgramInfoLog") if gpGetProgramInfoLog == 0 { return errors.New("gl: glGetProgramInfoLog is missing") @@ -576,15 +517,10 @@ func InitWithProcAddrFunc(getProcAddr func(name string) uintptr) error { if gpGetShaderiv == 0 { return errors.New("gl: glGetShaderiv is missing") } - gpGetTransformFeedbacki64_v = getProcAddr("glGetTransformFeedbacki64_v") - gpGetTransformFeedbacki_v = getProcAddr("glGetTransformFeedbacki_v") gpGetUniformLocation = getProcAddr("glGetUniformLocation") if gpGetUniformLocation == 0 { return errors.New("gl: glGetUniformLocation is missing") } - gpGetUnsignedBytei_vEXT = getProcAddr("glGetUnsignedBytei_vEXT") - gpGetVertexArrayIntegeri_vEXT = getProcAddr("glGetVertexArrayIntegeri_vEXT") - gpGetVertexArrayPointeri_vEXT = getProcAddr("glGetVertexArrayPointeri_vEXT") gpIsFramebufferEXT = getProcAddr("glIsFramebufferEXT") gpIsProgram = getProcAddr("glIsProgram") if gpIsProgram == 0 { diff --git a/internal/graphicsdriver/opengl/gles/default.go b/internal/graphicsdriver/opengl/gles/default.go index 077618f16..04911ba4a 100644 --- a/internal/graphicsdriver/opengl/gles/default.go +++ b/internal/graphicsdriver/opengl/gles/default.go @@ -211,10 +211,6 @@ func (DefaultContext) GetIntegerv(dst []int32, pname uint32) { C.glGetIntegerv(C.GLenum(pname), (*C.GLint)(unsafe.Pointer(&dst[0]))) } -func (DefaultContext) GetProgramiv(dst []int32, program uint32, pname uint32) { - C.glGetProgramiv(C.GLuint(program), C.GLenum(pname), (*C.GLint)(unsafe.Pointer(&dst[0]))) -} - func (d DefaultContext) GetProgramInfoLog(program uint32) string { buflens := make([]int32, 1) d.GetProgramiv(buflens, program, glconst.INFO_LOG_LENGTH) @@ -228,8 +224,8 @@ func (d DefaultContext) GetProgramInfoLog(program uint32) string { return string(buf[:length]) } -func (DefaultContext) GetShaderiv(dst []int32, shader uint32, pname uint32) { - C.glGetShaderiv(C.GLuint(shader), C.GLenum(pname), (*C.GLint)(unsafe.Pointer(&dst[0]))) +func (DefaultContext) GetProgramiv(dst []int32, program uint32, pname uint32) { + C.glGetProgramiv(C.GLuint(program), C.GLenum(pname), (*C.GLint)(unsafe.Pointer(&dst[0]))) } func (d DefaultContext) GetShaderInfoLog(shader uint32) string { @@ -245,6 +241,10 @@ func (d DefaultContext) GetShaderInfoLog(shader uint32) string { return string(buf[:length]) } +func (DefaultContext) GetShaderiv(dst []int32, shader uint32, pname uint32) { + C.glGetShaderiv(C.GLuint(shader), C.GLenum(pname), (*C.GLint)(unsafe.Pointer(&dst[0]))) +} + func (DefaultContext) GetShaderPrecisionFormat(shadertype uint32, precisiontype uint32) (rangeLow, rangeHigh, precision int) { var r [2]int32 var p int32 diff --git a/internal/graphicsdriver/opengl/gles/gomobile.go b/internal/graphicsdriver/opengl/gles/gomobile.go index 5f346bd2d..11bed6b23 100644 --- a/internal/graphicsdriver/opengl/gles/gomobile.go +++ b/internal/graphicsdriver/opengl/gles/gomobile.go @@ -214,22 +214,22 @@ func (g *GomobileContext) GetIntegerv(dst []int32, pname uint32) { g.ctx.GetIntegerv(dst, gl.Enum(pname)) } -func (g *GomobileContext) GetProgramiv(dst []int32, program uint32, pname uint32) { - dst[0] = int32(g.ctx.GetProgrami(gmProgram(program), gl.Enum(pname))) -} - func (g *GomobileContext) GetProgramInfoLog(program uint32) string { return g.ctx.GetProgramInfoLog(gmProgram(program)) } -func (g *GomobileContext) GetShaderiv(dst []int32, shader uint32, pname uint32) { - dst[0] = int32(g.ctx.GetShaderi(gl.Shader{Value: shader}, gl.Enum(pname))) +func (g *GomobileContext) GetProgramiv(dst []int32, program uint32, pname uint32) { + dst[0] = int32(g.ctx.GetProgrami(gmProgram(program), gl.Enum(pname))) } func (g *GomobileContext) GetShaderInfoLog(shader uint32) string { return g.ctx.GetShaderInfoLog(gl.Shader{Value: shader}) } +func (g *GomobileContext) GetShaderiv(dst []int32, shader uint32, pname uint32) { + dst[0] = int32(g.ctx.GetShaderi(gl.Shader{Value: shader}, gl.Enum(pname))) +} + func (g *GomobileContext) GetShaderPrecisionFormat(shadertype uint32, precisiontype uint32) (rangeLow, rangeHigh, precision int) { return g.ctx.GetShaderPrecisionFormat(gl.Enum(shadertype), gl.Enum(precisiontype)) } diff --git a/internal/graphicsdriver/opengl/gles/interface.go b/internal/graphicsdriver/opengl/gles/interface.go index b4704f370..34c0587c6 100644 --- a/internal/graphicsdriver/opengl/gles/interface.go +++ b/internal/graphicsdriver/opengl/gles/interface.go @@ -53,10 +53,10 @@ type Context interface { GenTextures(n int32) []uint32 GetError() uint32 GetIntegerv(dst []int32, pname uint32) - GetProgramiv(dst []int32, program uint32, pname uint32) GetProgramInfoLog(program uint32) string - GetShaderiv(dst []int32, shader uint32, pname uint32) + GetProgramiv(dst []int32, program uint32, pname uint32) GetShaderInfoLog(shader uint32) string + GetShaderiv(dst []int32, shader uint32, pname uint32) GetShaderPrecisionFormat(shadertype uint32, precisiontype uint32) (rangeLow, rangeHigh, precision int) GetUniformLocation(program uint32, name string) int32 IsFramebuffer(framebuffer uint32) bool