wined3d: Implement zero step rate for instanced attributes.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2021-03-23 15:52:50 -05:00 committed by Alexandre Julliard
parent 1eff85d2f7
commit 4d345a78bf
4 changed files with 11 additions and 5 deletions

View File

@ -238,16 +238,17 @@ void wined3d_stream_info_from_declaration(struct wined3d_stream_info *stream_inf
if (stream->flags & WINED3DSTREAMSOURCE_INSTANCEDATA)
{
stream_info->elements[idx].divisor = 1;
stream_info->elements[idx].instanced = true;
}
else if (element->input_slot_class == WINED3D_INPUT_PER_INSTANCE_DATA)
{
stream_info->elements[idx].divisor = element->instance_data_step_rate;
if (!element->instance_data_step_rate)
FIXME("Instance step rate 0 not implemented.\n");
stream_info->elements[idx].instanced = true;
}
else
{
stream_info->elements[idx].divisor = 0;
stream_info->elements[idx].instanced = false;
}
if (!d3d_info->vertex_bgra && element->format->id == WINED3DFMT_B8G8R8A8_UNORM)

View File

@ -5378,7 +5378,11 @@ static void wined3d_context_gl_load_numbered_arrays(struct wined3d_context_gl *c
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)
{

View File

@ -2061,9 +2061,9 @@ 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->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->binding = binding;

View File

@ -1665,6 +1665,7 @@ struct wined3d_stream_info_element
GLsizei stride;
unsigned int stream_idx;
unsigned int divisor;
bool instanced;
};
struct wined3d_stream_info