wined3d: Store the immediate mode fixed function attribute submission function pointers in struct wined3d_d3d_info.

This commit is contained in:
Henri Verbeet 2013-08-19 10:50:51 +02:00 committed by Alexandre Julliard
parent c1a7323fac
commit b2721d5f9c
3 changed files with 142 additions and 148 deletions

View file

@ -255,20 +255,6 @@ const GLenum magLookup_noFilter[] =
GL_NEAREST, GL_NEAREST, GL_NEAREST,
};
/* drawStridedSlow attributes */
glAttribFunc position_funcs[WINED3D_FFP_EMIT_COUNT];
glAttribFunc diffuse_funcs[WINED3D_FFP_EMIT_COUNT];
glAttribFunc specular_func_3ubv;
glAttribFunc specular_funcs[WINED3D_FFP_EMIT_COUNT];
glAttribFunc normal_funcs[WINED3D_FFP_EMIT_COUNT];
glMultiTexCoordFunc multi_texcoord_funcs[WINED3D_FFP_EMIT_COUNT];
/**
* Note: GL seems to trap if GetDeviceCaps is called before any HWND's created,
* i.e., there is no GL Context - Get a default rendering context to enable the
* function query some info from GL.
*/
struct wined3d_fake_gl_ctx
{
HDC dc;
@ -4775,11 +4761,14 @@ static void WINE_GLAPI diffuse_d3dcolor(const void *data)
static void WINE_GLAPI specular_d3dcolor(const void *data)
{
DWORD specularColor = *((const DWORD *)data);
GLbyte d[] = {D3DCOLOR_B_R(specularColor),
D3DCOLOR_B_G(specularColor),
D3DCOLOR_B_B(specularColor)};
GLubyte d[] =
{
D3DCOLOR_B_R(specularColor),
D3DCOLOR_B_G(specularColor),
D3DCOLOR_B_B(specularColor)
};
specular_func_3ubv(d);
context_get_current()->gl_info->gl_ops.ext.p_glSecondaryColor3ubvEXT(d);
}
static void WINE_GLAPI warn_no_specular_func(const void *data)
@ -4787,134 +4776,131 @@ static void WINE_GLAPI warn_no_specular_func(const void *data)
WARN("GL_EXT_secondary_color not supported\n");
}
static void wined3d_adapter_init_ffp_attrib_ops(const struct wined3d_adapter *adapter)
static void wined3d_adapter_init_ffp_attrib_ops(struct wined3d_adapter *adapter)
{
const struct wined3d_d3d_info *d3d_info = &adapter->d3d_info;
const struct wined3d_gl_info *gl_info = &adapter->gl_info;
struct wined3d_d3d_info *d3d_info = &adapter->d3d_info;
struct wined3d_ffp_attrib_ops *ops = &d3d_info->ffp_attrib_ops;
position_funcs[WINED3D_FFP_EMIT_FLOAT1] = invalid_func;
position_funcs[WINED3D_FFP_EMIT_FLOAT2] = invalid_func;
position_funcs[WINED3D_FFP_EMIT_FLOAT3] = (glAttribFunc)gl_info->gl_ops.gl.p_glVertex3fv;
ops->position[WINED3D_FFP_EMIT_FLOAT1] = invalid_func;
ops->position[WINED3D_FFP_EMIT_FLOAT2] = invalid_func;
ops->position[WINED3D_FFP_EMIT_FLOAT3] = (wined3d_ffp_attrib_func)gl_info->gl_ops.gl.p_glVertex3fv;
if (!d3d_info->xyzrhw)
position_funcs[WINED3D_FFP_EMIT_FLOAT4] = position_float4;
ops->position[WINED3D_FFP_EMIT_FLOAT4] = position_float4;
else
position_funcs[WINED3D_FFP_EMIT_FLOAT4] = (glAttribFunc)gl_info->gl_ops.gl.p_glVertex4fv;
position_funcs[WINED3D_FFP_EMIT_D3DCOLOR] = position_d3dcolor;
position_funcs[WINED3D_FFP_EMIT_UBYTE4] = invalid_func;
position_funcs[WINED3D_FFP_EMIT_SHORT2] = invalid_func;
position_funcs[WINED3D_FFP_EMIT_SHORT4] = (glAttribFunc)gl_info->gl_ops.gl.p_glVertex2sv;
position_funcs[WINED3D_FFP_EMIT_UBYTE4N] = invalid_func;
position_funcs[WINED3D_FFP_EMIT_SHORT2N] = invalid_func;
position_funcs[WINED3D_FFP_EMIT_SHORT4N] = invalid_func;
position_funcs[WINED3D_FFP_EMIT_USHORT2N] = invalid_func;
position_funcs[WINED3D_FFP_EMIT_USHORT4N] = invalid_func;
position_funcs[WINED3D_FFP_EMIT_UDEC3] = invalid_func;
position_funcs[WINED3D_FFP_EMIT_DEC3N] = invalid_func;
position_funcs[WINED3D_FFP_EMIT_FLOAT16_2] = invalid_func;
position_funcs[WINED3D_FFP_EMIT_FLOAT16_4] = invalid_func;
position_funcs[WINED3D_FFP_EMIT_INVALID] = invalid_func;
ops->position[WINED3D_FFP_EMIT_FLOAT4] = (wined3d_ffp_attrib_func)gl_info->gl_ops.gl.p_glVertex4fv;
ops->position[WINED3D_FFP_EMIT_D3DCOLOR] = position_d3dcolor;
ops->position[WINED3D_FFP_EMIT_UBYTE4] = invalid_func;
ops->position[WINED3D_FFP_EMIT_SHORT2] = invalid_func;
ops->position[WINED3D_FFP_EMIT_SHORT4] = (wined3d_ffp_attrib_func)gl_info->gl_ops.gl.p_glVertex2sv;
ops->position[WINED3D_FFP_EMIT_UBYTE4N] = invalid_func;
ops->position[WINED3D_FFP_EMIT_SHORT2N] = invalid_func;
ops->position[WINED3D_FFP_EMIT_SHORT4N] = invalid_func;
ops->position[WINED3D_FFP_EMIT_USHORT2N] = invalid_func;
ops->position[WINED3D_FFP_EMIT_USHORT4N] = invalid_func;
ops->position[WINED3D_FFP_EMIT_UDEC3] = invalid_func;
ops->position[WINED3D_FFP_EMIT_DEC3N] = invalid_func;
ops->position[WINED3D_FFP_EMIT_FLOAT16_2] = invalid_func;
ops->position[WINED3D_FFP_EMIT_FLOAT16_4] = invalid_func;
ops->position[WINED3D_FFP_EMIT_INVALID] = invalid_func;
diffuse_funcs[WINED3D_FFP_EMIT_FLOAT1] = invalid_func;
diffuse_funcs[WINED3D_FFP_EMIT_FLOAT2] = invalid_func;
diffuse_funcs[WINED3D_FFP_EMIT_FLOAT3] = (glAttribFunc)gl_info->gl_ops.gl.p_glColor3fv;
diffuse_funcs[WINED3D_FFP_EMIT_FLOAT4] = (glAttribFunc)gl_info->gl_ops.gl.p_glColor4fv;
diffuse_funcs[WINED3D_FFP_EMIT_D3DCOLOR] = diffuse_d3dcolor;
diffuse_funcs[WINED3D_FFP_EMIT_UBYTE4] = invalid_func;
diffuse_funcs[WINED3D_FFP_EMIT_SHORT2] = invalid_func;
diffuse_funcs[WINED3D_FFP_EMIT_SHORT4] = invalid_func;
diffuse_funcs[WINED3D_FFP_EMIT_UBYTE4N] = (glAttribFunc)gl_info->gl_ops.gl.p_glColor4ubv;
diffuse_funcs[WINED3D_FFP_EMIT_SHORT2N] = invalid_func;
diffuse_funcs[WINED3D_FFP_EMIT_SHORT4N] = (glAttribFunc)gl_info->gl_ops.gl.p_glColor4sv;
diffuse_funcs[WINED3D_FFP_EMIT_USHORT2N] = invalid_func;
diffuse_funcs[WINED3D_FFP_EMIT_USHORT4N] = (glAttribFunc)gl_info->gl_ops.gl.p_glColor4usv;
diffuse_funcs[WINED3D_FFP_EMIT_UDEC3] = invalid_func;
diffuse_funcs[WINED3D_FFP_EMIT_DEC3N] = invalid_func;
diffuse_funcs[WINED3D_FFP_EMIT_FLOAT16_2] = invalid_func;
diffuse_funcs[WINED3D_FFP_EMIT_FLOAT16_4] = invalid_func;
diffuse_funcs[WINED3D_FFP_EMIT_INVALID] = invalid_func;
ops->diffuse[WINED3D_FFP_EMIT_FLOAT1] = invalid_func;
ops->diffuse[WINED3D_FFP_EMIT_FLOAT2] = invalid_func;
ops->diffuse[WINED3D_FFP_EMIT_FLOAT3] = (wined3d_ffp_attrib_func)gl_info->gl_ops.gl.p_glColor3fv;
ops->diffuse[WINED3D_FFP_EMIT_FLOAT4] = (wined3d_ffp_attrib_func)gl_info->gl_ops.gl.p_glColor4fv;
ops->diffuse[WINED3D_FFP_EMIT_D3DCOLOR] = diffuse_d3dcolor;
ops->diffuse[WINED3D_FFP_EMIT_UBYTE4] = invalid_func;
ops->diffuse[WINED3D_FFP_EMIT_SHORT2] = invalid_func;
ops->diffuse[WINED3D_FFP_EMIT_SHORT4] = invalid_func;
ops->diffuse[WINED3D_FFP_EMIT_UBYTE4N] = (wined3d_ffp_attrib_func)gl_info->gl_ops.gl.p_glColor4ubv;
ops->diffuse[WINED3D_FFP_EMIT_SHORT2N] = invalid_func;
ops->diffuse[WINED3D_FFP_EMIT_SHORT4N] = (wined3d_ffp_attrib_func)gl_info->gl_ops.gl.p_glColor4sv;
ops->diffuse[WINED3D_FFP_EMIT_USHORT2N] = invalid_func;
ops->diffuse[WINED3D_FFP_EMIT_USHORT4N] = (wined3d_ffp_attrib_func)gl_info->gl_ops.gl.p_glColor4usv;
ops->diffuse[WINED3D_FFP_EMIT_UDEC3] = invalid_func;
ops->diffuse[WINED3D_FFP_EMIT_DEC3N] = invalid_func;
ops->diffuse[WINED3D_FFP_EMIT_FLOAT16_2] = invalid_func;
ops->diffuse[WINED3D_FFP_EMIT_FLOAT16_4] = invalid_func;
ops->diffuse[WINED3D_FFP_EMIT_INVALID] = invalid_func;
/* No 4 component entry points here */
specular_funcs[WINED3D_FFP_EMIT_FLOAT1] = invalid_func;
specular_funcs[WINED3D_FFP_EMIT_FLOAT2] = invalid_func;
/* No 4 component entry points here. */
ops->specular[WINED3D_FFP_EMIT_FLOAT1] = invalid_func;
ops->specular[WINED3D_FFP_EMIT_FLOAT2] = invalid_func;
if (gl_info->supported[EXT_SECONDARY_COLOR])
{
specular_funcs[WINED3D_FFP_EMIT_FLOAT3] = (glAttribFunc)GL_EXTCALL(glSecondaryColor3fvEXT);
}
ops->specular[WINED3D_FFP_EMIT_FLOAT3] = (wined3d_ffp_attrib_func)GL_EXTCALL(glSecondaryColor3fvEXT);
else
{
specular_funcs[WINED3D_FFP_EMIT_FLOAT3] = warn_no_specular_func;
}
specular_funcs[WINED3D_FFP_EMIT_FLOAT4] = invalid_func;
ops->specular[WINED3D_FFP_EMIT_FLOAT3] = warn_no_specular_func;
ops->specular[WINED3D_FFP_EMIT_FLOAT4] = invalid_func;
if (gl_info->supported[EXT_SECONDARY_COLOR])
{
specular_func_3ubv = (glAttribFunc)GL_EXTCALL(glSecondaryColor3ubvEXT);
specular_funcs[WINED3D_FFP_EMIT_D3DCOLOR] = specular_d3dcolor;
}
ops->specular[WINED3D_FFP_EMIT_D3DCOLOR] = specular_d3dcolor;
else
{
specular_funcs[WINED3D_FFP_EMIT_D3DCOLOR] = warn_no_specular_func;
}
specular_funcs[WINED3D_FFP_EMIT_UBYTE4] = invalid_func;
specular_funcs[WINED3D_FFP_EMIT_SHORT2] = invalid_func;
specular_funcs[WINED3D_FFP_EMIT_SHORT4] = invalid_func;
specular_funcs[WINED3D_FFP_EMIT_UBYTE4N] = invalid_func;
specular_funcs[WINED3D_FFP_EMIT_SHORT2N] = invalid_func;
specular_funcs[WINED3D_FFP_EMIT_SHORT4N] = invalid_func;
specular_funcs[WINED3D_FFP_EMIT_USHORT2N] = invalid_func;
specular_funcs[WINED3D_FFP_EMIT_USHORT4N] = invalid_func;
specular_funcs[WINED3D_FFP_EMIT_UDEC3] = invalid_func;
specular_funcs[WINED3D_FFP_EMIT_DEC3N] = invalid_func;
specular_funcs[WINED3D_FFP_EMIT_FLOAT16_2] = invalid_func;
specular_funcs[WINED3D_FFP_EMIT_FLOAT16_4] = invalid_func;
specular_funcs[WINED3D_FFP_EMIT_INVALID] = invalid_func;
ops->specular[WINED3D_FFP_EMIT_D3DCOLOR] = warn_no_specular_func;
ops->specular[WINED3D_FFP_EMIT_UBYTE4] = invalid_func;
ops->specular[WINED3D_FFP_EMIT_SHORT2] = invalid_func;
ops->specular[WINED3D_FFP_EMIT_SHORT4] = invalid_func;
ops->specular[WINED3D_FFP_EMIT_UBYTE4N] = invalid_func;
ops->specular[WINED3D_FFP_EMIT_SHORT2N] = invalid_func;
ops->specular[WINED3D_FFP_EMIT_SHORT4N] = invalid_func;
ops->specular[WINED3D_FFP_EMIT_USHORT2N] = invalid_func;
ops->specular[WINED3D_FFP_EMIT_USHORT4N] = invalid_func;
ops->specular[WINED3D_FFP_EMIT_UDEC3] = invalid_func;
ops->specular[WINED3D_FFP_EMIT_DEC3N] = invalid_func;
ops->specular[WINED3D_FFP_EMIT_FLOAT16_2] = invalid_func;
ops->specular[WINED3D_FFP_EMIT_FLOAT16_4] = invalid_func;
ops->specular[WINED3D_FFP_EMIT_INVALID] = invalid_func;
/* Only 3 component entry points here. Test how others behave. Float4 normals are used
* by one of our tests, trying to pass it to the pixel shader, which fails on Windows.
*/
normal_funcs[WINED3D_FFP_EMIT_FLOAT1] = invalid_func;
normal_funcs[WINED3D_FFP_EMIT_FLOAT2] = invalid_func;
normal_funcs[WINED3D_FFP_EMIT_FLOAT3] = (glAttribFunc)gl_info->gl_ops.gl.p_glNormal3fv;
normal_funcs[WINED3D_FFP_EMIT_FLOAT4] = (glAttribFunc)gl_info->gl_ops.gl.p_glNormal3fv; /* Just ignore the 4th value */
normal_funcs[WINED3D_FFP_EMIT_D3DCOLOR] = invalid_func;
normal_funcs[WINED3D_FFP_EMIT_UBYTE4] = invalid_func;
normal_funcs[WINED3D_FFP_EMIT_SHORT2] = invalid_func;
normal_funcs[WINED3D_FFP_EMIT_SHORT4] = invalid_func;
normal_funcs[WINED3D_FFP_EMIT_UBYTE4N] = invalid_func;
normal_funcs[WINED3D_FFP_EMIT_SHORT2N] = invalid_func;
normal_funcs[WINED3D_FFP_EMIT_SHORT4N] = invalid_func;
normal_funcs[WINED3D_FFP_EMIT_USHORT2N] = invalid_func;
normal_funcs[WINED3D_FFP_EMIT_USHORT4N] = invalid_func;
normal_funcs[WINED3D_FFP_EMIT_UDEC3] = invalid_func;
normal_funcs[WINED3D_FFP_EMIT_DEC3N] = invalid_func;
normal_funcs[WINED3D_FFP_EMIT_FLOAT16_2] = invalid_func;
normal_funcs[WINED3D_FFP_EMIT_FLOAT16_4] = invalid_func;
normal_funcs[WINED3D_FFP_EMIT_INVALID] = invalid_func;
/* Only 3 component entry points here. Test how others behave. Float4
* normals are used by one of our tests, trying to pass it to the pixel
* shader, which fails on Windows. */
ops->normal[WINED3D_FFP_EMIT_FLOAT1] = invalid_func;
ops->normal[WINED3D_FFP_EMIT_FLOAT2] = invalid_func;
ops->normal[WINED3D_FFP_EMIT_FLOAT3] = (wined3d_ffp_attrib_func)gl_info->gl_ops.gl.p_glNormal3fv;
/* Just ignore the 4th value. */
ops->normal[WINED3D_FFP_EMIT_FLOAT4] = (wined3d_ffp_attrib_func)gl_info->gl_ops.gl.p_glNormal3fv;
ops->normal[WINED3D_FFP_EMIT_D3DCOLOR] = invalid_func;
ops->normal[WINED3D_FFP_EMIT_UBYTE4] = invalid_func;
ops->normal[WINED3D_FFP_EMIT_SHORT2] = invalid_func;
ops->normal[WINED3D_FFP_EMIT_SHORT4] = invalid_func;
ops->normal[WINED3D_FFP_EMIT_UBYTE4N] = invalid_func;
ops->normal[WINED3D_FFP_EMIT_SHORT2N] = invalid_func;
ops->normal[WINED3D_FFP_EMIT_SHORT4N] = invalid_func;
ops->normal[WINED3D_FFP_EMIT_USHORT2N] = invalid_func;
ops->normal[WINED3D_FFP_EMIT_USHORT4N] = invalid_func;
ops->normal[WINED3D_FFP_EMIT_UDEC3] = invalid_func;
ops->normal[WINED3D_FFP_EMIT_DEC3N] = invalid_func;
ops->normal[WINED3D_FFP_EMIT_FLOAT16_2] = invalid_func;
ops->normal[WINED3D_FFP_EMIT_FLOAT16_4] = invalid_func;
ops->normal[WINED3D_FFP_EMIT_INVALID] = invalid_func;
multi_texcoord_funcs[WINED3D_FFP_EMIT_FLOAT1] = (glMultiTexCoordFunc)GL_EXTCALL(glMultiTexCoord1fvARB);
multi_texcoord_funcs[WINED3D_FFP_EMIT_FLOAT2] = (glMultiTexCoordFunc)GL_EXTCALL(glMultiTexCoord2fvARB);
multi_texcoord_funcs[WINED3D_FFP_EMIT_FLOAT3] = (glMultiTexCoordFunc)GL_EXTCALL(glMultiTexCoord3fvARB);
multi_texcoord_funcs[WINED3D_FFP_EMIT_FLOAT4] = (glMultiTexCoordFunc)GL_EXTCALL(glMultiTexCoord4fvARB);
multi_texcoord_funcs[WINED3D_FFP_EMIT_D3DCOLOR] = invalid_texcoord_func;
multi_texcoord_funcs[WINED3D_FFP_EMIT_UBYTE4] = invalid_texcoord_func;
multi_texcoord_funcs[WINED3D_FFP_EMIT_SHORT2] = (glMultiTexCoordFunc)GL_EXTCALL(glMultiTexCoord2svARB);
multi_texcoord_funcs[WINED3D_FFP_EMIT_SHORT4] = (glMultiTexCoordFunc)GL_EXTCALL(glMultiTexCoord4svARB);
multi_texcoord_funcs[WINED3D_FFP_EMIT_UBYTE4N] = invalid_texcoord_func;
multi_texcoord_funcs[WINED3D_FFP_EMIT_SHORT2N] = invalid_texcoord_func;
multi_texcoord_funcs[WINED3D_FFP_EMIT_SHORT4N] = invalid_texcoord_func;
multi_texcoord_funcs[WINED3D_FFP_EMIT_USHORT2N] = invalid_texcoord_func;
multi_texcoord_funcs[WINED3D_FFP_EMIT_USHORT4N] = invalid_texcoord_func;
multi_texcoord_funcs[WINED3D_FFP_EMIT_UDEC3] = invalid_texcoord_func;
multi_texcoord_funcs[WINED3D_FFP_EMIT_DEC3N] = invalid_texcoord_func;
ops->texcoord[WINED3D_FFP_EMIT_FLOAT1] = (wined3d_ffp_texcoord_func)gl_info->gl_ops.ext.p_glMultiTexCoord1fvARB;
ops->texcoord[WINED3D_FFP_EMIT_FLOAT2] = (wined3d_ffp_texcoord_func)gl_info->gl_ops.ext.p_glMultiTexCoord2fvARB;
ops->texcoord[WINED3D_FFP_EMIT_FLOAT3] = (wined3d_ffp_texcoord_func)gl_info->gl_ops.ext.p_glMultiTexCoord3fvARB;
ops->texcoord[WINED3D_FFP_EMIT_FLOAT4] = (wined3d_ffp_texcoord_func)gl_info->gl_ops.ext.p_glMultiTexCoord4fvARB;
ops->texcoord[WINED3D_FFP_EMIT_D3DCOLOR] = invalid_texcoord_func;
ops->texcoord[WINED3D_FFP_EMIT_UBYTE4] = invalid_texcoord_func;
ops->texcoord[WINED3D_FFP_EMIT_SHORT2] = (wined3d_ffp_texcoord_func)gl_info->gl_ops.ext.p_glMultiTexCoord2svARB;
ops->texcoord[WINED3D_FFP_EMIT_SHORT4] = (wined3d_ffp_texcoord_func)gl_info->gl_ops.ext.p_glMultiTexCoord4svARB;
ops->texcoord[WINED3D_FFP_EMIT_UBYTE4N] = invalid_texcoord_func;
ops->texcoord[WINED3D_FFP_EMIT_SHORT2N] = invalid_texcoord_func;
ops->texcoord[WINED3D_FFP_EMIT_SHORT4N] = invalid_texcoord_func;
ops->texcoord[WINED3D_FFP_EMIT_USHORT2N] = invalid_texcoord_func;
ops->texcoord[WINED3D_FFP_EMIT_USHORT4N] = invalid_texcoord_func;
ops->texcoord[WINED3D_FFP_EMIT_UDEC3] = invalid_texcoord_func;
ops->texcoord[WINED3D_FFP_EMIT_DEC3N] = invalid_texcoord_func;
if (gl_info->supported[NV_HALF_FLOAT])
{
/* Not supported by ARB_HALF_FLOAT_VERTEX, so check for NV_HALF_FLOAT */
multi_texcoord_funcs[WINED3D_FFP_EMIT_FLOAT16_2] = (glMultiTexCoordFunc)GL_EXTCALL(glMultiTexCoord2hvNV);
multi_texcoord_funcs[WINED3D_FFP_EMIT_FLOAT16_4] = (glMultiTexCoordFunc)GL_EXTCALL(glMultiTexCoord4hvNV);
} else {
multi_texcoord_funcs[WINED3D_FFP_EMIT_FLOAT16_2] = invalid_texcoord_func;
multi_texcoord_funcs[WINED3D_FFP_EMIT_FLOAT16_4] = invalid_texcoord_func;
/* Not supported by ARB_HALF_FLOAT_VERTEX, so check for NV_HALF_FLOAT. */
ops->texcoord[WINED3D_FFP_EMIT_FLOAT16_2] =
(wined3d_ffp_texcoord_func)gl_info->gl_ops.ext.p_glMultiTexCoord2hvNV;
ops->texcoord[WINED3D_FFP_EMIT_FLOAT16_4] =
(wined3d_ffp_texcoord_func)gl_info->gl_ops.ext.p_glMultiTexCoord4hvNV;
}
multi_texcoord_funcs[WINED3D_FFP_EMIT_INVALID] = invalid_texcoord_func;
else
{
ops->texcoord[WINED3D_FFP_EMIT_FLOAT16_2] = invalid_texcoord_func;
ops->texcoord[WINED3D_FFP_EMIT_FLOAT16_4] = invalid_texcoord_func;
}
ops->texcoord[WINED3D_FFP_EMIT_INVALID] = invalid_texcoord_func;
}
static void wined3d_adapter_init_fb_cfgs(struct wined3d_adapter *adapter, HDC dc)

View file

@ -99,6 +99,7 @@ static void drawStridedSlow(const struct wined3d_device *device, const struct wi
const BYTE *diffuse = NULL, *specular = NULL, *normal = NULL, *position = NULL;
const struct wined3d_gl_info *gl_info = context->gl_info;
const struct wined3d_d3d_info *d3d_info = context->d3d_info;
const struct wined3d_ffp_attrib_ops *ops = &d3d_info->ffp_attrib_ops;
UINT texture_stages = d3d_info->limits.ffp_blend_stages;
const struct wined3d_stream_info_element *element;
UINT num_untracked_materials;
@ -266,15 +267,16 @@ static void drawStridedSlow(const struct wined3d_device *device, const struct wi
ptr = texCoords[coord_idx] + (SkipnStrides * si->elements[WINED3D_FFP_TEXCOORD0 + coord_idx].stride);
texture_idx = device->texUnitMap[texture];
multi_texcoord_funcs[si->elements[WINED3D_FFP_TEXCOORD0 + coord_idx].format->emit_idx](
ops->texcoord[si->elements[WINED3D_FFP_TEXCOORD0 + coord_idx].format->emit_idx](
GL_TEXTURE0_ARB + texture_idx, ptr);
}
/* Diffuse -------------------------------- */
if (diffuse) {
if (diffuse)
{
const void *ptrToCoords = diffuse + SkipnStrides * si->elements[WINED3D_FFP_DIFFUSE].stride;
ops->diffuse[si->elements[WINED3D_FFP_DIFFUSE].format->emit_idx](ptrToCoords);
diffuse_funcs[si->elements[WINED3D_FFP_DIFFUSE].format->emit_idx](ptrToCoords);
if (num_untracked_materials)
{
DWORD diffuseColor = ((const DWORD *)ptrToCoords)[0];
@ -294,10 +296,10 @@ static void drawStridedSlow(const struct wined3d_device *device, const struct wi
}
/* Specular ------------------------------- */
if (specular) {
if (specular)
{
const void *ptrToCoords = specular + SkipnStrides * si->elements[WINED3D_FFP_SPECULAR].stride;
specular_funcs[si->elements[WINED3D_FFP_SPECULAR].format->emit_idx](ptrToCoords);
ops->specular[si->elements[WINED3D_FFP_SPECULAR].format->emit_idx](ptrToCoords);
if (specular_fog)
{
@ -310,13 +312,14 @@ static void drawStridedSlow(const struct wined3d_device *device, const struct wi
if (normal)
{
const void *ptrToCoords = normal + SkipnStrides * si->elements[WINED3D_FFP_NORMAL].stride;
normal_funcs[si->elements[WINED3D_FFP_NORMAL].format->emit_idx](ptrToCoords);
ops->normal[si->elements[WINED3D_FFP_NORMAL].format->emit_idx](ptrToCoords);
}
/* Position -------------------------------- */
if (position) {
if (position)
{
const void *ptrToCoords = position + SkipnStrides * si->elements[WINED3D_FFP_POSITION].stride;
position_funcs[si->elements[WINED3D_FFP_POSITION].format->emit_idx](ptrToCoords);
ops->position[si->elements[WINED3D_FFP_POSITION].format->emit_idx](ptrToCoords);
}
/* For non indexed mode, step onto next parts */

View file

@ -944,15 +944,6 @@ void draw_primitive(struct wined3d_device *device, UINT start_idx, UINT index_co
UINT start_instance, UINT instance_count, BOOL indexed) DECLSPEC_HIDDEN;
DWORD get_flexible_vertex_size(DWORD d3dvtVertexType) DECLSPEC_HIDDEN;
typedef void (WINE_GLAPI *glAttribFunc)(const void *data);
typedef void (WINE_GLAPI *glMultiTexCoordFunc)(GLenum unit, const void *data);
extern glAttribFunc position_funcs[WINED3D_FFP_EMIT_COUNT] DECLSPEC_HIDDEN;
extern glAttribFunc diffuse_funcs[WINED3D_FFP_EMIT_COUNT] DECLSPEC_HIDDEN;
extern glAttribFunc specular_func_3ubv DECLSPEC_HIDDEN;
extern glAttribFunc specular_funcs[WINED3D_FFP_EMIT_COUNT] DECLSPEC_HIDDEN;
extern glAttribFunc normal_funcs[WINED3D_FFP_EMIT_COUNT] DECLSPEC_HIDDEN;
extern glMultiTexCoordFunc multi_texcoord_funcs[WINED3D_FFP_EMIT_COUNT] DECLSPEC_HIDDEN;
#define eps 1e-8
#define GET_TEXCOORD_SIZE_FROM_FVF(d3dvtVertexType, tex_num) \
@ -1612,9 +1603,23 @@ struct wined3d_d3d_limits
UINT ffp_blend_stages;
};
typedef void (WINE_GLAPI *wined3d_ffp_attrib_func)(const void *data);
typedef void (WINE_GLAPI *wined3d_ffp_texcoord_func)(GLenum unit, const void *data);
extern wined3d_ffp_attrib_func specular_func_3ubv DECLSPEC_HIDDEN;
struct wined3d_ffp_attrib_ops
{
wined3d_ffp_attrib_func position[WINED3D_FFP_EMIT_COUNT];
wined3d_ffp_attrib_func diffuse[WINED3D_FFP_EMIT_COUNT];
wined3d_ffp_attrib_func specular[WINED3D_FFP_EMIT_COUNT];
wined3d_ffp_attrib_func normal[WINED3D_FFP_EMIT_COUNT];
wined3d_ffp_texcoord_func texcoord[WINED3D_FFP_EMIT_COUNT];
};
struct wined3d_d3d_info
{
struct wined3d_d3d_limits limits;
struct wined3d_ffp_attrib_ops ffp_attrib_ops;
BOOL xyzrhw;
BOOL vs_clipping;
DWORD valid_rt_mask;