[vlc-commits] opengl: do not store a copy of fmt in renderer
Romain Vimont
git at videolan.org
Sat Jun 20 11:30:27 CEST 2020
vlc | branch: master | Romain Vimont <rom1v at videolabs.io> | Wed Jun 17 21:28:50 2020 +0200| [1ca5bbefe34ba254b09bf90fa7a9467f4f2ee870] | committer: Alexandre Janniaux
opengl: do not store a copy of fmt in renderer
The renderer format is, by definition, the one of its sampler. There is
no need to copy it.
Signed-off-by: Alexandre Janniaux <ajanni at videolabs.io>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1ca5bbefe34ba254b09bf90fa7a9467f4f2ee870
---
modules/video_output/opengl/renderer.c | 16 +++++++++-------
modules/video_output/opengl/renderer.h | 2 --
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/modules/video_output/opengl/renderer.c b/modules/video_output/opengl/renderer.c
index 1419927891..335ca27e48 100644
--- a/modules/video_output/opengl/renderer.c
+++ b/modules/video_output/opengl/renderer.c
@@ -347,8 +347,6 @@ vlc_gl_renderer_New(vlc_gl_t *gl, const struct vlc_gl_api *api,
getViewpointMatrixes(renderer, fmt->projection_mode);
- renderer->fmt = *fmt;
-
/* */
vt->Disable(GL_BLEND);
vt->Disable(GL_DEPTH_TEST);
@@ -421,7 +419,8 @@ vlc_gl_renderer_SetViewpoint(struct vlc_gl_renderer *renderer,
UpdateFOVy(renderer);
UpdateZ(renderer);
}
- getViewpointMatrixes(renderer, renderer->fmt.projection_mode);
+ const video_format_t *fmt = renderer->sampler->fmt;
+ getViewpointMatrixes(renderer, fmt->projection_mode);
return VLC_SUCCESS;
}
@@ -436,7 +435,9 @@ vlc_gl_renderer_SetWindowAspectRatio(struct vlc_gl_renderer *renderer,
renderer->f_sar = f_sar;
UpdateFOVy(renderer);
UpdateZ(renderer);
- getViewpointMatrixes(renderer, renderer->fmt.projection_mode);
+
+ const video_format_t *fmt = renderer->sampler->fmt;
+ getViewpointMatrixes(renderer, fmt->projection_mode);
}
static int BuildSphere(GLfloat **vertexCoord, GLfloat **textureCoord, unsigned *nbVertices,
@@ -680,13 +681,14 @@ static int BuildRectangle(GLfloat **vertexCoord, GLfloat **textureCoord, unsigne
static int SetupCoords(struct vlc_gl_renderer *renderer)
{
const opengl_vtable_t *vt = renderer->vt;
+ const video_format_t *fmt = renderer->sampler->fmt;
GLfloat *vertexCoord, *textureCoord;
GLushort *indices;
unsigned nbVertices, nbIndices;
int i_ret;
- switch (renderer->fmt.projection_mode)
+ switch (fmt->projection_mode)
{
case PROJECTION_MODE_RECTANGULAR:
i_ret = BuildRectangle(&vertexCoord, &textureCoord, &nbVertices,
@@ -697,8 +699,8 @@ static int SetupCoords(struct vlc_gl_renderer *renderer)
&indices, &nbIndices);
break;
case PROJECTION_MODE_CUBEMAP_LAYOUT_STANDARD:
- i_ret = BuildCube((float)renderer->fmt.i_cubemap_padding / renderer->fmt.i_width,
- (float)renderer->fmt.i_cubemap_padding / renderer->fmt.i_height,
+ i_ret = BuildCube((float)fmt->i_cubemap_padding / fmt->i_width,
+ (float)fmt->i_cubemap_padding / fmt->i_height,
&vertexCoord, &textureCoord, &nbVertices,
&indices, &nbIndices);
break;
diff --git a/modules/video_output/opengl/renderer.h b/modules/video_output/opengl/renderer.h
index af2dbd538f..6f4029504f 100644
--- a/modules/video_output/opengl/renderer.h
+++ b/modules/video_output/opengl/renderer.h
@@ -79,8 +79,6 @@ struct vlc_gl_renderer
struct vlc_gl_sampler *sampler;
- video_format_t fmt;
-
unsigned nb_indices;
GLuint vertex_buffer_object;
GLuint index_buffer_object;
More information about the vlc-commits
mailing list