Commit 27132a30 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Construct the non-rhw projection matrix directly in transform_projection().

parent 6e7f33a7
...@@ -3930,39 +3930,21 @@ static void transform_projection(struct wined3d_context *context, const struct w ...@@ -3930,39 +3930,21 @@ static void transform_projection(struct wined3d_context *context, const struct w
} }
else else
{ {
/* double y_scale = context->render_offscreen ? -1.0 : 1.0;
* Careful with the order of operations here, we're essentially working backwards: double x_offset = (63.0 / 64.0) / state->viewport.Width;
* x = x + 1/w; double y_offset = context->render_offscreen
* y = (y - 1/h) * flip; ? (63.0 / 64.0) / state->viewport.Height
* z = z * 2 - 1; : -(63.0 / 64.0) / state->viewport.Height;
* const GLdouble projection[] =
* Becomes:
* glTranslatef(0.0, 0.0, -1.0);
* glScalef(1.0, 1.0, 2.0);
*
* glScalef(1.0, flip, 1.0);
* glTranslatef(1/w, -1/h, 0.0);
*
* This is equivalent to:
* glTranslatef(1/w, -flip/h, -1.0)
* glScalef(1.0, flip, 2.0);
*/
GLfloat xoffset = (63.0f / 64.0f) / state->viewport.Width;
GLfloat yoffset = -(63.0f / 64.0f) / state->viewport.Height;
glLoadIdentity();
checkGLcall("glLoadIdentity");
if (context->render_offscreen)
{ {
glTranslatef(xoffset, -yoffset, -1.0f); 1.0, 0.0, 0.0, 0.0,
checkGLcall("glTranslatef(xoffset, -yoffset, -1.0f)"); 0.0, y_scale, 0.0, 0.0,
glScalef(1.0f, -1.0f, 2.0f); 0.0, 0.0, 2.0, 0.0,
} else { x_offset, y_offset, -1.0, 1.0,
glTranslatef(xoffset, yoffset, -1.0f); };
checkGLcall("glTranslatef(xoffset, yoffset, -1.0f)");
glScalef(1.0f, 1.0f, 2.0f); glLoadMatrixd(projection);
} checkGLcall("glLoadMatrixd");
checkGLcall("glScalef");
glMultMatrixf(&state->transforms[WINED3DTS_PROJECTION].u.m[0][0]); glMultMatrixf(&state->transforms[WINED3DTS_PROJECTION].u.m[0][0]);
checkGLcall("glLoadMatrixf"); checkGLcall("glLoadMatrixf");
......
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