glsl shaders broken in cvs?

Using the latest source from cvs, any object with a GLSL shader applied will not render, displaying a rather unhelpful:

:display:gsg:glgsg(error): at 434 of c:\work\panda3d\panda\src\glstuff\glShaderContext_src.cxx : invalid operation

I thought maybe it was the recent GL buffer changes from zhao but I built the source from before that and it still has the same problem.
I think it might have something to do with the eigen/16 bit alignment changes, but not sure.

Example:

from panda3d.core import *
from direct.showbase.ShowBase import ShowBase

vshader = """//GLSL
#version 120
#extension GL_ARB_compatibility : enable

void main() {
  gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}
"""

fshader = """//GLSL
#version 120
#extension GL_ARB_compatibility : enable

void main() {
  gl_FragColor = vec4(1.0, 0.5, 1.0, 0.5);
}
"""

class Game(ShowBase):
    def __init__(self):
        """Get the game ready to play."""
        ShowBase.__init__(self)
        self.model = self.loader.loadModel('smiley')
        self.model.reparentTo(render)
        self.shader = Shader.make(Shader.SLGLSL, vshader, fshader)
        self.model.setShader(self.shader)

game = Game()
game.run()

Can you file this as a bug report?

There ya go!

I found a fix for the error message.
Line 358 of glShaderContext_src.cxx should be changed from:

if (inputname->get_name().substr(0, 4) == "gl_") {

to

if (inputname->get_name().substr(0, 3) == "gl_") {

The objects are still not rendering though, too bad.

Nice catch! Thanks, I’ve committed your fix.

I have verified that it is not an issue with my build by testing using today’s snapshot build. I also tried building with LINMATH_ALIGN set to UNDEF, but that did not work either.
Are there SDK builds available for download going back further than a few days? That would make it a heck of a lot easier to figure out when the GLSL got broken.

Maybe we should setup a unit testing framework?

In this particular case it would have to save screenshots to test, because there is actually no error, the objects just don’t show up.

I did test builds to narrow it down. It first got broken during Nov. 28, 2011 with changes to glShaderContext_src.cxx and glShaderContext.I.

There must be some other problem though, because just reverting those files does not make the current source work. I will try incrementally syncing forward towards the current source if that is helpful.