d3d_target.h
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2013 The ClanLib Team
4 **
5 ** This software is provided 'as-is', without any express or implied
6 ** warranty. In no event will the authors be held liable for any damages
7 ** arising from the use of this software.
8 **
9 ** Permission is granted to anyone to use this software for any purpose,
10 ** including commercial applications, and to alter it and redistribute it
11 ** freely, subject to the following restrictions:
12 **
13 ** 1. The origin of this software must not be misrepresented; you must not
14 ** claim that you wrote the original software. If you use this software
15 ** in a product, an acknowledgment in the product documentation would be
16 ** appreciated but is not required.
17 ** 2. Altered source versions must be plainly marked as such, and must not be
18 ** misrepresented as being the original software.
19 ** 3. This notice may not be removed or altered from any source distribution.
20 **
21 ** Note: Some of the libraries ClanLib may link to may have additional
22 ** requirements or restrictions.
23 **
24 ** File Author(s):
25 **
26 ** Magnus Norddahl
27 */
28 
29 
30 #pragma once
31 
32 #include "api_d3d.h"
33 #include "../Display/display_target.h"
34 #include <memory>
35 #include <d3d11.h>
36 
37 namespace clan
38 {
41 
42 class Texture;
43 class PixelBuffer;
44 class VertexArrayBuffer;
45 class ElementArrayBuffer;
46 class RenderBuffer;
47 class UniformBuffer;
48 class GraphicContext;
49 
51 class CL_API_D3D D3DTarget : public DisplayTarget
52 {
55 public:
57  D3DTarget();
58  ~D3DTarget();
60 
63 public:
67  static bool is_current();
68 
70 
73 public:
77  static ID3D11Texture2D *get_texture2d_handle(const GraphicContext &gc, const Texture &texture);
78 
82  static ID3D11Texture2D *get_texture2d_handle(const GraphicContext &gc, const PixelBuffer &pixel_buffer);
83 
87  static ID3D11Texture2D *get_texture2d_handle(const GraphicContext &gc, const RenderBuffer &render_buffer);
88 
92  static ID3D11Buffer *get_buffer_handle(const GraphicContext &gc, const VertexArrayBuffer &buffer);
93 
97  static ID3D11Buffer *get_buffer_handle(const GraphicContext &gc, const ElementArrayBuffer &buffer);
98 
102  static ID3D11Buffer *get_buffer_handle(const GraphicContext &gc, const UniformBuffer &buffer);
103 
107  static ID3D11Device *get_device_handle(const GraphicContext &gc);
108 
112  static ID3D11DeviceContext *get_device_context_handle(const GraphicContext &gc);
113 
115  static void throw_if_failed(const char *text, HRESULT result);
116 
118  static void set_current();
119 
121 
124 private:
126 };
127 
128 }
129 
Vertex Array Buffer.
Definition: vertex_array_buffer.h:47
Texture object class.
Definition: texture.h:104
Pixel data container.
Definition: pixel_buffer.h:69
Display target for clanDisplay.
Definition: d3d_target.h:51
Element Array Buffer.
Definition: element_array_buffer.h:47
Uniform Buffer.
Definition: uniform_buffer.h:48
Display target for clanDisplay.
Definition: display_target.h:44
Interface to drawing graphics.
Definition: graphic_context.h:257
Render-buffer object class.
Definition: render_buffer.h:48