-
Bug
-
Resolution: Done
-
P1: Critical
-
6.0.0
-
None
-
-
8361bdd25c0bb04e68ded8e803cc27daa55f782e (qt/qtquick3d/dev) 9cbb01db78f5ec49e362d0ed88111f22c5402811 (qt/qtquick3d/6.0)
-
Qt Quick 3D - 49/50
When creating a CustomMaterial with Unshaded shadingMode, it is possible for the shader generation/compilation to fail when there are varyings but no uniforms (custom properties).
It seems to be because QQ3D_SHADER_META is created in two blocks:
Working:
36 #ifdef QQ3D_SHADER_META
37 /*{
38 "uniforms": [
39 { "type": "vec4", "name": "flatColor" }
40 ]
41 }*/
42 #endif
43 #ifdef QQ3D_SHADER_META
44 /*{
45 "inputs": [
46 { "type": "vec3", "name": "var_normal", "stage": "fragment" }
47 ]
48 }*/
49 #endif
Non Working:
40 #ifdef QQ3D_SHADER_META
41 /*{
42 "uniforms": [
43 ]
44 }*/
45 #endif
46 #ifdef QQ3D_SHADER_META
47 /*{
48 "outputs": [
49 { "type": "vec3", "name": "var_normal", "stage": "vertex" }
50 ]
51 }*/
52 #endif
The lack of any uniforms in the first block is expected for a material that doesn't expose any custom uniforms properties. But what happens is that when the shader meta data is parsed it hits this block in qssgrendershadermetadata.cpp:
// /*{"uniforms":{"name":"x","type":"y"}}*/ => 40
if (size < 40) {
qWarning("Shader metadata section found, but content to small to be valid!");
break;
}
But this blocks the parsing of varyings by breaking, meaning that valid shader code will not be generated.