PDA

View Full Version : shader running in software when it says it is running in hardware...



killerseven
11-10-2005, 10:33 AM
What could be the cause of a shader running in software when it says in the link log that it will run in hardware.

I have tried creating the simplest possible shader and rendering a small quad with it kills the framerate.

Here is my shader:

// Vertex shader
void main()
{
gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}

// Fragment shader
void main()
{
gl_FragColor[0] = 1.0;
gl_FragColor[1] = 0.0;
gl_FragColor[2] = 1.0;
gl_FragColor[3] = 1.0;
}and here is how I use it


glUseProgramObjectARB(simpleShader);
glBegin(GL_QUADS);
glColor4fv(color);
glVertex2f(vertices.m_min.x, vertices.m_min.y);
glVertex2f(vertices.m_max.x, vertices.m_min.y);
glVertex2f(vertices.m_max.x, vertices.m_max.y);
glVertex2f(vertices.m_min.x, vertices.m_max.y);
glEnd();
glUseProgramObjectARB(0);The shader initialises with no errors and says it will run in hardware. It does render correctly with no glErrors, but it is running in software.

I am running this on my laptop which has an FireGL T2 card, this shouldnt be a problem though as it runs every glsl demo I have tried.

jide
11-10-2005, 01:46 PM
How do you know it is running on the cpu side ?

killerseven
11-10-2005, 02:30 PM
I dont know for sure that it is (is there a reliable way to check this?), but drawing a fullscreen quad without the shader runs at 100+fps, whereas drawing it with the shader causes it to run at 1-2fps.

I am assuming that this is because of the software renderer kicking in.

jide
11-10-2005, 02:38 PM
If the demos run well, then it really looks strange. Can you post your full code ?
Also for gl_FragColor I use gl_FragColor = vec4 (1,0,1,1) as it's not an array. Maybe it's simply that or another thing people here might discover when seeing your code. But like that I'm almost sure very few people could give the solution like that.

killerseven
11-10-2005, 03:03 PM
sorry, I cant post my code. I'm just going through it all now stripping everything out to be sure I havent missed anything obvious.

I just wondered if there is something I should look out for that could cause this.

I tried your gl_FragColor suggestion but it didnt fix it.

Thanks for your help

killerseven
11-10-2005, 03:39 PM
One thing I have just noticed is that glCreateProgramObjectARB() returns -2147483647.

I take it that this is not a normal return value?
Does anyone know what could cause this?

Humus
11-10-2005, 07:01 PM
That looks like a normal value actually. At least if you're using GLSL extension rather than GL2.

killerseven
11-11-2005, 03:51 PM
I found the cause of the problem.

I enable GL_LINE_SMOOTH at the start of my program, and for some reason this cripples the rendering of any primitive with a shader.

It was no problem to just enable and disable LINE_SMOOTH around my line rendering and the problem goes away.

I am running the latest IBM drivers on my T41p, I think they are based on the first set of ATI drivers that supported GL 2.0 (I've been waiting for them to update them with ATI's latest drivers that support FBO's).

Thanks everyone for your help.

V-man
11-11-2005, 05:30 PM
GL2 on ATI returns large values. It's not like glGenTextures.

I think line smooth and point smooth cause this problem.

Mars_999
11-12-2005, 04:16 PM
Originally posted by killerseven:
I found the cause of the problem.

I enable GL_LINE_SMOOTH at the start of my program, and for some reason this cripples the rendering of any primitive with a shader.

It was no problem to just enable and disable LINE_SMOOTH around my line rendering and the problem goes away.

I am running the latest IBM drivers on my T41p, I think they are based on the first set of ATI drivers that supported GL 2.0 (I've been waiting for them to update them with ATI's latest drivers that support FBO's).

Thanks everyone for your help.I don't have a FireGL card, but what drivers does that card use? Catalyst? I am not sure on this but you can try it or look into it, http://www.driverheaven.net/ and look around for the mod tool to make the newest drivers work with your laptop without waiting for IBM. HTH

killerseven
11-12-2005, 05:40 PM
The Fire GL does use the catalyst drivers, and I have tried using the hacked (non-IBM) ones before, but they messed up my power management so I stick to the official drivers now.