Commit 036a62a2 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

wined3d: Explicitly pass the state to shader_load_constants.

parent 5d138799
...@@ -719,13 +719,13 @@ static void shader_arb_load_constants_internal(struct shader_arb_priv *priv, ...@@ -719,13 +719,13 @@ static void shader_arb_load_constants_internal(struct shader_arb_priv *priv,
} }
} }
static void shader_arb_load_constants(const struct wined3d_context *context, BOOL ps, BOOL vs) static void shader_arb_load_constants(void *shader_priv, const struct wined3d_context *context,
const struct wined3d_state *state)
{ {
struct wined3d_device *device = context->swapchain->device; BOOL vs = use_vs(state);
const struct wined3d_stateblock *stateblock = device->stateBlock; BOOL ps = use_ps(state);
const struct wined3d_state *state = &stateblock->state;
shader_arb_load_constants_internal(device->shader_priv, context, state, ps, vs, FALSE); shader_arb_load_constants_internal(shader_priv, context, state, ps, vs, FALSE);
} }
static void shader_arb_update_float_vertex_constants(struct wined3d_device *device, UINT start, UINT count) static void shader_arb_update_float_vertex_constants(struct wined3d_device *device, UINT start, UINT count)
......
...@@ -2411,7 +2411,8 @@ BOOL context_apply_draw_state(struct wined3d_context *context, struct wined3d_de ...@@ -2411,7 +2411,8 @@ BOOL context_apply_draw_state(struct wined3d_context *context, struct wined3d_de
if (context->load_constants) if (context->load_constants)
{ {
device->shader_backend->shader_load_constants(context, use_ps(state), use_vs(state)); device->shader_backend->shader_load_constants(device->shader_priv,
context, state);
context->load_constants = 0; context->load_constants = 0;
} }
......
...@@ -725,14 +725,11 @@ static void shader_glsl_load_np2fixup_constants(void *shader_priv, ...@@ -725,14 +725,11 @@ static void shader_glsl_load_np2fixup_constants(void *shader_priv,
} }
/* Context activation is done by the caller (state handler). */ /* Context activation is done by the caller (state handler). */
static void shader_glsl_load_constants(const struct wined3d_context *context, static void shader_glsl_load_constants(void *shader_priv, const struct wined3d_context *context,
BOOL usePixelShader, BOOL useVertexShader) const struct wined3d_state *state)
{ {
const struct wined3d_gl_info *gl_info = context->gl_info; const struct wined3d_gl_info *gl_info = context->gl_info;
struct wined3d_device *device = context->swapchain->device; struct shader_glsl_priv *priv = shader_priv;
struct wined3d_stateblock *stateBlock = device->stateBlock;
const struct wined3d_state *state = &stateBlock->state;
struct shader_glsl_priv *priv = device->shader_priv;
float position_fixup[4]; float position_fixup[4];
GLhandleARB programId; GLhandleARB programId;
...@@ -747,7 +744,7 @@ static void shader_glsl_load_constants(const struct wined3d_context *context, ...@@ -747,7 +744,7 @@ static void shader_glsl_load_constants(const struct wined3d_context *context,
programId = prog->programId; programId = prog->programId;
constant_version = prog->constant_version; constant_version = prog->constant_version;
if (useVertexShader) if (use_vs(state))
{ {
const struct wined3d_shader *vshader = state->vertex_shader; const struct wined3d_shader *vshader = state->vertex_shader;
...@@ -757,11 +754,11 @@ static void shader_glsl_load_constants(const struct wined3d_context *context, ...@@ -757,11 +754,11 @@ static void shader_glsl_load_constants(const struct wined3d_context *context,
/* Load DirectX 9 integer constants/uniforms for vertex shader */ /* 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, 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 */ /* Load DirectX 9 boolean constants/uniforms for vertex shader */
shader_glsl_load_constantsB(vshader, gl_info, programId, state->vs_consts_b, 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 */ /* Upload the position fixup params */
shader_get_position_fixup(context, state, position_fixup); shader_get_position_fixup(context, state, position_fixup);
...@@ -769,7 +766,7 @@ static void shader_glsl_load_constants(const struct wined3d_context *context, ...@@ -769,7 +766,7 @@ static void shader_glsl_load_constants(const struct wined3d_context *context,
checkGLcall("glUniform4fvARB"); checkGLcall("glUniform4fvARB");
} }
if (usePixelShader) if (use_ps(state))
{ {
const struct wined3d_shader *pshader = state->pixel_shader; const struct wined3d_shader *pshader = state->pixel_shader;
...@@ -779,11 +776,11 @@ static void shader_glsl_load_constants(const struct wined3d_context *context, ...@@ -779,11 +776,11 @@ static void shader_glsl_load_constants(const struct wined3d_context *context,
/* Load DirectX 9 integer constants/uniforms for pixel shader */ /* 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, 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 */ /* Load DirectX 9 boolean constants/uniforms for pixel shader */
shader_glsl_load_constantsB(pshader, gl_info, programId, state->ps_consts_b, 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 /* Upload the environment bump map matrix if needed. The needsbumpmat
* member specifies the texture stage to load the matrix from. It * member specifies the texture stage to load the matrix from. It
......
...@@ -1509,7 +1509,8 @@ static void shader_none_select_depth_blt(void *shader_priv, const struct wined3d ...@@ -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_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_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_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(void *shader_priv, const struct wined3d_context *context,
const struct wined3d_state *state) {}
static void shader_none_load_np2fixup_constants(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) {} const struct wined3d_gl_info *gl_info, const struct wined3d_state *state) {}
static void shader_none_destroy(struct wined3d_shader *shader) {} static void shader_none_destroy(struct wined3d_shader *shader) {}
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
* Copyright 2002-2003 Raphael Junqueira * Copyright 2002-2003 Raphael Junqueira
* Copyright 2002-2003, 2004 Jason Edmeades * Copyright 2002-2003, 2004 Jason Edmeades
* Copyright 2005 Oliver Stieber * Copyright 2005 Oliver Stieber
* Copyright 2006-2011, 2013 Stefan Dösinger for CodeWeavers
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
...@@ -806,7 +807,8 @@ struct wined3d_shader_backend_ops ...@@ -806,7 +807,8 @@ struct wined3d_shader_backend_ops
void (*shader_deselect_depth_blt)(void *shader_priv, const struct wined3d_gl_info *gl_info); 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_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_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)(void *shader_priv, const struct wined3d_context *context,
const struct wined3d_state *state);
void (*shader_load_np2fixup_constants)(void *shader_priv, const struct wined3d_gl_info *gl_info, void (*shader_load_np2fixup_constants)(void *shader_priv, const struct wined3d_gl_info *gl_info,
const struct wined3d_state *state); const struct wined3d_state *state);
void (*shader_destroy)(struct wined3d_shader *shader); void (*shader_destroy)(struct wined3d_shader *shader);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment