llvmpipe: remove some old sampler support structs
[mesa.git] / src / gallium / drivers / llvmpipe / lp_bld_blend_logicop.c
1 /**************************************************************************
2 *
3 * Copyright 2009 VMware, Inc.
4 * All Rights Reserved.
5 *
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:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
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 VMWARE 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.
25 *
26 **************************************************************************/
27
28
29 /**
30 * @file
31 * Blend LLVM IR generation -- logic ops.
32 *
33 * @author Jose Fonseca <jfonseca@vmware.com>
34 */
35
36
37 #include "pipe/p_state.h"
38
39 #include "lp_bld_blend.h"
40
41
42 LLVMValueRef
43 lp_build_logicop(LLVMBuilderRef builder,
44 unsigned logicop_func,
45 LLVMValueRef src,
46 LLVMValueRef dst)
47 {
48 LLVMTypeRef type;
49 LLVMValueRef res;
50
51 type = LLVMTypeOf(src);
52
53 switch (logicop_func) {
54 case PIPE_LOGICOP_CLEAR:
55 res = LLVMConstNull(type);
56 break;
57 case PIPE_LOGICOP_NOR:
58 res = LLVMBuildNot(builder, LLVMBuildOr(builder, src, dst, ""), "");
59 break;
60 case PIPE_LOGICOP_AND_INVERTED:
61 res = LLVMBuildAnd(builder, LLVMBuildNot(builder, src, ""), dst, "");
62 break;
63 case PIPE_LOGICOP_COPY_INVERTED:
64 res = LLVMBuildNot(builder, src, "");
65 break;
66 case PIPE_LOGICOP_AND_REVERSE:
67 res = LLVMBuildAnd(builder, src, LLVMBuildNot(builder, dst, ""), "");
68 break;
69 case PIPE_LOGICOP_INVERT:
70 res = LLVMBuildNot(builder, dst, "");
71 break;
72 case PIPE_LOGICOP_XOR:
73 res = LLVMBuildXor(builder, src, dst, "");
74 break;
75 case PIPE_LOGICOP_NAND:
76 res = LLVMBuildNot(builder, LLVMBuildAnd(builder, src, dst, ""), "");
77 break;
78 case PIPE_LOGICOP_AND:
79 res = LLVMBuildAnd(builder, src, dst, "");
80 break;
81 case PIPE_LOGICOP_EQUIV:
82 res = LLVMBuildNot(builder, LLVMBuildXor(builder, src, dst, ""), "");
83 break;
84 case PIPE_LOGICOP_NOOP:
85 res = dst;
86 break;
87 case PIPE_LOGICOP_OR_INVERTED:
88 res = LLVMBuildOr(builder, LLVMBuildNot(builder, src, ""), dst, "");
89 break;
90 case PIPE_LOGICOP_COPY:
91 res = src;
92 break;
93 case PIPE_LOGICOP_OR_REVERSE:
94 res = LLVMBuildOr(builder, src, LLVMBuildNot(builder, dst, ""), "");
95 break;
96 case PIPE_LOGICOP_OR:
97 res = LLVMBuildOr(builder, src, dst, "");
98 break;
99 case PIPE_LOGICOP_SET:
100 res = LLVMConstAllOnes(type);
101 break;
102 default:
103 assert(0);
104 res = src;
105 }
106
107 return res;
108 }