summaryrefslogtreecommitdiffstats
path: root/video/out/opengl/formats.c
diff options
context:
space:
mode:
Diffstat (limited to 'video/out/opengl/formats.c')
-rw-r--r--video/out/opengl/formats.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/video/out/opengl/formats.c b/video/out/opengl/formats.c
index 45cb96f8cb..9bdc7828e5 100644
--- a/video/out/opengl/formats.c
+++ b/video/out/opengl/formats.c
@@ -303,7 +303,14 @@ int gl_bytes_per_pixel(GLenum format, GLenum type)
case GL_UNSIGNED_SHORT_8_8_REV_APPLE: return 2;
}
- return gl_format_components(format) * gl_component_size(type);
+ return gl_component_size(type) * gl_format_components(format);
+}
+
+// The format has cleanly separated components (on byte boundaries).
+bool gl_format_is_regular(const struct gl_format *fmt)
+{
+ int bpp = gl_component_size(fmt->type) * gl_format_components(fmt->format);
+ return bpp == gl_bytes_per_pixel(fmt->format, fmt->type);
}
// dest = src.<w> (always using 4 components)