shader: fixes viewport-no-gs.shader_test

Add fragment gl_ViewportIndex support.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
macos/master
Marc-André Lureau 9 years ago committed by Dave Airlie
parent 55a34e71e8
commit 914e46b1a8
  1. 14
      src/vrend_shader.c

@ -138,6 +138,7 @@ struct dump_ctx {
bool has_clipvertex;
bool has_clipvertex_so;
bool has_viewport_idx;
bool has_frag_viewport_idx;
};
static inline const char *tgsi_proc_to_prefix(int shader_type)
@ -316,6 +317,17 @@ iter_declaration(struct tgsi_iterate_context *iter,
ctx->glsl_ver_required = 150;
break;
}
case TGSI_SEMANTIC_VIEWPORT_INDEX:
if (iter->processor.Processor == TGSI_PROCESSOR_FRAGMENT) {
ctx->inputs[i].glsl_predefined_no_emit = true;
ctx->inputs[i].glsl_no_index = true;
ctx->inputs[i].is_int = true;
ctx->inputs[i].override_no_wm = true;
name_prefix = "gl_ViewportIndex";
if (ctx->glsl_ver_required >= 140)
ctx->has_frag_viewport_idx = true;
break;
}
case TGSI_SEMANTIC_LAYER:
if (iter->processor.Processor == TGSI_PROCESSOR_FRAGMENT) {
name_prefix = "gl_Layer";
@ -2030,6 +2042,8 @@ static char *emit_header(struct dump_ctx *ctx, char *glsl_hdr)
STRCAT_WITH_RET(glsl_hdr, "#extension GL_ARB_texture_gather : require\n");
if (ctx->has_viewport_idx)
STRCAT_WITH_RET(glsl_hdr, "#extension GL_ARB_viewport_array : require\n");
if (ctx->has_frag_viewport_idx)
STRCAT_WITH_RET(glsl_hdr, "#extension GL_ARB_fragment_layer_viewport : require\n");
if (ctx->uses_stencil_export)
STRCAT_WITH_RET(glsl_hdr, "#extension GL_ARB_shader_stencil_export : require\n");
if (ctx->uses_layer)

Loading…
Cancel
Save