Page MenuHome

Fix for error when building with Optix
ClosedPublic

Authored by Daniel Santana (dgsantana) on Mar 27 2020, 1:39 PM.

Details

Summary

Building with Optix, in the latest master (31bd8e6bf3aeecf7968249c7b7e832fc639a52d5) fails due to missing the extra 0.0f on make_float3.
This simple patch fixes this.

Diff Detail

Repository
rB Blender

Event Timeline

This revision is now accepted and ready to land.Mar 27 2020, 1:57 PM

@Daniel Santana (dgsantana) should the make_float3 function be fixed here? Is _mm_set1_ps the problem? It's not clear using make_float3 with a single argument is going to cause trouble for different hardware.

ccl_device_inline float3 make_float3(float f)
{
#  ifdef __KERNEL_SSE__
  float3 a(_mm_set1_ps(f));
#  else
  float3 a = {f, f, f, f};
#  endif
  return a;
}

ccl_device_inline float3 make_float3(float x, float y, float z)
{
#  ifdef __KERNEL_SSE__
  float3 a(_mm_set_ps(0.0f, z, y, x));
#  else
  float3 a = {x, y, z, 0.0f};
#  endif
  return a;
}

There is no function overloading in OpenCL, so we can't do this.

That whole block is in a CPU only #ifdef, make_<type> are build in cuda types

@Brecht Van Lommel (brecht) @Ray Molenkamp (LazyDodo)
Should the single argument make_float3 be removed or renamed to prevent this in the future? From what I can tell it's only used in the is_zero function now. See P1315 for mini patch to remove it.

I wouldn't mind it, there's some use of it inside cycles_bvh as well though.

I'm fine with the single argument version being removed.