Commit 937eb7e6 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Move the scissor rect to wined3d_state.

parent 1ef4f075
...@@ -567,7 +567,7 @@ void device_get_draw_rect(IWineD3DDeviceImpl *device, RECT *rect) ...@@ -567,7 +567,7 @@ void device_get_draw_rect(IWineD3DDeviceImpl *device, RECT *rect)
if (stateblock->state.render_states[WINED3DRS_SCISSORTESTENABLE]) if (stateblock->state.render_states[WINED3DRS_SCISSORTESTENABLE])
{ {
IntersectRect(rect, rect, &stateblock->scissorRect); IntersectRect(rect, rect, &stateblock->state.scissor_rect);
} }
} }
...@@ -3138,11 +3138,12 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetScissorRect(IWineD3DDevice *iface, C ...@@ -3138,11 +3138,12 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetScissorRect(IWineD3DDevice *iface, C
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
This->updateStateBlock->changed.scissorRect = TRUE; This->updateStateBlock->changed.scissorRect = TRUE;
if(EqualRect(&This->updateStateBlock->scissorRect, pRect)) { if (EqualRect(&This->updateStateBlock->state.scissor_rect, pRect))
TRACE("App is setting the old scissor rectangle over, nothing to do\n"); {
TRACE("App is setting the old scissor rectangle over, nothing to do.\n");
return WINED3D_OK; return WINED3D_OK;
} }
CopyRect(&This->updateStateBlock->scissorRect, pRect); CopyRect(&This->updateStateBlock->state.scissor_rect, pRect);
if(This->isRecordingState) { if(This->isRecordingState) {
TRACE("Recording... not performing anything\n"); TRACE("Recording... not performing anything\n");
...@@ -3157,7 +3158,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetScissorRect(IWineD3DDevice *iface, C ...@@ -3157,7 +3158,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetScissorRect(IWineD3DDevice *iface, C
static HRESULT WINAPI IWineD3DDeviceImpl_GetScissorRect(IWineD3DDevice *iface, RECT* pRect) { static HRESULT WINAPI IWineD3DDeviceImpl_GetScissorRect(IWineD3DDevice *iface, RECT* pRect) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
*pRect = This->updateStateBlock->scissorRect; *pRect = This->updateStateBlock->state.scissor_rect;
TRACE("(%p)Returning a Scissor Rect of %d:%d-%d:%d\n", This, pRect->left, pRect->top, pRect->right, pRect->bottom); TRACE("(%p)Returning a Scissor Rect of %d:%d-%d:%d\n", This, pRect->left, pRect->top, pRect->right, pRect->bottom);
return WINED3D_OK; return WINED3D_OK;
} }
...@@ -5759,10 +5760,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetRenderTarget(IWineD3DDevice *iface, ...@@ -5759,10 +5760,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetRenderTarget(IWineD3DDevice *iface,
device->stateBlock->viewport.MinZ = 0.0f; device->stateBlock->viewport.MinZ = 0.0f;
IWineD3DDeviceImpl_MarkStateDirty(device, STATE_VIEWPORT); IWineD3DDeviceImpl_MarkStateDirty(device, STATE_VIEWPORT);
device->stateBlock->scissorRect.top = 0; device->stateBlock->state.scissor_rect.top = 0;
device->stateBlock->scissorRect.left = 0; device->stateBlock->state.scissor_rect.left = 0;
device->stateBlock->scissorRect.right = device->stateBlock->viewport.Width; device->stateBlock->state.scissor_rect.right = device->stateBlock->viewport.Width;
device->stateBlock->scissorRect.bottom = device->stateBlock->viewport.Height; device->stateBlock->state.scissor_rect.bottom = device->stateBlock->viewport.Height;
IWineD3DDeviceImpl_MarkStateDirty(device, STATE_SCISSORRECT); IWineD3DDeviceImpl_MarkStateDirty(device, STATE_SCISSORRECT);
} }
......
...@@ -4880,7 +4880,7 @@ static void light(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3 ...@@ -4880,7 +4880,7 @@ static void light(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3
static void scissorrect(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) static void scissorrect(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context)
{ {
IWineD3DSurfaceImpl *target = stateblock->device->render_targets[0]; IWineD3DSurfaceImpl *target = stateblock->device->render_targets[0];
RECT *pRect = &stateblock->scissorRect; RECT *pRect = &stateblock->state.scissor_rect;
UINT height; UINT height;
UINT width; UINT width;
......
...@@ -755,12 +755,12 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface) ...@@ -755,12 +755,12 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
This->viewport = targetStateBlock->viewport; This->viewport = targetStateBlock->viewport;
} }
if(This->changed.scissorRect if (This->changed.scissorRect && memcmp(&targetStateBlock->state.scissor_rect,
&& memcmp(&targetStateBlock->scissorRect, &This->scissorRect, sizeof(This->scissorRect))) &This->state.scissor_rect, sizeof(This->state.scissor_rect)))
{ {
TRACE("Updating scissor rect.\n"); TRACE("Updating scissor rect.\n");
This->scissorRect = targetStateBlock->scissorRect; This->state.scissor_rect = targetStateBlock->state.scissor_rect;
} }
map = This->changed.streamSource; map = This->changed.streamSource;
...@@ -1000,7 +1000,7 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Apply(IWineD3DStateBlock *iface) ...@@ -1000,7 +1000,7 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Apply(IWineD3DStateBlock *iface)
if (This->changed.scissorRect) if (This->changed.scissorRect)
{ {
IWineD3DDevice_SetScissorRect(device, &This->scissorRect); IWineD3DDevice_SetScissorRect(device, &This->state.scissor_rect);
} }
map = This->changed.streamSource; map = This->changed.streamSource;
......
...@@ -2349,6 +2349,8 @@ struct wined3d_stream_state ...@@ -2349,6 +2349,8 @@ struct wined3d_stream_state
struct wined3d_state struct wined3d_state
{ {
RECT scissor_rect;
DWORD render_states[WINEHIGHEST_RENDER_STATE + 1]; DWORD render_states[WINEHIGHEST_RENDER_STATE + 1];
}; };
...@@ -2425,9 +2427,6 @@ struct IWineD3DStateBlockImpl ...@@ -2425,9 +2427,6 @@ struct IWineD3DStateBlockImpl
/* Sampler States */ /* Sampler States */
DWORD samplerState[MAX_COMBINED_SAMPLERS][WINED3D_HIGHEST_SAMPLER_STATE + 1]; DWORD samplerState[MAX_COMBINED_SAMPLERS][WINED3D_HIGHEST_SAMPLER_STATE + 1];
/* Scissor test rectangle */
RECT scissorRect;
/* Contained state management */ /* Contained state management */
DWORD contained_render_states[WINEHIGHEST_RENDER_STATE + 1]; DWORD contained_render_states[WINEHIGHEST_RENDER_STATE + 1];
unsigned int num_contained_render_states; unsigned int num_contained_render_states;
......
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