diff options
author | Niklas Haas <git@haasn.xyz> | 2017-07-25 20:12:44 +0200 |
---|---|---|
committer | Niklas Haas <git@haasn.xyz> | 2017-07-25 20:14:03 +0200 |
commit | 49a648447ffae91a3bf6e46abe861bedf8baa546 (patch) | |
tree | fb70d2d29442bb3da6011a10226a763b8d4fd081 /video | |
parent | 7097b6f81c76990952d65a6c5bea71b2f8856043 (diff) |
vo_opengl: cosmetic change
Diffstat (limited to 'video')
-rw-r--r-- | video/out/opengl/video.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/video/out/opengl/video.c b/video/out/opengl/video.c index 949c74b0fe..91adc62660 100644 --- a/video/out/opengl/video.c +++ b/video/out/opengl/video.c @@ -1753,14 +1753,8 @@ static void pass_sample(struct gl_video *p, struct img_tex tex, } else if (strcmp(name, "oversample") == 0) { pass_sample_oversample(p->sc, scaler, w, h); } else if (scaler->kernel && scaler->kernel->polar) { - bool use_compute_polar = (p->gl->mpgl_caps & MPGL_CAP_COMPUTE_SHADER) && - (p->gl->mpgl_caps & MPGL_CAP_NESTED_ARRAY); - // Use a compute shader where possible, fallback to the slower texture - // fragment sampler otherwise. Also use the fragment shader for - // very large kernels to avoid exhausting shmem - if (!use_compute_polar || scaler->kernel->f.radius > 16) { - pass_sample_polar(p->sc, scaler, tex.components, p->gl->glsl_version); - } else { + GLenum reqs = MPGL_CAP_COMPUTE_SHADER | MPGL_CAP_NESTED_ARRAY; + if ((p->gl->mpgl_caps & reqs) && scaler->kernel->f.radius <= 16) { // For performance we want to load at least as many pixels // horizontally as there are threads in a warp (32 for nvidia), as // well as enough to take advantage of shmem parallelism @@ -1769,6 +1763,10 @@ static void pass_sample(struct gl_video *p, struct img_tex tex, pass_compute_polar(p->sc, scaler, tex.components, p->compute_w, p->compute_h, (float)w / tex.w, (float)h / tex.h); + } else { + // Fall back to regular polar shader when compute shaders are + // unsupported or the kernel is too big for shmem + pass_sample_polar(p->sc, scaler, tex.components, p->gl->glsl_version); } } else if (scaler->kernel) { pass_sample_separated(p, tex, scaler, w, h); |