diff --git a/dlls/ddraw/executebuffer.c b/dlls/ddraw/executebuffer.c index fb52ffd3179..3becf583935 100644 --- a/dlls/ddraw/executebuffer.c +++ b/dlls/ddraw/executebuffer.c @@ -56,10 +56,11 @@ static void transform_vertex(D3DTLVERTEX *dst, const D3DMATRIX *mat, dst->u3.sz = (x * mat->_13) + (y * mat->_23) + (z * mat->_33) + mat->_43; dst->u4.rhw = (x * mat->_14) + (y * mat->_24) + (z * mat->_34) + mat->_44; - dst->u1.sx = dst->u1.sx / dst->u4.rhw * vp->dvScaleX + vp->dwX + vp->dwWidth / 2; - dst->u2.sy = -dst->u2.sy / dst->u4.rhw * vp->dvScaleY + vp->dwY + vp->dwHeight / 2; - dst->u3.sz /= dst->u4.rhw; dst->u4.rhw = 1.0f / dst->u4.rhw; + + dst->u1.sx = (dst->u1.sx * dst->u4.rhw + 1.0f) * vp->dwWidth * 0.5 + vp->dwX; + dst->u2.sy = (-dst->u2.sy * dst->u4.rhw + 1.0f) * vp->dwHeight * 0.5 + vp->dwY; + dst->u3.sz *= dst->u4.rhw; } HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer, @@ -203,7 +204,7 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer, device->view = ci->u2.dwArg[0]; if (ci->u1.dtstTransformStateType == D3DTRANSFORMSTATE_PROJECTION) device->proj = ci->u2.dwArg[0]; - IDirect3DDevice7_SetTransform(&device->IDirect3DDevice7_iface, + IDirect3DDevice3_SetTransform(&device->IDirect3DDevice3_iface, ci->u1.dtstTransformStateType, m); } @@ -247,8 +248,8 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer, TRACE("PROCESSVERTICES (%d)\n", count); - /* Get the transform and world matrix */ - /* Note: D3DMATRIX is compatible with struct wined3d_matrix. */ + /* Note that the projection set in wined3d has the legacy clip space + * adjustment built in. */ wined3d_device_get_transform(device->wined3d_device, D3DTRANSFORMSTATE_VIEW, (struct wined3d_matrix *)&view_mat); wined3d_device_get_transform(device->wined3d_device, diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 207ee59cfb0..7824a926f84 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -9552,7 +9552,7 @@ static void test_transform_vertices(void) {143.0f, 118.0f, 1.0f, 1.0f}, {133.0f, 128.0f, -1.0f, 1.0f}, {133.0f, 128.0f, 0.0f, 1.0f} }; - todo_wine ok(compare_vec4(&cmp[i], out[i].x, out[i].y, out[i].z, out[i].w, 4096), + ok(compare_vec4(&cmp[i], out[i].x, out[i].y, out[i].z, out[i].w, 4096), "Vertex %u differs. Got %f %f %f %f.\n", i, out[i].x, out[i].y, out[i].z, out[i].w); } @@ -9657,10 +9657,10 @@ static void test_transform_vertices(void) color = get_surface_color(rt, 128, 147); ok(compare_color(color, 0x000000ff, 1), "Got unexpected color 0x%08x.\n", color); color = get_surface_color(rt, 132, 147); - todo_wine ok(compare_color(color, 0x00ff0000, 1), "Got unexpected color 0x%08x.\n", color); + ok(compare_color(color, 0x00ff0000, 1), "Got unexpected color 0x%08x.\n", color); color = get_surface_color(rt, 177, 217); - todo_wine ok(compare_color(color, 0x00ff0000, 1), "Got unexpected color 0x%08x.\n", color); + ok(compare_color(color, 0x00ff0000, 1), "Got unexpected color 0x%08x.\n", color); color = get_surface_color(rt, 181, 217); ok(compare_color(color, 0x000000ff, 1), "Got unexpected color 0x%08x.\n", color); color = get_surface_color(rt, 177, 221);