add check for valid msaa values in NewWindow()

This commit is contained in:
Anten Skrabec 2021-08-15 23:31:06 -06:00
parent 7615c055cf
commit f6e2f3a8d8
1 changed files with 12 additions and 0 deletions

View File

@ -1,6 +1,7 @@
package pixelgl
import (
"fmt"
"image"
"image/color"
"runtime"
@ -123,6 +124,17 @@ func NewWindow(cfg WindowConfig) (*Window, error) {
w := &Window{bounds: cfg.Bounds, cursorVisible: true}
flag := false
for _, v := range []int{0, 2, 4, 8, 16} {
if cfg.SamplesMSAA == v {
flag = true
break
}
}
if !flag {
return nil, fmt.Errorf("invalid value '%v' for msaaSamples", cfg.SamplesMSAA)
}
err := mainthread.CallErr(func() error {
var err error