0
$\begingroup$

I may not need as precise pixel-perfect stenciling as my render target during stencil tested render pass. I could be okay with stencil test happening at half or quarter of resolution to save bandwidth, but is it even an option, or the way stencil test designed is to always work on matching dimensions?

$\endgroup$

1 Answer 1

2
$\begingroup$

When the framebuffer attachment sizes differ, rendering will only happen to the smallest size supported by all attachments (i.e. a rectangle of minimal width & height among all the attachments). See the OpenGL wiki

Notice that there is no restriction based on size. The effective size of the FBO is the intersection of all of the sizes of the bound images (ie: the smallest in each dimension).

or the OpenGL specification, section 9.2 Binding and Managing Framebuffer Objects:

If the attachment sizes are not all identical, the results of rendering are defined only within the largest area that can fit in all of the attachments. This area is defined as the intersection of rectangles having a lower left of (0, 0) and an upper right of (width, height) for each attachment. Contents of attachments outside this area are undefined after execution of a rendering command (as defined in section 2.4).

So, if the stencil buffer is smaller than the color attachments, it will simply limit the rendering area to its size.

$\endgroup$
3
  • 1
    $\begingroup$ Can you point out or provide a citation on exact rule from which this implied? I've read your link, but it's not obvious to me why it would be a violation. $\endgroup$
    – simd
    Oct 8, 2023 at 5:23
  • 1
    $\begingroup$ @simd I'm terribly sorry, apparently this answer is completely wrong :) I'll update it shortly. $\endgroup$
    – lisyarus
    Oct 8, 2023 at 8:42
  • 1
    $\begingroup$ Thank you! It's strange that it's not simply an error. I can't image this intersection behaviour ever be useful. $\endgroup$
    – simd
    Oct 8, 2023 at 9:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.