forked from s90110019/Gsdx-cutie
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GSRendererCS.h
145 lines (121 loc) · 3.14 KB
/
GSRendererCS.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
/*
* Copyright (C) 2007-2009 Gabest
* http://www.gabest.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA USA.
* http://www.gnu.org/copyleft/gpl.html
*
*/
#pragma once
#include "GSRenderer.h"
#include "GSDevice11.h"
class GSRendererCS : public GSRenderer
{
struct VSSelector
{
union
{
struct
{
uint32 tme:1;
uint32 fst:1;
};
uint32 key;
};
operator uint32() {return key & 0x3;}
VSSelector() : key(0) {}
};
__aligned(struct, 32) VSConstantBuffer
{
GSVector4 VertexScale;
GSVector4 VertexOffset;
};
struct GSSelector
{
union
{
struct
{
uint32 iip:1;
uint32 prim:2;
};
uint32 key;
};
operator uint32() {return key & 0x7;}
GSSelector() : key(0) {}
};
struct PSSelector
{
union
{
struct
{
uint32 fpsm:6;
uint32 zpsm:6;
};
uint32 key;
};
operator uint32() {return key & 0x3ff;}
PSSelector() : key(0) {}
};
__aligned(struct, 32) PSConstantBuffer
{
uint32 fm;
uint32 zm;
};
CComPtr<ID3D11DepthStencilState> m_dss;
CComPtr<ID3D11BlendState> m_bs;
CComPtr<ID3D11SamplerState> m_ss;
CComPtr<ID3D11Buffer> m_lb;
CComPtr<ID3D11UnorderedAccessView> m_lb_uav;
CComPtr<ID3D11ShaderResourceView> m_lb_srv;
CComPtr<ID3D11Buffer> m_sob;
CComPtr<ID3D11UnorderedAccessView> m_sob_uav;
CComPtr<ID3D11ShaderResourceView> m_sob_srv;
CComPtr<ID3D11Buffer> m_vm;
//CComPtr<ID3D11Texture2D> m_vm;
CComPtr<ID3D11UnorderedAccessView> m_vm_uav;
uint32 m_vm_valid[16];
CComPtr<ID3D11Buffer> m_pb;
//CComPtr<ID3D11Texture2D> m_pb;
hash_map<uint32, GSVertexShader11 > m_vs;
CComPtr<ID3D11Buffer> m_vs_cb;
hash_map<uint32, CComPtr<ID3D11GeometryShader> > m_gs;
CComPtr<ID3D11PixelShader> m_ps0;
hash_map<uint32, CComPtr<ID3D11PixelShader> > m_ps1;
CComPtr<ID3D11Buffer> m_ps_cb;
void Write(GSOffset* off, const GSVector4i& r);
void Read(GSOffset* off, const GSVector4i& r, bool invalidate);
struct OffsetBuffer
{
CComPtr<ID3D11Buffer> row, col;
CComPtr<ID3D11ShaderResourceView> row_srv, col_srv;
};
hash_map<uint32, OffsetBuffer> m_offset;
bool GetOffsetBuffer(OffsetBuffer** fzbo);
protected:
GSTexture* m_texture[2];
uint8* m_output;
bool CreateDevice(GSDevice* dev);
void ResetDevice();
void VSync(int field);
GSTexture* GetOutput(int i);
void Draw();
void InvalidateVideoMem(const GIFRegBITBLTBUF& BITBLTBUF, const GSVector4i& r);
void InvalidateLocalMem(const GIFRegBITBLTBUF& BITBLTBUF, const GSVector4i& r, bool clut);
public:
GSRendererCS();
virtual ~GSRendererCS();
};