blob: 31ac55927917c012824b450f7632f9bdbf90e2eb [file] [log] [blame]
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +00001//
2// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
3// Use of this source code is governed by a BSD-style license that can be
4// found in the LICENSE file.
5//
6
7// angleutils.h: Common ANGLE utilities.
8
daniel@transgaming.combbf56f72010-04-20 18:52:13 +00009#ifndef COMMON_ANGLEUTILS_H_
10#define COMMON_ANGLEUTILS_H_
11
daniel@transgaming.com4f39fd92010-03-08 20:26:45 +000012// A macro to disallow the copy constructor and operator= functions
13// This must be used in the private: declarations for a class
14#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
15 TypeName(const TypeName&); \
16 void operator=(const TypeName&)
17
shannon.woods@transgaming.com6d792572013-02-28 23:07:25 +000018template <typename T, unsigned int N>
19inline unsigned int ArraySize(T(&)[N])
20{
21 return N;
22}
23
shannon.woods%transgaming.com@gtempaccount.com96224772013-04-13 03:30:18 +000024template <typename T, unsigned int N>
25void SafeRelease(T (&resourceBlock)[N])
26{
27 for (unsigned int i = 0; i < N; i++)
28 {
29 SafeRelease(resourceBlock[i]);
30 }
31}
32
33template <typename T>
34void SafeRelease(T& resource)
35{
36 if (resource)
37 {
38 resource->Release();
39 resource = NULL;
40 }
41}
42
alokp@chromium.org79fb1012012-04-26 21:07:39 +000043#if defined(_MSC_VER)
44#define snprintf _snprintf
45#endif
46
apatrick@chromium.org85e44192012-08-17 20:58:01 +000047#define VENDOR_ID_AMD 0x1002
48#define VENDOR_ID_INTEL 0x8086
49#define VENDOR_ID_NVIDIA 0x10DE
50
daniel@transgaming.com106e1f72012-10-31 18:38:36 +000051#define GL_BGRA4_ANGLEX 0x6ABC
52#define GL_BGR5_A1_ANGLEX 0x6ABD
53
daniel@transgaming.combbf56f72010-04-20 18:52:13 +000054#endif // COMMON_ANGLEUTILS_H_