diff options
author | Ian Romanick <[email protected]> | 2015-11-13 11:12:57 -0800 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2016-03-01 11:07:20 -0800 |
commit | ec5757f9c93c6749aee39a10d6edfe4a7389ef5e (patch) | |
tree | 83223026fde1141db6be7476b9727bb33c60ebc0 | |
parent | 7c254f02008159b4e042cd6c9d33a2fc8c92e1ea (diff) |
meta: Use _mesa_bind_framebuffers instead of _mesa_BindFramebuffer
Signed-off-by: Ian Romanick <[email protected]>
Reviewed-by: Topi Pohjolainen <[email protected]>
-rw-r--r-- | src/mesa/drivers/common/meta.c | 13 | ||||
-rw-r--r-- | src/mesa/drivers/common/meta_copy_image.c | 11 | ||||
-rw-r--r-- | src/mesa/drivers/common/meta_tex_subimage.c | 24 |
3 files changed, 40 insertions, 8 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index d5082f536c1..6a133c9b5e6 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -2785,6 +2785,7 @@ copytexsubimage_using_blit_framebuffer(struct gl_context *ctx, GLuint dims, GLsizei width, GLsizei height) { GLuint fbo; + struct gl_framebuffer *drawFb; bool success = false; GLbitfield mask; GLenum status; @@ -2795,7 +2796,10 @@ copytexsubimage_using_blit_framebuffer(struct gl_context *ctx, GLuint dims, _mesa_meta_begin(ctx, MESA_META_ALL & ~MESA_META_DRAW_BUFFERS); _mesa_CreateFramebuffers(1, &fbo); - _mesa_BindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo); + drawFb = _mesa_lookup_framebuffer(ctx, fbo); + assert(drawFb != NULL && drawFb->Name == fbo); + + _mesa_bind_framebuffers(ctx, drawFb, ctx->ReadBuffer); if (rb->_BaseFormat == GL_DEPTH_STENCIL || rb->_BaseFormat == GL_DEPTH_COMPONENT) { @@ -3510,10 +3514,15 @@ cleartexsubimage_for_zoffset(struct gl_context *ctx, const GLvoid *clearValue) { GLuint fbo; + struct gl_framebuffer *drawFb; bool success; _mesa_CreateFramebuffers(1, &fbo); - _mesa_BindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo); + + drawFb = _mesa_lookup_framebuffer(ctx, fbo); + assert(drawFb != NULL && drawFb->Name == fbo); + + _mesa_bind_framebuffers(ctx, drawFb, ctx->ReadBuffer); switch(texImage->_BaseFormat) { case GL_DEPTH_STENCIL: diff --git a/src/mesa/drivers/common/meta_copy_image.c b/src/mesa/drivers/common/meta_copy_image.c index ce7597f1637..1d45785a177 100644 --- a/src/mesa/drivers/common/meta_copy_image.c +++ b/src/mesa/drivers/common/meta_copy_image.c @@ -167,6 +167,8 @@ _mesa_meta_CopyImageSubData_uncompressed(struct gl_context *ctx, GLuint src_view_texture = 0; struct gl_texture_image *src_view_tex_image; GLuint fbos[2]; + struct gl_framebuffer *readFb; + struct gl_framebuffer *drawFb; bool success = false; GLbitfield mask; GLenum status, attachment; @@ -211,8 +213,13 @@ _mesa_meta_CopyImageSubData_uncompressed(struct gl_context *ctx, _mesa_meta_begin(ctx, MESA_META_SCISSOR); _mesa_CreateFramebuffers(2, fbos); - _mesa_BindFramebuffer(GL_READ_FRAMEBUFFER, fbos[0]); - _mesa_BindFramebuffer(GL_DRAW_FRAMEBUFFER, fbos[1]); + readFb = _mesa_lookup_framebuffer(ctx, fbos[0]); + assert(readFb != NULL && readFb->Name == fbos[0]); + + drawFb = _mesa_lookup_framebuffer(ctx, fbos[1]); + assert(drawFb != NULL && drawFb->Name == fbos[1]); + + _mesa_bind_framebuffers(ctx, drawFb, readFb); switch (_mesa_get_format_base_format(src_format)) { case GL_DEPTH_COMPONENT: diff --git a/src/mesa/drivers/common/meta_tex_subimage.c b/src/mesa/drivers/common/meta_tex_subimage.c index 81d6cf35a87..55605554157 100644 --- a/src/mesa/drivers/common/meta_tex_subimage.c +++ b/src/mesa/drivers/common/meta_tex_subimage.c @@ -30,6 +30,7 @@ #include "buffers.h" #include "clear.h" #include "fbobject.h" +#include "framebuffer.h" #include "glformats.h" #include "glheader.h" #include "image.h" @@ -179,6 +180,8 @@ _mesa_meta_pbo_TexSubImage(struct gl_context *ctx, GLuint dims, { struct gl_buffer_object *pbo = NULL; GLuint pbo_tex = 0, fbos[2] = { 0, 0 }; + struct gl_framebuffer *readFb; + struct gl_framebuffer *drawFb; int image_height; struct gl_texture_image *pbo_tex_image; GLenum status; @@ -226,8 +229,14 @@ _mesa_meta_pbo_TexSubImage(struct gl_context *ctx, GLuint dims, MESA_META_PIXEL_STORE)); _mesa_CreateFramebuffers(2, fbos); - _mesa_BindFramebuffer(GL_READ_FRAMEBUFFER, fbos[0]); - _mesa_BindFramebuffer(GL_DRAW_FRAMEBUFFER, fbos[1]); + + readFb = _mesa_lookup_framebuffer(ctx, fbos[0]); + assert(readFb != NULL && readFb->Name == fbos[0]); + + drawFb = _mesa_lookup_framebuffer(ctx, fbos[1]); + assert(drawFb != NULL && drawFb->Name == fbos[1]); + + _mesa_bind_framebuffers(ctx, drawFb, tex_image ? readFb : ctx->ReadBuffer); if (tex_image->TexObject->Target == GL_TEXTURE_1D_ARRAY) { assert(depth == 1); @@ -301,6 +310,8 @@ _mesa_meta_pbo_GetTexSubImage(struct gl_context *ctx, GLuint dims, { struct gl_buffer_object *pbo = NULL; GLuint pbo_tex = 0, fbos[2] = { 0, 0 }; + struct gl_framebuffer *readFb; + struct gl_framebuffer *drawFb; int image_height; struct gl_texture_image *pbo_tex_image; struct gl_renderbuffer *rb = NULL; @@ -365,6 +376,12 @@ _mesa_meta_pbo_GetTexSubImage(struct gl_context *ctx, GLuint dims, _mesa_CreateFramebuffers(2, fbos); + readFb = _mesa_lookup_framebuffer(ctx, fbos[0]); + assert(readFb != NULL && readFb->Name == fbos[0]); + + drawFb = _mesa_lookup_framebuffer(ctx, fbos[1]); + assert(drawFb != NULL && drawFb->Name == fbos[1]); + if (tex_image && tex_image->TexObject->Target == GL_TEXTURE_1D_ARRAY) { assert(depth == 1); assert(zoffset == 0); @@ -379,8 +396,8 @@ _mesa_meta_pbo_GetTexSubImage(struct gl_context *ctx, GLuint dims, * we're doing a ReadPixels and we should just use whatever framebuffer * the client has bound. */ + _mesa_bind_framebuffers(ctx, drawFb, tex_image ? readFb : ctx->ReadBuffer); if (tex_image) { - _mesa_BindFramebuffer(GL_READ_FRAMEBUFFER, fbos[0]); _mesa_meta_framebuffer_texture_image(ctx, ctx->ReadBuffer, GL_COLOR_ATTACHMENT0, tex_image, zoffset); @@ -392,7 +409,6 @@ _mesa_meta_pbo_GetTexSubImage(struct gl_context *ctx, GLuint dims, assert(depth == 1); } - _mesa_BindFramebuffer(GL_DRAW_FRAMEBUFFER, fbos[1]); _mesa_meta_framebuffer_texture_image(ctx, ctx->DrawBuffer, GL_COLOR_ATTACHMENT0, pbo_tex_image, 0); |