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

New Vulkan validation error when running bevy app on Linux #5303

Closed
SludgePhD opened this issue Feb 25, 2024 · 1 comment
Closed

New Vulkan validation error when running bevy app on Linux #5303

SludgePhD opened this issue Feb 25, 2024 · 1 comment

Comments

@SludgePhD
Copy link
Contributor

SludgePhD commented Feb 25, 2024

Description

I'm getting this validation error when running simple bevy apps:

2024-02-25T02:50:06.644539Z ERROR wgpu_hal::vulkan::instance: VALIDATION [VUID-VkShaderModuleCreateInfo-pCode-08737 (0xa5625282)]
        Validation Error: [ VUID-VkShaderModuleCreateInfo-pCode-08737 ] | MessageID = 0xa5625282 | vkCreateShaderModule(): pCreateInfo->pCode (spirv-val produced an error):
Structure id 11 decorated as Block for variable in Uniform storage class must follow relaxed uniform buffer layout rules: member 3 is a matrix with stride 8 not satisfying alignment to 16
  %StandardMaterialX_naga_oil_mod_XMJSXM6K7OBRHEOR2OBRHEX3UPFYGK4YX = OpTypeStruct %v4float %v4float %v4float %mat3v2float %float %float %float %float %float %float %float %float %uint %float %float %float %float %uint %uint
. The Vulkan spec states: If pCode is a pointer to SPIR-V code, pCode must adhere to the validation rules described by the Validation Rules within a Module section of the SPIR-V Environment appendix (https://www.khronos.org/registry/vulkan/specs/1.3-extensions/html/vkspec.html#VUID-VkShaderModuleCreateInfo-pCode-08737)    

Bevy's StandardMaterial uniform is triggering the issue:

struct StandardMaterial {
    base_color: vec4<f32>,
    emissive: vec4<f32>,
    attenuation_color: vec4<f32>,
    uv_transform: mat3x2<f32>,
    perceptual_roughness: f32,
    metallic: f32,
    reflectance: f32,
    diffuse_transmission: f32,
    specular_transmission: f32,
    thickness: f32,
    ior: f32,
    attenuation_distance: f32,
    // 'flags' is a bit field indicating various options. u32 is 32 bits so we have up to 32 options.
    flags: u32,
    alpha_cutoff: f32,
    parallax_depth_scale: f32,
    max_parallax_layer_count: f32,
    lightmap_exposure: f32,
    max_relief_mapping_search_steps: u32,
    /// ID for specifying which deferred lighting pass should be used for rendering this material, if any.
    deferred_lighting_pass_id: u32,
};

Repro steps
I've encountered this with bevy's render-to-texture example (cargo r --example render_to_texture).

A uniform struct type containing a mat3x2<f32> should reproduce the issue as long the validation layers at version 1.3.275 are installed.

It's possible that this is a false positive, I'm not well-versed enough in Vulkan to know.

Expected vs observed behavior
If my reading of the WGSL spec is right, this is valid in WebGPU, so wgpu should accept it without validation errors.

Platform
Linux 6.7.6, Mesa 24, Vulkan validation layers 1.3.275.

@cwfitzgerald
Copy link
Member

Thanks for filling, this is a duplicate of #4371

@cwfitzgerald cwfitzgerald closed this as not planned Won't fix, can't repro, duplicate, stale Feb 25, 2024
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

No branches or pull requests

2 participants