GLenum *target)
{
struct gl_texture_image *texImage;
+ GLuint tempTex;
if (rb->NumSamples > 1)
*target = GL_TEXTURE_2D_MULTISAMPLE;
else
*target = GL_TEXTURE_2D;
- _mesa_GenTextures(1, tex);
+ tempTex = 0;
+ _mesa_GenTextures(1, &tempTex);
+ if (tempTex == 0)
+ return false;
+
+ *tex = tempTex;
+
_mesa_BindTexture(*target, *tex);
*texObj = _mesa_lookup_texture(ctx, *tex);
texImage = _mesa_get_tex_image(ctx, *texObj, *target, 0);
_mesa_BufferSubData(GL_ARRAY_BUFFER_ARB, 0, sizeof(verts), verts);
}
-static void
+static bool
set_read_rb_tex_image(struct gl_context *ctx, struct fb_tex_blit_state *blit,
GLenum *target)
{
*target = tex_obj->Target;
level = att->TextureLevel;
} else {
- _mesa_meta_bind_rb_as_tex_image(ctx, rb, &blit->tempTex, &tex_obj,
- target);
+ if (!_mesa_meta_bind_rb_as_tex_image(ctx, rb, &blit->tempTex, &tex_obj,
+ target)) {
+ return false;
+ }
}
blit->baseLevelSave = tex_obj->BaseLevel;
blit->stencilSamplingSave = tex_obj->StencilSampling;
blit->sampler = _mesa_meta_setup_sampler(ctx, tex_obj, *target,
GL_NEAREST, level);
+ return true;
}
static void
_mesa_DrawBuffer(GL_COLOR_ATTACHMENT0);
ctx->DrawBuffer->_Status = GL_FRAMEBUFFER_COMPLETE;
- set_read_rb_tex_image(ctx, &blit, &target);
+ if (!set_read_rb_tex_image(ctx, &blit, &target)) {
+ goto error;
+ }
_mesa_TexParameteri(target, GL_DEPTH_STENCIL_TEXTURE_MODE,
GL_STENCIL_INDEX);
_mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4);
+error:
_mesa_meta_fb_tex_blit_end(ctx, target, &blit);
_mesa_meta_end(ctx);