summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-04-14 17:35:27 +0200
committerwm4 <wm4@nowhere>2017-04-14 17:35:27 +0200
commit7b84297699214a9e35eb7d4d447d29e62c26892f (patch)
treec2a00bf805e19e80f40a97d1004ac1cbc0b0de25 /video
parentdc5dfa5c929d2bf079cd8085338b9dc91c3fa8e3 (diff)
downloadmpv-7b84297699214a9e35eb7d4d447d29e62c26892f.tar.bz2
mpv-7b84297699214a9e35eb7d4d447d29e62c26892f.tar.xz
vo_opengl: minor cosmetics
Diffstat (limited to 'video')
-rw-r--r--video/out/opengl/formats.c16
-rw-r--r--video/out/opengl/formats.h4
-rw-r--r--video/out/opengl/gl_headers.h4
3 files changed, 13 insertions, 11 deletions
diff --git a/video/out/opengl/formats.c b/video/out/opengl/formats.c
index 1d1350ae1c..5c9a2ab331 100644
--- a/video/out/opengl/formats.c
+++ b/video/out/opengl/formats.c
@@ -10,7 +10,7 @@ enum {
// List of allowed formats, and their usability for bilinear filtering and FBOs.
// This is limited to combinations that are useful for our renderer.
-const struct gl_format gl_formats[] = {
+static const struct gl_format gl_formats[] = {
// These are used for desktop GL 3+, and GLES 3+ with GL_EXT_texture_norm16.
{GL_R8, GL_RED, T_U8, F_CF | F_GL3 | F_GL2F | F_ES3},
{GL_RG8, GL_RG, T_U8, F_CF | F_GL3 | F_GL2F | F_ES3},
@@ -238,8 +238,8 @@ int gl_format_type(const struct gl_format *format)
return MPGL_TYPE_UNORM;
}
-// Return an integer pixel "format" to a base internal format.
-// Return 0 if it's not an integer format.
+// Return base internal format of an integer format, or 0 if it's not integer.
+// "format" is like in struct gl_format.
GLenum gl_integer_format_to_base(GLenum format)
{
switch (format) {
@@ -251,6 +251,8 @@ GLenum gl_integer_format_to_base(GLenum format)
return 0;
}
+// Return whether it's a non-normalized integer format.
+// "format" is like in struct gl_format.
bool gl_is_integer_format(GLenum format)
{
return !!gl_integer_format_to_base(format);
@@ -259,6 +261,7 @@ bool gl_is_integer_format(GLenum format)
// Return the number of bytes per component this format implies.
// Returns 0 for formats with non-byte alignments and formats which
// merge multiple components (like GL_UNSIGNED_SHORT_5_6_5).
+// "type" is like in struct gl_format.
int gl_component_size(GLenum type)
{
switch (type) {
@@ -269,7 +272,8 @@ int gl_component_size(GLenum type)
return 0;
}
-// Return the number of a pixel "format".
+// Return the number of separate color components.
+// "format" is like in struct gl_format.
int gl_format_components(GLenum format)
{
switch (format) {
@@ -291,8 +295,8 @@ int gl_format_components(GLenum format)
return 0;
}
-// return the number of bytes per pixel for the given format
-// does not handle all possible variants, just those used by mpv
+// Return the number of bytes per pixel for the given format.
+// Parameter names like in struct gl_format.
int gl_bytes_per_pixel(GLenum format, GLenum type)
{
// Formats with merged components are special.
diff --git a/video/out/opengl/formats.h b/video/out/opengl/formats.h
index 9b20c3fa26..288e92f5db 100644
--- a/video/out/opengl/formats.h
+++ b/video/out/opengl/formats.h
@@ -7,11 +7,9 @@ struct gl_format {
GLint internal_format; // glTexImage argument
GLenum format; // glTexImage argument
GLenum type; // e.g. GL_UNSIGNED_SHORT
- int flags;
+ int flags; // F_* flags
};
-extern const struct gl_format gl_formats[];
-
enum {
// --- gl_format.flags
diff --git a/video/out/opengl/gl_headers.h b/video/out/opengl/gl_headers.h
index 60eb0f744e..bfefc3d3bf 100644
--- a/video/out/opengl/gl_headers.h
+++ b/video/out/opengl/gl_headers.h
@@ -59,7 +59,7 @@
#define GL_TEXTURE_RECTANGLE 0x84F5
-// -- GL 3.3
+// --- GL 3.3
#define GL_TIME_ELAPSED 0x88BF
@@ -77,7 +77,7 @@
// --- GL_OES_EGL_image_external, GL_NV_EGL_stream_consumer_external
-#define GL_TEXTURE_EXTERNAL_OES 0x8D65
+#define GL_TEXTURE_EXTERNAL_OES 0x8D65
// --- GL_APPLE_rgb_422