diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-03-07 02:12:12 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-03-07 02:12:12 +0300 |
commit | 627c764e3cdd7ce67d9640e5a0c5280953c3728d (patch) | |
tree | c810fa3ad6ba8f998b106db02a71879c6d14394a /source/blender/editors/render/render_opengl.c | |
parent | f1e0ef1d1281cc63d092a144ddbe3b1140104cd5 (diff) |
bug [#26329] Project Paint not working
we cant ensure that a requested buffer can be allocated so report opengl errors when failing to allocate the buffer (rather then printing to console).
this is common enough and generic error isn't too helpful to users.
Diffstat (limited to 'source/blender/editors/render/render_opengl.c')
-rw-r--r-- | source/blender/editors/render/render_opengl.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index 5d3bf92a492..43fb41a5e3d 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -188,9 +188,17 @@ static void screen_opengl_render_apply(OGLRender *oglrender) GPU_offscreen_unbind(oglrender->ofs); /* unbind */ } else { - ImBuf *ibuf_view= ED_view3d_draw_offscreen_imbuf_simple(scene, oglrender->sizex, oglrender->sizey, IB_rectfloat, OB_SOLID); - memcpy(rr->rectf, ibuf_view->rect_float, sizeof(float) * 4 * oglrender->sizex * oglrender->sizey); - IMB_freeImBuf(ibuf_view); + /* shouldnt suddenly give errors mid-render but possible */ + char err_out[256]= "unknown"; + ImBuf *ibuf_view= ED_view3d_draw_offscreen_imbuf_simple(scene, oglrender->sizex, oglrender->sizey, IB_rectfloat, OB_SOLID, err_out); + + if(ibuf_view) { + memcpy(rr->rectf, ibuf_view->rect_float, sizeof(float) * 4 * oglrender->sizex * oglrender->sizey); + IMB_freeImBuf(ibuf_view); + } + else { + fprintf(stderr, "screen_opengl_render_apply: failed to get buffer, %s\n", err_out); + } } /* rr->rectf is now filled with image data */ @@ -230,6 +238,7 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op) short is_view_context= RNA_boolean_get(op->ptr, "view_context"); const short is_animation= RNA_boolean_get(op->ptr, "animation"); const short is_write_still= RNA_boolean_get(op->ptr, "write_still"); + char err_out[256]= "unknown"; /* ensure we have a 3d view */ @@ -263,10 +272,10 @@ static int screen_opengl_render_init(bContext *C, wmOperator *op) sizey= (scene->r.size*scene->r.ysch)/100; /* corrects render size with actual size, not every card supports non-power-of-two dimensions */ - ofs= GPU_offscreen_create(&sizex, &sizey); + ofs= GPU_offscreen_create(&sizex, &sizey, err_out); if(!ofs) { - BKE_report(op->reports, RPT_ERROR, "Failed to create OpenGL offscreen buffer."); + BKE_reportf(op->reports, RPT_ERROR, "Failed to create OpenGL offscreen buffer, %s", err_out); return 0; } |