Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

color attachment byte cost validation panics for native only formats like Rg16Unorm #5903

Closed
ScanMountGoat opened this issue Jul 3, 2024 · 0 comments · Fixed by #5934
Closed
Labels
area: validation Issues related to validation, diagnostics, and error handling type: bug Something isn't working

Comments

@ScanMountGoat
Copy link
Contributor

ScanMountGoat commented Jul 3, 2024

I'm using 16 bit normalized color attachments on desktop with wgpu::Features::TEXTURE_FORMAT_16BIT_NORM. This was working in 0.19.0 but panics in validation code on the latest release.

let byte_cost = format.target_pixel_byte_cost().unwrap();

It looks like the validation code only includes formats supported on the web.

wgpu/wgpu-types/src/lib.rs

Lines 3629 to 3663 in e26d2d7

pub fn target_pixel_byte_cost(&self) -> Option<u32> {
match *self {
Self::R8Unorm | Self::R8Uint | Self::R8Sint => Some(1),
Self::Rg8Unorm
| Self::Rg8Uint
| Self::Rg8Sint
| Self::R16Uint
| Self::R16Sint
| Self::R16Float => Some(2),
Self::Rgba8Uint
| Self::Rgba8Sint
| Self::Rg16Uint
| Self::Rg16Sint
| Self::Rg16Float
| Self::R32Uint
| Self::R32Sint
| Self::R32Float => Some(4),
Self::Rgba8Unorm
| Self::Rgba8UnormSrgb
| Self::Bgra8Unorm
| Self::Bgra8UnormSrgb
| Self::Rgba16Uint
| Self::Rgba16Sint
| Self::Rgba16Float
| Self::Rg32Uint
| Self::Rg32Sint
| Self::Rg32Float
| Self::Rgb10a2Uint
| Self::Rgb10a2Unorm
| Self::Rg11b10Float => Some(8),
Self::Rgba32Uint | Self::Rgba32Sint | Self::Rgba32Float => Some(16),
Self::Rgba8Snorm | Self::Rg8Snorm | Self::R8Snorm => None,
_ => None,
}
}

@nical nical added type: bug Something isn't working area: validation Issues related to validation, diagnostics, and error handling labels Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: validation Issues related to validation, diagnostics, and error handling type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants