Blender V5.0
GHOST_ContextD3D.hh
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2014-2023 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#pragma once
10
11#ifndef WIN32
12# error WIN32 only!
13#endif // WIN32
14
15#include <D3D11.h>
16
17#include "GHOST_Context.hh"
18
20 /* XR code needs low level graphics data to send to OpenXR. */
24
25 public:
26 GHOST_ContextD3D(const GHOST_ContextParams &context_params, HWND hWnd);
27 ~GHOST_ContextD3D() override;
28
31 {
32 return GHOST_kSuccess;
33 }
34
40
46
52
58
65 {
66 return GHOST_kFailure;
67 }
68
74
80 GHOST_TSuccess setSwapInterval(int /*interval*/) override
81 {
82 return GHOST_kFailure;
83 }
84
90 GHOST_TSuccess getSwapInterval(int & /*unused*/) override
91 {
92 return GHOST_kFailure;
93 }
94
99 unsigned int getDefaultFramebuffer() override
100 {
101 return 0;
102 }
103
105 unsigned int width,
106 unsigned int height,
107 DXGI_FORMAT format,
108 ID3D11RenderTargetView *render_target);
110 unsigned int height,
111 DXGI_FORMAT format);
114 unsigned int width,
115 unsigned int height);
116 ID3D11Texture2D *getSharedTexture2D(class GHOST_SharedOpenGLResource *shared_res);
117
118 bool isUpsideDown() const override
119 {
120 return true;
121 }
122
123 private:
124 GHOST_TSuccess setupD3DLib();
125
126 static HMODULE s_d3d_lib;
127 static PFN_D3D11_CREATE_DEVICE s_D3D11CreateDeviceFn;
128
129 HWND h_wnd_;
130
131 ID3D11Device *device_;
132 ID3D11DeviceContext *device_ctx_;
133};
GHOST_TSuccess
Definition GHOST_Types.h:57
@ GHOST_kFailure
Definition GHOST_Types.h:57
@ GHOST_kSuccess
Definition GHOST_Types.h:57
GHOST_TSuccess activateDrawingContext() override
GHOST_ContextD3D(const GHOST_ContextParams &context_params, HWND hWnd)
GHOST_TSuccess initializeDrawingContext() override
friend class GHOST_XrGraphicsBindingOpenGLD3D
friend class GHOST_XrGraphicsBindingD3D
~GHOST_ContextD3D() override
GHOST_TSuccess getSwapInterval(int &) override
friend class GHOST_XrGraphicsBindingVulkanD3D
GHOST_TSuccess releaseDrawingContext() override
bool isUpsideDown() const override
GHOST_TSuccess blitFromOpenGLContext(class GHOST_SharedOpenGLResource *shared_res, unsigned int width, unsigned int height)
ID3D11Texture2D * getSharedTexture2D(class GHOST_SharedOpenGLResource *shared_res)
GHOST_TSuccess setSwapInterval(int) override
class GHOST_SharedOpenGLResource * createSharedOpenGLResource(unsigned int width, unsigned int height, DXGI_FORMAT format, ID3D11RenderTargetView *render_target)
void disposeSharedOpenGLResource(class GHOST_SharedOpenGLResource *shared_res)
GHOST_TSuccess releaseNativeHandles() override
unsigned int getDefaultFramebuffer() override
GHOST_TSuccess swapBufferRelease() override
GHOST_TSuccess swapBufferAcquire() override
GHOST_TSuccess updateDrawingContext() override
GHOST_Context(const GHOST_ContextParams &context_params)
format