Commit 0fdb1aaf authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

ddraw: SetSurfaceDesc does not work on primaries.

parent 03fe6f3e
......@@ -4293,8 +4293,9 @@ static HRESULT WINAPI ddraw_surface7_SetSurfaceDesc(IDirectDrawSurface7 *iface,
WARN("Flags is %x, returning DDERR_INVALIDPARAMS\n", Flags);
return DDERR_INVALIDPARAMS;
}
if (!(This->surface_desc.ddsCaps.dwCaps & DDSCAPS_SYSTEMMEMORY) ||
This->surface_desc.ddsCaps.dwCaps2 & (DDSCAPS2_TEXTUREMANAGE | DDSCAPS2_D3DTEXTUREMANAGE))
if (!(This->surface_desc.ddsCaps.dwCaps & DDSCAPS_SYSTEMMEMORY)
|| This->surface_desc.ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE
|| This->surface_desc.ddsCaps.dwCaps2 & (DDSCAPS2_TEXTUREMANAGE | DDSCAPS2_D3DTEXTUREMANAGE))
{
WARN("Surface is not in system memory, returning DDERR_INVALIDSURFACETYPE.\n");
return DDERR_INVALIDSURFACETYPE;
......
......@@ -4580,6 +4580,7 @@ static void test_set_surface_desc(void)
{
{DDSCAPS_VIDEOMEMORY, FALSE, "videomemory plain"},
{DDSCAPS_TEXTURE | DDSCAPS_SYSTEMMEMORY, TRUE, "systemmemory texture"},
{DDSCAPS_PRIMARYSURFACE | DDSCAPS_SYSTEMMEMORY, FALSE, "systemmemory primary"},
};
if (!(ddraw = create_ddraw()))
......@@ -4810,7 +4811,11 @@ static void test_set_surface_desc(void)
for (i = 0; i < sizeof(invalid_caps_tests) / sizeof(*invalid_caps_tests); i++)
{
reset_ddsd(&ddsd);
ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS | DDSD_PIXELFORMAT;
ddsd.dwFlags = DDSD_CAPS;
ddsd.ddsCaps.dwCaps = invalid_caps_tests[i].caps;
if (!(invalid_caps_tests[i].caps & DDSCAPS_PRIMARYSURFACE))
{
ddsd.dwFlags |= DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
ddsd.dwWidth = 8;
ddsd.dwHeight = 8;
ddsd.ddpfPixelFormat.dwSize = sizeof(ddsd.ddpfPixelFormat);
......@@ -4819,7 +4824,7 @@ static void test_set_surface_desc(void)
U2(ddsd.ddpfPixelFormat).dwRBitMask = 0x00ff0000;
U3(ddsd.ddpfPixelFormat).dwGBitMask = 0x0000ff00;
U4(ddsd.ddpfPixelFormat).dwBBitMask = 0x000000ff;
ddsd.ddsCaps.dwCaps = invalid_caps_tests[i].caps;
}
hr = IDirectDraw_CreateSurface(ddraw, &ddsd, &surface, NULL);
ok(SUCCEEDED(hr) || hr == DDERR_NODIRECTDRAWHW, "Failed to create surface, hr %#x.\n", hr);
......
......@@ -5185,6 +5185,7 @@ static void test_set_surface_desc(void)
{DDSCAPS_TEXTURE | DDSCAPS_SYSTEMMEMORY, 0, TRUE, "systemmemory texture"},
{DDSCAPS_TEXTURE, DDSCAPS2_D3DTEXTUREMANAGE, FALSE, "managed texture"},
{DDSCAPS_TEXTURE, DDSCAPS2_TEXTUREMANAGE, FALSE, "managed texture"},
{DDSCAPS_PRIMARYSURFACE | DDSCAPS_SYSTEMMEMORY, 0, FALSE, "systemmemory primary"},
};
if (!(ddraw = create_ddraw()))
......@@ -5414,7 +5415,12 @@ static void test_set_surface_desc(void)
for (i = 0; i < sizeof(invalid_caps_tests) / sizeof(*invalid_caps_tests); i++)
{
reset_ddsd(&ddsd);
ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS | DDSD_PIXELFORMAT;
ddsd.dwFlags = DDSD_CAPS;
ddsd.ddsCaps.dwCaps = invalid_caps_tests[i].caps;
ddsd.ddsCaps.dwCaps2 = invalid_caps_tests[i].caps2;
if (!(invalid_caps_tests[i].caps & DDSCAPS_PRIMARYSURFACE))
{
ddsd.dwFlags |= DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
ddsd.dwWidth = 8;
ddsd.dwHeight = 8;
U4(ddsd).ddpfPixelFormat.dwSize = sizeof(U4(ddsd).ddpfPixelFormat);
......@@ -5423,8 +5429,7 @@ static void test_set_surface_desc(void)
U2(U4(ddsd).ddpfPixelFormat).dwRBitMask = 0x00ff0000;
U3(U4(ddsd).ddpfPixelFormat).dwGBitMask = 0x0000ff00;
U4(U4(ddsd).ddpfPixelFormat).dwBBitMask = 0x000000ff;
ddsd.ddsCaps.dwCaps = invalid_caps_tests[i].caps;
ddsd.ddsCaps.dwCaps2 = invalid_caps_tests[i].caps2;
}
hr = IDirectDraw4_CreateSurface(ddraw, &ddsd, &surface, NULL);
ok(SUCCEEDED(hr) || hr == DDERR_NODIRECTDRAWHW, "Failed to create surface, hr %#x.\n", hr);
......
......@@ -5072,6 +5072,7 @@ static void test_set_surface_desc(void)
{DDSCAPS_TEXTURE | DDSCAPS_SYSTEMMEMORY, 0, TRUE, "systemmemory texture"},
{DDSCAPS_TEXTURE, DDSCAPS2_D3DTEXTUREMANAGE, FALSE, "managed texture"},
{DDSCAPS_TEXTURE, DDSCAPS2_TEXTUREMANAGE, FALSE, "managed texture"},
{DDSCAPS_PRIMARYSURFACE | DDSCAPS_SYSTEMMEMORY, 0, FALSE, "systemmemory primary"},
};
if (!(ddraw = create_ddraw()))
......@@ -5302,7 +5303,12 @@ static void test_set_surface_desc(void)
for (i = 0; i < sizeof(invalid_caps_tests) / sizeof(*invalid_caps_tests); i++)
{
reset_ddsd(&ddsd);
ddsd.dwFlags = DDSD_WIDTH | DDSD_HEIGHT | DDSD_CAPS | DDSD_PIXELFORMAT;
ddsd.dwFlags = DDSD_CAPS;
ddsd.ddsCaps.dwCaps = invalid_caps_tests[i].caps;
ddsd.ddsCaps.dwCaps2 = invalid_caps_tests[i].caps2;
if (!(invalid_caps_tests[i].caps & DDSCAPS_PRIMARYSURFACE))
{
ddsd.dwFlags |= DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT;
ddsd.dwWidth = 8;
ddsd.dwHeight = 8;
U4(ddsd).ddpfPixelFormat.dwSize = sizeof(U4(ddsd).ddpfPixelFormat);
......@@ -5311,8 +5317,7 @@ static void test_set_surface_desc(void)
U2(U4(ddsd).ddpfPixelFormat).dwRBitMask = 0x00ff0000;
U3(U4(ddsd).ddpfPixelFormat).dwGBitMask = 0x0000ff00;
U4(U4(ddsd).ddpfPixelFormat).dwBBitMask = 0x000000ff;
ddsd.ddsCaps.dwCaps = invalid_caps_tests[i].caps;
ddsd.ddsCaps.dwCaps2 = invalid_caps_tests[i].caps2;
}
hr = IDirectDraw7_CreateSurface(ddraw, &ddsd, &surface, NULL);
ok(SUCCEEDED(hr) || hr == DDERR_NODIRECTDRAWHW, "Failed to create surface, hr %#x.\n", hr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment