Skip to content

Conversation

@ZivDero
Copy link
Contributor

@ZivDero ZivDero commented Oct 29, 2025

Add support for GPU RGB565 (B5G6R5_UNORM) textures with DX11

Description

Allows using GPU textures with the RGB56 format with the DirectX11 backend.

Existing Issue(s)

Resolves #14357

@slouken
Copy link
Collaborator

slouken commented Oct 29, 2025

The documentation for this states:

DXGI_FORMAT_B5G6R5_UNORM
Value: 85
A three-component, 16-bit unsigned-normalized-integer format that supports 5 bits for blue, 6 bits for green, and 5 bits for red.

Direct3D 10 through Direct3D 11:  This value is defined for DXGI. However, Direct3D 10, 10.1, or 11 devices do not support this format.

Direct3D 11.1:  This value is not supported until Windows 8.

So you need a Direct3D 11 version check and OS version check before you can use this.

It also looks like this has the channels in high - blue, middle - green, low - red order, is that right?

@ZivDero
Copy link
Contributor Author

ZivDero commented Oct 29, 2025

It also looks like this has the channels in high - blue, middle - green, low - red order, is that right?

Apparently this is just an outdated naming convention (has to do with endianness), the actual color format matches (and is confirmed experimentally by me to work as expected).

I will look into adding the checks.

@ZivDero
Copy link
Contributor Author

ZivDero commented Oct 29, 2025

Added checks.

@ZivDero
Copy link
Contributor Author

ZivDero commented Oct 29, 2025

Hmm... seems like the check comes too early. I guess it has to be moved.

@slouken slouken merged commit a76fb7b into libsdl-org:main Oct 29, 2025
40 of 43 checks passed
@slouken
Copy link
Collaborator

slouken commented Oct 29, 2025

Merged, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support hardware RGB565 textures with DX11

2 participants