Henri Verbeet : wined3d: Properly check if an attribute is used in loadVertexData().
Alexandre Julliard
julliard at winehq.org
Mon Aug 24 10:08:36 CDT 2009
Module: wine
Branch: master
Commit: e48350a4713a5503213d224ba42ac0cd1120be8e
URL: http://source.winehq.org/git/wine.git/?a=commit;h=e48350a4713a5503213d224ba42ac0cd1120be8e
Author: Henri Verbeet <hverbeet at codeweavers.com>
Date: Mon Aug 24 09:27:51 2009 +0200
wined3d: Properly check if an attribute is used in loadVertexData().
---
dlls/wined3d/state.c | 31 +++++++++++++++----------------
1 files changed, 15 insertions(+), 16 deletions(-)
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 97f1f79..e9fd804 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -4144,11 +4144,11 @@ static void loadVertexData(const struct wined3d_context *context, IWineD3DStateB
stateblock->wineD3DDevice->instancedDraw = FALSE;
/* Blend Data ---------------------------------------------- */
- e = &si->elements[WINED3D_FFP_BLENDWEIGHT];
- if (e->data || e->buffer_object
- || si->elements[WINED3D_FFP_BLENDINDICES].data
- || si->elements[WINED3D_FFP_BLENDINDICES].buffer_object)
+ if ((si->use_map & (1 << WINED3D_FFP_BLENDWEIGHT))
+ || si->use_map & (1 << WINED3D_FFP_BLENDINDICES))
{
+ e = &si->elements[WINED3D_FFP_BLENDWEIGHT];
+
if (GL_SUPPORT(ARB_VERTEX_BLEND)) {
TRACE("Blend %d %p %d\n", e->format_desc->component_count,
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
checkGLcall("glWeightPointerARB");
- if (si->elements[WINED3D_FFP_BLENDINDICES].data
- || (si->elements[WINED3D_FFP_BLENDINDICES].buffer_object))
+ if (si->use_map & (1 << WINED3D_FFP_BLENDINDICES))
{
static BOOL warned;
if (!warned)
@@ -4200,8 +4199,7 @@ static void loadVertexData(const struct wined3d_context *context, IWineD3DStateB
}
/* Point Size ----------------------------------------------*/
- e = &si->elements[WINED3D_FFP_PSIZE];
- if (e->data || e->buffer_object)
+ if (si->use_map & (1 << WINED3D_FFP_PSIZE))
{
/* no such functionality in the fixed function GL pipeline */
TRACE("Cannot change ptSize here in openGl\n");
@@ -4209,11 +4207,11 @@ static void loadVertexData(const struct wined3d_context *context, IWineD3DStateB
}
/* Vertex Pointers -----------------------------------------*/
- e = &si->elements[WINED3D_FFP_POSITION];
- if (e->data || e->buffer_object)
+ if (si->use_map & (1 << WINED3D_FFP_POSITION))
{
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)
{
GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, e->buffer_object));
@@ -4243,10 +4241,11 @@ static void loadVertexData(const struct wined3d_context *context, IWineD3DStateB
}
/* Normals -------------------------------------------------*/
- e = &si->elements[WINED3D_FFP_NORMAL];
- if (e->data || e->buffer_object)
+ if (si->use_map & (1 << WINED3D_FFP_NORMAL))
{
VTRACE(("glNormalPointer(GL_FLOAT, %d, %p)\n", e->stride, e->data));
+
+ e = &si->elements[WINED3D_FFP_NORMAL];
if (curVBO != 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
/* NOTE: Unless we write a vertex shader to swizzle the colour*/
/* , or the user doesn't care and wants the speed advantage */
- e = &si->elements[WINED3D_FFP_DIFFUSE];
- if (e->data || e->buffer_object)
+ if (si->use_map & (1 << WINED3D_FFP_DIFFUSE))
{
VTRACE(("glColorPointer(4, GL_UNSIGNED_BYTE, %d, %p)\n", e->stride, e->data));
+ e = &si->elements[WINED3D_FFP_DIFFUSE];
if (curVBO != 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
}
/* Specular Colour ------------------------------------------*/
- e = &si->elements[WINED3D_FFP_SPECULAR];
- if (e->data || e->buffer_object)
+ if (si->use_map & (1 << WINED3D_FFP_SPECULAR))
{
TRACE("setting specular colour\n");
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)) {
GLenum type = e->format_desc->gl_vtx_type;
GLint format = e->format_desc->gl_vtx_format;
More information about the wine-cvs
mailing list