Skip to content

Commit 0c82320

Browse files
authored
Merge pull request #10558 from tetrapod00/shader-tweaks
Improve shading language page
2 parents 173ff27 + a2d2c07 commit 0c82320

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

tutorials/shaders/shader_reference/shading_language.rst

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ Most GLSL ES 3.0 datatypes are supported:
102102
Comments
103103
~~~~~~~~
104104

105-
The shading language supports the same comment syntax as used in C# and C++:
105+
The shading language supports the same comment syntax as used in C# and C++,
106+
using ``//`` for single-line comments and ``/* */`` for multi-line comments:
106107

107108
.. code-block:: glsl
108109
@@ -1121,15 +1122,17 @@ When using per-instance uniforms, there are some restrictions you should be awar
11211122
Setting uniforms from code
11221123
~~~~~~~~~~~~~~~~~~~~~~~~~~
11231124

1124-
You can set uniforms from GDScript:
1125+
You can set uniforms from GDScript using the
1126+
:ref:`set_shader_parameter() <class_ShaderMaterial_method_set_shader_parameter>`
1127+
method:
11251128

11261129
.. code-block:: gdscript
11271130
11281131
material.set_shader_parameter("some_value", some_value)
11291132
11301133
material.set_shader_parameter("colors", [Vector3(1, 0, 0), Vector3(0, 1, 0), Vector3(0, 0, 1)])
11311134
1132-
.. note:: The first argument to ``set_shader_parameter`` is the name of the uniform
1135+
.. note:: The first argument to ``set_shader_parameter()`` is the name of the uniform
11331136
in the shader. It must match *exactly* to the name of the uniform in
11341137
the shader or else it will not be recognized.
11351138

@@ -1222,13 +1225,12 @@ table of the corresponding types:
12221225
| **samplerExternalOES** | **ExternalTexture** | Only supported in Compatibility/Android platform. |
12231226
+------------------------+-------------------------+------------------------------------------------------------+
12241227

1225-
.. note:: Be careful when setting shader uniforms from GDScript, no error will
1226-
be thrown if the type does not match. Your shader will just exhibit
1227-
undefined behavior.
1228-
1229-
.. warning::
1230-
As with the last note, no error will be thrown if the typing does not match while setting a shader uniform, this unintuitively includes setting a (GDscript) 64 bit int/float into a Godot shader language int/float (32 bit). This may lead to unintentional consequences in cases where high precision is required.
1231-
1228+
.. note:: Be careful when setting shader uniforms from GDScript, since no error
1229+
will be thrown if the type does not match. Your shader will just exhibit
1230+
undefined behavior. Specifically, this includes setting a GDScript
1231+
int/float (64 bit) into a Godot shader language int/float (32 bit).
1232+
This may lead to unintended consequences in cases where high
1233+
precision is required.
12321234

12331235
Uniform limits
12341236
~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)