summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri
diff options
context:
space:
mode:
authorJuha-Pekka Heikkila <[email protected]>2014-05-28 13:28:58 +0300
committerTapani Pälli <[email protected]>2014-09-23 10:25:02 +0300
commita82b29d52627c0b0a35efa437c4d81aaaafbbe0c (patch)
tree08119b9b728e23e0a9809b97cf4fc7bc82dbb6b1 /src/mesa/drivers/dri
parent5a6ec26aec6c3a16df18270ec6cbc7e9fd3757cf (diff)
i965: in set_read_rb_tex_image() check _mesa_meta_bind_rb_as_tex_image() did succeed
Check if _mesa_meta_bind_rb_as_tex_image() did give the texture. If no texture was given there is already either GL_INVALID_VALUE or GL_OUT_OF_MEMORY error set in context. Signed-off-by: Juha-Pekka Heikkila <[email protected]> Reviewed-by: Topi Pohjolainen <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r--src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c14
1 files changed, 10 insertions, 4 deletions
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 0b4742693db..b9b481b90eb 100644
--- a/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c
+++ b/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c
@@ -371,7 +371,7 @@ prepare_vertex_data(void)
_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)
{
@@ -387,8 +387,10 @@ set_read_rb_tex_image(struct gl_context *ctx, struct fb_tex_blit_state *blit,
*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;
@@ -396,6 +398,7 @@ set_read_rb_tex_image(struct gl_context *ctx, struct fb_tex_blit_state *blit,
blit->stencilSamplingSave = tex_obj->StencilSampling;
blit->sampler = _mesa_meta_setup_sampler(ctx, tex_obj, *target,
GL_NEAREST, level);
+ return true;
}
static void
@@ -424,7 +427,9 @@ brw_meta_stencil_blit(struct brw_context *brw,
_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);
@@ -445,6 +450,7 @@ brw_meta_stencil_blit(struct brw_context *brw,
_mesa_DrawArrays(GL_TRIANGLE_FAN, 0, 4);
+error:
_mesa_meta_fb_tex_blit_end(ctx, target, &blit);
_mesa_meta_end(ctx);