Stefan Dösinger : wined3d: Adjust the rhw transformation for offscreen rendering.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Mar 5 13:10:22 CST 2007
Module: wine
Branch: master
Commit: 2cdced8193fbf4693298f84d6a121d4ce4607fd5
URL: http://source.winehq.org/git/wine.git/?a=commit;h=2cdced8193fbf4693298f84d6a121d4ce4607fd5
Author: Stefan Dösinger <stefan at 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");
More information about the wine-cvs
mailing list