Revision: 42077
          
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42077
Author:   campbellbarton
Date:     2011-11-22 18:15:08 +0000 (Tue, 22 Nov 2011)
Log Message:
-----------
svn merge ^/trunk/blender -r42069:42076

Revision Links:
--------------
    
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42069

Modified Paths:
--------------
    branches/bmesh/blender/intern/cycles/device/device_opencl.cpp
    branches/bmesh/blender/intern/cycles/kernel/kernel.cl
    branches/bmesh/blender/intern/cycles/render/filter.cpp
    branches/bmesh/blender/intern/cycles/util/util_path.cpp
    branches/bmesh/blender/intern/cycles/util/util_path.h
    branches/bmesh/blender/release/scripts/startup/bl_ui/properties_render.py
    branches/bmesh/blender/release/scripts/startup/bl_ui/space_view3d_toolbar.py
    branches/bmesh/blender/source/blender/blenkernel/intern/ocean.c
    branches/bmesh/blender/source/blender/editors/include/UI_interface.h
    branches/bmesh/blender/source/blender/editors/interface/interface.c
    branches/bmesh/blender/source/blender/editors/interface/interface_handlers.c
    branches/bmesh/blender/source/blender/editors/space_image/image_buttons.c
    branches/bmesh/blender/source/blender/editors/space_node/drawnode.c
    branches/bmesh/blender/source/blender/editors/space_node/node_draw.c
    branches/bmesh/blender/source/blender/makesrna/intern/rna_ui_api.c
    branches/bmesh/blender/source/blender/modifiers/intern/MOD_ocean.c

Property Changed:
----------------
    branches/bmesh/blender/
    branches/bmesh/blender/release/
    branches/bmesh/blender/source/blender/editors/space_outliner/


Property changes on: branches/bmesh/blender
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/blender:39992-42069
   + /trunk/blender:39992-42076

Modified: branches/bmesh/blender/intern/cycles/device/device_opencl.cpp
===================================================================
--- branches/bmesh/blender/intern/cycles/device/device_opencl.cpp       
2011-11-22 18:03:33 UTC (rev 42076)
+++ branches/bmesh/blender/intern/cycles/device/device_opencl.cpp       
2011-11-22 18:15:08 UTC (rev 42077)
@@ -278,10 +278,7 @@
 
        bool build_kernel(const string& kernel_path)
        {
-               string build_options = "";
-
-               build_options += "-I " + kernel_path + ""; /* todo: escape 
path, but it doesn't get parsed correct? */
-               build_options += kernel_build_options();
+               string build_options = kernel_build_options();
        
                ciErr = clBuildProgram(cpProgram, 0, NULL, 
build_options.c_str(), NULL, NULL);
 
@@ -312,6 +309,8 @@
                   kernel caches do not seem to recognize changes in included 
files.
                   so we force recompile on changes by adding the md5 hash of 
all files */
                string source = "#include \"kernel.cl\" // " + kernel_md5 + 
"\n";
+               source = path_source_replace_includes(source, kernel_path);
+
                size_t source_len = source.size();
                const char *source_str = source.c_str();
 

Modified: branches/bmesh/blender/intern/cycles/kernel/kernel.cl
===================================================================
--- branches/bmesh/blender/intern/cycles/kernel/kernel.cl       2011-11-22 
18:03:33 UTC (rev 42076)
+++ branches/bmesh/blender/intern/cycles/kernel/kernel.cl       2011-11-22 
18:15:08 UTC (rev 42077)
@@ -25,7 +25,6 @@
 
 #include "kernel_film.h"
 #include "kernel_path.h"
-//#include "kernel_displace.h"
 
 __kernel void kernel_ocl_path_trace(
        __constant KernelData *data,

Modified: branches/bmesh/blender/intern/cycles/render/filter.cpp
===================================================================
--- branches/bmesh/blender/intern/cycles/render/filter.cpp      2011-11-22 
18:03:33 UTC (rev 42076)
+++ branches/bmesh/blender/intern/cycles/render/filter.cpp      2011-11-22 
18:15:08 UTC (rev 42077)
@@ -53,7 +53,7 @@
 
 static vector<float> filter_table(FilterType type, float width)
 {
-       const int filter_table_size = FILTER_TABLE_SIZE;
+       const int filter_table_size = FILTER_TABLE_SIZE-1;
        vector<float> filter_table_cdf(filter_table_size+1);
        vector<float> filter_table(filter_table_size+1);
        float (*filter_func)(float, float) = NULL;

Modified: branches/bmesh/blender/intern/cycles/util/util_path.cpp
===================================================================
--- branches/bmesh/blender/intern/cycles/util/util_path.cpp     2011-11-22 
18:03:33 UTC (rev 42076)
+++ branches/bmesh/blender/intern/cycles/util/util_path.cpp     2011-11-22 
18:15:08 UTC (rev 42077)
@@ -162,5 +162,46 @@
        return true;
 }
 
+static bool path_read_text(const string& path, string& text)
+{
+       vector<uint8_t> binary;
+
+       if(!path_exists(path) || !path_read_binary(path, binary))
+               return false;
+       
+       const char *str = (const char*)&binary[0];
+       size_t size = binary.size();
+       text = string(str, size);
+
+       return true;
+}
+
+string path_source_replace_includes(const string& source_, const string& path)
+{
+       /* our own little c preprocessor that replaces #includes with the file
+          contents, to work around issue of opencl drivers not supporting
+          include paths with spaces in them */
+       string source = source_;
+       const string include = "#include \"";
+       size_t n, pos = 0;
+
+       while((n = source.find(include, pos)) != string::npos) {
+               size_t n_start = n + include.size();
+               size_t n_end = source.find("\"", n_start);
+               string filename = source.substr(n_start, n_end - n_start);
+
+               string text, filepath = path_join(path, filename);
+
+               if(path_read_text(filepath, text)) {
+                       text = path_source_replace_includes(text, 
path_dirname(filepath));
+                       source.replace(n, n_end + 1 - n, "\n" + text + "\n");
+               }
+               else
+                       pos = n_end;
+       }
+
+       return source;
+}
+
 CCL_NAMESPACE_END
 

Modified: branches/bmesh/blender/intern/cycles/util/util_path.h
===================================================================
--- branches/bmesh/blender/intern/cycles/util/util_path.h       2011-11-22 
18:03:33 UTC (rev 42076)
+++ branches/bmesh/blender/intern/cycles/util/util_path.h       2011-11-22 
18:15:08 UTC (rev 42077)
@@ -46,6 +46,8 @@
 bool path_write_binary(const string& path, const vector<uint8_t>& binary);
 bool path_read_binary(const string& path, vector<uint8_t>& binary);
 
+string path_source_replace_includes(const string& source, const string& path);
+
 CCL_NAMESPACE_END
 
 #endif


Property changes on: branches/bmesh/blender/release
___________________________________________________________________
Modified: svn:mergeinfo
   - /trunk/blender/release:31524-42069
   + /trunk/blender/release:31524-42076

Modified: 
branches/bmesh/blender/release/scripts/startup/bl_ui/properties_render.py
===================================================================
--- branches/bmesh/blender/release/scripts/startup/bl_ui/properties_render.py   
2011-11-22 18:03:33 UTC (rev 42076)
+++ branches/bmesh/blender/release/scripts/startup/bl_ui/properties_render.py   
2011-11-22 18:15:08 UTC (rev 42077)
@@ -456,17 +456,14 @@
         file_format = rd.image_settings.file_format
 
         layout.prop(rd, "filepath", text="")
+        
+        flow = layout.column_flow()
+        flow.prop(rd, "use_overwrite")
+        flow.prop(rd, "use_placeholder")
+        flow.prop(rd, "use_file_extension")
 
-        split = layout.split()
+        layout.template_image_settings(rd.image_settings)
 
-        col = split.column()
-        col.template_image_settings(rd.image_settings)
-
-        col = split.column()
-        col.prop(rd, "use_file_extension")
-        col.prop(rd, "use_overwrite")
-        col.prop(rd, "use_placeholder")
-
         if file_format == 'QUICKTIME_CARBON':
             layout.operator("scene.render_data_set_quicktime_codec")
 

Modified: 
branches/bmesh/blender/release/scripts/startup/bl_ui/space_view3d_toolbar.py
===================================================================
--- 
branches/bmesh/blender/release/scripts/startup/bl_ui/space_view3d_toolbar.py    
    2011-11-22 18:03:33 UTC (rev 42076)
+++ 
branches/bmesh/blender/release/scripts/startup/bl_ui/space_view3d_toolbar.py    
    2011-11-22 18:15:08 UTC (rev 42077)
@@ -88,7 +88,7 @@
         col.operator("object.join")
 
         active_object = context.active_object
-        if active_object and active_object.type == 'MESH':
+        if active_object and active_object.type in {'MESH', 'CURVE', 
'SURFACE'}:
 
             col = layout.column(align=True)
             col.label(text="Shading:")

Modified: branches/bmesh/blender/source/blender/blenkernel/intern/ocean.c
===================================================================
--- branches/bmesh/blender/source/blender/blenkernel/intern/ocean.c     
2011-11-22 18:03:33 UTC (rev 42076)
+++ branches/bmesh/blender/source/blender/blenkernel/intern/ocean.c     
2011-11-22 18:15:08 UTC (rev 42077)
@@ -313,8 +313,8 @@
        float uu,vv;
 
        // first wrap the texture so 0 <= (u,v) < 1
-       u = fmod(u,1.0f);
-       v = fmod(v,1.0f);
+       u = fmodf(u,1.0f);
+       v = fmodf(v,1.0f);
 
        if (u < 0) u += 1.0f;
        if (v < 0) v += 1.0f;
@@ -1021,6 +1021,22 @@
        BKE_makepicstring(string, cachepath, relbase, frame, 
R_IMF_IMTYPE_OPENEXR, 1, TRUE);
 }
 
+/* silly functions but useful to inline when the args do a lot of indirections 
*/
+MINLINE void rgb_to_rgba_unit_alpha(float r_rgba[4], const float rgb[3])
+{
+       r_rgba[0]= rgb[0];
+       r_rgba[1]= rgb[1];
+       r_rgba[2]= rgb[2];
+       r_rgba[3]= 1.0f;
+}
+MINLINE void value_to_rgba_unit_alpha(float r_rgba[4], const float value)
+{
+       r_rgba[0]= value;
+       r_rgba[1]= value;
+       r_rgba[2]= value;
+       r_rgba[3]= 1.0f;
+}
+
 void BKE_free_ocean_cache(struct OceanCache *och)
 {
        int i, f=0;
@@ -1076,9 +1092,7 @@
 
        if (och->ibufs_disp[f]) {
                ibuf_sample(och->ibufs_disp[f], u, v, (1.0f/(float)res_x), 
(1.0f/(float)res_y), result);
-               ocr->disp[0] = result[0];
-               ocr->disp[1] = result[1];
-               ocr->disp[2] = result[2];
+               copy_v3_v3(ocr->disp, result);
        }
 
        if (och->ibufs_foam[f]) {
@@ -1088,34 +1102,31 @@
 
        if (och->ibufs_norm[f]) {
                ibuf_sample(och->ibufs_norm[f], u, v, (1.0f/(float)res_x), 
(1.0f/(float)res_y), result);
-               ocr->normal[0] = result[0];
-               ocr->normal[1] = result[1];
-               ocr->normal[2] = result[2];
+               copy_v3_v3(ocr->normal, result);
        }
 }
 
 void BKE_ocean_cache_eval_ij(struct OceanCache *och, struct OceanResult *ocr, 
int f, int i, int j)
 {
-       int res_x = och->resolution_x;
-       int res_y = och->resolution_y;
+       const int res_x = och->resolution_x;
+       const int res_y = och->resolution_y;
 
-       i = abs(i) % res_x;
-       j = abs(j) % res_y;
+       if (i < 0) i= -i;
+       if (j < 0) j= -j;
 
+       i = i % res_x;
+       j = j % res_y;
+
        if (och->ibufs_disp[f]) {
-               ocr->disp[0] = och->ibufs_disp[f]->rect_float[4*(res_x*j + i) + 
0];
-               ocr->disp[1] = och->ibufs_disp[f]->rect_float[4*(res_x*j + i) + 
1];
-               ocr->disp[2] = och->ibufs_disp[f]->rect_float[4*(res_x*j + i) + 
2];
+               copy_v3_v3(ocr->disp, 
&och->ibufs_disp[f]->rect_float[4*(res_x*j + i)]);
        }
 
        if (och->ibufs_foam[f]) {
-               ocr->foam = och->ibufs_foam[f]->rect_float[4*(res_x*j + i) + 0];
+               ocr->foam = och->ibufs_foam[f]->rect_float[4*(res_x*j + i)];
        }
 
        if (och->ibufs_norm[f]) {
-               ocr->normal[0] = och->ibufs_norm[f]->rect_float[4*(res_x*j + i) 
+ 0];
-               ocr->normal[1] = och->ibufs_norm[f]->rect_float[4*(res_x*j + i) 
+ 1];
-               ocr->normal[2] = och->ibufs_norm[f]->rect_float[4*(res_x*j + i) 
+ 2];
+               copy_v3_v3(ocr->normal, 
&och->ibufs_norm[f]->rect_float[4*(res_x*j + i)]);
        }
 }
 
@@ -1206,10 +1217,8 @@
        /* setup image format */
        imf.imtype= R_IMF_IMTYPE_OPENEXR;
        imf.depth=  R_IMF_CHAN_DEPTH_16;
-       imf.exr_codec= R_IMF_EXR_CODEC_ZIP; /* ZIP */
+       imf.exr_codec= R_IMF_EXR_CODEC_ZIP;
 
-
-
        for (f=och->start, i=0; f<=och->end; f++, i++) {
 
                /* create a new imbuf to store image for this frame */
@@ -1228,10 +1237,7 @@
                                BKE_ocean_eval_ij(o, &ocr, x, y);
 
                                /* add to the image */
-                               ibuf_disp->rect_float[4*(res_x*y + x) + 0] = 
ocr.disp[0];
-                               ibuf_disp->rect_float[4*(res_x*y + x) + 1] = 
ocr.disp[1];
-                               ibuf_disp->rect_float[4*(res_x*y + x) + 2] = 
ocr.disp[2];
-                               ibuf_disp->rect_float[4*(res_x*y + x) + 3] = 
1.0f;
+                               
rgb_to_rgba_unit_alpha(&ibuf_disp->rect_float[4*(res_x*y + x)], ocr.disp);
 
                                if (o->_do_jacobian) {
                                        /* TODO, cleanup unused code - campbell 
*/
@@ -1284,35 +1290,29 @@
 
                                        prev_foam[res_x*y + x] = foam_result;
 

@@ Diff output truncated at 10240 characters. @@
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to