Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2017-08-31 14:57:14 +0300
committerCampbell Barton <ideasman42@gmail.com>2017-08-31 14:57:38 +0300
commit323a7ab944132335f27ba21519df161d7a3351c9 (patch)
treeebccd8e52bcead21faaadbcf4c427293e598061c /intern
parent480def9c5587b710ce478a58985e2e4359c14467 (diff)
parenta35aae9e4972656c0e619c03aa0b26c903d16b34 (diff)
Merge branch 'master' into blender2.8
Diffstat (limited to 'intern')
-rw-r--r--intern/cycles/device/device_network.cpp1
-rw-r--r--intern/cycles/kernel/kernel_light.h31
-rw-r--r--intern/cycles/util/util_simd.h14
3 files changed, 21 insertions, 25 deletions
diff --git a/intern/cycles/device/device_network.cpp b/intern/cycles/device/device_network.cpp
index 66758954f44..571ba9465ca 100644
--- a/intern/cycles/device/device_network.cpp
+++ b/intern/cycles/device/device_network.cpp
@@ -344,7 +344,6 @@ void device_network_info(vector<DeviceInfo>& devices)
info.id = "NETWORK";
info.num = 0;
info.advanced_shading = true; /* todo: get this info from device */
- info.pack_images = false;
devices.push_back(info);
}
diff --git a/intern/cycles/kernel/kernel_light.h b/intern/cycles/kernel/kernel_light.h
index cd05e29ca54..d03cfa92319 100644
--- a/intern/cycles/kernel/kernel_light.h
+++ b/intern/cycles/kernel/kernel_light.h
@@ -807,9 +807,7 @@ ccl_device_forceinline float triangle_light_pdf(KernelGlobals *kg, ShaderData *s
{
/* A naive heuristic to decide between costly solid angle sampling
* and simple area sampling, comparing the distance to the triangle plane
- * to the length of the edtes of the triangle.
- * Looking at two edge of the triangle should be a sufficient heuristic,
- * the third edge can't possibly be longer than the sum of the other two. */
+ * to the length of the edges of the triangle. */
float3 V[3];
bool has_motion = triangle_world_space_vertices(kg, sd->object, sd->prim, sd->time, V);
@@ -877,9 +875,7 @@ ccl_device_forceinline void triangle_light_sample(KernelGlobals *kg, int prim, i
{
/* A naive heuristic to decide between costly solid angle sampling
* and simple area sampling, comparing the distance to the triangle plane
- * to the length of the edtes of the triangle.
- * Looking at two edge of the triangle should be a sufficient heuristic,
- * the third edge can't possibly be longer than the sum of the other two. */
+ * to the length of the edges of the triangle. */
float3 V[3];
bool has_motion = triangle_world_space_vertices(kg, object, prim, time, V);
@@ -968,21 +964,14 @@ ccl_device_forceinline void triangle_light_sample(KernelGlobals *kg, int prim, i
const float z = 1.0f - randv * (1.0f - dot(C_, B));
ls->D = z * B + safe_sqrtf(1.0f - z*z) * safe_normalize(C_ - dot(C_, B) * B);
- /* calculate intersection with the planar triangle
- * mostly standard ray/tri intersection, with u/v clamped */
- const float3 s1 = cross(ls->D, e1);
-
- const float divisor = dot(s1, e0);
- if(UNLIKELY(divisor == 0.0f)) {
- ls->pdf = 0.0f;
- return;
- }
- const float inv_divisor = 1.0f/divisor;
- const float3 d = P - V[0];
- ls->u = clamp(dot(d, s1)*inv_divisor, 0.0f, 1.0f);
- const float3 s2 = cross(d, e0);
- ls->v = clamp(dot(ls->D, s2)*inv_divisor, 0.0f, 1.0f);
- ls->t = dot(e1, s2)*inv_divisor;
+ /* calculate intersection with the planar triangle */
+ ray_triangle_intersect(P, ls->D, FLT_MAX,
+#if defined(__KERNEL_SSE2__) && defined(__KERNEL_SSE__)
+ (ssef*)V,
+#else
+ V[0], V[1], V[2],
+#endif
+ &ls->u, &ls->v, &ls->t);
ls->P = P + ls->D * ls->t;
/* pdf_triangles is calculated over triangle area, but we're sampling over solid angle */
diff --git a/intern/cycles/util/util_simd.h b/intern/cycles/util/util_simd.h
index 1a26ca697dd..58b3d267266 100644
--- a/intern/cycles/util/util_simd.h
+++ b/intern/cycles/util/util_simd.h
@@ -347,7 +347,10 @@ __forceinline size_t __bscf(size_t& v)
#endif /* _WIN32 */
-#if !(defined(__SSE4_1__) || defined(__SSE4_2__))
+/* Test __KERNEL_SSE41__ for MSVC which does not define __SSE4_1__, and test
+ * __SSE4_1__ to avoid OpenImageIO conflicts with our emulation macros on other
+ * platforms when compiling code outside the kernel. */
+#if !(defined(__KERNEL_SSE41__) || defined(__SSE4_1__) || defined(__SSE4_2__))
/* Emulation of SSE4 functions with SSE2 */
@@ -361,7 +364,12 @@ __forceinline size_t __bscf(size_t& v)
#define _mm_blendv_ps _mm_blendv_ps_emu
__forceinline __m128 _mm_blendv_ps_emu( __m128 value, __m128 input, __m128 mask)
{
- return _mm_or_ps(_mm_and_ps(mask, input), _mm_andnot_ps(mask, value));
+ __m128i isignmask = _mm_set1_epi32(0x80000000);
+ __m128 signmask = _mm_castsi128_ps(isignmask);
+ __m128i iandsign = _mm_castps_si128(_mm_and_ps(mask, signmask));
+ __m128i icmpmask = _mm_cmpeq_epi32(iandsign, isignmask);
+ __m128 cmpmask = _mm_castsi128_ps(icmpmask);
+ return _mm_or_ps(_mm_and_ps(cmpmask, input), _mm_andnot_ps(cmpmask, value));
}
#undef _mm_blend_ps
@@ -435,7 +443,7 @@ __forceinline __m128 _mm_round_ps_emu( __m128 value, const int flags)
return value;
}
-#endif /* !(defined(__SSE4_1__) || defined(__SSE4_2__)) */
+#endif /* !(defined(__KERNEL_SSE41__) || defined(__SSE4_1__) || defined(__SSE4_2__)) */
#else /* __KERNEL_SSE2__ */