[15/19] catch nop sampler changes
Stefan Dösinger
stefan at codeweavers.com
Tue Dec 19 16:17:17 CST 2006
-------------- next part --------------
From af27dd96991ad0dc2a3fc20600076ae3f341cd4c Mon Sep 17 00:00:00 2001
From: Stefan Doesinger <stefan at codeweavers.com>
Date: Mon, 18 Dec 2006 14:29:27 +0100
Subject: [PATCH] WineD3D: Catch nop sampler changes
---
dlls/wined3d/device.c | 13 ++++++++++++-
dlls/wined3d/stateblock.c | 3 ++-
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 2a943b4..c5b173f 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3364,6 +3364,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl
static HRESULT WINAPI IWineD3DDeviceImpl_SetSamplerState(IWineD3DDevice *iface, DWORD Sampler, WINED3DSAMPLERSTATETYPE Type, DWORD Value) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
+ DWORD oldValue = This->stateBlock->samplerState[Sampler][Type];
+
/**
* SetSampler is designed to allow for more than the standard up to 8 textures
* and Geforce has stopped supporting more than 6 standard textures in openGL.
@@ -3397,6 +3399,11 @@ static HRESULT WINAPI IWineD3DDeviceImpl
return WINED3D_OK;
}
+ if(oldValue == Value) {
+ TRACE("Application is setting the old value over, nothing to do\n");
+ return WINED3D_OK;
+ }
+
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_SAMPLER(Sampler));
return WINED3D_OK;
@@ -4483,7 +4490,6 @@ #endif
This->stateBlock->textureDimensions[Stage] = IWineD3DBaseTexture_GetTextureDimensions(pTexture);
}
- oldTexture = This->updateStateBlock->textures[Stage];
TRACE("GL_LIMITS %d\n",GL_LIMITS(sampler_stages));
TRACE("(%p) : oldtexture(%p)\n", This,oldTexture);
@@ -4498,6 +4504,11 @@ #endif
return WINED3D_OK;
}
+ if(oldTexture == pTexture) {
+ TRACE("App is setting the same texture again, nothing to do\n");
+ return WINED3D_OK;
+ }
+
/** NOTE: MSDN says that setTexture increases the reference count,
* and the the application nust set the texture back to null (or have a leaky application),
* This means we should pass the refcount up to the parent
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
index 4dd182c..afc582d 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -756,7 +756,8 @@ should really perform a delta so that on
((IWineD3DDeviceImpl *)pDevice)->stateBlock->changed.samplerState[j][i] = TRUE;
}
}
-
+ /* SetTexture catches nop changes, so the above call does not assure that the sampler is updated */
+ IWineD3DDeviceImpl_MarkStateDirty((IWineD3DDeviceImpl *)pDevice, STATE_SAMPLER(j));
}
} else if (This->blockType == WINED3DSBT_PIXELSTATE) {
--
1.4.2.4
More information about the wine-patches
mailing list