Blender  V2.93
kernel_shadow_blocked_ao.h
Go to the documentation of this file.
1 /*
2  * Copyright 2011-2015 Blender Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
18 
19 /* Shadow ray cast for AO. */
21 {
22  unsigned int ao_queue_length = kernel_split_params.queue_index[QUEUE_SHADOW_RAY_CAST_AO_RAYS];
24 
25  int ray_index = QUEUE_EMPTY_SLOT;
26  int thread_index = ccl_global_id(1) * ccl_global_size(0) + ccl_global_id(0);
27  if (thread_index < ao_queue_length) {
28  ray_index = get_ray_index(kg,
29  thread_index,
31  kernel_split_state.queue_data,
32  kernel_split_params.queue_size,
33  1);
34  }
35 
36  if (ray_index == QUEUE_EMPTY_SLOT) {
37  return;
38  }
39 
40  ShaderData *sd = kernel_split_sd(sd, ray_index);
41  ShaderData *emission_sd = AS_SHADER_DATA(&kernel_split_state.sd_DL_shadow[ray_index]);
42  PathRadiance *L = &kernel_split_state.path_radiance[ray_index];
43  ccl_global PathState *state = &kernel_split_state.path_state[ray_index];
44  float3 throughput = kernel_split_state.throughput[ray_index];
45 
46 #ifdef __BRANCHED_PATH__
47  if (!kernel_data.integrator.branched ||
48  IS_FLAG(kernel_split_state.ray_state, ray_index, RAY_BRANCHED_INDIRECT)) {
49 #endif
50  kernel_path_ao(kg, sd, emission_sd, L, state, throughput, shader_bsdf_alpha(kg, sd));
51 #ifdef __BRANCHED_PATH__
52  }
53  else {
54  kernel_branched_path_ao(kg, sd, emission_sd, L, state, throughput);
55  }
56 #endif
57 }
58 
#define kernel_data
#define ccl_global_id(d)
#define ccl_global_size(d)
#define ccl_device
#define ccl_global
#define CCL_NAMESPACE_END
ccl_device_noinline void kernel_path_ao(KernelGlobals *kg, ShaderData *sd, ShaderData *emission_sd, PathRadiance *L, ccl_addr_space PathState *state, float3 throughput, float3 ao_alpha)
Definition: kernel_path.h:329
ccl_device int get_ray_index(KernelGlobals *kg, int thread_index, int queue_number, ccl_global int *queues, int queuesize, int empty_queue)
Definition: kernel_queues.h:53
ccl_device float3 shader_bsdf_alpha(KernelGlobals *kg, ShaderData *sd)
CCL_NAMESPACE_BEGIN ccl_device void kernel_shadow_blocked_ao(KernelGlobals *kg)
#define kernel_split_params
#define kernel_split_sd(sd, ray_index)
#define kernel_split_state
#define IS_FLAG(ray_state, ray_index, flag)
#define AS_SHADER_DATA(shader_data_tiny_storage)
ShaderData
#define QUEUE_EMPTY_SLOT
@ RAY_BRANCHED_INDIRECT
@ QUEUE_SHADOW_RAY_CAST_AO_RAYS
static ulong state[N]
#define L
#define CCL_LOCAL_MEM_FENCE
Definition: util_atomic.h:32
#define ccl_barrier(flags)
Definition: util_atomic.h:33