gfx/angle/src/common/angleutils.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 //
     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 //
     7 // angleutils.h: Common ANGLE utilities.
     9 #ifndef COMMON_ANGLEUTILS_H_
    10 #define COMMON_ANGLEUTILS_H_
    12 #include <stddef.h>
    14 // A macro to disallow the copy constructor and operator= functions
    15 // This must be used in the private: declarations for a class
    16 #define DISALLOW_COPY_AND_ASSIGN(TypeName) \
    17   TypeName(const TypeName&);               \
    18   void operator=(const TypeName&)
    20 template <typename T, unsigned int N>
    21 inline unsigned int ArraySize(T(&)[N])
    22 {
    23     return N;
    24 }
    26 template <typename T, unsigned int N>
    27 void SafeRelease(T (&resourceBlock)[N])
    28 {
    29     for (unsigned int i = 0; i < N; i++)
    30     {
    31         SafeRelease(resourceBlock[i]);
    32     }
    33 }
    35 template <typename T>
    36 void SafeRelease(T& resource)
    37 {
    38     if (resource)
    39     {
    40         resource->Release();
    41         resource = NULL;
    42     }
    43 }
    45 #if defined(_MSC_VER)
    46 #define snprintf _snprintf
    47 #endif
    49 #define VENDOR_ID_AMD 0x1002
    50 #define VENDOR_ID_INTEL 0x8086
    51 #define VENDOR_ID_NVIDIA 0x10DE
    53 #define GL_BGRA4_ANGLEX 0x6ABC
    54 #define GL_BGR5_A1_ANGLEX 0x6ABD
    56 #endif // COMMON_ANGLEUTILS_H_

mercurial