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:
-rw-r--r--source/blender/draw/DRW_engine.h1
-rw-r--r--source/blender/draw/intern/draw_manager.c8
-rw-r--r--source/blender/editors/include/ED_view3d.h2
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c11
-rw-r--r--source/blender/python/gpu/gpu_py_offscreen.c1
5 files changed, 15 insertions, 8 deletions
diff --git a/source/blender/draw/DRW_engine.h b/source/blender/draw/DRW_engine.h
index 49d17e39de2..f5e679a4e73 100644
--- a/source/blender/draw/DRW_engine.h
+++ b/source/blender/draw/DRW_engine.h
@@ -111,6 +111,7 @@ void DRW_draw_render_loop_offscreen(
struct RenderEngineType *engine_type,
struct ARegion *ar, struct View3D *v3d,
const bool draw_background,
+ const bool do_color_management,
struct GPUOffScreen *ofs,
struct GPUViewport *viewport);
void DRW_draw_select_loop(
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
index 8a532ecdb7d..44ec9926d59 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -1673,7 +1673,9 @@ void DRW_draw_render_loop(
void DRW_draw_render_loop_offscreen(
struct Depsgraph *depsgraph, RenderEngineType *engine_type,
ARegion *ar, View3D *v3d,
- const bool draw_background, GPUOffScreen *ofs,
+ const bool draw_background,
+ const bool do_color_management,
+ GPUOffScreen *ofs,
GPUViewport *viewport)
{
/* Create temporary viewport if needed. */
@@ -1686,7 +1688,9 @@ void DRW_draw_render_loop_offscreen(
/* Reset before using it. */
drw_state_prepare_clean_for_draw(&DST);
- DST.options.is_image_render = true;
+ /* WATCH: Force color management to output CManaged byte buffer by
+ * forcing is_image_render to false. */
+ DST.options.is_image_render = !do_color_management;
DST.options.draw_background = draw_background;
DRW_draw_render_loop_ex(depsgraph, engine_type, ar, v3d, render_viewport, NULL);
diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h
index 04488aedf49..02ea0027938 100644
--- a/source/blender/editors/include/ED_view3d.h
+++ b/source/blender/editors/include/ED_view3d.h
@@ -450,7 +450,7 @@ void ED_view3d_draw_offscreen(
int drawtype,
struct View3D *v3d, struct ARegion *ar, int winx, int winy, float viewmat[4][4],
float winmat[4][4], bool do_sky, bool is_persp, const char *viewname,
- struct GPUFXSettings *fx_settings,
+ struct GPUFXSettings *fx_settings, bool do_color_managment,
struct GPUOffScreen *ofs, struct GPUViewport *viewport);
void ED_view3d_draw_setup_view(
struct wmWindow *win, struct Depsgraph *depsgraph, struct Scene *scene, struct ARegion *ar, struct View3D *v3d,
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 39a77329db5..522d081fdd6 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -1455,7 +1455,7 @@ void ED_view3d_draw_offscreen(
View3D *v3d, ARegion *ar, int winx, int winy,
float viewmat[4][4], float winmat[4][4],
bool do_sky, bool UNUSED(is_persp), const char *viewname,
- GPUFXSettings *UNUSED(fx_settings),
+ GPUFXSettings *UNUSED(fx_settings), const bool do_color_management,
GPUOffScreen *ofs, GPUViewport *viewport)
{
RegionView3D *rv3d = ar->regiondata;
@@ -1501,7 +1501,7 @@ void ED_view3d_draw_offscreen(
/* main drawing call */
DRW_draw_render_loop_offscreen(
depsgraph, engine_type, ar, v3d,
- do_sky, ofs, viewport);
+ do_sky, do_color_management, ofs, viewport);
/* restore size */
ar->winx = bwinx;
@@ -1604,12 +1604,13 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(
}
if ((samples && use_full_sample) == 0) {
+ const bool do_color_management = (ibuf->rect_float == NULL);
/* Single-pass render, common case */
ED_view3d_draw_offscreen(
depsgraph, scene, drawtype,
v3d, ar, sizex, sizey, NULL, winmat,
draw_sky, !is_ortho, viewname,
- &fx_settings, ofs, NULL);
+ &fx_settings, do_color_management, ofs, NULL);
if (ibuf->rect_float) {
GPU_offscreen_read_pixels(ofs, GL_FLOAT, ibuf->rect_float);
@@ -1634,7 +1635,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(
depsgraph, scene, drawtype,
v3d, ar, sizex, sizey, NULL, winmat,
draw_sky, !is_ortho, viewname,
- &fx_settings, ofs, viewport);
+ &fx_settings, false, ofs, viewport);
GPU_offscreen_read_pixels(ofs, GL_FLOAT, accum_buffer);
/* skip the first sample */
@@ -1649,7 +1650,7 @@ ImBuf *ED_view3d_draw_offscreen_imbuf(
depsgraph, scene, drawtype,
v3d, ar, sizex, sizey, NULL, winmat_jitter,
draw_sky, !is_ortho, viewname,
- &fx_settings, ofs, viewport);
+ &fx_settings, false, ofs, viewport);
GPU_offscreen_read_pixels(ofs, GL_FLOAT, rect_temp);
uint i = sizex * sizey * 4;
diff --git a/source/blender/python/gpu/gpu_py_offscreen.c b/source/blender/python/gpu/gpu_py_offscreen.c
index 21edae036df..5482677defc 100644
--- a/source/blender/python/gpu/gpu_py_offscreen.c
+++ b/source/blender/python/gpu/gpu_py_offscreen.c
@@ -259,6 +259,7 @@ static PyObject *bpygpu_offscreen_draw_view3d(BPyGPUOffScreen *self, PyObject *a
true,
"",
NULL,
+ true,
self->ofs,
NULL);