gfx/angle/src/common/angleutils.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/angle/src/common/angleutils.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,56 @@
     1.4 +//
     1.5 +// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
     1.6 +// Use of this source code is governed by a BSD-style license that can be
     1.7 +// found in the LICENSE file.
     1.8 +//
     1.9 +
    1.10 +// angleutils.h: Common ANGLE utilities.
    1.11 +
    1.12 +#ifndef COMMON_ANGLEUTILS_H_
    1.13 +#define COMMON_ANGLEUTILS_H_
    1.14 +
    1.15 +#include <stddef.h>
    1.16 +
    1.17 +// A macro to disallow the copy constructor and operator= functions
    1.18 +// This must be used in the private: declarations for a class
    1.19 +#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
    1.20 +  TypeName(const TypeName&);               \
    1.21 +  void operator=(const TypeName&)
    1.22 +
    1.23 +template <typename T, unsigned int N>
    1.24 +inline unsigned int ArraySize(T(&)[N])
    1.25 +{
    1.26 +    return N;
    1.27 +}
    1.28 +
    1.29 +template <typename T, unsigned int N>
    1.30 +void SafeRelease(T (&resourceBlock)[N])
    1.31 +{
    1.32 +    for (unsigned int i = 0; i < N; i++)
    1.33 +    {
    1.34 +        SafeRelease(resourceBlock[i]);
    1.35 +    }
    1.36 +}
    1.37 +
    1.38 +template <typename T>
    1.39 +void SafeRelease(T& resource)
    1.40 +{
    1.41 +    if (resource)
    1.42 +    {
    1.43 +        resource->Release();
    1.44 +        resource = NULL;
    1.45 +    }
    1.46 +}
    1.47 +
    1.48 +#if defined(_MSC_VER)
    1.49 +#define snprintf _snprintf
    1.50 +#endif
    1.51 +
    1.52 +#define VENDOR_ID_AMD 0x1002
    1.53 +#define VENDOR_ID_INTEL 0x8086
    1.54 +#define VENDOR_ID_NVIDIA 0x10DE
    1.55 +
    1.56 +#define GL_BGRA4_ANGLEX 0x6ABC
    1.57 +#define GL_BGR5_A1_ANGLEX 0x6ABD
    1.58 +
    1.59 +#endif // COMMON_ANGLEUTILS_H_

mercurial