[virglrenderer-devel] [PATCH virglrenderer] shader: fixes viewport-no-gs.shader_test
marcandre.lureau at redhat.com
marcandre.lureau at redhat.com
Mon Feb 22 18:55:11 UTC 2016
From: Marc-André Lureau <marcandre.lureau at redhat.com>
Add fragment gl_ViewportIndex support.
Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
---
src/vrend_shader.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/src/vrend_shader.c b/src/vrend_shader.c
index 93b95b9..9a9710c 100644
--- a/src/vrend_shader.c
+++ b/src/vrend_shader.c
@@ -137,6 +137,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)
@@ -312,6 +313,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";
@@ -2026,6 +2038,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)
--
2.5.0
More information about the virglrenderer-devel
mailing list