diff options
-rw-r--r-- | source/blender/editors/render/render_opengl.c | 14 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_scene_types.h | 24 |
2 files changed, 27 insertions, 11 deletions
diff --git a/source/blender/editors/render/render_opengl.c b/source/blender/editors/render/render_opengl.c index f419d30a17e..0d0e183e480 100644 --- a/source/blender/editors/render/render_opengl.c +++ b/source/blender/editors/render/render_opengl.c @@ -18,7 +18,7 @@ */ /** \file - * \ingroup edrend + * \ingroup render */ #include <math.h> @@ -77,7 +77,7 @@ #include "render_intern.h" /* Define this to get timing information. */ -// #undef DEBUG_TIME +// #define DEBUG_TIME #ifdef DEBUG_TIME # include "PIL_time.h" @@ -138,6 +138,8 @@ typedef struct OGLRender { TaskPool *task_pool; bool pool_ok; bool is_animation; + + eImageFormatDepth color_depth; SpinLock reports_lock; unsigned int num_scheduled_frames; ThreadMutex task_mutex; @@ -356,6 +358,7 @@ static void screen_opengl_render_doit(const bContext *C, OGLRender *oglrender, R char err_out[256] = "unknown"; ImBuf *ibuf_view; const int alpha_mode = (draw_sky) ? R_ADDSKY : R_ALPHAPREMUL; + int output_flags = oglrender->color_depth <= R_IMF_CHAN_DEPTH_8 ? IB_rect : IB_rectfloat; if (view_context) { ibuf_view = ED_view3d_draw_offscreen_imbuf(depsgraph, @@ -365,7 +368,7 @@ static void screen_opengl_render_doit(const bContext *C, OGLRender *oglrender, R ar, sizex, sizey, - IB_rectfloat, + output_flags, alpha_mode, oglrender->ofs_samples, viewname, @@ -385,7 +388,7 @@ static void screen_opengl_render_doit(const bContext *C, OGLRender *oglrender, R scene->camera, oglrender->sizex, oglrender->sizey, - IB_rectfloat, + output_flags, V3D_OFSDRAW_SHOW_ANNOTATION, alpha_mode, oglrender->ofs_samples, @@ -528,6 +531,8 @@ static bool screen_opengl_render_init(bContext *C, wmOperator *op) const bool is_animation = RNA_boolean_get(op->ptr, "animation"); const bool is_sequencer = RNA_boolean_get(op->ptr, "sequencer"); const bool is_write_still = RNA_boolean_get(op->ptr, "write_still"); + const eImageFormatDepth color_depth = (is_animation) ? scene->r.im_format.depth : + R_IMF_CHAN_DEPTH_32; const int samples = U.ogl_multisamples; char err_out[256] = "unknown"; @@ -600,6 +605,7 @@ static bool screen_opengl_render_init(bContext *C, wmOperator *op) oglrender->write_still = is_write_still && !is_animation; oglrender->is_animation = is_animation; + oglrender->color_depth = color_depth; oglrender->views_len = BKE_scene_multiview_num_views_get(&scene->r); diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h index 0de43c1632f..ce0c7319ce5 100644 --- a/source/blender/makesdna/DNA_scene_types.h +++ b/source/blender/makesdna/DNA_scene_types.h @@ -483,13 +483,23 @@ typedef struct ImageFormatData { #define R_IMF_FLAG_PREVIEW_JPG (1 << 1) /* was R_PREVIEW_JPG */ /* return values from BKE_imtype_valid_depths, note this is depts per channel */ -#define R_IMF_CHAN_DEPTH_1 (1 << 0) /* 1bits (unused) */ -#define R_IMF_CHAN_DEPTH_8 (1 << 1) /* 8bits (default) */ -#define R_IMF_CHAN_DEPTH_10 (1 << 2) /* 10bits (uncommon, Cineon/DPX support) */ -#define R_IMF_CHAN_DEPTH_12 (1 << 3) /* 12bits (uncommon, jp2/DPX support) */ -#define R_IMF_CHAN_DEPTH_16 (1 << 4) /* 16bits (tiff, halff float exr) */ -#define R_IMF_CHAN_DEPTH_24 (1 << 5) /* 24bits (unused) */ -#define R_IMF_CHAN_DEPTH_32 (1 << 6) /* 32bits (full float exr) */ +/* ImageFormatData.depth */ +typedef enum eImageFormatDepth { + /* 1bits (unused) */ + R_IMF_CHAN_DEPTH_1 = (1 << 0), + /* 8bits (default) */ + R_IMF_CHAN_DEPTH_8 = (1 << 1), + /* 10bits (uncommon, Cineon/DPX support) */ + R_IMF_CHAN_DEPTH_10 = (1 << 2), + /* 12bits (uncommon, jp2/DPX support) */ + R_IMF_CHAN_DEPTH_12 = (1 << 3), + /* 16bits (tiff, half float exr) */ + R_IMF_CHAN_DEPTH_16 = (1 << 4), + /* 24bits (unused) */ + R_IMF_CHAN_DEPTH_24 = (1 << 5), + /* 32bits (full float exr) */ + R_IMF_CHAN_DEPTH_32 = (1 << 6), +} eImageFormatDepth; /* ImageFormatData.planes */ #define R_IMF_PLANES_RGB 24 |