Pixel shaders in OpenGL

Started by
7 comments, last by browny 20 years, 8 months ago
I am using a GeForce4 Ti 64 MB card and it certainly has programmable pixel shader capability. But most of the programs/demos floating around the net uses "GL_ARB_fragment_program" extension to do pixel shading which my driver doesn''t have. I have tried updating my drivers from nVidia.com but still... "GL_ARB_fragment_program" seems to be missing though i have extensions like "GL_NV_register_combiners" "GL_NV_register_combiners2" and "GL_NV_texture_shader" which i suppose are NVIDIA''s own pixel shading extensions. If that''s the case then if i write a pixel shader now using the extensions that i have in my driver then it might not run on an ATI board for the same reason the downloaded demos aren''t running on my card only because i dont have an extension (GL_ARB_fragment_program ) whereas my hardware has the capability. NOW the question is... how STANDARD is OpenGL when it comes the the question of some widely used stuffs like "Vertex Shaders" and "Pixel Shaders" ?
Z
Advertisement
GL_ARB_fragment_shader?!
Either GL_ARB_fragment_shader or GL_ARB_fragment_program is an ATI extension??!
quote:Original post by browny
If that''s the case then if i write a pixel shader now using the extensions that i have in my driver then it might not run on an ATI board for the same reason the downloaded demos aren''t running on my card only because i dont have an extension (GL_ARB_fragment_program ) whereas my hardware has the capability.

The answer is easy: your card has no support for programmable pixel shaders. ARB_fragment_program is only supported by fully programmable hardware, ie. DX9-type boards: GeForce FX, Radeon 9x00.

The GeForce4 does not support that extension, because it does not have the required hardware support. In fact, a GeForce4 is not programmable, but configurable. Means, it still has a fixed function pixel pipeline, but you can route the fragments around in a multitude of ways. This is done with vendor specific extensions aka. NV_register_combiner(1,2) or NV_texture_shader(1,2,3). Your code will obviously not work on ATI cards then.

Your options:

*) Write two codepaths, one for nVidia and one for ATI. This is certainly the best choice to target a wide range of 3D cards out there, but it''s more work.

*) Get a new 3D card, and use ARB_fragment_program. Your code will only work on DX9-level cards.

*) Don''t use pixelshaders at all, but use standarized combiners, eg. ARB_texture_combine. This will work on all cards, but is technically very limited.

*) Enable NV30 emulation on your GeForce4. This will give you the ARB_fragment_program extension, but it will be 100% software emulated. It will be extremely slow. But you can at least develop for DX9 type cards without needing one.

*) Use Cg. Cg can compile into all kinds of vendor-specific or vendor-independent extensions.
Yann, do you use Cg?
im trying to get started with it but i still havnt got round to it

Danushka | IRIX
"I am a donut! Ask not how many tris/batch, but rather how many batches/frame!" -- Matthias Wloka & Richard Huddy, (GDC, DirectX 9 Performance)

http://www.silvermace.com/ -- My personal website
Cg is good here.

very good.

One disadvantage in Cg is that it doesn''t compile to Ati extensions (which should be obvious why)... But also, it doesn''t compile to Direct3D pixel shader 1.4... Which is a lot more useful now days than nvidia will probably admit... This makes a radeon 8500/9000/9100/9200 pretty useless in GL and no better than a Ti in D3D.. When in both it is really a lot more powerful.

Although, I havn''t looked into it, I think there might be other Cg compilers, which may solve this problem (there is a dud link on the nvidia dev site called ''open source compiler'', which gives hope)

there is also ''CGFx'' - effectivly the direct3d fx file format, but for GL and D3D, which lets you do nice material and old-school combiner stuff. Tis very good this. I wish I knew about it before I wrote my own combinery shadery materialy codey stuff in the past.

I''ve had a few issues with Cg for some small things not working right but overall it''s really nice.

It''s a lot nicer than writing (and especially converting) asm / combiners... especially if you want a bit of artistic freedom.

| - Project-X - On hold.. - | - adDeath - | - email me - |
D3D8 has the same problems as well. While Ati can process ps < 1.4, they''re emulated thru 1.4 and thus loose some speed from what I understand. I were you I would just buy dx9 card ie. one that can do gl arb fragment/vertex programs. Rumors have it that ati''s r300 core and up can do gl2 but it has to be written into drivers first. I also understand that ati has very fast shader path compared to nv gffx. Is it still 50% behind of ati?
GL has no problems cg compiles to ARB_fragment_program
my Radeon is running these nVidia Demo''s pretty sweet

- danushka | IRIX
"I am a donut! Ask not how many tris/batch, but rather how many batches/frame!" -- Matthias Wloka & Richard Huddy, (GDC, DirectX 9 Performance)

http://www.silvermace.com/ -- My personal website
Is there a GeForce 4 Ti 64MB? There are the MX cards with 64MB but not the Ti cards.

"C lets you shoot yourself in the foot rather easily. C++ allows you to reuse the bullet!"
Member of the Shove Pouya Off A Cliff club, SPOAC. (If you wish to join, add this line to your signature.)Member of "Un-Ban nes8bit" association, UNA (to join put this in your sig)"C lets you shoot yourself in the foot rather easily. C++ allows you to reuse the bullet!"
quote:Original post by silvermace
Yann, do you use Cg?
im trying to get started with it but i still havnt got round to it

Yes, I do, especially for prototyping new shaders. It''s very convenient and easy to use. Although I generally rewrite the shader in ASM once it is done (performance), it''s so much simpler to have a high-level language, when you experiment around.

I will probably switch to GLSL though, once good drivers are generally available.

This topic is closed to new replies.

Advertisement