2 * Copyright 2010 Red Hat Inc.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * on the rights to use, copy, modify, merge, publish, distribute, sub
8 * license, and/or sell copies of the Software, and to permit persons to whom
9 * the Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
19 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
21 * USE OR OTHER DEALINGS IN THE SOFTWARE. */
23 #ifndef R600_STATE_INLINES_H
24 #define R600_STATE_INLINES_H
28 static INLINE
uint32_t r600_translate_blend_function(int blend_func
)
32 return R600_BLEND_FCN_ADD
;
33 case PIPE_BLEND_SUBTRACT
:
34 return R600_BLEND_FCN_SUBTRACT
;
35 case PIPE_BLEND_REVERSE_SUBTRACT
:
36 return R600_BLEND_FCN_RSUB
;
38 return R600_BLEND_FCN_MIN
;
40 return R600_BLEND_FCN_MAX
;
42 fprintf(stderr
, "r600: Unknown blend function %d\n", blend_func
);
49 static INLINE
uint32_t r600_translate_blend_factor(int blend_fact
)
52 case PIPE_BLENDFACTOR_ONE
:
53 return R600_BLEND_ZERO
;
54 case PIPE_BLENDFACTOR_SRC_COLOR
:
55 return R600_BLEND_SRC_COLOR
;
56 case PIPE_BLENDFACTOR_SRC_ALPHA
:
57 return R600_BLEND_SRC_ALPHA
;
58 case PIPE_BLENDFACTOR_DST_ALPHA
:
59 return R600_BLEND_DST_ALPHA
;
60 case PIPE_BLENDFACTOR_DST_COLOR
:
61 return R600_BLEND_DST_COLOR
;
62 case PIPE_BLENDFACTOR_SRC_ALPHA_SATURATE
:
63 return R600_BLEND_SRC_ALPHA_SATURATE
;
64 case PIPE_BLENDFACTOR_CONST_COLOR
:
65 return R600_BLEND_CONST_COLOR
;
66 case PIPE_BLENDFACTOR_CONST_ALPHA
:
67 return R600_BLEND_CONST_ALPHA
;
68 case PIPE_BLENDFACTOR_ZERO
:
69 return R600_BLEND_ZERO
;
70 case PIPE_BLENDFACTOR_INV_SRC_COLOR
:
71 return R600_BLEND_ONE_MINUS_SRC_COLOR
;
72 case PIPE_BLENDFACTOR_INV_SRC_ALPHA
:
73 return R600_BLEND_ONE_MINUS_SRC_ALPHA
;
74 case PIPE_BLENDFACTOR_INV_DST_ALPHA
:
75 return R600_BLEND_ONE_MINUS_DST_ALPHA
;
76 case PIPE_BLENDFACTOR_INV_DST_COLOR
:
77 return R600_BLEND_ONE_MINUS_DST_COLOR
;
78 case PIPE_BLENDFACTOR_INV_CONST_COLOR
:
79 return R600_BLEND_ONE_MINUS_CONST_COLOR
;
80 case PIPE_BLENDFACTOR_INV_CONST_ALPHA
:
81 return R600_BLEND_ONE_MINUS_CONST_ALPHA
;
83 case PIPE_BLENDFACTOR_SRC1_COLOR
:
84 return R600_BLEND_SRC1_COLOR
;
85 case PIPE_BLENDFACTOR_SRC1_ALPHA
:
86 return R600_BLEND_SRC1_ALPHA
;
87 case PIPE_BLENDFACTOR_INV_SRC1_COLOR
:
88 return R600_BLEND_INV_SRC1_COLOR
;
89 case PIPE_BLENDFACTOR_INV_SRC1_ALPHA
:
90 return R600_BLEND_INV_SRC1_ALPHA
;
92 fprintf(stderr
, "r600: Implementation error: "
93 "Bad blend factor %d not supported!\n", blend_fact
);
100 static INLINE
uint32_t r600_translate_stencil_op(int s_op
)
103 case PIPE_STENCIL_OP_KEEP
:
105 case PIPE_STENCIL_OP_ZERO
:
107 case PIPE_STENCIL_OP_REPLACE
:
108 return R600_ZS_REPLACE
;
109 case PIPE_STENCIL_OP_INCR
:
111 case PIPE_STENCIL_OP_DECR
:
113 case PIPE_STENCIL_OP_INCR_WRAP
:
114 return R600_ZS_INCR_WRAP
;
115 case PIPE_STENCIL_OP_DECR_WRAP
:
116 return R600_ZS_DECR_WRAP
;
117 case PIPE_STENCIL_OP_INVERT
:
118 return R600_ZS_INVERT
;
120 fprintf(stderr
, "r600: Unknown stencil op %d", s_op
);
127 /* translates straight */
128 static INLINE
uint32_t r600_translate_ds_func(int func
)