Skip to content

Commit

Permalink
add check for valid msaa values in NewWindow()
Browse files Browse the repository at this point in the history
  • Loading branch information
cebarks committed Aug 16, 2021
1 parent 7615c05 commit f6e2f3a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions pixelgl/window.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package pixelgl

import (
"fmt"
"image"
"image/color"
"runtime"
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit f6e2f3a

Please sign in to comment.