My vertex shader code was working fine with GLSL 4.30 but after upgrading to GLSL 4.50 it seems to not be able to read values from SSBOs. Here is the code that offloads data to the buffers:
glBindBuffer(GL_SHADER_STORAGE_BUFFER, buf_plumeX);
glBufferSubData(GL_SHADER_STORAGE_BUFFER, 0, sizeof(GLFrame->PlumeSetP->plX), GLFrame->PlumeSetP->plX);
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 7, buf_plumeX);
glBindBuffer(GL_SHADER_STORAGE_BUFFER, buf_plumeY);
glBufferSubData(GL_SHADER_STORAGE_BUFFER, 0, sizeof(GLFrame->PlumeSetP->plY), GLFrame->PlumeSetP->plY);
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 6, buf_plumeY);
glBindBuffer(GL_SHADER_STORAGE_BUFFER, buf_plumeZ);
glBufferSubData(GL_SHADER_STORAGE_BUFFER, 0, sizeof(GLFrame->PlumeSetP->plZ), GLFrame->PlumeSetP->plZ);
glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 5, buf_plumeZ);
In shader, I am reading those buffers using the following code:
layout ( std140, binding = 7) buffer PlumeBufferX {
float plumeX[];
};
layout ( std140, binding = 6) buffer PlumeBufferY {
float plumeY[];
};
layout ( std140, binding = 5) buffer PlumeBufferZ {
float plumeZ[];
};
I calculate an offset and fetch the data at that specific offset:
vec3 p = vec3(plumeX[offset], plumeY[offset], plumeZ[ offset] );
Now no matter how i calculate the offset when I render the points based on this p position, it looks like they are all around the value of zero! I am positively sure that this was not the behavior I was getting with GLSL 4.30 because I had recorded a video of my render. Any idea what is causing the problem and why my SSBO's are zeroed out by GLSL 4.50?
Thanks.