[PATCH] WineD3D: Move fixed function texture dimension updates =

Stefan Doesinger stefan at codeweavers.com
Fri Jul 4 12:06:58 CDT 2008


to the fragment pipeline=0A=
=0A=
This is a further separation of the sampler state, and a preparation to =
move the nv texture shader stuff to its own=0A=
pipeline implementation=0A=
---=0A=
 dlls/wined3d/ati_fragment_shader.c |    8 ++++++++=0A=
 dlls/wined3d/state.c               |   16 ++++++++--------=0A=
 dlls/wined3d/utils.c               |   16 ++++++++++++++++=0A=
 dlls/wined3d/wined3d_private.h     |    1 +=0A=
 4 files changed, 33 insertions(+), 8 deletions(-)=0A=
=0A=
diff --git a/dlls/wined3d/ati_fragment_shader.c =
b/dlls/wined3d/ati_fragment_shader.c=0A=
index 6fc0aa4..a41f686 100644=0A=
--- a/dlls/wined3d/ati_fragment_shader.c=0A=
+++ b/dlls/wined3d/ati_fragment_shader.c=0A=
@@ -958,6 +958,14 @@ static const struct StateEntryTemplate =
atifs_fragmentstate_template[] =3D {=0A=
     {STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT01),      { =
STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT00),     set_bumpmat          =
   }},=0A=
     {STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT10),      { =
STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT00),     set_bumpmat          =
   }},=0A=
     {STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT11),      { =
STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT00),     set_bumpmat          =
   }},=0A=
+    { STATE_SAMPLER(0),                                   { =
STATE_SAMPLER(0),                                   sampler_texdim       =
   }},=0A=
+    { STATE_SAMPLER(1),                                   { =
STATE_SAMPLER(1),                                   sampler_texdim       =
   }},=0A=
+    { STATE_SAMPLER(2),                                   { =
STATE_SAMPLER(2),                                   sampler_texdim       =
   }},=0A=
+    { STATE_SAMPLER(3),                                   { =
STATE_SAMPLER(3),                                   sampler_texdim       =
   }},=0A=
+    { STATE_SAMPLER(4),                                   { =
STATE_SAMPLER(4),                                   sampler_texdim       =
   }},=0A=
+    { STATE_SAMPLER(5),                                   { =
STATE_SAMPLER(5),                                   sampler_texdim       =
   }},=0A=
+    { STATE_SAMPLER(6),                                   { =
STATE_SAMPLER(6),                                   sampler_texdim       =
   }},=0A=
+    { STATE_SAMPLER(7),                                   { =
STATE_SAMPLER(7),                                   sampler_texdim       =
   }},=0A=
     {0 /* Terminate */,                                   { 0,          =
                                        0                       }},=0A=
 };=0A=
 =0A=
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c=0A=
index b96f80f..d1d64fe 100644=0A=
--- a/dlls/wined3d/state.c=0A=
+++ b/dlls/wined3d/state.c=0A=
@@ -2430,10 +2430,6 @@ static void sampler(DWORD state, =
IWineD3DStateBlockImpl *stateblock, WineD3DCont=0A=
             glEnable(stateblock->textureDimensions[sampler]);=0A=
             =
checkGLcall("glEnable(stateblock->textureDimensions[sampler])");=0A=
         } else if(sampler < stateblock->lowest_disabled_stage) {=0A=
-            if(!isStateDirty(context, STATE_TEXTURESTAGE(sampler, =
WINED3DTSS_COLOROP))) {=0A=
-                texture_activate_dimensions(sampler, stateblock, =
context);=0A=
-            }=0A=
-=0A=
             if(stateblock->renderState[WINED3DRS_COLORKEYENABLE] && =
sampler =3D=3D 0) {=0A=
                 /* If color keying is enabled update the alpha test, it =
depends on the existence=0A=
                  * of a color key in stage 0=0A=
@@ -2444,10 +2440,6 @@ static void sampler(DWORD state, =
IWineD3DStateBlockImpl *stateblock, WineD3DCont=0A=
     } else if(mapped_stage < GL_LIMITS(textures)) {=0A=
         if(sampler < stateblock->lowest_disabled_stage) {=0A=
             /* TODO: What should I do with pixel shaders here ??? */=0A=
-            if(!isStateDirty(context, STATE_TEXTURESTAGE(sampler, =
WINED3DTSS_COLOROP))) {=0A=
-                texture_activate_dimensions(sampler, stateblock, =
context);=0A=
-            }=0A=
-=0A=
             if(stateblock->renderState[WINED3DRS_COLORKEYENABLE] && =
sampler =3D=3D 0) {=0A=
                 /* If color keying is enabled update the alpha test, it =
depends on the existence=0A=
                 * of a color key in stage 0=0A=
@@ -4460,6 +4452,14 @@ static const struct StateEntryTemplate =
ffp_fragmentstate_template[] =3D {=0A=
     { STATE_RENDER(WINED3DRS_SRGBWRITEENABLE),            { =
STATE_PIXELSHADER,                                  pixelshader         =
}},=0A=
     { STATE_RENDER(WINED3DRS_BORDERCOLOR),                { =
STATE_RENDER(WINED3DRS_BORDERCOLOR),                state_bordercolor   =
}},=0A=
     { STATE_RENDER(WINED3DRS_TEXTUREFACTOR),              { =
STATE_RENDER(WINED3DRS_TEXTUREFACTOR),              state_texfactor     =
}},=0A=
+    { STATE_SAMPLER(0),                                   { =
STATE_SAMPLER(0),                                   sampler_texdim      =
}},=0A=
+    { STATE_SAMPLER(1),                                   { =
STATE_SAMPLER(1),                                   sampler_texdim      =
}},=0A=
+    { STATE_SAMPLER(2),                                   { =
STATE_SAMPLER(2),                                   sampler_texdim      =
}},=0A=
+    { STATE_SAMPLER(3),                                   { =
STATE_SAMPLER(3),                                   sampler_texdim      =
}},=0A=
+    { STATE_SAMPLER(4),                                   { =
STATE_SAMPLER(4),                                   sampler_texdim      =
}},=0A=
+    { STATE_SAMPLER(5),                                   { =
STATE_SAMPLER(5),                                   sampler_texdim      =
}},=0A=
+    { STATE_SAMPLER(6),                                   { =
STATE_SAMPLER(6),                                   sampler_texdim      =
}},=0A=
+    { STATE_SAMPLER(7),                                   { =
STATE_SAMPLER(7),                                   sampler_texdim      =
}},=0A=
     {0 /* Terminate */,                                   { 0,          =
                                        0                   }},=0A=
 };=0A=
 #undef GLINFO_LOCATION=0A=
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c=0A=
index 5a02717..71833d5 100644=0A=
--- a/dlls/wined3d/utils.c=0A=
+++ b/dlls/wined3d/utils.c=0A=
@@ -3498,4 +3498,20 @@ void texture_activate_dimensions(DWORD stage, =
IWineD3DStateBlockImpl *stateblock=0A=
         }=0A=
     }=0A=
 }=0A=
+=0A=
+void sampler_texdim(DWORD state, IWineD3DStateBlockImpl *stateblock, =
WineD3DContext *context) {=0A=
+    DWORD sampler =3D state - STATE_SAMPLER(0);=0A=
+    DWORD mapped_stage =3D =
stateblock->wineD3DDevice->texUnitMap[sampler];=0A=
+=0A=
+    /* No need to enable / disable anything here for unused samplers. =
The tex_colorop=0A=
+    * handler takes care. Also no action is needed with pixel shaders, =
or if tex_colorop=0A=
+    * will take care of this business=0A=
+    */=0A=
+    if(mapped_stage =3D=3D -1 || mapped_stage >=3D GL_LIMITS(textures)) =
return;=0A=
+    if(sampler >=3D stateblock->lowest_disabled_stage) return;=0A=
+    if(use_ps(stateblock->wineD3DDevice)) return;=0A=
+    if(isStateDirty(context, STATE_TEXTURESTAGE(sampler, =
WINED3DTSS_COLOROP))) return;=0A=
+=0A=
+    texture_activate_dimensions(sampler, stateblock, context);=0A=
+}=0A=
 #undef GLINFO_LOCATION=0A=
diff --git a/dlls/wined3d/wined3d_private.h =
b/dlls/wined3d/wined3d_private.h=0A=
index d5352ea..5c067ed 100644=0A=
--- a/dlls/wined3d/wined3d_private.h=0A=
+++ b/dlls/wined3d/wined3d_private.h=0A=
@@ -1733,6 +1733,7 @@ void   set_tex_op(IWineD3DDevice *iface, BOOL =
isAlpha, int Stage, WINED3DTEXTURE=0A=
 void   set_tex_op_nvrc(IWineD3DDevice *iface, BOOL is_alpha, int stage, =
WINED3DTEXTUREOP op, DWORD arg1, DWORD arg2, DWORD arg3, INT =
texture_idx, DWORD dst);=0A=
 void   set_texture_matrix(const float *smat, DWORD flags, BOOL =
calculatedCoords, BOOL transformed, DWORD coordtype);=0A=
 void texture_activate_dimensions(DWORD stage, IWineD3DStateBlockImpl =
*stateblock, WineD3DContext *context);=0A=
+void sampler_texdim(DWORD state, IWineD3DStateBlockImpl *stateblock, =
WineD3DContext *context);=0A=
 =0A=
 void surface_set_compatible_renderbuffer(IWineD3DSurface *iface, =
unsigned int width, unsigned int height);=0A=
 GLenum surface_get_gl_buffer(IWineD3DSurface *iface, IWineD3DSwapChain =
*swapchain);=0A=
-- =0A=
1.5.4.5=0A=
=0A=

------=_NextPart_000_000B_01C8E2A2.87405A20--




More information about the wine-patches mailing list