wined3d: Move WINED3DRS_BLENDOP to the state table.

This commit is contained in:
Stefan Dösinger 2006-12-08 20:21:43 +01:00 committed by Alexandre Julliard
parent 89e999ac71
commit ac26172c2d
2 changed files with 27 additions and 25 deletions

View File

@ -3459,31 +3459,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetRenderState(IWineD3DDevice *iface, W
case WINED3DRS_COLORKEYENABLE :
case WINED3DRS_CLIPPLANEENABLE :
case WINED3DRS_CLIPPING :
StateTable[STATE_RENDER(State)].apply(STATE_RENDER(State), This->stateBlock);
break;
case WINED3DRS_BLENDOP :
{
int glParm = GL_FUNC_ADD;
switch ((WINED3DBLENDOP) Value) {
case WINED3DBLENDOP_ADD : glParm = GL_FUNC_ADD; break;
case WINED3DBLENDOP_SUBTRACT : glParm = GL_FUNC_SUBTRACT; break;
case WINED3DBLENDOP_REVSUBTRACT : glParm = GL_FUNC_REVERSE_SUBTRACT; break;
case WINED3DBLENDOP_MIN : glParm = GL_MIN; break;
case WINED3DBLENDOP_MAX : glParm = GL_MAX; break;
default:
FIXME("Unrecognized/Unhandled WINED3DBLENDOP value %d\n", Value);
}
if(GL_SUPPORT(EXT_BLEND_MINMAX)) {
TRACE("glBlendEquation(%x)\n", glParm);
GL_EXTCALL(glBlendEquation(glParm));
checkGLcall("glBlendEquation");
} else {
WARN("Unsupported in local OpenGL implementation: glBlendEquation\n");
}
}
StateTable[STATE_RENDER(State)].apply(STATE_RENDER(State), This->stateBlock);
break;
case WINED3DRS_TEXTUREFACTOR :

View File

@ -27,6 +27,8 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
#define GLINFO_LOCATION ((IWineD3DImpl *)(stateblock->wineD3DDevice->wineD3D))->gl_info
static void state_unknown(DWORD state, IWineD3DStateBlockImpl *stateblock) {
/* State which does exist, but wined3d doesn't know about */
if(STATE_IS_RENDER(state)) {
@ -407,6 +409,29 @@ static void state_clipping(DWORD state, IWineD3DStateBlockImpl *stateblock) {
}
}
static void state_blendop(DWORD state, IWineD3DStateBlockImpl *stateblock) {
int glParm = GL_FUNC_ADD;
if(!GL_SUPPORT(EXT_BLEND_MINMAX)) {
WARN("Unsupported in local OpenGL implementation: glBlendEquation\n");
return;
}
switch ((WINED3DBLENDOP) stateblock->renderState[WINED3DRS_BLENDOP]) {
case WINED3DBLENDOP_ADD : glParm = GL_FUNC_ADD; break;
case WINED3DBLENDOP_SUBTRACT : glParm = GL_FUNC_SUBTRACT; break;
case WINED3DBLENDOP_REVSUBTRACT : glParm = GL_FUNC_REVERSE_SUBTRACT; break;
case WINED3DBLENDOP_MIN : glParm = GL_MIN; break;
case WINED3DBLENDOP_MAX : glParm = GL_MAX; break;
default:
FIXME("Unrecognized/Unhandled D3DBLENDOP value %d\n", stateblock->renderState[WINED3DRS_BLENDOP]);
}
TRACE("glBlendEquation(%x)\n", glParm);
GL_EXTCALL(glBlendEquation(glParm));
checkGLcall("glBlendEquation");
}
const struct StateEntry StateTable[] =
{
/* State name representative, apply function */
@ -583,7 +608,7 @@ const struct StateEntry StateTable[] =
{ /*168, WINED3DRS_COLORWRITEENABLE */ STATE_RENDER(WINED3DRS_COLORWRITEENABLE), state_unknown },
{ /*169, Undefined */ 0, state_undefined },
{ /*170, WINED3DRS_TWEENFACTOR */ 0, state_nogl },
{ /*171, WINED3DRS_BLENDOP */ STATE_RENDER(WINED3DRS_BLENDOP), state_unknown },
{ /*171, WINED3DRS_BLENDOP */ STATE_RENDER(WINED3DRS_BLENDOP), state_blendop },
{ /*172, WINED3DRS_POSITIONDEGREE */ STATE_RENDER(WINED3DRS_POSITIONDEGREE), state_unknown },
{ /*173, WINED3DRS_NORMALDEGREE */ STATE_RENDER(WINED3DRS_NORMALDEGREE), state_unknown },
/*172, WINED3DRS_POSITIONORDER */ /* Value assigned to 2 state names */