mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
internal/graphicsdriver/opengl: Avoid allocations by escaping to heap
This commit is contained in:
parent
a3eb8933e5
commit
7661147e31
@ -418,7 +418,9 @@ func (c *context) uniformFloats(p program, location string, v []float32, typ sha
|
|||||||
case shaderir.Mat4:
|
case shaderir.Mat4:
|
||||||
gl.UniformMatrix4fv(l, len, false, (*float32)(gl.Ptr(v)))
|
gl.UniformMatrix4fv(l, len, false, (*float32)(gl.Ptr(v)))
|
||||||
default:
|
default:
|
||||||
panic(fmt.Sprintf("opengl: unexpected type: %s", typ.String()))
|
// Copy shaderir.Type value to avoid heap allocation of typ.
|
||||||
|
t := typ
|
||||||
|
panic(fmt.Sprintf("opengl: unexpected type: %s", t.String()))
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -384,7 +384,9 @@ func (c *context) uniformFloats(p program, location string, v []float32, typ sha
|
|||||||
case shaderir.Mat4:
|
case shaderir.Mat4:
|
||||||
c.ctx.UniformMatrix4fv(int32(l), false, v)
|
c.ctx.UniformMatrix4fv(int32(l), false, v)
|
||||||
default:
|
default:
|
||||||
panic(fmt.Sprintf("opengl: unexpected type: %s", typ.String()))
|
// Copy shaderir.Type value to avoid heap allocation of typ.
|
||||||
|
t := typ
|
||||||
|
panic(fmt.Sprintf("opengl: unexpected type: %s", t.String()))
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user