17117f1b4Smrg/*
27117f1b4Smrg * Mesa 3-D graphics library
37117f1b4Smrg *
47117f1b4Smrg * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
57117f1b4Smrg *
67117f1b4Smrg * Permission is hereby granted, free of charge, to any person obtaining a
77117f1b4Smrg * copy of this software and associated documentation files (the "Software"),
87117f1b4Smrg * to deal in the Software without restriction, including without limitation
97117f1b4Smrg * the rights to use, copy, modify, merge, publish, distribute, sublicense,
107117f1b4Smrg * and/or sell copies of the Software, and to permit persons to whom the
117117f1b4Smrg * Software is furnished to do so, subject to the following conditions:
127117f1b4Smrg *
137117f1b4Smrg * The above copyright notice and this permission notice shall be included
147117f1b4Smrg * in all copies or substantial portions of the Software.
157117f1b4Smrg *
167117f1b4Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
177117f1b4Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
187117f1b4Smrg * 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.
237117f1b4Smrg */
247117f1b4Smrg
257117f1b4Smrg
267117f1b4Smrg#ifndef _M_TRANSLATE_H_
277117f1b4Smrg#define _M_TRANSLATE_H_
287117f1b4Smrg
293464ebd5Sriastradh#include "main/glheader.h"
307117f1b4Smrg
317117f1b4Smrg/**
327117f1b4Smrg * Array translation.
337117f1b4Smrg * For example, convert array of GLushort[3] to GLfloat[4].
347117f1b4Smrg * The function name specifies the destination format/size.
357117f1b4Smrg * \param  to  the destination address
367117f1b4Smrg * \param  ptr  the source address
377117f1b4Smrg * \param  stride  the source stride (in bytes) between elements
387117f1b4Smrg * \param  type  the source datatype (GL_SHORT, GL_UNSIGNED_INT, etc)
397117f1b4Smrg * \param  size  number of values per element in source array (1,2,3 or 4)
407117f1b4Smrg * \param  start  first element in source array to convert
417117f1b4Smrg * \param  n  number of elements to convert
427117f1b4Smrg *
437117f1b4Smrg * Note: "element" means a tuple like GLfloat[3] or GLubyte[4].
447117f1b4Smrg */
457117f1b4Smrg
467117f1b4Smrg
477117f1b4Smrgextern void _math_trans_1f(GLfloat *to,
48af69d88dSmrg			   const void *ptr,
497117f1b4Smrg			   GLuint stride,
507117f1b4Smrg			   GLenum type,
517117f1b4Smrg			   GLuint start,
527117f1b4Smrg			   GLuint n );
537117f1b4Smrg
547117f1b4Smrgextern void _math_trans_1ui(GLuint *to,
55af69d88dSmrg			    const void *ptr,
567117f1b4Smrg			    GLuint stride,
577117f1b4Smrg			    GLenum type,
587117f1b4Smrg			    GLuint start,
597117f1b4Smrg			    GLuint n );
607117f1b4Smrg
617117f1b4Smrgextern void _math_trans_1ub(GLubyte *to,
62af69d88dSmrg			    const void *ptr,
637117f1b4Smrg			    GLuint stride,
647117f1b4Smrg			    GLenum type,
657117f1b4Smrg			    GLuint start,
667117f1b4Smrg			    GLuint n );
677117f1b4Smrg
687117f1b4Smrgextern void _math_trans_4ub(GLubyte (*to)[4],
69af69d88dSmrg			    const void *ptr,
707117f1b4Smrg			    GLuint stride,
717117f1b4Smrg			    GLenum type,
727117f1b4Smrg			    GLuint size,
737117f1b4Smrg			    GLuint start,
747117f1b4Smrg			    GLuint n );
757117f1b4Smrg
767117f1b4Smrgextern void _math_trans_4us(GLushort (*to)[4],
77af69d88dSmrg			    const void *ptr,
787117f1b4Smrg			    GLuint stride,
797117f1b4Smrg			    GLenum type,
807117f1b4Smrg			    GLuint size,
817117f1b4Smrg			    GLuint start,
827117f1b4Smrg			    GLuint n );
837117f1b4Smrg
847117f1b4Smrg/** Convert to floats w/out normalization (i.e. just cast) */
857117f1b4Smrgextern void _math_trans_4f(GLfloat (*to)[4],
86af69d88dSmrg			   const void *ptr,
877117f1b4Smrg			   GLuint stride,
887117f1b4Smrg			   GLenum type,
897117f1b4Smrg			   GLuint size,
907117f1b4Smrg			   GLuint start,
917117f1b4Smrg			   GLuint n );
927117f1b4Smrg
937117f1b4Smrg/** Convert to normalized floats in [0,1] or [-1, 1] */
947117f1b4Smrgextern void _math_trans_4fn(GLfloat (*to)[4],
95af69d88dSmrg			    const void *ptr,
967117f1b4Smrg			    GLuint stride,
977117f1b4Smrg			    GLenum type,
987117f1b4Smrg			    GLuint size,
997117f1b4Smrg			    GLuint start,
1007117f1b4Smrg			    GLuint n );
1017117f1b4Smrg
1027117f1b4Smrgextern void _math_trans_3fn(GLfloat (*to)[3],
103af69d88dSmrg			   const void *ptr,
1047117f1b4Smrg			   GLuint stride,
1057117f1b4Smrg			   GLenum type,
1067117f1b4Smrg			   GLuint start,
1077117f1b4Smrg			   GLuint n );
1087117f1b4Smrg
1097117f1b4Smrgextern void _math_init_translate( void );
1107117f1b4Smrg
1117117f1b4Smrg
1127117f1b4Smrg#endif
113