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/glheader.h"
27 #include "main/context.h"
28 #include "main/macros.h"
29 #include "main/enums.h"
32 #include "intel_screen.h"
33 #include "brw_context.h"
34 #include "brw_defines.h"
37 intel_translate_shadow_compare_func(GLenum func
)
39 /* GL specifies the result of shadow comparisons as:
40 * 1 if ref <op> texel,
44 * 0 if texel <op> ref,
47 * So, these look a bit strange because there's both a negation
48 * and swapping of the arguments involved.
52 return BRW_COMPAREFUNCTION_ALWAYS
;
54 return BRW_COMPAREFUNCTION_LEQUAL
;
56 return BRW_COMPAREFUNCTION_LESS
;
58 return BRW_COMPAREFUNCTION_GEQUAL
;
60 return BRW_COMPAREFUNCTION_GREATER
;
62 return BRW_COMPAREFUNCTION_EQUAL
;
64 return BRW_COMPAREFUNCTION_NOTEQUAL
;
66 return BRW_COMPAREFUNCTION_NEVER
;
69 unreachable("Invalid shadow comparison function.");
73 intel_translate_compare_func(GLenum func
)
77 return BRW_COMPAREFUNCTION_NEVER
;
79 return BRW_COMPAREFUNCTION_LESS
;
81 return BRW_COMPAREFUNCTION_LEQUAL
;
83 return BRW_COMPAREFUNCTION_GREATER
;
85 return BRW_COMPAREFUNCTION_GEQUAL
;
87 return BRW_COMPAREFUNCTION_NOTEQUAL
;
89 return BRW_COMPAREFUNCTION_EQUAL
;
91 return BRW_COMPAREFUNCTION_ALWAYS
;
94 unreachable("Invalid comparison function.");
98 intel_translate_stencil_op(GLenum op
)
102 return BRW_STENCILOP_KEEP
;
104 return BRW_STENCILOP_ZERO
;
106 return BRW_STENCILOP_REPLACE
;
108 return BRW_STENCILOP_INCRSAT
;
110 return BRW_STENCILOP_DECRSAT
;
112 return BRW_STENCILOP_INCR
;
114 return BRW_STENCILOP_DECR
;
116 return BRW_STENCILOP_INVERT
;
118 return BRW_STENCILOP_ZERO
;
123 intel_translate_logic_op(GLenum opcode
)
127 return BRW_LOGICOPFUNCTION_CLEAR
;
129 return BRW_LOGICOPFUNCTION_AND
;
131 return BRW_LOGICOPFUNCTION_AND_REVERSE
;
133 return BRW_LOGICOPFUNCTION_COPY
;
134 case GL_COPY_INVERTED
:
135 return BRW_LOGICOPFUNCTION_COPY_INVERTED
;
136 case GL_AND_INVERTED
:
137 return BRW_LOGICOPFUNCTION_AND_INVERTED
;
139 return BRW_LOGICOPFUNCTION_NOOP
;
141 return BRW_LOGICOPFUNCTION_XOR
;
143 return BRW_LOGICOPFUNCTION_OR
;
145 return BRW_LOGICOPFUNCTION_OR_INVERTED
;
147 return BRW_LOGICOPFUNCTION_NOR
;
149 return BRW_LOGICOPFUNCTION_EQUIV
;
151 return BRW_LOGICOPFUNCTION_INVERT
;
153 return BRW_LOGICOPFUNCTION_OR_REVERSE
;
155 return BRW_LOGICOPFUNCTION_NAND
;
157 return BRW_LOGICOPFUNCTION_SET
;
159 return BRW_LOGICOPFUNCTION_SET
;