Sign in to follow this  

Shader basics

This topic is 3736 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a damn basic question about shaders. Say I'm rendering a rectangle and I'm using vertex & pixel shaders. glBegin(GL_QUADS); .... glEnd(); My question is how many times the shaders will be exicuted ? I think Vertex shader will be exicuted 4 times (once for a vertex). But what about pixel shader ?

Share this post


Link to post
Share on other sites
Quote:
Original post by Morrandir
Correct me if I am wrong but AFAIK the pixel shader is executed once for each fragment, which does not necessarily equate to a pixel. In any case, this a small detail.


The only difference is when you perform FSAA, right? Otherwise, it's always one pixel, texel, fragment etc.

Share this post


Link to post
Share on other sites
Quote:
Original post by rozz666
The only difference is when you perform FSAA, right? Otherwise, it's always one pixel, texel, fragment etc.


Yes, in most cases the number of fragments processed by the shader equals to the number of pixels.

Share this post


Link to post
Share on other sites
heh actually fragment shader is executed as many times as many fragments is being processed for a scene, so if you got lots of overdraw and its not handled by early-z rejecting then shader is executed many times for a single pixel of a screen(and this is why we are using pre-z pass and near to far drawing order). The curious question is what 'fragment' actually mean? ;)

Share this post


Link to post
Share on other sites

This topic is 3736 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this