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 {
if c.isES {
const ext = "EXT"
if strings.HasSuffix(name, ext) {
name = name[:len(name)-len(ext)]
}
name = strings.TrimSuffix(name, "EXT")
}
return purego.Dlsym(opengl, name)
}

View File

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