• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * GStreamer
3  * Copyright (C) 2020 Seungha Yang <seungha@centricular.com>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18  * Boston, MA 02110-1301, USA.
19  */
20 
21 #include <gst/gst.h>
22 #include <windows.h>
23 #include <d3d11.h>
24 #include <dxgi1_2.h>
25 
26 typedef struct
27 {
28   struct {
29     FLOAT x;
30     FLOAT y;
31     FLOAT z;
32   } position;
33   struct {
34     FLOAT x;
35     FLOAT y;
36   } texture;
37 } VertexData;
38 
39 HRESULT
40 prepare_d3d11_device (ID3D11Device ** d3d11_device,
41                       ID3D11DeviceContext ** d3d11_context,
42                       IDXGIFactory2 ** dxgi_factory);
43 
44 HRESULT
45 prepare_shared_texture (ID3D11Device * d3d11_device,
46                         guint width,
47                         guint height,
48                         DXGI_FORMAT format,
49                         UINT misc_flags,
50                         ID3D11Texture2D ** texture,
51                         ID3D11ShaderResourceView ** srv,
52                         IDXGIKeyedMutex ** keyed_mutex,
53                         HANDLE * shared_handle);
54 
55 HRESULT
56 prepare_shader (ID3D11Device * d3d11_device,
57                 ID3D11DeviceContext * context,
58                 ID3D11SamplerState ** sampler,
59                 ID3D11PixelShader ** ps,
60                 ID3D11VertexShader ** vs,
61                 ID3D11InputLayout ** layout,
62                 ID3D11Buffer ** vertex,
63                 ID3D11Buffer ** index);