aboutsummaryrefslogtreecommitdiffhomepage
path: root/video/out/opengl/formats.h
diff options
context:
space:
mode:
authorGravatar wm4 <wm4@nowhere>2017-06-30 16:57:17 +0200
committerGravatar wm4 <wm4@nowhere>2017-06-30 17:07:55 +0200
commit0c0a06140c8460115d5ce357a8adfc4d8c1bae69 (patch)
tree4a776f3152fa74ed81a0a2397d629edfd8ccdfba /video/out/opengl/formats.h
parent91583fccac85880ad2199f50463c095560791d56 (diff)
vo_opengl: restructure format setup
Instead of setting up a weird swizzle (which is linked to how the internal renderer code works, rather than the generic format code), add per-component mapping to gl_imgfmt_desc. The renderer still computes the weird swizzle, but at least it's confined to itself. Also, it appears the hwdec backends don't need this anymore. It's really nice that the messy init_format() goes away too.
Diffstat (limited to 'video/out/opengl/formats.h')
-rw-r--r--video/out/opengl/formats.h20
1 files changed, 13 insertions, 7 deletions
diff --git a/video/out/opengl/formats.h b/video/out/opengl/formats.h
index 288e92f5db..d86577547b 100644
--- a/video/out/opengl/formats.h
+++ b/video/out/opengl/formats.h
@@ -40,7 +40,6 @@ enum {
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_special_format(GL *gl, int mpfmt);
const struct gl_format *gl_find_format(GL *gl, int type, int flags,
int bytes_per_component, int n_components);
const struct gl_format *gl_find_unorm_format(GL *gl, int bytes_per_component,
@@ -59,12 +58,19 @@ 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];
+ // Component storage size in bits (possibly padded). For formats with
+ // different sizes per component, this is arbitrary. For padded formats
+ // like P010 or YUV420P10, padding is included.
+ int component_bits;
+ // Like mp_regular_imgfmt.component_pad.
+ int component_pad;
+ // For each texture and each texture output (rgba order) describe what
+ // component it returns.
+ // The values are like the values in mp_regular_imgfmt_plane.components[].
+ // Access as components[plane_nr][component_index]. Set unused items to 0.
+ // This pretends GL_RG is used instead of GL_LUMINANCE_ALPHA. The renderer
+ // fixes this later.
+ uint8_t components[4][4];
};
bool gl_get_imgfmt_desc(GL *gl, int imgfmt, struct gl_imgfmt_desc *out);