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.
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.4] section 3.4 page 15.
11 #ifndef INCLUDE_CONFIG_H_
12 #define INCLUDE_CONFIG_H_
20 #include "common/angleutils.h"
29 Config(D3DDISPLAYMODE displayMode, EGLint minSwapInterval, EGLint maxSwapInterval, D3DFORMAT renderTargetFormat, D3DFORMAT depthStencilFormat, EGLint multiSample, EGLint texWidth, EGLint texHeight);
32 void set(D3DDISPLAYMODE displayMode, EGLint minSwapInterval, EGLint maxSwapInterval, D3DFORMAT renderTargetFormat, D3DFORMAT depthStencilFormat, EGLint multiSample, EGLint texWidth, EGLint texHeight);
33 EGLConfig getHandle() const;
35 const D3DDISPLAYMODE mDisplayMode;
36 const D3DFORMAT mRenderTargetFormat;
37 const D3DFORMAT mDepthStencilFormat;
38 const EGLint mMultiSample;
40 EGLint mBufferSize; // Depth of the color buffer
41 EGLint mRedSize; // Bits of Red in the color buffer
42 EGLint mGreenSize; // Bits of Green in the color buffer
43 EGLint mBlueSize; // Bits of Blue in the color buffer
44 EGLint mLuminanceSize; // Bits of Luminance in the color buffer
45 EGLint mAlphaSize; // Bits of Alpha in the color buffer
46 EGLint mAlphaMaskSize; // Bits of Alpha Mask in the mask buffer
47 EGLBoolean mBindToTextureRGB; // True if bindable to RGB textures.
48 EGLBoolean mBindToTextureRGBA; // True if bindable to RGBA textures.
49 EGLenum mColorBufferType; // Color buffer type
50 EGLenum mConfigCaveat; // Any caveats for the configuration
51 EGLint mConfigID; // Unique EGLConfig identifier
52 EGLint mConformant; // Whether contexts created with this config are conformant
53 EGLint mDepthSize; // Bits of Z in the depth buffer
54 EGLint mLevel; // Frame buffer level
55 EGLBoolean mMatchNativePixmap; // Match the native pixmap format
56 EGLint mMaxPBufferWidth; // Maximum width of pbuffer
57 EGLint mMaxPBufferHeight; // Maximum height of pbuffer
58 EGLint mMaxPBufferPixels; // Maximum size of pbuffer
59 EGLint mMaxSwapInterval; // Maximum swap interval
60 EGLint mMinSwapInterval; // Minimum swap interval
61 EGLBoolean mNativeRenderable; // EGL_TRUE if native rendering APIs can render to surface
62 EGLint mNativeVisualID; // Handle of corresponding native visual
63 EGLint mNativeVisualType; // Native visual type of the associated visual
64 EGLint mRenderableType; // Which client rendering APIs are supported.
65 EGLint mSampleBuffers; // Number of multisample buffers
66 EGLint mSamples; // Number of samples per pixel
67 EGLint mStencilSize; // Bits of Stencil in the stencil buffer
68 EGLint mSurfaceType; // Which types of EGL surfaces are supported.
69 EGLenum mTransparentType; // Type of transparency supported
70 EGLint mTransparentRedValue; // Transparent red value
71 EGLint mTransparentGreenValue; // Transparent green value
72 EGLint mTransparentBlueValue; // Transparent blue value
75 // Function object used by STL sorting routines for ordering Configs according to [EGL] section 3.4.1 page 24.
79 explicit SortConfig(const EGLint *attribList);
81 bool operator()(const Config *x, const Config *y) const;
82 bool operator()(const Config &x, const Config &y) const;
85 void scanForWantedComponents(const EGLint *attribList);
86 EGLint wantedComponentsSize(const Config &config) const;
102 void add(D3DDISPLAYMODE displayMode, EGLint minSwapInterval, EGLint maxSwapInterval, D3DFORMAT renderTargetFormat, D3DFORMAT depthStencilFormat, EGLint multiSample, EGLint texWidth, EGLint texHeight);
104 bool getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint configSize, EGLint *numConfig);
105 const egl::Config *get(EGLConfig configHandle);
108 DISALLOW_COPY_AND_ASSIGN(ConfigSet);
110 typedef std::set<Config, SortConfig> Set;
111 typedef Set::iterator Iterator;
114 static const EGLint mSortAttribs[];
118 #endif // INCLUDE_CONFIG_H_