shader: Emit winsys_adjust_y only once per FS shader

If more then one input variable is tagged as requiring winsys_adjust_y then
this variable would be declared more then once and consequently compiling the
shader would fail.

Keep track of whether the variable was already declared to make sure it is emitted
only once.

Closes:  #72

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
macos/master
Gert Wollny 6 years ago committed by Dave Airlie
parent 967062325b
commit d61fc12340
  1. 1
      src/vrend_renderer.c
  2. 2
      src/vrend_shader.c
  3. 1
      src/vrend_shader.h

@ -2804,6 +2804,7 @@ static inline void vrend_fill_shader_key(struct vrend_context *ctx,
}
key->invert_fs_origin = !ctx->sub->inverted_fbo_content;
key->coord_replace = ctx->sub->rs_state.point_quad_rasterization ? ctx->sub->rs_state.sprite_coord_enable : 0;
key->winsys_adjust_y_emitted = false;
if (ctx->sub->shaders[PIPE_SHADER_GEOMETRY])
key->gs_present = true;

@ -4613,8 +4613,10 @@ static char *emit_ios(struct dump_ctx *ctx, char *glsl_hdr)
}
if (ctx->prog_type == TGSI_PROCESSOR_FRAGMENT && ctx->cfg->use_gles &&
!ctx->key->winsys_adjust_y_emitted &&
(ctx->key->coord_replace & (1 << ctx->inputs[i].sid))) {
snprintf(buf, 255, "uniform float winsys_adjust_y;\n");
ctx->key->winsys_adjust_y_emitted = true;
STRCAT_WITH_RET(glsl_hdr, buf);
}
}

@ -82,6 +82,7 @@ struct vrend_shader_info {
struct vrend_shader_key {
uint32_t coord_replace;
bool winsys_adjust_y_emitted;
bool invert_fs_origin;
bool pstipple_tex;
bool add_alpha_test;

Loading…
Cancel
Save