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
qwindowsd3d11planesplitter_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
QWINDOWSD3D11PLANESPLITTER_P_H
4
#
define
QWINDOWSD3D11PLANESPLITTER_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
#
include
<
QtMultimedia
/
qvideoframeformat
.
h
>
19
20
#
include
<
QtCore
/
qsize
.
h
>
21
#
include
<
QtCore
/
private
/
qcomptr_p
.
h
>
22
23
#
include
<
d3d11
.
h
>
24
25
#
include
<
memory
>
26
#
include
<
optional
>
27
#
include
<
utility
>
28
#
include
<
vector
>
29
30
QT_BEGIN_NAMESPACE
31
32
namespace
QtMultimediaPrivate
{
33
34
/*! \internal
35
Splits one array slice of a multi-planar D3D11 texture (NV12, P010) into one single-plane
36
texture per plane, cropped to a given frame size, for import into single-plane-only QRhi
37
backends. Planes are copied with a texel-fetch shader because D3D11 rejects direct copies
38
between planar and single-channel formats. Instances are bound to one device: create them
39
with create(), which returns null if the shaders cannot be created.
40
*/
41
class
Q_MULTIMEDIA_EXPORT
QWindowsD3D11PlaneSplitter
42
{
43
public
:
44
~
QWindowsD3D11PlaneSplitter
();
45
46
static
std
::
unique_ptr
<
QWindowsD3D11PlaneSplitter
>
create
(
ID3D11Device
*
device
);
47
48
static
bool
isPixelFormatSupported
(
QVideoFrameFormat
::
PixelFormat
);
49
Q_DISABLE_COPY_MOVE
(
QWindowsD3D11PlaneSplitter
)
50
51
struct
Plane
52
{
53
ComPtr
<
ID3D11Texture2D
>
texture
;
54
QSize
size
;
55
};
56
57
// Splits slice 'subresourceIndex' of 'texture' into one texture per plane, cropped to 'frameSize'
58
std
::
optional
<
std
::
vector
<
Plane
>>
split
(
ID3D11Device
*,
ID3D11DeviceContext
*,
59
const
ComPtr
<
ID3D11Texture2D
> &
texture
,
60
UINT
subresourceIndex
,
const
QSize
&
frameSize
,
61
QVideoFrameFormat
::
PixelFormat
pixelFormat
);
62
63
private
:
64
QWindowsD3D11PlaneSplitter
();
65
66
bool
createPipeline
(
ID3D11Device
*
device
);
67
68
// Returns 'texture' itself when it has shader access, otherwise a cached internal copy.
69
std
::
pair
<
ComPtr
<
ID3D11Texture2D
>,
UINT
>
70
shaderReadableTexture
(
ID3D11Device
*
device
,
ID3D11DeviceContext
*
context
,
71
const
ComPtr
<
ID3D11Texture2D
> &
texture
,
UINT
subresourceIndex
);
72
73
ComPtr
<
ID3D11Device
>
m_shaderDevice
;
// device the shaders below were created for
74
ComPtr
<
ID3D11VertexShader
>
m_vs
;
75
ComPtr
<
ID3D11PixelShader
>
m_ps
;
76
77
// Reused across frames; recreated when the device, format or size of the source changes.
78
ComPtr
<
ID3D11Texture2D
>
m_shaderReadableCopy
;
79
};
80
81
}
// namespace QtMultimediaPrivate
82
83
QT_END_NAMESPACE
84
85
#
endif
// QWINDOWSD3D11PLANESPLITTER_P_H
QtMultimediaPrivate::QWindowsD3D11PlaneSplitter
Definition
qwindowsd3d11planesplitter_p.h:42
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
QtMultimediaPrivate::impl
Definition
qaudiosystem_p.h:257
qtmultimedia
src
multimedia
windows
qwindowsd3d11planesplitter_p.h
Generated on
for Qt by
1.16.1