[Bf-blender-cvs] [45cfa58ee82] cycles-x: Enable built-in OptiX curves by default
Patrick Mours
noreply at git.blender.org
Thu Jun 24 13:27:14 CEST 2021
Commit: 45cfa58ee82a3ccdeaa5d07cb69e0f672b356e08
Author: Patrick Mours
Date: Thu Jun 24 12:53:43 2021 +0200
Branches: cycles-x
https://developer.blender.org/rB45cfa58ee82a3ccdeaa5d07cb69e0f672b356e08
Enable built-in OptiX curves by default
Starting with OptiX 7.3 curves now behave as expected with Cycles and render the same as the
custom intersection implementation, so enable by default.
===================================================================
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 6afce0829f8..4997e9e4381 100644
--- a/intern/cycles/blender/addon/properties.py
+++ b/intern/cycles/blender/addon/properties.py
@@ -708,11 +708,6 @@ class CyclesRenderSettings(bpy.types.PropertyGroup):
debug_use_cuda_adaptive_compile: BoolProperty(name="Adaptive Compile", 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 4d6418ed84a..8ab8e051ec0 100644
--- a/intern/cycles/blender/addon/ui.py
+++ b/intern/cycles/blender/addon/ui.py
@@ -1779,7 +1779,6 @@ class CYCLES_RENDER_PT_debug(CyclesDebugButtonsPanel, Panel):
col = layout.column()
col.label(text="OptiX Flags:")
- 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 fbb6c07bfb6..59826fa3e85 100644
--- a/intern/cycles/blender/blender_python.cpp
+++ b/intern/cycles/blender/blender_python.cpp
@@ -90,7 +90,6 @@ 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.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 2d2b596b95b..44f7964304d 100644
--- a/intern/cycles/device/optix/device_impl.cpp
+++ b/intern/cycles/device/optix/device_impl.cpp
@@ -232,12 +232,13 @@ 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.use_curves_api && requested_features.use_hair_thick) {
+# if OPTIX_ABI_VERSION >= 47
+ if (requested_features.use_hair_thick) {
pipeline_options.usesPrimitiveTypeFlags |= OPTIX_PRIMITIVE_TYPE_FLAGS_ROUND_CUBIC_BSPLINE;
}
- else {
+ else
+# endif
pipeline_options.usesPrimitiveTypeFlags |= OPTIX_PRIMITIVE_TYPE_FLAGS_CUSTOM;
- }
}
# endif
@@ -337,8 +338,8 @@ bool OptiXDevice::load_kernels(const DeviceRequestedFeatures &requested_features
group_descs[PG_HITS].hitgroup.entryFunctionNameIS = "__intersection__curve_ribbon";
}
-# if OPTIX_ABI_VERSION >= 36
- if (DebugFlags().optix.use_curves_api && requested_features.use_hair_thick) {
+# if OPTIX_ABI_VERSION >= 47
+ if (requested_features.use_hair_thick) {
OptixBuiltinISOptions builtin_options = {};
builtin_options.builtinISModuleType = OPTIX_PRIMITIVE_TYPE_ROUND_CUBIC_BSPLINE;
builtin_options.usesMotionBlur = false;
@@ -409,7 +410,7 @@ bool OptiXDevice::load_kernels(const DeviceRequestedFeatures &requested_features
trace_css = std::max(trace_css, stack_size[PG_HITD].cssIS + stack_size[PG_HITD].cssAH);
trace_css = std::max(trace_css, stack_size[PG_HITS].cssIS + stack_size[PG_HITS].cssAH);
trace_css = std::max(trace_css, stack_size[PG_HITL].cssIS + stack_size[PG_HITL].cssAH);
-# if OPTIX_ABI_VERSION >= 36
+# if OPTIX_ABI_VERSION >= 47
trace_css = std::max(trace_css,
stack_size[PG_HITD_MOTION].cssIS + stack_size[PG_HITD_MOTION].cssAH);
trace_css = std::max(trace_css,
@@ -439,7 +440,7 @@ bool OptiXDevice::load_kernels(const DeviceRequestedFeatures &requested_features
pipeline_groups.push_back(groups[PG_HITD]);
pipeline_groups.push_back(groups[PG_HITS]);
pipeline_groups.push_back(groups[PG_HITL]);
-# if OPTIX_ABI_VERSION >= 36
+# if OPTIX_ABI_VERSION >= 47
if (motion_blur) {
pipeline_groups.push_back(groups[PG_HITD_MOTION]);
pipeline_groups.push_back(groups[PG_HITS_MOTION]);
@@ -478,7 +479,7 @@ bool OptiXDevice::load_kernels(const DeviceRequestedFeatures &requested_features
pipeline_groups.push_back(groups[PG_HITD]);
pipeline_groups.push_back(groups[PG_HITS]);
pipeline_groups.push_back(groups[PG_HITL]);
-# if OPTIX_ABI_VERSION >= 36
+# if OPTIX_ABI_VERSION >= 47
if (motion_blur) {
pipeline_groups.push_back(groups[PG_HITD_MOTION]);
pipeline_groups.push_back(groups[PG_HITS_MOTION]);
@@ -1048,12 +1049,12 @@ void OptiXDevice::build_bvh(BVH *bvh, Progress &progress, bool refit)
}
device_vector<OptixAabb> aabb_data(this, "optix temp aabb data", MEM_READ_ONLY);
-# if OPTIX_ABI_VERSION >= 36
+# if OPTIX_ABI_VERSION >= 47
device_vector<int> index_data(this, "optix temp index data", MEM_READ_ONLY);
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.use_curves_api && hair->curve_shape == CURVE_THICK) {
+ if (hair->curve_shape == CURVE_THICK) {
index_data.alloc(num_segments);
vertex_data.alloc(num_vertices * num_motion_steps);
}
@@ -1074,13 +1075,13 @@ void OptiXDevice::build_bvh(BVH *bvh, Progress &progress, bool refit)
for (size_t j = 0, i = 0; j < hair->num_curves(); ++j) {
const Hair::Curve curve = hair->get_curve(j);
-# if OPTIX_ABI_VERSION >= 36
+# if OPTIX_ABI_VERSION >= 47
const array<float> &curve_radius = hair->get_curve_radius();
# endif
for (int segment = 0; segment < curve.num_segments(); ++segment, ++i) {
-# if OPTIX_ABI_VERSION >= 36
- if (DebugFlags().optix.use_curves_api && hair->curve_shape == CURVE_THICK) {
+# if OPTIX_ABI_VERSION >= 47
+ if (hair->curve_shape == CURVE_THICK) {
int k0 = curve.first_key + segment;
int k1 = k0 + 1;
int ka = max(k0 - 1, curve.first_key);
@@ -1129,14 +1130,14 @@ void OptiXDevice::build_bvh(BVH *bvh, Progress &progress, bool refit)
/* Upload AABB data to GPU. */
aabb_data.copy_to_device();
-# if OPTIX_ABI_VERSION >= 36
+# if OPTIX_ABI_VERSION >= 47
index_data.copy_to_device();
vertex_data.copy_to_device();
# endif
vector<device_ptr> aabb_ptrs;
aabb_ptrs.reserve(num_motion_steps);
-# if OPTIX_ABI_VERSION >= 36
+# if OPTIX_ABI_VERSION >= 47
vector<device_ptr> width_ptrs;
vector<device_ptr> vertex_ptrs;
width_ptrs.reserve(num_motion_steps);
@@ -1144,7 +1145,7 @@ void OptiXDevice::build_bvh(BVH *bvh, Progress &progress, bool refit)
# endif
for (size_t step = 0; step < num_motion_steps; ++step) {
aabb_ptrs.push_back(aabb_data.device_pointer + step * num_segments * sizeof(OptixAabb));
-# if OPTIX_ABI_VERSION >= 36
+# if OPTIX_ABI_VERSION >= 47
const device_ptr base_ptr = vertex_data.device_pointer +
step * num_vertices * sizeof(float4);
width_ptrs.push_back(base_ptr + 3 * sizeof(float)); /* Offset by vertex size. */
@@ -1155,8 +1156,8 @@ void OptiXDevice::build_bvh(BVH *bvh, Progress &progress, bool refit)
/* Force a single any-hit call, so shadow record-all behavior works correctly. */
unsigned int build_flags = OPTIX_GEOMETRY_FLAG_REQUIRE_SINGLE_ANYHIT_CALL;
OptixBuildInput build_input = {};
-# if OPTIX_ABI_VERSION >= 36
- if (DebugFlags().optix.use_curves_api && hair->curve_shape == CURVE_THICK) {
+# if OPTIX_ABI_VERSION >= 47
+ if (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;
@@ -1358,9 +1359,8 @@ void OptiXDevice::build_bvh(BVH *bvh, Progress &progress, bool refit)
/* Same applies to curves (so they can be skipped in local trace calls). */
instance.visibilityMask |= 4;
-# if OPTIX_ABI_VERSION >= 36
+# if OPTIX_ABI_VERSION >= 47
if (motion_blur && ob->get_geometry()->has_motion_blur() &&
- 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 a3dd2d1b610..179e19c2916 100644
--- a/intern/cycles/util/util_debug.cpp
+++ b/intern/cycles/util/util_debug.cpp
@@ -72,7 +72,6 @@ DebugFlags::OptiX::OptiX()
void DebugFlags::OptiX::reset()
{
- use_curves_api = false;
use_debug = false;
}
@@ -138,7 +137,6 @@ 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 : " << 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 e6e76706029..f3b2f985734 100644
--- a/intern/cycles/util/util_debug.h
+++ b/intern/cycles/util/util_debug.h
@@ -100,9 +100,6 @@ class DebugFlags {
/* Reset flags to their defaults. */
void reset();
- /* Use OptiX curves API for hair instead of custom implementation. */
- bool use_curves_api;
-
/* Load Opti
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list