Skip to content

Commit f3500de

Browse files
committed
minor sdl cleanups
1 parent 5c2756e commit f3500de

File tree

3 files changed

+14
-35
lines changed

3 files changed

+14
-35
lines changed

src/gl.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ void MessageCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLs
3131

3232
void gl_init_2d_mode(Gamep g)
3333
{
34-
LOG("SDL: init 2d mode");
34+
LOG("SDL: Init 2d mode");
3535
TRACE_AND_INDENT();
36-
GL_ERROR_CHECK();
3736

37+
GL_ERROR_CHECK();
3838
gl_leave_2d_mode(g);
3939

4040
//

src/music.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ bool music_init(void)
4646
//
4747
int flags = MIX_INIT_OGG;
4848
int initted = Mix_Init(flags);
49-
LOG("SDL: Mix_Init");
49+
LOG("SDL: Load mixer");
5050
if ((initted & flags) != flags) {
5151
ERR("Mix_Init: Failed to init required OGG support");
5252
}

src/sdl.cpp

+11-32
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,6 @@ void sdl_fini(Gamep g)
5656

5757
LOG("SDL: Quit");
5858
SDL_Quit();
59-
60-
LOG("SDL: Quit done");
6159
}
6260

6361
static inline void sdl_list_video_size(void)
@@ -196,7 +194,6 @@ uint8_t sdl_init_display(Gamep g)
196194
{
197195
int video_width;
198196
int video_height;
199-
int value;
200197

201198
sdl.init_video = 1;
202199

@@ -299,30 +296,32 @@ uint8_t sdl_init_display(Gamep g)
299296
ERR("SDL_GL_CreateContext failed %s", SDL_GetError());
300297
return false;
301298
}
302-
LOG("SDL: SDL_GL_CreateContext( done");
303299

304300
LOG("SDL: Call SDL_GL_MakeCurrent()");
305301
if (SDL_GL_MakeCurrent(sdl.window, sdl.context) < 0) {
306302
SDL_ClearError();
307303
ERR("SDL_GL_MakeCurrent failed %s", SDL_GetError());
308304
return false;
309305
}
310-
LOG("SDL: SDL_GL_MakeCurrent() done");
311306

312307
SDL_ClearError();
313308

314309
//
315310
// Clear the screen, both buffers
316311
//
317-
LOG("SDL: Clear screens");
318312
glcolor(WHITE);
319313
glClearColor(0, 0, 0, 0);
320314
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
321-
SDL_GL_SwapWindow(sdl.window);
322-
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
323-
SDL_GL_SwapWindow(sdl.window);
324315

325-
LOG("SDL: Call SDL_SetWindowTitle");
316+
//
317+
// Do we really need to do this? it takes a small bit of time.
318+
//
319+
if (0) {
320+
SDL_GL_SwapWindow(sdl.window);
321+
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
322+
SDL_GL_SwapWindow(sdl.window);
323+
}
324+
326325
SDL_SetWindowTitle(sdl.window, "gorget");
327326

328327
LOG("SDL: OpenGL Vendor : %s", glGetString(GL_VENDOR));
@@ -331,26 +330,6 @@ uint8_t sdl_init_display(Gamep g)
331330

332331
IF_DEBUG { DBG("SDL: OpenGL Exts : %s", glGetString(GL_EXTENSIONS)); }
333332

334-
SDL_GL_GetAttribute(SDL_GL_RED_SIZE, &value);
335-
LOG("SDL: Red size : %d", value);
336-
337-
SDL_GL_GetAttribute(SDL_GL_GREEN_SIZE, &value);
338-
LOG("SDL: Green size : %d", value);
339-
340-
SDL_GL_GetAttribute(SDL_GL_BLUE_SIZE, &value);
341-
LOG("SDL: Blue size : %d", value);
342-
343-
SDL_GL_GetAttribute(SDL_GL_DEPTH_SIZE, &value);
344-
LOG("SDL: Depth size : %d", value);
345-
346-
SDL_GL_GetAttribute(SDL_GL_DOUBLEBUFFER, &value);
347-
LOG("SDL: Double buf : %d", value);
348-
349-
SDL_GL_GetAttribute(SDL_GL_ACCELERATED_VISUAL, &value);
350-
LOG("SDL: Hw Accel : %d", value);
351-
352-
LOG("SDL: Vsync : %d", SDL_GL_GetSwapInterval());
353-
354333
return true;
355334
}
356335

@@ -664,12 +643,12 @@ uint8_t config_errored(Gamep g, class Tokens *tokens, void *context)
664643

665644
void sdl_config_update_all(Gamep g)
666645
{
667-
TRACE_NO_INDENT();
668646
LOG("SDL: Update config");
647+
TRACE_AND_INDENT();
648+
669649
config_game_gfx_update(g);
670650
config_gfx_vsync_update(g);
671651
gl_init_2d_mode(g);
672-
LOG("SDL: Updated config");
673652
}
674653

675654
//

0 commit comments

Comments
 (0)