xref: /aosp_15_r20/external/gmmlib/Source/inc/common/gfxplatform.h (revision 35ffd701415c9e32e53136d61a677a8d0a8fc4a5)
1 /*==============================================================================
2 Copyright(c) 2017 Intel Corporation
3 
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 the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 and / or sell copies of the Software, and to permit persons to whom the
9 Software is furnished to do so, subject to the following conditions:
10 
11 The above copyright notice and this permission notice shall be included
12 in all copies or substantial portions of the Software.
13 
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 OTHER DEALINGS IN THE SOFTWARE.
21 ============================================================================*/
22 
23 #ifndef __GFXPLATFORM_H__
24 #define __GFXPLATFORM_H__
25 
26 ////////////////////////////////////////////////////////////////////////
27 // ABSTRACT:
28 //                  Platform-specific constants, #defines, and
29 //                  #includes.  For the purposes of this header file,
30 //                  a platform is defined as the combination of:
31 //
32 //                    - CPU Architecture
33 //                    - C/C++ Compiler
34 ////////////////////////////////////////////////////////////////////////
35 
36 #if _MSC_VER
37 #pragma inline_depth (255)
38 #endif // _MSC_VER
39 
40 #ifndef __S_INLINE
41     #define __S_INLINE __inline
42 #endif
43 
44 #ifndef __F_INLINE
45     #ifdef _DEBUG
46         #define __F_INLINE static
47     #else
48         #define __F_INLINE static __inline
49     #endif
50 #endif
51 
52 // Component definitions for ASSERT.
53 
54 #define GFX_GMM	   (uint32_t)0x00000020
55 
56 #ifdef _DEBUG
57   #define GFX_ASSERT(component,expr)        \
58                                         {if (!(expr)) {__debugbreak();}}
59 #else
60   #define GFX_ASSERT(component,expr)
61 #endif
62 
63 //========================================================================
64 // From winnt.h
65 //
66 // C_ASSERT() can be used to perform many COMPILE-TIME assertions:
67 //            type sizes, field offsets, etc.
68 //
69 // An assertion failure results in error C2118: negative subscript.
70 //
71 // When this assertion is to be used in the middle of a code block,
72 // use it within {} - e.g. {GFX_C_ASSERT (GFX_NUM == 0);}
73 #ifndef GFX_C_ASSERT
74 #define GFX_C_ASSERT(e) typedef char GFX_C_ASSERT__[(e)?1:-1]
75 #endif
76 //========================================================================
77 // GFX_MMX_ALIGN:  Alignment boundary (in bytes) for optimal use of
78 // the MMX instruction set on IA32.
79 
80 #define GFX_MMX_ALIGN              8
81 
82 #endif // #ifndef __GFXPLATFORM_H__
83