summaryrefslogtreecommitdiffstats
path: root/video/out/opengl
diff options
context:
space:
mode:
Diffstat (limited to 'video/out/opengl')
-rw-r--r--video/out/opengl/common.c16
-rw-r--r--video/out/opengl/common.h1
-rw-r--r--video/out/opengl/ra_gl.c1
3 files changed, 18 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;
diff --git a/video/out/opengl/common.h b/video/out/opengl/common.h
index a9e67d9756..35535322ad 100644
--- a/video/out/opengl/common.h
+++ b/video/out/opengl/common.h
@@ -59,6 +59,7 @@ enum {
MPGL_CAP_COMPUTE_SHADER = (1 << 23), // GL_ARB_compute_shader & GL_ARB_shader_image_load_store
MPGL_CAP_NESTED_ARRAY = (1 << 24), // GL_ARB_arrays_of_arrays
+ MPGL_CAP_SLOW_DR = (1 << 29), // direct rendering is assumed to be slow
MPGL_CAP_SW = (1 << 30), // indirect or sw renderer
};
diff --git a/video/out/opengl/ra_gl.c b/video/out/opengl/ra_gl.c
index 03207e1c4a..f535f1f13d 100644
--- a/video/out/opengl/ra_gl.c
+++ b/video/out/opengl/ra_gl.c
@@ -103,6 +103,7 @@ static int ra_init_gl(struct ra *ra, GL *gl)
{RA_CAP_COMPUTE, MPGL_CAP_COMPUTE_SHADER},
{RA_CAP_NUM_GROUPS, MPGL_CAP_COMPUTE_SHADER},
{RA_CAP_NESTED_ARRAY, MPGL_CAP_NESTED_ARRAY},
+ {RA_CAP_SLOW_DR, MPGL_CAP_SLOW_DR},
};
for (int i = 0; i < MP_ARRAY_SIZE(caps_map); i++) {