Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Mesa 3-D graphics library |
Brian Paul | 0395cc0 | 2006-06-13 03:22:52 +0000 | [diff] [blame] | 3 | * Version: 6.5.1 |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 4 | * |
Brian Paul | 0395cc0 | 2006-06-13 03:22:52 +0000 | [diff] [blame] | 5 | * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 6 | * |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 7 | * Permission is hereby granted, free of charge, to any person obtaining a |
| 8 | * copy of this software and associated documentation files (the "Software"), |
| 9 | * to deal in the Software without restriction, including without limitation |
| 10 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 11 | * and/or sell copies of the Software, and to permit persons to whom the |
| 12 | * Software is furnished to do so, subject to the following conditions: |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 13 | * |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 14 | * The above copyright notice and this permission notice shall be included |
| 15 | * in all copies or substantial portions of the Software. |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 16 | * |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 18 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
| 20 | * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
| 21 | * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 22 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 23 | */ |
| 24 | |
Brian Paul | 0395cc0 | 2006-06-13 03:22:52 +0000 | [diff] [blame] | 25 | /** |
| 26 | * \brief Translate vectors of numbers between various types. |
| 27 | * \author Keith Whitwell. |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 28 | */ |
| 29 | |
| 30 | |
| 31 | #include "glheader.h" |
Keith Whitwell | 4eebc90 | 2001-02-20 18:28:52 +0000 | [diff] [blame] | 32 | #include "mtypes.h" /* GLchan hack */ |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 33 | #include "colormac.h" |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 34 | |
| 35 | #include "m_translate.h" |
| 36 | |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 37 | |
| 38 | |
| 39 | typedef void (*trans_1f_func)(GLfloat *to, |
| 40 | CONST void *ptr, |
| 41 | GLuint stride, |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 42 | GLuint start, |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 43 | GLuint n ); |
| 44 | |
| 45 | typedef void (*trans_1ui_func)(GLuint *to, |
| 46 | CONST void *ptr, |
| 47 | GLuint stride, |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 48 | GLuint start, |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 49 | GLuint n ); |
| 50 | |
| 51 | typedef void (*trans_1ub_func)(GLubyte *to, |
| 52 | CONST void *ptr, |
| 53 | GLuint stride, |
| 54 | GLuint start, |
| 55 | GLuint n ); |
| 56 | |
| 57 | typedef void (*trans_4ub_func)(GLubyte (*to)[4], |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 58 | CONST void *ptr, |
| 59 | GLuint stride, |
| 60 | GLuint start, |
| 61 | GLuint n ); |
| 62 | |
| 63 | typedef void (*trans_4us_func)(GLushort (*to)[4], |
| 64 | CONST void *ptr, |
| 65 | GLuint stride, |
| 66 | GLuint start, |
| 67 | GLuint n ); |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 68 | |
| 69 | typedef void (*trans_4f_func)(GLfloat (*to)[4], |
| 70 | CONST void *ptr, |
| 71 | GLuint stride, |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 72 | GLuint start, |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 73 | GLuint n ); |
| 74 | |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 75 | typedef void (*trans_3fn_func)(GLfloat (*to)[3], |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 76 | CONST void *ptr, |
| 77 | GLuint stride, |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 78 | GLuint start, |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 79 | GLuint n ); |
| 80 | |
| 81 | |
| 82 | |
| 83 | |
| 84 | #define TYPE_IDX(t) ((t) & 0xf) |
| 85 | #define MAX_TYPES TYPE_IDX(GL_DOUBLE)+1 /* 0xa + 1 */ |
| 86 | |
| 87 | |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 88 | /* This macro is used on other systems, so undefine it for this module */ |
| 89 | |
| 90 | #undef CHECK |
| 91 | |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 92 | static trans_1f_func _math_trans_1f_tab[MAX_TYPES]; |
| 93 | static trans_1ui_func _math_trans_1ui_tab[MAX_TYPES]; |
| 94 | static trans_1ub_func _math_trans_1ub_tab[MAX_TYPES]; |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 95 | static trans_3fn_func _math_trans_3fn_tab[MAX_TYPES]; |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 96 | static trans_4ub_func _math_trans_4ub_tab[5][MAX_TYPES]; |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 97 | static trans_4us_func _math_trans_4us_tab[5][MAX_TYPES]; |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 98 | static trans_4f_func _math_trans_4f_tab[5][MAX_TYPES]; |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 99 | static trans_4f_func _math_trans_4fn_tab[5][MAX_TYPES]; |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 100 | |
| 101 | |
| 102 | #define PTR_ELT(ptr, elt) (((SRC *)ptr)[elt]) |
| 103 | |
| 104 | |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 105 | #define TAB(x) _math_trans##x##_tab |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 106 | #define ARGS GLuint start, GLuint n |
| 107 | #define SRC_START start |
| 108 | #define DST_START 0 |
| 109 | #define STRIDE stride |
| 110 | #define NEXT_F f += stride |
| 111 | #define NEXT_F2 |
| 112 | #define CHECK |
| 113 | |
| 114 | |
| 115 | |
| 116 | |
Brian Paul | 0395cc0 | 2006-06-13 03:22:52 +0000 | [diff] [blame] | 117 | /** |
| 118 | * Translate from GL_BYTE. |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 119 | */ |
| 120 | #define SRC GLbyte |
| 121 | #define SRC_IDX TYPE_IDX(GL_BYTE) |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 122 | #define TRX_3FN(f,n) BYTE_TO_FLOAT( PTR_ELT(f,n) ) |
Brian Paul | 0395cc0 | 2006-06-13 03:22:52 +0000 | [diff] [blame] | 123 | #if 1 |
Keith Whitwell | 5f2230c | 2001-05-09 14:12:34 +0000 | [diff] [blame] | 124 | #define TRX_4F(f,n) BYTE_TO_FLOAT( PTR_ELT(f,n) ) |
Brian Paul | 0395cc0 | 2006-06-13 03:22:52 +0000 | [diff] [blame] | 125 | #else |
| 126 | #define TRX_4F(f,n) (GLfloat)( PTR_ELT(f,n) ) |
| 127 | #endif |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 128 | #define TRX_4FN(f,n) BYTE_TO_FLOAT( PTR_ELT(f,n) ) |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 129 | #define TRX_UB(ub, f,n) ub = BYTE_TO_UBYTE( PTR_ELT(f,n) ) |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 130 | #define TRX_US(ch, f,n) ch = BYTE_TO_USHORT( PTR_ELT(f,n) ) |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 131 | #define TRX_UI(f,n) (PTR_ELT(f,n) < 0 ? 0 : (GLuint) PTR_ELT(f,n)) |
| 132 | |
| 133 | |
| 134 | #define SZ 4 |
| 135 | #define INIT init_trans_4_GLbyte_raw |
| 136 | #define DEST_4F trans_4_GLbyte_4f_raw |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 137 | #define DEST_4FN trans_4_GLbyte_4fn_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 138 | #define DEST_4UB trans_4_GLbyte_4ub_raw |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 139 | #define DEST_4US trans_4_GLbyte_4us_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 140 | #include "m_trans_tmp.h" |
| 141 | |
| 142 | #define SZ 3 |
| 143 | #define INIT init_trans_3_GLbyte_raw |
| 144 | #define DEST_4F trans_3_GLbyte_4f_raw |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 145 | #define DEST_4FN trans_3_GLbyte_4fn_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 146 | #define DEST_4UB trans_3_GLbyte_4ub_raw |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 147 | #define DEST_4US trans_3_GLbyte_4us_raw |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 148 | #define DEST_3FN trans_3_GLbyte_3fn_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 149 | #include "m_trans_tmp.h" |
| 150 | |
| 151 | #define SZ 2 |
| 152 | #define INIT init_trans_2_GLbyte_raw |
| 153 | #define DEST_4F trans_2_GLbyte_4f_raw |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 154 | #define DEST_4FN trans_2_GLbyte_4fn_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 155 | #include "m_trans_tmp.h" |
| 156 | |
| 157 | #define SZ 1 |
| 158 | #define INIT init_trans_1_GLbyte_raw |
| 159 | #define DEST_4F trans_1_GLbyte_4f_raw |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 160 | #define DEST_4FN trans_1_GLbyte_4fn_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 161 | #define DEST_1UB trans_1_GLbyte_1ub_raw |
| 162 | #define DEST_1UI trans_1_GLbyte_1ui_raw |
| 163 | #include "m_trans_tmp.h" |
| 164 | |
| 165 | #undef SRC |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 166 | #undef TRX_3FN |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 167 | #undef TRX_4F |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 168 | #undef TRX_4FN |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 169 | #undef TRX_UB |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 170 | #undef TRX_US |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 171 | #undef TRX_UI |
| 172 | #undef SRC_IDX |
| 173 | |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 174 | |
Brian Paul | 0395cc0 | 2006-06-13 03:22:52 +0000 | [diff] [blame] | 175 | /** |
| 176 | * Translate from GL_UNSIGNED_BYTE. |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 177 | */ |
| 178 | #define SRC GLubyte |
| 179 | #define SRC_IDX TYPE_IDX(GL_UNSIGNED_BYTE) |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 180 | #define TRX_3FN(f,n) UBYTE_TO_FLOAT(PTR_ELT(f,n)) |
Brian Paul | 0395cc0 | 2006-06-13 03:22:52 +0000 | [diff] [blame] | 181 | #define TRX_4F(f,n) (GLfloat)( PTR_ELT(f,n) ) |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 182 | #define TRX_4FN(f,n) UBYTE_TO_FLOAT(PTR_ELT(f,n)) |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 183 | #define TRX_UB(ub, f,n) ub = PTR_ELT(f,n) |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 184 | #define TRX_US(us, f,n) us = UBYTE_TO_USHORT(PTR_ELT(f,n)) |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 185 | #define TRX_UI(f,n) (GLuint)PTR_ELT(f,n) |
| 186 | |
| 187 | /* 4ub->4ub handled in special case below. |
| 188 | */ |
Keith Whitwell | 51c0c71 | 2001-04-28 08:39:17 +0000 | [diff] [blame] | 189 | #define SZ 4 |
| 190 | #define INIT init_trans_4_GLubyte_raw |
| 191 | #define DEST_4F trans_4_GLubyte_4f_raw |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 192 | #define DEST_4FN trans_4_GLubyte_4fn_raw |
Keith Whitwell | 51c0c71 | 2001-04-28 08:39:17 +0000 | [diff] [blame] | 193 | #define DEST_4US trans_4_GLubyte_4us_raw |
| 194 | #include "m_trans_tmp.h" |
| 195 | |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 196 | |
| 197 | #define SZ 3 |
| 198 | #define INIT init_trans_3_GLubyte_raw |
| 199 | #define DEST_4UB trans_3_GLubyte_4ub_raw |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 200 | #define DEST_4US trans_3_GLubyte_4us_raw |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 201 | #define DEST_3FN trans_3_GLubyte_3fn_raw |
Keith Whitwell | 51c0c71 | 2001-04-28 08:39:17 +0000 | [diff] [blame] | 202 | #define DEST_4F trans_3_GLubyte_4f_raw |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 203 | #define DEST_4FN trans_3_GLubyte_4fn_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 204 | #include "m_trans_tmp.h" |
| 205 | |
| 206 | |
| 207 | #define SZ 1 |
| 208 | #define INIT init_trans_1_GLubyte_raw |
| 209 | #define DEST_1UI trans_1_GLubyte_1ui_raw |
| 210 | #define DEST_1UB trans_1_GLubyte_1ub_raw |
| 211 | #include "m_trans_tmp.h" |
| 212 | |
| 213 | #undef SRC |
| 214 | #undef SRC_IDX |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 215 | #undef TRX_3FN |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 216 | #undef TRX_4F |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 217 | #undef TRX_4FN |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 218 | #undef TRX_UB |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 219 | #undef TRX_US |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 220 | #undef TRX_UI |
| 221 | |
| 222 | |
| 223 | /* GL_SHORT |
| 224 | */ |
| 225 | #define SRC GLshort |
| 226 | #define SRC_IDX TYPE_IDX(GL_SHORT) |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 227 | #define TRX_3FN(f,n) SHORT_TO_FLOAT( PTR_ELT(f,n) ) |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 228 | #define TRX_4F(f,n) (GLfloat)( PTR_ELT(f,n) ) |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 229 | #define TRX_4FN(f,n) SHORT_TO_FLOAT( PTR_ELT(f,n) ) |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 230 | #define TRX_UB(ub, f,n) ub = SHORT_TO_UBYTE(PTR_ELT(f,n)) |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 231 | #define TRX_US(us, f,n) us = SHORT_TO_USHORT(PTR_ELT(f,n)) |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 232 | #define TRX_UI(f,n) (PTR_ELT(f,n) < 0 ? 0 : (GLuint) PTR_ELT(f,n)) |
| 233 | |
| 234 | |
| 235 | #define SZ 4 |
| 236 | #define INIT init_trans_4_GLshort_raw |
| 237 | #define DEST_4F trans_4_GLshort_4f_raw |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 238 | #define DEST_4FN trans_4_GLshort_4fn_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 239 | #define DEST_4UB trans_4_GLshort_4ub_raw |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 240 | #define DEST_4US trans_4_GLshort_4us_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 241 | #include "m_trans_tmp.h" |
| 242 | |
| 243 | #define SZ 3 |
| 244 | #define INIT init_trans_3_GLshort_raw |
| 245 | #define DEST_4F trans_3_GLshort_4f_raw |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 246 | #define DEST_4FN trans_3_GLshort_4fn_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 247 | #define DEST_4UB trans_3_GLshort_4ub_raw |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 248 | #define DEST_4US trans_3_GLshort_4us_raw |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 249 | #define DEST_3FN trans_3_GLshort_3fn_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 250 | #include "m_trans_tmp.h" |
| 251 | |
| 252 | #define SZ 2 |
| 253 | #define INIT init_trans_2_GLshort_raw |
| 254 | #define DEST_4F trans_2_GLshort_4f_raw |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 255 | #define DEST_4FN trans_2_GLshort_4fn_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 256 | #include "m_trans_tmp.h" |
| 257 | |
| 258 | #define SZ 1 |
| 259 | #define INIT init_trans_1_GLshort_raw |
| 260 | #define DEST_4F trans_1_GLshort_4f_raw |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 261 | #define DEST_4FN trans_1_GLshort_4fn_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 262 | #define DEST_1UB trans_1_GLshort_1ub_raw |
| 263 | #define DEST_1UI trans_1_GLshort_1ui_raw |
| 264 | #include "m_trans_tmp.h" |
| 265 | |
| 266 | |
| 267 | #undef SRC |
| 268 | #undef SRC_IDX |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 269 | #undef TRX_3FN |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 270 | #undef TRX_4F |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 271 | #undef TRX_4FN |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 272 | #undef TRX_UB |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 273 | #undef TRX_US |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 274 | #undef TRX_UI |
| 275 | |
| 276 | |
| 277 | /* GL_UNSIGNED_SHORT |
| 278 | */ |
| 279 | #define SRC GLushort |
| 280 | #define SRC_IDX TYPE_IDX(GL_UNSIGNED_SHORT) |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 281 | #define TRX_3FN(f,n) USHORT_TO_FLOAT( PTR_ELT(f,n) ) |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 282 | #define TRX_4F(f,n) (GLfloat)( PTR_ELT(f,n) ) |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 283 | #define TRX_4FN(f,n) USHORT_TO_FLOAT( PTR_ELT(f,n) ) |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 284 | #define TRX_UB(ub,f,n) ub = (GLubyte) (PTR_ELT(f,n) >> 8) |
Brian Paul | 0395cc0 | 2006-06-13 03:22:52 +0000 | [diff] [blame] | 285 | #define TRX_US(us,f,n) us = PTR_ELT(f,n) |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 286 | #define TRX_UI(f,n) (GLuint) PTR_ELT(f,n) |
| 287 | |
| 288 | |
| 289 | #define SZ 4 |
| 290 | #define INIT init_trans_4_GLushort_raw |
| 291 | #define DEST_4F trans_4_GLushort_4f_raw |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 292 | #define DEST_4FN trans_4_GLushort_4fn_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 293 | #define DEST_4UB trans_4_GLushort_4ub_raw |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 294 | #define DEST_4US trans_4_GLushort_4us_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 295 | #include "m_trans_tmp.h" |
| 296 | |
| 297 | #define SZ 3 |
| 298 | #define INIT init_trans_3_GLushort_raw |
| 299 | #define DEST_4F trans_3_GLushort_4f_raw |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 300 | #define DEST_4FN trans_3_GLushort_4fn_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 301 | #define DEST_4UB trans_3_GLushort_4ub_raw |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 302 | #define DEST_4US trans_3_GLushort_4us_raw |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 303 | #define DEST_3FN trans_3_GLushort_3fn_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 304 | #include "m_trans_tmp.h" |
| 305 | |
| 306 | #define SZ 2 |
| 307 | #define INIT init_trans_2_GLushort_raw |
| 308 | #define DEST_4F trans_2_GLushort_4f_raw |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 309 | #define DEST_4FN trans_2_GLushort_4fn_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 310 | #include "m_trans_tmp.h" |
| 311 | |
| 312 | #define SZ 1 |
| 313 | #define INIT init_trans_1_GLushort_raw |
| 314 | #define DEST_4F trans_1_GLushort_4f_raw |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 315 | #define DEST_4FN trans_1_GLushort_4fn_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 316 | #define DEST_1UB trans_1_GLushort_1ub_raw |
| 317 | #define DEST_1UI trans_1_GLushort_1ui_raw |
| 318 | #include "m_trans_tmp.h" |
| 319 | |
| 320 | #undef SRC |
| 321 | #undef SRC_IDX |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 322 | #undef TRX_3FN |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 323 | #undef TRX_4F |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 324 | #undef TRX_4FN |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 325 | #undef TRX_UB |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 326 | #undef TRX_US |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 327 | #undef TRX_UI |
| 328 | |
| 329 | |
| 330 | /* GL_INT |
| 331 | */ |
| 332 | #define SRC GLint |
| 333 | #define SRC_IDX TYPE_IDX(GL_INT) |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 334 | #define TRX_3FN(f,n) INT_TO_FLOAT( PTR_ELT(f,n) ) |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 335 | #define TRX_4F(f,n) (GLfloat)( PTR_ELT(f,n) ) |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 336 | #define TRX_4FN(f,n) INT_TO_FLOAT( PTR_ELT(f,n) ) |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 337 | #define TRX_UB(ub, f,n) ub = INT_TO_UBYTE(PTR_ELT(f,n)) |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 338 | #define TRX_US(us, f,n) us = INT_TO_USHORT(PTR_ELT(f,n)) |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 339 | #define TRX_UI(f,n) (PTR_ELT(f,n) < 0 ? 0 : (GLuint) PTR_ELT(f,n)) |
| 340 | |
| 341 | |
| 342 | #define SZ 4 |
| 343 | #define INIT init_trans_4_GLint_raw |
| 344 | #define DEST_4F trans_4_GLint_4f_raw |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 345 | #define DEST_4FN trans_4_GLint_4fn_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 346 | #define DEST_4UB trans_4_GLint_4ub_raw |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 347 | #define DEST_4US trans_4_GLint_4us_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 348 | #include "m_trans_tmp.h" |
| 349 | |
| 350 | #define SZ 3 |
| 351 | #define INIT init_trans_3_GLint_raw |
| 352 | #define DEST_4F trans_3_GLint_4f_raw |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 353 | #define DEST_4FN trans_3_GLint_4fn_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 354 | #define DEST_4UB trans_3_GLint_4ub_raw |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 355 | #define DEST_4US trans_3_GLint_4us_raw |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 356 | #define DEST_3FN trans_3_GLint_3fn_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 357 | #include "m_trans_tmp.h" |
| 358 | |
| 359 | #define SZ 2 |
| 360 | #define INIT init_trans_2_GLint_raw |
| 361 | #define DEST_4F trans_2_GLint_4f_raw |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 362 | #define DEST_4FN trans_2_GLint_4fn_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 363 | #include "m_trans_tmp.h" |
| 364 | |
| 365 | #define SZ 1 |
| 366 | #define INIT init_trans_1_GLint_raw |
| 367 | #define DEST_4F trans_1_GLint_4f_raw |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 368 | #define DEST_4FN trans_1_GLint_4fn_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 369 | #define DEST_1UB trans_1_GLint_1ub_raw |
| 370 | #define DEST_1UI trans_1_GLint_1ui_raw |
| 371 | #include "m_trans_tmp.h" |
| 372 | |
| 373 | |
| 374 | #undef SRC |
| 375 | #undef SRC_IDX |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 376 | #undef TRX_3FN |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 377 | #undef TRX_4F |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 378 | #undef TRX_4FN |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 379 | #undef TRX_UB |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 380 | #undef TRX_US |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 381 | #undef TRX_UI |
| 382 | |
| 383 | |
| 384 | /* GL_UNSIGNED_INT |
| 385 | */ |
| 386 | #define SRC GLuint |
| 387 | #define SRC_IDX TYPE_IDX(GL_UNSIGNED_INT) |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 388 | #define TRX_3FN(f,n) INT_TO_FLOAT( PTR_ELT(f,n) ) |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 389 | #define TRX_4F(f,n) (GLfloat)( PTR_ELT(f,n) ) |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 390 | #define TRX_4FN(f,n) UINT_TO_FLOAT( PTR_ELT(f,n) ) |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 391 | #define TRX_UB(ub, f,n) ub = (GLubyte) (PTR_ELT(f,n) >> 24) |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 392 | #define TRX_US(us, f,n) us = (GLshort) (PTR_ELT(f,n) >> 16) |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 393 | #define TRX_UI(f,n) PTR_ELT(f,n) |
| 394 | |
| 395 | |
| 396 | #define SZ 4 |
| 397 | #define INIT init_trans_4_GLuint_raw |
| 398 | #define DEST_4F trans_4_GLuint_4f_raw |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 399 | #define DEST_4FN trans_4_GLuint_4fn_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 400 | #define DEST_4UB trans_4_GLuint_4ub_raw |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 401 | #define DEST_4US trans_4_GLuint_4us_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 402 | #include "m_trans_tmp.h" |
| 403 | |
| 404 | #define SZ 3 |
| 405 | #define INIT init_trans_3_GLuint_raw |
| 406 | #define DEST_4F trans_3_GLuint_4f_raw |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 407 | #define DEST_4FN trans_3_GLuint_4fn_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 408 | #define DEST_4UB trans_3_GLuint_4ub_raw |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 409 | #define DEST_4US trans_3_GLuint_4us_raw |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 410 | #define DEST_3FN trans_3_GLuint_3fn_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 411 | #include "m_trans_tmp.h" |
| 412 | |
| 413 | #define SZ 2 |
| 414 | #define INIT init_trans_2_GLuint_raw |
| 415 | #define DEST_4F trans_2_GLuint_4f_raw |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 416 | #define DEST_4FN trans_2_GLuint_4fn_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 417 | #include "m_trans_tmp.h" |
| 418 | |
| 419 | #define SZ 1 |
| 420 | #define INIT init_trans_1_GLuint_raw |
| 421 | #define DEST_4F trans_1_GLuint_4f_raw |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 422 | #define DEST_4FN trans_1_GLuint_4fn_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 423 | #define DEST_1UB trans_1_GLuint_1ub_raw |
| 424 | #define DEST_1UI trans_1_GLuint_1ui_raw |
| 425 | #include "m_trans_tmp.h" |
| 426 | |
| 427 | #undef SRC |
| 428 | #undef SRC_IDX |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 429 | #undef TRX_3FN |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 430 | #undef TRX_4F |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 431 | #undef TRX_4FN |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 432 | #undef TRX_UB |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 433 | #undef TRX_US |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 434 | #undef TRX_UI |
| 435 | |
| 436 | |
| 437 | /* GL_DOUBLE |
| 438 | */ |
| 439 | #define SRC GLdouble |
| 440 | #define SRC_IDX TYPE_IDX(GL_DOUBLE) |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 441 | #define TRX_3FN(f,n) (GLfloat) PTR_ELT(f,n) |
Karl Schultz | 7b9fe82 | 2001-09-18 23:06:14 +0000 | [diff] [blame] | 442 | #define TRX_4F(f,n) (GLfloat) PTR_ELT(f,n) |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 443 | #define TRX_4FN(f,n) (GLfloat) PTR_ELT(f,n) |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 444 | #define TRX_UB(ub,f,n) UNCLAMPED_FLOAT_TO_UBYTE(ub, PTR_ELT(f,n)) |
| 445 | #define TRX_US(us,f,n) UNCLAMPED_FLOAT_TO_USHORT(us, PTR_ELT(f,n)) |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 446 | #define TRX_UI(f,n) (GLuint) (GLint) PTR_ELT(f,n) |
Karl Schultz | 7b9fe82 | 2001-09-18 23:06:14 +0000 | [diff] [blame] | 447 | #define TRX_1F(f,n) (GLfloat) PTR_ELT(f,n) |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 448 | |
| 449 | |
| 450 | #define SZ 4 |
| 451 | #define INIT init_trans_4_GLdouble_raw |
| 452 | #define DEST_4F trans_4_GLdouble_4f_raw |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 453 | #define DEST_4FN trans_4_GLdouble_4fn_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 454 | #define DEST_4UB trans_4_GLdouble_4ub_raw |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 455 | #define DEST_4US trans_4_GLdouble_4us_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 456 | #include "m_trans_tmp.h" |
| 457 | |
| 458 | #define SZ 3 |
| 459 | #define INIT init_trans_3_GLdouble_raw |
| 460 | #define DEST_4F trans_3_GLdouble_4f_raw |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 461 | #define DEST_4FN trans_3_GLdouble_4fn_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 462 | #define DEST_4UB trans_3_GLdouble_4ub_raw |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 463 | #define DEST_4US trans_3_GLdouble_4us_raw |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 464 | #define DEST_3FN trans_3_GLdouble_3fn_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 465 | #include "m_trans_tmp.h" |
| 466 | |
| 467 | #define SZ 2 |
| 468 | #define INIT init_trans_2_GLdouble_raw |
| 469 | #define DEST_4F trans_2_GLdouble_4f_raw |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 470 | #define DEST_4FN trans_2_GLdouble_4fn_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 471 | #include "m_trans_tmp.h" |
| 472 | |
| 473 | #define SZ 1 |
| 474 | #define INIT init_trans_1_GLdouble_raw |
| 475 | #define DEST_4F trans_1_GLdouble_4f_raw |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 476 | #define DEST_4FN trans_1_GLdouble_4fn_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 477 | #define DEST_1UB trans_1_GLdouble_1ub_raw |
| 478 | #define DEST_1UI trans_1_GLdouble_1ui_raw |
| 479 | #define DEST_1F trans_1_GLdouble_1f_raw |
| 480 | #include "m_trans_tmp.h" |
| 481 | |
| 482 | #undef SRC |
| 483 | #undef SRC_IDX |
| 484 | |
| 485 | /* GL_FLOAT |
| 486 | */ |
| 487 | #define SRC GLfloat |
| 488 | #define SRC_IDX TYPE_IDX(GL_FLOAT) |
| 489 | #define SZ 4 |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 490 | #define INIT init_trans_4_GLfloat_raw |
| 491 | #define DEST_4UB trans_4_GLfloat_4ub_raw |
| 492 | #define DEST_4US trans_4_GLfloat_4us_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 493 | #define DEST_4F trans_4_GLfloat_4f_raw |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 494 | #define DEST_4FN trans_4_GLfloat_4fn_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 495 | #include "m_trans_tmp.h" |
| 496 | |
| 497 | #define SZ 3 |
| 498 | #define INIT init_trans_3_GLfloat_raw |
| 499 | #define DEST_4F trans_3_GLfloat_4f_raw |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 500 | #define DEST_4FN trans_3_GLfloat_4fn_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 501 | #define DEST_4UB trans_3_GLfloat_4ub_raw |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 502 | #define DEST_4US trans_3_GLfloat_4us_raw |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 503 | #define DEST_3FN trans_3_GLfloat_3fn_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 504 | #include "m_trans_tmp.h" |
| 505 | |
| 506 | #define SZ 2 |
| 507 | #define INIT init_trans_2_GLfloat_raw |
| 508 | #define DEST_4F trans_2_GLfloat_4f_raw |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 509 | #define DEST_4FN trans_2_GLfloat_4fn_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 510 | #include "m_trans_tmp.h" |
| 511 | |
| 512 | #define SZ 1 |
| 513 | #define INIT init_trans_1_GLfloat_raw |
| 514 | #define DEST_4F trans_1_GLfloat_4f_raw |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 515 | #define DEST_4FN trans_1_GLfloat_4fn_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 516 | #define DEST_1UB trans_1_GLfloat_1ub_raw |
| 517 | #define DEST_1UI trans_1_GLfloat_1ui_raw |
| 518 | #define DEST_1F trans_1_GLfloat_1f_raw |
| 519 | |
| 520 | #include "m_trans_tmp.h" |
| 521 | |
| 522 | #undef SRC |
| 523 | #undef SRC_IDX |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 524 | #undef TRX_3FN |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 525 | #undef TRX_4F |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 526 | #undef TRX_4FN |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 527 | #undef TRX_UB |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 528 | #undef TRX_US |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 529 | #undef TRX_UI |
| 530 | |
| 531 | |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 532 | static void trans_4_GLubyte_4ub_raw(GLubyte (*t)[4], |
| 533 | CONST void *Ptr, |
| 534 | GLuint stride, |
| 535 | ARGS ) |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 536 | { |
| 537 | const GLubyte *f = (GLubyte *) Ptr + SRC_START * stride; |
| 538 | GLuint i; |
| 539 | |
Karl Schultz | 6258b76 | 2005-05-05 21:08:07 +0000 | [diff] [blame] | 540 | if (((((uintptr_t) f | (uintptr_t) stride)) & 3L) == 0L) { |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 541 | /* Aligned. |
| 542 | */ |
| 543 | for (i = DST_START ; i < n ; i++, f += stride) { |
| 544 | COPY_4UBV( t[i], f ); |
| 545 | } |
| 546 | } else { |
| 547 | for (i = DST_START ; i < n ; i++, f += stride) { |
| 548 | t[i][0] = f[0]; |
| 549 | t[i][1] = f[1]; |
| 550 | t[i][2] = f[2]; |
| 551 | t[i][3] = f[3]; |
| 552 | } |
| 553 | } |
| 554 | } |
| 555 | |
| 556 | |
| 557 | static void init_translate_raw(void) |
| 558 | { |
| 559 | MEMSET( TAB(_1ui), 0, sizeof(TAB(_1ui)) ); |
| 560 | MEMSET( TAB(_1ub), 0, sizeof(TAB(_1ub)) ); |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 561 | MEMSET( TAB(_3fn), 0, sizeof(TAB(_3fn)) ); |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 562 | MEMSET( TAB(_4ub), 0, sizeof(TAB(_4ub)) ); |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 563 | MEMSET( TAB(_4us), 0, sizeof(TAB(_4us)) ); |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 564 | MEMSET( TAB(_4f), 0, sizeof(TAB(_4f)) ); |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 565 | MEMSET( TAB(_4fn), 0, sizeof(TAB(_4fn)) ); |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 566 | |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 567 | init_trans_4_GLbyte_raw(); |
| 568 | init_trans_3_GLbyte_raw(); |
| 569 | init_trans_2_GLbyte_raw(); |
| 570 | init_trans_1_GLbyte_raw(); |
| 571 | init_trans_1_GLubyte_raw(); |
| 572 | init_trans_3_GLubyte_raw(); |
Keith Whitwell | 51c0c71 | 2001-04-28 08:39:17 +0000 | [diff] [blame] | 573 | init_trans_4_GLubyte_raw(); |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 574 | init_trans_4_GLshort_raw(); |
| 575 | init_trans_3_GLshort_raw(); |
| 576 | init_trans_2_GLshort_raw(); |
| 577 | init_trans_1_GLshort_raw(); |
| 578 | init_trans_4_GLushort_raw(); |
| 579 | init_trans_3_GLushort_raw(); |
| 580 | init_trans_2_GLushort_raw(); |
| 581 | init_trans_1_GLushort_raw(); |
| 582 | init_trans_4_GLint_raw(); |
| 583 | init_trans_3_GLint_raw(); |
| 584 | init_trans_2_GLint_raw(); |
| 585 | init_trans_1_GLint_raw(); |
| 586 | init_trans_4_GLuint_raw(); |
| 587 | init_trans_3_GLuint_raw(); |
| 588 | init_trans_2_GLuint_raw(); |
| 589 | init_trans_1_GLuint_raw(); |
| 590 | init_trans_4_GLdouble_raw(); |
| 591 | init_trans_3_GLdouble_raw(); |
| 592 | init_trans_2_GLdouble_raw(); |
| 593 | init_trans_1_GLdouble_raw(); |
| 594 | init_trans_4_GLfloat_raw(); |
| 595 | init_trans_3_GLfloat_raw(); |
| 596 | init_trans_2_GLfloat_raw(); |
| 597 | init_trans_1_GLfloat_raw(); |
Keith Whitwell | 51c0c71 | 2001-04-28 08:39:17 +0000 | [diff] [blame] | 598 | |
| 599 | TAB(_4ub)[4][TYPE_IDX(GL_UNSIGNED_BYTE)] = trans_4_GLubyte_4ub_raw; |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 600 | } |
| 601 | |
| 602 | |
| 603 | #undef TAB |
Brian Paul | d18c08f | 2003-05-28 15:30:53 +0000 | [diff] [blame] | 604 | #ifdef CLASS |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 605 | #undef CLASS |
Brian Paul | d18c08f | 2003-05-28 15:30:53 +0000 | [diff] [blame] | 606 | #endif |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 607 | #undef ARGS |
| 608 | #undef CHECK |
| 609 | #undef SRC_START |
| 610 | #undef DST_START |
| 611 | #undef NEXT_F |
| 612 | #undef NEXT_F2 |
| 613 | |
| 614 | |
| 615 | |
| 616 | |
| 617 | |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 618 | void _math_init_translate( void ) |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 619 | { |
| 620 | init_translate_raw(); |
| 621 | } |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 622 | |
| 623 | |
Brian Paul | 0395cc0 | 2006-06-13 03:22:52 +0000 | [diff] [blame] | 624 | /** |
| 625 | * Translate vector of values to GLfloat [1]. |
| 626 | */ |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 627 | void _math_trans_1f(GLfloat *to, |
| 628 | CONST void *ptr, |
| 629 | GLuint stride, |
| 630 | GLenum type, |
| 631 | GLuint start, |
| 632 | GLuint n ) |
| 633 | { |
| 634 | _math_trans_1f_tab[TYPE_IDX(type)]( to, ptr, stride, start, n ); |
| 635 | } |
| 636 | |
Brian Paul | 0395cc0 | 2006-06-13 03:22:52 +0000 | [diff] [blame] | 637 | /** |
| 638 | * Translate vector of values to GLuint [1]. |
| 639 | */ |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 640 | void _math_trans_1ui(GLuint *to, |
| 641 | CONST void *ptr, |
| 642 | GLuint stride, |
| 643 | GLenum type, |
| 644 | GLuint start, |
| 645 | GLuint n ) |
| 646 | { |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 647 | _math_trans_1ui_tab[TYPE_IDX(type)]( to, ptr, stride, start, n ); |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 648 | } |
| 649 | |
Brian Paul | 0395cc0 | 2006-06-13 03:22:52 +0000 | [diff] [blame] | 650 | /** |
| 651 | * Translate vector of values to GLubyte [1]. |
| 652 | */ |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 653 | void _math_trans_1ub(GLubyte *to, |
| 654 | CONST void *ptr, |
| 655 | GLuint stride, |
| 656 | GLenum type, |
| 657 | GLuint start, |
| 658 | GLuint n ) |
| 659 | { |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 660 | _math_trans_1ub_tab[TYPE_IDX(type)]( to, ptr, stride, start, n ); |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 661 | } |
| 662 | |
| 663 | |
Brian Paul | 0395cc0 | 2006-06-13 03:22:52 +0000 | [diff] [blame] | 664 | /** |
| 665 | * Translate vector of values to GLubyte [4]. |
| 666 | */ |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 667 | void _math_trans_4ub(GLubyte (*to)[4], |
| 668 | CONST void *ptr, |
| 669 | GLuint stride, |
| 670 | GLenum type, |
| 671 | GLuint size, |
| 672 | GLuint start, |
| 673 | GLuint n ) |
| 674 | { |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 675 | _math_trans_4ub_tab[size][TYPE_IDX(type)]( to, ptr, stride, start, n ); |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 676 | } |
| 677 | |
Brian Paul | 0395cc0 | 2006-06-13 03:22:52 +0000 | [diff] [blame] | 678 | /** |
| 679 | * Translate vector of values to GLchan [4]. |
| 680 | */ |
Keith Whitwell | 4eebc90 | 2001-02-20 18:28:52 +0000 | [diff] [blame] | 681 | void _math_trans_4chan( GLchan (*to)[4], |
| 682 | CONST void *ptr, |
| 683 | GLuint stride, |
| 684 | GLenum type, |
| 685 | GLuint size, |
| 686 | GLuint start, |
| 687 | GLuint n ) |
| 688 | { |
| 689 | #if CHAN_TYPE == GL_UNSIGNED_BYTE |
| 690 | _math_trans_4ub( to, ptr, stride, type, size, start, n ); |
| 691 | #elif CHAN_TYPE == GL_UNSIGNED_SHORT |
| 692 | _math_trans_4us( to, ptr, stride, type, size, start, n ); |
| 693 | #elif CHAN_TYPE == GL_FLOAT |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 694 | _math_trans_4fn( to, ptr, stride, type, size, start, n ); |
Keith Whitwell | 4eebc90 | 2001-02-20 18:28:52 +0000 | [diff] [blame] | 695 | #endif |
| 696 | } |
| 697 | |
Brian Paul | 0395cc0 | 2006-06-13 03:22:52 +0000 | [diff] [blame] | 698 | /** |
| 699 | * Translate vector of values to GLushort [4]. |
| 700 | */ |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 701 | void _math_trans_4us(GLushort (*to)[4], |
| 702 | CONST void *ptr, |
| 703 | GLuint stride, |
| 704 | GLenum type, |
| 705 | GLuint size, |
| 706 | GLuint start, |
| 707 | GLuint n ) |
| 708 | { |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 709 | _math_trans_4us_tab[size][TYPE_IDX(type)]( to, ptr, stride, start, n ); |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 710 | } |
| 711 | |
Brian Paul | 0395cc0 | 2006-06-13 03:22:52 +0000 | [diff] [blame] | 712 | /** |
| 713 | * Translate vector of values to GLfloat [4]. |
| 714 | */ |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 715 | void _math_trans_4f(GLfloat (*to)[4], |
| 716 | CONST void *ptr, |
| 717 | GLuint stride, |
| 718 | GLenum type, |
| 719 | GLuint size, |
| 720 | GLuint start, |
| 721 | GLuint n ) |
| 722 | { |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 723 | _math_trans_4f_tab[size][TYPE_IDX(type)]( to, ptr, stride, start, n ); |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 724 | } |
| 725 | |
Brian Paul | 0395cc0 | 2006-06-13 03:22:52 +0000 | [diff] [blame] | 726 | /** |
| 727 | * Translate vector of values to GLfloat[4], normalized to [-1, 1]. |
| 728 | */ |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 729 | void _math_trans_4fn(GLfloat (*to)[4], |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame] | 730 | CONST void *ptr, |
| 731 | GLuint stride, |
| 732 | GLenum type, |
| 733 | GLuint size, |
| 734 | GLuint start, |
| 735 | GLuint n ) |
| 736 | { |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 737 | _math_trans_4fn_tab[size][TYPE_IDX(type)]( to, ptr, stride, start, n ); |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame] | 738 | } |
| 739 | |
Brian Paul | 0395cc0 | 2006-06-13 03:22:52 +0000 | [diff] [blame] | 740 | /** |
| 741 | * Translate vector of values to GLfloat[3], normalized to [-1, 1]. |
| 742 | */ |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 743 | void _math_trans_3fn(GLfloat (*to)[3], |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 744 | CONST void *ptr, |
| 745 | GLuint stride, |
| 746 | GLenum type, |
| 747 | GLuint start, |
| 748 | GLuint n ) |
| 749 | { |
Brian Paul | 7dfdf3a | 2006-06-13 17:13:15 +0000 | [diff] [blame] | 750 | _math_trans_3fn_tab[TYPE_IDX(type)]( to, ptr, stride, start, n ); |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 751 | } |