Add cb_set_shader_mvp
This commit is contained in:
parent
64fdadf60f
commit
d8f5065d64
|
@ -217,7 +217,6 @@ static void gl_overlay_tex_geom(void *data,
|
||||||
|
|
||||||
static void gl_render_overlay(gl_t *gl, video_frame_info_t *video_info)
|
static void gl_render_overlay(gl_t *gl, video_frame_info_t *video_info)
|
||||||
{
|
{
|
||||||
video_shader_ctx_mvp_t mvp;
|
|
||||||
video_shader_ctx_coords_t coords;
|
video_shader_ctx_coords_t coords;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
unsigned width = video_info->width;
|
unsigned width = video_info->width;
|
||||||
|
@ -245,10 +244,7 @@ static void gl_render_overlay(gl_t *gl, video_frame_info_t *video_info)
|
||||||
|
|
||||||
video_shader_driver_set_coords(coords);
|
video_shader_driver_set_coords(coords);
|
||||||
|
|
||||||
mvp.data = gl;
|
video_info->cb_shader_set_mvp(gl, video_info->shader_data, &gl->mvp_no_rot);
|
||||||
mvp.matrix = &gl->mvp_no_rot;
|
|
||||||
|
|
||||||
video_shader_driver_set_mvp(mvp);
|
|
||||||
|
|
||||||
for (i = 0; i < gl->overlays; i++)
|
for (i = 0; i < gl->overlays; i++)
|
||||||
{
|
{
|
||||||
|
@ -1001,7 +997,6 @@ static void gl_pbo_async_readback(gl_t *gl)
|
||||||
|
|
||||||
static INLINE void gl_draw_texture(gl_t *gl, video_frame_info_t *video_info)
|
static INLINE void gl_draw_texture(gl_t *gl, video_frame_info_t *video_info)
|
||||||
{
|
{
|
||||||
video_shader_ctx_mvp_t mvp;
|
|
||||||
video_shader_ctx_coords_t coords;
|
video_shader_ctx_coords_t coords;
|
||||||
GLfloat color[16];
|
GLfloat color[16];
|
||||||
unsigned width = video_info->width;
|
unsigned width = video_info->width;
|
||||||
|
@ -1041,10 +1036,7 @@ static INLINE void gl_draw_texture(gl_t *gl, video_frame_info_t *video_info)
|
||||||
|
|
||||||
video_shader_driver_set_coords(coords);
|
video_shader_driver_set_coords(coords);
|
||||||
|
|
||||||
mvp.data = gl;
|
video_info->cb_shader_set_mvp(gl, video_info->shader_data, &gl->mvp_no_rot);
|
||||||
mvp.matrix = &gl->mvp_no_rot;
|
|
||||||
|
|
||||||
video_shader_driver_set_mvp(mvp);
|
|
||||||
|
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
|
|
||||||
|
@ -1072,7 +1064,6 @@ static bool gl_frame(void *data, const void *frame,
|
||||||
unsigned pitch, const char *msg,
|
unsigned pitch, const char *msg,
|
||||||
video_frame_info_t *video_info)
|
video_frame_info_t *video_info)
|
||||||
{
|
{
|
||||||
video_shader_ctx_mvp_t mvp;
|
|
||||||
video_shader_ctx_coords_t coords;
|
video_shader_ctx_coords_t coords;
|
||||||
video_shader_ctx_params_t params;
|
video_shader_ctx_params_t params;
|
||||||
struct video_tex_info feedback_info;
|
struct video_tex_info feedback_info;
|
||||||
|
@ -1230,10 +1221,7 @@ static bool gl_frame(void *data, const void *frame,
|
||||||
|
|
||||||
video_shader_driver_set_coords(coords);
|
video_shader_driver_set_coords(coords);
|
||||||
|
|
||||||
mvp.data = gl;
|
video_info->cb_shader_set_mvp(gl, video_info->shader_data, &gl->mvp);
|
||||||
mvp.matrix = &gl->mvp;
|
|
||||||
|
|
||||||
video_shader_driver_set_mvp(mvp);
|
|
||||||
|
|
||||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||||
|
|
||||||
|
|
|
@ -121,7 +121,8 @@ typedef struct video_pixel_scaler
|
||||||
void *scaler_out;
|
void *scaler_out;
|
||||||
} video_pixel_scaler_t;
|
} video_pixel_scaler_t;
|
||||||
|
|
||||||
void (*video_driver_cb_shader_use)(void *data, void *shader_data, unsigned index, bool set_active);
|
static void (*video_driver_cb_shader_use)(void *data, void *shader_data, unsigned index, bool set_active);
|
||||||
|
static bool (*video_driver_cb_shader_set_mvp)(void *data, void *shader_data, const math_matrix_4x4 *mat);
|
||||||
|
|
||||||
/* Opaque handles to currently running window.
|
/* Opaque handles to currently running window.
|
||||||
* Used by e.g. input drivers which bind to a window.
|
* Used by e.g. input drivers which bind to a window.
|
||||||
|
@ -2515,6 +2516,7 @@ void video_driver_build_info(video_frame_info_t *video_info)
|
||||||
video_info->cb_set_resize = current_video_context.set_resize;
|
video_info->cb_set_resize = current_video_context.set_resize;
|
||||||
|
|
||||||
video_info->cb_shader_use = video_driver_cb_shader_use;
|
video_info->cb_shader_use = video_driver_cb_shader_use;
|
||||||
|
video_info->cb_shader_set_mvp = video_driver_cb_shader_set_mvp;
|
||||||
|
|
||||||
#ifdef HAVE_THREADS
|
#ifdef HAVE_THREADS
|
||||||
video_driver_threaded_unlock(is_threaded);
|
video_driver_threaded_unlock(is_threaded);
|
||||||
|
@ -3188,8 +3190,13 @@ static void video_shader_driver_reset_to_defaults(void)
|
||||||
{
|
{
|
||||||
if (!current_shader->wrap_type)
|
if (!current_shader->wrap_type)
|
||||||
current_shader->wrap_type = video_shader_driver_wrap_type_null;
|
current_shader->wrap_type = video_shader_driver_wrap_type_null;
|
||||||
if (!current_shader->set_mvp)
|
if (current_shader->set_mvp)
|
||||||
|
video_driver_cb_shader_set_mvp = current_shader->set_mvp;
|
||||||
|
else
|
||||||
|
{
|
||||||
current_shader->set_mvp = video_shader_driver_set_mvp_null;
|
current_shader->set_mvp = video_shader_driver_set_mvp_null;
|
||||||
|
video_driver_cb_shader_set_mvp = video_shader_driver_set_mvp_null;
|
||||||
|
}
|
||||||
if (!current_shader->set_coords)
|
if (!current_shader->set_coords)
|
||||||
current_shader->set_coords = video_shader_driver_set_coords_null;
|
current_shader->set_coords = video_shader_driver_set_coords_null;
|
||||||
if (current_shader->use)
|
if (current_shader->use)
|
||||||
|
|
|
@ -451,6 +451,8 @@ typedef struct video_frame_info
|
||||||
bool (*cb_set_resize)(void*, unsigned, unsigned);
|
bool (*cb_set_resize)(void*, unsigned, unsigned);
|
||||||
|
|
||||||
void (*cb_shader_use)(void *data, void *shader_data, unsigned index, bool set_active);
|
void (*cb_shader_use)(void *data, void *shader_data, unsigned index, bool set_active);
|
||||||
|
bool (*cb_shader_set_mvp)(void *data, void *shader_data,
|
||||||
|
const math_matrix_4x4 *mat);
|
||||||
|
|
||||||
void *context_data;
|
void *context_data;
|
||||||
void *shader_data;
|
void *shader_data;
|
||||||
|
|
Loading…
Reference in New Issue