diff options
Diffstat (limited to 'src/mesa/state_tracker/st_cb_drawpixels.c')
-rw-r--r-- | src/mesa/state_tracker/st_cb_drawpixels.c | 33 |
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 896ba2b905..99e1e3ed25 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. |