kvark / kri

[old] Modern OpenGL-3 engine, a playground for experimental design concepts and features
2 stars 4 forks source link

Shaders don't link properly on Nvidia #31

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
nvidia 9800 gt driver 257.33

Viewer shows following message:

Shader: Failed to compile object (/part/child_v), message: 0(12) : error C7532: 
global variable gl_InstanceID requires "#version 140" or later
0(12) : error C0000: ... or #extension GL_EXT_gpu_shader4 : enable

Shader: Failed to compile object (/part/surf/vertex_v), message: 0(7) : error 
C7532: global type samplerBuffer requires "#version 140" or later
0(7) : error C0000: ... or #extension GL_EXT_gpu_shader4 : enable

Shader: Failed to compile object (/part/surf/edge_v), message: 0(3) : error 
C7532: global type samplerBuffer requires "#version 140" or later
0(3) : error C0000: ... or #extension GL_EXT_gpu_shader4 : enable

Original issue reported on code.google.com by Wormbl...@gmail.com on 25 Jul 2011 at 3:13

GoogleCodeExporter commented 9 years ago
Hi again!
Unfortunately, It's difficult to find and NVidia machine for me, so I'm working 
on ATI only. I will try to test it on NV soon. The last time I tried NVidia 
didn't seem to support OpenGL core Transform Feedback properly (crashing on the 
glTransformFeedbackVaryins call).

Could you try changing the corresponding "#version" tags to "140" in the broken 
shader objects and see what happens then?
Thanks for the report!

Original comment by kvarkus on 25 Jul 2011 at 3:17

GoogleCodeExporter commented 9 years ago

Original comment by kvarkus on 25 Jul 2011 at 3:35

GoogleCodeExporter commented 9 years ago
I changed and got different errors:

Shader: Failed to compile object (/skin/skin_v), message: 0(20) : error C7011: 
implicit cast from "int" to "uint"

Shader: Failed to link program (45), message: Vertex info
-----------
0(20) : error C7011: implicit cast from "int" to "uint"

Link info
---------
error: Programs must have a vertex, geometry, or tessellation shader assigned 
to use transform Feedback varyings.

Shader: Failed to compile object (/cull/box_g), message: 0(3) : error C3013: 
input/output layout qualifiers supported above GL version 140
0(4) : error C3013: input/output layout qualifiers supported above GL version 
140
0(13) : error C7532: global function EmitVertex requires

Original comment by Wormbl...@gmail.com on 25 Jul 2011 at 4:33

GoogleCodeExporter commented 9 years ago
Ok, could you try fixing those errors by the following way:
/skin/skin_v (line 20):
uvec4 ids = (at_skin + uint(bones_number>>20)) >> 8u;

/cull/box_g (line 1):
#version 150 core

Original comment by kvarkus on 25 Jul 2011 at 6:09

GoogleCodeExporter commented 9 years ago
After those changes:

Shader: Failed to compile object (/cull/draw_v), message: 0(10) : error C7514: 
OpenGL does not allow varying of type struct Bound

Shader: Failed to compile object (/cull/draw_g), message: 0(3) : error C3013: 
input/output layout qualifiers supported above GL version 140
0(4) : error C3013: input/output layout qualifiers supported above GL version 
140
0(15) : error C7514: OpenGL does not allow varying of type struct Bound[]
0(36) : error C7532: global function EmitVertex requires "#version 150" or later
0(36) : error C0000: ... or #extension GL_EXT_geometry_shader4 : enable
0(39) : error C7532: global function EndPrimitive requires "#version 150" or 
later
0(39) : error C0000: ... or #extension GL_EXT_geometry_shader4 : enable

Original comment by Wormbl...@gmail.com on 26 Jul 2011 at 10:24

GoogleCodeExporter commented 9 years ago
Oh, more errors! Good!
I'll make a patch in a couple of hours.
BTW, you know that you can still play with Viewer, even with some shaders 
failing to link.

Original comment by kvarkus on 26 Jul 2011 at 11:20

GoogleCodeExporter commented 9 years ago
I've fixed these errors in shaders and pushed the changes into Hg (rev 
15f126c0382a). Could you please update your 'kri' folder and try again?

Original comment by kvarkus on 26 Jul 2011 at 2:05

GoogleCodeExporter commented 9 years ago
That's a bug in NV driver actually. Structures can be output variables, 
according to the GLSL 3.3 specification.

Original comment by kvarkus on 26 Jul 2011 at 2:50

GoogleCodeExporter commented 9 years ago

Original comment by kvarkus on 26 Jul 2011 at 5:13

GoogleCodeExporter commented 9 years ago
May be the engine needs some kind of shader manager which would load only 
supported shaders? 

New errors:

Shader: Failed to compile object (/cull/check_v), message: 0(14) : error C7514: 
OpenGL does not allow varying of type bool

Shader: Failed to compile object (/g/apply_f), message: 0(29) : error C7514: 
OpenGL does not allow varying of type struct Spatial

Shader: Failed to compile object (/g/apply_v), message: 0(13) : error C7514: 
OpenGL does not allow varying of type struct Spatial

Original comment by Wormbl...@gmail.com on 28 Jul 2011 at 9:09

GoogleCodeExporter commented 9 years ago
Thanks for a new pack of shader errors!
I will fix them ASAP and update the issue.

As for the shader management system - the only real requirement for my shaders 
is the OpenGL context version. The requested version can be changed in 
'kri.conf' of any demo/application. The errors you experience are NV-specific 
and many of them should not be there, according to the specification.

Even If I parse a shader, extract the version and check it via the requested GL 
context version - it would still not guarantee proper compiling/linking, 
because each driver manufacturer treats the specification in his own way.

Finally, shader errors are not breaking the system anyway. During the past 4 
months I was (among other things) trying to make error catching and reporting 
to be as transparent and non-harmful as possible. For instance, shader program 
that failed to link will not be used to render any mesh (and the error will 
only be reported once), so the engine will practically ignore that shader and 
move forward.

Original comment by kvarkus on 28 Jul 2011 at 11:51

GoogleCodeExporter commented 9 years ago
Code updated (Revision 349d83d2d7).
Please, check if there are more NVidia shader errors.

Original comment by kvarkus on 28 Jul 2011 at 1:07

GoogleCodeExporter commented 9 years ago
I've filed a bug to Nvidia about output structures in GLSL.

Original comment by kvarkus on 28 Jul 2011 at 8:14

GoogleCodeExporter commented 9 years ago
Ok, i was able to load scenes taken from kri_viewer_pack without errors in 
debug mode. All other modes cause viewer to silently quit. Is it another bug?

Original comment by Wormbl...@gmail.com on 4 Aug 2011 at 10:16

GoogleCodeExporter commented 9 years ago
That's wonderful!
Viewer quits silently when it encounters exception. I couldn't find a better 
way to handle it under GTK, so it just leaves 'exception.txt' file and quits.
Could you please file another bug (for not working rendering modes) with 
'exception.txt' attached (at least, for one of them - the reason may be the 
same)?

Original comment by kvarkus on 4 Aug 2011 at 11:48