GL_TEXTURE_SPARSE_ARB on Nvidia

Hi everyone,

currently I’m working on a project that uses a 3D texture as voxel storage. Everything’s working fine so far, but I’d love to optimze my memory usage and since I’m working with GL4.4 anyway I thought I’d give the GL_TEXTURE_SPARSE_ARB extension a try. The extension has been promoted by Cass Everitt (p.34) and Graham Sellers (p.43) multiple times lately, so I hoped I could get it to work too.

Unfortunately I get no result when querying for the virtual page sizes as described in the presentations.

While

glGetIntegerv(GL_MAX_SPARSE_3D_TEXTURE_SIZE_ARB, &maxSize) 

returns the expected 2048.

I don’t get any number of indices from these…

glGetInternalformativ(GL_TEXTURE_3D, GL_NUM_VIRTUAL_PAGE_SIZES_ARB, GL_RGBA8, sizeof(GLint), &numSizes);
glGetInternalformativ(GL_TEXTURE_3D, GL_VIRTUAL_PAGE_SIZE_X_ARB, GL_RGBA8, numSizes*sizeof(GLint), pageSizesX);

I also tried GL_TEXTURE_2D instead, as used in the slides - the result is no different.

Cass Everitt writes

Note: numIndexes can be 0, so have a plan
Iterate, select suitable pageSizeIndex

so, question is…what to do? This sounds like the extension could still work on my HW and drivers, but I’d need to guess the proper virtual page size index I’d want to use.

Has anybody worked with this yet and knows the page sizes (for Nvidia)? I hope it’s just a driver issue on windows…

Thanks in advance on any input on this issue :slight_smile:

PS: GPU is a GTX780, driver is the latest 335.23, OS win8.1

I use GL_TEXTURE_2D_ARRAY not GL_TEXTURE_3D

Looks like a simple parameter mix-up to me:
glGetInternalformativ(GLenum target​, GLenum internalformat​, GLenum pname​, GLsizei bufSize​, GLint *params​);
->
glGetInternalformativ(GL_TEXTURE_3D, GL_RGBA8, GL_NUM_VIRTUAL_PAGE_SIZES_ARB, sizeof(GLint), &numSizes);

Oh damn, that’s kind of embarrassing :doh: That’s what I get from copying slides without thinking…

Thanks a lot Osbios! :slight_smile:

Kind of unhandy that I can’t have the same page size for z (16) as I have for x and y (32) though. But well I’m happy enough it’s working at all now^^