I’m fairly new to OpenGLES3.1 and I’m attempting to utilise compute shaders in attempt to parallelise a conventionally serial algorithm.
I was wondering if anyone could offer any advice on the subject of SSBOs and potentially two dimensional SSBOs.
I would like my shader to take two input buffers of structs :
The first buffer would consist of a few select nodes which correspond to a node in the second buffer.
I would like to take this initial node (first buffer), find its corresponding node (second buffer) and then find its adjacent nodes in the second buffer.
Once the adjacent nodes have been found I would then like to fill up a 3rd SSBO with these adjacent nodes.
That’s about it for now;
My first question would be is this at all possible?
If yes would it be possible with 2D SSBOs?
If yes how do I go about creating two dimensional SSBOs?
If not possible with 2D SSBOs what are my other options? (A 1D SSBO with an Array of Arrays perhaps?)
I hope I have explained this in enough detail, any comments would be greatly appreciated
What do you mean by a “2D SSBO”? Your buffer definition uses an unbounded array of data, which means the length is determined by the length of the buffer object you bind to it. You can’t have two dimensions which both have an unbounded length.
But if you can use SSBOs, you can use arrays of arrays. So long as you can specify the size of all but the first dimension, you can have as many dimensions as you like.
I tried to keep my sample as generic as possible, so I didn’t define values, I only really posted that image to show the struct definition, I apologise for the confusion.
The reason I say 2D SSBO is because I’m trying to find out if such a thing is common or even possible, I’m very new to OpenGLES3.1 and SSBOs so I’m not sure what the best practice or approach is to achieving something similar to a Two Dimensional SSBO.
My ‘2DSSBO’ would have completely defined values depending on the complexity of my algorithm.
8 * 8 for example; giving a total of 64 nodes, working as a makeshift lookup table?
while my input buffer could have anywhere between 1 to 64 nodes. (Although this is unlikely to be the case)
further, my output buffer would be similar to that of the input buffer.
I’ve removed the image and posted quoted text instead, sincerest apologies.
I’ll attempt a method using an array of arrays like you’ve suggested thank you very much!
EDIT : My buffer definition is for my output buffer that would contain an amount of nodes proportional to the number of input nodes received.
Again I apologise if my post seems a bit flimsy I am very new to compute shaders >.<
Any sources that you could recommend would also be welcomed!
When I linked you to information about arrays of arrays, you would fine this sentence: “If an array can be specified without a size (such as in buffer variables), only the first array index can be unsized.” Your definition uses two unsized arrays.
Maybe I am not understanding some of the terminology in the link you have posted but that is why I have come back and asked for more assistance.
I apologize if your message wasn’t sarcastic or intentionally hateful but I find it hard to look at it any other way.
Furthermore I’m making my way through several pages of documentation and searching other sources for information on the subject, I’m not some lazy guy looking to make some generic program I’m working on my thesis.
I tried to not take offence from your other two comments but I feel like the assumption that I didn’t thoroughly read the sources you linked was crossing the line :\
I sincerely apologize for wasting your time. I was just looking to be pointed in the right direction, I hesitated posting my initial question as I thought it may be a stupid one. Turns out it was.
I have read the entire page you linked, the code snippet I posted doesn’t contain all forms of combinations I have tried.
How can someone possibly know what you’ve tried… if you don’t actually post what you’ve tried?
We’re not telepathic. We have to assume that what is presented to us is what you’ve actually tried, not “some” of what you’ve tried. The linked page is very clear that cannot work, it is syntactically invalid GLSL code. As this was the only case you posted, the most reasonable explanation for you to post it was that you did not know that it was syntactically invalid. Since the page made it clear that it is syntactically invalid, it stands to reason that you did not read or understand the page.
In any case, if your implementation supports arrays of arrays, then the Nodes  version is the only variation (that you posted) which must work. The [size] version cannot work (it’s even explicitly shown on the page as a failure example), but the other two size versions may or may not work, depending on what size is.
So I’ll focus on .
If that failed, this suggests that your implementation doesn’t support arrays of arrays at all. SSBOs and arrays of arrays are both GL 4.3 features, so most implementations that support one ought to support the other. If you’re getting this, then here are the potential reasons for that:
If your implementation does not advertise GL 4.3 or better, then you must be using SSBOs as an extension. That would require that you’re enabling the extension via #extension syntax. Thus, in order to use arrays of arrays, you must also use #extension syntax to enable it. You’d get this error if you’re enabling SSBOs but not arrays of arrays.
If your implementation does not advertise GL 4.3 or better, then you must be using SSBOs and arrays of arrays as an extension. If your shader requests both, but you’re only using #extension ... enable rather than #extension ... require, then it is possible that your implementation doesn’t actually support arrays of arrays as an extension. Since you’re only using “enable”, the compilation will succeed, but emit a warning. Since your code relies on arrays of arrays, you should “require” it.
If your implementation does advertise GL 4.3 or better, then your shader must use #version 430 or better to get SSBO and arrays of arrays support.