gfx-rs / wgpu

A cross-platform, safe, pure-Rust graphics API.
https://wgpu.rs
Apache License 2.0
12.2k stars 897 forks source link

Vulkan validation error when creeating a swapchain on Android #2085

Open DethRaid opened 2 years ago

DethRaid commented 2 years ago

Description I'm developing an Android application using wgpu. When I create my swapchain I get an error from the Vulkan validation layers:

VUID-VkSwapchainCreateInfoKHR-compositeAlpha-01280(ERROR / SPEC): msgNum: -1341842926 - Validation Error: [ VUID-VkSwapchainCreateInfoKHR-compositeAlpha-01280 ] Object 0: handle = 0xb4000071272f0c70, type = VK_OBJECT_TYPE_DEVICE; | MessageID = 0xb0051a12 | vkCreateSwapchainKHR() called with a non-supported pCreateInfo->compositeAlpha (i.e. VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR).  Supported values are:
        VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR
    . The Vulkan spec states: compositeAlpha must be one of the bits present in the supportedCompositeAlpha member of the VkSurfaceCapabilitiesKHR structure returned by vkGetPhysicalDeviceSurfaceCapabilitiesKHR for the surface (https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/vkspec.html#VUID-VkSwapchainCreateInfoKHR-compositeAlpha-01280)
        Objects: 1
            [0] 0xb4000071272f0c70, type: 3, name: NULL

Repro steps I'm creating a swapchain just like in the wgpu-native example:

const auto desc = WGPUSwapChainDescriptor{
        .label = "Super cool swapchain",
        .usage  = WGPUTextureUsage_RenderAttachment,
        .format = WGPUTextureFormat_RGBA8UnormSrgb,
        .width = swapchain_size.x,
        .height = swapchain_size.y,
        .presentMode = WGPUPresentMode_Fifo,
};
swapchain = wgpuDeviceCreateSwapChain(device, surface, &desc);

Expected vs observed behavior I expect to not have the Vulkan validation layer print any validation errors when I create a swapchain, or if this is a bug in my code I expect WGPU to give me an error message that helps point that out

Platform Android 11 build number RQ3A.211001.001 Adreno 640 GPU in the Qualcomm SM8150 Snapdragon 855 chipset 64-bit Android (arm64-v8a ABI) NDK 21.4.7075529 Android SDK 31 C++17 compiled with the toolchain in NDK 21 Vulkan validation layers prebuilt binaries for SDK 1.2.189.2 wgpu-native version 0.6.0 (commit b4dd62d1781c923ae0b52195fb9e710a7fc6b177) (I've exposed the struct WGPUSurfaceDescriptorFromAndroid and implemented wgpuCreateInstance, otherwise it's unchanged) wgpu version 0.10 (specified in wgpu-native's cargo.toml

kvark commented 2 years ago

We shouldn't request composite modes that aren't supported. So this is a bug on our side, but should be harmless.