Blit ColourID selection

Hi Caroline and Ray Wenderlich team,

I was wondering if you might be able to assist with an error I have been encountering.

A few months back we spoke on the forum regarding object selection. There was the raycast method, and then the colouID pass method.

I have been implementing the colourID pass method, and have gotten stuck at the blit command encoder. I have constructed two textures (one for the beauty pass, one for the colourID pass) and then blit copy the texture onto the command buffer, but it seems that every second frame seems to be garbage. It even happens when the scene is only using the clear colour with no data to render.

If I GPU debug the frame, it looks correct. The only error message that does appear is one log mentioning GPU Soft Fault count: 1

I implemented, a semaphore trying to see if it might be a memory resource error.

Thanks for taking a look,
Simon

Metal_Quad_SelectionPassID.zip (85.7 KB)

The frame is taking too long to prepare.

You’re creating the textures in the render loop. If you take the texture creation out of the render loop and create them up front, it’s fine.

1 Like

Thank you Caroline! you are a life saver. I was pulling my hair out and moving code all over the place trying to pin point the error.

Cant wait to try this a after work

1 Like

:crossed_fingers: - let me know how you progress!

Thanks Caroline, just restructured my code and it works :slight_smile: Thank you.

There seems to be some fringe scenarios, when resizing the view that cause the same garbage frames, but its very rare.

1 Like