Merge pull request #45 from digarok/sdl2_performance_profile

fix sdl frame rendering vsync method to simply present the buffer once per frame
This commit is contained in:
Dagen Brock 2018-08-26 14:23:12 -05:00 committed by GitHub
commit 712c0792bf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 18 deletions

View File

@ -416,17 +416,9 @@ void sdl_push_kimage(Kimage *kimage_ptr, int destx, int desty, int srcx, int src
pitch = BORDER_WIDTH+72;
}
SDL_UpdateTexture(texture, &dstrect, src_ptr, pitch*4 );
SDL_RenderClear(renderer);
SDL_RenderCopy(renderer, texture, NULL, NULL);
if (g_scanline_simulator) {
SDL_RenderCopy(renderer, overlay_texture, NULL, NULL);
}
SDL_RenderPresent(renderer);
if (g_screenshot_requested) {
x_take_screenshot();
g_screenshot_requested = 0;
}
// We now call the render step seperately in sdl_present_buffer once per frame
// SDL picks up the buffer and waits for VBLANK to send it
}
@ -806,6 +798,19 @@ void debuginfo_renderer(SDL_Renderer *r) {
}
}
void sdl_present_buffer() {
SDL_RenderClear(renderer);
SDL_RenderCopy(renderer, texture, NULL, NULL);
if (g_scanline_simulator) {
SDL_RenderCopy(renderer, overlay_texture, NULL, NULL);
}
SDL_RenderPresent(renderer);
if (g_screenshot_requested) {
x_take_screenshot();
g_screenshot_requested = 0;
}
}
// BELOW ARE FUNCTIONS THAT ARE EITHER UNIMPLEMENTED, OR AR NOT RELEVANT TO
// THIS DRIVER.

View File

@ -640,7 +640,10 @@ void video_update() {
video_update_through_line(0);
}
#if defined(HAVE_SDL)
extern void sdl_present_buffer();
sdl_present_buffer();
#endif
// OG Notify host that video has been uodated
#if defined(ACTIVEGSPLUGIN) && defined(MAC)
{
@ -3474,13 +3477,6 @@ void video_update_color_array(int col_num, int a2_color) {
return;
}
#if 0
if(g_screen_depth != 8) {
/* redraw whole superhires for now */
g_full_refresh_needed = -1;
}
#endif
video_update_color_raw(col_num, a2_color);
}