Discussion:
[Qt3D] Error: uniform variables in fragment shader do not fit in vectors
(too old to reply)
Oleg Evseev
2018-11-24 11:28:38 UTC
Permalink
Hi all,

Trying to run simple-cpp 3d application on ARM embedded Linux against Qt
5.9.5 got the error:

QOpenGLShader::link: Error: uniform variables in fragment shader do not fit
in 222 vectors.

According to
https://www.khronos.org/registry/OpenGL/specs/es/2.0/es_full_spec_2.0.pdf
Fragment shaders can access uniforms belonging to the current shader
object. The amount of storage available for fragment shader uniform
variables is specified by the implementation-dependent constant
MAX_FRAGMENT_UNIFORM_VECTORS
This value represents the number of four-element floating-point, integer,
or boolean vectors that can be held in uniform variable storage for a
fragment shader. A link error will be generated if an attempt is made to
utilize more than the space available for fragment shader uniform variables

So I wonder why simple 3d application can't fit in?

Thanks in advanced for help.

--
With regards, Oleg.
Oleg Evseev
2018-11-26 09:21:21 UTC
Permalink
Hi Paul,

Yes, you are right. Almost today I came to the same conclusion that is due
to lights allocation up to 8 light sources in light.inc.frag

struct Light {
int type;
FP vec3 position;
FP vec3 color;
FP float intensity;
FP vec3 direction;
FP vec3 attenuation;
FP float cutOffAngle;
};
uniform Light lights[MAX_LIGHTS];

Later I plan to reduce MAX_LIGHTS down to 1 source (it is enough for my
app).
For now I already can run simplecustommaterial example with simple shader.

But I still wonder why scene with one geometry with default material
doesn't fit in 222 vectors, while lights array needs only 8*(3+4*3)=120
"places"?

Thanks for help! I'm sorry I haven't written back yet.
Hi Oleg,
Do you recall which Material simple-qml uses? I would assume it's the
PhongMaterial or DiffuseSpecularMaterial. Both of these materials are made
to work with Qt3D default lights which brings in a set of uniforms (see
http://code.qt.io/cgit/qt/qt3d.git/tree/src/extras/shaders/es2/light.inc.frag).
I would suspect this is what's triggering the linking error. The easiest
work around is probably to use your own custom Material with simpler
shaders.
I hope that helps,
Paul
Hi all,
Trying to run simple-cpp 3d application on ARM embedded Linux against Qt
QOpenGLShader::link: Error: uniform variables in fragment shader do not
fit in 222 vectors.
According to
https://www.khronos.org/registry/OpenGL/specs/es/2.0/es_full_spec_2.0.pdf
Fragment shaders can access uniforms belonging to the current shader
object. The amount of storage available for fragment shader uniform
variables is specified by the implementation-dependent constant
MAX_FRAGMENT_UNIFORM_VECTORS
This value represents the number of four-element floating-point,
integer, or boolean vectors that can be held in uniform variable storage
for a fragment shader. A link error will be generated if an attempt is made
to utilize more than the space available for fragment shader uniform
variables
So I wonder why simple 3d application can't fit in?
Thanks in advanced for help.
--
With regards, Oleg.
_______________________________________________
--
KDAB (France) S.A.S., a KDAB Group company
Tel: France +33 (0)4 90 84 08 53, http://www.kdab.fr
KDAB - The Qt, C++ and OpenGL Experts
Loading...