Closed aconstlink closed 3 years ago
After playing with arrays in shaders I came to the conclusion to discard this feature due to the following reasons:
OpenGL is ok and allows for dynamic array indexing in the shader. DirectX11 is not so nice at figuring out variable arrays through the reflection api and the killer mainly is that dynamically indexing into the array is not possible.
So the conclusion is that data can already be passed efficiently with data arrays and allowing texture arrays can be done through concrete texture array types in the apis.
An array of variables is required for accessing multiple values within the same shader instance. This may interfere with [#231] but this issue should come first, because we can have arrays for data variables as well as for texture/sampler variables. A Texture Array is a special shader object.
A variable array is written like:
sometype mydata[value] ;
Somydata
becomes an array ofsometype
and can be indexed by a external variable to the shader or by some computation.This type of variable is first required for [#243] where multiple textures need to be accessed based on some external shader variable for a single shader invocation.