Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
To: bhurt@spnz.org
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] LablGL question
Date: Mon, 03 Sep 2007 10:37:41 +0900 (JST)	[thread overview]
Message-ID: <20070903.103741.77043601.garrigue@math.nagoya-u.ac.jp> (raw)
In-Reply-To: <Pine.LNX.4.64.0709021337320.28993@localhost>

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


  reply	other threads:[~2007-09-03  1:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-02 17:41 Brian Hurt
2007-09-03  1:37 ` Jacques Garrigue [this message]
2007-09-03  1:50   ` [Caml-list] " Carlos Scheidegger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070903.103741.77043601.garrigue@math.nagoya-u.ac.jp \
    --to=garrigue@math.nagoya-u.ac.jp \
    --cc=bhurt@spnz.org \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox