Blender  V3.3
kernel/osl/background.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  *
3  * Adapted from Open Shading Language
4  * Copyright (c) 2009-2010 Sony Pictures Imageworks Inc., et al.
5  * All Rights Reserved.
6  *
7  * Modifications Copyright 2011-2022 Blender Foundation. */
8 
9 #include <OpenImageIO/fmath.h>
10 
11 #include <OSL/genclosure.h>
12 
13 #include "kernel/osl/closures.h"
14 
15 // clang-format off
17 #include "kernel/closure/alloc.h"
19 // clang-format on
20 
22 
23 using namespace OSL;
24 
32  public:
33  void setup(ShaderData *sd, uint32_t /* path_flag */, float3 weight)
34  {
35  background_setup(sd, weight);
36  }
37 };
38 
47  public:
48  void setup(ShaderData *sd, uint32_t /* path_flag */, float3 weight)
49  {
50  closure_alloc(sd, sizeof(ShaderClosure), CLOSURE_HOLDOUT_ID, weight);
51  sd->flag |= SD_HOLDOUT;
52  }
53 };
54 
56 {
57  static ClosureParam params[] = {
58  CLOSURE_STRING_KEYPARAM(GenericBackgroundClosure, label, "label"),
59  CLOSURE_FINISH_PARAM(GenericBackgroundClosure)};
60  return params;
61 }
62 
64 
65 ClosureParam *closure_holdout_params()
66 {
67  static ClosureParam params[] = {CLOSURE_FINISH_PARAM(HoldoutClosure)};
68  return params;
69 }
70 
72 
CCL_NAMESPACE_BEGIN ccl_device ccl_private ShaderClosure * closure_alloc(ccl_private ShaderData *sd, int size, ClosureType type, float3 weight)
Definition: alloc.h:8
void setup(ShaderData *sd, uint32_t, float3 weight)
void setup(ShaderData *sd, uint32_t, float3 weight)
#define CCLOSURE_PREPARE(name, classname)
Definition: closures.h:70
void closure_background_prepare(OSL::RendererServices *, int id, void *data)
void closure_holdout_prepare(OSL::RendererServices *, int id, void *data)
#define CCL_NAMESPACE_END
Definition: cuda/compat.h:9
const char * label
CCL_NAMESPACE_BEGIN ccl_device void background_setup(ccl_private ShaderData *sd, const float3 weight)
Definition: emissive.h:15
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]
ClosureParam * closure_holdout_params()
ClosureParam * closure_background_params()
@ CLOSURE_HOLDOUT_ID
@ SD_HOLDOUT
Definition: kernel/types.h:748
ShaderData
Definition: kernel/types.h:925
ShaderClosure
Definition: kernel/types.h:726
unsigned int uint32_t
Definition: stdint.h:80