wined3d: Move clip plane state to wined3d_state.

This commit is contained in:
Henri Verbeet 2010-09-21 21:20:55 +02:00 committed by Alexandre Julliard
parent 4546a13d98
commit 9ce3c61a41
4 changed files with 27 additions and 24 deletions

View file

@ -2808,18 +2808,19 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetClipPlane(IWineD3DDevice *iface, DWO
This->updateStateBlock->changed.clipplane |= 1 << Index;
if(This->updateStateBlock->clipplane[Index][0] == pPlane[0] &&
This->updateStateBlock->clipplane[Index][1] == pPlane[1] &&
This->updateStateBlock->clipplane[Index][2] == pPlane[2] &&
This->updateStateBlock->clipplane[Index][3] == pPlane[3]) {
if (This->updateStateBlock->state.clip_planes[Index][0] == pPlane[0]
&& This->updateStateBlock->state.clip_planes[Index][1] == pPlane[1]
&& This->updateStateBlock->state.clip_planes[Index][2] == pPlane[2]
&& This->updateStateBlock->state.clip_planes[Index][3] == pPlane[3])
{
TRACE("Application is setting old values over, nothing to do\n");
return WINED3D_OK;
}
This->updateStateBlock->clipplane[Index][0] = pPlane[0];
This->updateStateBlock->clipplane[Index][1] = pPlane[1];
This->updateStateBlock->clipplane[Index][2] = pPlane[2];
This->updateStateBlock->clipplane[Index][3] = pPlane[3];
This->updateStateBlock->state.clip_planes[Index][0] = pPlane[0];
This->updateStateBlock->state.clip_planes[Index][1] = pPlane[1];
This->updateStateBlock->state.clip_planes[Index][2] = pPlane[2];
This->updateStateBlock->state.clip_planes[Index][3] = pPlane[3];
/* Handle recording of state blocks */
if (This->isRecordingState) {
@ -2843,10 +2844,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetClipPlane(IWineD3DDevice *iface, DWO
return WINED3DERR_INVALIDCALL;
}
pPlane[0] = (float) This->stateBlock->clipplane[Index][0];
pPlane[1] = (float) This->stateBlock->clipplane[Index][1];
pPlane[2] = (float) This->stateBlock->clipplane[Index][2];
pPlane[3] = (float) This->stateBlock->clipplane[Index][3];
pPlane[0] = (float)This->stateBlock->state.clip_planes[Index][0];
pPlane[1] = (float)This->stateBlock->state.clip_planes[Index][1];
pPlane[2] = (float)This->stateBlock->state.clip_planes[Index][2];
pPlane[3] = (float)This->stateBlock->state.clip_planes[Index][3];
return WINED3D_OK;
}

View file

@ -3809,11 +3809,11 @@ static void clipplane(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wi
}
TRACE("Clipplane [%f,%f,%f,%f]\n",
stateblock->clipplane[index][0],
stateblock->clipplane[index][1],
stateblock->clipplane[index][2],
stateblock->clipplane[index][3]);
glClipPlane(GL_CLIP_PLANE0 + index, stateblock->clipplane[index]);
stateblock->state.clip_planes[index][0],
stateblock->state.clip_planes[index][1],
stateblock->state.clip_planes[index][2],
stateblock->state.clip_planes[index][3]);
glClipPlane(GL_CLIP_PLANE0 + index, stateblock->state.clip_planes[index]);
checkGLcall("glClipPlane");
glPopMatrix();

View file

@ -818,10 +818,12 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
{
if (!(map & 1)) continue;
if (memcmp(targetStateBlock->clipplane[i], This->clipplane[i], sizeof(*This->clipplane)))
if (memcmp(targetStateBlock->state.clip_planes[i],
This->state.clip_planes[i], sizeof(*This->state.clip_planes)))
{
TRACE("Updating clipplane %u.\n", i);
memcpy(This->clipplane[i], targetStateBlock->clipplane[i], sizeof(*This->clipplane));
memcpy(This->state.clip_planes[i],
targetStateBlock->state.clip_planes[i], sizeof(*This->state.clip_planes));
}
}
@ -1061,10 +1063,10 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Apply(IWineD3DStateBlock *iface)
if (!(map & 1)) continue;
clip[0] = This->clipplane[i][0];
clip[1] = This->clipplane[i][1];
clip[2] = This->clipplane[i][2];
clip[3] = This->clipplane[i][3];
clip[0] = This->state.clip_planes[i][0];
clip[1] = This->state.clip_planes[i][1];
clip[2] = This->state.clip_planes[i][2];
clip[3] = This->state.clip_planes[i][3];
IWineD3DDevice_SetClipPlane(device, i, clip);
}

View file

@ -2374,6 +2374,7 @@ struct wined3d_state
DWORD lowest_disabled_stage;
WINED3DMATRIX transforms[HIGHEST_TRANSFORMSTATE + 1];
double clip_planes[MAX_CLIPPLANES][4];
WINED3DMATERIAL material;
WINED3DVIEWPORT viewport;
RECT scissor_rect;
@ -2402,7 +2403,6 @@ struct IWineD3DStateBlockImpl
struct wined3d_state state;
/* Clipping */
double clipplane[MAX_CLIPPLANES][4];
WINED3DCLIPSTATUS clip_status;
/* Contained state management */