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"
38 #include "intel_regions.h"
39 #include "swrast/swrast.h"
42 intel_translate_shadow_compare_func(GLenum func
)
46 return COMPAREFUNC_ALWAYS
;
48 return COMPAREFUNC_LEQUAL
;
50 return COMPAREFUNC_LESS
;
52 return COMPAREFUNC_GEQUAL
;
54 return COMPAREFUNC_GREATER
;
56 return COMPAREFUNC_EQUAL
;
58 return COMPAREFUNC_NOTEQUAL
;
60 return COMPAREFUNC_NEVER
;
63 fprintf(stderr
, "Unknown value in %s: %x\n", __FUNCTION__
, func
);
64 return COMPAREFUNC_NEVER
;
68 intel_translate_compare_func(GLenum func
)
72 return COMPAREFUNC_NEVER
;
74 return COMPAREFUNC_LESS
;
76 return COMPAREFUNC_LEQUAL
;
78 return COMPAREFUNC_GREATER
;
80 return COMPAREFUNC_GEQUAL
;
82 return COMPAREFUNC_NOTEQUAL
;
84 return COMPAREFUNC_EQUAL
;
86 return COMPAREFUNC_ALWAYS
;
89 fprintf(stderr
, "Unknown value in %s: %x\n", __FUNCTION__
, func
);
90 return COMPAREFUNC_ALWAYS
;
94 intel_translate_stencil_op(GLenum op
)
98 return STENCILOP_KEEP
;
100 return STENCILOP_ZERO
;
102 return STENCILOP_REPLACE
;
104 return STENCILOP_INCRSAT
;
106 return STENCILOP_DECRSAT
;
108 return STENCILOP_INCR
;
110 return STENCILOP_DECR
;
112 return STENCILOP_INVERT
;
114 return STENCILOP_ZERO
;
119 intel_translate_blend_factor(GLenum factor
)
123 return BLENDFACT_ZERO
;
125 return BLENDFACT_SRC_ALPHA
;
127 return BLENDFACT_ONE
;
129 return BLENDFACT_SRC_COLR
;
130 case GL_ONE_MINUS_SRC_COLOR
:
131 return BLENDFACT_INV_SRC_COLR
;
133 return BLENDFACT_DST_COLR
;
134 case GL_ONE_MINUS_DST_COLOR
:
135 return BLENDFACT_INV_DST_COLR
;
136 case GL_ONE_MINUS_SRC_ALPHA
:
137 return BLENDFACT_INV_SRC_ALPHA
;
139 return BLENDFACT_DST_ALPHA
;
140 case GL_ONE_MINUS_DST_ALPHA
:
141 return BLENDFACT_INV_DST_ALPHA
;
142 case GL_SRC_ALPHA_SATURATE
:
143 return BLENDFACT_SRC_ALPHA_SATURATE
;
144 case GL_CONSTANT_COLOR
:
145 return BLENDFACT_CONST_COLOR
;
146 case GL_ONE_MINUS_CONSTANT_COLOR
:
147 return BLENDFACT_INV_CONST_COLOR
;
148 case GL_CONSTANT_ALPHA
:
149 return BLENDFACT_CONST_ALPHA
;
150 case GL_ONE_MINUS_CONSTANT_ALPHA
:
151 return BLENDFACT_INV_CONST_ALPHA
;
154 fprintf(stderr
, "Unknown value in %s: %x\n", __FUNCTION__
, factor
);
155 return BLENDFACT_ZERO
;
159 intel_translate_logic_op(GLenum opcode
)
163 return LOGICOP_CLEAR
;
167 return LOGICOP_AND_RVRSE
;
170 case GL_COPY_INVERTED
:
171 return LOGICOP_COPY_INV
;
172 case GL_AND_INVERTED
:
173 return LOGICOP_AND_INV
;
181 return LOGICOP_OR_INV
;
185 return LOGICOP_EQUIV
;
189 return LOGICOP_OR_RVRSE
;
199 /* Fallback to swrast for select and feedback.
202 intelRenderMode(GLcontext
*ctx
, GLenum mode
)
204 struct intel_context
*intel
= intel_context(ctx
);
205 FALLBACK(intel
, INTEL_FALLBACK_RENDERMODE
, (mode
!= GL_RENDER
));
210 intelInitStateFuncs(struct dd_function_table
*functions
)
212 functions
->RenderMode
= intelRenderMode
;