Cleanup: Cycles: Query OptiX hardware ray-tracing state from device

Commit 976ca9d244 fixed the "Hardware
Ray-Tracing" state message being printed to the log always showing off
for OptiX. This improves that further by querying whether the device
actually supports it, since OptiX has a software fallback on devices
without hardware ray tracing support.

Pull Request: https://projects.blender.org/blender/blender/pulls/163807
This commit is contained in:
Patrick Mours 2026-09-14 15:50:17 +02:00 • committed by Patrick Mours
parent f0551e8010
commit f97ee31df7
2 changed files with 8 additions and 5 deletions

View file

@ -92,6 +92,11 @@ OptiXDevice::OptiXDevice(const DeviceInfo &info, Stats &stats, Profiler &profile
optix_assert(optixDeviceContextSetLogCallback(
context, options.logCallbackFunction, options.logCallbackData, options.logCallbackLevel));
unsigned int rtcore_version = 0;
optix_assert(optixDeviceContextGetProperty(
context, OPTIX_DEVICE_PROPERTY_RTCORE_VERSION, &rtcore_version, sizeof(rtcore_version)));
this->info.use_hardware_raytracing = rtcore_version > 0;
/* Fix weird compiler bug that assigns wrong size. */
launch_params.data_elements = sizeof(KernelParamsOptiX);
@ -273,7 +278,6 @@ bool OptiXDevice::load_kernels(const uint64_t kernel_features)
# else
const bool use_osl_shading = false;
const bool use_osl_camera = false;
const bool use_osl_volume = false;
# endif
const bool use_shader_raytrace = (kernel_features & KERNEL_FEATURE_NODE_RAYTRACE);
const bool use_mnee = (kernel_features & KERNEL_FEATURE_MNEE);
@ -859,16 +863,16 @@ bool OptiXDevice::load_kernels(const uint64_t kernel_features)
if (use_osl_shading || use_osl_camera) {
/* OSL kernels will be (re)created on by OSL manager. */
}
else if (kernel_features & (KERNEL_FEATURE_NODE_RAYTRACE | KERNEL_FEATURE_MNEE)) {
else if (use_shader_raytrace || use_mnee) {
/* Create shader ray-tracing and MNEE pipeline. */
vector<OptixProgramGroup> pipeline_groups;
pipeline_groups.reserve(NUM_PROGRAM_GROUPS);
if (kernel_features & KERNEL_FEATURE_NODE_RAYTRACE) {
if (use_shader_raytrace) {
pipeline_groups.push_back(groups[PG_RGEN_SHADE_SURFACE_RAYTRACE]);
pipeline_groups.push_back(groups[PG_CALL_SVM_AO]);
pipeline_groups.push_back(groups[PG_CALL_SVM_BEVEL]);
}
if (kernel_features & KERNEL_FEATURE_MNEE) {
if (use_mnee) {
pipeline_groups.push_back(groups[PG_RGEN_INTERSECT_MNEE]);
}
add_hit_miss_program_groups(groups, pipeline_groups);

View file

@ -351,7 +351,6 @@ extern "C" __global__ void __intersection__curve_ribbon()
optix_intersection_curve(prim, type);
}
}
#endif
#ifdef __POINTCLOUD__