Wednesday, September 1, 2010

[android-developers] Re: ByteBuffers and GLES

The Javadoc for the OpenGL ES API does a good job explaining why you
can't use wrapped arrays for everything:
> http://download.oracle.com/javame/config/cldc/opt-pkgs/api/jb/jsr239/index.html
> Because these functions do not consume the data located at the given pointer immediately, but only at some unspecified later time, it is not possible to use an array since the Java virtual machine may relocate the array within system memory.

But if you really want hardware details, here's a nice document for
the type of graphics in the Droid:
http://www.imgtec.com/factsheets/SDK/POWERVR%20SGX.OpenGL%20ES%202.0%20Application%20Development%20Recommendations.1.1f.External.pdf

There's lots of stuff for older chips like the MSM7200 in the G1 out
there as well, although you may have to look in a BREW oriented
document or two to find it.

On Sep 1, 7:31 pm, Samsyn <d...@synthetic-reality.com> wrote:
> So, I've been a good boy (I think) and used ByteBuffers (and
> ShortBuffers and IntBuffers etc) for all the vertex lists and textures
> I feed to GLES.
>
> But can someone point me to the basic architecture of the 'typical'
> mobile GPU (or, I guess, the OpenVR Droid GPU at least).  For example,
> does a mobile GPU have its own texture/buffer memory, or does it
> always share 'system memory' ?
>
> If it's going to copy the data I give it into 'gpu ram' anyway, then
> have I just added another buffer in the bucket brigade of memory when
> I use a ByteBuffer?
>
> GLES seems perfectly happy using a direct java array for the data, but
> I imagine that does nasty things like locking memory when the GPU
> touches it, when maybe  memory outside the garbage collection heap
> doesn't have that problem (and just gets leaked when I mis-manage
> it :-)
>
> I can't say that I see any performance difference between using
> ByteBuffers or just direct java arrays.  But most of my meshes (and
> all of my textures) are created just once.  But some meshes (for
> example, particles) get regenerated every frame.  And for that, I do
> the math in a java array and then allocateDirect a suitable
> <whatever>Buffer before passing it to GLES.  That smells really awful
> to me and I guess I am just wondering how big a sin it would be to not
> use <whatever>Buffers for these dynamic meshes?
>
> I guess I just feel like I am flying blind without some GPU
> documentation to look at.

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment