Skip to content

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

Closed
@kwillemsen

Description

@kwillemsen

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    backend: dx12Issues with DX12 or DXGIexternal: driver-bugA driver is causing the bug, though we may still want to work around it

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions