Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Alignment requirements for Client Storage and Texture Range extensions ?



Hello,

we are developping a video playback application and we are using the OpenGL extensions :
- GL_APPLE_client_storage
- GL_APPLE_texture_range with GL_STORAGE_SHARED_APPLE
- GL_ARB_texture_rectangle


For some images width, the OpenGL driver/framework seems to make a copy of the texture data.

My test machine :
- MacPro 2 x 2.66Ghz Dual-Core Intel Xeon
- 9 GB of RAM
- Leopard : 10.5.2 (9C7010)
- 4 nvidia Geforce 7300 GT cards (rom version : 3011)
- 2 displays on 2 physical cards (16x and 8x)

I create 1GB of images. I bind them using the following code :

===============
glBindTexture(GL_TEXTURE_RECTANGLE_EXT, textureObjects[i]);

glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE);
glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(GL_TEXTURE_RECTANGLE_EXT, GL_TEXTURE_STORAGE_HINT_APPLE, GL_STORAGE_SHARED_APPLE);
glTextureRangeAPPLE(GL_TEXTURE_RECTANGLE_EXT, 4*kH*kW, images[i]);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glPixelStorei(GL_UNPACK_ROW_LENGTH, kW);
================


If image width (kW) is a multiple of 8 (rows are 32-bytes aligned), there is no copy (real memory = 1.01GB, virtual memory : 2.18GB)

If image width is not a multiple of 8, a copy is made for each new context (ie if I move my window to another display attached to another physical video card). Starting on main screen (real memory : 1.01GB, virtual memory : 3.19GB), moving the window to a second screen (real memory : 1.01GB, virtual memory : 3.97GB and some textures are not created as memory is exhausted)

Concerning the observed bandwidth :
- on PCIe 16x : 1600MB/s with 32-byte aligned rows, 900MB/s with unaligned rows


Does this 32-byte alignment of rows is a general constraint to avoid OpenGL copying ? Or does it depend on hardware/driver/os combination ? If so, how could I programmatically get this value ?

What I plan to do is to pad each rows with 0 at the end to get the good alignment and then use :

unsigned int rowStride = (kW+7)&(~7);
glPixelStorei(GL_UNPACK_ALIGNMENT, 8);
glPixelStorei(GL_UNPACK_ROW_LENGTH, rowStride);

Thanks in advance.

Attachment: client_storage.cpp
Description: Binary data




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

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 © 2007 Apple Inc. All rights reserved.