Advertisement

Vertex/Fragment Programs

Started by January 11, 2005 01:12 PM
25 comments, last by vincoof 19 years, 10 months ago
Quote: Original post by Krohm
Quote: Original post by cippyboy
Oh and is there a shader debugger ? :D I`d really wanna see what the variables contain at run-time and stuff(I guess I`m asking for too much huh ?)

I has been told there is one from NVidia available only to well-known companies, but I think this is just a rumor. The stream-MIMD processing model is not really well suited to debugging.

NVIDIA develops FX Composer which has an integrated shader debugger, but it is designed for Direct 3D only. NVIDIA stated explicitly that they did not plan to export such work for OpenGL in the near future. It is free software, by-the-way.

Quote: Original post by cippyboy
1)Ok some other thing I cam across while writing some testing fragment programs, can I find out the fragment`s 3D position ? the window position doesn`t help too much...

You can use texture generation with EYE_LINEAR mode if you're not using VP's, or you can simply compute such info in a texture coordinate directly from vertex position if you're using VP's.

Quote: Original post by cippyboy
2)How does the DST command work ? I`m sending 2 vectors and still seem not too get what I want... it should return the length on all 4 components right ?

The input vectors must have a very specific style. The first one should be [NA, d^2, d^2, NA] and the second one should be [NA, 1/d, NA, 1/d].
See Section 2.14.5.7 of the ARB_vp spec.

Quote: Original post by cippyboy
Oh and how about the Square Root ? RSQ is reciprocal(which I don`t know what it should mean) I just want to do a square root to a variable that`s all...

reciprocal(x)=1/x
The square root isn't encoded in the ARB_vp/fp instructions, simply because you mostly don't need it (you can almost always do without, be it for distance values into lighting computations etc).
However, if you really want a SQRT-like instruction, you can combine a RSQ followed by a RCP instruction. The former computes 1/sqrt(x) and the latter computes 1/x, so : RCP(RSQ(x)) = 1/(1/sqrt(x)) = sqrt(x)
aha... thanks, by the way I was wondering that once you can`t acces the framebuffer, how can you emulate blending ?

Relative Games - My apps

Advertisement
You have to copy screen to texture and work with that if you need some kind of special blending that you can't get with normal blending.
You should never let your fears become the boundaries of your dreams.
I was actually talking about the normal gl blending, I can`t test it right now but I think that when fragment programs are on, blending is off so... How can I blend in a fragment program ? Default OpenGL can do it and I can`t ? I just can`t believe that OpenGL copyes everything puts it to a texture and then computes the final color...

And no I don`t want any speciall effect(for now :D) I just want normal blending, let`s say a (GL_ONE,GL_ONE) type for the simplicity of it, just don`t tell me you can`t do that in a fragment program ?

Relative Games - My apps

You can use blending with fragment program, but these are different stages.
You can enable fragment programming or not, as well as you can enable blending or not. They look very similar in some way, but are independant in fact.

If you lose the blending stage when you enable fragment programs, then either there's a bug in the implementation (eg the driver), or you simply forget to fill the alpha component of the output color in the fragment program.

The current blending implementation in OpenGL does NOT copy the whole image to a texture, of course ! But what Mirko meant was that you can't rule blending in the fragment programming stage, but you can almost do the same thing if you get the picture into a texture and use it in a fragment program.

A future OpenGL implementation would allow programs dedicated to the blending stage, but actually nothing is really serious about that in the near future. So you have to stick with the copy-to-texture trick that everybody uses actually.

hth
Oh bummer ! I thought that the framebuffer acces would fix everything (and I really think it would) but copying to a texture is kind of slow as much I`ve seen in my now "ancient" code... hm... that`s bad news, so when are we gonna have framebuffer acces ? can`t wait :D

Oh and you wore right with the blending, it stays on if it`s on ;)

Relative Games - My apps

Advertisement
You can already perform few neat tricks with the blending stage, thanks to blending equations and such.
Quote: Original post by vincoof
NVIDIA develops FX Composer which has an integrated shader debugger, but it is designed for Direct 3D only. NVIDIA stated explicitly that they did not plan to export such work for OpenGL in the near future. It is free software, by-the-way.

Well, I didn't know that so I checked it again.
I see there's something useful to debugging but it's still somewhat very different from what I call a "debugger". Beside easy interactivity and some compiler tools I'm not able to see nothing which looks like a real debugging functionality as meant in the usual way.
Can you please point me where to find that?
Thank you.

Previously "Krohm"

Oh one interesting thing, when I put in the fragment`s result.depth it`s color, a weird blending occurs, I thought that could be my intro to fragment blending but... hm... I guess it`s just an optical illusion :D

Relative Games - My apps

Quote: Original post by Krohm
I see there's something useful to debugging but it's still somewhat very different from what I call a "debugger". Beside easy interactivity and some compiler tools I'm not able to see nothing which looks like a real debugging functionality as meant in the usual way.
Can you please point me where to find that?

Please, where to find "what" ? The debugging feature of the software ? Or another "more complete" shader debugger software ?

This topic is closed to new replies.

Advertisement