• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* GStreamer
2  * Copyright (C) <2019> Seungha Yang <seungha.yang@navercorp.com>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19 
20 #ifndef __GST_D3D11_SHADER_H__
21 #define __GST_D3D11_SHADER_H__
22 
23 #include <gst/gst.h>
24 #include <gst/video/video.h>
25 #include <gst/d3d11/gstd3d11.h>
26 
27 #include <d3dcompiler.h>
28 
29 G_BEGIN_DECLS
30 
31 typedef struct _GstD3D11Quad GstD3D11Quad;
32 
33 gboolean gst_d3d11_shader_init (void);
34 
35 gboolean gst_d3d11_create_pixel_shader (GstD3D11Device * device,
36                                         const gchar * source,
37                                         ID3D11PixelShader ** shader);
38 
39 gboolean gst_d3d11_create_vertex_shader (GstD3D11Device * device,
40                                          const gchar * source,
41                                          const D3D11_INPUT_ELEMENT_DESC * input_desc,
42                                          guint desc_len,
43                                          ID3D11VertexShader ** shader,
44                                          ID3D11InputLayout ** layout);
45 
46 GstD3D11Quad * gst_d3d11_quad_new (GstD3D11Device * device,
47                                    ID3D11PixelShader * pixel_shader,
48                                    ID3D11VertexShader * vertex_shader,
49                                    ID3D11InputLayout * layout,
50                                    ID3D11Buffer ** const_buffers,
51                                    guint num_const_buffers,
52                                    ID3D11Buffer * vertex_buffer,
53                                    guint vertex_stride,
54                                    ID3D11Buffer * index_buffer,
55                                    DXGI_FORMAT index_format,
56                                    guint index_count);
57 
58 void          gst_d3d11_quad_free (GstD3D11Quad * quad);
59 
60 gboolean gst_d3d11_draw_quad (GstD3D11Quad * quad,
61                               D3D11_VIEWPORT viewport[GST_VIDEO_MAX_PLANES],
62                               guint num_viewport,
63                               ID3D11ShaderResourceView *srv[GST_VIDEO_MAX_PLANES],
64                               guint num_srv,
65                               ID3D11RenderTargetView *rtv[GST_VIDEO_MAX_PLANES],
66                               guint num_rtv,
67                               ID3D11BlendState *blend,
68                               gfloat blend_factor[4],
69                               ID3D11SamplerState ** sampler,
70                               guint num_sampler);
71 
72 gboolean gst_d3d11_draw_quad_unlocked (GstD3D11Quad * quad,
73                                        D3D11_VIEWPORT viewport[GST_VIDEO_MAX_PLANES],
74                                        guint num_viewport,
75                                        ID3D11ShaderResourceView *srv[GST_VIDEO_MAX_PLANES],
76                                        guint num_srv,
77                                        ID3D11RenderTargetView *rtv[GST_VIDEO_MAX_PLANES],
78                                        guint num_rtv,
79                                        ID3D11BlendState *blend,
80                                        gfloat blend_factor[4],
81                                        ID3D11SamplerState ** sampler,
82                                        guint num_sampler);
83 
84 G_END_DECLS
85 
86 #endif /* __GST_D3D11_SHADER_H__ */
87