Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qwindowsd3d11texturebridge_p.h
Go to the documentation of this file.
1
// Copyright (C) 2026 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
#
ifndef
QWINDOWSD3D11TEXTUREBRIDGE_P_H
4
#
define
QWINDOWSD3D11TEXTUREBRIDGE_P_H
5
6
//
7
// W A R N I N G
8
// -------------
9
//
10
// This file is not part of the Qt API. It exists purely as an
11
// implementation detail. This header file may change from version to
12
// version without notice, or even be removed.
13
//
14
// We mean it.
15
//
16
17
#
include
<
QtMultimedia
/
qtmultimediaexports
.
h
>
18
19
#
include
<
QtCore
/
qsize
.
h
>
20
#
include
<
QtCore
/
private
/
qcomptr_p
.
h
>
21
#
include
<
QtCore
/
private
/
quniquehandle_types_p
.
h
>
22
23
#
include
<
d3d11
.
h
>
24
#
include
<
d3d11_1
.
h
>
25
26
QT_BEGIN_NAMESPACE
27
28
namespace
QtMultimediaPrivate
{
29
30
/*! \internal Utility class for synchronized transfer of a texture between two D3D devices
31
*
32
* This class is used to copy a texture from one device to another device. This
33
* is implemented using a shared texture, along with keyed mutexes to synchronize
34
* access to the texture.
35
*
36
* This is needed because the source and destination may use different D3D devices,
37
* for example when copying a decoded frame owned by FFmpeg or the Windows Media
38
* Foundation media engine into a texture usable by RHI.
39
*/
40
class
Q_MULTIMEDIA_EXPORT QWindowsD3D11TextureBridge
final
41
{
42
public
:
43
/** Copy a texture slice at position 'index' belonging to device 'dev'
44
* into a shared texture, limiting the texture size to the frame size */
45
bool
copyToSharedTex
(
ID3D11Device
*,
ID3D11DeviceContext
*,
const
ComPtr
<
ID3D11Texture2D
> &,
46
const
QSize
&
frameSize
,
UINT
index
= 0);
47
bool
copyToSharedTex
(
const
ComPtr
<
ID3D11Device
> &,
const
ComPtr
<
ID3D11DeviceContext
> &,
48
const
ComPtr
<
ID3D11Texture2D
> &,
const
QSize
&
frameSize
,
UINT
index
= 0);
49
50
// Obtain a copy of the texture on a second device.
51
ComPtr
<
ID3D11Texture2D
>
copyFromSharedTex
(
const
ComPtr
<
ID3D11Device1
> &,
52
const
ComPtr
<
ID3D11DeviceContext
> &);
53
54
// Obtain a copy of the texture on a second device into a caller-provided destination texture.
55
bool
copyFromSharedTex
(
const
ComPtr
<
ID3D11Device1
> &,
const
ComPtr
<
ID3D11DeviceContext
> &,
56
const
ComPtr
<
ID3D11Texture2D
> &
destination
);
57
58
private
:
59
bool
ensureDestTex
(
const
ComPtr
<
ID3D11Device1
> &
dev
);
60
bool
ensureSrcTex
(
ID3D11Device
*
dev
,
const
ComPtr
<
ID3D11Texture2D
> &
tex
,
61
const
QSize
&
frameSize
);
62
bool
isSrcInitialized
(
const
ID3D11Device
*
dev
,
const
ComPtr
<
ID3D11Texture2D
> &
tex
,
63
const
QSize
&
frameSize
)
const
;
64
bool
recreateSrc
(
ID3D11Device
*
dev
,
const
ComPtr
<
ID3D11Texture2D
> &
tex
,
const
QSize
&
frameSize
);
65
66
QUniqueWin32NullHandle
m_sharedHandle
{};
67
68
static
constexpr
UINT
kSrcKey
= 0;
69
static
constexpr
UINT
kDestKey
= 1;
70
71
ComPtr
<
ID3D11Texture2D
>
m_srcTex
;
72
ComPtr
<
IDXGIKeyedMutex
>
m_srcMutex
;
73
74
ComPtr
<
ID3D11Device1
>
m_destDevice
;
75
ComPtr
<
ID3D11Texture2D
>
m_destTex
;
76
ComPtr
<
IDXGIKeyedMutex
>
m_destMutex
;
77
78
ComPtr
<
ID3D11Texture2D
>
m_outputTex
;
79
};
80
81
}
// namespace QtMultimediaPrivate
82
83
QT_END_NAMESPACE
84
85
#
endif
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
QtMultimediaPrivate::impl
Definition
qaudiosystem_p.h:257
QtMultimediaPrivate::kMutexTimeoutMs
static constexpr DWORD kMutexTimeoutMs
Definition
qwindowsd3d11texturebridge.cpp:21
qtmultimedia
src
multimedia
windows
qwindowsd3d11texturebridge_p.h
Generated on
for Qt by
1.16.1