[vlc-commits] opengl: move interop functions to interop.c

Romain Vimont git at videolan.org
Thu Feb 13 23:12:57 CET 2020


vlc | branch: master | Romain Vimont <rom1v at videolabs.io> | Mon Jan 27 14:34:46 2020 +0100| [4dd4da4a840002ae82f5a3d2231c2a00232484a4] | committer: Jean-Baptiste Kempf

opengl: move interop functions to interop.c

The functions GenerateTextures() and DeleteTextures() apply to interop,
move them to the relevant file.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4dd4da4a840002ae82f5a3d2231c2a00232484a4
---

 modules/video_output/opengl/interop.c     | 44 +++++++++++++++++++++++++++++++
 modules/video_output/opengl/vout_helper.c | 44 -------------------------------
 2 files changed, 44 insertions(+), 44 deletions(-)

diff --git a/modules/video_output/opengl/interop.c b/modules/video_output/opengl/interop.c
index 8fcdac90f2..9f39681a60 100644
--- a/modules/video_output/opengl/interop.c
+++ b/modules/video_output/opengl/interop.c
@@ -121,6 +121,50 @@ vlc_gl_interop_Delete(struct vlc_gl_interop *interop)
     vlc_object_delete(interop);
 }
 
+int
+vlc_gl_interop_GenerateTextures(const struct vlc_gl_interop *interop,
+                                const GLsizei *tex_width,
+                                const GLsizei *tex_height, GLuint *textures)
+{
+    interop->vt->GenTextures(interop->tex_count, textures);
+
+    for (unsigned i = 0; i < interop->tex_count; i++)
+    {
+        interop->vt->BindTexture(interop->tex_target, textures[i]);
+
+#if !defined(USE_OPENGL_ES2)
+        /* Set the texture parameters */
+        interop->vt->TexParameterf(interop->tex_target, GL_TEXTURE_PRIORITY, 1.0);
+        interop->vt->TexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
+#endif
+
+        interop->vt->TexParameteri(interop->tex_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+        interop->vt->TexParameteri(interop->tex_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+        interop->vt->TexParameteri(interop->tex_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+        interop->vt->TexParameteri(interop->tex_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+    }
+
+    if (interop->ops->allocate_textures != NULL)
+    {
+        int ret = interop->ops->allocate_textures(interop, textures, tex_width, tex_height);
+        if (ret != VLC_SUCCESS)
+        {
+            interop->vt->DeleteTextures(interop->tex_count, textures);
+            memset(textures, 0, interop->tex_count * sizeof(GLuint));
+            return ret;
+        }
+    }
+    return VLC_SUCCESS;
+}
+
+void
+vlc_gl_interop_DeleteTextures(const struct vlc_gl_interop *interop,
+                              GLuint *textures)
+{
+    interop->vt->DeleteTextures(interop->tex_count, textures);
+    memset(textures, 0, interop->tex_count * sizeof(GLuint));
+}
+
 static int GetTexFormatSize(const opengl_vtable_t *vt, int target,
                             int tex_format, int tex_internal, int tex_type)
 {
diff --git a/modules/video_output/opengl/vout_helper.c b/modules/video_output/opengl/vout_helper.c
index 39b8edb4c1..3b86a612e3 100644
--- a/modules/video_output/opengl/vout_helper.c
+++ b/modules/video_output/opengl/vout_helper.c
@@ -311,50 +311,6 @@ static GLuint BuildVertexShader(const opengl_tex_converter_t *tc,
     return shader;
 }
 
-int
-vlc_gl_interop_GenerateTextures(const struct vlc_gl_interop *interop,
-                                const GLsizei *tex_width,
-                                const GLsizei *tex_height, GLuint *textures)
-{
-    interop->vt->GenTextures(interop->tex_count, textures);
-
-    for (unsigned i = 0; i < interop->tex_count; i++)
-    {
-        interop->vt->BindTexture(interop->tex_target, textures[i]);
-
-#if !defined(USE_OPENGL_ES2)
-        /* Set the texture parameters */
-        interop->vt->TexParameterf(interop->tex_target, GL_TEXTURE_PRIORITY, 1.0);
-        interop->vt->TexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
-#endif
-
-        interop->vt->TexParameteri(interop->tex_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-        interop->vt->TexParameteri(interop->tex_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
-        interop->vt->TexParameteri(interop->tex_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
-        interop->vt->TexParameteri(interop->tex_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-    }
-
-    if (interop->ops->allocate_textures != NULL)
-    {
-        int ret = interop->ops->allocate_textures(interop, textures, tex_width, tex_height);
-        if (ret != VLC_SUCCESS)
-        {
-            interop->vt->DeleteTextures(interop->tex_count, textures);
-            memset(textures, 0, interop->tex_count * sizeof(GLuint));
-            return ret;
-        }
-    }
-    return VLC_SUCCESS;
-}
-
-void
-vlc_gl_interop_DeleteTextures(const struct vlc_gl_interop *interop,
-                              GLuint *textures)
-{
-    interop->vt->DeleteTextures(interop->tex_count, textures);
-    memset(textures, 0, interop->tex_count * sizeof(GLuint));
-}
-
 static int
 opengl_link_program(struct prgm *prgm)
 {



More information about the vlc-commits mailing list