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: // Config.h: Defines the egl::Config class, describing the format, type michael@0: // and size for an egl::Surface. Implements EGLConfig and related functionality. michael@0: // [EGL 1.4] section 3.4 page 15. michael@0: michael@0: #ifndef INCLUDE_CONFIG_H_ michael@0: #define INCLUDE_CONFIG_H_ michael@0: michael@0: #define EGLAPI michael@0: #include michael@0: michael@0: #include michael@0: michael@0: #include "libGLESv2/renderer/Renderer.h" michael@0: #include "common/angleutils.h" michael@0: michael@0: namespace egl michael@0: { michael@0: class Display; michael@0: michael@0: class Config michael@0: { michael@0: public: michael@0: Config(rx::ConfigDesc desc, EGLint minSwapInterval, EGLint maxSwapInterval, EGLint texWidth, EGLint texHeight); michael@0: michael@0: EGLConfig getHandle() const; michael@0: michael@0: const GLenum mRenderTargetFormat; michael@0: const GLenum mDepthStencilFormat; michael@0: const GLint mMultiSample; michael@0: michael@0: EGLint mBufferSize; // Depth of the color buffer michael@0: EGLint mRedSize; // Bits of Red in the color buffer michael@0: EGLint mGreenSize; // Bits of Green in the color buffer michael@0: EGLint mBlueSize; // Bits of Blue in the color buffer michael@0: EGLint mLuminanceSize; // Bits of Luminance in the color buffer michael@0: EGLint mAlphaSize; // Bits of Alpha in the color buffer michael@0: EGLint mAlphaMaskSize; // Bits of Alpha Mask in the mask buffer michael@0: EGLBoolean mBindToTextureRGB; // True if bindable to RGB textures. michael@0: EGLBoolean mBindToTextureRGBA; // True if bindable to RGBA textures. michael@0: EGLenum mColorBufferType; // Color buffer type michael@0: EGLenum mConfigCaveat; // Any caveats for the configuration michael@0: EGLint mConfigID; // Unique EGLConfig identifier michael@0: EGLint mConformant; // Whether contexts created with this config are conformant michael@0: EGLint mDepthSize; // Bits of Z in the depth buffer michael@0: EGLint mLevel; // Frame buffer level michael@0: EGLBoolean mMatchNativePixmap; // Match the native pixmap format michael@0: EGLint mMaxPBufferWidth; // Maximum width of pbuffer michael@0: EGLint mMaxPBufferHeight; // Maximum height of pbuffer michael@0: EGLint mMaxPBufferPixels; // Maximum size of pbuffer michael@0: EGLint mMaxSwapInterval; // Maximum swap interval michael@0: EGLint mMinSwapInterval; // Minimum swap interval michael@0: EGLBoolean mNativeRenderable; // EGL_TRUE if native rendering APIs can render to surface michael@0: EGLint mNativeVisualID; // Handle of corresponding native visual michael@0: EGLint mNativeVisualType; // Native visual type of the associated visual michael@0: EGLint mRenderableType; // Which client rendering APIs are supported. michael@0: EGLint mSampleBuffers; // Number of multisample buffers michael@0: EGLint mSamples; // Number of samples per pixel michael@0: EGLint mStencilSize; // Bits of Stencil in the stencil buffer michael@0: EGLint mSurfaceType; // Which types of EGL surfaces are supported. michael@0: EGLenum mTransparentType; // Type of transparency supported michael@0: EGLint mTransparentRedValue; // Transparent red value michael@0: EGLint mTransparentGreenValue; // Transparent green value michael@0: EGLint mTransparentBlueValue; // Transparent blue value michael@0: }; michael@0: michael@0: // Function object used by STL sorting routines for ordering Configs according to [EGL] section 3.4.1 page 24. michael@0: class SortConfig michael@0: { michael@0: public: michael@0: explicit SortConfig(const EGLint *attribList); michael@0: michael@0: bool operator()(const Config *x, const Config *y) const; michael@0: bool operator()(const Config &x, const Config &y) const; michael@0: michael@0: private: michael@0: void scanForWantedComponents(const EGLint *attribList); michael@0: EGLint wantedComponentsSize(const Config &config) const; michael@0: michael@0: bool mWantRed; michael@0: bool mWantGreen; michael@0: bool mWantBlue; michael@0: bool mWantAlpha; michael@0: bool mWantLuminance; michael@0: }; michael@0: michael@0: class ConfigSet michael@0: { michael@0: friend Display; michael@0: michael@0: public: michael@0: ConfigSet(); michael@0: michael@0: void add(rx::ConfigDesc desc, EGLint minSwapInterval, EGLint maxSwapInterval, EGLint texWidth, EGLint texHeight); michael@0: size_t size() const; michael@0: bool getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint configSize, EGLint *numConfig); michael@0: const egl::Config *get(EGLConfig configHandle); michael@0: michael@0: private: michael@0: DISALLOW_COPY_AND_ASSIGN(ConfigSet); michael@0: michael@0: typedef std::set Set; michael@0: typedef Set::iterator Iterator; michael@0: Set mSet; michael@0: michael@0: static const EGLint mSortAttribs[]; michael@0: }; michael@0: } michael@0: michael@0: #endif // INCLUDE_CONFIG_H_