Blender  V3.3
render_buffer.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: Apache-2.0
2  * Copyright 2022 NVIDIA Corporation
3  * Copyright 2022 Blender Foundation */
4 
5 #pragma once
6 
7 #include "hydra/config.h"
8 
9 #include <pxr/imaging/hd/renderBuffer.h>
10 
12 
13 class HdCyclesRenderBuffer final : public PXR_NS::HdRenderBuffer {
14  public:
15  HdCyclesRenderBuffer(const PXR_NS::SdfPath &bprimId);
16  ~HdCyclesRenderBuffer() override;
17 
18  void Finalize(PXR_NS::HdRenderParam *renderParam) override;
19 
20  bool Allocate(const PXR_NS::GfVec3i &dimensions,
21  PXR_NS::HdFormat format,
22  bool multiSampled) override;
23 
24  unsigned int GetWidth() const override
25  {
26  return _width;
27  }
28 
29  unsigned int GetHeight() const override
30  {
31  return _height;
32  }
33 
34  unsigned int GetDepth() const override
35  {
36  return 1u;
37  }
38 
39  PXR_NS::HdFormat GetFormat() const override
40  {
41  return _format;
42  }
43 
44  bool IsMultiSampled() const override
45  {
46  return false;
47  }
48 
49  void *Map() override;
50 
51  void Unmap() override;
52 
53  bool IsMapped() const override;
54 
55  void Resolve() override;
56 
57  bool IsConverged() const override;
58 
59  void SetConverged(bool converged);
60 
61  bool IsResourceUsed() const;
62 
63  PXR_NS::VtValue GetResource(bool multiSampled = false) const override;
64 
65  void SetResource(const PXR_NS::VtValue &resource);
66 
67  void WritePixels(const float *pixels,
68  const PXR_NS::GfVec2i &offset,
69  const PXR_NS::GfVec2i &dims,
70  int channels,
71  bool isId = false);
72 
73  private:
74  void _Deallocate() override;
75 
76  unsigned int _width = 0u;
77  unsigned int _height = 0u;
78  PXR_NS::HdFormat _format = PXR_NS::HdFormatInvalid;
79  size_t _dataSize = 0;
80 
81  std::vector<uint8_t> _data;
82  PXR_NS::VtValue _resource;
83  mutable std::atomic_bool _resourceUsed = false;
84 
85  std::atomic_int _mapped = 0;
86  std::atomic_bool _converged = false;
87 };
88 
#define final(a, b, c)
Definition: BLI_hash.h:21
Group Output data from inside of a node group A color picker Mix two input colors RGB to Convert a color s luminance to a grayscale value Generate a normal vector and a dot product Bright Control the brightness and contrast of the input color Vector Map an input vectors to used to fine tune the interpolation of the input Camera Retrieve information about the camera and how it relates to the current shading point s position Clamp a value between a minimum and a maximum Vector Perform vector math operation Invert a producing a negative Combine Generate a color from its and blue channels(Deprecated)") DefNode(ShaderNode
bool IsConverged() const override
void Resolve() override
void SetConverged(bool converged)
HdCyclesRenderBuffer(const PXR_NS::SdfPath &bprimId)
bool IsResourceUsed() const
unsigned int GetWidth() const override
Definition: render_buffer.h:24
bool IsMultiSampled() const override
Definition: render_buffer.h:44
bool Allocate(const PXR_NS::GfVec3i &dimensions, PXR_NS::HdFormat format, bool multiSampled) override
unsigned int GetHeight() const override
Definition: render_buffer.h:29
~HdCyclesRenderBuffer() override
bool IsMapped() const override
void SetResource(const PXR_NS::VtValue &resource)
void Unmap() override
PXR_NS::HdFormat GetFormat() const override
Definition: render_buffer.h:39
void * Map() override
void Finalize(PXR_NS::HdRenderParam *renderParam) override
unsigned int GetDepth() const override
Definition: render_buffer.h:34
void WritePixels(const float *pixels, const PXR_NS::GfVec2i &offset, const PXR_NS::GfVec2i &dims, int channels, bool isId=false)
PXR_NS::VtValue GetResource(bool multiSampled=false) const override
#define HDCYCLES_NAMESPACE_CLOSE_SCOPE
Definition: hydra/config.h:17
ccl_gpu_kernel_postfix ccl_global float int int int int float bool int offset
bool converged
format
Definition: logImageCore.h:38