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.
This commit is contained in:
wm4 2017-08-08 17:53:19 +02:00
parent 6087f63003
commit 7397e8ab42
2 changed files with 11 additions and 1 deletions

View File

@ -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},

View File

@ -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