Revision: 26421
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26421
Author:   blendix
Date:     2010-01-30 10:24:50 +0100 (Sat, 30 Jan 2010)

Log Message:
-----------
Fix #19875: drawing smoke on graphics cards that do not support
non-power-of-two textures lead to artifacts due to uninitialized
memory if the domain had a non-power-of-two size.

Modified Paths:
--------------
    trunk/blender/source/blender/gpu/intern/gpu_extensions.c

Modified: trunk/blender/source/blender/gpu/intern/gpu_extensions.c
===================================================================
--- trunk/blender/source/blender/gpu/intern/gpu_extensions.c    2010-01-30 
09:18:59 UTC (rev 26420)
+++ trunk/blender/source/blender/gpu/intern/gpu_extensions.c    2010-01-30 
09:24:50 UTC (rev 26421)
@@ -372,6 +372,13 @@
        GPU_print_error("3D glTexImage3D");
 
        if (fpixels) {
+               if(!GPU_non_power_of_two_support() && (w != tex->w || h != 
tex->h || depth != tex->depth)) {
+                       /* clear first to avoid unitialized pixels */
+                       float *zero= 
MEM_callocN(sizeof(float)*tex->w*tex->h*tex->depth, "zero");
+                       glTexSubImage3D(tex->target, 0, 0, 0, 0, tex->w, 
tex->h, tex->depth, format, type, zero);
+                       MEM_freeN(zero);
+               }
+
                glTexSubImage3D(tex->target, 0, 0, 0, 0, w, h, depth, format, 
type, fpixels);
                GPU_print_error("3D glTexSubImage3D");
        }


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to