internal/graphicsdriver/opengl: refactoring

This commit is contained in:
Hajime Hoshi 2024-11-07 13:25:26 +09:00
parent 4be626f707
commit b6d539d8e8

View File

@ -43,19 +43,19 @@ func isGLXExtensionForGL2Available() bool {
var listingExtensions bool var listingExtensions bool
s := bufio.NewScanner(&buf) s := bufio.NewScanner(&buf)
for s.Scan() { for s.Scan() {
line := s.Text()
if !listingExtensions { if !listingExtensions {
if s.Text() == "GLX extensions:" { if line == "GLX extensions:" {
listingExtensions = true listingExtensions = true
} }
continue continue
} }
if !strings.HasPrefix(s.Text(), indent) { if !strings.HasPrefix(line, indent) {
listingExtensions = false listingExtensions = false
break break
} }
line := s.Text()
for len(line) > 0 { for len(line) > 0 {
head, tail, _ := strings.Cut(line, ",") head, tail, _ := strings.Cut(line, ",")
if strings.TrimSpace(head) == ext { if strings.TrimSpace(head) == ext {