Commit fbd53c3a authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

wined3d: Provide a null counter BO for slots with no corresponding XFB buffer bound.

The Vulkan specification does not currently mandate this. However, an (unfortunately internal) Khronos discussion determined that this is an oversight, and that many drivers likely expect that no counter buffer will be bound if no XFB buffer is bound. Accordingly the specification will probably mandate this in the future. lavapipe is such a driver. This fixes a crash with llvmpipe in test_index_buffer_offset().
parent ce59348c
...@@ -2820,13 +2820,12 @@ static void wined3d_context_vk_bind_stream_output_buffers(struct wined3d_context ...@@ -2820,13 +2820,12 @@ static void wined3d_context_vk_bind_stream_output_buffers(struct wined3d_context
if (!wined3d_context_vk_create_bo(context_vk, ARRAY_SIZE(context_vk->vk_so_counters) * sizeof(uint32_t) * 2, if (!wined3d_context_vk_create_bo(context_vk, ARRAY_SIZE(context_vk->vk_so_counters) * sizeof(uint32_t) * 2,
VK_BUFFER_USAGE_TRANSFORM_FEEDBACK_COUNTER_BUFFER_BIT_EXT, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, bo)) VK_BUFFER_USAGE_TRANSFORM_FEEDBACK_COUNTER_BUFFER_BIT_EXT, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, bo))
ERR("Failed to create counter BO.\n"); ERR("Failed to create counter BO.\n");
for (i = 0; i < ARRAY_SIZE(context_vk->vk_so_counters); ++i) for (i = 0; i < ARRAY_SIZE(context_vk->vk_so_counters); ++i)
{
context_vk->vk_so_counters[i] = bo->vk_buffer;
context_vk->vk_so_offsets[i] = bo->b.buffer_offset + i * sizeof(uint32_t) * 2; context_vk->vk_so_offsets[i] = bo->b.buffer_offset + i * sizeof(uint32_t) * 2;
}
} }
memset(context_vk->vk_so_counters, 0, sizeof(context_vk->vk_so_counters));
first = 0; first = 0;
count = 0; count = 0;
for (i = 0; i < ARRAY_SIZE(state->stream_output); ++i) for (i = 0; i < ARRAY_SIZE(state->stream_output); ++i)
...@@ -2835,6 +2834,8 @@ static void wined3d_context_vk_bind_stream_output_buffers(struct wined3d_context ...@@ -2835,6 +2834,8 @@ static void wined3d_context_vk_bind_stream_output_buffers(struct wined3d_context
if ((buffer = stream->buffer)) if ((buffer = stream->buffer))
{ {
context_vk->vk_so_counters[i] = context_vk->vk_so_counter_bo.vk_buffer;
buffer_vk = wined3d_buffer_vk(buffer); buffer_vk = wined3d_buffer_vk(buffer);
buffer_info = wined3d_buffer_vk_get_buffer_info(buffer_vk); buffer_info = wined3d_buffer_vk_get_buffer_info(buffer_vk);
wined3d_context_vk_reference_bo(context_vk, wined3d_bo_vk(buffer->buffer_object)); wined3d_context_vk_reference_bo(context_vk, wined3d_bo_vk(buffer->buffer_object));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment