mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 02:48:06 +02:00
mesa: added _mesa_get_format_bits()
This commit is contained in:
parent
a608257a02
commit
c28d78f832
2 changed files with 35 additions and 0 deletions
|
|
@ -24,6 +24,7 @@
|
|||
*/
|
||||
|
||||
|
||||
#include "imports.h"
|
||||
#include "formats.h"
|
||||
#include "config.h"
|
||||
#include "texstore.h"
|
||||
|
|
@ -785,3 +786,33 @@ _mesa_format_to_type_and_comps2(gl_format format,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
GLint
|
||||
_mesa_get_format_bits(gl_format format, GLenum pname)
|
||||
{
|
||||
const struct gl_format_info *info = _mesa_get_format_info(format);
|
||||
|
||||
switch (pname) {
|
||||
case GL_TEXTURE_RED_SIZE:
|
||||
return info->RedBits;
|
||||
case GL_TEXTURE_GREEN_SIZE:
|
||||
return info->GreenBits;
|
||||
case GL_TEXTURE_BLUE_SIZE:
|
||||
return info->BlueBits;
|
||||
case GL_TEXTURE_ALPHA_SIZE:
|
||||
return info->AlphaBits;
|
||||
case GL_TEXTURE_INTENSITY_SIZE:
|
||||
return info->IntensityBits;
|
||||
case GL_TEXTURE_LUMINANCE_SIZE:
|
||||
return info->LuminanceBits;
|
||||
case GL_TEXTURE_INDEX_SIZE_EXT:
|
||||
return info->IndexBits;
|
||||
case GL_TEXTURE_DEPTH_SIZE_ARB:
|
||||
return info->DepthBits;
|
||||
case GL_TEXTURE_STENCIL_SIZE_EXT:
|
||||
return info->StencilBits;
|
||||
default:
|
||||
_mesa_problem(NULL, "bad pname in _mesa_get_format_bits()");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -208,6 +208,10 @@ extern void
|
|||
_mesa_format_to_type_and_comps2(gl_format format,
|
||||
GLenum *datatype, GLuint *comps);
|
||||
|
||||
extern GLint
|
||||
_mesa_get_format_bits(gl_format format, GLenum pname);
|
||||
|
||||
|
||||
extern void
|
||||
_mesa_test_formats(void);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue