winrt-Windows.Graphics.DirectX.Direct3D11.Interop 3.2.0__tar.gz → 4.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- winrt_windows_graphics_directx_direct3d11_interop-4.0.0/LICENSE +22 -0
- winrt_windows_graphics_directx_direct3d11_interop-4.0.0/MANIFEST.in +3 -0
- winrt_windows_graphics_directx_direct3d11_interop-4.0.0/PKG-INFO +39 -0
- winrt_windows_graphics_directx_direct3d11_interop-4.0.0/README.md +13 -0
- winrt_windows_graphics_directx_direct3d11_interop-4.0.0/interop.h +175 -0
- winrt_windows_graphics_directx_direct3d11_interop-4.0.0/py.Windows.Graphics.DirectX.Direct3D11.Interop.cpp +181 -0
- winrt_windows_graphics_directx_direct3d11_interop-4.0.0/pyproject.toml +54 -0
- winrt_windows_graphics_directx_direct3d11_interop-4.0.0/requirements.txt +4 -0
- {winrt_windows_graphics_directx_direct3d11_interop-3.2.0 → winrt_windows_graphics_directx_direct3d11_interop-4.0.0}/setup.py +14 -5
- winrt_windows_graphics_directx_direct3d11_interop-4.0.0/version.txt +1 -0
- winrt_windows_graphics_directx_direct3d11_interop-4.0.0/winrt/_winrt_windows_graphics_directx_direct3d11_interop.pyi +10 -0
- winrt_windows_graphics_directx_direct3d11_interop-4.0.0/winrt/windows/graphics/directx/direct3d11/interop/__init__.py +81 -0
- winrt_windows_graphics_directx_direct3d11_interop-4.0.0/winrt_Windows.Graphics.DirectX.Direct3D11.Interop.egg-info/PKG-INFO +39 -0
- {winrt_windows_graphics_directx_direct3d11_interop-3.2.0 → winrt_windows_graphics_directx_direct3d11_interop-4.0.0}/winrt_Windows.Graphics.DirectX.Direct3D11.Interop.egg-info/SOURCES.txt +6 -1
- winrt_windows_graphics_directx_direct3d11_interop-4.0.0/winrt_Windows.Graphics.DirectX.Direct3D11.Interop.egg-info/requires.txt +2 -0
- winrt_windows_graphics_directx_direct3d11_interop-3.2.0/PKG-INFO +0 -22
- winrt_windows_graphics_directx_direct3d11_interop-3.2.0/README.md +0 -7
- winrt_windows_graphics_directx_direct3d11_interop-3.2.0/py.Windows.Graphics.DirectX.Direct3D11.Interop.cpp +0 -217
- winrt_windows_graphics_directx_direct3d11_interop-3.2.0/pyproject.toml +0 -45
- winrt_windows_graphics_directx_direct3d11_interop-3.2.0/pywinrt-version.txt +0 -1
- winrt_windows_graphics_directx_direct3d11_interop-3.2.0/winrt/_winrt_windows_graphics_directx_direct3d11_interop.pyi +0 -46
- winrt_windows_graphics_directx_direct3d11_interop-3.2.0/winrt/windows/graphics/directx/direct3d11/interop/__init__.py +0 -13
- winrt_windows_graphics_directx_direct3d11_interop-3.2.0/winrt_Windows.Graphics.DirectX.Direct3D11.Interop.egg-info/PKG-INFO +0 -22
- {winrt_windows_graphics_directx_direct3d11_interop-3.2.0 → winrt_windows_graphics_directx_direct3d11_interop-4.0.0}/setup.cfg +0 -0
- {winrt_windows_graphics_directx_direct3d11_interop-3.2.0 → winrt_windows_graphics_directx_direct3d11_interop-4.0.0}/winrt/windows/graphics/directx/direct3d11/interop/py.typed +0 -0
- {winrt_windows_graphics_directx_direct3d11_interop-3.2.0 → winrt_windows_graphics_directx_direct3d11_interop-4.0.0}/winrt_Windows.Graphics.DirectX.Direct3D11.Interop.egg-info/dependency_links.txt +0 -0
- {winrt_windows_graphics_directx_direct3d11_interop-3.2.0 → winrt_windows_graphics_directx_direct3d11_interop-4.0.0}/winrt_Windows.Graphics.DirectX.Direct3D11.Interop.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4
|
+
Copyright (c) 2021-2026 David Lechner <david@pybricks.com>
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: winrt-Windows.Graphics.DirectX.Direct3D11.Interop
|
|
3
|
+
Version: 4.0.0
|
|
4
|
+
Summary: Converts between DXGI devices and surfaces and the IDirect3DDevice and IDirect3DSurface that WinRT APIs take.
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Project-URL: Documentation, https://pywinrt.readthedocs.io
|
|
7
|
+
Project-URL: Repository, https://github.com/pywinrt/pywinrt
|
|
8
|
+
Project-URL: Changelog, https://github.com/pywinrt/pywinrt/blob/main/interop/winrt-Windows.Graphics.DirectX.Direct3D11.Interop/CHANGELOG.md
|
|
9
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
16
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
17
|
+
Classifier: Intended Audience :: Developers
|
|
18
|
+
Classifier: Programming Language :: Python :: Free Threading :: 2 - Beta
|
|
19
|
+
Classifier: Typing :: Typed
|
|
20
|
+
Requires-Python: >=3.11
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: winrt-runtime<5,>=4.0.0
|
|
24
|
+
Requires-Dist: winrt-Windows.Graphics.DirectX.Direct3D11>=4!10.0.28000.2705
|
|
25
|
+
Dynamic: license-file
|
|
26
|
+
|
|
27
|
+
<!-- warning: Please don't edit this file. It was automatically generated. -->
|
|
28
|
+
|
|
29
|
+
# winrt-Windows.Graphics.DirectX.Direct3D11.Interop
|
|
30
|
+
|
|
31
|
+
Converts between DXGI devices and surfaces and the `IDirect3DDevice` and `IDirect3DSurface` that WinRT APIs take.
|
|
32
|
+
|
|
33
|
+
This package provides the `winrt.windows.graphics.directx.direct3d11.interop` module.
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
pip install winrt-Windows.Graphics.DirectX.Direct3D11.Interop
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
installs it with `winrt-Windows.Graphics.DirectX.Direct3D11`.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- warning: Please don't edit this file. It was automatically generated. -->
|
|
2
|
+
|
|
3
|
+
# winrt-Windows.Graphics.DirectX.Direct3D11.Interop
|
|
4
|
+
|
|
5
|
+
Converts between DXGI devices and surfaces and the `IDirect3DDevice` and `IDirect3DSurface` that WinRT APIs take.
|
|
6
|
+
|
|
7
|
+
This package provides the `winrt.windows.graphics.directx.direct3d11.interop` module.
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
pip install winrt-Windows.Graphics.DirectX.Direct3D11.Interop
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
installs it with `winrt-Windows.Graphics.DirectX.Direct3D11`.
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
// WARNING: Please don't edit this file. It was copied from interop/interop.h
|
|
2
|
+
// by scripts/generate-pyproject.py.
|
|
3
|
+
|
|
4
|
+
// What an interop module needs to exchange WinRT objects and errors with
|
|
5
|
+
// winrt-runtime.
|
|
6
|
+
//
|
|
7
|
+
// An interop module shares no C ABI with the runtime and includes none of its
|
|
8
|
+
// headers. A WinRT object crosses as an interface pointer capsule, which
|
|
9
|
+
// winrt.runtime.interop.as_interface() makes from a projected object and
|
|
10
|
+
// winrt.runtime.interop.wrap_interface() makes a projected object from, and a
|
|
11
|
+
// failed call raises the exception that winrt.runtime.interop.hresult_error()
|
|
12
|
+
// builds. The capsule's name and those three functions are the whole
|
|
13
|
+
// contract, so this header can change freely.
|
|
14
|
+
//
|
|
15
|
+
// scripts/generate-pyproject.py copies this file into each interop package,
|
|
16
|
+
// so that its source distribution builds on its own.
|
|
17
|
+
|
|
18
|
+
#pragma once
|
|
19
|
+
|
|
20
|
+
#include <Python.h>
|
|
21
|
+
|
|
22
|
+
#include <windows.h>
|
|
23
|
+
|
|
24
|
+
#include <oleauto.h>
|
|
25
|
+
|
|
26
|
+
#include <cstddef>
|
|
27
|
+
|
|
28
|
+
namespace interop
|
|
29
|
+
{
|
|
30
|
+
/// The name every interface pointer capsule carries, in the runtime and in
|
|
31
|
+
/// every interop module alike. One holds a reference to a COM interface,
|
|
32
|
+
/// which its destructor releases.
|
|
33
|
+
inline constexpr char interface_capsule_name[] = "winrt.interface";
|
|
34
|
+
|
|
35
|
+
/// Releases the GIL for as long as it is in scope.
|
|
36
|
+
///
|
|
37
|
+
/// A call into an object in another apartment, or one that sends a window
|
|
38
|
+
/// on another thread a message, waits for that thread, which may itself
|
|
39
|
+
/// be waiting for the GIL to run a Python handler.
|
|
40
|
+
class gil_released
|
|
41
|
+
{
|
|
42
|
+
public:
|
|
43
|
+
gil_released() noexcept : state{PyEval_SaveThread()}
|
|
44
|
+
{
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
gil_released(gil_released const&) = delete;
|
|
48
|
+
gil_released& operator=(gil_released const&) = delete;
|
|
49
|
+
|
|
50
|
+
~gil_released() noexcept
|
|
51
|
+
{
|
|
52
|
+
PyEval_RestoreThread(state);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
private:
|
|
56
|
+
PyThreadState* state;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/// The destructor of an interface pointer capsule this module made, which
|
|
60
|
+
/// may hold the last reference to the object.
|
|
61
|
+
inline void release_interface(PyObject* capsule) noexcept
|
|
62
|
+
{
|
|
63
|
+
auto const abi = PyCapsule_GetPointer(capsule, interface_capsule_name);
|
|
64
|
+
if (!abi)
|
|
65
|
+
{
|
|
66
|
+
PyErr_WriteUnraisable(capsule);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
gil_released const guard;
|
|
71
|
+
static_cast<IUnknown*>(abi)->Release();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/// Hands @p abi, and the reference that comes with it, to a new interface
|
|
75
|
+
/// pointer capsule. The reference is released if that fails.
|
|
76
|
+
inline PyObject* new_interface_capsule(IUnknown* abi) noexcept
|
|
77
|
+
{
|
|
78
|
+
auto const capsule
|
|
79
|
+
= PyCapsule_New(abi, interface_capsule_name, release_interface);
|
|
80
|
+
if (!capsule)
|
|
81
|
+
{
|
|
82
|
+
abi->Release();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return capsule;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/// Raises what winrt.runtime.interop.hresult_error() makes of @p hr and
|
|
89
|
+
/// @p info, the error info of the call that failed with it, which may be
|
|
90
|
+
/// @c nullptr. The reference to @p info moves in.
|
|
91
|
+
/// @returns nullptr, for the caller to return.
|
|
92
|
+
inline PyObject* set_hresult_error(HRESULT hr, IErrorInfo* info) noexcept
|
|
93
|
+
{
|
|
94
|
+
auto const capsule = info ? new_interface_capsule(info) : Py_NewRef(Py_None);
|
|
95
|
+
if (!capsule)
|
|
96
|
+
{
|
|
97
|
+
return nullptr;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
auto const runtime = PyImport_ImportModule("winrt.runtime.interop");
|
|
101
|
+
if (!runtime)
|
|
102
|
+
{
|
|
103
|
+
Py_DECREF(capsule);
|
|
104
|
+
return nullptr;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
auto const error = PyObject_CallMethod(
|
|
108
|
+
runtime, "hresult_error", "lO", static_cast<long>(hr), capsule);
|
|
109
|
+
Py_DECREF(runtime);
|
|
110
|
+
Py_DECREF(capsule);
|
|
111
|
+
if (!error)
|
|
112
|
+
{
|
|
113
|
+
return nullptr;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
PyErr_SetObject(reinterpret_cast<PyObject*>(Py_TYPE(error)), error);
|
|
117
|
+
Py_DECREF(error);
|
|
118
|
+
|
|
119
|
+
return nullptr;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/// Raises what winrt.runtime.interop.hresult_error() makes of @p hr and of
|
|
123
|
+
/// the error info that the call that just failed with it left on this
|
|
124
|
+
/// thread.
|
|
125
|
+
/// @returns nullptr, for the caller to return.
|
|
126
|
+
inline PyObject* set_hresult_error(HRESULT hr) noexcept
|
|
127
|
+
{
|
|
128
|
+
// The error info belongs to the thread and the next failure replaces
|
|
129
|
+
// it, so it is taken before anything else can fail.
|
|
130
|
+
IErrorInfo* info{};
|
|
131
|
+
if (GetErrorInfo(0, &info) != S_OK)
|
|
132
|
+
{
|
|
133
|
+
info = nullptr;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return set_hresult_error(hr, info);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/// The @p I interface of what the interface pointer capsule @p capsule
|
|
140
|
+
/// holds, which the caller owns a reference to.
|
|
141
|
+
/// @returns false with a Python exception set when @p capsule is not one
|
|
142
|
+
/// or what it holds does not implement @p I.
|
|
143
|
+
template<typename I>
|
|
144
|
+
bool query_capsule(PyObject* capsule, I** result) noexcept
|
|
145
|
+
{
|
|
146
|
+
auto const abi = PyCapsule_GetPointer(capsule, interface_capsule_name);
|
|
147
|
+
if (!abi)
|
|
148
|
+
{
|
|
149
|
+
return false;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
auto const hr = static_cast<IUnknown*>(abi)->QueryInterface(
|
|
153
|
+
__uuidof(I), reinterpret_cast<void**>(result));
|
|
154
|
+
if (FAILED(hr))
|
|
155
|
+
{
|
|
156
|
+
set_hresult_error(hr);
|
|
157
|
+
return false;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
return true;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/// The slots of an interop module that has nothing to set up when it is
|
|
164
|
+
/// executed. It keeps no state, but it exchanges objects and errors with
|
|
165
|
+
/// winrt-runtime, which refuses any interpreter but the main one, so it
|
|
166
|
+
/// says the same.
|
|
167
|
+
inline PyModuleDef_Slot module_slots[]{
|
|
168
|
+
#ifdef Py_mod_multiple_interpreters
|
|
169
|
+
{Py_mod_multiple_interpreters, Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED},
|
|
170
|
+
#endif
|
|
171
|
+
#ifdef Py_mod_gil
|
|
172
|
+
{Py_mod_gil, Py_MOD_GIL_NOT_USED},
|
|
173
|
+
#endif
|
|
174
|
+
{}};
|
|
175
|
+
} // namespace interop
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
#include "interop.h"
|
|
2
|
+
|
|
3
|
+
#if __has_include("windows.graphics.directx.direct3d11.interop.h")
|
|
4
|
+
#include <windows.graphics.directx.direct3d11.interop.h>
|
|
5
|
+
|
|
6
|
+
#ifdef __MINGW32__
|
|
7
|
+
// mingw-w64 generates this header from an .idl that is missing this
|
|
8
|
+
// function, so declare it here. Everything else the header needs is
|
|
9
|
+
// there, including the C++ IDirect3DDxgiInterfaceAccess and its uuid.
|
|
10
|
+
extern "C" HRESULT __stdcall CreateDirect3D11SurfaceFromDXGISurface(
|
|
11
|
+
::IDXGISurface* dgxiSurface, ::IInspectable** graphicsSurface);
|
|
12
|
+
#endif
|
|
13
|
+
|
|
14
|
+
#else
|
|
15
|
+
// some environments like MSYS2 don't have the interop header
|
|
16
|
+
#include <dxgi.h>
|
|
17
|
+
#include <inspectable.h>
|
|
18
|
+
#include <unknwn.h>
|
|
19
|
+
|
|
20
|
+
// https://gist.github.com/kennykerr/15a62c8218254bc908de672e5ed405fa
|
|
21
|
+
|
|
22
|
+
extern "C"
|
|
23
|
+
{
|
|
24
|
+
HRESULT __stdcall CreateDirect3D11DeviceFromDXGIDevice(
|
|
25
|
+
::IDXGIDevice* dxgiDevice, ::IInspectable** graphicsDevice);
|
|
26
|
+
|
|
27
|
+
HRESULT __stdcall CreateDirect3D11SurfaceFromDXGISurface(
|
|
28
|
+
::IDXGISurface* dgxiSurface, ::IInspectable** graphicsSurface);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
DEFINE_GUID(
|
|
32
|
+
IID__x_Windows_Graphics_DirectX_Direct3D11_IDirect3DDxgiInterfaceAccess,
|
|
33
|
+
// clang-format off
|
|
34
|
+
0xA9B3D012, 0x3DF2, 0x4EE3, 0xB8, 0xD1, 0x86, 0x95, 0xF4, 0x57, 0xD3, 0xC1
|
|
35
|
+
// clang-format on
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
namespace Windows::Graphics::DirectX::Direct3D11
|
|
39
|
+
{
|
|
40
|
+
MIDL_INTERFACE("A9B3D012-3DF2-4EE3-B8D1-8695F457D3C1")
|
|
41
|
+
IDirect3DDxgiInterfaceAccess : ::IUnknown
|
|
42
|
+
{
|
|
43
|
+
virtual HRESULT STDMETHODCALLTYPE GetInterface(
|
|
44
|
+
REFIID riid, _COM_Outptr_ void** p) noexcept = 0;
|
|
45
|
+
};
|
|
46
|
+
} // namespace Windows::Graphics::DirectX::Direct3D11
|
|
47
|
+
|
|
48
|
+
#ifdef __CRT_UUID_DECL
|
|
49
|
+
__CRT_UUID_DECL(
|
|
50
|
+
Windows::Graphics::DirectX::Direct3D11::IDirect3DDxgiInterfaceAccess,
|
|
51
|
+
// clang-format off
|
|
52
|
+
0xA9B3D012, 0x3DF2, 0x4EE3, 0xB8, 0xD1, 0x86, 0x95, 0xF4, 0x57, 0xD3, 0xC1
|
|
53
|
+
// clang-format on
|
|
54
|
+
);
|
|
55
|
+
#endif
|
|
56
|
+
#endif
|
|
57
|
+
|
|
58
|
+
// https://learn.microsoft.com/en-us/windows/win32/api/windows.graphics.directx.direct3d11.interop/
|
|
59
|
+
|
|
60
|
+
namespace
|
|
61
|
+
{
|
|
62
|
+
using ::Windows::Graphics::DirectX::Direct3D11::IDirect3DDxgiInterfaceAccess;
|
|
63
|
+
|
|
64
|
+
PyObject* create_direct3d11_device_from_dxgi_device(
|
|
65
|
+
PyObject* /*unused*/, PyObject* dxgi_device_obj) noexcept
|
|
66
|
+
{
|
|
67
|
+
auto const dxgi_device
|
|
68
|
+
= static_cast<IDXGIDevice*>(PyLong_AsVoidPtr(dxgi_device_obj));
|
|
69
|
+
if (!dxgi_device && PyErr_Occurred())
|
|
70
|
+
{
|
|
71
|
+
return nullptr;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
::IInspectable* d3d_device{};
|
|
75
|
+
|
|
76
|
+
auto const hr = CreateDirect3D11DeviceFromDXGIDevice(dxgi_device, &d3d_device);
|
|
77
|
+
if (FAILED(hr))
|
|
78
|
+
{
|
|
79
|
+
return interop::set_hresult_error(hr);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return interop::new_interface_capsule(d3d_device);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
PyObject* create_direct3d11_surface_from_dxgi_surface(
|
|
86
|
+
PyObject* /*unused*/, PyObject* dxgi_surface_obj) noexcept
|
|
87
|
+
{
|
|
88
|
+
auto const dxgi_surface
|
|
89
|
+
= static_cast<IDXGISurface*>(PyLong_AsVoidPtr(dxgi_surface_obj));
|
|
90
|
+
if (!dxgi_surface && PyErr_Occurred())
|
|
91
|
+
{
|
|
92
|
+
return nullptr;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
::IInspectable* d3d_surface{};
|
|
96
|
+
|
|
97
|
+
auto const hr
|
|
98
|
+
= CreateDirect3D11SurfaceFromDXGISurface(dxgi_surface, &d3d_surface);
|
|
99
|
+
if (FAILED(hr))
|
|
100
|
+
{
|
|
101
|
+
return interop::set_hresult_error(hr);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return interop::new_interface_capsule(d3d_surface);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/// The @p I interface that the Direct3D object in @p capsule wraps, as an
|
|
108
|
+
/// integer that owns a reference to it.
|
|
109
|
+
template<typename I>
|
|
110
|
+
PyObject* get_dxgi_interface(PyObject* capsule) noexcept
|
|
111
|
+
{
|
|
112
|
+
IDirect3DDxgiInterfaceAccess* access{};
|
|
113
|
+
if (!interop::query_capsule(capsule, &access))
|
|
114
|
+
{
|
|
115
|
+
return nullptr;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
I* result{};
|
|
119
|
+
|
|
120
|
+
auto const hr
|
|
121
|
+
= access->GetInterface(__uuidof(I), reinterpret_cast<void**>(&result));
|
|
122
|
+
access->Release();
|
|
123
|
+
if (FAILED(hr))
|
|
124
|
+
{
|
|
125
|
+
return interop::set_hresult_error(hr);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
auto const value = PyLong_FromVoidPtr(result);
|
|
129
|
+
if (!value)
|
|
130
|
+
{
|
|
131
|
+
result->Release();
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return value;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
PyObject* get_dxgi_device_from_object(
|
|
138
|
+
PyObject* /*unused*/, PyObject* capsule) noexcept
|
|
139
|
+
{
|
|
140
|
+
return get_dxgi_interface<IDXGIDevice>(capsule);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
PyObject* get_dxgi_surface_from_object(
|
|
144
|
+
PyObject* /*unused*/, PyObject* capsule) noexcept
|
|
145
|
+
{
|
|
146
|
+
return get_dxgi_interface<IDXGISurface>(capsule);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
PyMethodDef module_methods[]{
|
|
150
|
+
{"create_direct3d11_device_from_dxgi_device",
|
|
151
|
+
create_direct3d11_device_from_dxgi_device,
|
|
152
|
+
METH_O,
|
|
153
|
+
nullptr},
|
|
154
|
+
{"create_direct3d11_surface_from_dxgi_surface",
|
|
155
|
+
create_direct3d11_surface_from_dxgi_surface,
|
|
156
|
+
METH_O,
|
|
157
|
+
nullptr},
|
|
158
|
+
{"get_dxgi_device_from_object", get_dxgi_device_from_object, METH_O, nullptr},
|
|
159
|
+
{"get_dxgi_surface_from_object", get_dxgi_surface_from_object, METH_O, nullptr},
|
|
160
|
+
{}};
|
|
161
|
+
|
|
162
|
+
PyDoc_STRVAR(
|
|
163
|
+
module_doc,
|
|
164
|
+
"Interop functions for use with IDirect3DDevice and IDirect3DSurface.");
|
|
165
|
+
|
|
166
|
+
PyModuleDef module_def
|
|
167
|
+
= {PyModuleDef_HEAD_INIT,
|
|
168
|
+
"_winrt_windows_graphics_directx_direct3d11_interop",
|
|
169
|
+
module_doc,
|
|
170
|
+
0,
|
|
171
|
+
module_methods,
|
|
172
|
+
interop::module_slots,
|
|
173
|
+
nullptr,
|
|
174
|
+
nullptr,
|
|
175
|
+
nullptr};
|
|
176
|
+
} // namespace
|
|
177
|
+
|
|
178
|
+
PyMODINIT_FUNC PyInit__winrt_windows_graphics_directx_direct3d11_interop(void) noexcept
|
|
179
|
+
{
|
|
180
|
+
return PyModuleDef_Init(&module_def);
|
|
181
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# WARNING: Please don't edit this file. It was automatically generated.
|
|
2
|
+
|
|
3
|
+
[build-system]
|
|
4
|
+
requires = ["setuptools>=78"]
|
|
5
|
+
build-backend = "setuptools.build_meta"
|
|
6
|
+
|
|
7
|
+
[project]
|
|
8
|
+
name = "winrt-Windows.Graphics.DirectX.Direct3D11.Interop"
|
|
9
|
+
description = "Converts between DXGI devices and surfaces and the IDirect3DDevice and IDirect3DSurface that WinRT APIs take."
|
|
10
|
+
readme = "README.md"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Operating System :: Microsoft :: Windows",
|
|
15
|
+
"Programming Language :: Python :: 3",
|
|
16
|
+
"Programming Language :: Python :: 3.11",
|
|
17
|
+
"Programming Language :: Python :: 3.12",
|
|
18
|
+
"Programming Language :: Python :: 3.13",
|
|
19
|
+
"Programming Language :: Python :: 3.14",
|
|
20
|
+
"Programming Language :: Python :: 3.15",
|
|
21
|
+
"Programming Language :: Python :: Implementation :: CPython",
|
|
22
|
+
"Intended Audience :: Developers",
|
|
23
|
+
"Programming Language :: Python :: Free Threading :: 2 - Beta",
|
|
24
|
+
"Typing :: Typed",
|
|
25
|
+
]
|
|
26
|
+
dynamic = ["version", "dependencies"]
|
|
27
|
+
requires-python = ">=3.11"
|
|
28
|
+
|
|
29
|
+
[project.urls]
|
|
30
|
+
Documentation = "https://pywinrt.readthedocs.io"
|
|
31
|
+
Repository = "https://github.com/pywinrt/pywinrt"
|
|
32
|
+
Changelog = "https://github.com/pywinrt/pywinrt/blob/main/interop/winrt-Windows.Graphics.DirectX.Direct3D11.Interop/CHANGELOG.md"
|
|
33
|
+
|
|
34
|
+
[tool.setuptools.dynamic]
|
|
35
|
+
version = { file = "version.txt" }
|
|
36
|
+
dependencies = { file = "requirements.txt" }
|
|
37
|
+
|
|
38
|
+
[tool.setuptools.packages.find]
|
|
39
|
+
include = ["winrt*"]
|
|
40
|
+
|
|
41
|
+
[tool.setuptools.package-data]
|
|
42
|
+
"*" = ["*.pyi", "py.typed"]
|
|
43
|
+
|
|
44
|
+
[tool.cibuildwheel]
|
|
45
|
+
# don't build for PyPy
|
|
46
|
+
skip = "pp*"
|
|
47
|
+
# suppress warnings about ARM64 testing
|
|
48
|
+
test-skip = "*-win_arm64"
|
|
49
|
+
test-command = "python -c \"import winrt._winrt_windows_graphics_directx_direct3d11_interop\""
|
|
50
|
+
|
|
51
|
+
[tool.cibuildwheel.windows]
|
|
52
|
+
archs = ["x86", "AMD64", "ARM64"]
|
|
53
|
+
# nothing here is copied in after the build, so there is no repair step
|
|
54
|
+
repair-wheel-command = ""
|
|
@@ -1,16 +1,25 @@
|
|
|
1
1
|
# WARNING: Please don't edit this file. It was automatically generated.
|
|
2
|
+
# setuptools does not annotate the build_ext methods this file overrides.
|
|
3
|
+
# pyright: reportUnknownMemberType=false
|
|
2
4
|
|
|
3
5
|
from setuptools import Extension, setup
|
|
4
6
|
from setuptools.command.build_ext import build_ext
|
|
5
|
-
|
|
7
|
+
|
|
8
|
+
INCLUDE_DIRS: list[str] = []
|
|
6
9
|
|
|
7
10
|
|
|
8
11
|
class build_ext_ex(build_ext):
|
|
9
|
-
def build_extension(self, ext):
|
|
12
|
+
def build_extension(self, ext: Extension) -> None:
|
|
13
|
+
# nothing in the projection uses dynamic_cast or typeid, so disabling
|
|
14
|
+
# RTTI costs nothing and makes the module about 15% smaller
|
|
10
15
|
if self.compiler.compiler_type == "msvc":
|
|
11
|
-
ext.extra_compile_args = ["/std:c++20", "/permissive-"]
|
|
16
|
+
ext.extra_compile_args = ["/std:c++20", "/permissive-", "/GR-"]
|
|
12
17
|
elif self.compiler.compiler_type == "mingw32":
|
|
13
|
-
ext.extra_compile_args = [
|
|
18
|
+
ext.extra_compile_args = [
|
|
19
|
+
"-std=c++20",
|
|
20
|
+
"-fno-rtti",
|
|
21
|
+
"-D_WIN32_WINNT=_WIN32_WINNT_WIN10",
|
|
22
|
+
]
|
|
14
23
|
# GCC 15 complains about some things that it didn't in the past
|
|
15
24
|
ext.extra_compile_args += ["-Wno-strict-aliasing", "-Wno-template-body"]
|
|
16
25
|
ext.extra_link_args = ["-loleaut32"]
|
|
@@ -26,7 +35,7 @@ setup(
|
|
|
26
35
|
Extension(
|
|
27
36
|
"winrt._winrt_windows_graphics_directx_direct3d11_interop",
|
|
28
37
|
sources=["py.Windows.Graphics.DirectX.Direct3D11.Interop.cpp"],
|
|
29
|
-
include_dirs=
|
|
38
|
+
include_dirs=INCLUDE_DIRS,
|
|
30
39
|
libraries=["windowsapp", "D3D11"],
|
|
31
40
|
)
|
|
32
41
|
],
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
4.0.0
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
from winrt.runtime.interop import InterfaceCapsule
|
|
2
|
+
|
|
3
|
+
def create_direct3d11_device_from_dxgi_device(
|
|
4
|
+
dxgi_device: int, /
|
|
5
|
+
) -> InterfaceCapsule: ...
|
|
6
|
+
def create_direct3d11_surface_from_dxgi_surface(
|
|
7
|
+
dxgi_surface: int, /
|
|
8
|
+
) -> InterfaceCapsule: ...
|
|
9
|
+
def get_dxgi_device_from_object(capsule: InterfaceCapsule, /) -> int: ...
|
|
10
|
+
def get_dxgi_surface_from_object(capsule: InterfaceCapsule, /) -> int: ...
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
from uuid import UUID
|
|
2
|
+
|
|
3
|
+
import winrt.runtime.interop as _runtime
|
|
4
|
+
import winrt._winrt_windows_graphics_directx_direct3d11_interop as _native
|
|
5
|
+
from winrt.system import Object
|
|
6
|
+
from winrt.windows.graphics.directx.direct3d11 import IDirect3DDevice, IDirect3DSurface
|
|
7
|
+
|
|
8
|
+
__all__ = [
|
|
9
|
+
"create_direct3d11_device_from_dxgi_device",
|
|
10
|
+
"create_direct3d11_surface_from_dxgi_surface",
|
|
11
|
+
"get_dxgi_device_from_object",
|
|
12
|
+
"get_dxgi_surface_from_object",
|
|
13
|
+
]
|
|
14
|
+
|
|
15
|
+
_IID_IINSPECTABLE = UUID("AF86E2E0-B12D-4C6A-9C5A-D7AA65101E90")
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def create_direct3d11_device_from_dxgi_device(dxgi_device: int, /) -> IDirect3DDevice:
|
|
19
|
+
"""
|
|
20
|
+
Creates an instance of IDirect3DDevice from an IDXGIDevice.
|
|
21
|
+
|
|
22
|
+
Args:
|
|
23
|
+
dxgi_device (IDXGIDevice*): The IDXGIDevice to create the Direct3DDevice
|
|
24
|
+
from.
|
|
25
|
+
|
|
26
|
+
Returns:
|
|
27
|
+
A Direct3DDevice instance that wraps the DXGIDevice.
|
|
28
|
+
"""
|
|
29
|
+
return _runtime.wrap_interface(
|
|
30
|
+
_native.create_direct3d11_device_from_dxgi_device(dxgi_device),
|
|
31
|
+
IDirect3DDevice,
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def create_direct3d11_surface_from_dxgi_surface(
|
|
36
|
+
dxgi_surface: int, /
|
|
37
|
+
) -> IDirect3DSurface:
|
|
38
|
+
"""
|
|
39
|
+
Creates an instance of IDirect3DSurface from an IDXGISurface.
|
|
40
|
+
|
|
41
|
+
Args:
|
|
42
|
+
dxgi_surface (IDXGISurface*): The IDXGISurface to create the
|
|
43
|
+
Direct3DSurface from.
|
|
44
|
+
|
|
45
|
+
Returns:
|
|
46
|
+
A Direct3DSurface instance that wraps the DXGISurface.
|
|
47
|
+
"""
|
|
48
|
+
return _runtime.wrap_interface(
|
|
49
|
+
_native.create_direct3d11_surface_from_dxgi_surface(dxgi_surface),
|
|
50
|
+
IDirect3DSurface,
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def get_dxgi_device_from_object(device: Object, /) -> int:
|
|
55
|
+
"""
|
|
56
|
+
Retrieves the IDXGIDevice from a Direct3D object.
|
|
57
|
+
|
|
58
|
+
Args:
|
|
59
|
+
device: The WinRT object to retrieve the IDXGIDevice from.
|
|
60
|
+
|
|
61
|
+
Returns:
|
|
62
|
+
Pointer to IDXGIDevice interface of the WinRT object.
|
|
63
|
+
"""
|
|
64
|
+
return _native.get_dxgi_device_from_object(
|
|
65
|
+
_runtime.as_interface(device, _IID_IINSPECTABLE)
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def get_dxgi_surface_from_object(surface: Object, /) -> int:
|
|
70
|
+
"""
|
|
71
|
+
Retrieves the IDXGISurface from a Direct3D object.
|
|
72
|
+
|
|
73
|
+
Args:
|
|
74
|
+
surface: The WinRT object to retrieve the IDXGISurface from.
|
|
75
|
+
|
|
76
|
+
Returns:
|
|
77
|
+
Pointer to IDXGISurface interface of the WinRT object.
|
|
78
|
+
"""
|
|
79
|
+
return _native.get_dxgi_surface_from_object(
|
|
80
|
+
_runtime.as_interface(surface, _IID_IINSPECTABLE)
|
|
81
|
+
)
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: winrt-Windows.Graphics.DirectX.Direct3D11.Interop
|
|
3
|
+
Version: 4.0.0
|
|
4
|
+
Summary: Converts between DXGI devices and surfaces and the IDirect3DDevice and IDirect3DSurface that WinRT APIs take.
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Project-URL: Documentation, https://pywinrt.readthedocs.io
|
|
7
|
+
Project-URL: Repository, https://github.com/pywinrt/pywinrt
|
|
8
|
+
Project-URL: Changelog, https://github.com/pywinrt/pywinrt/blob/main/interop/winrt-Windows.Graphics.DirectX.Direct3D11.Interop/CHANGELOG.md
|
|
9
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
16
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
17
|
+
Classifier: Intended Audience :: Developers
|
|
18
|
+
Classifier: Programming Language :: Python :: Free Threading :: 2 - Beta
|
|
19
|
+
Classifier: Typing :: Typed
|
|
20
|
+
Requires-Python: >=3.11
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: winrt-runtime<5,>=4.0.0
|
|
24
|
+
Requires-Dist: winrt-Windows.Graphics.DirectX.Direct3D11>=4!10.0.28000.2705
|
|
25
|
+
Dynamic: license-file
|
|
26
|
+
|
|
27
|
+
<!-- warning: Please don't edit this file. It was automatically generated. -->
|
|
28
|
+
|
|
29
|
+
# winrt-Windows.Graphics.DirectX.Direct3D11.Interop
|
|
30
|
+
|
|
31
|
+
Converts between DXGI devices and surfaces and the `IDirect3DDevice` and `IDirect3DSurface` that WinRT APIs take.
|
|
32
|
+
|
|
33
|
+
This package provides the `winrt.windows.graphics.directx.direct3d11.interop` module.
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
pip install winrt-Windows.Graphics.DirectX.Direct3D11.Interop
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
installs it with `winrt-Windows.Graphics.DirectX.Direct3D11`.
|
|
@@ -1,12 +1,17 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
MANIFEST.in
|
|
1
3
|
README.md
|
|
4
|
+
interop.h
|
|
2
5
|
py.Windows.Graphics.DirectX.Direct3D11.Interop.cpp
|
|
3
6
|
pyproject.toml
|
|
4
|
-
|
|
7
|
+
requirements.txt
|
|
5
8
|
setup.py
|
|
9
|
+
version.txt
|
|
6
10
|
winrt/_winrt_windows_graphics_directx_direct3d11_interop.pyi
|
|
7
11
|
winrt/windows/graphics/directx/direct3d11/interop/__init__.py
|
|
8
12
|
winrt/windows/graphics/directx/direct3d11/interop/py.typed
|
|
9
13
|
winrt_Windows.Graphics.DirectX.Direct3D11.Interop.egg-info/PKG-INFO
|
|
10
14
|
winrt_Windows.Graphics.DirectX.Direct3D11.Interop.egg-info/SOURCES.txt
|
|
11
15
|
winrt_Windows.Graphics.DirectX.Direct3D11.Interop.egg-info/dependency_links.txt
|
|
16
|
+
winrt_Windows.Graphics.DirectX.Direct3D11.Interop.egg-info/requires.txt
|
|
12
17
|
winrt_Windows.Graphics.DirectX.Direct3D11.Interop.egg-info/top_level.txt
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: winrt-Windows.Graphics.DirectX.Direct3D11.Interop
|
|
3
|
-
Version: 3.2.0
|
|
4
|
-
Summary: Python projection of Windows Runtime (WinRT) APIs
|
|
5
|
-
License-Expression: MIT
|
|
6
|
-
Project-URL: Documentation, https://pywinrt.readthedocs.io
|
|
7
|
-
Project-URL: Repository, https://github.com/pywinrt/pywinrt
|
|
8
|
-
Project-URL: Changelog, https://github.com/pywinrt/pywinrt/blob/main/CHANGELOG.md
|
|
9
|
-
Classifier: Operating System :: Microsoft :: Windows
|
|
10
|
-
Classifier: Programming Language :: Python :: 3
|
|
11
|
-
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
12
|
-
Classifier: Intended Audience :: Developers
|
|
13
|
-
Requires-Python: >=3.9
|
|
14
|
-
Description-Content-Type: text/markdown
|
|
15
|
-
|
|
16
|
-
<!-- warning: Please don't edit this file. It was automatically generated. -->
|
|
17
|
-
|
|
18
|
-
# winrt-Windows.Graphics.DirectX.Direct3D11.Interop
|
|
19
|
-
|
|
20
|
-
Windows Runtime (WinRT) APIs for for the `Windows.Graphics.DirectX.Direct3D11.Interop` namespace.
|
|
21
|
-
|
|
22
|
-
This package provides the `winrt.windows.graphics.directx.direct3d11.interop` module.
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
<!-- warning: Please don't edit this file. It was automatically generated. -->
|
|
2
|
-
|
|
3
|
-
# winrt-Windows.Graphics.DirectX.Direct3D11.Interop
|
|
4
|
-
|
|
5
|
-
Windows Runtime (WinRT) APIs for for the `Windows.Graphics.DirectX.Direct3D11.Interop` namespace.
|
|
6
|
-
|
|
7
|
-
This package provides the `winrt.windows.graphics.directx.direct3d11.interop` module.
|
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
#if __has_include("windows.graphics.directx.direct3d11.interop.h")
|
|
2
|
-
#include <windows.graphics.directx.direct3d11.interop.h>
|
|
3
|
-
#else
|
|
4
|
-
// some environments like MSYS2 don't have the interop header
|
|
5
|
-
#include <dxgi.h>
|
|
6
|
-
#include <inspectable.h>
|
|
7
|
-
#include <unknwn.h>
|
|
8
|
-
|
|
9
|
-
// https://gist.github.com/kennykerr/15a62c8218254bc908de672e5ed405fa
|
|
10
|
-
|
|
11
|
-
extern "C"
|
|
12
|
-
{
|
|
13
|
-
HRESULT __stdcall CreateDirect3D11DeviceFromDXGIDevice(
|
|
14
|
-
::IDXGIDevice* dxgiDevice, ::IInspectable** graphicsDevice);
|
|
15
|
-
|
|
16
|
-
HRESULT __stdcall CreateDirect3D11SurfaceFromDXGISurface(
|
|
17
|
-
::IDXGISurface* dgxiSurface, ::IInspectable** graphicsSurface);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
DEFINE_GUID(
|
|
21
|
-
IID__x_Windows_Graphics_DirectX_Direct3D11_IDirect3DDxgiInterfaceAccess,
|
|
22
|
-
// clang-format off
|
|
23
|
-
0xA9B3D012, 0x3DF2, 0x4EE3, 0xB8, 0xD1, 0x86, 0x95, 0xF4, 0x57, 0xD3, 0xC1
|
|
24
|
-
// clang-format on
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
namespace Windows::Graphics::DirectX::Direct3D11
|
|
28
|
-
{
|
|
29
|
-
MIDL_INTERFACE("A9B3D012-3DF2-4EE3-B8D1-8695F457D3C1")
|
|
30
|
-
IDirect3DDxgiInterfaceAccess : ::IUnknown
|
|
31
|
-
{
|
|
32
|
-
virtual HRESULT STDMETHODCALLTYPE GetInterface(
|
|
33
|
-
REFIID riid, _COM_Outptr_ void** p) noexcept
|
|
34
|
-
= 0;
|
|
35
|
-
};
|
|
36
|
-
} // namespace Windows::Graphics::DirectX::Direct3D11
|
|
37
|
-
|
|
38
|
-
#ifdef __CRT_UUID_DECL
|
|
39
|
-
__CRT_UUID_DECL(
|
|
40
|
-
Windows::Graphics::DirectX::Direct3D11::IDirect3DDxgiInterfaceAccess,
|
|
41
|
-
// clang-format off
|
|
42
|
-
0xA9B3D012, 0x3DF2, 0x4EE3, 0xB8, 0xD1, 0x86, 0x95, 0xF4, 0x57, 0xD3, 0xC1
|
|
43
|
-
// clang-format on
|
|
44
|
-
);
|
|
45
|
-
#endif
|
|
46
|
-
#endif
|
|
47
|
-
|
|
48
|
-
#include <winrt/Windows.Graphics.DirectX.Direct3D11.h>
|
|
49
|
-
#include "pybase.h"
|
|
50
|
-
#include "py.Windows.Graphics.DirectX.Direct3D11.h"
|
|
51
|
-
|
|
52
|
-
// https://learn.microsoft.com/en-us/windows/win32/api/windows.graphics.directx.direct3d11.interop/
|
|
53
|
-
|
|
54
|
-
namespace py::cpp::Windows::Graphics::DirectX::Direct3D11::Interop
|
|
55
|
-
{
|
|
56
|
-
static PyObject* create_direct3d11_device_from_dxgi_device(
|
|
57
|
-
PyObject* /*unused*/, PyObject* dxgi_device_obj) noexcept
|
|
58
|
-
{
|
|
59
|
-
try
|
|
60
|
-
{
|
|
61
|
-
auto dxgi_device
|
|
62
|
-
= reinterpret_cast<IDXGIDevice*>(PyLong_AsVoidPtr(dxgi_device_obj));
|
|
63
|
-
|
|
64
|
-
if (!dxgi_device && PyErr_Occurred())
|
|
65
|
-
{
|
|
66
|
-
return nullptr;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
winrt::com_ptr<::IInspectable> d3d_device;
|
|
70
|
-
winrt::check_hresult(
|
|
71
|
-
CreateDirect3D11DeviceFromDXGIDevice(dxgi_device, d3d_device.put()));
|
|
72
|
-
|
|
73
|
-
return py::convert(
|
|
74
|
-
d3d_device.as<
|
|
75
|
-
winrt::Windows::Graphics::DirectX::Direct3D11::IDirect3DDevice>());
|
|
76
|
-
}
|
|
77
|
-
catch (...)
|
|
78
|
-
{
|
|
79
|
-
py::to_PyErr();
|
|
80
|
-
return nullptr;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
PyDoc_STRVAR(
|
|
85
|
-
create_direct3d11_device_from_dxgi_device_doc,
|
|
86
|
-
R"(Creates an instance of IDirect3DDevice from an IDXGIDevice.
|
|
87
|
-
|
|
88
|
-
Args:
|
|
89
|
-
dxgi_device (IDXGIDevice*): The IDXGIDevice to create the Direct3DDevice from.
|
|
90
|
-
|
|
91
|
-
Returns:
|
|
92
|
-
A Direct3DDevice instance that wraps the DXGIDevice.
|
|
93
|
-
)");
|
|
94
|
-
|
|
95
|
-
static PyObject* create_direct3d11_surface_from_dxgi_surface(
|
|
96
|
-
PyObject* /*unused*/, PyObject* dxgi_surface_obj) noexcept
|
|
97
|
-
{
|
|
98
|
-
try
|
|
99
|
-
{
|
|
100
|
-
auto dxgi_surface
|
|
101
|
-
= reinterpret_cast<IDXGISurface*>(PyLong_AsVoidPtr(dxgi_surface_obj));
|
|
102
|
-
|
|
103
|
-
if (!dxgi_surface && PyErr_Occurred())
|
|
104
|
-
{
|
|
105
|
-
return nullptr;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
winrt::com_ptr<::IInspectable> d3d_surface;
|
|
109
|
-
winrt::check_hresult(CreateDirect3D11SurfaceFromDXGISurface(
|
|
110
|
-
dxgi_surface, d3d_surface.put()));
|
|
111
|
-
|
|
112
|
-
return py::convert(
|
|
113
|
-
d3d_surface.as<
|
|
114
|
-
winrt::Windows::Graphics::DirectX::Direct3D11::IDirect3DSurface>());
|
|
115
|
-
}
|
|
116
|
-
catch (...)
|
|
117
|
-
{
|
|
118
|
-
py::to_PyErr();
|
|
119
|
-
return nullptr;
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
PyDoc_STRVAR(
|
|
124
|
-
create_direct3d11_surface_from_dxgi_surface_doc,
|
|
125
|
-
R"(Creates an instance of IDirect3DSurface from an IDXGISurface.
|
|
126
|
-
|
|
127
|
-
Args:
|
|
128
|
-
dxgi_surface (IDXGISurface*): The IDXGISurface to create the Direct3DSurface from.
|
|
129
|
-
|
|
130
|
-
Returns:
|
|
131
|
-
A Direct3DSurface instance that wraps the DXGISurface.
|
|
132
|
-
)");
|
|
133
|
-
|
|
134
|
-
static PyObject* get_dxgi_device_from_object(
|
|
135
|
-
PyObject* /*unused*/, PyObject* py_obj) noexcept
|
|
136
|
-
{
|
|
137
|
-
try
|
|
138
|
-
{
|
|
139
|
-
auto object
|
|
140
|
-
= py::convert_to<winrt::Windows::Foundation::IInspectable>(py_obj);
|
|
141
|
-
auto access = object.as<::Windows::Graphics::DirectX::Direct3D11::
|
|
142
|
-
IDirect3DDxgiInterfaceAccess>();
|
|
143
|
-
winrt::com_ptr<IDXGIDevice> result;
|
|
144
|
-
winrt::check_hresult(
|
|
145
|
-
access->GetInterface(winrt::guid_of<IDXGIDevice>(), result.put_void()));
|
|
146
|
-
|
|
147
|
-
return PyLong_FromVoidPtr(result.detach());
|
|
148
|
-
}
|
|
149
|
-
catch (...)
|
|
150
|
-
{
|
|
151
|
-
py::to_PyErr();
|
|
152
|
-
return nullptr;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
static PyObject* get_dxgi_surface_from_object(
|
|
157
|
-
PyObject* /*unused*/, PyObject* py_obj) noexcept
|
|
158
|
-
{
|
|
159
|
-
try
|
|
160
|
-
{
|
|
161
|
-
auto object
|
|
162
|
-
= py::convert_to<winrt::Windows::Foundation::IInspectable>(py_obj);
|
|
163
|
-
auto access = object.as<::Windows::Graphics::DirectX::Direct3D11::
|
|
164
|
-
IDirect3DDxgiInterfaceAccess>();
|
|
165
|
-
winrt::com_ptr<IDXGISurface> result;
|
|
166
|
-
winrt::check_hresult(access->GetInterface(
|
|
167
|
-
winrt::guid_of<IDXGISurface>(), result.put_void()));
|
|
168
|
-
|
|
169
|
-
return PyLong_FromVoidPtr(result.detach());
|
|
170
|
-
}
|
|
171
|
-
catch (...)
|
|
172
|
-
{
|
|
173
|
-
py::to_PyErr();
|
|
174
|
-
return nullptr;
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
static PyMethodDef module_methods[]{
|
|
179
|
-
{"create_direct3d11_device_from_dxgi_device",
|
|
180
|
-
create_direct3d11_device_from_dxgi_device,
|
|
181
|
-
METH_O,
|
|
182
|
-
create_direct3d11_device_from_dxgi_device_doc},
|
|
183
|
-
{"create_direct3d11_surface_from_dxgi_surface",
|
|
184
|
-
create_direct3d11_surface_from_dxgi_surface,
|
|
185
|
-
METH_O,
|
|
186
|
-
create_direct3d11_surface_from_dxgi_surface_doc},
|
|
187
|
-
{"get_dxgi_device_from_object", get_dxgi_device_from_object, METH_O, nullptr},
|
|
188
|
-
{"get_dxgi_surface_from_object", get_dxgi_surface_from_object, METH_O, nullptr},
|
|
189
|
-
{}};
|
|
190
|
-
|
|
191
|
-
PyDoc_STRVAR(
|
|
192
|
-
module_doc,
|
|
193
|
-
"Interop functions for use with IDirect3DDevice and IDirect3DSurface.");
|
|
194
|
-
|
|
195
|
-
static PyModuleDef module_def
|
|
196
|
-
= {PyModuleDef_HEAD_INIT,
|
|
197
|
-
"_winrt_windows_graphics_directx_direct3d11_interop",
|
|
198
|
-
module_doc,
|
|
199
|
-
0,
|
|
200
|
-
module_methods,
|
|
201
|
-
nullptr,
|
|
202
|
-
nullptr,
|
|
203
|
-
nullptr,
|
|
204
|
-
nullptr};
|
|
205
|
-
} // namespace py::cpp::Windows::Graphics::DirectX::Direct3D11::Interop
|
|
206
|
-
|
|
207
|
-
PyMODINIT_FUNC PyInit__winrt_windows_graphics_directx_direct3d11_interop(void) noexcept
|
|
208
|
-
{
|
|
209
|
-
using namespace py::cpp::Windows::Graphics::DirectX::Direct3D11::Interop;
|
|
210
|
-
|
|
211
|
-
if (py::import_winrt_runtime() == -1)
|
|
212
|
-
{
|
|
213
|
-
return nullptr;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
return PyModule_Create(&module_def);
|
|
217
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
# WARNING: Please don't edit this file. It was automatically generated.
|
|
2
|
-
|
|
3
|
-
[build-system]
|
|
4
|
-
requires = ["setuptools>=78", "winrt-sdk"]
|
|
5
|
-
build-backend = "setuptools.build_meta"
|
|
6
|
-
|
|
7
|
-
[project]
|
|
8
|
-
name = "winrt-Windows.Graphics.DirectX.Direct3D11.Interop"
|
|
9
|
-
description = "Python projection of Windows Runtime (WinRT) APIs"
|
|
10
|
-
readme = "README.md"
|
|
11
|
-
license = "MIT"
|
|
12
|
-
classifiers = [
|
|
13
|
-
"Operating System :: Microsoft :: Windows",
|
|
14
|
-
"Programming Language :: Python :: 3",
|
|
15
|
-
"Programming Language :: Python :: Implementation :: CPython",
|
|
16
|
-
"Intended Audience :: Developers",
|
|
17
|
-
]
|
|
18
|
-
dynamic = ["version"]
|
|
19
|
-
requires-python = ">=3.9"
|
|
20
|
-
|
|
21
|
-
[project.urls]
|
|
22
|
-
# Homepage = "https://github.com/pywinrt/pywinrt"
|
|
23
|
-
Documentation = "https://pywinrt.readthedocs.io"
|
|
24
|
-
Repository = "https://github.com/pywinrt/pywinrt"
|
|
25
|
-
Changelog = "https://github.com/pywinrt/pywinrt/blob/main/CHANGELOG.md"
|
|
26
|
-
|
|
27
|
-
[tool.setuptools.dynamic]
|
|
28
|
-
version = { file = "pywinrt-version.txt" }
|
|
29
|
-
|
|
30
|
-
[tool.setuptools.package-data]
|
|
31
|
-
"*" = ["*.pyi", "py.typed"]
|
|
32
|
-
|
|
33
|
-
[tool.cibuildwheel]
|
|
34
|
-
# use local winrt-sdk build dependency
|
|
35
|
-
environment = { PYTHONPATH="../../winrt-sdk/src" }
|
|
36
|
-
# don't install winrt-sdk from PyPI
|
|
37
|
-
build-frontend = { name = "build[uv]", args = ["--skip-dependency-check", "--no-isolation"] }
|
|
38
|
-
before-build = "uv pip install setuptools"
|
|
39
|
-
# don't build for PyPy
|
|
40
|
-
skip = "pp*"
|
|
41
|
-
# suppress warnings about ARM64 testing
|
|
42
|
-
test-skip = "*-win_arm64"
|
|
43
|
-
|
|
44
|
-
[tool.cibuildwheel.windows]
|
|
45
|
-
archs = ["x86", "AMD64", "ARM64"]
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
3.2.0
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
from winrt.windows.graphics.directx.direct3d11 import IDirect3DDevice
|
|
2
|
-
from winrt.system import Object
|
|
3
|
-
|
|
4
|
-
def create_direct3d11_device_from_dxgi_device(dxgi_device: int) -> IDirect3DDevice:
|
|
5
|
-
"""
|
|
6
|
-
Creates an instance of IDirect3DDevice from an IDXGIDevice.
|
|
7
|
-
|
|
8
|
-
Args:
|
|
9
|
-
dxgi_device (IDXGIDevice*): The IDXGIDevice to create the Direct3DDevice from.
|
|
10
|
-
|
|
11
|
-
Returns:
|
|
12
|
-
A Direct3DDevice instance that wraps the DXGIDevice.
|
|
13
|
-
"""
|
|
14
|
-
|
|
15
|
-
def create_direct3d11_surface_from_dxgi_surface(dxgi_surface: int) -> int:
|
|
16
|
-
"""
|
|
17
|
-
Creates an instance of IDirect3DSurface from an IDXGISurface.
|
|
18
|
-
|
|
19
|
-
Args:
|
|
20
|
-
dxgi_surface (IDXGISurface*): The IDXGISurface to create the Direct3DSurface from.
|
|
21
|
-
|
|
22
|
-
Returns:
|
|
23
|
-
Pointer to IDirect3DSurface interface of the IDXGISurface.
|
|
24
|
-
"""
|
|
25
|
-
|
|
26
|
-
def get_dxgi_device_from_object(object: Object) -> int:
|
|
27
|
-
"""
|
|
28
|
-
Retrieves the IDXGIDevice from a Direct3D object.
|
|
29
|
-
|
|
30
|
-
Args:
|
|
31
|
-
object: The WinRT object to retrieve the IDXGIDevice from.
|
|
32
|
-
|
|
33
|
-
Returns:
|
|
34
|
-
Pointer to IDXGIDevice interface of the WinRT object.
|
|
35
|
-
"""
|
|
36
|
-
|
|
37
|
-
def get_dxgi_surface_from_object(object: Object) -> int:
|
|
38
|
-
"""
|
|
39
|
-
Retrieves the IDXGISurface from a Direct3D object.
|
|
40
|
-
|
|
41
|
-
Args:
|
|
42
|
-
object: The WinRT object to retrieve the IDXGISurface from.
|
|
43
|
-
|
|
44
|
-
Returns:
|
|
45
|
-
Pointer to IDXGISurface interface of the WinRT object.
|
|
46
|
-
"""
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
from winrt._winrt_windows_graphics_directx_direct3d11_interop import (
|
|
2
|
-
create_direct3d11_device_from_dxgi_device,
|
|
3
|
-
create_direct3d11_surface_from_dxgi_surface,
|
|
4
|
-
get_dxgi_device_from_object,
|
|
5
|
-
get_dxgi_surface_from_object,
|
|
6
|
-
)
|
|
7
|
-
|
|
8
|
-
__all__ = [
|
|
9
|
-
"create_direct3d11_device_from_dxgi_device",
|
|
10
|
-
"create_direct3d11_surface_from_dxgi_surface",
|
|
11
|
-
"get_dxgi_device_from_object",
|
|
12
|
-
"get_dxgi_surface_from_object",
|
|
13
|
-
]
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: winrt-Windows.Graphics.DirectX.Direct3D11.Interop
|
|
3
|
-
Version: 3.2.0
|
|
4
|
-
Summary: Python projection of Windows Runtime (WinRT) APIs
|
|
5
|
-
License-Expression: MIT
|
|
6
|
-
Project-URL: Documentation, https://pywinrt.readthedocs.io
|
|
7
|
-
Project-URL: Repository, https://github.com/pywinrt/pywinrt
|
|
8
|
-
Project-URL: Changelog, https://github.com/pywinrt/pywinrt/blob/main/CHANGELOG.md
|
|
9
|
-
Classifier: Operating System :: Microsoft :: Windows
|
|
10
|
-
Classifier: Programming Language :: Python :: 3
|
|
11
|
-
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
12
|
-
Classifier: Intended Audience :: Developers
|
|
13
|
-
Requires-Python: >=3.9
|
|
14
|
-
Description-Content-Type: text/markdown
|
|
15
|
-
|
|
16
|
-
<!-- warning: Please don't edit this file. It was automatically generated. -->
|
|
17
|
-
|
|
18
|
-
# winrt-Windows.Graphics.DirectX.Direct3D11.Interop
|
|
19
|
-
|
|
20
|
-
Windows Runtime (WinRT) APIs for for the `Windows.Graphics.DirectX.Direct3D11.Interop` namespace.
|
|
21
|
-
|
|
22
|
-
This package provides the `winrt.windows.graphics.directx.direct3d11.interop` module.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|