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
diff options
context:
space:
mode:
authorEthan-Hall <Ethan1080>2022-03-23 17:53:10 +0300
committerBrecht Van Lommel <brecht@blender.org>2022-03-23 22:06:12 +0300
commitf5066d43ae572de929fea31cbc9e091e288b2435 (patch)
treec585a7551aae6b899064e88b570046f606a76f7a /intern/cycles
parent4e56e738a8f35228873d6e84d9e9f8b0e7a74a59 (diff)
Cleanup: use make_float4(f) zero_float4() to simplify code
Differential Revision: https://developer.blender.org/D14426
Diffstat (limited to 'intern/cycles')
-rw-r--r--intern/cycles/blender/object.cpp2
-rw-r--r--intern/cycles/bvh/binning.cpp2
-rw-r--r--intern/cycles/kernel/closure/bsdf_hair_principled.h2
-rw-r--r--intern/cycles/kernel/film/read.h2
-rw-r--r--intern/cycles/kernel/geom/curve.h8
-rw-r--r--intern/cycles/kernel/geom/patch.h12
-rw-r--r--intern/cycles/kernel/geom/point.h6
-rw-r--r--intern/cycles/kernel/geom/primitive.h8
-rw-r--r--intern/cycles/kernel/geom/subd_triangle.h14
-rw-r--r--intern/cycles/kernel/geom/triangle.h6
-rw-r--r--intern/cycles/kernel/geom/volume.h2
-rw-r--r--intern/cycles/kernel/osl/services.cpp4
-rw-r--r--intern/cycles/kernel/svm/image.h2
-rw-r--r--intern/cycles/kernel/svm/voronoi.h22
-rw-r--r--intern/cycles/kernel/svm/voxel.h2
-rw-r--r--intern/cycles/util/math_float4.h14
-rw-r--r--intern/cycles/util/math_matrix.h4
17 files changed, 56 insertions, 56 deletions
diff --git a/intern/cycles/blender/object.cpp b/intern/cycles/blender/object.cpp
index 054142a9ca4..3a95746d149 100644
--- a/intern/cycles/blender/object.cpp
+++ b/intern/cycles/blender/object.cpp
@@ -422,7 +422,7 @@ static float4 lookup_instance_property(BL::DepsgraphObjectInstance &b_instance,
return value;
}
- return make_float4(0.0f);
+ return zero_float4();
}
bool BlenderSync::sync_object_attributes(BL::DepsgraphObjectInstance &b_instance, Object *object)
diff --git a/intern/cycles/bvh/binning.cpp b/intern/cycles/bvh/binning.cpp
index b04fc069c54..5ac7f9c782a 100644
--- a/intern/cycles/bvh/binning.cpp
+++ b/intern/cycles/bvh/binning.cpp
@@ -203,7 +203,7 @@ BVHObjectBinning::BVHObjectBinning(const BVHRange &job,
bestSAH = min(sah, bestSAH);
}
- int4 mask = float3_to_float4(cent_bounds_.size()) <= make_float4(0.0f);
+ int4 mask = float3_to_float4(cent_bounds_.size()) <= zero_float4();
bestSAH = insert<3>(select(mask, make_float4(FLT_MAX), bestSAH), FLT_MAX);
/* find best dimension */
diff --git a/intern/cycles/kernel/closure/bsdf_hair_principled.h b/intern/cycles/kernel/closure/bsdf_hair_principled.h
index 33706213403..fb65d744a0c 100644
--- a/intern/cycles/kernel/closure/bsdf_hair_principled.h
+++ b/intern/cycles/kernel/closure/bsdf_hair_principled.h
@@ -220,7 +220,7 @@ ccl_device_inline void hair_attenuation(KernelGlobals kg,
ccl_private float4 *Ap)
{
/* Primary specular (R). */
- Ap[0] = make_float4(f, f, f, f);
+ Ap[0] = make_float4(f);
/* Transmission (TT). */
float3 col = sqr(1.0f - f) * T;
diff --git a/intern/cycles/kernel/film/read.h b/intern/cycles/kernel/film/read.h
index 0931e14ee84..a0236909f4b 100644
--- a/intern/cycles/kernel/film/read.h
+++ b/intern/cycles/kernel/film/read.h
@@ -451,7 +451,7 @@ ccl_device_inline float4 film_calculate_shadow_catcher_matte_with_shadow(
float scale, scale_exposure;
if (!film_get_scale_and_scale_exposure(kfilm_convert, buffer, &scale, &scale_exposure)) {
- return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
+ return zero_float4();
}
ccl_global const float *in_matte = buffer + kfilm_convert->pass_shadow_catcher_matte;
diff --git a/intern/cycles/kernel/geom/curve.h b/intern/cycles/kernel/geom/curve.h
index 79366f11082..4dbc6d4f6db 100644
--- a/intern/cycles/kernel/geom/curve.h
+++ b/intern/cycles/kernel/geom/curve.h
@@ -164,7 +164,7 @@ ccl_device float4 curve_attribute_float4(KernelGlobals kg,
if (dx)
*dx = sd->du.dx * (f1 - f0);
if (dy)
- *dy = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
+ *dy = zero_float4();
# endif
return (1.0f - sd->u) * f0 + sd->u * f1;
@@ -172,9 +172,9 @@ ccl_device float4 curve_attribute_float4(KernelGlobals kg,
else {
# ifdef __RAY_DIFFERENTIALS__
if (dx)
- *dx = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
+ *dx = zero_float4();
if (dy)
- *dy = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
+ *dy = zero_float4();
# endif
if (desc.element & (ATTR_ELEMENT_CURVE | ATTR_ELEMENT_OBJECT | ATTR_ELEMENT_MESH)) {
@@ -183,7 +183,7 @@ ccl_device float4 curve_attribute_float4(KernelGlobals kg,
return kernel_tex_fetch(__attributes_float4, offset);
}
else {
- return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
+ return zero_float4();
}
}
}
diff --git a/intern/cycles/kernel/geom/patch.h b/intern/cycles/kernel/geom/patch.h
index 9a006baf7bf..1c63a00e30d 100644
--- a/intern/cycles/kernel/geom/patch.h
+++ b/intern/cycles/kernel/geom/patch.h
@@ -391,11 +391,11 @@ ccl_device float4 patch_eval_float4(KernelGlobals kg,
int num_control = patch_eval_control_verts(
kg, sd->object, patch, u, v, channel, indices, weights, weights_du, weights_dv);
- float4 val = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
+ float4 val = zero_float4();
if (du)
- *du = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
+ *du = zero_float4();
if (dv)
- *dv = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
+ *dv = zero_float4();
for (int i = 0; i < num_control; i++) {
float4 v = kernel_tex_fetch(__attributes_float4, offset + indices[i]);
@@ -428,11 +428,11 @@ ccl_device float4 patch_eval_uchar4(KernelGlobals kg,
int num_control = patch_eval_control_verts(
kg, sd->object, patch, u, v, channel, indices, weights, weights_du, weights_dv);
- float4 val = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
+ float4 val = zero_float4();
if (du)
- *du = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
+ *du = zero_float4();
if (dv)
- *dv = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
+ *dv = zero_float4();
for (int i = 0; i < num_control; i++) {
float4 v = color_srgb_to_linear_v4(
diff --git a/intern/cycles/kernel/geom/point.h b/intern/cycles/kernel/geom/point.h
index 041ecb3c2cf..ee7eca9e0c6 100644
--- a/intern/cycles/kernel/geom/point.h
+++ b/intern/cycles/kernel/geom/point.h
@@ -83,16 +83,16 @@ ccl_device float4 point_attribute_float4(KernelGlobals kg,
{
# ifdef __RAY_DIFFERENTIALS__
if (dx)
- *dx = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
+ *dx = zero_float4();
if (dy)
- *dy = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
+ *dy = zero_float4();
# endif
if (desc.element == ATTR_ELEMENT_VERTEX) {
return kernel_tex_fetch(__attributes_float4, desc.offset + sd->prim);
}
else {
- return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
+ return zero_float4();
}
}
diff --git a/intern/cycles/kernel/geom/primitive.h b/intern/cycles/kernel/geom/primitive.h
index 63d1168364c..9b4b61fbd84 100644
--- a/intern/cycles/kernel/geom/primitive.h
+++ b/intern/cycles/kernel/geom/primitive.h
@@ -135,10 +135,10 @@ ccl_device_forceinline float4 primitive_surface_attribute_float4(KernelGlobals k
#endif
else {
if (dx)
- *dx = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
+ *dx = zero_float4();
if (dy)
- *dy = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
- return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
+ *dy = zero_float4();
+ return zero_float4();
}
}
@@ -187,7 +187,7 @@ ccl_device_inline float4 primitive_volume_attribute_float4(KernelGlobals kg,
return volume_attribute_float4(kg, sd, desc);
}
else {
- return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
+ return zero_float4();
}
}
#endif
diff --git a/intern/cycles/kernel/geom/subd_triangle.h b/intern/cycles/kernel/geom/subd_triangle.h
index 0ff5292b5b5..24e1e454b8c 100644
--- a/intern/cycles/kernel/geom/subd_triangle.h
+++ b/intern/cycles/kernel/geom/subd_triangle.h
@@ -566,9 +566,9 @@ ccl_device_noinline float4 subd_triangle_attribute_float4(KernelGlobals kg,
#endif /* __PATCH_EVAL__ */
if (desc.element == ATTR_ELEMENT_FACE) {
if (dx)
- *dx = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
+ *dx = zero_float4();
if (dy)
- *dy = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
+ *dy = zero_float4();
return kernel_tex_fetch(__attributes_float4,
desc.offset + subd_triangle_patch_face(kg, patch));
@@ -648,19 +648,19 @@ ccl_device_noinline float4 subd_triangle_attribute_float4(KernelGlobals kg,
}
else if (desc.element == ATTR_ELEMENT_OBJECT || desc.element == ATTR_ELEMENT_MESH) {
if (dx)
- *dx = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
+ *dx = zero_float4();
if (dy)
- *dy = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
+ *dy = zero_float4();
return kernel_tex_fetch(__attributes_float4, desc.offset);
}
else {
if (dx)
- *dx = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
+ *dx = zero_float4();
if (dy)
- *dy = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
+ *dy = zero_float4();
- return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
+ return zero_float4();
}
}
diff --git a/intern/cycles/kernel/geom/triangle.h b/intern/cycles/kernel/geom/triangle.h
index 865bf549ae3..8ac7e67ff05 100644
--- a/intern/cycles/kernel/geom/triangle.h
+++ b/intern/cycles/kernel/geom/triangle.h
@@ -338,9 +338,9 @@ ccl_device float4 triangle_attribute_float4(KernelGlobals kg,
else {
#ifdef __RAY_DIFFERENTIALS__
if (dx)
- *dx = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
+ *dx = zero_float4();
if (dy)
- *dy = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
+ *dy = zero_float4();
#endif
if (desc.element & (ATTR_ELEMENT_FACE | ATTR_ELEMENT_OBJECT | ATTR_ELEMENT_MESH)) {
@@ -349,7 +349,7 @@ ccl_device float4 triangle_attribute_float4(KernelGlobals kg,
return kernel_tex_fetch(__attributes_float4, offset);
}
else {
- return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
+ return zero_float4();
}
}
}
diff --git a/intern/cycles/kernel/geom/volume.h b/intern/cycles/kernel/geom/volume.h
index aa6f3b42bf2..22715dee5bf 100644
--- a/intern/cycles/kernel/geom/volume.h
+++ b/intern/cycles/kernel/geom/volume.h
@@ -75,7 +75,7 @@ ccl_device float4 volume_attribute_float4(KernelGlobals kg,
return kernel_tex_image_interp_3d(kg, desc.offset, P, interp);
}
else {
- return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
+ return zero_float4();
}
}
diff --git a/intern/cycles/kernel/osl/services.cpp b/intern/cycles/kernel/osl/services.cpp
index 79547872c68..832498f1f73 100644
--- a/intern/cycles/kernel/osl/services.cpp
+++ b/intern/cycles/kernel/osl/services.cpp
@@ -595,8 +595,8 @@ static bool set_attribute_float4(float4 f, TypeDesc type, bool derivatives, void
float4 fv[3];
fv[0] = f;
- fv[1] = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
- fv[2] = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
+ fv[1] = zero_float4();
+ fv[2] = zero_float4();
return set_attribute_float4(fv, type, derivatives, val);
}
diff --git a/intern/cycles/kernel/svm/image.h b/intern/cycles/kernel/svm/image.h
index e9669800f4c..31f29531740 100644
--- a/intern/cycles/kernel/svm/image.h
+++ b/intern/cycles/kernel/svm/image.h
@@ -186,7 +186,7 @@ ccl_device_noinline void svm_node_tex_image_box(KernelGlobals kg,
float3 co = stack_load_float3(stack, co_offset);
uint id = node.y;
- float4 f = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
+ float4 f = zero_float4();
/* Map so that no textures are flipped, rotation is somewhat arbitrary. */
if (weight.x > 0.0f) {
diff --git a/intern/cycles/kernel/svm/voronoi.h b/intern/cycles/kernel/svm/voronoi.h
index 8afd7cc9b5f..4ff1047aab7 100644
--- a/intern/cycles/kernel/svm/voronoi.h
+++ b/intern/cycles/kernel/svm/voronoi.h
@@ -684,8 +684,8 @@ ccl_device void voronoi_f1_4d(float4 coord,
float4 localPosition = coord - cellPosition;
float minDistance = 8.0f;
- float4 targetOffset = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
- float4 targetPosition = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
+ float4 targetOffset = zero_float4();
+ float4 targetPosition = zero_float4();
for (int u = -1; u <= 1; u++) {
for (int k = -1; k <= 1; k++) {
ccl_loop_no_unroll for (int j = -1; j <= 1; j++)
@@ -724,7 +724,7 @@ ccl_device void voronoi_smooth_f1_4d(float4 coord,
float smoothDistance = 8.0f;
float3 smoothColor = make_float3(0.0f, 0.0f, 0.0f);
- float4 smoothPosition = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
+ float4 smoothPosition = zero_float4();
for (int u = -2; u <= 2; u++) {
for (int k = -2; k <= 2; k++) {
ccl_loop_no_unroll for (int j = -2; j <= 2; j++)
@@ -765,10 +765,10 @@ ccl_device void voronoi_f2_4d(float4 coord,
float distanceF1 = 8.0f;
float distanceF2 = 8.0f;
- float4 offsetF1 = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
- float4 positionF1 = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
- float4 offsetF2 = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
- float4 positionF2 = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
+ float4 offsetF1 = zero_float4();
+ float4 positionF1 = zero_float4();
+ float4 offsetF2 = zero_float4();
+ float4 positionF2 = zero_float4();
for (int u = -1; u <= 1; u++) {
for (int k = -1; k <= 1; k++) {
ccl_loop_no_unroll for (int j = -1; j <= 1; j++)
@@ -808,7 +808,7 @@ ccl_device void voronoi_distance_to_edge_4d(float4 coord,
float4 cellPosition = floor(coord);
float4 localPosition = coord - cellPosition;
- float4 vectorToClosest = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
+ float4 vectorToClosest = zero_float4();
float minDistance = 8.0f;
for (int u = -1; u <= 1; u++) {
for (int k = -1; k <= 1; k++) {
@@ -859,8 +859,8 @@ ccl_device void voronoi_n_sphere_radius_4d(float4 coord,
float4 cellPosition = floor(coord);
float4 localPosition = coord - cellPosition;
- float4 closestPoint = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
- float4 closestPointOffset = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
+ float4 closestPoint = zero_float4();
+ float4 closestPointOffset = zero_float4();
float minDistance = 8.0f;
for (int u = -1; u <= 1; u++) {
for (int k = -1; k <= 1; k++) {
@@ -882,7 +882,7 @@ ccl_device void voronoi_n_sphere_radius_4d(float4 coord,
}
minDistance = 8.0f;
- float4 closestPointToClosestPoint = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
+ float4 closestPointToClosestPoint = zero_float4();
for (int u = -1; u <= 1; u++) {
for (int k = -1; k <= 1; k++) {
ccl_loop_no_unroll for (int j = -1; j <= 1; j++)
diff --git a/intern/cycles/kernel/svm/voxel.h b/intern/cycles/kernel/svm/voxel.h
index c5f6a6f004a..553a00cd09a 100644
--- a/intern/cycles/kernel/svm/voxel.h
+++ b/intern/cycles/kernel/svm/voxel.h
@@ -30,7 +30,7 @@ ccl_device_noinline int svm_node_tex_voxel(
float4 r = kernel_tex_image_interp_3d(kg, id, co, INTERPOLATION_NONE);
#else
- float4 r = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
+ float4 r = zero_float4();
#endif
if (stack_valid(density_out_offset))
stack_store_float(stack, density_out_offset, r.w);
diff --git a/intern/cycles/util/math_float4.h b/intern/cycles/util/math_float4.h
index 9f4a1a904b5..5d4da7dd30f 100644
--- a/intern/cycles/util/math_float4.h
+++ b/intern/cycles/util/math_float4.h
@@ -90,13 +90,13 @@ ccl_device_inline float4 zero_float4()
#ifdef __KERNEL_SSE__
return float4(_mm_setzero_ps());
#else
- return make_float4(0.0f, 0.0f, 0.0f, 0.0f);
+ return make_float4(0.0f);
#endif
}
ccl_device_inline float4 one_float4()
{
- return make_float4(1.0f, 1.0f, 1.0f, 1.0f);
+ return make_float4(1.0f);
}
#if !defined(__KERNEL_METAL__)
@@ -149,7 +149,7 @@ ccl_device_inline float4 operator/(const float4 &a, const float4 &b)
ccl_device_inline float4 operator+(const float4 &a, const float f)
{
- return a + make_float4(f, f, f, f);
+ return a + make_float4(f);
}
ccl_device_inline float4 operator+(const float4 &a, const float4 &b)
@@ -163,7 +163,7 @@ ccl_device_inline float4 operator+(const float4 &a, const float4 &b)
ccl_device_inline float4 operator-(const float4 &a, const float f)
{
- return a - make_float4(f, f, f, f);
+ return a - make_float4(f);
}
ccl_device_inline float4 operator-(const float4 &a, const float4 &b)
@@ -297,7 +297,7 @@ ccl_device_inline float4 cross(const float4 &a, const float4 &b)
ccl_device_inline bool is_zero(const float4 &a)
{
# ifdef __KERNEL_SSE__
- return a == make_float4(0.0f);
+ return a == zero_float4();
# else
return (a.x == 0.0f && a.y == 0.0f && a.z == 0.0f && a.w == 0.0f);
# endif
@@ -317,7 +317,7 @@ ccl_device_inline float4 reduce_add(const float4 &a)
# endif
# else
float sum = (a.x + a.y) + (a.z + a.w);
- return make_float4(sum, sum, sum, sum);
+ return make_float4(sum);
# endif
}
@@ -458,7 +458,7 @@ ccl_device_inline float4 select(const int4 &mask, const float4 &a, const float4
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
{
/* Replace elements of x with zero where mask isn't set. */
- return select(mask, a, make_float4(0.0f));
+ return select(mask, a, zero_float4());
}
ccl_device_inline float4 reduce_min(const float4 &a)
diff --git a/intern/cycles/util/math_matrix.h b/intern/cycles/util/math_matrix.h
index a4318fda6e8..b10d9b3c938 100644
--- a/intern/cycles/util/math_matrix.h
+++ b/intern/cycles/util/math_matrix.h
@@ -376,7 +376,7 @@ ccl_device void math_matrix_jacobi_eigendecomposition(ccl_private float *A,
ccl_device_inline void math_vector_zero_sse(float4 *A, int n)
{
for (int i = 0; i < n; i++) {
- A[i] = make_float4(0.0f);
+ A[i] = zero_float4();
}
}
@@ -384,7 +384,7 @@ ccl_device_inline void math_matrix_zero_sse(float4 *A, int n)
{
for (int row = 0; row < n; row++) {
for (int col = 0; col <= row; col++) {
- MAT(A, n, row, col) = make_float4(0.0f);
+ MAT(A, n, row, col) = zero_float4();
}
}
}