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

[Merged by Bors] - Fix KTX2 R8_SRGB, R8_UNORM, R8G8_SRGB, R8G8_UNORM, R8G8B8_SRGB, R8G8B8_UNORM support #4594

Closed
wants to merge 5 commits into from

Conversation

superdump
Copy link
Contributor

Objective

Solution

  • Implement SrgbColorSpace for u8 via f32
  • Convert KTX2 R8 and R8G8 non-linear sRGB to wgpu R8Unorm and Rg8Unorm as non-linear sRGB are not supported by wgpu for these formats
  • Convert KTX2 R8G8B8 formats to Rgba8Unorm and Rgba8UnormSrgb by adding an alpha channel as the Rgb variants don't exist in wgpu

Changelog

  • Added: Support for KTX2 R8_SRGB, R8_UNORM, R8G8_SRGB, R8G8_UNORM, R8G8B8_SRGB, R8G8B8_UNORM formats by converting to supported wgpu formats as appropriate

@github-actions github-actions bot added the S-Needs-Triage This issue needs to be labelled label Apr 25, 2022
@superdump superdump changed the title Fix ktx2 uncompressed Fix KTX2 R8_SRGB, R8_UNORM, R8G8_SRGB, R8G8_UNORM, R8G8B8_SRGB, R8G8B8_UNORM support Apr 25, 2022
@alice-i-cecile alice-i-cecile added C-Bug An unexpected or incorrect behavior A-Rendering Drawing game state to the screen and removed S-Needs-Triage This issue needs to be labelled labels Apr 26, 2022
Copy link
Member

@mockersf mockersf left a comment

Choose a reason for hiding this comment

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

change looks OK but I can't test it

@alice-i-cecile
Copy link
Member

@superdump how does this PR relate to #5325? (And this needs rebasing)

Copy link
Contributor

@atlv24 atlv24 left a comment

Choose a reason for hiding this comment

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

transcoding is lossy (unsurprisingly), supporting this is good though. if it ever results in banding near deep dark colors, dithering at the transcode step could be investigated

@alice-i-cecile alice-i-cecile 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 Jan 16, 2023
@superdump
Copy link
Contributor Author

@alice-i-cecile it isn’t directly related. This is about supporting some uncompressed data formats. That other PR was rather about how to interpret the pieces of data (layers in array textures, faces in cubemap textures, both in cubemap array textures, and mip levels and whatever) to get them to wgpu buffers in the correct order without really caring about the format of the data itself.

@mockersf
Copy link
Member

bors r+

bors bot pushed a commit that referenced this pull request Jan 30, 2023
…8_UNORM support (#4594)

# Objective

- Fixes #4592

## Solution

- Implement `SrgbColorSpace` for `u8` via `f32`
- Convert KTX2 R8 and R8G8 non-linear sRGB to wgpu `R8Unorm` and `Rg8Unorm` as non-linear sRGB are not supported by wgpu for these formats
- Convert KTX2 R8G8B8 formats to `Rgba8Unorm` and `Rgba8UnormSrgb` by adding an alpha channel as the Rgb variants don't exist in wgpu

---

## Changelog

- Added: Support for KTX2 `R8_SRGB`, `R8_UNORM`, `R8G8_SRGB`, `R8G8_UNORM`, `R8G8B8_SRGB`, `R8G8B8_UNORM` formats by converting to supported wgpu formats as appropriate
@bors bors bot changed the title Fix KTX2 R8_SRGB, R8_UNORM, R8G8_SRGB, R8G8_UNORM, R8G8B8_SRGB, R8G8B8_UNORM support [Merged by Bors] - Fix KTX2 R8_SRGB, R8_UNORM, R8G8_SRGB, R8G8_UNORM, R8G8B8_SRGB, R8G8B8_UNORM support Jan 30, 2023
@bors bors bot closed this Jan 30, 2023
ItsDoot pushed a commit to ItsDoot/bevy that referenced this pull request Feb 1, 2023
…8_UNORM support (bevyengine#4594)

# Objective

- Fixes bevyengine#4592

## Solution

- Implement `SrgbColorSpace` for `u8` via `f32`
- Convert KTX2 R8 and R8G8 non-linear sRGB to wgpu `R8Unorm` and `Rg8Unorm` as non-linear sRGB are not supported by wgpu for these formats
- Convert KTX2 R8G8B8 formats to `Rgba8Unorm` and `Rgba8UnormSrgb` by adding an alpha channel as the Rgb variants don't exist in wgpu

---

## Changelog

- Added: Support for KTX2 `R8_SRGB`, `R8_UNORM`, `R8G8_SRGB`, `R8G8_UNORM`, `R8G8B8_SRGB`, `R8G8B8_UNORM` formats by converting to supported wgpu formats as appropriate
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 S-Ready-For-Final-Review This PR has been approved by the community. It's ready for a maintainer to consider merging it
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

KTX2: unsupported pixel formats R/RG/RGB linear/srgb
4 participants