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_comparison_op(unsigned op
)
113 static inline unsigned
114 nvgl_polygon_mode(unsigned mode
)
128 static inline unsigned
129 nvgl_stencil_op(unsigned op
)
144 case GL_INCR_WRAP_EXT
:
146 case GL_DECR_WRAP_EXT
:
153 static inline unsigned
154 nvgl_primitive(unsigned prim
)
167 case GL_TRIANGLE_STRIP
:
169 case GL_TRIANGLE_FAN
:
182 static inline unsigned
183 nvgl_wrap_mode(unsigned wrap
)
188 case GL_MIRRORED_REPEAT
:
191 case GL_CLAMP_TO_EDGE
:
193 case GL_CLAMP_TO_BORDER
:
200 static inline unsigned
201 nvgl_wrap_mode_nv20(unsigned wrap
)
206 case GL_MIRRORED_REPEAT
:
210 case GL_CLAMP_TO_EDGE
:
212 case GL_CLAMP_TO_BORDER
:
215 unreachable("Bad GL texture wrap mode");
219 static inline unsigned
220 nvgl_filter_mode(unsigned filter
)
227 case GL_NEAREST_MIPMAP_NEAREST
:
229 case GL_LINEAR_MIPMAP_NEAREST
:
231 case GL_NEAREST_MIPMAP_LINEAR
:
233 case GL_LINEAR_MIPMAP_LINEAR
:
240 static inline unsigned
241 nvgl_texgen_mode(unsigned mode
)
246 case GL_OBJECT_LINEAR
:
252 case GL_REFLECTION_MAP
: