d3d_target.h Source File - ClanLib SDK
Description: d3d_target.h Source File

d3d_target.h
1/*
2** ClanLib SDK
3** Copyright (c) 1997-2020 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#pragma once
30
31#include "../Display/display_target.h"
32#include <memory>
33#include <d3d11.h>
34
35namespace clan
36{
39
40 class Texture;
41 class PixelBuffer;
42 class VertexArrayBuffer;
43 class ElementArrayBuffer;
44 class RenderBuffer;
45 class UniformBuffer;
46 class GraphicContext;
47
49 class D3DTarget
50 {
51 public:
55 static bool is_current();
56
60 static ID3D11Texture2D *get_texture2d_handle(const GraphicContext &gc, const Texture &texture);
61
65 static ID3D11Texture2D *get_texture2d_handle(const GraphicContext &gc, const PixelBuffer &pixel_buffer);
66
70 static ID3D11Texture2D *get_texture2d_handle(const GraphicContext &gc, const RenderBuffer &render_buffer);
71
75 static ID3D11Buffer *get_buffer_handle(const GraphicContext &gc, const VertexArrayBuffer &buffer);
76
80 static ID3D11Buffer *get_buffer_handle(const GraphicContext &gc, const ElementArrayBuffer &buffer);
81
85 static ID3D11Buffer *get_buffer_handle(const GraphicContext &gc, const UniformBuffer &buffer);
86
90 static ID3D11ShaderResourceView *get_srv_handle(const GraphicContext &gc, const Texture &texture);
91
95 static ID3D11Device *get_device_handle(const GraphicContext &gc);
96
100 static ID3D11DeviceContext *get_device_context_handle(const GraphicContext &gc);
101
105 static IDXGISwapChain *get_swap_chain_handle(const GraphicContext &gc);
106
110 static ID3D11RenderTargetView *get_back_buffer_rtv_handle(const GraphicContext &gc);
111
113 static void throw_if_failed(const char *text, HRESULT result);
114
116 static void set_current();
117 };
118
120}
clan::D3DTarget
Display target for clanDisplay.
Definition d3d_target.h:50
clan::D3DTarget::get_texture2d_handle
static ID3D11Texture2D * get_texture2d_handle(const GraphicContext &gc, const Texture &texture)
Returns the Direct3D handle used by the texture object.
clan::D3DTarget::throw_if_failed
static void throw_if_failed(const char *text, HRESULT result)
Throws an exception with the specified text if the passed result is an error condition.
clan::D3DTarget::get_srv_handle
static ID3D11ShaderResourceView * get_srv_handle(const GraphicContext &gc, const Texture &texture)
Returns the Direct3D shader resource view handle used by the texture object.
clan::D3DTarget::is_current
static bool is_current()
Returns true if this display target is the current target.
clan::D3DTarget::get_device_context_handle
static ID3D11DeviceContext * get_device_context_handle(const GraphicContext &gc)
Returns the Direct3D device context handle used by the graphic context.
clan::D3DTarget::get_device_handle
static ID3D11Device * get_device_handle(const GraphicContext &gc)
Returns the Direct3D device handle used by the graphic context.
clan::D3DTarget::get_buffer_handle
static ID3D11Buffer * get_buffer_handle(const GraphicContext &gc, const VertexArrayBuffer &buffer)
Returns the Direct3D handle used by the buffer object.
clan::D3DTarget::get_texture2d_handle
static ID3D11Texture2D * get_texture2d_handle(const GraphicContext &gc, const RenderBuffer &render_buffer)
Returns the Direct3D handle used by the render buffer object.
clan::D3DTarget::get_swap_chain_handle
static IDXGISwapChain * get_swap_chain_handle(const GraphicContext &gc)
Returns the Direct3D swap chain handle used by the graphic context.
clan::D3DTarget::get_texture2d_handle
static ID3D11Texture2D * get_texture2d_handle(const GraphicContext &gc, const PixelBuffer &pixel_buffer)
Returns the Direct3D handle used by the pixel buffer object.
clan::D3DTarget::set_current
static void set_current()
Set this display target to be the current target.
clan::D3DTarget::get_buffer_handle
static ID3D11Buffer * get_buffer_handle(const GraphicContext &gc, const UniformBuffer &buffer)
Returns the Direct3D handle used by the buffer object.
clan::D3DTarget::get_back_buffer_rtv_handle
static ID3D11RenderTargetView * get_back_buffer_rtv_handle(const GraphicContext &gc)
Returns the Direct3D render target view for the swap chain back buffer.
clan::D3DTarget::get_buffer_handle
static ID3D11Buffer * get_buffer_handle(const GraphicContext &gc, const ElementArrayBuffer &buffer)
Returns the Direct3D handle used by the buffer object.
clan::ElementArrayBuffer
Element Array Buffer.
Definition element_array_buffer.h:46
clan::GraphicContext
Interface to drawing graphics.
Definition graphic_context.h:257
clan::PixelBuffer
Pixel data container.
Definition pixel_buffer.h:68
clan::RenderBuffer
Render-buffer object class.
Definition render_buffer.h:47
clan::Texture
Texture object class.
Definition texture.h:103
clan::UniformBuffer
Uniform Buffer.
Definition uniform_buffer.h:47
clan::VertexArrayBuffer
Vertex Array Buffer.
Definition vertex_array_buffer.h:46
clan
Definition clanapp.h:36