ddraw: Sysmem overlays are not allowed.
This commit is contained in:
parent
0fdb1aaff6
commit
f53d83cf26
|
@ -5857,6 +5857,14 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((desc->ddsCaps.dwCaps & (DDSCAPS_OVERLAY | DDSCAPS_SYSTEMMEMORY))
|
||||||
|
== (DDSCAPS_OVERLAY | DDSCAPS_SYSTEMMEMORY))
|
||||||
|
{
|
||||||
|
WARN("System memory overlays are not allowed.\n");
|
||||||
|
HeapFree(GetProcessHeap(), 0, texture);
|
||||||
|
return DDERR_NOOVERLAYHW;
|
||||||
|
}
|
||||||
|
|
||||||
if (desc->ddsCaps.dwCaps & DDSCAPS_SYSTEMMEMORY)
|
if (desc->ddsCaps.dwCaps & DDSCAPS_SYSTEMMEMORY)
|
||||||
{
|
{
|
||||||
wined3d_desc.pool = WINED3D_POOL_SYSTEM_MEM;
|
wined3d_desc.pool = WINED3D_POOL_SYSTEM_MEM;
|
||||||
|
|
|
@ -3872,6 +3872,47 @@ static void test_flip(void)
|
||||||
DestroyWindow(window);
|
DestroyWindow(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_sysmem_overlay(void)
|
||||||
|
{
|
||||||
|
IDirectDraw *ddraw;
|
||||||
|
HWND window;
|
||||||
|
HRESULT hr;
|
||||||
|
DDSURFACEDESC ddsd;
|
||||||
|
IDirectDrawSurface *surface;
|
||||||
|
ULONG ref;
|
||||||
|
|
||||||
|
if (!(ddraw = create_ddraw()))
|
||||||
|
{
|
||||||
|
skip("Failed to create a ddraw object, skipping test.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW,
|
||||||
|
0, 0, 640, 480, 0, 0, 0, 0);
|
||||||
|
|
||||||
|
hr = IDirectDraw_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL);
|
||||||
|
ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
|
||||||
|
|
||||||
|
memset(&ddsd, 0, sizeof(ddsd));
|
||||||
|
ddsd.dwSize = sizeof(ddsd);
|
||||||
|
ddsd.dwFlags = DDSD_CAPS | DDSD_PIXELFORMAT | DDSD_WIDTH | DDSD_HEIGHT;
|
||||||
|
ddsd.dwWidth = 16;
|
||||||
|
ddsd.dwHeight = 16;
|
||||||
|
ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY | DDSCAPS_OVERLAY;
|
||||||
|
ddsd.ddpfPixelFormat.dwSize = sizeof(ddsd.ddpfPixelFormat);
|
||||||
|
ddsd.ddpfPixelFormat.dwFlags = DDPF_RGB;
|
||||||
|
U1(ddsd.ddpfPixelFormat).dwRGBBitCount = 32;
|
||||||
|
U2(ddsd.ddpfPixelFormat).dwRBitMask = 0x00ff0000;
|
||||||
|
U3(ddsd.ddpfPixelFormat).dwGBitMask = 0x0000ff00;
|
||||||
|
U4(ddsd.ddpfPixelFormat).dwBBitMask = 0x000000ff;
|
||||||
|
hr = IDirectDraw_CreateSurface(ddraw, &ddsd, &surface, NULL);
|
||||||
|
ok(hr == DDERR_NOOVERLAYHW, "Got unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
ref = IDirectDraw_Release(ddraw);
|
||||||
|
ok(ref == 0, "Ddraw object not properly released, refcount %u.\n", ref);
|
||||||
|
DestroyWindow(window);
|
||||||
|
}
|
||||||
|
|
||||||
START_TEST(ddraw1)
|
START_TEST(ddraw1)
|
||||||
{
|
{
|
||||||
test_coop_level_create_device_window();
|
test_coop_level_create_device_window();
|
||||||
|
@ -3901,4 +3942,5 @@ START_TEST(ddraw1)
|
||||||
test_surface_lock();
|
test_surface_lock();
|
||||||
test_surface_discard();
|
test_surface_discard();
|
||||||
test_flip();
|
test_flip();
|
||||||
|
test_sysmem_overlay();
|
||||||
}
|
}
|
||||||
|
|
|
@ -4932,6 +4932,46 @@ static void test_user_memory_getdc(void)
|
||||||
DestroyWindow(window);
|
DestroyWindow(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_sysmem_overlay(void)
|
||||||
|
{
|
||||||
|
IDirectDraw2 *ddraw;
|
||||||
|
HWND window;
|
||||||
|
HRESULT hr;
|
||||||
|
DDSURFACEDESC ddsd;
|
||||||
|
IDirectDrawSurface *surface;
|
||||||
|
ULONG ref;
|
||||||
|
|
||||||
|
if (!(ddraw = create_ddraw()))
|
||||||
|
{
|
||||||
|
skip("Failed to create a ddraw object, skipping test.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW,
|
||||||
|
0, 0, 640, 480, 0, 0, 0, 0);
|
||||||
|
|
||||||
|
hr = IDirectDraw2_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL);
|
||||||
|
ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
|
||||||
|
|
||||||
|
reset_ddsd(&ddsd);
|
||||||
|
ddsd.dwFlags = DDSD_CAPS | DDSD_PIXELFORMAT | DDSD_WIDTH | DDSD_HEIGHT;
|
||||||
|
ddsd.dwWidth = 16;
|
||||||
|
ddsd.dwHeight = 16;
|
||||||
|
ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY | DDSCAPS_OVERLAY;
|
||||||
|
ddsd.ddpfPixelFormat.dwSize = sizeof(ddsd.ddpfPixelFormat);
|
||||||
|
ddsd.ddpfPixelFormat.dwFlags = DDPF_RGB;
|
||||||
|
U1(ddsd.ddpfPixelFormat).dwRGBBitCount = 32;
|
||||||
|
U2(ddsd.ddpfPixelFormat).dwRBitMask = 0x00ff0000;
|
||||||
|
U3(ddsd.ddpfPixelFormat).dwGBitMask = 0x0000ff00;
|
||||||
|
U4(ddsd.ddpfPixelFormat).dwBBitMask = 0x000000ff;
|
||||||
|
hr = IDirectDraw2_CreateSurface(ddraw, &ddsd, &surface, NULL);
|
||||||
|
ok(hr == DDERR_NOOVERLAYHW, "Got unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
ref = IDirectDraw2_Release(ddraw);
|
||||||
|
ok(ref == 0, "Ddraw object not properly released, refcount %u.\n", ref);
|
||||||
|
DestroyWindow(window);
|
||||||
|
}
|
||||||
|
|
||||||
START_TEST(ddraw2)
|
START_TEST(ddraw2)
|
||||||
{
|
{
|
||||||
test_coop_level_create_device_window();
|
test_coop_level_create_device_window();
|
||||||
|
@ -4967,4 +5007,5 @@ START_TEST(ddraw2)
|
||||||
test_flip();
|
test_flip();
|
||||||
test_set_surface_desc();
|
test_set_surface_desc();
|
||||||
test_user_memory_getdc();
|
test_user_memory_getdc();
|
||||||
|
test_sysmem_overlay();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5529,6 +5529,46 @@ static void test_user_memory_getdc(void)
|
||||||
DestroyWindow(window);
|
DestroyWindow(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_sysmem_overlay(void)
|
||||||
|
{
|
||||||
|
IDirectDraw4 *ddraw;
|
||||||
|
HWND window;
|
||||||
|
HRESULT hr;
|
||||||
|
DDSURFACEDESC2 ddsd;
|
||||||
|
IDirectDrawSurface4 *surface;
|
||||||
|
ULONG ref;
|
||||||
|
|
||||||
|
if (!(ddraw = create_ddraw()))
|
||||||
|
{
|
||||||
|
skip("Failed to create a ddraw object, skipping test.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW,
|
||||||
|
0, 0, 640, 480, 0, 0, 0, 0);
|
||||||
|
|
||||||
|
hr = IDirectDraw4_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL);
|
||||||
|
ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
|
||||||
|
|
||||||
|
reset_ddsd(&ddsd);
|
||||||
|
ddsd.dwFlags = DDSD_CAPS | DDSD_PIXELFORMAT | DDSD_WIDTH | DDSD_HEIGHT;
|
||||||
|
ddsd.dwWidth = 16;
|
||||||
|
ddsd.dwHeight = 16;
|
||||||
|
ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY | DDSCAPS_OVERLAY;
|
||||||
|
ddsd.ddpfPixelFormat.dwSize = sizeof(ddsd.ddpfPixelFormat);
|
||||||
|
ddsd.ddpfPixelFormat.dwFlags = DDPF_RGB;
|
||||||
|
U1(ddsd.ddpfPixelFormat).dwRGBBitCount = 32;
|
||||||
|
U2(ddsd.ddpfPixelFormat).dwRBitMask = 0x00ff0000;
|
||||||
|
U3(ddsd.ddpfPixelFormat).dwGBitMask = 0x0000ff00;
|
||||||
|
U4(ddsd.ddpfPixelFormat).dwBBitMask = 0x000000ff;
|
||||||
|
hr = IDirectDraw4_CreateSurface(ddraw, &ddsd, &surface, NULL);
|
||||||
|
ok(hr == DDERR_NOOVERLAYHW, "Got unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
ref = IDirectDraw4_Release(ddraw);
|
||||||
|
ok(ref == 0, "Ddraw object not properly released, refcount %u.\n", ref);
|
||||||
|
DestroyWindow(window);
|
||||||
|
}
|
||||||
|
|
||||||
START_TEST(ddraw4)
|
START_TEST(ddraw4)
|
||||||
{
|
{
|
||||||
test_process_vertices();
|
test_process_vertices();
|
||||||
|
@ -5569,4 +5609,5 @@ START_TEST(ddraw4)
|
||||||
test_flip();
|
test_flip();
|
||||||
test_set_surface_desc();
|
test_set_surface_desc();
|
||||||
test_user_memory_getdc();
|
test_user_memory_getdc();
|
||||||
|
test_sysmem_overlay();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5417,6 +5417,46 @@ static void test_user_memory_getdc(void)
|
||||||
DestroyWindow(window);
|
DestroyWindow(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void test_sysmem_overlay(void)
|
||||||
|
{
|
||||||
|
IDirectDraw7 *ddraw;
|
||||||
|
HWND window;
|
||||||
|
HRESULT hr;
|
||||||
|
DDSURFACEDESC2 ddsd;
|
||||||
|
IDirectDrawSurface7 *surface;
|
||||||
|
ULONG ref;
|
||||||
|
|
||||||
|
if (!(ddraw = create_ddraw()))
|
||||||
|
{
|
||||||
|
skip("Failed to create a ddraw object, skipping test.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
window = CreateWindowA("static", "ddraw_test", WS_OVERLAPPEDWINDOW,
|
||||||
|
0, 0, 640, 480, 0, 0, 0, 0);
|
||||||
|
|
||||||
|
hr = IDirectDraw7_SetCooperativeLevel(ddraw, window, DDSCL_NORMAL);
|
||||||
|
ok(SUCCEEDED(hr), "Failed to set cooperative level, hr %#x.\n", hr);
|
||||||
|
|
||||||
|
reset_ddsd(&ddsd);
|
||||||
|
ddsd.dwFlags = DDSD_CAPS | DDSD_PIXELFORMAT | DDSD_WIDTH | DDSD_HEIGHT;
|
||||||
|
ddsd.dwWidth = 16;
|
||||||
|
ddsd.dwHeight = 16;
|
||||||
|
ddsd.ddsCaps.dwCaps = DDSCAPS_SYSTEMMEMORY | DDSCAPS_OVERLAY;
|
||||||
|
ddsd.ddpfPixelFormat.dwSize = sizeof(ddsd.ddpfPixelFormat);
|
||||||
|
ddsd.ddpfPixelFormat.dwFlags = DDPF_RGB;
|
||||||
|
U1(ddsd.ddpfPixelFormat).dwRGBBitCount = 32;
|
||||||
|
U2(ddsd.ddpfPixelFormat).dwRBitMask = 0x00ff0000;
|
||||||
|
U3(ddsd.ddpfPixelFormat).dwGBitMask = 0x0000ff00;
|
||||||
|
U4(ddsd.ddpfPixelFormat).dwBBitMask = 0x000000ff;
|
||||||
|
hr = IDirectDraw7_CreateSurface(ddraw, &ddsd, &surface, NULL);
|
||||||
|
ok(hr == DDERR_NOOVERLAYHW, "Got unexpected hr %#x.\n", hr);
|
||||||
|
|
||||||
|
ref = IDirectDraw7_Release(ddraw);
|
||||||
|
ok(ref == 0, "Ddraw object not properly released, refcount %u.\n", ref);
|
||||||
|
DestroyWindow(window);
|
||||||
|
}
|
||||||
|
|
||||||
START_TEST(ddraw7)
|
START_TEST(ddraw7)
|
||||||
{
|
{
|
||||||
HMODULE module = GetModuleHandleA("ddraw.dll");
|
HMODULE module = GetModuleHandleA("ddraw.dll");
|
||||||
|
@ -5465,4 +5505,5 @@ START_TEST(ddraw7)
|
||||||
test_flip();
|
test_flip();
|
||||||
test_set_surface_desc();
|
test_set_surface_desc();
|
||||||
test_user_memory_getdc();
|
test_user_memory_getdc();
|
||||||
|
test_sysmem_overlay();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue