wined3d: Get rid of state access in shader_generate_glsl_declarations().

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Stefan Dösinger 2016-03-16 18:17:01 +01:00 committed by Alexandre Julliard
parent ab1ae26520
commit f08896aa73
1 changed files with 6 additions and 27 deletions

View File

@ -1646,11 +1646,9 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
const struct wined3d_shader_reg_maps *reg_maps, const struct shader_glsl_ctx_priv *ctx_priv)
{
const struct wined3d_shader_version *version = &reg_maps->shader_version;
const struct wined3d_state *state = &shader->device->state;
const struct vs_compile_args *vs_args = ctx_priv->cur_vs_args;
const struct ps_compile_args *ps_args = ctx_priv->cur_ps_args;
const struct wined3d_gl_info *gl_info = context->gl_info;
const struct wined3d_fb_state *fb = &shader->device->fb;
unsigned int i, extra_constants_needed = 0;
const struct wined3d_shader_lconst *lconst;
const char *prefix;
@ -1953,7 +1951,7 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
{
UINT in_count = min(vec4_varyings(version->major, gl_info), shader->limits->packed_input);
if (use_vs(state))
if (ps_args->vp_mode == vertexshader)
declare_in_varying(gl_info, buffer, FALSE, "vec4 %s_link[%u];\n", prefix, in_count);
shader_addline(buffer, "vec4 %s_in[%u];\n", prefix, in_count);
}
@ -1986,32 +1984,13 @@ static void shader_generate_glsl_declarations(const struct wined3d_context *cont
}
if (reg_maps->vpos || reg_maps->usesdsy)
{
if (shader->limits->constant_float + extra_constants_needed
+ 1 < gl_info->limits.glsl_ps_float_constants)
{
shader_addline(buffer, "uniform vec4 ycorrection;\n");
extra_constants_needed++;
}
else
{
float ycorrection[] =
{
context->render_offscreen ? 0.0f : fb->render_targets[0]->height,
context->render_offscreen ? 1.0f : -1.0f,
0.0f,
0.0f,
};
/* This happens because we do not have proper tracking of the
* constant registers that are actually used, only the max
* limit of the shader version. */
FIXME("Cannot find a free uniform for vpos correction params\n");
shader_addline(buffer, "const vec4 ycorrection = ");
shader_glsl_append_imm_vec4(buffer, ycorrection);
shader_addline(buffer, ";\n");
}
++extra_constants_needed;
shader_addline(buffer, "uniform vec4 ycorrection;\n");
shader_addline(buffer, "vec4 vpos;\n");
}
if (shader->limits->constant_float + extra_constants_needed >= gl_info->limits.glsl_ps_float_constants)
FIXME("Insufficient uniforms to run this shader.\n");
}
/* Declare output register temporaries */