PDA

View Full Version : GeforceFX behavior anomaly



Zeno
05-22-2003, 09:32 AM
I'm working on a program where I auto-gen texture coordinates and have six clip planes enabled. That's my only per-vertex work, other than transforming the position.

Yesterday I made a vertex program to reproduce what the fixed-function pipeline was doing. I used ARB_vertex_program, and ARB_position_invariant so that my clip planes would still work. So far, so good.

The strange thing is that, once I enabled the vertex program, I got about 4-5x the performance I got without it!

Can anyone explain that? If anything, I would expect slightly less performance, but nothing significant....the program should not be geometry bound. I'm drawing less than 1000 triangles per frame.

[This message has been edited by Zeno (edited 05-23-2003).]

Coriolis
05-22-2003, 10:40 AM
User clip planes in the fixed-function pipeline are notoriously slow for nVidia hardware. If you do the clipping yourself in the vertex program, that could easily explain the difference.

Zeno
05-22-2003, 10:45 AM
Ahh, but I don't do the clipping myself in either case. According to the spec for ARB_vertex_program, if you use position invariance, then OGL will continue to clip for you...which it does.

Perhaps clip planes are done in hardware when vertex programs are active but done in software when they're not?




[This message has been edited by Zeno (edited 05-22-2003).]

Jan
05-23-2003, 12:49 AM
Is it possible to do own clipping in a vertex-program, at all??? I mean, you can redefine a vertex´ position, but clipping usually means you have to add a second vertex, which is impossible in a vertex-program (or am i wrong here?).
As far as i understood Zeno, he does it in the fragment-program, which should be possible.

Sorry, it´s OT, but i don´t understand Coriolis "explanation" of the speed-up, therefore i wanted to ask this question.

Jan.

Zeno
05-23-2003, 09:34 AM
Originally posted by Jan2000:
Is it possible to do own clipping in a vertex-program, at all???

No, it isn't possible, you are correct that you would need to be able to create vertices to clip in a vertex program.


As far as i understood Zeno, he does it in the fragment-program, which should be possible.

Sorry, I had a typo in my original post, which I fixed. I am clipping with normal OpenGL clip planes.

Coriolis
05-23-2003, 01:26 PM
Originally posted by Jan2000:
Is it possible to do own clipping in a vertex-program, at all??? I mean, you can redefine a vertex´ position, but clipping usually means you have to add a second vertex, which is impossible in a vertex-program (or am i wrong here?).
As far as i understood Zeno, he does it in the fragment-program, which should be possible.

Sorry, it´s OT, but i don´t understand Coriolis "explanation" of the speed-up, therefore i wanted to ask this question.

Jan.

It's not possible to do pure clipping in a vertex program, but you can do it. All you really need to do is add redundant vertices, so that the new edges always exist but are collapsed down to 0 length before you clip. I don't know if you could easily handle more than 1 clip plane this way before it became combinatorially heinous, but I can imagine special cases where it would in fact work.

JD
05-24-2003, 09:49 PM
You can clip in fragment program though. I think it's kill or some such instruction.