forked from KhronosGroup/ANARI-SDK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
renderBuffer.h
64 lines (47 loc) · 1.68 KB
/
renderBuffer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Copyright 2024 The Khronos Group
// SPDX-License-Identifier: Apache-2.0
#pragma once
#include "hdAnariTypes.h"
// pxr
#include <pxr/imaging/hd/renderBuffer.h>
#include <pxr/pxr.h>
PXR_NAMESPACE_OPEN_SCOPE
struct HdAnariRenderBuffer : public HdRenderBuffer
{
HdAnariRenderBuffer(SdfPath const &id);
~HdAnariRenderBuffer() override = default;
bool Allocate(
const GfVec3i &dimensions, HdFormat format, bool multiSampled) override;
unsigned int GetWidth() const override;
unsigned int GetHeight() const override;
unsigned int GetDepth() const override;
HdFormat GetFormat() const override;
bool IsMultiSampled() const override;
void Resolve() override;
void *Map() override;
void Unmap() override;
bool IsMapped() const override;
bool IsConverged() const override;
void SetConverged(bool cv);
void CopyFromAnariFrame(anari::Device d,
anari::Frame f,
const TfToken &aovName,
const VtValue &clearValue);
void Clear(const VtValue &clearValue);
private:
// ---------------------------------------------------------------------- //
/// \name I/O helpers
// ---------------------------------------------------------------------- //
void Write(const GfVec3i &pixel, size_t numComponents, float const *value);
void Write(const GfVec3i &pixel, size_t numComponents, int const *value);
void Clear(size_t numComponents, float const *value);
void Clear(size_t numComponents, int const *value);
void _Deallocate() override;
unsigned int _width{0};
unsigned int _height{0};
HdFormat _format{HdFormatInvalid};
std::vector<uint8_t> _buffer;
std::atomic<int> _mappers{0};
std::atomic<bool> _converged{false};
};
PXR_NAMESPACE_CLOSE_SCOPE