ddraw/tests: Add tests for edge antialiasing blending.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
2bee102353
commit
b808b0758d
|
@ -10244,6 +10244,215 @@ static void test_draw_primitive(void)
|
|||
DestroyWindow(window);
|
||||
}
|
||||
|
||||
static void test_edge_antialiasing_blending(void)
|
||||
{
|
||||
D3DRECT clear_rect = {{0}, {0}, {640}, {480}};
|
||||
IDirect3DMaterial2 *green_background;
|
||||
IDirect3DMaterial2 *red_background;
|
||||
IDirectDrawSurface *offscreen, *ds;
|
||||
D3DDEVICEDESC hal_desc, hel_desc;
|
||||
IDirect3DViewport2 *viewport;
|
||||
DDSURFACEDESC surface_desc;
|
||||
IDirect3DDevice2 *device;
|
||||
IDirectDraw2 *ddraw;
|
||||
ULONG refcount;
|
||||
D3DCOLOR color;
|
||||
HWND window;
|
||||
HRESULT hr;
|
||||
|
||||
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 green_quad[] =
|
||||
{
|
||||
{{-1.0f}, {-1.0f}, {0.1f}, 0, {0x7f00ff00}},
|
||||
{{-1.0f}, { 1.0f}, {0.1f}, 0, {0x7f00ff00}},
|
||||
{{ 1.0f}, {-1.0f}, {0.1f}, 0, {0x7f00ff00}},
|
||||
{{ 1.0f}, { 1.0f}, {0.1f}, 0, {0x7f00ff00}},
|
||||
};
|
||||
static D3DLVERTEX red_quad[] =
|
||||
{
|
||||
{{-1.0f}, {-1.0f}, {0.1f}, 0, {0xccff0000}},
|
||||
{{-1.0f}, { 1.0f}, {0.1f}, 0, {0xccff0000}},
|
||||
{{ 1.0f}, {-1.0f}, {0.1f}, 0, {0xccff0000}},
|
||||
{{ 1.0f}, { 1.0f}, {0.1f}, 0, {0xccff0000}},
|
||||
};
|
||||
|
||||
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.\n");
|
||||
DestroyWindow(window);
|
||||
return;
|
||||
}
|
||||
|
||||
memset(&hal_desc, 0, sizeof(hal_desc));
|
||||
hal_desc.dwSize = sizeof(hal_desc);
|
||||
memset(&hel_desc, 0, sizeof(hel_desc));
|
||||
hel_desc.dwSize = sizeof(hel_desc);
|
||||
hr = IDirect3DDevice2_GetCaps(device, &hal_desc, &hel_desc);
|
||||
ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr);
|
||||
trace("HAL line edge antialiasing support: %#x.\n",
|
||||
hal_desc.dpcLineCaps.dwRasterCaps & D3DPRASTERCAPS_ANTIALIASEDGES);
|
||||
trace("HAL triangle edge antialiasing support: %#x.\n",
|
||||
hal_desc.dpcTriCaps.dwRasterCaps & D3DPRASTERCAPS_ANTIALIASEDGES);
|
||||
trace("HEL line edge antialiasing support: %#x.\n",
|
||||
hel_desc.dpcLineCaps.dwRasterCaps & D3DPRASTERCAPS_ANTIALIASEDGES);
|
||||
trace("HEL triangle edge antialiasing support: %#x.\n",
|
||||
hel_desc.dpcTriCaps.dwRasterCaps & D3DPRASTERCAPS_ANTIALIASEDGES);
|
||||
|
||||
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||
surface_desc.dwSize = sizeof(surface_desc);
|
||||
surface_desc.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS | DDSD_PIXELFORMAT;
|
||||
surface_desc.dwWidth = 640;
|
||||
surface_desc.dwHeight = 480;
|
||||
surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_3DDEVICE;
|
||||
surface_desc.ddpfPixelFormat.dwSize = sizeof(surface_desc.ddpfPixelFormat);
|
||||
U4(surface_desc).ddpfPixelFormat.dwFlags = DDPF_RGB | DDPF_ALPHAPIXELS;
|
||||
U1(U4(surface_desc).ddpfPixelFormat).dwRGBBitCount = 32;
|
||||
U2(U4(surface_desc).ddpfPixelFormat).dwRBitMask = 0x00ff0000;
|
||||
U3(U4(surface_desc).ddpfPixelFormat).dwGBitMask = 0x0000ff00;
|
||||
U4(U4(surface_desc).ddpfPixelFormat).dwBBitMask = 0x000000ff;
|
||||
U5(U4(surface_desc).ddpfPixelFormat).dwRGBAlphaBitMask = 0xff000000;
|
||||
hr = IDirectDraw2_CreateSurface(ddraw, &surface_desc, &offscreen, NULL);
|
||||
ok(hr == D3D_OK, "Creating the offscreen render target failed, hr %#x.\n", hr);
|
||||
|
||||
ds = get_depth_stencil(device);
|
||||
hr = IDirectDrawSurface_AddAttachedSurface(offscreen, ds);
|
||||
todo_wine ok(SUCCEEDED(hr), "Failed to attach depth buffer, hr %#x.\n", hr);
|
||||
IDirectDrawSurface_Release(ds);
|
||||
|
||||
hr = IDirect3DDevice2_SetRenderTarget(device, offscreen, 0);
|
||||
ok(SUCCEEDED(hr), "Failed to set render target, hr %#x.\n", hr);
|
||||
|
||||
red_background = create_diffuse_material(device, 1.0f, 0.0f, 0.0f, 0.8f);
|
||||
green_background = create_diffuse_material(device, 0.0f, 1.0f, 0.0f, 0.5f);
|
||||
|
||||
viewport = create_viewport(device, 0, 0, 640, 480);
|
||||
hr = IDirect3DDevice2_SetCurrentViewport(device, viewport);
|
||||
ok(SUCCEEDED(hr), "Failed to activate the viewport, 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);
|
||||
hr = IDirect3DDevice2_SetRenderState(device, D3DRENDERSTATE_CLIPPING, FALSE);
|
||||
ok(SUCCEEDED(hr), "Failed to disable clipping, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice2_SetRenderState(device, D3DRENDERSTATE_ZENABLE, FALSE);
|
||||
ok(SUCCEEDED(hr), "Failed to disable Z test, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice2_SetRenderState(device, D3DRENDERSTATE_FOGENABLE, FALSE);
|
||||
ok(SUCCEEDED(hr), "Failed to disable fog, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice2_SetRenderState(device, D3DRENDERSTATE_STENCILENABLE, FALSE);
|
||||
ok(SUCCEEDED(hr), "Failed to disable stencil 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_SetRenderState(device, D3DRENDERSTATE_LIGHTING, FALSE);
|
||||
ok(SUCCEEDED(hr), "Failed to disable lighting, hr %#x.\n", hr);
|
||||
|
||||
hr = IDirect3DDevice2_SetRenderState(device, D3DRENDERSTATE_ALPHABLENDENABLE, TRUE);
|
||||
ok(SUCCEEDED(hr), "Failed to enable blending, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice2_SetRenderState(device, D3DRENDERSTATE_SRCBLEND, D3DBLEND_SRCALPHA);
|
||||
ok(SUCCEEDED(hr), "Failed to set src blend, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice2_SetRenderState(device, D3DRENDERSTATE_DESTBLEND, D3DBLEND_DESTALPHA);
|
||||
ok(SUCCEEDED(hr), "Failed to set dest blend, hr %#x.\n", hr);
|
||||
|
||||
viewport_set_background(device, viewport, red_background);
|
||||
hr = IDirect3DViewport2_Clear(viewport, 1, &clear_rect, D3DCLEAR_TARGET);
|
||||
ok(SUCCEEDED(hr), "Failed to clear render target, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice2_BeginScene(device);
|
||||
ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice2_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, D3DVT_LVERTEX, green_quad, 4, 0);
|
||||
ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice2_EndScene(device);
|
||||
ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
|
||||
color = get_surface_color(offscreen, 320, 240);
|
||||
ok(compare_color(color, 0x00cc7f00, 1), "Got unexpected color 0x%08x.\n", color);
|
||||
|
||||
viewport_set_background(device, viewport, green_background);
|
||||
hr = IDirect3DViewport2_Clear(viewport, 1, &clear_rect, D3DCLEAR_TARGET);
|
||||
ok(SUCCEEDED(hr), "Failed to clear render target, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice2_BeginScene(device);
|
||||
ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice2_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, D3DVT_LVERTEX, red_quad, 4, 0);
|
||||
ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice2_EndScene(device);
|
||||
ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
|
||||
color = get_surface_color(offscreen, 320, 240);
|
||||
ok(compare_color(color, 0x00cc7f00, 1), "Got unexpected color 0x%08x.\n", color);
|
||||
|
||||
hr = IDirect3DDevice2_SetRenderState(device, D3DRENDERSTATE_ALPHABLENDENABLE, FALSE);
|
||||
ok(SUCCEEDED(hr), "Failed to disable blending, hr %#x.\n", hr);
|
||||
|
||||
viewport_set_background(device, viewport, red_background);
|
||||
hr = IDirect3DViewport2_Clear(viewport, 1, &clear_rect, D3DCLEAR_TARGET);
|
||||
ok(SUCCEEDED(hr), "Failed to clear render target, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice2_BeginScene(device);
|
||||
ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice2_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, D3DVT_LVERTEX, green_quad, 4, 0);
|
||||
ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice2_EndScene(device);
|
||||
ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
|
||||
color = get_surface_color(offscreen, 320, 240);
|
||||
ok(compare_color(color, 0x0000ff00, 1), "Got unexpected color 0x%08x.\n", color);
|
||||
|
||||
viewport_set_background(device, viewport, green_background);
|
||||
hr = IDirect3DViewport2_Clear(viewport, 1, &clear_rect, D3DCLEAR_TARGET);
|
||||
ok(SUCCEEDED(hr), "Failed to clear render target, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice2_BeginScene(device);
|
||||
ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice2_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, D3DVT_LVERTEX, red_quad, 4, 0);
|
||||
ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice2_EndScene(device);
|
||||
ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
|
||||
color = get_surface_color(offscreen, 320, 240);
|
||||
ok(compare_color(color, 0x00ff0000, 1), "Got unexpected color 0x%08x.\n", color);
|
||||
|
||||
hr = IDirect3DDevice2_SetRenderState(device, D3DRENDERSTATE_EDGEANTIALIAS, TRUE);
|
||||
ok(SUCCEEDED(hr), "Failed to enable edge antialiasing, hr %#x.\n", hr);
|
||||
|
||||
viewport_set_background(device, viewport, red_background);
|
||||
hr = IDirect3DViewport2_Clear(viewport, 1, &clear_rect, D3DCLEAR_TARGET);
|
||||
ok(SUCCEEDED(hr), "Failed to clear render target, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice2_BeginScene(device);
|
||||
ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice2_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, D3DVT_LVERTEX, green_quad, 4, 0);
|
||||
ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice2_EndScene(device);
|
||||
ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
|
||||
color = get_surface_color(offscreen, 320, 240);
|
||||
todo_wine ok(compare_color(color, 0x0000ff00, 1), "Got unexpected color 0x%08x.\n", color);
|
||||
|
||||
viewport_set_background(device, viewport, green_background);
|
||||
hr = IDirect3DViewport2_Clear(viewport, 1, &clear_rect, D3DCLEAR_TARGET);
|
||||
ok(SUCCEEDED(hr), "Failed to clear render target, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice2_BeginScene(device);
|
||||
ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice2_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, D3DVT_LVERTEX, red_quad, 4, 0);
|
||||
ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice2_EndScene(device);
|
||||
ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
|
||||
color = get_surface_color(offscreen, 320, 240);
|
||||
todo_wine ok(compare_color(color, 0x00ff0000, 1), "Got unexpected color 0x%08x.\n", color);
|
||||
|
||||
IDirectDrawSurface_Release(offscreen);
|
||||
destroy_viewport(device, viewport);
|
||||
destroy_material(red_background);
|
||||
destroy_material(green_background);
|
||||
refcount = IDirect3DDevice2_Release(device);
|
||||
ok(!refcount, "Device has %u references left.\n", refcount);
|
||||
IDirectDraw2_Release(ddraw);
|
||||
DestroyWindow(window);
|
||||
}
|
||||
|
||||
START_TEST(ddraw2)
|
||||
{
|
||||
IDirectDraw2 *ddraw;
|
||||
|
@ -10334,4 +10543,5 @@ START_TEST(ddraw2)
|
|||
test_blt();
|
||||
test_getdc();
|
||||
test_draw_primitive();
|
||||
test_edge_antialiasing_blending();
|
||||
}
|
||||
|
|
|
@ -11560,6 +11560,231 @@ static void test_draw_primitive(void)
|
|||
DestroyWindow(window);
|
||||
}
|
||||
|
||||
static void test_edge_antialiasing_blending(void)
|
||||
{
|
||||
D3DRECT clear_rect = {{0}, {0}, {640}, {480}};
|
||||
IDirectDrawSurface4 *offscreen, *ds;
|
||||
D3DDEVICEDESC hal_desc, hel_desc;
|
||||
IDirect3DViewport3 *viewport;
|
||||
DDSURFACEDESC2 surface_desc;
|
||||
IDirect3DDevice3 *device;
|
||||
IDirectDraw4 *ddraw;
|
||||
IDirect3D3 *d3d;
|
||||
ULONG refcount;
|
||||
D3DCOLOR color;
|
||||
HWND window;
|
||||
HRESULT hr;
|
||||
|
||||
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
|
||||
{
|
||||
struct vec3 position;
|
||||
DWORD diffuse;
|
||||
}
|
||||
green_quad[] =
|
||||
{
|
||||
{{-1.0f, -1.0f, 0.1f}, 0x7f00ff00},
|
||||
{{-1.0f, 1.0f, 0.1f}, 0x7f00ff00},
|
||||
{{ 1.0f, -1.0f, 0.1f}, 0x7f00ff00},
|
||||
{{ 1.0f, 1.0f, 0.1f}, 0x7f00ff00},
|
||||
};
|
||||
static struct
|
||||
{
|
||||
struct vec3 position;
|
||||
DWORD diffuse;
|
||||
}
|
||||
red_quad[] =
|
||||
{
|
||||
{{-1.0f, -1.0f, 0.1f}, 0xccff0000},
|
||||
{{-1.0f, 1.0f, 0.1f}, 0xccff0000},
|
||||
{{ 1.0f, -1.0f, 0.1f}, 0xccff0000},
|
||||
{{ 1.0f, 1.0f, 0.1f}, 0xccff0000},
|
||||
};
|
||||
|
||||
window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW,
|
||||
0, 0, 640, 480, NULL, NULL, NULL, NULL);
|
||||
if (!(device = create_device(window, DDSCL_NORMAL)))
|
||||
{
|
||||
skip("Failed to create a 3D device.\n");
|
||||
DestroyWindow(window);
|
||||
return;
|
||||
}
|
||||
|
||||
memset(&hal_desc, 0, sizeof(hal_desc));
|
||||
hal_desc.dwSize = sizeof(hal_desc);
|
||||
memset(&hel_desc, 0, sizeof(hel_desc));
|
||||
hel_desc.dwSize = sizeof(hel_desc);
|
||||
hr = IDirect3DDevice3_GetCaps(device, &hal_desc, &hel_desc);
|
||||
ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr);
|
||||
trace("HAL line edge antialiasing support: %#x.\n",
|
||||
hal_desc.dpcLineCaps.dwRasterCaps & D3DPRASTERCAPS_ANTIALIASEDGES);
|
||||
trace("HAL triangle edge antialiasing support: %#x.\n",
|
||||
hal_desc.dpcTriCaps.dwRasterCaps & D3DPRASTERCAPS_ANTIALIASEDGES);
|
||||
trace("HEL line edge antialiasing support: %#x.\n",
|
||||
hel_desc.dpcLineCaps.dwRasterCaps & D3DPRASTERCAPS_ANTIALIASEDGES);
|
||||
trace("HEL triangle edge antialiasing support: %#x.\n",
|
||||
hel_desc.dpcTriCaps.dwRasterCaps & D3DPRASTERCAPS_ANTIALIASEDGES);
|
||||
|
||||
hr = IDirect3DDevice3_GetDirect3D(device, &d3d);
|
||||
ok(SUCCEEDED(hr), "Failed to get D3D interface, hr %#x.\n", hr);
|
||||
hr = IDirect3D3_QueryInterface(d3d, &IID_IDirectDraw4, (void **)&ddraw);
|
||||
ok(SUCCEEDED(hr), "Failed to get DirectDraw4 interface, hr %#x.\n", hr);
|
||||
IDirect3D3_Release(d3d);
|
||||
|
||||
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||
surface_desc.dwSize = sizeof(surface_desc);
|
||||
surface_desc.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS | DDSD_PIXELFORMAT;
|
||||
surface_desc.dwWidth = 640;
|
||||
surface_desc.dwHeight = 480;
|
||||
surface_desc.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_3DDEVICE;
|
||||
U4(surface_desc).ddpfPixelFormat.dwFlags = DDPF_RGB | DDPF_ALPHAPIXELS;
|
||||
U1(U4(surface_desc).ddpfPixelFormat).dwRGBBitCount = 32;
|
||||
U2(U4(surface_desc).ddpfPixelFormat).dwRBitMask = 0x00ff0000;
|
||||
U3(U4(surface_desc).ddpfPixelFormat).dwGBitMask = 0x0000ff00;
|
||||
U4(U4(surface_desc).ddpfPixelFormat).dwBBitMask = 0x000000ff;
|
||||
U5(U4(surface_desc).ddpfPixelFormat).dwRGBAlphaBitMask = 0xff000000;
|
||||
hr = IDirectDraw4_CreateSurface(ddraw, &surface_desc, &offscreen, NULL);
|
||||
ok(hr == D3D_OK, "Creating the offscreen render target failed, hr %#x.\n", hr);
|
||||
|
||||
ds = get_depth_stencil(device);
|
||||
hr = IDirectDrawSurface_AddAttachedSurface(offscreen, ds);
|
||||
todo_wine ok(SUCCEEDED(hr), "Failed to attach depth buffer, hr %#x.\n", hr);
|
||||
IDirectDrawSurface_Release(ds);
|
||||
|
||||
hr = IDirect3DDevice3_SetRenderTarget(device, offscreen, 0);
|
||||
ok(SUCCEEDED(hr), "Failed to set render target, hr %#x.\n", hr);
|
||||
|
||||
viewport = create_viewport(device, 0, 0, 640, 480);
|
||||
hr = IDirect3DDevice3_SetCurrentViewport(device, viewport);
|
||||
ok(SUCCEEDED(hr), "Failed to set current viewport, 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);
|
||||
hr = IDirect3DDevice3_SetRenderState(device, D3DRENDERSTATE_CLIPPING, FALSE);
|
||||
ok(SUCCEEDED(hr), "Failed to disable clipping, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice3_SetRenderState(device, D3DRENDERSTATE_ZENABLE, FALSE);
|
||||
ok(SUCCEEDED(hr), "Failed to disable Z test, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice3_SetRenderState(device, D3DRENDERSTATE_FOGENABLE, FALSE);
|
||||
ok(SUCCEEDED(hr), "Failed to disable fog, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice3_SetRenderState(device, D3DRENDERSTATE_STENCILENABLE, FALSE);
|
||||
ok(SUCCEEDED(hr), "Failed to disable stencil 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_SetRenderState(device, D3DRENDERSTATE_LIGHTING, FALSE);
|
||||
ok(SUCCEEDED(hr), "Failed to disable lighting, hr %#x.\n", hr);
|
||||
|
||||
hr = IDirect3DDevice3_SetRenderState(device, D3DRENDERSTATE_ALPHABLENDENABLE, TRUE);
|
||||
ok(SUCCEEDED(hr), "Failed to enable blending, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice3_SetRenderState(device, D3DRENDERSTATE_SRCBLEND, D3DBLEND_SRCALPHA);
|
||||
ok(SUCCEEDED(hr), "Failed to set src blend, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice3_SetRenderState(device, D3DRENDERSTATE_DESTBLEND, D3DBLEND_DESTALPHA);
|
||||
ok(SUCCEEDED(hr), "Failed to set dest blend, hr %#x.\n", hr);
|
||||
|
||||
hr = IDirect3DDevice3_SetTextureStageState(device, 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
|
||||
ok(SUCCEEDED(hr), "Failed to set color op, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice3_SetTextureStageState(device, 0, D3DTSS_COLORARG1, D3DTA_DIFFUSE);
|
||||
ok(SUCCEEDED(hr), "Failed to set color arg, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice3_SetTextureStageState(device, 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
|
||||
ok(SUCCEEDED(hr), "Failed to set alpha op, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice3_SetTextureStageState(device, 0, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE);
|
||||
ok(SUCCEEDED(hr), "Failed to set alpha arg, hr %#x.\n", hr);
|
||||
|
||||
hr = IDirect3DViewport3_Clear2(viewport, 1, &clear_rect, D3DCLEAR_TARGET, 0xccff0000, 0.0f, 0);
|
||||
ok(SUCCEEDED(hr), "Failed to clear viewport, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice3_BeginScene(device);
|
||||
ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice3_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, D3DFVF_XYZ | D3DFVF_DIFFUSE,
|
||||
green_quad, 4, 0);
|
||||
ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice3_EndScene(device);
|
||||
ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
|
||||
color = get_surface_color(offscreen, 320, 240);
|
||||
ok(compare_color(color, 0x00cc7f00, 1), "Got unexpected color 0x%08x.\n", color);
|
||||
|
||||
hr = IDirect3DViewport3_Clear2(viewport, 1, &clear_rect, D3DCLEAR_TARGET, 0x7f00ff00, 0.0f, 0);
|
||||
ok(SUCCEEDED(hr), "Failed to clear viewport, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice3_BeginScene(device);
|
||||
ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice3_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, D3DFVF_XYZ | D3DFVF_DIFFUSE,
|
||||
red_quad, 4, 0);
|
||||
ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice3_EndScene(device);
|
||||
ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
|
||||
color = get_surface_color(offscreen, 320, 240);
|
||||
ok(compare_color(color, 0x00cc7f00, 1), "Got unexpected color 0x%08x.\n", color);
|
||||
|
||||
hr = IDirect3DDevice3_SetRenderState(device, D3DRENDERSTATE_ALPHABLENDENABLE, FALSE);
|
||||
ok(SUCCEEDED(hr), "Failed to disable blending, hr %#x.\n", hr);
|
||||
|
||||
hr = IDirect3DViewport3_Clear2(viewport, 1, &clear_rect, D3DCLEAR_TARGET, 0xccff0000, 0.0f, 0);
|
||||
ok(SUCCEEDED(hr), "Failed to clear viewport, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice3_BeginScene(device);
|
||||
ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice3_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, D3DFVF_XYZ | D3DFVF_DIFFUSE,
|
||||
green_quad, 4, 0);
|
||||
ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice3_EndScene(device);
|
||||
ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
|
||||
color = get_surface_color(offscreen, 320, 240);
|
||||
ok(compare_color(color, 0x0000ff00, 1), "Got unexpected color 0x%08x.\n", color);
|
||||
|
||||
hr = IDirect3DViewport3_Clear2(viewport, 1, &clear_rect, D3DCLEAR_TARGET, 0x7f00ff00, 0.0f, 0);
|
||||
ok(SUCCEEDED(hr), "Failed to clear viewport, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice3_BeginScene(device);
|
||||
ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice3_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, D3DFVF_XYZ | D3DFVF_DIFFUSE,
|
||||
red_quad, 4, 0);
|
||||
ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice3_EndScene(device);
|
||||
ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
|
||||
color = get_surface_color(offscreen, 320, 240);
|
||||
ok(compare_color(color, 0x00ff0000, 1), "Got unexpected color 0x%08x.\n", color);
|
||||
|
||||
hr = IDirect3DDevice3_SetRenderState(device, D3DRENDERSTATE_EDGEANTIALIAS, TRUE);
|
||||
ok(SUCCEEDED(hr), "Failed to enable edge antialiasing, hr %#x.\n", hr);
|
||||
|
||||
hr = IDirect3DViewport3_Clear2(viewport, 1, &clear_rect, D3DCLEAR_TARGET, 0xccff0000, 0.0f, 0);
|
||||
ok(SUCCEEDED(hr), "Failed to clear viewport, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice3_BeginScene(device);
|
||||
ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice3_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, D3DFVF_XYZ | D3DFVF_DIFFUSE,
|
||||
green_quad, 4, 0);
|
||||
ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice3_EndScene(device);
|
||||
ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
|
||||
color = get_surface_color(offscreen, 320, 240);
|
||||
todo_wine ok(compare_color(color, 0x0000ff00, 1), "Got unexpected color 0x%08x.\n", color);
|
||||
|
||||
hr = IDirect3DViewport3_Clear2(viewport, 1, &clear_rect, D3DCLEAR_TARGET, 0x7f00ff00, 0.0f, 0);
|
||||
ok(SUCCEEDED(hr), "Failed to clear viewport, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice3_BeginScene(device);
|
||||
ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice3_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, D3DFVF_XYZ | D3DFVF_DIFFUSE,
|
||||
red_quad, 4, 0);
|
||||
ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice3_EndScene(device);
|
||||
ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
|
||||
color = get_surface_color(offscreen, 320, 240);
|
||||
todo_wine ok(compare_color(color, 0x00ff0000, 1), "Got unexpected color 0x%08x.\n", color);
|
||||
|
||||
IDirectDrawSurface4_Release(offscreen);
|
||||
IDirectDraw3_Release(ddraw);
|
||||
destroy_viewport(device, viewport);
|
||||
refcount = IDirect3DDevice3_Release(device);
|
||||
ok(!refcount, "Device has %u references left.\n", refcount);
|
||||
DestroyWindow(window);
|
||||
}
|
||||
|
||||
START_TEST(ddraw4)
|
||||
{
|
||||
IDirectDraw4 *ddraw;
|
||||
|
@ -11658,4 +11883,5 @@ START_TEST(ddraw4)
|
|||
test_color_clamping();
|
||||
test_getdc();
|
||||
test_draw_primitive();
|
||||
test_edge_antialiasing_blending();
|
||||
}
|
||||
|
|
|
@ -11881,6 +11881,211 @@ static void test_draw_primitive(void)
|
|||
DestroyWindow(window);
|
||||
}
|
||||
|
||||
static void test_edge_antialiasing_blending(void)
|
||||
{
|
||||
IDirectDrawSurface7 *offscreen;
|
||||
DDSURFACEDESC2 surface_desc;
|
||||
D3DDEVICEDESC7 device_desc;
|
||||
IDirect3DDevice7 *device;
|
||||
IDirectDraw7 *ddraw;
|
||||
IDirect3D7 *d3d;
|
||||
ULONG refcount;
|
||||
D3DCOLOR color;
|
||||
HWND window;
|
||||
HRESULT hr;
|
||||
|
||||
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
|
||||
{
|
||||
struct vec3 position;
|
||||
DWORD diffuse;
|
||||
}
|
||||
green_quad[] =
|
||||
{
|
||||
{{-1.0f, -1.0f, 0.1f}, 0x7f00ff00},
|
||||
{{-1.0f, 1.0f, 0.1f}, 0x7f00ff00},
|
||||
{{ 1.0f, -1.0f, 0.1f}, 0x7f00ff00},
|
||||
{{ 1.0f, 1.0f, 0.1f}, 0x7f00ff00},
|
||||
};
|
||||
static struct
|
||||
{
|
||||
struct vec3 position;
|
||||
DWORD diffuse;
|
||||
}
|
||||
red_quad[] =
|
||||
{
|
||||
{{-1.0f, -1.0f, 0.1f}, 0xccff0000},
|
||||
{{-1.0f, 1.0f, 0.1f}, 0xccff0000},
|
||||
{{ 1.0f, -1.0f, 0.1f}, 0xccff0000},
|
||||
{{ 1.0f, 1.0f, 0.1f}, 0xccff0000},
|
||||
};
|
||||
|
||||
window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW,
|
||||
0, 0, 640, 480, NULL, NULL, NULL, NULL);
|
||||
if (!(device = create_device(window, DDSCL_NORMAL)))
|
||||
{
|
||||
skip("Failed to create a 3D device.\n");
|
||||
DestroyWindow(window);
|
||||
return;
|
||||
}
|
||||
|
||||
hr = IDirect3DDevice7_GetCaps(device, &device_desc);
|
||||
ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr);
|
||||
trace("Line edge antialiasing support: %#x.\n",
|
||||
device_desc.dpcLineCaps.dwRasterCaps & D3DPRASTERCAPS_ANTIALIASEDGES);
|
||||
trace("Triangle edge antialiasing support: %#x.\n",
|
||||
device_desc.dpcTriCaps.dwRasterCaps & D3DPRASTERCAPS_ANTIALIASEDGES);
|
||||
|
||||
hr = IDirect3DDevice7_GetDirect3D(device, &d3d);
|
||||
ok(SUCCEEDED(hr), "Failed to get D3D interface, hr %#x.\n", hr);
|
||||
hr = IDirect3D7_QueryInterface(d3d, &IID_IDirectDraw7, (void **)&ddraw);
|
||||
ok(SUCCEEDED(hr), "Failed to get DirectDraw7 interface, hr %#x.\n", hr);
|
||||
IDirect3D7_Release(d3d);
|
||||
|
||||
memset(&surface_desc, 0, sizeof(surface_desc));
|
||||
surface_desc.dwSize = sizeof(surface_desc);
|
||||
surface_desc.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS | DDSD_PIXELFORMAT;
|
||||
surface_desc.dwWidth = 640;
|
||||
surface_desc.dwHeight = 480;
|
||||
surface_desc.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_3DDEVICE;
|
||||
U4(surface_desc).ddpfPixelFormat.dwFlags = DDPF_RGB | DDPF_ALPHAPIXELS;
|
||||
U1(U4(surface_desc).ddpfPixelFormat).dwRGBBitCount = 32;
|
||||
U2(U4(surface_desc).ddpfPixelFormat).dwRBitMask = 0x00ff0000;
|
||||
U3(U4(surface_desc).ddpfPixelFormat).dwGBitMask = 0x0000ff00;
|
||||
U4(U4(surface_desc).ddpfPixelFormat).dwBBitMask = 0x000000ff;
|
||||
U5(U4(surface_desc).ddpfPixelFormat).dwRGBAlphaBitMask = 0xff000000;
|
||||
hr = IDirectDraw7_CreateSurface(ddraw, &surface_desc, &offscreen, NULL);
|
||||
ok(hr == D3D_OK, "Creating the offscreen render target failed, hr %#x.\n", hr);
|
||||
|
||||
hr = IDirect3DDevice7_SetRenderTarget(device, offscreen, 0);
|
||||
ok(SUCCEEDED(hr), "Failed to set render target, hr %#x.\n", hr);
|
||||
|
||||
hr = IDirect3DDevice7_SetTransform(device, D3DTRANSFORMSTATE_WORLD, &mat);
|
||||
ok(SUCCEEDED(hr), "Failed to set world transform, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice7_SetTransform(device, D3DTRANSFORMSTATE_VIEW, &mat);
|
||||
ok(SUCCEEDED(hr), "Failed to set view transform, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice7_SetTransform(device, D3DTRANSFORMSTATE_PROJECTION, &mat);
|
||||
ok(SUCCEEDED(hr), "Failed to set projection transform, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_CLIPPING, FALSE);
|
||||
ok(SUCCEEDED(hr), "Failed to disable clipping, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_ZENABLE, FALSE);
|
||||
ok(SUCCEEDED(hr), "Failed to disable Z test, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_FOGENABLE, FALSE);
|
||||
ok(SUCCEEDED(hr), "Failed to disable fog, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_STENCILENABLE, FALSE);
|
||||
ok(SUCCEEDED(hr), "Failed to disable stencil test, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_CULLMODE, D3DCULL_NONE);
|
||||
ok(SUCCEEDED(hr), "Failed to disable culling, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_LIGHTING, FALSE);
|
||||
ok(SUCCEEDED(hr), "Failed to disable lighting, hr %#x.\n", hr);
|
||||
|
||||
hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_ALPHABLENDENABLE, TRUE);
|
||||
ok(SUCCEEDED(hr), "Failed to enable blending, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_SRCBLEND, D3DBLEND_SRCALPHA);
|
||||
ok(SUCCEEDED(hr), "Failed to set src blend, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_DESTBLEND, D3DBLEND_DESTALPHA);
|
||||
ok(SUCCEEDED(hr), "Failed to set dest blend, hr %#x.\n", hr);
|
||||
|
||||
hr = IDirect3DDevice7_SetTextureStageState(device, 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
|
||||
ok(SUCCEEDED(hr), "Failed to set color op, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice7_SetTextureStageState(device, 0, D3DTSS_COLORARG1, D3DTA_DIFFUSE);
|
||||
ok(SUCCEEDED(hr), "Failed to set color arg, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice7_SetTextureStageState(device, 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1);
|
||||
ok(SUCCEEDED(hr), "Failed to set alpha op, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice7_SetTextureStageState(device, 0, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE);
|
||||
ok(SUCCEEDED(hr), "Failed to set alpha arg, hr %#x.\n", hr);
|
||||
|
||||
hr = IDirect3DDevice7_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xccff0000, 0.0f, 0);
|
||||
ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice7_BeginScene(device);
|
||||
ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice7_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, D3DFVF_XYZ | D3DFVF_DIFFUSE,
|
||||
green_quad, 4, 0);
|
||||
ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice7_EndScene(device);
|
||||
ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
|
||||
color = get_surface_color(offscreen, 320, 240);
|
||||
ok(compare_color(color, 0x00cc7f00, 1), "Got unexpected color 0x%08x.\n", color);
|
||||
|
||||
hr = IDirect3DDevice7_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x7f00ff00, 0.0f, 0);
|
||||
ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice7_BeginScene(device);
|
||||
ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice7_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, D3DFVF_XYZ | D3DFVF_DIFFUSE,
|
||||
red_quad, 4, 0);
|
||||
ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice7_EndScene(device);
|
||||
ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
|
||||
color = get_surface_color(offscreen, 320, 240);
|
||||
ok(compare_color(color, 0x00cc7f00, 1), "Got unexpected color 0x%08x.\n", color);
|
||||
|
||||
hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_ALPHABLENDENABLE, FALSE);
|
||||
ok(SUCCEEDED(hr), "Failed to disable blending, hr %#x.\n", hr);
|
||||
|
||||
hr = IDirect3DDevice7_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xccff0000, 0.0f, 0);
|
||||
ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice7_BeginScene(device);
|
||||
ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice7_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, D3DFVF_XYZ | D3DFVF_DIFFUSE,
|
||||
green_quad, 4, 0);
|
||||
ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice7_EndScene(device);
|
||||
ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
|
||||
color = get_surface_color(offscreen, 320, 240);
|
||||
ok(compare_color(color, 0x0000ff00, 1), "Got unexpected color 0x%08x.\n", color);
|
||||
|
||||
hr = IDirect3DDevice7_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x7f00ff00, 0.0f, 0);
|
||||
ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice7_BeginScene(device);
|
||||
ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice7_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, D3DFVF_XYZ | D3DFVF_DIFFUSE,
|
||||
red_quad, 4, 0);
|
||||
ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice7_EndScene(device);
|
||||
ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
|
||||
color = get_surface_color(offscreen, 320, 240);
|
||||
ok(compare_color(color, 0x00ff0000, 1), "Got unexpected color 0x%08x.\n", color);
|
||||
|
||||
hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_EDGEANTIALIAS, TRUE);
|
||||
ok(SUCCEEDED(hr), "Failed to enable edge antialiasing, hr %#x.\n", hr);
|
||||
|
||||
hr = IDirect3DDevice7_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xccff0000, 0.0f, 0);
|
||||
ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice7_BeginScene(device);
|
||||
ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice7_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, D3DFVF_XYZ | D3DFVF_DIFFUSE,
|
||||
green_quad, 4, 0);
|
||||
ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice7_EndScene(device);
|
||||
ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
|
||||
color = get_surface_color(offscreen, 320, 240);
|
||||
todo_wine ok(compare_color(color, 0x0000ff00, 1), "Got unexpected color 0x%08x.\n", color);
|
||||
|
||||
hr = IDirect3DDevice7_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x7f00ff00, 0.0f, 0);
|
||||
ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice7_BeginScene(device);
|
||||
ok(SUCCEEDED(hr), "Failed to begin scene, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice7_DrawPrimitive(device, D3DPT_TRIANGLESTRIP, D3DFVF_XYZ | D3DFVF_DIFFUSE,
|
||||
red_quad, 4, 0);
|
||||
ok(SUCCEEDED(hr), "Failed to draw, hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice7_EndScene(device);
|
||||
ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
|
||||
color = get_surface_color(offscreen, 320, 240);
|
||||
todo_wine ok(compare_color(color, 0x00ff0000, 1), "Got unexpected color 0x%08x.\n", color);
|
||||
|
||||
IDirectDrawSurface7_Release(offscreen);
|
||||
IDirectDraw7_Release(ddraw);
|
||||
refcount = IDirect3DDevice7_Release(device);
|
||||
ok(!refcount, "Device has %u references left.\n", refcount);
|
||||
DestroyWindow(window);
|
||||
}
|
||||
|
||||
START_TEST(ddraw7)
|
||||
{
|
||||
HMODULE module = GetModuleHandleA("ddraw.dll");
|
||||
|
@ -11990,4 +12195,5 @@ START_TEST(ddraw7)
|
|||
test_color_clamping();
|
||||
test_getdc();
|
||||
test_draw_primitive();
|
||||
test_edge_antialiasing_blending();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue