1 /**************************************************************************
3 * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 **************************************************************************/
29 #include "main/glheader.h"
30 #include "main/context.h"
31 #include "main/macros.h"
32 #include "main/enums.h"
33 #include "main/colormac.h"
36 #include "intel_screen.h"
37 #include "intel_context.h"
40 intel_translate_shadow_compare_func(GLenum func
)
44 return COMPAREFUNC_ALWAYS
;
46 return COMPAREFUNC_LEQUAL
;
48 return COMPAREFUNC_LESS
;
50 return COMPAREFUNC_GEQUAL
;
52 return COMPAREFUNC_GREATER
;
54 return COMPAREFUNC_EQUAL
;
56 return COMPAREFUNC_NOTEQUAL
;
58 return COMPAREFUNC_NEVER
;
61 fprintf(stderr
, "Unknown value in %s: %x\n", __FUNCTION__
, func
);
62 return COMPAREFUNC_NEVER
;
66 intel_translate_compare_func(GLenum func
)
70 return COMPAREFUNC_NEVER
;
72 return COMPAREFUNC_LESS
;
74 return COMPAREFUNC_LEQUAL
;
76 return COMPAREFUNC_GREATER
;
78 return COMPAREFUNC_GEQUAL
;
80 return COMPAREFUNC_NOTEQUAL
;
82 return COMPAREFUNC_EQUAL
;
84 return COMPAREFUNC_ALWAYS
;
87 fprintf(stderr
, "Unknown value in %s: %x\n", __FUNCTION__
, func
);
88 return COMPAREFUNC_ALWAYS
;
92 intel_translate_stencil_op(GLenum op
)
96 return STENCILOP_KEEP
;
98 return STENCILOP_ZERO
;
100 return STENCILOP_REPLACE
;
102 return STENCILOP_INCRSAT
;
104 return STENCILOP_DECRSAT
;
106 return STENCILOP_INCR
;
108 return STENCILOP_DECR
;
110 return STENCILOP_INVERT
;
112 return STENCILOP_ZERO
;
117 intel_translate_blend_factor(GLenum factor
)
121 return BLENDFACT_ZERO
;
123 return BLENDFACT_SRC_ALPHA
;
125 return BLENDFACT_ONE
;
127 return BLENDFACT_SRC_COLR
;
128 case GL_ONE_MINUS_SRC_COLOR
:
129 return BLENDFACT_INV_SRC_COLR
;
131 return BLENDFACT_DST_COLR
;
132 case GL_ONE_MINUS_DST_COLOR
:
133 return BLENDFACT_INV_DST_COLR
;
134 case GL_ONE_MINUS_SRC_ALPHA
:
135 return BLENDFACT_INV_SRC_ALPHA
;
137 return BLENDFACT_DST_ALPHA
;
138 case GL_ONE_MINUS_DST_ALPHA
:
139 return BLENDFACT_INV_DST_ALPHA
;
140 case GL_SRC_ALPHA_SATURATE
:
141 return BLENDFACT_SRC_ALPHA_SATURATE
;
142 case GL_CONSTANT_COLOR
:
143 return BLENDFACT_CONST_COLOR
;
144 case GL_ONE_MINUS_CONSTANT_COLOR
:
145 return BLENDFACT_INV_CONST_COLOR
;
146 case GL_CONSTANT_ALPHA
:
147 return BLENDFACT_CONST_ALPHA
;
148 case GL_ONE_MINUS_CONSTANT_ALPHA
:
149 return BLENDFACT_INV_CONST_ALPHA
;
152 fprintf(stderr
, "Unknown value in %s: %x\n", __FUNCTION__
, factor
);
153 return BLENDFACT_ZERO
;
157 intel_translate_logic_op(GLenum opcode
)
161 return LOGICOP_CLEAR
;
165 return LOGICOP_AND_RVRSE
;
168 case GL_COPY_INVERTED
:
169 return LOGICOP_COPY_INV
;
170 case GL_AND_INVERTED
:
171 return LOGICOP_AND_INV
;
179 return LOGICOP_OR_INV
;
183 return LOGICOP_EQUIV
;
187 return LOGICOP_OR_RVRSE
;
197 /* Fallback to swrast for select and feedback.
200 intelRenderMode(GLcontext
*ctx
, GLenum mode
)
202 struct intel_context
*intel
= intel_context(ctx
);
203 FALLBACK(intel
, INTEL_FALLBACK_RENDERMODE
, (mode
!= GL_RENDER
));
208 intelInitStateFuncs(struct dd_function_table
*functions
)
210 functions
->RenderMode
= intelRenderMode
;