summaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker
diff options
context:
space:
mode:
authorMichal Krol <[email protected]>2009-12-03 11:58:36 +0100
committerMichal Krol <[email protected]>2009-12-03 11:58:36 +0100
commitf5bd93fae2e4f46665eb1f09ca64cb39ff2b8a79 (patch)
tree2389d913bcd736d2d17a64189550b00ef68e1033 /src/mesa/state_tracker
parentcceeab39ea541b1be1521114316d660a77769c2a (diff)
Move pf_get_component_bits() to u_format auxiliary module.
Diffstat (limited to 'src/mesa/state_tracker')
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c4
-rw-r--r--src/mesa/state_tracker/st_format.c44
-rw-r--r--src/mesa/state_tracker/st_texture.c2
3 files changed, 22 insertions, 28 deletions
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index 0889cd6d2c2..496c1c4f3c6 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -648,7 +648,7 @@ draw_stencil_pixels(GLcontext *ctx, GLint x, GLint y,
}
if(format != GL_DEPTH_STENCIL &&
- pf_get_component_bits( strb->format, PIPE_FORMAT_COMP_Z ) != 0)
+ util_format_get_component_bits(strb->format, UTIL_FORMAT_COLORSPACE_ZS, 0) != 0)
usage = PIPE_TRANSFER_READ_WRITE;
else
usage = PIPE_TRANSFER_WRITE;
@@ -843,7 +843,7 @@ copy_stencil_pixels(GLcontext *ctx, GLint srcx, GLint srcy,
GL_STENCIL_INDEX, GL_UNSIGNED_BYTE,
&ctx->DefaultPacking, buffer);
- if(pf_get_component_bits( rbDraw->format, PIPE_FORMAT_COMP_Z ) != 0)
+ if(util_format_get_component_bits(rbDraw->format, UTIL_FORMAT_COLORSPACE_ZS, 0) != 0)
usage = PIPE_TRANSFER_READ_WRITE;
else
usage = PIPE_TRANSFER_WRITE;
diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c
index 02f80057c29..c492d77530b 100644
--- a/src/mesa/state_tracker/st_format.c
+++ b/src/mesa/state_tracker/st_format.c
@@ -42,28 +42,22 @@
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
#include "pipe/p_screen.h"
+#include "util/u_format.h"
#include "st_context.h"
#include "st_format.h"
-static GLuint
-format_bits(
- pipe_format_rgbazs_t info,
- GLuint comp )
-{
- return pf_get_component_bits( (enum pipe_format) info, comp );
-}
static GLuint
format_max_bits(
pipe_format_rgbazs_t info )
{
- GLuint size = format_bits( info, PIPE_FORMAT_COMP_R );
+ GLuint size = util_format_get_component_bits((enum pipe_format)info, UTIL_FORMAT_COLORSPACE_RGB, 0);
- size = MAX2( size, format_bits( info, PIPE_FORMAT_COMP_G ) );
- size = MAX2( size, format_bits( info, PIPE_FORMAT_COMP_B ) );
- size = MAX2( size, format_bits( info, PIPE_FORMAT_COMP_A ) );
- size = MAX2( size, format_bits( info, PIPE_FORMAT_COMP_Z ) );
- size = MAX2( size, format_bits( info, PIPE_FORMAT_COMP_S ) );
+ size = MAX2(size, util_format_get_component_bits((enum pipe_format)info, UTIL_FORMAT_COLORSPACE_RGB, 1));
+ size = MAX2(size, util_format_get_component_bits((enum pipe_format)info, UTIL_FORMAT_COLORSPACE_RGB, 2));
+ size = MAX2(size, util_format_get_component_bits((enum pipe_format)info, UTIL_FORMAT_COLORSPACE_RGB, 3));
+ size = MAX2(size, util_format_get_component_bits((enum pipe_format)info, UTIL_FORMAT_COLORSPACE_ZS, 0));
+ size = MAX2(size, util_format_get_component_bits((enum pipe_format)info, UTIL_FORMAT_COLORSPACE_ZS, 1));
return size;
}
@@ -72,12 +66,12 @@ format_size(
pipe_format_rgbazs_t info )
{
return
- format_bits( info, PIPE_FORMAT_COMP_R ) +
- format_bits( info, PIPE_FORMAT_COMP_G ) +
- format_bits( info, PIPE_FORMAT_COMP_B ) +
- format_bits( info, PIPE_FORMAT_COMP_A ) +
- format_bits( info, PIPE_FORMAT_COMP_Z ) +
- format_bits( info, PIPE_FORMAT_COMP_S );
+ util_format_get_component_bits((enum pipe_format)info, UTIL_FORMAT_COLORSPACE_RGB, 0) +
+ util_format_get_component_bits((enum pipe_format)info, UTIL_FORMAT_COLORSPACE_RGB, 1) +
+ util_format_get_component_bits((enum pipe_format)info, UTIL_FORMAT_COLORSPACE_RGB, 2) +
+ util_format_get_component_bits((enum pipe_format)info, UTIL_FORMAT_COLORSPACE_RGB, 3) +
+ util_format_get_component_bits((enum pipe_format)info, UTIL_FORMAT_COLORSPACE_ZS, 0) +
+ util_format_get_component_bits((enum pipe_format)info, UTIL_FORMAT_COLORSPACE_ZS, 1);
}
/*
@@ -126,12 +120,12 @@ st_get_format_info(enum pipe_format format, struct pipe_format_info *pinfo)
}
/* Component bits */
- pinfo->red_bits = format_bits( info, PIPE_FORMAT_COMP_R );
- pinfo->green_bits = format_bits( info, PIPE_FORMAT_COMP_G );
- pinfo->blue_bits = format_bits( info, PIPE_FORMAT_COMP_B );
- pinfo->alpha_bits = format_bits( info, PIPE_FORMAT_COMP_A );
- pinfo->depth_bits = format_bits( info, PIPE_FORMAT_COMP_Z );
- pinfo->stencil_bits = format_bits( info, PIPE_FORMAT_COMP_S );
+ pinfo->red_bits = util_format_get_component_bits((enum pipe_format)info, UTIL_FORMAT_COLORSPACE_RGB, 0);
+ pinfo->green_bits = util_format_get_component_bits((enum pipe_format)info, UTIL_FORMAT_COLORSPACE_RGB, 1);
+ pinfo->blue_bits = util_format_get_component_bits((enum pipe_format)info, UTIL_FORMAT_COLORSPACE_RGB, 2);
+ pinfo->alpha_bits = util_format_get_component_bits((enum pipe_format)info, UTIL_FORMAT_COLORSPACE_RGB, 3);
+ pinfo->depth_bits = util_format_get_component_bits((enum pipe_format)info, UTIL_FORMAT_COLORSPACE_ZS, 0);
+ pinfo->stencil_bits = util_format_get_component_bits((enum pipe_format)info, UTIL_FORMAT_COLORSPACE_ZS, 1);
pinfo->luminance_bits = 0;
pinfo->intensity_bits = 0;
diff --git a/src/mesa/state_tracker/st_texture.c b/src/mesa/state_tracker/st_texture.c
index bd6ee5d71c6..b1b515b28a6 100644
--- a/src/mesa/state_tracker/st_texture.c
+++ b/src/mesa/state_tracker/st_texture.c
@@ -406,7 +406,7 @@ st_bind_texture_surface(struct pipe_surface *ps, int target, int level,
}
/* map pipe format to base format for now */
- if (pf_get_component_bits(format, PIPE_FORMAT_COMP_A) > 0)
+ if (util_format_get_component_bits(format, UTIL_FORMAT_COLORSPACE_RGB, 3) > 0)
internalFormat = GL_RGBA;
else
internalFormat = GL_RGB;