[PATCH] WineD3D: Get some vertex pipeline infrastructure in =
Stefan Doesinger
stefan at codeweavers.com
Wed Sep 17 10:55:22 CDT 2008
place=0A=
=0A=
---=0A=
dlls/wined3d/directx.c | 10 +++++++++-=0A=
dlls/wined3d/state.c | 11 ++++++++---=0A=
dlls/wined3d/vertexbuffer.c | 2 +-=0A=
dlls/wined3d/wined3d_private.h | 10 +++++++++-=0A=
4 files changed, 27 insertions(+), 6 deletions(-)=0A=
=0A=
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c=0A=
index effc9eb..bfc05b9 100644=0A=
--- a/dlls/wined3d/directx.c=0A=
+++ b/dlls/wined3d/directx.c=0A=
@@ -150,6 +150,7 @@ static struct WineD3DAdapter Adapters[1];=0A=
=0A=
static HRESULT WINAPI IWineD3DImpl_CheckDeviceFormat(IWineD3D *iface, =
UINT Adapter, WINED3DDEVTYPE DeviceType, WINED3DFORMAT AdapterFormat, =
DWORD Usage, WINED3DRESOURCETYPE RType, WINED3DFORMAT CheckFormat, =
WINED3DSURFTYPE SurfaceType);=0A=
static const struct fragment_pipeline =
*select_fragment_implementation(UINT Adapter, WINED3DDEVTYPE DeviceType);=0A=
+static const struct vertex_pipeline *select_vertex_implementation(UINT =
Adapter, WINED3DDEVTYPE DeviceType);=0A=
static const shader_backend_t *select_shader_backend(UINT Adapter, =
WINED3DDEVTYPE DeviceType);=0A=
static const struct blit_shader *select_blit_implementation(UINT =
Adapter, WINED3DDEVTYPE DeviceType);=0A=
=0A=
@@ -3011,6 +3012,10 @@ static const struct fragment_pipeline =
*select_fragment_implementation(UINT Adapt=0A=
}=0A=
}=0A=
=0A=
+static const struct vertex_pipeline *select_vertex_implementation(UINT =
Adapter, WINED3DDEVTYPE DeviceType) {=0A=
+ return &ffp_vertex_pipeline;=0A=
+}=0A=
+=0A=
static const struct blit_shader *select_blit_implementation(UINT =
Adapter, WINED3DDEVTYPE DeviceType) {=0A=
int vs_selected_mode;=0A=
int ps_selected_mode;=0A=
@@ -3608,6 +3613,7 @@ static HRESULT WINAPI =
IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter,=0A=
IWineD3DImpl *This =3D (IWineD3DImpl *)iface;=0A=
WINED3DDISPLAYMODE mode;=0A=
const struct fragment_pipeline *frag_pipeline =3D NULL;=0A=
+ const struct vertex_pipeline *vertex_pipeline =3D NULL;=0A=
int i;=0A=
struct fragment_caps ffp_caps;=0A=
=0A=
@@ -3665,11 +3671,13 @@ static HRESULT WINAPI =
IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter,=0A=
memset(&ffp_caps, 0, sizeof(ffp_caps));=0A=
frag_pipeline =3D select_fragment_implementation(Adapter, =
DeviceType);=0A=
object->frag_pipe =3D frag_pipeline;=0A=
+ vertex_pipeline =3D select_vertex_implementation(Adapter, =
DeviceType);=0A=
+ object->vertex_pipe =3D vertex_pipeline;=0A=
frag_pipeline->get_caps(DeviceType, &GLINFO_LOCATION, &ffp_caps);=0A=
object->max_ffp_textures =3D ffp_caps.MaxSimultaneousTextures;=0A=
object->max_ffp_texture_stages =3D ffp_caps.MaxTextureBlendStages;=0A=
compile_state_table(object->StateTable, object->multistate_funcs, =
&GLINFO_LOCATION,=0A=
- ffp_vertexstate_template, frag_pipeline, =
misc_state_template);=0A=
+ vertex_pipeline, frag_pipeline, =
misc_state_template);=0A=
=0A=
object->blitter =3D select_blit_implementation(Adapter, DeviceType);=0A=
=0A=
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c=0A=
index 573c23c..b50b1dd 100644=0A=
--- a/dlls/wined3d/state.c=0A=
+++ b/dlls/wined3d/state.c=0A=
@@ -4397,7 +4397,7 @@ static void streamsrc(DWORD state, =
IWineD3DStateBlockImpl *stateblock, WineD3DCo=0A=
device->useDrawStridedSlow =3D FALSE;=0A=
context->numberedArraysLoaded =3D TRUE;=0A=
}=0A=
- } else if (fixup ||=0A=
+ } else if (device->vertex_pipe->can_convert_d3dcolor || fixup ||=0A=
(dataLocations->u.s.pSize.lpData =3D=3D NULL &&=0A=
dataLocations->u.s.diffuse.lpData =3D=3D NULL &&=0A=
dataLocations->u.s.specular.lpData =3D=3D NULL)) {=0A=
@@ -5356,6 +5356,11 @@ const struct StateEntryTemplate =
ffp_vertexstate_template[] =3D {=0A=
{0 /* Terminate */, { 0, =
0 }, 0 =
},=0A=
};=0A=
=0A=
+const struct vertex_pipeline ffp_vertex_pipeline =3D {=0A=
+ ffp_vertexstate_template,=0A=
+ FALSE /* The implementation cannot convert d3dcolors natively */=0A=
+};=0A=
+=0A=
static const struct StateEntryTemplate ffp_fragmentstate_template[] =3D =
{=0A=
{ STATE_TEXTURESTAGE(0, WINED3DTSS_COLOROP), { =
STATE_TEXTURESTAGE(0, WINED3DTSS_COLOROP), tex_colorop =
}, 0 },=0A=
{ STATE_TEXTURESTAGE(0, WINED3DTSS_COLORARG1), { =
STATE_TEXTURESTAGE(0, WINED3DTSS_COLOROP), tex_colorop =
}, 0 },=0A=
@@ -5529,7 +5534,7 @@ static void multistate_apply_3(DWORD state, =
IWineD3DStateBlockImpl *stateblock,=0A=
void compile_state_table(struct StateEntry *StateTable,=0A=
APPLYSTATEFUNC **dev_multistate_funcs,=0A=
WineD3D_GL_Info *gl_info,=0A=
- const struct StateEntryTemplate *vertex,=0A=
+ const struct vertex_pipeline *vertex,=0A=
const struct fragment_pipeline *fragment,=0A=
const struct StateEntryTemplate *misc) {=0A=
unsigned int i, type, handlers;=0A=
@@ -5549,7 +5554,7 @@ void compile_state_table(struct StateEntry =
*StateTable,=0A=
switch(type) {=0A=
case 0: cur =3D misc; break;=0A=
case 1: cur =3D fragment->states; break;=0A=
- case 2: cur =3D vertex; break;=0A=
+ case 2: cur =3D vertex->states; break;=0A=
default: cur =3D NULL; /* Stupid compiler */=0A=
}=0A=
if(!cur) continue;=0A=
diff --git a/dlls/wined3d/vertexbuffer.c b/dlls/wined3d/vertexbuffer.c=0A=
index 5f687ff..09509e2 100644=0A=
--- a/dlls/wined3d/vertexbuffer.c=0A=
+++ b/dlls/wined3d/vertexbuffer.c=0A=
@@ -357,7 +357,7 @@ inline BOOL WINAPI =
IWineD3DVertexBufferImpl_FindDecl(IWineD3DVertexBufferImpl *T=0A=
HeapFree(GetProcessHeap(), 0, This->conv_shift);=0A=
This->conv_shift =3D find_conversion_shift(This, =
&device->strided_streams, This->stride);=0A=
}=0A=
- } else {=0A=
+ } else if(!device->vertex_pipe->can_convert_d3dcolor) {=0A=
/* Fixed function is a bit trickier. We have to take care for =
D3DCOLOR types, FLOAT4 positions and of course=0A=
* FLOAT16s if not supported. Also, we can't iterate over the =
array, so use macros to generate code for all=0A=
* the attributes that our current fixed function pipeline =
implementation cares for.=0A=
diff --git a/dlls/wined3d/wined3d_private.h =
b/dlls/wined3d/wined3d_private.h=0A=
index 1ca1edd..93257bc 100644=0A=
--- a/dlls/wined3d/wined3d_private.h=0A=
+++ b/dlls/wined3d/wined3d_private.h=0A=
@@ -645,6 +645,11 @@ struct fragment_pipeline {=0A=
BOOL ffp_proj_control;=0A=
};=0A=
=0A=
+struct vertex_pipeline {=0A=
+ const struct StateEntryTemplate *states;=0A=
+ BOOL can_convert_d3dcolor;=0A=
+};=0A=
+=0A=
extern const struct StateEntryTemplate misc_state_template[];=0A=
extern const struct StateEntryTemplate ffp_vertexstate_template[];=0A=
extern const struct fragment_pipeline ffp_fragment_pipeline;=0A=
@@ -653,11 +658,13 @@ extern const struct fragment_pipeline =
arbfp_fragment_pipeline;=0A=
extern const struct fragment_pipeline nvts_fragment_pipeline;=0A=
extern const struct fragment_pipeline nvrc_fragment_pipeline;=0A=
=0A=
+extern const struct vertex_pipeline ffp_vertex_pipeline;=0A=
+=0A=
/* "Base" state table */=0A=
void compile_state_table(struct StateEntry *StateTable,=0A=
APPLYSTATEFUNC **dev_multistate_funcs,=0A=
WineD3D_GL_Info *gl_info,=0A=
- const struct StateEntryTemplate *vertex,=0A=
+ const struct vertex_pipeline *vertex,=0A=
const struct fragment_pipeline *fragment,=0A=
const struct StateEntryTemplate *misc);=0A=
=0A=
@@ -934,6 +941,7 @@ struct IWineD3DDeviceImpl=0A=
/* Array of functions for states which are handled by more than one =
pipeline part */=0A=
APPLYSTATEFUNC *multistate_funcs[STATE_HIGHEST + 1];=0A=
const struct fragment_pipeline *frag_pipe;=0A=
+ const struct vertex_pipeline *vertex_pipe;=0A=
const struct blit_shader *blitter;=0A=
=0A=
unsigned int max_ffp_textures, max_ffp_texture_stages;=0A=
-- =0A=
1.5.6.4=0A=
=0A=
------=_NextPart_000_002B_01C94849.B6EB5BA0--
More information about the wine-patches
mailing list