KhronosGroup / KhronosGroup/GLSL
Allow passing dynamic arrays (in SSBOs) as function arguments.
- Dominant language
- JavaScript
- Stars
- 458
- Forks
- 114
- Avg merge
- 4m
- Merged PRs (30d)
- 1
Description
Like the title says: Allow passing dynamic arrays (in SSBOs) as function arguments. (By reference).
I have some complicated functions that walk a tree-structure stored in an SSBO dynamic array, like:
```glsl
layout(std430) buffer TreeNodes_ {
TreeNode TreeNodes[];
};
```
And I have some utility functions that are able to peruse the tree, like:
```glsl
NodeID GetNode(NodeID from, TreePath path);
```
Alas, I am unable to use multiple trees in a single program, because I am forced to use a global tree variable, because glsl does not allow one to pass a reference to a dynamic array.
Something like this would be nice:
```glsl
NodeID GetNode(TreeNode TreeNodes[], NodeID from, TreePath path);
```
Related:
* [GLSL_EXT_buffer_reference](https://github.com/KhronosGroup/GLSL/blob/master/extensions/ext/GLSL_EXT_buffer_reference.txt)
* [NV_shader_buffer_load](https://www.khronos.org/registry/OpenGL/extensions/NV/NV_shader_buffer_load.txt)
* [Want pass-by-reference function-call syntax to avoid implication of doing large copies.](https://github.com/KhronosGroup/GLSL/issues/84)?
Contributor guide
Research direction
Start by reviewing the GLSL_EXT_buffer_reference and NV_shader_buffer_load documents linked in the issue, then compare the related discussion in issue 84. Define the syntax and semantics for passing SSBO runtime arrays by reference, including how multiple trees would be supported, and document the resolved behavior in the relevant specification section.
Written by the indexing model from the issue text.
Assessment
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100