//1// Copyright 2002 The ANGLE Project Authors. All rights reserved.2// Use of this source code is governed by a BSD-style license that can be3// found in the LICENSE file.4//56// Config.h: Defines the egl::Config class, describing the format, type7// and size for an egl::Surface. Implements EGLConfig and related functionality.8// [EGL 1.5] section 3.4 page 19.910#ifndef INCLUDE_CONFIG_H_11#define INCLUDE_CONFIG_H_1213#include "libANGLE/AttributeMap.h"1415#include "common/angleutils.h"1617#include <EGL/egl.h>18#include <GLES2/gl2.h>1920#include <map>21#include <vector>2223namespace egl24{2526struct Config27{28Config();29~Config();30Config(const Config &other);31Config &operator=(const Config &other);3233GLenum renderTargetFormat; // TODO(geofflang): remove this34GLenum depthStencilFormat; // TODO(geofflang): remove this3536EGLint bufferSize; // Depth of the color buffer37EGLint redSize; // Bits of Red in the color buffer38EGLint greenSize; // Bits of Green in the color buffer39EGLint blueSize; // Bits of Blue in the color buffer40EGLint luminanceSize; // Bits of Luminance in the color buffer41EGLint alphaSize; // Bits of Alpha in the color buffer42EGLint alphaMaskSize; // Bits of Alpha Mask in the mask buffer43EGLBoolean bindToTextureRGB; // True if bindable to RGB textures.44EGLBoolean bindToTextureRGBA; // True if bindable to RGBA textures.45EGLenum bindToTextureTarget; // Which texture target should be used for pbuffers46EGLenum colorBufferType; // Color buffer type47EGLenum configCaveat; // Any caveats for the configuration48EGLint configID; // Unique EGLConfig identifier49EGLint conformant; // Whether contexts created with this config are conformant50EGLint depthSize; // Bits of Z in the depth buffer51EGLint level; // Frame buffer level52EGLBoolean matchNativePixmap; // Match the native pixmap format53EGLint maxPBufferWidth; // Maximum width of pbuffer54EGLint maxPBufferHeight; // Maximum height of pbuffer55EGLint maxPBufferPixels; // Maximum size of pbuffer56EGLint maxSwapInterval; // Maximum swap interval57EGLint minSwapInterval; // Minimum swap interval58EGLBoolean nativeRenderable; // EGL_TRUE if native rendering APIs can render to surface59EGLint nativeVisualID; // Handle of corresponding native visual60EGLint nativeVisualType; // Native visual type of the associated visual61EGLint renderableType; // Which client rendering APIs are supported.62EGLint sampleBuffers; // Number of multisample buffers63EGLint samples; // Number of samples per pixel64EGLint stencilSize; // Bits of Stencil in the stencil buffer65EGLint surfaceType; // Which types of EGL surfaces are supported.66EGLenum transparentType; // Type of transparency supported67EGLint transparentRedValue; // Transparent red value68EGLint transparentGreenValue; // Transparent green value69EGLint transparentBlueValue; // Transparent blue value70EGLint optimalOrientation; // Optimal window surface orientation71EGLenum colorComponentType; // Color component type72EGLBoolean recordable; // EGL_TRUE if a surface can support recording on Android73EGLBoolean framebufferTarget; // EGL_TRUE if the config supports rendering to a ANativeWindow74// for which the buffers are passed to the HWComposer HAL as a75// framebuffer target layer.76EGLBoolean yInverted; // True if the drawable's framebuffer is y-inverted. This can be used to77// determine if y-inverted texture coordinates need to be used when78// texturing from this drawable when it is bound to a texture target.79};8081class ConfigSet82{83private:84typedef std::map<EGLint, Config> ConfigMap;8586public:87ConfigSet();88ConfigSet(const ConfigSet &other);89~ConfigSet();90ConfigSet &operator=(const ConfigSet &other);9192EGLint add(const Config &config);93const Config &get(EGLint id) const;9495void clear();9697size_t size() const;9899bool contains(const Config *config) const;100101// Filter configurations based on the table in [EGL 1.5] section 3.4.1.2 page 29102std::vector<const Config *> filter(const AttributeMap &attributeMap) const;103104ConfigMap::iterator begin();105ConfigMap::iterator end();106107private:108ConfigMap mConfigs;109};110111} // namespace egl112113#endif // INCLUDE_CONFIG_H_114115116