Stefan Dösinger : wined3d: Move fixed function texture dimension updates to the fragment pipeline.
Alexandre Julliard
julliard at winehq.org
Mon Jul 14 05:56:39 CDT 2008
Module: wine
Branch: master
Commit: 51e64b3fe95afb3246c8690d9ea1e7b4c38ce2b4
URL: http://source.winehq.org/git/wine.git/?a=commit;h=51e64b3fe95afb3246c8690d9ea1e7b4c38ce2b4
Author: Stefan Dösinger <stefan at codeweavers.com>
Date: Fri Jul 4 12:06:58 2008 -0500
wined3d: Move fixed function texture dimension updates to the fragment pipeline.
This is a further separation of the sampler state, and a preparation
to move the nv texture shader stuff to its own pipeline implementation.
---
dlls/wined3d/ati_fragment_shader.c | 8 ++++++++
dlls/wined3d/state.c | 16 ++++++++--------
dlls/wined3d/utils.c | 16 ++++++++++++++++
dlls/wined3d/wined3d_private.h | 1 +
4 files changed, 33 insertions(+), 8 deletions(-)
diff --git a/dlls/wined3d/ati_fragment_shader.c b/dlls/wined3d/ati_fragment_shader.c
index 6fc0aa4..a41f686 100644
--- a/dlls/wined3d/ati_fragment_shader.c
+++ b/dlls/wined3d/ati_fragment_shader.c
@@ -958,6 +958,14 @@ static const struct StateEntryTemplate atifs_fragmentstate_template[] = {
{STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT01), { STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT00), set_bumpmat }},
{STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT10), { STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT00), set_bumpmat }},
{STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT11), { STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT00), set_bumpmat }},
+ { STATE_SAMPLER(0), { STATE_SAMPLER(0), sampler_texdim }},
+ { STATE_SAMPLER(1), { STATE_SAMPLER(1), sampler_texdim }},
+ { STATE_SAMPLER(2), { STATE_SAMPLER(2), sampler_texdim }},
+ { STATE_SAMPLER(3), { STATE_SAMPLER(3), sampler_texdim }},
+ { STATE_SAMPLER(4), { STATE_SAMPLER(4), sampler_texdim }},
+ { STATE_SAMPLER(5), { STATE_SAMPLER(5), sampler_texdim }},
+ { STATE_SAMPLER(6), { STATE_SAMPLER(6), sampler_texdim }},
+ { STATE_SAMPLER(7), { STATE_SAMPLER(7), sampler_texdim }},
{0 /* Terminate */, { 0, 0 }},
};
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index b96f80f..d1d64fe 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -2430,10 +2430,6 @@ static void sampler(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DCont
glEnable(stateblock->textureDimensions[sampler]);
checkGLcall("glEnable(stateblock->textureDimensions[sampler])");
} else if(sampler < stateblock->lowest_disabled_stage) {
- if(!isStateDirty(context, STATE_TEXTURESTAGE(sampler, WINED3DTSS_COLOROP))) {
- texture_activate_dimensions(sampler, stateblock, context);
- }
-
if(stateblock->renderState[WINED3DRS_COLORKEYENABLE] && sampler == 0) {
/* If color keying is enabled update the alpha test, it depends on the existence
* of a color key in stage 0
@@ -2444,10 +2440,6 @@ static void sampler(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DCont
} else if(mapped_stage < GL_LIMITS(textures)) {
if(sampler < stateblock->lowest_disabled_stage) {
/* TODO: What should I do with pixel shaders here ??? */
- if(!isStateDirty(context, STATE_TEXTURESTAGE(sampler, WINED3DTSS_COLOROP))) {
- texture_activate_dimensions(sampler, stateblock, context);
- }
-
if(stateblock->renderState[WINED3DRS_COLORKEYENABLE] && sampler == 0) {
/* If color keying is enabled update the alpha test, it depends on the existence
* of a color key in stage 0
@@ -4460,6 +4452,14 @@ static const struct StateEntryTemplate ffp_fragmentstate_template[] = {
{ STATE_RENDER(WINED3DRS_SRGBWRITEENABLE), { STATE_PIXELSHADER, pixelshader }},
{ STATE_RENDER(WINED3DRS_BORDERCOLOR), { STATE_RENDER(WINED3DRS_BORDERCOLOR), state_bordercolor }},
{ STATE_RENDER(WINED3DRS_TEXTUREFACTOR), { STATE_RENDER(WINED3DRS_TEXTUREFACTOR), state_texfactor }},
+ { STATE_SAMPLER(0), { STATE_SAMPLER(0), sampler_texdim }},
+ { STATE_SAMPLER(1), { STATE_SAMPLER(1), sampler_texdim }},
+ { STATE_SAMPLER(2), { STATE_SAMPLER(2), sampler_texdim }},
+ { STATE_SAMPLER(3), { STATE_SAMPLER(3), sampler_texdim }},
+ { STATE_SAMPLER(4), { STATE_SAMPLER(4), sampler_texdim }},
+ { STATE_SAMPLER(5), { STATE_SAMPLER(5), sampler_texdim }},
+ { STATE_SAMPLER(6), { STATE_SAMPLER(6), sampler_texdim }},
+ { STATE_SAMPLER(7), { STATE_SAMPLER(7), sampler_texdim }},
{0 /* Terminate */, { 0, 0 }},
};
#undef GLINFO_LOCATION
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index 5a02717..71833d5 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -3498,4 +3498,20 @@ void texture_activate_dimensions(DWORD stage, IWineD3DStateBlockImpl *stateblock
}
}
}
+
+void sampler_texdim(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
+ DWORD sampler = state - STATE_SAMPLER(0);
+ DWORD mapped_stage = stateblock->wineD3DDevice->texUnitMap[sampler];
+
+ /* No need to enable / disable anything here for unused samplers. The tex_colorop
+ * handler takes care. Also no action is needed with pixel shaders, or if tex_colorop
+ * will take care of this business
+ */
+ if(mapped_stage == -1 || mapped_stage >= GL_LIMITS(textures)) return;
+ if(sampler >= stateblock->lowest_disabled_stage) return;
+ if(use_ps(stateblock->wineD3DDevice)) return;
+ if(isStateDirty(context, STATE_TEXTURESTAGE(sampler, WINED3DTSS_COLOROP))) return;
+
+ texture_activate_dimensions(sampler, stateblock, context);
+}
#undef GLINFO_LOCATION
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index d5352ea..5c067ed 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1733,6 +1733,7 @@ void set_tex_op(IWineD3DDevice *iface, BOOL isAlpha, int Stage, WINED3DTEXTURE
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);
void set_texture_matrix(const float *smat, DWORD flags, BOOL calculatedCoords, BOOL transformed, DWORD coordtype);
void texture_activate_dimensions(DWORD stage, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context);
+void sampler_texdim(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context);
void surface_set_compatible_renderbuffer(IWineD3DSurface *iface, unsigned int width, unsigned int height);
GLenum surface_get_gl_buffer(IWineD3DSurface *iface, IWineD3DSwapChain *swapchain);
More information about the wine-cvs
mailing list