diff options
Diffstat (limited to 'source/blender/gpu')
-rw-r--r-- | source/blender/gpu/intern/gpu_draw.c | 15 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_material.c | 8 |
2 files changed, 16 insertions, 7 deletions
diff --git a/source/blender/gpu/intern/gpu_draw.c b/source/blender/gpu/intern/gpu_draw.c index ab3ab0a133e..9b027f7906d 100644 --- a/source/blender/gpu/intern/gpu_draw.c +++ b/source/blender/gpu/intern/gpu_draw.c @@ -492,7 +492,7 @@ int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int compare, int } /* TODO unneeded when float images are correctly treated as linear always */ - if (!ncd && ibuf->profile == IB_PROFILE_LINEAR_RGB) + if (!ncd) do_color_management = TRUE; if (ibuf->rect==NULL) @@ -535,7 +535,7 @@ int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int compare, int if (do_color_management) { srgb_frect = MEM_mallocN(ibuf->x*ibuf->y*sizeof(float)*4, "floar_buf_col_cor"); IMB_buffer_float_from_float(srgb_frect, ibuf->rect_float, - ibuf->channels, IB_PROFILE_SRGB, ibuf->profile, 0, + ibuf->channels, IB_PROFILE_SRGB, IB_PROFILE_LINEAR_RGB, 0, ibuf->x, ibuf->y, ibuf->x, ibuf->x); /* clamp buffer colors to 1.0 to avoid artifacts due to glu for hdr images */ IMB_buffer_float_clamp(srgb_frect, ibuf->x, ibuf->y); @@ -560,7 +560,7 @@ int GPU_verify_image(Image *ima, ImageUser *iuser, int tftile, int compare, int if (do_color_management) { frect = srgb_frect = MEM_mallocN(ibuf->x*ibuf->y*sizeof(*srgb_frect)*4, "floar_buf_col_cor"); IMB_buffer_float_from_float(srgb_frect, ibuf->rect_float, - ibuf->channels, IB_PROFILE_SRGB, ibuf->profile, 0, + ibuf->channels, IB_PROFILE_SRGB, IB_PROFILE_LINEAR_RGB, 0, ibuf->x, ibuf->y, ibuf->x, ibuf->x); /* clamp buffer colors to 1.0 to avoid artifacts due to glu for hdr images */ IMB_buffer_float_clamp(srgb_frect, ibuf->x, ibuf->y); @@ -901,7 +901,7 @@ void GPU_paint_update_image(Image *ima, int x, int y, int w, int h, int mipmap) glGetIntegerv(GL_UNPACK_SKIP_ROWS, &skip_rows); /* if color correction is needed, we must update the part that needs updating. */ - if (ibuf->rect_float && (!U.use_16bit_textures || (ibuf->profile == IB_PROFILE_LINEAR_RGB))) { + if (ibuf->rect_float) { float *buffer = MEM_mallocN(w*h*sizeof(float)*4, "temp_texpaint_float_buf"); IMB_partial_rect_from_float(ibuf, buffer, x, y, w, h); @@ -1197,7 +1197,12 @@ void GPU_begin_object_materials(View3D *v3d, RegionView3D *rv3d, Scene *scene, O GPUMaterial *gpumat; GPUBlendMode alphablend; int a; - int gamma = scene->r.color_mgt_flag & R_COLOR_MANAGEMENT; + + /* OCIO_TODO: assume color management is always enabled. could be nice to support real display transform here, + * but that's not so important and could be done later + */ + int gamma = TRUE; + int new_shading_nodes = BKE_scene_use_new_shading_nodes(scene); /* initialize state */ diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index 61be4057843..dd92b561235 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -389,8 +389,12 @@ void gpu_material_add_node(GPUMaterial *material, GPUNode *node) int GPU_material_do_color_management(GPUMaterial *mat) { - return ((mat->scene->r.color_mgt_flag & R_COLOR_MANAGEMENT) && - !((mat->scene->gm.flag & GAME_GLSL_NO_COLOR_MANAGEMENT))); + /* OCIO_TODO: for now assume scene always does color management. probably could be + * improved in the future to support real display transform + * also probably we'll need to get rid ofgame engine's color management flag + */ + + return !((mat->scene->gm.flag & GAME_GLSL_NO_COLOR_MANAGEMENT)); } static GPUNodeLink *lamp_get_visibility(GPUMaterial *mat, GPULamp *lamp, GPUNodeLink **lv, GPUNodeLink **dist) |