(My setup: GeForce (1), Windows XP, Athlon processor, 41.09 drivers)
I tried pixel_data_range extension in my application, which was already using VAR. I set my write_data_range to be equal to my VAR (AGP) allocation, and used my existing memory allocator for creating buffers which I use for uploading my (pre)compressed textures. The problem is that I am seeing corrupted textures.
If I remove the EnableClientState, the problem disappears, so it looks like it is directly related to the PDR. Also if I add PDR flush immediatelly after the glCompressedTex(Sub)Image2ARB the problem does NOT disappear, so maybe I am not reusing
the memory too soon. (I use Fences so that should not happen anyways)
I have started to suspect that maybe I have too little memory on my card? It is possible that all the textures don’t fit on the card so the driver should move them from the main memory to the video memory as needed. I would have expected this to work, but maybe not? Also if I increase my small GL window to full screen more textures suddenly appear corrupted, which might be related to memory shortage. GeForce (1) has only 32M memory.
I suspect that I finally found the reason for my problems, sort of embarasing that I found it by reading the extension spec more carefully.
Quoting from the NV_Pixel_Data_Range spec:
The following additional restrictions apply to glTex[Sub]Image2D:
- The texture must fit in video memory.
(actually the spec does not mention this limitation for compressed textures?)
Continuing this issue – We all know the OpenGL beginner question “How do I know if my textures fits on the Card memory”, and the answer “You don’t, and you shouldn’t really care too much”. Now the extension spec requires that the texture fits on video memory!
The following is my best quess how this extension can be actually used for texture uploads.
Use a reasonably sized texture, and HOPE it fits into video memory.
Only use the texture for rendering immediatelly after you have uploaded it. Don’t even think binding an other texture between the upload and the rendering.
You can of course reuse the texture, but always glTex[Sub]Image it before using it in rendering.
Is there any reason to use this extension over CopyTexSubImage? I’ve always supposed that CopyTexSubImage would copy directly to video mem (this may not be your purpose, I realise).