Vertex shaders acting strangely...

Originally posted by PH:
[b]I found something that seems a bit strange: with the line,

glShaderOp2EXT( GL_OP_MUL_EXT, temp2, temp2, temp);

you are multiplying temp2 ( that contains N.L ) with a temporary that you didn’t initialize ( temp ).

Oh, and I’m using the 6118 official drivers ( released yesterday ).[/b]

My fault…
in my original code temp was initialized…
you can remove this line.
The thing is that when you use intensity has the 2nd variable you get a black quad but get a blue one with all others (which is what you can expect).
Try again removing the line

glShaderOp2EXT( GL_OP_MUL_EXT, temp2, temp2, temp);

As you can see i’ve even tested with an unitiliazed variable (called nonInitiliazed ) and it works this way…

But for me the result is not random. I’ve always the same effects each time i run.
I’ll give a try to the new drivers has soon as i get back the radeon (have lend it for another project )

Joel.

Ok, tried that. I get a black quad will all 3 lines.

Now the result should be,

Result = clamp( N.L, 0, 1 ) + intensity( = 0 );

Where does the color blue come from ?

Originally posted by PH:
[b]Ok, tried that. I get a black quad will all 3 lines.

Now the result should be,

Result = clamp( N.L, 0, 1 ) + intensity( = 0 );

Where does the color blue come from ?[/b]

In fact that is N.L that is encoded as a color.

glShaderOp1EXT( GL_OP_MOV_EXT, GL_OUTPUT_COLOR0_EXT, intensity);

in my original code i handle multiple lights that’s why you have got intensity = intensity + clamp(N.L, 0, 1)
I didn’t initialized the light position has it is supposed to have a default value, but maybe i should have…

Too bad i have lost my radeon the day i get replies…
As we don’t get the same results i guess this must be an issue of drivers… (so that was finally a bug that has been fixed)
The thing that trouble me is that you should get a blue quad and not a black one. May be by initalizing the light position this will have the expected results.

Thanks.

Joel.

Well, intensity contains ‘zero’ and you are clamping N.L to be between 0 and 1. The result of N.L is a scalar and adding this to 0 gives N.L which is then replicated to all channels in GL_OUTPUT_COLOR0_EXT. The result is a shade of grey ( or is that gray ? ).

With the code you mailed me, there should never be a blue quad.

Originally posted by PH:
[b]Well, intensity contains ‘zero’ and you are clamping N.L to be between 0 and 1. The result of N.L is a scalar and adding this to 0 gives N.L which is then replicated to all channels in GL_OUTPUT_COLOR0_EXT. The result is a shade of grey ( or is that gray ? ).

With the code you mailed me, there should never be a blue quad.[/b]

You’re right. With the code i’ve sent there should not have a blue quad (with my original you could, but it is a lot more trickier).
Seems the blue came from the temp i didn’t initialized. But as it reproduced the problem i had (with one variable i get a result and with another one i don’t get the same even if the variable’s values aren’t used) i didn’t even though of that .

I’ll make more tests when i get my radeon back. I’ve coded the part i’ve sent without having a radeon. I just tested it on the radeon and as i’ve seen that i got the same behaviour i haven’t been any deeper…
The thing is that my original code is well initialized and presents the problem.

Hold on for now and i’ll make more tests as soon as i get my radeon back (and tell you my results).

Thanks for your help.

Joel.

[edit] typos and spelling, i’m getting too tired to write correct english

[This message has been edited by Joel (edited 08-02-2002).]

Ok,

so i finally get my Radeon back after a fight to death…

I’ve intialized all the things properly in the app now and i still have the strange bug.
I’ve tried with my old drivers and the 6118 ones, same result…

PH if you’re still interested i can send you this (clean) example.
I’d like an ATI guy to give me any answers too… I’m quite sure this is a bug in the drivers.

Thanks so far.
Joel.

6118 are the latest drivers from the beginning of August ?
I haven’t heard that they meant to fix bugs in vertex shaders, so I’m not surprised you didn’t get any better result. Well, as long as we consider it is a bug from the drivers…

Originally posted by Joel:
…PH if you’re still interested i can send you this (clean) example…

Sure, looking forward to it. I’ve done a lot of work with EXT_vertex_shader recently, so everything is still fresh in my mind .

I had a look at the new code and did a few tests. It looks like a driver bug, so you should probably notify ATI about it.

A few observations,

(1) If you don’t use ‘intensity’ after the swizzle command, everything works as expected.

(2) If you add,

glShaderOp1EXT( GL_OP_MOV_EXT, intensity, zero);

after the clamp instruction, things work as expected. The strange thing is that if you add the line immediately after the swizzling instruction ( just before the clamp ), things don’t work. So it can’t simply be a problem with the swizzling instruction. It looks more like the driver is doing some incorrect code optimizations.

(3) If you remove the clamp instruction, everything works as expected.

(4) Changing the clamp instruction to a combination of MIN/MAX doesn’t work either ( unless you re-initialize ‘intensity’ right after, like it 2. ).

Originally posted by PH:
I had a look at the new code and did a few tests. It looks like a driver bug, so you should probably notify ATI about it.

I would like but didn’t find anywhere on their site how to report it…
I hoped one ATI guy will see this post


It looks more like the driver is doing some incorrect code optimizations.

That’s what i thought too. So i think it should be usefull that ATI is notified of this (the reason of this thread as i’ve found a way to go over the problem)

Oh and by the way i switched back to the elder drivers. The newest make my GUI all screwed (i use QT for that). Does anybody has the same problem ?

You can use this driver feedback form ( and provide a download link to the code ),
http://apps.ati.com/driverfeedback/index.asp

or send an e-mail to devrel ‘at’ ati.com.

(nm swwy)

[This message has been edited by vincoof (edited 08-21-2002).]