javascriptbrowserrenderingmultisamplingwebgpu

How to fix the "Binding multisampled flag (1) doesn't match the layout's multisampled flag (0)" error in WebGPU?


I`m trying to add MSAA to a model with multiple textures (normal, metallicRoughness, baseColor, emission), but get the following error:

Binding multisampled flag (1) doesn't match the layout's multisampled flag (0)
 - While validating that the entry-point's declaration for @group(2) @binding(1) matches [BindGroupLayout "materialBindGroupLayout"]
 - While validating the entry-point's compatibility for group 2 with [BindGroupLayout "materialBindGroupLayout"]
 - While validating fragment stage ([ShaderModule (unlabeled)], entryPoint: "fragment_main").
 - While validating fragment state.
 - While calling [Device].CreateRenderPipeline([RenderPipelineDescriptor]).

The problem is i don't even understand what's that supposed to mean.

All the textures are multisampled, and are collected in the same bind group. What layout is in question? Bind group, buffer or pipeline? Is there any written explanation for what this error means? I sure could not find one, so any nudge in right direction would be appreciated.


Solution

  • I figured it out. The problem was that i`ve set sampleCount:4 for all textures, but resource textures such as baseColor/normal/etc. should not be flagged as multisampled, only the depth texture and view texture.