aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/state_tracker/st_cb_drawpixels.c
diff options
context:
space:
mode:
authorMichal Krol <[email protected]>2007-10-28 17:19:39 +0000
committerMichal Krol <[email protected]>2007-10-28 17:34:39 +0000
commit3c8121967224f91bfcd5431b4069d66eecbc5952 (patch)
tree0f02118d163e144074dc4e5cafd21fdfbcb2f7ee /src/mesa/state_tracker/st_cb_drawpixels.c
parentb85cd7b70096cf7c922aed56ae8255fb4b8f0709 (diff)
Replace supported_formats with is_format_supported interface.
The old supported_formats interface returned a list of formats supported by a pipe/winsys implementation. This was reasonable when gallium had a fixed list of predefined format. Now things has changed and the definition of PIPE_FORMAT is more flexible. The new shiny is_format_supported interface gets PIPE_FORMAT as an argument and returns a boolean whether this particular format is supported.
Diffstat (limited to 'src/mesa/state_tracker/st_cb_drawpixels.c')
-rw-r--r--src/mesa/state_tracker/st_cb_drawpixels.c33
1 files changed, 14 insertions, 19 deletions
diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c
index 896ba2b905e..99e1e3ed25d 100644
--- a/src/mesa/state_tracker/st_cb_drawpixels.c
+++ b/src/mesa/state_tracker/st_cb_drawpixels.c
@@ -937,31 +937,26 @@ make_bitmap_texture(GLcontext *ctx, GLsizei width, GLsizei height,
{
struct pipe_context *pipe = ctx->st->pipe;
const uint flags = PIPE_SURFACE_FLAG_TEXTURE;
- uint numFormats, i, format = 0, cpp, comp, pitch;
- const uint *formats = ctx->st->pipe->supported_formats(pipe, &numFormats);
+ uint format = 0, cpp, comp, pitch;
ubyte *dest;
struct pipe_mipmap_tree *mt;
int row, col;
/* find a texture format we know */
- for (i = 0; i < numFormats; i++) {
- switch (formats[i]) {
- case PIPE_FORMAT_U_I8:
- format = formats[i];
- cpp = 1;
- comp = 0;
- break;
- case PIPE_FORMAT_U_A8_R8_G8_B8:
- format = formats[i];
- cpp = 4;
- comp = 3; /* alpha channel */ /*XXX little-endian dependency */
- break;
- default:
- /* XXX support more formats */
- ;
- }
+ if (pipe->is_format_supported( pipe, PIPE_FORMAT_U_I8 )) {
+ format = PIPE_FORMAT_U_I8;
+ cpp = 1;
+ comp = 0;
+ }
+ else if (pipe->is_format_supported( pipe, PIPE_FORMAT_U_A8_R8_G8_B8 )) {
+ format = PIPE_FORMAT_U_A8_R8_G8_B8;
+ cpp = 4;
+ comp = 3; /* alpha channel */ /*XXX little-endian dependency */
+ }
+ else {
+ /* XXX support more formats */
+ assert( 0 );
}
- assert(format);
/**
* Create a mipmap tree.