24 #ifndef PXR_IMAGING_PLUGIN_HD_EMBREE_RENDER_BUFFER_H
25 #define PXR_IMAGING_PLUGIN_HD_EMBREE_RENDER_BUFFER_H
28 #include "pxr/imaging/hd/renderBuffer.h"
33 PXR_NAMESPACE_OPEN_SCOPE
38 HdEmbreeRenderBuffer(
SdfPath const&
id);
39 ~HdEmbreeRenderBuffer();
49 HdDirtyBits *dirtyBits)
override;
67 bool multiSampled)
override;
71 virtual unsigned int GetWidth()
const override {
return _width; }
75 virtual unsigned int GetHeight()
const override {
return _height; }
79 virtual unsigned int GetDepth()
const override {
return 1; }
83 virtual HdFormat
GetFormat()
const override {
return _format; }
87 virtual bool IsMultiSampled()
const override {
return _multiSampled; }
93 virtual void*
Map()
override {
95 return _buffer.data();
99 virtual void Unmap()
override {
105 virtual bool IsMapped()
const override {
106 return _mappers.load() != 0;
113 return _converged.load();
118 void SetConverged(
bool cv) {
119 _converged.store(cv);
123 virtual void Resolve()
override;
136 void Write(
GfVec3i const& pixel,
size_t numComponents,
float const* value);
145 void Write(
GfVec3i const& pixel,
size_t numComponents,
int const* value);
153 void Clear(
size_t numComponents,
float const* value);
161 void Clear(
size_t numComponents,
int const* value);
165 static size_t _GetBufferSize(
GfVec2i const& dims, HdFormat format);
170 static HdFormat _GetSampleFormat(HdFormat format);
178 unsigned int _height;
185 std::vector<uint8_t> _buffer;
187 std::vector<uint8_t> _sampleBuffer;
189 std::vector<uint8_t> _sampleCount;
192 std::atomic<int> _mappers;
194 std::atomic<bool> _converged;
197 PXR_NAMESPACE_CLOSE_SCOPE
199 #endif // PXR_IMAGING_PLUGIN_HD_EMBREE_RENDER_BUFFER_H
Basic type for a vector of 2 int components.
virtual void Unmap()=0
Unmap the buffer. It is no longer safe to read from the buffer.
virtual bool IsMapped() const =0
Return whether the buffer is currently mapped by anybody.
The HdRenderParam is an opaque (to core Hydra) handle, to an object that is obtained from the render ...
virtual unsigned int GetWidth() const =0
Get the buffer's width.
virtual void _Deallocate()=0
Deallocate the buffer, freeing any owned resources.
Adapter class providing data exchange with the client scene graph.
virtual HD_API void Finalize(HdRenderParam *renderParam) override
Deallocate before deletion.
virtual HdFormat GetFormat() const =0
Get the buffer's per-pixel format.
Basic type for a vector of 3 int components.
A path value used to locate objects in layers or scenegraphs.
virtual bool IsConverged() const =0
Return whether the buffer is converged (whether the renderer is still adding samples or not)...
virtual unsigned int GetHeight() const =0
Get the buffer's height.
virtual unsigned int GetDepth() const =0
Get the buffer's depth.
A render buffer is a handle to a data resource that can be rendered into, such as a 2d image for a dr...
virtual void * Map()=0
Map the buffer for reading.
virtual bool Allocate(GfVec3i const &dimensions, HdFormat format, bool multiSampled)=0
Allocate a buffer.
virtual HD_API void Sync(HdSceneDelegate *sceneDelegate, HdRenderParam *renderParam, HdDirtyBits *dirtyBits) override
Get allocation information from the scene delegate.
virtual bool IsMultiSampled() const =0
Get whether the buffer is multisampled.
virtual void Resolve()=0
Resolve the buffer so that reads reflect the latest writes.