tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

Config.h (4779B)


      1 //
      2 // Copyright 2002 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 // Config.h: Defines the egl::Config class, describing the format, type
      8 // and size for an egl::Surface. Implements EGLConfig and related functionality.
      9 // [EGL 1.5] section 3.4 page 19.
     10 
     11 #ifndef INCLUDE_CONFIG_H_
     12 #define INCLUDE_CONFIG_H_
     13 
     14 #include "libANGLE/AttributeMap.h"
     15 
     16 #include "common/angleutils.h"
     17 
     18 #include <EGL/egl.h>
     19 #include <GLES2/gl2.h>
     20 
     21 #include <map>
     22 #include <vector>
     23 
     24 namespace egl
     25 {
     26 
     27 struct Config
     28 {
     29    Config();
     30    ~Config();
     31    Config(const Config &other);
     32    Config &operator=(const Config &other);
     33 
     34    GLenum renderTargetFormat;  // TODO(geofflang): remove this
     35    GLenum depthStencilFormat;  // TODO(geofflang): remove this
     36 
     37    EGLint bufferSize;             // Depth of the color buffer
     38    EGLint redSize;                // Bits of Red in the color buffer
     39    EGLint greenSize;              // Bits of Green in the color buffer
     40    EGLint blueSize;               // Bits of Blue in the color buffer
     41    EGLint luminanceSize;          // Bits of Luminance in the color buffer
     42    EGLint alphaSize;              // Bits of Alpha in the color buffer
     43    EGLint alphaMaskSize;          // Bits of Alpha Mask in the mask buffer
     44    EGLBoolean bindToTextureRGB;   // True if bindable to RGB textures.
     45    EGLBoolean bindToTextureRGBA;  // True if bindable to RGBA textures.
     46    EGLenum bindToTextureTarget;   // Which texture target should be used for pbuffers
     47    EGLenum colorBufferType;       // Color buffer type
     48    EGLenum configCaveat;          // Any caveats for the configuration
     49    EGLint configID;               // Unique EGLConfig identifier
     50    EGLint conformant;             // Whether contexts created with this config are conformant
     51    EGLint depthSize;              // Bits of Z in the depth buffer
     52    EGLint level;                  // Frame buffer level
     53    EGLBoolean matchNativePixmap;  // Match the native pixmap format
     54    EGLint maxPBufferWidth;        // Maximum width of pbuffer
     55    EGLint maxPBufferHeight;       // Maximum height of pbuffer
     56    EGLint maxPBufferPixels;       // Maximum size of pbuffer
     57    EGLint maxSwapInterval;        // Maximum swap interval
     58    EGLint minSwapInterval;        // Minimum swap interval
     59    EGLBoolean nativeRenderable;   // EGL_TRUE if native rendering APIs can render to surface
     60    EGLint nativeVisualID;         // Handle of corresponding native visual
     61    EGLint nativeVisualType;       // Native visual type of the associated visual
     62    EGLint renderableType;         // Which client rendering APIs are supported.
     63    EGLint sampleBuffers;          // Number of multisample buffers
     64    EGLint samples;                // Number of samples per pixel
     65    EGLint stencilSize;            // Bits of Stencil in the stencil buffer
     66    EGLint surfaceType;            // Which types of EGL surfaces are supported.
     67    EGLenum transparentType;       // Type of transparency supported
     68    EGLint transparentRedValue;    // Transparent red value
     69    EGLint transparentGreenValue;  // Transparent green value
     70    EGLint transparentBlueValue;   // Transparent blue value
     71    EGLint optimalOrientation;     // Optimal window surface orientation
     72    EGLenum colorComponentType;    // Color component type
     73    EGLBoolean recordable;         // EGL_TRUE if a surface can support recording on Android
     74    EGLBoolean framebufferTarget;  // EGL_TRUE if the config supports rendering to a ANativeWindow
     75                                   // for which the buffers are passed to the HWComposer HAL as a
     76                                   // framebuffer target layer.
     77    EGLBoolean yInverted;  // True if the drawable's framebuffer is y-inverted.  This can be used to
     78                           // determine if y-inverted texture coordinates need to be used when
     79                           // texturing from this drawable when it is bound to a texture target.
     80    EGLint matchFormat;    // LockSurface match format.
     81 };
     82 
     83 class ConfigSet
     84 {
     85  private:
     86    typedef std::map<EGLint, Config> ConfigMap;
     87 
     88  public:
     89    ConfigSet();
     90    ConfigSet(const ConfigSet &other);
     91    ~ConfigSet();
     92    ConfigSet &operator=(const ConfigSet &other);
     93 
     94    EGLint add(const Config &config);
     95    const Config &get(EGLint id) const;
     96 
     97    void clear();
     98 
     99    size_t size() const;
    100 
    101    bool contains(const Config *config) const;
    102 
    103    // Filter configurations based on the table in [EGL 1.5] section 3.4.1.2 page 29
    104    std::vector<const Config *> filter(const AttributeMap &attributeMap) const;
    105 
    106    ConfigMap::iterator begin();
    107    ConfigMap::iterator end();
    108 
    109  private:
    110    ConfigMap mConfigs;
    111 };
    112 
    113 }  // namespace egl
    114 
    115 #endif  // INCLUDE_CONFIG_H_