#include "teximage.h"
#include "texobj.h"
#include "fbobject.h"
+#include "framebuffer.h"
#include "buffers.h"
#include "state.h"
#include "mtypes.h"
0, internal_format,
GL_NONE, GL_NONE);
- if (!ctx->Driver.TestProxyTexImage(ctx, tex_obj->Target, 0, tex_format,
- tex_image->Width, tex_image->Height,
- tex_image->Depth, 0)) {
+ if (!ctx->Driver.TestProxyTexImage(ctx, tex_obj->Target, 1, 0, tex_format,
+ 1, tex_image->Width, tex_image->Height,
+ tex_image->Depth)) {
_mesa_DeleteTextures(1, view_tex_name);
*view_tex_name = 0;
return false;
GLint src_internal_format, dst_internal_format;
GLuint src_view_texture = 0;
struct gl_texture_image *src_view_tex_image;
- GLuint fbos[2];
+ struct gl_framebuffer *readFb;
+ struct gl_framebuffer *drawFb = NULL;
bool success = false;
GLbitfield mask;
GLenum status, attachment;
src_tex_image = wrap_renderbuffer(ctx, src_renderbuffer);
}
if (!make_view(ctx, src_tex_image, &src_view_tex_image, &src_view_texture,
- dst_tex_image->InternalFormat))
+ dst_internal_format))
goto cleanup;
}
/* We really only need to stash the bound framebuffers and scissor. */
_mesa_meta_begin(ctx, MESA_META_SCISSOR);
- _mesa_GenFramebuffers(2, fbos);
- _mesa_BindFramebuffer(GL_READ_FRAMEBUFFER, fbos[0]);
- _mesa_BindFramebuffer(GL_DRAW_FRAMEBUFFER, fbos[1]);
+ readFb = ctx->Driver.NewFramebuffer(ctx, 0xDEADBEEF);
+ if (readFb == NULL)
+ goto meta_end;
+
+ drawFb = ctx->Driver.NewFramebuffer(ctx, 0xDEADBEEF);
+ if (drawFb == NULL)
+ goto meta_end;
+
+ _mesa_bind_framebuffers(ctx, drawFb, readFb);
switch (_mesa_get_format_base_format(src_format)) {
case GL_DEPTH_COMPONENT:
/* Prefer the tex image because, even if we have a renderbuffer, we may
* have had to wrap it in a texture view.
*/
- _mesa_meta_bind_fbo_image(GL_READ_FRAMEBUFFER, attachment,
- src_view_tex_image, src_z);
+ _mesa_meta_framebuffer_texture_image(ctx, ctx->ReadBuffer, attachment,
+ src_view_tex_image, src_z);
} else {
_mesa_framebuffer_renderbuffer(ctx, ctx->ReadBuffer, attachment,
src_renderbuffer);
}
- status = _mesa_CheckFramebufferStatus(GL_READ_FRAMEBUFFER);
+ status = _mesa_check_framebuffer_status(ctx, ctx->ReadBuffer);
if (status != GL_FRAMEBUFFER_COMPLETE)
goto meta_end;
_mesa_framebuffer_renderbuffer(ctx, ctx->DrawBuffer, attachment,
dst_renderbuffer);
} else {
- _mesa_meta_bind_fbo_image(GL_DRAW_FRAMEBUFFER, attachment,
- dst_tex_image, dst_z);
+ _mesa_meta_framebuffer_texture_image(ctx, ctx->DrawBuffer, attachment,
+ dst_tex_image, dst_z);
}
- status = _mesa_CheckFramebufferStatus(GL_DRAW_FRAMEBUFFER);
+ status = _mesa_check_framebuffer_status(ctx, ctx->DrawBuffer);
if (status != GL_FRAMEBUFFER_COMPLETE)
goto meta_end;
+ /* Explicitly disable sRGB encoding */
+ ctx->DrawBuffer->Visual.sRGBCapable = false;
+
/* Since we've bound a new draw framebuffer, we need to update its
* derived state -- _Xmin, etc -- for BlitFramebuffer's clipping to
* be correct.
success = true;
meta_end:
- _mesa_DeleteFramebuffers(2, fbos);
+ _mesa_reference_framebuffer(&readFb, NULL);
+ _mesa_reference_framebuffer(&drawFb, NULL);
_mesa_meta_end(ctx);
cleanup: