Module: wine
Branch: master
Commit: 287c6247abe842e406a07cd16900700676cefc07
URL: http://source.winehq.org/git/wine.git/?a=commit;h=287c6247abe842e406a07cd16…
Author: Stefan Dösinger <stefan(a)codeweavers.com>
Date: Fri Dec 8 18:37:17 2006 +0100
wined3d: Move WINED3DRS_TEXTUREFACTOR to the state table.
---
dlls/wined3d/device.c | 29 +----------------------------
dlls/wined3d/state.c | 30 +++++++++++++++++++++++++++++-
2 files changed, 30 insertions(+), 29 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 86a4252..d0bdde9 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3460,35 +3460,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl
case WINED3DRS_CLIPPLANEENABLE :
case WINED3DRS_CLIPPING :
case WINED3DRS_BLENDOP :
- StateTable[STATE_RENDER(State)].apply(STATE_RENDER(State), This->stateBlock);
- break;
-
case WINED3DRS_TEXTUREFACTOR :
- {
- unsigned int i;
-
- /* Note the texture color applies to all textures whereas
- GL_TEXTURE_ENV_COLOR applies to active only */
- float col[4];
- D3DCOLORTOGLFLOAT4(Value, col);
-
- if (!GL_SUPPORT(NV_REGISTER_COMBINERS)) {
- /* And now the default texture color as well */
- for (i = 0; i < GL_LIMITS(texture_stages); i++) {
- /* Note the WINED3DRS value applies to all textures, but GL has one
- per texture, so apply it now ready to be used! */
- if (GL_SUPPORT(ARB_MULTITEXTURE)) {
- GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + i));
- checkGLcall("glActiveTextureARB");
- } else if (i>0) {
- FIXME("Program using multiple concurrent textures which this opengl implementation doesn't support\n");
- }
-
- glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, &col[0]);
- checkGLcall("glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, color);");
- }
- }
- }
+ StateTable[STATE_RENDER(State)].apply(STATE_RENDER(State), This->stateBlock);
break;
case WINED3DRS_SPECULARENABLE :
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 0eaef71..549b120 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -432,6 +432,34 @@ static void state_blendop(DWORD state, I
checkGLcall("glBlendEquation");
}
+static void state_texfactor(DWORD state, IWineD3DStateBlockImpl *stateblock) {
+ unsigned int i;
+
+ /* Note the texture color applies to all textures whereas
+ * GL_TEXTURE_ENV_COLOR applies to active only
+ */
+ float col[4];
+ D3DCOLORTOGLFLOAT4(stateblock->renderState[WINED3DRS_TEXTUREFACTOR], col);
+
+ if (!GL_SUPPORT(NV_REGISTER_COMBINERS)) {
+ /* And now the default texture color as well */
+ for (i = 0; i < GL_LIMITS(texture_stages); i++) {
+ /* Note the WINED3DRS value applies to all textures, but GL has one
+ * per texture, so apply it now ready to be used!
+ */
+ if (GL_SUPPORT(ARB_MULTITEXTURE)) {
+ GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + i));
+ checkGLcall("glActiveTextureARB");
+ } else if (i>0) {
+ FIXME("Program using multiple concurrent textures which this opengl implementation doesn't support\n");
+ }
+
+ glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, &col[0]);
+ checkGLcall("glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, color);");
+ }
+ }
+}
+
const struct StateEntry StateTable[] =
{
/* State name representative, apply function */
@@ -495,7 +523,7 @@ const struct StateEntry StateTable[] =
{ /* 57, WINED3DRS_STENCILREF */ STATE_RENDER(WINED3DRS_STENCILENABLE), state_unknown },
{ /* 58, WINED3DRS_STENCILMASK */ STATE_RENDER(WINED3DRS_STENCILENABLE), state_unknown },
{ /* 59, WINED3DRS_STENCILWRITEMASK */ STATE_RENDER(WINED3DRS_STENCILWRITEMASK), state_unknown },
- { /* 60, WINED3DRS_TEXTUREFACTOR */ STATE_RENDER(WINED3DRS_TEXTUREFACTOR), state_unknown },
+ { /* 60, WINED3DRS_TEXTUREFACTOR */ STATE_RENDER(WINED3DRS_TEXTUREFACTOR), state_texfactor },
/* A BIG hole. If wanted, 'fixed' states like the vertex type or the bound shaders can be put here */
{ /* 61, Undefined */ 0, state_undefined },
{ /* 62, Undefined */ 0, state_undefined },