wined3d: Get rid of the surface_type parameter to wined3d_surface_create().

This commit is contained in:
Henri Verbeet 2013-01-17 10:24:27 +01:00 committed by Alexandre Julliard
parent aa4b4e8ab2
commit ce912d5149
10 changed files with 24 additions and 46 deletions

View File

@ -1862,8 +1862,7 @@ static HRESULT CDECL device_parent_create_texture_surface(struct wined3d_device_
device_parent, container_parent, width, height, format, usage, pool, sub_resource_idx, surface);
return wined3d_surface_create(device->wined3d_device, width, height, format, usage, pool,
WINED3D_MULTISAMPLE_NONE, 0, WINED3D_SURFACE_TYPE_OPENGL, 0, container_parent,
&d3d10_null_wined3d_parent_ops, surface);
WINED3D_MULTISAMPLE_NONE, 0, 0, container_parent, &d3d10_null_wined3d_parent_ops, surface);
}
static HRESULT CDECL device_parent_create_swapchain_surface(struct wined3d_device_parent *device_parent,

View File

@ -350,7 +350,7 @@ HRESULT surface_init(struct d3d8_surface *surface, struct d3d8_device *device, U
wined3d_mutex_lock();
hr = wined3d_surface_create(device->wined3d_device, width, height, wined3dformat_from_d3dformat(format),
usage & WINED3DUSAGE_MASK, (enum wined3d_pool)pool, multisample_type, multisample_quality,
WINED3D_SURFACE_TYPE_OPENGL, flags, surface, &d3d8_surface_wined3d_parent_ops, &surface->wined3d_surface);
flags, surface, &d3d8_surface_wined3d_parent_ops, &surface->wined3d_surface);
wined3d_mutex_unlock();
if (FAILED(hr))
{

View File

@ -431,7 +431,7 @@ HRESULT surface_init(struct d3d9_surface *surface, struct d3d9_device *device, U
wined3d_mutex_lock();
hr = wined3d_surface_create(device->wined3d_device, width, height, wined3dformat_from_d3dformat(format),
usage & WINED3DUSAGE_MASK, (enum wined3d_pool)pool, multisample_type, multisample_quality,
WINED3D_SURFACE_TYPE_OPENGL, flags, surface, &d3d9_surface_wined3d_parent_ops, &surface->wined3d_surface);
flags, surface, &d3d9_surface_wined3d_parent_ops, &surface->wined3d_surface);
wined3d_mutex_unlock();
if (FAILED(hr))
{

View File

@ -5187,9 +5187,9 @@ static HRESULT CDECL device_parent_create_swapchain_surface(struct wined3d_devic
return E_FAIL;
}
if (SUCCEEDED(hr = wined3d_surface_create(ddraw->wined3d_device, width, height, format_id,
usage, WINED3D_POOL_DEFAULT, multisample_type, multisample_quality, DefaultSurfaceType,
WINED3D_SURFACE_MAPPABLE, ddraw, &ddraw_frontbuffer_parent_ops, surface)))
if (SUCCEEDED(hr = wined3d_surface_create(ddraw->wined3d_device, width, height, format_id, usage,
WINED3D_POOL_DEFAULT, multisample_type, multisample_quality, WINED3D_SURFACE_MAPPABLE,
ddraw, &ddraw_frontbuffer_parent_ops, surface)))
ddraw->wined3d_frontbuffer = *surface;
return hr;

View File

@ -5785,7 +5785,7 @@ HRESULT ddraw_surface_init(struct ddraw_surface *surface, struct ddraw *ddraw, D
surface->first_attached = surface;
if (FAILED(hr = wined3d_surface_create(ddraw->wined3d_device, desc->dwWidth, desc->dwHeight, format,
usage, pool, WINED3D_MULTISAMPLE_NONE, 0, DefaultSurfaceType, flags, surface,
usage, pool, WINED3D_MULTISAMPLE_NONE, 0, flags, surface,
&ddraw_surface_wined3d_parent_ops, &surface->wined3d_surface)))
{
WARN("Failed to create wined3d surface, hr %#x.\n", hr);

View File

@ -914,7 +914,7 @@ static void device_load_logo(struct wined3d_device *device, const char *filename
}
hr = wined3d_surface_create(device, bm.bmWidth, bm.bmHeight, WINED3DFMT_B5G6R5_UNORM, 0,
WINED3D_POOL_SYSTEM_MEM, WINED3D_MULTISAMPLE_NONE, 0, WINED3D_SURFACE_TYPE_OPENGL, WINED3D_SURFACE_MAPPABLE,
WINED3D_POOL_SYSTEM_MEM, WINED3D_MULTISAMPLE_NONE, 0, WINED3D_SURFACE_MAPPABLE,
NULL, &wined3d_null_parent_ops, &device->logo_surface);
if (FAILED(hr))
{

View File

@ -3722,7 +3722,7 @@ static struct wined3d_surface *surface_convert_format(struct wined3d_surface *so
/* FIXME: Multisampled conversion? */
if (FAILED(hr = wined3d_surface_create(source->resource.device, source->resource.width, source->resource.height,
to_fmt, 0, WINED3D_POOL_SCRATCH, WINED3D_MULTISAMPLE_NONE, 0, source->surface_type,
to_fmt, 0, WINED3D_POOL_SCRATCH, WINED3D_MULTISAMPLE_NONE, 0,
WINED3D_SURFACE_MAPPABLE | WINED3D_SURFACE_DISCARD, NULL, &wined3d_null_parent_ops, &ret)))
{
ERR("Failed to create a destination surface for conversion.\n");
@ -7103,9 +7103,9 @@ const struct blit_shader cpu_blit = {
cpu_blit_depth_fill,
};
static HRESULT surface_init(struct wined3d_surface *surface, enum wined3d_surface_type surface_type,
UINT alignment, UINT width, UINT height, enum wined3d_multisample_type multisample_type,
UINT multisample_quality, struct wined3d_device *device, DWORD usage, enum wined3d_format_id format_id,
static HRESULT surface_init(struct wined3d_surface *surface, UINT alignment, UINT width, UINT height,
enum wined3d_multisample_type multisample_type, UINT multisample_quality,
struct wined3d_device *device, DWORD usage, enum wined3d_format_id format_id,
enum wined3d_pool pool, DWORD flags, void *parent, const struct wined3d_parent_ops *parent_ops)
{
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
@ -7164,22 +7164,10 @@ static HRESULT surface_init(struct wined3d_surface *surface, enum wined3d_surfac
if (!resource_size)
return WINED3DERR_INVALIDCALL;
surface->surface_type = surface_type;
switch (surface_type)
{
case WINED3D_SURFACE_TYPE_OPENGL:
surface->surface_ops = &surface_ops;
break;
case WINED3D_SURFACE_TYPE_GDI:
surface->surface_ops = &gdi_surface_ops;
break;
default:
ERR("Requested unknown surface implementation %#x.\n", surface_type);
return WINED3DERR_INVALIDCALL;
}
if (device->wined3d->flags & WINED3D_NO3D)
surface->surface_ops = &gdi_surface_ops;
else
surface->surface_ops = &surface_ops;
hr = resource_init(&surface->resource, device, WINED3D_RTYPE_SURFACE, format,
multisample_type, multisample_quality, usage, pool, width, height, 1,
@ -7245,9 +7233,8 @@ static HRESULT surface_init(struct wined3d_surface *surface, enum wined3d_surfac
HRESULT CDECL wined3d_surface_create(struct wined3d_device *device, UINT width, UINT height,
enum wined3d_format_id format_id, DWORD usage, enum wined3d_pool pool,
enum wined3d_multisample_type multisample_type, DWORD multisample_quality,
enum wined3d_surface_type surface_type, DWORD flags, void *parent,
const struct wined3d_parent_ops *parent_ops, struct wined3d_surface **surface)
enum wined3d_multisample_type multisample_type, DWORD multisample_quality, DWORD flags,
void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_surface **surface)
{
struct wined3d_surface *object;
HRESULT hr;
@ -7256,13 +7243,7 @@ HRESULT CDECL wined3d_surface_create(struct wined3d_device *device, UINT width,
device, width, height, debug_d3dformat(format_id));
TRACE("surface %p, usage %s (%#x), pool %s, multisample_type %#x, multisample_quality %u\n",
surface, debug_d3dusage(usage), usage, debug_d3dpool(pool), multisample_type, multisample_quality);
TRACE("surface_type %#x, flags %#x, parent %p, parent_ops %p.\n", surface_type, flags, parent, parent_ops);
if (surface_type == WINED3D_SURFACE_TYPE_OPENGL && !device->adapter)
{
ERR("OpenGL surfaces are not available without OpenGL.\n");
return WINED3DERR_NOTAVAILABLE;
}
TRACE("flags %#x, parent %p, parent_ops %p.\n", flags, parent, parent_ops);
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object)
@ -7271,8 +7252,8 @@ HRESULT CDECL wined3d_surface_create(struct wined3d_device *device, UINT width,
return WINED3DERR_OUTOFVIDEOMEMORY;
}
if (FAILED(hr = surface_init(object, surface_type, device->surface_alignment, width, height,
multisample_type, multisample_quality, device, usage, format_id, pool, flags, parent, parent_ops)))
if (FAILED(hr = surface_init(object, device->surface_alignment, width, height, multisample_type,
multisample_quality, device, usage, format_id, pool, flags, parent, parent_ops)))
{
WARN("Failed to initialize surface, returning %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, object);

View File

@ -210,7 +210,7 @@
@ cdecl wined3d_stateblock_incref(ptr)
@ cdecl wined3d_surface_blt(ptr ptr ptr ptr long ptr long)
@ cdecl wined3d_surface_create(ptr long long long long long long long long long ptr ptr ptr)
@ cdecl wined3d_surface_create(ptr long long long long long long long long ptr ptr ptr)
@ cdecl wined3d_surface_decref(ptr)
@ cdecl wined3d_surface_flip(ptr ptr long)
@ cdecl wined3d_surface_from_resource(ptr)

View File

@ -2053,7 +2053,6 @@ struct wined3d_surface
DWORD flags;
enum wined3d_surface_type surface_type;
UINT pow2Width;
UINT pow2Height;

View File

@ -2339,9 +2339,8 @@ HRESULT __cdecl wined3d_surface_blt(struct wined3d_surface *dst_surface, const R
const WINEDDBLTFX *blt_fx, enum wined3d_texture_filter_type filter);
HRESULT __cdecl wined3d_surface_create(struct wined3d_device *device, UINT width, UINT height,
enum wined3d_format_id format_id, DWORD usage, enum wined3d_pool pool,
enum wined3d_multisample_type multisample_type, DWORD multisample_quality,
enum wined3d_surface_type surface_type, DWORD flags, void *parent,
const struct wined3d_parent_ops *parent_ops, struct wined3d_surface **surface);
enum wined3d_multisample_type multisample_type, DWORD multisample_quality, DWORD flags,
void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_surface **surface);
ULONG __cdecl wined3d_surface_decref(struct wined3d_surface *surface);
HRESULT __cdecl wined3d_surface_flip(struct wined3d_surface *surface, struct wined3d_surface *override, DWORD flags);
struct wined3d_surface * __cdecl wined3d_surface_from_resource(struct wined3d_resource *resource);