vrend: Replace all uses of glDrawBuffer with glDrawBuffers

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.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Jakob Bornecrantz <jakob.bornecrantz@collabora.com>
macos/master
Jakob Bornecrantz 7 years ago
parent 026ad193aa
commit 71487a41fe
  1. 9
      src/vrend_blitter.c
  2. 9
      src/vrend_formats.c
  3. 6
      src/vrend_renderer.c

@ -535,6 +535,7 @@ void vrend_renderer_blit_gl(struct vrend_context *ctx,
const struct pipe_blit_info *info) const struct pipe_blit_info *info)
{ {
struct vrend_blitter_ctx *blit_ctx = &vrend_blit_ctx; struct vrend_blitter_ctx *blit_ctx = &vrend_blit_ctx;
GLuint buffers;
GLuint prog_id; GLuint prog_id;
GLuint fs_id; GLuint fs_id;
GLint lret; GLint lret;
@ -597,7 +598,8 @@ void vrend_renderer_blit_gl(struct vrend_context *ctx,
glBindFramebuffer(GL_FRAMEBUFFER_EXT, blit_ctx->fb_id); glBindFramebuffer(GL_FRAMEBUFFER_EXT, blit_ctx->fb_id);
vrend_fb_bind_texture(dst_res, 0, info->dst.level, info->dst.box.z); 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); 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); glBindFramebuffer(GL_FRAMEBUFFER_EXT, blit_ctx->fb_id);
vrend_fb_bind_texture(dst_res, 0, info->dst.level, dst_z); 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, blitter_set_texcoords(blit_ctx, src_res, info->src.level,
info->src.box.z + src_z, 0, info->src.box.z + src_z, 0,
info->src.box.x, info->src.box.y, info->src.box.x, info->src.box.y,

@ -253,7 +253,9 @@ static void vrend_add_formats(struct vrend_format_table *table, int num_entries)
{ {
int i; int i;
uint32_t binding = 0; uint32_t binding = 0;
GLuint buffers;
GLuint tex_id, fb_id; GLuint tex_id, fb_id;
for (i = 0; i < num_entries; i++) { for (i = 0; i < num_entries; i++) {
GLenum status; GLenum status;
bool is_depth = false; 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); glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, attachment, GL_TEXTURE_2D, tex_id, 0);
is_depth = true; is_depth = true;
glDrawBuffer(GL_NONE);
buffers = GL_NONE;
glDrawBuffers(1, &buffers);
} else { } else {
glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, tex_id, 0); 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); status = glCheckFramebufferStatus(GL_FRAMEBUFFER);

@ -4676,6 +4676,8 @@ static int vrend_renderer_transfer_write_iov(struct vrend_context *ctx,
gltype = tex_conv_table[res->base.format].gltype; gltype = tex_conv_table[res->base.format].gltype;
if ((!vrend_state.use_core_profile) && (res->y_0_top)) { if ((!vrend_state.use_core_profile) && (res->y_0_top)) {
GLuint buffers;
if (res->readback_fb_id == 0 || res->readback_fb_level != info->level) { if (res->readback_fb_id == 0 || res->readback_fb_level != info->level) {
GLuint fb_id; GLuint fb_id;
if (res->readback_fb_id) if (res->readback_fb_id)
@ -4690,7 +4692,9 @@ static int vrend_renderer_transfer_write_iov(struct vrend_context *ctx,
} else { } else {
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, res->readback_fb_id); 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_blend_enable(ctx, false);
vrend_depth_test_enable(ctx, false); vrend_depth_test_enable(ctx, false);
vrend_alpha_test_enable(ctx, false); vrend_alpha_test_enable(ctx, false);

Loading…
Cancel
Save