ATI_fragment_shader and parsing

Hi all,
Before you tell me to go and get a new card, just hear me out for a second, humour me if you have to…

My Raedon 9200 supports ARBvp but not ARBfp, the fragment shader functionality is exposed as ATI_fragment_shader, however, it uses hardcoded OpenGL code instead of asm like txt files to parse (like ARBfp/vp and GLSL). There is an ATI_text_fragment_shader extention to do that, but that is only available under MacOSX which renders 90% of users (if not more) useless…

Does anybody know of a tool/library or another extention that can use text files to generate those fragment shaders for older ATI cards starting from 8500 to 9500? A tool is available for nvidia cards (called nvparse) to generate NV_register_combiners code from asm txt files, is there something like that for ATI cards? I have googled, but found nothing; Just a bunch of forums with people saying they are going to be building their own parser/compiler and that it is a good idea to support those cards, but nothing concrete…

Thanks in advance,
DP

Go get a new card! :stuck_out_tongue: ;D

I’ve searched too and couldn’t find anything. I finally got used to the extension and wrote everything by hand. Cool extension, can be very powerful with enough tweaking. Too bad R200 is missing depth texture support…

Dang, crack and woffle! Looks like im going to have to stick it out with ARBfp/vp and GLSL and buy a new card. Or create another shader path for R200…

Anybody know how Doom3 did it? I think it supports the R200 for pixel lighting and bumpmapping…

[quote=“darkprophet,post:3,topic:24108”]
I didn’t find any “shader” files for NV_RC or ATI_FS, so I guess both were hardcoded in C code. If you go for it, my suggestion is this: write a simple parser to read the shader from a file and automatically generate the OpenGL calls (I’ve done this in Marathon). Very easy to implement but saves a lot of time.

Yes thats the plan, but my fear is that im going to have to code 4 files. 1 GLSL, 1 fragment, 1 vertex, and 1 for both ATI_fragment_shader and NV_register_combine. Either that, or write a complicated parser to parse the fragment/vertex asm files and generate the OpenGL code like you said.

I still haven’t looked at the NV_register_combine extention, is it similar to ATI’s in terms of functionality? Any thing one of them doesn’t support that the other does?

[quote=“darkprophet,post:5,topic:24108”]
Yeah, writing such a general renderer is a big problem. I did it like that in Marathon initially, but then decided it wasn’t worth the trouble and now I only have GLSL plus an NV_RC path for the crappy FX line of cards. Your decision should be based on what you want to support of course (we’re going to support FX+, R300+).

By the way, I didn’t mean an ARB_fragment_program to ATI_FS converter (very difficult), just a simple text representation of ATI_FS that can be easily modified without recompiling.

[quote=“darkprophet,post:5,topic:24108”]
ATI_fragment_shader is the equivalent of NV_register_combiners + NV_texture_shader and both are the equivalent of DX <= 1.4 pixel shaders. Some differences:

  • ATI_FS has a better internal color precision [-8, 8], whereas NV_RC has [-1, 1] with 9-bit signed fixed point values.
  • NV_register_combiners is supported even on Geforce 1 & 2 (no NV_texture_shader though, only on NV20+), whereas ATI_FS needs R200+.
  • NV has kept the NV_RC & NV_TS hardware on newer cards (super fast), whereas ATI is emulating the ATI_FS functionality with the fragment shader hardware on R300+ (I’ve not verified this, but even if it’s true it’s more than fast enough anyway).

Other than these, they are mostly equal in terms of functionality.

Yes, i heard that as well about them and not verified them myself too…So i can’t really comment on how marginal the speed difference is, but if anything, it is definetly measurable…

Marathon is definetly looking good, i dont particularly know the details, is it going to be opensourced? or is it used for a commercial game? Either way, im happy what Java can achieve with games…

Marathon is an engine for strategy games (mainly). It’s in a good state, but far from ready and not our only project, not even our first priority actually. We do plan to release a commercial game on top of it, but that’s obviously going to take a while. As for opensourcing it, time will tell. I certainly plan to release the renderer + tools someday though.

:o

http://realmforge.tigris.org/source/browse/realmforge/trunk/src/Axiom/RenderSystems/OpenGL/ATI/PixelShader.cs?rev=5&view=auto&content-type=text/vnd.viewcvs-markup

Its in C#, and it also changes DX8.1 pixel shaders to ATI_fragment_shader stuff, so not ARBfp…But its a start :slight_smile:

Anybody feels up to the challenge of writing a lexer for ARBfp?

DP