Manually Blitting a Texture

Hey I am trying to perform my own version of a Graphis.Blit() inside my own post effect class.

To do so I am drawing a simple quad using GL.Begin(GL.QUADS) with GL.LoadOrtho() as view matrix as well as setting a material/pass using the inbuild hidden shader “Hidden/Internal-GUITextureBlit”.
This is all working well.

HOWEVER! I notcied that even when I am doing a simple blit from source to destination the source image is missing anthing in the scene rendered after the Transparent Alpha Cutout queue.

i.e. when I do a Blit(source, desitnation) inside OnRenderImage(), using Graphics.Blit correctly means the full scene image is showing whilst my own manual blit means an incomplete scene is shown (without particles/lens flares/anything transparent).

I am sure this is a GPU timing issue, my own code is getting a handle to an old version of the source texture. Is there anything I should call inside my Blit code to make sure textures / graphics instructions are in sync? I have tried a GL.Flush().

What actually happens inside Graphics.Blit()? Is there something it does to ensure the source and destination textures are up to date?

Thanks.

UPDATE. So if I SetRenderTarget back to the camera’s target after OnRenderImage is called the remaining parts of the scene (particales/lens flares/transparent objects) are rendered back to the screen over the top of the post effects.

This definely makes it seem like its a GPU command buffer issue - Graphics.Blit() must wait for all current rendering commands to finish before using the source texture, how can I do the same?

Ok slightly embarressing but found the cause - I copied the test image effect from another one and didn’t notice I’d left a stray [ImageEffectOpaque] tag on the OnRenderImage function doh! :stuck_out_tongue:

Haha suddently twigged as I was looking at this render flow diagram. ah well!