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

Improve vk format msaa capabilities detection #3429

Merged
merged 4 commits into from
Jan 28, 2023
Merged

Conversation

jinleili
Copy link
Contributor

@jinleili jinleili commented Jan 27, 2023

Checklist

  • Run cargo clippy.
  • Run RUSTFLAGS=--cfg=web_sys_unstable_apis cargo clippy --target wasm32-unknown-unknown if applicable.
  • Add change to CHANGELOG.md. See simple instructions inside file.

Description
MSAA with a sample count greater than 1 (e.g., 4) will result in the following validation error on the vk backend:

thread 'main' panicked at 'wgpu error: Validation Error

Caused by:
    In Device::create_render_pipeline
    color state [0] is invalid
    format Rgba8UnormSrgb can't be multisampled

Here are the relevant fields defined in vk Limits

sampledImageColorSampleCounts is a bitmask1 of VkSampleCountFlagBits indicating the sample counts supported for all 2D images created with VK_IMAGE_TILING_OPTIMAL, usage containing VK_IMAGE_USAGE_SAMPLED_BIT, and a non-integer color format.
sampledImageIntegerSampleCounts is a bitmask1 of VkSampleCountFlagBits indicating the sample counts supported for all 2D images created with VK_IMAGE_TILING_OPTIMAL, usage containing VK_IMAGE_USAGE_SAMPLED_BIT, and an integer color format.
storageImageSampleCounts is a bitmask1 of VkSampleCountFlagBits indicating the sample counts supported for all 2D images created with VK_IMAGE_TILING_OPTIMAL, and usage containing VK_IMAGE_USAGE_STORAGE_BIT.

On my test devices, storageImageSampleCounts always equal to SampleCountFlags::TYPE_1.

Testing
Tested on Android 13 and macOS (--features=vulkan-portability) via wgpu-in-app

wgpu-hal/src/vulkan/adapter.rs Outdated Show resolved Hide resolved
wgpu-hal/src/vulkan/adapter.rs Outdated Show resolved Hide resolved
wgpu-hal/src/vulkan/adapter.rs Outdated Show resolved Hide resolved
wgpu-hal/src/vulkan/adapter.rs Outdated Show resolved Hide resolved
jinleili added a commit to jinleili/wgpu-in-app that referenced this pull request Jan 28, 2023
Copy link
Member

@teoxoy teoxoy left a comment

Choose a reason for hiding this comment

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

LGTM, thank you!

@teoxoy teoxoy enabled auto-merge (squash) January 28, 2023 11:55
@teoxoy teoxoy merged commit b31069f into gfx-rs:master Jan 28, 2023
@cwfitzgerald cwfitzgerald added the PR: needs back-porting PR with a fix that needs to land on crates label Feb 1, 2023
cwfitzgerald pushed a commit that referenced this pull request Feb 9, 2023
* Improve vk format msaa capabilities detection

* Update CHANGELOG

* Follow the suggestions

* Update wgpu-hal/src/vulkan/adapter.rs

Co-authored-by: Teodor Tanasoaia <[email protected]>
@jinleili jinleili deleted the vk_msaa branch February 10, 2023 02:50
@cwfitzgerald cwfitzgerald removed the PR: needs back-porting PR with a fix that needs to land on crates label Feb 22, 2023
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