[virglrenderer-devel] [PATCH 2/5] vrend: Replace all uses of glDrawBuffer with glDrawBuffers
Marc-André Lureau
marcandre.lureau at redhat.com
Mon Nov 27 21:28:06 UTC 2017
----- Original Message -----
> OpenGL ES does not have glDrawBuffer, but it does have glDrawBuffers. It has
> been available in Desktop OpenGL since 2.0 and was exposed in OpenGL ES 3.0.
>
> Signed-off-by: Jakob Bornecrantz <jakob.bornecrantz at collabora.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau at redhat.com>
> ---
> src/vrend_blitter.c | 9 +++++++--
> src/vrend_formats.c | 9 +++++++--
> src/vrend_renderer.c | 6 +++++-
> 3 files changed, 19 insertions(+), 5 deletions(-)
>
> diff --git a/src/vrend_blitter.c b/src/vrend_blitter.c
> index 035c409..0b4112a 100644
> --- a/src/vrend_blitter.c
> +++ b/src/vrend_blitter.c
> @@ -535,6 +535,7 @@ void vrend_renderer_blit_gl(struct vrend_context *ctx,
> const struct pipe_blit_info *info)
> {
> struct vrend_blitter_ctx *blit_ctx = &vrend_blit_ctx;
> + GLuint buffers;
> GLuint prog_id;
> GLuint fs_id;
> GLint lret;
> @@ -597,7 +598,8 @@ void vrend_renderer_blit_gl(struct vrend_context *ctx,
> glBindFramebuffer(GL_FRAMEBUFFER_EXT, blit_ctx->fb_id);
> vrend_fb_bind_texture(dst_res, 0, info->dst.level, info->dst.box.z);
>
> - glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
> + buffers = GL_COLOR_ATTACHMENT0_EXT;
> + glDrawBuffers(1, &buffers);
>
> glBindTexture(src_res->target, src_res->id);
>
> @@ -635,7 +637,10 @@ void vrend_renderer_blit_gl(struct vrend_context *ctx,
> glBindFramebuffer(GL_FRAMEBUFFER_EXT, blit_ctx->fb_id);
> vrend_fb_bind_texture(dst_res, 0, info->dst.level, dst_z);
>
> - glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
> +
> +
> + buffers = GL_COLOR_ATTACHMENT0_EXT;
> + glDrawBuffers(1, &buffers);
> blitter_set_texcoords(blit_ctx, src_res, info->src.level,
> info->src.box.z + src_z, 0,
> info->src.box.x, info->src.box.y,
> diff --git a/src/vrend_formats.c b/src/vrend_formats.c
> index d7f1c6d..ce72c12 100644
> --- a/src/vrend_formats.c
> +++ b/src/vrend_formats.c
> @@ -253,7 +253,9 @@ static void vrend_add_formats(struct vrend_format_table
> *table, int num_entries)
> {
> int i;
> uint32_t binding = 0;
> + GLuint buffers;
> GLuint tex_id, fb_id;
> +
> for (i = 0; i < num_entries; i++) {
> GLenum status;
> bool is_depth = false;
> @@ -304,11 +306,14 @@ static void vrend_add_formats(struct vrend_format_table
> *table, int num_entries)
> glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, attachment, GL_TEXTURE_2D,
> tex_id, 0);
>
> is_depth = true;
> - glDrawBuffer(GL_NONE);
> +
> + buffers = GL_NONE;
> + glDrawBuffers(1, &buffers);
> } else {
> glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT,
> GL_TEXTURE_2D, tex_id, 0);
>
> - glDrawBuffer(GL_COLOR_ATTACHMENT0);
> + buffers = GL_COLOR_ATTACHMENT0_EXT;
> + glDrawBuffers(1, &buffers);
> }
>
> status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
> diff --git a/src/vrend_renderer.c b/src/vrend_renderer.c
> index a70167a..17f4b82 100644
> --- a/src/vrend_renderer.c
> +++ b/src/vrend_renderer.c
> @@ -4676,6 +4676,8 @@ static int vrend_renderer_transfer_write_iov(struct
> vrend_context *ctx,
> gltype = tex_conv_table[res->base.format].gltype;
>
> if ((!vrend_state.use_core_profile) && (res->y_0_top)) {
> + GLuint buffers;
> +
> if (res->readback_fb_id == 0 || res->readback_fb_level !=
> info->level) {
> GLuint fb_id;
> if (res->readback_fb_id)
> @@ -4690,7 +4692,9 @@ static int vrend_renderer_transfer_write_iov(struct
> vrend_context *ctx,
> } else {
> glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, res->readback_fb_id);
> }
> - glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT);
> +
> + buffers = GL_COLOR_ATTACHMENT0_EXT;
> + glDrawBuffers(1, &buffers);
> vrend_blend_enable(ctx, false);
> vrend_depth_test_enable(ctx, false);
> vrend_alpha_test_enable(ctx, false);
> --
> 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