1af69d88dSmrg/*
2af69d88dSmrg * Mesa 3-D graphics library
3af69d88dSmrg *
4af69d88dSmrg * Copyright (c) 2011 VMware, Inc.
5af69d88dSmrg *
6af69d88dSmrg * Permission is hereby granted, free of charge, to any person obtaining a
7af69d88dSmrg * copy of this software and associated documentation files (the "Software"),
8af69d88dSmrg * to deal in the Software without restriction, including without limitation
9af69d88dSmrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10af69d88dSmrg * and/or sell copies of the Software, and to permit persons to whom the
11af69d88dSmrg * Software is furnished to do so, subject to the following conditions:
12af69d88dSmrg *
13af69d88dSmrg * The above copyright notice and this permission notice shall be included
14af69d88dSmrg * in all copies or substantial portions of the Software.
15af69d88dSmrg *
16af69d88dSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17af69d88dSmrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18af69d88dSmrg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
19af69d88dSmrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20af69d88dSmrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21af69d88dSmrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22af69d88dSmrg * OTHER DEALINGS IN THE SOFTWARE.
23af69d88dSmrg */
24af69d88dSmrg
25af69d88dSmrg#ifndef FORMAT_UNPACK_H
26af69d88dSmrg#define FORMAT_UNPACK_H
27af69d88dSmrg
287ec681f3Smrg#include "util/format/u_format.h"
2901e04c3fSmrg#include "formats.h"
3001e04c3fSmrg
317ec681f3Smrg#ifdef __cplusplus
327ec681f3Smrgextern "C" {
337ec681f3Smrg#endif
34af69d88dSmrg
357ec681f3Smrgstatic inline void
367ec681f3Smrg_mesa_unpack_rgba_row(mesa_format format, uint32_t n,
377ec681f3Smrg                      const void *src, float dst[][4])
387ec681f3Smrg{
397ec681f3Smrg   util_format_unpack_rgba(format, dst, src, n);
407ec681f3Smrg}
41af69d88dSmrg
42af69d88dSmrgextern void
437ec681f3Smrg_mesa_unpack_ubyte_rgba_row(mesa_format format, uint32_t n,
447ec681f3Smrg                            const void *src, uint8_t dst[][4]);
45af69d88dSmrg
467ec681f3Smrgstatic inline void
477ec681f3Smrg_mesa_unpack_uint_rgba_row(mesa_format format, uint32_t n,
487ec681f3Smrg                           const void *src, uint32_t dst[][4])
497ec681f3Smrg{
507ec681f3Smrg   util_format_unpack_rgba(format, dst, src, n);
517ec681f3Smrg}
52af69d88dSmrg
537ec681f3Smrgstatic inline void
547ec681f3Smrg_mesa_unpack_float_z_row(mesa_format format, uint32_t n,
557ec681f3Smrg                         const void *src, float *dst)
567ec681f3Smrg{
577ec681f3Smrg   util_format_unpack_z_float((enum pipe_format)format, dst, src, n);
587ec681f3Smrg}
59af69d88dSmrg
60af69d88dSmrg
617ec681f3Smrgstatic inline void
627ec681f3Smrg_mesa_unpack_uint_z_row(mesa_format format, uint32_t n,
637ec681f3Smrg                        const void *src, uint32_t *dst)
647ec681f3Smrg{
657ec681f3Smrg   util_format_unpack_z_32unorm((enum pipe_format)format, dst, src, n);
667ec681f3Smrg}
677ec681f3Smrg
687ec681f3Smrgstatic inline void
697ec681f3Smrg_mesa_unpack_ubyte_stencil_row(mesa_format format, uint32_t n,
707ec681f3Smrg                               const void *src, uint8_t *dst)
717ec681f3Smrg{
727ec681f3Smrg   util_format_unpack_s_8uint((enum pipe_format)format, dst, src, n);
737ec681f3Smrg}
74af69d88dSmrg
75af69d88dSmrgvoid
767ec681f3Smrg_mesa_unpack_uint_24_8_depth_stencil_row(mesa_format format, uint32_t n,
777ec681f3Smrg                                         const void *src, uint32_t *dst);
78af69d88dSmrg
79af69d88dSmrgvoid
80af69d88dSmrg_mesa_unpack_float_32_uint_24_8_depth_stencil_row(mesa_format format,
817ec681f3Smrg                                                  uint32_t n,
82af69d88dSmrg                                                  const void *src,
837ec681f3Smrg                                                  uint32_t *dst);
847ec681f3Smrg
857ec681f3Smrg#ifdef __cplusplus
867ec681f3Smrg}
877ec681f3Smrg#endif
887ec681f3Smrg
89af69d88dSmrg#endif /* FORMAT_UNPACK_H */
90