summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-08-08 17:53:19 +0200
committerwm4 <wm4@nowhere>2017-08-08 17:53:19 +0200
commit7397e8ab42acd4dcb12943949e902e3df2738085 (patch)
treee2ae2522ae17dc49a9df862e5b18dd601d64298c
parent6087f63003351812996823877a4abbd51a1f9530 (diff)
downloadmpv-7397e8ab42acd4dcb12943949e902e3df2738085.tar.bz2
mpv-7397e8ab42acd4dcb12943949e902e3df2738085.tar.xz
vo_opengl: add a hack for Apple's broken iOS hwdec stuff
As seen in hwdec_ios.m, it insists on using the legacy luminance alpha formats for mapped textures.
-rw-r--r--video/out/opengl/formats.c7
-rw-r--r--video/out/opengl/ra.h5
2 files changed, 11 insertions, 1 deletions
diff --git a/video/out/opengl/formats.c b/video/out/opengl/formats.c
index 7556bf21e2..56970d8b14 100644
--- a/video/out/opengl/formats.c
+++ b/video/out/opengl/formats.c
@@ -34,6 +34,12 @@ const struct gl_format gl_formats[] = {
{"rgb16", GL_RGB16, GL_RGB, T_U16, F_TF | F_GL2},
{"rgba16", GL_RGBA16, GL_RGBA, T_U16, F_TF | F_GL2},
+ // ES3 legacy. This is literally to compensate for Apple bugs in their iOS
+ // interop (can they do anything right?). ES3 still allows these formats,
+ // but they are deprecated.
+ {"l" , GL_LUMINANCE,GL_LUMINANCE, T_U8, F_CF | F_ES3},
+ {"la",GL_LUMINANCE_ALPHA,GL_LUMINANCE_ALPHA, T_U8, F_CF | F_ES3},
+
// ES2 legacy
{"l" , GL_LUMINANCE,GL_LUMINANCE, T_U8, F_TF | F_ES2},
{"la",GL_LUMINANCE_ALPHA,GL_LUMINANCE_ALPHA, T_U8, F_TF | F_ES2},
@@ -88,6 +94,7 @@ const struct gl_format gl_formats[] = {
// Special formats.
{"rgb565", GL_RGB8, GL_RGB,
GL_UNSIGNED_SHORT_5_6_5, F_TF | F_GL2 | F_GL3},
+ // Worthless, but needed by OSX videotoolbox interop on old Apple hardware.
{"appleyp", GL_RGB, GL_RGB_422_APPLE,
GL_UNSIGNED_SHORT_8_8_APPLE, F_TF | F_APPL},
diff --git a/video/out/opengl/ra.h b/video/out/opengl/ra.h
index bc149c27ee..00d631b93e 100644
--- a/video/out/opengl/ra.h
+++ b/video/out/opengl/ra.h
@@ -26,6 +26,8 @@ struct ra {
size_t max_shmem;
// Set of supported texture formats. Must be added by RA backend at init time.
+ // If there are equivalent formats with different caveats, the preferred
+ // formats should have a lower index. (E.g. GLES3 should put rg8 before la.)
struct ra_format **formats;
int num_formats;
@@ -61,7 +63,8 @@ struct ra_format {
void *priv;
enum ra_ctype ctype; // data type of each component
bool ordered; // components are sequential in memory, and returned
- // by the shader in memory order
+ // by the shader in memory order (the shader can
+ // return arbitrary values for unused components)
int num_components; // component count, 0 if not applicable, max. 4
int component_size[4]; // in bits, all entries 0 if not applicable
int component_depth[4]; // bits in use for each component, 0 if not applicable