shader: rename shader outputs for easier distinction.

outputs from vertex shaders are now vso
and outputs from geometry shaders are now gso.

This allows adding tessellation a bit easier.

Signed-off-by: Dave Airlie <airlied@redhat.com>
macos/master
Dave Airlie 7 years ago
parent 744c1db862
commit 66fa155ddc
  1. 4
      src/vrend_renderer.c
  2. 40
      src/vrend_shader.c
  3. 2
      src/vrend_shader.h

@ -858,11 +858,11 @@ static struct vrend_linked_shader_program *add_shader_program(struct vrend_conte
if (gs)
vrend_patch_vertex_shader_interpolants(&ctx->shader_cfg, gs->glsl_prog,
&gs->sel->sinfo,
&fs->sel->sinfo, true, fs->key.flatshade);
&fs->sel->sinfo, "gso", fs->key.flatshade);
else
vrend_patch_vertex_shader_interpolants(&ctx->shader_cfg, vs->glsl_prog,
&vs->sel->sinfo,
&fs->sel->sinfo, false, fs->key.flatshade);
&fs->sel->sinfo, "vso", fs->key.flatshade);
ret = vrend_compile_shader(ctx, gs ? gs : vs);
if (ret == false) {
glDeleteShader(gs ? gs->id : vs->id);

@ -418,17 +418,23 @@ iter_declaration(struct tgsi_iterate_context *iter,
}
}
default:
if (iter->processor.Processor == TGSI_PROCESSOR_FRAGMENT ||
iter->processor.Processor == TGSI_PROCESSOR_GEOMETRY) {
if (iter->processor.Processor == TGSI_PROCESSOR_FRAGMENT &&
ctx->key->gs_present)
name_prefix = "out";
switch (iter->processor.Processor) {
case TGSI_PROCESSOR_FRAGMENT:
if (ctx->key->gs_present)
name_prefix = "gso";
else
name_prefix = "ex";
} else
name_prefix = "vso";
break;
case TGSI_PROCESSOR_GEOMETRY:
name_prefix = "vso";
break;
case TGSI_PROCESSOR_VERTEX:
default:
name_prefix = "in";
break;
}
break;
}
if (ctx->inputs[i].glsl_no_index)
snprintf(ctx->inputs[i].glsl_name, 64, "%s", name_prefix);
@ -596,14 +602,22 @@ iter_declaration(struct tgsi_iterate_context *iter,
if (ctx->outputs[i].name == TGSI_SEMANTIC_GENERIC)
color_offset = -1;
default:
if (iter->processor.Processor == TGSI_PROCESSOR_VERTEX)
name_prefix = "ex";
else if (iter->processor.Processor == TGSI_PROCESSOR_FRAGMENT)
switch (iter->processor.Processor) {
case TGSI_PROCESSOR_FRAGMENT:
name_prefix = "fsout";
else
break;
case TGSI_PROCESSOR_GEOMETRY:
name_prefix = "gso";
break;
case TGSI_PROCESSOR_VERTEX:
name_prefix = "vso";
break;
default:
name_prefix = "out";
break;
}
break;
}
if (ctx->outputs[i].glsl_no_index)
snprintf(ctx->outputs[i].glsl_name, 64, "%s", name_prefix);
@ -2729,7 +2743,7 @@ static void replace_interp(char *program,
bool vrend_patch_vertex_shader_interpolants(struct vrend_shader_cfg *cfg, char *program,
struct vrend_shader_info *vs_info,
struct vrend_shader_info *fs_info, bool is_gs, bool flatshade)
struct vrend_shader_info *fs_info, const char *oprefix, bool flatshade)
{
int i;
const char *pstring;
@ -2764,7 +2778,7 @@ bool vrend_patch_vertex_shader_interpolants(struct vrend_shader_cfg *cfg, char *
}
break;
case TGSI_SEMANTIC_GENERIC:
snprintf(glsl_name, 64, "%s_g%d", is_gs ? "out" : "ex", fs_info->interpinfo[i].semantic_index);
snprintf(glsl_name, 64, "%s_g%d", oprefix, fs_info->interpinfo[i].semantic_index);
replace_interp(program, glsl_name, pstring);
break;
default:

@ -80,7 +80,7 @@ bool vrend_patch_vertex_shader_interpolants(struct vrend_shader_cfg *cfg,
char *program,
struct vrend_shader_info *vs_info,
struct vrend_shader_info *fs_info,
bool is_gs, bool flatshade);
const char *oprefix, bool flatshade);
char *vrend_convert_shader(struct vrend_shader_cfg *cfg,
const struct tgsi_token *tokens,

Loading…
Cancel
Save