Skip to main content
GameDev.net gamedev.net
🔒 Locked

poor shader performance

Started by m4444x May 17, 2006 at 7:50 AM 5 replies 1.2k views
Original Post
m4444x
m4444x
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]
superpig
superpig
What graphics card are you running it on?
Richard "Superpig" Fine - saving pigs from untimely fates - Microsoft DirectX MVP 2006/2007/2008/2009
"Shaders are not meant to do everything. Of course you can try to use it for everything, but it's like playing football using cabbage." - MickeyMouse
m4444x
m4444x
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.
nmi
nmi
What happens if you comment out the texture access ?

Do you maybe compile&link the program for every frame inside your rendering loop ?
m4444x
m4444x
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.
dbzprogrammer
dbzprogrammer
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()?
We should do this the Microsoft way: "WAHOOOO!!! IT COMPILES! SHIP IT!"
nmi
nmi
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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.