Has anyone used a TextureSampler with the array size > 1 in Optix ?
I seem to always get the error ‘Invalid buffer size in texture’, I call setArraySize(3), fill each slice with a different buffer.
What’s the declaration in the .cu for the rtTextureSampler with an array ?
thanks.
I’ve posted a similar question HERE
yeah, I guess “There is no support for texture arrays in OptiX” may be the answer to my question. 3D textures seem supported, but I was looking for a varying number of differently sized textures (as found in real world data). I wonder how that case is supposed to be handled.
Texture arrays would have the same size for all texture slices.
What you ask for is possible with bindless textures (running in hardware on Kepler GPUs and newer once supported).
You create an OptiX TextureSampler as usual, but do not assign it to a sampler variable but use the bindless texture IDs you can get with TextureSampler::getId() which are plain integers you can put into buffers as well, and refer to them in the OptiX shaders via the texture wrapper functions like rtTex2D(yourTextureId, tc.x, tc.y) which will generate the proper PTX code internally.
There is an example usage in the OptiX rayDifferentials sample emulating mipmaps.