wined3d: Move WINED3DRS_LINEPATTERN to the state table.

This commit is contained in:
Stefan Dösinger 2006-12-10 23:20:01 +01:00 committed by Alexandre Julliard
parent 81a1dce0cb
commit 6a5d7df74f
2 changed files with 22 additions and 23 deletions

View File

@ -3389,29 +3389,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetRenderState(IWineD3DDevice *iface, W
case WINED3DRS_SPECULARMATERIALSOURCE :
case WINED3DRS_AMBIENTMATERIALSOURCE :
case WINED3DRS_EMISSIVEMATERIALSOURCE :
StateTable[STATE_RENDER(State)].apply(STATE_RENDER(State), This->stateBlock);
break;
case WINED3DRS_LINEPATTERN :
{
union {
DWORD d;
WINED3DLINEPATTERN lp;
} tmppattern;
tmppattern.d = Value;
TRACE("Line pattern: repeat %d bits %x\n", tmppattern.lp.wRepeatFactor, tmppattern.lp.wLinePattern);
if (tmppattern.lp.wRepeatFactor) {
glLineStipple(tmppattern.lp.wRepeatFactor, tmppattern.lp.wLinePattern);
checkGLcall("glLineStipple(repeat, linepattern)");
glEnable(GL_LINE_STIPPLE);
checkGLcall("glEnable(GL_LINE_STIPPLE);");
} else {
glDisable(GL_LINE_STIPPLE);
checkGLcall("glDisable(GL_LINE_STIPPLE);");
}
}
StateTable[STATE_RENDER(State)].apply(STATE_RENDER(State), This->stateBlock);
break;
case WINED3DRS_ZBIAS : /* D3D8 only */

View File

@ -849,6 +849,26 @@ static void state_colormat(DWORD state, IWineD3DStateBlockImpl *stateblock) {
}
}
static void state_linepattern(DWORD state, IWineD3DStateBlockImpl *stateblock) {
union {
DWORD d;
WINED3DLINEPATTERN lp;
} tmppattern;
tmppattern.d = stateblock->renderState[WINED3DRS_LINEPATTERN];
TRACE("Line pattern: repeat %d bits %x\n", tmppattern.lp.wRepeatFactor, tmppattern.lp.wLinePattern);
if (tmppattern.lp.wRepeatFactor) {
glLineStipple(tmppattern.lp.wRepeatFactor, tmppattern.lp.wLinePattern);
checkGLcall("glLineStipple(repeat, linepattern)");
glEnable(GL_LINE_STIPPLE);
checkGLcall("glEnable(GL_LINE_STIPPLE);");
} else {
glDisable(GL_LINE_STIPPLE);
checkGLcall("glDisable(GL_LINE_STIPPLE);");
}
}
const struct StateEntry StateTable[] =
{
/* State name representative, apply function */
@ -862,7 +882,7 @@ const struct StateEntry StateTable[] =
{ /* 7, WINED3DRS_ZENABLE */ STATE_RENDER(WINED3DRS_ZENABLE), state_zenable },
{ /* 8, WINED3DRS_FILLMODE */ STATE_RENDER(WINED3DRS_FILLMODE), state_fillmode },
{ /* 9, WINED3DRS_SHADEMODE */ STATE_RENDER(WINED3DRS_SHADEMODE), state_shademode },
{ /* 10, WINED3DRS_LINEPATTERN */ STATE_RENDER(WINED3DRS_LINEPATTERN), state_unknown },
{ /* 10, WINED3DRS_LINEPATTERN */ STATE_RENDER(WINED3DRS_LINEPATTERN), state_linepattern },
{ /* 11, WINED3DRS_MONOENABLE */ STATE_RENDER(WINED3DRS_MONOENABLE), state_unknown },
{ /* 12, WINED3DRS_ROP2 */ STATE_RENDER(WINED3DRS_ROP2), state_unknown },
{ /* 13, WINED3DRS_PLANEMASK */ STATE_RENDER(WINED3DRS_PLANEMASK), state_unknown },