Module: wine Branch: master Commit: a3e1a6f2ee61a48e685bed4d784bcdcb5b6d035e URL: http://source.winehq.org/git/wine.git/?a=commit;h=a3e1a6f2ee61a48e685bed4d78...
Author: Henri Verbeet hverbeet@codeweavers.com Date: Wed Jan 27 20:19:42 2010 +0100
wined3d: Use correct texture stage limits in a couple of places.
---
dlls/wined3d/device.c | 16 +++++++++++----- dlls/wined3d/state.c | 6 +++--- 2 files changed, 14 insertions(+), 8 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 8e85e4d..0cc27c9 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -3024,6 +3024,7 @@ static void device_map_fixed_function_samplers(IWineD3DDeviceImpl *This) { static void device_map_psamplers(IWineD3DDeviceImpl *This) { const WINED3DSAMPLER_TEXTURE_TYPE *sampler_type = ((IWineD3DPixelShaderImpl *)This->stateBlock->pixelShader)->baseShader.reg_maps.sampler_type; + const struct wined3d_gl_info *gl_info = &This->adapter->gl_info; unsigned int i;
for (i = 0; i < MAX_FRAGMENT_SAMPLERS; ++i) { @@ -3031,7 +3032,8 @@ static void device_map_psamplers(IWineD3DDeviceImpl *This) { { device_map_stage(This, i, i); IWineD3DDeviceImpl_MarkStateDirty(This, STATE_SAMPLER(i)); - if (i < MAX_TEXTURES) { + if (i < gl_info->limits.texture_stages) + { markTextureStagesDirty(This, i); } } @@ -3735,11 +3737,14 @@ static HRESULT WINAPI IWineD3DDeviceImpl_ProcessVertices(IWineD3DDevice *iface, static HRESULT WINAPI IWineD3DDeviceImpl_SetTextureStageState(IWineD3DDevice *iface, DWORD Stage, WINED3DTEXTURESTAGESTATETYPE Type, DWORD Value) { IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; DWORD oldValue = This->updateStateBlock->textureState[Stage][Type]; + const struct wined3d_gl_info *gl_info = &This->adapter->gl_info;
TRACE("(%p) : Stage=%d, Type=%s(%d), Value=%d\n", This, Stage, debug_d3dtexturestate(Type), Type, Value);
- if (Stage >= MAX_TEXTURES) { - WARN("Attempting to set stage %u which is higher than the max stage %u, ignoring\n", Stage, MAX_TEXTURES - 1); + if (Stage >= gl_info->limits.texture_stages) + { + WARN("Attempting to set stage %u which is higher than the max stage %u, ignoring.\n", + Stage, gl_info->limits.texture_stages - 1); return WINED3D_OK; }
@@ -3820,6 +3825,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetTexture(IWineD3DDevice *iface, DWORD stage, IWineD3DBaseTexture *texture) { IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; + const struct wined3d_gl_info *gl_info = &This->adapter->gl_info; IWineD3DBaseTexture *prev;
TRACE("iface %p, stage %u, texture %p.\n", iface, stage, texture); @@ -3878,7 +3884,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetTexture(IWineD3DDevice *iface, IWineD3DDeviceImpl_MarkStateDirty(This, STATE_PIXELSHADER); }
- if (!prev && stage < MAX_TEXTURES) + if (!prev && stage < gl_info->limits.texture_stages) { /* The source arguments for color and alpha ops have different * meanings when a NULL texture is bound, so the COLOROP and @@ -3897,7 +3903,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetTexture(IWineD3DDevice *iface,
IWineD3DBaseTexture_Release(prev);
- if (!texture && stage < MAX_TEXTURES) + if (!texture && stage < gl_info->limits.texture_stages) { IWineD3DDeviceImpl_MarkStateDirty(This, STATE_TEXTURESTAGE(stage, WINED3DTSS_COLOROP)); IWineD3DDeviceImpl_MarkStateDirty(This, STATE_TEXTURESTAGE(stage, WINED3DTSS_ALPHAOP)); diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index 247710c..35482ee 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -3601,9 +3601,9 @@ void apply_pixelshader(DWORD state, IWineD3DStateBlockImpl *stateblock, struct w } } else { /* Disabled the pixel shader - color ops weren't applied - * while it was enabled, so re-apply them. - */ - for(i=0; i < MAX_TEXTURES; i++) { + * while it was enabled, so re-apply them. */ + for (i = 0; i < context->gl_info->limits.texture_stages; ++i) + { if(!isStateDirty(context, STATE_TEXTURESTAGE(i, WINED3DTSS_COLOROP))) { device->StateTable[STATE_TEXTURESTAGE(i, WINED3DTSS_COLOROP)].apply (STATE_TEXTURESTAGE(i, WINED3DTSS_COLOROP), stateblock, context);