aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/state_tracker/st_format.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-01-25 08:24:51 +0100
committermarha <marha@users.sourceforge.net>2012-01-25 08:24:51 +0100
commite6432710d8a586386b3c7025e845cf4f80830da3 (patch)
treea403fa86779a287c97f5605f9b4d455d662ece66 /mesalib/src/mesa/state_tracker/st_format.c
parentd3f0fe49b8cb29295f3e529cc699a2abde1515a1 (diff)
downloadvcxsrv-e6432710d8a586386b3c7025e845cf4f80830da3.tar.gz
vcxsrv-e6432710d8a586386b3c7025e845cf4f80830da3.tar.bz2
vcxsrv-e6432710d8a586386b3c7025e845cf4f80830da3.zip
mesa git update 25 jan 2012
Diffstat (limited to 'mesalib/src/mesa/state_tracker/st_format.c')
-rw-r--r--mesalib/src/mesa/state_tracker/st_format.c100
1 files changed, 0 insertions, 100 deletions
diff --git a/mesalib/src/mesa/state_tracker/st_format.c b/mesalib/src/mesa/state_tracker/st_format.c
index 620910ddb..2fdbcd773 100644
--- a/mesalib/src/mesa/state_tracker/st_format.c
+++ b/mesalib/src/mesa/state_tracker/st_format.c
@@ -47,106 +47,6 @@
#include "st_format.h"
-static GLuint
-format_max_bits(enum pipe_format format)
-{
- GLuint size = util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_RGB, 0);
-
- size = MAX2(size, util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_RGB, 1));
- size = MAX2(size, util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_RGB, 2));
- size = MAX2(size, util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_RGB, 3));
- size = MAX2(size, util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_ZS, 0));
- size = MAX2(size, util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_ZS, 1));
- return size;
-}
-
-
-/**
- * Return basic GL datatype for the given gallium format.
- */
-GLenum
-st_format_datatype(enum pipe_format format)
-{
- const struct util_format_description *desc;
- int i;
-
- desc = util_format_description(format);
- assert(desc);
-
- /* Find the first non-VOID channel. */
- for (i = 0; i < 4; i++) {
- if (desc->channel[i].type != UTIL_FORMAT_TYPE_VOID) {
- break;
- }
- }
-
- if (desc->layout == UTIL_FORMAT_LAYOUT_PLAIN) {
- if (format == PIPE_FORMAT_B5G5R5A1_UNORM ||
- format == PIPE_FORMAT_B5G6R5_UNORM) {
- return GL_UNSIGNED_SHORT;
- }
- else if (format == PIPE_FORMAT_R11G11B10_FLOAT ||
- format == PIPE_FORMAT_R9G9B9E5_FLOAT) {
- return GL_FLOAT;
- }
- else if (format == PIPE_FORMAT_Z24_UNORM_S8_UINT ||
- format == PIPE_FORMAT_S8_UINT_Z24_UNORM ||
- format == PIPE_FORMAT_Z24X8_UNORM ||
- format == PIPE_FORMAT_X8Z24_UNORM) {
- return GL_UNSIGNED_INT_24_8;
- }
- else if (format == PIPE_FORMAT_Z32_FLOAT_S8X24_UINT) {
- return GL_FLOAT_32_UNSIGNED_INT_24_8_REV;
- }
- else {
- const GLuint size = format_max_bits(format);
-
- assert(i < 4);
- if (i == 4)
- return GL_NONE;
-
- if (size == 8) {
- if (desc->channel[i].type == UTIL_FORMAT_TYPE_UNSIGNED)
- return GL_UNSIGNED_BYTE;
- else
- return GL_BYTE;
- }
- else if (size == 16) {
- if (desc->channel[i].type == UTIL_FORMAT_TYPE_FLOAT)
- return GL_HALF_FLOAT;
- if (desc->channel[i].type == UTIL_FORMAT_TYPE_UNSIGNED)
- return GL_UNSIGNED_SHORT;
- else
- return GL_SHORT;
- }
- else if (size <= 32) {
- if (desc->channel[i].type == UTIL_FORMAT_TYPE_FLOAT)
- return GL_FLOAT;
- if (desc->channel[i].type == UTIL_FORMAT_TYPE_UNSIGNED)
- return GL_UNSIGNED_INT;
- else
- return GL_INT;
- }
- else {
- assert(size == 64);
- assert(desc->channel[i].type == UTIL_FORMAT_TYPE_FLOAT);
- return GL_DOUBLE;
- }
- }
- }
- else if (format == PIPE_FORMAT_UYVY) {
- return GL_UNSIGNED_SHORT;
- }
- else if (format == PIPE_FORMAT_YUYV) {
- return GL_UNSIGNED_SHORT;
- }
- else {
- /* probably a compressed format, unsupported anyway */
- return GL_NONE;
- }
-}
-
-
/**
* Translate Mesa format to Gallium format.
*/