Module: wine Branch: master Commit: 16d9c91b97745916eb3afc10f15f20681394fe62 URL: http://source.winehq.org/git/wine.git/?a=commit;h=16d9c91b97745916eb3afc10f1...
Author: Henri Verbeet hverbeet@codeweavers.com Date: Wed Sep 15 12:00:06 2010 +0200
wined3d: Move the viewport to wined3d_state.
---
dlls/wined3d/device.c | 22 +++++++++++----------- dlls/wined3d/state.c | 22 +++++++++++----------- dlls/wined3d/stateblock.c | 8 ++++---- dlls/wined3d/wined3d_private.h | 4 +--- 4 files changed, 27 insertions(+), 29 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 3bf1eac..15df5ab 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -561,7 +561,7 @@ void device_context_remove(IWineD3DDeviceImpl *device, struct wined3d_context *c void device_get_draw_rect(IWineD3DDeviceImpl *device, RECT *rect) { IWineD3DStateBlockImpl *stateblock = device->stateBlock; - WINED3DVIEWPORT *vp = &stateblock->viewport; + WINED3DVIEWPORT *vp = &stateblock->state.viewport;
SetRect(rect, vp->X, vp->Y, vp->X + vp->Width, vp->Y + vp->Height);
@@ -2998,7 +2998,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetViewport(IWineD3DDevice *iface, CONS
TRACE("(%p)\n", This); This->updateStateBlock->changed.viewport = TRUE; - This->updateStateBlock->viewport = *pViewport; + This->updateStateBlock->state.viewport = *pViewport;
/* Handle recording of state blocks */ if (This->isRecordingState) { @@ -3017,7 +3017,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetViewport(IWineD3DDevice *iface, CONS static HRESULT WINAPI IWineD3DDeviceImpl_GetViewport(IWineD3DDevice *iface, WINED3DVIEWPORT* pViewport) { IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; TRACE("(%p)\n", This); - *pViewport = This->stateBlock->viewport; + *pViewport = This->stateBlock->state.viewport; return WINED3D_OK; }
@@ -5752,18 +5752,18 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetRenderTarget(IWineD3DDevice *iface, /* Set the viewport and scissor rectangles, if requested. Tests show * that stateblock recording is ignored, the change goes directly * into the primary stateblock. */ - device->stateBlock->viewport.Height = device->render_targets[0]->currentDesc.Height; - device->stateBlock->viewport.Width = device->render_targets[0]->currentDesc.Width; - device->stateBlock->viewport.X = 0; - device->stateBlock->viewport.Y = 0; - device->stateBlock->viewport.MaxZ = 1.0f; - device->stateBlock->viewport.MinZ = 0.0f; + device->stateBlock->state.viewport.Height = device->render_targets[0]->currentDesc.Height; + device->stateBlock->state.viewport.Width = device->render_targets[0]->currentDesc.Width; + device->stateBlock->state.viewport.X = 0; + device->stateBlock->state.viewport.Y = 0; + device->stateBlock->state.viewport.MaxZ = 1.0f; + device->stateBlock->state.viewport.MinZ = 0.0f; IWineD3DDeviceImpl_MarkStateDirty(device, STATE_VIEWPORT);
device->stateBlock->state.scissor_rect.top = 0; device->stateBlock->state.scissor_rect.left = 0; - device->stateBlock->state.scissor_rect.right = device->stateBlock->viewport.Width; - device->stateBlock->state.scissor_rect.bottom = device->stateBlock->viewport.Height; + device->stateBlock->state.scissor_rect.right = device->stateBlock->state.viewport.Width; + device->stateBlock->state.scissor_rect.bottom = device->stateBlock->state.viewport.Height; IWineD3DDeviceImpl_MarkStateDirty(device, STATE_SCISSORRECT); }
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index ebd89b3..50447b8 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -1516,7 +1516,7 @@ static void state_pscale(DWORD state, IWineD3DStateBlockImpl *stateblock, struct if (stateblock->state.render_states[WINED3DRS_POINTSCALEENABLE]) { GLfloat scaleFactor; - DWORD h = stateblock->viewport.Height; + DWORD h = stateblock->state.viewport.Height;
if (pointSize.f < gl_info->limits.pointsize_min) { @@ -3943,10 +3943,10 @@ static void transform_projection(DWORD state, IWineD3DStateBlockImpl *stateblock
if (context->last_was_rhw) { - double x = stateblock->viewport.X; - double y = stateblock->viewport.Y; - double w = stateblock->viewport.Width; - double h = stateblock->viewport.Height; + double x = stateblock->state.viewport.X; + double y = stateblock->state.viewport.Y; + double w = stateblock->state.viewport.Width; + double h = stateblock->state.viewport.Height;
TRACE("Calling glOrtho with x %.8e, y %.8e, w %.8e, h %.8e.\n", x, y, w, h); if (context->render_offscreen) @@ -4010,8 +4010,8 @@ static void transform_projection(DWORD state, IWineD3DStateBlockImpl *stateblock * filling convention. We want the difference to be large enough that * it doesn't get lost due to rounding inside the driver, but small * enough to prevent it from interfering with any anti-aliasing. */ - GLfloat xoffset = (63.0f / 64.0f) / stateblock->viewport.Width; - GLfloat yoffset = -(63.0f / 64.0f) / stateblock->viewport.Height; + GLfloat xoffset = (63.0f / 64.0f) / stateblock->state.viewport.Width; + GLfloat yoffset = -(63.0f / 64.0f) / stateblock->state.viewport.Height;
if (context->render_offscreen) { @@ -4597,7 +4597,7 @@ static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateblock, s */ if (useVertexShaderFunction) { - GLfloat yoffset = -(63.0f / 64.0f) / stateblock->viewport.Height; + GLfloat yoffset = -(63.0f / 64.0f) / stateblock->state.viewport.Height; device->posFixup[1] = context->render_offscreen ? -1.0f : 1.0f; device->posFixup[3] = device->posFixup[1] * yoffset; } @@ -4723,7 +4723,7 @@ static void viewport_miscpart(DWORD state, IWineD3DStateBlockImpl *stateblock, s { IWineD3DSurfaceImpl *target = stateblock->device->render_targets[0]; UINT width, height; - WINED3DVIEWPORT vp = stateblock->viewport; + WINED3DVIEWPORT vp = stateblock->state.viewport;
if(vp.Width > target->currentDesc.Width) vp.Width = target->currentDesc.Width; if(vp.Height > target->currentDesc.Height) vp.Height = target->currentDesc.Height; @@ -4748,9 +4748,9 @@ static void viewport_miscpart(DWORD state, IWineD3DStateBlockImpl *stateblock, s
static void viewport_vertexpart(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) { - GLfloat yoffset = -(63.0f / 64.0f) / stateblock->viewport.Height; + GLfloat yoffset = -(63.0f / 64.0f) / stateblock->state.viewport.Height;
- stateblock->device->posFixup[2] = (63.0f / 64.0f) / stateblock->viewport.Width; + stateblock->device->posFixup[2] = (63.0f / 64.0f) / stateblock->state.viewport.Width; stateblock->device->posFixup[3] = stateblock->device->posFixup[1] * yoffset;
if(!isStateDirty(context, STATE_TRANSFORM(WINED3DTS_PROJECTION))) { diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index 3f20ae5..5a6d58e 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -747,12 +747,12 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface) This->material = targetStateBlock->material; }
- if (This->changed.viewport - && memcmp(&targetStateBlock->viewport, &This->viewport, sizeof(This->viewport))) + if (This->changed.viewport && memcmp(&targetStateBlock->state.viewport, + &This->state.viewport, sizeof(This->state.viewport))) { TRACE("Updating viewport.\n");
- This->viewport = targetStateBlock->viewport; + This->state.viewport = targetStateBlock->state.viewport; }
if (This->changed.scissorRect && memcmp(&targetStateBlock->state.scissor_rect, @@ -995,7 +995,7 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Apply(IWineD3DStateBlock *iface)
if (This->changed.viewport) { - IWineD3DDevice_SetViewport(device, &This->viewport); + IWineD3DDevice_SetViewport(device, &This->state.viewport); }
if (This->changed.scissorRect) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index ed8ea55..49e741a 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2349,6 +2349,7 @@ struct wined3d_stream_state
struct wined3d_state { + WINED3DVIEWPORT viewport; RECT scissor_rect;
DWORD render_states[WINEHIGHEST_RENDER_STATE + 1]; @@ -2404,9 +2405,6 @@ struct IWineD3DStateBlockImpl double clipplane[MAX_CLIPPLANES][4]; WINED3DCLIPSTATUS clip_status;
- /* ViewPort */ - WINED3DVIEWPORT viewport; - /* Material */ WINED3DMATERIAL material;