1/* 2 * Mesa 3-D graphics library 3 * 4 * Copyright (c) 2011 VMware, Inc. 5 * 6 * Permission is hereby granted, free of charge, to any person obtaining a 7 * copy of this software and associated documentation files (the "Software"), 8 * to deal in the Software without restriction, including without limitation 9 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10 * and/or sell copies of the Software, and to permit persons to whom the 11 * Software is furnished to do so, subject to the following conditions: 12 * 13 * The above copyright notice and this permission notice shall be included 14 * in all copies or substantial portions of the Software. 15 * 16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 * OTHER DEALINGS IN THE SOFTWARE. 23 */ 24 25 26#ifndef FORMAT_PACK_H 27#define FORMAT_PACK_H 28 29 30#include "util/format/u_format.h" 31#include "formats.h" 32 33#ifdef __cplusplus 34extern "C" { 35#endif 36 37static inline void 38_mesa_pack_float_rgba_row(mesa_format format, uint32_t n, 39 const float src[][4], void *dst) 40{ 41 util_format_pack_rgba(format, dst, src, n); 42} 43 44static inline void 45_mesa_pack_ubyte_rgba_row(mesa_format format, uint32_t n, 46 const uint8_t *src, void *dst) 47{ 48 const struct util_format_pack_description *pack = util_format_pack_description(format); 49 pack->pack_rgba_8unorm((uint8_t *)dst, 0, src, 0, n, 1); 50} 51 52static inline void 53_mesa_pack_uint_rgba_row(mesa_format format, uint32_t n, 54 const uint32_t src[][4], void *dst) 55{ 56 util_format_pack_rgba(format, dst, src, n); 57} 58 59static inline void 60_mesa_pack_float_z_row(mesa_format format, uint32_t n, 61 const float *src, void *dst) 62{ 63 util_format_pack_z_float(format, dst, src, n); 64} 65 66static inline void 67_mesa_pack_uint_z_row(mesa_format format, uint32_t n, 68 const uint32_t *src, void *dst) 69{ 70 util_format_pack_z_32unorm(format, dst, src, n); 71} 72 73static inline void 74_mesa_pack_ubyte_stencil_row(mesa_format format, uint32_t n, 75 const uint8_t *src, void *dst) 76{ 77 util_format_pack_s_8uint(format, dst, src, n); 78} 79 80#ifdef __cplusplus 81} 82#endif 83 84#endif 85