Turn fixed-function vertex coord/matrix code into macros

This commit is contained in:
twinaphex 2014-10-02 14:50:24 +02:00
parent aed7afb31d
commit 53c7bf65ed
3 changed files with 29 additions and 25 deletions

View File

@ -1551,12 +1551,9 @@ void *driver_video_resolve(const video_driver_t **drv)
if (g_settings.video.threaded
&& !g_extern.system.hw_render_callback.context_type)
return rarch_threaded_video_resolve(drv);
else
#endif
{
if (drv)
*drv = driver.video;
if (drv)
*drv = driver.video;
return driver.video_data;
}
return driver.video_data;
}

View File

@ -90,30 +90,13 @@ void gl_shader_set_coords(gl_t *gl,
if (!gl->shader->set_coords(coords))
{
#ifndef NO_GL_FF_VERTEX
/* Fall back to FF-style if needed and possible. */
glClientActiveTexture(GL_TEXTURE1);
glTexCoordPointer(2, GL_FLOAT, 0, coords->lut_tex_coord);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
glClientActiveTexture(GL_TEXTURE0);
glVertexPointer(2, GL_FLOAT, 0, coords->vertex);
glEnableClientState(GL_VERTEX_ARRAY);
glColorPointer(4, GL_FLOAT, 0, coords->color);
glEnableClientState(GL_COLOR_ARRAY);
glTexCoordPointer(2, GL_FLOAT, 0, coords->tex_coord);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
gl_ff_vertex(coords);
#endif
}
if (!gl->shader->set_mvp(gl, mat))
{
#ifndef NO_GL_FF_MATRIX
/* Fall back to FF-style if needed and possible. */
glMatrixMode(GL_PROJECTION);
glLoadMatrixf(mat->data);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gl_ff_matrix(mat);
#endif
}
}

View File

@ -355,12 +355,16 @@ extern void glBufferSubDataTextureReferenceRA( GLenum target,
#endif
#if defined(HAVE_OPENGL_MODERN) || defined(HAVE_OPENGLES2) || defined(HAVE_PSGL)
#ifndef NO_GL_FF_VERTEX
#define NO_GL_FF_VERTEX
#endif
#endif
#if defined(HAVE_OPENGL_MODERN) || defined(HAVE_OPENGLES2) || defined(HAVE_PSGL)
#ifndef NO_GL_FF_MATRIX
#define NO_GL_FF_MATRIX
#endif
#endif
#if defined(HAVE_OPENGLES2) /* TODO: Figure out exactly what. */
#define NO_GL_CLAMP_TO_BORDER
@ -376,6 +380,26 @@ extern void glBufferSubDataTextureReferenceRA( GLenum target,
#endif
#endif
/* Fall back to FF-style if needed and possible. */
#define gl_ff_vertex(coords) \
glClientActiveTexture(GL_TEXTURE1); \
glTexCoordPointer(2, GL_FLOAT, 0, coords->lut_tex_coord); \
glEnableClientState(GL_TEXTURE_COORD_ARRAY); \
glClientActiveTexture(GL_TEXTURE0); \
glVertexPointer(2, GL_FLOAT, 0, coords->vertex); \
glEnableClientState(GL_VERTEX_ARRAY); \
glColorPointer(4, GL_FLOAT, 0, coords->color); \
glEnableClientState(GL_COLOR_ARRAY); \
glTexCoordPointer(2, GL_FLOAT, 0, coords->tex_coord); \
glEnableClientState(GL_TEXTURE_COORD_ARRAY)
/* Fall back to FF-style if needed and possible. */
#define gl_ff_matrix(mat) \
glMatrixMode(GL_PROJECTION); \
glLoadMatrixf(mat->data); \
glMatrixMode(GL_MODELVIEW); \
glLoadIdentity()
void gl_set_viewport(gl_t *gl, unsigned width, unsigned height,
bool force_full, bool allow_rotate);