internal/graphicsdriver/opengl/gl: refactoring

This commit is contained in:
Hajime Hoshi 2022-11-15 02:38:38 +09:00
parent 0d8912e7ae
commit 056042ca92
2 changed files with 2 additions and 6 deletions

View File

@ -40,10 +40,7 @@ func (c *defaultContext) init() error {
func (c *defaultContext) getProcAddress(name string) uintptr { func (c *defaultContext) getProcAddress(name string) uintptr {
if c.isES { if c.isES {
const ext = "EXT" name = strings.TrimSuffix(name, "EXT")
if strings.HasSuffix(name, ext) {
name = name[:len(name)-len(ext)]
}
} }
return purego.Dlsym(opengl, name) return purego.Dlsym(opengl, name)
} }

View File

@ -106,9 +106,8 @@ func getProcAddressGL(name string) unsafe.Pointer {
} }
func getProcAddressGLES(name string) unsafe.Pointer { func getProcAddressGLES(name string) unsafe.Pointer {
const ext = "EXT"
if strings.HasSuffix(name, ext) { if strings.HasSuffix(name, ext) {
name = name[:len(name)-len(ext)] name = strings.TrimSuffix(name, "EXT")
} }
cname := C.CString(name) cname := C.CString(name)
defer C.free(unsafe.Pointer(cname)) defer C.free(unsafe.Pointer(cname))