wgpu
wgpu copied to clipboard
Queue::write_buffer() issue on Microsoft Basic Render Driver
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 Adapter
s, except for Microsoft Basic Render Driver
:
The incorrect result when using Microsoft Basic Render Driver
:
API trace (also available in the sample repo): api_trace.zip
Platform
I'm running this on Windows 10
, using wgpu 0.11.0
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.
Just verified that this issue is no longer present in Windows 11, but still present in Windows 10.
Thanks for testing! Win11 has an upgraded WARP, so this is unsurprising, the water example also works with Win11 but not with Win10