From b9b91cca10ae2566012fc44314a9c16af811e530 Mon Sep 17 00:00:00 2001 From: tetrapod00 <145553014+tetrapod00@users.noreply.github.com> Date: Sun, 27 Oct 2024 15:52:59 -0700 Subject: [PATCH] Add note about uniform buffer size limit to Shading Language --- tutorials/shaders/shader_reference/shading_language.rst | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tutorials/shaders/shader_reference/shading_language.rst b/tutorials/shaders/shader_reference/shading_language.rst index 529f02475f4..3c255830b01 100644 --- a/tutorials/shaders/shader_reference/shading_language.rst +++ b/tutorials/shaders/shader_reference/shading_language.rst @@ -804,6 +804,15 @@ 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 smaller. + Uniforms smaller than a ``vec4``, such as ``float`` or ``vec2``, are + padded to the size of a ``vec4``. 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 ~~~~~~~~~~~~~