[vlc-commits] [Git][videolan/vlc][3.0.x] 4 commits: Revert "opengl: vout_helper: use pl_gpu_dummy for shaders"

Romain Vimont (@rom1v) gitlab at videolan.org
Fri Jan 21 16:57:11 UTC 2022



Romain Vimont pushed to branch 3.0.x at VideoLAN / VLC


Commits:
110d69c8 by Niklas Haas at 2022-01-18T16:47:22+01:00
Revert "opengl: vout_helper: use pl_gpu_dummy for shaders"

This reverts commit 2437484d7684a4661048df1e095484a276bbea0b.

The referenced commit is not a good way of fixing the issue described in
its commit message. Attaching a dummy GPU to the pl_shader makes the
shader think a GPU is actually available, and can lead to e.g. the use
of a dither texture (which VLC has no mapping code for, and would thus
result in a shader compilation error).

All of the queried limits are also irrelevant for the way we use shaders
in this code, since they only affect GPU resources (which we can't use)
or texture sampling (which we don't use).

Fixes #26503 by removing the conflicting code

- - - - -
6d145e38 by Niklas Haas at 2022-01-18T17:07:25+01:00
opengl: vout_helper: use pl_shader_params.glsl

This is the proper way to limit the GLSL version when using standalone
shaders without an associated GPU backend.

- - - - -
645cbd6f by Niklas Haas at 2022-01-18T17:21:47+01:00
opengl: don't error on no-op libplacebo shader

See 6efc345d81a12

- - - - -
37bf74e6 by Niklas Haas at 2022-01-18T18:03:48+01:00
opengl: drop unneeded GetIntegeri_v

This causes issues on some platforms, and we don't need it

- - - - -


3 changed files:

- modules/video_output/opengl/converter.h
- modules/video_output/opengl/fragment_shaders.c
- modules/video_output/opengl/vout_helper.c


Changes:

=====================================
modules/video_output/opengl/converter.h
=====================================
@@ -167,9 +167,6 @@ typedef struct {
     PFNGLGENTEXTURESPROC    GenTextures;
     PFNGLGETERRORPROC       GetError;
     PFNGLGETINTEGERVPROC    GetIntegerv;
-#ifndef USE_OPENGL_ES2
-    PFNGLGETINTEGERIVPROC   GetIntegeri_v;
-#endif
     PFNGLGETSTRINGPROC      GetString;
     PFNGLPIXELSTOREIPROC    PixelStorei;
     PFNGLTEXIMAGE2DPROC     TexImage2D;
@@ -340,7 +337,6 @@ 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/fragment_shaders.c
=====================================
@@ -765,8 +765,8 @@ opengl_fragment_shader_init_impl(opengl_tex_converter_t *tc, GLenum tex_target,
     }
 
 #ifdef HAVE_LIBPLACEBO
-    if (tc->pl_sh_res) {
-        const struct pl_shader_res *res = tc->pl_sh_res;
+    const struct pl_shader_res *res = tc->pl_sh_res;
+    if (res && res->input != PL_SHADER_SIG_NONE) {
         assert(res->input  == PL_SHADER_SIG_COLOR);
         assert(res->output == PL_SHADER_SIG_COLOR);
         ADDF(" result = %s(result);\n", res->name);


=====================================
modules/video_output/opengl/vout_helper.c
=====================================
@@ -44,12 +44,6 @@
 #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
@@ -576,10 +570,6 @@ 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
@@ -632,78 +622,17 @@ 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, &shader_params);
+            tc->pl_sh = pl_shader_alloc(tc->pl_ctx, &(struct pl_shader_params) {
+                .glsl.version = tc->glsl_version,
+                .glsl.gles = tc->is_gles,
+            });
 #   elif PL_API_VER >= 6
             tc->pl_sh = pl_shader_alloc(tc->pl_ctx, NULL, 0);
 #   else
@@ -860,9 +789,6 @@ 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/7d014e8d4b7a911a0d823075658d3ea390ddf5dc...37bf74e6645d3023c1ebcbd81ffae1e552d3a73e

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/7d014e8d4b7a911a0d823075658d3ea390ddf5dc...37bf74e6645d3023c1ebcbd81ffae1e552d3a73e
You're receiving this email because of your account on code.videolan.org.




More information about the vlc-commits mailing list