7

I am implementing a simple ray tracer with OpenGL. I have a shader storage buffer with all the triangles so I can test them for intersections in a compute shader. It works fine up to a certain buffer size. But if I have more than a certain amount, it stops working and I get the following message:

OpenGL: Buffer usage warning: Discarding a video memory only buffer object. The data store will be reallocated on next usage of the buffer object.

The program does not crash however.

The GL_MAX_SHADER_STORAGE_BLOCK_SIZE is 2147483647, so 2GB. The size of the buffer when it doesn't work anymore is just a couple of MB, around 6 to 7 MB.

Am I overlooking something? Are there other limits I don't know about?

Edit:

My specs: Linux Mint 17.2, GTX 980Ti with 6GB of VRAM

gartenriese
  • 171
  • 2
  • 1
    That's just a warning that the vram is getting over-committed and could cause more memory transfers. – ratchet freak Feb 11 '16 at 11:06
  • @ratchetfreak: That's just a side effect then? I still don't understand why the program stops working though. – gartenriese Feb 11 '16 at 17:08
  • Can you share OS + GPU details? –  Feb 12 '16 at 02:19
  • @DanielMGessel: Yes, I am using Linux Mint 17.2 and my GPU is a GTX 980Ti with 6GB of VRAM. – gartenriese Feb 12 '16 at 17:00
  • The message seems to be that a buffer in VRAM is getting straight up discarded - unless you are using a ton of VRAM for something else, or you have locked up the GPU - this could be a symptom what would be a TDR on windows - if you submit a command buffer that takes too long. But that should just kill your command buffer, not your data. You could try changing the bits passed to glBufferStorage to make it dynamic and see what happens. Crosspost on an NV message board and/or file a bug report. –  Feb 12 '16 at 20:02
  • @DanielMGessel: I think it has something to do with how long my compute shader is working. When I am using a simple compute shader where I iterate through the whole buffer and compute an average over all the values inside, then it works with bigger buffer sizes. Are there any rules on how long a shader can be working? My error appeared when the shader was working for more than ~8 seconds. – gartenriese Feb 15 '16 at 07:55
  • It would be useful to include the additional information (such as the comment mentioning OS and GPU) in the question so it is more accessible. Also, comments are not intended to last long term. If there's any information you want to add to the question, just [edit]. – trichoplax is on Codidact now Mar 30 '16 at 02:52
  • There are usually two limits, one having "native" in the name. Beyond native limits the driver is likely to emulate behavior in software. MB of shader data storage is never good. I had similar problem in DX11 a few years back. You should try move that data to a buffer object of some kind or divide the issue into more passes. – Andreas Mar 31 '16 at 18:53
  • Why is a buffer object better than a shader data storage? I thought it was the other way around. – gartenriese Mar 31 '16 at 23:39
  • @gartenriese Better? How do you mean? – Andreas Apr 01 '16 at 06:07
  • @Andreas: If you look here, three out of four points are in favor of SSBOs over UBOs. – gartenriese Apr 01 '16 at 12:08
  • @gartenriese (Sry for delay, didnt have rep to comment) Oh I see. SSBO have additional features, and that is "better". Ok. My idea of a "buffer storage" was not SSBO/UBO. This post mentions "texture buffer objects" that are quite large without the requirement to be writeable: http://stackoverflow.com/questions/7954927/glsl-passing-a-list-of-values-to-fragment-shader – Andreas Apr 09 '16 at 15:15
  • @Andreas: Thanks for the link, very informative. However the top answer says that SSBOs are even larger than TBOs, so I don't think this should be the problem. But I can try anyways! – gartenriese Apr 11 '16 at 06:24
  • @gartenriese That's not what I read. SSBO are limited to 16MB. TBO is limited to VRAM. And you do have more VRAM than that, right? In any case you should check those parameters for you platform (glGetInteger). – Andreas Apr 11 '16 at 06:34
  • 1
    @Andreas: No, they are not limited to 16MB. 16MB is the minimal size it is guaranteed to have. Usually they are limited to VRAM. If you look at my question I already checked the size with GL_MAX_SHADER_STORAGE_BLOCK_SIZE and it's 2GB (which isn't actually my VRAM size, but still big enough). – gartenriese Apr 11 '16 at 09:53
  • @gartenriese Oh right, my bad. – Andreas Apr 11 '16 at 09:55

0 Answers0