Changeset View
Changeset View
Standalone View
Standalone View
src/device/device_optix.cpp
| Context not available. | |||||
| # include "device/cuda/device_cuda.h" | # include "device/cuda/device_cuda.h" | ||||
| # include "device/device_denoising.h" | # include "device/device_denoising.h" | ||||
| # include "device/device_intern.h" | # include "device/device_intern.h" | ||||
| # include "device/device_debug.h" | |||||
| # include "render/buffers.h" | # include "render/buffers.h" | ||||
| # include "render/hair.h" | # include "render/hair.h" | ||||
| # include "render/mesh.h" | # include "render/mesh.h" | ||||
| # include "render/object.h" | # include "render/object.h" | ||||
| # include "render/scene.h" | # include "render/scene.h" | ||||
| # include "util/util_debug.h" | |||||
| # include "util/util_logging.h" | # include "util/util_logging.h" | ||||
| # include "util/util_md5.h" | # include "util/util_md5.h" | ||||
| # include "util/util_path.h" | # include "util/util_path.h" | ||||
| Context not available. | |||||
| denoiser_state(this, "__denoiser_state") | denoiser_state(this, "__denoiser_state") | ||||
| { | { | ||||
| // Store number of CUDA streams in device info | // Store number of CUDA streams in device info | ||||
| info.cpu_threads = DebugFlags().optix.cuda_streams; | info.cpu_threads = DeviceDebugFlags().optix.cuda_streams; | ||||
| // Make the CUDA context current | // Make the CUDA context current | ||||
| if (!cuContext) { | if (!cuContext) { | ||||
| Context not available. | |||||
| # if OPTIX_ABI_VERSION >= 36 | # if OPTIX_ABI_VERSION >= 36 | ||||
| pipeline_options.usesPrimitiveTypeFlags = OPTIX_PRIMITIVE_TYPE_FLAGS_TRIANGLE; | pipeline_options.usesPrimitiveTypeFlags = OPTIX_PRIMITIVE_TYPE_FLAGS_TRIANGLE; | ||||
| if (requested_features.use_hair) { | if (requested_features.use_hair) { | ||||
| if (DebugFlags().optix.curves_api && requested_features.use_hair_thick) { | if (DeviceDebugFlags().optix.curves_api && requested_features.use_hair_thick) { | ||||
| pipeline_options.usesPrimitiveTypeFlags |= OPTIX_PRIMITIVE_TYPE_FLAGS_ROUND_CUBIC_BSPLINE; | pipeline_options.usesPrimitiveTypeFlags |= OPTIX_PRIMITIVE_TYPE_FLAGS_ROUND_CUBIC_BSPLINE; | ||||
| } | } | ||||
| else { | else { | ||||
| Context not available. | |||||
| } | } | ||||
| # if OPTIX_ABI_VERSION >= 36 | # if OPTIX_ABI_VERSION >= 36 | ||||
| if (DebugFlags().optix.curves_api && requested_features.use_hair_thick) { | if (DeviceDebugFlags().optix.curves_api && requested_features.use_hair_thick) { | ||||
| OptixBuiltinISOptions builtin_options; | OptixBuiltinISOptions builtin_options; | ||||
| builtin_options.builtinISModuleType = OPTIX_PRIMITIVE_TYPE_ROUND_CUBIC_BSPLINE; | builtin_options.builtinISModuleType = OPTIX_PRIMITIVE_TYPE_ROUND_CUBIC_BSPLINE; | ||||
| builtin_options.usesMotionBlur = false; | builtin_options.usesMotionBlur = false; | ||||
| Context not available. | |||||
| device_vector<float4> vertex_data(this, "temp_vertex_data", MEM_READ_ONLY); | device_vector<float4> vertex_data(this, "temp_vertex_data", MEM_READ_ONLY); | ||||
| // Four control points for each curve segment | // Four control points for each curve segment | ||||
| const size_t num_vertices = num_segments * 4; | const size_t num_vertices = num_segments * 4; | ||||
| if (DebugFlags().optix.curves_api && hair->curve_shape == CURVE_THICK) { | if (DeviceDebugFlags().optix.curves_api && hair->curve_shape == CURVE_THICK) { | ||||
| index_data.alloc(num_segments); | index_data.alloc(num_segments); | ||||
| vertex_data.alloc(num_vertices * num_motion_steps); | vertex_data.alloc(num_vertices * num_motion_steps); | ||||
| } | } | ||||
| Context not available. | |||||
| for (int segment = 0; segment < curve.num_segments(); ++segment, ++i) { | for (int segment = 0; segment < curve.num_segments(); ++segment, ++i) { | ||||
| # if OPTIX_ABI_VERSION >= 36 | # if OPTIX_ABI_VERSION >= 36 | ||||
| if (DebugFlags().optix.curves_api && hair->curve_shape == CURVE_THICK) { | if (DeviceDebugFlags().optix.curves_api && hair->curve_shape == CURVE_THICK) { | ||||
| int k0 = curve.first_key + segment; | int k0 = curve.first_key + segment; | ||||
| int k1 = k0 + 1; | int k1 = k0 + 1; | ||||
| int ka = max(k0 - 1, curve.first_key); | int ka = max(k0 - 1, curve.first_key); | ||||
| Context not available. | |||||
| unsigned int build_flags = OPTIX_GEOMETRY_FLAG_REQUIRE_SINGLE_ANYHIT_CALL; | unsigned int build_flags = OPTIX_GEOMETRY_FLAG_REQUIRE_SINGLE_ANYHIT_CALL; | ||||
| OptixBuildInput build_input = {}; | OptixBuildInput build_input = {}; | ||||
| # if OPTIX_ABI_VERSION >= 36 | # if OPTIX_ABI_VERSION >= 36 | ||||
| if (DebugFlags().optix.curves_api && hair->curve_shape == CURVE_THICK) { | if (DeviceDebugFlags().optix.curves_api && hair->curve_shape == CURVE_THICK) { | ||||
| build_input.type = OPTIX_BUILD_INPUT_TYPE_CURVES; | build_input.type = OPTIX_BUILD_INPUT_TYPE_CURVES; | ||||
| build_input.curveArray.curveType = OPTIX_PRIMITIVE_TYPE_ROUND_CUBIC_BSPLINE; | build_input.curveArray.curveType = OPTIX_PRIMITIVE_TYPE_ROUND_CUBIC_BSPLINE; | ||||
| build_input.curveArray.numPrimitives = num_segments; | build_input.curveArray.numPrimitives = num_segments; | ||||
| Context not available. | |||||
| instance.visibilityMask |= 4; | instance.visibilityMask |= 4; | ||||
| # if OPTIX_ABI_VERSION >= 36 | # if OPTIX_ABI_VERSION >= 36 | ||||
| if (motion_blur && ob->geometry->has_motion_blur() && DebugFlags().optix.curves_api && | if (motion_blur && ob->geometry->has_motion_blur() && DeviceDebugFlags().optix.curves_api && | ||||
| static_cast<const Hair *>(ob->geometry)->curve_shape == CURVE_THICK) { | static_cast<const Hair *>(ob->geometry)->curve_shape == CURVE_THICK) { | ||||
| // Select between motion blur and non-motion blur built-in intersection module | // Select between motion blur and non-motion blur built-in intersection module | ||||
| instance.sbtOffset = PG_HITD_MOTION - PG_HITD; | instance.sbtOffset = PG_HITD_MOTION - PG_HITD; | ||||
| Context not available. | |||||