Sign in to follow this  

LockBox() with volume textures of non-power-2 dimensions

Recommended Posts

I'm working with a GeForce 6800 Ultra and I've run into difficulties generating volume textures properly. According to the texture caps for the card, the maximum volume extent is 511 and it allows non-power-of-two sized textures. However, it seems that internally it is actually using a 512x511xDepth block of memory when I use a 511x511xDepth size texture. First, I create a 511x511xDepth texture object. Next, I use LockBox(), specifying a box and array ranks with the same dimensions. I fill this array and call UnlockBox(). When the texture is rendered, it is skewed as if each row contained 512 pixels and I had written contiguous rows of 511 (each subsequent row is offset by one less than the previous). I tried using the LockedBox out parameter in LockBox(). In my case (2 bytes per pixel), the box it returns has row pitch of 1024 (512*2) and slice pitch of 523264 (row pitch * 511). I could use that information to adjust what I lock. So the question is, how can I know what is stored before the call to LockBox()? If there is not a better way, I guess I can just call LockBox() just to get the pitch information before the texture is actually generated. Any notes or suggestions are appreciated.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this