[Bf-blender-cvs] [19622ffc5b8] master: Cleanup: Remove OpenCL workaround in volume_sample_channel().

Thomas Dinges noreply at git.blender.org
Thu Jan 20 17:02:33 CET 2022


Commit: 19622ffc5b84475a6c3b56ff0595811a503f461c
Author: Thomas Dinges
Date:   Thu Jan 20 17:01:14 2022 +0100
Branches: master
https://developer.blender.org/rB19622ffc5b84475a6c3b56ff0595811a503f461c

Cleanup: Remove OpenCL workaround in volume_sample_channel().

===================================================================

M	intern/cycles/kernel/closure/volume.h

===================================================================

diff --git a/intern/cycles/kernel/closure/volume.h b/intern/cycles/kernel/closure/volume.h
index 023fb3ac4ea..4a7a63819ab 100644
--- a/intern/cycles/kernel/closure/volume.h
+++ b/intern/cycles/kernel/closure/volume.h
@@ -199,22 +199,18 @@ ccl_device int volume_sample_channel(float3 albedo,
    *  Tracing". Matt Jen-Yuan Chiang, Peter Kutz, Brent Burley. SIGGRAPH 2016. */
   float3 weights = fabs(throughput * albedo);
   float sum_weights = weights.x + weights.y + weights.z;
-  float3 weights_pdf;
 
   if (sum_weights > 0.0f) {
-    weights_pdf = weights / sum_weights;
+    *pdf = weights / sum_weights;
   }
   else {
-    weights_pdf = make_float3(1.0f / 3.0f, 1.0f / 3.0f, 1.0f / 3.0f);
+    *pdf = make_float3(1.0f / 3.0f, 1.0f / 3.0f, 1.0f / 3.0f);
   }
 
-  *pdf = weights_pdf;
-
-  /* OpenCL does not support -> on float3, so don't use pdf->x. */
-  if (rand < weights_pdf.x) {
+  if (rand < pdf->x) {
     return 0;
   }
-  else if (rand < weights_pdf.x + weights_pdf.y) {
+  else if (rand < pdf->x + pdf->y) {
     return 1;
   }
   else {



More information about the Bf-blender-cvs mailing list