dri2: Add createContextAttribs entry point for DRISW version 3
[mesa.git] / src / mesa / drivers / dri / common / spantmp_common.h
1 /*
2 * Copyright 2000-2001 VA Linux Systems, Inc.
3 * (C) Copyright IBM Corporation 2004
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 "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * on the rights to use, copy, modify, merge, publish, distribute, sub
10 * license, and/or sell copies of the Software, and to permit persons to whom
11 * the Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice (including the next
14 * paragraph) shall be included in all copies or substantial portions of the
15 * Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
20 * VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
21 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
22 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
23 * USE OR OTHER DEALINGS IN THE SOFTWARE.
24 */
25
26 /**
27 * \file spantmp_common.h
28 *
29 * common macros for span read / write functions to be used in the depth,
30 * stencil and pixel span templates.
31 */
32
33 #ifndef HW_WRITE_LOCK
34 #define HW_WRITE_LOCK() HW_LOCK()
35 #endif
36
37 #ifndef HW_WRITE_UNLOCK
38 #define HW_WRITE_UNLOCK() HW_UNLOCK()
39 #endif
40
41 #ifndef HW_READ_LOCK
42 #define HW_READ_LOCK() HW_LOCK()
43 #endif
44
45 #ifndef HW_READ_UNLOCK
46 #define HW_READ_UNLOCK() HW_UNLOCK()
47 #endif
48
49 #ifndef HW_CLIPLOOP
50 #define HW_CLIPLOOP() \
51 do { \
52 int minx = 0; \
53 int miny = 0; \
54 int maxx = dPriv->w; \
55 int maxy = dPriv->h;
56 #endif
57
58 #ifndef HW_ENDCLIPLOOP
59 #define HW_ENDCLIPLOOP() \
60 } while (0)
61 #endif
62
63 #ifndef CLIPPIXEL
64 #define CLIPPIXEL( _x, _y ) \
65 ((_x >= minx) && (_x < maxx) && (_y >= miny) && (_y < maxy))
66 #endif
67
68 #ifndef CLIPSPAN
69 #define CLIPSPAN( _x, _y, _n, _x1, _n1, _i ) \
70 if ( _y < miny || _y >= maxy /*|| _x + n < minx || _x >=maxx*/ ) { \
71 _n1 = 0, _x1 = x; \
72 } else { \
73 _n1 = _n; \
74 _x1 = _x; \
75 if ( _x1 < minx ) _i += (minx-_x1), n1 -= (minx-_x1), _x1 = minx; \
76 if ( _x1 + _n1 >= maxx ) n1 -= (_x1 + n1 - maxx); \
77 }
78 #endif