Fix for usage of un-initialized memory.
authorSergey Sharybin <sergey.vfx@gmail.com>
Mon, 3 Sep 2012 13:17:21 +0000 (13:17 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Mon, 3 Sep 2012 13:17:21 +0000 (13:17 +0000)
Checked by Brecht when were in Blender Institute.

Discovered when was looking into #32296: Node Texture - Node Material - GLSL Viewport rendering issue

source/blender/gpu/intern/gpu_material.c

index 81b80b831660fdf6b2a7d11942b906941b9469d4..c831b92936f254c5dcbe285141d64f5ebc20ea28 100644 (file)
@@ -1396,10 +1396,10 @@ void GPU_shaderesult_set(GPUShadeInput *shi, GPUShadeResult *shr)
                GPU_material_enable_alpha(mat);
 
        if ((mat->scene->gm.flag & GAME_GLSL_NO_LIGHTS) || (ma->mode & MA_SHLESS)) {
-               shr->combined = shi->rgb;
-               shr->alpha = shi->alpha;
                GPU_link(mat, "set_rgb", shi->rgb, &shr->diff);
                GPU_link(mat, "set_rgb_zero", &shr->spec);
+               GPU_link(mat, "set_value", shi->alpha, &shr->alpha);
+               shr->combined = shr->diff;
        }
        else {
                if (GPU_link_changed(shi->emit) || ma->emit != 0.0f) {
@@ -1418,7 +1418,8 @@ void GPU_shaderesult_set(GPUShadeInput *shi, GPUShadeResult *shr)
                material_lights(shi, shr);
 
                shr->combined = shr->diff;
-               shr->alpha = shi->alpha;
+
+               GPU_link(mat, "set_value", shi->alpha, &shr->alpha);
 
                if (world) {
                        /* exposure correction */