Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- Inspired by a patch by Rafał Mużyło.
I'm surprised that this didn't come up earlier.
dlls/d3dx9_36/effect.c | 5 +++-- dlls/d3dx9_36/tests/effect.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c index a909d66a92f..94f7b072117 100644 --- a/dlls/d3dx9_36/effect.c +++ b/dlls/d3dx9_36/effect.c @@ -4202,7 +4202,7 @@ static HRESULT WINAPI ID3DXEffectImpl_Begin(ID3DXEffect *iface, UINT *passes, DW
TRACE("iface %p, passes %p, flags %#x.\n", iface, passes, flags);
- if (passes && technique) + if (technique) { if (flags & ~(D3DXFX_DONOTSAVESTATE | D3DXFX_DONOTSAVESAMPLERSTATE | D3DXFX_DONOTSAVESHADERSTATE)) WARN("Invalid flags (%#x) specified.\n", flags); @@ -4234,7 +4234,8 @@ static HRESULT WINAPI ID3DXEffectImpl_Begin(ID3DXEffect *iface, UINT *passes, DW ERR("StateBlock Capture failed, hr %#x.\n", hr); }
- *passes = technique->pass_count; + if (passes) + *passes = technique->pass_count; effect->started = TRUE; effect->begin_flags = flags;
diff --git a/dlls/d3dx9_36/tests/effect.c b/dlls/d3dx9_36/tests/effect.c index 9a8a9b65fbc..a75b67c7f62 100644 --- a/dlls/d3dx9_36/tests/effect.c +++ b/dlls/d3dx9_36/tests/effect.c @@ -3081,7 +3081,7 @@ static void test_effect_states(IDirect3DDevice9 *device) ok(!bval, "Got result %u, expected 0.\n", bval);
hr = IDirect3DDevice9_SetTransform(device, D3DTS_WORLDMATRIX(1), &test_mat); - hr = effect->lpVtbl->Begin(effect, &npasses, 0); + hr = effect->lpVtbl->Begin(effect, NULL, 0); ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
hr = IDirect3DDevice9_GetTransform(device, D3DTS_WORLDMATRIX(1), &mat);
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- It shouldn't make any real difference in practice, since viewport_count should never be more than 1 in the stateblock anyway. Actually, I'm adding an assert to enforce the invariant.
dlls/wined3d/stateblock.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index 23a615fc08d..4ad0331f94b 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -810,9 +810,12 @@ void CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock) stateblock->state.material = src_state->material; }
+ assert(src_state->viewport_count <= 1); + if (stateblock->changed.viewport && (src_state->viewport_count != stateblock->state.viewport_count - || memcmp(src_state->viewports, stateblock->state.viewports, src_state->viewport_count * sizeof(stateblock->state.viewports)))) + || memcmp(src_state->viewports, stateblock->state.viewports, + src_state->viewport_count * sizeof(*stateblock->state.viewports)))) { TRACE("Updating viewports.\n");
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- We need an explicit enable in GLSL < 4.10.
dlls/wined3d/glsl_shader.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 7f1e66bc877..799b2ff1caf 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -7515,6 +7515,8 @@ static void shader_glsl_enable_extensions(struct wined3d_string_buffer *buffer, shader_addline(buffer, "#extension GL_ARB_texture_query_levels : enable\n"); if (gl_info->supported[ARB_UNIFORM_BUFFER_OBJECT]) shader_addline(buffer, "#extension GL_ARB_uniform_buffer_object : enable\n"); + if (gl_info->supported[ARB_VIEWPORT_ARRAY]) + shader_addline(buffer, "#extension GL_ARB_viewport_array : enable\n"); if (gl_info->supported[EXT_GPU_SHADER4]) shader_addline(buffer, "#extension GL_EXT_gpu_shader4 : enable\n"); if (gl_info->supported[EXT_TEXTURE_ARRAY])
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- v2: Use ARRAY_SIZE().
dlls/ddraw/tests/ddraw4.c | 241 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 235 insertions(+), 6 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index 00f981ecc13..9c4c5a3e5b2 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -266,6 +266,45 @@ static D3DCOLOR get_surface_color(IDirectDrawSurface4 *surface, UINT x, UINT y) return color; }
+static void check_rect(IDirectDrawSurface4 *surface, RECT r, const char *message) +{ + LONG x_coords[2][2] = + { + {r.left - 1, r.left + 1}, + {r.right + 1, r.right - 1}, + }; + LONG y_coords[2][2] = + { + {r.top - 1, r.top + 1}, + {r.bottom + 1, r.bottom - 1} + }; + unsigned int i, j, x_side, y_side; + DWORD color; + LONG x, y; + + for (i = 0; i < 2; ++i) + { + for (j = 0; j < 2; ++j) + { + for (x_side = 0; x_side < 2; ++x_side) + { + for (y_side = 0; y_side < 2; ++y_side) + { + DWORD expected = (x_side == 1 && y_side == 1) ? 0x00ffffff : 0x00000000; + + x = x_coords[i][x_side]; + y = y_coords[j][y_side]; + if (x < 0 || x >= 640 || y < 0 || y >= 480) + continue; + color = get_surface_color(surface, x, y); + ok(color == expected, "%s: Pixel (%d, %d) has color %08x, expected %08x\n", + message, x, y, color, expected); + } + } + } + } +} + static HRESULT CALLBACK enum_z_fmt(DDPIXELFORMAT *format, void *ctx) { DDPIXELFORMAT *z_fmt = ctx; @@ -365,7 +404,7 @@ static IDirect3DDevice3 *create_device(HWND window, DWORD coop_level) return NULL; }
- hr = IDirectDrawSurface_AddAttachedSurface(surface, ds); + hr = IDirectDrawSurface4_AddAttachedSurface(surface, ds); ok(SUCCEEDED(hr), "Failed to attach depth buffer, hr %#x.\n", hr); IDirectDrawSurface4_Release(ds); if (FAILED(hr)) @@ -1491,7 +1530,7 @@ static ULONG get_refcount(IUnknown *test_iface) return IUnknown_Release(test_iface); }
-static void test_viewport(void) +static void test_viewport_object(void) { IDirectDraw4 *ddraw; IDirect3D3 *d3d; @@ -12212,9 +12251,9 @@ static void test_edge_antialiasing_blending(void) ok(hr == D3D_OK, "Creating the offscreen render target failed, hr %#x.\n", hr);
ds = get_depth_stencil(device); - hr = IDirectDrawSurface_AddAttachedSurface(offscreen, ds); + hr = IDirectDrawSurface4_AddAttachedSurface(offscreen, ds); todo_wine ok(SUCCEEDED(hr), "Failed to attach depth buffer, hr %#x.\n", hr); - IDirectDrawSurface_Release(ds); + IDirectDrawSurface4_Release(ds);
hr = IDirect3DDevice3_SetRenderTarget(device, offscreen, 0); ok(SUCCEEDED(hr), "Failed to set render target, hr %#x.\n", hr); @@ -12333,7 +12372,7 @@ static void test_edge_antialiasing_blending(void) ok(compare_color(color, 0x00ff0000, 1), "Got unexpected color 0x%08x.\n", color);
IDirectDrawSurface4_Release(offscreen); - IDirectDraw3_Release(ddraw); + IDirectDraw4_Release(ddraw); destroy_viewport(device, viewport); refcount = IDirect3DDevice3_Release(device); ok(!refcount, "Device has %u references left.\n", refcount); @@ -14729,6 +14768,195 @@ static void test_enum_surfaces(void) IDirectDraw4_Release(ddraw); }
+static void test_viewport(void) +{ + static struct + { + D3DVIEWPORT7 vp; + RECT expected_rect; + const char *message; + } + tests[] = + { + {{ 0, 0, 640, 480}, { 0, 120, 479, 359}, "Viewport (0, 0) - (640, 480)"}, + {{ 0, 0, 320, 240}, { 0, 60, 239, 179}, "Viewport (0, 0) - (320, 240)"}, + {{ 0, 0, 1280, 960}, { 0, 240, 639, 479}, "Viewport (0, 0) - (1280, 960)"}, + {{ 0, 0, 2000, 1600}, { 0, 400, 639, 479}, "Viewport (0, 0) - (2000, 1600)"}, + {{100, 100, 640, 480}, {100, 220, 579, 459}, "Viewport (100, 100) - (640, 480)"}, + {{ 0, 0, 8192, 8192}, {-10, -10, -10, -10}, "Viewport (0, 0) - (8192, 8192)"}, + }; + static const struct vec2 rt_sizes[] = + { + {640, 480}, {1280, 960}, {320, 240}, {800, 600}, + }; + static D3DMATRIX mat = + { + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f, + }; + static struct vec3 quad[] = + { + {-1.5f, -0.5f, 0.1f}, + {-1.5f, 0.5f, 0.1f}, + { 0.5f, -0.5f, 0.1f}, + { 0.5f, 0.5f, 0.1f}, + }; + IDirect3DViewport3 *viewport, *full_viewport; + IDirectDrawSurface4 *rt, *ds; + DDSURFACEDESC2 surface_desc; + IDirect3DDevice3 *device; + BOOL expected_failure; + IDirectDraw4 *ddraw; + DDPIXELFORMAT z_fmt; + D3DRECT clear_rect; + unsigned int i, j; + IDirect3D3 *d3d; + D3DVIEWPORT2 vp; + ULONG refcount; + HWND window; + HRESULT hr; + + window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW | WS_VISIBLE, + 0, 0, 640, 480, 0, 0, 0, 0); + if (!(device = create_device(window, DDSCL_NORMAL))) + { + skip("Failed to create a 3D device, skipping test.\n"); + DestroyWindow(window); + return; + } + + hr = IDirect3DDevice3_GetDirect3D(device, &d3d); + ok(SUCCEEDED(hr), "Failed to get Direct3D3 interface, hr %#x.\n", hr); + hr = IDirect3D3_QueryInterface(d3d, &IID_IDirectDraw4, (void **)&ddraw); + ok(SUCCEEDED(hr), "Failed to get ddraw interface, hr %#x.\n", hr); + + hr = IDirect3DDevice3_SetRenderState(device, D3DRENDERSTATE_ZENABLE, D3DZB_FALSE); + ok(SUCCEEDED(hr), "Failed to disable depth test, hr %#x.\n", hr); + hr = IDirect3DDevice3_SetRenderState(device, D3DRENDERSTATE_CULLMODE, D3DCULL_NONE); + ok(SUCCEEDED(hr), "Failed to disable culling, hr %#x.\n", hr); + + hr = IDirect3DDevice3_SetTransform(device, D3DTRANSFORMSTATE_WORLD, &mat); + ok(SUCCEEDED(hr), "Failed to set world transform, hr %#x.\n", hr); + hr = IDirect3DDevice3_SetTransform(device, D3DTRANSFORMSTATE_VIEW, &mat); + ok(SUCCEEDED(hr), "Failed to set view transform, hr %#x.\n", hr); + hr = IDirect3DDevice3_SetTransform(device, D3DTRANSFORMSTATE_PROJECTION, &mat); + ok(SUCCEEDED(hr), "Failed to set projection transform, hr %#x.\n", hr); + + ds = get_depth_stencil(device); + memset(&surface_desc, 0, sizeof(surface_desc)); + surface_desc.dwSize = sizeof(surface_desc); + hr = IDirectDrawSurface4_GetSurfaceDesc(ds, &surface_desc); + z_fmt = U4(surface_desc).ddpfPixelFormat; + + for (i = 0; i < ARRAY_SIZE(rt_sizes); ++i) + { + if (i) + { + memset(&surface_desc, 0, sizeof(surface_desc)); + surface_desc.dwSize = sizeof(surface_desc); + surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; + surface_desc.dwWidth = rt_sizes[i].x; + surface_desc.dwHeight = rt_sizes[i].y; + surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE; + hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &rt, NULL); + ok(SUCCEEDED(hr), "Failed to create render target, hr %#x (i %u).\n", hr, i); + + surface_desc.dwFlags = DDSD_CAPS | DDSD_PIXELFORMAT | DDSD_WIDTH | DDSD_HEIGHT; + surface_desc.ddsCaps.dwCaps = DDSCAPS_ZBUFFER; + U4(surface_desc).ddpfPixelFormat = z_fmt; + hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &ds, NULL); + ok(SUCCEEDED(hr), "Failed to create depth buffer, hr %#x (i %u).\n", hr, i); + hr = IDirectDrawSurface4_AddAttachedSurface(rt, ds); + ok(SUCCEEDED(hr), "Failed to attach depth buffer, hr %#x (i %u).\n", hr, i); + + hr = IDirect3DDevice3_SetRenderTarget(device, rt, 0); + ok(SUCCEEDED(hr), "Failed to set render target, hr %#x.\n", hr); + } + else + { + hr = IDirect3DDevice3_GetRenderTarget(device, &rt); + ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr); + } + + full_viewport = create_viewport(device, 0, 0, rt_sizes[i].x, rt_sizes[i].y); + + U1(clear_rect).x1 = U2(clear_rect).y1 = 0; + U3(clear_rect).x2 = rt_sizes[i].x; + U4(clear_rect).y2 = rt_sizes[i].y; + + for (j = 0; j < ARRAY_SIZE(tests); ++j) + { + expected_failure = tests[j].vp.dwX + tests[j].vp.dwWidth > rt_sizes[i].x + || tests[j].vp.dwY + tests[j].vp.dwHeight > rt_sizes[i].y; + + hr = IDirect3DViewport3_Clear2(full_viewport, 1, &clear_rect, D3DCLEAR_TARGET, 0xff000000, 0.0f, 0); + ok(SUCCEEDED(hr), "Failed to clear viewport, hr %#x (i %u, j %u).\n", hr, i, j); + + hr = IDirect3D3_CreateViewport(d3d, &viewport, NULL); + ok(SUCCEEDED(hr), "Failed to create viewport, hr %#x (i %u, j %u).\n", hr, i, j); + hr = IDirect3DViewport3_SetViewport2(viewport, NULL); + ok(hr == E_INVALIDARG, "Setting NULL viewport data returned unexpected hr %#x (i %u, j %u).\n", hr, i, j); + memset(&vp, 0, sizeof(vp)); + vp.dwSize = sizeof(vp); + vp.dwX = tests[j].vp.dwX; + vp.dwY = tests[j].vp.dwY; + vp.dwWidth = tests[j].vp.dwWidth; + vp.dwHeight = tests[j].vp.dwHeight; + vp.dvClipX = -1.0f; + vp.dvClipY = 1.0f; + vp.dvClipWidth = 2.0f; + vp.dvClipHeight = 2.0f; + vp.dvMinZ = 0.0f; + vp.dvMaxZ = 1.0f; + hr = IDirect3DViewport3_SetViewport2(viewport, &vp); + ok(hr == D3DERR_VIEWPORTHASNODEVICE, + "Setting viewport data returned unexpected hr %#x (i %u, j %u).\n", hr, i, j); + hr = IDirect3DDevice3_AddViewport(device, viewport); + ok(SUCCEEDED(hr), "Failed to add viewport, hr %#x (i %u, j %u).\n", hr, i, j); + hr = IDirect3DViewport3_SetViewport2(viewport, &vp); + if (expected_failure) + ok(hr == E_INVALIDARG, + "Setting viewport data returned unexpected hr %#x (i %u, j %u).\n", hr, i, j); + else + ok(SUCCEEDED(hr), "Failed to set viewport data, hr %#x (i %u, j %u).\n", hr, i, j); + + hr = IDirect3DDevice3_SetCurrentViewport(device, viewport); + ok(SUCCEEDED(hr), "Failed to set the viewport, hr %#x (i %u, j %u).\n", hr, i, j); + if (expected_failure) + { + destroy_viewport(device, viewport); + continue; + } + + hr = IDirect3DDevice3_BeginScene(device); + ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x (i %u, j %u).\n", hr, i, j); + hr = IDirect3DDevice3_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, D3DFVF_XYZ, quad, 4, 0); + ok(SUCCEEDED(hr), "Got unexpected hr %#x (i %u, j %u).\n", hr, i, j); + hr = IDirect3DDevice3_EndScene(device); + ok(SUCCEEDED(hr), "Failed to end scene, hr %#x (i %u, j %u).\n", hr, i, j); + + check_rect(rt, tests[j].expected_rect, tests[j].message); + + destroy_viewport(device, viewport); + } + + destroy_viewport(device, full_viewport); + + hr = IDirectDrawSurface4_DeleteAttachedSurface(rt, 0, ds); + ok(SUCCEEDED(hr), "Failed to detach surface, hr %#x (i %u).\n", hr, i); + IDirectDrawSurface4_Release(ds); + + IDirectDrawSurface4_Release(rt); + } + + refcount = IDirect3DDevice3_Release(device); + IDirect3D3_Release(d3d); + ok(!refcount, "Device has %u references left.\n", refcount); + DestroyWindow(window); +} + START_TEST(ddraw4) { DDDEVICEIDENTIFIER identifier; @@ -14775,7 +15003,7 @@ START_TEST(ddraw4) test_coop_level_threaded(); test_depth_blit(); test_texture_load_ckey(); - test_viewport(); + test_viewport_object(); test_zenable(); test_ck_rgba(); test_ck_default(); @@ -14853,4 +15081,5 @@ START_TEST(ddraw4) test_depth_readback(); test_clear(); test_enum_surfaces(); + test_viewport(); }
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/ddraw/viewport.c | 39 ++++++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 7 deletions(-)
diff --git a/dlls/ddraw/viewport.c b/dlls/ddraw/viewport.c index 0bc746e974f..fad079f1edb 100644 --- a/dlls/ddraw/viewport.c +++ b/dlls/ddraw/viewport.c @@ -299,7 +299,10 @@ static HRESULT WINAPI d3d_viewport_SetViewport(IDirect3DViewport3 *iface, D3DVIE { struct d3d_viewport *viewport = impl_from_IDirect3DViewport3(iface); struct d3d_device *device = viewport->active_device; + struct wined3d_sub_resource_desc rt_desc; + struct wined3d_rendertarget_view *rtv; IDirect3DViewport3 *current_viewport; + struct ddraw_surface *surface;
TRACE("iface %p, vp %p.\n", iface, vp);
@@ -312,8 +315,33 @@ static HRESULT WINAPI d3d_viewport_SetViewport(IDirect3DViewport3 *iface, D3DVIE _dump_D3DVIEWPORT(vp); }
+ if (!device) + { + WARN("Viewport not bound to a device, returning D3DERR_VIEWPORTHASNODEVICE.\n"); + return D3DERR_VIEWPORTHASNODEVICE; + } + wined3d_mutex_lock();
+ if (device->version > 1) + { + if (!(rtv = wined3d_device_get_rendertarget_view(device->wined3d_device, 0))) + { + wined3d_mutex_unlock(); + return DDERR_INVALIDCAPS; + } + surface = wined3d_rendertarget_view_get_sub_resource_parent(rtv); + wined3d_texture_get_sub_resource_desc(surface->wined3d_texture, surface->sub_resource_idx, &rt_desc); + + if (vp->dwX > rt_desc.width || vp->dwWidth > rt_desc.width - vp->dwX + || vp->dwY > rt_desc.height || vp->dwHeight > rt_desc.height - vp->dwY) + { + WARN("Invalid viewport, returning DDERR_INVALIDPARAMS.\n"); + wined3d_mutex_unlock(); + return DDERR_INVALIDPARAMS; + } + } + viewport->use_vp2 = 0; memset(&viewport->viewports.vp1, 0, sizeof(viewport->viewports.vp1)); memcpy(&viewport->viewports.vp1, vp, vp->dwSize); @@ -323,14 +351,11 @@ static HRESULT WINAPI d3d_viewport_SetViewport(IDirect3DViewport3 *iface, D3DVIE viewport->viewports.vp1.dvMinZ = 0.0; viewport->viewports.vp1.dvMaxZ = 1.0;
- if (device) + if (SUCCEEDED(IDirect3DDevice3_GetCurrentViewport(&device->IDirect3DDevice3_iface, ¤t_viewport))) { - if (SUCCEEDED(IDirect3DDevice3_GetCurrentViewport(&device->IDirect3DDevice3_iface, ¤t_viewport))) - { - if (current_viewport == iface) - viewport_activate(viewport, FALSE); - IDirect3DViewport3_Release(current_viewport); - } + if (current_viewport == iface) + viewport_activate(viewport, FALSE); + IDirect3DViewport3_Release(current_viewport); }
wined3d_mutex_unlock();
On 18 April 2018 at 01:32, Matteo Bruni mbruni@codeweavers.com wrote:
Signed-off-by: Matteo Bruni mbruni@codeweavers.com
dlls/ddraw/viewport.c | 39 ++++++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 7 deletions(-)
This fails here:
../../../../../src/wine-git/tools/runtest -q -P wine -T ../../.. -M d3drm.dll -p d3drm_test.exe.so d3drm && touch d3drm.ok d3drm.c:1709: Test failed: Cannot get IDirect3DRMViewport interface (hr = 0x88760316) d3drm.c:1711: Test failed: Expected ref4 > ref1, got ref1 = 4, ref4 = 4. d3drm.c:1719: Test failed: Expected ref4 > frame_ref, got frame_ref = 1, ref4 = 1. wine: Unhandled page fault on read access to 0x0d8ac3e9 at address 0x7eba0a1e (thread 0009), starting debugger...
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/ddraw/tests/ddraw2.c | 243 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 241 insertions(+), 2 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 3bfb1b5785a..c2b438cf2ae 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -35,6 +35,11 @@ static HRESULT (WINAPI *pDwmIsCompositionEnabled)(BOOL *); #define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) #endif
+struct vec2 +{ + float x, y; +}; + struct vec4 { float x, y, z, w; @@ -260,6 +265,45 @@ static D3DCOLOR get_surface_color(IDirectDrawSurface *surface, UINT x, UINT y) return color; }
+static void check_rect(IDirectDrawSurface *surface, RECT r, const char *message) +{ + LONG x_coords[2][2] = + { + {r.left - 1, r.left + 1}, + {r.right + 1, r.right - 1}, + }; + LONG y_coords[2][2] = + { + {r.top - 1, r.top + 1}, + {r.bottom + 1, r.bottom - 1} + }; + unsigned int i, j, x_side, y_side; + DWORD color; + LONG x, y; + + for (i = 0; i < 2; ++i) + { + for (j = 0; j < 2; ++j) + { + for (x_side = 0; x_side < 2; ++x_side) + { + for (y_side = 0; y_side < 2; ++y_side) + { + DWORD expected = (x_side == 1 && y_side == 1) ? 0x00ffffff : 0x00000000; + + x = x_coords[i][x_side]; + y = y_coords[j][y_side]; + if (x < 0 || x >= 640 || y < 0 || y >= 480) + continue; + color = get_surface_color(surface, x, y); + ok(color == expected, "%s: Pixel (%d, %d) has color %08x, expected %08x\n", + message, x, y, color, expected); + } + } + } + } +} + static DWORD get_device_z_depth(IDirect3DDevice2 *device) { DDSCAPS caps = {DDSCAPS_ZBUFFER}; @@ -1333,7 +1377,7 @@ static ULONG get_refcount(IUnknown *test_iface) return IUnknown_Release(test_iface); }
-static void test_viewport(void) +static void test_viewport_object(void) { IDirectDraw2 *ddraw; IDirect3D2 *d3d; @@ -12633,6 +12677,200 @@ static void test_enum_surfaces(void) IDirectDraw2_Release(ddraw); }
+static void test_viewport(void) +{ + static struct + { + D3DVIEWPORT7 vp; + RECT expected_rect; + const char *message; + } + tests[] = + { + {{ 0, 0, 640, 480}, { 0, 120, 479, 359}, "Viewport (0, 0) - (640, 480)"}, + {{ 0, 0, 320, 240}, { 0, 60, 239, 179}, "Viewport (0, 0) - (320, 240)"}, + {{ 0, 0, 1280, 960}, { 0, 240, 639, 479}, "Viewport (0, 0) - (1280, 960)"}, + {{ 0, 0, 2000, 1600}, { 0, 400, 639, 479}, "Viewport (0, 0) - (2000, 1600)"}, + {{100, 100, 640, 480}, {100, 220, 579, 459}, "Viewport (100, 100) - (640, 480)"}, + {{ 0, 0, 8192, 8192}, {-10, -10, -10, -10}, "Viewport (0, 0) - (8192, 8192)"}, + }; + static const struct vec2 rt_sizes[] = + { + {640, 480}, {1280, 960}, {320, 240}, {800, 600}, + }; + static D3DMATRIX mat = + { + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f, + }; + static D3DLVERTEX quad[] = + { + {{-1.5f}, {-0.5f}, {0.1f}, 0, {0xffffffff}}, + {{-1.5f}, { 0.5f}, {0.1f}, 0, {0xffffffff}}, + {{ 0.5f}, {-0.5f}, {0.1f}, 0, {0xffffffff}}, + {{ 0.5f}, { 0.5f}, {0.1f}, 0, {0xffffffff}}, + }; + IDirect3DViewport2 *viewport, *full_viewport; + IDirect3DMaterial2 *black_background; + IDirectDrawSurface *rt, *ds; + DDSURFACEDESC surface_desc; + IDirect3DDevice2 *device; + BOOL expected_failure; + IDirectDraw2 *ddraw; + DDPIXELFORMAT z_fmt; + D3DRECT clear_rect; + unsigned int i, j; + IDirect3D2 *d3d; + D3DVIEWPORT vp; + ULONG refcount; + HWND window; + HRESULT hr; + + window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, NULL, NULL, NULL, NULL); + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); + if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + { + skip("Failed to create a 3D device, skipping test.\n"); + IDirectDraw2_Release(ddraw); + DestroyWindow(window); + return; + } + + hr = IDirect3DDevice2_GetDirect3D(device, &d3d); + ok(SUCCEEDED(hr), "Failed to get Direct3D2 interface, hr %#x.\n", hr); + + hr = IDirect3DDevice2_SetRenderState(device, D3DRENDERSTATE_ZENABLE, D3DZB_FALSE); + ok(SUCCEEDED(hr), "Failed to disable depth test, hr %#x.\n", hr); + hr = IDirect3DDevice2_SetRenderState(device, D3DRENDERSTATE_CULLMODE, D3DCULL_NONE); + ok(SUCCEEDED(hr), "Failed to disable culling, hr %#x.\n", hr); + + hr = IDirect3DDevice2_SetTransform(device, D3DTRANSFORMSTATE_WORLD, &mat); + ok(SUCCEEDED(hr), "Failed to set world transform, hr %#x.\n", hr); + hr = IDirect3DDevice2_SetTransform(device, D3DTRANSFORMSTATE_VIEW, &mat); + ok(SUCCEEDED(hr), "Failed to set view transform, hr %#x.\n", hr); + hr = IDirect3DDevice2_SetTransform(device, D3DTRANSFORMSTATE_PROJECTION, &mat); + ok(SUCCEEDED(hr), "Failed to set projection transform, hr %#x.\n", hr); + + black_background = create_diffuse_material(device, 0.0f, 0.0f, 0.0f, 0.0f); + + ds = get_depth_stencil(device); + memset(&surface_desc, 0, sizeof(surface_desc)); + surface_desc.dwSize = sizeof(surface_desc); + hr = IDirectDrawSurface_GetSurfaceDesc(ds, &surface_desc); + z_fmt = U4(surface_desc).ddpfPixelFormat; + + for (i = 0; i < ARRAY_SIZE(rt_sizes); ++i) + { + if (i) + { + memset(&surface_desc, 0, sizeof(surface_desc)); + surface_desc.dwSize = sizeof(surface_desc); + surface_desc.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; + surface_desc.dwWidth = rt_sizes[i].x; + surface_desc.dwHeight = rt_sizes[i].y; + surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE; + hr = IDirectDraw2_CreateSurface(ddraw, &surface_desc, &rt, NULL); + ok(SUCCEEDED(hr), "Failed to create render target, hr %#x (i %u).\n", hr, i); + + surface_desc.dwFlags = DDSD_CAPS | DDSD_PIXELFORMAT | DDSD_WIDTH | DDSD_HEIGHT; + surface_desc.ddsCaps.dwCaps = DDSCAPS_ZBUFFER; + U4(surface_desc).ddpfPixelFormat = z_fmt; + hr = IDirectDraw2_CreateSurface(ddraw, &surface_desc, &ds, NULL); + ok(SUCCEEDED(hr), "Failed to create depth buffer, hr %#x (i %u).\n", hr, i); + hr = IDirectDrawSurface_AddAttachedSurface(rt, ds); + ok(SUCCEEDED(hr), "Failed to attach depth buffer, hr %#x (i %u).\n", hr, i); + + hr = IDirect3DDevice2_SetRenderTarget(device, rt, 0); + ok(SUCCEEDED(hr), "Failed to set render target, hr %#x (i %u).\n", hr, i); + } + else + { + hr = IDirect3DDevice2_GetRenderTarget(device, &rt); + ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr); + } + + full_viewport = create_viewport(device, 0, 0, rt_sizes[i].x, rt_sizes[i].y); + viewport_set_background(device, full_viewport, black_background); + + U1(clear_rect).x1 = U2(clear_rect).y1 = 0; + U3(clear_rect).x2 = rt_sizes[i].x; + U4(clear_rect).y2 = rt_sizes[i].y; + + for (j = 0; j < ARRAY_SIZE(tests); ++j) + { + expected_failure = tests[j].vp.dwX + tests[j].vp.dwWidth > rt_sizes[i].x + || tests[j].vp.dwY + tests[j].vp.dwHeight > rt_sizes[i].y; + + hr = IDirect3DViewport2_Clear(full_viewport, 1, &clear_rect, D3DCLEAR_TARGET); + ok(SUCCEEDED(hr), "Failed to clear viewport, hr %#x (i %u, j %u).\n", hr, i, j); + + hr = IDirect3D2_CreateViewport(d3d, &viewport, NULL); + ok(SUCCEEDED(hr), "Failed to create viewport, hr %#x (i %u, j %u).\n", hr, i, j); + hr = IDirect3DViewport2_SetViewport2(viewport, NULL); + ok(hr == E_INVALIDARG, "Setting NULL viewport data returned unexpected hr %#x (i %u, j %u).\n", + hr, i, j); + memset(&vp, 0, sizeof(vp)); + vp.dwSize = sizeof(vp); + vp.dwX = tests[j].vp.dwX; + vp.dwY = tests[j].vp.dwY; + vp.dwWidth = tests[j].vp.dwWidth; + vp.dwHeight = tests[j].vp.dwHeight; + vp.dvScaleX = tests[j].vp.dwWidth / 2.0f; + vp.dvScaleY = tests[j].vp.dwHeight / 2.0f; + vp.dvMinZ = 0.0f; + vp.dvMaxZ = 1.0f; + hr = IDirect3DViewport2_SetViewport(viewport, &vp); + ok(hr == D3DERR_VIEWPORTHASNODEVICE, + "Setting viewport data returned unexpected hr %#x (i %u, j %u).\n", hr, i, j); + hr = IDirect3DDevice2_AddViewport(device, viewport); + ok(SUCCEEDED(hr), "Failed to add viewport, hr %#x (i %u, j %u).\n", hr, i, j); + hr = IDirect3DViewport2_SetViewport(viewport, &vp); + if (expected_failure) + ok(hr == E_INVALIDARG, "Setting viewport data returned unexpected hr %#x (i %u, j %u).\n", + hr, i, j); + else + ok(SUCCEEDED(hr), "Failed to set viewport data, hr %#x (i %u, j %u).\n", hr, i, j); + + hr = IDirect3DDevice2_SetCurrentViewport(device, viewport); + ok(SUCCEEDED(hr), "Failed to set the viewport, hr %#x (i %u, j %u).\n", hr, i, j); + if (expected_failure) + { + destroy_viewport(device, viewport); + continue; + } + + hr = IDirect3DDevice2_BeginScene(device); + ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x (i %u, j %u).\n", hr, i, j); + hr = IDirect3DDevice2_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, D3DVT_LVERTEX, quad, 4, 0); + ok(SUCCEEDED(hr), "Got unexpected hr %#x (i %u, j %u).\n", hr, i, j); + hr = IDirect3DDevice2_EndScene(device); + ok(SUCCEEDED(hr), "Failed to end scene, hr %#x (i %u, j %u).\n", hr, i, j); + + check_rect(rt, tests[j].expected_rect, tests[j].message); + + destroy_viewport(device, viewport); + } + + destroy_viewport(device, full_viewport); + + hr = IDirectDrawSurface_DeleteAttachedSurface(rt, 0, ds); + ok(SUCCEEDED(hr), "Failed to detach surface, hr %#x (i %u).\n", hr, i); + IDirectDrawSurface_Release(ds); + + IDirectDrawSurface_Release(rt); + } + + destroy_material(black_background); + refcount = IDirect3DDevice2_Release(device); + IDirect3D2_Release(d3d); + ok(!refcount, "Device has %u references left.\n", refcount); + DestroyWindow(window); +} + START_TEST(ddraw2) { DDDEVICEIDENTIFIER identifier; @@ -12678,7 +12916,7 @@ START_TEST(ddraw2) test_coop_level_threaded(); test_depth_blit(); test_texture_load_ckey(); - test_viewport(); + test_viewport_object(); test_zenable(); test_ck_rgba(); test_ck_default(); @@ -12743,4 +12981,5 @@ START_TEST(ddraw2) test_depth_readback(); test_clear(); test_enum_surfaces(); + test_viewport(); }
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/ddraw/tests/ddraw1.c | 223 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 221 insertions(+), 2 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 4c2e703a994..fb0858f253b 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -33,6 +33,11 @@ static HRESULT (WINAPI *pDwmIsCompositionEnabled)(BOOL *); #define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0])) #endif
+struct vec2 +{ + float x, y; +}; + struct vec4 { float x, y, z, w; @@ -263,6 +268,45 @@ static D3DCOLOR get_surface_color(IDirectDrawSurface *surface, UINT x, UINT y) return color; }
+static void check_rect(IDirectDrawSurface *surface, RECT r, const char *message) +{ + LONG x_coords[2][2] = + { + {r.left - 1, r.left + 1}, + {r.right + 1, r.right - 1}, + }; + LONG y_coords[2][2] = + { + {r.top - 1, r.top + 1}, + {r.bottom + 1, r.bottom - 1} + }; + unsigned int i, j, x_side, y_side; + DWORD color; + LONG x, y; + + for (i = 0; i < 2; ++i) + { + for (j = 0; j < 2; ++j) + { + for (x_side = 0; x_side < 2; ++x_side) + { + for (y_side = 0; y_side < 2; ++y_side) + { + DWORD expected = (x_side == 1 && y_side == 1) ? 0x00ffffff : 0x00000000; + + x = x_coords[i][x_side]; + y = y_coords[j][y_side]; + if (x < 0 || x >= 640 || y < 0 || y >= 480) + continue; + color = get_surface_color(surface, x, y); + ok(color == expected, "%s: Pixel (%d, %d) has color %08x, expected %08x\n", + message, x, y, color, expected); + } + } + } + } +} + static void emit_process_vertices(void **ptr, DWORD flags, WORD base_idx, DWORD vertex_count) { D3DINSTRUCTION *inst = *ptr; @@ -1165,7 +1209,7 @@ static ULONG get_refcount(IUnknown *test_iface) return IUnknown_Release(test_iface); }
-static void test_viewport(void) +static void test_viewport_object(void) { IDirectDraw *ddraw; IDirect3D *d3d; @@ -11371,6 +11415,180 @@ static void test_execute_data(void) DestroyWindow(window); }
+static void test_viewport(void) +{ + static struct + { + D3DVIEWPORT7 vp; + RECT expected_rect; + const char *message; + } + tests[] = + { + {{ 0, 0, 640, 480}, { 0, 120, 479, 359}, "(0, 0) - (640, 480) viewport"}, + {{ 0, 0, 320, 240}, { 0, 60, 239, 179}, "(0, 0) - (320, 240) viewport"}, + {{ 0, 0, 1280, 960}, {-10, -10, -1, -1}, "(0, 0) - (1280, 960) viewport"}, + {{ 0, 0, 2000, 1600}, {-10, -10, -1, -1}, "(0, 0) - (2000, 1600) viewport"}, + {{100, 100, 640, 480}, {-10, -10, -1, -1}, "(100, 100) - (640, 480) viewport"}, + {{ 0, 0, 8192, 8192}, {-10, -10, -1, -1}, "(0, 0) - (8192, 8192) viewport"}, + }; + static D3DMATRIX mat = + { + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f, + }; + static D3DLVERTEX quad[] = + { + {{-1.5f}, {-0.5f}, {0.1f}, 0, {0xffffffff}}, + {{-1.5f}, { 0.5f}, {0.1f}, 0, {0xffffffff}}, + {{ 0.5f}, {-0.5f}, {0.1f}, 0, {0xffffffff}}, + {{ 0.5f}, { 0.5f}, {0.1f}, 0, {0xffffffff}}, + }; + D3DMATRIXHANDLE world_handle, view_handle, proj_handle; + IDirect3DViewport *viewport, *full_viewport; + IDirect3DExecuteBuffer *execute_buffer; + IDirect3DMaterial *black_background; + D3DEXECUTEBUFFERDESC exec_desc; + IDirect3DDevice *device; + IDirectDrawSurface *rt; + IDirectDraw *ddraw; + D3DRECT clear_rect; + UINT inst_length; + unsigned int j; + IDirect3D *d3d; + D3DVIEWPORT vp; + ULONG refcount; + HWND window; + HRESULT hr; + void *ptr; + + window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW, + 0, 0, 640, 480, 0, 0, 0, 0); + ddraw = create_ddraw(); + ok(!!ddraw, "Failed to create a ddraw object.\n"); + if (!(device = create_device(ddraw, window, DDSCL_NORMAL))) + { + skip("Failed to create a 3D device, skipping test.\n"); + IDirectDraw_Release(ddraw); + DestroyWindow(window); + return; + } + + hr = IDirect3DDevice_QueryInterface(device, &IID_IDirectDrawSurface, (void **)&rt); + ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr); + + hr = IDirect3DDevice_GetDirect3D(device, &d3d); + ok(SUCCEEDED(hr), "Failed to get Direct3D3 interface, hr %#x.\n", hr); + + black_background = create_diffuse_material(device, 0.0f, 0.0f, 0.0f, 0.0f); + + hr = IDirect3DDevice_CreateMatrix(device, &world_handle); + ok(SUCCEEDED(hr), "Creating a matrix object failed, hr %#x.\n", hr); + hr = IDirect3DDevice_SetMatrix(device, world_handle, &mat); + ok(SUCCEEDED(hr), "Setting a matrix object failed, hr %#x.\n", hr); + hr = IDirect3DDevice_CreateMatrix(device, &view_handle); + ok(SUCCEEDED(hr), "Creating a matrix object failed, hr %#x.\n", hr); + hr = IDirect3DDevice_SetMatrix(device, view_handle, &mat); + ok(SUCCEEDED(hr), "Setting a matrix object failed, hr %#x.\n", hr); + hr = IDirect3DDevice_CreateMatrix(device, &proj_handle); + ok(SUCCEEDED(hr), "Creating a matrix object failed, hr %#x.\n", hr); + hr = IDirect3DDevice_SetMatrix(device, proj_handle, &mat); + ok(SUCCEEDED(hr), "Setting a matrix object failed, hr %#x.\n", hr); + + memset(&exec_desc, 0, sizeof(exec_desc)); + exec_desc.dwSize = sizeof(exec_desc); + exec_desc.dwFlags = D3DDEB_BUFSIZE | D3DDEB_CAPS; + exec_desc.dwBufferSize = 1024; + exec_desc.dwCaps = D3DDEBCAPS_SYSTEMMEMORY; + + hr = IDirect3DDevice_CreateExecuteBuffer(device, &exec_desc, &execute_buffer, NULL); + ok(SUCCEEDED(hr), "Failed to create execute buffer, hr %#x.\n", hr); + + hr = IDirect3DExecuteBuffer_Lock(execute_buffer, &exec_desc); + ok(SUCCEEDED(hr), "Failed to lock execute buffer, hr %#x.\n", hr); + + memcpy(exec_desc.lpData, quad, sizeof(quad)); + ptr = ((BYTE *)exec_desc.lpData) + sizeof(quad); + emit_set_ts(&ptr, D3DTRANSFORMSTATE_WORLD, world_handle); + emit_set_ts(&ptr, D3DTRANSFORMSTATE_VIEW, view_handle); + emit_set_ts(&ptr, D3DTRANSFORMSTATE_PROJECTION, proj_handle); + emit_set_rs(&ptr, D3DRENDERSTATE_ZENABLE, FALSE); + emit_set_rs(&ptr, D3DRENDERSTATE_FOGENABLE, FALSE); + emit_set_rs(&ptr, D3DRENDERSTATE_CULLMODE, D3DCULL_NONE); + emit_process_vertices(&ptr, D3DPROCESSVERTICES_TRANSFORM, 0, 4); + emit_tquad(&ptr, 0); + emit_end(&ptr); + inst_length = (BYTE *)ptr - (BYTE *)exec_desc.lpData; + inst_length -= sizeof(quad); + + hr = IDirect3DExecuteBuffer_Unlock(execute_buffer); + ok(SUCCEEDED(hr), "Failed to unlock execute buffer, hr %#x.\n", hr); + + full_viewport = create_viewport(device, 0, 0, 640, 480); + viewport_set_background(device, full_viewport, black_background); + + U1(clear_rect).x1 = U2(clear_rect).y1 = 0; + U3(clear_rect).x2 = 640; + U4(clear_rect).y2 = 480; + + for (j = 0; j < ARRAY_SIZE(tests); ++j) + { + hr = IDirect3DViewport_Clear(full_viewport, 1, &clear_rect, D3DCLEAR_TARGET); + ok(SUCCEEDED(hr), "Failed to clear viewport, hr %#x (j %u).\n", hr, j); + + hr = IDirect3D_CreateViewport(d3d, &viewport, NULL); + ok(SUCCEEDED(hr), "Failed to create viewport, hr %#x (j %u).\n", hr, j); + memset(&vp, 0, sizeof(vp)); + vp.dwSize = sizeof(vp); + vp.dwX = tests[j].vp.dwX; + vp.dwY = tests[j].vp.dwY; + vp.dwWidth = tests[j].vp.dwWidth; + vp.dwHeight = tests[j].vp.dwHeight; + vp.dvScaleX = tests[j].vp.dwWidth / 2.0f; + vp.dvScaleY = tests[j].vp.dwHeight / 2.0f; + vp.dvMaxX = 1.0f; + vp.dvMaxY = 1.0f; + vp.dvMinZ = 0.0f; + vp.dvMaxZ = 1.0f; + hr = IDirect3DViewport_SetViewport(viewport, &vp); + ok(hr == D3DERR_VIEWPORTHASNODEVICE, + "Setting viewport data returned unexpected hr %#x (j %u).\n", hr, j); + hr = IDirect3DDevice_AddViewport(device, viewport); + ok(SUCCEEDED(hr), "Failed to add viewport, hr %#x (j %u).\n", hr, j); + hr = IDirect3DViewport_SetViewport(viewport, &vp); + ok(SUCCEEDED(hr), "Failed to set viewport data, hr %#x (j %u).\n", hr, j); + + hr = IDirect3DDevice_BeginScene(device); + ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x (j %u).\n", hr, j); + + set_execute_data(execute_buffer, 4, sizeof(quad), inst_length); + hr = IDirect3DDevice_Execute(device, execute_buffer, viewport, D3DEXECUTE_CLIPPED); + ok(SUCCEEDED(hr), "Failed to execute exec buffer, hr %#x (j %u).\n", hr, j); + + hr = IDirect3DDevice_EndScene(device); + ok(SUCCEEDED(hr), "Failed to end scene, hr %#x (j %u).\n", hr, j); + + check_rect(rt, tests[j].expected_rect, tests[j].message); + + destroy_viewport(device, viewport); + } + + destroy_viewport(device, full_viewport); + IDirectDrawSurface_Release(rt); + + IDirect3DExecuteBuffer_Release(execute_buffer); + IDirect3DDevice_DeleteMatrix(device, world_handle); + IDirect3DDevice_DeleteMatrix(device, view_handle); + IDirect3DDevice_DeleteMatrix(device, proj_handle); + destroy_material(black_background); + refcount = IDirect3DDevice_Release(device); + IDirect3D2_Release(d3d); + ok(!refcount, "Device has %u references left.\n", refcount); + DestroyWindow(window); +} + START_TEST(ddraw1) { DDDEVICEIDENTIFIER identifier; @@ -11414,7 +11632,7 @@ START_TEST(ddraw1) test_coop_level_d3d_state(); test_surface_interface_mismatch(); test_coop_level_threaded(); - test_viewport(); + test_viewport_object(); test_zenable(); test_ck_rgba(); test_ck_default(); @@ -11473,4 +11691,5 @@ START_TEST(ddraw1) test_clear(); test_enum_surfaces(); test_execute_data(); + test_viewport(); }
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check? Full results can be found at https://testbot.winehq.org/JobDetails.pl?Key=37760
Your paranoid android.
=== w864 (32 bit ddraw1) === ddraw1.c:7064: Test failed: Got unexpected color 0x00000000. ddraw1.c:7066: Test failed: Got unexpected color 0x00000000. ddraw1.c:7068: Test failed: Got unexpected color 0x00000000. ddraw1.c:7070: Test failed: Got unexpected color 0x00000000.
=== wvistau64 (64 bit ddraw1) === ddraw1.c:2704: Test failed: Expected message 0x46, but didn't receive it. ddraw1.c:2706: Test failed: Expected screen size 1024x768, got 0x0. ddraw1.c:2712: Test failed: Expected (0,0)-(1024,768), got (-8,-8)-(1032,746). ddraw1.c:2742: Test failed: Expected (0,0)-(1024,768), got (-8,-8)-(1032,746). ddraw1.c:2749: Test failed: Expected (0,0)-(1024,768), got (-8,-8)-(1032,746). ddraw1.c:2775: Test failed: Expected (0,0)-(1024,768), got (-8,-8)-(1032,746). ddraw1.c:2798: Test failed: Expected (0,0)-(1024,768), got (-8,-8)-(1032,746). ddraw1.c:2827: Test failed: Expected (0,0)-(1024,768), got (-8,-8)-(1032,746). ddraw1.c:2853: Test failed: Expected (0,0)-(1024,768), got (-8,-8)-(1032,746). ddraw1.c:2873: Test failed: Expected (0,0)-(1024,768), got (-8,-8)-(1032,746). ddraw1.c:2909: Test failed: Expected (0,0)-(1024,768), got (-8,-8)-(1032,746). ddraw1.c:2919: Test failed: Expected (0,0)-(1024,768), got (-8,-8)-(1032,746). ddraw1.c:2945: Test failed: Expected (0,0)-(1024,768), got (-8,-8)-(1032,746). ddraw1.c:2968: Test failed: Expected (0,0)-(1024,768), got (-8,-8)-(1032,746). ddraw1.c:2990: Test failed: Expected (0,0)-(1024,768), got (-8,-8)-(1032,746). ddraw1.c:3016: Test failed: Expected (0,0)-(1024,768), got (-8,-8)-(1032,746). ddraw1.c:3036: Test failed: Expected (0,0)-(1024,768), got (-8,-8)-(1032,746). ddraw1.c:3073: Test failed: Expected (0,0)-(1024,768), got (-8,-8)-(1032,746).