5 * Copyright (C) 2004 Daniel Borca All Rights Reserved.
7 * this is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
12 * this is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with GNU Make; see the file COPYING. If not, write to
19 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
23 #ifndef INTERNAL_H_included
24 #define INTERNAL_H_included
26 /*****************************************************************************\
28 \*****************************************************************************/
31 #define TAPI __declspec(dllexport)
32 #define TAPIENTRY /*__stdcall*/
39 /*****************************************************************************\
40 * 64bit types on 32bit machine
41 \*****************************************************************************/
43 #if (defined(__GNUC__) && !defined(__cplusplus)) || defined(__MSC__)
45 typedef unsigned long long qword;
47 #define Q_MOV32(a, b) a = b
48 #define Q_OR32(a, b) a |= b
49 #define Q_SHL(a, c) a <<= c
57 #define Q_MOV32(a, b) a.lo = b
58 #define Q_OR32(a, b) a.lo |= b
62 a.hi = a.lo << ((c) - 32); \
65 a.hi = (a.hi << (c)) | (a.lo >> (32 - (c)));\
70 #endif /* !__GNUC__ */
73 /*****************************************************************************\
75 \*****************************************************************************/
82 /*****************************************************************************\
84 \*****************************************************************************/
86 #define F(i) (float)1 /* can be used to obtain an oblong metric: 0.30 / 0.59 / 0.11 */
87 #define SAFECDOT 1 /* for paranoids */
89 #define MAKEIVEC(NV, NC, IV, B, V0, V1) \
91 /* compute interpolation vector */\
95 for (i = 0; i < NC; i++) { \
96 IV[i] = (V1[i] - V0[i]) * F(i);\
97 d2 += IV[i] * IV[i]; \
99 rd2 = (float)NV / d2; \
101 for (i = 0; i < NC; i++) { \
103 B -= IV[i] * V0[i]; \
106 B = B * rd2 + 0.5F; \
109 #define CALCCDOT(TEXEL, NV, NC, IV, B, V)\
112 for (i = 0; i < NC; i++) { \
113 dot += V[i] * IV[i]; \
115 TEXEL = (int)(dot + B); \
119 } else if (TEXEL > NV) { \
126 /*****************************************************************************\
128 \*****************************************************************************/
131 _mesa_upscale_teximage2d (unsigned int inWidth, unsigned int inHeight,
132 unsigned int outWidth, unsigned int outHeight,
134 const byte *src, int srcRowStride,
135 unsigned char *dest);