Skip to content

ra_pl: add x2bgr10/x2rgb10 special RA formats - #18364

Merged
kasper93 merged 1 commit into
mpv-player:masterfrom
philipl:ra-pl-x2bgr10
Aug 13, 2026
Merged

ra_pl: add x2bgr10/x2rgb10 special RA formats#18364
kasper93 merged 1 commit into
mpv-player:masterfrom
philipl:ra-pl-x2bgr10

Conversation

@philipl

@philipl philipl commented Aug 13, 2026

Copy link
Copy Markdown
Member

x2bgr10/x2rgb10 are packed formats that do not automatically get mapped by the existing ra_pl logic. They are more useful than other non-byte-aligned packed formats because they show up when dealing with > 8bit RGB content, which is more common in an HDR context.

In practice, x2bgr10 is probably the only one that's going to get used, but I figured there's no harm in supporting both.

I also experimented with adding generic logic to map packed formats, but it's a bunch of un-intuitive code and the ra format constraints mean the only accepted packed formats would be x2bgr10 and x2rgb10 anyway. To add insult to injury, you'd still need special case code in ra_gl to provide missing metadata to make the generic mapping work.

With all that as the alternative, simply adding special formats to ra_pl is much easier to understand and maintain.

x2bgr10/x2rgb10 are packed formats that do not automatically get mapped by the
existing ra_pl logic. They are more useful than other non-byte-aligned packed
formats because they show up when dealing with > 8bit RGB content, which is
more common in an HDR context.

In practice, x2bgr10 is probably the only one that's going to get used, but
I figured there's no harm in supporting both.
@kasper93

Copy link
Copy Markdown
Member

It's fine. One nitpick though, we already have those in ra_gl and ra_d3d11, but only the one that's is needed. So if you add both bgr/rgb formats in ra_pl, I would like to keep ra_gl and ra_d3d11 in sync.

@flowreen

Copy link
Copy Markdown

Tested on top of my #18300 series with its two format commits dropped (the hwdec_cuda table and the hwdec_vulkan check removal): the restored ra_get_imgfmt_desc checks pass through the new special formats, every x2bgr10 route stays direct through both the cuda and vulkan mappers, and screenshots are bit identical to the native d3d11 route.

@kasper93
kasper93 merged commit 7b8915b into mpv-player:master Aug 13, 2026
58 of 76 checks passed
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.

3 participants