Sign in to follow this  
m4444x

poor shader performance

Recommended Posts

m4444x    122
Hi! I'm trying to jump on the shader train but somehow it doesn't start rolling. For testing purpose I wrote the simplest shader I could think off:
varying vec2 texco;

void main( void )
{
    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
    texco = gl_MultiTexCoord0.xy;
}
uniform sampler2D BaseMap;
varying vec2 texco;

void main( void )
{
    gl_FragColor = texture2D( BaseMap, texco );
}
The linker then told me that the shaders will 'run in hardware'. So I expected this to run very fast but instead the performance is really poor. Only one or two frames per sec while the same thing rendered with the standard pipeline gives me a fps count around 1000. I wonder now what could cause such a slowdown? [Edited by - m4444x on May 17, 2006 3:45:30 PM]

Share this post


Link to post
Share on other sites
m4444x    122
It's an ATI 1600

I checked some precompiled GLSL examples from codesampler.com and they run just fine. So it's probably not the Gl driver.

Share this post


Link to post
Share on other sites
nmi    978
What happens if you comment out the texture access ?

Do you maybe compile&link the program for every frame inside your rendering loop ?

Share this post


Link to post
Share on other sites
m4444x    122
I'm fairly sure that the shaders are only compiled and linked once during application startup.

Without the texture lookup it's a little bit faster but still much to slow (about 10 fps).

I get the feeling that the problem is directly related to the fill rate because if I reduce the viewport size the fps counter increases accordingly.

Share this post


Link to post
Share on other sites
dbzprogrammer    100
Drop your variable "texco." Use the default one, gl_TexCoord[0]. See how that does, and if it's still slow, then I'm not too sure what could be the problem. I think your main problem is is that your video card doesn't like the varying variable. And why not just ftransform()?

Share this post


Link to post
Share on other sites
nmi    978
I tested your shader programs with TyphoonLabs Shader Designer.
It works fine on my system (Athlon64, GeForce 6600 GT).

Maybe the information from your linker is incorrect, and the shaders are not hardware accelerated.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this