diff options
author | sfan5 <sfan5@live.de> | 2023-01-21 15:46:06 +0100 |
---|---|---|
committer | Niklas Haas <github-daiK1o@haasn.dev> | 2023-01-23 14:13:34 +0100 |
commit | 9b59d39a3ab64da0e9489ee4ce2062d4503e7cc5 (patch) | |
tree | 95ad1bfc4177f44f80faf59359c9739273b11abc /video/out/opengl/common.c | |
parent | 2531a89fcb93d7c7578cec4c5536c37244f08d39 (diff) | |
download | mpv-9b59d39a3ab64da0e9489ee4ce2062d4503e7cc5.tar.bz2 mpv-9b59d39a3ab64da0e9489ee4ce2062d4503e7cc5.tar.xz |
vo_gpu: implement VO_DR_FLAG_HOST_CACHED
For OpenGL, this is based on simply comparing GL_VENDOR strings against
a list of allowed vendors.
Co-authored-by: Nicolas F. <ovdev@fratti.ch>
Co-authored-by: Niklas Haas <git@haasn.dev>
Diffstat (limited to 'video/out/opengl/common.c')
-rw-r--r-- | video/out/opengl/common.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/video/out/opengl/common.c b/video/out/opengl/common.c index cf680e9c4c..ee2650867c 100644 --- a/video/out/opengl/common.c +++ b/video/out/opengl/common.c @@ -25,6 +25,7 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> +#include <strings.h> #include <stdbool.h> #include <math.h> #include <assert.h> @@ -47,6 +48,18 @@ static bool is_software_gl(GL *gl) strcmp(renderer, "Apple Software Renderer") == 0; } +// This guesses whether our DR path is fast or slow +static bool is_fast_dr(GL *gl) +{ + const char *vendor = gl->GetString(GL_VENDOR); + if (!vendor) + return false; + + return strcasecmp(vendor, "AMD") == 0 || + strcasecmp(vendor, "NVIDIA Corporation") == 0 || + strcasecmp(vendor, "ATI Technologies Inc.") == 0; // AMD on Windows +} + static void GLAPIENTRY dummy_glBindFramebuffer(GLenum target, GLuint framebuffer) { assert(framebuffer == 0); @@ -650,6 +663,9 @@ void mpgl_load_functions2(GL *gl, void *(*get_fn)(void *ctx, const char *n), mp_verbose(log, "Detected suspected software renderer.\n"); } + if (!is_fast_dr(gl)) + gl->mpgl_caps |= MPGL_CAP_SLOW_DR; + // GL_ARB_compute_shader & GL_ARB_shader_image_load_store if (gl->DispatchCompute && gl->BindImageTexture) gl->mpgl_caps |= MPGL_CAP_COMPUTE_SHADER; |