Edit

kc3-lang/angle/src/libEGL/Config.h

Branch :

  • Show log

    Commit

  • Author : alokp@chromium.org
    Date : 2010-03-22 19:33:14
    Hash : ea0e1af4
    Message : Minor reshuffling of directory structure in preparation of ESSL to GLSL compiler work. 1. Added include/GLSLANG which includes compiler API 2. Deleted src/include and moved the header files to the same directory as the corresponding source files 3. Modied include path to be relative to src/. I have only fixed paths for files I moved. We should fix it for all new files at least. It is much easier to see where an included file is coming from. I noticed that a few libGLESv2 source files include headers from libEGL project, which seems wrong. I think we should address this issue. Next step: move compiler source files to compiler/frontend and create two new projects compiler/glsl_backend and compiler/hlsl_backend. Review URL: http://codereview.appspot.com/662042 git-svn-id: https://angleproject.googlecode.com/svn/trunk@62 736b8ea6-26fd-11df-bfd4-992fa37f6226

  • src/libEGL/Config.h
  • //
    // Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
    // Use of this source code is governed by a BSD-style license that can be
    // found in the LICENSE file.
    //
    
    // Config.h: Defines the egl::Config class, describing the format, type
    // and size for an egl::Surface. Implements EGLConfig and related functionality.
    // [EGL 1.4] section 3.4 page 15.
    
    #ifndef INCLUDE_CONFIG_H_
    #define INCLUDE_CONFIG_H_
    
    #define EGLAPI
    #include <EGL/egl.h>
    #include <d3d9.h>
    
    #include <set>
    
    #include "common/angleutils.h"
    
    namespace egl
    {
    class Config
    {
      public:
        Config(D3DDISPLAYMODE displayMode, EGLint minSwapInterval, EGLint maxSwapInterval, D3DFORMAT renderTargetFormat, D3DFORMAT depthStencilFormat, EGLint multiSample);
    
        void setDefaults();
        void set(D3DDISPLAYMODE displayMode, EGLint minSwapInterval, EGLint maxSwapInterval, D3DFORMAT renderTargetFormat, D3DFORMAT depthStencilFormat, EGLint multiSample);
        EGLConfig getHandle() const;
    
        const D3DDISPLAYMODE mDisplayMode;
        const D3DFORMAT mRenderTargetFormat;
        const D3DFORMAT mDepthStencilFormat;
        const EGLint mMultiSample;
    
        EGLint mBufferSize;              // Depth of the color buffer
        EGLint mRedSize;                 // Bits of Red in the color buffer
        EGLint mGreenSize;               // Bits of Green in the color buffer
        EGLint mBlueSize;                // Bits of Blue in the color buffer
        EGLint mLuminanceSize;           // Bits of Luminance in the color buffer
        EGLint mAlphaSize;               // Bits of Alpha in the color buffer
        EGLint mAlphaMaskSize;           // Bits of Alpha Mask in the mask buffer
        EGLBoolean mBindToTextureRGB;    // True if bindable to RGB textures.
        EGLBoolean mBindToTextureRGBA;   // True if bindable to RGBA textures.
        EGLenum mColorBufferType;        // Color buffer type
        EGLenum mConfigCaveat;           // Any caveats for the configuration
        EGLint mConfigID;                // Unique EGLConfig identifier
        EGLint mConformant;              // Whether contexts created with this config are conformant
        EGLint mDepthSize;               // Bits of Z in the depth buffer
        EGLint mLevel;                   // Frame buffer level
        EGLBoolean mMatchNativePixmap;   // Match the native pixmap format
        EGLint mMaxPBufferWidth;         // Maximum width of pbuffer
        EGLint mMaxPBufferHeight;        // Maximum height of pbuffer
        EGLint mMaxPBufferPixels;        // Maximum size of pbuffer
        EGLint mMaxSwapInterval;         // Maximum swap interval
        EGLint mMinSwapInterval;         // Minimum swap interval
        EGLBoolean mNativeRenderable;    // EGL_TRUE if native rendering APIs can render to surface
        EGLint mNativeVisualID;          // Handle of corresponding native visual
        EGLint mNativeVisualType;        // Native visual type of the associated visual
        EGLint mRenderableType;          // Which client rendering APIs are supported.
        EGLint mSampleBuffers;           // Number of multisample buffers
        EGLint mSamples;                 // Number of samples per pixel
        EGLint mStencilSize;             // Bits of Stencil in the stencil buffer
        EGLint mSurfaceType;             // Which types of EGL surfaces are supported.
        EGLenum mTransparentType;        // Type of transparency supported
        EGLint mTransparentRedValue;     // Transparent red value
        EGLint mTransparentGreenValue;   // Transparent green value
        EGLint mTransparentBlueValue;    // Transparent blue value
    };
    
    // Function object used by STL sorting routines for ordering Configs according to [EGL] section 3.4.1 page 24.
    class SortConfig
    {
      public:
        explicit SortConfig(const EGLint *attribList);
    
        bool operator()(const Config *x, const Config *y) const;
        bool operator()(const Config &x, const Config &y) const;
    
      private:
        void scanForWantedComponents(const EGLint *attribList);
        EGLint wantedComponentsSize(const Config &config) const;
    
        bool mWantRed;
        bool mWantGreen;
        bool mWantBlue;
        bool mWantAlpha;
        bool mWantLuminance;
    };
    
    class ConfigSet
    {
      public:
        ConfigSet();
    
        void add(D3DDISPLAYMODE displayMode, EGLint minSwapInterval, EGLint maxSwapInterval, D3DFORMAT renderTargetFormat, D3DFORMAT depthStencilFormat, EGLint multiSample);
        void enumerate();
        size_t size() const;
        bool getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint configSize, EGLint *numConfig);
        const egl::Config *get(EGLConfig configHandle);
    
        typedef std::set<Config, SortConfig> Set;
        typedef Set::iterator Iterator;
        Set mSet;
    
      private:
        DISALLOW_COPY_AND_ASSIGN(ConfigSet);
    
        static const EGLint mSortAttribs[];
    };
    }
    
    #endif   // INCLUDE_CONFIG_H_