Clear framebuffer depth target

As a possible optimization, I’m looking into reusing framebuffers instead of creating a new one for each rendering pass in the framegraph. The difficulty is, there is no existing method that I am aware of to clear the depth target of the framebuffer. Does anyone have any idea how that might be done?

Renderer.clearBuffers or i misunderstood

1 Like

That will indeed clear the buffers, but I’d like to disconnect the depth target texture/buffer so that the framebuffer won’t render to it anymore. Similar to what FrameBuffer.clearColorTargets does.

Modifying a framebuffer is as expensive as creating a new one on each modification if i remember correctly.

You can disable depth test/write if thats the only issue.

Not sure i understand what you try to optimize.

Oh, I was under the impression that attaching textures was not as expensive as creating new framebuffers. :sweat_smile:

I’ve recoded that part of the system to minimize the number of attachment operations, which was quite a lot before.

The creation would be a one time operation, while the modifications would be needed every frame?

In general, due to error checkings, opengl is not a big fan of runtime modifications. Data changes are not a big issue, but every data holding structure change is checked