Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Mesa 3-D graphics library |
Brian Paul | d18c08f | 2003-05-28 15:30:53 +0000 | [diff] [blame] | 3 | * Version: 5.1 |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 4 | * |
Brian Paul | d18c08f | 2003-05-28 15:30:53 +0000 | [diff] [blame] | 5 | * Copyright (C) 1999-2003 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 | |
| 25 | /* |
| 26 | * New (3.1) transformation code written by Keith Whitwell. |
| 27 | */ |
| 28 | |
| 29 | |
| 30 | #include "glheader.h" |
Keith Whitwell | 4eebc90 | 2001-02-20 18:28:52 +0000 | [diff] [blame] | 31 | #include "mtypes.h" /* GLchan hack */ |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 32 | #include "colormac.h" |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 33 | |
| 34 | #include "m_translate.h" |
| 35 | |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 36 | |
| 37 | |
| 38 | typedef void (*trans_1f_func)(GLfloat *to, |
| 39 | CONST void *ptr, |
| 40 | GLuint stride, |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 41 | GLuint start, |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 42 | GLuint n ); |
| 43 | |
| 44 | typedef void (*trans_1ui_func)(GLuint *to, |
| 45 | CONST void *ptr, |
| 46 | GLuint stride, |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 47 | GLuint start, |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 48 | GLuint n ); |
| 49 | |
| 50 | typedef void (*trans_1ub_func)(GLubyte *to, |
| 51 | CONST void *ptr, |
| 52 | GLuint stride, |
| 53 | GLuint start, |
| 54 | GLuint n ); |
| 55 | |
| 56 | typedef void (*trans_4ub_func)(GLubyte (*to)[4], |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 57 | CONST void *ptr, |
| 58 | GLuint stride, |
| 59 | GLuint start, |
| 60 | GLuint n ); |
| 61 | |
| 62 | typedef void (*trans_4us_func)(GLushort (*to)[4], |
| 63 | CONST void *ptr, |
| 64 | GLuint stride, |
| 65 | GLuint start, |
| 66 | GLuint n ); |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 67 | |
| 68 | typedef void (*trans_4f_func)(GLfloat (*to)[4], |
| 69 | CONST void *ptr, |
| 70 | GLuint stride, |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 71 | GLuint start, |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 72 | GLuint n ); |
| 73 | |
| 74 | typedef void (*trans_3f_func)(GLfloat (*to)[3], |
| 75 | CONST void *ptr, |
| 76 | GLuint stride, |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 77 | GLuint start, |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 78 | GLuint n ); |
| 79 | |
| 80 | |
| 81 | |
| 82 | |
| 83 | #define TYPE_IDX(t) ((t) & 0xf) |
| 84 | #define MAX_TYPES TYPE_IDX(GL_DOUBLE)+1 /* 0xa + 1 */ |
| 85 | |
| 86 | |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 87 | /* This macro is used on other systems, so undefine it for this module */ |
| 88 | |
| 89 | #undef CHECK |
| 90 | |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 91 | static trans_1f_func _math_trans_1f_tab[MAX_TYPES]; |
| 92 | static trans_1ui_func _math_trans_1ui_tab[MAX_TYPES]; |
| 93 | static trans_1ub_func _math_trans_1ub_tab[MAX_TYPES]; |
| 94 | static trans_3f_func _math_trans_3f_tab[MAX_TYPES]; |
| 95 | static trans_4ub_func _math_trans_4ub_tab[5][MAX_TYPES]; |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 96 | static trans_4us_func _math_trans_4us_tab[5][MAX_TYPES]; |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 97 | static trans_4f_func _math_trans_4f_tab[5][MAX_TYPES]; |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame^] | 98 | static trans_4f_func _math_trans_4fc_tab[5][MAX_TYPES]; |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 99 | |
| 100 | |
| 101 | #define PTR_ELT(ptr, elt) (((SRC *)ptr)[elt]) |
| 102 | |
| 103 | |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 104 | #define TAB(x) _math_trans##x##_tab |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 105 | #define ARGS GLuint start, GLuint n |
| 106 | #define SRC_START start |
| 107 | #define DST_START 0 |
| 108 | #define STRIDE stride |
| 109 | #define NEXT_F f += stride |
| 110 | #define NEXT_F2 |
| 111 | #define CHECK |
| 112 | |
| 113 | |
| 114 | |
| 115 | |
| 116 | /* GL_BYTE |
| 117 | */ |
| 118 | #define SRC GLbyte |
| 119 | #define SRC_IDX TYPE_IDX(GL_BYTE) |
| 120 | #define TRX_3F(f,n) BYTE_TO_FLOAT( PTR_ELT(f,n) ) |
Keith Whitwell | 5f2230c | 2001-05-09 14:12:34 +0000 | [diff] [blame] | 121 | #define TRX_4F(f,n) BYTE_TO_FLOAT( PTR_ELT(f,n) ) |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame^] | 122 | #define TRX_4FC(f,n) BYTE_TO_FLOAT( PTR_ELT(f,n) ) |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 123 | #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] | 124 | #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] | 125 | #define TRX_UI(f,n) (PTR_ELT(f,n) < 0 ? 0 : (GLuint) PTR_ELT(f,n)) |
| 126 | |
| 127 | |
| 128 | #define SZ 4 |
| 129 | #define INIT init_trans_4_GLbyte_raw |
| 130 | #define DEST_4F trans_4_GLbyte_4f_raw |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame^] | 131 | #define DEST_4FC trans_4_GLbyte_4fc_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 132 | #define DEST_4UB trans_4_GLbyte_4ub_raw |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 133 | #define DEST_4US trans_4_GLbyte_4us_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 134 | #include "m_trans_tmp.h" |
| 135 | |
| 136 | #define SZ 3 |
| 137 | #define INIT init_trans_3_GLbyte_raw |
| 138 | #define DEST_4F trans_3_GLbyte_4f_raw |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame^] | 139 | #define DEST_4FC trans_3_GLbyte_4fc_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 140 | #define DEST_4UB trans_3_GLbyte_4ub_raw |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 141 | #define DEST_4US trans_3_GLbyte_4us_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 142 | #define DEST_3F trans_3_GLbyte_3f_raw |
| 143 | #include "m_trans_tmp.h" |
| 144 | |
| 145 | #define SZ 2 |
| 146 | #define INIT init_trans_2_GLbyte_raw |
| 147 | #define DEST_4F trans_2_GLbyte_4f_raw |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame^] | 148 | #define DEST_4FC trans_2_GLbyte_4fc_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 149 | #include "m_trans_tmp.h" |
| 150 | |
| 151 | #define SZ 1 |
| 152 | #define INIT init_trans_1_GLbyte_raw |
| 153 | #define DEST_4F trans_1_GLbyte_4f_raw |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame^] | 154 | #define DEST_4FC trans_1_GLbyte_4fc_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 155 | #define DEST_1UB trans_1_GLbyte_1ub_raw |
| 156 | #define DEST_1UI trans_1_GLbyte_1ui_raw |
| 157 | #include "m_trans_tmp.h" |
| 158 | |
| 159 | #undef SRC |
| 160 | #undef TRX_3F |
| 161 | #undef TRX_4F |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame^] | 162 | #undef TRX_4FC |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 163 | #undef TRX_UB |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 164 | #undef TRX_US |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 165 | #undef TRX_UI |
| 166 | #undef SRC_IDX |
| 167 | |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 168 | |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 169 | /* GL_UNSIGNED_BYTE |
| 170 | */ |
| 171 | #define SRC GLubyte |
| 172 | #define SRC_IDX TYPE_IDX(GL_UNSIGNED_BYTE) |
Keith Whitwell | 51c0c71 | 2001-04-28 08:39:17 +0000 | [diff] [blame] | 173 | #define TRX_3F(f,n) UBYTE_TO_FLOAT(PTR_ELT(f,n)) |
| 174 | #define TRX_4F(f,n) UBYTE_TO_FLOAT(PTR_ELT(f,n)) |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame^] | 175 | #define TRX_4FC(f,n) UBYTE_TO_FLOAT(PTR_ELT(f,n)) |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 176 | #define TRX_UB(ub, f,n) ub = PTR_ELT(f,n) |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 177 | #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] | 178 | #define TRX_UI(f,n) (GLuint)PTR_ELT(f,n) |
| 179 | |
| 180 | /* 4ub->4ub handled in special case below. |
| 181 | */ |
Keith Whitwell | 51c0c71 | 2001-04-28 08:39:17 +0000 | [diff] [blame] | 182 | #define SZ 4 |
| 183 | #define INIT init_trans_4_GLubyte_raw |
| 184 | #define DEST_4F trans_4_GLubyte_4f_raw |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame^] | 185 | #define DEST_4FC trans_4_GLubyte_4fc_raw |
Keith Whitwell | 51c0c71 | 2001-04-28 08:39:17 +0000 | [diff] [blame] | 186 | #define DEST_4US trans_4_GLubyte_4us_raw |
| 187 | #include "m_trans_tmp.h" |
| 188 | |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 189 | |
| 190 | #define SZ 3 |
| 191 | #define INIT init_trans_3_GLubyte_raw |
| 192 | #define DEST_4UB trans_3_GLubyte_4ub_raw |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 193 | #define DEST_4US trans_3_GLubyte_4us_raw |
Keith Whitwell | 51c0c71 | 2001-04-28 08:39:17 +0000 | [diff] [blame] | 194 | #define DEST_3F trans_3_GLubyte_3f_raw |
| 195 | #define DEST_4F trans_3_GLubyte_4f_raw |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame^] | 196 | #define DEST_4FC trans_3_GLubyte_4fc_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 197 | #include "m_trans_tmp.h" |
| 198 | |
| 199 | |
| 200 | #define SZ 1 |
| 201 | #define INIT init_trans_1_GLubyte_raw |
| 202 | #define DEST_1UI trans_1_GLubyte_1ui_raw |
| 203 | #define DEST_1UB trans_1_GLubyte_1ub_raw |
| 204 | #include "m_trans_tmp.h" |
| 205 | |
| 206 | #undef SRC |
| 207 | #undef SRC_IDX |
| 208 | #undef TRX_3F |
| 209 | #undef TRX_4F |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame^] | 210 | #undef TRX_4FC |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 211 | #undef TRX_UB |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 212 | #undef TRX_US |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 213 | #undef TRX_UI |
| 214 | |
| 215 | |
| 216 | /* GL_SHORT |
| 217 | */ |
| 218 | #define SRC GLshort |
| 219 | #define SRC_IDX TYPE_IDX(GL_SHORT) |
| 220 | #define TRX_3F(f,n) SHORT_TO_FLOAT( PTR_ELT(f,n) ) |
| 221 | #define TRX_4F(f,n) (GLfloat)( PTR_ELT(f,n) ) |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame^] | 222 | #define TRX_4FC(f,n) (GLfloat)( PTR_ELT(f,n) ) |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 223 | #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] | 224 | #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] | 225 | #define TRX_UI(f,n) (PTR_ELT(f,n) < 0 ? 0 : (GLuint) PTR_ELT(f,n)) |
| 226 | |
| 227 | |
| 228 | #define SZ 4 |
| 229 | #define INIT init_trans_4_GLshort_raw |
| 230 | #define DEST_4F trans_4_GLshort_4f_raw |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame^] | 231 | #define DEST_4FC trans_4_GLshort_4fc_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 232 | #define DEST_4UB trans_4_GLshort_4ub_raw |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 233 | #define DEST_4US trans_4_GLshort_4us_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 234 | #include "m_trans_tmp.h" |
| 235 | |
| 236 | #define SZ 3 |
| 237 | #define INIT init_trans_3_GLshort_raw |
| 238 | #define DEST_4F trans_3_GLshort_4f_raw |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame^] | 239 | #define DEST_4FC trans_3_GLshort_4fc_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 240 | #define DEST_4UB trans_3_GLshort_4ub_raw |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 241 | #define DEST_4US trans_3_GLshort_4us_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 242 | #define DEST_3F trans_3_GLshort_3f_raw |
| 243 | #include "m_trans_tmp.h" |
| 244 | |
| 245 | #define SZ 2 |
| 246 | #define INIT init_trans_2_GLshort_raw |
| 247 | #define DEST_4F trans_2_GLshort_4f_raw |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame^] | 248 | #define DEST_4FC trans_2_GLshort_4fc_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 249 | #include "m_trans_tmp.h" |
| 250 | |
| 251 | #define SZ 1 |
| 252 | #define INIT init_trans_1_GLshort_raw |
| 253 | #define DEST_4F trans_1_GLshort_4f_raw |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame^] | 254 | #define DEST_4FC trans_1_GLshort_4fc_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 255 | #define DEST_1UB trans_1_GLshort_1ub_raw |
| 256 | #define DEST_1UI trans_1_GLshort_1ui_raw |
| 257 | #include "m_trans_tmp.h" |
| 258 | |
| 259 | |
| 260 | #undef SRC |
| 261 | #undef SRC_IDX |
| 262 | #undef TRX_3F |
| 263 | #undef TRX_4F |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame^] | 264 | #undef TRX_4FC |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 265 | #undef TRX_UB |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 266 | #undef TRX_US |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 267 | #undef TRX_UI |
| 268 | |
| 269 | |
| 270 | /* GL_UNSIGNED_SHORT |
| 271 | */ |
| 272 | #define SRC GLushort |
| 273 | #define SRC_IDX TYPE_IDX(GL_UNSIGNED_SHORT) |
| 274 | #define TRX_3F(f,n) USHORT_TO_FLOAT( PTR_ELT(f,n) ) |
| 275 | #define TRX_4F(f,n) (GLfloat)( PTR_ELT(f,n) ) |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame^] | 276 | #define TRX_4FC(f,n) (GLfloat)( PTR_ELT(f,n) ) |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 277 | #define TRX_UB(ub,f,n) ub = (GLubyte) (PTR_ELT(f,n) >> 8) |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 278 | #define TRX_US(us,f,n) us = (GLushort) (PTR_ELT(f,n) >> 8) |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 279 | #define TRX_UI(f,n) (GLuint) PTR_ELT(f,n) |
| 280 | |
| 281 | |
| 282 | #define SZ 4 |
| 283 | #define INIT init_trans_4_GLushort_raw |
| 284 | #define DEST_4F trans_4_GLushort_4f_raw |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame^] | 285 | #define DEST_4FC trans_4_GLushort_4fc_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 286 | #define DEST_4UB trans_4_GLushort_4ub_raw |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 287 | #define DEST_4US trans_4_GLushort_4us_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 288 | #include "m_trans_tmp.h" |
| 289 | |
| 290 | #define SZ 3 |
| 291 | #define INIT init_trans_3_GLushort_raw |
| 292 | #define DEST_4F trans_3_GLushort_4f_raw |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame^] | 293 | #define DEST_4FC trans_3_GLushort_4fc_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 294 | #define DEST_4UB trans_3_GLushort_4ub_raw |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 295 | #define DEST_4US trans_3_GLushort_4us_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 296 | #define DEST_3F trans_3_GLushort_3f_raw |
| 297 | #include "m_trans_tmp.h" |
| 298 | |
| 299 | #define SZ 2 |
| 300 | #define INIT init_trans_2_GLushort_raw |
| 301 | #define DEST_4F trans_2_GLushort_4f_raw |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame^] | 302 | #define DEST_4FC trans_2_GLushort_4fc_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 303 | #include "m_trans_tmp.h" |
| 304 | |
| 305 | #define SZ 1 |
| 306 | #define INIT init_trans_1_GLushort_raw |
| 307 | #define DEST_4F trans_1_GLushort_4f_raw |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame^] | 308 | #define DEST_4FC trans_1_GLushort_4fc_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 309 | #define DEST_1UB trans_1_GLushort_1ub_raw |
| 310 | #define DEST_1UI trans_1_GLushort_1ui_raw |
| 311 | #include "m_trans_tmp.h" |
| 312 | |
| 313 | #undef SRC |
| 314 | #undef SRC_IDX |
| 315 | #undef TRX_3F |
| 316 | #undef TRX_4F |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame^] | 317 | #undef TRX_4FC |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 318 | #undef TRX_UB |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 319 | #undef TRX_US |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 320 | #undef TRX_UI |
| 321 | |
| 322 | |
| 323 | /* GL_INT |
| 324 | */ |
| 325 | #define SRC GLint |
| 326 | #define SRC_IDX TYPE_IDX(GL_INT) |
| 327 | #define TRX_3F(f,n) INT_TO_FLOAT( PTR_ELT(f,n) ) |
| 328 | #define TRX_4F(f,n) (GLfloat)( PTR_ELT(f,n) ) |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame^] | 329 | #define TRX_4FC(f,n) (GLfloat)( PTR_ELT(f,n) ) |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 330 | #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] | 331 | #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] | 332 | #define TRX_UI(f,n) (PTR_ELT(f,n) < 0 ? 0 : (GLuint) PTR_ELT(f,n)) |
| 333 | |
| 334 | |
| 335 | #define SZ 4 |
| 336 | #define INIT init_trans_4_GLint_raw |
| 337 | #define DEST_4F trans_4_GLint_4f_raw |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame^] | 338 | #define DEST_4FC trans_4_GLint_4fc_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 339 | #define DEST_4UB trans_4_GLint_4ub_raw |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 340 | #define DEST_4US trans_4_GLint_4us_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 341 | #include "m_trans_tmp.h" |
| 342 | |
| 343 | #define SZ 3 |
| 344 | #define INIT init_trans_3_GLint_raw |
| 345 | #define DEST_4F trans_3_GLint_4f_raw |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame^] | 346 | #define DEST_4FC trans_3_GLint_4fc_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 347 | #define DEST_4UB trans_3_GLint_4ub_raw |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 348 | #define DEST_4US trans_3_GLint_4us_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 349 | #define DEST_3F trans_3_GLint_3f_raw |
| 350 | #include "m_trans_tmp.h" |
| 351 | |
| 352 | #define SZ 2 |
| 353 | #define INIT init_trans_2_GLint_raw |
| 354 | #define DEST_4F trans_2_GLint_4f_raw |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame^] | 355 | #define DEST_4FC trans_2_GLint_4fc_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 356 | #include "m_trans_tmp.h" |
| 357 | |
| 358 | #define SZ 1 |
| 359 | #define INIT init_trans_1_GLint_raw |
| 360 | #define DEST_4F trans_1_GLint_4f_raw |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame^] | 361 | #define DEST_4FC trans_1_GLint_4fc_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 362 | #define DEST_1UB trans_1_GLint_1ub_raw |
| 363 | #define DEST_1UI trans_1_GLint_1ui_raw |
| 364 | #include "m_trans_tmp.h" |
| 365 | |
| 366 | |
| 367 | #undef SRC |
| 368 | #undef SRC_IDX |
| 369 | #undef TRX_3F |
| 370 | #undef TRX_4F |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame^] | 371 | #undef TRX_4FC |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 372 | #undef TRX_UB |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 373 | #undef TRX_US |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 374 | #undef TRX_UI |
| 375 | |
| 376 | |
| 377 | /* GL_UNSIGNED_INT |
| 378 | */ |
| 379 | #define SRC GLuint |
| 380 | #define SRC_IDX TYPE_IDX(GL_UNSIGNED_INT) |
| 381 | #define TRX_3F(f,n) INT_TO_FLOAT( PTR_ELT(f,n) ) |
| 382 | #define TRX_4F(f,n) (GLfloat)( PTR_ELT(f,n) ) |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame^] | 383 | #define TRX_4FC(f,n) (GLfloat)( PTR_ELT(f,n) ) |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 384 | #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] | 385 | #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] | 386 | #define TRX_UI(f,n) PTR_ELT(f,n) |
| 387 | |
| 388 | |
| 389 | #define SZ 4 |
| 390 | #define INIT init_trans_4_GLuint_raw |
| 391 | #define DEST_4F trans_4_GLuint_4f_raw |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame^] | 392 | #define DEST_4FC trans_4_GLuint_4fc_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 393 | #define DEST_4UB trans_4_GLuint_4ub_raw |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 394 | #define DEST_4US trans_4_GLuint_4us_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 395 | #include "m_trans_tmp.h" |
| 396 | |
| 397 | #define SZ 3 |
| 398 | #define INIT init_trans_3_GLuint_raw |
| 399 | #define DEST_4F trans_3_GLuint_4f_raw |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame^] | 400 | #define DEST_4FC trans_3_GLuint_4fc_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 401 | #define DEST_4UB trans_3_GLuint_4ub_raw |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 402 | #define DEST_4US trans_3_GLuint_4us_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 403 | #define DEST_3F trans_3_GLuint_3f_raw |
| 404 | #include "m_trans_tmp.h" |
| 405 | |
| 406 | #define SZ 2 |
| 407 | #define INIT init_trans_2_GLuint_raw |
| 408 | #define DEST_4F trans_2_GLuint_4f_raw |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame^] | 409 | #define DEST_4FC trans_2_GLuint_4fc_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 410 | #include "m_trans_tmp.h" |
| 411 | |
| 412 | #define SZ 1 |
| 413 | #define INIT init_trans_1_GLuint_raw |
| 414 | #define DEST_4F trans_1_GLuint_4f_raw |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame^] | 415 | #define DEST_4FC trans_1_GLuint_4fc_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 416 | #define DEST_1UB trans_1_GLuint_1ub_raw |
| 417 | #define DEST_1UI trans_1_GLuint_1ui_raw |
| 418 | #include "m_trans_tmp.h" |
| 419 | |
| 420 | #undef SRC |
| 421 | #undef SRC_IDX |
| 422 | #undef TRX_3F |
| 423 | #undef TRX_4F |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame^] | 424 | #undef TRX_4FC |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 425 | #undef TRX_UB |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 426 | #undef TRX_US |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 427 | #undef TRX_UI |
| 428 | |
| 429 | |
| 430 | /* GL_DOUBLE |
| 431 | */ |
| 432 | #define SRC GLdouble |
| 433 | #define SRC_IDX TYPE_IDX(GL_DOUBLE) |
Karl Schultz | 7b9fe82 | 2001-09-18 23:06:14 +0000 | [diff] [blame] | 434 | #define TRX_3F(f,n) (GLfloat) PTR_ELT(f,n) |
| 435 | #define TRX_4F(f,n) (GLfloat) PTR_ELT(f,n) |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame^] | 436 | #define TRX_4FC(f,n) (GLfloat) PTR_ELT(f,n) |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 437 | #define TRX_UB(ub,f,n) UNCLAMPED_FLOAT_TO_UBYTE(ub, PTR_ELT(f,n)) |
| 438 | #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] | 439 | #define TRX_UI(f,n) (GLuint) (GLint) PTR_ELT(f,n) |
Karl Schultz | 7b9fe82 | 2001-09-18 23:06:14 +0000 | [diff] [blame] | 440 | #define TRX_1F(f,n) (GLfloat) PTR_ELT(f,n) |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 441 | |
| 442 | |
| 443 | #define SZ 4 |
| 444 | #define INIT init_trans_4_GLdouble_raw |
| 445 | #define DEST_4F trans_4_GLdouble_4f_raw |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame^] | 446 | #define DEST_4FC trans_4_GLdouble_4fc_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 447 | #define DEST_4UB trans_4_GLdouble_4ub_raw |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 448 | #define DEST_4US trans_4_GLdouble_4us_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 449 | #include "m_trans_tmp.h" |
| 450 | |
| 451 | #define SZ 3 |
| 452 | #define INIT init_trans_3_GLdouble_raw |
| 453 | #define DEST_4F trans_3_GLdouble_4f_raw |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame^] | 454 | #define DEST_4FC trans_3_GLdouble_4fc_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 455 | #define DEST_4UB trans_3_GLdouble_4ub_raw |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 456 | #define DEST_4US trans_3_GLdouble_4us_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 457 | #define DEST_3F trans_3_GLdouble_3f_raw |
| 458 | #include "m_trans_tmp.h" |
| 459 | |
| 460 | #define SZ 2 |
| 461 | #define INIT init_trans_2_GLdouble_raw |
| 462 | #define DEST_4F trans_2_GLdouble_4f_raw |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame^] | 463 | #define DEST_4FC trans_2_GLdouble_4fc_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 464 | #include "m_trans_tmp.h" |
| 465 | |
| 466 | #define SZ 1 |
| 467 | #define INIT init_trans_1_GLdouble_raw |
| 468 | #define DEST_4F trans_1_GLdouble_4f_raw |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame^] | 469 | #define DEST_4FC trans_1_GLdouble_4fc_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 470 | #define DEST_1UB trans_1_GLdouble_1ub_raw |
| 471 | #define DEST_1UI trans_1_GLdouble_1ui_raw |
| 472 | #define DEST_1F trans_1_GLdouble_1f_raw |
| 473 | #include "m_trans_tmp.h" |
| 474 | |
| 475 | #undef SRC |
| 476 | #undef SRC_IDX |
| 477 | |
| 478 | /* GL_FLOAT |
| 479 | */ |
| 480 | #define SRC GLfloat |
| 481 | #define SRC_IDX TYPE_IDX(GL_FLOAT) |
| 482 | #define SZ 4 |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 483 | #define INIT init_trans_4_GLfloat_raw |
| 484 | #define DEST_4UB trans_4_GLfloat_4ub_raw |
| 485 | #define DEST_4US trans_4_GLfloat_4us_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 486 | #define DEST_4F trans_4_GLfloat_4f_raw |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame^] | 487 | #define DEST_4FC trans_4_GLfloat_4fc_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 488 | #include "m_trans_tmp.h" |
| 489 | |
| 490 | #define SZ 3 |
| 491 | #define INIT init_trans_3_GLfloat_raw |
| 492 | #define DEST_4F trans_3_GLfloat_4f_raw |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame^] | 493 | #define DEST_4FC trans_3_GLfloat_4fc_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 494 | #define DEST_4UB trans_3_GLfloat_4ub_raw |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 495 | #define DEST_4US trans_3_GLfloat_4us_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 496 | #define DEST_3F trans_3_GLfloat_3f_raw |
| 497 | #include "m_trans_tmp.h" |
| 498 | |
| 499 | #define SZ 2 |
| 500 | #define INIT init_trans_2_GLfloat_raw |
| 501 | #define DEST_4F trans_2_GLfloat_4f_raw |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame^] | 502 | #define DEST_4FC trans_2_GLfloat_4fc_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 503 | #include "m_trans_tmp.h" |
| 504 | |
| 505 | #define SZ 1 |
| 506 | #define INIT init_trans_1_GLfloat_raw |
| 507 | #define DEST_4F trans_1_GLfloat_4f_raw |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame^] | 508 | #define DEST_4FC trans_1_GLfloat_4fc_raw |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 509 | #define DEST_1UB trans_1_GLfloat_1ub_raw |
| 510 | #define DEST_1UI trans_1_GLfloat_1ui_raw |
| 511 | #define DEST_1F trans_1_GLfloat_1f_raw |
| 512 | |
| 513 | #include "m_trans_tmp.h" |
| 514 | |
| 515 | #undef SRC |
| 516 | #undef SRC_IDX |
| 517 | #undef TRX_3F |
| 518 | #undef TRX_4F |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame^] | 519 | #undef TRX_4FC |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 520 | #undef TRX_UB |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 521 | #undef TRX_US |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 522 | #undef TRX_UI |
| 523 | |
| 524 | |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 525 | static void trans_4_GLubyte_4ub_raw(GLubyte (*t)[4], |
| 526 | CONST void *Ptr, |
| 527 | GLuint stride, |
| 528 | ARGS ) |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 529 | { |
| 530 | const GLubyte *f = (GLubyte *) Ptr + SRC_START * stride; |
| 531 | GLuint i; |
| 532 | |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 533 | if (((((long) f | (long) stride)) & 3L) == 0L) { |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 534 | /* Aligned. |
| 535 | */ |
| 536 | for (i = DST_START ; i < n ; i++, f += stride) { |
| 537 | COPY_4UBV( t[i], f ); |
| 538 | } |
| 539 | } else { |
| 540 | for (i = DST_START ; i < n ; i++, f += stride) { |
| 541 | t[i][0] = f[0]; |
| 542 | t[i][1] = f[1]; |
| 543 | t[i][2] = f[2]; |
| 544 | t[i][3] = f[3]; |
| 545 | } |
| 546 | } |
| 547 | } |
| 548 | |
| 549 | |
| 550 | static void init_translate_raw(void) |
| 551 | { |
| 552 | MEMSET( TAB(_1ui), 0, sizeof(TAB(_1ui)) ); |
| 553 | MEMSET( TAB(_1ub), 0, sizeof(TAB(_1ub)) ); |
| 554 | MEMSET( TAB(_3f), 0, sizeof(TAB(_3f)) ); |
| 555 | MEMSET( TAB(_4ub), 0, sizeof(TAB(_4ub)) ); |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 556 | MEMSET( TAB(_4us), 0, sizeof(TAB(_4us)) ); |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 557 | MEMSET( TAB(_4f), 0, sizeof(TAB(_4f)) ); |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame^] | 558 | MEMSET( TAB(_4fc), 0, sizeof(TAB(_4fc)) ); |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 559 | |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 560 | init_trans_4_GLbyte_raw(); |
| 561 | init_trans_3_GLbyte_raw(); |
| 562 | init_trans_2_GLbyte_raw(); |
| 563 | init_trans_1_GLbyte_raw(); |
| 564 | init_trans_1_GLubyte_raw(); |
| 565 | init_trans_3_GLubyte_raw(); |
Keith Whitwell | 51c0c71 | 2001-04-28 08:39:17 +0000 | [diff] [blame] | 566 | init_trans_4_GLubyte_raw(); |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 567 | init_trans_4_GLshort_raw(); |
| 568 | init_trans_3_GLshort_raw(); |
| 569 | init_trans_2_GLshort_raw(); |
| 570 | init_trans_1_GLshort_raw(); |
| 571 | init_trans_4_GLushort_raw(); |
| 572 | init_trans_3_GLushort_raw(); |
| 573 | init_trans_2_GLushort_raw(); |
| 574 | init_trans_1_GLushort_raw(); |
| 575 | init_trans_4_GLint_raw(); |
| 576 | init_trans_3_GLint_raw(); |
| 577 | init_trans_2_GLint_raw(); |
| 578 | init_trans_1_GLint_raw(); |
| 579 | init_trans_4_GLuint_raw(); |
| 580 | init_trans_3_GLuint_raw(); |
| 581 | init_trans_2_GLuint_raw(); |
| 582 | init_trans_1_GLuint_raw(); |
| 583 | init_trans_4_GLdouble_raw(); |
| 584 | init_trans_3_GLdouble_raw(); |
| 585 | init_trans_2_GLdouble_raw(); |
| 586 | init_trans_1_GLdouble_raw(); |
| 587 | init_trans_4_GLfloat_raw(); |
| 588 | init_trans_3_GLfloat_raw(); |
| 589 | init_trans_2_GLfloat_raw(); |
| 590 | init_trans_1_GLfloat_raw(); |
Keith Whitwell | 51c0c71 | 2001-04-28 08:39:17 +0000 | [diff] [blame] | 591 | |
| 592 | 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] | 593 | } |
| 594 | |
| 595 | |
| 596 | #undef TAB |
Brian Paul | d18c08f | 2003-05-28 15:30:53 +0000 | [diff] [blame] | 597 | #ifdef CLASS |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 598 | #undef CLASS |
Brian Paul | d18c08f | 2003-05-28 15:30:53 +0000 | [diff] [blame] | 599 | #endif |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 600 | #undef ARGS |
| 601 | #undef CHECK |
| 602 | #undef SRC_START |
| 603 | #undef DST_START |
| 604 | #undef NEXT_F |
| 605 | #undef NEXT_F2 |
| 606 | |
| 607 | |
| 608 | |
| 609 | |
| 610 | |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 611 | void _math_init_translate( void ) |
Keith Whitwell | 23caf20 | 2000-11-16 21:05:34 +0000 | [diff] [blame] | 612 | { |
| 613 | init_translate_raw(); |
| 614 | } |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 615 | |
| 616 | |
| 617 | |
| 618 | void _math_trans_1f(GLfloat *to, |
| 619 | CONST void *ptr, |
| 620 | GLuint stride, |
| 621 | GLenum type, |
| 622 | GLuint start, |
| 623 | GLuint n ) |
| 624 | { |
| 625 | _math_trans_1f_tab[TYPE_IDX(type)]( to, ptr, stride, start, n ); |
| 626 | } |
| 627 | |
| 628 | void _math_trans_1ui(GLuint *to, |
| 629 | CONST void *ptr, |
| 630 | GLuint stride, |
| 631 | GLenum type, |
| 632 | GLuint start, |
| 633 | GLuint n ) |
| 634 | { |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 635 | _math_trans_1ui_tab[TYPE_IDX(type)]( to, ptr, stride, start, n ); |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 636 | } |
| 637 | |
| 638 | void _math_trans_1ub(GLubyte *to, |
| 639 | CONST void *ptr, |
| 640 | GLuint stride, |
| 641 | GLenum type, |
| 642 | GLuint start, |
| 643 | GLuint n ) |
| 644 | { |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 645 | _math_trans_1ub_tab[TYPE_IDX(type)]( to, ptr, stride, start, n ); |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 646 | } |
| 647 | |
| 648 | |
| 649 | void _math_trans_4ub(GLubyte (*to)[4], |
| 650 | CONST void *ptr, |
| 651 | GLuint stride, |
| 652 | GLenum type, |
| 653 | GLuint size, |
| 654 | GLuint start, |
| 655 | GLuint n ) |
| 656 | { |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 657 | _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] | 658 | } |
| 659 | |
Keith Whitwell | 4eebc90 | 2001-02-20 18:28:52 +0000 | [diff] [blame] | 660 | void _math_trans_4chan( GLchan (*to)[4], |
| 661 | CONST void *ptr, |
| 662 | GLuint stride, |
| 663 | GLenum type, |
| 664 | GLuint size, |
| 665 | GLuint start, |
| 666 | GLuint n ) |
| 667 | { |
| 668 | #if CHAN_TYPE == GL_UNSIGNED_BYTE |
| 669 | _math_trans_4ub( to, ptr, stride, type, size, start, n ); |
| 670 | #elif CHAN_TYPE == GL_UNSIGNED_SHORT |
| 671 | _math_trans_4us( to, ptr, stride, type, size, start, n ); |
| 672 | #elif CHAN_TYPE == GL_FLOAT |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame^] | 673 | _math_trans_4fc( to, ptr, stride, type, size, start, n ); |
Keith Whitwell | 4eebc90 | 2001-02-20 18:28:52 +0000 | [diff] [blame] | 674 | #endif |
| 675 | } |
| 676 | |
Brian Paul | 74b493a | 2001-01-24 00:04:58 +0000 | [diff] [blame] | 677 | void _math_trans_4us(GLushort (*to)[4], |
| 678 | CONST void *ptr, |
| 679 | GLuint stride, |
| 680 | GLenum type, |
| 681 | GLuint size, |
| 682 | GLuint start, |
| 683 | GLuint n ) |
| 684 | { |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 685 | _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] | 686 | } |
| 687 | |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 688 | void _math_trans_4f(GLfloat (*to)[4], |
| 689 | CONST void *ptr, |
| 690 | GLuint stride, |
| 691 | GLenum type, |
| 692 | GLuint size, |
| 693 | GLuint start, |
| 694 | GLuint n ) |
| 695 | { |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 696 | _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] | 697 | } |
| 698 | |
Keith Whitwell | 12c037d | 2003-08-20 07:21:41 +0000 | [diff] [blame^] | 699 | void _math_trans_4fc(GLfloat (*to)[4], |
| 700 | CONST void *ptr, |
| 701 | GLuint stride, |
| 702 | GLenum type, |
| 703 | GLuint size, |
| 704 | GLuint start, |
| 705 | GLuint n ) |
| 706 | { |
| 707 | _math_trans_4fc_tab[size][TYPE_IDX(type)]( to, ptr, stride, start, n ); |
| 708 | } |
| 709 | |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 710 | void _math_trans_3f(GLfloat (*to)[3], |
| 711 | CONST void *ptr, |
| 712 | GLuint stride, |
| 713 | GLenum type, |
| 714 | GLuint start, |
| 715 | GLuint n ) |
| 716 | { |
Gareth Hughes | 22144ab | 2001-03-12 00:48:37 +0000 | [diff] [blame] | 717 | _math_trans_3f_tab[TYPE_IDX(type)]( to, ptr, stride, start, n ); |
Keith Whitwell | cab974c | 2000-12-26 05:09:27 +0000 | [diff] [blame] | 718 | } |