Blender  V2.93
kernel_indirect_background.h
Go to the documentation of this file.
1 /*
2  * Copyright 2011-2017 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 
20 {
21  ccl_global char *ray_state = kernel_split_state.ray_state;
22 
23  int thread_index = ccl_global_id(1) * ccl_global_size(0) + ccl_global_id(0);
24  int ray_index;
25 
26  if (kernel_data.integrator.ao_bounces != INT_MAX) {
27  ray_index = get_ray_index(kg,
28  thread_index,
30  kernel_split_state.queue_data,
31  kernel_split_params.queue_size,
32  0);
33 
34  if (ray_index != QUEUE_EMPTY_SLOT) {
35  if (IS_STATE(ray_state, ray_index, RAY_ACTIVE)) {
36  ccl_global PathState *state = &kernel_split_state.path_state[ray_index];
38  kernel_split_path_end(kg, ray_index);
39  }
40  }
41  }
42  }
43 
44  ray_index = get_ray_index(kg,
45  thread_index,
47  kernel_split_state.queue_data,
48  kernel_split_params.queue_size,
49  0);
50 
51  if (ray_index == QUEUE_EMPTY_SLOT) {
52  return;
53  }
54 
55  if (IS_STATE(ray_state, ray_index, RAY_HIT_BACKGROUND)) {
56  ccl_global PathState *state = &kernel_split_state.path_state[ray_index];
57  PathRadiance *L = &kernel_split_state.path_radiance[ray_index];
58  ccl_global Ray *ray = &kernel_split_state.ray[ray_index];
59  float3 throughput = kernel_split_state.throughput[ray_index];
60  ShaderData *sd = kernel_split_sd(sd, ray_index);
61  uint buffer_offset = kernel_split_state.buffer_offset[ray_index];
62  ccl_global float *buffer = kernel_split_params.tile.buffer + buffer_offset;
63 
64  kernel_path_background(kg, state, ray, throughput, sd, buffer, L);
65  kernel_split_path_end(kg, ray_index);
66  }
67 }
68 
unsigned int uint
Definition: BLI_sys_types.h:83
#define kernel_data
#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_indirect_background(KernelGlobals *kg)
ccl_device_forceinline void kernel_path_background(KernelGlobals *kg, ccl_addr_space PathState *state, ccl_addr_space Ray *ray, float3 throughput, ShaderData *sd, ccl_global float *buffer, PathRadiance *L)
Definition: kernel_path.h:115
ccl_device_inline bool path_state_ao_bounce(KernelGlobals *kg, ccl_addr_space PathState *state)
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_NAMESPACE_BEGIN ccl_device_inline void kernel_split_path_end(KernelGlobals *kg, int ray_index)
#define kernel_split_params
#define kernel_split_sd(sd, ray_index)
#define kernel_split_state
__kernel void ccl_constant KernelData ccl_global void ccl_global char ccl_global int ccl_global char ccl_global unsigned int ccl_global float * buffer
__kernel void ccl_constant KernelData ccl_global void ccl_global char * ray_state
#define IS_STATE(ray_state, ray_index, state)
ShaderData
#define QUEUE_EMPTY_SLOT
@ RAY_HIT_BACKGROUND
@ RAY_ACTIVE
@ QUEUE_HITBG_BUFF_UPDATE_TOREGEN_RAYS
@ QUEUE_ACTIVE_AND_REGENERATED_RAYS
static ulong state[N]
#define L