Future of ARB_fragment_program ?

Having to know how each card works defeats the purpose of having a device-independent API.
This problem will fade over time, and the situation will become like in the CPU world. Do you use to care if your CPU has the intructions run your C program?

And to help me in this discussion let me remember some old words from John Carmack regarding the resource queries:

I do need to get up on a soapbox for a long discourse about why the upcoming high level languages MUST NOT have fixed, queried resource limits if they are going to reach their full potential. I will go into a lot of detail when I get a chance, but drivers must have the right and responsibility to multipass arbitrarily complex inputs to hardware with smaller limits. Get over it
And regarding low level interfaces:

I have not done a detailed comparison with Cg. There are a half dozen C-like graphics languages floating around, and honestly, I don’t think there is a hell of a lot of usability difference between them at the syntax level. They are all a whole lot better than the current interfaces we are using, so I hope syntax quibbles don’t get too religious. It won’t be too long before all real work is done in one of these, and developers that stick with the lower level interfaces will be regarded like people that write all-assembly PC applications today. (I get some amusement from the all-assembly crowd, and it can be impressive, but it is certainly not effective)

This problem will fade over time, and the situation will become like in the CPU world. Do you use to care if your CPU has the intructions run your C program?
And precisely how long will that be? 3 years? 5? 10?

If we don’t have basic useability now, it doesn’t matter if we will be in the right place 10 years from now. Because everyone writing performance apps will be using D3D, and OpenGL will be that thing that CAD programs/non-Windows programs use.

And to help me in this discussion let me remember some old words from John Carmack regarding the resource queries:
First, I do not subscribe to the notion that what Carmack says is the divine word of God, or even more significant than what any other graphics programming professional would say. Plus, logic is with me; the source of an argument or position is irrelevant to the veracity of that argument or position.

In that vein, do note that the ARB promptly shot his nonsesne about non-querryable limits down flat. The mere thought of a low-level graphics API being required to do multipass or whatever it takes to make shader X work is sheer lunacy. It’d guarentee that no glslang implementations would even exist (let alone be at all trustworthy) until hardware was actually capable of virtualizing its limitations. Certainly, you couldn’t write performance code based on it; you have no guarentees, or even educated guesses, about what the compiler, multipasser, etc is going to do with it.

While the ARB agrees with him about not trying to support any further form of assembly (to GL’s detriment), they do not accept that hardware limits need to be virtualized. As they pointed out, if an implementation wishes to do so, they can expose an extension to virtualize these and require the glslang implementation to run any shader it is given.

Equally importantly, Carmack just wants someone else to write the dull, boring, boilerplate code for him. He wants driver developers to write code that takes a shader and breaks it down into multiple passes for inferior hardware so that he doesn’t have to do it. He’s looking ahead to his next engine knowing full well that he’s going to have to write some boring code into that engine to be able to run on R300 hardware just as much as R600 with the same shaders.

And regarding low level interfaces:
Considering that Carmack made a game that can’t be fully run on current hardware, I don’t think he’s the kind of authority you want on performance apps (note: I realize this is irrational, but Carmack bashing is a hobby of mine, so I felt the need to indulge :wink: ).

More on-point, nobody’s arguing that higher level interfaces aren’t the future. The question is much more a matter of when that future gets here.

To my mind, high-level languages are a luxury until the day that hardware limits are actually virtualized (via reasonable means. IE, not because the driver decides to multipass). Once that happens, any usefulness of low-level languages is gone, and we therefore ought to use something else. In that vein, I agree with Carmack that glslang shouldn’t allow for querryable limits, but I add to that that it shouldn’t exist yet.

I recall this quote from Sid Meyer’s Alpha Centauri:

“Technological advance is an inherently iterative process. One does not simply take sand from the beach and produce a Dataprobe. We use crude tools to fashion better tools, and then our better
tools to fashion more precise tools, and so on. Each minor refinement is a step in the process, and all of the steps must be taken.”

Effectively, this means that attempting to leap over a step simply because we know that it will eventually lead to something else doesn’t make it a good idea. This isn’t an API refinement like VBO, which theoretically we could have had at GL1.0. This is a significant feature; a technological advance.

You can skip a step when you’re climing the ladder, but if the rung you’re going to is too high, you’ll pull a muscle or something on the way. CPU improvement didn’t skip the “code in assembly” phase; imagine what would have happened if they did. Imagine sending out your source code to be compiled for their CPU and hardware setup. Maybe it’ll work, but maybe it won’t. There’s no way for you to tell. And your consumers don’t want to here, “Oh, set this build parameter” or whatever other nonsense; if it doesn’t work, it isn’t worth their time.

It isn’t that glslang isn’t a good idea to have even today. The point is that, for quite some time, CPU code was written in both C and assembly. There were good reasons for this; it was a transition period and to not have one of them would have made the transition more painful. It doesn’t make sense to try to just skip the assembly phase just because it’s going to end eventually.

I think the ARB is living in the Ivory Tower, where they can just go for the right answer, when they don’t realize that the right now answer is not only not a bad idea, but quite useful and crucial for many applications.

That’s the first time I’ve ever heard anyone quote from a game to support an argument. Oh brave new world.

ah my two favs knackered and korval (are they one in the same sybil like)

It doesn’t make sense to try to just skip the assembly phase just because it’s going to end eventually.
ild argue, yes it does make sense, stick that broken record back on,
fact - we know that asm shaders will become irrelavant in the future.
the question is when, well i believe since 6 months.

personally ive never even written a arb_vp or arb_fp, why not, well after spending time learning gl1.0 then/multitexture/combine/register_combiners etc. and realising they became outdated quickly, i didnt want to make the same mistake again, spending all that effort to learn something that is practically useless today.
i want those 3 months back that i spent using register combiners! its worth nowt today, i would of been better off doing something else eg collision detection, at least 90% of what i learnt would still been relevant.

ive long since given up caring about an extra 10% performance, im focusing on the extra 300%

the question is when, well i believe since 6 months.
What happens in 6 months?

Neither ATi nor nVidia has any significant card releases lined up for then. There may be a few performance-tweaked refreshers, but that’s it. Certainly, these cards won’t be able to virtualize resources internally, so they will still have resource limits.

The glslang compilers may have improved in that time (though I’m skeptical about ATi’s ability to write an optimizing compiler at all), but will they be trustworthy? Can I write a shader that happens to be near the limits (that I am not aware of because nobody tells me I’m close to them) and then a later driver revision breaks my shader? Can I trust the compiler to not break on a shader that worked on that hardware 3 driver revisions ago?

These are some of the principle reasons for using simpler interfaces (not trusting the optimizer would be another one). Until these problems are solved, glslang has little real use in the performance graphics arena. You just can’t trust it, and if you can’t rely on something, you can’t use it.

Personally, I’d even like to see a return to more hardware-specific things like ATI_fragment_shader. In this language, you have to do a lot of the “compiler’s” work yourself, splitting your shader into distinct phases and doing all the 3-vector/scaler opcode stuff yourself. What it lets you do is work around compiler bugs that the driver developer hasn’t fixed, as well as write a shader that is guarenteed to work on the hardware.

Note that none of these need to be ARB extensions, nor do they ever need to be considered to go into the core. I don’t need to see ARB_vp/fp go into the core. As long as they’re there, with up-to-date features, everything is fine.

personally ive never even written a arb_vp or arb_fp, why not, well after spending time learning gl1.0 then/multitexture/combine/register_combiners etc. and realising they became outdated quickly, i didnt want to make the same mistake again, spending all that effort to learn something that is practically useless today.
There’s no way you could mistake NV_register_combiners as anything other than direct access to specific nVidia hardware of the time. If you were under the impression that this extension was anything more than that, then this was a poor assumption on your part. There’s a reason it was “NV”, not “ARB” or core.

Plus, NV_RC was not “oudated quickly”. It was quite viable for 2-3 years. That’s the normal life-cycle of game development. Plenty of time to put them to use.

For my part, the time I spent learning NV_register_combiners was invaluable. Not only did I get a pretty good glimpse at what the hardware was actually doing, it was the first extension that created the concept of a “fragment program”. Up until then, the “fragment process” was bound to texture enviromnents and the sequence of multi texture. The novelty of NV_register_combiners was that it decoupled texture accessing from fragment usage. In doing so, it helped define fragment processing in much less strict terms.

The mere idea that a texture could be a normal rather than a color image was very profound for me at the time. It seems obvious and silly nowadays, but this was pretty heady stuff back then. If the ARB had just popped out glslang for everyone to use, it’d have taken far longer to simply wrap your head around what it was supposed to do, let alone start thinking of stuff to do with it. This lends some weight to the theory that all the steps in a progression need to be taken. The idea is that, by slowly building up to the concept, it gives people time to analyse it, figure out what works (NV_RC not being object-based didn’t work), figure out what they want to do with it, and figure out which limitations on the overall concept need to be expanded.

The time spent learning ARB_vp/fp has prepared me for the complexities of writing larger shaders that consume more resources. When/if the time comes for glslang to be useful, this experience will be quite useful.

Programmers pick up all kinds of languages. The language is alomst irrelevant (to the degree that it is easy to use, of course); what matters is the experience you get when using it.

Personally, I’d even like to see a return to more hardware-specific things like ATI_fragment_shader. In this language, you have to do a lot of the “compiler’s” work yourself, splitting your shader into distinct phases and doing all the 3-vector/scaler opcode stuff yourself. What it lets you do is work around compiler bugs that the driver developer hasn’t fixed, as well as write a shader that is guarenteed to work on the hardware.

NOOOOO! make it stop!
You do realize there are many people who don’t feel this way. For those people with release dates and deadlines this would make life hell. As I said before, I agree that the rug shouldn’t be pulled out from under ASM shader languages - right now, we could definitely use both (I would even agrue that we could use both indefinitely)

But Korval, you can’t just say that glslang is useless - personally, I hate writing tons of ADD,SLT,whatever instruction code.

Plus I think it’s just plain wrong to factor in things like: “well, maybe i can’t trust the driver” into the development of a language. If the language was repsonsible for all that crap think of what a nightmare it would be to actually use it.

Have you actually had a new driver release break one of your shaders? I’m sure it could happen, but hell, I’ve had a new driver reboot my machine whenever i was rendering in selection mode, using VBOs in a pbuffer context.

These things happen; you point the finger at the driver developer and say: “Hey you really screwed up here, can you fix this?”. They’re writing drivers because that’s what their job is, it’s not my job to hand everything to the board sugar-coated.

Just as the CPU knows what to do with the instructions I’ve sent it, we should learn to expect the same from the GPU.

[quote]Personally, I’d even like to see a return to more hardware-specific things like ATI_fragment_shader. In this language, you have to do a lot of the “compiler’s” work yourself, splitting your shader into distinct phases and doing all the 3-vector/scaler opcode stuff yourself. What it lets you do is work around compiler bugs that the driver developer hasn’t fixed, as well as write a shader that is guarenteed to work on the hardware.
NOOOOO! make it stop!
You do realize there are many people who don’t feel this way. For those people with release dates and deadlines this would make life hell. As I said before, I agree that the rug shouldn’t be pulled out from under ASM shader languages - right now, we could definitely use both (I would even agrue that we could use both indefinitely)
[/QUOTE]I’m going to go way out on a limb and, at least partially, agree with Korval. I don’t think the future of the assembly-level APIs will be in ARB extensions. I think, assuming there is a future, it will be in vendor-specific extensions. This is for the simple reason that multivendor extensions aren’t going to match any vendor’s hardware close enough to actually be useful.

In fact, we’re already seeing this in NV extensions. It would be nice if ATI and Intel would expose extensions for features of their hardware, but they don’t seem interested. What can you do?

Originally posted by idr:
I don’t think the future of the assembly-level APIs will be in ARB extensions. I think, assuming there is a future, it will be in vendor-specific extensions. This is for the simple reason that multivendor extensions aren’t going to match any vendor’s hardware close enough to actually be useful.
That’s exactly what I don’t want to see happening as a 3d coder and as a game developper. I don’t want to write 10 times the same rendering logic for X brands and Y generations of hardware.

I want the driver compiler to either create the best vp/fp the card can run, or to give me back a “failed” message. And then if the program runs too slow, the user will just choose a smaller quality level.

And for the CPU comparison : do you write amd_x86 code and intel_x86 code, or do you write x86 code (not speaking about 3dnow/sse*/mmx here) ?

That’s exactly what I don’t want to see happening as a 3d coder and as a game developper. I don’t want to write 10 times the same rendering logic for X brands and Y generations of hardware.
I couldn’t agree more, although I use ARB_vp/ARB_fp (+ NV extensions to ARB_fp) more often these days. The advantages of run-time compilation in terms of portability can not be denied. And we shouldn’t make any assumptions based on somewhat broken implementations available today.
Of course it would be nice to have vendor specific extensions for ARB_fp, but put yourself in the driverwriter position. I think that the most important thing for them is to improve the core features of the GL (which includes GLSL). Moreover, writing specs for new extensions to ARB_fp/vp is far more time consuming than applying some fixes to existing GLSL implementation allowing it to take advantage of new hardware features.
Personally I don’t want to see ARB programs dead but it is inevitable I am afraid. Most of the current GPU vendors can’t be compared in terms of man power and development potential to the biggest CPU vendors that are able to maintain ASM and high level interfaces at the same time. And the history of languages used for GPU development seems to be somewhat “flipped” compared to the CPU court: there was relatively short period of ARB_fp/vp usage and now developers are rapidly switching to high level languages. Maybe it has something to do with that we don’t have any reference architecture on GPU side, something like x86 for CPUs. Maybe some kind of intermediate target that Cass spoke of could help in this matter, but than again I don’t believe that anyone except Nvidia has the man power sufficient to develop for two APIs (GL and DX) and multiple languages for at least one this APIs.

I emailed the webmaster about making a poll.
The question is, what should the poll question be and what should the options be?

Perhaps…

Do you think ARB_vp/fp should be extended to support the new generation of GPUs?

  • Yes, but I prefer GLSL.
  • Yes, I prefer low level shaders.
  • No
  • Huh?

Well, in general i like GLSL better, than ASM programming. On the other hand, i can understand, that it might be easier to translate ASM into GPU-code, in certain cases.

And i am willing to use, whatever runs better. As a programmer, of course i like having better tools, but it is my JOB to do the dirty work, if it runs faster then.

BUT, i think ARB_fp is a really bad language. It is ASM, so i may be closer to the actual hardware capabilities, but it is still quite abstract. For example, i am not able to use a float, a vec2, vec3 or vec4. No, i have to use a TEMP. How is that supposed to help the driver?? Now we still need a good optimizer, to find out, what gets actually used.
Also, there is not a normalize-function and some other very general stuff. And it was obvious, that this would be implemented in hardware pretty soon!

So, in my oppinion, ARB_fp should not be EXTENDED, but merely REPLACED, by a better thought-through (?) ASM langauge. I am really wondering, how one could make such a castrated “low-level” language. This is definitely not efficient.

Also, i think, nVidias approach of using halfs is not a bad idea. Certainly, some hardware doesn´t support this, but where is the problem? Hardware, that does support it, can use this extra information for a speedup, and other hardware simply uses full precision.

A really good GLSL implementation would be most desireable, but i doubt that ATI and nVidia will get it done fast enough (~1 year).

Jan.

I think, assuming there is a future, it will be in vendor-specific extensions. This is for the simple reason that multivendor extensions aren’t going to match any vendor’s hardware close enough to actually be useful.
but is there gonna be anyone whos gonna use them?, look at ALL the games (not little tech demos) released to date not a single one AFAIKS streches the hardware and couldnt run with glsl, based on this evidence its safe to say the future is gonna be similar. ppl might say they want this and that but if they dont use it then do they really need it, the effort would be better placed elsewhere.

performance isnt everything, personally i believe ease of use is more important, eg i was writing a small demo last night to test something, now i coded it up with immediate mode, quick easy to make changes (which u often do when youre experimenting) sure i could of used VA/VBOS whatever but then it would of taken more time to make/change the test program. im a great believe in results (does anything else matter)

And for the CPU comparison : do you write amd_x86 code and intel_x86 code, or do you write x86 code (not speaking about 3dnow/sse*/mmx here) ?
GPU’s aren’t CPU’s, despite what people would like you to think. You’re trying to compare modern CPU’s with GPU’s that are hardly in nearly as mature a state.

My point is that, if ATI_fragment_shader were extended to cover the 9500+ hardware, we would be able to give hints/direction to the compiler that would let us work around compiler bugs in their ARB_fp compiler. Would we prefer that these bugs not exist? Sure. Has ATi fixed them over 2 years after getting ARB_fp implemented? No.

We need a way to bypass the harder parts of a compiler so that, if they are buggy, then we can work around those bugs.

look at ALL the games (not little tech demos) released to date not a single one AFAIKS streches the hardware and couldnt run with glsl,
While you could arguably call Doom 3 a “tech demo”, there’s no question that it does push the hardware. HL2 does so as well, though it is a D3D game.

The principle reason why games don’t push hardware is because they can’t afford to. They need to reach the widest number of people possible, so they develop for lower-end machines.

And I’m not sure what you mean by, “couldnt run with glsl.” Following English grammar rules would help.

performance isnt everything
Um, no, actually performance is everything. That people can whip up a little demo in 5 minutes is irrelevant to actual software development. It’s this kind of thought that makes people consider OpenGL a hobbiest API.

Performance is the #1 limitation for application developers. If you don’t have the performance to do bumpmapping, you don’t do it. If you don’t have the performance to do that fresnel specular computation, you don’t do it. It’s that simple.

We need a way to bypass the harder parts of a compiler so that, if they are buggy, then we can work around those bugs.
gee ild love to work with your code after youve finished with it :slight_smile:
if ( card == ati && driver_version_is_between( 32.3, 33.5 )
do this
else if ( card == ati && driver_version_is_between( 35.3, 36.5 )
do this
else if ( card == nvidia && driver_version_is_between( 32.3, 33.5 )
do this

While you could arguably call Doom 3 a “tech demo”, there’s no question that it does push the hardware. HL2 does so as well, though it is a D3D game.
both doom3/hl2 could run with glsl on my gffx

Following English grammar rules would help.
a language that doesnt use phonetic(should be f) spelling + has illogical rules
actually now i think about it i can see your attraction
if ( i before e && after c && !not sounds like y)
{
write ie
}
if ( i before e && after c && not sounds like y)
{
write e
}
etc :slight_smile:

Um, no, actually performance is everything.
personally this is my order of preference
1/ get the thing up and running
2/ get it running with correct results
3/ get it bug free/stable
4/ finally get it fast

if i stuck 4 first on the list i wouldnt of released the [big font] worlds first unified lighting game [/big font]
a little while ago, he saiz with no ego :wink: , ild still be farting around squeezing the extra 2.34% out of my collision detection stuff.
btw its actually quite fun to play now.

if ( card == ati && driver_version_is_between( 32.3, 33.5 )
do this
else if ( card == ati && driver_version_is_between( 35.3, 36.5 )
do this
else if ( card == nvidia && driver_version_is_between( 32.3, 33.5 )
do this
Nothing so wierd. Simply attempt to compile the shader one way, and if it fails, try another. Standard fallback techniques. It’s something real developers have to live with. At least, if they want to ship a functioning product, rather than one where incompetence of drivers can break them.

both doom3/hl2 could run with glsl on my gffx
No, it would not. There’s no question about it; the only reason it runs well at all on an FX card is because Id use nVidia-specific API’s for programming it. Through glslang, the same shaders would have murdered your card. This is a proven fact. Carmack himself said that the ARB_fp version of his shaders ran so slowly on nVidia hardware that he had to use NV_fp.

Getting a bit off-topic, but…

a language that doesnt use phonetic(should be f) spelling + has illogical rules
I asked for grammar, not spelling. The rules for periods, punctuation, capitalization, and possession are, not only quite logical, but very well specified. Asking that you use the ‘shift’ key at appropriate places and adding a few punctuation marks here and there so that people can more easily read your text is hardly unreasonable. After all, if your grammer is getting in the way of getting a point across, or annoys those who read it, then you’re not getting your point across and thus you wasted your time making the post to begin with.

Carmack himself said that …
didnt u just dis out some other fella for quoting carmack the few messages ago

No, it would not. There’s no question about it;
how can u be so sure, granted youre prolly more knowledgable with the uptodate features of hardware/hardware direction etc than me, but ive got a sneaking suspicion you havent really developed any major apps yourslef and yet youre telling me (supply evidence otherwise)

Performance is the #1 limitation for application developers
does the same rules apply to ati driver writers? if so u should be praising them instead of knocking them, cause its likely theyve put performance ahead of stabilty. your reply ‘they should give both performance + stabilty features etc’.

you twist and turn like a twisty turny thing

And for the CPU comparison : do you write amd_x86 code and intel_x86 code, or do you write x86 code (not speaking about 3dnow/sse*/mmx here) ?
But from an instruction set point-of-view, those are essentially the same. The differences in hardware architecture and instructions set between, say, a Radeon X800 and a Wildcat Realizm is larger than the difference between x86 and PowerPC. Would anyone expect for a second to use the same assembly code on both those?

That’s why high-level shading languages are the future. If there is going to be a continuation of the assembly-level shading languages, it will be, by necessity, hardware specific.

say, a Radeon X800 and a Wildcat Realizm is larger than the difference between x86 and PowerPC. Would anyone expect for a second to use the same assembly code on both those?
I don’t see why the assemblies can’t be extended AND why it can’t be implemented on the particular GLSL capable hw.

Is it easier to compile assembly shaders as opposed to GLSL or not?

If there was a single GLSL compiler that could compile to a simpler form (ARB_vp/fp), it would make things more consistent.
I know this has been said before, but it’s simply true and it should be considered.

didnt u just dis out some other fella for quoting carmack the few messages ago
I figured someone would point that out. But, then again, I also figured that the person might realize that, in this case, the quote states facts derived from testing rather than his own personal opinions of the future.

how can u be so sure, granted youre prolly more knowledgable with the uptodate features of hardware/hardware direction etc than me, but ive got a sneaking suspicion you havent really developed any major apps yourslef and yet youre telling me (supply evidence otherwise)

No experience is even needed to know this. This is a fact based on knowledge of FX level hardware and how the driver is forced to compile glslang.

Glslang’s spec requires 24-bit floats or better for all floating-point types. This forces nVidia to use 32-bit floats, the slowest possible type. Not only that, because 32-bit floats take twice the room of 16-bit floats, it takes up more room in their “temporary cache” thing that they have in their fragment hardware. Taking up more room means that you can have fewer quads in the fragment pipe. Fewer quads in the pipe means that more cycles are wasted. More cycles wasted means slower hardware.

Originally posted by Korval:
[b] [quote]how can u be so sure, granted youre prolly more knowledgable with the uptodate features of hardware/hardware direction etc than me, but ive got a sneaking suspicion you havent really developed any major apps yourslef and yet youre telling me (supply evidence otherwise)

No experience is even needed to know this. This is a fact based on knowledge of FX level hardware and how the driver is forced to compile glslang.

Glslang’s spec requires 24-bit floats or better for all floating-point types. This forces nVidia to use 32-bit floats, the slowest possible type. Not only that, because 32-bit floats take twice the room of 16-bit floats, it takes up more room in their “temporary cache” thing that they have in their fragment hardware. Taking up more room means that you can have fewer quads in the fragment pipe. Fewer quads in the pipe means that more cycles are wasted. More cycles wasted means slower hardware.[/b][/QUOTE]In fact it is even worse : the Geforce FX was designed long before it was shipped, but it was delayed because of the 3dfx integration into NVidia. At that time, Nv thought the arb would standardize both integer and float based fp. It seems life float fp were thought not to be too important at the time. They were wrong, and they did not have time to remove their integer fp path and to optimize their float fp path.