Processing time at vertex shader
#1 Members - Reputation: 173
Posted 07 June 2012 - 10:36 PM
At the moment, I aim to estimate the time it takes to perform vertex processing. Say, I have a graphics rendering pipeline as follows:
-------------------- ------------------------ ------------------------
Vertices --->| Vertex Shader |-------> | Geometry shader | -------> .... --------> | Fragment shader | ------ Frame buffer -----> Display
-------------------- ------------------------ ------------------------
Now, I just want to estimate the average processing time at Vertex shader. Is there any possible way to do that?
Thanks in advance,
-D
#2 Members - Reputation: 1408
Posted 07 June 2012 - 11:41 PM
Another complication is that a "real" application usually have many vertex shaders, used for different things. And maybe they are using deferred shading, in which case you call two different vertex shaders after each other (where the second time is quick).
You mention geometry shading, are you sure you are going to use that?
There are ways to actually measure the time that the GPU needs, and that is by using queries.
Please say what you need the information for, and maybe there may be ways to help you optimize.
#3 Members - Reputation: 173
Posted 07 June 2012 - 11:50 PM
Giving a vertex shader program, assuming that I have 1000 vertices now I want to know how long does it take the vertex shader to process 1000 vertices. Is there any way to put the timer in the middle to measure the processing time?
Thanks,
-D
#4 Members - Reputation: 173
Posted 08 June 2012 - 12:00 AM
#5 Members - Reputation: 1408
Posted 08 June 2012 - 01:49 AM
If you want to measure only the vertex shader, there is a trick to disable the fragment shader: Calling glCullFace(GL_FRONT_AND_BACK) will cull all facets (but not primitives like points and lines). This would of course be something you only do for testing.
#7 Members - Reputation: 536
Posted 09 June 2012 - 10:36 AM
Read stream processor.
http://www.alteredgamer.com/pc-gaming-tech/984-painting-the-scene-graphics-cards-explained/
#8 Moderators - Reputation: 3963
Posted 09 June 2012 - 02:00 PM
If you really want to get performance data then you'll need to break out specific tools to do timing be it NV, AMD or Intel's graphics debugging/analysis programs or any extensions which let you do profiling of the pipeline.
Simply turning on culling and trying to time that way is going to give you some results I just... wouldn't trust them too much personally...
#9 Members - Reputation: 173
Posted 09 June 2012 - 09:26 PM
-D
#11 Members - Reputation: 1408
Posted 10 June 2012 - 04:25 AM
It may turn out that you can get a value, which may not be relevant as a decision support.
The general recommendation is to push as much computation as possible from the fragment shader to the vertex shader. One way of doing that, if you have many lights, is to use a deferred shader. That way, light computation is only limited to pixels that are actually going to be shown.
#13 Members - Reputation: 536
Posted 13 June 2012 - 11:23 AM
Well do any of the tools track each processors state, can you query back the percentage of time each or all processors were doing vertex or pixel shader operations? And still knowing those numbers will not tell you anything about how efficient your shaders are or anything relevant. Because they switch all the time you cant be vertex or pixel bound. The GPU will try to even those out.there are still vertex shaders, there just hasn't been any dedicated hardware for it for some time now.
#14 Moderators - Reputation: 3963
Posted 13 June 2012 - 02:01 PM
Some counters from AMD's GPUPerf lib;
Timing : ShaderBusy, ShaderBusyCS, ShaderBusyDS, ShaderBusyGS, ShaderBusyHS, ShaderBusyPS, ShaderBusyVS
Vertex Shader; VSALUBusy, VSALUEfficiency
(They have many more, covering all shader types, memory information and more. NV and Intel will cover the same.).
And of course you can still be vertex or pixel bound - if most of your shader time in a frame is being spent on vertex shader operations then you are vertex bound. Same thing if you replace 'vertex' with 'pixel', 'geometry', 'hull', 'domain' or 'compute'.
Just because there are no longer dedicated "pipes" doesn't mean you can't be bound by a perticular shader type; being 'bound' by something just means it is taking the most amount of time and optimsing other parts of the process aren't going to make a difference.
Just because the GPU can balance resources as it needs to doesn't magically mean that all shaders will execute in the same amount of time, it just means the GPU can stay as busy as possible while it has work to do.
#16 Members - Reputation: 1408
Posted 18 June 2012 - 02:47 AM
It is not possible to give a general answer to that. In a "real application", you generally have several shader programs. Each of them have at least a vertex shader and a fragment shader. And all of these vertex shaders and fragment shaders can maybe be running in parallel, or they may not. It depends on the hardware, on your state changes, on what the CPU is busy with, and other things.Hi Phantom,
If I understand you correctly, suppose the time it takes to render 1 frame is 0.5 ms it means that the execution time at vertex shader and pixel shader are also 0.5 ms, right? is it something called unified shader model?
I think the concept of Unified Shader Model is about the hardware design. That is, the shader "execution unit" is not specialized for vertex shading and fragment shading, which allows for more flexible usage. I suppose it can mean that an application that is using much resources from fragment shading can have automatic reallocation to improve processing speed.






