Access Parent Render Pass

I have two render passes, one that is nested within another, and I'd like for the inner pass to have access to the color attachments of the outer pass. Is it possible for render pass 2 to have knowledge of render pass 1's color at any given moment? Here is the logic:

1.) Start render pass 1 with texture 1

2.) Draw objects

3.) Start render pass 2 with texture 2

4.) Draw objects using color from render pass 1

5.) End render pass 2

6.) Draw output of render pass 2 into render pass 1

7.) End render pass 1

Replies

Hi, I can think of two ways that our GPUs might support what you are trying to accomplish.

The first approach is for you to use tile shading (see About Tile Shading). This allows you to have a separate compute pass that works on the same tile which is being rendered.

The second approach approach is to use raster order groups (see About Raster Order Groups) which allows you to specify in your shaders the order in which memory can be accessed to help you prevent a data race condition.

  • Thanks for your suggestions, both approaches seem very helpful. As for the first approach, how can a kernel-based tile shader read the color attachment of both the outer and inner render pass and if so is there any documentation on this?

    For the second approach, I'm also confused as to how I can access color attachments from different render passes through a single shader. Would it look something like this:

    fragment ColorIO myFragment(ColorIO innerRenderPassFragment, ColorIO outerRenderPassFragment) { ... }

Add a Comment