@@ -17,24 +17,18 @@ void free_vid_mode_list();
1717
1818CHW HW;
1919
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*/ )
2222{
2323 if (severity != GL_DEBUG_SEVERITY_NOTIFICATION)
2424 Log (message, id);
2525}
2626
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+ }
3832
3933CHW::~CHW () {}
4034// ////////////////////////////////////////////////////////////////////
@@ -46,7 +40,7 @@ void CHW::CreateDevice(SDL_Window* hWnd)
4640
4741 R_ASSERT (m_hWnd);
4842
49- // Choose the closest pixel format
43+ // Choose the closest pixel format
5044 SDL_DisplayMode mode;
5145 SDL_GetWindowDisplayMode (m_hWnd, &mode);
5246 mode.format = SDL_PIXELFORMAT_RGBA8888;
@@ -82,8 +76,8 @@ void CHW::CreateDevice(SDL_Window* hWnd)
8276 }
8377
8478#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 ));
8781#endif // DEBUG
8882
8983 // Clip control ensures compatibility with D3D device coordinates.
@@ -151,17 +145,23 @@ void fill_vid_mode_list(CHW* /*_hw*/)
151145
152146 int i = 0 ;
153147 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++)
155153 {
154+ SDL_DisplayMode mode;
155+ SDL_GetDisplayMode (0 , i, &mode);
156+
156157 string32 str;
157158
158- xr_sprintf (str, sizeof (str), " %dx%d" , dmi. dmPelsWidth , dmi. dmPelsHeight );
159+ xr_sprintf (str, sizeof (str), " %dx%d" , mode. w , mode. h );
159160
160161 if (AVM.cend () != find_if (AVM.cbegin (), AVM.cend (), uniqueRenderingMode (str)))
161162 continue ;
162163
163164 AVM.emplace_back (xr_token (xr_strdup (str), i));
164- ++i;
165165 }
166166 AVM.emplace_back (xr_token (nullptr , -1 ));
167167
@@ -191,7 +191,6 @@ void CHW::UpdateViews()
191191 CHK_GL (glTexStorage2D (GL_TEXTURE_2D, 1 , GL_DEPTH24_STENCIL8, psCurrentVidMode[0 ], psCurrentVidMode[1 ]));
192192}
193193
194-
195194void CHW::ClearRenderTargetView (GLuint pRenderTargetView, const FLOAT ColorRGBA[4 ])
196195{
197196 if (pRenderTargetView == 0 )
@@ -222,7 +221,6 @@ void CHW::ClearDepthStencilView(GLuint pDepthStencilView, UINT ClearFlags, FLOAT
222221 if (ClearFlags & D3D_CLEAR_STENCIL)
223222 mask |= (u32 )GL_STENCIL_BUFFER_BIT;
224223
225-
226224 glPushAttrib (mask);
227225 if (ClearFlags & D3D_CLEAR_DEPTH)
228226 {
0 commit comments