Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2011-03-07 02:12:12 +0300
committerCampbell Barton <ideasman42@gmail.com>2011-03-07 02:12:12 +0300
commit627c764e3cdd7ce67d9640e5a0c5280953c3728d (patch)
treec810fa3ad6ba8f998b106db02a71879c6d14394a /source/blender/editors
parentf1e0ef1d1281cc63d092a144ddbe3b1140104cd5 (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')
-rw-r--r--source/blender/editors/include/ED_view3d.h4
-rw-r--r--source/blender/editors/render/render_opengl.c19
-rw-r--r--source/blender/editors/sculpt_paint/paint_image.c5
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c8
4 files changed, 23 insertions, 13 deletions
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h
index fdfad7c4128..48f3a40b0f9 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -171,8 +171,8 @@ int ED_view3d_context_activate(struct bContext *C);
void ED_view3d_draw_offscreen(struct Scene *scene, struct View3D *v3d, struct ARegion *ar,
int winx, int winy, float viewmat[][4], float winmat[][4]);
-struct ImBuf *ED_view3d_draw_offscreen_imbuf(struct Scene *scene, struct View3D *v3d, struct ARegion *ar, int sizex, int sizey, unsigned int flag);
-struct ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, int width, int height, unsigned int flag, int drawtype);
+struct ImBuf *ED_view3d_draw_offscreen_imbuf(struct Scene *scene, struct View3D *v3d, struct ARegion *ar, int sizex, int sizey, unsigned int flag, char err_out[256]);
+struct ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, int width, int height, unsigned int flag, int drawtype, char err_out[256]);
Base *ED_view3d_give_base_under_cursor(struct bContext *C, short *mval);
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;
}
diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c
index 6c696ac357b..d697a3a8856 100644
--- a/source/blender/editors/sculpt_paint/paint_image.c
+++ b/source/blender/editors/sculpt_paint/paint_image.c
@@ -5587,6 +5587,7 @@ static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op)
int w= settings->imapaint.screen_grab_size[0];
int h= settings->imapaint.screen_grab_size[1];
int maxsize;
+ char err_out[256]= "unknown";
RNA_string_get(op->ptr, "filepath", filename);
@@ -5595,11 +5596,11 @@ static int texture_paint_image_from_view_exec(bContext *C, wmOperator *op)
if(w > maxsize) w= maxsize;
if(h > maxsize) h= maxsize;
- ibuf= ED_view3d_draw_offscreen_imbuf(CTX_data_scene(C), CTX_wm_view3d(C), CTX_wm_region(C), w, h, IB_rect);
+ ibuf= ED_view3d_draw_offscreen_imbuf(CTX_data_scene(C), CTX_wm_view3d(C), CTX_wm_region(C), w, h, IB_rect, err_out);
if(!ibuf) {
/* Mostly happens when OpenGL offscreen buffer was failed to create, */
/* but could be other reasons. Should be handled in the future. nazgul */
- 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 OPERATOR_CANCELLED;
}
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 3ca6d39305c..6e286578dad 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -2150,7 +2150,7 @@ void ED_view3d_draw_offscreen(Scene *scene, View3D *v3d, ARegion *ar, int winx,
}
/* utility func for ED_view3d_draw_offscreen */
-ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, int sizex, int sizey, unsigned int flag)
+ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, int sizex, int sizey, unsigned int flag, char err_out[256])
{
RegionView3D *rv3d= ar->regiondata;
ImBuf *ibuf;
@@ -2160,7 +2160,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, in
glPushAttrib(GL_LIGHTING_BIT);
/* bind */
- ofs= GPU_offscreen_create(&sizex, &sizey);
+ ofs= GPU_offscreen_create(&sizex, &sizey, err_out);
if(ofs == NULL)
return NULL;
@@ -2204,7 +2204,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(Scene *scene, View3D *v3d, ARegion *ar, in
}
/* creates own 3d views, used by the sequencer */
-ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, int width, int height, unsigned int flag, int drawtype)
+ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, int width, int height, unsigned int flag, int drawtype, char err_out[256])
{
View3D v3d= {NULL};
ARegion ar= {NULL};
@@ -2235,7 +2235,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf_simple(Scene *scene, int width, int height
mul_m4_m4m4(rv3d.persmat, rv3d.viewmat, rv3d.winmat);
invert_m4_m4(rv3d.persinv, rv3d.viewinv);
- return ED_view3d_draw_offscreen_imbuf(scene, &v3d, &ar, width, height, flag);
+ return ED_view3d_draw_offscreen_imbuf(scene, &v3d, &ar, width, height, flag, err_out);
// seq_view3d_cb(scene, cfra, render_size, seqrectx, seqrecty);
}