[Bf-blender-cvs] [0ae13c65f4f] cycles-x: Cycles X: Cleanup OptiX Curves API flag

Sergey Sharybin noreply at git.blender.org
Thu May 27 16:35:18 CEST 2021


Commit: 0ae13c65f4f3bcd93fd370418b5762a6341901b6
Author: Sergey Sharybin
Date:   Thu May 27 15:39:06 2021 +0200
Branches: cycles-x
https://developer.blender.org/rB0ae13c65f4f3bcd93fd370418b5762a6341901b6

Cycles X: Cleanup OptiX Curves API flag

- Use proper boolean prefix
- Log as a human-readable boolean
- Add description for Python property

===================================================================

M	intern/cycles/blender/addon/properties.py
M	intern/cycles/blender/addon/ui.py
M	intern/cycles/blender/blender_python.cpp
M	intern/cycles/device/optix/device_impl.cpp
M	intern/cycles/util/util_debug.cpp
M	intern/cycles/util/util_debug.h

===================================================================

diff --git a/intern/cycles/blender/addon/properties.py b/intern/cycles/blender/addon/properties.py
index b8c99952066..3efb4bea106 100644
--- a/intern/cycles/blender/addon/properties.py
+++ b/intern/cycles/blender/addon/properties.py
@@ -698,7 +698,11 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
 
     debug_use_cuda_adaptive_compile: BoolProperty(name="Adaptive Compile", default=False)
 
-    debug_optix_curves_api: BoolProperty(name="Native OptiX Curve Primitive", default=False)
+    debug_use_optix_curves_api: BoolProperty(
+        name="Native OptiX Curve Primitive",
+        description="Use OptiX curves API for hair instead of custom implementation",
+        default=False
+    )
     debug_use_optix_debug: BoolProperty(
         name="OptiX Module Debug",
         description="Load OptiX module in debug mode: lower logging verbosity level, enable validations, and lower optimization level",
diff --git a/intern/cycles/blender/addon/ui.py b/intern/cycles/blender/addon/ui.py
index 7a729e49167..307445a722d 100644
--- a/intern/cycles/blender/addon/ui.py
+++ b/intern/cycles/blender/addon/ui.py
@@ -1820,7 +1820,7 @@ class CYCLES_RENDER_PT_debug(CyclesDebugButtonsPanel, Panel):
 
         col = layout.column()
         col.label(text="OptiX Flags:")
-        col.prop(cscene, "debug_optix_curves_api")
+        col.prop(cscene, "debug_use_optix_curves_api")
         col.prop(cscene, "debug_use_optix_debug")
 
         col.separator()
diff --git a/intern/cycles/blender/blender_python.cpp b/intern/cycles/blender/blender_python.cpp
index 0301881607b..aaa7c413d05 100644
--- a/intern/cycles/blender/blender_python.cpp
+++ b/intern/cycles/blender/blender_python.cpp
@@ -90,7 +90,7 @@ bool debug_flags_sync_from_scene(BL::Scene b_scene)
   /* Synchronize CUDA flags. */
   flags.cuda.adaptive_compile = get_boolean(cscene, "debug_use_cuda_adaptive_compile");
   /* Synchronize OptiX flags. */
-  flags.optix.curves_api = get_boolean(cscene, "debug_optix_curves_api");
+  flags.optix.use_curves_api = get_boolean(cscene, "debug_use_optix_curves_api");
   flags.optix.use_debug = get_boolean(cscene, "debug_use_optix_debug");
   /* Synchronize OpenCL device type. */
   switch (get_enum(cscene, "debug_opencl_device_type")) {
diff --git a/intern/cycles/device/optix/device_impl.cpp b/intern/cycles/device/optix/device_impl.cpp
index 8e81a7133ab..03bed23423c 100644
--- a/intern/cycles/device/optix/device_impl.cpp
+++ b/intern/cycles/device/optix/device_impl.cpp
@@ -247,7 +247,7 @@ bool OptiXDevice::load_kernels(const DeviceRequestedFeatures &requested_features
 #  if OPTIX_ABI_VERSION >= 36
   pipeline_options.usesPrimitiveTypeFlags = OPTIX_PRIMITIVE_TYPE_FLAGS_TRIANGLE;
   if (requested_features.use_hair) {
-    if (DebugFlags().optix.curves_api && requested_features.use_hair_thick) {
+    if (DebugFlags().optix.use_curves_api && requested_features.use_hair_thick) {
       pipeline_options.usesPrimitiveTypeFlags |= OPTIX_PRIMITIVE_TYPE_FLAGS_ROUND_CUBIC_BSPLINE;
     }
     else {
@@ -347,7 +347,7 @@ bool OptiXDevice::load_kernels(const DeviceRequestedFeatures &requested_features
     }
 
 #  if OPTIX_ABI_VERSION >= 36
-    if (DebugFlags().optix.curves_api && requested_features.use_hair_thick) {
+    if (DebugFlags().optix.use_curves_api && requested_features.use_hair_thick) {
       OptixBuiltinISOptions builtin_options = {};
       builtin_options.builtinISModuleType = OPTIX_PRIMITIVE_TYPE_ROUND_CUBIC_BSPLINE;
       builtin_options.usesMotionBlur = false;
@@ -939,7 +939,7 @@ void OptiXDevice::build_bvh(BVH *bvh, Progress &progress, bool refit)
       device_vector<float4> vertex_data(this, "optix temp vertex data", MEM_READ_ONLY);
       /* Four control points for each curve segment. */
       const size_t num_vertices = num_segments * 4;
-      if (DebugFlags().optix.curves_api && hair->curve_shape == CURVE_THICK) {
+      if (DebugFlags().optix.use_curves_api && hair->curve_shape == CURVE_THICK) {
         index_data.alloc(num_segments);
         vertex_data.alloc(num_vertices * num_motion_steps);
       }
@@ -966,7 +966,7 @@ void OptiXDevice::build_bvh(BVH *bvh, Progress &progress, bool refit)
 
           for (int segment = 0; segment < curve.num_segments(); ++segment, ++i) {
 #  if OPTIX_ABI_VERSION >= 36
-            if (DebugFlags().optix.curves_api && hair->curve_shape == CURVE_THICK) {
+            if (DebugFlags().optix.use_curves_api && hair->curve_shape == CURVE_THICK) {
               int k0 = curve.first_key + segment;
               int k1 = k0 + 1;
               int ka = max(k0 - 1, curve.first_key);
@@ -1042,7 +1042,7 @@ void OptiXDevice::build_bvh(BVH *bvh, Progress &progress, bool refit)
       unsigned int build_flags = OPTIX_GEOMETRY_FLAG_REQUIRE_SINGLE_ANYHIT_CALL;
       OptixBuildInput build_input = {};
 #  if OPTIX_ABI_VERSION >= 36
-      if (DebugFlags().optix.curves_api && hair->curve_shape == CURVE_THICK) {
+      if (DebugFlags().optix.use_curves_api && hair->curve_shape == CURVE_THICK) {
         build_input.type = OPTIX_BUILD_INPUT_TYPE_CURVES;
         build_input.curveArray.curveType = OPTIX_PRIMITIVE_TYPE_ROUND_CUBIC_BSPLINE;
         build_input.curveArray.numPrimitives = num_segments;
@@ -1246,7 +1246,7 @@ void OptiXDevice::build_bvh(BVH *bvh, Progress &progress, bool refit)
 
 #  if OPTIX_ABI_VERSION >= 36
         if (motion_blur && ob->get_geometry()->has_motion_blur() &&
-            DebugFlags().optix.curves_api &&
+            DebugFlags().optix.use_curves_api &&
             static_cast<const Hair *>(ob->get_geometry())->curve_shape == CURVE_THICK) {
           /* Select between motion blur and non-motion blur built-in intersection module. */
           instance.sbtOffset = PG_HITD_MOTION - PG_HITD;
diff --git a/intern/cycles/util/util_debug.cpp b/intern/cycles/util/util_debug.cpp
index e07a10600c3..a3dd2d1b610 100644
--- a/intern/cycles/util/util_debug.cpp
+++ b/intern/cycles/util/util_debug.cpp
@@ -72,7 +72,7 @@ DebugFlags::OptiX::OptiX()
 
 void DebugFlags::OptiX::reset()
 {
-  curves_api = false;
+  use_curves_api = false;
   use_debug = false;
 }
 
@@ -138,7 +138,7 @@ std::ostream &operator<<(std::ostream &os, DebugFlagsConstRef debug_flags)
      << "  Adaptive Compile : " << string_from_bool(debug_flags.cuda.adaptive_compile) << "\n";
 
   os << "OptiX flags:\n"
-     << "  Curves API : " << debug_flags.optix.curves_api << "\n"
+     << "  Curves API : " << string_from_bool(debug_flags.optix.use_curves_api) << "\n"
      << "  Debug : " << string_from_bool(debug_flags.optix.use_debug) << "\n";
 
   const char *opencl_device_type;
diff --git a/intern/cycles/util/util_debug.h b/intern/cycles/util/util_debug.h
index 135d45967a3..e6e76706029 100644
--- a/intern/cycles/util/util_debug.h
+++ b/intern/cycles/util/util_debug.h
@@ -101,7 +101,7 @@ class DebugFlags {
     void reset();
 
     /* Use OptiX curves API for hair instead of custom implementation. */
-    bool curves_api;
+    bool use_curves_api;
 
     /* Load OptiX module with debug capabilities. Will lower logging verbosity level, enable
      * validations, and lower optimization level. */



More information about the Bf-blender-cvs mailing list