Skip to content

Commit 5b0f792

Browse files
authored
Merge pull request #10171 from tetrapod00/global-const-arrays
Fix inaccurate/misleading note about shader global arrays
2 parents af6ab3d + ed8b4c8 commit 5b0f792

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

tutorials/shaders/shader_reference/shading_language.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -322,22 +322,24 @@ return the array's size.
322322
Global arrays
323323
~~~~~~~~~~~~~
324324

325-
You can declare arrays at global space like:
325+
You can declare arrays in global space as either ``const`` or ``uniform``:
326326

327327
.. code-block:: glsl
328328
329329
shader_type spatial;
330330
331331
const lowp vec3 v[1] = lowp vec3[1] ( vec3(0, 0, 1) );
332+
uniform lowp vec3 w[1];
332333
333334
void fragment() {
334-
ALBEDO = v[0];
335+
ALBEDO = v[0] + w[0];
335336
}
336337
337338
.. note::
338339

339-
Global arrays have to be declared as global constants, otherwise they can be
340-
declared the same as local arrays.
340+
Global arrays use the same syntax as local arrays, except with a ``const``
341+
or ``uniform`` added to their declaration. Note that uniform arrays can't
342+
have a default value.
341343

342344
Constants
343345
---------

0 commit comments

Comments
 (0)