Loading...
Searching...
No Matches
oitBufferAccessor.h
1//
2// Copyright 2019 Pixar
3//
4// Licensed under the terms set forth in the LICENSE.txt file available at
5// https://openusd.org/license.
6//
7#ifndef PXR_IMAGING_HDX_OIT_BUFFER_ACCESSOR_H
8#define PXR_IMAGING_HDX_OIT_BUFFER_ACCESSOR_H
9
10#include "pxr/pxr.h"
11#include "pxr/imaging/hdx/api.h"
12#include "pxr/imaging/hdx/version.h"
13
14#include "pxr/imaging/hd/task.h"
15
16#include "pxr/base/gf/vec2i.h"
17
18#include <memory>
19
20PXR_NAMESPACE_OPEN_SCOPE
21
22class Hgi;
23class HdRenderIndex;
24
25using HdBufferArrayRangeSharedPtr =
26 std::shared_ptr<class HdBufferArrayRange>;
27
28using HdStRenderPassShaderSharedPtr =
29 std::shared_ptr<class HdStRenderPassShader>;
30
33public:
34 HDX_API
35 static bool IsOitEnabled();
36
37 // This method helps improve the footprint of the OIT buffers by packing the
38 // color, transmission and depth into smaller buffers. This follows the
39 // theory in https://interplayoflight.wordpress.com/2022/06/25/order-independent-transparency-part-1/
40 // This compression results in a 4x reduction in the memory footprint of the
41 // OIT buffers at the cost of accuracy.
42 HDX_API
43 static bool IsOitPackedDepthEnabled();
44
45 HDX_API
46 HdxOitBufferAccessor(HdTaskContext *ctx);
47
49 HDX_API
51
54 HDX_API
56
61 HDX_API
63 GfVec2i const &screenSize,
64 GfVec2i *prevScreenSize);
65
67 HDX_API
69
73 HDX_API
74 bool AddOitBufferBindings(const HdStRenderPassShaderSharedPtr &);
75
76private:
77 HdBufferArrayRangeSharedPtr const &_GetBar(const TfToken &);
78
79 HdTaskContext * const _ctx;
80};
81
82PXR_NAMESPACE_CLOSE_SCOPE
83
84#endif
Basic type for a vector of 2 int components.
Definition vec2i.h:44
The render index is part of the Hydra 1.0 API and is only used for emulation purposes so that HdScene...
Class for OIT render tasks to access the OIT buffers.
HDX_API void InitializeOitBuffersIfNecessary(Hgi *hgi)
Called during Excecute before writing to OIT buffers.
HDX_API bool ResizeOitBuffersIfNecessary(HdRenderIndex *renderIndex, GfVec2i const &screenSize, GfVec2i *prevScreenSize)
Called during Prepare (by OitResolveTask) to grow OIT bars to fit the current screen.
HDX_API void RequestOitBuffers()
Called during Prepare to indicate that OIT buffers are needed.
HDX_API void AllocateOitBuffersIfNecessary(HdRenderIndex *renderIndex)
Called during Prepare to allocate OIT bars if not yet in context.
HDX_API bool AddOitBufferBindings(const HdStRenderPassShaderSharedPtr &)
Called during Execute to add necessary OIT buffer shader bindings.
Hydra Graphics Interface.
Definition hgi.h:95
Token for efficient comparison, assignment, and hashing of known strings.
Definition token.h:81