Blender  V2.93
kernel_lamp_emission.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 /* This kernel operates on QUEUE_ACTIVE_AND_REGENERATED_RAYS.
20  * It processes rays of state RAY_ACTIVE and RAY_HIT_BACKGROUND.
21  * We will empty QUEUE_ACTIVE_AND_REGENERATED_RAYS queue in this kernel.
22  */
23 ccl_device void kernel_lamp_emission(KernelGlobals *kg)
24 {
25 #ifndef __VOLUME__
26  /* We will empty this queue in this kernel. */
27  if (ccl_global_id(0) == 0 && ccl_global_id(1) == 0) {
29  }
30 #endif
31  /* Fetch use_queues_flag. */
32  char local_use_queues_flag = *kernel_split_params.use_queues_flag;
34 
35  int ray_index = ccl_global_id(1) * ccl_global_size(0) + ccl_global_id(0);
36  if (local_use_queues_flag) {
37  ray_index = get_ray_index(kg,
38  ray_index,
40  kernel_split_state.queue_data,
41  kernel_split_params.queue_size,
42 #ifndef __VOLUME__
43  1
44 #else
45  0
46 #endif
47  );
48  if (ray_index == QUEUE_EMPTY_SLOT) {
49  return;
50  }
51  }
52 
53  if (IS_STATE(kernel_split_state.ray_state, ray_index, RAY_ACTIVE) ||
54  IS_STATE(kernel_split_state.ray_state, ray_index, RAY_HIT_BACKGROUND)) {
55  PathRadiance *L = &kernel_split_state.path_radiance[ray_index];
56  ccl_global PathState *state = &kernel_split_state.path_state[ray_index];
57 
58  float3 throughput = kernel_split_state.throughput[ray_index];
59  Ray ray = kernel_split_state.ray[ray_index];
60  ccl_global Intersection *isect = &kernel_split_state.isect[ray_index];
61  ShaderData *sd = kernel_split_sd(sd, ray_index);
62 
63  kernel_path_lamp_emission(kg, state, &ray, throughput, isect, sd, L);
64  }
65 }
66 
#define ccl_global_id(d)
#define ccl_global_size(d)
#define ccl_device
#define ccl_global
#define CCL_NAMESPACE_END
CCL_NAMESPACE_BEGIN ccl_device void kernel_lamp_emission(KernelGlobals *kg)
ccl_device_forceinline void kernel_path_lamp_emission(KernelGlobals *kg, ccl_addr_space PathState *state, Ray *ray, float3 throughput, ccl_addr_space Intersection *isect, ShaderData *emission_sd, PathRadiance *L)
Definition: kernel_path.h:86
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
#define kernel_split_params
#define kernel_split_sd(sd, ray_index)
#define kernel_split_state
#define __VOLUME__
Definition: kernel_types.h:114
#define IS_STATE(ray_state, ray_index, state)
ShaderData
#define QUEUE_EMPTY_SLOT
@ RAY_HIT_BACKGROUND
@ RAY_ACTIVE
@ QUEUE_ACTIVE_AND_REGENERATED_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