@@ -17,24 +17,18 @@ void free_vid_mode_list();
17
17
18
18
CHW HW;
19
19
20
- void CALLBACK OnDebugCallback (GLenum /* source*/ , GLenum /* type*/ , GLuint id, GLenum severity,
21
- GLsizei /* length */ , const GLchar* message, const void * /* userParam*/ )
20
+ void CALLBACK OnDebugCallback (GLenum /* source*/ , GLenum /* type*/ , GLuint id, GLenum severity, GLsizei /* length */ ,
21
+ const GLchar* message, const void * /* userParam*/ )
22
22
{
23
23
if (severity != GL_DEBUG_SEVERITY_NOTIFICATION)
24
24
Log (message, id);
25
25
}
26
26
27
- CHW::CHW () :
28
- pDevice(this ),
29
- pContext(this ),
30
- m_pSwapChain(this ),
31
- pBaseRT(0 ),
32
- pBaseZB(0 ),
33
- pPP(0 ),
34
- pFB(0 ),
35
- m_hWnd(nullptr ),
36
- m_hDC(nullptr ),
37
- m_hRC(nullptr ) {}
27
+ CHW::CHW ()
28
+ : pDevice(this ), pContext(this ), m_pSwapChain(this ), pBaseRT(0 ), pBaseZB(0 ), pPP(0 ), pFB(0 ), m_hWnd(nullptr ),
29
+ m_hDC(nullptr ), m_hRC(nullptr )
30
+ {
31
+ }
38
32
39
33
CHW::~CHW () {}
40
34
// ////////////////////////////////////////////////////////////////////
@@ -46,7 +40,7 @@ void CHW::CreateDevice(SDL_Window* hWnd)
46
40
47
41
R_ASSERT (m_hWnd);
48
42
49
- // Choose the closest pixel format
43
+ // Choose the closest pixel format
50
44
SDL_DisplayMode mode;
51
45
SDL_GetWindowDisplayMode (m_hWnd, &mode);
52
46
mode.format = SDL_PIXELFORMAT_RGBA8888;
@@ -82,8 +76,8 @@ void CHW::CreateDevice(SDL_Window* hWnd)
82
76
}
83
77
84
78
#ifdef DEBUG
85
- CHK_GL (glEnable (GL_DEBUG_OUTPUT));
86
- CHK_GL (glDebugMessageCallback ((GLDEBUGPROC)OnDebugCallback, nullptr ));
79
+ CHK_GL (glEnable (GL_DEBUG_OUTPUT));
80
+ CHK_GL (glDebugMessageCallback ((GLDEBUGPROC)OnDebugCallback, nullptr ));
87
81
#endif // DEBUG
88
82
89
83
// Clip control ensures compatibility with D3D device coordinates.
@@ -151,17 +145,23 @@ void fill_vid_mode_list(CHW* /*_hw*/)
151
145
152
146
int i = 0 ;
153
147
auto & AVM = AvailableVideoModes;
154
- while (EnumDisplaySettings (nullptr , iModeNum++, &dmi) != 0 )
148
+
149
+ int num_modes = SDL_GetNumDisplayModes (0 );
150
+ Log (" found video modes:" , num_modes);
151
+
152
+ for (i = 0 ; i < num_modes; i++)
155
153
{
154
+ SDL_DisplayMode mode;
155
+ SDL_GetDisplayMode (0 , i, &mode);
156
+
156
157
string32 str;
157
158
158
- xr_sprintf (str, sizeof (str), " %dx%d" , dmi. dmPelsWidth , dmi. dmPelsHeight );
159
+ xr_sprintf (str, sizeof (str), " %dx%d" , mode. w , mode. h );
159
160
160
161
if (AVM.cend () != find_if (AVM.cbegin (), AVM.cend (), uniqueRenderingMode (str)))
161
162
continue ;
162
163
163
164
AVM.emplace_back (xr_token (xr_strdup (str), i));
164
- ++i;
165
165
}
166
166
AVM.emplace_back (xr_token (nullptr , -1 ));
167
167
@@ -191,7 +191,6 @@ void CHW::UpdateViews()
191
191
CHK_GL (glTexStorage2D (GL_TEXTURE_2D, 1 , GL_DEPTH24_STENCIL8, psCurrentVidMode[0 ], psCurrentVidMode[1 ]));
192
192
}
193
193
194
-
195
194
void CHW::ClearRenderTargetView (GLuint pRenderTargetView, const FLOAT ColorRGBA[4 ])
196
195
{
197
196
if (pRenderTargetView == 0 )
@@ -222,7 +221,6 @@ void CHW::ClearDepthStencilView(GLuint pDepthStencilView, UINT ClearFlags, FLOAT
222
221
if (ClearFlags & D3D_CLEAR_STENCIL)
223
222
mask |= (u32 )GL_STENCIL_BUFFER_BIT;
224
223
225
-
226
224
glPushAttrib (mask);
227
225
if (ClearFlags & D3D_CLEAR_DEPTH)
228
226
{
0 commit comments