parent
224705741e
commit
43434e55af
@ -0,0 +1,259 @@
|
||||
From 110d69c8245bb2bc1f0cf183dcdd6ba636973bfc Mon Sep 17 00:00:00 2001
|
||||
From: Niklas Haas <git@haasn.dev>
|
||||
Date: Tue, 18 Jan 2022 16:47:22 +0100
|
||||
Subject: [PATCH 1/4] 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
|
||||
---
|
||||
modules/video_output/opengl/converter.h | 1 -
|
||||
modules/video_output/opengl/vout_helper.c | 78 +----------------------
|
||||
2 files changed, 2 insertions(+), 77 deletions(-)
|
||||
|
||||
diff --git a/modules/video_output/opengl/converter.h b/modules/video_output/opengl/converter.h
|
||||
index f8f0c12024..b69807f8cd 100644
|
||||
--- a/modules/video_output/opengl/converter.h
|
||||
+++ b/modules/video_output/opengl/converter.h
|
||||
@@ -340,7 +340,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;
|
||||
|
||||
diff --git a/modules/video_output/opengl/vout_helper.c b/modules/video_output/opengl/vout_helper.c
|
||||
index bf07c1c03f..711a14b7ae 100644
|
||||
--- a/modules/video_output/opengl/vout_helper.c
|
||||
+++ b/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,14 @@ 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, NULL);
|
||||
# elif PL_API_VER >= 6
|
||||
tc->pl_sh = pl_shader_alloc(tc->pl_ctx, NULL, 0);
|
||||
# else
|
||||
@@ -861,7 +787,7 @@ vout_display_opengl_t *vout_display_opengl_New(video_format_t *fmt,
|
||||
GET_PROC_ADDR_CORE(GetError);
|
||||
GET_PROC_ADDR_CORE(GetIntegerv);
|
||||
#ifndef USE_OPENGL_ES2
|
||||
- GET_PROC_ADDR_OPTIONAL(GetIntegeri_v);
|
||||
+ GET_PROC_ADDR_CORE(GetIntegeri_v);
|
||||
#endif
|
||||
GET_PROC_ADDR_CORE(GetString);
|
||||
GET_PROC_ADDR_CORE(PixelStorei);
|
||||
--
|
||||
GitLab
|
||||
|
||||
|
||||
From 6d145e38c03d4ffa5b6bff31e358a5ca6ceb3461 Mon Sep 17 00:00:00 2001
|
||||
From: Niklas Haas <git@haasn.dev>
|
||||
Date: Tue, 18 Jan 2022 17:07:25 +0100
|
||||
Subject: [PATCH 2/4] 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.
|
||||
---
|
||||
modules/video_output/opengl/vout_helper.c | 5 ++++-
|
||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/modules/video_output/opengl/vout_helper.c b/modules/video_output/opengl/vout_helper.c
|
||||
index 711a14b7ae..a98621a859 100644
|
||||
--- a/modules/video_output/opengl/vout_helper.c
|
||||
+++ b/modules/video_output/opengl/vout_helper.c
|
||||
@@ -629,7 +629,10 @@ opengl_init_program(vout_display_opengl_t *vgl, struct prgm *prgm,
|
||||
});
|
||||
if (tc->pl_ctx) {
|
||||
# if PL_API_VER >= 20
|
||||
- tc->pl_sh = pl_shader_alloc(tc->pl_ctx, NULL);
|
||||
+ 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
|
||||
--
|
||||
GitLab
|
||||
|
||||
|
||||
From 645cbd6fac5bd07d1c973be9fc048b0f329c087c Mon Sep 17 00:00:00 2001
|
||||
From: Niklas Haas <git@haasn.dev>
|
||||
Date: Tue, 18 Jan 2022 17:19:27 +0100
|
||||
Subject: [PATCH 3/4] opengl: don't error on no-op libplacebo shader
|
||||
|
||||
See 6efc345d81a12
|
||||
---
|
||||
modules/video_output/opengl/fragment_shaders.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/modules/video_output/opengl/fragment_shaders.c b/modules/video_output/opengl/fragment_shaders.c
|
||||
index e0b98732ca..ecf7226f0e 100644
|
||||
--- a/modules/video_output/opengl/fragment_shaders.c
|
||||
+++ b/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);
|
||||
--
|
||||
GitLab
|
||||
|
||||
|
||||
From 37bf74e6645d3023c1ebcbd81ffae1e552d3a73e Mon Sep 17 00:00:00 2001
|
||||
From: Niklas Haas <git@haasn.dev>
|
||||
Date: Tue, 18 Jan 2022 18:03:48 +0100
|
||||
Subject: [PATCH 4/4] opengl: drop unneeded GetIntegeri_v
|
||||
|
||||
This causes issues on some platforms, and we don't need it
|
||||
---
|
||||
modules/video_output/opengl/converter.h | 3 ---
|
||||
modules/video_output/opengl/vout_helper.c | 3 ---
|
||||
2 files changed, 6 deletions(-)
|
||||
|
||||
diff --git a/modules/video_output/opengl/converter.h b/modules/video_output/opengl/converter.h
|
||||
index b69807f8cd..7000e1f38e 100644
|
||||
--- a/modules/video_output/opengl/converter.h
|
||||
+++ b/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;
|
||||
diff --git a/modules/video_output/opengl/vout_helper.c b/modules/video_output/opengl/vout_helper.c
|
||||
index a98621a859..13d65e04c8 100644
|
||||
--- a/modules/video_output/opengl/vout_helper.c
|
||||
+++ b/modules/video_output/opengl/vout_helper.c
|
||||
@@ -789,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_CORE(GetIntegeri_v);
|
||||
-#endif
|
||||
GET_PROC_ADDR_CORE(GetString);
|
||||
GET_PROC_ADDR_CORE(PixelStorei);
|
||||
GET_PROC_ADDR_CORE(TexImage2D);
|
||||
--
|
||||
GitLab
|
||||
|
@ -0,0 +1,98 @@
|
||||
diff -uNrp a/modules/video_output/caca.c b/modules/video_output/caca.c
|
||||
--- a/modules/video_output/caca.c 2022-01-14 06:09:28.000000000 +0000
|
||||
+++ b/modules/video_output/caca.c 2022-01-18 23:09:44.979137301 +0000
|
||||
@@ -74,9 +74,9 @@ static void Place(vout_display_t *, vout
|
||||
|
||||
/* */
|
||||
struct vout_display_sys_t {
|
||||
- cucul_canvas_t *cv;
|
||||
+ caca_canvas_t *cv;
|
||||
caca_display_t *dp;
|
||||
- cucul_dither_t *dither;
|
||||
+ caca_dither_t *dither;
|
||||
|
||||
picture_pool_t *pool;
|
||||
vout_display_event_thread_t *et;
|
||||
@@ -153,9 +153,9 @@ static int Open(vlc_object_t *object)
|
||||
if (!sys)
|
||||
goto error;
|
||||
|
||||
- sys->cv = cucul_create_canvas(0, 0);
|
||||
+ sys->cv = caca_create_canvas(0, 0);
|
||||
if (!sys->cv) {
|
||||
- msg_Err(vd, "cannot initialize libcucul");
|
||||
+ msg_Err(vd, "cannot initialize libcaca");
|
||||
goto error;
|
||||
}
|
||||
|
||||
@@ -209,11 +209,11 @@ error:
|
||||
if (sys->pool)
|
||||
picture_pool_Release(sys->pool);
|
||||
if (sys->dither)
|
||||
- cucul_free_dither(sys->dither);
|
||||
+ caca_free_dither(sys->dither);
|
||||
if (sys->dp)
|
||||
caca_free_display(sys->dp);
|
||||
if (sys->cv)
|
||||
- cucul_free_canvas(sys->cv);
|
||||
+ caca_free_canvas(sys->cv);
|
||||
|
||||
free(sys);
|
||||
}
|
||||
@@ -235,9 +235,9 @@ static void Close(vlc_object_t *object)
|
||||
if (sys->pool)
|
||||
picture_pool_Release(sys->pool);
|
||||
if (sys->dither)
|
||||
- cucul_free_dither(sys->dither);
|
||||
+ caca_free_dither(sys->dither);
|
||||
caca_free_display(sys->dp);
|
||||
- cucul_free_canvas(sys->cv);
|
||||
+ caca_free_canvas(sys->cv);
|
||||
|
||||
#if defined(_WIN32)
|
||||
FreeConsole();
|
||||
@@ -266,7 +266,7 @@ static void Prepare(vout_display_t *vd,
|
||||
|
||||
if (!sys->dither) {
|
||||
/* Create the libcaca dither object */
|
||||
- sys->dither = cucul_create_dither(32,
|
||||
+ sys->dither = caca_create_dither(32,
|
||||
vd->source.i_visible_width,
|
||||
vd->source.i_visible_height,
|
||||
picture->p[0].i_pitch,
|
||||
@@ -284,12 +284,12 @@ static void Prepare(vout_display_t *vd,
|
||||
vout_display_place_t place;
|
||||
Place(vd, &place);
|
||||
|
||||
- cucul_set_color_ansi(sys->cv, CUCUL_COLOR_DEFAULT, CUCUL_COLOR_BLACK);
|
||||
- cucul_clear_canvas(sys->cv);
|
||||
+ caca_set_color_ansi(sys->cv, CACA_DEFAULT, CACA_BLACK);
|
||||
+ caca_clear_canvas(sys->cv);
|
||||
|
||||
const int crop_offset = vd->source.i_y_offset * picture->p->i_pitch +
|
||||
vd->source.i_x_offset * picture->p->i_pixel_pitch;
|
||||
- cucul_dither_bitmap(sys->cv, place.x, place.y,
|
||||
+ caca_dither_bitmap(sys->cv, place.x, place.y,
|
||||
place.width, place.height,
|
||||
sys->dither,
|
||||
&picture->p->p_pixels[crop_offset]);
|
||||
@@ -328,7 +328,7 @@ static int Control(vout_display_t *vd, i
|
||||
|
||||
case VOUT_DISPLAY_CHANGE_SOURCE_CROP:
|
||||
if (sys->dither)
|
||||
- cucul_free_dither(sys->dither);
|
||||
+ caca_free_dither(sys->dither);
|
||||
sys->dither = NULL;
|
||||
return VLC_SUCCESS;
|
||||
|
||||
@@ -366,8 +366,8 @@ static void Place(vout_display_t *vd, vo
|
||||
|
||||
vout_display_PlacePicture(place, &vd->source, vd->cfg, false);
|
||||
|
||||
- const int canvas_width = cucul_get_canvas_width(sys->cv);
|
||||
- const int canvas_height = cucul_get_canvas_height(sys->cv);
|
||||
+ const int canvas_width = caca_get_canvas_width(sys->cv);
|
||||
+ const int canvas_height = caca_get_canvas_height(sys->cv);
|
||||
const int display_width = caca_get_display_width(sys->dp);
|
||||
const int display_height = caca_get_display_height(sys->dp);
|
||||
|
Loading…
Reference in new issue