Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/bvh/bvh.h
| Show First 20 Lines • Show All 161 Lines • ▼ Show 20 Lines | |||||
| #ifdef __KERNEL_OPTIX__ | #ifdef __KERNEL_OPTIX__ | ||||
| uint p0 = 0; | uint p0 = 0; | ||||
| uint p1 = 0; | uint p1 = 0; | ||||
| uint p2 = 0; | uint p2 = 0; | ||||
| uint p3 = 0; | uint p3 = 0; | ||||
| uint p4 = visibility; | uint p4 = visibility; | ||||
| uint p5 = PRIMITIVE_NONE; | uint p5 = PRIMITIVE_NONE; | ||||
| uint ray_mask = visibility & 0xFF; | |||||
| uint ray_flags = OPTIX_RAY_FLAG_NONE; | |||||
| if (0 == ray_mask && (visibility & ~0xFF) != 0) { | |||||
| ray_mask = 0xFF; | |||||
| ray_flags = OPTIX_RAY_FLAG_ENFORCE_ANYHIT; | |||||
| } | |||||
| else if (visibility & PATH_RAY_SHADOW_OPAQUE) { | |||||
| ray_flags = OPTIX_RAY_FLAG_TERMINATE_ON_FIRST_HIT; | |||||
| } | |||||
| optixTrace(scene_intersect_valid(ray) ? kernel_data.bvh.scene : 0, | optixTrace(scene_intersect_valid(ray) ? kernel_data.bvh.scene : 0, | ||||
| ray->P, | ray->P, | ||||
| ray->D, | ray->D, | ||||
| 0.0f, | 0.0f, | ||||
| ray->t, | ray->t, | ||||
| ray->time, | ray->time, | ||||
| 0xF, | ray_mask, | ||||
| OPTIX_RAY_FLAG_NONE, | ray_flags, | ||||
| 0, // SBT offset for PG_HITD | 0, /* SBT offset for PG_HITD */ | ||||
| 0, | 0, | ||||
| 0, | 0, | ||||
| p0, | p0, | ||||
| p1, | p1, | ||||
| p2, | p2, | ||||
| p3, | p3, | ||||
| p4, | p4, | ||||
| p5); | p5); | ||||
| ▲ Show 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | ccl_device_intersect bool scene_intersect_local(const KernelGlobals *kg, | ||||
| int max_hits) | int max_hits) | ||||
| { | { | ||||
| # ifdef __KERNEL_OPTIX__ | # ifdef __KERNEL_OPTIX__ | ||||
| uint p0 = ((uint64_t)lcg_state) & 0xFFFFFFFF; | uint p0 = ((uint64_t)lcg_state) & 0xFFFFFFFF; | ||||
| uint p1 = (((uint64_t)lcg_state) >> 32) & 0xFFFFFFFF; | uint p1 = (((uint64_t)lcg_state) >> 32) & 0xFFFFFFFF; | ||||
| uint p2 = ((uint64_t)local_isect) & 0xFFFFFFFF; | uint p2 = ((uint64_t)local_isect) & 0xFFFFFFFF; | ||||
| uint p3 = (((uint64_t)local_isect) >> 32) & 0xFFFFFFFF; | uint p3 = (((uint64_t)local_isect) >> 32) & 0xFFFFFFFF; | ||||
| uint p4 = local_object; | uint p4 = local_object; | ||||
| // Is set to zero on miss or if ray is aborted, so can be used as return value | /* Is set to zero on miss or if ray is aborted, so can be used as return value. */ | ||||
| uint p5 = max_hits; | uint p5 = max_hits; | ||||
| if (local_isect) { | if (local_isect) { | ||||
| local_isect->num_hits = 0; // Initialize hit count to zero | local_isect->num_hits = 0; /* Initialize hit count to zero. */ | ||||
| } | } | ||||
| optixTrace(scene_intersect_valid(ray) ? kernel_data.bvh.scene : 0, | optixTrace(scene_intersect_valid(ray) ? kernel_data.bvh.scene : 0, | ||||
| ray->P, | ray->P, | ||||
| ray->D, | ray->D, | ||||
| 0.0f, | 0.0f, | ||||
| ray->t, | ray->t, | ||||
| ray->time, | ray->time, | ||||
| // Skip curves | 0xFF, | ||||
| 0x3, | /* Need to always call into __anyhit__kernel_optix_local_hit. */ | ||||
| // Need to always call into __anyhit__kernel_optix_local_hit | |||||
| OPTIX_RAY_FLAG_ENFORCE_ANYHIT, | OPTIX_RAY_FLAG_ENFORCE_ANYHIT, | ||||
| 2, // SBT offset for PG_HITL | 2, /* SBT offset for PG_HITL */ | ||||
| 0, | 0, | ||||
| 0, | 0, | ||||
| p0, | p0, | ||||
| p1, | p1, | ||||
| p2, | p2, | ||||
| p3, | p3, | ||||
| p4, | p4, | ||||
| p5); | p5); | ||||
| ▲ Show 20 Lines • Show All 81 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| # ifdef __KERNEL_OPTIX__ | # ifdef __KERNEL_OPTIX__ | ||||
| uint p0 = ((uint64_t)isect) & 0xFFFFFFFF; | uint p0 = ((uint64_t)isect) & 0xFFFFFFFF; | ||||
| uint p1 = (((uint64_t)isect) >> 32) & 0xFFFFFFFF; | uint p1 = (((uint64_t)isect) >> 32) & 0xFFFFFFFF; | ||||
| uint p3 = max_hits; | uint p3 = max_hits; | ||||
| uint p4 = visibility; | uint p4 = visibility; | ||||
| uint p5 = false; | uint p5 = false; | ||||
| *num_hits = 0; // Initialize hit count to zero | uint ray_mask = visibility & 0xFF; | ||||
| if (0 == ray_mask && (visibility & ~0xFF) != 0) { | |||||
| ray_mask = 0xFF; | |||||
| } | |||||
| *num_hits = 0; /* Initialize hit count to zero. */ | |||||
| optixTrace(scene_intersect_valid(ray) ? kernel_data.bvh.scene : 0, | optixTrace(scene_intersect_valid(ray) ? kernel_data.bvh.scene : 0, | ||||
| ray->P, | ray->P, | ||||
| ray->D, | ray->D, | ||||
| 0.0f, | 0.0f, | ||||
| ray->t, | ray->t, | ||||
| ray->time, | ray->time, | ||||
| 0xF, | ray_mask, | ||||
| // Need to always call into __anyhit__kernel_optix_shadow_all_hit | /* Need to always call into __anyhit__kernel_optix_shadow_all_hit. */ | ||||
| OPTIX_RAY_FLAG_ENFORCE_ANYHIT, | OPTIX_RAY_FLAG_ENFORCE_ANYHIT, | ||||
| 1, // SBT offset for PG_HITS | 1, /* SBT offset for PG_HITS */ | ||||
| 0, | 0, | ||||
| 0, | 0, | ||||
| p0, | p0, | ||||
| p1, | p1, | ||||
| *num_hits, | *num_hits, | ||||
| p3, | p3, | ||||
| p4, | p4, | ||||
| p5); | p5); | ||||
| ▲ Show 20 Lines • Show All 52 Lines • ▼ Show 20 Lines | |||||
| # ifdef __KERNEL_OPTIX__ | # ifdef __KERNEL_OPTIX__ | ||||
| uint p0 = 0; | uint p0 = 0; | ||||
| uint p1 = 0; | uint p1 = 0; | ||||
| uint p2 = 0; | uint p2 = 0; | ||||
| uint p3 = 0; | uint p3 = 0; | ||||
| uint p4 = visibility; | uint p4 = visibility; | ||||
| uint p5 = PRIMITIVE_NONE; | uint p5 = PRIMITIVE_NONE; | ||||
| uint ray_mask = visibility & 0xFF; | |||||
| if (0 == ray_mask && (visibility & ~0xFF) != 0) { | |||||
| ray_mask = 0xFF; | |||||
| } | |||||
| optixTrace(scene_intersect_valid(ray) ? kernel_data.bvh.scene : 0, | optixTrace(scene_intersect_valid(ray) ? kernel_data.bvh.scene : 0, | ||||
| ray->P, | ray->P, | ||||
| ray->D, | ray->D, | ||||
| 0.0f, | 0.0f, | ||||
| ray->t, | ray->t, | ||||
| ray->time, | ray->time, | ||||
| // Skip everything but volumes | ray_mask, | ||||
| 0x2, | /* Need to always call into __anyhit__kernel_optix_volume_test. */ | ||||
| OPTIX_RAY_FLAG_NONE, | OPTIX_RAY_FLAG_ENFORCE_ANYHIT, | ||||
| 0, // SBT offset for PG_HITD | 3, /* SBT offset for PG_HITV */ | ||||
| 0, | 0, | ||||
| 0, | 0, | ||||
| p0, | p0, | ||||
| p1, | p1, | ||||
| p2, | p2, | ||||
| p3, | p3, | ||||
| p4, | p4, | ||||
| p5); | p5); | ||||
| ▲ Show 20 Lines • Show All 61 Lines • Show Last 20 Lines | |||||