[Interest] [Qt3D] Error: uniform variables in fragment shader do not fit in vectors

Oleg Evseev ev.mipt at gmail.com
Mon Nov 26 10:21:21 CET 2018


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.

пн, 26 нояб. 2018 г. в 11:48, Paul Lemire <paul.lemire at kdab.com>:

> 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
>
>
> On 24/11/2018 12:28, Oleg Evseev wrote:
>
> 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.
>
> _______________________________________________
> Interest mailing listInterest at lists.qt-project.orghttps://lists.qt-project.org/listinfo/interest
>
> --
> Paul Lemire | paul.lemire at kdab.com | Senior Software Engineer
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20181126/46aa2af4/attachment.html>


More information about the Interest mailing list