summaryrefslogtreecommitdiffstats
path: root/video/out/opengl/formats.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-07-26 11:19:51 +0200
committerwm4 <wm4@nowhere>2017-07-26 11:31:43 +0200
commit81851febc4766e053cc17134c779959f5942025a (patch)
tree48e6aedcdb3889e641dfb169e1fff8c144b01bfa /video/out/opengl/formats.h
parent5904eddb38f20bf794aadff659050c0b32479054 (diff)
downloadmpv-81851febc4766e053cc17134c779959f5942025a.tar.bz2
mpv-81851febc4766e053cc17134c779959f5942025a.tar.xz
vo_opengl: start work on rendering API abstraction
This starts work on moving OpenGL-specific code out of the general renderer code, so that we can support other other GPU APIs. This is in a very early stage and it's only a proof of concept. It's unknown whether this will succeed or result in other backends. For now, the GL rendering API ("ra") and its only provider (ra_gl) does texture creation/upload/destruction only. And it's used for the main video texture only. All other code is still hardcoded to GL. There is some duplication with ra_format and gl_format handling. In the end, only the ra variants will be needed (plus the gl_format table of course). For now, this is simpler, because for some reason lots of hwdec code still requires the GL variants, and would have to be updated to use the ra ones. Currently, the video.c code accesses private ra_gl fields. In the end, it should not do that of course, and it would not include ra_gl.h. Probably adds bugs, but you can keep them.
Diffstat (limited to 'video/out/opengl/formats.h')
-rw-r--r--video/out/opengl/formats.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/video/out/opengl/formats.h b/video/out/opengl/formats.h
index 5bb3bcb4a3..d4d38c1150 100644
--- a/video/out/opengl/formats.h
+++ b/video/out/opengl/formats.h
@@ -2,8 +2,10 @@
#define MPGL_FORMATS_H_
#include "common.h"
+#include "ra.h"
struct gl_format {
+ const char *name; // symbolic name for user interaction/debugging
GLint internal_format; // glTexImage argument
GLenum format; // glTexImage argument
GLenum type; // e.g. GL_UNSIGNED_SHORT
@@ -33,11 +35,13 @@ enum {
// the format is still GL_FLOAT (32 bit)
// --- Other constants.
- MPGL_TYPE_UNORM = 1, // normalized integer (fixed point) formats
- MPGL_TYPE_UINT = 2, // full integer formats
- MPGL_TYPE_FLOAT = 3, // float formats (both full and half)
+ MPGL_TYPE_UNORM = RA_CTYPE_UNORM, // normalized integer (fixed point) formats
+ MPGL_TYPE_UINT = RA_CTYPE_UINT, // full integer formats
+ MPGL_TYPE_FLOAT = RA_CTYPE_FLOAT, // float formats (both full and half)
};
+extern const struct gl_format gl_formats[];
+
int gl_format_feature_flags(GL *gl);
const struct gl_format *gl_find_internal_format(GL *gl, GLint internal_format);
const struct gl_format *gl_find_format(GL *gl, int type, int flags,