Does the OpenGL stencil test run before or after the fragment program?

When I set the glStencilFunc( GL_NEVER, . . . )effective shutdown of the entire drawing and then run my program [shader binding], I do not get a performance increase, allowing me to run the fragment shader. I thought the stencil test happened before the fragments program. Is this not so, or at least not guaranteed? Replacing a fragment shader with one that simply writes the gl_FragColor constant results in a higher FPS.

+3
source share
4 answers

Take a look at the following contour for the DX10 pipeline, it says that the stencil test runs before the pixel shader:

http://3.bp.blogspot.com/_2YU3pmPHKN4/Sz_0vqlzrBI/AAAAAAAAAAcg/CpDXxOB-r3U/s1600-h/D3D10CheatSheet.jpg

and the same is true in DX11:

http://4.bp.blogspot.com/_2YU3pmPHKN4/S1KhDSPmotI/AAAAAAAAAcw/d38b4oA_DxM/s1600-h/DX11.JPG

I do not know if this complies with the OpenGL specifications, but it would be harmful for the implementation not to perform a screen check before running the fragment program.

0
source

. , OpenGL ES 2.0. , z, , .

AMD/ATI, . , , , , , , . OpenGL .

+2

, / . z- , , , - discard.

GPU /z , z/, , , , z-, . , , .

+2

Source: https://habr.com/ru/post/1743768/


All Articles