Module: wine Branch: master Commit: 7ae71a92a2d12c241d22e4b620c7edfe6b6db5d8 URL: http://source.winehq.org/git/wine.git/?a=commit;h=7ae71a92a2d12c241d22e4b620...
Author: H. Verbeet hverbeet@gmail.com Date: Wed Jan 3 19:18:59 2007 +0100
wined3d: Skip sampler state application for stages that aren't mapped to a texture unit.
---
dlls/wined3d/state.c | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index b76b53b..9d608c3 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -1702,6 +1702,7 @@ static void tex_resultarg(DWORD state, I
static void sampler(DWORD state, IWineD3DStateBlockImpl *stateblock) { DWORD sampler = state - STATE_SAMPLER(0); + DWORD mapped_stage = stateblock->wineD3DDevice->texUnitMap[sampler]; union { float f; DWORD d; @@ -1711,12 +1712,17 @@ static void sampler(DWORD state, IWineD3 /* Enabling and disabling texture dimensions is done by texture stage state / pixel shader setup, this function * only has to bind textures and set the per texture states */ + + if (mapped_stage == -1) { + TRACE("No sampler mapped to stage %d. Returning.\n", sampler); + return; + } + if (GL_SUPPORT(ARB_MULTITEXTURE)) { - /* TODO: register combiners! */ if(sampler >= GL_LIMITS(sampler_stages)) { return; } - GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + stateblock->wineD3DDevice->texUnitMap[sampler])); + GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + mapped_stage)); checkGLcall("glActiveTextureARB"); } else if (sampler > 0) { /* We can't do anything here */