diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-05-02 17:52:41 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2011-05-02 17:52:41 +0400 |
commit | 7f4b4bbaf0ed5fc7ad41bca13f6a5f9f4d16220c (patch) | |
tree | 84c439445118da91eec4727ad26dbfc137a4dd33 /source | |
parent | 08d8914b3d0c0028c0f204d499ddfe46a76da113 (diff) |
Fix #26697: glsl color management + vertex color was not working right.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/gpu/intern/gpu_material.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index 134bffc7b8c..962c486c159 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -373,6 +373,12 @@ void gpu_material_add_node(GPUMaterial *material, GPUNode *node) /* Code generation */ +static int gpu_do_color_management(GPUMaterial *mat) +{ + return ((mat->scene->r.color_mgt_flag & R_COLOR_MANAGEMENT) && + !((mat->scene->gm.flag & GAME_GLSL_NO_COLOR_MANAGEMENT))); +} + static GPUNodeLink *lamp_get_visibility(GPUMaterial *mat, GPULamp *lamp, GPUNodeLink **lv, GPUNodeLink **dist) { GPUNodeLink *visifac, *inpr; @@ -1011,8 +1017,7 @@ static void do_material_tex(GPUShadeInput *shi) } if(tex->type==TEX_IMAGE) - if((mat->scene->r.color_mgt_flag & R_COLOR_MANAGEMENT) && - !((mat->scene->gm.flag & GAME_GLSL_NO_COLOR_MANAGEMENT))) + if(gpu_do_color_management(mat)) GPU_link(mat, "srgb_to_linearrgb", tcol, &tcol); if(mtex->mapto & MAP_COL) { @@ -1259,6 +1264,8 @@ void GPU_shadeinput_set(GPUMaterial *mat, Material *ma, GPUShadeInput *shi) GPU_link(mat, "set_value", GPU_uniform(&ma->amb), &shi->amb); GPU_link(mat, "shade_view", GPU_builtin(GPU_VIEW_POSITION), &shi->view); GPU_link(mat, "vcol_attribute", GPU_attribute(CD_MCOL, ""), &shi->vcol); + if(gpu_do_color_management(mat)) + GPU_link(mat, "srgb_to_linearrgb", shi->vcol, &shi->vcol); GPU_link(mat, "texco_refl", shi->vn, shi->view, &shi->ref); } @@ -1364,8 +1371,7 @@ void GPU_shaderesult_set(GPUShadeInput *shi, GPUShadeResult *shr) GPU_link(mat, "shade_alpha_obcolor", shr->combined, GPU_builtin(GPU_OBCOLOR), &shr->combined); } - if((mat->scene->r.color_mgt_flag & R_COLOR_MANAGEMENT) && - !((mat->scene->gm.flag & GAME_GLSL_NO_COLOR_MANAGEMENT))) + if(gpu_do_color_management(mat)) GPU_link(mat, "linearrgb_to_srgb", shr->combined, &shr->combined); } |