#1 Members - Reputation: 173
Posted 24 June 2012 - 11:25 PM
For some reasons, I want to disable the pixel shader (fragment shader). It means that the hardware will throw fragments away right after they come out of the rasterization stage so that the fragments can't be able to get into the next stage (pixel shader).
I know that we can disable rasterization stage by enabling RASTERIZER_DISCARD, is there any similarity with pixel? or any trick to do that?
Thank in advance,
-D
#2 Members - Reputation: 1408
Posted 25 June 2012 - 07:08 AM
(GL_FRONT_AND_BACK). That will cull all faces of triangles, sending none to the fragment shader.
Edited by larspensjo, 25 June 2012 - 07:08 AM.
#5 Members - Reputation: 3828
Posted 25 June 2012 - 07:28 AM
It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.
#7 Members - Reputation: 3828
Posted 25 June 2012 - 09:17 AM
It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.
#8 Members - Reputation: 773
Posted 25 June 2012 - 09:31 AM
#9 Members - Reputation: 3828
Posted 25 June 2012 - 10:29 AM
Even that won't be 100% perfect though as in a real program there will be all kinds of other stuff going on - CPU/GPU concurrency and concurrency of pipeline stages may even mean that an apparently complex pixel shader can be had for free.
It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.
#11 Members - Reputation: 546
Posted 25 June 2012 - 02:03 PM
gDEBugger does this, you can check the GL_GREMEDY_frame_terminator, GL_GREMEDY_string_marker and GL_ARB_debug_output extensions. Also you may want to check out the gDEBugger docs.Nope. I just want to measure the processing time when pixel processing stage is disabled.
Edited by Yours3!f, 25 June 2012 - 02:04 PM.
#12 Members - Reputation: 308
Posted 25 June 2012 - 05:04 PM
Nope. I just want to measure the processing time when pixel processing stage is disabled.
It sounds like you want to check whether your program is fragment shader bound.
In that case, just make ultra simple fragment shader and measure execution time.
Otherwise, glEnable(GL_RASTERIZER_DISCARD) is the way to disable fragment shaders execution.
Also, you could try to discard fragments in the fragment shader. It is, of course, meaningless, but maybe that will trigger some optimization in the drivers and totally eliminate FS.
#13 Members - Reputation: 173
Posted 25 June 2012 - 08:18 PM
I did use this way. This happens before rasterization stage. I am now testing with discarding fragments. This way, of course, is not perfectly correct but giving pixel shader as little work as possible seems not a bad idea though.
Nope. I just want to measure the processing time when pixel processing stage is disabled.
It sounds like you want to check whether your program is fragment shader bound.
In that case, just make ultra simple fragment shader and measure execution time.
Otherwise, glEnable(GL_RASTERIZER_DISCARD) is the way to disable fragment shaders execution.
Also, you could try to discard fragments in the fragment shader. It is, of course, meaningless, but maybe that will trigger some optimization in the drivers and totally eliminate FS.
#15 Members - Reputation: 173
Posted 26 June 2012 - 02:18 AM
uniform int enabled; void main () { if (enabled) { RunMyPixelShaderTask(); } }
It is possible to pass varying variables and attribute variables down to pixel shader but I don't think this works for functions. Anw, I still appreciate your idea
What I am doing now is as follows
void main ()
{
discard;
}
However, this, of course, can't give me accurate results.
Edited by donguow, 26 June 2012 - 02:19 AM.
#16 Moderators - Reputation: 3968
Posted 26 June 2012 - 03:22 AM
More importantly; WHAT are you trying to do with this information?
Currently you are learning nothing useful what so ever...






