From 239e8cad7c01c295f5657cf39f55d255eb0c5044 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Mon, 23 Mar 2015 18:59:09 +0100 Subject: [PATCH] wined3d: Add per-context private data for fragment pipelines. --- dlls/wined3d/arb_program_shader.c | 11 +++++++++++ dlls/wined3d/ati_fragment_shader.c | 11 +++++++++++ dlls/wined3d/context.c | 7 +++++++ dlls/wined3d/glsl_shader.c | 11 +++++++++++ dlls/wined3d/nvidia_texture_shader.c | 14 ++++++++++++++ dlls/wined3d/state.c | 13 +++++++++++++ dlls/wined3d/wined3d_private.h | 3 +++ 7 files changed, 70 insertions(+) diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c index aa9dc76c2cc..747836c8e8a 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c @@ -6789,11 +6789,22 @@ static const struct StateEntryTemplate arbfp_fragmentstate_template[] = {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 = { arbfp_enable, arbfp_get_caps, arbfp_alloc, arbfp_free, + arbfp_alloc_context_data, + arbfp_free_context_data, shader_arb_color_fixup_supported, arbfp_fragmentstate_template, }; diff --git a/dlls/wined3d/ati_fragment_shader.c b/dlls/wined3d/ati_fragment_shader.c index afe71583144..ee3e90b8226 100644 --- a/dlls/wined3d/ati_fragment_shader.c +++ b/dlls/wined3d/ati_fragment_shader.c @@ -1249,11 +1249,22 @@ static BOOL atifs_color_fixup_supported(struct color_fixup_desc fixup) 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 = { atifs_enable, atifs_get_caps, atifs_alloc, atifs_free, + atifs_alloc_context_data, + atifs_free_context_data, atifs_color_fixup_supported, atifs_fragmentstate_template, }; diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c index f87500676ea..1d7cf9ca9b9 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c @@ -1447,6 +1447,11 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, ERR("Failed to allocate shader backend context data.\n"); 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 */ for (s = 0; s < MAX_COMBINED_SAMPLERS; ++s) @@ -1764,6 +1769,7 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain, out: 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_occlusion_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->adapter->fragment_pipe->free_context_data(context); HeapFree(GetProcessHeap(), 0, context->draw_buffers); HeapFree(GetProcessHeap(), 0, context->blit_targets); device_context_remove(device, context); diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 6e3b5359d4d..0fa8308a88e 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -7539,12 +7539,23 @@ static const struct StateEntryTemplate glsl_fragment_pipe_state_template[] = {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 = { glsl_fragment_pipe_enable, glsl_fragment_pipe_get_caps, glsl_fragment_pipe_alloc, glsl_fragment_pipe_free, + glsl_fragment_pipe_alloc_context_data, + glsl_fragment_pipe_free_context_data, shader_glsl_color_fixup_supported, glsl_fragment_pipe_state_template, }; diff --git a/dlls/wined3d/nvidia_texture_shader.c b/dlls/wined3d/nvidia_texture_shader.c index 136e7f786ab..516b8af958a 100644 --- a/dlls/wined3d/nvidia_texture_shader.c +++ b/dlls/wined3d/nvidia_texture_shader.c @@ -906,11 +906,23 @@ static const struct StateEntryTemplate nvrc_fragmentstate_template[] = {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 = { nvts_enable, nvrc_fragment_get_caps, nvrc_fragment_alloc, nvrc_fragment_free, + nvrc_context_alloc, + nvrc_context_free, nvts_color_fixup_supported, nvrc_fragmentstate_template, }; @@ -920,6 +932,8 @@ const struct fragment_pipeline nvrc_fragment_pipeline = { nvrc_fragment_get_caps, nvrc_fragment_alloc, nvrc_fragment_free, + nvrc_context_alloc, + nvrc_context_free, nvts_color_fixup_supported, nvrc_fragmentstate_template, }; diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index 4118f69b97b..a949077f427 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -5793,11 +5793,22 @@ static BOOL ffp_color_fixup_supported(struct color_fixup_desc fixup) 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 = { ffp_enable, ffp_fragment_get_caps, ffp_alloc, ffp_free, + ffp_none_context_alloc, + ffp_none_context_free, ffp_color_fixup_supported, ffp_fragmentstate_template, }; @@ -5841,6 +5852,8 @@ const struct fragment_pipeline none_fragment_pipe = fp_none_get_caps, none_alloc, none_free, + ffp_none_context_alloc, + ffp_none_context_free, fp_none_color_fixup_supported, NULL, }; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 99d7aed25be..c88f9b1204e 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -1190,6 +1190,7 @@ struct wined3d_context GLint aux_buffers; void *shader_backend_data; + void *fragment_pipe_data; /* FBOs */ 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 *(*alloc_private)(const struct wined3d_shader_backend_ops *shader_backend, void *shader_priv); 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); const struct StateEntryTemplate *states; };