Commit 8c530333 authored by H. Verbeet's avatar H. Verbeet Committed by Alexandre Julliard

wined3d: Don't do WINED3DTSS_COLOROP texture operations for stages that aren't…

wined3d: Don't do WINED3DTSS_COLOROP texture operations for stages that aren't mapped to a texture unit.
parent 06b19b01
...@@ -1363,6 +1363,7 @@ static void activate_dimensions(DWORD stage, IWineD3DStateBlockImpl *stateblock) ...@@ -1363,6 +1363,7 @@ static void activate_dimensions(DWORD stage, IWineD3DStateBlockImpl *stateblock)
static void tex_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock) { static void tex_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock) {
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / WINED3D_HIGHEST_TEXTURE_STATE; DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / WINED3D_HIGHEST_TEXTURE_STATE;
DWORD mapped_stage = stateblock->wineD3DDevice->texUnitMap[stage];
TRACE("Setting color op for stage %d\n", stage); TRACE("Setting color op for stage %d\n", stage);
...@@ -1372,21 +1373,23 @@ static void tex_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock) { ...@@ -1372,21 +1373,23 @@ static void tex_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock) {
return; return;
} }
if (GL_SUPPORT(ARB_MULTITEXTURE)) { if (stage != mapped_stage) WARN("Using non 1:1 mapping: %d -> %d!\n", stage, mapped_stage);
/* TODO: register combiners! */
if(stage != stateblock->wineD3DDevice->texUnitMap[stage]) ERR("Foo: %d is %d!\n", stage, stateblock->wineD3DDevice->texUnitMap[stage]); if (mapped_stage != -1) {
if(stateblock->wineD3DDevice->texUnitMap[stage] >= GL_LIMITS(sampler_stages)) { if (GL_SUPPORT(ARB_MULTITEXTURE)) {
if(stateblock->textureState[stage][WINED3DTSS_COLOROP] != WINED3DTOP_DISABLE && if (mapped_stage >= GL_LIMITS(sampler_stages)) {
stateblock->textureState[stage][WINED3DTSS_COLOROP] != 0) { if (stateblock->textureState[stage][WINED3DTSS_COLOROP] != WINED3DTOP_DISABLE &&
FIXME("Attempt to enable unsupported stage!\n"); stateblock->textureState[stage][WINED3DTSS_COLOROP] != 0) {
FIXME("Attempt to enable unsupported stage!\n");
}
return;
} }
GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + mapped_stage));
checkGLcall("glActiveTextureARB");
} else if (stage > 0) {
WARN("Program using multiple concurrent textures which this opengl implementation doesn't support\n");
return; return;
} }
GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + stateblock->wineD3DDevice->texUnitMap[stage]));
checkGLcall("glActiveTextureARB");
} else if (stage > 0) {
WARN("Program using multiple concurrent textures which this opengl implementation doesn't support\n");
return;
} }
if (GL_SUPPORT(NV_REGISTER_COMBINERS)) { if (GL_SUPPORT(NV_REGISTER_COMBINERS)) {
...@@ -1399,20 +1402,22 @@ static void tex_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock) { ...@@ -1399,20 +1402,22 @@ static void tex_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock) {
} }
if(stage >= stateblock->lowest_disabled_stage) { if(stage >= stateblock->lowest_disabled_stage) {
TRACE("Stage disabled\n"); TRACE("Stage disabled\n");
/* Disable everything here */ if (mapped_stage != -1) {
glDisable(GL_TEXTURE_1D); /* Disable everything here */
checkGLcall("glDisable(GL_TEXTURE_1D)"); glDisable(GL_TEXTURE_1D);
glDisable(GL_TEXTURE_2D); checkGLcall("glDisable(GL_TEXTURE_1D)");
checkGLcall("glDisable(GL_TEXTURE_2D)"); glDisable(GL_TEXTURE_2D);
glDisable(GL_TEXTURE_3D); checkGLcall("glDisable(GL_TEXTURE_2D)");
checkGLcall("glDisable(GL_TEXTURE_3D)"); glDisable(GL_TEXTURE_3D);
glDisable(GL_TEXTURE_CUBE_MAP_ARB); checkGLcall("glDisable(GL_TEXTURE_3D)");
checkGLcall("glDisable(GL_TEXTURE_CUBE_MAP_ARB)"); glDisable(GL_TEXTURE_CUBE_MAP_ARB);
checkGLcall("glDisable(GL_TEXTURE_CUBE_MAP_ARB)");
}
/* All done */ /* All done */
return; return;
} }
activate_dimensions(stage, stateblock); if (mapped_stage != -1) activate_dimensions(stage, stateblock);
/* Set the texture combiners */ /* Set the texture combiners */
if (GL_SUPPORT(NV_REGISTER_COMBINERS)) { if (GL_SUPPORT(NV_REGISTER_COMBINERS)) {
...@@ -1421,7 +1426,7 @@ static void tex_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock) { ...@@ -1421,7 +1426,7 @@ static void tex_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock) {
stateblock->textureState[stage][WINED3DTSS_COLORARG1], stateblock->textureState[stage][WINED3DTSS_COLORARG1],
stateblock->textureState[stage][WINED3DTSS_COLORARG2], stateblock->textureState[stage][WINED3DTSS_COLORARG2],
stateblock->textureState[stage][WINED3DTSS_COLORARG0], stateblock->textureState[stage][WINED3DTSS_COLORARG0],
stateblock->wineD3DDevice->texUnitMap[stage]); mapped_stage);
} else { } else {
set_tex_op((IWineD3DDevice *)stateblock->wineD3DDevice, FALSE, stage, set_tex_op((IWineD3DDevice *)stateblock->wineD3DDevice, FALSE, stage,
stateblock->textureState[stage][WINED3DTSS_COLOROP], stateblock->textureState[stage][WINED3DTSS_COLOROP],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment