Commit 26ace33d authored by Thomas Guillem's avatar Thomas Guillem

opengl: set textures non const

This allow tex converters to generate textures from the pf_update callback.
parent f23c6513
......@@ -58,10 +58,11 @@ tc_anop_gen_textures(const opengl_tex_converter_t *tc,
}
static void
tc_anop_del_textures(const opengl_tex_converter_t *tc, const GLuint *textures)
tc_anop_del_textures(const opengl_tex_converter_t *tc, GLuint *textures)
{
(void) tc;
glDeleteTextures(1, textures);
textures[0] = 0;
}
static int
......@@ -86,9 +87,10 @@ pool_unlock_pic(picture_t *p_pic)
static picture_pool_t *
tc_anop_get_pool(const opengl_tex_converter_t *tc, const video_format_t *fmt,
unsigned requested_count, const GLuint *textures)
unsigned requested_count, GLuint *textures)
{
struct priv *priv = tc->priv;
assert(textures[0] != 0);
priv->stex = SurfaceTexture_create(tc->parent, textures[0]);
if (priv->stex == NULL)
{
......@@ -145,11 +147,12 @@ error:
}
static int
tc_anop_update(const opengl_tex_converter_t *tc, const GLuint *textures,
tc_anop_update(const opengl_tex_converter_t *tc, GLuint *textures,
unsigned width, unsigned height,
picture_t *pic, const size_t *plane_offset)
{
(void) width; (void) height; (void) plane_offset;
assert(textures[0] != 0);
if (plane_offset != NULL)
return VLC_EGENERIC;
......
......@@ -233,7 +233,7 @@ picture_destroy_cb(picture_t *pic)
static picture_pool_t *
tc_common_get_pool(const opengl_tex_converter_t *tc, const video_format_t *fmt,
unsigned requested_count, const GLuint *textures)
unsigned requested_count, GLuint *textures)
{
struct priv *priv = tc->priv;
picture_t *pictures[VLCGL_PICTURE_MAX];
......@@ -343,10 +343,10 @@ tc_common_gen_textures(const opengl_tex_converter_t *tc,
}
static void
tc_common_del_textures(const opengl_tex_converter_t *tc,
const GLuint *textures)
tc_common_del_textures(const opengl_tex_converter_t *tc, GLuint *textures)
{
glDeleteTextures(tc->desc->plane_count, textures);
memset(textures, 0, tc->desc->plane_count * sizeof(GLuint));
}
static int
......@@ -410,7 +410,7 @@ upload_plane(const opengl_tex_converter_t *tc,
}
static int
tc_common_update(const opengl_tex_converter_t *tc, const GLuint *textures,
tc_common_update(const opengl_tex_converter_t *tc, GLuint *textures,
unsigned width, unsigned height,
picture_t *pic, const size_t *plane_offset)
{
......@@ -422,6 +422,7 @@ tc_common_update(const opengl_tex_converter_t *tc, const GLuint *textures,
int ret = VLC_SUCCESS;
for (unsigned i = 0; i < tc->desc->plane_count && ret == VLC_SUCCESS; i++)
{
assert(textures[i] != 0);
glActiveTexture(GL_TEXTURE0 + i);
glClientActiveTexture(GL_TEXTURE0 + i);
glBindTexture(tc->tex_target, textures[i]);
......
......@@ -204,7 +204,7 @@ struct opengl_tex_converter_t
* \param textures array of textures to delete (one per plane)
*/
void (*pf_del_textures)(const opengl_tex_converter_t *fc,
const GLuint *textures);
GLuint *textures);
/*
* Callback to allocate a picture pool
......@@ -221,7 +221,7 @@ struct opengl_tex_converter_t
picture_pool_t *(*pf_get_pool)(const opengl_tex_converter_t *fc,
const video_format_t *fmt,
unsigned requested_count,
const GLuint *textures);
GLuint *textures);
/*
* Callback to update a picture
......@@ -238,7 +238,7 @@ struct opengl_tex_converter_t
* (one per plane, can be NULL)
* \return VLC_SUCCESS or a VLC error
*/
int (*pf_update)(const opengl_tex_converter_t *fc, const GLuint *textures,
int (*pf_update)(const opengl_tex_converter_t *fc, GLuint *textures,
unsigned width, unsigned height,
picture_t *pic, const size_t *plane_offset);
......
......@@ -611,7 +611,6 @@ picture_pool_t *vout_display_opengl_GetPool(vout_display_opengl_t *vgl, unsigned
error:
tc->pf_del_textures(tc, vgl->texture);
memset(vgl->texture, 0, PICTURE_PLANE_MAX * sizeof(GLuint));
return NULL;
}
......@@ -1201,6 +1200,7 @@ static void DrawWithShaders(vout_display_opengl_t *vgl,
}
for (unsigned j = 0; j < vgl->chroma->plane_count; j++) {
assert(vgl->texture[j] != 0);
glActiveTexture(GL_TEXTURE0+j);
glClientActiveTexture(GL_TEXTURE0+j);
glBindTexture(tc->tex_target, vgl->texture[j]);
......@@ -1329,6 +1329,7 @@ int vout_display_opengl_Display(vout_display_opengl_t *vgl,
glr->tex_width, glr->tex_height,
};
assert(glr->texture != 0);
glBindTexture(sub_tc->tex_target, glr->texture);
sub_tc->pf_prepare_shader(sub_tc, sub_program, glr->alpha);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment