wined3d: Get rid of the "target" parameter to wined3d_adapter_gl_create_context().

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2019-05-06 21:16:29 +04:30 committed by Alexandre Julliard
parent c82423df85
commit 11b7e47598
4 changed files with 14 additions and 15 deletions

View File

@ -288,8 +288,7 @@ static void adapter_vk_destroy_device(struct wined3d_device *device)
heap_free(device_vk); heap_free(device_vk);
} }
static BOOL adapter_vk_create_context(struct wined3d_context *context, static BOOL adapter_vk_create_context(struct wined3d_context *context, const struct wined3d_format *ds_format)
struct wined3d_texture *target, const struct wined3d_format *ds_format)
{ {
return TRUE; return TRUE;
} }

View File

@ -1967,12 +1967,11 @@ static BOOL wined3d_context_init(struct wined3d_context *context, struct wined3d
struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, const struct wined3d_format *ds_format) struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, const struct wined3d_format *ds_format)
{ {
struct wined3d_texture *target = swapchain->front_buffer;
struct wined3d_device *device = swapchain->device; struct wined3d_device *device = swapchain->device;
struct wined3d_context_gl *context_gl; struct wined3d_context_gl *context_gl;
struct wined3d_context *context; struct wined3d_context *context;
TRACE("swapchain %p, target %p, window %p.\n", swapchain, target, swapchain->win_handle); TRACE("swapchain %p.\n", swapchain);
wined3d_from_cs(device->cs); wined3d_from_cs(device->cs);
@ -1985,7 +1984,7 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, cons
heap_free(context_gl); heap_free(context_gl);
return NULL; return NULL;
} }
if (!(device->adapter->adapter_ops->adapter_create_context(context, target, ds_format))) if (!(device->adapter->adapter_ops->adapter_create_context(context, ds_format)))
{ {
wined3d_release_dc(context->win_handle, context->hdc); wined3d_release_dc(context->win_handle, context->hdc);
heap_free(context_gl); heap_free(context_gl);
@ -2004,13 +2003,13 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, cons
return context; return context;
} }
BOOL wined3d_adapter_gl_create_context(struct wined3d_context *context, BOOL wined3d_adapter_gl_create_context(struct wined3d_context *context, const struct wined3d_format *ds_format)
struct wined3d_texture *target, const struct wined3d_format *ds_format)
{ {
struct wined3d_device *device = context->device; struct wined3d_device *device = context->device;
const struct wined3d_format *color_format; const struct wined3d_format *color_format;
const struct wined3d_d3d_info *d3d_info; const struct wined3d_d3d_info *d3d_info;
const struct wined3d_gl_info *gl_info; const struct wined3d_gl_info *gl_info;
struct wined3d_resource *target;
unsigned int target_bind_flags; unsigned int target_bind_flags;
BOOL aux_buffers = FALSE; BOOL aux_buffers = FALSE;
HGLRC ctx, share_ctx; HGLRC ctx, share_ctx;
@ -2057,8 +2056,9 @@ BOOL wined3d_adapter_gl_create_context(struct wined3d_context *context,
sizeof(*context->texture_type)))) sizeof(*context->texture_type))))
return FALSE; return FALSE;
color_format = target->resource.format; target = &context->current_rt.texture->resource;
target_bind_flags = target->resource.bind_flags; color_format = target->format;
target_bind_flags = target->bind_flags;
/* In case of ORM_BACKBUFFER, make sure to request an alpha component for /* In case of ORM_BACKBUFFER, make sure to request an alpha component for
* X4R4G4B4/X8R8G8B8 as we might need it for the backbuffer. */ * X4R4G4B4/X8R8G8B8 as we might need it for the backbuffer. */
@ -2141,7 +2141,7 @@ BOOL wined3d_adapter_gl_create_context(struct wined3d_context *context,
} }
} }
context->render_offscreen = wined3d_resource_is_offscreen(&target->resource); context->render_offscreen = wined3d_resource_is_offscreen(target);
context->draw_buffers_mask = context_generate_rt_mask(GL_BACK); context->draw_buffers_mask = context_generate_rt_mask(GL_BACK);
context->valid = 1; context->valid = 1;

View File

@ -2256,7 +2256,7 @@ static void adapter_no3d_destroy_device(struct wined3d_device *device)
} }
static BOOL wined3d_adapter_no3d_create_context(struct wined3d_context *context, static BOOL wined3d_adapter_no3d_create_context(struct wined3d_context *context,
struct wined3d_texture *target, const struct wined3d_format *ds_format) const struct wined3d_format *ds_format)
{ {
return TRUE; return TRUE;
} }

View File

@ -2711,8 +2711,7 @@ struct wined3d_adapter_ops
BYTE surface_alignment, const enum wined3d_feature_level *levels, unsigned int level_count, BYTE surface_alignment, const enum wined3d_feature_level *levels, unsigned int level_count,
struct wined3d_device_parent *device_parent, struct wined3d_device **device); struct wined3d_device_parent *device_parent, struct wined3d_device **device);
void (*adapter_destroy_device)(struct wined3d_device *device); void (*adapter_destroy_device)(struct wined3d_device *device);
BOOL (*adapter_create_context)(struct wined3d_context *context, BOOL (*adapter_create_context)(struct wined3d_context *context, const struct wined3d_format *ds_format);
struct wined3d_texture *target, const struct wined3d_format *ds_format);
void (*adapter_get_wined3d_caps)(const struct wined3d_adapter *adapter, struct wined3d_caps *caps); void (*adapter_get_wined3d_caps)(const struct wined3d_adapter *adapter, struct wined3d_caps *caps);
BOOL (*adapter_check_format)(const struct wined3d_adapter *adapter, BOOL (*adapter_check_format)(const struct wined3d_adapter *adapter,
const struct wined3d_format *adapter_format, const struct wined3d_format *rt_format, const struct wined3d_format *adapter_format, const struct wined3d_format *rt_format,
@ -2767,9 +2766,10 @@ static inline const struct wined3d_adapter_gl *wined3d_adapter_gl_const(const st
return CONTAINING_RECORD(adapter, struct wined3d_adapter_gl, a); return CONTAINING_RECORD(adapter, struct wined3d_adapter_gl, a);
} }
struct wined3d_adapter *wined3d_adapter_gl_create(unsigned int ordinal, unsigned int wined3d_creation_flags) DECLSPEC_HIDDEN; struct wined3d_adapter *wined3d_adapter_gl_create(unsigned int ordinal,
unsigned int wined3d_creation_flags) DECLSPEC_HIDDEN;
BOOL wined3d_adapter_gl_create_context(struct wined3d_context *context, BOOL wined3d_adapter_gl_create_context(struct wined3d_context *context,
struct wined3d_texture *target, const struct wined3d_format *ds_format) DECLSPEC_HIDDEN; const struct wined3d_format *ds_format) DECLSPEC_HIDDEN;
struct wined3d_adapter_vk struct wined3d_adapter_vk
{ {