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

default 16bit rgb/rgba textures to unorm instead of uint #9611

Merged
merged 2 commits into from
Sep 6, 2023

Conversation

robtfm
Copy link
Contributor

@robtfm robtfm commented Aug 28, 2023

Objective

fix #8185, #6710
replace #7005 (closed)

rgb and rgba 16 bit textures currently default to Rgba16Uint, the more common use is Rgba16Unorm, which also matches the default type of rgb8 and rgba8 textures.

Solution

Change default to Rgba16Unorm

@robtfm robtfm added the A-Rendering Drawing game state to the screen label Aug 28, 2023
@alice-i-cecile alice-i-cecile added C-Bug An unexpected or incorrect behavior P-Crash A sudden unexpected crash labels Aug 28, 2023
Copy link
Contributor

@superdump superdump left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems OK to me.

@@ -88,7 +88,7 @@ pub fn dds_format_to_texture_format(
TextureFormat::Bc3RgbaUnorm
}
}
D3DFormat::A16B16G16R16 => TextureFormat::Rgba16Uint,
D3DFormat::A16B16G16R16 => TextureFormat::Rgba16Unorm,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked the microsoft docs and it seems like A16B16G16R16 is an old dx9 format and the dx11 equivalent is DXGI_FORMAT_R16G16B16A16_UNORM, so this seems correct.


data = local_data;
data = cast_slice(&raw_data).to_owned();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this potentially be in an unsafe block?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you mean make Image::from_dynamic unsafe? i don't think it's necessary, the worst that'll happen is garbage pixeldata in your image.

crates/bevy_render/src/texture/image_texture_conversion.rs Outdated Show resolved Hide resolved
@mockersf mockersf added the S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it label Sep 5, 2023
@superdump superdump added this pull request to the merge queue Sep 6, 2023
Merged via the queue into bevyengine:main with commit 6c1f466 Sep 6, 2023
22 checks passed
rdrpenguin04 pushed a commit to rdrpenguin04/bevy that referenced this pull request Jan 9, 2024
…9611)

# Objective

fix  bevyengine#8185, bevyengine#6710
replace bevyengine#7005 (closed)

rgb and rgba 16 bit textures currently default to `Rgba16Uint`, the more
common use is `Rgba16Unorm`, which also matches the default type of rgb8
and rgba8 textures.

## Solution

Change default to `Rgba16Unorm`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Bug An unexpected or incorrect behavior P-Crash A sudden unexpected crash S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bevy 0.10 Res<AssetServer>::load(...) Causes Panic Given Valid Path
5 participants