aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/formats.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-01-12 20:34:04 +0000
committermarha <marha@users.sourceforge.net>2011-01-12 20:34:04 +0000
commit2ebdcfeee38bed8c65daa78aa7d18d8d1d93ed85 (patch)
tree276bf91b61421f0043fc8ac00a13af467ecc10f2 /mesalib/src/mesa/main/formats.c
parent4613071e75e4828ce69ac1f17d73b0b7b6275578 (diff)
downloadvcxsrv-2ebdcfeee38bed8c65daa78aa7d18d8d1d93ed85.tar.gz
vcxsrv-2ebdcfeee38bed8c65daa78aa7d18d8d1d93ed85.tar.bz2
vcxsrv-2ebdcfeee38bed8c65daa78aa7d18d8d1d93ed85.zip
xkeyboard-config libX11 mesalib git update 12 jan 2011
Diffstat (limited to 'mesalib/src/mesa/main/formats.c')
-rw-r--r--mesalib/src/mesa/main/formats.c39
1 files changed, 31 insertions, 8 deletions
diff --git a/mesalib/src/mesa/main/formats.c b/mesalib/src/mesa/main/formats.c
index d17619ef1..46ac15ed7 100644
--- a/mesalib/src/mesa/main/formats.c
+++ b/mesalib/src/mesa/main/formats.c
@@ -802,7 +802,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
{
MESA_FORMAT_SIGNED_R8, /* Name */
"MESA_FORMAT_SIGNED_R8", /* StrName */
- GL_RGBA, /* BaseFormat */
+ GL_RED, /* BaseFormat */
GL_SIGNED_NORMALIZED, /* DataType */
8, 0, 0, 0, /* Red/Green/Blue/AlphaBits */
0, 0, 0, 0, 0, /* Lum/Int/Index/Depth/StencilBits */
@@ -811,7 +811,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
{
MESA_FORMAT_SIGNED_RG88,
"MESA_FORMAT_SIGNED_RG88",
- GL_RGBA,
+ GL_RG,
GL_SIGNED_NORMALIZED,
8, 8, 0, 0,
0, 0, 0, 0, 0,
@@ -820,7 +820,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
{
MESA_FORMAT_SIGNED_RGBX8888,
"MESA_FORMAT_SIGNED_RGBX8888",
- GL_RGBA,
+ GL_RGB,
GL_SIGNED_NORMALIZED,
8, 8, 8, 0,
0, 0, 0, 0, 0,
@@ -849,7 +849,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
{
MESA_FORMAT_SIGNED_R_16,
"MESA_FORMAT_SIGNED_R_16",
- GL_RGBA,
+ GL_RED,
GL_SIGNED_NORMALIZED,
16, 0, 0, 0,
0, 0, 0, 0, 0,
@@ -858,7 +858,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
{
MESA_FORMAT_SIGNED_RG_16,
"MESA_FORMAT_SIGNED_RG_16",
- GL_RGBA,
+ GL_RG,
GL_SIGNED_NORMALIZED,
16, 16, 0, 0,
0, 0, 0, 0, 0,
@@ -867,7 +867,7 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] =
{
MESA_FORMAT_SIGNED_RGB_16,
"MESA_FORMAT_SIGNED_RGB_16",
- GL_RGBA,
+ GL_RGB,
GL_SIGNED_NORMALIZED,
16, 16, 16, 0,
0, 0, 0, 0, 0,
@@ -1168,6 +1168,27 @@ _mesa_format_row_stride(gl_format format, GLsizei width)
}
+/**
+ * Debug/test: check that all formats are handled in the
+ * _mesa_format_to_type_and_comps() function. When new pixel formats
+ * are added to Mesa, that function needs to be updated.
+ * This is a no-op after the first call.
+ */
+static void
+check_format_to_type_and_comps(void)
+{
+ gl_format f;
+
+ for (f = MESA_FORMAT_NONE + 1; f < MESA_FORMAT_COUNT; f++) {
+ GLenum datatype = 0;
+ GLuint comps = 0;
+ /* This function will emit a problem/warning if the format is
+ * not handled.
+ */
+ _mesa_format_to_type_and_comps(f, &datatype, &comps);
+ }
+}
+
/**
* Do sanity checking of the format info table.
@@ -1192,7 +1213,7 @@ _mesa_test_formats(void)
if (info->RedBits > 0) {
GLuint t = info->RedBits + info->GreenBits
+ info->BlueBits + info->AlphaBits;
- assert(t / 8 == info->BytesPerBlock);
+ assert(t / 8 <= info->BytesPerBlock);
(void) t;
}
}
@@ -1200,6 +1221,7 @@ _mesa_test_formats(void)
assert(info->DataType == GL_UNSIGNED_NORMALIZED ||
info->DataType == GL_SIGNED_NORMALIZED ||
info->DataType == GL_UNSIGNED_INT ||
+ info->DataType == GL_INT ||
info->DataType == GL_FLOAT);
if (info->BaseFormat == GL_RGB) {
@@ -1250,8 +1272,9 @@ _mesa_test_formats(void)
assert(info->LuminanceBits == 0);
assert(info->IntensityBits > 0);
}
-
}
+
+ check_format_to_type_and_comps();
}