[wined3d] trigger constant reloading when RECT textures change

Tobias Jakobi tjakobi at ada17.math.uni-bielefeld.de
Wed Mar 25 08:44:45 CDT 2009


---
 dlls/wined3d/state.c |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 720a548..f44a1ca 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -3028,8 +3028,10 @@ static void transform_texture(DWORD state, IWineD3DStateBlockImpl *stateblock, W
         if(generated) {
             FIXME("Non-power2 texture being used with generated texture coords\n");
         }
-        TRACE("Non power two matrix multiply fixup\n");
-        glMultMatrixf(((IWineD3DTextureImpl *) stateblock->textures[texUnit])->baseTexture.pow2Matrix);
+        if (!use_ps(stateblock)) {
+            TRACE("Non power two matrix multiply fixup\n");
+            glMultMatrixf(((IWineD3DTextureImpl *) stateblock->textures[texUnit])->baseTexture.pow2Matrix);
+        }
     }
 }
 
@@ -3373,6 +3375,17 @@ static void sampler(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DCont
                 state_alpha(WINED3DRS_COLORKEYENABLE, stateblock, context);
             }
         }
+
+        /* Trigger shader constant reloading (for texcoord fixup when RECT samplers are used)
+         * Only do this if pixelshaders are used.
+         * The fixup is currently only implemented in the GLSL backend. */
+        if (GL_TEXTURE_RECTANGLE_ARB == IWineD3DBaseTexture_GetTextureDimensions(stateblock->textures[sampler]) &&
+            use_ps(stateblock)) {
+            IWineD3DDeviceImpl* d3ddevice = stateblock->wineD3DDevice;
+            /* FIXME: add something like shader_load_rectfixup_consts to the backend to only reload the
+             * constants that are used for the fixup (and not the other ones too) */
+            d3ddevice->shader_backend->shader_load_constants((IWineD3DDevice*)d3ddevice, use_ps(stateblock), use_vs(stateblock));
+        }
     } else if(mapped_stage < GL_LIMITS(textures)) {
         if(sampler < stateblock->lowest_disabled_stage) {
             /* TODO: What should I do with pixel shaders here ??? */
-- 
1.5.4.3


--========GMX277111237989135762575--



More information about the wine-patches mailing list