Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Texture Range, Client storage and pixel formats
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Texture Range, Client storage and pixel formats



Hi, all

I've been following the OpenGL Programming Guide for Mac OS X section on Texture techniques.  I've been trying to see if the Intel integrated graphics can leverage shared memory to avoid as many texture copies as possible.  

I've gotten GL_APPLE_client_storage to work appropriately (shaving-off an order of magnitude of texture load time [ 20mS vs 130mS in glTexImage3D with an 128 texel cube]).

Now I'm combining that extension with glTextureRangeAPPLE() to try and reduce that further.  There is no appreciable improvement.  I read further and came across the "Optimal data formats and types" section of the document and hit a brick-wall.  I've been trying to use the GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV pair.  The performance is TERRIBLE!  load times have jumped up to 151mS in glTexImage3d for the same texture size.

Are there any suggestions?  Am I completely out-to-lunch about trying to avoid a memory copy?  Is the optimal data formats document incorrect?

For reference, here is the code used to load the texture naively:
glBindTexture( GL_TEXTURE_3D, texID );
glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_CLAMP );
glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_CLAMP );
glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_CLAMP );
glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, width, height, depth, 0, GL_RGBA, GL_FLOAT, data );

With client-storage
glBindTexture( GL_TEXTURE_3D, texID );
glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE);
glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_CLAMP );
glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_CLAMP );
glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_CLAMP );
glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, width, height, depth, 0, GL_RGBA, GL_FLOAT, data );

With client-storage and texture range and "optimal" pixel format
glBindTexture( GL_TEXTURE_3D, texID );
glTexParameteri(GL_TEXTURE_3D, GL_TEXTURE_STORAGE_HINT_APPLE, GL_STORAGE_SHARED_APPLE);
glTextureRangeAPPLE(GL_TEXTURE_3D, width * height * depth * 4 * sizeof(GL_UINT), data);
glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE);
glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_WRAP_S, GL_CLAMP );
glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_WRAP_T, GL_CLAMP );
glTexParameterf(GL_TEXTURE_3D, GL_TEXTURE_WRAP_R, GL_CLAMP );
glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE );
glTexImage3D(GL_TEXTURE_3D, 0, GL_RGBA, width, height, depth, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, data );

Thanks in advance for any help!

William Dillon
email@hidden

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Mac-opengl mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.