Cg shaders limited to ARB profiles on non-nvidia cards

Bug #1154064 reported by ninth
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Panda3D
Fix Released
High
rdb

Bug Description

On ATI and Intel onboard cards Cg report that "Cg program too complex for driver " if shader contain cycles with many iterations or non constant cycles. This is because Cg unroll cycles. It would be great if we could control options like "unroll" by instructions in the header of shader or in the confir.prc

Tags: ati cg intel
Revision history for this message
rdb (rdb) wrote :

This would indeed be a nice feature to control, but cgc already does this by default. The error is caused by a different issue. You should try a recent build of Panda3D (1.8.1 won't work) and let me know what error messages it reports, particularly with "notify-level-gobj" set to "debug".

Revision history for this message
ninth (rupanda3d) wrote :

Panda3D-2013.05.06-22
Windows 7 x32
Intel HD Graphics 2000
In shader file I define:
//Cg
//Cg profile glsl

If you need, I can make log on another system with ATI graphic card.

Revision history for this message
rdb (rdb) wrote :

The correct line in the shader is "//Cg profile glslv glslf", the one you posted is a no-op.

Could you also give me the output with "notify-level-glgsg debug"? Thanks! Also, please make sure that basic-shaders-only is set to #f, of course.

Revision history for this message
ninth (rupanda3d) wrote :

New log with both gobj and glgsg debug. Also I changed profile definition to "//Cg profile glslv glslf"
basic-shaders-only is already #f

Revision history for this message
rdb (rdb) wrote :

Thank you, that is immensely helpful.
From what I gather, there are two problems:
* For your graphics card, the Cg runtime is always reporting that the 'latest' profile is arbvp1/arbfp1, which is nonsense. We could work around this easily, and this would already solve the problem by itself.
* But setting the profile in the shader is also supposed to make it work, and the fact that it doesn't suggests there's something wrong in the code that parses the shader file. I'll have to look into this, but I cannot do so currently as my Panda build is currently crashing.

Fixing these two things should be able to finally resolve the issues, though, so many thanks for helping out in tracking this bug down.

tags: added: ati cg intel
Changed in panda3d:
importance: Undecided → High
status: New → Triaged
summary: - Cg unroll cycles
+ Cg shaders limited to ARB profiles on non-nvidia cards
Changed in panda3d:
milestone: none → 1.8.2
Revision history for this message
rdb (rdb) wrote :

I'm going to roll back my 'fix' due to completely broken shaders with the AMD Catalyst drivers.
The ARB profiles seem to be the only reliable ones on non-NVIDIA cards. Please limit your shader complexity or switch to GLSL entirely.

Changed in panda3d:
assignee: nobody → rdb (rdb)
milestone: 1.8.2 → none
status: Triaged → Won't Fix
Revision history for this message
rdb (rdb) wrote :

I had another stab at this. I had to completely overhaul the way we compile Cg shaders, and needed some pretty obscene workarounds, but I think I fixed it. I can now use non-basic Cg shaders (via GLSL profiles) on both my AMD card on Linux and my Intel card on Windows.

There are some limitations with regards to the semantics that are used in the shader, though - in particular, using "NORMAL0" produces errors while "NORMAL" does not. Weird stuff.

Changed in panda3d:
milestone: none → 1.9.0
status: Won't Fix → Fix Committed
rdb (rdb)
Changed in panda3d:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.