summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/formats.c16
-rw-r--r--src/mesa/main/formats.h3
2 files changed, 19 insertions, 0 deletions
diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c
index 1f83a5368d7..cca0014b178 100644
--- a/src/mesa/main/formats.c
+++ b/src/mesa/main/formats.c
@@ -27,6 +27,7 @@
#include "imports.h"
#include "formats.h"
#include "mfeatures.h"
+#include "macros.h"
/**
@@ -1613,6 +1614,21 @@ _mesa_get_format_bits(gl_format format, GLenum pname)
}
+GLuint
+_mesa_get_format_max_bits(gl_format format)
+{
+ const struct gl_format_info *info = _mesa_get_format_info(format);
+ GLuint max = MAX2(info->RedBits, info->GreenBits);
+ max = MAX2(max, info->BlueBits);
+ max = MAX2(max, info->AlphaBits);
+ max = MAX2(max, info->LuminanceBits);
+ max = MAX2(max, info->IntensityBits);
+ max = MAX2(max, info->DepthBits);
+ max = MAX2(max, info->StencilBits);
+ return max;
+}
+
+
/**
* Return the data type (or more specifically, the data representation)
* for the given format.
diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h
index e6b429d5f37..9609343387f 100644
--- a/src/mesa/main/formats.h
+++ b/src/mesa/main/formats.h
@@ -290,6 +290,9 @@ _mesa_get_format_bytes(gl_format format);
extern GLint
_mesa_get_format_bits(gl_format format, GLenum pname);
+extern GLuint
+_mesa_get_format_max_bits(gl_format format);
+
extern GLenum
_mesa_get_format_datatype(gl_format format);