diff options
-rw-r--r-- | video/out/opengl/common.c | 15 | ||||
-rw-r--r-- | video/out/opengl/ra_gl.c | 15 |
2 files changed, 25 insertions, 5 deletions
diff --git a/video/out/opengl/common.c b/video/out/opengl/common.c index 3d98d39381..b0d37bec44 100644 --- a/video/out/opengl/common.c +++ b/video/out/opengl/common.c @@ -308,6 +308,7 @@ static const struct gl_functions gl_functions[] = { }, { .ver_core = 430, + .extension = "GL_ARB_invalidate_subdata", .functions = (const struct gl_function[]) { DEF_FN(InvalidateTexImage), {0} @@ -339,8 +340,17 @@ static const struct gl_functions gl_functions[] = { {0} }, }, + // Equivalent extension for ES + { + .extension = "GL_EXT_buffer_storage", + .functions = (const struct gl_function[]) { + DEF_FN_NAME(BufferStorage, "glBufferStorageEXT"), + {0} + }, + }, { .ver_core = 420, + .ver_es_core = 310, .extension = "GL_ARB_shader_image_load_store", .functions = (const struct gl_function[]) { DEF_FN(BindImageTexture), @@ -350,16 +360,19 @@ static const struct gl_functions gl_functions[] = { }, { .ver_core = 310, + .ver_es_core = 300, .extension = "GL_ARB_uniform_buffer_object", .provides = MPGL_CAP_UBO, }, { .ver_core = 430, + .ver_es_core = 310, .extension = "GL_ARB_shader_storage_buffer_object", .provides = MPGL_CAP_SSBO, }, { .ver_core = 430, + .ver_es_core = 310, .extension = "GL_ARB_compute_shader", .functions = (const struct gl_function[]) { DEF_FN(DispatchCompute), @@ -638,7 +651,7 @@ void mpgl_load_functions2(GL *gl, void *(*get_fn)(void *ctx, const char *n), if (gl->es >= 200) gl->glsl_version = 100; if (gl->es >= 300) - gl->glsl_version = 300; + gl->glsl_version = gl->es; } else { gl->glsl_version = 120; int glsl_major = 0, glsl_minor = 0; diff --git a/video/out/opengl/ra_gl.c b/video/out/opengl/ra_gl.c index b0c5b34e8e..e08f5ed9bf 100644 --- a/video/out/opengl/ra_gl.c +++ b/video/out/opengl/ra_gl.c @@ -117,8 +117,8 @@ static int ra_init_gl(struct ra *ra, GL *gl) ra->caps |= RA_CAP_BUF_RW; } - // textureGather is only supported in GLSL 400+ - if (ra->glsl_version >= 400) + // textureGather is only supported in GLSL 400+ / ES 310+ + if (ra->glsl_version >= (ra->glsl_es ? 310 : 400)) ra->caps |= RA_CAP_GATHER; if (gl->BlitFramebuffer) @@ -127,7 +127,14 @@ static int ra_init_gl(struct ra *ra, GL *gl) // Disable compute shaders for GLSL < 420. This work-around is needed since // some buggy OpenGL drivers expose compute shaders for lower GLSL versions, // despite the spec requiring 420+. - if (ra->glsl_version < 420) + if (ra->glsl_version < (ra->glsl_es ? 310 : 420)) { + ra->caps &= ~RA_CAP_COMPUTE; + } + + // While we can handle compute shaders on GLES the spec (intentionally) + // does not support binding textures for writing, which all uses inside mpv + // would require. So disable it unconditionally anyway. + if (ra->glsl_es) ra->caps &= ~RA_CAP_COMPUTE; int gl_fmt_features = gl_format_feature_flags(gl); @@ -581,7 +588,7 @@ static struct ra_buf *gl_buf_create(struct ra *ra, { GL *gl = ra_gl_get(ra); - if (params->host_mapped && gl->version < 440) + if (params->host_mapped && !gl->BufferStorage) return NULL; struct ra_buf *buf = talloc_zero(NULL, struct ra_buf); |