diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2019-11-05 18:55:51 +0300 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2019-11-27 17:54:15 +0300 |
commit | 7959dcd4f6316ade726209f2452323406f3672ea (patch) | |
tree | dd8b3080bd155416e3b5a02540708257ebfcdf30 /source/blender/editors/render | |
parent | 9d7f65630b206385c03d997aa308dbe36c60298f (diff) |
RenderViewport: Texture Format
When doing viewport rendering the color management happens on the CPU.
This has overhead in downloading a float texture from the gpu and
performing color management on the CPU.
Based on the scene fileformat bit depth the result will be rendered to
a byte texture where the colormanagement happens on the GPU or a float
texture where the colormanagement happens on the CPU.
This is only done during `Viewport Render Animation` in other
cases a float texture is being used.
Baseline (HD render of wanderer.blend workbench engine no samples) 15.688038 s
After changes: 9.412880s
Reviewed By: fclem
Differential Revision: https://developer.blender.org/D6195
Diffstat (limited to 'source/blender/editors/render')
-rw-r--r-- | source/blender/editors/render/render_opengl.c | 14 |
1 files changed, 10 insertions, 4 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); |