24 PG_RGEN_INTERSECT_CLOSEST,
25 PG_RGEN_INTERSECT_SHADOW,
26 PG_RGEN_INTERSECT_SUBSURFACE,
27 PG_RGEN_INTERSECT_VOLUME_STACK,
28 PG_RGEN_INTERSECT_DEDICATED_LIGHT,
29 PG_RGEN_SHADE_BACKGROUND,
31 PG_RGEN_SHADE_SURFACE,
32 PG_RGEN_SHADE_SURFACE_RAYTRACE,
33 PG_RGEN_SHADE_SURFACE_MNEE,
35 PG_RGEN_SHADE_VOLUME_RAY_MARCHING,
37 PG_RGEN_SHADE_DEDICATED_LIGHT,
38 PG_RGEN_EVAL_DISPLACE,
39 PG_RGEN_EVAL_BACKGROUND,
40 PG_RGEN_EVAL_CURVE_SHADOW_TRANSPARENCY,
41 PG_RGEN_INIT_FROM_CAMERA,
42 PG_RGEN_EVAL_VOLUME_DENSITY,
60 PG_HITD_CURVE_LINEAR_MOTION,
61 PG_HITS_CURVE_LINEAR_MOTION,
62 PG_HITV_CURVE_LINEAR_MOTION,
63 PG_HITL_CURVE_LINEAR_MOTION,
80static const int MISS_PROGRAM_GROUP_OFFSET = PG_MISS;
81static const int NUM_MISS_PROGRAM_GROUPS = 1;
82static const int HIT_PROGAM_GROUP_OFFSET = PG_HITD;
83static const int NUM_HIT_PROGRAM_GROUPS = 24;
84static const int CALLABLE_PROGRAM_GROUPS_BASE = PG_CALL_SVM_AO;
85static const int NUM_CALLABLE_PROGRAM_GROUPS = 2;
88enum { PIP_SHADE, PIP_INTERSECT, NUM_PIPELINES };
92 char header[OPTIX_SBT_RECORD_HEADER_SIZE];
95class OptiXDevice :
public CUDADevice {
97 OptixDeviceContext
context =
nullptr;
99 OptixModule optix_module =
nullptr;
100 OptixModule builtin_modules[4] = {};
101 OptixPipeline pipelines[NUM_PIPELINES] = {};
102 OptixProgramGroup groups[NUM_PROGRAM_GROUPS] = {};
103 OptixPipelineCompileOptions pipeline_options = {};
106 OSLGlobals osl_globals;
107 vector<OptixModule> osl_modules;
108 vector<OptixProgramGroup> osl_groups;
109 OptixModule osl_camera_module =
nullptr;
110 device_vector<uint8_t> osl_colorsystem;
113 device_vector<SbtRecord> sbt_data;
114 device_only_memory<KernelParamsOptiX> launch_params;
117 OptixTraversableHandle tlas_handle = 0;
118 vector<unique_ptr<device_only_memory<char>>> delayed_free_bvh_memory;
122 OptiXDevice(
const DeviceInfo &info, Stats &stats, Profiler &profiler,
bool headless);
123 ~OptiXDevice()
override;
127 string compile_kernel_get_common_cflags(
const uint kernel_features);
129 void create_optix_module(
TaskPool &pool,
130 OptixModuleCompileOptions &module_options,
133 OptixResult &failure_reason);
135 bool load_kernels(
const uint kernel_features)
override;
137 bool load_osl_kernels()
override;
139 bool build_optix_bvh(BVHOptiX *bvh,
140 OptixBuildOperation operation,
141 const OptixBuildInput &build_input,
142 uint16_t num_motion_steps);
146 void release_bvh(
BVH *bvh)
override;
147 void free_bvh_memory_delayed();
149 void const_copy_to(
const char *
name,
void *host,
const size_t size)
override;
151 void update_launch_params(
const size_t offset,
void *
data,
const size_t data_size);
153 unique_ptr<DeviceQueue> gpu_queue_create()
override;
155 OSLGlobals *get_cpu_osl_memory()
override;
BMesh const char void * data
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
void refit(btStridingMeshInterface *triangles, const btVector3 &aabbMin, const btVector3 &aabbMax)
#define CCL_NAMESPACE_END
ccl_device bool BVH_FUNCTION_FULL_NAME BVH(KernelGlobals kg, const ccl_private Ray *ray, ccl_private LocalIntersection *local_isect, const int local_object, ccl_private uint *lcg_state, const int max_hits)
int context(const bContext *C, const char *member, bContextDataResult *result)
static struct PyModuleDef module