2 * Copyright (C) 2007-2010 The Nouveau Project.
5 * Permission is hereby granted, free of charge, to any person obtaining
6 * a copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sublicense, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
13 * The above copyright notice and this permission notice (including the
14 * next paragraph) shall be included in all copies or substantial
15 * portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
21 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 #ifndef __NOUVEAU_GLDEFS_H__
28 #define __NOUVEAU_GLDEFS_H__
30 static inline unsigned
31 nvgl_blend_func(unsigned func
)
40 case GL_ONE_MINUS_SRC_COLOR
:
44 case GL_ONE_MINUS_SRC_ALPHA
:
48 case GL_ONE_MINUS_DST_ALPHA
:
52 case GL_ONE_MINUS_DST_COLOR
:
54 case GL_SRC_ALPHA_SATURATE
:
56 case GL_CONSTANT_COLOR
:
58 case GL_ONE_MINUS_CONSTANT_COLOR
:
60 case GL_CONSTANT_ALPHA
:
62 case GL_ONE_MINUS_CONSTANT_ALPHA
:
69 static inline unsigned
70 nvgl_blend_eqn(unsigned eqn
)
79 case GL_FUNC_SUBTRACT
:
81 case GL_FUNC_REVERSE_SUBTRACT
:
88 static inline unsigned
89 nvgl_logicop_func(unsigned func
)
98 case GL_COPY_INVERTED
:
129 static inline unsigned
130 nvgl_comparison_op(unsigned op
)
154 static inline unsigned
155 nvgl_polygon_mode(unsigned mode
)
169 static inline unsigned
170 nvgl_stencil_op(unsigned op
)
185 case GL_INCR_WRAP_EXT
:
187 case GL_DECR_WRAP_EXT
:
194 static inline unsigned
195 nvgl_primitive(unsigned prim
)
208 case GL_TRIANGLE_STRIP
:
210 case GL_TRIANGLE_FAN
:
223 static inline unsigned
224 nvgl_wrap_mode(unsigned wrap
)
229 case GL_MIRRORED_REPEAT
:
232 case GL_CLAMP_TO_EDGE
:
234 case GL_CLAMP_TO_BORDER
:
241 static inline unsigned
242 nvgl_wrap_mode_nv20(unsigned wrap
)
247 case GL_MIRRORED_REPEAT
:
251 case GL_CLAMP_TO_EDGE
:
253 case GL_CLAMP_TO_BORDER
:
256 unreachable("Bad GL texture wrap mode");
260 static inline unsigned
261 nvgl_filter_mode(unsigned filter
)
268 case GL_NEAREST_MIPMAP_NEAREST
:
270 case GL_LINEAR_MIPMAP_NEAREST
:
272 case GL_NEAREST_MIPMAP_LINEAR
:
274 case GL_LINEAR_MIPMAP_LINEAR
:
281 static inline unsigned
282 nvgl_texgen_mode(unsigned mode
)
287 case GL_OBJECT_LINEAR
:
293 case GL_REFLECTION_MAP
: