Commit e48350a4 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

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

parent 918c9d59
...@@ -4144,11 +4144,11 @@ static void loadVertexData(const struct wined3d_context *context, IWineD3DStateB ...@@ -4144,11 +4144,11 @@ static void loadVertexData(const struct wined3d_context *context, IWineD3DStateB
stateblock->wineD3DDevice->instancedDraw = FALSE; stateblock->wineD3DDevice->instancedDraw = FALSE;
/* Blend Data ---------------------------------------------- */ /* Blend Data ---------------------------------------------- */
e = &si->elements[WINED3D_FFP_BLENDWEIGHT]; if ((si->use_map & (1 << WINED3D_FFP_BLENDWEIGHT))
if (e->data || e->buffer_object || si->use_map & (1 << WINED3D_FFP_BLENDINDICES))
|| si->elements[WINED3D_FFP_BLENDINDICES].data
|| si->elements[WINED3D_FFP_BLENDINDICES].buffer_object)
{ {
e = &si->elements[WINED3D_FFP_BLENDWEIGHT];
if (GL_SUPPORT(ARB_VERTEX_BLEND)) { if (GL_SUPPORT(ARB_VERTEX_BLEND)) {
TRACE("Blend %d %p %d\n", e->format_desc->component_count, TRACE("Blend %d %p %d\n", e->format_desc->component_count,
e->data + stateblock->loadBaseVertexIndex * e->stride, e->stride + offset[e->stream_idx]); e->data + stateblock->loadBaseVertexIndex * e->stride, e->stride + offset[e->stream_idx]);
...@@ -4175,8 +4175,7 @@ static void loadVertexData(const struct wined3d_context *context, IWineD3DStateB ...@@ -4175,8 +4175,7 @@ static void loadVertexData(const struct wined3d_context *context, IWineD3DStateB
checkGLcall("glWeightPointerARB"); checkGLcall("glWeightPointerARB");
if (si->elements[WINED3D_FFP_BLENDINDICES].data if (si->use_map & (1 << WINED3D_FFP_BLENDINDICES))
|| (si->elements[WINED3D_FFP_BLENDINDICES].buffer_object))
{ {
static BOOL warned; static BOOL warned;
if (!warned) if (!warned)
...@@ -4200,8 +4199,7 @@ static void loadVertexData(const struct wined3d_context *context, IWineD3DStateB ...@@ -4200,8 +4199,7 @@ static void loadVertexData(const struct wined3d_context *context, IWineD3DStateB
} }
/* Point Size ----------------------------------------------*/ /* Point Size ----------------------------------------------*/
e = &si->elements[WINED3D_FFP_PSIZE]; if (si->use_map & (1 << WINED3D_FFP_PSIZE))
if (e->data || e->buffer_object)
{ {
/* no such functionality in the fixed function GL pipeline */ /* no such functionality in the fixed function GL pipeline */
TRACE("Cannot change ptSize here in openGl\n"); TRACE("Cannot change ptSize here in openGl\n");
...@@ -4209,11 +4207,11 @@ static void loadVertexData(const struct wined3d_context *context, IWineD3DStateB ...@@ -4209,11 +4207,11 @@ static void loadVertexData(const struct wined3d_context *context, IWineD3DStateB
} }
/* Vertex Pointers -----------------------------------------*/ /* Vertex Pointers -----------------------------------------*/
e = &si->elements[WINED3D_FFP_POSITION]; if (si->use_map & (1 << WINED3D_FFP_POSITION))
if (e->data || e->buffer_object)
{ {
VTRACE(("glVertexPointer(%d, GL_FLOAT, %d, %p)\n", e->stride, e->size, e->data)); VTRACE(("glVertexPointer(%d, GL_FLOAT, %d, %p)\n", e->stride, e->size, e->data));
e = &si->elements[WINED3D_FFP_POSITION];
if (curVBO != e->buffer_object) if (curVBO != e->buffer_object)
{ {
GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, e->buffer_object)); GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, e->buffer_object));
...@@ -4243,10 +4241,11 @@ static void loadVertexData(const struct wined3d_context *context, IWineD3DStateB ...@@ -4243,10 +4241,11 @@ static void loadVertexData(const struct wined3d_context *context, IWineD3DStateB
} }
/* Normals -------------------------------------------------*/ /* Normals -------------------------------------------------*/
e = &si->elements[WINED3D_FFP_NORMAL]; if (si->use_map & (1 << WINED3D_FFP_NORMAL))
if (e->data || e->buffer_object)
{ {
VTRACE(("glNormalPointer(GL_FLOAT, %d, %p)\n", e->stride, e->data)); VTRACE(("glNormalPointer(GL_FLOAT, %d, %p)\n", e->stride, e->data));
e = &si->elements[WINED3D_FFP_NORMAL];
if (curVBO != e->buffer_object) if (curVBO != e->buffer_object)
{ {
GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, e->buffer_object)); GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, e->buffer_object));
...@@ -4273,11 +4272,11 @@ static void loadVertexData(const struct wined3d_context *context, IWineD3DStateB ...@@ -4273,11 +4272,11 @@ static void loadVertexData(const struct wined3d_context *context, IWineD3DStateB
/* NOTE: Unless we write a vertex shader to swizzle the colour*/ /* NOTE: Unless we write a vertex shader to swizzle the colour*/
/* , or the user doesn't care and wants the speed advantage */ /* , or the user doesn't care and wants the speed advantage */
e = &si->elements[WINED3D_FFP_DIFFUSE]; if (si->use_map & (1 << WINED3D_FFP_DIFFUSE))
if (e->data || e->buffer_object)
{ {
VTRACE(("glColorPointer(4, GL_UNSIGNED_BYTE, %d, %p)\n", e->stride, e->data)); VTRACE(("glColorPointer(4, GL_UNSIGNED_BYTE, %d, %p)\n", e->stride, e->data));
e = &si->elements[WINED3D_FFP_DIFFUSE];
if (curVBO != e->buffer_object) if (curVBO != e->buffer_object)
{ {
GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, e->buffer_object)); GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, e->buffer_object));
...@@ -4297,12 +4296,12 @@ static void loadVertexData(const struct wined3d_context *context, IWineD3DStateB ...@@ -4297,12 +4296,12 @@ static void loadVertexData(const struct wined3d_context *context, IWineD3DStateB
} }
/* Specular Colour ------------------------------------------*/ /* Specular Colour ------------------------------------------*/
e = &si->elements[WINED3D_FFP_SPECULAR]; if (si->use_map & (1 << WINED3D_FFP_SPECULAR))
if (e->data || e->buffer_object)
{ {
TRACE("setting specular colour\n"); TRACE("setting specular colour\n");
VTRACE(("glSecondaryColorPointer(4, GL_UNSIGNED_BYTE, %d, %p)\n", e->stride, e->data)); VTRACE(("glSecondaryColorPointer(4, GL_UNSIGNED_BYTE, %d, %p)\n", e->stride, e->data));
e = &si->elements[WINED3D_FFP_SPECULAR];
if (GL_SUPPORT(EXT_SECONDARY_COLOR)) { if (GL_SUPPORT(EXT_SECONDARY_COLOR)) {
GLenum type = e->format_desc->gl_vtx_type; GLenum type = e->format_desc->gl_vtx_type;
GLint format = e->format_desc->gl_vtx_format; GLint format = e->format_desc->gl_vtx_format;
......
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