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

Queue::write_buffer() issue on Microsoft Basic Render Driver #2189

Open
kwillemsen opened this issue Nov 17, 2021 · 3 comments
Open

Queue::write_buffer() issue on Microsoft Basic Render Driver #2189

kwillemsen opened this issue Nov 17, 2021 · 3 comments
Labels
api: dx12 Issues with DX12 or DXGI external: driver-bug A driver is causing the bug, though we may still want to work around it

Comments

@kwillemsen
Copy link
Contributor

kwillemsen commented Nov 17, 2021

Description

When using the Microsoft Basic Render Driver Adapter, it seems Queue::write_buffer() does not work correctly.
All other backends (on my machine Vulkan and DX12, both on NVIDIA and Intel hardware) do function as expected.

I guess this could be an issue in my code, in wgpu-rs or in the Microsoft Basic Render Driver.

Repro steps

This repo contains a sample app and explains the issue.
Basically, the following code

// Phase 1 : update constant buffers.
for e in &entities {
    queue.write_buffer(&e.constant_buffer, 0, &e.constant_data);         // (1)
}

// Phase 2 : draw all entities.
let mut encoder = device.create_command_encoder(/*...*/);
{
    let mut render_pass = encoder.begin_render_pass(/*...*/);
    render_pass.set_pipeline(&render_pipeline);
    for e in &entities {
        render_pass.set_bind_group(0, &e.bind_group, &[]);               // (2)
        render_pass.set_vertex_buffer(0, e.vertex_buffer.slice(..));
        render_pass.set_index_buffer(e.index_buffer.slice(..), IndexFormat::Uint32);
        render_pass.draw_indexed(0..e.num_indices, 0, 0..1);
    }
}

queue.submit(iter::once(encoder.finish()));

does not work as expected when using Microsoft Basic Render Driver (so on DX12).

Expected vs observed behavior

All entities have their constant buffer updated in phase (1) and bound to a RenderPass in phase (2).
But they all are rendered with the same constant data - as far as I can tell, always the last one written in (1).

Extra materials

The sample app draws a bunch of quads. Each of them uses a color from its own constant buffer.

The expected result which is what I get on all Adapters, except for Microsoft Basic Render Driver:
correct

The incorrect result when using Microsoft Basic Render Driver:
incorrect

API trace (also available in the sample repo):
api_trace.zip

Platform

I'm running this on Windows 10, using wgpu 0.11.0

@kvark
Copy link
Member

kvark commented Nov 17, 2021

Oh interesting! We've seen (driver) issues with WARP before. I wonder if it's something to do with the way our mapping flush/invalidation works.

@kvark kvark added area: correctness We're behaving incorrectly type: bug Something isn't working labels Nov 17, 2021
@cwfitzgerald cwfitzgerald added the external: driver-bug A driver is causing the bug, though we may still want to work around it label Jun 2, 2022
@cwfitzgerald cwfitzgerald added api: dx12 Issues with DX12 or DXGI and removed type: bug Something isn't working area: correctness We're behaving incorrectly labels Jun 4, 2022
@PrototypeNM1
Copy link
Contributor

Just verified that this issue is no longer present in Windows 11, but still present in Windows 10.

@cwfitzgerald
Copy link
Member

cwfitzgerald commented Jul 11, 2022

Thanks for testing! Win11 has an upgraded WARP, so this is unsurprising, the water example also works with Win11 but not with Win10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: dx12 Issues with DX12 or DXGI external: driver-bug A driver is causing the bug, though we may still want to work around it
Projects
None yet
Development

No branches or pull requests

4 participants