Add more to renderchain driver

This commit is contained in:
twinaphex 2017-11-07 20:56:08 +01:00
parent 00d52a4783
commit fe2bf47b98
4 changed files with 34 additions and 24 deletions

View File

@ -1359,7 +1359,8 @@ static bool gl_frame(void *data, const void *frame,
#endif #endif
/* Set prev textures. */ /* Set prev textures. */
gl2_renderchain_bind_prev_texture(gl, &gl->tex_info); if (gl->renderchain_driver->bind_prev_texture)
gl->renderchain_driver->bind_prev_texture(gl, &gl->tex_info);
#if defined(HAVE_MENU) #if defined(HAVE_MENU)
if (gl->menu_texture_enable) if (gl->menu_texture_enable)
@ -2449,12 +2450,18 @@ error:
static void gl_viewport_info(void *data, struct video_viewport *vp) static void gl_viewport_info(void *data, struct video_viewport *vp)
{ {
gl_renderchain_viewport_info(data, vp); gl_t *gl = (gl_t*)data;
if (!gl->renderchain_driver || !gl->renderchain_driver->viewport_info)
return;
gl->renderchain_driver->viewport_info(data, vp);
} }
static bool gl_read_viewport(void *data, uint8_t *buffer, bool is_idle) static bool gl_read_viewport(void *data, uint8_t *buffer, bool is_idle)
{ {
return gl_renderchain_read_viewport(data, buffer, is_idle); gl_t *gl = (gl_t*)data;
if (!gl->renderchain_driver || !gl->renderchain_driver->read_viewport)
return false;
return gl->renderchain_driver->read_viewport(data, buffer, is_idle);
} }
#if 0 #if 0

View File

@ -72,6 +72,15 @@ typedef struct gl2_renderchain
/* Prototypes */ /* Prototypes */
GLenum min_filter_to_mag(GLenum type); GLenum min_filter_to_mag(GLenum type);
void gl_load_texture_data(
uint32_t id_data,
enum gfx_wrap_type wrap_type,
enum texture_filter_type filter_type,
unsigned alignment,
unsigned width, unsigned height,
const void *frame, unsigned base_size);
void gl_set_viewport( void gl_set_viewport(
void *data, video_frame_info_t *video_info, void *data, video_frame_info_t *video_info,
unsigned viewport_width, unsigned viewport_width,
@ -927,7 +936,7 @@ static bool gl2_renderchain_init_hw_render(
#endif #endif
void gl2_renderchain_bind_prev_texture( static void gl2_renderchain_bind_prev_texture(
void *data, void *data,
const struct video_tex_info *tex_info) const struct video_tex_info *tex_info)
{ {
@ -997,7 +1006,8 @@ bool gl2_renderchain_add_lut(
return true; return true;
} }
void gl_renderchain_viewport_info(void *data, struct video_viewport *vp) static void gl2_renderchain_viewport_info(
void *data, struct video_viewport *vp)
{ {
unsigned width, height; unsigned width, height;
unsigned top_y, top_dist; unsigned top_y, top_dist;
@ -1015,7 +1025,8 @@ void gl_renderchain_viewport_info(void *data, struct video_viewport *vp)
vp->y = top_dist; vp->y = top_dist;
} }
bool gl_renderchain_read_viewport(void *data, uint8_t *buffer, bool is_idle) static bool gl2_renderchain_read_viewport(
void *data, uint8_t *buffer, bool is_idle)
{ {
#ifndef NO_GL_READ_PIXELS #ifndef NO_GL_READ_PIXELS
unsigned num_pixels = 0; unsigned num_pixels = 0;
@ -1137,6 +1148,9 @@ static void *gl2_renderchain_new(void)
#ifdef HAVE_FBO #ifdef HAVE_FBO
gl_renderchain_driver_t gl2_renderchain = { gl_renderchain_driver_t gl2_renderchain = {
gl2_renderchain_viewport_info,
gl2_renderchain_read_viewport,
gl2_renderchain_bind_prev_texture,
gl2_renderchain_free_internal, gl2_renderchain_free_internal,
gl2_renderchain_new, gl2_renderchain_new,
gl2_renderchain_init, gl2_renderchain_init,

View File

@ -25,29 +25,11 @@
RETRO_BEGIN_DECLS RETRO_BEGIN_DECLS
void gl2_renderchain_bind_prev_texture(
void *data,
const struct video_tex_info *tex_info);
bool gl2_renderchain_add_lut(const struct video_shader *shader, bool gl2_renderchain_add_lut(const struct video_shader *shader,
unsigned i, void *textures_lut); unsigned i, void *textures_lut);
void gl_load_texture_data(
uint32_t id_data,
enum gfx_wrap_type wrap_type,
enum texture_filter_type filter_type,
unsigned alignment,
unsigned width, unsigned height,
const void *frame, unsigned base_size);
void gl2_renderchain_deinit_fbo(void *data); void gl2_renderchain_deinit_fbo(void *data);
void gl_renderchain_viewport_info(
void *data, struct video_viewport *vp);
bool gl_renderchain_read_viewport(
void *data, uint8_t *buffer, bool is_idle);
void context_bind_hw_render(bool enable); void context_bind_hw_render(bool enable);
RETRO_END_DECLS RETRO_END_DECLS

View File

@ -827,6 +827,13 @@ typedef struct d3d_renderchain_driver
typedef struct gl_renderchain_driver typedef struct gl_renderchain_driver
{ {
void (*viewport_info)(
void *data, struct video_viewport *vp);
bool (*read_viewport)(
void *data, uint8_t *buffer, bool is_idle);
void (*bind_prev_texture)(
void *data,
const struct video_tex_info *tex_info);
void (*chain_free)(void *data); void (*chain_free)(void *data);
void *(*chain_new)(void); void *(*chain_new)(void);
void (*init)(void *data, unsigned fbo_width, unsigned fbo_height); void (*init)(void *data, unsigned fbo_width, unsigned fbo_height);