diff options
-rw-r--r-- | src/mesa/state_tracker/st_cb_eglimage.c | 1 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_cb_fbo.c | 3 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_format.c | 100 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_format.h | 3 |
4 files changed, 0 insertions, 107 deletions
diff --git a/src/mesa/state_tracker/st_cb_eglimage.c b/src/mesa/state_tracker/st_cb_eglimage.c index 5209fc795d3..e91e9142da7 100644 --- a/src/mesa/state_tracker/st_cb_eglimage.c +++ b/src/mesa/state_tracker/st_cb_eglimage.c @@ -86,7 +86,6 @@ st_egl_image_target_renderbuffer_storage(struct gl_context *ctx, strb->Base.Width = ps->width; strb->Base.Height = ps->height; strb->Base.Format = st_pipe_format_to_mesa_format(ps->format); - strb->Base.DataType = st_format_datatype(ps->format); strb->Base._BaseFormat = st_pipe_format_to_base_format(ps->format); strb->Base.InternalFormat = strb->Base._BaseFormat; diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index ec40a2b70c1..be9c365cde3 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -97,7 +97,6 @@ st_renderbuffer_alloc_storage(struct gl_context * ctx, strb->Base.Height = height; strb->Base.Format = st_pipe_format_to_mesa_format(format); strb->Base._BaseFormat = _mesa_base_fbo_format(ctx, internalFormat); - strb->Base.DataType = st_format_datatype(format); strb->format = format; strb->defined = GL_FALSE; /* undefined contents now */ @@ -252,7 +251,6 @@ st_new_renderbuffer_fb(enum pipe_format format, int samples, boolean sw) strb->Base.NumSamples = samples; strb->Base.Format = st_pipe_format_to_mesa_format(format); strb->Base._BaseFormat = _mesa_get_format_base_format(strb->Base.Format); - strb->Base.DataType = st_format_datatype(format); strb->format = format; strb->software = sw; @@ -425,7 +423,6 @@ st_render_texture(struct gl_context *ctx, strb->format = pt->format; strb->Base.Format = st_pipe_format_to_mesa_format(pt->format); - strb->Base.DataType = st_format_datatype(pt->format); /* printf("RENDER TO TEXTURE obj=%p pt=%p surf=%p %d x %d\n", diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c index 5f9ae91298f..c6e31753580 100644 --- a/src/mesa/state_tracker/st_format.c +++ b/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. */ diff --git a/src/mesa/state_tracker/st_format.h b/src/mesa/state_tracker/st_format.h index 10ffeaa7385..1dea0d9a5e7 100644 --- a/src/mesa/state_tracker/st_format.h +++ b/src/mesa/state_tracker/st_format.h @@ -39,9 +39,6 @@ struct gl_context; struct pipe_screen; -extern GLenum -st_format_datatype(enum pipe_format format); - extern enum pipe_format st_mesa_format_to_pipe_format(gl_format mesaFormat); |