The new capture_hi_res.rs example demonstrates the following steps each frame:
During step 4, we use a TextureReshaper to write the larger mulstisampled texture to the smaller multisampled window texture (see here). The TextureReshaper does this by treating the src_texture as a shader input and rendering it with two triangles to the dst_texture. The TextureReshaper src can be found here.
An issue is occurring where the following validation error is being produced when render_pass.draw is called within the TextureReshaper::encode_render_pass method:
UNASSIGNED-CoreValidation-DrawState-DescriptorSetNotUpdated(ERROR / SPEC): msgNum: 0 - VkDescriptorSet 0x32[] bound as set #0 encountered the following validation error at vkCmdDraw() time: Descriptor in binding #0 index 0 requires bound image to have VK_SAMPLE_COUNT_1_BIT but got VK_SAMPLE_COUNT_4_BIT.
It seems that, for some reason, the texture binding in the descriptor set is expected to have a sample count of 1, even though we specify that the SampledTexture is multisampled when creating the bind group layout.
@kvark do you have any thoughts on what I might be doing wrong here? You mentioned yesterday that it should be fine to use a multisampled texture as a shader input, so I'm guessing I must be failing to specify the src sample count in a field somewhere or something along these lines. Or is it possible that the multisampled field of the BindGroupLayoutBinding is accidentally being ignored by wgpu? Let me know if I can provide more info!
Sorry to keep bugging you! This is the last known wgpu related error I'm running into before #452 is ready to land but I'm struggling to crack this one.
Your shader expects the texture to be non-multisampled: https://github.com/nannou-org/nannou/blob/f035233a18ce424779e26b57502b7a8c6ac0d02d/src/wgpu/texture/reshaper/shaders/shader.frag#L12
The proper type would be texture2DMS.
So from wgpu perspective, the shader doesn't match the pipeline layout (which specifies this binding to be multi-sampled), and we should be erroring out the pipeline creation. This falls under https://github.com/gfx-rs/wgpu/issues/269
Aaaahhhhhhhhh I see!
TIL texture2DMS is a thing :)
Thank you as usual!
For the reference, keep this around: https://github.com/KhronosGroup/GLSL/blob/master/extensions/khr/GL_KHR_vulkan_glsl.txt
I think in the future we'll have WGSL specified much better and will be able to recommend it.
Okydoke, just pushed a fix in this commit!