diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2016-02-22 19:55:03 +0100 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2016-02-29 06:56:37 +0000 |
commit | 55a34e71e892ceafa00479df53c8951c80d589b0 (patch) | |
tree | 9c9582d6508d595a4ef24edfadc6eb79da000d7e | |
parent | 5f9133d0dbce6d850fe7024eaf80e622ac4d2eba (diff) |
shader: fixes piglit layer-gs-no-write
Fix using undeclared gl_Layer from fragment shader.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
-rw-r--r-- | src/vrend_shader.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/vrend_shader.c b/src/vrend_shader.c index 18e66c4..5afb435 100644 --- a/src/vrend_shader.c +++ b/src/vrend_shader.c @@ -116,6 +116,7 @@ struct dump_ctx { bool uses_lodq; bool uses_txq_levels; bool uses_tg4; + bool uses_layer; bool write_all_cbufs; bool uses_stencil_export; uint32_t shadow_samp_mask; @@ -315,6 +316,16 @@ iter_declaration(struct tgsi_iterate_context *iter, ctx->glsl_ver_required = 150; break; } + case TGSI_SEMANTIC_LAYER: + if (iter->processor.Processor == TGSI_PROCESSOR_FRAGMENT) { + name_prefix = "gl_Layer"; + 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; + ctx->uses_layer = true; + break; + } case TGSI_SEMANTIC_PSIZE: if (iter->processor.Processor == TGSI_PROCESSOR_GEOMETRY) { name_prefix = "gl_PointSize"; @@ -1436,7 +1447,7 @@ iter_instruction(struct tgsi_iterate_context *iter, idx += src->Register.SwizzleX; snprintf(srcs[i], 255, "%s(vec4(%s%s%s[%d]))", stypeprefix, prefix, arrayname, ctx->inputs[j].glsl_name, idx); } else - snprintf(srcs[i], 255, "%s(%s%s%s%s)", stypeprefix, prefix, ctx->inputs[j].glsl_name, arrayname, swizzle); + snprintf(srcs[i], 255, "%s(%s%s%s%s)", stypeprefix, prefix, ctx->inputs[j].glsl_name, arrayname, ctx->inputs[j].is_int ? "" : swizzle); override_no_wm[i] = ctx->inputs[j].override_no_wm; break; } @@ -2021,6 +2032,8 @@ static char *emit_header(struct dump_ctx *ctx, char *glsl_hdr) STRCAT_WITH_RET(glsl_hdr, "#extension GL_ARB_viewport_array : require\n"); if (ctx->uses_stencil_export) STRCAT_WITH_RET(glsl_hdr, "#extension GL_ARB_shader_stencil_export : require\n"); + if (ctx->uses_layer) + STRCAT_WITH_RET(glsl_hdr, "#extension GL_ARB_fragment_layer_viewport : require\n"); return glsl_hdr; } |