From fd4cdd445cf310ac9c4589a80338d7534ad6ad48 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Thu, 17 Jan 2019 21:27:58 +0900 Subject: [PATCH] graphicsdriver/opengl/gl: Unexport or remove C symbols (#786) --- .../opengl/gl/conversions_notwindows.go | 2 +- .../opengl/gl/conversions_windows.go | 2 +- .../opengl/gl/debug_notwindows.go | 33 ------------------- .../graphicsdriver/opengl/gl/debug_windows.go | 14 -------- internal/graphicsdriver/opengl/gl/package.go | 2 +- .../opengl/gl/package_notwindows.go | 26 +++++++-------- .../opengl/gl/package_windows.go | 13 +++++--- .../opengl/gl/procaddr_notwindows.go | 8 ++--- .../opengl/gl/procaddr_windows.go | 2 +- 9 files changed, 29 insertions(+), 73 deletions(-) delete mode 100644 internal/graphicsdriver/opengl/gl/debug_notwindows.go delete mode 100644 internal/graphicsdriver/opengl/gl/debug_windows.go diff --git a/internal/graphicsdriver/opengl/gl/conversions_notwindows.go b/internal/graphicsdriver/opengl/gl/conversions_notwindows.go index 9765f651f..06074a7be 100644 --- a/internal/graphicsdriver/opengl/gl/conversions_notwindows.go +++ b/internal/graphicsdriver/opengl/gl/conversions_notwindows.go @@ -1,6 +1,6 @@ // +build !windows -// Code generated by glow (https://github.com/go-gl/glow). DO NOT EDIT. +// Code generated by glow (https://github.com/hajimehoshi/glow's for_ebiten branch). DO NOT EDIT. package gl diff --git a/internal/graphicsdriver/opengl/gl/conversions_windows.go b/internal/graphicsdriver/opengl/gl/conversions_windows.go index 6a04cecfc..55dd6fcc1 100644 --- a/internal/graphicsdriver/opengl/gl/conversions_windows.go +++ b/internal/graphicsdriver/opengl/gl/conversions_windows.go @@ -1,6 +1,6 @@ // +build windows -// Code generated by glow (https://github.com/go-gl/glow). DO NOT EDIT. +// Code generated by glow (https://github.com/hajimehoshi/glow's for_ebiten branch). DO NOT EDIT. package gl diff --git a/internal/graphicsdriver/opengl/gl/debug_notwindows.go b/internal/graphicsdriver/opengl/gl/debug_notwindows.go deleted file mode 100644 index 4bb6473f6..000000000 --- a/internal/graphicsdriver/opengl/gl/debug_notwindows.go +++ /dev/null @@ -1,33 +0,0 @@ -// +build !windows - -// Code generated by glow (https://github.com/go-gl/glow). DO NOT EDIT. - -package gl - -import "C" -import "unsafe" - -type DebugProc func( - source uint32, - gltype uint32, - id uint32, - severity uint32, - length int32, - message string, - userParam unsafe.Pointer) - -var userDebugCallback DebugProc - -//export glowDebugCallback_gl21 -func glowDebugCallback_gl21( - source uint32, - gltype uint32, - id uint32, - severity uint32, - length int32, - message *uint8, - userParam unsafe.Pointer) { - if userDebugCallback != nil { - userDebugCallback(source, gltype, id, severity, length, GoStr(message), userParam) - } -} diff --git a/internal/graphicsdriver/opengl/gl/debug_windows.go b/internal/graphicsdriver/opengl/gl/debug_windows.go deleted file mode 100644 index 8b7d4b974..000000000 --- a/internal/graphicsdriver/opengl/gl/debug_windows.go +++ /dev/null @@ -1,14 +0,0 @@ -// Code generated by glow (https://github.com/go-gl/glow). DO NOT EDIT. - -package gl - -import "unsafe" - -type DebugProc func( - source uint32, - gltype uint32, - id uint32, - severity uint32, - length int32, - message string, - userParam unsafe.Pointer) diff --git a/internal/graphicsdriver/opengl/gl/package.go b/internal/graphicsdriver/opengl/gl/package.go index d6fe92cc1..951550f14 100644 --- a/internal/graphicsdriver/opengl/gl/package.go +++ b/internal/graphicsdriver/opengl/gl/package.go @@ -1,4 +1,4 @@ -// Code generated by glow (https://github.com/go-gl/glow). DO NOT EDIT. +// Code generated by glow (https://github.com/hajimehoshi/glow's for_ebiten branch). DO NOT EDIT. // Copyright (c) 2010 Khronos Group. // This material may be distributed subject to the terms and conditions diff --git a/internal/graphicsdriver/opengl/gl/package_notwindows.go b/internal/graphicsdriver/opengl/gl/package_notwindows.go index fbe5d02c5..86de4fab4 100644 --- a/internal/graphicsdriver/opengl/gl/package_notwindows.go +++ b/internal/graphicsdriver/opengl/gl/package_notwindows.go @@ -1,6 +1,6 @@ // +build !windows -// Code generated by glow (https://github.com/go-gl/glow). DO NOT EDIT. +// Code generated by glow (https://github.com/hajimehoshi/glow's for_ebiten branch). DO NOT EDIT. package gl @@ -103,10 +103,6 @@ package gl // typedef unsigned short GLhalfNV; // typedef GLintptr GLvdpauSurfaceNV; // typedef void (APIENTRY *GLVULKANPROCNV)(void); -// extern void glowDebugCallback_gl21(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, const void* userParam); -// static void APIENTRY glowCDebugCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, const void* userParam) { -// glowDebugCallback_gl21(source, type, id, severity, length, message, userParam); -// } // typedef void (APIENTRYP GPACCUM)(GLenum op, GLfloat value); // typedef void (APIENTRYP GPACCUMXOES)(GLenum op, GLfixed value); // typedef GLboolean (APIENTRYP GPACQUIREKEYEDMUTEXWIN32EXT)(GLuint memory, GLuint64 key, GLuint timeout); @@ -3971,16 +3967,16 @@ package gl // (*fnptr)(index); // } // static void glowDebugMessageCallback(GPDEBUGMESSAGECALLBACK fnptr, GLDEBUGPROC callback, const void * userParam) { -// (*fnptr)(glowCDebugCallback, userParam); +// (*fnptr)(callback, userParam); // } // static void glowDebugMessageCallbackAMD(GPDEBUGMESSAGECALLBACKAMD fnptr, GLDEBUGPROCAMD callback, void * userParam) { // (*fnptr)(callback, userParam); // } // static void glowDebugMessageCallbackARB(GPDEBUGMESSAGECALLBACKARB fnptr, GLDEBUGPROCARB callback, const void * userParam) { -// (*fnptr)(glowCDebugCallback, userParam); +// (*fnptr)(callback, userParam); // } // static void glowDebugMessageCallbackKHR(GPDEBUGMESSAGECALLBACKKHR fnptr, GLDEBUGPROCKHR callback, const void * userParam) { -// (*fnptr)(glowCDebugCallback, userParam); +// (*fnptr)(callback, userParam); // } // static void glowDebugMessageControl(GPDEBUGMESSAGECONTROL fnptr, GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint * ids, GLboolean enabled) { // (*fnptr)(source, type, severity, count, ids, enabled); @@ -15369,8 +15365,8 @@ func CurrentPaletteMatrixARB(index int32) { } // specify a callback to receive debugging messages from the GL -func DebugMessageCallback(callback DebugProc, userParam unsafe.Pointer) { - userDebugCallback = callback +// Parameter callback has type C.GLDEBUGPROC. +func DebugMessageCallback(callback unsafe.Pointer, userParam unsafe.Pointer) { C.glowDebugMessageCallback(gpDebugMessageCallback, (C.GLDEBUGPROC)(unsafe.Pointer(&callback)), userParam) } @@ -15378,12 +15374,14 @@ func DebugMessageCallback(callback DebugProc, userParam unsafe.Pointer) { func DebugMessageCallbackAMD(callback unsafe.Pointer, userParam unsafe.Pointer) { C.glowDebugMessageCallbackAMD(gpDebugMessageCallbackAMD, (C.GLDEBUGPROCAMD)(callback), userParam) } -func DebugMessageCallbackARB(callback DebugProc, userParam unsafe.Pointer) { - userDebugCallback = callback + +// Parameter callback has type C.GLDEBUGPROCARB. +func DebugMessageCallbackARB(callback unsafe.Pointer, userParam unsafe.Pointer) { C.glowDebugMessageCallbackARB(gpDebugMessageCallbackARB, (C.GLDEBUGPROCARB)(unsafe.Pointer(&callback)), userParam) } -func DebugMessageCallbackKHR(callback DebugProc, userParam unsafe.Pointer) { - userDebugCallback = callback + +// Parameter callback has type C.GLDEBUGPROCKHR. +func DebugMessageCallbackKHR(callback unsafe.Pointer, userParam unsafe.Pointer) { C.glowDebugMessageCallbackKHR(gpDebugMessageCallbackKHR, (C.GLDEBUGPROCKHR)(unsafe.Pointer(&callback)), userParam) } diff --git a/internal/graphicsdriver/opengl/gl/package_windows.go b/internal/graphicsdriver/opengl/gl/package_windows.go index cbc8ec66d..f95193f13 100644 --- a/internal/graphicsdriver/opengl/gl/package_windows.go +++ b/internal/graphicsdriver/opengl/gl/package_windows.go @@ -1,4 +1,4 @@ -// Code generated by glow (https://github.com/go-gl/glow). DO NOT EDIT. +// Code generated by glow (https://github.com/hajimehoshi/glow's for_ebiten branch). DO NOT EDIT. package gl @@ -4108,7 +4108,8 @@ func CurrentPaletteMatrixARB(index int32) { } // specify a callback to receive debugging messages from the GL -func DebugMessageCallback(callback DebugProc, userParam unsafe.Pointer) { +// Parameter callback has type C.GLDEBUGPROC. +func DebugMessageCallback(callback unsafe.Pointer, userParam unsafe.Pointer) { syscall.Syscall(gpDebugMessageCallback, 2, syscall.NewCallback(callback), uintptr(userParam), 0) } @@ -4116,10 +4117,14 @@ func DebugMessageCallback(callback DebugProc, userParam unsafe.Pointer) { func DebugMessageCallbackAMD(callback unsafe.Pointer, userParam unsafe.Pointer) { syscall.Syscall(gpDebugMessageCallbackAMD, 2, uintptr(callback), uintptr(userParam), 0) } -func DebugMessageCallbackARB(callback DebugProc, userParam unsafe.Pointer) { + +// Parameter callback has type C.GLDEBUGPROCARB. +func DebugMessageCallbackARB(callback unsafe.Pointer, userParam unsafe.Pointer) { syscall.Syscall(gpDebugMessageCallbackARB, 2, syscall.NewCallback(callback), uintptr(userParam), 0) } -func DebugMessageCallbackKHR(callback DebugProc, userParam unsafe.Pointer) { + +// Parameter callback has type C.GLDEBUGPROCKHR. +func DebugMessageCallbackKHR(callback unsafe.Pointer, userParam unsafe.Pointer) { syscall.Syscall(gpDebugMessageCallbackKHR, 2, syscall.NewCallback(callback), uintptr(userParam), 0) } diff --git a/internal/graphicsdriver/opengl/gl/procaddr_notwindows.go b/internal/graphicsdriver/opengl/gl/procaddr_notwindows.go index bd6abbb9c..e5f5643d6 100644 --- a/internal/graphicsdriver/opengl/gl/procaddr_notwindows.go +++ b/internal/graphicsdriver/opengl/gl/procaddr_notwindows.go @@ -1,6 +1,6 @@ // +build !windows -// Code generated by glow (https://github.com/go-gl/glow). DO NOT EDIT. +// Code generated by glow (https://github.com/hajimehoshi/glow's for_ebiten branch). DO NOT EDIT. // This file implements GlowGetProcAddress for every supported platform. The // correct version is chosen automatically based on build tags: @@ -28,19 +28,19 @@ package gl #if defined(TAG_EGL) #include #include - void* GlowGetProcAddress_gl21(const char* name) { + static void* GlowGetProcAddress_gl21(const char* name) { return eglGetProcAddress(name); } #elif defined(TAG_DARWIN) #include #include - void* GlowGetProcAddress_gl21(const char* name) { + static void* GlowGetProcAddress_gl21(const char* name) { return dlsym(RTLD_DEFAULT, name); } #elif defined(TAG_POSIX) #include #include - void* GlowGetProcAddress_gl21(const char* name) { + static void* GlowGetProcAddress_gl21(const char* name) { return glXGetProcAddress((const GLubyte *) name); } #endif diff --git a/internal/graphicsdriver/opengl/gl/procaddr_windows.go b/internal/graphicsdriver/opengl/gl/procaddr_windows.go index cd86743f6..ab2221bc5 100644 --- a/internal/graphicsdriver/opengl/gl/procaddr_windows.go +++ b/internal/graphicsdriver/opengl/gl/procaddr_windows.go @@ -1,4 +1,4 @@ -// Code generated by glow (https://github.com/go-gl/glow). DO NOT EDIT. +// Code generated by glow (https://github.com/hajimehoshi/glow's for_ebiten branch). DO NOT EDIT. package gl