Skip to content

Commit d904c1d

Browse files
authored
Merge pull request #10153 from tetrapod00/shader-uniform-limit
Add note about shader uniform size limit to Shading Language
2 parents 2d0b917 + 58867df commit d904c1d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tutorials/shaders/shader_reference/shading_language.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -804,6 +804,18 @@ GDScript:
804804
in the shader. It must match *exactly* to the name of the uniform in
805805
the shader or else it will not be recognized.
806806

807+
.. note:: There is a limit to the total size of shader uniforms that you can use
808+
in a single shader. On most desktop platforms, this limit is ``65536``
809+
bytes, or 4096 ``vec4`` uniforms. On mobile platforms, the limit is
810+
typically ``16384`` bytes, or 1024 ``vec4`` uniforms. Vector uniforms
811+
smaller than a ``vec4``, such as ``vec2`` or ``vec3``, are padded to
812+
the size of a ``vec4``. Scalar uniforms such as ``int`` or ``float``
813+
are not padded, and ``bool`` is padded to the size of an ``int``.
814+
815+
Arrays count as the total size of their contents. If you need a uniform
816+
array that is larger than this limit, consider packing the data into a
817+
texture instead, since the *contents* of a texture do not count towards
818+
this limit, only the size of the sampler uniform.
807819

808820
Uniform hints
809821
~~~~~~~~~~~~~

0 commit comments

Comments
 (0)