16template<const
bool shadow,
typename IntegratorGenericState>
20 if constexpr (shadow) {
21 return integrator_state_read_shadow_volume_stack(
state, i);
24 return integrator_state_read_volume_stack(
state, i);
29 VolumeStack stack = {};
34template<const
bool shadow,
typename IntegratorGenericState>
37 const VolumeStack entry)
39 if constexpr (shadow) {
40 integrator_state_write_shadow_volume_stack(
state, i, entry);
43 integrator_state_write_volume_stack(
state, i, entry);
47template<const
bool shadow,
typename IntegratorGenericState>
61 volume_stack_write<shadow>(
state, exit_i, volume_stack_read<shadow>(
state, i));
68template<const
bool shadow,
typename IntegratorGenericState>
70 IntegratorGenericState
state,
73# ifdef __KERNEL_USE_DATA_CONSTANTS__
91 for (
int i = 0;; i++) {
92 const VolumeStack entry = volume_stack_read<shadow>(
state, i);
97 if (entry.object == sd->object && entry.shader == sd->shader) {
98 volume_stack_exit<shadow>(
state, i);
107 const VolumeStack entry = volume_stack_read<shadow>(
state, i);
113 if (entry.object == sd->object && entry.shader == sd->shader) {
124 const VolumeStack new_entry = {sd->object, sd->shader};
126 volume_stack_write<shadow>(
state, i, new_entry);
127 volume_stack_write<shadow>(
state, i + 1, empty_entry);
168 const int object = entry.object;
169 if (
object ==
kernel_data.background.object_index) {
184template<const
bool shadow,
typename IntegratorGenericState>
187 for (
int i = 0;; i++) {
188 const VolumeStack entry = volume_stack_read<shadow>(
state, i);
194 if (!volume_is_homogeneous(kg, entry)) {
203template<const
bool shadow,
typename IntegratorGenericState>
210 for (
int i = 0;; i++) {
211 const VolumeStack entry = volume_stack_read<shadow>(
state, i);
216 if (!volume_is_homogeneous(kg, entry)) {
217 const float object_step_size =
kernel_data_fetch(volume_step_size, entry.object);
218 step_size =
fminf(object_step_size, step_size);
225enum VolumeSampleMethod {
226 VOLUME_SAMPLE_NONE = 0,
227 VOLUME_SAMPLE_DISTANCE = (1 << 0),
228 VOLUME_SAMPLE_EQUIANGULAR = (1 << 1),
229 VOLUME_SAMPLE_MIS = (VOLUME_SAMPLE_DISTANCE | VOLUME_SAMPLE_EQUIANGULAR),
234 VolumeSampleMethod method = VOLUME_SAMPLE_NONE;
236 for (
int i = 0;; i++) {
237 VolumeStack entry = integrator_state_read_volume_stack(
state, i);
246 return VOLUME_SAMPLE_MIS;
250 if (method == VOLUME_SAMPLE_DISTANCE) {
251 return VOLUME_SAMPLE_MIS;
255 method = VOLUME_SAMPLE_EQUIANGULAR;
259 if (method == VOLUME_SAMPLE_EQUIANGULAR) {
260 return VOLUME_SAMPLE_MIS;
264 method = VOLUME_SAMPLE_DISTANCE;
#define kernel_assert(cond)
#define KERNEL_FEATURE_VOLUME
#define ccl_device_forceinline
#define kernel_data_fetch(name, index)
#define ccl_device_inline
#define CCL_NAMESPACE_END
@ SD_NEED_VOLUME_ATTRIBUTES
@ SD_HETEROGENEOUS_VOLUME
@ SD_OBJECT_HAS_VOLUME_ATTRIBUTES
#define INTEGRATOR_STATE_ARRAY_WRITE(state, nested_struct, array_index, member)
IntegratorStateCPU * IntegratorState