Skip to content

Transparent camera causes unnecessary draw calls #3549

@ACrazyTown

Description

@ACrazyTown

In #3459, FlxCamera.fill() was changed to always fill the camera, even if the alpha is 0. As a result, even though this fill rect is entirely invisible, it still gets pushed and drawn by OpenGL, which we can see by using an OpenGL debugger like RenderDoc:

Image

Here's a replay of the draw process, in video form to better illustrate my point. Notice how the first glDrawElements() call doesn't change anything visually (because it's entirely transparent).

2026-01-14.17-24-52.mp4

The alpha check was added back in 2013 in 5dde99f with the intention of solving performance related issues mentioned in #502. I believe we should re-add the check, and the memory leak from #3459 should be investigated further.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions