GLsizei width, GLsizei height)
{
GLuint fbo;
+ struct gl_framebuffer *drawFb;
bool success = false;
GLbitfield mask;
GLenum status;
_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) {
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:
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;
_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:
#include "buffers.h"
#include "clear.h"
#include "fbobject.h"
+#include "framebuffer.h"
#include "glformats.h"
#include "glheader.h"
#include "image.h"
{
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;
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);
{
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;
_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);
* 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);
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);