3
\$\begingroup\$

I have drawn image with OpenGL and will redraw tile of its texture (non filled area).

enter image description here

Which case will work faster?

  1. Set glViewport with full texture's rect, draw full texture and use glScissor with updated area's rect.
  2. Set glViewport with updated area's rect and draw tile of texture with calculating its texture coordinates.

I've found in Apple's documentation, that scissor test is called after fragment shader. Does this mean, that fragment shader will work with pixels of full texture? How slower will it be rendered than case 2?

SOLVED: I've viewed pipeline scheme of OpenGL ES 2.0 here. Scissor test is done before fragment shading and allow to optimise rendering.

\$\endgroup\$

1 Answer 1

3
\$\begingroup\$

According to this pipeline map, the scissor test is applied before the fragment shader (I couldn't find a mention of the scissor test on the page you linked - perhaps you confused it with the stencil test which does happen after the fragment shader), so option 1 should not be more expensive than option 2 in terms of shader execution and texture fetch. There may still be a rasterization cost for the fragments which fail the scissor test. As always, the only way to be sure is to test.

\$\endgroup\$
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .