From ed8b4c8099c6676d1ec99de331cd731d29a11af8 Mon Sep 17 00:00:00 2001 From: tetrapod00 <145553014+tetrapod00@users.noreply.github.com> Date: Wed, 30 Oct 2024 02:15:20 -0700 Subject: [PATCH] Fix inaccurate note about shader global arrays --- .../shaders/shader_reference/shading_language.rst | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tutorials/shaders/shader_reference/shading_language.rst b/tutorials/shaders/shader_reference/shading_language.rst index ccf5fc15bad..c03a9073c24 100644 --- a/tutorials/shaders/shader_reference/shading_language.rst +++ b/tutorials/shaders/shader_reference/shading_language.rst @@ -322,22 +322,24 @@ return the array's size. Global arrays ~~~~~~~~~~~~~ -You can declare arrays at global space like: +You can declare arrays in global space as either ``const`` or ``uniform``: .. code-block:: glsl shader_type spatial; const lowp vec3 v[1] = lowp vec3[1] ( vec3(0, 0, 1) ); + uniform lowp vec3 w[1]; void fragment() { - ALBEDO = v[0]; + ALBEDO = v[0] + w[0]; } .. note:: - Global arrays have to be declared as global constants, otherwise they can be - declared the same as local arrays. + Global arrays use the same syntax as local arrays, except with a ``const`` + or ``uniform`` added to their declaration. Note that uniform arrays can't + have a default value. Constants ---------