- 23 Mar, 2020 40 commits
-
-
Romain Vimont authored
The version and precision header strings are different for OpenGL and OpenGL ES. Insert them directly into the shader string literal, instead of initializing renderer fields and inserting them at runtime.
-
Romain Vimont authored
The renderer format is, by definition, the one of its sampler. There is no need to copy it.
-
Romain Vimont authored
The video can be top-aligned (--align=4) or bottom-aligned (--align=8) in the window. In OpenGL, the vertical alignment is reversed, because the textures are vertically flipped. It was correctly handled for some control events (e.g. CHANGE_DISPLAY_SIZE), but not for others (e.g. CHANGE_SOURCE_CROP).
-
Romain Vimont authored
Uploading a picture_t to OpenGL flips it vertically. To display the video in the correct orientation, the renderer reversed the transformation: each vertex received as attribute texture coordinates (x, 1-y) instead of (x, y), in order to flip the image vertically. This caused several problems. Firstly, the renderer must be independent of the input picture storage. Otherwise, when it will receive an input in the correct orientation, it will wrongly apply a vertical flip. Secondly, since the vflip was applied on the input coordinates, it occurred before the orientation transform: OrientationMatrix * VFlipMatrix * input_coords (semantically) whereas the correct transformation is: VFlipMatrix * OrientationMatrix * input_coords (for reasons explained in e329c4bb). Since matrix multiplication is not commutative, it resulted in a wrong orientation in some cases (for example if OrientationMatrix contains a rotation by 90°). (In fact, in pratice, this case still worked, because the initialization of OrientationMatrix was also wrong, see the two previous commits). To fix all these problems, initialize the texture coordinates in the normal orientation in the renderer, and apply the vertical flip using the TransformationMatrix in the sampler. This also allows to simplify the Android interop, which can just provide its own transform matrix without compensating for the vertical flip that was applied in the renderer.
-
Romain Vimont authored
Simplify the initialization matrices and document, so that they do not just contain magic values.
-
Romain Vimont authored
The orientation matrices were incorrect. This commit is just here to show the differences, but the next commit will rewrite their initialization to make them more readable.
-
Romain Vimont authored
For convenience, use a local variable to reference the vlc_gl_api.
-
Romain Vimont authored
This avoids to rewrite consecutive cleanups on each error case.
-
Romain Vimont authored
The purpose of this callback is to load sampler data (bind textures, load uniforms, etc.) to be used for the OpenGL draw call. The name "load" also allows to possibly add an "unload" function later (to reset bindings).
-
Romain Vimont authored
This makes explicit that these functions are set by the sampler implementation and must be called by the user of sampler.
-
Romain Vimont authored
If GetUniformLocation() returns -1, then this is an implementation error. Assert instead of reporting the error to the caller.
-
Romain Vimont authored
Hide implementation details from renderers. This will allow to expose only what OpenGL filters need in the public API.
-
Romain Vimont authored
Only the renderer dumps its shaders depending on the verbose level.
-
Romain Vimont authored
The code in fragment_shaders.c is part of the implementation of the sampler: it generates the fragment shader to expose a GLSL function "vlc_texture(vec2 coords)".
-
Romain Vimont authored
The function vlc_gl_renderer_Draw() (almost) just called DrawWithShaders(). There is no need for a separate function.
-
Romain Vimont authored
The renderer is expected to be independant of the input picture format. Instead, update the sampler directly.
-
Romain Vimont authored
Remove the remaining usage of interop from renderer. Now, the renderer only need to use the sampler.
-
Romain Vimont authored
The sampler were owned by the renderer. Move it to vgl, so that the renderer never have to handle an interop instance directly.
-
Romain Vimont authored
For convenience, expose the video format directly in sampler.
-
Romain Vimont authored
The renderer should not know the interop, so it may not be responsible to upload the textures. Move the pictures update to sampler.
-
Romain Vimont authored
The orentation matrix is managed by the sampler. Move its initialization to opengl_fragment_shader_init() (called by the sampler).
-
Romain Vimont authored
Move opengl_fragment_shader_init() call from renderer to sampler.
-
Romain Vimont authored
The sampler handles the input pictures, so it is also responsible for generating the necessary GLSL extensions code (if any).
-
Romain Vimont authored
The function opengl_fragment_shader_init() both initializes the and creates the fragment shader. To be able to move its initialization outside the renderer, store it in the sampler instead of returning it. This will also allow to provide the "extensions" part of the fragment shader as a separate string.
-
Romain Vimont authored
The renderer instance is not needed anymore.
-
Romain Vimont authored
Remove the (weak) reference to the interop from the renderer structure. The interop is still accessed explicitly from the renderer via the sampler structure for now.
-
Romain Vimont authored
The fact that the sampler use internal function pointers (instead of if-blocks for example) is an internal detail.
-
Romain Vimont authored
Remove tex_width and tex_height parameters, as they are either unused or accessible from the sampler itself.
-
Romain Vimont authored
The alpha value was used to render subpictures, which are now drawn by the subpictures renderer using its own fragment shader.
-
Romain Vimont authored
Load uniforms related to sampler from sampler->pf_prepare_shader.
-
Romain Vimont authored
Fetch locations related to sampler from sampler->pf_fetch_locations.
-
Romain Vimont authored
The sampler is responsible to fetch its location and initialize its textures and uniforms.
-
Romain Vimont authored
This will allow to use them from several files.
-
Romain Vimont authored
For convenience, expose the vlc_gl_t and the OpenGL virtual table in sampler.
-
Romain Vimont authored
Extract sampler creation and destruction to separate functions.
-
Romain Vimont authored
This allows to use an interop instance without a renderer.
-
Romain Vimont authored
The interop initializes its own video_format_t from the input format. In the renderer initialization, always use this updated format. This avoids an additional format parameter, which may be confusing.
-
Romain Vimont authored
The projection mode can be read from the provided video format. The intermediate renderer variable is unnecessary.
-
Romain Vimont authored
The interop may modify its own copy of the video_format_t. These changes must be reported to the core (by writing to the provided video_format_t), except for the orientation: it is managed internally by OpenGL, so from the core point of view, the orientation does not change. Handle the format to report to the core outside of the renderer. This paves the way to pass only the interop to the renderer, without an additional video_format_t instance.
-
Romain Vimont authored
The interop instances were owned by the renderers. To prepare for making the renderers independant of the input picture (in particular, independant of the interop), make the vgl own the interop instances.
-