[vlc-commits] [Git][videolan/vlc][3.0.x] 2 commits: opengl: add glGetIntegeri_v
Hugo Beauzée-Luyssen (@chouquette)
gitlab at videolan.org
Thu Dec 2 17:00:03 UTC 2021
Hugo Beauzée-Luyssen pushed to branch 3.0.x at VideoLAN / VLC
Commits:
0da425a2 by Louis Régnier at 2021-12-02T16:32:49+00:00
opengl: add glGetIntegeri_v
- - - - -
2437484d by Louis Régnier at 2021-12-02T16:32:49+00:00
opengl: vout_helper: use pl_gpu_dummy for shaders
Without specifying the version, libplacebo might generate shaders with
a different version from the one we specified, leading to usage of
function that might not be available.
A typical failure would lead to such error messages:
gl gl: Initialized libplacebo v3.120.3 (API v120)
gl gl error: shader 0: 0:22(13): error: no matching function for
call to `mix(vec3, vec3, bvec3)'; candidates are:
0:22(13): error: float mix(float, float, float)
0:22(13): error: vec2 mix(vec2, vec2, float)
0:22(13): error: vec3 mix(vec3, vec3, float)
0:22(13): error: vec4 mix(vec4, vec4, float)
0:22(13): error: vec2 mix(vec2, vec2, vec2)
0:22(13): error: vec3 mix(vec3, vec3, vec3)
0:22(13): error: vec4 mix(vec4, vec4, vec4)
Fixes #25324
Co-authored-by: Alexandre Janniaux <ajanni at videolabs.io>
- - - - -
2 changed files:
- modules/video_output/opengl/converter.h
- modules/video_output/opengl/vout_helper.c
Changes:
=====================================
modules/video_output/opengl/converter.h
=====================================
@@ -83,6 +83,7 @@ typedef void (APIENTRY *PFNGLFLUSHPROC)(void);
typedef void (APIENTRY *PFNGLGENTEXTURESPROC) (GLsizei n, GLuint *textures);
typedef GLenum (APIENTRY *PFNGLGETERRORPROC) (void);
typedef void (APIENTRY *PFNGLGETINTEGERVPROC) (GLenum pname, GLint *data);
+typedef void (APIENTRY *PFNGLGETINTEGERIVPROC) (GLenum pname, GLuint index, GLint *data);
typedef const GLubyte *(APIENTRY *PFNGLGETSTRINGPROC) (GLenum name);
typedef void (APIENTRY *PFNGLGETTEXLEVELPARAMETERIVPROC) (GLenum target, GLint level, GLenum pname, GLint *params);
typedef void (APIENTRY *PFNGLPIXELSTOREIPROC) (GLenum pname, GLint param);
@@ -166,6 +167,9 @@ typedef struct {
PFNGLGENTEXTURESPROC GenTextures;
PFNGLGETERRORPROC GetError;
PFNGLGETINTEGERVPROC GetIntegerv;
+#ifndef USE_OPENGL_ES2
+ PFNGLGETINTEGERIVPROC GetIntegeri_v;
+#endif
PFNGLGETSTRINGPROC GetString;
PFNGLPIXELSTOREIPROC PixelStorei;
PFNGLTEXIMAGE2DPROC TexImage2D;
@@ -336,6 +340,7 @@ struct opengl_tex_converter_t
bool yuv_color;
GLfloat yuv_coefficients[16];
+ const struct pl_gpu *pl_gpu;
struct pl_shader *pl_sh;
const struct pl_shader_res *pl_sh_res;
=====================================
modules/video_output/opengl/vout_helper.c
=====================================
@@ -44,6 +44,12 @@
#include "vout_helper.h"
#include "internal.h"
+#if HAVE_LIBPLACEBO
+#if PL_API_VER >= 18
+#include <libplacebo/dummy.h>
+#endif
+#endif
+
#ifndef GL_CLAMP_TO_EDGE
# define GL_CLAMP_TO_EDGE 0x812F
#endif
@@ -570,6 +576,10 @@ opengl_deinit_program(vout_display_opengl_t *vgl, struct prgm *prgm)
#ifdef HAVE_LIBPLACEBO
FREENULL(tc->uloc.pl_vars);
+#if PL_API_VER >= 18
+ if (tc->pl_gpu)
+ pl_gpu_dummy_destroy(&tc->pl_gpu);
+#endif
if (tc->pl_ctx)
pl_context_destroy(&tc->pl_ctx);
#endif
@@ -622,14 +632,78 @@ opengl_init_program(vout_display_opengl_t *vgl, struct prgm *prgm,
// create the main libplacebo context
if (!subpics)
{
+#if PL_API_VER >= 18
+ struct pl_gpu_dummy_params gpu_dummy_params = {
+ .caps = PL_GPU_CAP_INPUT_VARIABLES,
+ .glsl = (struct pl_glsl_desc) {
+#ifdef USE_OPENGL_ES2
+ .version = 100,
+ .gles = true,
+#else
+ .version = 120,
+#endif
+ .vulkan = false,
+ },
+ .limits = { 0 }
+ };
+#endif
+
+ const opengl_vtable_t *vt = tc->vt;
+
+#if PL_API_VER >= 18
+ vt->GetIntegerv(GL_MAX_TEXTURE_SIZE,
+ (GLint *)&gpu_dummy_params.limits.max_tex_1d_dim);
+ gpu_dummy_params.limits.max_tex_2d_dim = gpu_dummy_params.limits.max_tex_1d_dim;
+#ifndef USE_OPENGL_ES2
+ vt->GetIntegerv(GL_MAX_3D_TEXTURE_SIZE,
+ (GLint *)&gpu_dummy_params.limits.max_tex_3d_dim);
+ vt->GetIntegerv(GL_MAX_UNIFORM_BLOCK_SIZE,
+ (GLint *)&gpu_dummy_params.limits.max_ubo_size);
+ vt->GetIntegerv(GL_MAX_SHADER_STORAGE_BLOCK_SIZE,
+ (GLint *)&gpu_dummy_params.limits.max_ssbo_size);
+ vt->GetIntegerv(GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_ARB,
+ (GLint *)&gpu_dummy_params.limits.min_gather_offset);
+ vt->GetIntegerv(GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_ARB,
+ (GLint *)&gpu_dummy_params.limits.max_gather_offset);
+ vt->GetIntegerv(GL_MAX_COMPUTE_SHARED_MEMORY_SIZE,
+ (GLint *)&gpu_dummy_params.limits.max_shmem_size);
+ vt->GetIntegerv(GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS,
+ (GLint *)&gpu_dummy_params.limits.max_group_threads);
+ if (vt->GetIntegeri_v != NULL)
+ {
+ for (int i = 0; i < 3; i++)
+ {
+ vt->GetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_COUNT, i,
+ (GLint *)&gpu_dummy_params.limits.max_dispatch[i]);
+ vt->GetIntegeri_v(GL_MAX_COMPUTE_WORK_GROUP_SIZE, i,
+ (GLint *)&gpu_dummy_params.limits.max_group_size[i]);
+ }
+ }
+#endif
+#endif
+
+ /* Drain potential errors, non-existing variables will be set to zero */
+ while (vt->GetError() != GL_NO_ERROR) {}
+
tc->pl_ctx = pl_context_create(PL_API_VER, &(struct pl_context_params) {
.log_cb = log_cb,
.log_priv = tc,
.log_level = PL_LOG_INFO,
});
+
if (tc->pl_ctx) {
+#if PL_API_VER >= 18
+ /* pl_gpu = NULL is not fatal but might generate incorrect shaders
+ * depending or more recent GLSL version than VLC shaders. */
+ tc->pl_gpu = pl_gpu_dummy_create(tc->pl_ctx, &gpu_dummy_params);
+
+ struct pl_shader_params shader_params = {
+ .gpu = tc->pl_gpu,
+ };
+#endif
+
# if PL_API_VER >= 20
- tc->pl_sh = pl_shader_alloc(tc->pl_ctx, NULL);
+ tc->pl_sh = pl_shader_alloc(tc->pl_ctx, &shader_params);
# elif PL_API_VER >= 6
tc->pl_sh = pl_shader_alloc(tc->pl_ctx, NULL, 0);
# else
@@ -786,6 +860,9 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
GET_PROC_ADDR_CORE(GenTextures);
GET_PROC_ADDR_CORE(GetError);
GET_PROC_ADDR_CORE(GetIntegerv);
+#ifndef USE_OPENGL_ES2
+ GET_PROC_ADDR_OPTIONAL(GetIntegeri_v);
+#endif
GET_PROC_ADDR_CORE(GetString);
GET_PROC_ADDR_CORE(PixelStorei);
GET_PROC_ADDR_CORE(TexImage2D);
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/576630ee395d25d506e01a9a21de4475381644ec...2437484d7684a4661048df1e095484a276bbea0b
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/576630ee395d25d506e01a9a21de4475381644ec...2437484d7684a4661048df1e095484a276bbea0b
You're receiving this email because of your account on code.videolan.org.
More information about the vlc-commits
mailing list