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
qwindowsd3d11texturereadback.cpp
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
5
6#include <QtCore/qloggingcategory.h>
7#include <QtCore/private/qsystemerror_p.h>
8
10
11namespace QtMultimediaPrivate {
12
13namespace {
14Q_LOGGING_CATEGORY(lcD3D11TextureReadback, "qt.multimedia.windows.d3d11texturereadback");
15}
16
20{
23
24 if (m_mapped)
25 return {};
26
28
32 desc.BindFlags = 0;
34 desc.MiscFlags = 0;
35
36 if (const HRESULT hr = device->CreateTexture2D(&desc, nullptr, &m_stagingTex); FAILED(hr)) {
38 << "CreateTexture2D failed:" << QSystemError::windowsComString(hr);
39 return {};
40 }
41
43
46 FAILED(hr)) {
50 return {};
51 }
52
53 m_mapped = true;
54
56 data.planeCount = 1;
57 data.bytesPerLine[0] = static_cast<int>(mapped.RowPitch);
58 data.data[0] = static_cast<uchar *>(mapped.pData);
59 data.dataSize[0] = static_cast<int>(mapped.RowPitch) * frameSize.height();
60 return data;
61}
62
64{
65 if (!m_mapped)
66 return;
67
71 m_mapped = false;
72}
73
74} // namespace QtMultimediaPrivate
75
76QT_END_NAMESPACE
Combined button and popup list for selecting options.