From 9b59d39a3ab64da0e9489ee4ce2062d4503e7cc5 Mon Sep 17 00:00:00 2001 From: sfan5 Date: Sat, 21 Jan 2023 15:46:06 +0100 Subject: 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. Co-authored-by: Niklas Haas --- video/out/opengl/common.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'video/out/opengl/common.c') 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 #include #include +#include #include #include #include @@ -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; -- cgit v1.2.3