[prev in list] [next in list] [prev in thread] [next in thread]
List: wine-devel
Subject: [PATCH 5/5] wined3d: Pass a wined3d_context structure to fragment_pipeline.enable_extension().
From: Henri Verbeet <hverbeet () codeweavers ! com>
Date: 2019-07-31 20:30:06
Message-ID: 20190731201806.7666-5-hverbeet () codeweavers ! com
[Download RAW message or body]
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
---
dlls/wined3d/adapter_gl.c | 2 +-
dlls/wined3d/arb_program_shader.c | 17 ++++++++++-------
dlls/wined3d/ati_fragment_shader.c | 7 +++++--
dlls/wined3d/device.c | 2 +-
dlls/wined3d/glsl_shader.c | 12 ++++++------
dlls/wined3d/nvidia_texture_shader.c | 16 +++++++++++-----
dlls/wined3d/shader.c | 10 ++++------
dlls/wined3d/state.c | 13 ++++++-------
dlls/wined3d/wined3d_private.h | 26 +++++++++++++-------------
9 files changed, 57 insertions(+), 48 deletions(-)
diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c
index dd357e62510..bf07955f13e 100644
--- a/dlls/wined3d/adapter_gl.c
+++ b/dlls/wined3d/adapter_gl.c
@@ -2020,7 +2020,7 @@ static const struct wined3d_vertex_pipe_ops \
*select_vertex_implementation(const return &ffp_vertex_pipe;
}
-static const struct fragment_pipeline *select_fragment_implementation(const struct \
wined3d_gl_info *gl_info, +static const struct wined3d_fragment_pipe_ops \
*select_fragment_implementation(const struct wined3d_gl_info *gl_info, const struct \
wined3d_shader_backend_ops *shader_backend_ops) {
if (shader_backend_ops == &glsl_shader_backend && \
gl_info->supported[ARB_FRAGMENT_SHADER])
diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index d4de02f333f..958c9f2b362 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -304,7 +304,7 @@ struct shader_arb_priv
const struct wined3d_context *last_context;
const struct wined3d_vertex_pipe_ops *vertex_pipe;
- const struct fragment_pipeline *fragment_pipe;
+ const struct wined3d_fragment_pipe_ops *fragment_pipe;
BOOL ffp_proj_control;
};
@@ -4582,7 +4582,7 @@ static void shader_arb_select(void *shader_priv, struct \
wined3d_context *context
checkGLcall("glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, \
priv->current_fprogram_id);");
if (!priv->use_arbfp_fixed_func)
- priv->fragment_pipe->enable_extension(gl_info, FALSE);
+ priv->fragment_pipe->fp_enable(context, FALSE);
/* Enable OpenGL fragment programs. */
gl_info->gl_ops.gl.p_glEnable(GL_FRAGMENT_PROGRAM_ARB);
@@ -4629,7 +4629,7 @@ static void shader_arb_select(void *shader_priv, struct \
wined3d_context *context checkGLcall("glDisable(GL_FRAGMENT_PROGRAM_ARB)");
priv->current_fprogram_id = 0;
}
- priv->fragment_pipe->enable_extension(gl_info, TRUE);
+ priv->fragment_pipe->fp_enable(context, TRUE);
}
if (use_vs(state))
@@ -4712,7 +4712,7 @@ static void shader_arb_disable(void *shader_priv, struct \
wined3d_context *contex checkGLcall("glDisable(GL_FRAGMENT_PROGRAM_ARB)");
priv->current_fprogram_id = 0;
}
- priv->fragment_pipe->enable_extension(gl_info, FALSE);
+ priv->fragment_pipe->fp_enable(context, FALSE);
if (gl_info->supported[ARB_VERTEX_PROGRAM])
{
@@ -4785,7 +4785,7 @@ static int sig_tree_compare(const void *key, const struct \
wine_rb_entry *entry) }
static HRESULT shader_arb_alloc(struct wined3d_device *device, const struct \
wined3d_vertex_pipe_ops *vertex_pipe,
- const struct fragment_pipeline *fragment_pipe)
+ const struct wined3d_fragment_pipe_ops *fragment_pipe)
{
const struct wined3d_d3d_info *d3d_info = &device->adapter->d3d_info;
struct fragment_caps fragment_caps;
@@ -5685,8 +5685,10 @@ struct arbfp_ffp_desc
};
/* Context activation is done by the caller. */
-static void arbfp_enable(const struct wined3d_gl_info *gl_info, BOOL enable)
+static void arbfp_enable(const struct wined3d_context *context, BOOL enable)
{
+ const struct wined3d_gl_info *gl_info = context->gl_info;
+
if (enable)
{
gl_info->gl_ops.gl.p_glEnable(GL_FRAGMENT_PROGRAM_ARB);
@@ -6855,7 +6857,8 @@ static void arbfp_free_context_data(struct wined3d_context \
*context) {
}
-const struct fragment_pipeline arbfp_fragment_pipeline = {
+const struct wined3d_fragment_pipe_ops arbfp_fragment_pipeline =
+{
arbfp_enable,
arbfp_get_caps,
arbfp_get_emul_mask,
diff --git a/dlls/wined3d/ati_fragment_shader.c b/dlls/wined3d/ati_fragment_shader.c
index 1945344688a..9e87af4240b 100644
--- a/dlls/wined3d/ati_fragment_shader.c
+++ b/dlls/wined3d/ati_fragment_shader.c
@@ -1250,8 +1250,10 @@ static const struct wined3d_state_entry_template \
atifs_fragmentstate_template[] };
/* Context activation is done by the caller. */
-static void atifs_enable(const struct wined3d_gl_info *gl_info, BOOL enable)
+static void atifs_enable(const struct wined3d_context *context, BOOL enable)
{
+ const struct wined3d_gl_info *gl_info = context->gl_info;
+
if (enable)
{
gl_info->gl_ops.gl.p_glEnable(GL_FRAGMENT_SHADER_ATI);
@@ -1376,7 +1378,8 @@ static void atifs_free_context_data(struct wined3d_context \
*context) heap_free(context->fragment_pipe_data);
}
-const struct fragment_pipeline atifs_fragment_pipeline = {
+const struct wined3d_fragment_pipe_ops atifs_fragment_pipeline =
+{
atifs_enable,
atifs_get_caps,
atifs_get_emul_mask,
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 30307cc90c3..8d75175174c 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -5784,8 +5784,8 @@ HRESULT wined3d_device_init(struct wined3d_device *device, \
struct wined3d *wined struct wined3d_device_parent *device_parent)
{
struct wined3d_adapter *adapter = wined3d->adapters[adapter_idx];
+ const struct wined3d_fragment_pipe_ops *fragment_pipeline;
const struct wined3d_vertex_pipe_ops *vertex_pipeline;
- const struct fragment_pipeline *fragment_pipeline;
unsigned int i;
HRESULT hr;
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index 954a768f026..9b388e66d22 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -139,7 +139,7 @@ struct shader_glsl_priv
UINT next_constant_version;
const struct wined3d_vertex_pipe_ops *vertex_pipe;
- const struct fragment_pipeline *fragment_pipe;
+ const struct wined3d_fragment_pipe_ops *fragment_pipe;
struct wine_rb_tree ffp_vertex_shaders;
struct wine_rb_tree ffp_fragment_shaders;
BOOL ffp_proj_control;
@@ -10554,7 +10554,7 @@ static void shader_glsl_select(void *shader_priv, struct \
wined3d_context *contex GLuint program_id, prev_id;
priv->vertex_pipe->vp_enable(context, !use_vs(state));
- priv->fragment_pipe->enable_extension(gl_info, !use_ps(state));
+ priv->fragment_pipe->fp_enable(context, !use_ps(state));
prev_id = ctx_data->glsl_program ? ctx_data->glsl_program->id : 0;
set_glsl_shader_program(context_gl, state, priv, ctx_data);
@@ -10656,7 +10656,7 @@ static void shader_glsl_disable(void *shader_priv, struct \
wined3d_context *conte checkGLcall("glUseProgram");
priv->vertex_pipe->vp_enable(context, FALSE);
- priv->fragment_pipe->enable_extension(gl_info, FALSE);
+ priv->fragment_pipe->fp_enable(context, FALSE);
if (needs_legacy_glsl_syntax(gl_info) && \
gl_info->supported[ARB_COLOR_BUFFER_FLOAT]) {
@@ -10911,7 +10911,7 @@ static void constant_heap_free(struct constant_heap *heap)
}
static HRESULT shader_glsl_alloc(struct wined3d_device *device, const struct \
wined3d_vertex_pipe_ops *vertex_pipe,
- const struct fragment_pipeline *fragment_pipe)
+ const struct wined3d_fragment_pipe_ops *fragment_pipe)
{
SIZE_T stack_size = wined3d_log2i(max(WINED3D_MAX_VS_CONSTS_F, \
WINED3D_MAX_PS_CONSTS_F)) + 1; struct fragment_caps fragment_caps;
@@ -11892,7 +11892,7 @@ const struct wined3d_vertex_pipe_ops glsl_vertex_pipe =
glsl_vertex_pipe_vp_states,
};
-static void glsl_fragment_pipe_enable(const struct wined3d_gl_info *gl_info, BOOL \
enable) +static void glsl_fragment_pipe_enable(const struct wined3d_context *context, \
BOOL enable) {
/* Nothing to do. */
}
@@ -12251,7 +12251,7 @@ static void glsl_fragment_pipe_free_context_data(struct \
wined3d_context *context {
}
-const struct fragment_pipeline glsl_fragment_pipe =
+const struct wined3d_fragment_pipe_ops glsl_fragment_pipe =
{
glsl_fragment_pipe_enable,
glsl_fragment_pipe_get_caps,
diff --git a/dlls/wined3d/nvidia_texture_shader.c \
b/dlls/wined3d/nvidia_texture_shader.c index 1cffbe45798..7ace75841c1 100644
--- a/dlls/wined3d/nvidia_texture_shader.c
+++ b/dlls/wined3d/nvidia_texture_shader.c
@@ -659,8 +659,10 @@ static void nvrc_texfactor(struct wined3d_context *context, \
const struct wined3d }
/* Context activation is done by the caller. */
-static void nvrc_enable(const struct wined3d_gl_info *gl_info, BOOL enable)
+static void nvrc_enable(const struct wined3d_context *context, BOOL enable)
{
+ const struct wined3d_gl_info *gl_info = context->gl_info;
+
if (enable)
{
gl_info->gl_ops.gl.p_glEnable(GL_REGISTER_COMBINERS_NV);
@@ -674,9 +676,11 @@ static void nvrc_enable(const struct wined3d_gl_info *gl_info, \
BOOL enable) }
/* Context activation is done by the caller. */
-static void nvts_enable(const struct wined3d_gl_info *gl_info, BOOL enable)
+static void nvts_enable(const struct wined3d_context *context, BOOL enable)
{
- nvrc_enable(gl_info, enable);
+ const struct wined3d_gl_info *gl_info = context->gl_info;
+
+ nvrc_enable(context, enable);
if (enable)
{
gl_info->gl_ops.gl.p_glEnable(GL_TEXTURE_SHADER_NV);
@@ -923,7 +927,8 @@ static void nvrc_context_free(struct wined3d_context *context)
}
-const struct fragment_pipeline nvts_fragment_pipeline = {
+const struct wined3d_fragment_pipe_ops nvts_fragment_pipeline =
+{
nvts_enable,
nvrc_fragment_get_caps,
nvrc_fragment_get_emul_mask,
@@ -935,7 +940,8 @@ const struct fragment_pipeline nvts_fragment_pipeline = {
nvrc_fragmentstate_template,
};
-const struct fragment_pipeline nvrc_fragment_pipeline = {
+const struct wined3d_fragment_pipe_ops nvrc_fragment_pipeline =
+{
nvrc_enable,
nvrc_fragment_get_caps,
nvrc_fragment_get_emul_mask,
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
index e0055f6ff16..973941b8d9e 100644
--- a/dlls/wined3d/shader.c
+++ b/dlls/wined3d/shader.c
@@ -3165,7 +3165,7 @@ static void shader_cleanup(struct wined3d_shader *shader)
struct shader_none_priv
{
const struct wined3d_vertex_pipe_ops *vertex_pipe;
- const struct fragment_pipeline *fragment_pipe;
+ const struct wined3d_fragment_pipe_ops *fragment_pipe;
BOOL ffp_proj_control;
};
@@ -3185,21 +3185,19 @@ static void shader_none_init_context_state(struct \
wined3d_context *context) {} static void shader_none_select(void *shader_priv, \
struct wined3d_context *context, const struct wined3d_state *state)
{
- const struct wined3d_gl_info *gl_info = context->gl_info;
struct shader_none_priv *priv = shader_priv;
priv->vertex_pipe->vp_enable(context, !use_vs(state));
- priv->fragment_pipe->enable_extension(gl_info, !use_ps(state));
+ priv->fragment_pipe->fp_enable(context, !use_ps(state));
}
/* Context activation is done by the caller. */
static void shader_none_disable(void *shader_priv, struct wined3d_context *context)
{
struct shader_none_priv *priv = shader_priv;
- const struct wined3d_gl_info *gl_info = context->gl_info;
priv->vertex_pipe->vp_enable(context, FALSE);
- priv->fragment_pipe->enable_extension(gl_info, FALSE);
+ priv->fragment_pipe->fp_enable(context, FALSE);
context->shader_update_mask = (1u << WINED3D_SHADER_TYPE_PIXEL)
| (1u << WINED3D_SHADER_TYPE_VERTEX)
@@ -3210,7 +3208,7 @@ static void shader_none_disable(void *shader_priv, struct \
wined3d_context *conte }
static HRESULT shader_none_alloc(struct wined3d_device *device, const struct \
wined3d_vertex_pipe_ops *vertex_pipe,
- const struct fragment_pipeline *fragment_pipe)
+ const struct wined3d_fragment_pipe_ops *fragment_pipe)
{
struct fragment_caps fragment_caps;
void *vertex_priv, *fragment_priv;
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 6df20a40d74..bf110bcf990 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -5186,7 +5186,6 @@ static const struct wined3d_state_entry_template \
ffp_fragmentstate_template[] = };
/* Context activation is done by the caller. */
-static void ffp_enable(const struct wined3d_gl_info *gl_info, BOOL enable) {}
static void ffp_pipe_enable(const struct wined3d_context *context, BOOL enable) {}
static void *ffp_alloc(const struct wined3d_shader_backend_ops *shader_backend, void \
*shader_priv) @@ -5297,8 +5296,9 @@ static void ffp_none_context_free(struct \
wined3d_context *context) {
}
-const struct fragment_pipeline ffp_fragment_pipeline = {
- ffp_enable,
+const struct wined3d_fragment_pipe_ops ffp_fragment_pipeline =
+{
+ ffp_pipe_enable,
ffp_fragment_get_caps,
ffp_fragment_get_emul_mask,
ffp_alloc,
@@ -5309,7 +5309,6 @@ const struct fragment_pipeline ffp_fragment_pipeline = {
ffp_fragmentstate_template,
};
-static void none_enable(const struct wined3d_gl_info *gl_info, BOOL enable) {}
static void none_pipe_enable(const struct wined3d_context *context, BOOL enable) {}
static void *none_alloc(const struct wined3d_shader_backend_ops *shader_backend, \
void *shader_priv) @@ -5354,9 +5353,9 @@ static BOOL \
fp_none_color_fixup_supported(struct color_fixup_desc fixup) return \
is_identity_fixup(fixup); }
-const struct fragment_pipeline none_fragment_pipe =
+const struct wined3d_fragment_pipe_ops none_fragment_pipe =
{
- none_enable,
+ none_pipe_enable,
fp_none_get_caps,
fp_none_get_emul_mask,
none_alloc,
@@ -5522,7 +5521,7 @@ static void validate_state_table(struct wined3d_state_entry \
*state_table)
HRESULT compile_state_table(struct wined3d_state_entry *state_table, APPLYSTATEFUNC \
**dev_multistate_funcs,
const struct wined3d_d3d_info *d3d_info, const BOOL *supported_extensions,
- const struct wined3d_vertex_pipe_ops *vertex, const struct fragment_pipeline \
*fragment, + const struct wined3d_vertex_pipe_ops *vertex, const struct \
wined3d_fragment_pipe_ops *fragment, const struct wined3d_state_entry_template \
*misc) {
APPLYSTATEFUNC multistate_funcs[STATE_HIGHEST + 1][3];
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 7ad0c113641..438e535f8aa 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -74,7 +74,7 @@
#define WINED3D_QUIRK_BROKEN_ARB_FOG 0x00000200
#define WINED3D_QUIRK_NO_INDEPENDENT_BIT_DEPTHS 0x00000400
-struct fragment_pipeline;
+struct wined3d_fragment_pipe_ops;
struct wined3d_adapter;
struct wined3d_context;
struct wined3d_state;
@@ -1444,7 +1444,7 @@ struct wined3d_shader_backend_ops
const struct wined3d_state *state);
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);
+ const struct wined3d_fragment_pipe_ops *fragment_pipe);
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);
@@ -2159,9 +2159,9 @@ struct fragment_caps
#define GL_EXT_EMUL_ARB_MULTITEXTURE 0x00000001
#define GL_EXT_EMUL_EXT_FOG_COORD 0x00000002
-struct fragment_pipeline
+struct wined3d_fragment_pipe_ops
{
- void (*enable_extension)(const struct wined3d_gl_info *gl_info, BOOL enable);
+ void (*fp_enable)(const struct wined3d_context *context, BOOL enable);
void (*get_caps)(const struct wined3d_adapter *adapter, 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); @@ -2197,13 +2197,13 @@ struct wined3d_vertex_pipe_ops
};
extern const struct wined3d_state_entry_template misc_state_template[] \
DECLSPEC_HIDDEN;
-extern const struct fragment_pipeline none_fragment_pipe DECLSPEC_HIDDEN;
-extern const struct fragment_pipeline ffp_fragment_pipeline DECLSPEC_HIDDEN;
-extern const struct fragment_pipeline atifs_fragment_pipeline DECLSPEC_HIDDEN;
-extern const struct fragment_pipeline arbfp_fragment_pipeline DECLSPEC_HIDDEN;
-extern const struct fragment_pipeline nvts_fragment_pipeline DECLSPEC_HIDDEN;
-extern const struct fragment_pipeline nvrc_fragment_pipeline DECLSPEC_HIDDEN;
-extern const struct fragment_pipeline glsl_fragment_pipe DECLSPEC_HIDDEN;
+extern const struct wined3d_fragment_pipe_ops none_fragment_pipe DECLSPEC_HIDDEN;
+extern const struct wined3d_fragment_pipe_ops ffp_fragment_pipeline DECLSPEC_HIDDEN;
+extern const struct wined3d_fragment_pipe_ops atifs_fragment_pipeline \
DECLSPEC_HIDDEN; +extern const struct wined3d_fragment_pipe_ops \
arbfp_fragment_pipeline DECLSPEC_HIDDEN; +extern const struct \
wined3d_fragment_pipe_ops nvts_fragment_pipeline DECLSPEC_HIDDEN; +extern const \
struct wined3d_fragment_pipe_ops nvrc_fragment_pipeline DECLSPEC_HIDDEN; +extern \
const struct wined3d_fragment_pipe_ops glsl_fragment_pipe DECLSPEC_HIDDEN;
extern const struct wined3d_vertex_pipe_ops none_vertex_pipe DECLSPEC_HIDDEN;
extern const struct wined3d_vertex_pipe_ops ffp_vertex_pipe DECLSPEC_HIDDEN;
@@ -2212,7 +2212,7 @@ extern const struct wined3d_vertex_pipe_ops glsl_vertex_pipe \
DECLSPEC_HIDDEN; /* "Base" state table */
HRESULT compile_state_table(struct wined3d_state_entry *state_table, APPLYSTATEFUNC \
**dev_multistate_funcs,
const struct wined3d_d3d_info *d3d_info, const BOOL *supported_extensions,
- const struct wined3d_vertex_pipe_ops *vertex, const struct fragment_pipeline \
*fragment, + const struct wined3d_vertex_pipe_ops *vertex, const struct \
wined3d_fragment_pipe_ops *fragment, const struct wined3d_state_entry_template \
*misc) DECLSPEC_HIDDEN;
enum wined3d_blit_op
@@ -2794,7 +2794,7 @@ struct wined3d_adapter
size_t format_size;
const struct wined3d_vertex_pipe_ops *vertex_pipe;
- const struct fragment_pipeline *fragment_pipe;
+ const struct wined3d_fragment_pipe_ops *fragment_pipe;
const struct wined3d_shader_backend_ops *shader_backend;
const struct wined3d_adapter_ops *adapter_ops;
};
--
2.11.0
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic