Module: wine Branch: master Commit: 4f651808fcae9c378af58585a28d265578b27899 URL: http://source.winehq.org/git/wine.git/?a=commit;h=4f651808fcae9c378af58585a2...
Author: Henri Verbeet hverbeet@codeweavers.com Date: Thu Nov 18 12:21:39 2010 +0100
wined3d: Disallow empty surfaces.
---
dlls/d3d9/tests/visual.c | 7 ++----- dlls/wined3d/surface.c | 1 + 2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index 9e5b9a0..f2eb4b4 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -10613,11 +10613,8 @@ static void depth_bounds_test(IDirect3DDevice9 *device)
hr = IDirect3DDevice9_CreateOffscreenPlainSurface(device, 32, 32, MAKEFOURCC('N','V','D','B'), D3DPOOL_DEFAULT, &offscreen_surface, NULL); - todo_wine ok(hr != D3D_OK, "Able to create surface, hr = %08x\n", hr); - if(offscreen_surface) - { - IDirect3DSurface9_Release(offscreen_surface); - } + ok(FAILED(hr), "Able to create surface, hr %#x.\n", hr); + if (offscreen_surface) IDirect3DSurface9_Release(offscreen_surface);
hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffffffff, 1.0, 0); ok(SUCCEEDED(hr), "Clear failed, hr %#x.\n", hr); diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 432eb9b..e60a684 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -353,6 +353,7 @@ HRESULT surface_init(IWineD3DSurfaceImpl *surface, WINED3DSURFTYPE surface_type, /* FIXME: Check that the format is supported by the device. */
resource_size = wined3d_format_calculate_size(format, alignment, width, height); + if (!resource_size) return WINED3DERR_INVALIDCALL;
/* Look at the implementation and set the correct Vtable. */ switch (surface_type)