Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • videolan/vlc
  • chouquette/vlc
  • bakiewicz.marek122/vlc
  • devnexen/vlc
  • rohanrajpal/vlc
  • blurrrb/vlc
  • gsoc/gsoc2019/darkapex/vlc
  • b1ue/vlc
  • fkuehne/vlc
  • magsoft/vlc
  • chub/vlc
  • cramiro9/vlc
  • robUx4/vlc
  • rom1v/vlc
  • akshayaky/vlc
  • tmk907/vlc
  • akymaster/vlc
  • govind.sharma/vlc
  • psilokos/vlc
  • xjbeta/vlc
  • jahan/vlc
  • 1480c1/vlc
  • amanchande/vlc
  • aaqib/vlc
  • rist/vlc
  • apol/vlc
  • mindfreeze/vlc
  • alexandre-janniaux/vlc
  • sandsmark/vlc
  • jagannatharjun/vlc
  • gsoc/gsoc2020/matiaslgonzalez/vlc
  • gsoc/gsoc2020/jagannatharjun/vlc
  • mstorsjo/vlc
  • gsoc/gsoc2020/vedenta/vlc
  • gsoc/gsoc2020/arnav-ishaan/vlc
  • gsoc/gsoc2020/andreduong/vlc
  • fuzun/vlc
  • gsoc/gsoc2020/vatsin/vlc
  • gsoc/gsoc2020/sagid/vlc
  • yaron/vlc
  • Phoenix/vlc
  • Garf/vlc
  • ePiratWorkarounds/vlc
  • tguillem/vlc
  • jnqnfe/vlc
  • mdc/vlc
  • Vedaa/vlc
  • rasa/vlc
  • quink/vlc
  • yealo/vlc
  • aleksey_ak/vlc
  • ePirat/vlc
  • ilya.yanok/vlc
  • asenat/vlc
  • m/vlc
  • bunjee/vlc
  • BLumia/vlc
  • sagudev/vlc
  • hamedmonji30/vlc
  • nullgemm/vlc
  • DivyamAhuja/vlc
  • thesamesam/vlc
  • dag7/vlc
  • snehil101/vlc
  • haasn/vlc
  • jbk/vlc
  • ValZapod/vlc
  • mfkl/vlc
  • WangChuan/vlc
  • core1024/vlc
  • GhostVaibhav/vlc
  • dfuhrmann/vlc
  • davide.prade/vlc
  • tmatth/vlc
  • Courmisch/vlc
  • zouya/vlc
  • hpi/vlc
  • EwoutH/vlc
  • aleung27/vlc
  • hengwu0/vlc
  • saladin/vlc
  • ashuio/vlc
  • richselwood/vlc
  • verma16Ayush/vlc
  • chemicalflash/vlc
  • PoignardAzur/vlc
  • huangjieNT/vlc
  • Blake-Haydon/vlc
  • AnuthaDev/vlc
  • gsoc/gsoc2021/mpd/vlc
  • nicolas_lequec/vlc
  • sambassaly/vlc
  • thresh/vlc
  • bonniegong/vlc
  • myaashish/vlc
  • stavros.vagionitis/vlc
  • ileoo/vlc
  • louis-santucci/vlc
  • cchristiansen/vlc
  • sabyasachi07/vlc
  • AbduAmeen/vlc
  • ashishb0410/vlc
  • urbanhusky/vlc
  • davidepietrasanta/vlc
  • riksleutelstad/vlc
  • jeremyVignelles/vlc
  • komh/vlc
  • iamjithinjohn/vlc
  • JohannesKauffmann/vlc2
  • kunglao/vlc
  • natzberg/vlc
  • jill/vlc
  • cwendling/vlc
  • adufou/vlc
  • ErwanAirone/vlc
  • HasinduDilshan10/vlc
  • vagrantc/vlc
  • rafiv/macos-bigsur-icon
  • Aymeriic/vlc
  • saranshg20/vlc
  • metzlove24/vlc
  • linkfanel/vlc
  • Ds886/vlc
  • metehan-arslan/vlc
  • Skantes/vlc
  • kgsandundananjaya96/vlc
  • mitchcapper/vlc
  • advaitgupta/vlc
  • StefanBruens/vlc
  • ratajs/vlc
  • T.M.F.B.3761/vlc
  • m222059/vlc
  • casemerrick/vlc
  • joshuaword2alt/vlc
  • sjwaddy/vlc
  • dima/vlc
  • Ybalrid/vlc
  • umxprime/vlc
  • eschmidt/vlc
  • vannieuwenhuysenmichelle/vlc
  • badcf00d/vlc
  • wesinator/vlc
  • louis/vlc
  • xqq/vlc
  • EmperorYP7/vlc
  • NicoLiam/vlc
  • loveleen/vlc
  • rofferom/vlc
  • rbultje/vlc
  • TheUnamed/vlc
  • pratiksharma341/vlc
  • Saurab17/vlc
  • purist.coder/vlc
  • Shuicheng/vlc
  • mdrrubel292/vlc
  • silverbleu00/vlc
  • metif12/vlc
  • asher-m/vlc
  • jeffk/vlc
  • Brandonbr1/vlc
  • beautyyuyanli/vlc
  • rego21/vlc
  • muyangren907/vlc
  • collectionbylawrencejason/vlc
  • evelez/vlc
  • GSMgeeth/vlc
  • Oneric/vlc
  • TJ5/vlc
  • XuanTung95/vlc
  • darrenjenny21/vlc
  • Trenly/vlc
  • RockyTDR/vlc
  • mjakubowski/vlc
  • caprica/vlc
  • ForteFrankie/vlc
  • seannamiller19/vlc
  • junlon2006/vlc
  • kiwiren6666/vlc
  • iuseiphonexs/vlc
  • fenngtun/vlc
  • Rajdutt999/vlc
  • typx/vlc
  • leon.vitanos/vlc
  • robertogarci0938/vlc
  • gsoc/gsoc2022/luc65r/vlc-mpd
  • skeller/vlc
  • MCJack123/vlc
  • luc65r/vlc-mpd
  • popov895/vlc
  • claucambra/vlc
  • brad/vlc
  • matthewmurua88/vlc
  • Tomas8874/vlc
  • philenotfound/vlc
  • makita-do3/vlc
  • LZXCorp/vlc
  • mar0x/vlc
  • senojetkennedy0102/vlc
  • shaneb243/vlc
  • ahmadbader/vlc
  • rajduttcse26/vlc-audio-filters
  • Juniorzito8415/vlc
  • achernyakov/vlc
  • lucasjetgroup/vlc
  • pupdoggy666/vlc
  • gmde9363/vlc
  • alexnwayne/vlc
  • bahareebrahimi781/vlc
  • hamad633666/vlc
  • umghof3112/vlc
  • joe0199771874/vlc
  • Octocats66666666/vlc
  • jjm_223/vlc
  • btech10110.19/vlc
  • sunnykfc028/vlc-audio-filters
  • loic/vlc
  • nguyenminhducmx1/vlc
  • JanekKrueger/vlc
  • bstubbington2/vlc
  • rcombs/vlc
  • Ordissimo/vlc
  • king7532/vlc
  • noobsauce101/vlc
  • schong0525/vlc
  • myQwil/vlc
  • apisbg91/vlc
  • geeboy0101017/vlc
  • kim.faughey/vlc
  • nurupo/vlc
  • yyusea/vlc
  • 0711235879.khco/vlc
  • ialo/vlc
  • iloveyeye2/vlc
  • gdtdftdqtd/vlc
  • leandroconsiglio/vlc
  • AndyHTML2012/vlc
  • ncz/vlc
  • lucenticus/vlc
  • knr1931/vlc
  • kjoonlee/vlc
  • chandrakant100/vlc-qt
  • johge42/vlc
  • polter/vlc
  • hexchain/vlc
  • Tushwrld/vlc
  • mztea928/vlc
  • jbelloncastro/vlc
  • alvinhochun/vlc
  • ghostpiratecrow/vlc
  • ujjwaltwitx/vlc
  • alexsonarin06/vlc
  • adrianbon76/vlc
  • altsod/vlc
  • damien.lucas44/vlc
  • dmytrivtaisa/vlc
  • utk202/vlc
  • aaxhrj/vlc
  • thomas.hermes/vlc
  • structurenewworldorder/vlc
  • slomo/vlc
  • wantlamy/vlc
  • musc.o3cminc/vlc
  • thebarshablog/vlc
  • kerrick/vlc
  • kratos142518/vlc
  • leogps/vlc
  • vacantron/vlc
  • luna_koly/vlc
  • Ratio2/vlc
  • anuoshemohammad/vlc
  • apsun/vlc
  • aaa1115910/vlc
  • alimotmoyo/vlc
  • Ambossmann/vlc
  • Sam-LearnsToCode/vlc
  • Chilledheart/vlc
  • Labnann/vlc
  • ktcoooot1/vlc
  • mohit-marathe/vlc
  • johnddx/vlc
  • manstabuk/vlc
  • Omar-ahmed314/vlc
  • vineethkm/vlc
  • 9Enemi86/vlc
  • radoslav.m.panteleev/vlc
  • ashishami2002/vlc
  • Corbax/vlc
  • firnasahmed/vlc
  • pelayarmalam4/vlc
  • c0ff330k/vlc
  • shikhindahikar/vlc
  • l342723951/vlc
  • christianschwandner/vlc
  • douniwan5788/vlc
  • 7damian7/vlc
  • ferdnyc/vlc
  • f.ales1/vlc
  • pandagby/vlc
  • BaaBaa/vlc
  • jewe37/vlc
  • w00drow/vlc
  • russelltg/vlc
  • ironicallygod/vlc
  • soumyaDghosh/vlc
  • linzihao1999/vlc
  • deyayush6/vlc
  • mibi88/vlc
  • newabdallah10/vlc
  • jhorbincolombia/vlc
  • rimvihaqueshupto/vlc
  • andrewkhon98/vlc
  • fab78/vlc
  • lapaz17/vlc
  • amanna13/vlc
  • mdakram28/vlc
  • 07jw1980/vlc
  • sohamgupta/vlc
  • Eson-Jia1/vlc
  • Sumou/vlc
  • vikram-kangotra/vlc
  • chalice191/vlc
  • olivercalder/vlc
  • aaasg4001/vlc
  • zipdox/vlc
  • kwizart/vlc
  • Dragon-S/vlc
  • jdemeule/vlc
  • gabriel_lt/vlc
  • locutusofborg/vlc
  • sammirata/vlc-librist
  • another/vlc
  • Benjamin_Loison/vlc
  • ahmedmoselhi/vlc
  • petergaal/vlc
  • huynhsontung/vlc
  • dariusmihut/vlc
  • tvermaashutosh/vlc
  • buti/vlc
  • Niram7777/vlc
  • rohan-here/vlc
  • balaji-sivasakthi/vlc
  • rlindner81/vlc
  • Kakadus/vlc
  • djain/vlc
  • ABBurmeister/vlc
  • craighuggins/vlc
  • orbea/vlc
  • maxos/vlc
  • aakarshmj/vlc
  • kblaschke/vlc
  • ankitm/vlc
  • advait-0/vlc
  • mohak2003/vlc
  • yselkowitz/vlc
  • AZM999/vlc-azm
  • andrey.turkin/vlc
  • Disha-Baghel/vlc
  • nowrep/vlc
  • Apeng/vlc
  • Choucroute_melba/vlc
  • autra/vlc
  • eclipseo/vlc
  • fhuber/vlc
  • olafhering/vlc
  • sdasda7777/vlc
  • 1div0/vlc
  • skosnits/vlc-extended-playlist-support
  • dnicolson/vlc
  • Timshel/vlc
  • octopols/vlc
  • MangalK/vlc
  • nima64/vlc
  • misawai/vlc
  • Alexander-Wilms/vlc
  • Maxime2/vlc-fork-for-visualizer
  • ww/vlc
  • jeske/vlc
  • sgross-emlix/vlc
  • morenonatural/vlc
  • freakingLovesVLC/vlc
  • borisgolovnev/vlc
  • mpromonet/vlc
  • diogo.simao-marques/vlc
  • masstock/vlc
  • pratikpatel8982/vlc
  • hugok79/vlc
  • longervision/vlc
  • abhiudaysurya/vlc
  • rishabhgarg/vlc
  • tumic/vlc
  • cart/vlc
  • shubham442/vlc
  • Aditya692005/vlc
  • sammirata/vlc4
  • syrykh/vlc
  • Vvorcun/macos-new-icon
  • AyaanshC/vlc
  • nasso/vlc
  • Quark/vlc
  • sebastinas/vlc
  • rhstone/vlc
  • talregev/vlc
  • Managor/vlc
403 results
Show changes
Commits on Source (2)
  • Alexandre Janniaux's avatar
    opengl: remove reference counting · f93738a6
    Alexandre Janniaux authored
    The API is not used anymore, and with the removal of the reference
    counting pattern in objects, not required.
    
    Indeed, the OpenGL providers are neither multi-thread nor reentrant
    so it needs a locked stated when multiple clients needs to use it,
    which will also needs to be reference counted across the clients, so
    the whole reference counting can be done there.
    
    In addition, if the context was given from module to other module, like
    in the filter chain, the video contexts forwarded in those chains would
    already be doing the reference counting. As a side note, there would
    probably be few reasons to implement such forwarding currently anyway
    since it would means that the beginning of the chain would lose usage
    of the context, which also encompass a pool of output picture too
    currently.
    f93738a6
  • Alexandre Janniaux's avatar
    opengl: implement vlc_gl_HasExtension in modules · a162a177
    Alexandre Janniaux authored
    
    Remove vlc_gl_HasExtension helper from the public API and implement it
    as a private helper in modules. The reason for such helper was to help
    ensuring the core stays compatible with Core OpenGL profile, which is
    broken as soon as glGetString(GL_EXTENSIONS) is called instead of the
    glGetStringi(GL_EXTENSION, i) variant.
    
    Having the helper in the core led to issues against the MacOSX
    implementation.
    
    The extension store in gl_util.h prevents reloading the functions
    across multiple calls from vlc_gl_HasExtension, and the helper can
    easily be used in any OpenGL client which needs access to the extension
    list.
    
    Fix #26606 regression as a side effect
    
    Co-Authored-by: default avatarZhao Zhili <quinkblack@foxmail.com>
    a162a177
Showing
with 124 additions and 119 deletions
......@@ -97,10 +97,7 @@ VLC_API vlc_gl_t *vlc_gl_CreateOffscreen(vlc_object_t *parent,
unsigned width, unsigned height,
unsigned flags, const char *name);
VLC_API void vlc_gl_Release(vlc_gl_t *);
VLC_API void vlc_gl_Hold(vlc_gl_t *);
VLC_API bool vlc_gl_HasExtension(vlc_gl_t *gl, const char *extension);
VLC_API void vlc_gl_Delete(vlc_gl_t *);
static inline int vlc_gl_MakeCurrent(vlc_gl_t *gl)
{
......
......@@ -34,6 +34,7 @@
#include "../video_output/android/utils.h"
#include "../video_output/opengl/gl_api.h"
#include "../video_output/opengl/gl_util.h"
#define BUFFER_COUNT 3
......@@ -400,9 +401,11 @@ static int Open(vlc_gl_t *gl, unsigned width, unsigned height)
goto error4;
}
struct vlc_gl_extension_vt extension_vt;
vlc_gl_LoadExtensionFunctions(gl, &extension_vt);
bool has_image_external =
vlc_gl_HasExtension(gl, "GL_OES_EGL_image_external");
vlc_gl_HasExtension(&extension_vt, "GL_OES_EGL_image_external");
vlc_gl_ReleaseCurrent(gl);
if (!has_image_external)
......
......@@ -156,7 +156,7 @@ static void Close( filter_t *filter )
vlc_gl_interop_Delete(sys->interop);
vlc_gl_ReleaseCurrent(sys->gl);
vlc_gl_Release(sys->gl);
vlc_gl_Delete(sys->gl);
free(sys);
}
}
......@@ -295,7 +295,7 @@ gl_api_failure:
vlc_gl_ReleaseCurrent(sys->gl);
make_current_failure:
vlc_gl_Release(sys->gl);
vlc_gl_Delete(sys->gl);
gl_create_failure:
free(sys);
......
......@@ -624,7 +624,7 @@ static void ClearSurface(vout_display_t *vd)
vlc_gl_ReleaseCurrent(gl);
end:
vlc_gl_Release(gl);
vlc_gl_Delete(gl);
}
else
{
......
......@@ -153,7 +153,7 @@ static void CloseInstance(vlc_placebo_t *pl)
vlc_gl_ReleaseCurrent(sys->gl);
}
vlc_gl_Release(sys->gl);
vlc_gl_Delete(sys->gl);
}
vlc_obj_free(VLC_OBJECT(pl), sys);
......
......@@ -181,7 +181,7 @@ static int Open(vout_display_t *vd,
error:
if (sys->gl != NULL)
vlc_gl_Release (sys->gl);
vlc_gl_Delete(sys->gl);
free (sys);
return VLC_EGENERIC;
}
......@@ -198,7 +198,7 @@ static void Close(vout_display_t *vd)
vout_display_opengl_Delete (sys->vgl);
vlc_gl_ReleaseCurrent (gl);
vlc_gl_Release (gl);
vlc_gl_Delete(gl);
free (sys);
}
......
......@@ -30,6 +30,7 @@
#include <vlc_opengl.h>
#include "gl_common.h"
#include "gl_util.h"
int
vlc_gl_api_Init(struct vlc_gl_api *api, vlc_gl_t *gl)
......@@ -167,6 +168,9 @@ vlc_gl_api_Init(struct vlc_gl_api *api, vlc_gl_t *gl)
while (error != GL_NO_ERROR)
error = api->vt.GetError();
struct vlc_gl_extension_vt extension_vt;
vlc_gl_LoadExtensionFunctions(gl, &extension_vt);
if (gl->api_type == VLC_OPENGL_ES2)
{
api->is_gles = true;
......@@ -177,8 +181,8 @@ vlc_gl_api_Init(struct vlc_gl_api *api, vlc_gl_t *gl)
else
{
api->is_gles = false;
api->supports_npot = vlc_gl_HasExtension(gl, "GL_ARB_texture_non_power_of_two") ||
vlc_gl_HasExtension(gl, "GL_APPLE_texture_2D_limited_npot");
api->supports_npot = vlc_gl_HasExtension(&extension_vt, "GL_ARB_texture_non_power_of_two") ||
vlc_gl_HasExtension(&extension_vt, "GL_APPLE_texture_2D_limited_npot");
}
return VLC_SUCCESS;
......
......@@ -168,6 +168,10 @@
# define GL_STREAM_READ 0x88E1
#endif
#if !defined(GL_NUM_EXTENSIONS)
# define GL_NUM_EXTENSIONS 0x821D
#endif
#ifndef APIENTRY
# define APIENTRY
#endif
......@@ -289,6 +293,7 @@ typedef GLsync (APIENTRY *PFNGLFENCESYNCPROC) (GLenum condition, GLbitfield flag
typedef void (APIENTRY *PFNGLDELETESYNCPROC) (GLsync sync);
typedef GLenum (APIENTRY *PFNGLCLIENTWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
typedef void *(APIENTRY *PFNGLMAPBUFFERPROC)(GLenum, GLbitfield);
typedef const GLubyte *(APIENTRY *PFNGLGETSTRINGIPROC) (GLenum name, GLint i);
#endif
/**
......
......@@ -27,6 +27,7 @@
#endif
#include <vlc_common.h>
#include <vlc_opengl.h>
#include "gl_common.h"
static const float MATRIX4_IDENTITY[4*4] = {
......@@ -89,4 +90,60 @@ vlc_gl_BuildProgram(vlc_object_t *obj, const opengl_vtable_t *vt,
module_t *
vlc_gl_WrapOpenGLFilter(filter_t *filter, const char *opengl_filter_name);
struct vlc_gl_extension_vt {
PFNGLGETSTRINGPROC GetString;
PFNGLGETSTRINGIPROC GetStringi;
PFNGLGETINTEGERVPROC GetIntegerv;
PFNGLGETERRORPROC GetError;
};
static inline void
vlc_gl_LoadExtensionFunctions(vlc_gl_t *gl, struct vlc_gl_extension_vt *vt)
{
vt->GetString = vlc_gl_GetProcAddress(gl, "glGetString");
vt->GetIntegerv = vlc_gl_GetProcAddress(gl, "glGetIntegerv");
vt->GetError = vlc_gl_GetProcAddress(gl, "glGetError");
vt->GetStringi = NULL;
GLint version;
vt->GetIntegerv(GL_MAJOR_VERSION, &version);
uint32_t error = vt->GetError();
if (error != GL_NO_ERROR)
version = 2;
/* Drain the errors before continuing. */
while (error != GL_NO_ERROR)
error = vt->GetError();
/* glGetStringi is available in OpenGL>=3 and GLES>=3.
* https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glGetString.xhtml
* https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetString.xhtml
*/
if (version >= 3)
vt->GetStringi = vlc_gl_GetProcAddress(gl, "glGetStringi");
}
static inline bool
vlc_gl_HasExtension(
struct vlc_gl_extension_vt *vt,
const char *name
){
if (vt->GetStringi == NULL)
{
const GLubyte *extensions = vt->GetString(GL_EXTENSIONS);
return vlc_gl_StrHasToken((const char *)extensions, name);
}
int32_t count = 0;
vt->GetIntegerv(GL_NUM_EXTENSIONS, &count);
for (int i = 0; i < count; ++i)
{
const uint8_t *extension = vt->GetStringi(GL_EXTENSIONS, i);
if (strcmp((const char *)extension, name) == 0)
return true;
}
return false;
}
#endif
......@@ -226,10 +226,13 @@ vlc_gl_importer_New(struct vlc_gl_interop *interop)
InitOrientationMatrix(importer->mtx_orientation, glfmt->fmt.orientation);
struct vlc_gl_extension_vt extension_vt;
vlc_gl_LoadExtensionFunctions(interop->gl, &extension_vt);
/* OpenGL ES 2 includes support for non-power of 2 textures by specification. */
bool supports_npot = interop->gl->api_type == VLC_OPENGL_ES2
|| vlc_gl_HasExtension(interop->gl, "GL_ARB_texture_non_power_of_two")
|| vlc_gl_HasExtension(interop->gl, "GL_APPLE_texture_2D_limited_npot");
|| vlc_gl_HasExtension(&extension_vt, "GL_ARB_texture_non_power_of_two")
|| vlc_gl_HasExtension(&extension_vt, "GL_APPLE_texture_2D_limited_npot");
/* Texture size */
for (unsigned j = 0; j < interop->tex_count; j++) {
......
......@@ -25,7 +25,7 @@
#include <vlc_common.h>
#include <vlc_modules.h>
#include "gl_api.h"
#include "gl_util.h"
#include "interop.h"
#include "interop_sw.h"
#include "vout_helper.h"
......@@ -49,6 +49,8 @@ struct vlc_gl_interop_private
#define DECLARE_SYMBOL(type, name) type name;
OPENGL_VTABLE_F(DECLARE_SYMBOL)
} gl;
struct vlc_gl_extension_vt extension_vt;
};
int
......@@ -161,12 +163,15 @@ interop_yuv_base_init(struct vlc_gl_interop *interop, GLenum tex_target,
vlc_fourcc_t chroma,
const vlc_chroma_description_t *desc)
{
struct vlc_gl_interop_private *priv =
container_of(interop, struct vlc_gl_interop_private, interop);
(void) chroma;
GLint oneplane_texfmt, oneplane16_texfmt,
twoplanes_texfmt, twoplanes16_texfmt;
if (vlc_gl_HasExtension(interop->gl, "GL_ARB_texture_rg"))
if (vlc_gl_HasExtension(&priv->extension_vt, "GL_ARB_texture_rg"))
{
oneplane_texfmt = GL_RED;
oneplane16_texfmt = GL_R16;
......@@ -396,6 +401,8 @@ vlc_gl_interop_New(struct vlc_gl_t *gl, vlc_video_context *context,
OPENGL_VTABLE_F(LOAD_SYMBOL);
#undef LOAD_SYMBOL
vlc_gl_LoadExtensionFunctions(interop->gl, &priv->extension_vt);
if (desc->plane_count == 0)
{
/* Opaque chroma: load a module to handle it */
......
......@@ -31,6 +31,7 @@
#include "interop.h"
#include "../android/utils.h"
#include "gl_api.h"
#include "gl_util.h"
struct priv
{
......@@ -197,7 +198,10 @@ Open(vlc_object_t *obj)
|| !interop->vctx)
return VLC_EGENERIC;
if (!vlc_gl_HasExtension(interop->gl, "GL_OES_EGL_image_external"))
struct vlc_gl_extension_vt extension_vt;
vlc_gl_LoadExtensionFunctions(interop->gl, &extension_vt);
if (!vlc_gl_HasExtension(&extension_vt, "GL_OES_EGL_image_external"))
{
msg_Warn(&interop->obj, "GL_OES_EGL_image_external is not available,"
" disabling android interop.");
......
......@@ -29,7 +29,7 @@
#include "interop_sw.h"
#include <vlc_common.h>
#include "gl_api.h"
#include "gl_util.h"
#define PBO_DISPLAY_COUNT 2 /* Double buffering */
typedef struct
......@@ -409,9 +409,12 @@ interop_init:
interop->ops = &ops;
interop->fmt_in.i_chroma = i_chroma;
struct vlc_gl_extension_vt extension_vt;
vlc_gl_LoadExtensionFunctions(interop->gl, &extension_vt);
/* OpenGL or OpenGL ES2 with GL_EXT_unpack_subimage ext */
priv->has_unpack_subimage = interop->gl->api_type == VLC_OPENGL
|| vlc_gl_HasExtension(interop->gl, "GL_EXT_unpack_subimage");
|| vlc_gl_HasExtension(&extension_vt, "GL_EXT_unpack_subimage");
if (allow_dr && priv->has_unpack_subimage)
{
......@@ -420,8 +423,8 @@ interop_init:
const bool glver_ok = strverscmp((const char *)ogl_version, "3.0") >= 0;
const bool has_pbo = glver_ok &&
(vlc_gl_HasExtension(interop->gl, "GL_ARB_pixel_buffer_object") ||
vlc_gl_HasExtension(interop->gl, "GL_EXT_pixel_buffer_object"));
(vlc_gl_HasExtension(&extension_vt, "GL_ARB_pixel_buffer_object") ||
vlc_gl_HasExtension(&extension_vt, "GL_EXT_pixel_buffer_object"));
const bool supports_pbo = has_pbo && priv->gl.BufferData
&& priv->gl.BufferSubData;
......
......@@ -33,7 +33,7 @@
#include <vlc_codec.h>
#include <vlc_plugin.h>
#include "gl_api.h"
#include "gl_util.h"
#include "interop.h"
#include "../../hw/vaapi/vlc_vaapi.h"
......@@ -446,7 +446,10 @@ Open(vlc_object_t *obj)
goto error;
}
if (!vlc_gl_HasExtension(interop->gl, "GL_OES_EGL_image"))
struct vlc_gl_extension_vt extension_vt;
vlc_gl_LoadExtensionFunctions(interop->gl, &extension_vt);
if (!vlc_gl_HasExtension(&extension_vt, "GL_OES_EGL_image"))
goto error;
priv = interop->priv = calloc(1, sizeof(struct priv));
......
......@@ -36,6 +36,7 @@
#include <vlc_plugin.h>
#include "gl_api.h"
#include "gl_util.h"
#include "../../hw/vdpau/vlc_vdpau.h"
#include "interop.h"
......@@ -125,12 +126,16 @@ Open(vlc_object_t *obj)
struct vlc_gl_interop *interop = (void *) obj;
if (interop->vctx == NULL)
return VLC_EGENERIC;
struct vlc_gl_extension_vt extension_vt;
vlc_gl_LoadExtensionFunctions(interop->gl, &extension_vt);
vlc_decoder_device *dec_device = vlc_video_context_HoldDevice(interop->vctx);
if (GetVDPAUOpaqueDevice(dec_device) == NULL
|| (interop->fmt_in.i_chroma != VLC_CODEC_VDPAU_VIDEO_420
&& interop->fmt_in.i_chroma != VLC_CODEC_VDPAU_VIDEO_422
&& interop->fmt_in.i_chroma != VLC_CODEC_VDPAU_VIDEO_444)
|| !vlc_gl_HasExtension(interop->gl, "GL_NV_vdpau_interop"))
|| !vlc_gl_HasExtension(&extension_vt, "GL_NV_vdpau_interop"))
{
vlc_decoder_device_Release(dec_device);
return VLC_EGENERIC;
......
......@@ -66,6 +66,8 @@ struct vlc_gl_sampler_priv {
* conversion), selected by vlc_gl_sampler_SetCurrentPlane(). */
bool expose_planes;
unsigned plane;
struct vlc_gl_extension_vt extension_vt;
};
static inline struct vlc_gl_sampler_priv *
......@@ -424,7 +426,7 @@ opengl_init_swizzle(struct vlc_gl_sampler *sampler,
struct vlc_gl_sampler_priv *priv = PRIV(sampler);
GLint oneplane_texfmt;
if (vlc_gl_HasExtension(priv->gl, "GL_ARB_texture_rg"))
if (vlc_gl_HasExtension(&priv->extension_vt, "GL_ARB_texture_rg"))
oneplane_texfmt = GL_RED;
else
oneplane_texfmt = GL_LUMINANCE;
......@@ -829,6 +831,7 @@ vlc_gl_sampler_New(struct vlc_gl_t *gl, const struct vlc_gl_api *api,
return NULL;
struct vlc_gl_sampler *sampler = &priv->sampler;
vlc_gl_LoadExtensionFunctions(gl, &priv->extension_vt);
priv->uloc.pl_vars = NULL;
priv->pl_ctx = NULL;
......
......@@ -195,7 +195,7 @@ static void Close(vout_display_t *vd)
vout_display_opengl_Delete(sys->vgl);
vlc_gl_ReleaseCurrent (gl);
}
vlc_gl_Release (gl);
vlc_gl_Delete(gl);
vlc_object_delete(surface);
}
......
......@@ -708,9 +708,7 @@ vlc_queue_Dequeue
vlc_queue_DequeueAll
vlc_gl_Create
vlc_gl_CreateOffscreen
vlc_gl_Release
vlc_gl_Hold
vlc_gl_HasExtension
vlc_gl_Delete
vlc_gl_surface_Create
vlc_gl_surface_CheckSize
vlc_gl_surface_Destroy
......
......@@ -36,14 +36,6 @@
struct vlc_gl_priv_t
{
vlc_gl_t gl;
vlc_atomic_rc_t rc;
struct {
const uint8_t* (*GetString)(uint32_t);
const uint8_t* (*GetStringi)(uint32_t, uint32_t);
void (*GetIntegerv)(uint32_t, int32_t *);
uint32_t (*GetError)();
} vt;
};
static int vlc_gl_start(void *func, bool forced, va_list ap)
......@@ -91,9 +83,6 @@ vlc_gl_t *vlc_gl_Create(const struct vout_display_cfg *restrict cfg,
gl->api_type = api_type;
gl->surface = wnd;
gl->device = NULL;
glpriv->vt.GetString = NULL;
glpriv->vt.GetStringi = NULL;
glpriv->vt.GetIntegerv = NULL;
gl->module = vlc_module_load(gl, type, name, true, vlc_gl_start, gl,
cfg->display.width, cfg->display.height);
......@@ -104,7 +93,6 @@ vlc_gl_t *vlc_gl_Create(const struct vout_display_cfg *restrict cfg,
}
assert(gl->make_current && gl->release_current && gl->swap
&& gl->get_proc_address);
vlc_atomic_rc_init(&glpriv->rc);
return &glpriv->gl;
}
......@@ -158,8 +146,6 @@ vlc_gl_t *vlc_gl_CreateOffscreen(vlc_object_t *parent,
/* The implementation must initialize the output chroma */
assert(gl->offscreen_chroma_out != VLC_CODEC_UNKNOWN);
vlc_atomic_rc_init(&glpriv->rc);
assert(gl->make_current);
assert(gl->release_current);
assert(gl->swap_offscreen);
......@@ -168,18 +154,8 @@ vlc_gl_t *vlc_gl_CreateOffscreen(vlc_object_t *parent,
return &glpriv->gl;
}
void vlc_gl_Hold(vlc_gl_t *gl)
{
struct vlc_gl_priv_t *glpriv = (struct vlc_gl_priv_t *)gl;
vlc_atomic_rc_inc(&glpriv->rc);
}
void vlc_gl_Release(vlc_gl_t *gl)
void vlc_gl_Delete(vlc_gl_t *gl)
{
struct vlc_gl_priv_t *glpriv = (struct vlc_gl_priv_t *)gl;
if (!vlc_atomic_rc_dec(&glpriv->rc))
return;
if (gl->destroy != NULL)
gl->destroy(gl);
......@@ -190,69 +166,6 @@ void vlc_gl_Release(vlc_gl_t *gl)
vlc_object_delete(gl);
}
bool vlc_gl_HasExtension(vlc_gl_t *gl, const char *extension)
{
#define GL_NO_ERROR 0
#define GL_VERSION 0x1F02
#define GL_MAJOR_VERSION 0x821B
#define GL_EXTENSIONS 0x1F03
#define GL_NUM_EXTENSIONS 0x821D
struct vlc_gl_priv_t *glpriv = (struct vlc_gl_priv_t *)gl;
/* Cache the OpenGL function before checking. It's not done at OpenGL
* provider creation because the context might not be current, and it is
* not done at MakeCurrent because MakeCurrent is currently called at each
* frames, whereas vlc_gl_HasExtension can be called only during the
* client code initialization. */
if (glpriv->vt.GetString == NULL && glpriv->vt.GetStringi == NULL)
{
glpriv->vt.GetString = vlc_gl_GetProcAddress(gl, "glGetString");
glpriv->vt.GetIntegerv = vlc_gl_GetProcAddress(gl, "glGetIntegerv");
glpriv->vt.GetError = vlc_gl_GetProcAddress(gl, "glGetError");
int32_t version;
/* GL_MAJOR_VERSION is available in every OpenGL and GLES>=3.
* https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glGet.xhtml
* https://www.khronos.org/registry/OpenGL-Refpages/es3.0/html/glGet.xhtml
* It will return a GL_INVALID_ENUM error on GLES<3
*/
glpriv->vt.GetIntegerv(GL_MAJOR_VERSION, &version);
uint32_t error = glpriv->vt.GetError();
if (error != GL_NO_ERROR)
version = 2;
/* Drain the errors before continuing. */
while (error != GL_NO_ERROR)
error = glpriv->vt.GetError();
/* glGetStringi is available in OpenGL>=3 and GLES>=3.
* https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/glGetString.xhtml
* https://www.khronos.org/registry/OpenGL-Refpages/es3/html/glGetString.xhtml
*/
if (version >= 3)
glpriv->vt.GetStringi = vlc_gl_GetProcAddress(gl, "glGetStringi");
}
/* Fallback to legacy checking mode. */
if (glpriv->vt.GetStringi == NULL)
{
const uint8_t *extensions = glpriv->vt.GetString(GL_EXTENSIONS);
return vlc_gl_StrHasToken((const char *)extensions, extension);
}
/* Unfortunately, no order is defined by the standard, so just loop over
* the different extensions linearily. */
int32_t count = 0;
glpriv->vt.GetIntegerv(GL_NUM_EXTENSIONS, &count);
for (int i = 0; i < count; ++i)
{
const uint8_t *name = glpriv->vt.GetStringi(GL_EXTENSIONS, i);
if (strcmp((const char *)name, extension) == 0)
return true;
}
return false;
}
#include <vlc_vout_window.h>
typedef struct vlc_gl_surface
......@@ -375,7 +288,7 @@ void vlc_gl_surface_Destroy(vlc_gl_t *gl)
vout_window_t *surface = gl->surface;
vlc_gl_surface_t *sys = surface->owner.sys;
vlc_gl_Release(gl);
vlc_gl_Delete(gl);
vout_window_Disable(surface);
vout_window_Delete(surface);
free(sys);
......