From 7438e42f1a5cb5c37e921c562d4b4d09334dfc64 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Tue, 25 Jan 2011 19:26:26 +0100 Subject: [PATCH] wined3d: Do checks at the start of surface_init() (LLVM/Clang). --- dlls/wined3d/surface.c | 80 +++++++++++++++++++++--------------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 2300a68cd68..841662fe6c6 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -431,6 +431,46 @@ HRESULT surface_init(IWineD3DSurfaceImpl *surface, WINED3DSURFTYPE surface_type, multisample_quality = 0; } + /* Quick lockable sanity check. + * TODO: remove this after surfaces, usage and lockability have been debugged properly + * this function is too deep to need to care about things like this. + * Levels need to be checked too, since they all affect what can be done. */ + switch (pool) + { + case WINED3DPOOL_SCRATCH: + if(!lockable) + { + FIXME("Called with a pool of SCRATCH and a lockable of FALSE " + "which are mutually exclusive, setting lockable to TRUE.\n"); + lockable = TRUE; + } + break; + + case WINED3DPOOL_SYSTEMMEM: + if (!lockable) + FIXME("Called with a pool of SYSTEMMEM and a lockable of FALSE, this is acceptable but unexpected.\n"); + break; + + case WINED3DPOOL_MANAGED: + if (usage & WINED3DUSAGE_DYNAMIC) + FIXME("Called with a pool of MANAGED and a usage of DYNAMIC which are mutually exclusive.\n"); + break; + + case WINED3DPOOL_DEFAULT: + if (lockable && !(usage & (WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_RENDERTARGET | WINED3DUSAGE_DEPTHSTENCIL))) + WARN("Creating a lockable surface with a POOL of DEFAULT, that doesn't specify DYNAMIC usage.\n"); + break; + + default: + FIXME("Unknown pool %#x.\n", pool); + break; + }; + + if (usage & WINED3DUSAGE_RENDERTARGET && pool != WINED3DPOOL_DEFAULT) + { + FIXME("Trying to create a render target that isn't in the default pool.\n"); + } + /* FIXME: Check that the format is supported by the device. */ resource_size = wined3d_format_calculate_size(format, alignment, width, height); @@ -477,46 +517,6 @@ HRESULT surface_init(IWineD3DSurfaceImpl *surface, WINED3DSURFTYPE surface_type, if (discard) surface->flags |= SFLAG_DISCARD; if (lockable || format_id == WINED3DFMT_D16_LOCKABLE) surface->flags |= SFLAG_LOCKABLE; - /* Quick lockable sanity check. - * TODO: remove this after surfaces, usage and lockability have been debugged properly - * this function is too deep to need to care about things like this. - * Levels need to be checked too, since they all affect what can be done. */ - switch (pool) - { - case WINED3DPOOL_SCRATCH: - if(!lockable) - { - FIXME("Called with a pool of SCRATCH and a lockable of FALSE " - "which are mutually exclusive, setting lockable to TRUE.\n"); - lockable = TRUE; - } - break; - - case WINED3DPOOL_SYSTEMMEM: - if (!lockable) - FIXME("Called with a pool of SYSTEMMEM and a lockable of FALSE, this is acceptable but unexpected.\n"); - break; - - case WINED3DPOOL_MANAGED: - if (usage & WINED3DUSAGE_DYNAMIC) - FIXME("Called with a pool of MANAGED and a usage of DYNAMIC which are mutually exclusive.\n"); - break; - - case WINED3DPOOL_DEFAULT: - if (lockable && !(usage & (WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_RENDERTARGET | WINED3DUSAGE_DEPTHSTENCIL))) - WARN("Creating a lockable surface with a POOL of DEFAULT, that doesn't specify DYNAMIC usage.\n"); - break; - - default: - FIXME("Unknown pool %#x.\n", pool); - break; - }; - - if (usage & WINED3DUSAGE_RENDERTARGET && pool != WINED3DPOOL_DEFAULT) - { - FIXME("Trying to create a render target that isn't in the default pool.\n"); - } - /* Mark the texture as dirty so that it gets loaded first time around. */ surface_add_dirty_rect(surface, NULL); list_init(&surface->renderbuffers);