View Full Version : Multitexturing/Fragment program and fragment operations

10-06-2004, 11:30 PM
I wonder where is the fragment program against all standard fragment operations (scissor test, depth test,alpha test,blending etc)

Before or after all of this test?

Thanks to everyone


10-07-2004, 12:27 AM
Theoretically everything you have listed is after shaders, but implementations do things out of order as optimizations for example early z and obvioulsy scissor. You can't see any visual difference, but the optimizations can be much faster.

The order of scissor is a no brainer, before or after shaders, the visual results are always identical but one is faster (for obvious reasons implementations won't even generate interpolated fragments never mind reach the shader for scissor), however optimizations like the early z (and/or coarse z) test requires that you use the unmodified fragment depth value, otherwise the hardware will perform it later.

Visually behavior remains as if shaders are performed before all the listed framebuffer ops.

The features you have listed are generally referred to as framebuffer operations, the fragment operations that fragment shaders replace are things like texture environments etc.

In addition fragment shaders support instructions like KILL that might initiate an early fragment cull although the actual performance effect is as usual implementation dependent.

10-07-2004, 01:22 PM
thanks dorbie for your help,
I saw a diagram on gamedev.net that explains this pipeline and the shader ar before this fragment function.
It is a directx diagram, but I think that this is very similar.