wined3d: Properly check if an attribute is used in drawStridedSlow().

This commit is contained in:
Henri Verbeet 2009-08-25 08:17:10 +02:00 committed by Alexandre Julliard
parent 15bd593fae
commit c9f270a5d9
1 changed files with 27 additions and 12 deletions

View File

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