[PATCH v2 6/6] wined3d: Create vertex input descriptions for inputs that don't have a buffer set.
Jan Sikorski
jsikorski at codeweavers.com
Fri Apr 16 03:44:49 CDT 2021
Fix them to be VK_VERTEX_INPUT_RATE_VERTEX with zero stride and offset,
as they will get a zero-filled buffer with a fixed size bound to them.
We could maybe avoid changing the pipeline key in that case with the
nullDescriptor feature. This is left as a potential future improvement.
Signed-off-by: Jan Sikorski <jsikorski at codeweavers.com>
---
dlls/wined3d/context_vk.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/dlls/wined3d/context_vk.c b/dlls/wined3d/context_vk.c
index ae7107dc1c8..02b03be915f 100644
--- a/dlls/wined3d/context_vk.c
+++ b/dlls/wined3d/context_vk.c
@@ -2032,7 +2032,7 @@ static bool wined3d_context_vk_update_graphics_pipeline_key(struct wined3d_conte
|| wined3d_context_is_graphics_state_dirty(&context_vk->c, STATE_STREAMSRC)
|| wined3d_context_is_graphics_state_dirty(&context_vk->c, STATE_SHADER(WINED3D_SHADER_TYPE_VERTEX)))
{
- wined3d_stream_info_from_declaration(&stream_info, state, d3d_info, true);
+ wined3d_stream_info_from_declaration(&stream_info, state, d3d_info, false);
divisor_count = 0;
for (i = 0, mask = 0, attribute_count = 0, binding_count = 0; i < ARRAY_SIZE(stream_info.elements); ++i)
{
@@ -2041,6 +2041,7 @@ static bool wined3d_context_vk_update_graphics_pipeline_key(struct wined3d_conte
VkVertexInputAttributeDescription *a;
VkVertexInputBindingDescription *b;
uint32_t binding;
+ bool empty;
if (!(stream_info.use_map & (1u << i)))
continue;
@@ -2048,11 +2049,12 @@ static bool wined3d_context_vk_update_graphics_pipeline_key(struct wined3d_conte
a = &key->attributes[attribute_count++];
e = &stream_info.elements[i];
binding = e->stream_idx;
+ empty = !state->streams[binding].buffer;
a->location = i;
a->binding = binding;
a->format = wined3d_format_vk(e->format)->vk_format;
- a->offset = (UINT_PTR)e->data.addr - state->streams[binding].offset;
+ a->offset = empty ? 0 : (UINT_PTR)e->data.addr - state->streams[binding].offset;
if (mask & (1u << binding))
continue;
@@ -2060,11 +2062,13 @@ static bool wined3d_context_vk_update_graphics_pipeline_key(struct wined3d_conte
b = &key->bindings[binding_count++];
b->binding = binding;
- b->stride = e->stride;
- b->inputRate = e->instanced ? VK_VERTEX_INPUT_RATE_INSTANCE : VK_VERTEX_INPUT_RATE_VERTEX;
+ b->stride = empty ? 0 : e->stride;
- if (e->instanced)
+ if (!e->instanced || empty)
+ b->inputRate = VK_VERTEX_INPUT_RATE_VERTEX;
+ else
{
+ b->inputRate = VK_VERTEX_INPUT_RATE_INSTANCE;
d = &key->divisors[divisor_count++];
d->binding = binding;
d->divisor = e->divisor;
--
2.31.0
More information about the wine-devel
mailing list