Blender V5.0
hydra/display_driver.h
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2022 NVIDIA Corporation
2 * SPDX-FileCopyrightText: 2022 Blender Foundation
3 *
4 * SPDX-License-Identifier: Apache-2.0 */
5
6#pragma once
7
8#include "hydra/config.h"
10#include "util/thread.h"
11
12#include <pxr/imaging/hgi/hgi.h>
13#include <pxr/imaging/hgi/texture.h>
14
16
17class HdCyclesDisplayDriver final : public CCL_NS::DisplayDriver {
18 public:
19 HdCyclesDisplayDriver(HdCyclesSession *renderParam, Hgi *hgi);
20 ~HdCyclesDisplayDriver() override;
21
22 private:
23 void next_tile_begin() override;
24
25 bool update_begin(const Params &params,
26 const int texture_width,
27 const int texture_height) override;
28 void update_end() override;
29
30 void flush() override;
31
32 CCL_NS::half4 *map_texture_buffer() override;
33 void unmap_texture_buffer() override;
34
35 GraphicsInteropDevice graphics_interop_get_device() override;
36 void graphics_interop_update_buffer() override;
37
38 void graphics_interop_activate() override;
39 void graphics_interop_deactivate() override;
40
41 void zero() override;
42
43 void draw(const Params &params) override;
44
45 void gl_context_create();
46 bool gl_context_enable();
47 void gl_context_disable();
48 void gl_context_dispose();
49
50 HdCyclesSession *const _renderParam;
51 Hgi *const _hgi;
52
53#ifdef _WIN32
54 void *hdc_ = nullptr;
55 void *gl_context_ = nullptr;
56#endif
57 CCL_NS::thread_mutex mutex_;
58
59 PXR_NS::HgiTextureHandle texture_;
60 unsigned int gl_pbo_id_ = 0;
61 CCL_NS::int2 pbo_size_ = CCL_NS::make_int2(0, 0);
62 bool need_update_ = false;
63 std::atomic_bool need_zero_ = false;
64 std::atomic_bool need_recreate_interop_ = false;
65
66 void *gl_render_sync_ = nullptr;
67 void *gl_upload_sync_ = nullptr;
68};
69
#define final(a, b, c)
Definition BLI_hash.h:19
HdCyclesDisplayDriver(HdCyclesSession *renderParam, Hgi *hgi)
#define HDCYCLES_NAMESPACE_CLOSE_SCOPE
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]