[PATCH 4/5] wined3d: Add per-context private data for fragment pipelines.
Stefan Dösinger
stefan at codeweavers.com
Mon Mar 23 12:59:09 CDT 2015
---
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 aa9dc76..747836c 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 afe7158..ee3e90b 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 894e259..974e6f1 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 0b307d3..3375cb2 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -7534,12 +7534,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 136e7f7..516b8af 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 bfef4b0..b303f97 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -5798,11 +5798,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,
};
@@ -5846,6 +5857,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 4e36969..37c3a5b 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1189,6 +1189,7 @@ struct wined3d_context
GLint aux_buffers;
void *shader_backend_data;
+ void *fragment_pipe_data;
/* FBOs */
UINT fbo_entry_count;
@@ -1272,6 +1273,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;
};
--
2.3.3
More information about the wine-patches
mailing list