Blender V4.3
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);
21
22 private:
23 void next_tile_begin() override;
24
25 bool update_begin(const Params &params, int texture_width, int texture_height) override;
26 void update_end() override;
27
28 void flush() override;
29
30 CCL_NS::half4 *map_texture_buffer() override;
31 void unmap_texture_buffer() override;
32
33 GraphicsInterop graphics_interop_get() override;
34
35 void graphics_interop_activate() override;
36 void graphics_interop_deactivate() override;
37
38 void clear() override;
39
40 void draw(const Params &params) override;
41
42 void gl_context_create();
43 bool gl_context_enable();
44 void gl_context_disable();
45 void gl_context_dispose();
46
47 HdCyclesSession *const _renderParam;
48 Hgi *const _hgi;
49
50#ifdef _WIN32
51 void *hdc_ = nullptr;
52 void *gl_context_ = nullptr;
53#endif
54 CCL_NS::thread_mutex mutex_;
55
56 PXR_NS::HgiTextureHandle texture_;
57 unsigned int gl_pbo_id_ = 0;
58 CCL_NS::int2 pbo_size_ = CCL_NS::make_int2(0, 0);
59 bool need_update_ = false;
60 std::atomic_bool need_clear_ = false;
61
62 void *gl_render_sync_ = nullptr;
63 void *gl_upload_sync_ = nullptr;
64};
65
HdCyclesDisplayDriver(HdCyclesSession *renderParam, Hgi *hgi)
#define HDCYCLES_NAMESPACE_CLOSE_SCOPE
uiWidgetBaseParameters params[MAX_WIDGET_BASE_BATCH]