Commit e6bf9bce authored by Zhao Zhili's avatar Zhao Zhili Committed by Thomas Guillem

opengl: rename HasExtension to generic StrHasToken

Signed-off-by: Thomas Guillem's avatarThomas Guillem <thomas@gllm.fr>
parent bee130f6
......@@ -118,7 +118,7 @@ VLC_API vlc_gl_t *vlc_gl_surface_Create(vlc_object_t *,
VLC_API bool vlc_gl_surface_CheckSize(vlc_gl_t *, unsigned *w, unsigned *h);
VLC_API void vlc_gl_surface_Destroy(vlc_gl_t *);
static inline bool vlc_gl_HasExtension(const char *apis, const char *api)
static inline bool vlc_gl_StrHasToken(const char *apis, const char *api)
{
size_t apilen = strlen(api);
while (apis) {
......
......@@ -586,19 +586,19 @@ opengl_tex_converter_generic_init(opengl_tex_converter_t *tc, bool allow_dr)
/* OpenGL or OpenGL ES2 with GL_EXT_unpack_subimage ext */
priv->has_unpack_subimage =
!tc->is_gles || vlc_gl_HasExtension(tc->glexts, "GL_EXT_unpack_subimage");
!tc->is_gles || vlc_gl_StrHasToken(tc->glexts, "GL_EXT_unpack_subimage");
if (allow_dr && priv->has_unpack_subimage)
{
bool supports_map_persistent = false;
const bool has_pbo =
vlc_gl_HasExtension(tc->glexts, "GL_ARB_pixel_buffer_object") ||
vlc_gl_HasExtension(tc->glexts, "GL_EXT_pixel_buffer_object");
vlc_gl_StrHasToken(tc->glexts, "GL_ARB_pixel_buffer_object") ||
vlc_gl_StrHasToken(tc->glexts, "GL_EXT_pixel_buffer_object");
const bool has_bs =
vlc_gl_HasExtension(tc->glexts, "GL_ARB_buffer_storage") ||
vlc_gl_HasExtension(tc->glexts, "GL_EXT_buffer_storage");
vlc_gl_StrHasToken(tc->glexts, "GL_ARB_buffer_storage") ||
vlc_gl_StrHasToken(tc->glexts, "GL_EXT_buffer_storage");
/* Ensure we do direct rendering with OpenGL 3.0 or higher. Indeed,
* persistent mapped buffers seems to be slow with OpenGL 2.1 drivers
......
......@@ -406,11 +406,11 @@ Open(vlc_object_t *obj)
|| tc->gl->egl.destroyImageKHR == NULL)
return VLC_EGENERIC;
if (!vlc_gl_HasExtension(tc->glexts, "GL_OES_EGL_image"))
if (!vlc_gl_StrHasToken(tc->glexts, "GL_OES_EGL_image"))
return VLC_EGENERIC;
const char *eglexts = tc->gl->egl.queryString(tc->gl, EGL_EXTENSIONS);
if (eglexts == NULL || !vlc_gl_HasExtension(eglexts, "EGL_EXT_image_dma_buf_import"))
if (eglexts == NULL || !vlc_gl_StrHasToken(eglexts, "EGL_EXT_image_dma_buf_import"))
return VLC_EGENERIC;
struct priv *priv = tc->priv = calloc(1, sizeof(struct priv));
......
......@@ -175,7 +175,7 @@ Open(vlc_object_t *obj)
if ((tc->fmt.i_chroma != VLC_CODEC_VDPAU_VIDEO_420 &&
tc->fmt.i_chroma != VLC_CODEC_VDPAU_VIDEO_422 &&
tc->fmt.i_chroma != VLC_CODEC_VDPAU_VIDEO_444) ||
!vlc_gl_HasExtension(tc->glexts, "GL_NV_vdpau_interop") ||
!vlc_gl_StrHasToken(tc->glexts, "GL_NV_vdpau_interop") ||
tc->gl->surface->type != VOUT_WINDOW_TYPE_XID)
return VLC_EGENERIC;
......
......@@ -104,7 +104,7 @@ tc_yuv_base_init(opengl_tex_converter_t *tc, GLenum tex_target,
GLint oneplane_texfmt, oneplane16_texfmt,
twoplanes_texfmt, twoplanes16_texfmt;
if (vlc_gl_HasExtension(tc->glexts, "GL_ARB_texture_rg"))
if (vlc_gl_StrHasToken(tc->glexts, "GL_ARB_texture_rg"))
{
oneplane_texfmt = GL_RED;
oneplane16_texfmt = GL_R16;
......
......@@ -871,8 +871,8 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
* so checks for extensions are bound to fail. Check for OpenGL ES version instead. */
vgl->supports_npot = true;
#else
vgl->supports_npot = vlc_gl_HasExtension(extensions, "GL_ARB_texture_non_power_of_two") ||
vlc_gl_HasExtension(extensions, "GL_APPLE_texture_2D_limited_npot");
vgl->supports_npot = vlc_gl_StrHasToken(extensions, "GL_ARB_texture_non_power_of_two") ||
vlc_gl_StrHasToken(extensions, "GL_APPLE_texture_2D_limited_npot");
#endif
bool b_dump_shaders = var_InheritInteger(gl, "verbose") >= 4;
......
......@@ -1943,7 +1943,7 @@ GLConvOpen(vlc_object_t *obj)
const char *wglExt = tc->gl->wgl.getExtensionsString(tc->gl);
if (wglExt == NULL || !vlc_gl_HasExtension(wglExt, "WGL_NV_DX_interop"))
if (wglExt == NULL || !vlc_gl_StrHasToken(wglExt, "WGL_NV_DX_interop"))
return VLC_EGENERIC;
struct wgl_vt vt;
......
......@@ -198,7 +198,7 @@ static int Open(vlc_object_t *object)
#ifdef WGL_EXT_swap_control
/* Create an GPU Affinity DC */
const char *extensions = (const char*)glGetString(GL_EXTENSIONS);
if (vlc_gl_HasExtension(extensions, "WGL_EXT_swap_control")) {
if (vlc_gl_StrHasToken(extensions, "WGL_EXT_swap_control")) {
PFNWGLSWAPINTERVALEXTPROC SwapIntervalEXT = (PFNWGLSWAPINTERVALEXTPROC)wglGetProcAddress("wglSwapIntervalEXT");
if (SwapIntervalEXT)
SwapIntervalEXT(1);
......
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