You could make this
{{-1.0f}, {-1.0f}, {0.0f}, 0, {0xffbada55}},
{{-1.0f}, { 1.0f}, {0.0f}, 0, {0xffbada55}},
{{ 1.0f}, {-1.0f}, {1.0f}, 0, {0xffbada55}},
{{ 1.0f}, { 1.0f}, {1.0f}, 0, {0xffbada55}},
Then your currently discarded draws will draw to ca x = 250. That way you can make sure the draw is really discarded by the depth test and not some other reason.
> + /* Check what happens if we release the depth surface that d3drm created, and clear the viewport */
> ...
> + hr = IDirect3DRMViewport_Clear(viewport1); It's worth checking the color surface here to see if the clear was completely ignored or if it realized that there's no depth surface and it only cleared color. Also clear with a different color than what's left behind by the previous test.
> + ok(SUCCEEDED(hr), "Cannot clear viewport (hr = %#x).\n", hr);
> ...
> + d3d_draw_quad1(d3d_device1, d3d_viewport);
> +
> + ret_color = get_surface_color(surface, 100, 200);
> + todo_wine ok(compare_color(ret_color, 0x000000ff, 1), "Got unexpected color 0x%08x.\n", ret_color);
My reading of this is that the depth surface wasn't cleared (everything else would be very surprising). If the color surface was indeed cleared this shows that native at some place expects your ugly deed of removing the depth surface. If the color is not cleared it and the clear call is completely ignored I'd say something is broken somewhere and we shouldn't care too much about this corner case.
> + hr = IDirect3DRMFrame_SetSceneBackgroundRGB(frame1, 1.0f, 1.0f, 1.0f); Can't the "where does the color come from" test be merged into the clear test at the start?
> + ok(SUCCEEDED(hr), "Cannot set scene background RGB (hr = %#x)\n", hr);
> + ret_color = IDirect3DRMFrame_GetSceneBackground(frame1);
> + ok(ret_color == 0xffffffff, "Expected scene color returned == 0xffffffff, got %#x.\n", ret_color);
> + hr = IDirect3DRMFrame_SetSceneBackgroundRGB(dummy_ frame1, 0.0f, 1.0f, 0.0f);
> + ok(SUCCEEDED(hr), "Cannot set scene background RGB (hr = %#x)\n", hr);
> + ret_color = IDirect3DRMFrame_GetSceneBackground(dummy_ frame1);
> + ok(ret_color == 0xff00ff00, "Expected scene color returned == 0xff00ff00, got %#x.\n", ret_color);
> + hr = IDirect3DRMFrame_SetSceneBackgroundRGB(dummy_ frame1, 0.0f, 0.0f, 1.0f);
> + ok(SUCCEEDED(hr), "Cannot set scene background RGB (hr = %#x)\n", hr);
> + ret_color = IDirect3DRMFrame_GetSceneBackground(dummy_ frame1);
> + ok(ret_color == 0xff0000ff, "Expected scene color returned == 0xff0000ff, got %#x.\n", ret_color);
> +static void draw_quad2(IDirect3DDevice2 *device, IDirect3DViewport *viewport)
> +{
Do you need to draw with IDirect3DDevice2 directly here? What about QI'ing IDirect3DDevice and calling d3d_draw_quad1?
> + if (FAILED(hr = IDirect3DMaterial_GetHandle(viewport->material, viewport->device->device, &hmat))) You can do these two calls during viewport creation, you don't have to repeat them every time.
> + return hr;
> +
> + if (FAILED(hr = IDirect3DViewport_SetBackground(viewport->d3d_ viewport, hmat)))
> + return hr;
> static HRESULT WINAPI d3drm_viewport2_Clear(IDirect3DRMViewport2 *iface, DWORD flags) > ...
> + if (flags & D3DRMCLEAR_ZBUFFER)
> + clear_flags |= D3DCLEAR_ZBUFFER;
I guess somewhere here or in the IDirect3DViewport::Clear implementation in ddraw you'll have to handle your missing depth buffer case.