I just want to ask if one could define shader evaluation order for the objects.
Say I have object1, object2 and object3. Each has some shader attached. But I need to run the shader on the object3 as first, than on object1 and the last object2.
I'm going to implement the per-pixel sorting using custom depth map and I want to use fragment shader to write to the Z buffer. Because I'm using composited sprites (that is, one object is composed with multiple sprites where each sprite have some predefined order in which it is drawn) I also need to run the shader in the order in which the sprites are drawn.
Is it somehow possible or am I out of luck?
Edit: I know that shaders are basically run in parallel but want to be sure that there isn't any other method of achieving it.