Hi,
I want to create a SSBO buffer for my fragment shader to use, however, my application hangs and I’m not sure if I’m doing something wrong.
The SSBO size is 2562561024*4 = 256 MB (because I want to use it as a 3-dimentional array of vec4’s)
Note, that I only allocate the buffer once in the application (after loading the shader program) and use it as a static memory during the lifetime of the application.
I allocate it the following way:
glBufferStorage(GL_SHADER_STORAGE_BUFFER, 256*256*1024*2, NULL, 0); // flags is 0 for best optimization
Also, in my fragment shader I declared the SSBO the following way:
layout(std430, binding = 0) buffer object_map
{
vec4 obj_map[256*256*1024];
};
I haven’t even used the buffer in the shader yet.
What I observe is the application runs until it needs to allocate the buffer, hangs and then crashes.
Also, a dumb question: Does OpenGL use the system RAM to allocate the buffers or there’s a special memory for that?
I’m a bit confused about the whole buffers storage.
P.S. I tried removing the 1024 multiplication, meaning my buffer is 256256*4 B in size it takes about 10~20s to allocate the buffer.
Is this normal and is there a way to optimize the buffer allocation?