More fixes related to #32900, motion blur with cuda sm 2.0 still disabled.

This commit is contained in:
Brecht Van Lommel
2012-10-18 12:45:27 +00:00
parent f7a584b841
commit 95963289c8
5 changed files with 17 additions and 6 deletions

View File

@@ -443,13 +443,19 @@ __device_inline bool bvh_intersect_motion(KernelGlobals *kg, const Ray *ray, con
__device_inline bool scene_intersect(KernelGlobals *kg, const Ray *ray, const uint visibility, Intersection *isect) __device_inline bool scene_intersect(KernelGlobals *kg, const Ray *ray, const uint visibility, Intersection *isect)
{ {
/* todo: fix cuda sm 2.0 motion blur */ #ifdef __OBJECT_MOTION__
#if defined(__OBJECT_MOTION__) && (!defined(__KERNEL_CUDA) || (__CUDA_ARCH__ >= 210)) #if !defined(__KERNEL_CUDA__) || (__CUDA_ARCH__ >= 210)
if(kernel_data.bvh.have_motion) if(kernel_data.bvh.have_motion)
return bvh_intersect_motion(kg, ray, visibility, isect); return bvh_intersect_motion(kg, ray, visibility, isect);
else else
#endif
return bvh_intersect(kg, ray, visibility, isect); return bvh_intersect(kg, ray, visibility, isect);
#else
/* todo: fix cuda sm 2.0 motion blur */
return bvh_intersect(kg, ray, visibility, isect);
#endif
#else
return bvh_intersect(kg, ray, visibility, isect);
#endif
} }
__device_inline float3 ray_offset(float3 P, float3 Ng) __device_inline float3 ray_offset(float3 P, float3 Ng)

View File

@@ -32,6 +32,10 @@ __device float3 direct_emissive_eval(KernelGlobals *kg, float rando,
Ray ray; Ray ray;
ray.D = ls->D; ray.D = ls->D;
ray.P = ls->P; ray.P = ls->P;
ray.t = 1.0f;
#ifdef __OBJECT_MOTION__
ray.time = time;
#endif
ray.dP.dx = make_float3(0.0f, 0.0f, 0.0f); ray.dP.dx = make_float3(0.0f, 0.0f, 0.0f);
ray.dP.dy = make_float3(0.0f, 0.0f, 0.0f); ray.dP.dy = make_float3(0.0f, 0.0f, 0.0f);
#ifdef __CAMERA_MOTION__ #ifdef __CAMERA_MOTION__

View File

@@ -514,7 +514,9 @@ typedef struct KernelCamera {
/* more matrices */ /* more matrices */
Transform screentoworld; Transform screentoworld;
Transform rastertoworld; Transform rastertoworld;
Transform ndctoworld; /* work around cuda sm 2.0 crash, this seems to
* cross some limit in combination with motion
* Transform ndctoworld; */
Transform worldtoscreen; Transform worldtoscreen;
Transform worldtoraster; Transform worldtoraster;
Transform worldtondc; Transform worldtondc;

View File

@@ -224,7 +224,7 @@ bool OSLRenderServices::get_matrix(OSL::Matrix44 &result, ustring from)
KernelGlobals *kg = kernel_globals; KernelGlobals *kg = kernel_globals;
if (from == u_ndc) { if (from == u_ndc) {
Transform tfm = transform_transpose(kernel_data.cam.ndctoworld); Transform tfm = transform_transpose(transform_quick_inverse(kernel_data.cam.worldtondc));
result = TO_MATRIX44(tfm); result = TO_MATRIX44(tfm);
return true; return true;
} }

View File

@@ -162,7 +162,6 @@ void Camera::device_update(Device *device, DeviceScene *dscene, Scene *scene)
/* store matrices */ /* store matrices */
kcam->screentoworld = screentoworld; kcam->screentoworld = screentoworld;
kcam->rastertoworld = rastertoworld; kcam->rastertoworld = rastertoworld;
kcam->ndctoworld = ndctoworld;
kcam->rastertocamera = rastertocamera; kcam->rastertocamera = rastertocamera;
kcam->cameratoworld = cameratoworld; kcam->cameratoworld = cameratoworld;
kcam->worldtoscreen = transform_inverse(screentoworld); kcam->worldtoscreen = transform_inverse(screentoworld);