mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 10:48:53 +01:00
graphics: Check the number of vertices
This commit is contained in:
parent
1ccdfd9a35
commit
aa83167e56
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user