Module: wine
Branch: master
Commit: 2cdced8193fbf4693298f84d6a121d4ce4607fd5
URL: http://source.winehq.org/git/wine.git/?a=commit;h=2cdced8193fbf4693298f84d6…
Author: Stefan Dösinger <stefan(a)codeweavers.com>
Date: Sat Mar 3 02:35:17 2007 +0100
wined3d: Adjust the rhw transformation for offscreen rendering.
When drawing processed vertices with the fixed function pipeline the
projection matrix is set up to map y values from 0 to height to 1.0;
-1.0(gl and d3d coord systems are flipped). This moves the y axis to
the bottom of the drawing area. When later on the y inversion matrix
is applied for offscreen rendering, the coordinate system will get
flipped out of the viewport.
This patch sets the Y range up upside down when using offscreen
rendering, so the invymat will flip it to the correct position. This
has to happen before the 0.375 pixel correction.
---
dlls/wined3d/state.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 64bce1c..ba421a1 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -2154,7 +2154,11 @@ static void transform_projection(DWORD state, IWineD3DStateBlockImpl *stateblock
* the Z coordinate does not affect the size of the primitives
*/
TRACE("Calling glOrtho with %f, %f, %f, %f\n", width, height, -minZ, -maxZ);
- glOrtho(X, X + width, Y + height, Y, -minZ, -maxZ);
+ if(stateblock->wineD3DDevice->render_offscreen) {
+ glOrtho(X, X + width, Y, Y - height, -minZ, -maxZ);
+ } else {
+ glOrtho(X, X + width, Y + height, Y, -minZ, -maxZ);
+ }
} else {
/* If the app mixes transformed and untransformed primitives we can't use the coordinate system
* trick above because this would mess up transformed and untransformed Z order. Pass the z position
@@ -2164,7 +2168,11 @@ static void transform_projection(DWORD state, IWineD3DStateBlockImpl *stateblock
* replacement shader.
*/
TRACE("Calling glOrtho with %f, %f, %f, %f\n", width, height, 1.0, -1.0);
- glOrtho(X, X + width, Y + height, Y, 1.0, -1.0);
+ if(stateblock->wineD3DDevice->render_offscreen) {
+ glOrtho(X, X + width, Y, Y - height, 1.0, -1.0);
+ } else {
+ glOrtho(X, X + width, Y + height, Y, 1.0, -1.0);
+ }
}
checkGLcall("glOrtho");
Module: wine
Branch: master
Commit: 7126b63645747fe035aaa1167f0dcda8cb38be01
URL: http://source.winehq.org/git/wine.git/?a=commit;h=7126b63645747fe035aaa1167…
Author: Stefan Dösinger <stefan(a)codeweavers.com>
Date: Fri Mar 2 09:25:02 2007 +0100
wined3d: Use the scissor test when clearing the full surface too.
It was incorrect to disable the scissor test for full surfaces in my
clear patch. With back buffer offscreen rendering the viewport does
not seem to restrict clearing, and with different sizes of depth
stencil and color buffer the final fantasy XI demo seems to expect the
clear to be restricted.
---
dlls/wined3d/device.c | 27 +++++++++++++++++++--------
1 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 0ad2c47..af28e96 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4138,14 +4138,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Clear(IWineD3DDevice *iface, DWORD Coun
ENTER_GL();
- if(pRects) {
- glEnable(GL_SCISSOR_TEST);
- checkGLcall("glEnable GL_SCISSOR_TEST");
- IWineD3DDeviceImpl_MarkStateDirty(This, STATE_SCISSORRECT);
- } else {
- glDisable(GL_SCISSOR_TEST);
- checkGLcall("glEnable GL_SCISSOR_TEST");
- }
+ glEnable(GL_SCISSOR_TEST);
+ checkGLcall("glEnable GL_SCISSOR_TEST");
+ IWineD3DDeviceImpl_MarkStateDirty(This, STATE_SCISSORRECT);
IWineD3DDeviceImpl_MarkStateDirty(This, STATE_RENDER(WINED3DRS_SCISSORTESTENABLE));
if (Count > 0 && pRects) {
@@ -4184,6 +4179,12 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Clear(IWineD3DDevice *iface, DWORD Coun
}
if (!curRect) {
+ glScissor(This->stateBlock->viewport.X,
+ (((IWineD3DSurfaceImpl *)This->render_targets[0])->currentDesc.Height -
+ (This->stateBlock->viewport.Y + This->stateBlock->viewport.Height)),
+ This->stateBlock->viewport.Width,
+ This->stateBlock->viewport.Height);
+ checkGLcall("glScissor");
glClear(glMask);
checkGLcall("glClear");
} else {
@@ -5246,10 +5247,20 @@ static void WINAPI IWineD3DDeviceImpl_SetCursorPosition(IWineD3DDevice* ifa
static BOOL WINAPI IWineD3DDeviceImpl_ShowCursor(IWineD3DDevice* iface, BOOL bShow) {
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
BOOL oldVisible = This->bCursorVisible;
+ POINT pt;
+
TRACE("(%p) : visible(%d)\n", This, bShow);
if(This->cursorTexture)
This->bCursorVisible = bShow;
+ /*
+ * When ShowCursor is first called it should make the cursor appear at the OS's last
+ * known cursor position. Because of this, some applications just repetitively call
+ * ShowCursor in order to update the cursor's position. This behavior is undocumented.
+ */
+ GetCursorPos(&pt);
+ This->xScreenSpace = pt.x;
+ This->yScreenSpace = pt.y;
return oldVisible;
}