1 /*************************************************************************/ /*!
3 @Title Global 3D types for use by IMG APIs
4 @Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
5 @Description Defines 3D types for use by IMG APIs
6 @License Dual MIT/GPLv2
8 The contents of this file are subject to the MIT license as set out below.
10 Permission is hereby granted, free of charge, to any person obtaining a copy
11 of this software and associated documentation files (the "Software"), to deal
12 in the Software without restriction, including without limitation the rights
13 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14 copies of the Software, and to permit persons to whom the Software is
15 furnished to do so, subject to the following conditions:
17 The above copyright notice and this permission notice shall be included in
18 all copies or substantial portions of the Software.
20 Alternatively, the contents of this file may be used under the terms of
21 the GNU General Public License Version 2 ("GPL") in which case the provisions
22 of GPL are applicable instead of those above.
24 If you wish to allow use of your version of this file only under the terms of
25 GPL, and not to allow others to use your version of this file under the terms
26 of the MIT license, indicate your decision by deleting the provisions above
27 and replace them with the notice and other provisions required by GPL as set
28 out in the file called "GPL-COPYING" included in this distribution. If you do
29 not delete the provisions above, a recipient may use your version of this file
30 under the terms of either the MIT license or GPL.
32 This License is also included in this distribution in the file called
35 EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) THE SOFTWARE IS
36 PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
37 BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
38 PURPOSE AND NONINFRINGEMENT; AND (B) IN NO EVENT SHALL THE AUTHORS OR
39 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
40 IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
41 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
42 */ /**************************************************************************/
44 #ifndef __IMG_3DTYPES_H__
45 #define __IMG_3DTYPES_H__
48 * Comparison functions
49 * This comparison function is defined as:
51 * A is a reference value, e.g., incoming depth etc.
52 * B is the sample value, e.g., value in depth buffer.
54 typedef enum _IMG_COMPFUNC_
56 IMG_COMPFUNC_NEVER, /**< The comparison never succeeds */
57 IMG_COMPFUNC_LESS, /**< The comparison is a less-than operation */
58 IMG_COMPFUNC_EQUAL, /**< The comparison is an equal-to operation */
59 IMG_COMPFUNC_LESS_EQUAL, /**< The comparison is a less-than or equal-to
61 IMG_COMPFUNC_GREATER, /**< The comparison is a greater-than operation
63 IMG_COMPFUNC_NOT_EQUAL, /**< The comparison is a no-equal-to operation
65 IMG_COMPFUNC_GREATER_EQUAL, /**< The comparison is a greater-than or
67 IMG_COMPFUNC_ALWAYS, /**< The comparison always succeeds */
71 * Stencil op functions
73 typedef enum _IMG_STENCILOP_
75 IMG_STENCILOP_KEEP, /**< Keep original value */
76 IMG_STENCILOP_ZERO, /**< Set stencil to 0 */
77 IMG_STENCILOP_REPLACE, /**< Replace stencil entry */
78 IMG_STENCILOP_INCR_SAT, /**< Increment stencil entry, clamping to max */
79 IMG_STENCILOP_DECR_SAT, /**< Decrement stencil entry, clamping to zero */
80 IMG_STENCILOP_INVERT, /**< Invert bits in stencil entry */
81 IMG_STENCILOP_INCR, /**< Increment stencil entry,
82 wrapping if necessary */
83 IMG_STENCILOP_DECR, /**< Decrement stencil entry,
84 wrapping if necessary */
88 * Memory layout enumeration.
89 * Defines how pixels are layed out within a surface.
91 typedef enum _IMG_MEMLAYOUT_
93 IMG_MEMLAYOUT_STRIDED, /**< Resource is strided, one row at a time */
94 IMG_MEMLAYOUT_TWIDDLED, /**< Resource is 2D twiddled, classic style */
95 IMG_MEMLAYOUT_3DTWIDDLED, /**< Resource is 3D twiddled, classic style */
96 IMG_MEMLAYOUT_TILED, /**< Resource is tiled, tiling config specified elsewhere. */
97 IMG_MEMLAYOUT_PAGETILED, /**< Resource is pagetiled */
101 * Alpha blending allows colours and textures on one surface
102 * to be blended with transparancy onto another surface.
103 * These definitions apply to both source and destination blending
106 typedef enum _IMG_BLEND_
108 IMG_BLEND_ZERO = 0, /**< Blend factor is (0,0,0,0) */
109 IMG_BLEND_ONE, /**< Blend factor is (1,1,1,1) */
110 IMG_BLEND_SRC_COLOUR, /**< Blend factor is the source colour */
111 IMG_BLEND_INV_SRC_COLOUR, /**< Blend factor is the inverted source colour
113 IMG_BLEND_SRC_ALPHA, /**< Blend factor is the source alpha */
114 IMG_BLEND_INV_SRC_ALPHA, /**< Blend factor is the inverted source alpha
115 (i.e. 1-src_alpha) */
116 IMG_BLEND_DEST_ALPHA, /**< Blend factor is the destination alpha */
117 IMG_BLEND_INV_DEST_ALPHA, /**< Blend factor is the inverted destination
119 IMG_BLEND_DEST_COLOUR, /**< Blend factor is the destination colour */
120 IMG_BLEND_INV_DEST_COLOUR, /**< Blend factor is the inverted destination
122 IMG_BLEND_SRC_ALPHASAT, /**< Blend factor is the alpha saturation (the
123 minimum of (Src alpha,
124 1 - destination alpha)) */
125 IMG_BLEND_BLEND_FACTOR, /**< Blend factor is a constant */
126 IMG_BLEND_INVBLEND_FACTOR, /**< Blend factor is a constant (inverted)*/
127 IMG_BLEND_SRC1_COLOUR, /**< Blend factor is the colour outputted from
129 IMG_BLEND_INV_SRC1_COLOUR, /**< Blend factor is the inverted colour
130 outputted from the pixel shader */
131 IMG_BLEND_SRC1_ALPHA, /**< Blend factor is the alpha outputted from
133 IMG_BLEND_INV_SRC1_ALPHA /**< Blend factor is the inverted alpha
134 outputted from the pixel shader */
138 * The arithmetic operation to perform when blending
140 typedef enum _IMG_BLENDOP_
142 IMG_BLENDOP_ADD = 0, /**< Result = (Source + Destination) */
143 IMG_BLENDOP_SUBTRACT, /**< Result = (Source - Destination) */
144 IMG_BLENDOP_REV_SUBTRACT, /**< Result = (Destination - Source) */
145 IMG_BLENDOP_MIN, /**< Result = min (Source, Destination) */
146 IMG_BLENDOP_MAX /**< Result = max (Source, Destination) */
150 * Logical operation to perform when logic ops are enabled
152 typedef enum _IMG_LOGICOP_
154 IMG_LOGICOP_CLEAR = 0, /**< Result = 0 */
155 IMG_LOGICOP_SET, /**< Result = -1 */
156 IMG_LOGICOP_COPY, /**< Result = Source */
157 IMG_LOGICOP_COPY_INVERTED, /**< Result = ~Source */
158 IMG_LOGICOP_NOOP, /**< Result = Destination */
159 IMG_LOGICOP_INVERT, /**< Result = ~Destination */
160 IMG_LOGICOP_AND, /**< Result = Source & Destination */
161 IMG_LOGICOP_NAND, /**< Result = ~(Source & Destination) */
162 IMG_LOGICOP_OR, /**< Result = Source | Destination */
163 IMG_LOGICOP_NOR, /**< Result = ~(Source | Destination) */
164 IMG_LOGICOP_XOR, /**< Result = Source ^ Destination */
165 IMG_LOGICOP_EQUIV, /**< Result = ~(Source ^ Destination) */
166 IMG_LOGICOP_AND_REVERSE, /**< Result = Source & ~Destination */
167 IMG_LOGICOP_AND_INVERTED, /**< Result = ~Source & Destination */
168 IMG_LOGICOP_OR_REVERSE, /**< Result = Source | ~Destination */
169 IMG_LOGICOP_OR_INVERTED /**< Result = ~Source | Destination */
173 * Type of fog blending supported
175 typedef enum _IMG_FOGMODE_
177 IMG_FOGMODE_NONE, /**< No fog blending - fog calculations are
178 * based on the value output from the vertex phase */
179 IMG_FOGMODE_LINEAR, /**< Linear interpolation */
180 IMG_FOGMODE_EXP, /**< Exponential */
181 IMG_FOGMODE_EXP2, /**< Exponential squaring */
187 typedef enum _IMG_FILTER_
189 IMG_FILTER_DONTCARE, /**< Any filtering mode is acceptable */
190 IMG_FILTER_POINT, /**< Point filtering */
191 IMG_FILTER_LINEAR, /**< Bi-linear filtering */
192 IMG_FILTER_BICUBIC, /**< Bi-cubic filtering */
196 * Addressing modes for textures
198 typedef enum _IMG_ADDRESSMODE_
200 IMG_ADDRESSMODE_REPEAT, /**< Texture repeats conintuously */
201 IMG_ADDRESSMODE_FLIP, /**< Texture flips on odd integer part */
202 IMG_ADDRESSMODE_CLAMP, /**< Texture clamped at 0 or 1 */
203 IMG_ADDRESSMODE_FLIPCLAMP, /**< Flipped once, then clampe */
204 IMG_ADDRESSMODE_CLAMPBORDER,
205 IMG_ADDRESSMODE_OGL_CLAMP,
206 IMG_ADDRESSMODE_OVG_TILEFILL,
207 IMG_ADDRESSMODE_DONTCARE,
211 * Culling based on winding order of triangle.
213 typedef enum _IMG_CULLMODE_
215 IMG_CULLMODE_NONE, /**< Don't cull */
216 IMG_CULLMODE_FRONTFACING, /**< Front facing triangles */
217 IMG_CULLMODE_BACKFACING, /**< Back facing triangles */
223 typedef enum _IMG_ROTATION_
225 IMG_ROTATION_0DEG = 0,
226 IMG_ROTATION_90DEG = 1,
227 IMG_ROTATION_180DEG = 2,
228 IMG_ROTATION_270DEG = 3,
229 IMG_ROTATION_FLIP_Y = 4
233 #endif /* __IMG_3DTYPES_H__ */
234 /******************************************************************************
235 End of file (img_3dtypes.h)
236 ******************************************************************************/