wined3d: Pass context to vp_free() and free_private().
Avoid using "adapter->gl_info". Signed-off-by: Józef Kucia <jkucia@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
0500b3e38f
commit
6cc36f7296
|
@ -4798,7 +4798,7 @@ static HRESULT shader_arb_alloc(struct wined3d_device *device, const struct wine
|
|||
if (!(fragment_priv = fragment_pipe->alloc_private(&arb_program_shader_backend, priv)))
|
||||
{
|
||||
ERR("Failed to initialize fragment pipe.\n");
|
||||
vertex_pipe->vp_free(device);
|
||||
vertex_pipe->vp_free(device, NULL);
|
||||
heap_free(priv);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
@ -4836,13 +4836,13 @@ static void release_signature(struct wine_rb_entry *entry, void *context)
|
|||
}
|
||||
|
||||
/* Context activation is done by the caller. */
|
||||
static void shader_arb_free(struct wined3d_device *device)
|
||||
static void shader_arb_free(struct wined3d_device *device, struct wined3d_context *context)
|
||||
{
|
||||
struct shader_arb_priv *priv = device->shader_priv;
|
||||
|
||||
wine_rb_destroy(&priv->signature_tree, release_signature, NULL);
|
||||
priv->fragment_pipe->free_private(device);
|
||||
priv->vertex_pipe->vp_free(device);
|
||||
priv->fragment_pipe->free_private(device, context);
|
||||
priv->vertex_pipe->vp_free(device, context);
|
||||
heap_free(device->shader_priv);
|
||||
}
|
||||
|
||||
|
@ -5710,22 +5710,24 @@ static void *arbfp_alloc(const struct wined3d_shader_backend_ops *shader_backend
|
|||
}
|
||||
|
||||
/* Context activation is done by the caller. */
|
||||
static void arbfp_free_ffpshader(struct wine_rb_entry *entry, void *context)
|
||||
static void arbfp_free_ffpshader(struct wine_rb_entry *entry, void *param)
|
||||
{
|
||||
const struct wined3d_gl_info *gl_info = context;
|
||||
struct arbfp_ffp_desc *entry_arb = WINE_RB_ENTRY_VALUE(entry, struct arbfp_ffp_desc, parent.entry);
|
||||
struct wined3d_context *context = param;
|
||||
const struct wined3d_gl_info *gl_info;
|
||||
|
||||
gl_info = context->gl_info;
|
||||
GL_EXTCALL(glDeleteProgramsARB(1, &entry_arb->shader));
|
||||
checkGLcall("glDeleteProgramsARB(1, &entry_arb->shader)");
|
||||
checkGLcall("delete ffp program");
|
||||
heap_free(entry_arb);
|
||||
}
|
||||
|
||||
/* Context activation is done by the caller. */
|
||||
static void arbfp_free(struct wined3d_device *device)
|
||||
static void arbfp_free(struct wined3d_device *device, struct wined3d_context *context)
|
||||
{
|
||||
struct shader_arb_priv *priv = device->fragment_priv;
|
||||
|
||||
wine_rb_destroy(&priv->fragment_shaders, arbfp_free_ffpshader, &device->adapter->gl_info);
|
||||
wine_rb_destroy(&priv->fragment_shaders, arbfp_free_ffpshader, context);
|
||||
priv->use_arbfp_fixed_func = FALSE;
|
||||
|
||||
if (device->shader_backend != &arb_program_shader_backend)
|
||||
|
|
|
@ -1329,22 +1329,24 @@ static void *atifs_alloc(const struct wined3d_shader_backend_ops *shader_backend
|
|||
}
|
||||
|
||||
/* Context activation is done by the caller. */
|
||||
static void atifs_free_ffpshader(struct wine_rb_entry *entry, void *cb_ctx)
|
||||
static void atifs_free_ffpshader(struct wine_rb_entry *entry, void *param)
|
||||
{
|
||||
const struct wined3d_gl_info *gl_info = cb_ctx;
|
||||
struct atifs_ffp_desc *entry_ati = WINE_RB_ENTRY_VALUE(entry, struct atifs_ffp_desc, parent.entry);
|
||||
struct wined3d_context *context = param;
|
||||
const struct wined3d_gl_info *gl_info;
|
||||
|
||||
gl_info = context->gl_info;
|
||||
GL_EXTCALL(glDeleteFragmentShaderATI(entry_ati->shader));
|
||||
checkGLcall("glDeleteFragmentShaderATI(entry->shader)");
|
||||
heap_free(entry_ati);
|
||||
}
|
||||
|
||||
/* Context activation is done by the caller. */
|
||||
static void atifs_free(struct wined3d_device *device)
|
||||
static void atifs_free(struct wined3d_device *device, struct wined3d_context *context)
|
||||
{
|
||||
struct atifs_private_data *priv = device->fragment_priv;
|
||||
|
||||
wine_rb_destroy(&priv->fragment_shaders, atifs_free_ffpshader, &device->adapter->gl_info);
|
||||
wine_rb_destroy(&priv->fragment_shaders, atifs_free_ffpshader, context);
|
||||
|
||||
heap_free(priv);
|
||||
device->fragment_priv = NULL;
|
||||
|
|
|
@ -1002,7 +1002,7 @@ static void wined3d_device_delete_opengl_contexts_cs(void *object)
|
|||
|
||||
context = context_acquire(device, NULL, 0);
|
||||
device->blitter->ops->blitter_destroy(device->blitter, context);
|
||||
device->shader_backend->shader_free_private(device);
|
||||
device->shader_backend->shader_free_private(device, context);
|
||||
destroy_dummy_textures(device, context);
|
||||
destroy_default_samplers(device, context);
|
||||
context_release(context);
|
||||
|
@ -1040,7 +1040,7 @@ static void wined3d_device_create_primary_opengl_context_cs(void *object)
|
|||
if (!(device->blitter = wined3d_cpu_blitter_create()))
|
||||
{
|
||||
ERR("Failed to create CPU blitter.\n");
|
||||
device->shader_backend->shader_free_private(device);
|
||||
device->shader_backend->shader_free_private(device, NULL);
|
||||
return;
|
||||
}
|
||||
wined3d_ffp_blitter_create(&device->blitter, &device->adapter->gl_info);
|
||||
|
|
|
@ -352,7 +352,7 @@ struct glsl_ffp_fragment_shader
|
|||
struct glsl_ffp_destroy_ctx
|
||||
{
|
||||
struct shader_glsl_priv *priv;
|
||||
const struct wined3d_gl_info *gl_info;
|
||||
const struct wined3d_context *context;
|
||||
};
|
||||
|
||||
static void shader_glsl_generate_shader_epilogue(const struct wined3d_shader_context *ctx);
|
||||
|
@ -11208,7 +11208,7 @@ static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct win
|
|||
if (!(fragment_priv = fragment_pipe->alloc_private(&glsl_shader_backend, priv)))
|
||||
{
|
||||
ERR("Failed to initialize fragment pipe.\n");
|
||||
vertex_pipe->vp_free(device);
|
||||
vertex_pipe->vp_free(device, NULL);
|
||||
heap_free(priv);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
@ -11257,14 +11257,14 @@ fail:
|
|||
constant_heap_free(&priv->vconst_heap);
|
||||
heap_free(priv->stack);
|
||||
string_buffer_free(&priv->shader_buffer);
|
||||
fragment_pipe->free_private(device);
|
||||
vertex_pipe->vp_free(device);
|
||||
fragment_pipe->free_private(device, NULL);
|
||||
vertex_pipe->vp_free(device, NULL);
|
||||
heap_free(priv);
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
/* Context activation is done by the caller. */
|
||||
static void shader_glsl_free(struct wined3d_device *device)
|
||||
static void shader_glsl_free(struct wined3d_device *device, struct wined3d_context *context)
|
||||
{
|
||||
struct shader_glsl_priv *priv = device->shader_priv;
|
||||
|
||||
|
@ -11274,8 +11274,8 @@ static void shader_glsl_free(struct wined3d_device *device)
|
|||
heap_free(priv->stack);
|
||||
string_buffer_list_cleanup(&priv->string_buffers);
|
||||
string_buffer_free(&priv->shader_buffer);
|
||||
priv->fragment_pipe->free_private(device);
|
||||
priv->vertex_pipe->vp_free(device);
|
||||
priv->fragment_pipe->free_private(device, context);
|
||||
priv->vertex_pipe->vp_free(device, context);
|
||||
|
||||
heap_free(device->shader_priv);
|
||||
device->shader_priv = NULL;
|
||||
|
@ -11718,30 +11718,31 @@ static void *glsl_vertex_pipe_vp_alloc(const struct wined3d_shader_backend_ops *
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static void shader_glsl_free_ffp_vertex_shader(struct wine_rb_entry *entry, void *context)
|
||||
static void shader_glsl_free_ffp_vertex_shader(struct wine_rb_entry *entry, void *param)
|
||||
{
|
||||
struct glsl_ffp_vertex_shader *shader = WINE_RB_ENTRY_VALUE(entry,
|
||||
struct glsl_ffp_vertex_shader, desc.entry);
|
||||
struct glsl_shader_prog_link *program, *program2;
|
||||
struct glsl_ffp_destroy_ctx *ctx = context;
|
||||
struct glsl_ffp_destroy_ctx *ctx = param;
|
||||
const struct wined3d_gl_info *gl_info = ctx->context->gl_info;
|
||||
|
||||
LIST_FOR_EACH_ENTRY_SAFE(program, program2, &shader->linked_programs,
|
||||
struct glsl_shader_prog_link, vs.shader_entry)
|
||||
{
|
||||
delete_glsl_program_entry(ctx->priv, ctx->gl_info, program);
|
||||
delete_glsl_program_entry(ctx->priv, gl_info, program);
|
||||
}
|
||||
ctx->gl_info->gl_ops.ext.p_glDeleteShader(shader->id);
|
||||
GL_EXTCALL(glDeleteShader(shader->id));
|
||||
heap_free(shader);
|
||||
}
|
||||
|
||||
/* Context activation is done by the caller. */
|
||||
static void glsl_vertex_pipe_vp_free(struct wined3d_device *device)
|
||||
static void glsl_vertex_pipe_vp_free(struct wined3d_device *device, struct wined3d_context *context)
|
||||
{
|
||||
struct shader_glsl_priv *priv = device->vertex_priv;
|
||||
struct glsl_ffp_destroy_ctx ctx;
|
||||
|
||||
ctx.priv = priv;
|
||||
ctx.gl_info = &device->adapter->gl_info;
|
||||
ctx.context = context;
|
||||
wine_rb_destroy(&priv->ffp_vertex_shaders, shader_glsl_free_ffp_vertex_shader, &ctx);
|
||||
}
|
||||
|
||||
|
@ -12225,30 +12226,31 @@ static void *glsl_fragment_pipe_alloc(const struct wined3d_shader_backend_ops *s
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static void shader_glsl_free_ffp_fragment_shader(struct wine_rb_entry *entry, void *context)
|
||||
static void shader_glsl_free_ffp_fragment_shader(struct wine_rb_entry *entry, void *param)
|
||||
{
|
||||
struct glsl_ffp_fragment_shader *shader = WINE_RB_ENTRY_VALUE(entry,
|
||||
struct glsl_ffp_fragment_shader, entry.entry);
|
||||
struct glsl_shader_prog_link *program, *program2;
|
||||
struct glsl_ffp_destroy_ctx *ctx = context;
|
||||
struct glsl_ffp_destroy_ctx *ctx = param;
|
||||
const struct wined3d_gl_info *gl_info = ctx->context->gl_info;
|
||||
|
||||
LIST_FOR_EACH_ENTRY_SAFE(program, program2, &shader->linked_programs,
|
||||
struct glsl_shader_prog_link, ps.shader_entry)
|
||||
{
|
||||
delete_glsl_program_entry(ctx->priv, ctx->gl_info, program);
|
||||
delete_glsl_program_entry(ctx->priv, gl_info, program);
|
||||
}
|
||||
ctx->gl_info->gl_ops.ext.p_glDeleteShader(shader->id);
|
||||
GL_EXTCALL(glDeleteShader(shader->id));
|
||||
heap_free(shader);
|
||||
}
|
||||
|
||||
/* Context activation is done by the caller. */
|
||||
static void glsl_fragment_pipe_free(struct wined3d_device *device)
|
||||
static void glsl_fragment_pipe_free(struct wined3d_device *device, struct wined3d_context *context)
|
||||
{
|
||||
struct shader_glsl_priv *priv = device->fragment_priv;
|
||||
struct glsl_ffp_destroy_ctx ctx;
|
||||
|
||||
ctx.priv = priv;
|
||||
ctx.gl_info = &device->adapter->gl_info;
|
||||
ctx.context = context;
|
||||
wine_rb_destroy(&priv->ffp_fragment_shaders, shader_glsl_free_ffp_fragment_shader, &ctx);
|
||||
}
|
||||
|
||||
|
|
|
@ -754,7 +754,7 @@ static void *nvrc_fragment_alloc(const struct wined3d_shader_backend_ops *shader
|
|||
}
|
||||
|
||||
/* Context activation is done by the caller. */
|
||||
static void nvrc_fragment_free(struct wined3d_device *device) {}
|
||||
static void nvrc_fragment_free(struct wined3d_device *device, struct wined3d_context *context) {}
|
||||
|
||||
/* Two fixed function pipeline implementations using GL_NV_register_combiners and
|
||||
* GL_NV_texture_shader. The nvts_fragment_pipeline assumes that both extensions
|
||||
|
|
|
@ -3229,7 +3229,7 @@ static HRESULT shader_none_alloc(struct wined3d_device *device, const struct win
|
|||
if (!(fragment_priv = fragment_pipe->alloc_private(&none_shader_backend, priv)))
|
||||
{
|
||||
ERR("Failed to initialize fragment pipe.\n");
|
||||
vertex_pipe->vp_free(device);
|
||||
vertex_pipe->vp_free(device, NULL);
|
||||
heap_free(priv);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
@ -3246,12 +3246,12 @@ static HRESULT shader_none_alloc(struct wined3d_device *device, const struct win
|
|||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
static void shader_none_free(struct wined3d_device *device)
|
||||
static void shader_none_free(struct wined3d_device *device, struct wined3d_context *context)
|
||||
{
|
||||
struct shader_none_priv *priv = device->shader_priv;
|
||||
|
||||
priv->fragment_pipe->free_private(device);
|
||||
priv->vertex_pipe->vp_free(device);
|
||||
priv->fragment_pipe->free_private(device, context);
|
||||
priv->vertex_pipe->vp_free(device, context);
|
||||
heap_free(priv);
|
||||
}
|
||||
|
||||
|
|
|
@ -5198,7 +5198,7 @@ static void *ffp_alloc(const struct wined3d_shader_backend_ops *shader_backend,
|
|||
return shader_priv;
|
||||
}
|
||||
|
||||
static void ffp_free(struct wined3d_device *device) {}
|
||||
static void ffp_free(struct wined3d_device *device, struct wined3d_context *context) {}
|
||||
|
||||
static void vp_ffp_get_caps(const struct wined3d_gl_info *gl_info, struct wined3d_vertex_caps *caps)
|
||||
{
|
||||
|
@ -5316,7 +5316,7 @@ static void *none_alloc(const struct wined3d_shader_backend_ops *shader_backend,
|
|||
return shader_priv;
|
||||
}
|
||||
|
||||
static void none_free(struct wined3d_device *device) {}
|
||||
static void none_free(struct wined3d_device *device, struct wined3d_context *context) {}
|
||||
|
||||
static void vp_none_get_caps(const struct wined3d_gl_info *gl_info, struct wined3d_vertex_caps *caps)
|
||||
{
|
||||
|
|
|
@ -1431,7 +1431,7 @@ struct wined3d_shader_backend_ops
|
|||
void (*shader_destroy)(struct wined3d_shader *shader);
|
||||
HRESULT (*shader_alloc_private)(struct wined3d_device *device, const struct wined3d_vertex_pipe_ops *vertex_pipe,
|
||||
const struct fragment_pipeline *fragment_pipe);
|
||||
void (*shader_free_private)(struct wined3d_device *device);
|
||||
void (*shader_free_private)(struct wined3d_device *device, struct wined3d_context *context);
|
||||
BOOL (*shader_allocate_context_data)(struct wined3d_context *context);
|
||||
void (*shader_free_context_data)(struct wined3d_context *context);
|
||||
void (*shader_init_context_state)(struct wined3d_context *context);
|
||||
|
@ -2063,7 +2063,7 @@ struct fragment_pipeline
|
|||
void (*get_caps)(const struct wined3d_gl_info *gl_info, struct fragment_caps *caps);
|
||||
DWORD (*get_emul_mask)(const struct wined3d_gl_info *gl_info);
|
||||
void *(*alloc_private)(const struct wined3d_shader_backend_ops *shader_backend, void *shader_priv);
|
||||
void (*free_private)(struct wined3d_device *device);
|
||||
void (*free_private)(struct wined3d_device *device, struct wined3d_context *context);
|
||||
BOOL (*allocate_context_data)(struct wined3d_context *context);
|
||||
void (*free_context_data)(struct wined3d_context *context);
|
||||
BOOL (*color_fixup_supported)(struct color_fixup_desc fixup);
|
||||
|
@ -2090,7 +2090,7 @@ struct wined3d_vertex_pipe_ops
|
|||
void (*vp_get_caps)(const struct wined3d_gl_info *gl_info, struct wined3d_vertex_caps *caps);
|
||||
DWORD (*vp_get_emul_mask)(const struct wined3d_gl_info *gl_info);
|
||||
void *(*vp_alloc)(const struct wined3d_shader_backend_ops *shader_backend, void *shader_priv);
|
||||
void (*vp_free)(struct wined3d_device *device);
|
||||
void (*vp_free)(struct wined3d_device *device, struct wined3d_context *context);
|
||||
const struct wined3d_state_entry_template *vp_states;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue