From: Ian Romanick Date: Sat, 14 Nov 2015 01:35:30 +0000 (-0800) Subject: i965/meta: Use _mesa_bind_framebuffers instead of _mesa_BindFramebuffer X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8f1b1878a0ae80dddc95a4322b0e84f486015c81;p=mesa.git i965/meta: Use _mesa_bind_framebuffers instead of _mesa_BindFramebuffer Signed-off-by: Ian Romanick Reviewed-by: Topi Pohjolainen --- diff --git a/src/mesa/drivers/dri/i965/brw_meta_fast_clear.c b/src/mesa/drivers/dri/i965/brw_meta_fast_clear.c index f95fe646ee5..50d8004d111 100644 --- a/src/mesa/drivers/dri/i965/brw_meta_fast_clear.c +++ b/src/mesa/drivers/dri/i965/brw_meta_fast_clear.c @@ -849,6 +849,7 @@ brw_meta_resolve_color(struct brw_context *brw, { struct gl_context *ctx = &brw->ctx; GLuint fbo; + struct gl_framebuffer *drawFb; struct gl_renderbuffer *rb; struct rect rect; @@ -857,9 +858,13 @@ brw_meta_resolve_color(struct brw_context *brw, _mesa_meta_begin(ctx, MESA_META_ALL); _mesa_CreateFramebuffers(1, &fbo); + + drawFb = _mesa_lookup_framebuffer(ctx, fbo); + assert(drawFb != NULL && drawFb->Name == fbo); + rb = brw_get_rb_for_slice(brw, mt, 0, 0, false); - _mesa_BindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo); + _mesa_bind_framebuffers(ctx, drawFb, ctx->ReadBuffer); _mesa_framebuffer_renderbuffer(ctx, ctx->DrawBuffer, GL_COLOR_ATTACHMENT0, rb); _mesa_DrawBuffer(GL_COLOR_ATTACHMENT0); diff --git a/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c b/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c index ab8d677a91f..d1a8780447c 100644 --- a/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c +++ b/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c @@ -425,6 +425,7 @@ brw_meta_stencil_blit(struct brw_context *brw, struct blit_dims dims = *orig_dims; struct fb_tex_blit_state blit; GLuint prog, fbo; + struct gl_framebuffer *drawFb; struct gl_renderbuffer *rb; GLenum target; @@ -437,12 +438,15 @@ brw_meta_stencil_blit(struct brw_context *brw, ctx->Extensions.ARB_texture_stencil8 = true; _mesa_CreateFramebuffers(1, &fbo); + drawFb = _mesa_lookup_framebuffer(ctx, fbo); + assert(drawFb != NULL && drawFb->Name == fbo); + /* Force the surface to be configured for level zero. */ rb = brw_get_rb_for_slice(brw, dst_mt, 0, dst_layer, true); adjust_msaa(&dims, dst_mt->num_samples); adjust_tiling(&dims, dst_mt->num_samples); - _mesa_BindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo); + _mesa_bind_framebuffers(ctx, drawFb, ctx->ReadBuffer); _mesa_framebuffer_renderbuffer(ctx, ctx->DrawBuffer, GL_COLOR_ATTACHMENT0, rb); _mesa_DrawBuffer(GL_COLOR_ATTACHMENT0); @@ -535,6 +539,7 @@ brw_meta_stencil_updownsample(struct brw_context *brw, .dst_x1 = dst->logical_width0, .dst_y1 = dst->logical_height0, .mirror_x = 0, .mirror_y = 0 }; GLuint fbo; + struct gl_framebuffer *readFb; struct gl_renderbuffer *rb; if (dst->stencil_mt) @@ -544,9 +549,12 @@ brw_meta_stencil_updownsample(struct brw_context *brw, _mesa_meta_begin(ctx, MESA_META_ALL); _mesa_CreateFramebuffers(1, &fbo); + readFb = _mesa_lookup_framebuffer(ctx, fbo); + assert(readFb != NULL && readFb->Name == fbo); + rb = brw_get_rb_for_slice(brw, src, 0, 0, false); - _mesa_BindFramebuffer(GL_READ_FRAMEBUFFER, fbo); + _mesa_bind_framebuffers(ctx, ctx->DrawBuffer, readFb); _mesa_framebuffer_renderbuffer(ctx, ctx->ReadBuffer, GL_STENCIL_ATTACHMENT, rb); diff --git a/src/mesa/drivers/dri/i965/brw_meta_updownsample.c b/src/mesa/drivers/dri/i965/brw_meta_updownsample.c index 213de2af0a6..da06fef4fee 100644 --- a/src/mesa/drivers/dri/i965/brw_meta_updownsample.c +++ b/src/mesa/drivers/dri/i965/brw_meta_updownsample.c @@ -93,7 +93,9 @@ brw_meta_updownsample(struct brw_context *brw, struct intel_mipmap_tree *dst_mt) { struct gl_context *ctx = &brw->ctx; - GLuint fbos[2], src_fbo, dst_fbo; + GLuint fbos[2]; + struct gl_framebuffer *src_fb; + struct gl_framebuffer *dst_fb; struct gl_renderbuffer *src_rb; struct gl_renderbuffer *dst_rb; GLenum drawbuffer; @@ -116,14 +118,16 @@ brw_meta_updownsample(struct brw_context *brw, _mesa_CreateFramebuffers(2, fbos); src_rb = brw_get_rb_for_slice(brw, src_mt, 0, 0, false); dst_rb = brw_get_rb_for_slice(brw, dst_mt, 0, 0, false); - src_fbo = fbos[0]; - dst_fbo = fbos[1]; + src_fb = _mesa_lookup_framebuffer(ctx, fbos[0]); + dst_fb = _mesa_lookup_framebuffer(ctx, fbos[1]); - _mesa_BindFramebuffer(GL_READ_FRAMEBUFFER, src_fbo); + assert(src_fb != NULL && src_fb->Name == fbos[0]); + assert(dst_fb != NULL && dst_fb->Name == fbos[1]); + + _mesa_bind_framebuffers(ctx, dst_fb, src_fb); _mesa_framebuffer_renderbuffer(ctx, ctx->ReadBuffer, attachment, src_rb); _mesa_ReadBuffer(drawbuffer); - _mesa_BindFramebuffer(GL_DRAW_FRAMEBUFFER, dst_fbo); _mesa_framebuffer_renderbuffer(ctx, ctx->DrawBuffer, attachment, dst_rb); _mesa_DrawBuffer(drawbuffer);