View Full Version : imageLoad addressing past 1gb boundary

02-02-2015, 10:52 PM
I seem to be running into an issue where image units can't be accessed past 1gb (I get zeroes instead of actual data).

gvec4 imageLoad(gimage1D image, int P);

Here, a signed integer is taken for the index, which I would expect limits addressing to 2gb as half the range is lost to negatives.

1. Is it normal to not not be able to address past 1gb, or have I made a mistake elsewhere?
2. If so, why at 1gb and not 2?
3. Is there a workaround that doesn't require two separate buffers? Maybe binding my 1D texture buffer as a 2D image instead?

Alfonse Reinheart
02-03-2015, 07:17 AM
How do you know that you're accessing "past 1gb"? It's a 1D image. Which means that your texture size will be limited to GL_MAX_TEXTURE_SIZE, which almost certainly is nowhere near 1gb.

So it would seem that you're just accessing data outside of the texture. Which is (if you're not using robustness stuff) going to lead to undefined behavior.

02-03-2015, 09:36 PM
I know I'm accessing past 1gb, because I have a buffer that dynamically resizes as needed. As it gets past 1gb (on-screen display), I start to see artefacts which would be caused by not reading correctly outside 1gb.

GL_MAX_TEXTURE_SIZE: params returns one value. The value gives a rough estimate of the largest texture that the GL can handle.

IIRC I've been able to successfully go past GL_MAX_TEXTURE_SIZE before, and assumed it was more of a suggestion for portability (not an issue in my situation, I just need it to work for me).

I have a titan with 6gb total memory and nowhere near the limit, checking with https://www.opengl.org/registry/specs/NVX/gpu_memory_info.txt and also tracking every new texture/buffer call I make.

GL_MAX_TEXTURE_SIZE gives 32767 for me. Lets say I were to allocate a 2D 32767x32767x4x4 byte texture. That's 16gb. In my case I'm creating a buffer object and mapping it to a texture buffer, which I then bind as a 1d image. My buffer size goes well past 32767 (pixels of arbitrary size?, "rough estimate", but whatever) and still seems to work, so I assume this max size doesn't apply here. I do not get GL errors from this, and I don't get zeroes from every access, I only get zeroes for the reads past ~1gb; everything else works fine.

I had a very brief skim through https://www.opengl.org/registry/specs/ARB/robustness.txt. Can you point out the parts you were referring to?