1bf215546Sopenharmony_ci/** 2bf215546Sopenharmony_ci * \file format_utils.h 3bf215546Sopenharmony_ci * A collection of format conversion utility functions. 4bf215546Sopenharmony_ci */ 5bf215546Sopenharmony_ci 6bf215546Sopenharmony_ci/* 7bf215546Sopenharmony_ci * Mesa 3-D graphics library 8bf215546Sopenharmony_ci * 9bf215546Sopenharmony_ci * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. 10bf215546Sopenharmony_ci * Copyright (C) 2014 Intel Corporation All Rights Reserved. 11bf215546Sopenharmony_ci * 12bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 13bf215546Sopenharmony_ci * copy of this software and associated documentation files (the "Software"), 14bf215546Sopenharmony_ci * to deal in the Software without restriction, including without limitation 15bf215546Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense, 16bf215546Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the 17bf215546Sopenharmony_ci * Software is furnished to do so, subject to the following conditions: 18bf215546Sopenharmony_ci * 19bf215546Sopenharmony_ci * The above copyright notice and this permission notice shall be included 20bf215546Sopenharmony_ci * in all copies or substantial portions of the Software. 21bf215546Sopenharmony_ci * 22bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 23bf215546Sopenharmony_ci * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24bf215546Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 25bf215546Sopenharmony_ci * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 26bf215546Sopenharmony_ci * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 27bf215546Sopenharmony_ci * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 28bf215546Sopenharmony_ci * OTHER DEALINGS IN THE SOFTWARE. 29bf215546Sopenharmony_ci */ 30bf215546Sopenharmony_ci 31bf215546Sopenharmony_ci#ifndef FORMAT_UTILS_H 32bf215546Sopenharmony_ci#define FORMAT_UTILS_H 33bf215546Sopenharmony_ci 34bf215546Sopenharmony_ci#include "formats.h" 35bf215546Sopenharmony_ci 36bf215546Sopenharmony_ci#include "macros.h" 37bf215546Sopenharmony_ci#include "util/rounding.h" 38bf215546Sopenharmony_ci#include "util/half_float.h" 39bf215546Sopenharmony_ci#include "util/format/format_utils.h" 40bf215546Sopenharmony_ci 41bf215546Sopenharmony_ciextern const mesa_array_format RGBA32_FLOAT; 42bf215546Sopenharmony_ciextern const mesa_array_format RGBA8_UBYTE; 43bf215546Sopenharmony_ciextern const mesa_array_format RGBA32_UINT; 44bf215546Sopenharmony_ciextern const mesa_array_format RGBA32_INT; 45bf215546Sopenharmony_ci 46bf215546Sopenharmony_cibool 47bf215546Sopenharmony_ci_mesa_format_to_array(mesa_format, GLenum *type, int *num_components, 48bf215546Sopenharmony_ci uint8_t swizzle[4], bool *normalized); 49bf215546Sopenharmony_ci 50bf215546Sopenharmony_civoid 51bf215546Sopenharmony_ci_mesa_swizzle_and_convert(void *dst, 52bf215546Sopenharmony_ci enum mesa_array_format_datatype dst_type, 53bf215546Sopenharmony_ci int num_dst_channels, 54bf215546Sopenharmony_ci const void *src, 55bf215546Sopenharmony_ci enum mesa_array_format_datatype src_type, 56bf215546Sopenharmony_ci int num_src_channels, 57bf215546Sopenharmony_ci const uint8_t swizzle[4], bool normalized, int count); 58bf215546Sopenharmony_ci 59bf215546Sopenharmony_cibool 60bf215546Sopenharmony_ci_mesa_compute_rgba2base2rgba_component_mapping(GLenum baseFormat, uint8_t *map); 61bf215546Sopenharmony_ci 62bf215546Sopenharmony_civoid 63bf215546Sopenharmony_ci_mesa_format_convert(void *void_dst, uint32_t dst_format, size_t dst_stride, 64bf215546Sopenharmony_ci void *void_src, uint32_t src_format, size_t src_stride, 65bf215546Sopenharmony_ci size_t width, size_t height, uint8_t *rebase_swizzle); 66bf215546Sopenharmony_ci 67bf215546Sopenharmony_ci#endif 68