1
$\begingroup$

Imagine I render to an FBO some arbitrary geometry. Geometry can be rendered via single or multiple draw calls. For the sake of the question, assume I know nothing about geometry or transformation matrices.

I need to efficiently read back the minimal screen-space bounding box of all drawn geometry after the rendering to FBO is finished.

I imagine this can be done with via use of atomics on an image (imageLoad/imageStore) or SSBO, sadly these are not available to me. Is there any other mechanism I can try?

$\endgroup$
  • 1
    $\begingroup$ Do you care what happens to geometry that doesn't affect a pixel? e.g. it's degenerate or end-on to the camera $\endgroup$ – Dan Hulme Mar 4 at 20:49
  • $\begingroup$ Unless parts of my geometry happen to be outside of clip space, every fragment from geometry should end up being rendered to FBO. Geometry from different submissions may and will overlap. What I need a rectangular area within my FBO that covers pixels "affected" by rendering. This area may well cover whole FBO viewport or cover zero area (in case all geometry happen to miss clipspace of FBO) $\endgroup$ – lhog Mar 4 at 21:12
  • $\begingroup$ Well, what is available to you? Since you got FBOs I assume an old-school GPGPU ping-pong reduction with a fragment shader would be viable? In that case, either you can distinguish a "rendered" pixel from a "background" pixel in the color buffer or you use the stencil buffer and then just reduce it computing the minimum and maximum of all "set" fragment positions. $\endgroup$ – Christian Rau Mar 4 at 22:20
  • $\begingroup$ @lhog: "read back the minimal screen-space bounding box of all drawn geometry after the rendering to FBO is finished." Did you pass the bounding box? If not, how do you expect to read back something you didn't provide? $\endgroup$ – Nicol Bolas Mar 5 at 1:59
  • 1
    $\begingroup$ Please don't cross-post questions to multiple Stack Exchange sites. $\endgroup$ – user1118321 Mar 6 at 4:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.