mirror of
https://github.com/CTCaer/RetroArch.git
synced 2024-12-20 01:38:12 +00:00
Turn video_shader_driver_use into macro
This commit is contained in:
parent
c9206d3cb3
commit
2deb306967
@ -225,7 +225,7 @@ static void renderchain_set_vertices(void *data, unsigned pass,
|
||||
shader_info.idx = pass;
|
||||
shader_info.set_active = true;
|
||||
|
||||
video_shader_driver_use(&shader_info);
|
||||
video_shader_driver_use(shader_info);
|
||||
|
||||
params.data = d3d;
|
||||
params.width = vert_width;
|
||||
|
@ -234,7 +234,7 @@ static void gl_render_overlay(gl_t *gl)
|
||||
shader_info.idx = VIDEO_SHADER_STOCK_BLEND;
|
||||
shader_info.set_active = true;
|
||||
|
||||
video_shader_driver_use(&shader_info);
|
||||
video_shader_driver_use(shader_info);
|
||||
|
||||
gl->coords.vertex = gl->overlay_vertex_coord;
|
||||
gl->coords.tex_coord = gl->overlay_tex_coord;
|
||||
@ -826,7 +826,7 @@ static INLINE void gl_set_shader_viewport(gl_t *gl, unsigned idx)
|
||||
shader_info.idx = idx;
|
||||
shader_info.set_active = true;
|
||||
|
||||
video_shader_driver_use(&shader_info);
|
||||
video_shader_driver_use(shader_info);
|
||||
gl_set_viewport(gl, width, height, false, true);
|
||||
}
|
||||
|
||||
@ -1041,7 +1041,7 @@ static INLINE void gl_draw_texture(gl_t *gl)
|
||||
shader_info.idx = VIDEO_SHADER_STOCK_BLEND;
|
||||
shader_info.set_active = true;
|
||||
|
||||
video_shader_driver_use(&shader_info);
|
||||
video_shader_driver_use(shader_info);
|
||||
|
||||
gl->coords.vertices = 4;
|
||||
|
||||
@ -1109,7 +1109,7 @@ static bool gl_frame(void *data, const void *frame,
|
||||
shader_info.idx = 1;
|
||||
shader_info.set_active = true;
|
||||
|
||||
video_shader_driver_use(&shader_info);
|
||||
video_shader_driver_use(shader_info);
|
||||
|
||||
#ifdef IOS
|
||||
/* Apparently the viewport is lost each frame, thanks Apple. */
|
||||
@ -1293,7 +1293,7 @@ static bool gl_frame(void *data, const void *frame,
|
||||
shader_info.idx = 0;
|
||||
shader_info.set_active = true;
|
||||
|
||||
video_shader_driver_use(&shader_info);
|
||||
video_shader_driver_use(shader_info);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
#ifndef NO_GL_FF_VERTEX
|
||||
|
@ -302,7 +302,7 @@ void gl_renderchain_render(gl_t *gl,
|
||||
shader_info.idx = i + 1;
|
||||
shader_info.set_active = true;
|
||||
|
||||
video_shader_driver_use(&shader_info);
|
||||
video_shader_driver_use(shader_info);
|
||||
glBindTexture(GL_TEXTURE_2D, gl->fbo_texture[i - 1]);
|
||||
|
||||
mip_level = i + 1;
|
||||
@ -377,7 +377,7 @@ void gl_renderchain_render(gl_t *gl,
|
||||
shader_info.idx = gl->fbo_pass + 1;
|
||||
shader_info.set_active = true;
|
||||
|
||||
video_shader_driver_use(&shader_info);
|
||||
video_shader_driver_use(shader_info);
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, gl->fbo_texture[gl->fbo_pass - 1]);
|
||||
|
||||
|
@ -430,7 +430,7 @@ static void gl_raster_font_setup_viewport(gl_raster_t *font, bool full_screen)
|
||||
shader_info.idx = VIDEO_SHADER_STOCK_BLEND;
|
||||
shader_info.set_active = true;
|
||||
|
||||
video_shader_driver_use(&shader_info);
|
||||
video_shader_driver_use(shader_info);
|
||||
}
|
||||
|
||||
static void gl_raster_font_restore_viewport(gl_t *gl, bool full_screen)
|
||||
|
@ -38,8 +38,8 @@ static const shader_backend_t *shader_ctx_drivers[] = {
|
||||
NULL
|
||||
};
|
||||
|
||||
static const shader_backend_t *current_shader = NULL;
|
||||
static void *shader_data = NULL;
|
||||
const shader_backend_t *current_shader = NULL;
|
||||
void *shader_data = NULL;
|
||||
|
||||
static const shader_backend_t *video_shader_set_backend(enum rarch_shader_type type)
|
||||
{
|
||||
@ -286,14 +286,6 @@ bool video_shader_driver_compile_program(struct shader_program_info *program_inf
|
||||
program_info->idx, NULL, program_info);
|
||||
}
|
||||
|
||||
bool video_shader_driver_use(video_shader_ctx_info_t *shader_info)
|
||||
{
|
||||
if (!current_shader || !shader_info)
|
||||
return false;
|
||||
current_shader->use(shader_info->data, shader_data, shader_info->idx, shader_info->set_active);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool video_shader_driver_wrap_type(video_shader_ctx_wrap_t *wrap)
|
||||
{
|
||||
if (!current_shader || !current_shader->wrap_type)
|
||||
|
@ -301,10 +301,15 @@ bool video_shader_driver_filter_type(video_shader_ctx_filter_t *filter);
|
||||
|
||||
bool video_shader_driver_compile_program(struct shader_program_info *program_info);
|
||||
|
||||
bool video_shader_driver_use(video_shader_ctx_info_t *shader_info);
|
||||
#define video_shader_driver_use(shader_info) \
|
||||
if (current_shader) \
|
||||
current_shader->use(shader_info.data, shader_data, shader_info.idx, shader_info.set_active)
|
||||
|
||||
bool video_shader_driver_wrap_type(video_shader_ctx_wrap_t *wrap);
|
||||
|
||||
extern const shader_backend_t *current_shader;
|
||||
extern void *shader_data;
|
||||
|
||||
extern const shader_backend_t gl_glsl_backend;
|
||||
extern const shader_backend_t hlsl_backend;
|
||||
extern const shader_backend_t gl_cg_backend;
|
||||
|
@ -194,7 +194,7 @@ void nk_common_device_draw(struct nk_device *dev,
|
||||
shader_info.data = NULL;
|
||||
shader_info.idx = dev->prog;
|
||||
shader_info.set_active = false;
|
||||
video_shader_driver_use(&shader_info);
|
||||
video_shader_driver_use(shader_info);
|
||||
|
||||
#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES)
|
||||
glUniformMatrix4fv(dev->uniform_proj, 1, GL_FALSE, &ortho[0][0]);
|
||||
@ -259,7 +259,7 @@ void nk_common_device_draw(struct nk_device *dev,
|
||||
shader_info.data = NULL;
|
||||
shader_info.idx = (GLint)last_prog;
|
||||
shader_info.set_active = false;
|
||||
video_shader_driver_use(&shader_info);
|
||||
video_shader_driver_use(shader_info);
|
||||
|
||||
#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES)
|
||||
glBindTexture(GL_TEXTURE_2D, (GLuint)last_tex);
|
||||
|
@ -204,11 +204,11 @@ static void menu_display_d3d_draw_pipeline(void *data)
|
||||
case VIDEO_SHADER_MENU:
|
||||
case VIDEO_SHADER_MENU_SEC:
|
||||
case VIDEO_SHADER_MENU_3:
|
||||
shader_info.data = NULL;
|
||||
shader_info.idx = draw->pipeline.id;
|
||||
shader_info.set_active = true;
|
||||
shader_info.data = NULL;
|
||||
shader_info.idx = draw->pipeline.id;
|
||||
shader_info.set_active = true;
|
||||
|
||||
video_shader_driver_use(&shader_info);
|
||||
video_shader_driver_use(shader_info);
|
||||
|
||||
t += 0.01;
|
||||
|
||||
|
@ -85,11 +85,11 @@ static void menu_display_gl_blend_begin(void)
|
||||
glEnable(GL_BLEND);
|
||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
shader_info.data = NULL;
|
||||
shader_info.idx = VIDEO_SHADER_STOCK_BLEND;
|
||||
shader_info.data = NULL;
|
||||
shader_info.idx = VIDEO_SHADER_STOCK_BLEND;
|
||||
shader_info.set_active = true;
|
||||
|
||||
video_shader_driver_use(&shader_info);
|
||||
video_shader_driver_use(shader_info);
|
||||
}
|
||||
|
||||
static void menu_display_gl_blend_end(void)
|
||||
@ -179,7 +179,7 @@ static void menu_display_gl_draw_pipeline(void *data)
|
||||
shader_info.idx = draw->pipeline.id;
|
||||
shader_info.set_active = true;
|
||||
|
||||
video_shader_driver_use(&shader_info);
|
||||
video_shader_driver_use(shader_info);
|
||||
|
||||
t += 0.01;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user