wined3d: Get rid of the surface_type parameter to wined3d_surface_create().
This commit is contained in:
parent
aa4b4e8ab2
commit
ce912d5149
|
@ -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);
|
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,
|
return wined3d_surface_create(device->wined3d_device, width, height, format, usage, pool,
|
||||||
WINED3D_MULTISAMPLE_NONE, 0, WINED3D_SURFACE_TYPE_OPENGL, 0, container_parent,
|
WINED3D_MULTISAMPLE_NONE, 0, 0, container_parent, &d3d10_null_wined3d_parent_ops, surface);
|
||||||
&d3d10_null_wined3d_parent_ops, surface);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT CDECL device_parent_create_swapchain_surface(struct wined3d_device_parent *device_parent,
|
static HRESULT CDECL device_parent_create_swapchain_surface(struct wined3d_device_parent *device_parent,
|
||||||
|
|
|
@ -350,7 +350,7 @@ HRESULT surface_init(struct d3d8_surface *surface, struct d3d8_device *device, U
|
||||||
wined3d_mutex_lock();
|
wined3d_mutex_lock();
|
||||||
hr = wined3d_surface_create(device->wined3d_device, width, height, wined3dformat_from_d3dformat(format),
|
hr = wined3d_surface_create(device->wined3d_device, width, height, wined3dformat_from_d3dformat(format),
|
||||||
usage & WINED3DUSAGE_MASK, (enum wined3d_pool)pool, multisample_type, multisample_quality,
|
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();
|
wined3d_mutex_unlock();
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
|
|
|
@ -431,7 +431,7 @@ HRESULT surface_init(struct d3d9_surface *surface, struct d3d9_device *device, U
|
||||||
wined3d_mutex_lock();
|
wined3d_mutex_lock();
|
||||||
hr = wined3d_surface_create(device->wined3d_device, width, height, wined3dformat_from_d3dformat(format),
|
hr = wined3d_surface_create(device->wined3d_device, width, height, wined3dformat_from_d3dformat(format),
|
||||||
usage & WINED3DUSAGE_MASK, (enum wined3d_pool)pool, multisample_type, multisample_quality,
|
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();
|
wined3d_mutex_unlock();
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
|
|
|
@ -5187,9 +5187,9 @@ static HRESULT CDECL device_parent_create_swapchain_surface(struct wined3d_devic
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SUCCEEDED(hr = wined3d_surface_create(ddraw->wined3d_device, width, height, format_id,
|
if (SUCCEEDED(hr = wined3d_surface_create(ddraw->wined3d_device, width, height, format_id, usage,
|
||||||
usage, WINED3D_POOL_DEFAULT, multisample_type, multisample_quality, DefaultSurfaceType,
|
WINED3D_POOL_DEFAULT, multisample_type, multisample_quality, WINED3D_SURFACE_MAPPABLE,
|
||||||
WINED3D_SURFACE_MAPPABLE, ddraw, &ddraw_frontbuffer_parent_ops, surface)))
|
ddraw, &ddraw_frontbuffer_parent_ops, surface)))
|
||||||
ddraw->wined3d_frontbuffer = *surface;
|
ddraw->wined3d_frontbuffer = *surface;
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
|
|
|
@ -5785,7 +5785,7 @@ HRESULT ddraw_surface_init(struct ddraw_surface *surface, struct ddraw *ddraw, D
|
||||||
surface->first_attached = surface;
|
surface->first_attached = surface;
|
||||||
|
|
||||||
if (FAILED(hr = wined3d_surface_create(ddraw->wined3d_device, desc->dwWidth, desc->dwHeight, format,
|
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)))
|
&ddraw_surface_wined3d_parent_ops, &surface->wined3d_surface)))
|
||||||
{
|
{
|
||||||
WARN("Failed to create wined3d surface, hr %#x.\n", hr);
|
WARN("Failed to create wined3d surface, hr %#x.\n", hr);
|
||||||
|
|
|
@ -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,
|
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);
|
NULL, &wined3d_null_parent_ops, &device->logo_surface);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
|
|
|
@ -3722,7 +3722,7 @@ static struct wined3d_surface *surface_convert_format(struct wined3d_surface *so
|
||||||
|
|
||||||
/* FIXME: Multisampled conversion? */
|
/* FIXME: Multisampled conversion? */
|
||||||
if (FAILED(hr = wined3d_surface_create(source->resource.device, source->resource.width, source->resource.height,
|
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)))
|
WINED3D_SURFACE_MAPPABLE | WINED3D_SURFACE_DISCARD, NULL, &wined3d_null_parent_ops, &ret)))
|
||||||
{
|
{
|
||||||
ERR("Failed to create a destination surface for conversion.\n");
|
ERR("Failed to create a destination surface for conversion.\n");
|
||||||
|
@ -7103,9 +7103,9 @@ const struct blit_shader cpu_blit = {
|
||||||
cpu_blit_depth_fill,
|
cpu_blit_depth_fill,
|
||||||
};
|
};
|
||||||
|
|
||||||
static HRESULT surface_init(struct wined3d_surface *surface, enum wined3d_surface_type surface_type,
|
static HRESULT surface_init(struct wined3d_surface *surface, UINT alignment, UINT width, UINT height,
|
||||||
UINT alignment, UINT width, UINT height, enum wined3d_multisample_type multisample_type,
|
enum wined3d_multisample_type multisample_type, UINT multisample_quality,
|
||||||
UINT multisample_quality, struct wined3d_device *device, DWORD usage, enum wined3d_format_id format_id,
|
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)
|
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;
|
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)
|
if (!resource_size)
|
||||||
return WINED3DERR_INVALIDCALL;
|
return WINED3DERR_INVALIDCALL;
|
||||||
|
|
||||||
surface->surface_type = surface_type;
|
if (device->wined3d->flags & WINED3D_NO3D)
|
||||||
|
|
||||||
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;
|
surface->surface_ops = &gdi_surface_ops;
|
||||||
break;
|
else
|
||||||
|
surface->surface_ops = &surface_ops;
|
||||||
default:
|
|
||||||
ERR("Requested unknown surface implementation %#x.\n", surface_type);
|
|
||||||
return WINED3DERR_INVALIDCALL;
|
|
||||||
}
|
|
||||||
|
|
||||||
hr = resource_init(&surface->resource, device, WINED3D_RTYPE_SURFACE, format,
|
hr = resource_init(&surface->resource, device, WINED3D_RTYPE_SURFACE, format,
|
||||||
multisample_type, multisample_quality, usage, pool, width, height, 1,
|
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,
|
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_format_id format_id, DWORD usage, enum wined3d_pool pool,
|
||||||
enum wined3d_multisample_type multisample_type, DWORD multisample_quality,
|
enum wined3d_multisample_type multisample_type, DWORD multisample_quality, DWORD flags,
|
||||||
enum wined3d_surface_type surface_type, DWORD flags, void *parent,
|
void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_surface **surface)
|
||||||
const struct wined3d_parent_ops *parent_ops, struct wined3d_surface **surface)
|
|
||||||
{
|
{
|
||||||
struct wined3d_surface *object;
|
struct wined3d_surface *object;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
@ -7256,13 +7243,7 @@ HRESULT CDECL wined3d_surface_create(struct wined3d_device *device, UINT width,
|
||||||
device, width, height, debug_d3dformat(format_id));
|
device, width, height, debug_d3dformat(format_id));
|
||||||
TRACE("surface %p, usage %s (%#x), pool %s, multisample_type %#x, multisample_quality %u\n",
|
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);
|
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);
|
TRACE("flags %#x, parent %p, parent_ops %p.\n", 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
|
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
|
||||||
if (!object)
|
if (!object)
|
||||||
|
@ -7271,8 +7252,8 @@ HRESULT CDECL wined3d_surface_create(struct wined3d_device *device, UINT width,
|
||||||
return WINED3DERR_OUTOFVIDEOMEMORY;
|
return WINED3DERR_OUTOFVIDEOMEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FAILED(hr = surface_init(object, surface_type, device->surface_alignment, width, height,
|
if (FAILED(hr = surface_init(object, device->surface_alignment, width, height, multisample_type,
|
||||||
multisample_type, multisample_quality, device, usage, format_id, pool, flags, parent, parent_ops)))
|
multisample_quality, device, usage, format_id, pool, flags, parent, parent_ops)))
|
||||||
{
|
{
|
||||||
WARN("Failed to initialize surface, returning %#x.\n", hr);
|
WARN("Failed to initialize surface, returning %#x.\n", hr);
|
||||||
HeapFree(GetProcessHeap(), 0, object);
|
HeapFree(GetProcessHeap(), 0, object);
|
||||||
|
|
|
@ -210,7 +210,7 @@
|
||||||
@ cdecl wined3d_stateblock_incref(ptr)
|
@ cdecl wined3d_stateblock_incref(ptr)
|
||||||
|
|
||||||
@ cdecl wined3d_surface_blt(ptr ptr ptr ptr long ptr long)
|
@ 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_decref(ptr)
|
||||||
@ cdecl wined3d_surface_flip(ptr ptr long)
|
@ cdecl wined3d_surface_flip(ptr ptr long)
|
||||||
@ cdecl wined3d_surface_from_resource(ptr)
|
@ cdecl wined3d_surface_from_resource(ptr)
|
||||||
|
|
|
@ -2053,7 +2053,6 @@ struct wined3d_surface
|
||||||
|
|
||||||
DWORD flags;
|
DWORD flags;
|
||||||
|
|
||||||
enum wined3d_surface_type surface_type;
|
|
||||||
UINT pow2Width;
|
UINT pow2Width;
|
||||||
UINT pow2Height;
|
UINT pow2Height;
|
||||||
|
|
||||||
|
|
|
@ -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);
|
const WINEDDBLTFX *blt_fx, enum wined3d_texture_filter_type filter);
|
||||||
HRESULT __cdecl wined3d_surface_create(struct wined3d_device *device, UINT width, UINT height,
|
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_format_id format_id, DWORD usage, enum wined3d_pool pool,
|
||||||
enum wined3d_multisample_type multisample_type, DWORD multisample_quality,
|
enum wined3d_multisample_type multisample_type, DWORD multisample_quality, DWORD flags,
|
||||||
enum wined3d_surface_type surface_type, DWORD flags, void *parent,
|
void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_surface **surface);
|
||||||
const struct wined3d_parent_ops *parent_ops, struct wined3d_surface **surface);
|
|
||||||
ULONG __cdecl wined3d_surface_decref(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);
|
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);
|
struct wined3d_surface * __cdecl wined3d_surface_from_resource(struct wined3d_resource *resource);
|
||||||
|
|
Loading…
Reference in New Issue