Skip to content

Replace SDL_gpu with bgfx #276

@ephemer

Description

@ephemer

Motivation

We've noticed that SDL_gpu doesn't fit our needs in many situations: it has a strange transformation matrix model (which leads to rendering bugs at pixel boundaries on certain devices, as well as to reduced performance, and not only on older devices), is difficult to use with custom shaders (important for shadows, masking, cap insets etc.), and has docs that are difficult to use / are incomplete.

SDL itself is also a dependency we'd like to remove (we're only really keeping it around for SDL_gpu).

Using bgfx would give us much more flexibility over our rendering, allowing us to implement shadows, capInset images, 8bit textures (see #275), and more. And would also be a nicer toolkit to work with, given its greater user base, better docs, and clearer render pathway. It appears that bgfx is widely used on Android as well, and also seems to work with WebGL, which was an initial draw card for SDL.

Disadvantages

  • SDL_gpu allows us to render rounded corners out of the box. We're hardly making use of this feature though because its rendering is highly aliased. We'd prefer to go for a solution using cap inset images or similar anyway.
  • We'd have to rewrite the UIScreen render functions to a certain degree. This is probably unavoidable, but also gives us the opportunity to improve our rendering performance by batching more draw calls together.
  • If we removed SDL we'd also have to rethink our text rendering: SDL_ttf unsurprisingly relies on SDL. But this would not be necessary if we just replace SDL_gpu with bgfx initially.

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