wined3d: Add per-context private data for fragment pipelines.

This commit is contained in:
Stefan Dösinger 2015-03-23 18:59:09 +01:00 committed by Alexandre Julliard
parent 1b0c063632
commit 239e8cad7c
7 changed files with 70 additions and 0 deletions

View File

@ -6789,11 +6789,22 @@ static const struct StateEntryTemplate arbfp_fragmentstate_template[] =
{0 /* Terminate */, { 0, 0 }, WINED3D_GL_EXT_NONE }, {0 /* Terminate */, { 0, 0 }, WINED3D_GL_EXT_NONE },
}; };
static BOOL arbfp_alloc_context_data(struct wined3d_context *context)
{
return TRUE;
}
static void arbfp_free_context_data(struct wined3d_context *context)
{
}
const struct fragment_pipeline arbfp_fragment_pipeline = { const struct fragment_pipeline arbfp_fragment_pipeline = {
arbfp_enable, arbfp_enable,
arbfp_get_caps, arbfp_get_caps,
arbfp_alloc, arbfp_alloc,
arbfp_free, arbfp_free,
arbfp_alloc_context_data,
arbfp_free_context_data,
shader_arb_color_fixup_supported, shader_arb_color_fixup_supported,
arbfp_fragmentstate_template, arbfp_fragmentstate_template,
}; };

View File

@ -1249,11 +1249,22 @@ static BOOL atifs_color_fixup_supported(struct color_fixup_desc fixup)
return FALSE; return FALSE;
} }
static BOOL atifs_alloc_context_data(struct wined3d_context *context)
{
return TRUE;
}
static void atifs_free_context_data(struct wined3d_context *context)
{
}
const struct fragment_pipeline atifs_fragment_pipeline = { const struct fragment_pipeline atifs_fragment_pipeline = {
atifs_enable, atifs_enable,
atifs_get_caps, atifs_get_caps,
atifs_alloc, atifs_alloc,
atifs_free, atifs_free,
atifs_alloc_context_data,
atifs_free_context_data,
atifs_color_fixup_supported, atifs_color_fixup_supported,
atifs_fragmentstate_template, atifs_fragmentstate_template,
}; };

View File

@ -1447,6 +1447,11 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
ERR("Failed to allocate shader backend context data.\n"); ERR("Failed to allocate shader backend context data.\n");
goto out; goto out;
} }
if (!device->adapter->fragment_pipe->allocate_context_data(ret))
{
ERR("Failed to allocate fragment pipeline context data.\n");
goto out;
}
/* Initialize the texture unit mapping to a 1:1 mapping */ /* Initialize the texture unit mapping to a 1:1 mapping */
for (s = 0; s < MAX_COMBINED_SAMPLERS; ++s) for (s = 0; s < MAX_COMBINED_SAMPLERS; ++s)
@ -1764,6 +1769,7 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
out: out:
device->shader_backend->shader_free_context_data(ret); device->shader_backend->shader_free_context_data(ret);
device->adapter->fragment_pipe->free_context_data(ret);
HeapFree(GetProcessHeap(), 0, ret->free_event_queries); HeapFree(GetProcessHeap(), 0, ret->free_event_queries);
HeapFree(GetProcessHeap(), 0, ret->free_occlusion_queries); HeapFree(GetProcessHeap(), 0, ret->free_occlusion_queries);
HeapFree(GetProcessHeap(), 0, ret->free_timestamp_queries); HeapFree(GetProcessHeap(), 0, ret->free_timestamp_queries);
@ -1797,6 +1803,7 @@ void context_destroy(struct wined3d_device *device, struct wined3d_context *cont
} }
device->shader_backend->shader_free_context_data(context); device->shader_backend->shader_free_context_data(context);
device->adapter->fragment_pipe->free_context_data(context);
HeapFree(GetProcessHeap(), 0, context->draw_buffers); HeapFree(GetProcessHeap(), 0, context->draw_buffers);
HeapFree(GetProcessHeap(), 0, context->blit_targets); HeapFree(GetProcessHeap(), 0, context->blit_targets);
device_context_remove(device, context); device_context_remove(device, context);

View File

@ -7539,12 +7539,23 @@ static const struct StateEntryTemplate glsl_fragment_pipe_state_template[] =
{0 /* Terminate */, {0, 0 }, WINED3D_GL_EXT_NONE }, {0 /* Terminate */, {0, 0 }, WINED3D_GL_EXT_NONE },
}; };
static BOOL glsl_fragment_pipe_alloc_context_data(struct wined3d_context *context)
{
return TRUE;
}
static void glsl_fragment_pipe_free_context_data(struct wined3d_context *context)
{
}
const struct fragment_pipeline glsl_fragment_pipe = const struct fragment_pipeline glsl_fragment_pipe =
{ {
glsl_fragment_pipe_enable, glsl_fragment_pipe_enable,
glsl_fragment_pipe_get_caps, glsl_fragment_pipe_get_caps,
glsl_fragment_pipe_alloc, glsl_fragment_pipe_alloc,
glsl_fragment_pipe_free, glsl_fragment_pipe_free,
glsl_fragment_pipe_alloc_context_data,
glsl_fragment_pipe_free_context_data,
shader_glsl_color_fixup_supported, shader_glsl_color_fixup_supported,
glsl_fragment_pipe_state_template, glsl_fragment_pipe_state_template,
}; };

View File

@ -906,11 +906,23 @@ static const struct StateEntryTemplate nvrc_fragmentstate_template[] =
{0 /* Terminate */, { 0, 0 }, WINED3D_GL_EXT_NONE }, {0 /* Terminate */, { 0, 0 }, WINED3D_GL_EXT_NONE },
}; };
static BOOL nvrc_context_alloc(struct wined3d_context *context)
{
return TRUE;
}
static void nvrc_context_free(struct wined3d_context *context)
{
}
const struct fragment_pipeline nvts_fragment_pipeline = { const struct fragment_pipeline nvts_fragment_pipeline = {
nvts_enable, nvts_enable,
nvrc_fragment_get_caps, nvrc_fragment_get_caps,
nvrc_fragment_alloc, nvrc_fragment_alloc,
nvrc_fragment_free, nvrc_fragment_free,
nvrc_context_alloc,
nvrc_context_free,
nvts_color_fixup_supported, nvts_color_fixup_supported,
nvrc_fragmentstate_template, nvrc_fragmentstate_template,
}; };
@ -920,6 +932,8 @@ const struct fragment_pipeline nvrc_fragment_pipeline = {
nvrc_fragment_get_caps, nvrc_fragment_get_caps,
nvrc_fragment_alloc, nvrc_fragment_alloc,
nvrc_fragment_free, nvrc_fragment_free,
nvrc_context_alloc,
nvrc_context_free,
nvts_color_fixup_supported, nvts_color_fixup_supported,
nvrc_fragmentstate_template, nvrc_fragmentstate_template,
}; };

View File

@ -5793,11 +5793,22 @@ static BOOL ffp_color_fixup_supported(struct color_fixup_desc fixup)
return FALSE; return FALSE;
} }
static BOOL ffp_none_context_alloc(struct wined3d_context *context)
{
return TRUE;
}
static void ffp_none_context_free(struct wined3d_context *context)
{
}
const struct fragment_pipeline ffp_fragment_pipeline = { const struct fragment_pipeline ffp_fragment_pipeline = {
ffp_enable, ffp_enable,
ffp_fragment_get_caps, ffp_fragment_get_caps,
ffp_alloc, ffp_alloc,
ffp_free, ffp_free,
ffp_none_context_alloc,
ffp_none_context_free,
ffp_color_fixup_supported, ffp_color_fixup_supported,
ffp_fragmentstate_template, ffp_fragmentstate_template,
}; };
@ -5841,6 +5852,8 @@ const struct fragment_pipeline none_fragment_pipe =
fp_none_get_caps, fp_none_get_caps,
none_alloc, none_alloc,
none_free, none_free,
ffp_none_context_alloc,
ffp_none_context_free,
fp_none_color_fixup_supported, fp_none_color_fixup_supported,
NULL, NULL,
}; };

View File

@ -1190,6 +1190,7 @@ struct wined3d_context
GLint aux_buffers; GLint aux_buffers;
void *shader_backend_data; void *shader_backend_data;
void *fragment_pipe_data;
/* FBOs */ /* FBOs */
UINT fbo_entry_count; UINT fbo_entry_count;
@ -1273,6 +1274,8 @@ struct fragment_pipeline
void (*get_caps)(const struct wined3d_gl_info *gl_info, struct fragment_caps *caps); void (*get_caps)(const struct wined3d_gl_info *gl_info, struct fragment_caps *caps);
void *(*alloc_private)(const struct wined3d_shader_backend_ops *shader_backend, void *shader_priv); 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);
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); BOOL (*color_fixup_supported)(struct color_fixup_desc fixup);
const struct StateEntryTemplate *states; const struct StateEntryTemplate *states;
}; };