diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c index 643b098129e..2b82cca51c4 100644 --- a/dlls/wined3d/drawprim.c +++ b/dlls/wined3d/drawprim.c @@ -113,23 +113,38 @@ static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_context VTRACE(("glBegin(%x)\n", glPrimType)); glBegin(glPrimType); - element = &si->elements[WINED3D_FFP_POSITION]; - if (element->data) position = element->data + streamOffset[element->stream_idx]; + if (si->use_map & (1 << WINED3D_FFP_POSITION)) + { + element = &si->elements[WINED3D_FFP_POSITION]; + position = element->data + streamOffset[element->stream_idx]; + } - element = &si->elements[WINED3D_FFP_NORMAL]; - if (element->data) normal = element->data + streamOffset[element->stream_idx]; - else glNormal3f(0, 0, 0); + if (si->use_map & (1 << WINED3D_FFP_NORMAL)) + { + element = &si->elements[WINED3D_FFP_NORMAL]; + normal = element->data + streamOffset[element->stream_idx]; + } + else + { + glNormal3f(0, 0, 0); + } - element = &si->elements[WINED3D_FFP_DIFFUSE]; - if (element->data) diffuse = element->data + streamOffset[element->stream_idx]; - else glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + if (si->use_map & (1 << WINED3D_FFP_DIFFUSE)) + { + element = &si->elements[WINED3D_FFP_DIFFUSE]; + diffuse = element->data + streamOffset[element->stream_idx]; + } + else + { + glColor4f(1.0f, 1.0f, 1.0f, 1.0f); + } num_untracked_materials = context->num_untracked_materials; if (num_untracked_materials && element->format_desc->format != WINED3DFMT_A8R8G8B8) FIXME("Implement diffuse color tracking from %s\n", debug_d3dformat(element->format_desc->format)); - element = &si->elements[WINED3D_FFP_SPECULAR]; - if (element->data) + if (si->use_map & (1 << WINED3D_FFP_SPECULAR)) { + element = &si->elements[WINED3D_FFP_SPECULAR]; specular = element->data + streamOffset[element->stream_idx]; /* special case where the fog density is stored in the specular alpha channel */ @@ -187,9 +202,9 @@ static void drawStridedSlow(IWineD3DDevice *iface, const struct wined3d_context continue; } - element = &si->elements[WINED3D_FFP_TEXCOORD0 + coordIdx]; - if (element->data) + if (si->use_map & (1 << (WINED3D_FFP_TEXCOORD0 + coordIdx))) { + element = &si->elements[WINED3D_FFP_TEXCOORD0 + coordIdx]; texCoords[coordIdx] = element->data + streamOffset[element->stream_idx]; tex_mask |= (1 << textureNo); }