Merge branch 'master' into blender2.8
authorCampbell Barton <ideasman42@gmail.com>
Mon, 5 Feb 2018 06:58:31 +0000 (17:58 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 5 Feb 2018 06:58:31 +0000 (17:58 +1100)
intern/cycles/app/cycles_cubin_cc.cpp
intern/cycles/kernel/kernel_compat_cuda.h
source/blender/blenkernel/BKE_paint.h
source/blender/editors/util/ed_util.c

index c1f3974be6dfd1ee24829ce44710acb907e8391f..73d0cd5130c0e84b833736859dca7ce7edd40161 100644 (file)
 using std::string;
 using std::vector;
 
+namespace std {
+       template<typename T>
+       std::string to_string(const T &n) {
+               std::ostringstream s;
+               s << n;
+               return s.str();
+       }
+}
+
 class CompilationSettings
 {
 public:
@@ -75,7 +84,7 @@ bool compile_cuda(CompilationSettings &settings)
        for(size_t i = 0; i < settings.defines.size(); i++) {
                options.push_back("-D" + settings.defines[i]);
        }
-
+       options.push_back("-D__KERNEL_CUDA_VERSION__=" + std::to_string(cuewNvrtcVersion()));
        options.push_back("-arch=compute_" + std::to_string(settings.target_arch));
        options.push_back("--device-as-default-execution-space");
        if(settings.fast_math)
@@ -150,9 +159,12 @@ bool link_ptxas(CompilationSettings &settings)
                                        " --gpu-name sm_" + std::to_string(settings.target_arch) +
                                        " -m" + std::to_string(settings.bits);
 
-       if(settings.verbose)
+       if (settings.verbose)
+       {
                ptx += " --verbose";
-
+               printf(ptx.c_str());
+       }
+       
        int pxresult = system(ptx.c_str());
        if(pxresult) {
                fprintf(stderr, "Error: ptxas failed (%x)\n\n", pxresult);
index 7b66bdc169e3d2ea282d66213875d9c73bf09387..900f7fe6a2c991fc7af6abe418004b19b3c76cd4 100644 (file)
@@ -37,8 +37,8 @@ typedef unsigned long long uint64_t;
 typedef unsigned short half;
 typedef unsigned long long CUtexObject;
 
-#define FLT_MAX 1.175494350822287507969e-38f
-#define FLT_MIN 340282346638528859811704183484516925440.0f
+#define FLT_MIN 1.175494350822287507969e-38f
+#define FLT_MAX 340282346638528859811704183484516925440.0f
 
 __device__ half __float2half(const float f)
 {
index 0d55b65fe659afcea01e34c5547adcb384190d53..7fd08ba541fe089c21d27a6dc8c8af0ab3eb50da 100644 (file)
@@ -214,7 +214,6 @@ typedef struct SculptSession {
        /* Layer brush persistence between strokes */
        float (*layer_co)[3]; /* Copy of the mesh vertices' locations */
 
-       struct SculptStroke *stroke;
        struct StrokeCache *cache;
 
        union {
index b52cc20f71f1d0ca92c554fbe7fa20e9f371de1e..8973c96c438564b9a5cb5297a28240c49cf5a95c 100644 (file)
@@ -175,18 +175,22 @@ bool ED_editors_flush_edits(const bContext *C, bool for_render)
         * objects can exist at the same time */
        for (ob = bmain->object.first; ob; ob = ob->id.next) {
                if (ob->mode & OB_MODE_SCULPT) {
-                       /* flush multires changes (for sculpt) */
-                       multires_force_update(ob);
-                       has_edited = true;
-
-                       if (for_render) {
-                               /* flush changes from dynamic topology sculpt */
-                               BKE_sculptsession_bm_to_me_for_render(ob);
-                       }
-                       else {
-                               /* Set reorder=false so that saving the file doesn't reorder
-                                * the BMesh's elements */
-                               BKE_sculptsession_bm_to_me(ob, false);
+                       /* Don't allow flushing while in the middle of a stroke (frees data in use).
+                        * Auto-save prevents this from happening but scripts may cause a flush on saving: T53986. */
+                       if ((ob->sculpt && ob->sculpt->cache) == 0) {
+                               /* flush multires changes (for sculpt) */
+                               multires_force_update(ob);
+                               has_edited = true;
+
+                               if (for_render) {
+                                       /* flush changes from dynamic topology sculpt */
+                                       BKE_sculptsession_bm_to_me_for_render(ob);
+                               }
+                               else {
+                                       /* Set reorder=false so that saving the file doesn't reorder
+                                        * the BMesh's elements */
+                                       BKE_sculptsession_bm_to_me(ob, false);
+                               }
                        }
                }
                else if (ob->mode & OB_MODE_EDIT) {