[virglrenderer-devel] [PATCH 5/5] vrend: Use ES reboustness functions where available
Marc-André Lureau
marcandre.lureau at redhat.com
Mon Nov 27 21:34:46 UTC 2017
Hi
----- Original Message -----
> OpenGL ES 3.2 exposes some of the GL_ARB_robustness functions, use those
> functions if available.
>
> Signed-off-by: Jakob Bornecrantz <jakob.bornecrantz at collabora.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau at redhat.com>
> ---
> src/vrend_renderer.c | 21 +++++++++++++--------
> 1 file changed, 13 insertions(+), 8 deletions(-)
>
> diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
> index 9d4e1a6..2c69e56 100644
> --- a/src/vrend_renderer.c
> +++ b/src/vrend_renderer.c
> @@ -103,7 +103,8 @@ struct global_renderer_state {
>
> bool have_mesa_invert;
> bool have_samplers;
> - bool have_robustness;
> + bool have_es_robustness;
> + bool have_arb_robustness;
> bool have_multisample;
> bool have_ms_scaled_blit;
> bool have_nv_prim_restart;
> @@ -3875,9 +3876,11 @@ int vrend_renderer_init(struct vrend_if_cbs *cbs,
> uint32_t flags)
> }
>
> if (epoxy_has_gl_extension("GL_ARB_robustness"))
> - vrend_state.have_robustness = true;
> + vrend_state.have_arb_robustness = true;
> + if (gles && gl_ver >= 32)
> + vrend_state.have_es_robustness = true;
> else
> - fprintf(stderr,"WARNING: running without ARB robustness in place may
> crash\n");
> + fprintf(stderr,"WARNING: running without ARB robustness or ES 3.2 in
> place may crash\n");
>
> if (epoxy_has_gl_extension("GL_MESA_pack_invert"))
> vrend_state.have_mesa_invert = true;
> @@ -4876,12 +4879,12 @@ static int vrend_transfer_send_getteximage(struct
> vrend_context *ctx,
> target = res->target;
>
> if (compressed) {
> - if (vrend_state.have_robustness)
> + if (vrend_state.have_arb_robustness)
> glGetnCompressedTexImageARB(target, info->level, tex_size, data);
> else
> glGetCompressedTexImage(target, info->level, data);
> } else {
> - if (vrend_state.have_robustness)
> + if (vrend_state.have_arb_robustness)
> glGetnTexImageARB(target, info->level, format, type, tex_size,
> data);
> else
> glGetTexImage(target, info->level, format, type, data);
> @@ -4991,8 +4994,10 @@ static int vrend_transfer_send_readpixels(struct
> vrend_context *ctx,
> glPixelTransferf(GL_DEPTH_SCALE, depth_scale);
> }
> }
> - if (vrend_state.have_robustness)
> + if (vrend_state.have_arb_robustness)
> glReadnPixelsARB(info->box->x, y1, info->box->width,
> info->box->height, format, type, send_size, data);
> + else if (vrend_state.have_es_robustness)
> + glReadnPixels(info->box->x, y1, info->box->width, info->box->height,
> format, type, send_size, data);
> else
> glReadPixels(info->box->x, y1, info->box->width, info->box->height,
> format, type, data);
>
> @@ -5373,12 +5378,12 @@ static void vrend_resource_copy_fallback(struct
> vrend_context *ctx,
> for (i = 0; i < cube_slice; i++) {
> GLenum ctarget = src_res->target == GL_TEXTURE_CUBE_MAP ?
> GL_TEXTURE_CUBE_MAP_POSITIVE_X + i : src_res->target;
> if (compressed) {
> - if (vrend_state.have_robustness)
> + if (vrend_state.have_arb_robustness)
> glGetnCompressedTexImageARB(ctarget, src_level, transfer_size,
> tptr + slice_offset);
> else
> glGetCompressedTexImage(ctarget, src_level, tptr +
> slice_offset);
> } else {
> - if (vrend_state.have_robustness)
> + if (vrend_state.have_arb_robustness)
> glGetnTexImageARB(ctarget, src_level, glformat, gltype,
> transfer_size, tptr + slice_offset);
> else
> glGetTexImage(ctarget, src_level, glformat, gltype, tptr +
> slice_offset);
> --
> 2.11.0
>
> _______________________________________________
> virglrenderer-devel mailing list
> virglrenderer-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/virglrenderer-devel
>
More information about the virglrenderer-devel
mailing list