count passes inside shader
Hi guys!
This is a short problem ...
I would like to be able to count how many times does some code of my shader have been executed.
Something like
if (){
// my code
count++;
}
else {
count+=0;
}
SO, if I have 100 fragments, and my code inside the if have been execute for example 65 .. be able to read my variable count from my API ..as GetValue .. ! Anyone knows how to do it and how I should declar and transfer my variables ??
Thanks,
Jesus
So you want to measure overdraw?
Normally this will be done by a special case of your application, it's difficult to combine it with normal image rendering.
Change your shader so that they add 1/255 to the render target each time they are invoked; and then read-back the pixel value (or just display it on-screen) and you'll have a count of the number of times that a particular pixel has been modified.
That'll work nicely for general overdraw, but if you want it for specific shaders then it's more tricky - you have to either split shaders into multiple channels (with MRT's you can count ~16 shaders) or you have to render the same frame multiple times and enable/disable the counting accordingly.
Alternatively, you might want to look into the NVPerfHUD and/or ATI PIXfW plugins. I've not personally tried NVPerfHUD (running ATI hw) but I'm sure I saw some screenshots of it showing the overdraw for a scene.
hth
Jack
Normally this will be done by a special case of your application, it's difficult to combine it with normal image rendering.
Change your shader so that they add 1/255 to the render target each time they are invoked; and then read-back the pixel value (or just display it on-screen) and you'll have a count of the number of times that a particular pixel has been modified.
That'll work nicely for general overdraw, but if you want it for specific shaders then it's more tricky - you have to either split shaders into multiple channels (with MRT's you can count ~16 shaders) or you have to render the same frame multiple times and enable/disable the counting accordingly.
Alternatively, you might want to look into the NVPerfHUD and/or ATI PIXfW plugins. I've not personally tried NVPerfHUD (running ATI hw) but I'm sure I saw some screenshots of it showing the overdraw for a scene.
hth
Jack
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement