vrend,feature: Check for GL_OES_viewport_array extension

This enables indexed access to viewports on GLES hosts.

v2: Also add the extension to shaders when needed

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 a613dcc82a
commit 88ffc3beb3
  1. 2
      src/vrend_renderer.c
  2. 7
      src/vrend_shader.c

@ -229,7 +229,7 @@ static const struct {
FEAT(transform_feedback_overflow_query, 46, UNAVAIL, "GL_ARB_transform_feedback_overflow_query" ), FEAT(transform_feedback_overflow_query, 46, UNAVAIL, "GL_ARB_transform_feedback_overflow_query" ),
FEAT(txqs, 45, UNAVAIL, "GL_ARB_shader_texture_image_samples" ), FEAT(txqs, 45, UNAVAIL, "GL_ARB_shader_texture_image_samples" ),
FEAT(ubo, 31, 30, "GL_ARB_uniform_buffer_object" ), FEAT(ubo, 31, 30, "GL_ARB_uniform_buffer_object" ),
FEAT(viewport_array, 41, UNAVAIL, "GL_ARB_viewport_array" ), FEAT(viewport_array, 41, UNAVAIL, "GL_ARB_viewport_array", "GL_OES_viewport_array"),
}; };
struct global_renderer_state { struct global_renderer_state {

@ -905,6 +905,8 @@ iter_declaration(struct tgsi_iterate_context *iter,
name_prefix = "gl_ViewportIndex"; name_prefix = "gl_ViewportIndex";
if (ctx->glsl_ver_required >= 140) if (ctx->glsl_ver_required >= 140)
ctx->shader_req_bits |= SHADER_REQ_LAYER; ctx->shader_req_bits |= SHADER_REQ_LAYER;
if (ctx->cfg->use_gles)
ctx->shader_req_bits |= SHADER_REQ_VIEWPORT_IDX;
break; break;
} }
/* fallthrough */ /* fallthrough */
@ -1213,7 +1215,7 @@ iter_declaration(struct tgsi_iterate_context *iter,
ctx->outputs[i].override_no_wm = true; ctx->outputs[i].override_no_wm = true;
ctx->outputs[i].is_int = true; ctx->outputs[i].is_int = true;
name_prefix = "gl_ViewportIndex"; name_prefix = "gl_ViewportIndex";
if (ctx->glsl_ver_required >= 140) if (ctx->glsl_ver_required >= 140 || ctx->cfg->use_gles)
ctx->shader_req_bits |= SHADER_REQ_VIEWPORT_IDX; ctx->shader_req_bits |= SHADER_REQ_VIEWPORT_IDX;
break; break;
} }
@ -4709,6 +4711,9 @@ static void emit_header(struct dump_ctx *ctx)
emit_ext(ctx, "EXT_shader_framebuffer_fetch", "require"); emit_ext(ctx, "EXT_shader_framebuffer_fetch", "require");
} }
if (ctx->shader_req_bits & SHADER_REQ_VIEWPORT_IDX)
emit_ext(ctx, "OES_viewport_array", "require");
if (ctx->prog_type == TGSI_PROCESSOR_GEOMETRY) { if (ctx->prog_type == TGSI_PROCESSOR_GEOMETRY) {
emit_ext(ctx, "EXT_geometry_shader", "require"); emit_ext(ctx, "EXT_geometry_shader", "require");
if (ctx->shader_req_bits & SHADER_REQ_PSIZE) if (ctx->shader_req_bits & SHADER_REQ_PSIZE)

Loading…
Cancel
Save