iOS: OpenGL ES 2.0 render texture with glScissor performance

| | August 4, 2015

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.

One Response to “iOS: OpenGL ES 2.0 render texture with glScissor performance”

  1. 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.

Leave a Reply