X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Fformats.c;h=9db9f1c56ead2536c23030ef1ba4f7cc5caa02c8;hb=e7087175f8a04f777403366fb34b58edd00f4d60;hp=3671140e85900234f246e366781d1f89a8d56073;hpb=17e96718946486ef77927fcf3bb299d8bff32b98;p=mesa.git diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index 3671140e859..9db9f1c56ea 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -26,7 +26,7 @@ #include "imports.h" #include "formats.h" -#include "config.h" +#include "mfeatures.h" /** @@ -48,7 +48,7 @@ struct gl_format_info /** * Logical data type: one of GL_UNSIGNED_NORMALIZED, GL_SIGNED_NORMALED, - * GL_UNSIGNED_INT, GL_SIGNED_INT, GL_FLOAT. + * GL_UNSIGNED_INT, GL_INT, GL_FLOAT. */ GLenum DataType; @@ -628,6 +628,66 @@ static struct gl_format_info format_info[MESA_FORMAT_COUNT] = 0, 16, 0, 0, 0, 1, 1, 2 }, + + /* unnormalized signed int formats */ + { + MESA_FORMAT_RGBA_INT8, + "MESA_FORMAT_RGBA_INT8", + GL_RGBA, + GL_INT, + 8, 8, 8, 8, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_RGBA_INT16, + "MESA_FORMAT_RGBA_INT16", + GL_RGBA, + GL_INT, + 16, 16, 16, 16, + 0, 0, 0, 0, 0, + 1, 1, 8 + }, + { + MESA_FORMAT_RGBA_INT32, + "MESA_FORMAT_RGBA_INT32", + GL_RGBA, + GL_INT, + 32, 32, 32, 32, + 0, 0, 0, 0, 0, + 1, 1, 16 + }, + + /* unnormalized unsigned int formats */ + { + MESA_FORMAT_RGBA_UINT8, + "MESA_FORMAT_RGBA_UINT8", + GL_RGBA, + GL_UNSIGNED_INT, + 8, 8, 8, 8, + 0, 0, 0, 0, 0, + 1, 1, 4 + }, + { + MESA_FORMAT_RGBA_UINT16, + "MESA_FORMAT_RGBA_UINT16", + GL_RGBA, + GL_UNSIGNED_INT, + 16, 16, 16, 16, + 0, 0, 0, 0, 0, + 1, 1, 8 + }, + { + MESA_FORMAT_RGBA_UINT32, + "MESA_FORMAT_RGBA_UINT32", + GL_RGBA, + GL_UNSIGNED_INT, + 32, 32, 32, 32, + 0, 0, 0, 0, 0, + 1, 1, 16 + }, + + { MESA_FORMAT_DUDV8, "MESA_FORMAT_DUDV8", @@ -880,6 +940,18 @@ _mesa_is_format_compressed(gl_format format) } +/** + * Determine if the given format represents a packed depth/stencil buffer. + */ +GLboolean +_mesa_is_format_packed_depth_stencil(gl_format format) +{ + const struct gl_format_info *info = _mesa_get_format_info(format); + + return info->BaseFormat == GL_DEPTH_STENCIL; +} + + /** * Return color encoding for given format. * \return GL_LINEAR or GL_SRGB @@ -1230,6 +1302,36 @@ _mesa_format_to_type_and_comps(gl_format format, *comps = 1; return; + case MESA_FORMAT_RGBA_INT8: + *datatype = GL_BYTE; + *comps = 4; + return; + case MESA_FORMAT_RGBA_INT16: + *datatype = GL_SHORT; + *comps = 4; + return; + case MESA_FORMAT_RGBA_INT32: + *datatype = GL_INT; + *comps = 4; + return; + + /** + * \name Non-normalized unsigned integer formats. + */ + case MESA_FORMAT_RGBA_UINT8: + *datatype = GL_UNSIGNED_BYTE; + *comps = 4; + return; + case MESA_FORMAT_RGBA_UINT16: + *datatype = GL_UNSIGNED_SHORT; + *comps = 4; + return; + case MESA_FORMAT_RGBA_UINT32: + *datatype = GL_UNSIGNED_INT; + *comps = 4; + return; + + default: _mesa_problem(NULL, "bad format in _mesa_format_to_type_and_comps"); *datatype = 0;