2 * Copyright 2003 VMware, Inc.
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * 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 portions
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
21 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 #include "main/context.h"
27 #include "main/macros.h"
28 #include "main/enums.h"
31 #include "intel_screen.h"
32 #include "brw_context.h"
33 #include "brw_defines.h"
36 intel_translate_shadow_compare_func(GLenum func
)
38 /* GL specifies the result of shadow comparisons as:
39 * 1 if ref <op> texel,
43 * 0 if texel <op> ref,
46 * So, these look a bit strange because there's both a negation
47 * and swapping of the arguments involved.
51 return BRW_COMPAREFUNCTION_ALWAYS
;
53 return BRW_COMPAREFUNCTION_LEQUAL
;
55 return BRW_COMPAREFUNCTION_LESS
;
57 return BRW_COMPAREFUNCTION_GEQUAL
;
59 return BRW_COMPAREFUNCTION_GREATER
;
61 return BRW_COMPAREFUNCTION_EQUAL
;
63 return BRW_COMPAREFUNCTION_NOTEQUAL
;
65 return BRW_COMPAREFUNCTION_NEVER
;
68 unreachable("Invalid shadow comparison function.");
72 intel_translate_compare_func(GLenum func
)
76 return BRW_COMPAREFUNCTION_NEVER
;
78 return BRW_COMPAREFUNCTION_LESS
;
80 return BRW_COMPAREFUNCTION_LEQUAL
;
82 return BRW_COMPAREFUNCTION_GREATER
;
84 return BRW_COMPAREFUNCTION_GEQUAL
;
86 return BRW_COMPAREFUNCTION_NOTEQUAL
;
88 return BRW_COMPAREFUNCTION_EQUAL
;
90 return BRW_COMPAREFUNCTION_ALWAYS
;
93 unreachable("Invalid comparison function.");
97 intel_translate_stencil_op(GLenum op
)
101 return BRW_STENCILOP_KEEP
;
103 return BRW_STENCILOP_ZERO
;
105 return BRW_STENCILOP_REPLACE
;
107 return BRW_STENCILOP_INCRSAT
;
109 return BRW_STENCILOP_DECRSAT
;
111 return BRW_STENCILOP_INCR
;
113 return BRW_STENCILOP_DECR
;
115 return BRW_STENCILOP_INVERT
;
117 return BRW_STENCILOP_ZERO
;
122 intel_translate_logic_op(GLenum opcode
)
126 return BRW_LOGICOPFUNCTION_CLEAR
;
128 return BRW_LOGICOPFUNCTION_AND
;
130 return BRW_LOGICOPFUNCTION_AND_REVERSE
;
132 return BRW_LOGICOPFUNCTION_COPY
;
133 case GL_COPY_INVERTED
:
134 return BRW_LOGICOPFUNCTION_COPY_INVERTED
;
135 case GL_AND_INVERTED
:
136 return BRW_LOGICOPFUNCTION_AND_INVERTED
;
138 return BRW_LOGICOPFUNCTION_NOOP
;
140 return BRW_LOGICOPFUNCTION_XOR
;
142 return BRW_LOGICOPFUNCTION_OR
;
144 return BRW_LOGICOPFUNCTION_OR_INVERTED
;
146 return BRW_LOGICOPFUNCTION_NOR
;
148 return BRW_LOGICOPFUNCTION_EQUIV
;
150 return BRW_LOGICOPFUNCTION_INVERT
;
152 return BRW_LOGICOPFUNCTION_OR_REVERSE
;
154 return BRW_LOGICOPFUNCTION_NAND
;
156 return BRW_LOGICOPFUNCTION_SET
;
158 return BRW_LOGICOPFUNCTION_SET
;