diff options
author | Bin Jin <bjin@ctrl-d.org> | 2017-07-24 19:15:15 +0000 |
---|---|---|
committer | Bin Jin <bjin@ctrl-d.org> | 2017-07-25 04:07:26 +0800 |
commit | 13ef6bcf6fe129614299bb40daa1427a213ed949 (patch) | |
tree | 0a18b93c9d60a69f093f154faab5030d512700ee /video/out/opengl/utils.c | |
parent | dbef5b737e2f994f02923c8214cba368b663a655 (diff) | |
download | mpv-13ef6bcf6fe129614299bb40daa1427a213ed949.tar.bz2 mpv-13ef6bcf6fe129614299bb40daa1427a213ed949.tar.xz |
vo_opengl: enable compute shader for mesa
Mesa 17.1 supports compute shader but not full specs of OpenGL 4.3.
Change the code to detect OpenGL extension "GL_ARB_compute_shader"
rather than OpenGL version 4.3.
HDR peak detection requires SSBO, and polar scaler requires 2D array
extension. Add these extensions as requirement as well.
Diffstat (limited to 'video/out/opengl/utils.c')
-rw-r--r-- | video/out/opengl/utils.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/video/out/opengl/utils.c b/video/out/opengl/utils.c index afbd6f65af..451010fffa 100644 --- a/video/out/opengl/utils.c +++ b/video/out/opengl/utils.c @@ -777,6 +777,8 @@ void gl_sc_uniform_image2D(struct gl_shader_cache *sc, char *name, GLuint textur void gl_sc_ssbo(struct gl_shader_cache *sc, char *name, GLuint ssbo, char *format, ...) { + gl_sc_enable_extension(sc, "GL_ARB_shader_storage_buffer_object"); + struct sc_buffer *b = find_buffer(sc, name); b->binding = sc->next_buffer_binding++; b->ssbo = ssbo; @@ -1179,6 +1181,11 @@ struct mp_pass_perf gl_sc_generate(struct gl_shader_cache *sc, GLenum type) // set up shader text (header + uniforms + body) bstr *header = &sc->tmp[0]; ADD(header, "#version %d%s\n", gl->glsl_version, gl->es >= 300 ? " es" : ""); + if (type == GL_COMPUTE_SHADER) { + // This extension cannot be enabled in fragment shader. Enable it as + // an exception for compute shader. + ADD(header, "#extension GL_ARB_compute_shader : enable\n"); + } for (int n = 0; n < sc->num_exts; n++) ADD(header, "#extension %s : enable\n", sc->exts[n]); if (gl->es) { |