summaryrefslogtreecommitdiffstats
path: root/video/out/opengl/formats.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-02-17 16:16:29 +0100
committerwm4 <wm4@nowhere>2017-02-17 16:28:31 +0100
commiteda69f5333a012dd76f8a9a46baa0e4624e95290 (patch)
tree4ce2e1d91b55d636f0e1084644b59efa74083aa6 /video/out/opengl/formats.h
parent9c54b224d8cdf05dcb1df73b6e8af1c868eca053 (diff)
downloadmpv-eda69f5333a012dd76f8a9a46baa0e4624e95290.tar.bz2
mpv-eda69f5333a012dd76f8a9a46baa0e4624e95290.tar.xz
vo_opengl: move texture mapping of pixel formats to helper function
All supported pixel formats have a specific "mapping" of CPU data to textures. This function determines the number and the formats of these textures. Moving it to a helper will be useful for some hardware decode interop backends, since they all need similar things.
Diffstat (limited to 'video/out/opengl/formats.h')
-rw-r--r--video/out/opengl/formats.h19
1 files changed, 16 insertions, 3 deletions
diff --git a/video/out/opengl/formats.h b/video/out/opengl/formats.h
index ebf3f3b331..5eed1ef2d4 100644
--- a/video/out/opengl/formats.h
+++ b/video/out/opengl/formats.h
@@ -35,9 +35,9 @@ enum {
// the format is still GL_FLOAT (32 bit)
// --- Other constants.
- MPGL_TYPE_UNORM = 1,
- MPGL_TYPE_UINT = 2,
- MPGL_TYPE_FLOAT = 3,
+ 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)
};
int gl_format_feature_flags(GL *gl);
@@ -57,4 +57,17 @@ int gl_component_size(GLenum type);
int gl_format_components(GLenum format);
int gl_bytes_per_pixel(GLenum format, GLenum type);
+struct gl_imgfmt_desc {
+ int num_planes;
+ const struct gl_format *planes[4];
+ // Chroma shift (sub-sampling) for each plane.
+ int xs[4], ys[4];
+ // Component order (e.g. "rgba"), applied after all planes are combined.
+ // This has always 4 components (the excess components have no meaning).
+ // (For GL_LUMINANCE_ALPHA, it is assumed "ra" has been assigned to "rg".)
+ char swizzle[5];
+};
+
+bool gl_get_imgfmt_desc(GL *gl, int imgfmt, struct gl_imgfmt_desc *out);
+
#endif