Commit dd6f5a54 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

wined3d: Move WINED3DRS_ZBIAS to the state table.

parent 6a5d7df7
...@@ -3390,31 +3390,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetRenderState(IWineD3DDevice *iface, W ...@@ -3390,31 +3390,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetRenderState(IWineD3DDevice *iface, W
case WINED3DRS_AMBIENTMATERIALSOURCE : case WINED3DRS_AMBIENTMATERIALSOURCE :
case WINED3DRS_EMISSIVEMATERIALSOURCE : case WINED3DRS_EMISSIVEMATERIALSOURCE :
case WINED3DRS_LINEPATTERN : case WINED3DRS_LINEPATTERN :
StateTable[STATE_RENDER(State)].apply(STATE_RENDER(State), This->stateBlock);
break;
case WINED3DRS_ZBIAS : /* D3D8 only */ case WINED3DRS_ZBIAS : /* D3D8 only */
{ StateTable[STATE_RENDER(State)].apply(STATE_RENDER(State), This->stateBlock);
if (Value) {
tmpvalue.d = Value;
TRACE("ZBias value %f\n", tmpvalue.f);
glPolygonOffset(0, -tmpvalue.f);
checkGLcall("glPolygonOffset(0, -Value)");
glEnable(GL_POLYGON_OFFSET_FILL);
checkGLcall("glEnable(GL_POLYGON_OFFSET_FILL);");
glEnable(GL_POLYGON_OFFSET_LINE);
checkGLcall("glEnable(GL_POLYGON_OFFSET_LINE);");
glEnable(GL_POLYGON_OFFSET_POINT);
checkGLcall("glEnable(GL_POLYGON_OFFSET_POINT);");
} else {
glDisable(GL_POLYGON_OFFSET_FILL);
checkGLcall("glDisable(GL_POLYGON_OFFSET_FILL);");
glDisable(GL_POLYGON_OFFSET_LINE);
checkGLcall("glDisable(GL_POLYGON_OFFSET_LINE);");
glDisable(GL_POLYGON_OFFSET_POINT);
checkGLcall("glDisable(GL_POLYGON_OFFSET_POINT);");
}
}
break; break;
case WINED3DRS_NORMALIZENORMALS : case WINED3DRS_NORMALIZENORMALS :
......
...@@ -869,6 +869,33 @@ static void state_linepattern(DWORD state, IWineD3DStateBlockImpl *stateblock) { ...@@ -869,6 +869,33 @@ static void state_linepattern(DWORD state, IWineD3DStateBlockImpl *stateblock) {
} }
} }
static void state_zbias(DWORD state, IWineD3DStateBlockImpl *stateblock) {
union {
DWORD d;
float f;
} tmpvalue;
if (stateblock->renderState[WINED3DRS_ZBIAS]) {
tmpvalue.d = stateblock->renderState[WINED3DRS_ZBIAS];
TRACE("ZBias value %f\n", tmpvalue.f);
glPolygonOffset(0, -tmpvalue.f);
checkGLcall("glPolygonOffset(0, -Value)");
glEnable(GL_POLYGON_OFFSET_FILL);
checkGLcall("glEnable(GL_POLYGON_OFFSET_FILL);");
glEnable(GL_POLYGON_OFFSET_LINE);
checkGLcall("glEnable(GL_POLYGON_OFFSET_LINE);");
glEnable(GL_POLYGON_OFFSET_POINT);
checkGLcall("glEnable(GL_POLYGON_OFFSET_POINT);");
} else {
glDisable(GL_POLYGON_OFFSET_FILL);
checkGLcall("glDisable(GL_POLYGON_OFFSET_FILL);");
glDisable(GL_POLYGON_OFFSET_LINE);
checkGLcall("glDisable(GL_POLYGON_OFFSET_LINE);");
glDisable(GL_POLYGON_OFFSET_POINT);
checkGLcall("glDisable(GL_POLYGON_OFFSET_POINT);");
}
}
const struct StateEntry StateTable[] = const struct StateEntry StateTable[] =
{ {
/* State name representative, apply function */ /* State name representative, apply function */
...@@ -919,7 +946,7 @@ const struct StateEntry StateTable[] = ...@@ -919,7 +946,7 @@ const struct StateEntry StateTable[] =
{ /* 44, WINED3DRS_TEXTUREADDRESSU */ 0, /* Handled in ddraw */ state_undefined }, { /* 44, WINED3DRS_TEXTUREADDRESSU */ 0, /* Handled in ddraw */ state_undefined },
{ /* 45, WINED3DRS_TEXTUREADDRESSV */ 0, /* Handled in ddraw */ state_undefined }, { /* 45, WINED3DRS_TEXTUREADDRESSV */ 0, /* Handled in ddraw */ state_undefined },
{ /* 46, WINED3DRS_MIPMAPLODBIAS */ STATE_RENDER(WINED3DRS_MIPMAPLODBIAS), state_unknown }, { /* 46, WINED3DRS_MIPMAPLODBIAS */ STATE_RENDER(WINED3DRS_MIPMAPLODBIAS), state_unknown },
{ /* 47, WINED3DRS_ZBIAS */ STATE_RENDER(WINED3DRS_ZBIAS), state_unknown }, { /* 47, WINED3DRS_ZBIAS */ STATE_RENDER(WINED3DRS_ZBIAS), state_zbias },
{ /* 48, WINED3DRS_RANGEFOGENABLE */ 0, state_nogl }, { /* 48, WINED3DRS_RANGEFOGENABLE */ 0, state_nogl },
{ /* 49, WINED3DRS_ANISOTROPY */ STATE_RENDER(WINED3DRS_ANISOTROPY), state_unknown }, { /* 49, WINED3DRS_ANISOTROPY */ STATE_RENDER(WINED3DRS_ANISOTROPY), state_unknown },
{ /* 50, WINED3DRS_FLUSHBATCH */ STATE_RENDER(WINED3DRS_FLUSHBATCH), state_unknown }, { /* 50, WINED3DRS_FLUSHBATCH */ STATE_RENDER(WINED3DRS_FLUSHBATCH), state_unknown },
......
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