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.
This commit is contained in:
Thomas Dinges 2014-07-05 02:04:07 +02:00
parent b4b5d9c24e
commit 5aec61f849
Notes: blender-bot 2023-02-14 10:48:33 +01:00
Referenced by issue #40963, Cycles crash on CPU rendering , CUDA works
Referenced by issue #40964, Cycles; massive shading failures with glass node mixing, whiteouts and blackouts.
4 changed files with 10 additions and 10 deletions

View File

@ -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);

View File

@ -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);

View File

@ -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

View File

@ -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)
{