Skip to content

Commit

Permalink
Merge pull request #10153 from tetrapod00/shader-uniform-limit
Browse files Browse the repository at this point in the history
Add note about shader uniform size limit to Shading Language
  • Loading branch information
mhilbrunner authored Oct 28, 2024
2 parents 2d0b917 + 58867df commit d904c1d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tutorials/shaders/shader_reference/shading_language.rst
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,18 @@ GDScript:
in the shader. It must match *exactly* to the name of the uniform in
the shader or else it will not be recognized.

.. note:: There is a limit to the total size of shader uniforms that you can use
in a single shader. On most desktop platforms, this limit is ``65536``
bytes, or 4096 ``vec4`` uniforms. On mobile platforms, the limit is
typically ``16384`` bytes, or 1024 ``vec4`` uniforms. Vector uniforms
smaller than a ``vec4``, such as ``vec2`` or ``vec3``, are padded to
the size of a ``vec4``. Scalar uniforms such as ``int`` or ``float``
are not padded, and ``bool`` is padded to the size of an ``int``.

Arrays count as the total size of their contents. If you need a uniform
array that is larger than this limit, consider packing the data into a
texture instead, since the *contents* of a texture do not count towards
this limit, only the size of the sampler uniform.

Uniform hints
~~~~~~~~~~~~~
Expand Down

0 comments on commit d904c1d

Please sign in to comment.