michael@0: // michael@0: // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved. michael@0: // Use of this source code is governed by a BSD-style license that can be michael@0: // found in the LICENSE file. michael@0: // michael@0: michael@0: // angleutils.h: Common ANGLE utilities. michael@0: michael@0: #ifndef COMMON_ANGLEUTILS_H_ michael@0: #define COMMON_ANGLEUTILS_H_ michael@0: michael@0: #include michael@0: michael@0: // A macro to disallow the copy constructor and operator= functions michael@0: // This must be used in the private: declarations for a class michael@0: #define DISALLOW_COPY_AND_ASSIGN(TypeName) \ michael@0: TypeName(const TypeName&); \ michael@0: void operator=(const TypeName&) michael@0: michael@0: template michael@0: inline unsigned int ArraySize(T(&)[N]) michael@0: { michael@0: return N; michael@0: } michael@0: michael@0: template michael@0: void SafeRelease(T (&resourceBlock)[N]) michael@0: { michael@0: for (unsigned int i = 0; i < N; i++) michael@0: { michael@0: SafeRelease(resourceBlock[i]); michael@0: } michael@0: } michael@0: michael@0: template michael@0: void SafeRelease(T& resource) michael@0: { michael@0: if (resource) michael@0: { michael@0: resource->Release(); michael@0: resource = NULL; michael@0: } michael@0: } michael@0: michael@0: #if defined(_MSC_VER) michael@0: #define snprintf _snprintf michael@0: #endif michael@0: michael@0: #define VENDOR_ID_AMD 0x1002 michael@0: #define VENDOR_ID_INTEL 0x8086 michael@0: #define VENDOR_ID_NVIDIA 0x10DE michael@0: michael@0: #define GL_BGRA4_ANGLEX 0x6ABC michael@0: #define GL_BGR5_A1_ANGLEX 0x6ABD michael@0: michael@0: #endif // COMMON_ANGLEUTILS_H_