Skip to content

Default to RGBX on Windows when debugging assertions are enabled#327

Draft
madsmtm wants to merge 1 commit intomasterfrom
madsmtm/default-rgbx-debug-windows
Draft

Default to RGBX on Windows when debugging assertions are enabled#327
madsmtm wants to merge 1 commit intomasterfrom
madsmtm/default-rgbx-debug-windows

Conversation

@madsmtm
Copy link
Member

@madsmtm madsmtm commented Jan 28, 2026

To help expose issues with assuming the wrong pixel format.

Unsure yet if this is a good idea or not - it does match what I've done in #315 with making the byte stride debug_assertions-dependent, but it might also just end up causing more confusion than it helps.

Tested on:

  • Windows

To help expose issues with assuming the wrong pixel format.
@madsmtm madsmtm added the DS - Win32 Windows backend label Jan 28, 2026
@MarijnS95
Copy link
Member

On Android I force RGBX too during the resize, rather than RGBA:

Some(HardwareBufferFormat::R8G8B8X8_UNORM),

@madsmtm
Copy link
Member Author

madsmtm commented Feb 8, 2026

On Android I force RGBX too during the resize, rather than RGBA

This PR doesn't touch alpha-ness, it's more to help people catch problems with doing:

let buffer = surface.buffer_mut();
// Fill BGRA format because that's seems to be what's used everywhere.
buffer.data_u32().fill(u32::from_ne_bytes([b, g, r, a]));
buffer.present();

Which would be wrong, the user should fill based on PixelFormat::default(), but it would only be wrong on Android and Web, which are a bit more niche, and thus such a problem would likely only be caught late in development.

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

Labels

DS - Win32 Windows backend

Development

Successfully merging this pull request may close these issues.

2 participants