From 1eaee42399ffac07fd2a2fb4019ddeafabee1ad9 Mon Sep 17 00:00:00 2001 From: Lionel Ulmer Date: Tue, 25 Nov 2003 00:06:33 +0000 Subject: [PATCH] Use vertex arrays when possible. --- dlls/ddraw/d3ddevice/mesa.c | 415 ++++++++++++++++++++---------------- dlls/ddraw/gl_api.h | 8 + dlls/ddraw/gl_private.h | 8 + dlls/ddraw/mesa_private.h | 1 + 4 files changed, 253 insertions(+), 179 deletions(-) diff --git a/dlls/ddraw/d3ddevice/mesa.c b/dlls/ddraw/d3ddevice/mesa.c index 030c2966a29..f92ebac9865 100644 --- a/dlls/ddraw/d3ddevice/mesa.c +++ b/dlls/ddraw/d3ddevice/mesa.c @@ -836,42 +836,36 @@ GL_IDirect3DDeviceImpl_3_2T_SetLightState(LPDIRECT3DDEVICE3 iface, return DD_OK; } -static void draw_primitive_start_GL(D3DPRIMITIVETYPE d3dpt) +static GLenum convert_D3D_ptype_to_GL(D3DPRIMITIVETYPE d3dpt) { switch (d3dpt) { case D3DPT_POINTLIST: - TRACE("Start POINTS\n"); - glBegin(GL_POINTS); - break; + TRACE(" primitive type is POINTS\n"); + return GL_POINTS; case D3DPT_LINELIST: - TRACE("Start LINES\n"); - glBegin(GL_LINES); - break; - + TRACE(" primitive type is LINES\n"); + return GL_LINES; + case D3DPT_LINESTRIP: - TRACE("Start LINE_STRIP\n"); - glBegin(GL_LINE_STRIP); - break; - + TRACE(" primitive type is LINE_STRIP\n"); + return GL_LINE_STRIP; + case D3DPT_TRIANGLELIST: - TRACE("Start TRIANGLES\n"); - glBegin(GL_TRIANGLES); - break; - + TRACE(" primitive type is TRIANGLES\n"); + return GL_TRIANGLES; + case D3DPT_TRIANGLESTRIP: - TRACE("Start TRIANGLE_STRIP\n"); - glBegin(GL_TRIANGLE_STRIP); - break; - + TRACE(" primitive type is TRIANGLE_STRIP\n"); + return GL_TRIANGLE_STRIP; + case D3DPT_TRIANGLEFAN: - TRACE("Start TRIANGLE_FAN\n"); - glBegin(GL_TRIANGLE_FAN); - break; - + TRACE(" primitive type is TRIANGLE_FAN\n"); + return GL_TRIANGLE_FAN; + default: FIXME("Unhandled primitive %08x\n", d3dpt); - break; + return GL_POINTS; } } @@ -1305,7 +1299,8 @@ static void draw_primitive_strided(IDirect3DDeviceImpl *This, BOOLEAN vertex_lighted = FALSE; IDirect3DDeviceGLImpl* glThis = (IDirect3DDeviceGLImpl*) This; int num_active_stages = 0; - + int num_tex_index = ((d3dvtVertexType & D3DFVF_TEXCOUNT_MASK) >> D3DFVF_TEXCOUNT_SHIFT); + /* I put the trace before the various locks... So as to better understand where locks occur :-) */ if (TRACE_ON(ddraw)) { TRACE(" Vertex format : "); dump_flexible_vertex(d3dvtVertexType); @@ -1356,167 +1351,228 @@ static void draw_primitive_strided(IDirect3DDeviceImpl *This, draw_primitive_handle_GL_state(This, (d3dvtVertexType & D3DFVF_POSITION_MASK) != D3DFVF_XYZ, vertex_lighted); - draw_primitive_start_GL(d3dptPrimitiveType); - /* Some fast paths first before the generic case.... */ - if ((d3dvtVertexType == D3DFVF_VERTEX) && (num_active_stages <= 1)) { - int index; - - for (index = 0; index < dwIndexCount; index++) { - int i = (dwIndices == NULL) ? index : dwIndices[index]; - D3DVALUE *normal = - (D3DVALUE *) (((char *) lpD3DDrawPrimStrideData->normal.lpvData) + i * lpD3DDrawPrimStrideData->normal.dwStride); - D3DVALUE *tex_coord = - (D3DVALUE *) (((char *) lpD3DDrawPrimStrideData->textureCoords[0].lpvData) + i * lpD3DDrawPrimStrideData->textureCoords[0].dwStride); - D3DVALUE *position = - (D3DVALUE *) (((char *) lpD3DDrawPrimStrideData->position.lpvData) + i * lpD3DDrawPrimStrideData->position.dwStride); - - handle_normal(normal); - handle_texture(tex_coord); - handle_xyz(position); - - TRACE_(ddraw_geom)(" %f %f %f / %f %f %f (%f %f)\n", - position[0], position[1], position[2], - normal[0], normal[1], normal[2], - tex_coord[0], tex_coord[1]); + /* First, see if we can use the OpenGL vertex arrays... This is very limited + for now to some 'special' cases where we can do a direct mapping between D3D + types and GL types. + + Note that in the future all calls will go through vertex arrays but the arrays + will be generated by this function. */ + if (((d3dvtVertexType & D3DFVF_POSITION_MASK) == D3DFVF_XYZ) && /* Standard XYZ vertices */ + (((d3dvtVertexType & (D3DFVF_DIFFUSE|D3DFVF_SPECULAR)) == 0) || /* Either no colours */ + (((d3dvtVertexType & D3DFVF_DIFFUSE) != 0) && /* Or diffuse only but the Alpha component is not used */ + (This->state_block.render_state[D3DRENDERSTATE_ALPHATESTENABLE - 1] == FALSE) && + (This->state_block.render_state[D3DRENDERSTATE_ALPHABLENDENABLE - 1] == FALSE)))) { + int tex_stage; + TRACE(" using GL vertex arrays for performance !\n"); + /* First, the vertices (we are sure we have some :-) */ + glEnableClientState(GL_VERTEX_ARRAY); + glVertexPointer(3, GL_FLOAT, lpD3DDrawPrimStrideData->position.dwStride, lpD3DDrawPrimStrideData->position.lpvData); + /* Then the normals */ + if (d3dvtVertexType & D3DFVF_NORMAL) { + glEnableClientState(GL_NORMAL_ARRAY); + glNormalPointer(GL_FLOAT, lpD3DDrawPrimStrideData->normal.dwStride, lpD3DDrawPrimStrideData->normal.lpvData); } - } else if ((d3dvtVertexType == D3DFVF_TLVERTEX) && (num_active_stages <= 1)) { - int index; - - for (index = 0; index < dwIndexCount; index++) { - int i = (dwIndices == NULL) ? index : dwIndices[index]; - DWORD *color_d = - (DWORD *) (((char *) lpD3DDrawPrimStrideData->diffuse.lpvData) + i * lpD3DDrawPrimStrideData->diffuse.dwStride); - DWORD *color_s = - (DWORD *) (((char *) lpD3DDrawPrimStrideData->specular.lpvData) + i * lpD3DDrawPrimStrideData->specular.dwStride); - D3DVALUE *tex_coord = - (D3DVALUE *) (((char *) lpD3DDrawPrimStrideData->textureCoords[0].lpvData) + i * lpD3DDrawPrimStrideData->textureCoords[0].dwStride); - D3DVALUE *position = - (D3DVALUE *) (((char *) lpD3DDrawPrimStrideData->position.lpvData) + i * lpD3DDrawPrimStrideData->position.dwStride); - - handle_diffuse_and_specular(&(This->state_block), glThis->fog_table, color_d, color_s, TRUE); - handle_texture(tex_coord); - handle_xyzrhw(position); - - TRACE_(ddraw_geom)(" %f %f %f %f / %02lx %02lx %02lx %02lx - %02lx %02lx %02lx %02lx (%f %f)\n", - position[0], position[1], position[2], position[3], - (*color_d >> 16) & 0xFF, - (*color_d >> 8) & 0xFF, - (*color_d >> 0) & 0xFF, - (*color_d >> 24) & 0xFF, - (*color_s >> 16) & 0xFF, - (*color_s >> 8) & 0xFF, - (*color_s >> 0) & 0xFF, - (*color_s >> 24) & 0xFF, - tex_coord[0], tex_coord[1]); - } - } else if (((d3dvtVertexType & D3DFVF_POSITION_MASK) == D3DFVF_XYZ) || - ((d3dvtVertexType & D3DFVF_POSITION_MASK) == D3DFVF_XYZRHW)) { - /* This is the 'slow path' but that should support all possible vertex formats out there... - Note that people should write a fast path for all vertex formats out there... - */ - int index; - int num_tex_index = ((d3dvtVertexType & D3DFVF_TEXCOUNT_MASK) >> D3DFVF_TEXCOUNT_SHIFT); - static const D3DVALUE no_index[] = { 0.0, 0.0, 0.0, 0.0 }; - - for (index = 0; index < dwIndexCount; index++) { - int i = (dwIndices == NULL) ? index : dwIndices[index]; - int tex_stage; - - if (d3dvtVertexType & D3DFVF_NORMAL) { - D3DVALUE *normal = - (D3DVALUE *) (((char *) lpD3DDrawPrimStrideData->normal.lpvData) + i * lpD3DDrawPrimStrideData->normal.dwStride); - handle_normal(normal); + /* Then the diffuse colour */ + if (d3dvtVertexType & D3DFVF_DIFFUSE) { + glEnableClientState(GL_COLOR_ARRAY); + glColorPointer(3, GL_UNSIGNED_BYTE, lpD3DDrawPrimStrideData->normal.dwStride, + ((char *) lpD3DDrawPrimStrideData->diffuse.lpvData)); + } + /* Then the various textures */ + for (tex_stage = 0; tex_stage < num_active_stages; tex_stage++) { + int tex_index = This->state_block.texture_stage_state[tex_stage][D3DTSS_TEXCOORDINDEX - 1] & 0x0000FFFF; + if (tex_index >= num_tex_index) { + WARN("Default texture coordinate not handled in the vertex array path !!!\n"); + tex_index = num_tex_index - 1; } - if ((d3dvtVertexType & (D3DFVF_DIFFUSE|D3DFVF_SPECULAR)) == (D3DFVF_DIFFUSE|D3DFVF_SPECULAR)) { - DWORD *color_d = - (DWORD *) (((char *) lpD3DDrawPrimStrideData->diffuse.lpvData) + i * lpD3DDrawPrimStrideData->diffuse.dwStride); - DWORD *color_s = - (DWORD *) (((char *) lpD3DDrawPrimStrideData->specular.lpvData) + i * lpD3DDrawPrimStrideData->specular.dwStride); - handle_diffuse_and_specular(&(This->state_block), glThis->fog_table, color_d, color_s, vertex_lighted); - } else { - if (d3dvtVertexType & D3DFVF_SPECULAR) { - DWORD *color_s = - (DWORD *) (((char *) lpD3DDrawPrimStrideData->specular.lpvData) + i * lpD3DDrawPrimStrideData->specular.dwStride); - handle_specular(&(This->state_block), color_s, vertex_lighted); - } else if (d3dvtVertexType & D3DFVF_DIFFUSE) { - DWORD *color_d = - (DWORD *) (((char *) lpD3DDrawPrimStrideData->diffuse.lpvData) + i * lpD3DDrawPrimStrideData->diffuse.dwStride); - handle_diffuse(&(This->state_block), color_d, vertex_lighted); - } + if (GL_extensions.glClientActiveTexture) { + GL_extensions.glClientActiveTexture(GL_TEXTURE0_WINE + tex_stage); } - - for (tex_stage = 0; tex_stage < num_active_stages; tex_stage++) { - int tex_index = This->state_block.texture_stage_state[tex_stage][D3DTSS_TEXCOORDINDEX - 1] & 0x0000FFFF; - if (tex_index >= num_tex_index) { - handle_textures((D3DVALUE *) no_index, tex_stage); - } else { - D3DVALUE *tex_coord = - (D3DVALUE *) (((char *) lpD3DDrawPrimStrideData->textureCoords[tex_index].lpvData) + - i * lpD3DDrawPrimStrideData->textureCoords[tex_index].dwStride); - handle_textures(tex_coord, tex_stage); - } - } - - if ((d3dvtVertexType & D3DFVF_POSITION_MASK) == D3DFVF_XYZ) { - D3DVALUE *position = - (D3DVALUE *) (((char *) lpD3DDrawPrimStrideData->position.lpvData) + i * lpD3DDrawPrimStrideData->position.dwStride); - handle_xyz(position); - } else if ((d3dvtVertexType & D3DFVF_POSITION_MASK) == D3DFVF_XYZRHW) { - D3DVALUE *position = - (D3DVALUE *) (((char *) lpD3DDrawPrimStrideData->position.lpvData) + i * lpD3DDrawPrimStrideData->position.dwStride); - handle_xyzrhw(position); - } - - if (TRACE_ON(ddraw_geom)) { - int tex_index; - - if ((d3dvtVertexType & D3DFVF_POSITION_MASK) == D3DFVF_XYZ) { - D3DVALUE *position = - (D3DVALUE *) (((char *) lpD3DDrawPrimStrideData->position.lpvData) + i * lpD3DDrawPrimStrideData->position.dwStride); - TRACE_(ddraw_geom)(" %f %f %f", position[0], position[1], position[2]); - } else if ((d3dvtVertexType & D3DFVF_POSITION_MASK) == D3DFVF_XYZRHW) { - D3DVALUE *position = - (D3DVALUE *) (((char *) lpD3DDrawPrimStrideData->position.lpvData) + i * lpD3DDrawPrimStrideData->position.dwStride); - TRACE_(ddraw_geom)(" %f %f %f %f", position[0], position[1], position[2], position[3]); - } - if (d3dvtVertexType & D3DFVF_NORMAL) { - D3DVALUE *normal = - (D3DVALUE *) (((char *) lpD3DDrawPrimStrideData->normal.lpvData) + i * lpD3DDrawPrimStrideData->normal.dwStride); - TRACE_(ddraw_geom)(" / %f %f %f", normal[0], normal[1], normal[2]); - } - if (d3dvtVertexType & D3DFVF_DIFFUSE) { - DWORD *color_d = - (DWORD *) (((char *) lpD3DDrawPrimStrideData->diffuse.lpvData) + i * lpD3DDrawPrimStrideData->diffuse.dwStride); - TRACE_(ddraw_geom)(" / %02lx %02lx %02lx %02lx", - (*color_d >> 16) & 0xFF, - (*color_d >> 8) & 0xFF, - (*color_d >> 0) & 0xFF, - (*color_d >> 24) & 0xFF); - } - if (d3dvtVertexType & D3DFVF_SPECULAR) { - DWORD *color_s = - (DWORD *) (((char *) lpD3DDrawPrimStrideData->specular.lpvData) + i * lpD3DDrawPrimStrideData->specular.dwStride); - TRACE_(ddraw_geom)(" / %02lx %02lx %02lx %02lx", - (*color_s >> 16) & 0xFF, - (*color_s >> 8) & 0xFF, - (*color_s >> 0) & 0xFF, - (*color_s >> 24) & 0xFF); - } - for (tex_index = 0; tex_index < ((d3dvtVertexType & D3DFVF_TEXCOUNT_MASK) >> D3DFVF_TEXCOUNT_SHIFT); tex_index++) { - D3DVALUE *tex_coord = - (D3DVALUE *) (((char *) lpD3DDrawPrimStrideData->textureCoords[tex_index].lpvData) + - i * lpD3DDrawPrimStrideData->textureCoords[tex_index].dwStride); - TRACE_(ddraw_geom)(" / %f %f", tex_coord[0], tex_coord[1]); - } - TRACE_(ddraw_geom)("\n"); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + glTexCoordPointer(2, GL_FLOAT, lpD3DDrawPrimStrideData->textureCoords[tex_index].dwStride, + lpD3DDrawPrimStrideData->textureCoords[tex_index].lpvData); + } + if (dwIndices != NULL) { + glDrawElements(convert_D3D_ptype_to_GL(d3dptPrimitiveType), dwIndexCount, GL_UNSIGNED_SHORT, dwIndices); + } else { + glDrawArrays(convert_D3D_ptype_to_GL(d3dptPrimitiveType), 0, dwIndexCount); + } + glDisableClientState(GL_VERTEX_ARRAY); + if (d3dvtVertexType & D3DFVF_NORMAL) { + glDisableClientState(GL_NORMAL_ARRAY); + } + if (d3dvtVertexType & D3DFVF_DIFFUSE) { + glDisableClientState(GL_COLOR_ARRAY); + } + for (tex_stage = 0; tex_stage < num_active_stages; tex_stage++) { + if (GL_extensions.glClientActiveTexture) { + GL_extensions.glClientActiveTexture(GL_TEXTURE0_WINE + tex_stage); } + glDisableClientState(GL_TEXTURE_COORD_ARRAY); } } else { - ERR(" matrix weighting not handled yet....\n"); + glBegin(convert_D3D_ptype_to_GL(d3dptPrimitiveType)); + + /* Some fast paths first before the generic case.... */ + if ((d3dvtVertexType == D3DFVF_VERTEX) && (num_active_stages <= 1)) { + int index; + + for (index = 0; index < dwIndexCount; index++) { + int i = (dwIndices == NULL) ? index : dwIndices[index]; + D3DVALUE *normal = + (D3DVALUE *) (((char *) lpD3DDrawPrimStrideData->normal.lpvData) + i * lpD3DDrawPrimStrideData->normal.dwStride); + D3DVALUE *tex_coord = + (D3DVALUE *) (((char *) lpD3DDrawPrimStrideData->textureCoords[0].lpvData) + i * lpD3DDrawPrimStrideData->textureCoords[0].dwStride); + D3DVALUE *position = + (D3DVALUE *) (((char *) lpD3DDrawPrimStrideData->position.lpvData) + i * lpD3DDrawPrimStrideData->position.dwStride); + + handle_normal(normal); + handle_texture(tex_coord); + handle_xyz(position); + + TRACE_(ddraw_geom)(" %f %f %f / %f %f %f (%f %f)\n", + position[0], position[1], position[2], + normal[0], normal[1], normal[2], + tex_coord[0], tex_coord[1]); + } + } else if ((d3dvtVertexType == D3DFVF_TLVERTEX) && (num_active_stages <= 1)) { + int index; + + for (index = 0; index < dwIndexCount; index++) { + int i = (dwIndices == NULL) ? index : dwIndices[index]; + DWORD *color_d = + (DWORD *) (((char *) lpD3DDrawPrimStrideData->diffuse.lpvData) + i * lpD3DDrawPrimStrideData->diffuse.dwStride); + DWORD *color_s = + (DWORD *) (((char *) lpD3DDrawPrimStrideData->specular.lpvData) + i * lpD3DDrawPrimStrideData->specular.dwStride); + D3DVALUE *tex_coord = + (D3DVALUE *) (((char *) lpD3DDrawPrimStrideData->textureCoords[0].lpvData) + i * lpD3DDrawPrimStrideData->textureCoords[0].dwStride); + D3DVALUE *position = + (D3DVALUE *) (((char *) lpD3DDrawPrimStrideData->position.lpvData) + i * lpD3DDrawPrimStrideData->position.dwStride); + + handle_diffuse_and_specular(&(This->state_block), glThis->fog_table, color_d, color_s, TRUE); + handle_texture(tex_coord); + handle_xyzrhw(position); + + TRACE_(ddraw_geom)(" %f %f %f %f / %02lx %02lx %02lx %02lx - %02lx %02lx %02lx %02lx (%f %f)\n", + position[0], position[1], position[2], position[3], + (*color_d >> 16) & 0xFF, + (*color_d >> 8) & 0xFF, + (*color_d >> 0) & 0xFF, + (*color_d >> 24) & 0xFF, + (*color_s >> 16) & 0xFF, + (*color_s >> 8) & 0xFF, + (*color_s >> 0) & 0xFF, + (*color_s >> 24) & 0xFF, + tex_coord[0], tex_coord[1]); + } + } else if (((d3dvtVertexType & D3DFVF_POSITION_MASK) == D3DFVF_XYZ) || + ((d3dvtVertexType & D3DFVF_POSITION_MASK) == D3DFVF_XYZRHW)) { + /* This is the 'slow path' but that should support all possible vertex formats out there... + Note that people should write a fast path for all vertex formats out there... + */ + int index; + static const D3DVALUE no_index[] = { 0.0, 0.0, 0.0, 0.0 }; + + for (index = 0; index < dwIndexCount; index++) { + int i = (dwIndices == NULL) ? index : dwIndices[index]; + int tex_stage; + + if (d3dvtVertexType & D3DFVF_NORMAL) { + D3DVALUE *normal = + (D3DVALUE *) (((char *) lpD3DDrawPrimStrideData->normal.lpvData) + i * lpD3DDrawPrimStrideData->normal.dwStride); + handle_normal(normal); + } + if ((d3dvtVertexType & (D3DFVF_DIFFUSE|D3DFVF_SPECULAR)) == (D3DFVF_DIFFUSE|D3DFVF_SPECULAR)) { + DWORD *color_d = + (DWORD *) (((char *) lpD3DDrawPrimStrideData->diffuse.lpvData) + i * lpD3DDrawPrimStrideData->diffuse.dwStride); + DWORD *color_s = + (DWORD *) (((char *) lpD3DDrawPrimStrideData->specular.lpvData) + i * lpD3DDrawPrimStrideData->specular.dwStride); + handle_diffuse_and_specular(&(This->state_block), glThis->fog_table, color_d, color_s, vertex_lighted); + } else { + if (d3dvtVertexType & D3DFVF_SPECULAR) { + DWORD *color_s = + (DWORD *) (((char *) lpD3DDrawPrimStrideData->specular.lpvData) + i * lpD3DDrawPrimStrideData->specular.dwStride); + handle_specular(&(This->state_block), color_s, vertex_lighted); + } else if (d3dvtVertexType & D3DFVF_DIFFUSE) { + DWORD *color_d = + (DWORD *) (((char *) lpD3DDrawPrimStrideData->diffuse.lpvData) + i * lpD3DDrawPrimStrideData->diffuse.dwStride); + handle_diffuse(&(This->state_block), color_d, vertex_lighted); + } + } + + for (tex_stage = 0; tex_stage < num_active_stages; tex_stage++) { + int tex_index = This->state_block.texture_stage_state[tex_stage][D3DTSS_TEXCOORDINDEX - 1] & 0x0000FFFF; + if (tex_index >= num_tex_index) { + handle_textures((D3DVALUE *) no_index, tex_stage); + } else { + D3DVALUE *tex_coord = + (D3DVALUE *) (((char *) lpD3DDrawPrimStrideData->textureCoords[tex_index].lpvData) + + i * lpD3DDrawPrimStrideData->textureCoords[tex_index].dwStride); + handle_textures(tex_coord, tex_stage); + } + } + + if ((d3dvtVertexType & D3DFVF_POSITION_MASK) == D3DFVF_XYZ) { + D3DVALUE *position = + (D3DVALUE *) (((char *) lpD3DDrawPrimStrideData->position.lpvData) + i * lpD3DDrawPrimStrideData->position.dwStride); + handle_xyz(position); + } else if ((d3dvtVertexType & D3DFVF_POSITION_MASK) == D3DFVF_XYZRHW) { + D3DVALUE *position = + (D3DVALUE *) (((char *) lpD3DDrawPrimStrideData->position.lpvData) + i * lpD3DDrawPrimStrideData->position.dwStride); + handle_xyzrhw(position); + } + + if (TRACE_ON(ddraw_geom)) { + int tex_index; + + if ((d3dvtVertexType & D3DFVF_POSITION_MASK) == D3DFVF_XYZ) { + D3DVALUE *position = + (D3DVALUE *) (((char *) lpD3DDrawPrimStrideData->position.lpvData) + i * lpD3DDrawPrimStrideData->position.dwStride); + TRACE_(ddraw_geom)(" %f %f %f", position[0], position[1], position[2]); + } else if ((d3dvtVertexType & D3DFVF_POSITION_MASK) == D3DFVF_XYZRHW) { + D3DVALUE *position = + (D3DVALUE *) (((char *) lpD3DDrawPrimStrideData->position.lpvData) + i * lpD3DDrawPrimStrideData->position.dwStride); + TRACE_(ddraw_geom)(" %f %f %f %f", position[0], position[1], position[2], position[3]); + } + if (d3dvtVertexType & D3DFVF_NORMAL) { + D3DVALUE *normal = + (D3DVALUE *) (((char *) lpD3DDrawPrimStrideData->normal.lpvData) + i * lpD3DDrawPrimStrideData->normal.dwStride); + TRACE_(ddraw_geom)(" / %f %f %f", normal[0], normal[1], normal[2]); + } + if (d3dvtVertexType & D3DFVF_DIFFUSE) { + DWORD *color_d = + (DWORD *) (((char *) lpD3DDrawPrimStrideData->diffuse.lpvData) + i * lpD3DDrawPrimStrideData->diffuse.dwStride); + TRACE_(ddraw_geom)(" / %02lx %02lx %02lx %02lx", + (*color_d >> 16) & 0xFF, + (*color_d >> 8) & 0xFF, + (*color_d >> 0) & 0xFF, + (*color_d >> 24) & 0xFF); + } + if (d3dvtVertexType & D3DFVF_SPECULAR) { + DWORD *color_s = + (DWORD *) (((char *) lpD3DDrawPrimStrideData->specular.lpvData) + i * lpD3DDrawPrimStrideData->specular.dwStride); + TRACE_(ddraw_geom)(" / %02lx %02lx %02lx %02lx", + (*color_s >> 16) & 0xFF, + (*color_s >> 8) & 0xFF, + (*color_s >> 0) & 0xFF, + (*color_s >> 24) & 0xFF); + } + for (tex_index = 0; tex_index < ((d3dvtVertexType & D3DFVF_TEXCOUNT_MASK) >> D3DFVF_TEXCOUNT_SHIFT); tex_index++) { + D3DVALUE *tex_coord = + (D3DVALUE *) (((char *) lpD3DDrawPrimStrideData->textureCoords[tex_index].lpvData) + + i * lpD3DDrawPrimStrideData->textureCoords[tex_index].dwStride); + TRACE_(ddraw_geom)(" / %f %f", tex_coord[0], tex_coord[1]); + } + TRACE_(ddraw_geom)("\n"); + } + } + } else { + ERR(" matrix weighting not handled yet....\n"); + } + + glEnd(); } - - glEnd(); /* Whatever the case, disable the color material stuff */ glDisable(GL_COLOR_MATERIAL); @@ -4203,6 +4259,7 @@ d3ddevice_init_at_startup(void *gl_handle) /* We query the ARB version to be the most portable we can... */ GL_extensions.glActiveTexture = pglXGetProcAddressARB("glActiveTextureARB"); GL_extensions.glMultiTexCoord2fv = pglXGetProcAddressARB("glMultiTexCoord2fv"); + GL_extensions.glClientActiveTexture = pglXGetProcAddressARB("glClientActiveTextureARB"); } } diff --git a/dlls/ddraw/gl_api.h b/dlls/ddraw/gl_api.h index c2e80f545d9..04fe09d259d 100644 --- a/dlls/ddraw/gl_api.h +++ b/dlls/ddraw/gl_api.h @@ -40,6 +40,7 @@ GL_API_FUNCTION(glColor3ub) GL_API_FUNCTION(glColor4ub) GL_API_FUNCTION(glColorMask) GL_API_FUNCTION(glColorMaterial) +GL_API_FUNCTION(glColorPointer) GL_API_FUNCTION(glCopyPixels) GL_API_FUNCTION(glCopyTexSubImage2D) GL_API_FUNCTION(glCullFace) @@ -48,9 +49,13 @@ GL_API_FUNCTION(glDepthFunc) GL_API_FUNCTION(glDepthMask) GL_API_FUNCTION(glDepthRange) GL_API_FUNCTION(glDisable) +GL_API_FUNCTION(glDisableClientState) +GL_API_FUNCTION(glDrawArrays) GL_API_FUNCTION(glDrawBuffer) +GL_API_FUNCTION(glDrawElements) GL_API_FUNCTION(glDrawPixels) GL_API_FUNCTION(glEnable) +GL_API_FUNCTION(glEnableClientState) GL_API_FUNCTION(glEnd) GL_API_FUNCTION(glFlush) GL_API_FUNCTION(glFogf) @@ -77,6 +82,7 @@ GL_API_FUNCTION(glMatrixMode) GL_API_FUNCTION(glMultMatrixf) GL_API_FUNCTION(glNormal3f) GL_API_FUNCTION(glNormal3fv) +GL_API_FUNCTION(glNormalPointer) GL_API_FUNCTION(glOrtho) GL_API_FUNCTION(glPixelStorei) GL_API_FUNCTION(glPolygonMode) @@ -94,6 +100,7 @@ GL_API_FUNCTION(glStencilMask) GL_API_FUNCTION(glStencilOp) GL_API_FUNCTION(glTexCoord2f) GL_API_FUNCTION(glTexCoord2fv) +GL_API_FUNCTION(glTexCoordPointer) GL_API_FUNCTION(glTexEnvf) GL_API_FUNCTION(glTexEnvfv) GL_API_FUNCTION(glTexEnvi) @@ -106,6 +113,7 @@ GL_API_FUNCTION(glVertex3d) GL_API_FUNCTION(glVertex3f) GL_API_FUNCTION(glVertex3fv) GL_API_FUNCTION(glVertex4f) +GL_API_FUNCTION(glVertexPointer) GL_API_FUNCTION(glViewport) GL_API_FUNCTION(glXCreateContext) GL_API_FUNCTION(glXDestroyContext) diff --git a/dlls/ddraw/gl_private.h b/dlls/ddraw/gl_private.h index 978ba7e257d..7eb1a4c9cdf 100644 --- a/dlls/ddraw/gl_private.h +++ b/dlls/ddraw/gl_private.h @@ -82,6 +82,7 @@ #define glColor3ub pglColor3ub #define glColor4ub pglColor4ub #define glColorMask pglColorMask +#define glColorPointer pglColorPointer #define glCopyPixels pglCopyPixels #define glCopyTexSubImage2D pglCopyTexSubImage2D #define glColorMaterial pglColorMaterial @@ -91,9 +92,13 @@ #define glDepthMask pglDepthMask #define glDepthRange pglDepthRange #define glDisable pglDisable +#define glDisableClientState pglDisableClientState +#define glDrawArrays pglDrawArrays #define glDrawBuffer pglDrawBuffer +#define glDrawElements pglDrawElements #define glDrawPixels pglDrawPixels #define glEnable pglEnable +#define glEnableClientState pglEnableClientState #define glEnd pglEnd #define glFlush pglFlush #define glFogf pglFogf @@ -120,6 +125,7 @@ #define glMultMatrixf pglMultMatrixf #define glNormal3f pglNormal3f #define glNormal3fv pglNormal3fv +#define glNormalPointer pglNormalPointer #define glOrtho pglOrtho #define glPixelStorei pglPixelStorei #define glPolygonMode pglPolygonMode @@ -137,6 +143,7 @@ #define glStencilOp pglStencilOp #define glTexCoord2f pglTexCoord2f #define glTexCoord2fv pglTexCoord2fv +#define glTexCoordPointer pglTexCoordPointer #define glTexEnvf pglTexEnvf #define glTexEnvfv pglTexEnvfv #define glTexEnvi pglTexEnvi @@ -149,6 +156,7 @@ #define glVertex3f pglVertex3f #define glVertex3fv pglVertex3fv #define glVertex4f pglVertex4f +#define glVertexPointer pglVertexPointer #define glViewport pglViewport #define glXCreateContext pglXCreateContext #define glXDestroyContext pglXDestroyContext diff --git a/dlls/ddraw/mesa_private.h b/dlls/ddraw/mesa_private.h index d8eb4acc890..cfa36c48d98 100644 --- a/dlls/ddraw/mesa_private.h +++ b/dlls/ddraw/mesa_private.h @@ -174,6 +174,7 @@ typedef struct { GLint max_texture_units; void (*glActiveTexture)(GLenum texture); void (*glMultiTexCoord2fv)(GLenum target, const GLfloat *v); + void (*glClientActiveTexture)(GLenum texture); } GL_EXTENSIONS_LIST; extern GL_EXTENSIONS_LIST GL_extensions;