Skip to content

BGFX_CONFIG_MAX_FRAME_LATENCY bad implementation on OSX #3508

@alexgu754

Description

@alexgu754

any project that uses bgfx including the sample projects have very bad frame lag that you can do absolutely nothing about (apart from turning off vsync), making it practically unusable for realtime applications with vsync enabled.
the problem is only the number of active command buffers is limited by BGFX_CONFIG_MAX_FRAME_LATENCY, but when a command buffer submits, that doesn't mean the frame has been presented or about to be presented. So you're submitting command buffers one after another in the while game loop and overflowing the CAMetalLayer*'s 4 drawable limit and then the application halts when next drawable is called for the drawable to free up, then you enqueue that drawable at the very back. you have to use 'addPresentedHandler' or 'drawable.presentedTime' to actually set a frames in flight limit, and its also a very good idea to use CVDisplayLink or NSView.displayLink to also reduce latency. If you do this you'd have perfect synchronisation with the os mouse, but right now its very unresponsive

Image Image
513545998-6b7180d9-c3a7-4134-9dfa-691dee6d2987.webm

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions