[PATCH 4/5] wined3d: Explicitly pass the state to shader_load_constants
Stefan Dösinger
stefan at codeweavers.com
Sun May 12 08:30:26 CDT 2013
This patch drops the stateBlock->changed.*ShaderConstants{B/I} checks from GLSL as
well. The changed.*ShaderConstantF checks remain, they are necessary to correctly
grow the constant heap. The plan for those is to maintain a copy of this
information in the GLSL backend's private data and use the stateblock information
only for stateblock recording.
---
dlls/wined3d/arb_program_shader.c | 9 +++------
dlls/wined3d/context.c | 3 ++-
dlls/wined3d/glsl_shader.c | 16 +++++++---------
dlls/wined3d/shader.c | 3 ++-
dlls/wined3d/wined3d_private.h | 3 ++-
5 files changed, 16 insertions(+), 18 deletions(-)
diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index ebacac2..4cae597 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -719,13 +719,10 @@ static void shader_arb_load_constants_internal(const struct wined3d_context *con
}
}
-static void shader_arb_load_constants(const struct wined3d_context *context, BOOL ps, BOOL vs)
+static void shader_arb_load_constants(const struct wined3d_context *context, BOOL ps, BOOL vs,
+ const struct wined3d_state *state, void *shader_priv)
{
- struct wined3d_device *device = context->swapchain->device;
- const struct wined3d_stateblock *stateblock = device->stateBlock;
- const struct wined3d_state *state = &stateblock->state;
-
- shader_arb_load_constants_internal(context, ps, vs, FALSE, state, device->shader_priv);
+ shader_arb_load_constants_internal(context, ps, vs, FALSE, state, shader_priv);
}
static void shader_arb_update_float_vertex_constants(struct wined3d_device *device, UINT start, UINT count)
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 6d30f1c..a413e27 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -2411,7 +2411,8 @@ BOOL context_apply_draw_state(struct wined3d_context *context, struct wined3d_de
if (context->load_constants)
{
- device->shader_backend->shader_load_constants(context, use_ps(state), use_vs(state));
+ device->shader_backend->shader_load_constants(context, use_ps(state), use_vs(state),
+ state, device->shader_priv);
context->load_constants = 0;
}
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index 16054ed..359120a 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -726,13 +726,11 @@ static void shader_glsl_load_np2fixup_constants(void *shader_priv,
/* Context activation is done by the caller (state handler). */
static void shader_glsl_load_constants(const struct wined3d_context *context,
- BOOL usePixelShader, BOOL useVertexShader)
+ BOOL usePixelShader, BOOL useVertexShader, const struct wined3d_state *state,
+ void *shader_priv)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
- struct wined3d_device *device = context->swapchain->device;
- struct wined3d_stateblock *stateBlock = device->stateBlock;
- const struct wined3d_state *state = &stateBlock->state;
- struct shader_glsl_priv *priv = device->shader_priv;
+ struct shader_glsl_priv *priv = shader_priv;
float position_fixup[4];
GLhandleARB programId;
@@ -757,11 +755,11 @@ static void shader_glsl_load_constants(const struct wined3d_context *context,
/* Load DirectX 9 integer constants/uniforms for vertex shader */
shader_glsl_load_constantsI(vshader, gl_info, prog->vs.uniform_i_locations, state->vs_consts_i,
- stateBlock->changed.vertexShaderConstantsI & vshader->reg_maps.integer_constants);
+ vshader->reg_maps.integer_constants);
/* Load DirectX 9 boolean constants/uniforms for vertex shader */
shader_glsl_load_constantsB(vshader, gl_info, programId, state->vs_consts_b,
- stateBlock->changed.vertexShaderConstantsB & vshader->reg_maps.boolean_constants);
+ vshader->reg_maps.boolean_constants);
/* Upload the position fixup params */
shader_get_position_fixup(context, state, position_fixup);
@@ -779,11 +777,11 @@ static void shader_glsl_load_constants(const struct wined3d_context *context,
/* Load DirectX 9 integer constants/uniforms for pixel shader */
shader_glsl_load_constantsI(pshader, gl_info, prog->ps.uniform_i_locations, state->ps_consts_i,
- stateBlock->changed.pixelShaderConstantsI & pshader->reg_maps.integer_constants);
+ pshader->reg_maps.integer_constants);
/* Load DirectX 9 boolean constants/uniforms for pixel shader */
shader_glsl_load_constantsB(pshader, gl_info, programId, state->ps_consts_b,
- stateBlock->changed.pixelShaderConstantsB & pshader->reg_maps.boolean_constants);
+ pshader->reg_maps.boolean_constants);
/* Upload the environment bump map matrix if needed. The needsbumpmat
* member specifies the texture stage to load the matrix from. It
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
index d9528d2..14ad322 100644
--- a/dlls/wined3d/shader.c
+++ b/dlls/wined3d/shader.c
@@ -1509,7 +1509,8 @@ static void shader_none_select_depth_blt(void *shader_priv, const struct wined3d
static void shader_none_deselect_depth_blt(void *shader_priv, const struct wined3d_gl_info *gl_info) {}
static void shader_none_update_float_vertex_constants(struct wined3d_device *device, UINT start, UINT count) {}
static void shader_none_update_float_pixel_constants(struct wined3d_device *device, UINT start, UINT count) {}
-static void shader_none_load_constants(const struct wined3d_context *context, BOOL usePS, BOOL useVS) {}
+static void shader_none_load_constants(const struct wined3d_context *context, BOOL usePS, BOOL useVS,
+ const struct wined3d_state *state, void *shader_priv) {}
static void shader_none_load_np2fixup_constants(void *shader_priv,
const struct wined3d_gl_info *gl_info, const struct wined3d_state *state) {}
static void shader_none_destroy(struct wined3d_shader *shader) {}
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index abf44c9..4b01f61 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -806,7 +806,8 @@ struct wined3d_shader_backend_ops
void (*shader_deselect_depth_blt)(void *shader_priv, const struct wined3d_gl_info *gl_info);
void (*shader_update_float_vertex_constants)(struct wined3d_device *device, UINT start, UINT count);
void (*shader_update_float_pixel_constants)(struct wined3d_device *device, UINT start, UINT count);
- void (*shader_load_constants)(const struct wined3d_context *context, BOOL usePS, BOOL useVS);
+ void (*shader_load_constants)(const struct wined3d_context *context, BOOL usePS, BOOL useVS,
+ const struct wined3d_state *state, void *shader_priv);
void (*shader_load_np2fixup_constants)(void *shader_priv, const struct wined3d_gl_info *gl_info,
const struct wined3d_state *state);
void (*shader_destroy)(struct wined3d_shader *shader);
--
1.8.1.5
More information about the wine-patches
mailing list