From abad305c1ae9a524e97eeaa05cf5f6d22dfe6f95 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Tue, 17 May 2016 14:01:54 +0200 Subject: [PATCH] wined3d: Emit position / attribute 0 last in draw_primitive_immediate_mode(). Emitting the position / attribute 0 provokes the actual vertex emission, so needs to happen last. This fixes a regression introduced by commit f3c155cc56eb31fa9294d388e755208a2633c398. Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/wined3d/drawprim.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c index c08649185a1..45fa5242df1 100644 --- a/dlls/wined3d/drawprim.c +++ b/dlls/wined3d/drawprim.c @@ -214,9 +214,9 @@ static void draw_primitive_immediate_mode(struct wined3d_context *context, const unsigned int element_idx; stride_idx = get_stride_idx(idx_data, idx_size, state->base_vertex_index, start_idx, vertex_idx); - for (element_idx = 0; use_map; use_map >>= 1, ++element_idx) + for (element_idx = MAX_ATTRIBS - 1; use_map; use_map &= ~(1u << element_idx), --element_idx) { - if (!(use_map & 1u)) + if (!(use_map & 1u << element_idx)) continue; ptr = si->elements[element_idx].data.addr + si->elements[element_idx].stride * stride_idx; @@ -329,12 +329,6 @@ static void draw_primitive_immediate_mode(struct wined3d_context *context, const stride_idx = get_stride_idx(idx_data, idx_size, state->base_vertex_index, start_idx, vertex_idx); - if (position) - { - ptr = position + stride_idx * si->elements[WINED3D_FFP_POSITION].stride; - ops->position[si->elements[WINED3D_FFP_POSITION].format->emit_idx](ptr); - } - if (normal) { ptr = normal + stride_idx * si->elements[WINED3D_FFP_NORMAL].stride; @@ -379,6 +373,12 @@ static void draw_primitive_immediate_mode(struct wined3d_context *context, const ops->texcoord[si->elements[WINED3D_FFP_TEXCOORD0 + coord_idx].format->emit_idx]( GL_TEXTURE0_ARB + context->tex_unit_map[texture_idx], ptr); } + + if (position) + { + ptr = position + stride_idx * si->elements[WINED3D_FFP_POSITION].stride; + ops->position[si->elements[WINED3D_FFP_POSITION].format->emit_idx](ptr); + } } gl_info->gl_ops.gl.p_glEnd();