1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/angle/src/libEGL/Config.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,115 @@ 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 +// Config.h: Defines the egl::Config class, describing the format, type 1.11 +// and size for an egl::Surface. Implements EGLConfig and related functionality. 1.12 +// [EGL 1.4] section 3.4 page 15. 1.13 + 1.14 +#ifndef INCLUDE_CONFIG_H_ 1.15 +#define INCLUDE_CONFIG_H_ 1.16 + 1.17 +#define EGLAPI 1.18 +#include <EGL/egl.h> 1.19 + 1.20 +#include <set> 1.21 + 1.22 +#include "libGLESv2/renderer/Renderer.h" 1.23 +#include "common/angleutils.h" 1.24 + 1.25 +namespace egl 1.26 +{ 1.27 +class Display; 1.28 + 1.29 +class Config 1.30 +{ 1.31 + public: 1.32 + Config(rx::ConfigDesc desc, EGLint minSwapInterval, EGLint maxSwapInterval, EGLint texWidth, EGLint texHeight); 1.33 + 1.34 + EGLConfig getHandle() const; 1.35 + 1.36 + const GLenum mRenderTargetFormat; 1.37 + const GLenum mDepthStencilFormat; 1.38 + const GLint mMultiSample; 1.39 + 1.40 + EGLint mBufferSize; // Depth of the color buffer 1.41 + EGLint mRedSize; // Bits of Red in the color buffer 1.42 + EGLint mGreenSize; // Bits of Green in the color buffer 1.43 + EGLint mBlueSize; // Bits of Blue in the color buffer 1.44 + EGLint mLuminanceSize; // Bits of Luminance in the color buffer 1.45 + EGLint mAlphaSize; // Bits of Alpha in the color buffer 1.46 + EGLint mAlphaMaskSize; // Bits of Alpha Mask in the mask buffer 1.47 + EGLBoolean mBindToTextureRGB; // True if bindable to RGB textures. 1.48 + EGLBoolean mBindToTextureRGBA; // True if bindable to RGBA textures. 1.49 + EGLenum mColorBufferType; // Color buffer type 1.50 + EGLenum mConfigCaveat; // Any caveats for the configuration 1.51 + EGLint mConfigID; // Unique EGLConfig identifier 1.52 + EGLint mConformant; // Whether contexts created with this config are conformant 1.53 + EGLint mDepthSize; // Bits of Z in the depth buffer 1.54 + EGLint mLevel; // Frame buffer level 1.55 + EGLBoolean mMatchNativePixmap; // Match the native pixmap format 1.56 + EGLint mMaxPBufferWidth; // Maximum width of pbuffer 1.57 + EGLint mMaxPBufferHeight; // Maximum height of pbuffer 1.58 + EGLint mMaxPBufferPixels; // Maximum size of pbuffer 1.59 + EGLint mMaxSwapInterval; // Maximum swap interval 1.60 + EGLint mMinSwapInterval; // Minimum swap interval 1.61 + EGLBoolean mNativeRenderable; // EGL_TRUE if native rendering APIs can render to surface 1.62 + EGLint mNativeVisualID; // Handle of corresponding native visual 1.63 + EGLint mNativeVisualType; // Native visual type of the associated visual 1.64 + EGLint mRenderableType; // Which client rendering APIs are supported. 1.65 + EGLint mSampleBuffers; // Number of multisample buffers 1.66 + EGLint mSamples; // Number of samples per pixel 1.67 + EGLint mStencilSize; // Bits of Stencil in the stencil buffer 1.68 + EGLint mSurfaceType; // Which types of EGL surfaces are supported. 1.69 + EGLenum mTransparentType; // Type of transparency supported 1.70 + EGLint mTransparentRedValue; // Transparent red value 1.71 + EGLint mTransparentGreenValue; // Transparent green value 1.72 + EGLint mTransparentBlueValue; // Transparent blue value 1.73 +}; 1.74 + 1.75 +// Function object used by STL sorting routines for ordering Configs according to [EGL] section 3.4.1 page 24. 1.76 +class SortConfig 1.77 +{ 1.78 + public: 1.79 + explicit SortConfig(const EGLint *attribList); 1.80 + 1.81 + bool operator()(const Config *x, const Config *y) const; 1.82 + bool operator()(const Config &x, const Config &y) const; 1.83 + 1.84 + private: 1.85 + void scanForWantedComponents(const EGLint *attribList); 1.86 + EGLint wantedComponentsSize(const Config &config) const; 1.87 + 1.88 + bool mWantRed; 1.89 + bool mWantGreen; 1.90 + bool mWantBlue; 1.91 + bool mWantAlpha; 1.92 + bool mWantLuminance; 1.93 +}; 1.94 + 1.95 +class ConfigSet 1.96 +{ 1.97 + friend Display; 1.98 + 1.99 + public: 1.100 + ConfigSet(); 1.101 + 1.102 + void add(rx::ConfigDesc desc, EGLint minSwapInterval, EGLint maxSwapInterval, EGLint texWidth, EGLint texHeight); 1.103 + size_t size() const; 1.104 + bool getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint configSize, EGLint *numConfig); 1.105 + const egl::Config *get(EGLConfig configHandle); 1.106 + 1.107 + private: 1.108 + DISALLOW_COPY_AND_ASSIGN(ConfigSet); 1.109 + 1.110 + typedef std::set<Config, SortConfig> Set; 1.111 + typedef Set::iterator Iterator; 1.112 + Set mSet; 1.113 + 1.114 + static const EGLint mSortAttribs[]; 1.115 +}; 1.116 +} 1.117 + 1.118 +#endif // INCLUDE_CONFIG_H_