* LablGL question
@ 2007-09-02 17:41 Brian Hurt
2007-09-03 1:37 ` [Caml-list] " Jacques Garrigue
0 siblings, 1 reply; 3+ messages in thread
From: Brian Hurt @ 2007-09-02 17:41 UTC (permalink / raw)
To: caml-list
Is there a reason why, in gl.mli, point3 is defined as a tuple, and not a
structure or array or other datatype that holds floats unboxed? Having it
an unboxed type would be a double advantage- unboxing in Ocaml, and the
ability to call the vector vectors on the openGL side of things without
having to copy the data.
Just wondering...
Brian
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Caml-list] LablGL question
2007-09-02 17:41 LablGL question Brian Hurt
@ 2007-09-03 1:37 ` Jacques Garrigue
2007-09-03 1:50 ` Carlos Scheidegger
0 siblings, 1 reply; 3+ messages in thread
From: Jacques Garrigue @ 2007-09-03 1:37 UTC (permalink / raw)
To: bhurt; +Cc: caml-list
From: Brian Hurt <bhurt@spnz.org>
> Is there a reason why, in gl.mli, point3 is defined as a tuple, and not a
> structure or array or other datatype that holds floats unboxed? Having it
> an unboxed type would be a double advantage- unboxing in Ocaml, and the
> ability to call the vector vectors on the openGL side of things without
> having to copy the data.
No deep reason. Just that performance of function calls was not the
main motivation, but rather ease of use.
Note also that
* boxing in caml does not matter that much, as functions using point3
take only one argument of this type, and there are no arrays of
points in the API (in that case raw arrays are used, which are
unboxed).
* ocaml arrays and structures are indeed unboxed, but on some
architectures you cannot cast them to (double*) because of alignment
restrictions. So at least on those architectures copying is needed.
(Well, looking at the glx code in Mesa this seems unnecessary with
X11, because it doesn't load those values to registers, but being
optimal would be complex indeed.)
If performance is you concern, you can use GlArray.vertex to draw a
full array of unboxed vertices in one step.
Jacques Garrigue
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2007-09-03 1:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-02 17:41 LablGL question Brian Hurt
2007-09-03 1:37 ` [Caml-list] " Jacques Garrigue
2007-09-03 1:50 ` Carlos Scheidegger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox