How to add/remove renderable objects while using Heap for textures (Chapter 15 GPU Driven Rendering)

When we use Heap to store all the textures of all the models rendered in a scene, creating the heap only once and load it to the GPU for rendering, what should we do if we want to add another model to the scene later? It doesn’t sound like an efficient approach to destroy the heap and create a new one from all textures needed. What is a recommended way of managing textures using heaps?

Maybe it is not an ideal practice to store textures of all model in one heap, but should create one heap for each model, so that it will be easier when we add/remove models in the scene?

Any thoughts that might be helpful is appreciated.

I don’t know the standard way of doing it yet. I would have thought that partitioning the scene and having a heap per partition would be the way to go. It would depend on your usage though.

That’s a good idea. Is it correct to say that once the heap is created, adding one more texture later to it is impossible and we will have to destroy the old one and create a new heap?

This might be worth looking into.

https://developer.apple.com/documentation/metal/mtlresource/1771705-makealiasable

1 Like

Also, Apple’s rendering of Amazon’s Bistro is a massive sample app:

https://developer.apple.com/documentation/metal/modern_rendering_with_metal

It goes with a couple of videos:

2 Likes

thanks for sharing these, I do need to watch more WWDC videos :smiley:

I do too. They don’t make sense until you know the basics, but they do take you to the next level.

1 Like

That’s indeed why I haven’t been watching them, most of them are beyond my level. But, with Metal by tutorials, I’m getting there :slight_smile:

1 Like

I can’t recommend the WWDC 2019 video on Modern Rendering that Caroline posted highly enough – especially if you’re interested in indirect commands and using heaps. The code also has some extremely interesting stuff on how to do texture streaming, which is along the lines of what I think you’re trying to do. You can checkout the Texture Manager class in the sample code that goes along with the talk for ideas.

2 Likes

thanks so much for the information, you’ve really motivated me to watch it ! :smiley: