Main change: Implemented EFB pokes in DX9/DX11.
[dolphin.git] / Source / Plugins / Plugin_VideoDX11 / Src / D3DUtil.h
blobb8fa15a907ef84d599e840ad7477e32688564b7c
1 // Copyright (C) 2003 Dolphin Project.
3 // This program is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, version 2.0.
7 // This program is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 // GNU General Public License 2.0 for more details.
12 // A copy of the GPL 2.0 should have been included with the program.
13 // If not, see http://www.gnu.org/licenses/
15 // Official SVN repository and contact information can be found at
16 // http://code.google.com/p/dolphin-emu/
18 #pragma once
20 #include "D3DBase.h"
21 #include <math.h>
22 #include <MathUtil.h>
24 namespace D3D
26 // Font creation flags
27 #define D3DFONT_BOLD 0x0001
28 #define D3DFONT_ITALIC 0x0002
30 // Font rendering flags
31 #define D3DFONT_CENTERED 0x0001
33 class CD3DFont
35 ID3D11ShaderResourceView* m_pTexture;
36 ID3D11Buffer* m_pVB;
37 ID3D11InputLayout* m_InputLayout;
38 ID3D11PixelShader* m_pshader;
39 ID3D11VertexShader* m_vshader;
40 ID3D11BlendState* m_blendstate;
41 ID3D11RasterizerState* m_raststate;
42 const int m_dwTexWidth;
43 const int m_dwTexHeight;
44 unsigned int m_LineHeight;
45 float m_fTexCoords[128-32][4];
47 public:
48 CD3DFont();
49 // 2D text drawing function
50 // Initializing and destroying device-dependent objects
51 int Init();
52 int Shutdown();
53 int DrawTextScaled(float x, float y,
54 float size,
55 float spacing, u32 dwColor,
56 const char* strText, bool center=true);
59 extern CD3DFont font;
61 void InitUtils();
62 void ShutdownUtils();
64 void SetPointCopySampler();
65 void SetLinearCopySampler();
67 void drawShadedTexQuad(ID3D11ShaderResourceView* texture,
68 const D3D11_RECT* rSource,
69 int SourceWidth,
70 int SourceHeight,
71 ID3D11PixelShader* PShader,
72 ID3D11VertexShader* VShader,
73 ID3D11InputLayout* layout);
74 void drawShadedTexSubQuad(ID3D11ShaderResourceView* texture,
75 const MathUtil::Rectangle<float>* rSource,
76 int SourceWidth,
77 int SourceHeight,
78 const MathUtil::Rectangle<float>* rDest,
79 ID3D11PixelShader* PShader,
80 ID3D11VertexShader* Vshader,
81 ID3D11InputLayout* layout);
82 void drawClearQuad(u32 Color, float z, ID3D11PixelShader* PShader, ID3D11VertexShader* Vshader, ID3D11InputLayout* layout);
83 void drawColorQuad(u32 Color, float x1, float y1, float x2, float y2);