wined3d: Move WINED3DRS_DEPTHBIAS to the state table.

This commit is contained in:
Stefan Dösinger 2006-12-10 23:20:52 +01:00 committed by Alexandre Julliard
parent d7e55c2841
commit 30cf5e4e90
2 changed files with 23 additions and 47 deletions

View File

@ -3425,6 +3425,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetRenderState(IWineD3DDevice *iface, W
case WINED3DRS_WRAP15 :
case WINED3DRS_MULTISAMPLEANTIALIAS :
case WINED3DRS_SCISSORTESTENABLE :
case WINED3DRS_SLOPESCALEDEPTHBIAS :
case WINED3DRS_DEPTHBIAS :
StateTable[STATE_RENDER(State)].apply(STATE_RENDER(State), This->stateBlock);
break;
@ -3435,51 +3437,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetRenderState(IWineD3DDevice *iface, W
return WINED3DERR_INVALIDCALL;
}
case WINED3DRS_SLOPESCALEDEPTHBIAS :
{
if(Value) {
tmpvalue.d = Value;
glEnable(GL_POLYGON_OFFSET_FILL);
checkGLcall("glEnable(GL_POLYGON_OFFSET_FILL)");
glPolygonOffset(tmpvalue.f, *((float*)&This->stateBlock->renderState[WINED3DRS_DEPTHBIAS]));
checkGLcall("glPolygonOffset(...)");
} else {
glDisable(GL_POLYGON_OFFSET_FILL);
checkGLcall("glDisable(GL_POLYGON_OFFSET_FILL)");
}
break;
}
{
if(Value) {
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
checkGLcall("glEnable(GL_BLEND)");
glEnable(GL_LINE_SMOOTH);
checkGLcall("glEnable(GL_LINE_SMOOTH)");
} else {
glDisable(GL_BLEND);
checkGLcall("glDisable(GL_BLEND)");
glDisable(GL_LINE_SMOOTH);
checkGLcall("glDisable(GL_LINE_SMOOTH)");
}
break;
}
case WINED3DRS_DEPTHBIAS :
{
if(Value) {
tmpvalue.d = Value;
glEnable(GL_POLYGON_OFFSET_FILL);
checkGLcall("glEnable(GL_POLYGON_OFFSET_FILL)");
glPolygonOffset(*((float*)&This->stateBlock->renderState[WINED3DRS_SLOPESCALEDEPTHBIAS]), tmpvalue.f);
checkGLcall("glPolygonOffset(...)");
} else {
glDisable(GL_POLYGON_OFFSET_FILL);
checkGLcall("glDisable(GL_POLYGON_OFFSET_FILL)");
}
break;
}
case WINED3DRS_TEXTUREPERSPECTIVE :
{
if (Value)

View File

@ -1125,6 +1125,25 @@ static void state_scissor(DWORD state, IWineD3DStateBlockImpl *stateblock) {
}
}
static void state_depthbias(DWORD state, IWineD3DStateBlockImpl *stateblock) {
union {
DWORD d;
float f;
} tmpvalue;
if(stateblock->renderState[WINED3DRS_SLOPESCALEDEPTHBIAS] ||
stateblock->renderState[WINED3DRS_DEPTHBIAS]) {
tmpvalue.d = stateblock->renderState[WINED3DRS_SLOPESCALEDEPTHBIAS];
glEnable(GL_POLYGON_OFFSET_FILL);
checkGLcall("glEnable(GL_POLYGON_OFFSET_FILL)");
glPolygonOffset(tmpvalue.f, *((float*)&stateblock->renderState[WINED3DRS_DEPTHBIAS]));
checkGLcall("glPolygonOffset(...)");
} else {
glDisable(GL_POLYGON_OFFSET_FILL);
checkGLcall("glDisable(GL_POLYGON_OFFSET_FILL)");
}
}
const struct StateEntry StateTable[] =
{
/* State name representative, apply function */
@ -1307,7 +1326,7 @@ const struct StateEntry StateTable[] =
/*172, WINED3DRS_POSITIONORDER */ /* Value assigned to 2 state names */
/*173, WINED3DRS_NORMALORDER */ /* Value assigned to 2 state names */
{ /*174, WINED3DRS_SCISSORTESTENABLE */ STATE_RENDER(WINED3DRS_SCISSORTESTENABLE), state_scissor },
{ /*175, WINED3DRS_SLOPESCALEDEPTHBIAS */ STATE_RENDER(WINED3DRS_DEPTHBIAS), state_unknown },
{ /*175, WINED3DRS_SLOPESCALEDEPTHBIAS */ STATE_RENDER(WINED3DRS_DEPTHBIAS), state_depthbias },
{ /*176, WINED3DRS_ANTIALIASEDLINEENABLE */ STATE_RENDER(WINED3DRS_ALPHABLENDENABLE), state_blend },
{ /*177, undefined */ 0, state_undefined },
{ /*178, WINED3DRS_MINTESSELLATIONLEVEL */ STATE_RENDER(WINED3DRS_ENABLEADAPTIVETESSELLATION), state_unknown },
@ -1327,7 +1346,7 @@ const struct StateEntry StateTable[] =
{ /*192, WINED3DRS_COLORWRITEENABLE3 */ STATE_RENDER(WINED3DRS_COLORWRITEENABLE), state_colorwrite },
{ /*193, WINED3DRS_BLENDFACTOR */ STATE_RENDER(WINED3DRS_ALPHABLENDENABLE), state_blend },
{ /*194, WINED3DRS_SRGBWRITEENABLE */ 0, state_nogl },
{ /*195, WINED3DRS_DEPTHBIAS */ STATE_RENDER(WINED3DRS_DEPTHBIAS), state_unknown },
{ /*195, WINED3DRS_DEPTHBIAS */ STATE_RENDER(WINED3DRS_DEPTHBIAS), state_depthbias },
{ /*196, undefined */ 0, state_undefined },
{ /*197, undefined */ 0, state_undefined },
{ /*198, WINED3DRS_WRAP8 */ STATE_RENDER(WINED3DRS_WRAP0), state_wrap },