Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- Not tested on real hardware since I don't have easy access to it at the moment.
We rely on this in test_dispatch_indirect(), which currently succeeds in Wine only because we initialize the buffer in sysmem with wined3d_resource_alloc_sysmem().
dlls/d3d11/tests/d3d11.c | 9 ++++----- dlls/wined3d/view.c | 7 ++++++- 2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index d1ffbe64f0b..1565d26a060 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -16371,10 +16371,8 @@ static void test_clear_buffer_unordered_access_view(void) buffer_desc.Usage = D3D11_USAGE_DEFAULT; buffer_desc.BindFlags = D3D11_BIND_UNORDERED_ACCESS; buffer_desc.CPUAccessFlags = 0; - buffer_desc.MiscFlags = 0; - buffer_desc.StructureByteStride = 0; buffer_desc.MiscFlags = D3D11_RESOURCE_MISC_BUFFER_STRUCTURED; - buffer_desc.StructureByteStride = 4; + buffer_desc.StructureByteStride = 8; hr = ID3D11Device_CreateBuffer(device, &buffer_desc, NULL, &buffer); ok(hr == S_OK, "Failed to create a buffer, hr %#x.\n", hr);
@@ -16400,9 +16398,10 @@ static void test_clear_buffer_unordered_access_view(void)
ID3D11DeviceContext_ClearUnorderedAccessViewUint(context, uav2, &fe_uvec4.x); get_buffer_readback(buffer, &rb); - SetRect(&rect, 0, 0, U(uav_desc).Buffer.NumElements, 1); + SetRect(&rect, 0, 0, U(uav_desc).Buffer.NumElements * buffer_desc.StructureByteStride / sizeof(uvec4.x), 1); check_readback_data_color(&rb, &rect, fe_uvec4.x, 0); - SetRect(&rect, U(uav_desc).Buffer.NumElements, 0, buffer_desc.ByteWidth / sizeof(uvec4.x), 1); + rect.left = rect.right; + rect.right = buffer_desc.ByteWidth / sizeof(uvec4.x); check_readback_data_color(&rb, &rect, uvec4.x, 0); release_resource_readback(&rb); } diff --git a/dlls/wined3d/view.c b/dlls/wined3d/view.c index efa98ea13eb..3b113a940a3 100644 --- a/dlls/wined3d/view.c +++ b/dlls/wined3d/view.c @@ -1985,11 +1985,16 @@ void wined3d_unordered_access_view_vk_clear(struct wined3d_unordered_access_view
if (resource->type == WINED3D_RTYPE_BUFFER) { + struct wined3d_buffer *buffer = buffer_from_resource(resource); + uav_location = WINED3D_LOCATION_BUFFER; layout = state->buffer_layout; vk_writes[0].descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER;
- constants.extent.width = view_desc->u.buffer.count; + if (buffer->structure_byte_stride) + constants.extent.width = view_desc->u.buffer.count * buffer->structure_byte_stride / 4; + else + constants.extent.width = view_desc->u.buffer.count; constants.extent.height = 1; } else