mirror of
https://github.com/libretro/RetroArch
synced 2025-04-17 02:43:03 +00:00
Make an "empty" buffer for performance. Also attempt to fall back if
vsync fails on start.
This commit is contained in:
parent
44c52ca4f8
commit
c646166fe1
@ -134,7 +134,7 @@ clean:
|
||||
rm -f tools/*.o
|
||||
|
||||
dist: all
|
||||
zip -r ssnes-win32-0.5.zip $(TARGET) ssnes.cfg snes.dll libxml2.dll iconv.dll zlib1.dll SDL.dll freetype6.dll xaudio-c.dll rsound.dll pthreadGC2.dll README.win32.txt $(JTARGET)
|
||||
zip -r ssnes-win32-0.5.1.zip $(TARGET) ssnes.cfg snes.dll libxml2.dll iconv.dll zlib1.dll SDL.dll freetype6.dll xaudio-c.dll rsound.dll pthreadGC2.dll README.win32.txt $(JTARGET)
|
||||
|
||||
libs:
|
||||
wget https://github.com/downloads/Themaister/SSNES/SSNES-win32-libs.zip --no-check-certificate
|
||||
|
42
gfx/gl.c
42
gfx/gl.c
@ -124,6 +124,8 @@ typedef struct gl
|
||||
GLuint texture;
|
||||
GLuint tex_filter;
|
||||
|
||||
void *empty_buf;
|
||||
|
||||
unsigned frame_count;
|
||||
|
||||
#ifdef HAVE_FBO
|
||||
@ -771,19 +773,16 @@ static bool gl_frame(void *data, const void* frame, unsigned width, unsigned hei
|
||||
#endif
|
||||
}
|
||||
|
||||
if (width != gl->last_width || height != gl->last_height) // Res change. need to clear out texture.
|
||||
if ((width != gl->last_width || height != gl->last_height) && gl->empty_buf) // Res change. need to clear out texture.
|
||||
{
|
||||
gl->last_width = width;
|
||||
gl->last_height = height;
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, get_alignment(pitch));
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, gl->tex_w);
|
||||
|
||||
// Can we pass NULL here, hmm?
|
||||
void *tmp = calloc(1, gl->tex_w * gl->tex_h * gl->base_size);
|
||||
glTexSubImage2D(GL_TEXTURE_2D,
|
||||
0, 0, 0, gl->tex_w, gl->tex_h, gl->texture_type,
|
||||
gl->texture_fmt, tmp);
|
||||
free(tmp);
|
||||
gl->texture_fmt, gl->empty_buf);
|
||||
|
||||
GLfloat x = (GLfloat)width / gl->tex_w;
|
||||
GLfloat y = (GLfloat)height / gl->tex_h;
|
||||
@ -931,6 +930,9 @@ static void gl_free(void *data)
|
||||
#endif
|
||||
SDL_QuitSubSystem(SDL_INIT_VIDEO);
|
||||
|
||||
if (gl->empty_buf)
|
||||
free(gl->empty_buf);
|
||||
|
||||
free(gl);
|
||||
}
|
||||
|
||||
@ -955,7 +957,7 @@ static void gl_set_nonblock_state(void *data, bool state)
|
||||
}
|
||||
if (!glx_swap_interval)
|
||||
{
|
||||
SDL_SYM_WRAP(glx_swap_interval, "glxSwapIntervalMESA");
|
||||
SDL_SYM_WRAP(glx_swap_interval, "glXSwapIntervalMESA");
|
||||
}
|
||||
if (glx_swap_interval) glx_swap_interval(state ? 0 : 1);
|
||||
#endif
|
||||
@ -983,16 +985,7 @@ static void* gl_init(const video_info_t *video, const input_driver_t **input, vo
|
||||
SDL_ShowCursor(SDL_DISABLE);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
int attr = 0;
|
||||
SDL_GL_GetAttribute(SDL_GL_SWAP_CONTROL, &attr);
|
||||
if (attr <= 0 && video->vsync)
|
||||
SSNES_WARN("GL VSync has not been enabled!\n");
|
||||
attr = 0;
|
||||
SDL_GL_GetAttribute(SDL_GL_DOUBLEBUFFER, &attr);
|
||||
if (attr <= 0)
|
||||
SSNES_WARN("GL double buffer has not been enabled!\n");
|
||||
|
||||
#if (defined(HAVE_XML) || defined(HAVE_CG)) && defined(_WIN32)
|
||||
#if (defined(HAVE_XML) || defined(HAVE_CG)) && defined(_WIN32)
|
||||
// Win32 GL lib doesn't have some functions needed for XML shaders.
|
||||
// Need to load dynamically :(
|
||||
if (!load_gl_proc())
|
||||
@ -1009,6 +1002,19 @@ static void* gl_init(const video_info_t *video, const input_driver_t **input, vo
|
||||
return NULL;
|
||||
}
|
||||
|
||||
gl->vsync = video->vsync;
|
||||
int attr = 0;
|
||||
SDL_GL_GetAttribute(SDL_GL_SWAP_CONTROL, &attr);
|
||||
if (attr <= 0 && video->vsync)
|
||||
{
|
||||
SSNES_WARN("GL VSync has not been enabled, attempting to recover using native calls!\n");
|
||||
gl_set_nonblock_state(gl, false);
|
||||
}
|
||||
attr = 0;
|
||||
SDL_GL_GetAttribute(SDL_GL_DOUBLEBUFFER, &attr);
|
||||
if (attr <= 0)
|
||||
SSNES_WARN("GL double buffer has not been enabled!\n");
|
||||
|
||||
gl->full_x = full_x;
|
||||
gl->full_y = full_y;
|
||||
|
||||
@ -1038,7 +1044,6 @@ static void* gl_init(const video_info_t *video, const input_driver_t **input, vo
|
||||
// Set up render to texture.
|
||||
gl_init_fbo(gl, 256 * video->input_scale, 256 * video->input_scale);
|
||||
|
||||
gl->vsync = video->vsync;
|
||||
gl->keep_aspect = video->force_aspect;
|
||||
|
||||
// Apparently need to set viewport for passes when we aren't using FBOs.
|
||||
@ -1102,6 +1107,9 @@ static void* gl_init(const video_info_t *video, const input_driver_t **input, vo
|
||||
0, GL_RGBA, gl->tex_w, gl->tex_h, 0, gl->texture_type,
|
||||
gl->texture_fmt, NULL);
|
||||
|
||||
// Empty buffer that we use to clear out the texture with on res change.
|
||||
gl->empty_buf = calloc(gl->base_size, gl->tex_w * gl->tex_h);
|
||||
|
||||
gl->last_width = gl->tex_w;
|
||||
gl->last_height = gl->tex_h;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
. qb/qb.params.sh
|
||||
|
||||
PACKAGE_NAME=ssnes
|
||||
PACKAGE_VERSION=0.5
|
||||
PACKAGE_VERSION=0.5.1
|
||||
|
||||
# Adds a command line opt to ./configure --help
|
||||
# $1: Variable (HAVE_ALSA, HAVE_OSS, etc)
|
||||
|
Loading…
x
Reference in New Issue
Block a user