diff options
author | Andrew Knight <andrew.knight@intopalo.com> | 2015-04-08 17:04:36 +0300 |
---|---|---|
committer | Andrew Knight <qt@panimo.net> | 2015-04-09 10:31:12 +0000 |
commit | a218a252c4200cfe7048de81a46f7e48349084d5 (patch) | |
tree | c1a82865d97e610cd0abb3a1360408363b38205b /src/3rdparty/angle/src/libEGL | |
parent | 331ddacfca90c91c5b44484bf3c78e2aa5b85947 (diff) |
Upgrade ANGLE to 2.1~99f075dade7c
This aligns with Chromium branch 2356.
This version brings more complete OpenGL ES 3 support as well as various
bug fixes and performance improvements.
The following changes were made to earlier patches:
-0000-General-fixes-for-ANGLE-2.1
Removed. All changes are now handled elsewhere.
+0001-ANGLE-Improve-Windows-Phone-support
Consolidated remaining parts from 0009/0010.
+0002-ANGLE-Fix-compilation-with-MinGW
Remaining issues from patch 0016.
+0003-ANGLE-Fix-compilation-with-MSVC2010
Remaining issues from patch 0015.
+0004-ANGLE-Dynamically-load-D3D-compiler-from-list
Renamed from patch 0008.
+0005-ANGLE-Add-support-for-querying-platform-device
Renamed from patch 0013.
-0004-Make-it-possible-to-link-ANGLE-statically-for-single
Removed. Fixed by adding defines to project files.
-0008-ANGLE-Dynamically-load-D3D-compiler-from-a-list-or-t
Renamed to patch 0005.
-0009-ANGLE-Support-WinRT
Removed. Mostly fixed upstream; remaining parts in patch 0001.
-0010-ANGLE-Enable-D3D11-for-feature-level-9-cards
Removed. Mostly fixed upstream; remaining parts in patch 0001.
-0012-ANGLE-fix-semantic-index-lookup
Removed. Fixed upstream.
-0013-ANGLE-Add-support-for-querying-platform-device
Renamed to patch 0005.
-0014-Let-ANGLE-use-multithreaded-devices-if-necessary
Removed. No longer needed.
-0015-ANGLE-Fix-angle-d3d11-on-MSVC2010
Moved remaining parts to patch 0003.
-0016-ANGLE-Fix-compilation-with-MinGW-D3D11
Moved remaining parts to patch 0002.
-0017-ANGLE-Fix-compilation-with-D3D9
Removed. Fixed upstream.
-0018-ANGLE-Fix-releasing-textures-after-we-kill-D3D11
Removed. Fixed upstream.
-0019-ANGLE-Fix-handling-of-shader-source-with-fixed-lengt
Removed. Fixed upstream.
-0020-ANGLE-Do-not-use-std-strlen
Removed. Fixed upstream.
-0020-ANGLE-Fix-compilation-with-MSVC2013-Update4
Removed. Fixed upstream.
[ChangeLog][Third-party libraries] ANGLE was updated to Chromium branch
2356 (2.1~99f075dade7c).
Change-Id: I32ccbfe95e10986bd94be7191dfd53445ea09158
Task-number: QTBUG-44815
Task-number: QTBUG-37660
Task-number: QTBUG-44694
Task-number: QTBUG-42443
Reviewed-by: Andrew Knight <qt@panimo.net>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Diffstat (limited to 'src/3rdparty/angle/src/libEGL')
-rw-r--r-- | src/3rdparty/angle/src/libEGL/AttributeMap.cpp | 40 | ||||
-rw-r--r-- | src/3rdparty/angle/src/libEGL/AttributeMap.h | 33 | ||||
-rw-r--r-- | src/3rdparty/angle/src/libEGL/Config.cpp | 353 | ||||
-rw-r--r-- | src/3rdparty/angle/src/libEGL/Config.h | 114 | ||||
-rw-r--r-- | src/3rdparty/angle/src/libEGL/Display.cpp | 648 | ||||
-rw-r--r-- | src/3rdparty/angle/src/libEGL/Display.h | 104 | ||||
-rw-r--r-- | src/3rdparty/angle/src/libEGL/Error.cpp | 48 | ||||
-rw-r--r-- | src/3rdparty/angle/src/libEGL/Error.h | 39 | ||||
-rw-r--r-- | src/3rdparty/angle/src/libEGL/Surface.cpp | 505 | ||||
-rw-r--r-- | src/3rdparty/angle/src/libEGL/Surface.h | 120 | ||||
-rw-r--r-- | src/3rdparty/angle/src/libEGL/libEGL.cpp | 1235 | ||||
-rw-r--r-- | src/3rdparty/angle/src/libEGL/libEGL.def | 12 | ||||
-rw-r--r-- | src/3rdparty/angle/src/libEGL/libEGL.rc | 103 | ||||
-rw-r--r-- | src/3rdparty/angle/src/libEGL/libEGL_mingw32.def | 12 | ||||
-rw-r--r-- | src/3rdparty/angle/src/libEGL/libEGLd.def | 12 | ||||
-rw-r--r-- | src/3rdparty/angle/src/libEGL/main.cpp | 203 | ||||
-rw-r--r-- | src/3rdparty/angle/src/libEGL/main.h | 45 |
17 files changed, 147 insertions, 3479 deletions
diff --git a/src/3rdparty/angle/src/libEGL/AttributeMap.cpp b/src/3rdparty/angle/src/libEGL/AttributeMap.cpp deleted file mode 100644 index 28dd3d842e..0000000000 --- a/src/3rdparty/angle/src/libEGL/AttributeMap.cpp +++ /dev/null @@ -1,40 +0,0 @@ -// -// Copyright (c) 2014 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. -// - -#include "libEGL/AttributeMap.h" - -namespace egl -{ - -AttributeMap::AttributeMap() -{ -} - -AttributeMap::AttributeMap(const EGLint *attributes) -{ - for (const EGLint *curAttrib = attributes; curAttrib[0] != EGL_NONE; curAttrib += 2) - { - insert(curAttrib[0], curAttrib[1]); - } -} - -void AttributeMap::insert(EGLint key, EGLint value) -{ - mAttributes[key] = value; -} - -bool AttributeMap::contains(EGLint key) const -{ - return (mAttributes.find(key) != mAttributes.end()); -} - -EGLint AttributeMap::get(EGLint key, EGLint defaultValue) const -{ - std::map<EGLint, EGLint>::const_iterator iter = mAttributes.find(key); - return (mAttributes.find(key) != mAttributes.end()) ? iter->second : defaultValue; -} - -} diff --git a/src/3rdparty/angle/src/libEGL/AttributeMap.h b/src/3rdparty/angle/src/libEGL/AttributeMap.h deleted file mode 100644 index f2f082fe21..0000000000 --- a/src/3rdparty/angle/src/libEGL/AttributeMap.h +++ /dev/null @@ -1,33 +0,0 @@ -// -// Copyright (c) 2014 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. -// - -#ifndef LIBEGL_ATTRIBUTEMAP_H_ -#define LIBEGL_ATTRIBUTEMAP_H_ - -#include <EGL/egl.h> - -#include <map> - -namespace egl -{ - -class AttributeMap -{ - public: - AttributeMap(); - explicit AttributeMap(const EGLint *attributes); - - virtual void insert(EGLint key, EGLint value); - virtual bool contains(EGLint key) const; - virtual EGLint get(EGLint key, EGLint defaultValue) const; - - private: - std::map<EGLint, EGLint> mAttributes; -}; - -} - -#endif // LIBEGL_ATTRIBUTEMAP_H_ diff --git a/src/3rdparty/angle/src/libEGL/Config.cpp b/src/3rdparty/angle/src/libEGL/Config.cpp deleted file mode 100644 index fdc41a95f0..0000000000 --- a/src/3rdparty/angle/src/libEGL/Config.cpp +++ /dev/null @@ -1,353 +0,0 @@ -// -// 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.cpp: Implements 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. - -#include "libEGL/Config.h" - -#include <algorithm> -#include <vector> - -#include "angle_gl.h" -#include <EGL/eglext.h> - -#include "common/debug.h" - -using namespace std; - -namespace egl -{ -Config::Config(rx::ConfigDesc desc, EGLint minInterval, EGLint maxInterval, EGLint texWidth, EGLint texHeight) - : mRenderTargetFormat(desc.renderTargetFormat), mDepthStencilFormat(desc.depthStencilFormat), mMultiSample(desc.multiSample) -{ - mBindToTextureRGB = EGL_FALSE; - mBindToTextureRGBA = EGL_FALSE; - switch (desc.renderTargetFormat) - { - case GL_RGB5_A1: - mBufferSize = 16; - mRedSize = 5; - mGreenSize = 5; - mBlueSize = 5; - mAlphaSize = 1; - break; - case GL_BGR5_A1_ANGLEX: - mBufferSize = 16; - mRedSize = 5; - mGreenSize = 5; - mBlueSize = 5; - mAlphaSize = 1; - break; - case GL_RGBA8_OES: - mBufferSize = 32; - mRedSize = 8; - mGreenSize = 8; - mBlueSize = 8; - mAlphaSize = 8; - mBindToTextureRGBA = true; - break; - case GL_RGB565: - mBufferSize = 16; - mRedSize = 5; - mGreenSize = 6; - mBlueSize = 5; - mAlphaSize = 0; - break; - case GL_RGB8_OES: - mBufferSize = 32; - mRedSize = 8; - mGreenSize = 8; - mBlueSize = 8; - mAlphaSize = 0; - mBindToTextureRGB = true; - break; - case GL_BGRA8_EXT: - mBufferSize = 32; - mRedSize = 8; - mGreenSize = 8; - mBlueSize = 8; - mAlphaSize = 8; - mBindToTextureRGBA = true; - break; - default: - UNREACHABLE(); // Other formats should not be valid - } - - mLuminanceSize = 0; - mAlphaMaskSize = 0; - mColorBufferType = EGL_RGB_BUFFER; - mConfigCaveat = (desc.fastConfig) ? EGL_NONE : EGL_SLOW_CONFIG; - mConfigID = 0; - mConformant = EGL_OPENGL_ES2_BIT; - - switch (desc.depthStencilFormat) - { - case GL_NONE: - mDepthSize = 0; - mStencilSize = 0; - break; - case GL_DEPTH_COMPONENT32_OES: - mDepthSize = 32; - mStencilSize = 0; - break; - case GL_DEPTH24_STENCIL8_OES: - mDepthSize = 24; - mStencilSize = 8; - break; - case GL_DEPTH_COMPONENT24_OES: - mDepthSize = 24; - mStencilSize = 0; - break; - case GL_DEPTH_COMPONENT16: - mDepthSize = 16; - mStencilSize = 0; - break; - default: - UNREACHABLE(); - } - - mLevel = 0; - mMatchNativePixmap = EGL_NONE; - mMaxPBufferWidth = texWidth; - mMaxPBufferHeight = texHeight; - mMaxPBufferPixels = texWidth*texHeight; - mMaxSwapInterval = maxInterval; - mMinSwapInterval = minInterval; - mNativeRenderable = EGL_FALSE; - mNativeVisualID = 0; - mNativeVisualType = 0; - mRenderableType = EGL_OPENGL_ES2_BIT; - mSampleBuffers = desc.multiSample ? 1 : 0; - mSamples = desc.multiSample; - mSurfaceType = EGL_PBUFFER_BIT | EGL_WINDOW_BIT | EGL_SWAP_BEHAVIOR_PRESERVED_BIT; - mTransparentType = EGL_NONE; - mTransparentRedValue = 0; - mTransparentGreenValue = 0; - mTransparentBlueValue = 0; - - if (desc.es3Capable) - { - mRenderableType |= EGL_OPENGL_ES3_BIT_KHR; - mConformant |= EGL_OPENGL_ES3_BIT_KHR; - } -} - -EGLConfig Config::getHandle() const -{ - return (EGLConfig)(size_t)mConfigID; -} - -SortConfig::SortConfig(const EGLint *attribList) - : mWantRed(false), mWantGreen(false), mWantBlue(false), mWantAlpha(false), mWantLuminance(false) -{ - scanForWantedComponents(attribList); -} - -void SortConfig::scanForWantedComponents(const EGLint *attribList) -{ - // [EGL] section 3.4.1 page 24 - // Sorting rule #3: by larger total number of color bits, not considering - // components that are 0 or don't-care. - for (const EGLint *attr = attribList; attr[0] != EGL_NONE; attr += 2) - { - if (attr[1] != 0 && attr[1] != EGL_DONT_CARE) - { - switch (attr[0]) - { - case EGL_RED_SIZE: mWantRed = true; break; - case EGL_GREEN_SIZE: mWantGreen = true; break; - case EGL_BLUE_SIZE: mWantBlue = true; break; - case EGL_ALPHA_SIZE: mWantAlpha = true; break; - case EGL_LUMINANCE_SIZE: mWantLuminance = true; break; - } - } - } -} - -EGLint SortConfig::wantedComponentsSize(const Config &config) const -{ - EGLint total = 0; - - if (mWantRed) total += config.mRedSize; - if (mWantGreen) total += config.mGreenSize; - if (mWantBlue) total += config.mBlueSize; - if (mWantAlpha) total += config.mAlphaSize; - if (mWantLuminance) total += config.mLuminanceSize; - - return total; -} - -bool SortConfig::operator()(const Config *x, const Config *y) const -{ - return (*this)(*x, *y); -} - -bool SortConfig::operator()(const Config &x, const Config &y) const -{ - #define SORT(attribute) \ - if (x.attribute != y.attribute) \ - { \ - return x.attribute < y.attribute; \ - } - - META_ASSERT(EGL_NONE < EGL_SLOW_CONFIG && EGL_SLOW_CONFIG < EGL_NON_CONFORMANT_CONFIG); - SORT(mConfigCaveat); - - META_ASSERT(EGL_RGB_BUFFER < EGL_LUMINANCE_BUFFER); - SORT(mColorBufferType); - - // By larger total number of color bits, only considering those that are requested to be > 0. - EGLint xComponentsSize = wantedComponentsSize(x); - EGLint yComponentsSize = wantedComponentsSize(y); - if (xComponentsSize != yComponentsSize) - { - return xComponentsSize > yComponentsSize; - } - - SORT(mBufferSize); - SORT(mSampleBuffers); - SORT(mSamples); - SORT(mDepthSize); - SORT(mStencilSize); - SORT(mAlphaMaskSize); - SORT(mNativeVisualType); - SORT(mConfigID); - - #undef SORT - - return false; -} - -// We'd like to use SortConfig to also eliminate duplicate configs. -// This works as long as we never have two configs with different per-RGB-component layouts, -// but the same total. -// 5551 and 565 are different because R+G+B is different. -// 5551 and 555 are different because bufferSize is different. -const EGLint ConfigSet::mSortAttribs[] = -{ - EGL_RED_SIZE, 1, - EGL_GREEN_SIZE, 1, - EGL_BLUE_SIZE, 1, - EGL_LUMINANCE_SIZE, 1, - // BUT NOT ALPHA - EGL_NONE -}; - -ConfigSet::ConfigSet() - : mSet(SortConfig(mSortAttribs)) -{ -} - -void ConfigSet::add(rx::ConfigDesc desc, EGLint minSwapInterval, EGLint maxSwapInterval, EGLint texWidth, EGLint texHeight) -{ - Config config(desc, minSwapInterval, maxSwapInterval, texWidth, texHeight); - mSet.insert(config); -} - -size_t ConfigSet::size() const -{ - return mSet.size(); -} - -bool ConfigSet::getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint configSize, EGLint *numConfig) -{ - vector<const Config*> passed; - passed.reserve(mSet.size()); - - for (Iterator config = mSet.begin(); config != mSet.end(); config++) - { - bool match = true; - const EGLint *attribute = attribList; - - while (attribute[0] != EGL_NONE) - { - switch (attribute[0]) - { - case EGL_BUFFER_SIZE: match = config->mBufferSize >= attribute[1]; break; - case EGL_ALPHA_SIZE: match = config->mAlphaSize >= attribute[1]; break; - case EGL_BLUE_SIZE: match = config->mBlueSize >= attribute[1]; break; - case EGL_GREEN_SIZE: match = config->mGreenSize >= attribute[1]; break; - case EGL_RED_SIZE: match = config->mRedSize >= attribute[1]; break; - case EGL_DEPTH_SIZE: match = config->mDepthSize >= attribute[1]; break; - case EGL_STENCIL_SIZE: match = config->mStencilSize >= attribute[1]; break; - case EGL_CONFIG_CAVEAT: match = config->mConfigCaveat == (EGLenum) attribute[1]; break; - case EGL_CONFIG_ID: match = config->mConfigID == attribute[1]; break; - case EGL_LEVEL: match = config->mLevel >= attribute[1]; break; - case EGL_NATIVE_RENDERABLE: match = config->mNativeRenderable == (EGLBoolean) attribute[1]; break; - case EGL_NATIVE_VISUAL_TYPE: match = config->mNativeVisualType == attribute[1]; break; - case EGL_SAMPLES: match = config->mSamples >= attribute[1]; break; - case EGL_SAMPLE_BUFFERS: match = config->mSampleBuffers >= attribute[1]; break; - case EGL_SURFACE_TYPE: match = (config->mSurfaceType & attribute[1]) == attribute[1]; break; - case EGL_TRANSPARENT_TYPE: match = config->mTransparentType == (EGLenum) attribute[1]; break; - case EGL_TRANSPARENT_BLUE_VALUE: match = config->mTransparentBlueValue == attribute[1]; break; - case EGL_TRANSPARENT_GREEN_VALUE: match = config->mTransparentGreenValue == attribute[1]; break; - case EGL_TRANSPARENT_RED_VALUE: match = config->mTransparentRedValue == attribute[1]; break; - case EGL_BIND_TO_TEXTURE_RGB: match = config->mBindToTextureRGB == (EGLBoolean) attribute[1]; break; - case EGL_BIND_TO_TEXTURE_RGBA: match = config->mBindToTextureRGBA == (EGLBoolean) attribute[1]; break; - case EGL_MIN_SWAP_INTERVAL: match = config->mMinSwapInterval == attribute[1]; break; - case EGL_MAX_SWAP_INTERVAL: match = config->mMaxSwapInterval == attribute[1]; break; - case EGL_LUMINANCE_SIZE: match = config->mLuminanceSize >= attribute[1]; break; - case EGL_ALPHA_MASK_SIZE: match = config->mAlphaMaskSize >= attribute[1]; break; - case EGL_COLOR_BUFFER_TYPE: match = config->mColorBufferType == (EGLenum) attribute[1]; break; - case EGL_RENDERABLE_TYPE: match = (config->mRenderableType & attribute[1]) == attribute[1]; break; - case EGL_MATCH_NATIVE_PIXMAP: match = false; UNIMPLEMENTED(); break; - case EGL_CONFORMANT: match = (config->mConformant & attribute[1]) == attribute[1]; break; - case EGL_MAX_PBUFFER_WIDTH: match = config->mMaxPBufferWidth >= attribute[1]; break; - case EGL_MAX_PBUFFER_HEIGHT: match = config->mMaxPBufferHeight >= attribute[1]; break; - case EGL_MAX_PBUFFER_PIXELS: match = config->mMaxPBufferPixels >= attribute[1]; break; - default: - return false; - } - - if (!match) - { - break; - } - - attribute += 2; - } - - if (match) - { - passed.push_back(&*config); - } - } - - if (configs) - { - sort(passed.begin(), passed.end(), SortConfig(attribList)); - - EGLint index; - for (index = 0; index < configSize && index < static_cast<EGLint>(passed.size()); index++) - { - configs[index] = passed[index]->getHandle(); - } - - *numConfig = index; - } - else - { - *numConfig = passed.size(); - } - - return true; -} - -const egl::Config *ConfigSet::get(EGLConfig configHandle) -{ - for (Iterator config = mSet.begin(); config != mSet.end(); config++) - { - if (config->getHandle() == configHandle) - { - return &(*config); - } - } - - return NULL; -} -} diff --git a/src/3rdparty/angle/src/libEGL/Config.h b/src/3rdparty/angle/src/libEGL/Config.h deleted file mode 100644 index 98441142f4..0000000000 --- a/src/3rdparty/angle/src/libEGL/Config.h +++ /dev/null @@ -1,114 +0,0 @@ -// -// 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_ - -#include <EGL/egl.h> - -#include <set> - -#include "libGLESv2/renderer/Renderer.h" -#include "common/angleutils.h" - -namespace egl -{ -class Display; - -class Config -{ - public: - Config(rx::ConfigDesc desc, EGLint minSwapInterval, EGLint maxSwapInterval, EGLint texWidth, EGLint texHeight); - - EGLConfig getHandle() const; - - const GLenum mRenderTargetFormat; - const GLenum mDepthStencilFormat; - const GLint 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 -{ - friend Display; - - public: - ConfigSet(); - - void add(rx::ConfigDesc desc, EGLint minSwapInterval, EGLint maxSwapInterval, EGLint texWidth, EGLint texHeight); - size_t size() const; - bool getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint configSize, EGLint *numConfig); - const egl::Config *get(EGLConfig configHandle); - - private: - DISALLOW_COPY_AND_ASSIGN(ConfigSet); - - typedef std::set<Config, SortConfig> Set; - typedef Set::iterator Iterator; - Set mSet; - - static const EGLint mSortAttribs[]; -}; -} - -#endif // INCLUDE_CONFIG_H_ diff --git a/src/3rdparty/angle/src/libEGL/Display.cpp b/src/3rdparty/angle/src/libEGL/Display.cpp deleted file mode 100644 index eea93b1d87..0000000000 --- a/src/3rdparty/angle/src/libEGL/Display.cpp +++ /dev/null @@ -1,648 +0,0 @@ -// -// Copyright (c) 2002-2014 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. -// - -// Display.cpp: Implements the egl::Display class, representing the abstract -// display on which graphics are drawn. Implements EGLDisplay. -// [EGL 1.4] section 2.1.2 page 3. - -#include "libEGL/Display.h" - -#include <algorithm> -#include <map> -#include <vector> -#include <sstream> -#include <iterator> - -#include "common/debug.h" -#include "common/mathutil.h" -#include "libGLESv2/main.h" -#include "libGLESv2/Context.h" -#include "libGLESv2/renderer/SwapChain.h" - -#include "libEGL/main.h" -#include "libEGL/Surface.h" - -namespace egl -{ - -typedef std::map<EGLNativeDisplayType, Display*> DisplayMap; -static DisplayMap *GetDisplayMap() -{ - static DisplayMap displays; - return &displays; -} - -egl::Display *Display::getDisplay(EGLNativeDisplayType displayId, const AttributeMap &attribMap) -{ - Display *display = NULL; - - DisplayMap *displays = GetDisplayMap(); - DisplayMap::const_iterator iter = displays->find(displayId); - if (iter != displays->end()) - { - display = iter->second; - } - else - { - display = new egl::Display(displayId); - displays->insert(std::make_pair(displayId, display)); - } - - // Apply new attributes if the display is not initialized yet. - if (!display->isInitialized()) - { - display->setAttributes(attribMap); - } - - return display; -} - -Display::Display(EGLNativeDisplayType displayId) - : mDisplayId(displayId), - mAttributeMap(), - mRenderer(NULL) -{ -} - -Display::~Display() -{ - terminate(); - - DisplayMap *displays = GetDisplayMap(); - DisplayMap::iterator iter = displays->find(mDisplayId); - if (iter != displays->end()) - { - displays->erase(iter); - } -} - -void Display::setAttributes(const AttributeMap &attribMap) -{ - mAttributeMap = attribMap; -} - -Error Display::initialize() -{ - if (isInitialized()) - { - return Error(EGL_SUCCESS); - } - - mRenderer = glCreateRenderer(this, mDisplayId, mAttributeMap); - - if (!mRenderer) - { - terminate(); - return Error(EGL_NOT_INITIALIZED); - } - - //TODO(jmadill): should be part of caps? - EGLint minSwapInterval = mRenderer->getMinSwapInterval(); - EGLint maxSwapInterval = mRenderer->getMaxSwapInterval(); - EGLint maxTextureSize = mRenderer->getRendererCaps().max2DTextureSize; - - rx::ConfigDesc *descList; - int numConfigs = mRenderer->generateConfigs(&descList); - ConfigSet configSet; - - for (int i = 0; i < numConfigs; ++i) - { - configSet.add(descList[i], minSwapInterval, maxSwapInterval, maxTextureSize, maxTextureSize); - } - - // Give the sorted configs a unique ID and store them internally - EGLint index = 1; - for (ConfigSet::Iterator config = configSet.mSet.begin(); config != configSet.mSet.end(); config++) - { - Config configuration = *config; - configuration.mConfigID = index; - index++; - - mConfigSet.mSet.insert(configuration); - } - - mRenderer->deleteConfigs(descList); - descList = NULL; - - if (!isInitialized()) - { - terminate(); - return Error(EGL_NOT_INITIALIZED); - } - - initDisplayExtensionString(); - initVendorString(); - - return Error(EGL_SUCCESS); -} - -void Display::terminate() -{ - while (!mSurfaceSet.empty()) - { - destroySurface(*mSurfaceSet.begin()); - } - - while (!mContextSet.empty()) - { - destroyContext(*mContextSet.begin()); - } - - glDestroyRenderer(mRenderer); - mRenderer = NULL; - - mConfigSet.mSet.clear(); -} - -bool Display::getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint configSize, EGLint *numConfig) -{ - return mConfigSet.getConfigs(configs, attribList, configSize, numConfig); -} - -bool Display::getConfigAttrib(EGLConfig config, EGLint attribute, EGLint *value) -{ - const egl::Config *configuration = mConfigSet.get(config); - - switch (attribute) - { - case EGL_BUFFER_SIZE: *value = configuration->mBufferSize; break; - case EGL_ALPHA_SIZE: *value = configuration->mAlphaSize; break; - case EGL_BLUE_SIZE: *value = configuration->mBlueSize; break; - case EGL_GREEN_SIZE: *value = configuration->mGreenSize; break; - case EGL_RED_SIZE: *value = configuration->mRedSize; break; - case EGL_DEPTH_SIZE: *value = configuration->mDepthSize; break; - case EGL_STENCIL_SIZE: *value = configuration->mStencilSize; break; - case EGL_CONFIG_CAVEAT: *value = configuration->mConfigCaveat; break; - case EGL_CONFIG_ID: *value = configuration->mConfigID; break; - case EGL_LEVEL: *value = configuration->mLevel; break; - case EGL_NATIVE_RENDERABLE: *value = configuration->mNativeRenderable; break; - case EGL_NATIVE_VISUAL_TYPE: *value = configuration->mNativeVisualType; break; - case EGL_SAMPLES: *value = configuration->mSamples; break; - case EGL_SAMPLE_BUFFERS: *value = configuration->mSampleBuffers; break; - case EGL_SURFACE_TYPE: *value = configuration->mSurfaceType; break; - case EGL_TRANSPARENT_TYPE: *value = configuration->mTransparentType; break; - case EGL_TRANSPARENT_BLUE_VALUE: *value = configuration->mTransparentBlueValue; break; - case EGL_TRANSPARENT_GREEN_VALUE: *value = configuration->mTransparentGreenValue; break; - case EGL_TRANSPARENT_RED_VALUE: *value = configuration->mTransparentRedValue; break; - case EGL_BIND_TO_TEXTURE_RGB: *value = configuration->mBindToTextureRGB; break; - case EGL_BIND_TO_TEXTURE_RGBA: *value = configuration->mBindToTextureRGBA; break; - case EGL_MIN_SWAP_INTERVAL: *value = configuration->mMinSwapInterval; break; - case EGL_MAX_SWAP_INTERVAL: *value = configuration->mMaxSwapInterval; break; - case EGL_LUMINANCE_SIZE: *value = configuration->mLuminanceSize; break; - case EGL_ALPHA_MASK_SIZE: *value = configuration->mAlphaMaskSize; break; - case EGL_COLOR_BUFFER_TYPE: *value = configuration->mColorBufferType; break; - case EGL_RENDERABLE_TYPE: *value = configuration->mRenderableType; break; - case EGL_MATCH_NATIVE_PIXMAP: *value = false; UNIMPLEMENTED(); break; - case EGL_CONFORMANT: *value = configuration->mConformant; break; - case EGL_MAX_PBUFFER_WIDTH: *value = configuration->mMaxPBufferWidth; break; - case EGL_MAX_PBUFFER_HEIGHT: *value = configuration->mMaxPBufferHeight; break; - case EGL_MAX_PBUFFER_PIXELS: *value = configuration->mMaxPBufferPixels; break; - default: - return false; - } - - return true; -} - - - -Error Display::createWindowSurface(EGLNativeWindowType window, EGLConfig config, const EGLint *attribList, EGLSurface *outSurface) -{ - const Config *configuration = mConfigSet.get(config); - EGLint postSubBufferSupported = EGL_FALSE; - - EGLint width = 0; - EGLint height = 0; - EGLint fixedSize = EGL_FALSE; - - if (attribList) - { - while (*attribList != EGL_NONE) - { - switch (attribList[0]) - { - case EGL_RENDER_BUFFER: - switch (attribList[1]) - { - case EGL_BACK_BUFFER: - break; - case EGL_SINGLE_BUFFER: - return Error(EGL_BAD_MATCH); // Rendering directly to front buffer not supported - default: - return Error(EGL_BAD_ATTRIBUTE); - } - break; - case EGL_POST_SUB_BUFFER_SUPPORTED_NV: - postSubBufferSupported = attribList[1]; - break; - case EGL_WIDTH: - width = attribList[1]; - break; - case EGL_HEIGHT: - height = attribList[1]; - break; - case EGL_FIXED_SIZE_ANGLE: - fixedSize = attribList[1]; - break; - case EGL_VG_COLORSPACE: - return Error(EGL_BAD_MATCH); - case EGL_VG_ALPHA_FORMAT: - return Error(EGL_BAD_MATCH); - default: - return Error(EGL_BAD_ATTRIBUTE); - } - - attribList += 2; - } - } - - if (width < 0 || height < 0) - { - return Error(EGL_BAD_PARAMETER); - } - - if (!fixedSize) - { - width = -1; - height = -1; - } - - if (hasExistingWindowSurface(window)) - { - return Error(EGL_BAD_ALLOC); - } - - if (mRenderer->testDeviceLost(false)) - { - Error error = restoreLostDevice(); - if (error.isError()) - { - return error; - } - } - - Surface *surface = new Surface(this, configuration, window, fixedSize, width, height, postSubBufferSupported); - Error error = surface->initialize(); - if (error.isError()) - { - SafeDelete(surface); - return error; - } - - mSurfaceSet.insert(surface); - - *outSurface = surface; - return Error(EGL_SUCCESS); -} - -Error Display::createOffscreenSurface(EGLConfig config, HANDLE shareHandle, const EGLint *attribList, EGLSurface *outSurface) -{ - EGLint width = 0, height = 0; - EGLenum textureFormat = EGL_NO_TEXTURE; - EGLenum textureTarget = EGL_NO_TEXTURE; - const Config *configuration = mConfigSet.get(config); - - if (attribList) - { - while (*attribList != EGL_NONE) - { - switch (attribList[0]) - { - case EGL_WIDTH: - width = attribList[1]; - break; - case EGL_HEIGHT: - height = attribList[1]; - break; - case EGL_LARGEST_PBUFFER: - if (attribList[1] != EGL_FALSE) - UNIMPLEMENTED(); // FIXME - break; - case EGL_TEXTURE_FORMAT: - switch (attribList[1]) - { - case EGL_NO_TEXTURE: - case EGL_TEXTURE_RGB: - case EGL_TEXTURE_RGBA: - textureFormat = attribList[1]; - break; - default: - return Error(EGL_BAD_ATTRIBUTE); - } - break; - case EGL_TEXTURE_TARGET: - switch (attribList[1]) - { - case EGL_NO_TEXTURE: - case EGL_TEXTURE_2D: - textureTarget = attribList[1]; - break; - default: - return Error(EGL_BAD_ATTRIBUTE); - } - break; - case EGL_MIPMAP_TEXTURE: - if (attribList[1] != EGL_FALSE) - return Error(EGL_BAD_ATTRIBUTE); - break; - case EGL_VG_COLORSPACE: - return Error(EGL_BAD_MATCH); - case EGL_VG_ALPHA_FORMAT: - return Error(EGL_BAD_MATCH); - default: - return Error(EGL_BAD_ATTRIBUTE); - } - - attribList += 2; - } - } - - if (width < 0 || height < 0) - { - return Error(EGL_BAD_PARAMETER); - } - - if (width == 0 || height == 0) - { - return Error(EGL_BAD_ATTRIBUTE); - } - - if (textureFormat != EGL_NO_TEXTURE && !mRenderer->getRendererExtensions().textureNPOT && (!gl::isPow2(width) || !gl::isPow2(height))) - { - return Error(EGL_BAD_MATCH); - } - - if ((textureFormat != EGL_NO_TEXTURE && textureTarget == EGL_NO_TEXTURE) || - (textureFormat == EGL_NO_TEXTURE && textureTarget != EGL_NO_TEXTURE)) - { - return Error(EGL_BAD_MATCH); - } - - if (!(configuration->mSurfaceType & EGL_PBUFFER_BIT)) - { - return Error(EGL_BAD_MATCH); - } - - if ((textureFormat == EGL_TEXTURE_RGB && configuration->mBindToTextureRGB != EGL_TRUE) || - (textureFormat == EGL_TEXTURE_RGBA && configuration->mBindToTextureRGBA != EGL_TRUE)) - { - return Error(EGL_BAD_ATTRIBUTE); - } - - if (mRenderer->testDeviceLost(false)) - { - Error error = restoreLostDevice(); - if (error.isError()) - { - return error; - } - } - - Surface *surface = new Surface(this, configuration, shareHandle, width, height, textureFormat, textureTarget); - Error error = surface->initialize(); - if (error.isError()) - { - SafeDelete(surface); - return error; - } - - mSurfaceSet.insert(surface); - - *outSurface = surface; - return Error(EGL_SUCCESS); -} - -Error Display::createContext(EGLConfig configHandle, EGLint clientVersion, const gl::Context *shareContext, bool notifyResets, - bool robustAccess, EGLContext *outContext) -{ - if (!mRenderer) - { - *outContext = EGL_NO_CONTEXT; - return Error(EGL_SUCCESS); - } - else if (mRenderer->testDeviceLost(false)) // Lost device - { - Error error = restoreLostDevice(); - if (error.isError()) - { - return error; - } - } - - //TODO(jmadill): shader model is not cross-platform - if (clientVersion > 2 && mRenderer->getMajorShaderModel() < 4) - { - return Error(EGL_BAD_CONFIG); - } - - gl::Context *context = glCreateContext(clientVersion, shareContext, mRenderer, notifyResets, robustAccess); - mContextSet.insert(context); - - *outContext = context; - return Error(EGL_SUCCESS); -} - -Error Display::restoreLostDevice() -{ - for (ContextSet::iterator ctx = mContextSet.begin(); ctx != mContextSet.end(); ctx++) - { - if ((*ctx)->isResetNotificationEnabled()) - { - // If reset notifications have been requested, application must delete all contexts first - return Error(EGL_CONTEXT_LOST); - } - } - - // Release surface resources to make the Reset() succeed - for (SurfaceSet::iterator surface = mSurfaceSet.begin(); surface != mSurfaceSet.end(); surface++) - { - (*surface)->release(); - } - - if (!mRenderer->resetDevice()) - { - return Error(EGL_BAD_ALLOC); - } - - // Restore any surfaces that may have been lost - for (SurfaceSet::iterator surface = mSurfaceSet.begin(); surface != mSurfaceSet.end(); surface++) - { - Error error = (*surface)->resetSwapChain(); - if (error.isError()) - { - return error; - } - } - - return Error(EGL_SUCCESS); -} - - -void Display::destroySurface(egl::Surface *surface) -{ - delete surface; - mSurfaceSet.erase(surface); -} - -void Display::destroyContext(gl::Context *context) -{ - glDestroyContext(context); - mContextSet.erase(context); -} - -void Display::notifyDeviceLost() -{ - for (ContextSet::iterator context = mContextSet.begin(); context != mContextSet.end(); context++) - { - (*context)->markContextLost(); - } -} - -void Display::recreateSwapChains() -{ - for (SurfaceSet::iterator surface = mSurfaceSet.begin(); surface != mSurfaceSet.end(); surface++) - { - (*surface)->getSwapChain()->recreate(); - } -} - -bool Display::isInitialized() const -{ - return mRenderer != NULL && mConfigSet.size() > 0; -} - -bool Display::isValidConfig(EGLConfig config) -{ - return mConfigSet.get(config) != NULL; -} - -bool Display::isValidContext(gl::Context *context) -{ - return mContextSet.find(context) != mContextSet.end(); -} - -bool Display::isValidSurface(egl::Surface *surface) -{ - return mSurfaceSet.find(surface) != mSurfaceSet.end(); -} - -bool Display::hasExistingWindowSurface(EGLNativeWindowType window) -{ - for (SurfaceSet::iterator surface = mSurfaceSet.begin(); surface != mSurfaceSet.end(); surface++) - { - if ((*surface)->getWindowHandle() == window) - { - return true; - } - } - - return false; -} - -std::string Display::generateClientExtensionString() -{ - std::vector<std::string> extensions; - - extensions.push_back("EGL_EXT_client_extensions"); - - extensions.push_back("ANGLE_platform_angle"); - - if (supportsPlatformD3D()) - { - extensions.push_back("ANGLE_platform_angle_d3d"); - } - - if (supportsPlatformOpenGL()) - { - extensions.push_back("ANGLE_platform_angle_opengl"); - } - - std::ostringstream stream; - std::copy(extensions.begin(), extensions.end(), std::ostream_iterator<std::string>(stream, " ")); - return stream.str(); -} - -void Display::initDisplayExtensionString() -{ - std::vector<std::string> extensions; - - // Multi-vendor (EXT) extensions - extensions.push_back("EGL_EXT_create_context_robustness"); - - // ANGLE-specific extensions - if (mRenderer->getShareHandleSupport()) - { - extensions.push_back("EGL_ANGLE_d3d_share_handle_client_buffer"); - extensions.push_back("EGL_ANGLE_surface_d3d_texture_2d_share_handle"); - } - - extensions.push_back("EGL_ANGLE_query_surface_pointer"); - extensions.push_back("EGL_ANGLE_window_fixed_size"); - - if (mRenderer->getPostSubBufferSupport()) - { - extensions.push_back("EGL_NV_post_sub_buffer"); - } - -#if defined (ANGLE_TEST_CONFIG) - // TODO: complete support for the EGL_KHR_create_context extension - extensions.push_back("EGL_KHR_create_context"); -#endif - - std::ostringstream stream; - std::copy(extensions.begin(), extensions.end(), std::ostream_iterator<std::string>(stream, " ")); - mDisplayExtensionString = stream.str(); -} - -const char *Display::getExtensionString(egl::Display *display) -{ - if (display != EGL_NO_DISPLAY) - { - return display->mDisplayExtensionString.c_str(); - } - else - { - static std::string clientExtensions = generateClientExtensionString(); - return clientExtensions.c_str(); - } -} - -bool Display::supportsPlatformD3D() -{ -#if defined(ANGLE_ENABLE_D3D9) || defined(ANGLE_ENABLE_D3D11) - return true; -#else - return false; -#endif -} - -bool Display::supportsPlatformOpenGL() -{ - return false; -} - -void Display::initVendorString() -{ - mVendorString = "Google Inc."; - - LUID adapterLuid = {0}; - - //TODO(jmadill): LUID is not cross-platform - if (mRenderer && mRenderer->getLUID(&adapterLuid)) - { - char adapterLuidString[64]; - sprintf_s(adapterLuidString, sizeof(adapterLuidString), " (adapter LUID: %08x%08x)", adapterLuid.HighPart, adapterLuid.LowPart); - - mVendorString += adapterLuidString; - } -} - -const char *Display::getVendorString() const -{ - return mVendorString.c_str(); -} - -} diff --git a/src/3rdparty/angle/src/libEGL/Display.h b/src/3rdparty/angle/src/libEGL/Display.h deleted file mode 100644 index b3ffcc84c5..0000000000 --- a/src/3rdparty/angle/src/libEGL/Display.h +++ /dev/null @@ -1,104 +0,0 @@ -// -// Copyright (c) 2002-2013 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. -// - -// Display.h: Defines the egl::Display class, representing the abstract -// display on which graphics are drawn. Implements EGLDisplay. -// [EGL 1.4] section 2.1.2 page 3. - -#ifndef LIBEGL_DISPLAY_H_ -#define LIBEGL_DISPLAY_H_ - -#include <set> -#include <vector> - -#include "libEGL/Error.h" -#include "libEGL/Config.h" -#include "libEGL/AttributeMap.h" - -namespace gl -{ -class Context; -} - -namespace egl -{ -class Surface; - -class Display -{ - public: - ~Display(); - - Error initialize(); - void terminate(); - - static egl::Display *getDisplay(EGLNativeDisplayType displayId, const AttributeMap &attribMap); - - static const char *getExtensionString(egl::Display *display); - - static bool supportsPlatformD3D(); - static bool supportsPlatformOpenGL(); - - bool getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint configSize, EGLint *numConfig); - bool getConfigAttrib(EGLConfig config, EGLint attribute, EGLint *value); - - Error createWindowSurface(EGLNativeWindowType window, EGLConfig config, const EGLint *attribList, EGLSurface *outSurface); - Error createOffscreenSurface(EGLConfig config, HANDLE shareHandle, const EGLint *attribList, EGLSurface *outSurface); - Error createContext(EGLConfig configHandle, EGLint clientVersion, const gl::Context *shareContext, bool notifyResets, - bool robustAccess, EGLContext *outContext); - - void destroySurface(egl::Surface *surface); - void destroyContext(gl::Context *context); - - bool isInitialized() const; - bool isValidConfig(EGLConfig config); - bool isValidContext(gl::Context *context); - bool isValidSurface(egl::Surface *surface); - bool hasExistingWindowSurface(EGLNativeWindowType window); - - rx::Renderer *getRenderer() { return mRenderer; }; - - // exported methods must be virtual - virtual void notifyDeviceLost(); - virtual void recreateSwapChains(); - - const char *getExtensionString() const; - const char *getVendorString() const; - EGLNativeDisplayType getDisplayId() const { return mDisplayId; } - - private: - DISALLOW_COPY_AND_ASSIGN(Display); - - Display(EGLNativeDisplayType displayId); - - void setAttributes(const AttributeMap &attribMap); - - Error restoreLostDevice(); - - EGLNativeDisplayType mDisplayId; - AttributeMap mAttributeMap; - - typedef std::set<Surface*> SurfaceSet; - SurfaceSet mSurfaceSet; - - ConfigSet mConfigSet; - - typedef std::set<gl::Context*> ContextSet; - ContextSet mContextSet; - - rx::Renderer *mRenderer; - - static std::string generateClientExtensionString(); - - void initDisplayExtensionString(); - std::string mDisplayExtensionString; - - void initVendorString(); - std::string mVendorString; -}; -} - -#endif // LIBEGL_DISPLAY_H_ diff --git a/src/3rdparty/angle/src/libEGL/Error.cpp b/src/3rdparty/angle/src/libEGL/Error.cpp deleted file mode 100644 index df5f163d32..0000000000 --- a/src/3rdparty/angle/src/libEGL/Error.cpp +++ /dev/null @@ -1,48 +0,0 @@ -// -// Copyright (c) 2014 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. -// - -// Error.cpp: Implements the egl::Error class which encapsulates an EGL error -// and optional error message. - -#include "libEGL/Error.h" - -#include "common/angleutils.h" - -#include <cstdarg> - -namespace egl -{ - -Error::Error(EGLint errorCode) - : mCode(errorCode), - mMessage() -{ -} - -Error::Error(EGLint errorCode, const char *msg, ...) - : mCode(errorCode), - mMessage() -{ - va_list vararg; - va_start(vararg, msg); - mMessage = FormatString(msg, vararg); - va_end(vararg); -} - -Error::Error(const Error &other) - : mCode(other.mCode), - mMessage(other.mMessage) -{ -} - -Error &Error::operator=(const Error &other) -{ - mCode = other.mCode; - mMessage = other.mMessage; - return *this; -} - -} diff --git a/src/3rdparty/angle/src/libEGL/Error.h b/src/3rdparty/angle/src/libEGL/Error.h deleted file mode 100644 index 71805d2fb7..0000000000 --- a/src/3rdparty/angle/src/libEGL/Error.h +++ /dev/null @@ -1,39 +0,0 @@ -// -// Copyright (c) 2014 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. - -// Error.h: Defines the egl::Error class which encapsulates an EGL error -// and optional error message. - -#ifndef LIBEGL_ERROR_H_ -#define LIBEGL_ERROR_H_ - -#include <EGL/egl.h> - -#include <string> - -namespace egl -{ - -class Error -{ - public: - explicit Error(EGLint errorCode); - Error(EGLint errorCode, const char *msg, ...); - Error(const Error &other); - Error &operator=(const Error &other); - - EGLint getCode() const { return mCode; } - bool isError() const { return (mCode != EGL_SUCCESS); } - - const std::string &getMessage() const { return mMessage; } - - private: - EGLint mCode; - std::string mMessage; -}; - -} - -#endif // LIBEGL_ERROR_H_ diff --git a/src/3rdparty/angle/src/libEGL/Surface.cpp b/src/3rdparty/angle/src/libEGL/Surface.cpp deleted file mode 100644 index b664a8530e..0000000000 --- a/src/3rdparty/angle/src/libEGL/Surface.cpp +++ /dev/null @@ -1,505 +0,0 @@ -// -// Copyright (c) 2002-2014 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. -// - -// Surface.cpp: Implements the egl::Surface class, representing a drawing surface -// such as the client area of a window, including any back buffers. -// Implements EGLSurface and related functionality. [EGL 1.4] section 2.2 page 3. - -#include <tchar.h> - -#include <algorithm> - -#include "libEGL/Surface.h" - -#include "common/debug.h" -#include "libGLESv2/Texture.h" -#include "libGLESv2/renderer/SwapChain.h" -#include "libGLESv2/main.h" - -#include "libEGL/main.h" -#include "libEGL/Display.h" - -#include "common/NativeWindow.h" - -//TODO(jmadill): phase this out -#include "libGLESv2/renderer/d3d/RendererD3D.h" - -namespace egl -{ - -Surface::Surface(Display *display, const Config *config, EGLNativeWindowType window, EGLint fixedSize, EGLint width, EGLint height, EGLint postSubBufferSupported) - : mDisplay(display), mConfig(config), mNativeWindow(window, display->getDisplayId()), mPostSubBufferSupported(postSubBufferSupported) -{ - //TODO(jmadill): MANGLE refactor. (note, can't call makeRendererD3D because of dll export issues) - mRenderer = static_cast<rx::RendererD3D*>(mDisplay->getRenderer()); - mSwapChain = NULL; - mShareHandle = NULL; - mTexture = NULL; - mTextureFormat = EGL_NO_TEXTURE; - mTextureTarget = EGL_NO_TEXTURE; - - mPixelAspectRatio = (EGLint)(1.0 * EGL_DISPLAY_SCALING); // FIXME: Determine actual pixel aspect ratio - mRenderBuffer = EGL_BACK_BUFFER; - mSwapBehavior = EGL_BUFFER_PRESERVED; - mSwapInterval = -1; - mWidth = width; - mHeight = height; - mFixedWidth = mWidth; - mFixedHeight = mHeight; - setSwapInterval(1); - mFixedSize = fixedSize; - - subclassWindow(); -} - -Surface::Surface(Display *display, const Config *config, HANDLE shareHandle, EGLint width, EGLint height, EGLenum textureFormat, EGLenum textureType) - : mDisplay(display), mNativeWindow(NULL, NULL), mConfig(config), mShareHandle(shareHandle), mWidth(width), mHeight(height), mPostSubBufferSupported(EGL_FALSE) -{ - //TODO(jmadill): MANGLE refactor. (note, can't call makeRendererD3D because of dll export issues) - mRenderer = static_cast<rx::RendererD3D*>(mDisplay->getRenderer()); - mSwapChain = NULL; - mWindowSubclassed = false; - mTexture = NULL; - mTextureFormat = textureFormat; - mTextureTarget = textureType; - - mPixelAspectRatio = (EGLint)(1.0 * EGL_DISPLAY_SCALING); // FIXME: Determine actual pixel aspect ratio - mRenderBuffer = EGL_BACK_BUFFER; - mSwapBehavior = EGL_BUFFER_PRESERVED; - mSwapInterval = -1; - setSwapInterval(1); - // This constructor is for offscreen surfaces, which are always fixed-size. - mFixedSize = EGL_TRUE; - mFixedWidth = mWidth; - mFixedHeight = mHeight; -} - -Surface::~Surface() -{ - unsubclassWindow(); - release(); -} - -Error Surface::initialize() -{ - if (mNativeWindow.getNativeWindow()) - { - if (!mNativeWindow.initialize()) - { - return Error(EGL_BAD_SURFACE); - } - } - - Error error = resetSwapChain(); - if (error.isError()) - { - return error; - } - - return Error(EGL_SUCCESS); -} - -void Surface::release() -{ - delete mSwapChain; - mSwapChain = NULL; - - if (mTexture) - { - mTexture->releaseTexImage(); - mTexture = NULL; - } -} - -Error Surface::resetSwapChain() -{ - ASSERT(!mSwapChain); - - int width; - int height; - - if (!mFixedSize) - { - RECT windowRect; - if (!mNativeWindow.getClientRect(&windowRect)) - { - ASSERT(false); - - return Error(EGL_BAD_SURFACE, "Could not retrieve the window dimensions"); - } - - width = windowRect.right - windowRect.left; - height = windowRect.bottom - windowRect.top; - } - else - { - // non-window surface - size is determined at creation - width = mWidth; - height = mHeight; - } - - mSwapChain = mRenderer->createSwapChain(mNativeWindow, mShareHandle, - mConfig->mRenderTargetFormat, - mConfig->mDepthStencilFormat); - if (!mSwapChain) - { - return Error(EGL_BAD_ALLOC); - } - - Error error = resetSwapChain(width, height); - if (error.isError()) - { - SafeDelete(mSwapChain); - return error; - } - - return Error(EGL_SUCCESS); -} - -Error Surface::resizeSwapChain(int backbufferWidth, int backbufferHeight) -{ - ASSERT(mSwapChain); - -#if !defined(ANGLE_ENABLE_WINDOWS_STORE) - backbufferWidth = std::max(1, backbufferWidth); - backbufferHeight = std::max(1, backbufferHeight); -#endif - EGLint status = mSwapChain->resize(backbufferWidth, backbufferHeight); - - if (status == EGL_CONTEXT_LOST) - { - mDisplay->notifyDeviceLost(); - return Error(status); - } - else if (status != EGL_SUCCESS) - { - return Error(status); - } - - mWidth = backbufferWidth; - mHeight = backbufferHeight; - - return Error(EGL_SUCCESS); -} - -Error Surface::resetSwapChain(int backbufferWidth, int backbufferHeight) -{ - ASSERT(backbufferWidth >= 0 && backbufferHeight >= 0); - ASSERT(mSwapChain); - - EGLint status = mSwapChain->reset(std::max(1, backbufferWidth), std::max(1, backbufferHeight), mSwapInterval); - - if (status == EGL_CONTEXT_LOST) - { - mRenderer->notifyDeviceLost(); - return Error(status); - } - else if (status != EGL_SUCCESS) - { - return Error(status); - } - - mWidth = backbufferWidth; - mHeight = backbufferHeight; - mSwapIntervalDirty = false; - - return Error(EGL_SUCCESS); -} - -Error Surface::swapRect(EGLint x, EGLint y, EGLint width, EGLint height) -{ - if (!mSwapChain) - { - return Error(EGL_SUCCESS); - } - - if (x + width > abs(mWidth)) - { - width = abs(mWidth) - x; - } - - if (y + height > abs(mHeight)) - { - height = abs(mHeight) - y; - } - - if (width == 0 || height == 0) - { - return Error(EGL_SUCCESS); - } - - ASSERT(width > 0); - ASSERT(height > 0); - - EGLint status = mSwapChain->swapRect(x, y, width, height); - - if (status == EGL_CONTEXT_LOST) - { - mRenderer->notifyDeviceLost(); - return Error(status); - } - else if (status != EGL_SUCCESS) - { - return Error(status); - } - - checkForOutOfDateSwapChain(); - - return Error(EGL_SUCCESS); -} - -EGLNativeWindowType Surface::getWindowHandle() -{ - return mNativeWindow.getNativeWindow(); -} - -#if !defined(ANGLE_ENABLE_WINDOWS_STORE) -#define kSurfaceProperty _TEXT("Egl::SurfaceOwner") -#define kParentWndProc _TEXT("Egl::SurfaceParentWndProc") - -static LRESULT CALLBACK SurfaceWindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam) -{ - if (message == WM_SIZE) - { - Surface* surf = reinterpret_cast<Surface*>(GetProp(hwnd, kSurfaceProperty)); - if(surf) - { - surf->checkForOutOfDateSwapChain(); - } - } - WNDPROC prevWndFunc = reinterpret_cast<WNDPROC >(GetProp(hwnd, kParentWndProc)); - return CallWindowProc(prevWndFunc, hwnd, message, wparam, lparam); -} -#endif - -void Surface::subclassWindow() -{ -#if !defined(ANGLE_ENABLE_WINDOWS_STORE) - HWND window = mNativeWindow.getNativeWindow(); - if (!window) - { - return; - } - - DWORD processId; - DWORD threadId = GetWindowThreadProcessId(window, &processId); - if (processId != GetCurrentProcessId() || threadId != GetCurrentThreadId()) - { - return; - } - - SetLastError(0); - LONG_PTR oldWndProc = SetWindowLongPtr(window, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(SurfaceWindowProc)); - if(oldWndProc == 0 && GetLastError() != ERROR_SUCCESS) - { - mWindowSubclassed = false; - return; - } - - SetProp(window, kSurfaceProperty, reinterpret_cast<HANDLE>(this)); - SetProp(window, kParentWndProc, reinterpret_cast<HANDLE>(oldWndProc)); - mWindowSubclassed = true; -#endif -} - -void Surface::unsubclassWindow() -{ - if(!mWindowSubclassed) - { - return; - } - -#if !defined(ANGLE_ENABLE_WINDOWS_STORE) - HWND window = mNativeWindow.getNativeWindow(); - if (!window) - { - return; - } - - // un-subclass - LONG_PTR parentWndFunc = reinterpret_cast<LONG_PTR>(GetProp(window, kParentWndProc)); - - // Check the windowproc is still SurfaceWindowProc. - // If this assert fails, then it is likely the application has subclassed the - // hwnd as well and did not unsubclass before destroying its EGL context. The - // application should be modified to either subclass before initializing the - // EGL context, or to unsubclass before destroying the EGL context. - if(parentWndFunc) - { - LONG_PTR prevWndFunc = SetWindowLongPtr(window, GWLP_WNDPROC, parentWndFunc); - UNUSED_ASSERTION_VARIABLE(prevWndFunc); - ASSERT(prevWndFunc == reinterpret_cast<LONG_PTR>(SurfaceWindowProc)); - } - - RemoveProp(window, kSurfaceProperty); - RemoveProp(window, kParentWndProc); -#endif - mWindowSubclassed = false; -} - -bool Surface::checkForOutOfDateSwapChain() -{ - RECT client; - int clientWidth = getWidth(); - int clientHeight = getHeight(); - bool sizeDirty = false; - if (!mFixedSize && !mNativeWindow.isIconic()) - { - // The window is automatically resized to 150x22 when it's minimized, but the swapchain shouldn't be resized - // because that's not a useful size to render to. - if (!mNativeWindow.getClientRect(&client)) - { - ASSERT(false); - return false; - } - - // Grow the buffer now, if the window has grown. We need to grow now to avoid losing information. - clientWidth = client.right - client.left; - clientHeight = client.bottom - client.top; - sizeDirty = clientWidth != getWidth() || clientHeight != getHeight(); - } - - if (mFixedSize && (mWidth != mFixedWidth || mHeight != mFixedHeight)) - { - clientWidth = mFixedWidth; - clientHeight = mFixedHeight; - sizeDirty = true; - } - - bool wasDirty = (mSwapIntervalDirty || sizeDirty); - - if (mSwapIntervalDirty) - { - resetSwapChain(clientWidth, clientHeight); - } - else if (sizeDirty) - { - resizeSwapChain(clientWidth, clientHeight); - } - - if (wasDirty) - { - if (static_cast<egl::Surface*>(getCurrentDrawSurface()) == this) - { - glMakeCurrent(glGetCurrentContext(), static_cast<egl::Display*>(getCurrentDisplay()), this); - } - - return true; - } - - return false; -} - -Error Surface::swap() -{ - return swapRect(0, 0, abs(mWidth), abs(mHeight)); -} - -Error Surface::postSubBuffer(EGLint x, EGLint y, EGLint width, EGLint height) -{ - if (!mPostSubBufferSupported) - { - // Spec is not clear about how this should be handled. - return Error(EGL_SUCCESS); - } - - return swapRect(x, y, width, height); -} - -EGLint Surface::isPostSubBufferSupported() const -{ - return mPostSubBufferSupported; -} - -rx::SwapChain *Surface::getSwapChain() const -{ - return mSwapChain; -} - -void Surface::setSwapInterval(EGLint interval) -{ - if (mSwapInterval == interval) - { - return; - } - - mSwapInterval = interval; - mSwapInterval = std::max(mSwapInterval, mRenderer->getMinSwapInterval()); - mSwapInterval = std::min(mSwapInterval, mRenderer->getMaxSwapInterval()); - - mSwapIntervalDirty = true; -} - -EGLint Surface::getConfigID() const -{ - return mConfig->mConfigID; -} - -EGLint Surface::getWidth() const -{ - return mWidth; -} - -EGLint Surface::getHeight() const -{ - return mHeight; -} - -EGLint Surface::getPixelAspectRatio() const -{ - return mPixelAspectRatio; -} - -EGLenum Surface::getRenderBuffer() const -{ - return mRenderBuffer; -} - -EGLenum Surface::getSwapBehavior() const -{ - return mSwapBehavior; -} - -EGLenum Surface::getTextureFormat() const -{ - return mTextureFormat; -} - -EGLenum Surface::getTextureTarget() const -{ - return mTextureTarget; -} - -void Surface::setBoundTexture(gl::Texture2D *texture) -{ - mTexture = texture; -} - -gl::Texture2D *Surface::getBoundTexture() const -{ - return mTexture; -} - -EGLint Surface::isFixedSize() const -{ - return mFixedSize; -} - -void Surface::setFixedWidth(EGLint width) -{ - mFixedWidth = width; -} - -void Surface::setFixedHeight(EGLint height) -{ - mFixedHeight = height; -} - -EGLenum Surface::getFormat() const -{ - return mConfig->mRenderTargetFormat; -} -} diff --git a/src/3rdparty/angle/src/libEGL/Surface.h b/src/3rdparty/angle/src/libEGL/Surface.h deleted file mode 100644 index 46382d06e1..0000000000 --- a/src/3rdparty/angle/src/libEGL/Surface.h +++ /dev/null @@ -1,120 +0,0 @@ -// -// Copyright (c) 2002-2014 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. -// - -// Surface.h: Defines the egl::Surface class, representing a drawing surface -// such as the client area of a window, including any back buffers. -// Implements EGLSurface and related functionality. [EGL 1.4] section 2.2 page 3. - -#ifndef LIBEGL_SURFACE_H_ -#define LIBEGL_SURFACE_H_ - -#include "libEGL/Error.h" - -#include <EGL/egl.h> - -#include "common/angleutils.h" -#include "common/NativeWindow.h" - -namespace gl -{ -class Texture2D; -} -namespace rx -{ -class SwapChain; -class RendererD3D; //TODO(jmadill): remove this -} - -namespace egl -{ -class Display; -class Config; - -class Surface -{ - public: - Surface(Display *display, const egl::Config *config, EGLNativeWindowType window, EGLint fixedSize, EGLint width, EGLint height, EGLint postSubBufferSupported); - Surface(Display *display, const egl::Config *config, HANDLE shareHandle, EGLint width, EGLint height, EGLenum textureFormat, EGLenum textureTarget); - - virtual ~Surface(); - - Error initialize(); - void release(); - Error resetSwapChain(); - - EGLNativeWindowType getWindowHandle(); - Error swap(); - Error postSubBuffer(EGLint x, EGLint y, EGLint width, EGLint height); - - virtual EGLint isPostSubBufferSupported() const; - - virtual rx::SwapChain *getSwapChain() const; - - void setSwapInterval(EGLint interval); - bool checkForOutOfDateSwapChain(); // Returns true if swapchain changed due to resize or interval update - - virtual EGLint getConfigID() const; - virtual EGLint getWidth() const; - virtual EGLint getHeight() const; - virtual EGLint getPixelAspectRatio() const; - virtual EGLenum getRenderBuffer() const; - virtual EGLenum getSwapBehavior() const; - virtual EGLenum getTextureFormat() const; - virtual EGLenum getTextureTarget() const; - virtual EGLenum getFormat() const; - - virtual void setBoundTexture(gl::Texture2D *texture); - virtual gl::Texture2D *getBoundTexture() const; - - EGLint isFixedSize() const; - void setFixedWidth(EGLint width); - void setFixedHeight(EGLint height); - - private: - DISALLOW_COPY_AND_ASSIGN(Surface); - - Display *const mDisplay; - rx::RendererD3D *mRenderer; - - HANDLE mShareHandle; - rx::SwapChain *mSwapChain; - - void subclassWindow(); - void unsubclassWindow(); - Error resizeSwapChain(int backbufferWidth, int backbufferHeight); - Error resetSwapChain(int backbufferWidth, int backbufferHeight); - Error swapRect(EGLint x, EGLint y, EGLint width, EGLint height); - - rx::NativeWindow mNativeWindow; // Handler for the Window that the surface is created for. - bool mWindowSubclassed; // Indicates whether we successfully subclassed mWindow for WM_RESIZE hooking - const egl::Config *mConfig; // EGL config surface was created with - EGLint mHeight; // Height of surface - EGLint mWidth; // Width of surface - EGLint mFixedHeight; // Pending height of the surface - EGLint mFixedWidth; // Pending width of the surface -// EGLint horizontalResolution; // Horizontal dot pitch -// EGLint verticalResolution; // Vertical dot pitch -// EGLBoolean largestPBuffer; // If true, create largest pbuffer possible -// EGLBoolean mipmapTexture; // True if texture has mipmaps -// EGLint mipmapLevel; // Mipmap level to render to -// EGLenum multisampleResolve; // Multisample resolve behavior - EGLint mPixelAspectRatio; // Display aspect ratio - EGLenum mRenderBuffer; // Render buffer - EGLenum mSwapBehavior; // Buffer swap behavior - EGLenum mTextureFormat; // Format of texture: RGB, RGBA, or no texture - EGLenum mTextureTarget; // Type of texture: 2D or no texture -// EGLenum vgAlphaFormat; // Alpha format for OpenVG -// EGLenum vgColorSpace; // Color space for OpenVG - EGLint mSwapInterval; - EGLint mPostSubBufferSupported; - EGLint mFixedSize; - - bool mSwapIntervalDirty; - gl::Texture2D *mTexture; -}; -} - -#endif // LIBEGL_SURFACE_H_ diff --git a/src/3rdparty/angle/src/libEGL/libEGL.cpp b/src/3rdparty/angle/src/libEGL/libEGL.cpp index 68399d63a4..d09219e308 100644 --- a/src/3rdparty/angle/src/libEGL/libEGL.cpp +++ b/src/3rdparty/angle/src/libEGL/libEGL.cpp @@ -6,1258 +6,245 @@ // libEGL.cpp: Implements the exported EGL functions. -#undef EGLAPI -#define EGLAPI +#include "libGLESv2/entry_points_egl.h" +#include "libGLESv2/entry_points_egl_ext.h" -#include <exception> - -#include "common/debug.h" -#include "common/version.h" -#include "libGLESv2/Context.h" -#include "libGLESv2/Texture.h" -#include "libGLESv2/main.h" -#include "libGLESv2/renderer/SwapChain.h" -#if defined(ANGLE_ENABLE_D3D11) -# include "libGLESv2/renderer/d3d/d3d11/Renderer11.h" -#endif - -#include "libEGL/main.h" -#include "libEGL/Display.h" -#include "libEGL/Surface.h" - -#include "common/NativeWindow.h" - -bool validateDisplay(egl::Display *display) +extern "C" { - if (display == EGL_NO_DISPLAY) - { - recordError(egl::Error(EGL_BAD_DISPLAY)); - return false; - } - - if (!display->isInitialized()) - { - recordError(egl::Error(EGL_NOT_INITIALIZED)); - return false; - } - return true; +EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config) +{ + return egl::ChooseConfig(dpy, attrib_list, configs, config_size, num_config); } -bool validateConfig(egl::Display *display, EGLConfig config) +EGLBoolean EGLAPIENTRY eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target) { - if (!validateDisplay(display)) - { - return false; - } - - if (!display->isValidConfig(config)) - { - recordError(egl::Error(EGL_BAD_CONFIG)); - return false; - } - - return true; + return egl::CopyBuffers(dpy, surface, target); } -bool validateContext(egl::Display *display, gl::Context *context) +EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list) { - if (!validateDisplay(display)) - { - return false; - } - - if (!display->isValidContext(context)) - { - recordError(egl::Error(EGL_BAD_CONTEXT)); - return false; - } - - return true; + return egl::CreateContext(dpy, config, share_context, attrib_list); } -bool validateSurface(egl::Display *display, egl::Surface *surface) +EGLSurface EGLAPIENTRY eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list) { - if (!validateDisplay(display)) - { - return false; - } - - if (!display->isValidSurface(surface)) - { - recordError(egl::Error(EGL_BAD_SURFACE)); - return false; - } - - return true; + return egl::CreatePbufferSurface(dpy, config, attrib_list); } -extern "C" -{ -EGLint __stdcall eglGetError(void) +EGLSurface EGLAPIENTRY eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list) { - EVENT("()"); - - EGLint error = egl::getCurrentError(); - recordError(egl::Error(EGL_SUCCESS)); - return error; + return egl::CreatePixmapSurface(dpy, config, pixmap, attrib_list); } -EGLDisplay __stdcall eglGetDisplay(EGLNativeDisplayType display_id) +EGLSurface EGLAPIENTRY eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list) { - EVENT("(EGLNativeDisplayType display_id = 0x%0.8p)", display_id); - - return egl::Display::getDisplay(display_id, egl::AttributeMap()); + return egl::CreateWindowSurface(dpy, config, win, attrib_list); } -EGLDisplay __stdcall eglGetPlatformDisplayEXT(EGLenum platform, void *native_display, const EGLint *attrib_list) +EGLBoolean EGLAPIENTRY eglDestroyContext(EGLDisplay dpy, EGLContext ctx) { - EVENT("(EGLenum platform = %d, void* native_display = 0x%0.8p, const EGLint* attrib_list = 0x%0.8p)", - platform, native_display, attrib_list); - - switch (platform) - { - case EGL_PLATFORM_ANGLE_ANGLE: - break; - - default: - recordError(egl::Error(EGL_BAD_CONFIG)); - return EGL_NO_DISPLAY; - } - - EGLNativeDisplayType displayId = static_cast<EGLNativeDisplayType>(native_display); - -#if !defined(ANGLE_ENABLE_WINDOWS_STORE) - // Validate the display device context - if (WindowFromDC(displayId) == NULL) - { - recordError(egl::Error(EGL_SUCCESS)); - return EGL_NO_DISPLAY; - } -#endif - - EGLint platformType = EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE; - bool majorVersionSpecified = false; - bool minorVersionSpecified = false; - bool requestedWARP = false; - - if (attrib_list) - { - for (const EGLint *curAttrib = attrib_list; curAttrib[0] != EGL_NONE; curAttrib += 2) - { - switch (curAttrib[0]) - { - case EGL_PLATFORM_ANGLE_TYPE_ANGLE: - switch (curAttrib[1]) - { - case EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE: - break; - - case EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE: - case EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE: - if (!egl::Display::supportsPlatformD3D()) - { - recordError(egl::Error(EGL_SUCCESS)); - return EGL_NO_DISPLAY; - } - break; - - case EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE: - case EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE: - if (!egl::Display::supportsPlatformOpenGL()) - { - recordError(egl::Error(EGL_SUCCESS)); - return EGL_NO_DISPLAY; - } - break; - - default: - recordError(egl::Error(EGL_SUCCESS)); - return EGL_NO_DISPLAY; - } - platformType = curAttrib[1]; - break; - - case EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE: - if (curAttrib[1] != EGL_DONT_CARE) - { - majorVersionSpecified = true; - } - break; - - case EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE: - if (curAttrib[1] != EGL_DONT_CARE) - { - minorVersionSpecified = true; - } - break; - - case EGL_PLATFORM_ANGLE_USE_WARP_ANGLE: - if (!egl::Display::supportsPlatformD3D()) - { - recordError(egl::Error(EGL_SUCCESS)); - return EGL_NO_DISPLAY; - } - - switch (curAttrib[1]) - { - case EGL_FALSE: - case EGL_TRUE: - break; - - default: - recordError(egl::Error(EGL_SUCCESS)); - return EGL_NO_DISPLAY; - } - - requestedWARP = (curAttrib[1] == EGL_TRUE); - break; - - default: - break; - } - } - } - - if (!majorVersionSpecified && minorVersionSpecified) - { - recordError(egl::Error(EGL_BAD_ATTRIBUTE)); - return EGL_NO_DISPLAY; - } - - if (platformType != EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE && requestedWARP) - { - recordError(egl::Error(EGL_BAD_ATTRIBUTE)); - return EGL_NO_DISPLAY; - } - - recordError(egl::Error(EGL_SUCCESS)); - return egl::Display::getDisplay(displayId, egl::AttributeMap(attrib_list)); + return egl::DestroyContext(dpy, ctx); } -EGLBoolean __stdcall eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor) +EGLBoolean EGLAPIENTRY eglDestroySurface(EGLDisplay dpy, EGLSurface surface) { - EVENT("(EGLDisplay dpy = 0x%0.8p, EGLint *major = 0x%0.8p, EGLint *minor = 0x%0.8p)", - dpy, major, minor); - - if (dpy == EGL_NO_DISPLAY) - { - recordError(egl::Error(EGL_BAD_DISPLAY)); - return EGL_FALSE; - } - - egl::Display *display = static_cast<egl::Display*>(dpy); - - egl::Error error = display->initialize(); - if (error.isError()) - { - recordError(error); - return EGL_FALSE; - } - - if (major) *major = 1; - if (minor) *minor = 4; - - recordError(egl::Error(EGL_SUCCESS)); - return EGL_TRUE; + return egl::DestroySurface(dpy, surface); } -EGLBoolean __stdcall eglTerminate(EGLDisplay dpy) +EGLBoolean EGLAPIENTRY eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value) { - EVENT("(EGLDisplay dpy = 0x%0.8p)", dpy); - - if (dpy == EGL_NO_DISPLAY) - { - recordError(egl::Error(EGL_BAD_DISPLAY)); - return EGL_FALSE; - } - - egl::Display *display = static_cast<egl::Display*>(dpy); - - display->terminate(); - - recordError(egl::Error(EGL_SUCCESS)); - return EGL_TRUE; + return egl::GetConfigAttrib(dpy, config, attribute, value); } -const char *__stdcall eglQueryString(EGLDisplay dpy, EGLint name) +EGLBoolean EGLAPIENTRY eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config) { - EVENT("(EGLDisplay dpy = 0x%0.8p, EGLint name = %d)", dpy, name); - - egl::Display *display = static_cast<egl::Display*>(dpy); - if (!(display == EGL_NO_DISPLAY && name == EGL_EXTENSIONS) && !validateDisplay(display)) - { - return NULL; - } - - const char *result; - switch (name) - { - case EGL_CLIENT_APIS: - result = "OpenGL_ES"; - break; - case EGL_EXTENSIONS: - result = egl::Display::getExtensionString(display); - break; - case EGL_VENDOR: - result = display->getVendorString(); - break; - case EGL_VERSION: - result = "1.4 (ANGLE " ANGLE_VERSION_STRING ")"; - break; - default: - recordError(egl::Error(EGL_BAD_PARAMETER)); - return NULL; - } - - recordError(egl::Error(EGL_SUCCESS)); - return result; + return egl::GetConfigs(dpy, configs, config_size, num_config); } -EGLBoolean __stdcall eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config) +EGLDisplay EGLAPIENTRY eglGetCurrentDisplay(void) { - EVENT("(EGLDisplay dpy = 0x%0.8p, EGLConfig *configs = 0x%0.8p, " - "EGLint config_size = %d, EGLint *num_config = 0x%0.8p)", - dpy, configs, config_size, num_config); - - egl::Display *display = static_cast<egl::Display*>(dpy); - - if (!validateDisplay(display)) - { - return EGL_FALSE; - } - - if (!num_config) - { - recordError(egl::Error(EGL_BAD_PARAMETER)); - return EGL_FALSE; - } - - const EGLint attribList[] = {EGL_NONE}; - - if (!display->getConfigs(configs, attribList, config_size, num_config)) - { - recordError(egl::Error(EGL_BAD_ATTRIBUTE)); - return EGL_FALSE; - } - - recordError(egl::Error(EGL_SUCCESS)); - return EGL_TRUE; + return egl::GetCurrentDisplay(); } -EGLBoolean __stdcall eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config) +EGLSurface EGLAPIENTRY eglGetCurrentSurface(EGLint readdraw) { - EVENT("(EGLDisplay dpy = 0x%0.8p, const EGLint *attrib_list = 0x%0.8p, " - "EGLConfig *configs = 0x%0.8p, EGLint config_size = %d, EGLint *num_config = 0x%0.8p)", - dpy, attrib_list, configs, config_size, num_config); - - egl::Display *display = static_cast<egl::Display*>(dpy); - - if (!validateDisplay(display)) - { - return EGL_FALSE; - } - - if (!num_config) - { - recordError(egl::Error(EGL_BAD_PARAMETER)); - return EGL_FALSE; - } - - const EGLint attribList[] = {EGL_NONE}; - - if (!attrib_list) - { - attrib_list = attribList; - } - - display->getConfigs(configs, attrib_list, config_size, num_config); - - recordError(egl::Error(EGL_SUCCESS)); - return EGL_TRUE; + return egl::GetCurrentSurface(readdraw); } -EGLBoolean __stdcall eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value) +EGLDisplay EGLAPIENTRY eglGetDisplay(EGLNativeDisplayType display_id) { - EVENT("(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, EGLint attribute = %d, EGLint *value = 0x%0.8p)", - dpy, config, attribute, value); - - egl::Display *display = static_cast<egl::Display*>(dpy); - - if (!validateConfig(display, config)) - { - return EGL_FALSE; - } - - if (!display->getConfigAttrib(config, attribute, value)) - { - recordError(egl::Error(EGL_BAD_ATTRIBUTE)); - return EGL_FALSE; - } - - recordError(egl::Error(EGL_SUCCESS)); - return EGL_TRUE; + return egl::GetDisplay(display_id); } -EGLSurface __stdcall eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list) +EGLint EGLAPIENTRY eglGetError(void) { - EVENT("(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, EGLNativeWindowType win = 0x%0.8p, " - "const EGLint *attrib_list = 0x%0.8p)", dpy, config, win, attrib_list); - - egl::Display *display = static_cast<egl::Display*>(dpy); - - if (!validateConfig(display, config)) - { - return EGL_NO_SURFACE; - } - - if (!rx::IsValidEGLNativeWindowType(win)) - { - recordError(egl::Error(EGL_BAD_NATIVE_WINDOW)); - return EGL_NO_SURFACE; - } - - EGLSurface surface = EGL_NO_SURFACE; - egl::Error error = display->createWindowSurface(win, config, attrib_list, &surface); - if (error.isError()) - { - recordError(error); - return EGL_NO_SURFACE; - } - - return surface; + return egl::GetError(); } -EGLSurface __stdcall eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list) +EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor) { - EVENT("(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, const EGLint *attrib_list = 0x%0.8p)", - dpy, config, attrib_list); - - egl::Display *display = static_cast<egl::Display*>(dpy); - - if (!validateConfig(display, config)) - { - return EGL_NO_SURFACE; - } - - EGLSurface surface = EGL_NO_SURFACE; - egl::Error error = display->createOffscreenSurface(config, NULL, attrib_list, &surface); - if (error.isError()) - { - recordError(error); - return EGL_NO_SURFACE; - } - - return surface; + return egl::Initialize(dpy, major, minor); } -EGLSurface __stdcall eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list) +EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx) { - EVENT("(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, EGLNativePixmapType pixmap = 0x%0.8p, " - "const EGLint *attrib_list = 0x%0.8p)", dpy, config, pixmap, attrib_list); - - egl::Display *display = static_cast<egl::Display*>(dpy); - - if (!validateConfig(display, config)) - { - return EGL_NO_SURFACE; - } - - UNIMPLEMENTED(); // FIXME - - recordError(egl::Error(EGL_SUCCESS)); - return EGL_NO_SURFACE; + return egl::MakeCurrent(dpy, draw, read, ctx); } -EGLBoolean __stdcall eglDestroySurface(EGLDisplay dpy, EGLSurface surface) +EGLBoolean EGLAPIENTRY eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value) { - EVENT("(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p)", dpy, surface); - - egl::Display *display = static_cast<egl::Display*>(dpy); - egl::Surface *eglSurface = static_cast<egl::Surface*>(surface); - - if (!validateSurface(display, eglSurface)) - { - return EGL_FALSE; - } - - if (surface == EGL_NO_SURFACE) - { - recordError(egl::Error(EGL_BAD_SURFACE)); - return EGL_FALSE; - } - - display->destroySurface((egl::Surface*)surface); - - recordError(egl::Error(EGL_SUCCESS)); - return EGL_TRUE; + return egl::QueryContext(dpy, ctx, attribute, value); } -EGLBoolean __stdcall eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value) +const char* EGLAPIENTRY eglQueryString(EGLDisplay dpy, EGLint name) { - EVENT("(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLint attribute = %d, EGLint *value = 0x%0.8p)", - dpy, surface, attribute, value); - - egl::Display *display = static_cast<egl::Display*>(dpy); - egl::Surface *eglSurface = (egl::Surface*)surface; - - if (!validateSurface(display, eglSurface)) - { - return EGL_FALSE; - } - - if (surface == EGL_NO_SURFACE) - { - recordError(egl::Error(EGL_BAD_SURFACE)); - return EGL_FALSE; - } - - switch (attribute) - { - case EGL_VG_ALPHA_FORMAT: - UNIMPLEMENTED(); // FIXME - break; - case EGL_VG_COLORSPACE: - UNIMPLEMENTED(); // FIXME - break; - case EGL_CONFIG_ID: - *value = eglSurface->getConfigID(); - break; - case EGL_HEIGHT: - *value = eglSurface->getHeight(); - break; - case EGL_HORIZONTAL_RESOLUTION: - UNIMPLEMENTED(); // FIXME - break; - case EGL_LARGEST_PBUFFER: - UNIMPLEMENTED(); // FIXME - break; - case EGL_MIPMAP_TEXTURE: - UNIMPLEMENTED(); // FIXME - break; - case EGL_MIPMAP_LEVEL: - UNIMPLEMENTED(); // FIXME - break; - case EGL_MULTISAMPLE_RESOLVE: - UNIMPLEMENTED(); // FIXME - break; - case EGL_PIXEL_ASPECT_RATIO: - *value = eglSurface->getPixelAspectRatio(); - break; - case EGL_RENDER_BUFFER: - *value = eglSurface->getRenderBuffer(); - break; - case EGL_SWAP_BEHAVIOR: - *value = eglSurface->getSwapBehavior(); - break; - case EGL_TEXTURE_FORMAT: - *value = eglSurface->getTextureFormat(); - break; - case EGL_TEXTURE_TARGET: - *value = eglSurface->getTextureTarget(); - break; - case EGL_VERTICAL_RESOLUTION: - UNIMPLEMENTED(); // FIXME - break; - case EGL_WIDTH: - *value = eglSurface->getWidth(); - break; - case EGL_POST_SUB_BUFFER_SUPPORTED_NV: - *value = eglSurface->isPostSubBufferSupported(); - break; - case EGL_FIXED_SIZE_ANGLE: - *value = eglSurface->isFixedSize(); - break; - default: - recordError(egl::Error(EGL_BAD_ATTRIBUTE)); - return EGL_FALSE; - } - - recordError(egl::Error(EGL_SUCCESS)); - return EGL_TRUE; + return egl::QueryString(dpy, name); } -EGLBoolean __stdcall eglQuerySurfacePointerANGLE(EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value) +EGLBoolean EGLAPIENTRY eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value) { - TRACE("(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLint attribute = %d, void **value = 0x%0.8p)", - dpy, surface, attribute, value); - - egl::Display *display = static_cast<egl::Display*>(dpy); - egl::Surface *eglSurface = (egl::Surface*)surface; - - switch (attribute) - { - case EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE: - { - if (!validateSurface(display, eglSurface)) - { - return EGL_FALSE; - } - - if (surface == EGL_NO_SURFACE) - { - recordError(egl::Error(EGL_BAD_SURFACE)); - return EGL_FALSE; - } - - rx::SwapChain *swapchain = eglSurface->getSwapChain(); - *value = (void*) (swapchain ? swapchain->getShareHandle() : NULL); - } - break; -#if defined(ANGLE_ENABLE_D3D11) - case EGL_DEVICE_EXT: - { - if (!validateDisplay(display)) - { - return EGL_FALSE; - } - - rx::Renderer *renderer = display->getRenderer(); - if (!renderer) - { - *value = NULL; - break; - } - - if (renderer->getMajorShaderModel() < 4) - { - recordError(egl::Error(EGL_BAD_CONTEXT)); - return EGL_FALSE; - } - - *value = static_cast<rx::Renderer11*>(renderer)->getDevice(); - } - break; -#endif - default: - recordError(egl::Error(EGL_BAD_ATTRIBUTE)); - return EGL_FALSE; - } - - recordError(egl::Error(EGL_SUCCESS)); - return EGL_TRUE; + return egl::QuerySurface(dpy, surface, attribute, value); } -EGLBoolean __stdcall eglBindAPI(EGLenum api) +EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surface) { - EVENT("(EGLenum api = 0x%X)", api); - - switch (api) - { - case EGL_OPENGL_API: - case EGL_OPENVG_API: - recordError(egl::Error(EGL_BAD_PARAMETER)); - return EGL_FALSE; // Not supported by this implementation - case EGL_OPENGL_ES_API: - break; - default: - recordError(egl::Error(EGL_BAD_PARAMETER)); - return EGL_FALSE; - } - - egl::setCurrentAPI(api); - - recordError(egl::Error(EGL_SUCCESS)); - return EGL_TRUE; + return egl::SwapBuffers(dpy, surface); } -EGLenum __stdcall eglQueryAPI(void) +EGLBoolean EGLAPIENTRY eglTerminate(EGLDisplay dpy) { - EVENT("()"); - - EGLenum API = egl::getCurrentAPI(); - - recordError(egl::Error(EGL_SUCCESS)); - return API; + return egl::Terminate(dpy); } -EGLBoolean __stdcall eglWaitClient(void) +EGLBoolean EGLAPIENTRY eglWaitGL(void) { - EVENT("()"); - - UNIMPLEMENTED(); // FIXME - - recordError(egl::Error(EGL_SUCCESS)); - return 0; + return egl::WaitGL(); } -EGLBoolean __stdcall eglReleaseThread(void) +EGLBoolean EGLAPIENTRY eglWaitNative(EGLint engine) { - EVENT("()"); - - eglMakeCurrent(EGL_NO_DISPLAY, EGL_NO_CONTEXT, EGL_NO_SURFACE, EGL_NO_SURFACE); - - recordError(egl::Error(EGL_SUCCESS)); - return EGL_TRUE; + return egl::WaitNative(engine); } -EGLSurface __stdcall eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list) +EGLBoolean EGLAPIENTRY eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) { - EVENT("(EGLDisplay dpy = 0x%0.8p, EGLenum buftype = 0x%X, EGLClientBuffer buffer = 0x%0.8p, " - "EGLConfig config = 0x%0.8p, const EGLint *attrib_list = 0x%0.8p)", - dpy, buftype, buffer, config, attrib_list); - - egl::Display *display = static_cast<egl::Display*>(dpy); - - if (!validateConfig(display, config)) - { - return EGL_NO_SURFACE; - } - - if (buftype != EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE || !buffer) - { - recordError(egl::Error(EGL_BAD_PARAMETER)); - return EGL_NO_SURFACE; - } - - EGLSurface surface = EGL_NO_SURFACE; - egl::Error error = display->createOffscreenSurface(config, (HANDLE)buffer, attrib_list, &surface); - if (error.isError()) - { - recordError(error); - return EGL_NO_SURFACE; - } - - return surface; + return egl::BindTexImage(dpy, surface, buffer); } -EGLBoolean __stdcall eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value) +EGLBoolean EGLAPIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) { - EVENT("(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLint attribute = %d, EGLint value = %d)", - dpy, surface, attribute, value); - - egl::Display *display = static_cast<egl::Display*>(dpy); - egl::Surface *eglSurface = static_cast<egl::Surface*>(surface); - - if (!validateSurface(display, eglSurface)) - { - return EGL_FALSE; - } - - switch (attribute) - { - case EGL_WIDTH: - if (!eglSurface->isFixedSize() || !value) { - recordError(egl::Error(EGL_BAD_PARAMETER)); - return EGL_FALSE; - } - eglSurface->setFixedWidth(value); - return EGL_TRUE; - case EGL_HEIGHT: - if (!eglSurface->isFixedSize() || !value) { - recordError(egl::Error(EGL_BAD_PARAMETER)); - return EGL_FALSE; - } - eglSurface->setFixedHeight(value); - return EGL_TRUE; - default: - break; - } - - UNIMPLEMENTED(); // FIXME - - recordError(egl::Error(EGL_SUCCESS)); - return EGL_TRUE; + return egl::ReleaseTexImage(dpy, surface, buffer); } -EGLBoolean __stdcall eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) +EGLBoolean EGLAPIENTRY eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value) { - EVENT("(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLint buffer = %d)", dpy, surface, buffer); - - egl::Display *display = static_cast<egl::Display*>(dpy); - egl::Surface *eglSurface = static_cast<egl::Surface*>(surface); - - if (!validateSurface(display, eglSurface)) - { - return EGL_FALSE; - } - - if (buffer != EGL_BACK_BUFFER) - { - recordError(egl::Error(EGL_BAD_PARAMETER)); - return EGL_FALSE; - } - - if (surface == EGL_NO_SURFACE || eglSurface->getWindowHandle()) - { - recordError(egl::Error(EGL_BAD_SURFACE)); - return EGL_FALSE; - } - - if (eglSurface->getBoundTexture()) - { - recordError(egl::Error(EGL_BAD_ACCESS)); - return EGL_FALSE; - } - - if (eglSurface->getTextureFormat() == EGL_NO_TEXTURE) - { - recordError(egl::Error(EGL_BAD_MATCH)); - return EGL_FALSE; - } - - if (!glBindTexImage(eglSurface)) - { - recordError(egl::Error(EGL_BAD_MATCH)); - return EGL_FALSE; - } - - recordError(egl::Error(EGL_SUCCESS)); - return EGL_TRUE; + return egl::SurfaceAttrib(dpy, surface, attribute, value); } -EGLBoolean __stdcall eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer) +EGLBoolean EGLAPIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval) { - EVENT("(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLint buffer = %d)", dpy, surface, buffer); - - egl::Display *display = static_cast<egl::Display*>(dpy); - egl::Surface *eglSurface = static_cast<egl::Surface*>(surface); - - if (!validateSurface(display, eglSurface)) - { - return EGL_FALSE; - } - - if (buffer != EGL_BACK_BUFFER) - { - recordError(egl::Error(EGL_BAD_PARAMETER)); - return EGL_FALSE; - } - - if (surface == EGL_NO_SURFACE || eglSurface->getWindowHandle()) - { - recordError(egl::Error(EGL_BAD_SURFACE)); - return EGL_FALSE; - } - - if (eglSurface->getTextureFormat() == EGL_NO_TEXTURE) - { - recordError(egl::Error(EGL_BAD_MATCH)); - return EGL_FALSE; - } - - gl::Texture2D *texture = eglSurface->getBoundTexture(); - - if (texture) - { - texture->releaseTexImage(); - } - - recordError(egl::Error(EGL_SUCCESS)); - return EGL_TRUE; + return egl::SwapInterval(dpy, interval); } -EGLBoolean __stdcall eglSwapInterval(EGLDisplay dpy, EGLint interval) +EGLBoolean EGLAPIENTRY eglBindAPI(EGLenum api) { - EVENT("(EGLDisplay dpy = 0x%0.8p, EGLint interval = %d)", dpy, interval); - - egl::Display *display = static_cast<egl::Display*>(dpy); - - if (!validateDisplay(display)) - { - return EGL_FALSE; - } - - egl::Surface *draw_surface = static_cast<egl::Surface*>(egl::getCurrentDrawSurface()); - - if (draw_surface == NULL) - { - recordError(egl::Error(EGL_BAD_SURFACE)); - return EGL_FALSE; - } - - draw_surface->setSwapInterval(interval); - - recordError(egl::Error(EGL_SUCCESS)); - return EGL_TRUE; + return egl::BindAPI(api); } -EGLContext __stdcall eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list) +EGLenum EGLAPIENTRY eglQueryAPI(void) { - EVENT("(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, EGLContext share_context = 0x%0.8p, " - "const EGLint *attrib_list = 0x%0.8p)", dpy, config, share_context, attrib_list); - - // Get the requested client version (default is 1) and check it is 2 or 3. - EGLint client_version = 1; - bool reset_notification = false; - bool robust_access = false; - - if (attrib_list) - { - for (const EGLint* attribute = attrib_list; attribute[0] != EGL_NONE; attribute += 2) - { - switch (attribute[0]) - { - case EGL_CONTEXT_CLIENT_VERSION: - client_version = attribute[1]; - break; - case EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT: - if (attribute[1] == EGL_TRUE) - { - recordError(egl::Error(EGL_BAD_CONFIG)); // Unimplemented - return EGL_NO_CONTEXT; - // robust_access = true; - } - else if (attribute[1] != EGL_FALSE) - { - recordError(egl::Error(EGL_BAD_ATTRIBUTE)); - return EGL_NO_CONTEXT; - } - break; - case EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT: - if (attribute[1] == EGL_LOSE_CONTEXT_ON_RESET_EXT) - { - reset_notification = true; - } - else if (attribute[1] != EGL_NO_RESET_NOTIFICATION_EXT) - { - recordError(egl::Error(EGL_BAD_ATTRIBUTE)); - return EGL_NO_CONTEXT; - } - break; - default: - recordError(egl::Error(EGL_BAD_ATTRIBUTE)); - return EGL_NO_CONTEXT; - } - } - } - - if (client_version != 2 && client_version != 3) - { - recordError(egl::Error(EGL_BAD_CONFIG)); - return EGL_NO_CONTEXT; - } - - egl::Display *display = static_cast<egl::Display*>(dpy); - - if (share_context) - { - gl::Context* sharedGLContext = static_cast<gl::Context*>(share_context); - - if (sharedGLContext->isResetNotificationEnabled() != reset_notification) - { - recordError(egl::Error(EGL_BAD_MATCH)); - return EGL_NO_CONTEXT; - } - - if (sharedGLContext->getClientVersion() != client_version) - { - recordError(egl::Error(EGL_BAD_CONTEXT)); - return EGL_NO_CONTEXT; - } - - // Can not share contexts between displays - if (sharedGLContext->getRenderer() != display->getRenderer()) - { - recordError(egl::Error(EGL_BAD_MATCH)); - return EGL_NO_CONTEXT; - } - } - - if (!validateConfig(display, config)) - { - return EGL_NO_CONTEXT; - } - - EGLContext context = EGL_NO_CONTEXT; - egl::Error error = display->createContext(config, client_version, static_cast<gl::Context*>(share_context), - reset_notification, robust_access, &context); - if (error.isError()) - { - recordError(error); - return EGL_NO_CONTEXT; - } - - return context; + return egl::QueryAPI(); } -EGLBoolean __stdcall eglDestroyContext(EGLDisplay dpy, EGLContext ctx) +EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list) { - EVENT("(EGLDisplay dpy = 0x%0.8p, EGLContext ctx = 0x%0.8p)", dpy, ctx); - - egl::Display *display = static_cast<egl::Display*>(dpy); - gl::Context *context = static_cast<gl::Context*>(ctx); - - if (!validateContext(display, context)) - { - return EGL_FALSE; - } - - if (ctx == EGL_NO_CONTEXT) - { - recordError(egl::Error(EGL_BAD_CONTEXT)); - return EGL_FALSE; - } - - display->destroyContext(context); - - recordError(egl::Error(EGL_SUCCESS)); - return EGL_TRUE; + return egl::CreatePbufferFromClientBuffer(dpy, buftype, buffer, config, attrib_list); } -EGLBoolean __stdcall eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx) +EGLBoolean EGLAPIENTRY eglReleaseThread(void) { - EVENT("(EGLDisplay dpy = 0x%0.8p, EGLSurface draw = 0x%0.8p, EGLSurface read = 0x%0.8p, EGLContext ctx = 0x%0.8p)", - dpy, draw, read, ctx); - - egl::Display *display = static_cast<egl::Display*>(dpy); - gl::Context *context = static_cast<gl::Context*>(ctx); - - bool noContext = (ctx == EGL_NO_CONTEXT); - bool noSurface = (draw == EGL_NO_SURFACE || read == EGL_NO_SURFACE); - if (noContext != noSurface) - { - recordError(egl::Error(EGL_BAD_MATCH)); - return EGL_FALSE; - } - - if (ctx != EGL_NO_CONTEXT && !validateContext(display, context)) - { - return EGL_FALSE; - } - - if (dpy != EGL_NO_DISPLAY && display->isInitialized()) - { - rx::Renderer *renderer = display->getRenderer(); - if (renderer->testDeviceLost(true)) - { - return EGL_FALSE; - } - - if (renderer->isDeviceLost()) - { - recordError(egl::Error(EGL_CONTEXT_LOST)); - return EGL_FALSE; - } - } - - if ((draw != EGL_NO_SURFACE && !validateSurface(display, static_cast<egl::Surface*>(draw))) || - (read != EGL_NO_SURFACE && !validateSurface(display, static_cast<egl::Surface*>(read)))) - { - return EGL_FALSE; - } - - if (draw != read) - { - UNIMPLEMENTED(); // FIXME - } - - egl::setCurrentDisplay(dpy); - egl::setCurrentDrawSurface(draw); - egl::setCurrentReadSurface(read); - - glMakeCurrent(context, display, static_cast<egl::Surface*>(draw)); - - recordError(egl::Error(EGL_SUCCESS)); - return EGL_TRUE; + return egl::ReleaseThread(); } -EGLContext __stdcall eglGetCurrentContext(void) +EGLBoolean EGLAPIENTRY eglWaitClient(void) { - EVENT("()"); - - EGLContext context = glGetCurrentContext(); - - recordError(egl::Error(EGL_SUCCESS)); - return context; + return egl::WaitClient(); } -EGLSurface __stdcall eglGetCurrentSurface(EGLint readdraw) +EGLContext EGLAPIENTRY eglGetCurrentContext(void) { - EVENT("(EGLint readdraw = %d)", readdraw); - - if (readdraw == EGL_READ) - { - recordError(egl::Error(EGL_SUCCESS)); - return egl::getCurrentReadSurface(); - } - else if (readdraw == EGL_DRAW) - { - recordError(egl::Error(EGL_SUCCESS)); - return egl::getCurrentDrawSurface(); - } - else - { - recordError(egl::Error(EGL_BAD_PARAMETER)); - return EGL_NO_SURFACE; - } + return egl::GetCurrentContext(); } -EGLDisplay __stdcall eglGetCurrentDisplay(void) +EGLSync EGLAPIENTRY eglCreateSync(EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list) { - EVENT("()"); - - EGLDisplay dpy = egl::getCurrentDisplay(); - - recordError(egl::Error(EGL_SUCCESS)); - return dpy; + return egl::CreateSync(dpy, type, attrib_list); } -EGLBoolean __stdcall eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value) +EGLBoolean EGLAPIENTRY eglDestroySync(EGLDisplay dpy, EGLSync sync) { - EVENT("(EGLDisplay dpy = 0x%0.8p, EGLContext ctx = 0x%0.8p, EGLint attribute = %d, EGLint *value = 0x%0.8p)", - dpy, ctx, attribute, value); - - egl::Display *display = static_cast<egl::Display*>(dpy); - gl::Context *context = static_cast<gl::Context*>(ctx); - - if (!validateContext(display, context)) - { - return EGL_FALSE; - } - - UNIMPLEMENTED(); // FIXME - - recordError(egl::Error(EGL_SUCCESS)); - return 0; + return egl::DestroySync(dpy, sync); } -EGLBoolean __stdcall eglWaitGL(void) +EGLint EGLAPIENTRY eglClientWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout) { - EVENT("()"); - - UNIMPLEMENTED(); // FIXME - - recordError(egl::Error(EGL_SUCCESS)); - return 0; + return egl::ClientWaitSync(dpy, sync, flags, timeout); } -EGLBoolean __stdcall eglWaitNative(EGLint engine) +EGLBoolean EGLAPIENTRY eglGetSyncAttrib(EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib *value) { - EVENT("(EGLint engine = %d)", engine); - - UNIMPLEMENTED(); // FIXME - - recordError(egl::Error(EGL_SUCCESS)); - return 0; + return egl::GetSyncAttrib(dpy, sync, attribute, value); } -EGLBoolean __stdcall eglSwapBuffers(EGLDisplay dpy, EGLSurface surface) +EGLImage EGLAPIENTRY eglCreateImage(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list) { - EVENT("(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p)", dpy, surface); - - egl::Display *display = static_cast<egl::Display*>(dpy); - egl::Surface *eglSurface = (egl::Surface*)surface; - - if (!validateSurface(display, eglSurface)) - { - return EGL_FALSE; - } - - if (display->getRenderer()->isDeviceLost()) - { - recordError(egl::Error(EGL_CONTEXT_LOST)); - return EGL_FALSE; - } - - if (surface == EGL_NO_SURFACE) - { - recordError(egl::Error(EGL_BAD_SURFACE)); - return EGL_FALSE; - } - - egl::Error error = eglSurface->swap(); - if (error.isError()) - { - recordError(error); - return EGL_FALSE; - } - - recordError(egl::Error(EGL_SUCCESS)); - return EGL_TRUE; + return egl::CreateImage(dpy, ctx, target, buffer, attrib_list); } -EGLBoolean __stdcall eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target) +EGLBoolean EGLAPIENTRY eglDestroyImage(EGLDisplay dpy, EGLImage image) { - EVENT("(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLNativePixmapType target = 0x%0.8p)", dpy, surface, target); - - egl::Display *display = static_cast<egl::Display*>(dpy); - egl::Surface *eglSurface = static_cast<egl::Surface*>(surface); - - if (!validateSurface(display, eglSurface)) - { - return EGL_FALSE; - } - - if (display->getRenderer()->isDeviceLost()) - { - recordError(egl::Error(EGL_CONTEXT_LOST)); - return EGL_FALSE; - } - - UNIMPLEMENTED(); // FIXME - - recordError(egl::Error(EGL_SUCCESS)); - return 0; + return egl::DestroyImage(dpy, image); } -EGLBoolean __stdcall eglPostSubBufferNV(EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height) +EGLDisplay EGLAPIENTRY eglGetPlatformDisplay(EGLenum platform, void *native_display, const EGLAttrib *attrib_list) { - EVENT("(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLint x = %d, EGLint y = %d, EGLint width = %d, EGLint height = %d)", dpy, surface, x, y, width, height); - - if (x < 0 || y < 0 || width < 0 || height < 0) - { - recordError(egl::Error(EGL_BAD_PARAMETER)); - return EGL_FALSE; - } - - egl::Display *display = static_cast<egl::Display*>(dpy); - egl::Surface *eglSurface = static_cast<egl::Surface*>(surface); - - if (!validateSurface(display, eglSurface)) - { - return EGL_FALSE; - } - - if (display->getRenderer()->isDeviceLost()) - { - recordError(egl::Error(EGL_CONTEXT_LOST)); - return EGL_FALSE; - } - - if (surface == EGL_NO_SURFACE) - { - recordError(egl::Error(EGL_BAD_SURFACE)); - return EGL_FALSE; - } + return egl::GetPlatformDisplay(platform, native_display, attrib_list); +} - egl::Error error = eglSurface->postSubBuffer(x, y, width, height); - if (error.isError()) - { - recordError(error); - return EGL_FALSE; - } +EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurface(EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list) +{ + return egl::CreatePlatformWindowSurface(dpy, config, native_window, attrib_list); +} - recordError(egl::Error(EGL_SUCCESS)); - return EGL_TRUE; +EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurface(EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list) +{ + return egl::CreatePlatformPixmapSurface(dpy, config, native_pixmap, attrib_list); } -__eglMustCastToProperFunctionPointerType __stdcall eglGetProcAddress(const char *procname) +EGLBoolean EGLAPIENTRY eglWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags) { - EVENT("(const char *procname = \"%s\")", procname); + return egl::WaitSync(dpy, sync, flags); +} - struct Extension - { - const char *name; - __eglMustCastToProperFunctionPointerType address; - }; +EGLBoolean EGLAPIENTRY eglQuerySurfacePointerANGLE(EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value) +{ + return egl::QuerySurfacePointerANGLE(dpy, surface, attribute, value); +} - static const Extension eglExtensions[] = - { - { "eglQuerySurfacePointerANGLE", (__eglMustCastToProperFunctionPointerType)eglQuerySurfacePointerANGLE }, - { "eglPostSubBufferNV", (__eglMustCastToProperFunctionPointerType)eglPostSubBufferNV }, - { "eglGetPlatformDisplayEXT", (__eglMustCastToProperFunctionPointerType)eglGetPlatformDisplayEXT }, - { "", NULL }, - }; +EGLBoolean EGLAPIENTRY eglPostSubBufferNV(EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height) +{ + return egl::PostSubBufferNV(dpy, surface, x, y, width, height); +} - for (unsigned int ext = 0; ext < ArraySize(eglExtensions); ext++) - { - if (strcmp(procname, eglExtensions[ext].name) == 0) - { - return (__eglMustCastToProperFunctionPointerType)eglExtensions[ext].address; - } - } +EGLDisplay EGLAPIENTRY eglGetPlatformDisplayEXT(EGLenum platform, void *native_display, const EGLint *attrib_list) +{ + return egl::GetPlatformDisplayEXT(platform, native_display, attrib_list); +} - return glGetProcAddress(procname); +__eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress(const char *procname) +{ + return egl::GetProcAddress(procname); } + } diff --git a/src/3rdparty/angle/src/libEGL/libEGL.def b/src/3rdparty/angle/src/libEGL/libEGL.def index d7949d0354..823cba2f88 100644 --- a/src/3rdparty/angle/src/libEGL/libEGL.def +++ b/src/3rdparty/angle/src/libEGL/libEGL.def @@ -39,3 +39,15 @@ EXPORTS eglGetPlatformDisplayEXT @35 eglQuerySurfacePointerANGLE @36 eglPostSubBufferNV @37 + + ; 1.5 entry points + eglCreateSync @38 + eglDestroySync @39 + eglClientWaitSync @40 + eglGetSyncAttrib @41 + eglCreateImage @42 + eglDestroyImage @43 + eglGetPlatformDisplay @44 + eglCreatePlatformWindowSurface @45 + eglCreatePlatformPixmapSurface @46 + eglWaitSync @47 diff --git a/src/3rdparty/angle/src/libEGL/libEGL.rc b/src/3rdparty/angle/src/libEGL/libEGL.rc deleted file mode 100644 index 65e0aa50c8..0000000000 --- a/src/3rdparty/angle/src/libEGL/libEGL.rc +++ /dev/null @@ -1,103 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include <windows.h> -#include "../common/version.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// English (U.S.) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -#ifdef _WIN32 -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""afxres.h""\r\n" - "#include ""../common/version.h""\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION ANGLE_MAJOR_VERSION,ANGLE_MINOR_VERSION,0,0 - PRODUCTVERSION ANGLE_MAJOR_VERSION,ANGLE_MINOR_VERSION,0,0 - FILEFLAGSMASK 0x17L -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "FileDescription", "ANGLE libEGL Dynamic Link Library" - VALUE "FileVersion", ANGLE_VERSION_STRING - VALUE "InternalName", "libEGL" - VALUE "LegalCopyright", "Copyright (C) 2011 Google Inc." - VALUE "OriginalFilename", "libEGL.dll" - VALUE "PrivateBuild", ANGLE_VERSION_STRING - VALUE "ProductName", "ANGLE libEGL Dynamic Link Library" - VALUE "ProductVersion", ANGLE_VERSION_STRING - VALUE "Comments", "Build Date: " ANGLE_COMMIT_DATE - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#endif // English (U.S.) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED diff --git a/src/3rdparty/angle/src/libEGL/libEGL_mingw32.def b/src/3rdparty/angle/src/libEGL/libEGL_mingw32.def index 492ad4d0cf..6a771a54b8 100644 --- a/src/3rdparty/angle/src/libEGL/libEGL_mingw32.def +++ b/src/3rdparty/angle/src/libEGL/libEGL_mingw32.def @@ -39,3 +39,15 @@ EXPORTS eglGetPlatformDisplayEXT@12 @35 eglQuerySurfacePointerANGLE@16 @36 eglPostSubBufferNV@24 @37 + + ; 1.5 entry points + eglCreateSync @38 + eglDestroySync @39 + eglClientWaitSync @40 + eglGetSyncAttrib @41 + eglCreateImage @42 + eglDestroyImage @43 + eglGetPlatformDisplay @44 + eglCreatePlatformWindowSurface @45 + eglCreatePlatformPixmapSurface @46 + eglWaitSync @47 diff --git a/src/3rdparty/angle/src/libEGL/libEGLd.def b/src/3rdparty/angle/src/libEGL/libEGLd.def index 0ebd27d0e1..cab7dc9d24 100644 --- a/src/3rdparty/angle/src/libEGL/libEGLd.def +++ b/src/3rdparty/angle/src/libEGL/libEGLd.def @@ -39,3 +39,15 @@ EXPORTS eglGetPlatformDisplayEXT @35 eglQuerySurfacePointerANGLE @36 eglPostSubBufferNV @37 + + ; 1.5 entry points + eglCreateSync @38 + eglDestroySync @39 + eglClientWaitSync @40 + eglGetSyncAttrib @41 + eglCreateImage @42 + eglDestroyImage @43 + eglGetPlatformDisplay @44 + eglCreatePlatformWindowSurface @45 + eglCreatePlatformPixmapSurface @46 + eglWaitSync @47 diff --git a/src/3rdparty/angle/src/libEGL/main.cpp b/src/3rdparty/angle/src/libEGL/main.cpp deleted file mode 100644 index e88cad775f..0000000000 --- a/src/3rdparty/angle/src/libEGL/main.cpp +++ /dev/null @@ -1,203 +0,0 @@ -// -// Copyright (c) 2002-2012 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. -// - -// main.cpp: DLL entry point and management of thread-local data. - -#include "libEGL/main.h" - -#include "common/debug.h" -#include "common/tls.h" - -static TLSIndex currentTLS = TLS_OUT_OF_INDEXES; - -namespace egl -{ - -Current *AllocateCurrent() -{ - ASSERT(currentTLS != TLS_OUT_OF_INDEXES); - if (currentTLS == TLS_OUT_OF_INDEXES) - { - return NULL; - } - - Current *current = new Current(); - current->error = EGL_SUCCESS; - current->API = EGL_OPENGL_ES_API; - current->display = EGL_NO_DISPLAY; - current->drawSurface = EGL_NO_SURFACE; - current->readSurface = EGL_NO_SURFACE; - - if (!SetTLSValue(currentTLS, current)) - { - ERR("Could not set thread local storage."); - return NULL; - } - - return current; -} - -void DeallocateCurrent() -{ - Current *current = reinterpret_cast<Current*>(GetTLSValue(currentTLS)); - SafeDelete(current); - SetTLSValue(currentTLS, NULL); -} - -} - -#ifndef QT_OPENGL_ES_2_ANGLE_STATIC - -extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved) -{ - switch (reason) - { - case DLL_PROCESS_ATTACH: - { -#if defined(ANGLE_ENABLE_DEBUG_TRACE) - FILE *debug = fopen(TRACE_OUTPUT_FILE, "rt"); - - if (debug) - { - fclose(debug); - debug = fopen(TRACE_OUTPUT_FILE, "wt"); // Erase - - if (debug) - { - fclose(debug); - } - } -#endif - - currentTLS = CreateTLSIndex(); - if (currentTLS == TLS_OUT_OF_INDEXES) - { - return FALSE; - } - -#ifdef ANGLE_ENABLE_DEBUG_ANNOTATIONS - gl::InitializeDebugAnnotations(); -#endif - } - // Fall through to initialize index - case DLL_THREAD_ATTACH: - { - egl::AllocateCurrent(); - } - break; - case DLL_THREAD_DETACH: - { - egl::DeallocateCurrent(); - } - break; - case DLL_PROCESS_DETACH: - { - egl::DeallocateCurrent(); - DestroyTLSIndex(currentTLS); - -#ifdef ANGLE_ENABLE_DEBUG_ANNOTATIONS - gl::UninitializeDebugAnnotations(); -#endif - } - break; - default: - break; - } - - return TRUE; -} - -#endif // !QT_OPENGL_ES_2_ANGLE_STATIC - -namespace egl -{ - -Current *GetCurrentData() -{ -#ifndef QT_OPENGL_ES_2_ANGLE_STATIC - Current *current = reinterpret_cast<Current*>(GetTLSValue(currentTLS)); - - // ANGLE issue 488: when the dll is loaded after thread initialization, - // thread local storage (current) might not exist yet. - return (current ? current : AllocateCurrent()); -#else - // No precautions for thread safety taken as ANGLE is used single-threaded in Qt. - static Current current = { EGL_SUCCESS, EGL_OPENGL_ES_API, EGL_NO_DISPLAY, EGL_NO_SURFACE, EGL_NO_SURFACE }; - return ¤t; -#endif -} - -void recordError(const Error &error) -{ - Current *current = GetCurrentData(); - - current->error = error.getCode(); -} - -EGLint getCurrentError() -{ - Current *current = GetCurrentData(); - - return current->error; -} - -void setCurrentAPI(EGLenum API) -{ - Current *current = GetCurrentData(); - - current->API = API; -} - -EGLenum getCurrentAPI() -{ - Current *current = GetCurrentData(); - - return current->API; -} - -void setCurrentDisplay(EGLDisplay dpy) -{ - Current *current = GetCurrentData(); - - current->display = dpy; -} - -EGLDisplay getCurrentDisplay() -{ - Current *current = GetCurrentData(); - - return current->display; -} - -void setCurrentDrawSurface(EGLSurface surface) -{ - Current *current = GetCurrentData(); - - current->drawSurface = surface; -} - -EGLSurface getCurrentDrawSurface() -{ - Current *current = GetCurrentData(); - - return current->drawSurface; -} - -void setCurrentReadSurface(EGLSurface surface) -{ - Current *current = GetCurrentData(); - - current->readSurface = surface; -} - -EGLSurface getCurrentReadSurface() -{ - Current *current = GetCurrentData(); - - return current->readSurface; -} - -} diff --git a/src/3rdparty/angle/src/libEGL/main.h b/src/3rdparty/angle/src/libEGL/main.h deleted file mode 100644 index e5361a4a5e..0000000000 --- a/src/3rdparty/angle/src/libEGL/main.h +++ /dev/null @@ -1,45 +0,0 @@ -// -// 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. -// - -// main.h: Management of thread-local data. - -#ifndef LIBEGL_MAIN_H_ -#define LIBEGL_MAIN_H_ - -#include "libEGL/Error.h" - -#include <EGL/egl.h> -#include <EGL/eglext.h> - -namespace egl -{ -struct Current -{ - EGLint error; - EGLenum API; - EGLDisplay display; - EGLSurface drawSurface; - EGLSurface readSurface; -}; - -void recordError(const Error &error); -EGLint getCurrentError(); - -void setCurrentAPI(EGLenum API); -EGLenum getCurrentAPI(); - -void setCurrentDisplay(EGLDisplay dpy); -EGLDisplay getCurrentDisplay(); - -void setCurrentDrawSurface(EGLSurface surface); -EGLSurface getCurrentDrawSurface(); - -void setCurrentReadSurface(EGLSurface surface); -EGLSurface getCurrentReadSurface(); - -} - -#endif // LIBEGL_MAIN_H_ |