diff --git a/internal/graphics/command.go b/internal/graphics/command.go index 0f7dbc2a7..04f17cdad 100644 --- a/internal/graphics/command.go +++ b/internal/graphics/command.go @@ -49,10 +49,12 @@ func (q *commandQueue) Flush(context *opengl.Context) error { vertices = append(vertices, c.vertices...) } } - // TODO: Check if len(vertices) is too big if 0 < len(vertices) { context.BufferSubData(context.ArrayBuffer, vertices) } + if MaxQuads < len(vertices)/16 { + return errors.New(fmt.Sprintf("len(quads) must be equal to or less than %d", MaxQuads)) + } for _, c := range q.commands { if err := c.Exec(context); err != nil { return err @@ -101,9 +103,6 @@ func (c *drawImageCommand) Exec(context *opengl.Context) error { if n == 0 { return nil } - if MaxQuads < n/16 { - return errors.New(fmt.Sprintf("len(quads) must be equal to or less than %d", MaxQuads)) - } p := programContext{ state: &theOpenGLState,