Sign in to follow this  

ARB_FRAGMENT_PROGRAM and my good old Ti4200

This topic is 4868 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok, so i read a few papers about the ARB_FRAGMENT_PROGRAM extension and i found a tutorial on GDNet that says it was tested on a GF4Ti4200. So i ran the demo and it had like, 0.164 fps. I also checked the availability for the extension and it is supported (together with the required ARB_FRAGMENT_SHADER extension) on my card. Is there a reason for the FPS? I suppose it falls back to software mode but as the tutorial said it worked on my card i guess there must be some way around it, or did they mean that it wasn't completely impossible to run it? Thanks for any help. BTW, i have a GF4 Ti4200 128MB AGP8X. Latest official NVidia drivers and Windows XP Pro.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
ARB_fragment_program is effectively Pixel Shader 2.0, which the Ti4200 does not support (I believe it is PS1.3?). In any case, the performance that you are seeing is more than likely software fallback.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
PS1.3 is not exposed through OpenGL with a glProgramString like interface. The best you can do is NV_register_combiners (which actually is a better description of PS1.3 anyway). I believe the register combiners were rolled into the OpenGL core for 1.4 (maybe it was 1.3).

Share this post


Link to post
Share on other sites
Register combiners are an nvidia-only extension, and were unfortunately never standarized through EXT or the ARB, much less made core.

To get the full PS1.3-like shader functionality of a GF4, you need to use both register combiners, as well as texture shaders (NV_register_combiners(2), NV_texture_shader(2,3)). Together, both actually offer more powerful shader functionality than the D3D PS1.3 standard, but they're unfortunately vendor dependent.

Share this post


Link to post
Share on other sites
Thanks for the info, that sucks. I saw NVidia CG OpenGL examples using Vertex Programs and these sorts of programs:


void main( float4 Position : POSITION, //in projection space
float4 Normal : COLOR0, //in tangent space
float4 LightVector : COLOR1, //in tangent space
float4 TexCoord0 : TEXCOORD0,
float4 TexCoord1 : TEXCOORD1,
out float4 Color,
uniform sampler2D DiffuseMap,
uniform sampler2D NormalMap,
uniform float Ambient)
{
//fetch base color
float4 color = tex2D(DiffuseMap);

//fetch bump normal
float4 bumpNormal = 2 * (tex2D(NormalMap) - 0.5);

//expand iterated normal to [-1,1]
float4 normal = 2 * (Normal - 0.5);

//expand iterated light vector to [-1,1]
float4 lightVector = 2 * (LightVector - 0.5);

//compute self-shadowing term
float shadow = saturate(4 * dot(normal.xyz, lightVector.xyz));

//compute final color (diffuse + ambient)
Color = color * (shadow * saturate(dot(bumpNormal.xyz, lightVector.xyz)) + Ambient);
}



This one does diffuse (and specular in another shader) bumpmapping and works fine.

Can anyone tell me what they are and whether or not they are vendor specific. Thanks!

A few examples used RCs and TSs but they both have no main function, this one obviously does ;].

And, are there any advantages of RCs and TSs over PSs/FSs/PPs/FPs on the latest generation NVidia cards?

Share this post


Link to post
Share on other sites
Quote:
Original post by Tree Penguin
This one does diffuse (and specular in another shader) bumpmapping and works fine.

Can anyone tell me what they are and whether or not they are vendor specific. Thanks!

Cg compiles down to either ARB vertex/fragment programs or various nvidia only extensions. Whether or not a compiled Cg shader is vendor dependent, depends on the profile you select when compiling it. An uncompiled (ie. on the fly compiled) Cg shader is vendor independent.

Quote:
Original post by Tree Penguin
A few examples used RCs and TSs but they both have no main function,

Of course they don't, they are no programs. They're just a large set of routing states. As I said, Cg can compile down to regcoms and texture shader setups, if you respect their inherent limitations within the Cg code. As an example, if you compile a Cg shader to the GeForce3/4 rc/ts profile, it will generate a set of regcom and texture shader states that will create the requested effect. The same shader will compile to ARB_fragment_program, if you select an ARBFP profile. Obviously, regcoms/TS are far more limited than FPs, so you need to respect those limits in your Cg program - the Cg code will not compile to the GF4 profile if you don't.

Quote:
Original post by Tree Penguin
And, are there any advantages of RCs and TSs over PSs/FSs/PPs/FPs on the latest generation NVidia cards?

No.

Share this post


Link to post
Share on other sites
Thanks!

So, i can use CG in my app/game using a runtime compiler (maybe multiple compilers, choosing one depending on the gfx card's specs, if that's neccessery) and it will increase compatibility without having to write RC/TS code myself?

I have searched for PS tutorials but they all are in DX. Does anyone know of a/some good OpenGL tutorials on PS?
Thanks again.

Share this post


Link to post
Share on other sites
Quote:
Original post by Tree Penguin
So, i can use CG in my app/game using a runtime compiler (maybe multiple compilers, choosing one depending on the gfx card's specs, if that's neccessery)

Cg comes with an all-in-one compiler.

Quote:

and it will increase compatibility without having to write RC/TS code myself?

Yes, exactly. Just keep in mind that older ATI cards (those without ARB_VP/FP) will not be supported.

Quote:

I have searched for PS tutorials but they all are in DX. Does anyone know of a/some good OpenGL tutorials on PS?

You won't find very much about OpenGL pixel shaders, because they aren't called pixel shaders in OpenGL ;) Search for either fragment programs (for lowlevel ASM ARB_FP shaders) or fragment shaders (or GLSL) for OpenGL highlevel shaders. Don't forget to check out the opengl.org shader forum.

Nvidia has a lot of Cg stuff on their developer site, and this site can also help. And then you have the classic tutorial sites, like Humus or Delphi3D.

Share this post


Link to post
Share on other sites
Thanks!

I kind of lost my hope when i read "For OpenGL things are a bit different. There the ps 1.3 instructions are not available, and you can only access the functionality trough register combiners." in a flipcode article.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Take a look at GL_ARB_texture_combine. This gives to core (as of 1.3) PS1.3 pixel shader like functionality.

Share this post


Link to post
Share on other sites
Quote:
Original post by Anonymous Poster
Take a look at GL_ARB_texture_combine. This gives to core (as of 1.3) PS1.3 pixel shader like functionality.

ARB_texture_env_combine and PS1.3-like functionality ?! You must be kidding...

Share this post


Link to post
Share on other sites

This topic is 4868 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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