summaryrefslogtreecommitdiff
path: root/src/mesa/state_tracker/st_format.c
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2010-02-24 11:10:47 -0700
committerBrian Paul <brianp@vmware.com>2010-02-24 11:10:47 -0700
commit87c85347ed8f74a855532fe6862d3ef62937ccbb (patch)
tree9ffa768a80f466fc6643ac9a97e7f3cf4331ad16 /src/mesa/state_tracker/st_format.c
parent5d8aae55f29fe35ec3d514b54b05b6c6fc8bebe2 (diff)
st/mesa: clean-up of format-related code
Diffstat (limited to 'src/mesa/state_tracker/st_format.c')
-rw-r--r--src/mesa/state_tracker/st_format.c60
1 files changed, 3 insertions, 57 deletions
diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c
index 3100a4edaa..8789d4b750 100644
--- a/src/mesa/state_tracker/st_format.c
+++ b/src/mesa/state_tracker/st_format.c
@@ -59,23 +59,12 @@ format_max_bits(enum pipe_format format)
return size;
}
-static GLuint
-format_size(enum pipe_format format)
-{
- return
- util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_RGB, 0) +
- util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_RGB, 1) +
- util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_RGB, 2) +
- util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_RGB, 3) +
- util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_ZS, 0) +
- util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_ZS, 1);
-}
/*
* XXX temporary here
*/
GLboolean
-st_get_format_info(enum pipe_format format, struct pipe_format_info *pinfo)
+st_get_format_info(enum pipe_format format, struct st_format_info *pinfo)
{
const struct util_format_description *desc;
@@ -118,43 +107,15 @@ st_get_format_info(enum pipe_format format, struct pipe_format_info *pinfo)
}
}
- /* Component bits */
- pinfo->red_bits = util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_RGB, 0);
- pinfo->green_bits = util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_RGB, 1);
- pinfo->blue_bits = util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_RGB, 2);
- pinfo->alpha_bits = util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_RGB, 3);
- pinfo->depth_bits = util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_ZS, 0);
- pinfo->stencil_bits = util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_ZS, 1);
- pinfo->luminance_bits = 0;
- pinfo->intensity_bits = 0;
-
- /* Format size */
- pinfo->size = format_size(format) / 8;
-
- /* Luminance & Intensity bits */
- if (desc->swizzle[0] == UTIL_FORMAT_SWIZZLE_X &&
- desc->swizzle[1] == UTIL_FORMAT_SWIZZLE_X &&
- desc->swizzle[2] == UTIL_FORMAT_SWIZZLE_X) {
- if (desc->swizzle[3] == UTIL_FORMAT_SWIZZLE_X) {
- pinfo->intensity_bits = pinfo->red_bits;
- }
- else {
- pinfo->luminance_bits = pinfo->red_bits;
- }
- pinfo->red_bits = 0;
- }
-
pinfo->mesa_format = st_pipe_format_to_mesa_format(format);
}
else if (format == PIPE_FORMAT_YCBCR) {
pinfo->mesa_format = MESA_FORMAT_YCBCR;
pinfo->datatype = GL_UNSIGNED_SHORT;
- pinfo->size = 2; /* two bytes per "texel" */
}
else if (format == PIPE_FORMAT_YCBCR_REV) {
pinfo->mesa_format = MESA_FORMAT_YCBCR_REV;
pinfo->datatype = GL_UNSIGNED_SHORT;
- pinfo->size = 2; /* two bytes per "texel" */
}
else {
/* compressed format? */
@@ -179,27 +140,12 @@ st_get_format_info(enum pipe_format format, struct pipe_format_info *pinfo)
/**
- * Return bytes per pixel for the given format.
- */
-GLuint
-st_sizeof_format(enum pipe_format format)
-{
- struct pipe_format_info info;
- if (!st_get_format_info( format, &info )) {
- assert( 0 );
- return 0;
- }
- return info.size;
-}
-
-
-/**
- * Return bytes per pixel for the given format.
+ * Return basic GL datatype for the given format.
*/
GLenum
st_format_datatype(enum pipe_format format)
{
- struct pipe_format_info info;
+ struct st_format_info info;
if (!st_get_format_info( format, &info )) {
assert( 0 );
return 0;