Commit 4d345a78 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

wined3d: Implement zero step rate for instanced attributes.

parent 1eff85d2
...@@ -238,16 +238,17 @@ void wined3d_stream_info_from_declaration(struct wined3d_stream_info *stream_inf ...@@ -238,16 +238,17 @@ void wined3d_stream_info_from_declaration(struct wined3d_stream_info *stream_inf
if (stream->flags & WINED3DSTREAMSOURCE_INSTANCEDATA) if (stream->flags & WINED3DSTREAMSOURCE_INSTANCEDATA)
{ {
stream_info->elements[idx].divisor = 1; stream_info->elements[idx].divisor = 1;
stream_info->elements[idx].instanced = true;
} }
else if (element->input_slot_class == WINED3D_INPUT_PER_INSTANCE_DATA) else if (element->input_slot_class == WINED3D_INPUT_PER_INSTANCE_DATA)
{ {
stream_info->elements[idx].divisor = element->instance_data_step_rate; stream_info->elements[idx].divisor = element->instance_data_step_rate;
if (!element->instance_data_step_rate) stream_info->elements[idx].instanced = true;
FIXME("Instance step rate 0 not implemented.\n");
} }
else else
{ {
stream_info->elements[idx].divisor = 0; stream_info->elements[idx].divisor = 0;
stream_info->elements[idx].instanced = false;
} }
if (!d3d_info->vertex_bgra && element->format->id == WINED3DFMT_B8G8R8A8_UNORM) if (!d3d_info->vertex_bgra && element->format->id == WINED3DFMT_B8G8R8A8_UNORM)
......
...@@ -5378,7 +5378,11 @@ static void wined3d_context_gl_load_numbered_arrays(struct wined3d_context_gl *c ...@@ -5378,7 +5378,11 @@ static void wined3d_context_gl_load_numbered_arrays(struct wined3d_context_gl *c
if (gl_info->supported[ARB_INSTANCED_ARRAYS]) if (gl_info->supported[ARB_INSTANCED_ARRAYS])
{ {
GL_EXTCALL(glVertexAttribDivisor(i, element->divisor)); unsigned int divisor = 0;
if (element->instanced)
divisor = element->divisor ? element->divisor : UINT_MAX;
GL_EXTCALL(glVertexAttribDivisor(i, divisor));
} }
else if (element->divisor) else if (element->divisor)
{ {
......
...@@ -2061,9 +2061,9 @@ static bool wined3d_context_vk_update_graphics_pipeline_key(struct wined3d_conte ...@@ -2061,9 +2061,9 @@ static bool wined3d_context_vk_update_graphics_pipeline_key(struct wined3d_conte
b = &key->bindings[binding_count++]; b = &key->bindings[binding_count++];
b->binding = binding; b->binding = binding;
b->stride = e->stride; b->stride = e->stride;
b->inputRate = e->divisor ? VK_VERTEX_INPUT_RATE_INSTANCE : VK_VERTEX_INPUT_RATE_VERTEX; b->inputRate = e->instanced ? VK_VERTEX_INPUT_RATE_INSTANCE : VK_VERTEX_INPUT_RATE_VERTEX;
if (e->divisor > 1) if (e->instanced)
{ {
d = &key->divisors[divisor_count++]; d = &key->divisors[divisor_count++];
d->binding = binding; d->binding = binding;
......
...@@ -1665,6 +1665,7 @@ struct wined3d_stream_info_element ...@@ -1665,6 +1665,7 @@ struct wined3d_stream_info_element
GLsizei stride; GLsizei stride;
unsigned int stream_idx; unsigned int stream_idx;
unsigned int divisor; unsigned int divisor;
bool instanced;
}; };
struct wined3d_stream_info struct wined3d_stream_info
......
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