[PATCH] WineD3D: Create fragment processing state templates and =

Stefan Doesinger stefan at codeweavers.com
Fri Jul 4 15:01:26 CDT 2008


select one=0A=
=0A=
For now the atifs selection sticks to the old rules, thus it is bound to=0A=
the available and selected shader capabilities. We may want to change =
that=0A=
in the future=0A=
---=0A=
 dlls/wined3d/ati_fragment_shader.c |    4 ++++=0A=
 dlls/wined3d/directx.c             |   19 ++++++++++++++++++-=0A=
 dlls/wined3d/state.c               |    4 ++++=0A=
 dlls/wined3d/wined3d_private.h     |    2 ++=0A=
 4 files changed, 28 insertions(+), 1 deletions(-)=0A=
=0A=
diff --git a/dlls/wined3d/ati_fragment_shader.c =
b/dlls/wined3d/ati_fragment_shader.c=0A=
index 8377917..adc88d6 100644=0A=
--- a/dlls/wined3d/ati_fragment_shader.c=0A=
+++ b/dlls/wined3d/ati_fragment_shader.c=0A=
@@ -893,6 +893,10 @@ static void init_state_table() {=0A=
     =
ATIFSStateTable[STATE_RENDER(WINED3DRS_TEXTUREFACTOR)].representative =
=3D STATE_RENDER(WINED3DRS_TEXTUREFACTOR);=0A=
 }=0A=
 =0A=
+const struct StateEntryTemplate atifs_fragmentstate_template[] =3D {=0A=
+    {0 /* Terminate */,                                   { 0,          =
                                        0                   }},=0A=
+};=0A=
+=0A=
 /* GL_ATI_fragment_shader backend.It borrows a lot from a the=0A=
  * ARB shader backend, currently the whole vertex processing=0A=
  * code. This code would also forward pixel shaders, but if=0A=
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c=0A=
index c1f68f8..b421519 100644=0A=
--- a/dlls/wined3d/directx.c=0A=
+++ b/dlls/wined3d/directx.c=0A=
@@ -2890,6 +2890,20 @@ static const shader_backend_t =
*select_shader_backend(UINT Adapter, WINED3DDEVTYP=0A=
     return ret;=0A=
 }=0A=
 =0A=
+static const struct StateEntryTemplate =
*select_fragment_implementation(UINT Adapter, WINED3DDEVTYPE DeviceType) =
{=0A=
+    int vs_selected_mode;=0A=
+    int ps_selected_mode;=0A=
+=0A=
+    select_shader_mode(&GLINFO_LOCATION, DeviceType, &ps_selected_mode, =
&vs_selected_mode);=0A=
+    if (ps_selected_mode =3D=3D SHADER_GLSL || ps_selected_mode =3D=3D =
SHADER_ARB) {=0A=
+        return ffp_fragmentstate_template;=0A=
+    } else if (ps_selected_mode !=3D SHADER_NONE && =
!GL_SUPPORT(ARB_FRAGMENT_PROGRAM)) {=0A=
+        return atifs_fragmentstate_template;=0A=
+    } else {=0A=
+        return ffp_fragmentstate_template;=0A=
+    }=0A=
+}=0A=
+=0A=
 /* Note: d3d8 passes in a pointer to a D3DCAPS8 structure, which is a =
true=0A=
       subset of a D3DCAPS9 structure. However, it has to come via a =
void *=0A=
       as the d3d8 interface cannot import the d3d9 header               =
   */=0A=
@@ -3393,6 +3407,7 @@ static HRESULT  WINAPI =
IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter,=0A=
     IWineD3DDeviceImpl *object  =3D NULL;=0A=
     IWineD3DImpl       *This    =3D (IWineD3DImpl *)iface;=0A=
     WINED3DDISPLAYMODE  mode;=0A=
+    const struct StateEntryTemplate *frag_pipeline =3D NULL;=0A=
     int i;=0A=
 =0A=
     /* Validate the adapter number. If no adapters are available(no =
GL), ignore the adapter=0A=
@@ -3446,8 +3461,10 @@ static HRESULT  WINAPI =
IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter,=0A=
     select_shader_mode(&GLINFO_LOCATION, DeviceType, =
&object->ps_selected_mode, &object->vs_selected_mode);=0A=
     object->shader_backend =3D select_shader_backend(Adapter, =
DeviceType);=0A=
 =0A=
+    frag_pipeline =3D select_fragment_implementation(Adapter, =
DeviceType);=0A=
+=0A=
     compile_state_table(object->StateTable, object->multistate_funcs,=0A=
-                        ffp_vertexstate_template, NULL, =
misc_state_template,=0A=
+                        ffp_vertexstate_template, frag_pipeline, =
misc_state_template,=0A=
                         object->shader_backend->StateTable_remove);=0A=
 =0A=
     /* Prefer the vtable with functions optimized for single =
dirtifyable objects if the shader=0A=
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c=0A=
index 2813d92..60089ce 100644=0A=
--- a/dlls/wined3d/state.c=0A=
+++ b/dlls/wined3d/state.c=0A=
@@ -5246,6 +5246,10 @@ const struct StateEntryTemplate =
ffp_vertexstate_template[] =3D {=0A=
     {0 /* Terminate */,                                   { 0,          =
                                        0                   }},=0A=
 };=0A=
 =0A=
+const struct StateEntryTemplate ffp_fragmentstate_template[] =3D {=0A=
+    {0 /* Terminate */,                                   { 0,          =
                                        0                   }},=0A=
+};=0A=
+=0A=
 static int num_handlers(APPLYSTATEFUNC *funcs) {=0A=
     unsigned int i;=0A=
     for(i =3D 0; funcs[i]; i++);=0A=
diff --git a/dlls/wined3d/wined3d_private.h =
b/dlls/wined3d/wined3d_private.h=0A=
index 706fdff..af0ee3b 100644=0A=
--- a/dlls/wined3d/wined3d_private.h=0A=
+++ b/dlls/wined3d/wined3d_private.h=0A=
@@ -595,6 +595,8 @@ struct StateEntryTemplate=0A=
 =0A=
 extern const struct StateEntryTemplate misc_state_template[];=0A=
 extern const struct StateEntryTemplate ffp_vertexstate_template[];=0A=
+extern const struct StateEntryTemplate ffp_fragmentstate_template[];=0A=
+extern const struct StateEntryTemplate atifs_fragmentstate_template[];=0A=
 =0A=
 /* "Base" state table */=0A=
 extern const struct StateEntry FFPStateTable[];=0A=
-- =0A=
1.5.4.5=0A=
=0A=

------=_NextPart_000_0011_01C8E0EC.F34C80C0--




More information about the wine-patches mailing list