floooh/oryol

Gfx::applyScissorRect Before Clean The Screen

Closed this issue · 2 comments

julee commented

When we use glScissor in OpenGL, we always let it apply the rect to glClear, as, without glScissor, the glClear clean the whole screen defaulted.
But with oryol, applyScissorRect needs call in a pass, means glScissor can only call after glClear. How can I let scissor apply to clear action with Oryol api?

The current behaviour is that the viewport is reset to the pass framebuffer size, and the scissor test is disabled (so if there is a left-over scissor-rect it won't influence the clear operation), this basically means you cannot do a clear limited to a scissor or viewport region (as far as I can see this is also not possible in Metal, because scissor rects are set on a MTLRenderCommandEncoder, and the clear happens implicitely when creating the MTLRenderCommandEncoder at the start of each pass.

After the Gfx module has been moved to sokol-gfx the behaviour will be slightly different:

  • viewport will be reset to full size (same as now)
  • scissor rect will be reset to full size
  • scissor test will always be enabled, so there will be no separate enable/disable scissor state in the pipeline object, main reason for this is that Metal also doesn't have a separate scissor-enable state
julee commented

OK. Thanks. I'll try other ways.