Commit: 5aec61f8493f5876a52ec67871148803396ff223
Author: Thomas Dinges
Date:   Sat Jul 5 02:04:07 2014 +0200
https://developer.blender.org/rB5aec61f8493f5876a52ec67871148803396ff223

Cycles: Compile fixes for CUDA Volumetrics.
* CUDA can be compiled with Volume support again, change line 78 kernel_types.h 
for that.

Volumes are still fragile on GPU though, got some Memory/Address CUDA errors in 
tests.. needs to be investigated more deeply.

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

M       intern/cycles/kernel/geom/geom_volume.h
M       intern/cycles/kernel/kernel_path.h
M       intern/cycles/kernel/kernel_path_volume.h
M       intern/cycles/kernel/kernel_volume.h

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

diff --git a/intern/cycles/kernel/geom/geom_volume.h 
b/intern/cycles/kernel/geom/geom_volume.h
index 963d6cb..33a2049 100644
--- a/intern/cycles/kernel/geom/geom_volume.h
+++ b/intern/cycles/kernel/geom/geom_volume.h
@@ -49,7 +49,11 @@ ccl_device float3 volume_normalized_position(KernelGlobals 
*kg, const ShaderData
 ccl_device float volume_attribute_float(KernelGlobals *kg, const ShaderData 
*sd, AttributeElement elem, int id, float *dx, float *dy)
 {
        float3 P = volume_normalized_position(kg, sd, sd->P);
+#ifdef __KERNEL_GPU__
+       float4 r = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
+#else
        float4 r = kernel_tex_image_interp_3d(id, P.x, P.y, P.z);
+#endif
 
        if(dx) *dx = 0.0f;
        if(dx) *dy = 0.0f;
@@ -61,7 +65,11 @@ ccl_device float volume_attribute_float(KernelGlobals *kg, 
const ShaderData *sd,
 ccl_device float3 volume_attribute_float3(KernelGlobals *kg, const ShaderData 
*sd, AttributeElement elem, int id, float3 *dx, float3 *dy)
 {
        float3 P = volume_normalized_position(kg, sd, sd->P);
+#ifdef __KERNEL_GPU__
+       float4 r = make_float4(0.0f, 0.0f, 0.0f, 0.0f);
+#else
        float4 r = kernel_tex_image_interp_3d(id, P.x, P.y, P.z);
+#endif
 
        if(dx) *dx = make_float3(0.0f, 0.0f, 0.0f);
        if(dy) *dy = make_float3(0.0f, 0.0f, 0.0f);
diff --git a/intern/cycles/kernel/kernel_path.h 
b/intern/cycles/kernel/kernel_path.h
index 83bceed..d7fbec2 100644
--- a/intern/cycles/kernel/kernel_path.h
+++ b/intern/cycles/kernel/kernel_path.h
@@ -902,7 +902,7 @@ ccl_device float4 
kernel_branched_path_integrate(KernelGlobals *kg, RNG *rng, in
                                if(result == VOLUME_PATH_SCATTERED) {
                                        /* todo: support equiangular, MIS and 
all light sampling.
                                         * alternatively get decoupled ray 
marching working on the GPU */
-                                       kernel_path_volume_connect_light(kg, 
rng, &volume_sd, &volume_ray, throughput, &state, &L, num_samples_inv);
+                                       kernel_path_volume_connect_light(kg, 
rng, &volume_sd, throughput, &state, &L, num_samples_inv);
 
                                        if(kernel_path_volume_bounce(kg, rng, 
&volume_sd, &tp, &ps, &L, &pray, num_samples_inv)) {
                                                kernel_path_indirect(kg, rng, 
pray, tp*num_samples_inv, num_samples, ps, &L);
diff --git a/intern/cycles/kernel/kernel_path_volume.h 
b/intern/cycles/kernel/kernel_path_volume.h
index 6cc3085..8453b79 100644
--- a/intern/cycles/kernel/kernel_path_volume.h
+++ b/intern/cycles/kernel/kernel_path_volume.h
@@ -103,8 +103,6 @@ ccl_device bool kernel_path_volume_bounce(KernelGlobals 
*kg, RNG *rng,
        return true;
 }
 
-#ifdef __KERNEL_CPU__
-
 ccl_device void kernel_branched_path_volume_connect_light(KernelGlobals *kg, 
RNG *rng,
        ShaderData *sd, float3 throughput, PathState *state, PathRadiance *L,
        float num_samples_adjust, bool sample_all_lights, Ray *ray, const 
VolumeSegment *segment)
@@ -275,7 +273,5 @@ ccl_device void 
kernel_branched_path_volume_connect_light(KernelGlobals *kg, RNG
 
 #endif
 
-#endif
-
 CCL_NAMESPACE_END
 
diff --git a/intern/cycles/kernel/kernel_volume.h 
b/intern/cycles/kernel/kernel_volume.h
index e61a29f..844ca90 100644
--- a/intern/cycles/kernel/kernel_volume.h
+++ b/intern/cycles/kernel/kernel_volume.h
@@ -582,11 +582,7 @@ typedef struct VolumeStep {
 } VolumeStep;
 
 typedef struct VolumeSegment {
-#ifdef __KERNEL_CPU__
        VolumeStep *steps;                      /* recorded steps */
-#else
-       VolumeStep steps[1];            /* recorded steps */
-#endif
        int numsteps;                           /* number of steps */
        int closure_flag;                       /* accumulated closure flags 
from all steps */
 
@@ -601,7 +597,7 @@ typedef struct VolumeSegment {
  * it would be nice if we could only record up to the point that we need to 
scatter,
  * but the entire segment is needed to do always scattering, rather than 
probalistically
  * hitting or missing the volume. if we don't know the transmittance at the 
end of the
- * volume we can't generate stratitied distance samples up to that 
transmittance */
+ * volume we can't generate stratified distance samples up to that 
transmittance */
 ccl_device void kernel_volume_decoupled_record(KernelGlobals *kg, PathState 
*state,
        Ray *ray, ShaderData *sd, VolumeSegment *segment, bool heterogeneous)
 {

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to