Error prior to using GLSL Program Object : invalid enumerant

Problems building or running the engine, queries about how to use features etc.
Commander
Kobold
Posts: 27
Joined: Thu Oct 11, 2007 12:43 am
Location: Aachen, Germany

Error prior to using GLSL Program Object : invalid enumerant

Post by Commander »

Hello!

I have a problem that I cannot resolve. My application runs fine, however the log gets spammed with the following line:

Error prior to using GLSL Program Object : invalid enumerant

..about once for every frame and mesh with a GLSL material. This does not only happen when using my own shader programs (which are the first I've ever written), but also with ones from the Ogre examples. However the demos themselves do not spit this error.

This might be introduced with updating the 1.6 branch from svn when RC1 was announced (before that, my copy was one or two weeks old). Of course it might also be my own fault, but I already tried out a lot.

From googling I found out that the error might actually be produced somewhere totally different, but the GLSL code is the first that checks for errors. I don't know if that's the case for Ogre.

Maybe someone can point me to a direction how I can debug this. Right now, I'm totally stepping in the dark. Any help is appreciated!

Here's the obligatory Ogre log: http://pastebin.ca/1192088

Thanks for your patience,
Cmdr

Update: Having no lights in my scene seems to fix it, no matter if the shaders care about lights or not...
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66
Contact:

Post by sinbad »

Yes, you should find if you update to the latest on branches/v1-6 that this is now gone (hopefully). Post-RC1 Noman applied a fix to resolve some issues with GL texture unit handling. Please update and let us know.
Commander
Kobold
Posts: 27
Joined: Thu Oct 11, 2007 12:43 am
Location: Aachen, Germany

Post by Commander »

Unfortunately, it's still there. I would really like to help by narrowing down possible causes, but I'm still totally clueless. Please forget my guess with the lights as well.

In the meanwhile, I updated to nVidia driver version 173.14.12, which is the latest stable. I'm also trying to compile my app on windows to see if it happens there.
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66
Contact:

Post by sinbad »

Hrm.

A quick and ugly workaround is to comment out line 205 of OgreGLSLLinkProgram.cpp, but that's just an avoidance rather than a solution.

Is there any chance you can send me a repro case (with source)?
Commander
Kobold
Posts: 27
Joined: Thu Oct 11, 2007 12:43 am
Location: Aachen, Germany

Post by Commander »

Commenting that line would at least allow me to test my game without being afraid of filling my disk with the Ogre.log :wink:

I plan on going open source with my project anyway (as soon I find a cool name for it :wink:), however it consists of almost 13k lines of code and has several dependencies. But I can try to create a stripped-down version that only shows graphics if you want to be able to compile it easily.
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66
Contact:

Post by sinbad »

A repro case would be useful, currently none of my GLSL-using samples trigger this problem so I'd like to know where it's coming from!
Commander
Kobold
Posts: 27
Joined: Thu Oct 11, 2007 12:43 am
Location: Aachen, Germany

Post by Commander »

I've sent a link to an archive to you. It's pretty barebone, but it produces the error.

Please forgive me if it's a silly mistake by me :wink: . However in my opinion producing multiple error messages per frame is not a desired behaviour.
Commander
Kobold
Posts: 27
Joined: Thu Oct 11, 2007 12:43 am
Location: Aachen, Germany

Post by Commander »

As a status report: in my test app I fixed the problem by commenting the following line:

Code: Select all

sceneMgr->setShadowTechnique(Ogre::SHADOWTYPE_TEXTURE_MODULATIVE);
But in my main project this does not suffice. Maybe there is an issue with my reflection/refraction material too.
iigor
Gnome
Posts: 387
Joined: Thu May 08, 2008 3:46 pm
Location: Russia, Moscow

Post by iigor »

Today i also get this error in my log, and before some investigation i figured out that error which make this error is unsetted uniforms, because of when i checked all uniforms in shader and added undefinde in ".program" script all works fine, so i create this thread to find out best decision on this problem.
Here is new thread in feature request: http://www.ogre3d.org/phpBB2/viewtopic. ... 650#308650
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66
Contact:

Post by sinbad »

Hmm - this is actually down to the driver, which implements the linker. I've actually seen errors when trying to link GLSL which had mismatched varyings before. Or do you really mean uniforms that haven't been set?
iigor
Gnome
Posts: 387
Joined: Thu May 08, 2008 3:46 pm
Location: Russia, Moscow

Post by iigor »

When i had mismatched varyings i get error at first attempt to use that shader with full description about which varyings are wrong, but when you have mismatched uniform thereis nothing else than full log of errors and strange shader rezult.
iigor
Gnome
Posts: 387
Joined: Thu May 08, 2008 3:46 pm
Location: Russia, Moscow

Post by iigor »

May be it's ATI specific i use radeon 3850 catalyst 8.9.
But i always loved ati compiler because when something work on ati it would be 100% work on nVidia.
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66
Contact:

Post by sinbad »

Hmm, any idea exactly where the error is generated? I now have gDEBugger but it's locked to my NVIDIA machine now (and I can't afford to buy another one).
iigor
Gnome
Posts: 387
Joined: Thu May 08, 2008 3:46 pm
Location: Russia, Moscow

Post by iigor »

it's from samples: examples.program,
i commented params:

Code: Select all

vertex_program Ogre/BasicVertexPrograms/AmbientOneTextureGLSL glsl
{
	source AmbientOneTexture.glsl

	default_params
	{
		//param_named_auto ambient ambient_light_colour
	}
}
and created material:

Code: Select all

material error_generator
{
	technique
	{
		pass
		{
			vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTextureGLSL
			{
			}
		}
	}
}
created entity with that material and get log full of messages(from every frame):

Code: Select all

12:39:31: Error prior to using GLSL Program Object : unsupported operation("unsupported operation" i translated from Russian, because i think my driver is Russian it writes errors in native language) Fragment shader(s) linked, vertex shader(s) linked. 
And to find which shader is wrong is very very difficult when you have many shaders(
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66
Contact:

Post by sinbad »

@Commander: I never managed to recreate your error on my machine - I built it on Windows with the latest NVIDIA driver and I don't get anything in the log or under gDEBugger set to break on any errors.
User avatar
metaldev
Orc Shaman
Posts: 761
Joined: Thu Mar 17, 2005 11:56 pm
Location: Boston
x 15
Contact:

Post by metaldev »

sorry to dig this one out of the grave, but I am still getting this issue using the latest SDK for 1.6 ... is this expected? or do I need to fix something?
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66
Contact:

Post by sinbad »

Since I could never recreate it, there wasn't anything I could fix.
Haladria
Gnoblar
Posts: 4
Joined: Tue Dec 02, 2008 4:55 pm

Post by Haladria »

I get this error too. On every GLSL-shader I use and every frame, but they all give the correct output to the screen. I will try to create a minimal test case and see if I can locate the error.

Code: Select all

03:59:36: VP = NormalDepth_vs_glslFP = NormalDepth_ps_glsl Error prior to using GLSL Program Object : felaktig åtgärd
03:59:36: VP = FullScreenQuad_vs_glslFP = SSAO_ps_glsl Error prior to using GLSL Program Object : felaktig åtgärd
03:59:36: VP = FullScreenQuadFlipped2_vs_glslFP = BlurX_ps_glsl Error prior to using GLSL Program Object : felaktig åtgärd
03:59:36: VP = FullScreenQuadFlipped2_vs_glslFP = BlurY_ps_glsl Error prior to using GLSL Program Object : felaktig åtgärd
03:59:36: VP = FullScreenQuadFlipped2_vs_glslFP = Combination_ps_glsl Error prior to using GLSL Program Object : felaktig åtgärd
(I changed the error message to also show the current shader it tries to use. )

I've got an Geforce 8800 gts so it's not an ATI error.

/Robert
User avatar
petrocket
Gremlin
Posts: 178
Joined: Tue Mar 20, 2007 3:29 am
x 10
Contact:

Re: Error prior to using GLSL Program Object : invalid enumerant

Post by petrocket »

I also get this error too on my Macbook pro which as the geforce 8600 mt and I'm concerned that it's affecting my framerate. Gonna comment out the log line for now, but isn't it likely that openGL is not running optimally if we get this warning?

I'm using Ogre 1.6 (not RC1) which I compiled from source in release mode

Does anyone have any idea how to debug this warning/error? Is there a way to set a break point in the GL rendersystem library while running a a diff program? I'm not experienced debugging libraries on OSX yet. /me visits google

Code: Select all

Error prior to using GLSL Program Object : invalid enumerantWARNING: Could not find vertex shader attribute 'vertex' to match BindAttributeLocation request.
WARNING: Could not find vertex shader attribute 'blendWeights' to match BindAttributeLocation request.
WARNING: Could not find vertex shader attribute 'normal' to match BindAttributeLocation request.
WARNING: Could not find vertex shader attribute 'colour' to match BindAttributeLocation request.
WARNING: Could not find vertex shader attribute 'secondary_colour' to match BindAttributeLocation request.
WARNING: Could not find vertex shader attribute 'blendIndices' to match BindAttributeLocation request.
WARNING: Could not find vertex shader attribute 'uv0' to match BindAttributeLocation request.
WARNING: Could not find vertex shader attribute 'uv1' to match BindAttributeLocation request.
WARNING: Could not find vertex shader attribute 'uv2' to match BindAttributeLocation request.
WARNING: Could not find vertex shader attribute 'uv3' to match BindAttributeLocation request.
WARNING: Could not find vertex shader attribute 'uv4' to match BindAttributeLocation request.
WARNING: Could not find vertex shader attribute 'uv5' to match BindAttributeLocation request.
WARNING: Could not find vertex shader attribute 'uv6' to match BindAttributeLocation request.
WARNING: Could not find vertex shader attribute 'uv7' to match BindAttributeLocation request.
WARNING: Could not find vertex shader attribute 'tangent' to match BindAttributeLocation request.
WARNING: Could not find vertex shader attribute 'binormal' to match BindAttributeLocation request.
Ogre API & Manual | Ogre Wiki

blog | website | work

Follow me on twitter @ twitter.com/petrocket
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66
Contact:

Re: Error prior to using GLSL Program Object : invalid enumerant

Post by sinbad »

Myke.
Gnoblar
Posts: 8
Joined: Thu Dec 04, 2008 12:20 pm

Re: Error prior to using GLSL Program Object : invalid enumerant

Post by Myke. »

Hey guys,
I'm getting the same problem, and maybe someone of you can reconstruct that error with the provided code:

I'm using a Composer effect. Not really an effect but it is used to implement Softedge Blending between several Projectors:

Code: Select all

compositor SoftEdge
{
    technique
    {
        // Temporary textures
        texture rt0 target_width target_height PF_A8R8G8B8

        // renders the scene into rt0
        target rt0
        {
            // Render output from previous compositor (or original scene)
            input previous
        }

        target_output
        {
            // Start with clear output
            input none
            shadows off
            
            // Draw a fullscreen quad with the black and white image
            pass render_quad
            {
                material Ogre/Compositor/Softedge
                input 0 rt0
            }
        }
    }
}
The material i used looks like this: (I shortened it a bit)

Code: Select all

vertex_program Ogre/Compositor/StdQuad_GL glsl
{
    source StdQuad.vert.glsl
}

fragment_program Ogre/Compositor/B&W_GL glsl
{
    source GrayScale.frag.glsl
}

material Ogre/Compositor/Softedge
{
    technique 
    {
        pass
        {
            depth_check off

            vertex_program_ref Ogre/Compositor/StdQuad_GL
            {
            }

            fragment_program_ref Ogre/Compositor/B&W_GL
            {
                param_named renderedScene int 0
                param_named alphaMap int 1
                param_named xInvert float 0.0
                param_named yInvert float 0.0
            }

            texture_unit 0 // unit 0
            {
                tex_coord_set 0
                tex_address_mode clamp
                filtering trilinear
            }
            
            texture_unit 1 // unit 1
            {
                texture soft1edgeH.TIF 2d
                filtering bilinear
                tex_coord_set 0
                tex_address_mode clamp
            }
            
            // further texture_units follow here.
        }
    }
}
The vertexProgram looks like this (basicaly just a renamed version of the existing StdQuad*glsl):

Code: Select all

varying vec2 uv;

void main()                    
{
    gl_Position = ftransform();
    
    // compute texture coords on the fly
    vec2 inPos = sign(gl_Vertex.xy);
    uv = (vec2(inPos.x, -inPos.y) + 1.0)/2.0;
}
and here goes the fragment program:

Code: Select all

varying vec2 uv;

uniform sampler2D renderedScene;
uniform sampler2D alphaMap;

uniform float xInvert;
uniform float yInvert;

void main()
{
    vec2 uv_alpha = vec2(abs(xInvert - uv.r), abs(yInvert - uv.g));
    vec3 color    = texture2D(renderedScene, uv).rgb * texture2D(alphaMap, uv_alpha).rgb;
    gl_FragColor  = vec4(color, 1.0);
}
In my application itself i do the following:

Code: Select all

Ogre::CompositorInstance* instance = Ogre::CompositorManager::getSingletonPtr()->addCompositor(mViewport, "SoftEdge");
	if (instance) {
		Ogre::CompositorManager::getSingleton().setCompositorEnabled(vp, "SoftEdge", true);
	}

	Ogre::ResourcePtr resource = Ogre::MaterialManager::getSingletonPtr()->getByName("Ogre/Compositor/Softedge");
	if (!resource.isNull())
	{
		Ogre::Material* material = dynamic_cast<Ogre::Material*>(resource.get());
		if (material) {
			mVertParams = material->getTechnique(0)->getPass(0)->getFragmentProgramParameters();
		}
	}

// something in between
 
	mVertParams->setNamedConstant("xInvert", Ogre::Real(xInv));
	mVertParams->setNamedConstant("yInvert", Ogre::Real(yInv));
	mVertParams->setNamedConstant("alphaMap", alphaMapIndex);
like all the others the output shows exactly what I expect from my program, but the console is spammed with the folling line:
Error prior to using GLSL Program Object : invalid enumerant
BTW: This is the only Compositor i use in my Application, but not the only Material, but all the other Materials don't make such Problems (and they all are written in GLSL).

Hopefully someone knows a solution to this problem,
thanks for taking the time to read to this (almost) very last line

lg, Myke.
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66
Contact:

Re: Error prior to using GLSL Program Object : invalid enumerant

Post by sinbad »

Did you try the Subversion 1.6 branch? That includes the updates that I talked about in the above link, and it's solved my problems.
User avatar
metaldev
Orc Shaman
Posts: 761
Joined: Thu Mar 17, 2005 11:56 pm
Location: Boston
x 15
Contact:

Re: Error prior to using GLSL Program Object : invalid enumerant

Post by metaldev »

wow i just updated to 1.6.1 and the problem is fixed, thank god (and you too sinbad :wink: )

also, a note for anyone also changing to 1.6.1 i had to update my compositors to match the ones in the 1.6.1 demos because my original ones crashed on runtime in 1.6.1.


thanks sinbad!
User avatar
xabila
Goblin
Posts: 225
Joined: Mon Jun 05, 2006 9:40 am
Location: rennes [FR]

Re: Error prior to using GLSL Program Object : invalid enumerant

Post by xabila »

I'm also on Ogre 1.6.1 now but i still get the error on the SkeletalAnimation.
I'm on Fedora core 9, and my driver is the 177.82 on a Quadro FX Go1400

Any idea?
User avatar
xabila
Goblin
Posts: 225
Joined: Mon Jun 05, 2006 9:40 am
Location: rennes [FR]

Re: Error prior to using GLSL Program Object : invalid enumerant

Post by xabila »

Well I've got exactly the same problem on windows on a Gforge 7900GT, with Ogre 1.6.1.
Maybe it's my code : (Actually it's the OgreBUllet Demo Code)

Code: Select all

void OgreView::initShadow()
{
  _pSceneMgr->setShadowColour(ColourValue(0.5, 0.5, 0.5));

  Ogre::PixelFormat pxlFmt = Ogre::PF_L8;
  if (_pRoot->getRenderSystem()->getCapabilities()->hasCapability(Ogre::RSC_TEXTURE_FLOAT))
  {
    pxlFmt = Ogre::PF_FLOAT16_R;
  }
  if (pxlFmt != Ogre::PF_L8)
  {
    String CUSTOM_CASTER_MATERIAL("Ogre/DepthShadowmap/Caster/Float");
    String CUSTOM_RECEIVER_MATERIAL("Ogre/DepthShadowmap/Receiver/Float");
    _pSceneMgr->setShadowTextureSelfShadow(true);
    _pSceneMgr->setShadowTextureCasterMaterial(CUSTOM_CASTER_MATERIAL);
    _pSceneMgr->setShadowTextureReceiverMaterial(CUSTOM_RECEIVER_MATERIAL + "/PCF");
    //_pSceneMgr->setShadowTextureReceiverMaterial(CUSTOM_RECEIVER_MATERIAL);
  }

  Ogre::LiSPSMShadowCameraSetup *mLiSPSMSetup = new Ogre::LiSPSMShadowCameraSetup();
  mLiSPSMSetup->setUseAggressiveFocusRegion(true);
  //mLiSPSMSetup->setUseSimpleOptimalAdjust(true);
  mLiSPSMSetup->setOptimalAdjustFactor(1.1f);
  _pSceneMgr->setShadowCameraSetup(Ogre::ShadowCameraSetupPtr(mLiSPSMSetup));

  _pSceneMgr->setShadowTechnique(Ogre::SHADOWTYPE_TEXTURE_ADDITIVE );
  if (_pRoot->getRenderSystem()->getCapabilities()->hasCapability(RSC_HWRENDER_TO_TEXTURE))
  {
    // In D3D, use a 1024x1024 shadow texture
    _pSceneMgr->setShadowTextureSettings(2048, 2, pxlFmt);
  }
  else
  {
    // Use 512x512 texture in GL since we can't go higher than the window res
    _pSceneMgr->setShadowTextureSettings(512, 2, pxlFmt);
  }
}
And i'm using the data on Ogre/Sample Media...
Post Reply