Thanks for your reaction.
Your last comment made me worry about something. I have a lot of problems with programs with DirectX as renderengine on my current pc.
But I have never tested it fully with opengl, and from the first few tests it seems that shaders are verry buggy on this system which might explain the wierd behavior.
I have a couple misstakes in the testing, which explains a couple of unexpected results, though the following are still standing;
On my current system I can refer to a UBO variable with and without the use of a Block-name (for UBO’s without an instance-name)
As you mentioned several times, arrays-of-arrays are treated like structures which is true. The problem is that every variable has a program-location and program-index.
Every (sub)array/structure has its own program-location, but the whole arrays-of-arrays variable occupies only one program-index.
Unfortunatly on my current system (and maybe others too) UBO variables are only accessible by program-index from the API.
I tried every combination of names/‘.’/‘[]’ operators and every method I could find to query the program-location of the UBO variables. without succes.
Another thing I noticed while testing some wierd behavior with program-indices (sadly). For further testing I made a UBO’s block array like so:
layout (std140) uniform Block
{
float array[5];
vec4 color;
} myUBO[2];
I am able to querry both UBO’s, where “Block” gives the same result as “Block[0]” (might not necessary be a bug, but might explain the next).
When querying the UBO variable indices, I get the following program-indices (example)
|
|
|
|
Nothing wrong so far.
When querying the variable properties (type, size etc.), the variables from “Block[0]” everything works perfectly as expected.
But when querying the variable properties from “Block[1]”, no (valid) result is returned.
For all the variable indices from “Block[1]” it returns the properties of “gl_ModelViewProjectionMatrix”.
After digging into it a litle bit, I thought it would only be possible if you(or the system itself) previously queried properties from that variable,
while the current input is not valid (somehow) and therefore returning the values of the previous querry.
refference: https://www.opengl.org/sdk/docs/man/html/glGetActiveUniform.xhtml
The list of active uniform variables may include both built-in uniform variables (which begin with the prefix “gl_”) as well as user-defined uniform variable names.
This function will return as much information as it can about the specified active uniform variable. If no information is available, length will be 0, and name will be an empty string. This situation could occur if this function is called after a link operation that failed. If an error occurs, the return values length, size, type, and name will be unmodified.
But, right before I qeurry the variables from “Block[1]”, I querried from the variables from “Block[0]”.
So if the last would be the case, I suspected the results of the last variable of “Block[0]”.
When querying the index of each variable seperatly with “GL43.glGetProgramResourceIndex” I could only use (for example)“Block.array”, but not “Block[0].array”.
I have no clue what to think of this, but I keep my drivers responsible for now.
Conclusion
there is no direct way to query a (sub)array length; A possible workaround requires a program-location which are not ussable with UBO-variables;
Its likly that my current system is causing a part of these problems, but it requires further testing.
So for now I believe there is no way to get the results I want.
Thanks for thinking with me!