[vlc-commits] opengl/vdpau: do not assume C and GL ptrdiff_t match

Rémi Denis-Courmont git at videolan.org
Mon Dec 31 17:46:06 CET 2018


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Dec 31 18:44:16 2018 +0200| [a65fdce13b3c598b77f7951caa00bbf3279997aa] | committer: Rémi Denis-Courmont

opengl/vdpau: do not assume C and GL ptrdiff_t match

This should fix compilation on some 32-bits platforms.

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

 modules/video_output/opengl/converter_vdpau.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/modules/video_output/opengl/converter_vdpau.c b/modules/video_output/opengl/converter_vdpau.c
index 76d1d0a5b5..5036606e12 100644
--- a/modules/video_output/opengl/converter_vdpau.c
+++ b/modules/video_output/opengl/converter_vdpau.c
@@ -75,33 +75,33 @@ tc_vdpau_gl_update(opengl_tex_converter_t const *tc, GLuint textures[],
     VLC_UNUSED(plane_offsets);
 
     vlc_vdp_output_surface_t *p_sys = pic->p_sys;
+    GLvdpauSurfaceNV gl_nv_surface = p_sys->gl_nv_surface;
 
-    static_assert (_Generic (p_sys->gl_nv_surface, GLvdpauSurfaceNV: 1,
-                                                   default: 0), "Mismatch");
+    static_assert (sizeof (gl_nv_surface) <= sizeof (p_sys->gl_nv_surface),
+                   "Type too small");
 
-    GLvdpauSurfaceNV *p_gl_nv_surface = &p_sys->gl_nv_surface;
-
-    if (*p_gl_nv_surface)
+    if (gl_nv_surface)
     {
-        assert(_glVDPAUIsSurfaceNV(*p_gl_nv_surface) == GL_TRUE);
+        assert(_glVDPAUIsSurfaceNV(gl_nv_surface) == GL_TRUE);
 
         GLint state;
         GLsizei num_val;
-        INTEROP_CALL(glVDPAUGetSurfaceivNV, *p_gl_nv_surface,
+        INTEROP_CALL(glVDPAUGetSurfaceivNV, gl_nv_surface,
                      GL_SURFACE_STATE_NV, 1, &num_val, &state);
         assert(num_val == 1); assert(state == GL_SURFACE_MAPPED_NV);
 
-        INTEROP_CALL(glVDPAUUnmapSurfacesNV, 1, p_gl_nv_surface);
-        INTEROP_CALL(glVDPAUUnregisterSurfaceNV, *p_gl_nv_surface);
+        INTEROP_CALL(glVDPAUUnmapSurfacesNV, 1, &gl_nv_surface);
+        INTEROP_CALL(glVDPAUUnregisterSurfaceNV, gl_nv_surface);
     }
 
-    *p_gl_nv_surface =
+    gl_nv_surface =
         INTEROP_CALL(glVDPAURegisterOutputSurfaceNV,
                      (void *)(size_t)p_sys->surface,
                      GL_TEXTURE_2D, tc->tex_count, textures);
-    INTEROP_CALL(glVDPAUSurfaceAccessNV, *p_gl_nv_surface, GL_READ_ONLY);
-    INTEROP_CALL(glVDPAUMapSurfacesNV, 1, p_gl_nv_surface);
+    INTEROP_CALL(glVDPAUSurfaceAccessNV, gl_nv_surface, GL_READ_ONLY);
+    INTEROP_CALL(glVDPAUMapSurfacesNV, 1, &gl_nv_surface);
 
+    p_sys->gl_nv_surface = gl_nv_surface;
     return VLC_SUCCESS;
 }
 



More information about the vlc-commits mailing list