Module: wine
Branch: master
Commit: fbd53c3a3f65792608281be25ad5dcb315a6f2eb
URL: https://gitlab.winehq.org/wine/wine/-/commit/fbd53c3a3f65792608281be25ad5dc…
Author: Zebediah Figura <zfigura(a)codeweavers.com>
Date: Wed Nov 8 18:10:31 2023 -0600
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().
---
dlls/wined3d/context_vk.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/dlls/wined3d/context_vk.c b/dlls/wined3d/context_vk.c
index fcdaaa17966..29a4a4998d4 100644
--- a/dlls/wined3d/context_vk.c
+++ b/dlls/wined3d/context_vk.c
@@ -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,
VK_BUFFER_USAGE_TRANSFORM_FEEDBACK_COUNTER_BUFFER_BIT_EXT, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT, bo))
ERR("Failed to create counter BO.\n");
+
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;
- }
}
+ memset(context_vk->vk_so_counters, 0, sizeof(context_vk->vk_so_counters));
first = 0;
count = 0;
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
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_info = wined3d_buffer_vk_get_buffer_info(buffer_vk);
wined3d_context_vk_reference_bo(context_vk, wined3d_bo_vk(buffer->buffer_object));