Blender V4.5
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(bool stereoVisual, HWND hWnd);
27 ~GHOST_ContextD3D() override;
28
33 GHOST_TSuccess swapBuffers() override;
34
40
46
52
59 {
60 return GHOST_kFailure;
61 }
62
68
74 GHOST_TSuccess setSwapInterval(int /*interval*/) override
75 {
76 return GHOST_kFailure;
77 }
78
84 GHOST_TSuccess getSwapInterval(int & /*unused*/) override
85 {
86 return GHOST_kFailure;
87 }
88
93 unsigned int getDefaultFramebuffer() override
94 {
95 return 0;
96 }
97
99 unsigned int width,
100 unsigned int height,
101 DXGI_FORMAT format,
102 ID3D11RenderTargetView *render_target);
104 unsigned int height,
105 DXGI_FORMAT format);
108 unsigned int width,
109 unsigned int height);
110 ID3D11Texture2D *getSharedTexture2D(class GHOST_SharedOpenGLResource *shared_res);
111
112 bool isUpsideDown() const override
113 {
114 return true;
115 }
116
117 private:
118 GHOST_TSuccess setupD3DLib();
119
120 static HMODULE s_d3d_lib;
121 static PFN_D3D11_CREATE_DEVICE s_D3D11CreateDeviceFn;
122
123 HWND m_hWnd;
124
125 ID3D11Device *m_device;
126 ID3D11DeviceContext *m_device_ctx;
127};
GHOST_TSuccess
Definition GHOST_Types.h:80
@ GHOST_kFailure
Definition GHOST_Types.h:80
GHOST_TSuccess activateDrawingContext() override
GHOST_TSuccess initializeDrawingContext() override
GHOST_TSuccess swapBuffers() override
friend class GHOST_XrGraphicsBindingOpenGLD3D
friend class GHOST_XrGraphicsBindingD3D
~GHOST_ContextD3D() override
GHOST_TSuccess getSwapInterval(int &) override
GHOST_ContextD3D(bool stereoVisual, HWND hWnd)
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 updateDrawingContext() override
GHOST_Context(bool stereoVisual)
format