ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

m_translate.c
Go to the documentation of this file.
00001 /*
00002  * Mesa 3-D graphics library
00003  * Version:  6.5.1
00004  *
00005  * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
00006  *
00007  * Permission is hereby granted, free of charge, to any person obtaining a
00008  * copy of this software and associated documentation files (the "Software"),
00009  * to deal in the Software without restriction, including without limitation
00010  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
00011  * and/or sell copies of the Software, and to permit persons to whom the
00012  * Software is furnished to do so, subject to the following conditions:
00013  *
00014  * The above copyright notice and this permission notice shall be included
00015  * in all copies or substantial portions of the Software.
00016  *
00017  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00018  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00019  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
00020  * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
00021  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00022  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00023  */
00024 
00031 #include "main/glheader.h"
00032 #include "main/mtypes.h"        /* GLchan hack */
00033 #include "main/colormac.h"
00034 
00035 #include "m_translate.h"
00036 
00037 
00038 
00039 typedef void (*trans_1f_func)(GLfloat *to,
00040                   CONST void *ptr,
00041                   GLuint stride,
00042                   GLuint start,
00043                   GLuint n );
00044 
00045 typedef void (*trans_1ui_func)(GLuint *to,
00046                    CONST void *ptr,
00047                    GLuint stride,
00048                    GLuint start,
00049                    GLuint n );
00050 
00051 typedef void (*trans_1ub_func)(GLubyte *to,
00052                    CONST void *ptr,
00053                    GLuint stride,
00054                    GLuint start,
00055                    GLuint n );
00056 
00057 typedef void (*trans_4ub_func)(GLubyte (*to)[4],
00058                                CONST void *ptr,
00059                                GLuint stride,
00060                                GLuint start,
00061                                GLuint n );
00062 
00063 typedef void (*trans_4us_func)(GLushort (*to)[4],
00064                                CONST void *ptr,
00065                                GLuint stride,
00066                                GLuint start,
00067                                GLuint n );
00068 
00069 typedef void (*trans_4f_func)(GLfloat (*to)[4],
00070                   CONST void *ptr,
00071                   GLuint stride,
00072                   GLuint start,
00073                   GLuint n );
00074 
00075 typedef void (*trans_3fn_func)(GLfloat (*to)[3],
00076                   CONST void *ptr,
00077                   GLuint stride,
00078                   GLuint start,
00079                   GLuint n );
00080 
00081 
00082 
00083 
00084 #define TYPE_IDX(t) ((t) & 0xf)
00085 #define MAX_TYPES TYPE_IDX(GL_DOUBLE)+1      /* 0xa + 1 */
00086 
00087 
00088 /* This macro is used on other systems, so undefine it for this module */
00089 
00090 #undef  CHECK
00091 
00092 static trans_1f_func  _math_trans_1f_tab[MAX_TYPES];
00093 static trans_1ui_func _math_trans_1ui_tab[MAX_TYPES];
00094 static trans_1ub_func _math_trans_1ub_tab[MAX_TYPES];
00095 static trans_3fn_func  _math_trans_3fn_tab[MAX_TYPES];
00096 static trans_4ub_func _math_trans_4ub_tab[5][MAX_TYPES];
00097 static trans_4us_func _math_trans_4us_tab[5][MAX_TYPES];
00098 static trans_4f_func  _math_trans_4f_tab[5][MAX_TYPES];
00099 static trans_4f_func  _math_trans_4fn_tab[5][MAX_TYPES];
00100 
00101 
00102 #define PTR_ELT(ptr, elt) (((SRC *)ptr)[elt])
00103 
00104 
00105 #define TAB(x) _math_trans##x##_tab
00106 #define ARGS   GLuint start, GLuint n
00107 #define SRC_START  start
00108 #define DST_START  0
00109 #define STRIDE stride
00110 #define NEXT_F f += stride
00111 #define NEXT_F2
00112 #define CHECK
00113 
00114 
00115 
00116 
00120 #define SRC GLbyte
00121 #define SRC_IDX TYPE_IDX(GL_BYTE)
00122 #define TRX_3FN(f,n)   BYTE_TO_FLOAT( PTR_ELT(f,n) )
00123 #if 1
00124 #define TRX_4F(f,n)   BYTE_TO_FLOAT( PTR_ELT(f,n) )
00125 #else
00126 #define TRX_4F(f,n)   (GLfloat)( PTR_ELT(f,n) )
00127 #endif
00128 #define TRX_4FN(f,n)   BYTE_TO_FLOAT( PTR_ELT(f,n) )
00129 #define TRX_UB(ub, f,n)  ub = BYTE_TO_UBYTE( PTR_ELT(f,n) )
00130 #define TRX_US(ch, f,n)  ch = BYTE_TO_USHORT( PTR_ELT(f,n) )
00131 #define TRX_UI(f,n)  (PTR_ELT(f,n) < 0 ? 0 : (GLuint)  PTR_ELT(f,n))
00132 
00133 
00134 #define SZ 4
00135 #define INIT init_trans_4_GLbyte_raw
00136 #define DEST_4F trans_4_GLbyte_4f_raw
00137 #define DEST_4FN trans_4_GLbyte_4fn_raw
00138 #define DEST_4UB trans_4_GLbyte_4ub_raw
00139 #define DEST_4US trans_4_GLbyte_4us_raw
00140 #include "m_trans_tmp.h"
00141 
00142 #define SZ 3
00143 #define INIT init_trans_3_GLbyte_raw
00144 #define DEST_4F trans_3_GLbyte_4f_raw
00145 #define DEST_4FN trans_3_GLbyte_4fn_raw
00146 #define DEST_4UB trans_3_GLbyte_4ub_raw
00147 #define DEST_4US trans_3_GLbyte_4us_raw
00148 #define DEST_3FN trans_3_GLbyte_3fn_raw
00149 #include "m_trans_tmp.h"
00150 
00151 #define SZ 2
00152 #define INIT init_trans_2_GLbyte_raw
00153 #define DEST_4F trans_2_GLbyte_4f_raw
00154 #define DEST_4FN trans_2_GLbyte_4fn_raw
00155 #include "m_trans_tmp.h"
00156 
00157 #define SZ 1
00158 #define INIT init_trans_1_GLbyte_raw
00159 #define DEST_4F trans_1_GLbyte_4f_raw
00160 #define DEST_4FN trans_1_GLbyte_4fn_raw
00161 #define DEST_1UB trans_1_GLbyte_1ub_raw
00162 #define DEST_1UI trans_1_GLbyte_1ui_raw
00163 #include "m_trans_tmp.h"
00164 
00165 #undef SRC
00166 #undef TRX_3FN
00167 #undef TRX_4F
00168 #undef TRX_4FN
00169 #undef TRX_UB
00170 #undef TRX_US
00171 #undef TRX_UI
00172 #undef SRC_IDX
00173 
00174 
00178 #define SRC GLubyte
00179 #define SRC_IDX TYPE_IDX(GL_UNSIGNED_BYTE)
00180 #define TRX_3FN(f,n)         UBYTE_TO_FLOAT(PTR_ELT(f,n))
00181 #define TRX_4F(f,n)      (GLfloat)( PTR_ELT(f,n) )
00182 #define TRX_4FN(f,n)         UBYTE_TO_FLOAT(PTR_ELT(f,n))
00183 #define TRX_UB(ub, f,n)      ub = PTR_ELT(f,n)
00184 #define TRX_US(us, f,n)      us = UBYTE_TO_USHORT(PTR_ELT(f,n))
00185 #define TRX_UI(f,n)          (GLuint)PTR_ELT(f,n)
00186 
00187 /* 4ub->4ub handled in special case below.
00188  */
00189 #define SZ 4
00190 #define INIT init_trans_4_GLubyte_raw
00191 #define DEST_4F trans_4_GLubyte_4f_raw
00192 #define DEST_4FN trans_4_GLubyte_4fn_raw
00193 #define DEST_4US trans_4_GLubyte_4us_raw
00194 #include "m_trans_tmp.h"
00195 
00196 
00197 #define SZ 3
00198 #define INIT init_trans_3_GLubyte_raw
00199 #define DEST_4UB trans_3_GLubyte_4ub_raw
00200 #define DEST_4US trans_3_GLubyte_4us_raw
00201 #define DEST_3FN trans_3_GLubyte_3fn_raw
00202 #define DEST_4F trans_3_GLubyte_4f_raw
00203 #define DEST_4FN trans_3_GLubyte_4fn_raw
00204 #include "m_trans_tmp.h"
00205 
00206 
00207 #define SZ 1
00208 #define INIT init_trans_1_GLubyte_raw
00209 #define DEST_1UI trans_1_GLubyte_1ui_raw
00210 #define DEST_1UB trans_1_GLubyte_1ub_raw
00211 #include "m_trans_tmp.h"
00212 
00213 #undef SRC
00214 #undef SRC_IDX
00215 #undef TRX_3FN
00216 #undef TRX_4F
00217 #undef TRX_4FN
00218 #undef TRX_UB
00219 #undef TRX_US
00220 #undef TRX_UI
00221 
00222 
00223 /* GL_SHORT
00224  */
00225 #define SRC GLshort
00226 #define SRC_IDX TYPE_IDX(GL_SHORT)
00227 #define TRX_3FN(f,n)   SHORT_TO_FLOAT( PTR_ELT(f,n) )
00228 #define TRX_4F(f,n)   (GLfloat)( PTR_ELT(f,n) )
00229 #define TRX_4FN(f,n)  SHORT_TO_FLOAT( PTR_ELT(f,n) )
00230 #define TRX_UB(ub, f,n)  ub = SHORT_TO_UBYTE(PTR_ELT(f,n))
00231 #define TRX_US(us, f,n)  us = SHORT_TO_USHORT(PTR_ELT(f,n))
00232 #define TRX_UI(f,n)  (PTR_ELT(f,n) < 0 ? 0 : (GLuint)  PTR_ELT(f,n))
00233 
00234 
00235 #define SZ  4
00236 #define INIT init_trans_4_GLshort_raw
00237 #define DEST_4F trans_4_GLshort_4f_raw
00238 #define DEST_4FN trans_4_GLshort_4fn_raw
00239 #define DEST_4UB trans_4_GLshort_4ub_raw
00240 #define DEST_4US trans_4_GLshort_4us_raw
00241 #include "m_trans_tmp.h"
00242 
00243 #define SZ 3
00244 #define INIT init_trans_3_GLshort_raw
00245 #define DEST_4F trans_3_GLshort_4f_raw
00246 #define DEST_4FN trans_3_GLshort_4fn_raw
00247 #define DEST_4UB trans_3_GLshort_4ub_raw
00248 #define DEST_4US trans_3_GLshort_4us_raw
00249 #define DEST_3FN trans_3_GLshort_3fn_raw
00250 #include "m_trans_tmp.h"
00251 
00252 #define SZ 2
00253 #define INIT init_trans_2_GLshort_raw
00254 #define DEST_4F trans_2_GLshort_4f_raw
00255 #define DEST_4FN trans_2_GLshort_4fn_raw
00256 #include "m_trans_tmp.h"
00257 
00258 #define SZ 1
00259 #define INIT init_trans_1_GLshort_raw
00260 #define DEST_4F trans_1_GLshort_4f_raw
00261 #define DEST_4FN trans_1_GLshort_4fn_raw
00262 #define DEST_1UB trans_1_GLshort_1ub_raw
00263 #define DEST_1UI trans_1_GLshort_1ui_raw
00264 #include "m_trans_tmp.h"
00265 
00266 
00267 #undef SRC
00268 #undef SRC_IDX
00269 #undef TRX_3FN
00270 #undef TRX_4F
00271 #undef TRX_4FN
00272 #undef TRX_UB
00273 #undef TRX_US
00274 #undef TRX_UI
00275 
00276 
00277 /* GL_UNSIGNED_SHORT
00278  */
00279 #define SRC GLushort
00280 #define SRC_IDX TYPE_IDX(GL_UNSIGNED_SHORT)
00281 #define TRX_3FN(f,n)   USHORT_TO_FLOAT( PTR_ELT(f,n) )
00282 #define TRX_4F(f,n)   (GLfloat)( PTR_ELT(f,n) )
00283 #define TRX_4FN(f,n)  USHORT_TO_FLOAT( PTR_ELT(f,n) )
00284 #define TRX_UB(ub,f,n)  ub = (GLubyte) (PTR_ELT(f,n) >> 8)
00285 #define TRX_US(us,f,n)  us = PTR_ELT(f,n)
00286 #define TRX_UI(f,n)  (GLuint)   PTR_ELT(f,n)
00287 
00288 
00289 #define SZ 4
00290 #define INIT init_trans_4_GLushort_raw
00291 #define DEST_4F trans_4_GLushort_4f_raw
00292 #define DEST_4FN trans_4_GLushort_4fn_raw
00293 #define DEST_4UB trans_4_GLushort_4ub_raw
00294 #define DEST_4US trans_4_GLushort_4us_raw
00295 #include "m_trans_tmp.h"
00296 
00297 #define SZ 3
00298 #define INIT init_trans_3_GLushort_raw
00299 #define DEST_4F trans_3_GLushort_4f_raw
00300 #define DEST_4FN trans_3_GLushort_4fn_raw
00301 #define DEST_4UB trans_3_GLushort_4ub_raw
00302 #define DEST_4US trans_3_GLushort_4us_raw
00303 #define DEST_3FN trans_3_GLushort_3fn_raw
00304 #include "m_trans_tmp.h"
00305 
00306 #define SZ 2
00307 #define INIT init_trans_2_GLushort_raw
00308 #define DEST_4F trans_2_GLushort_4f_raw
00309 #define DEST_4FN trans_2_GLushort_4fn_raw
00310 #include "m_trans_tmp.h"
00311 
00312 #define SZ 1
00313 #define INIT init_trans_1_GLushort_raw
00314 #define DEST_4F trans_1_GLushort_4f_raw
00315 #define DEST_4FN trans_1_GLushort_4fn_raw
00316 #define DEST_1UB trans_1_GLushort_1ub_raw
00317 #define DEST_1UI trans_1_GLushort_1ui_raw
00318 #include "m_trans_tmp.h"
00319 
00320 #undef SRC
00321 #undef SRC_IDX
00322 #undef TRX_3FN
00323 #undef TRX_4F
00324 #undef TRX_4FN
00325 #undef TRX_UB
00326 #undef TRX_US
00327 #undef TRX_UI
00328 
00329 
00330 /* GL_INT
00331  */
00332 #define SRC GLint
00333 #define SRC_IDX TYPE_IDX(GL_INT)
00334 #define TRX_3FN(f,n)   INT_TO_FLOAT( PTR_ELT(f,n) )
00335 #define TRX_4F(f,n)   (GLfloat)( PTR_ELT(f,n) )
00336 #define TRX_4FN(f,n)  INT_TO_FLOAT( PTR_ELT(f,n) )
00337 #define TRX_UB(ub, f,n)  ub = INT_TO_UBYTE(PTR_ELT(f,n))
00338 #define TRX_US(us, f,n)  us = INT_TO_USHORT(PTR_ELT(f,n))
00339 #define TRX_UI(f,n)  (PTR_ELT(f,n) < 0 ? 0 : (GLuint)  PTR_ELT(f,n))
00340 
00341 
00342 #define SZ 4
00343 #define INIT init_trans_4_GLint_raw
00344 #define DEST_4F trans_4_GLint_4f_raw
00345 #define DEST_4FN trans_4_GLint_4fn_raw
00346 #define DEST_4UB trans_4_GLint_4ub_raw
00347 #define DEST_4US trans_4_GLint_4us_raw
00348 #include "m_trans_tmp.h"
00349 
00350 #define SZ 3
00351 #define INIT init_trans_3_GLint_raw
00352 #define DEST_4F trans_3_GLint_4f_raw
00353 #define DEST_4FN trans_3_GLint_4fn_raw
00354 #define DEST_4UB trans_3_GLint_4ub_raw
00355 #define DEST_4US trans_3_GLint_4us_raw
00356 #define DEST_3FN trans_3_GLint_3fn_raw
00357 #include "m_trans_tmp.h"
00358 
00359 #define SZ 2
00360 #define INIT init_trans_2_GLint_raw
00361 #define DEST_4F trans_2_GLint_4f_raw
00362 #define DEST_4FN trans_2_GLint_4fn_raw
00363 #include "m_trans_tmp.h"
00364 
00365 #define SZ 1
00366 #define INIT init_trans_1_GLint_raw
00367 #define DEST_4F trans_1_GLint_4f_raw
00368 #define DEST_4FN trans_1_GLint_4fn_raw
00369 #define DEST_1UB trans_1_GLint_1ub_raw
00370 #define DEST_1UI trans_1_GLint_1ui_raw
00371 #include "m_trans_tmp.h"
00372 
00373 
00374 #undef SRC
00375 #undef SRC_IDX
00376 #undef TRX_3FN
00377 #undef TRX_4F
00378 #undef TRX_4FN
00379 #undef TRX_UB
00380 #undef TRX_US
00381 #undef TRX_UI
00382 
00383 
00384 /* GL_UNSIGNED_INT
00385  */
00386 #define SRC GLuint
00387 #define SRC_IDX TYPE_IDX(GL_UNSIGNED_INT)
00388 #define TRX_3FN(f,n)   INT_TO_FLOAT( PTR_ELT(f,n) )
00389 #define TRX_4F(f,n)   (GLfloat)( PTR_ELT(f,n) )
00390 #define TRX_4FN(f,n)  UINT_TO_FLOAT( PTR_ELT(f,n) )
00391 #define TRX_UB(ub, f,n)  ub = (GLubyte) (PTR_ELT(f,n) >> 24)
00392 #define TRX_US(us, f,n)  us = (GLshort) (PTR_ELT(f,n) >> 16)
00393 #define TRX_UI(f,n)     PTR_ELT(f,n)
00394 
00395 
00396 #define SZ 4
00397 #define INIT init_trans_4_GLuint_raw
00398 #define DEST_4F trans_4_GLuint_4f_raw
00399 #define DEST_4FN trans_4_GLuint_4fn_raw
00400 #define DEST_4UB trans_4_GLuint_4ub_raw
00401 #define DEST_4US trans_4_GLuint_4us_raw
00402 #include "m_trans_tmp.h"
00403 
00404 #define SZ 3
00405 #define INIT init_trans_3_GLuint_raw
00406 #define DEST_4F trans_3_GLuint_4f_raw
00407 #define DEST_4FN trans_3_GLuint_4fn_raw
00408 #define DEST_4UB trans_3_GLuint_4ub_raw
00409 #define DEST_4US trans_3_GLuint_4us_raw
00410 #define DEST_3FN trans_3_GLuint_3fn_raw
00411 #include "m_trans_tmp.h"
00412 
00413 #define SZ 2
00414 #define INIT init_trans_2_GLuint_raw
00415 #define DEST_4F trans_2_GLuint_4f_raw
00416 #define DEST_4FN trans_2_GLuint_4fn_raw
00417 #include "m_trans_tmp.h"
00418 
00419 #define SZ 1
00420 #define INIT init_trans_1_GLuint_raw
00421 #define DEST_4F trans_1_GLuint_4f_raw
00422 #define DEST_4FN trans_1_GLuint_4fn_raw
00423 #define DEST_1UB trans_1_GLuint_1ub_raw
00424 #define DEST_1UI trans_1_GLuint_1ui_raw
00425 #include "m_trans_tmp.h"
00426 
00427 #undef SRC
00428 #undef SRC_IDX
00429 #undef TRX_3FN
00430 #undef TRX_4F
00431 #undef TRX_4FN
00432 #undef TRX_UB
00433 #undef TRX_US
00434 #undef TRX_UI
00435 
00436 
00437 /* GL_DOUBLE
00438  */
00439 #define SRC GLdouble
00440 #define SRC_IDX TYPE_IDX(GL_DOUBLE)
00441 #define TRX_3FN(f,n)   (GLfloat) PTR_ELT(f,n)
00442 #define TRX_4F(f,n)   (GLfloat) PTR_ELT(f,n)
00443 #define TRX_4FN(f,n)   (GLfloat) PTR_ELT(f,n)
00444 #define TRX_UB(ub,f,n) UNCLAMPED_FLOAT_TO_UBYTE(ub, PTR_ELT(f,n))
00445 #define TRX_US(us,f,n) UNCLAMPED_FLOAT_TO_USHORT(us, PTR_ELT(f,n))
00446 #define TRX_UI(f,n)  (GLuint) (GLint) PTR_ELT(f,n)
00447 #define TRX_1F(f,n)   (GLfloat) PTR_ELT(f,n)
00448 
00449 
00450 #define SZ 4
00451 #define INIT init_trans_4_GLdouble_raw
00452 #define DEST_4F trans_4_GLdouble_4f_raw
00453 #define DEST_4FN trans_4_GLdouble_4fn_raw
00454 #define DEST_4UB trans_4_GLdouble_4ub_raw
00455 #define DEST_4US trans_4_GLdouble_4us_raw
00456 #include "m_trans_tmp.h"
00457 
00458 #define SZ 3
00459 #define INIT init_trans_3_GLdouble_raw
00460 #define DEST_4F trans_3_GLdouble_4f_raw
00461 #define DEST_4FN trans_3_GLdouble_4fn_raw
00462 #define DEST_4UB trans_3_GLdouble_4ub_raw
00463 #define DEST_4US trans_3_GLdouble_4us_raw
00464 #define DEST_3FN trans_3_GLdouble_3fn_raw
00465 #include "m_trans_tmp.h"
00466 
00467 #define SZ 2
00468 #define INIT init_trans_2_GLdouble_raw
00469 #define DEST_4F trans_2_GLdouble_4f_raw
00470 #define DEST_4FN trans_2_GLdouble_4fn_raw
00471 #include "m_trans_tmp.h"
00472 
00473 #define SZ 1
00474 #define INIT init_trans_1_GLdouble_raw
00475 #define DEST_4F trans_1_GLdouble_4f_raw
00476 #define DEST_4FN trans_1_GLdouble_4fn_raw
00477 #define DEST_1UB trans_1_GLdouble_1ub_raw
00478 #define DEST_1UI trans_1_GLdouble_1ui_raw
00479 #define DEST_1F trans_1_GLdouble_1f_raw
00480 #include "m_trans_tmp.h"
00481 
00482 #undef SRC
00483 #undef SRC_IDX
00484 
00485 /* GL_FLOAT
00486  */
00487 #define SRC GLfloat
00488 #define SRC_IDX TYPE_IDX(GL_FLOAT)
00489 #define SZ 4
00490 #define INIT init_trans_4_GLfloat_raw
00491 #define DEST_4UB trans_4_GLfloat_4ub_raw
00492 #define DEST_4US trans_4_GLfloat_4us_raw
00493 #define DEST_4F  trans_4_GLfloat_4f_raw
00494 #define DEST_4FN  trans_4_GLfloat_4fn_raw
00495 #include "m_trans_tmp.h"
00496 
00497 #define SZ 3
00498 #define INIT init_trans_3_GLfloat_raw
00499 #define DEST_4F  trans_3_GLfloat_4f_raw
00500 #define DEST_4FN  trans_3_GLfloat_4fn_raw
00501 #define DEST_4UB trans_3_GLfloat_4ub_raw
00502 #define DEST_4US trans_3_GLfloat_4us_raw
00503 #define DEST_3FN trans_3_GLfloat_3fn_raw
00504 #include "m_trans_tmp.h"
00505 
00506 #define SZ 2
00507 #define INIT init_trans_2_GLfloat_raw
00508 #define DEST_4F trans_2_GLfloat_4f_raw
00509 #define DEST_4FN trans_2_GLfloat_4fn_raw
00510 #include "m_trans_tmp.h"
00511 
00512 #define SZ 1
00513 #define INIT init_trans_1_GLfloat_raw
00514 #define DEST_4F  trans_1_GLfloat_4f_raw
00515 #define DEST_4FN  trans_1_GLfloat_4fn_raw
00516 #define DEST_1UB trans_1_GLfloat_1ub_raw
00517 #define DEST_1UI trans_1_GLfloat_1ui_raw
00518 #define DEST_1F trans_1_GLfloat_1f_raw
00519 
00520 #include "m_trans_tmp.h"
00521 
00522 #undef SRC
00523 #undef SRC_IDX
00524 #undef TRX_3FN
00525 #undef TRX_4F
00526 #undef TRX_4FN
00527 #undef TRX_UB
00528 #undef TRX_US
00529 #undef TRX_UI
00530 
00531 
00532 static void trans_4_GLubyte_4ub_raw(GLubyte (*t)[4],
00533                     CONST void *Ptr,
00534                     GLuint stride,
00535                     ARGS )
00536 {
00537    const GLubyte *f = (GLubyte *) Ptr + SRC_START * stride;
00538    GLuint i;
00539 
00540    if (((((uintptr_t) f | (uintptr_t) stride)) & 3L) == 0L) {
00541       /* Aligned.
00542        */
00543       for (i = DST_START ; i < n ; i++, f += stride) {
00544      COPY_4UBV( t[i], f );
00545       }
00546    } else {
00547       for (i = DST_START ; i < n ; i++, f += stride) {
00548      t[i][0] = f[0];
00549      t[i][1] = f[1];
00550      t[i][2] = f[2];
00551      t[i][3] = f[3];
00552       }
00553    }
00554 }
00555 
00556 
00557 static void init_translate_raw(void)
00558 {
00559    MEMSET( TAB(_1ui), 0, sizeof(TAB(_1ui)) );
00560    MEMSET( TAB(_1ub), 0, sizeof(TAB(_1ub)) );
00561    MEMSET( TAB(_3fn),  0, sizeof(TAB(_3fn)) );
00562    MEMSET( TAB(_4ub), 0, sizeof(TAB(_4ub)) );
00563    MEMSET( TAB(_4us), 0, sizeof(TAB(_4us)) );
00564    MEMSET( TAB(_4f),  0, sizeof(TAB(_4f)) );
00565    MEMSET( TAB(_4fn),  0, sizeof(TAB(_4fn)) );
00566 
00567    init_trans_4_GLbyte_raw();
00568    init_trans_3_GLbyte_raw();
00569    init_trans_2_GLbyte_raw();
00570    init_trans_1_GLbyte_raw();
00571    init_trans_1_GLubyte_raw();
00572    init_trans_3_GLubyte_raw();
00573    init_trans_4_GLubyte_raw();
00574    init_trans_4_GLshort_raw();
00575    init_trans_3_GLshort_raw();
00576    init_trans_2_GLshort_raw();
00577    init_trans_1_GLshort_raw();
00578    init_trans_4_GLushort_raw();
00579    init_trans_3_GLushort_raw();
00580    init_trans_2_GLushort_raw();
00581    init_trans_1_GLushort_raw();
00582    init_trans_4_GLint_raw();
00583    init_trans_3_GLint_raw();
00584    init_trans_2_GLint_raw();
00585    init_trans_1_GLint_raw();
00586    init_trans_4_GLuint_raw();
00587    init_trans_3_GLuint_raw();
00588    init_trans_2_GLuint_raw();
00589    init_trans_1_GLuint_raw();
00590    init_trans_4_GLdouble_raw();
00591    init_trans_3_GLdouble_raw();
00592    init_trans_2_GLdouble_raw();
00593    init_trans_1_GLdouble_raw();
00594    init_trans_4_GLfloat_raw();
00595    init_trans_3_GLfloat_raw();
00596    init_trans_2_GLfloat_raw();
00597    init_trans_1_GLfloat_raw();
00598 
00599    TAB(_4ub)[4][TYPE_IDX(GL_UNSIGNED_BYTE)] = trans_4_GLubyte_4ub_raw;
00600 }
00601 
00602 
00603 #undef TAB
00604 #ifdef CLASS
00605 #undef CLASS
00606 #endif
00607 #undef ARGS
00608 #undef CHECK
00609 #undef SRC_START
00610 #undef DST_START
00611 #undef NEXT_F
00612 #undef NEXT_F2
00613 
00614 
00615 
00616 
00617 
00618 void _math_init_translate( void )
00619 {
00620    init_translate_raw();
00621 }
00622 
00623 
00627 void _math_trans_1f(GLfloat *to,
00628             CONST void *ptr,
00629             GLuint stride,
00630             GLenum type,
00631             GLuint start,
00632             GLuint n )
00633 {
00634    _math_trans_1f_tab[TYPE_IDX(type)]( to, ptr, stride, start, n );
00635 }
00636 
00640 void _math_trans_1ui(GLuint *to,
00641              CONST void *ptr,
00642              GLuint stride,
00643              GLenum type,
00644              GLuint start,
00645              GLuint n )
00646 {
00647    _math_trans_1ui_tab[TYPE_IDX(type)]( to, ptr, stride, start, n );
00648 }
00649 
00653 void _math_trans_1ub(GLubyte *to,
00654              CONST void *ptr,
00655              GLuint stride,
00656              GLenum type,
00657              GLuint start,
00658              GLuint n )
00659 {
00660    _math_trans_1ub_tab[TYPE_IDX(type)]( to, ptr, stride, start, n );
00661 }
00662 
00663 
00667 void _math_trans_4ub(GLubyte (*to)[4],
00668              CONST void *ptr,
00669              GLuint stride,
00670              GLenum type,
00671              GLuint size,
00672              GLuint start,
00673              GLuint n )
00674 {
00675    _math_trans_4ub_tab[size][TYPE_IDX(type)]( to, ptr, stride, start, n );
00676 }
00677 
00681 void _math_trans_4chan( GLchan (*to)[4],
00682             CONST void *ptr,
00683             GLuint stride,
00684             GLenum type,
00685             GLuint size,
00686             GLuint start,
00687             GLuint n )
00688 {
00689 #if CHAN_TYPE == GL_UNSIGNED_BYTE
00690    _math_trans_4ub( to, ptr, stride, type, size, start, n );
00691 #elif CHAN_TYPE == GL_UNSIGNED_SHORT
00692    _math_trans_4us( to, ptr, stride, type, size, start, n );
00693 #elif CHAN_TYPE == GL_FLOAT
00694    _math_trans_4fn( to, ptr, stride, type, size, start, n );
00695 #endif
00696 }
00697 
00701 void _math_trans_4us(GLushort (*to)[4],
00702              CONST void *ptr,
00703              GLuint stride,
00704              GLenum type,
00705              GLuint size,
00706              GLuint start,
00707              GLuint n )
00708 {
00709    _math_trans_4us_tab[size][TYPE_IDX(type)]( to, ptr, stride, start, n );
00710 }
00711 
00715 void _math_trans_4f(GLfloat (*to)[4],
00716             CONST void *ptr,
00717             GLuint stride,
00718             GLenum type,
00719             GLuint size,
00720             GLuint start,
00721             GLuint n )
00722 {
00723    _math_trans_4f_tab[size][TYPE_IDX(type)]( to, ptr, stride, start, n );
00724 }
00725 
00729 void _math_trans_4fn(GLfloat (*to)[4],
00730             CONST void *ptr,
00731             GLuint stride,
00732             GLenum type,
00733             GLuint size,
00734             GLuint start,
00735             GLuint n )
00736 {
00737    _math_trans_4fn_tab[size][TYPE_IDX(type)]( to, ptr, stride, start, n );
00738 }
00739 
00743 void _math_trans_3fn(GLfloat (*to)[3],
00744             CONST void *ptr,
00745             GLuint stride,
00746             GLenum type,
00747             GLuint start,
00748             GLuint n )
00749 {
00750    _math_trans_3fn_tab[TYPE_IDX(type)]( to, ptr, stride, start, n );
00751 }

Generated on Fri May 25 2012 04:18:43 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.