diff options
author | Niklas Haas <git@haasn.xyz> | 2017-08-26 05:39:53 +0200 |
---|---|---|
committer | Niklas Haas <git@haasn.xyz> | 2017-08-27 14:36:00 +0200 |
commit | 7684fda6ac69265ca21cdf2f1d8ae8483bb36607 (patch) | |
tree | 75aa03a8f3e106a4481bc05585a2ad4a99f10ec5 /video/out/opengl/ra_gl.c | |
parent | 45bae90f4d98c64f01ec2fe419a6aa6c068331b2 (diff) | |
download | mpv-7684fda6ac69265ca21cdf2f1d8ae8483bb36607.tar.bz2 mpv-7684fda6ac69265ca21cdf2f1d8ae8483bb36607.tar.xz |
vo_opengl: refactor shader_cache binding
There's no reason to be needlessly wasteful with our binding points
here. Just add a CAP for it.
Diffstat (limited to 'video/out/opengl/ra_gl.c')
-rw-r--r-- | video/out/opengl/ra_gl.c | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/video/out/opengl/ra_gl.c b/video/out/opengl/ra_gl.c index d9c7205815..1726980615 100644 --- a/video/out/opengl/ra_gl.c +++ b/video/out/opengl/ra_gl.c @@ -91,22 +91,27 @@ static int ra_init_gl(struct ra *ra, GL *gl) ra_gl_set_debug(ra, true); ra->fns = &ra_fns_gl; - ra->caps = RA_CAP_DIRECT_UPLOAD; - if (gl->mpgl_caps & MPGL_CAP_1D_TEX) - ra->caps |= RA_CAP_TEX_1D; - if (gl->mpgl_caps & MPGL_CAP_3D_TEX) - ra->caps |= RA_CAP_TEX_3D; - if (gl->BlitFramebuffer) - ra->caps |= RA_CAP_BLIT; - if (gl->mpgl_caps & MPGL_CAP_COMPUTE_SHADER) - ra->caps |= RA_CAP_COMPUTE; - if (gl->mpgl_caps & MPGL_CAP_NESTED_ARRAY) - ra->caps |= RA_CAP_NESTED_ARRAY; - if (gl->mpgl_caps & MPGL_CAP_SSBO) - ra->caps |= RA_CAP_BUF_RW; ra->glsl_version = gl->glsl_version; ra->glsl_es = gl->es > 0; + static const int caps_map[][2] = { + {RA_CAP_DIRECT_UPLOAD, 0}, + {RA_CAP_SHARED_BINDING, 0}, + {RA_CAP_TEX_1D, MPGL_CAP_1D_TEX}, + {RA_CAP_TEX_3D, MPGL_CAP_3D_TEX}, + {RA_CAP_COMPUTE, MPGL_CAP_COMPUTE_SHADER}, + {RA_CAP_NESTED_ARRAY, MPGL_CAP_NESTED_ARRAY}, + {RA_CAP_BUF_RW, MPGL_CAP_SSBO}, + }; + + for (int i = 0; i < MP_ARRAY_SIZE(caps_map); i++) { + if ((gl->mpgl_caps & caps_map[i][1]) == caps_map[i][1]) + ra->caps |= caps_map[i][0]; + } + + if (gl->BlitFramebuffer) + ra->caps |= RA_CAP_BLIT; + int gl_fmt_features = gl_format_feature_flags(gl); for (int n = 0; gl_formats[n].internal_format; n++) { |