summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/angle/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/angle/src/common')
-rw-r--r--src/3rdparty/angle/src/common/MemoryBuffer.cpp80
-rw-r--r--src/3rdparty/angle/src/common/MemoryBuffer.h38
-rw-r--r--src/3rdparty/angle/src/common/NativeWindow.h82
-rw-r--r--src/3rdparty/angle/src/common/Optional.h61
-rw-r--r--src/3rdparty/angle/src/common/RefCountObject.cpp47
-rw-r--r--src/3rdparty/angle/src/common/RefCountObject.h95
-rw-r--r--src/3rdparty/angle/src/common/angleutils.cpp3
-rw-r--r--src/3rdparty/angle/src/common/angleutils.h35
-rw-r--r--src/3rdparty/angle/src/common/blocklayout.cpp251
-rw-r--r--src/3rdparty/angle/src/common/blocklayout.h127
-rw-r--r--src/3rdparty/angle/src/common/debug.cpp263
-rw-r--r--src/3rdparty/angle/src/common/debug.h82
-rw-r--r--src/3rdparty/angle/src/common/event_tracer.cpp38
-rw-r--r--src/3rdparty/angle/src/common/event_tracer.h34
-rw-r--r--src/3rdparty/angle/src/common/features.h35
-rw-r--r--src/3rdparty/angle/src/common/mathutil.h61
-rw-r--r--src/3rdparty/angle/src/common/platform.h109
-rw-r--r--src/3rdparty/angle/src/common/tls.h4
-rw-r--r--src/3rdparty/angle/src/common/utilities.cpp40
-rw-r--r--src/3rdparty/angle/src/common/utilities.h18
-rw-r--r--src/3rdparty/angle/src/common/version.h13
-rw-r--r--src/3rdparty/angle/src/common/win32/NativeWindow.cpp66
-rw-r--r--src/3rdparty/angle/src/common/winrt/CoreWindowNativeWindow.cpp200
-rw-r--r--src/3rdparty/angle/src/common/winrt/CoreWindowNativeWindow.h39
-rw-r--r--src/3rdparty/angle/src/common/winrt/InspectableNativeWindow.cpp274
-rw-r--r--src/3rdparty/angle/src/common/winrt/InspectableNativeWindow.h91
-rw-r--r--src/3rdparty/angle/src/common/winrt/SwapChainPanelNativeWindow.cpp226
-rw-r--r--src/3rdparty/angle/src/common/winrt/SwapChainPanelNativeWindow.h79
28 files changed, 518 insertions, 1973 deletions
diff --git a/src/3rdparty/angle/src/common/MemoryBuffer.cpp b/src/3rdparty/angle/src/common/MemoryBuffer.cpp
new file mode 100644
index 0000000000..e7a3fb4a2b
--- /dev/null
+++ b/src/3rdparty/angle/src/common/MemoryBuffer.cpp
@@ -0,0 +1,80 @@
+//
+// 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 "common/MemoryBuffer.h"
+
+#include <algorithm>
+#include <cstdlib>
+
+#include "common/debug.h"
+
+namespace rx
+{
+
+MemoryBuffer::MemoryBuffer()
+ : mSize(0),
+ mData(NULL)
+{
+}
+
+MemoryBuffer::~MemoryBuffer()
+{
+ free(mData);
+ mData = NULL;
+}
+
+bool MemoryBuffer::resize(size_t size)
+{
+ if (size == 0)
+ {
+ free(mData);
+ mData = NULL;
+ mSize = 0;
+ return true;
+ }
+
+ if (size == mSize)
+ {
+ return true;
+ }
+
+ // Only reallocate if the size has changed.
+ uint8_t *newMemory = reinterpret_cast<uint8_t*>(malloc(sizeof(uint8_t) * size));
+ if (newMemory == NULL)
+ {
+ return false;
+ }
+
+ if (mData)
+ {
+ // Copy the intersection of the old data and the new data
+ std::copy(mData, mData + std::min(mSize, size), newMemory);
+ free(mData);
+ }
+
+ mData = newMemory;
+ mSize = size;
+
+ return true;
+}
+
+size_t MemoryBuffer::size() const
+{
+ return mSize;
+}
+
+const uint8_t *MemoryBuffer::data() const
+{
+ return mData;
+}
+
+uint8_t *MemoryBuffer::data()
+{
+ ASSERT(mData);
+ return mData;
+}
+
+}
diff --git a/src/3rdparty/angle/src/common/MemoryBuffer.h b/src/3rdparty/angle/src/common/MemoryBuffer.h
new file mode 100644
index 0000000000..ec621cbca7
--- /dev/null
+++ b/src/3rdparty/angle/src/common/MemoryBuffer.h
@@ -0,0 +1,38 @@
+//
+// 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 COMMON_MEMORYBUFFER_H_
+#define COMMON_MEMORYBUFFER_H_
+
+#include "common/angleutils.h"
+
+#include <cstddef>
+#include <stdint.h>
+
+namespace rx
+{
+
+class MemoryBuffer : angle::NonCopyable
+{
+ public:
+ MemoryBuffer();
+ ~MemoryBuffer();
+
+ bool resize(size_t size);
+ size_t size() const;
+ bool empty() const { return mSize == 0; }
+
+ const uint8_t *data() const;
+ uint8_t *data();
+
+ private:
+ size_t mSize;
+ uint8_t *mData;
+};
+
+}
+
+#endif // COMMON_MEMORYBUFFER_H_
diff --git a/src/3rdparty/angle/src/common/NativeWindow.h b/src/3rdparty/angle/src/common/NativeWindow.h
deleted file mode 100644
index c4a0e42bcc..0000000000
--- a/src/3rdparty/angle/src/common/NativeWindow.h
+++ /dev/null
@@ -1,82 +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.
-//
-
-// NativeWindow.h: Defines NativeWindow, a class for managing and
-// performing operations on an EGLNativeWindowType.
-// It is used for HWND (Desktop Windows) and IInspectable objects
-//(Windows Store Applications).
-
-#ifndef COMMON_NATIVEWINDOW_H_
-#define COMMON_NATIVEWINDOW_H_
-
-#include <EGL/eglplatform.h>
-#include "common/debug.h"
-#include "common/platform.h"
-
-// DXGISwapChain and DXGIFactory are typedef'd to specific required
-// types. The HWND NativeWindow implementation requires IDXGISwapChain
-// and IDXGIFactory and the Windows Store NativeWindow
-// implementation requires IDXGISwapChain1 and IDXGIFactory2.
-#if defined(ANGLE_ENABLE_WINDOWS_STORE)
-typedef IDXGISwapChain1 DXGISwapChain;
-typedef IDXGIFactory2 DXGIFactory;
-
-#include <wrl.h>
-#include <wrl/wrappers/corewrappers.h>
-#include <windows.applicationmodel.core.h>
-#include <memory>
-
-namespace rx
-{
-class InspectableNativeWindow;
-}
-
-using namespace Microsoft::WRL;
-using namespace Microsoft::WRL::Wrappers;
-
-#else
-typedef IDXGISwapChain DXGISwapChain;
-typedef IDXGIFactory DXGIFactory;
-#endif
-
-namespace rx
-{
-
-class NativeWindow
-{
-public:
- explicit NativeWindow(EGLNativeWindowType window, EGLNativeDisplayType display);
-
- bool initialize();
- bool getClientRect(LPRECT rect);
- bool isIconic();
-
-# if defined(ANGLE_ENABLE_D3D11)
- typedef ID3D11Device Device;
-#else
- typedef IDirect3DDevice9 Device;
-#endif
- HRESULT createSwapChain(Device* device, DXGIFactory* factory,
- DXGI_FORMAT format, UINT width, UINT height,
- DXGISwapChain** swapChain);
-
- inline EGLNativeWindowType getNativeWindow() const { return mWindow; }
- inline EGLNativeDisplayType getNativeDisplay() const { return mDisplay; }
-
- private:
- EGLNativeWindowType mWindow;
- EGLNativeDisplayType mDisplay;
-
-#if defined(ANGLE_ENABLE_WINDOWS_STORE)
- std::shared_ptr<InspectableNativeWindow> mImpl;
-#endif
-
-};
-
-bool IsValidEGLNativeWindowType(EGLNativeWindowType window);
-}
-
-#endif // COMMON_NATIVEWINDOW_H_
diff --git a/src/3rdparty/angle/src/common/Optional.h b/src/3rdparty/angle/src/common/Optional.h
new file mode 100644
index 0000000000..9665b7ddf6
--- /dev/null
+++ b/src/3rdparty/angle/src/common/Optional.h
@@ -0,0 +1,61 @@
+//
+// Copyright (c) 2015 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.
+//
+// Optional.h:
+// Represents a type that may be invalid, similar to std::optional.
+//
+
+#ifndef COMMON_OPTIONAL_H_
+#define COMMON_OPTIONAL_H_
+
+template <class T>
+struct Optional
+{
+ Optional()
+ : mValid(false),
+ mValue(T())
+ {}
+
+ explicit Optional(const T &valueIn)
+ : mValid(true),
+ mValue(valueIn)
+ {}
+
+ Optional(const Optional &other)
+ : mValid(other.mValid),
+ mValue(other.mValue)
+ {}
+
+ Optional &operator=(const Optional &other)
+ {
+ this->mValid = other.mValid;
+ this->mValue = other.mValue;
+ return *this;
+ }
+
+ static Optional None()
+ {
+ return Optional();
+ }
+
+ bool valid() const { return mValid; }
+ const T &value() const { return mValue; }
+
+ bool operator==(const Optional &other) const
+ {
+ return ((mValid == other.mValid) && (!mValid || (mValue == other.mValue)));
+ }
+
+ bool operator!=(const Optional &other) const
+ {
+ return !(*this == other);
+ }
+
+ private:
+ bool mValid;
+ T mValue;
+};
+
+#endif // COMMON_OPTIONAL_H_
diff --git a/src/3rdparty/angle/src/common/RefCountObject.cpp b/src/3rdparty/angle/src/common/RefCountObject.cpp
deleted file mode 100644
index c1ef90cdcc..0000000000
--- a/src/3rdparty/angle/src/common/RefCountObject.cpp
+++ /dev/null
@@ -1,47 +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.
-//
-
-// RefCountObject.cpp: Defines the gl::RefCountObject base class that provides
-// lifecycle support for GL objects using the traditional BindObject scheme, but
-// that need to be reference counted for correct cross-context deletion.
-// (Concretely, textures, buffers and renderbuffers.)
-
-#include "RefCountObject.h"
-
-RefCountObject::RefCountObject(GLuint id)
-{
- mId = id;
- mRefCount = 0;
-}
-
-RefCountObject::~RefCountObject()
-{
- ASSERT(mRefCount == 0);
-}
-
-void RefCountObject::addRef() const
-{
- mRefCount++;
-}
-
-void RefCountObject::release() const
-{
- ASSERT(mRefCount > 0);
-
- if (--mRefCount == 0)
- {
- delete this;
- }
-}
-
-void RefCountObjectBindingPointer::set(RefCountObject *newObject)
-{
- // addRef first in case newObject == mObject and this is the last reference to it.
- if (newObject != NULL) newObject->addRef();
- if (mObject != NULL) mObject->release();
-
- mObject = newObject;
-}
diff --git a/src/3rdparty/angle/src/common/RefCountObject.h b/src/3rdparty/angle/src/common/RefCountObject.h
deleted file mode 100644
index 6eeaee1928..0000000000
--- a/src/3rdparty/angle/src/common/RefCountObject.h
+++ /dev/null
@@ -1,95 +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.
-//
-
-// RefCountObject.h: Defines the gl::RefCountObject base class that provides
-// lifecycle support for GL objects using the traditional BindObject scheme, but
-// that need to be reference counted for correct cross-context deletion.
-// (Concretely, textures, buffers and renderbuffers.)
-
-#ifndef COMMON_REFCOUNTOBJECT_H_
-#define COMMON_REFCOUNTOBJECT_H_
-
-#include "common/debug.h"
-
-#include "angle_gl.h"
-
-#include <cstddef>
-
-class RefCountObject
-{
- public:
- explicit RefCountObject(GLuint id);
- virtual ~RefCountObject();
-
- virtual void addRef() const;
- virtual void release() const;
-
- GLuint id() const { return mId; }
-
- private:
- GLuint mId;
-
- mutable std::size_t mRefCount;
-};
-
-class RefCountObjectBindingPointer
-{
- protected:
- RefCountObjectBindingPointer() : mObject(NULL) { }
- ~RefCountObjectBindingPointer() { ASSERT(mObject == NULL); } // Objects have to be released before the resource manager is destroyed, so they must be explicitly cleaned up.
-
- void set(RefCountObject *newObject);
- RefCountObject *get() const { return mObject; }
-
- public:
- GLuint id() const { return (mObject != NULL) ? mObject->id() : 0; }
- bool operator!() const { return (get() == NULL); }
-
- private:
- RefCountObject *mObject;
-};
-
-template <class ObjectType>
-class BindingPointer : public RefCountObjectBindingPointer
-{
- public:
- void set(ObjectType *newObject) { RefCountObjectBindingPointer::set(newObject); }
- ObjectType *get() const { return static_cast<ObjectType*>(RefCountObjectBindingPointer::get()); }
- ObjectType *operator->() const { return get(); }
-};
-
-template <class ObjectType>
-class OffsetBindingPointer : public RefCountObjectBindingPointer
-{
- public:
- OffsetBindingPointer() : mOffset(0), mSize(0) { }
-
- void set(ObjectType *newObject)
- {
- RefCountObjectBindingPointer::set(newObject);
- mOffset = 0;
- mSize = 0;
- }
-
- void set(ObjectType *newObject, GLintptr offset, GLsizeiptr size)
- {
- RefCountObjectBindingPointer::set(newObject);
- mOffset = offset;
- mSize = size;
- }
-
- GLintptr getOffset() const { return mOffset; }
- GLsizeiptr getSize() const { return mSize; }
-
- ObjectType *get() const { return static_cast<ObjectType*>(RefCountObjectBindingPointer::get()); }
- ObjectType *operator->() const { return get(); }
-
- private:
- GLintptr mOffset;
- GLsizeiptr mSize;
-};
-
-#endif // COMMON_REFCOUNTOBJECT_H_
diff --git a/src/3rdparty/angle/src/common/angleutils.cpp b/src/3rdparty/angle/src/common/angleutils.cpp
index c1367c460a..af5eb6c447 100644
--- a/src/3rdparty/angle/src/common/angleutils.cpp
+++ b/src/3rdparty/angle/src/common/angleutils.cpp
@@ -5,7 +5,8 @@
//
#include "common/angleutils.h"
-#include "debug.h"
+#include "common/debug.h"
+
#include <stdio.h>
#include <vector>
diff --git a/src/3rdparty/angle/src/common/angleutils.h b/src/3rdparty/angle/src/common/angleutils.h
index b343ece5bc..4cf84a3182 100644
--- a/src/3rdparty/angle/src/common/angleutils.h
+++ b/src/3rdparty/angle/src/common/angleutils.h
@@ -11,19 +11,31 @@
#include "common/platform.h"
-#include <stddef.h>
-#include <limits.h>
+#include <climits>
+#include <cstdarg>
+#include <cstddef>
#include <string>
#include <set>
#include <sstream>
-#include <cstdarg>
#include <vector>
-// A macro to disallow the copy constructor and operator= functions
-// This must be used in the private: declarations for a class
-#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
- TypeName(const TypeName&); \
- void operator=(const TypeName&)
+// A helper class to disallow copy and assignment operators
+namespace angle
+{
+
+class NonCopyable
+{
+#if !defined(_MSC_VER) || (_MSC_VER >= 1800)
+ public:
+ NonCopyable() = default;
+ ~NonCopyable() = default;
+ protected:
+ NonCopyable(const NonCopyable&) = delete;
+ void operator=(const NonCopyable&) = delete;
+#endif
+};
+
+}
template <typename T, size_t N>
inline size_t ArraySize(T(&)[N])
@@ -150,13 +162,12 @@ std::string FormatString(const char *fmt, ...);
#define snprintf _snprintf
#endif
-#define VENDOR_ID_AMD 0x1002
-#define VENDOR_ID_INTEL 0x8086
-#define VENDOR_ID_NVIDIA 0x10DE
-
#define GL_BGRA4_ANGLEX 0x6ABC
#define GL_BGR5_A1_ANGLEX 0x6ABD
#define GL_INT_64_ANGLEX 0x6ABE
#define GL_STRUCT_ANGLEX 0x6ABF
+// Hidden enum for the NULL D3D device type.
+#define EGL_PLATFORM_ANGLE_DEVICE_TYPE_NULL_ANGLE 0x6AC0
+
#endif // COMMON_ANGLEUTILS_H_
diff --git a/src/3rdparty/angle/src/common/blocklayout.cpp b/src/3rdparty/angle/src/common/blocklayout.cpp
deleted file mode 100644
index e3b2d43566..0000000000
--- a/src/3rdparty/angle/src/common/blocklayout.cpp
+++ /dev/null
@@ -1,251 +0,0 @@
-//
-// Copyright (c) 2013-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.
-//
-// blocklayout.cpp:
-// Implementation for block layout classes and methods.
-//
-
-#include "common/blocklayout.h"
-#include "common/mathutil.h"
-#include "common/utilities.h"
-
-namespace sh
-{
-
-BlockLayoutEncoder::BlockLayoutEncoder()
- : mCurrentOffset(0)
-{
-}
-
-BlockMemberInfo BlockLayoutEncoder::encodeType(GLenum type, unsigned int arraySize, bool isRowMajorMatrix)
-{
- int arrayStride;
- int matrixStride;
-
- getBlockLayoutInfo(type, arraySize, isRowMajorMatrix, &arrayStride, &matrixStride);
-
- const BlockMemberInfo memberInfo(mCurrentOffset * BytesPerComponent, arrayStride * BytesPerComponent, matrixStride * BytesPerComponent, isRowMajorMatrix);
-
- advanceOffset(type, arraySize, isRowMajorMatrix, arrayStride, matrixStride);
-
- return memberInfo;
-}
-
-void BlockLayoutEncoder::nextRegister()
-{
- mCurrentOffset = rx::roundUp<size_t>(mCurrentOffset, ComponentsPerRegister);
-}
-
-Std140BlockEncoder::Std140BlockEncoder()
-{
-}
-
-void Std140BlockEncoder::enterAggregateType()
-{
- nextRegister();
-}
-
-void Std140BlockEncoder::exitAggregateType()
-{
- nextRegister();
-}
-
-void Std140BlockEncoder::getBlockLayoutInfo(GLenum type, unsigned int arraySize, bool isRowMajorMatrix, int *arrayStrideOut, int *matrixStrideOut)
-{
- // We assume we are only dealing with 4 byte components (no doubles or half-words currently)
- ASSERT(gl::VariableComponentSize(gl::VariableComponentType(type)) == BytesPerComponent);
-
- size_t baseAlignment = 0;
- int matrixStride = 0;
- int arrayStride = 0;
-
- if (gl::IsMatrixType(type))
- {
- baseAlignment = ComponentsPerRegister;
- matrixStride = ComponentsPerRegister;
-
- if (arraySize > 0)
- {
- const int numRegisters = gl::MatrixRegisterCount(type, isRowMajorMatrix);
- arrayStride = ComponentsPerRegister * numRegisters;
- }
- }
- else if (arraySize > 0)
- {
- baseAlignment = ComponentsPerRegister;
- arrayStride = ComponentsPerRegister;
- }
- else
- {
- const int numComponents = gl::VariableComponentCount(type);
- baseAlignment = (numComponents == 3 ? 4u : static_cast<size_t>(numComponents));
- }
-
- mCurrentOffset = rx::roundUp(mCurrentOffset, baseAlignment);
-
- *matrixStrideOut = matrixStride;
- *arrayStrideOut = arrayStride;
-}
-
-void Std140BlockEncoder::advanceOffset(GLenum type, unsigned int arraySize, bool isRowMajorMatrix, int arrayStride, int matrixStride)
-{
- if (arraySize > 0)
- {
- mCurrentOffset += arrayStride * arraySize;
- }
- else if (gl::IsMatrixType(type))
- {
- ASSERT(matrixStride == ComponentsPerRegister);
- const int numRegisters = gl::MatrixRegisterCount(type, isRowMajorMatrix);
- mCurrentOffset += ComponentsPerRegister * numRegisters;
- }
- else
- {
- mCurrentOffset += gl::VariableComponentCount(type);
- }
-}
-
-HLSLBlockEncoder::HLSLBlockEncoder(HLSLBlockEncoderStrategy strategy)
- : mEncoderStrategy(strategy)
-{
-}
-
-void HLSLBlockEncoder::enterAggregateType()
-{
- nextRegister();
-}
-
-void HLSLBlockEncoder::exitAggregateType()
-{
-}
-
-void HLSLBlockEncoder::getBlockLayoutInfo(GLenum type, unsigned int arraySize, bool isRowMajorMatrix, int *arrayStrideOut, int *matrixStrideOut)
-{
- // We assume we are only dealing with 4 byte components (no doubles or half-words currently)
- ASSERT(gl::VariableComponentSize(gl::VariableComponentType(type)) == BytesPerComponent);
-
- int matrixStride = 0;
- int arrayStride = 0;
-
- // if variables are not to be packed, or we're about to
- // pack a matrix or array, skip to the start of the next
- // register
- if (!isPacked() ||
- gl::IsMatrixType(type) ||
- arraySize > 0)
- {
- nextRegister();
- }
-
- if (gl::IsMatrixType(type))
- {
- matrixStride = ComponentsPerRegister;
-
- if (arraySize > 0)
- {
- const int numRegisters = gl::MatrixRegisterCount(type, isRowMajorMatrix);
- arrayStride = ComponentsPerRegister * numRegisters;
- }
- }
- else if (arraySize > 0)
- {
- arrayStride = ComponentsPerRegister;
- }
- else if (isPacked())
- {
- int numComponents = gl::VariableComponentCount(type);
- if ((numComponents + (mCurrentOffset % ComponentsPerRegister)) > ComponentsPerRegister)
- {
- nextRegister();
- }
- }
-
- *matrixStrideOut = matrixStride;
- *arrayStrideOut = arrayStride;
-}
-
-void HLSLBlockEncoder::advanceOffset(GLenum type, unsigned int arraySize, bool isRowMajorMatrix, int arrayStride, int matrixStride)
-{
- if (arraySize > 0)
- {
- mCurrentOffset += arrayStride * (arraySize - 1);
- }
-
- if (gl::IsMatrixType(type))
- {
- ASSERT(matrixStride == ComponentsPerRegister);
- const int numRegisters = gl::MatrixRegisterCount(type, isRowMajorMatrix);
- const int numComponents = gl::MatrixComponentCount(type, isRowMajorMatrix);
- mCurrentOffset += ComponentsPerRegister * (numRegisters - 1);
- mCurrentOffset += numComponents;
- }
- else if (isPacked())
- {
- mCurrentOffset += gl::VariableComponentCount(type);
- }
- else
- {
- mCurrentOffset += ComponentsPerRegister;
- }
-}
-
-void HLSLBlockEncoder::skipRegisters(unsigned int numRegisters)
-{
- mCurrentOffset += (numRegisters * ComponentsPerRegister);
-}
-
-HLSLBlockEncoder::HLSLBlockEncoderStrategy HLSLBlockEncoder::GetStrategyFor(ShShaderOutput outputType)
-{
- switch (outputType)
- {
- case SH_HLSL9_OUTPUT: return ENCODE_LOOSE;
- case SH_HLSL11_OUTPUT: return ENCODE_PACKED;
- default: UNREACHABLE(); return ENCODE_PACKED;
- }
-}
-
-template <class ShaderVarType>
-void HLSLVariableRegisterCount(const ShaderVarType &variable, HLSLBlockEncoder *encoder)
-{
- if (variable.isStruct())
- {
- for (size_t arrayElement = 0; arrayElement < variable.elementCount(); arrayElement++)
- {
- encoder->enterAggregateType();
-
- for (size_t fieldIndex = 0; fieldIndex < variable.fields.size(); fieldIndex++)
- {
- HLSLVariableRegisterCount(variable.fields[fieldIndex], encoder);
- }
-
- encoder->exitAggregateType();
- }
- }
- else
- {
- // We operate only on varyings and uniforms, which do not have matrix layout qualifiers
- encoder->encodeType(variable.type, variable.arraySize, false);
- }
-}
-
-unsigned int HLSLVariableRegisterCount(const Varying &variable)
-{
- HLSLBlockEncoder encoder(HLSLBlockEncoder::ENCODE_PACKED);
- HLSLVariableRegisterCount(variable, &encoder);
-
- const size_t registerBytes = (encoder.BytesPerComponent * encoder.ComponentsPerRegister);
- return static_cast<unsigned int>(rx::roundUp<size_t>(encoder.getBlockSize(), registerBytes) / registerBytes);
-}
-
-unsigned int HLSLVariableRegisterCount(const Uniform &variable, ShShaderOutput outputType)
-{
- HLSLBlockEncoder encoder(HLSLBlockEncoder::GetStrategyFor(outputType));
- HLSLVariableRegisterCount(variable, &encoder);
-
- const size_t registerBytes = (encoder.BytesPerComponent * encoder.ComponentsPerRegister);
- return static_cast<unsigned int>(rx::roundUp<size_t>(encoder.getBlockSize(), registerBytes) / registerBytes);
-}
-
-}
diff --git a/src/3rdparty/angle/src/common/blocklayout.h b/src/3rdparty/angle/src/common/blocklayout.h
deleted file mode 100644
index d46ac6e547..0000000000
--- a/src/3rdparty/angle/src/common/blocklayout.h
+++ /dev/null
@@ -1,127 +0,0 @@
-//
-// Copyright (c) 2013-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.
-//
-// blocklayout.h:
-// Methods and classes related to uniform layout and packing in GLSL and HLSL.
-//
-
-#ifndef COMMON_BLOCKLAYOUT_H_
-#define COMMON_BLOCKLAYOUT_H_
-
-#include <cstddef>
-#include <vector>
-
-#include "angle_gl.h"
-#include <GLSLANG/ShaderLang.h>
-
-namespace sh
-{
-struct ShaderVariable;
-struct InterfaceBlockField;
-struct Uniform;
-struct Varying;
-struct InterfaceBlock;
-
-struct BlockMemberInfo
-{
- BlockMemberInfo(int offset, int arrayStride, int matrixStride, bool isRowMajorMatrix)
- : offset(offset),
- arrayStride(arrayStride),
- matrixStride(matrixStride),
- isRowMajorMatrix(isRowMajorMatrix)
- {}
-
- static BlockMemberInfo getDefaultBlockInfo()
- {
- return BlockMemberInfo(-1, -1, -1, false);
- }
-
- int offset;
- int arrayStride;
- int matrixStride;
- bool isRowMajorMatrix;
-};
-
-class BlockLayoutEncoder
-{
- public:
- BlockLayoutEncoder();
-
- BlockMemberInfo encodeType(GLenum type, unsigned int arraySize, bool isRowMajorMatrix);
-
- size_t getBlockSize() const { return mCurrentOffset * BytesPerComponent; }
- size_t getCurrentRegister() const { return mCurrentOffset / ComponentsPerRegister; }
- size_t getCurrentElement() const { return mCurrentOffset % ComponentsPerRegister; }
-
- virtual void enterAggregateType() = 0;
- virtual void exitAggregateType() = 0;
-
- static const size_t BytesPerComponent = 4u;
- static const unsigned int ComponentsPerRegister = 4u;
-
- protected:
- size_t mCurrentOffset;
-
- void nextRegister();
-
- virtual void getBlockLayoutInfo(GLenum type, unsigned int arraySize, bool isRowMajorMatrix, int *arrayStrideOut, int *matrixStrideOut) = 0;
- virtual void advanceOffset(GLenum type, unsigned int arraySize, bool isRowMajorMatrix, int arrayStride, int matrixStride) = 0;
-};
-
-// Block layout according to the std140 block layout
-// See "Standard Uniform Block Layout" in Section 2.11.6 of the OpenGL ES 3.0 specification
-
-class Std140BlockEncoder : public BlockLayoutEncoder
-{
- public:
- Std140BlockEncoder();
-
- virtual void enterAggregateType();
- virtual void exitAggregateType();
-
- protected:
- virtual void getBlockLayoutInfo(GLenum type, unsigned int arraySize, bool isRowMajorMatrix, int *arrayStrideOut, int *matrixStrideOut);
- virtual void advanceOffset(GLenum type, unsigned int arraySize, bool isRowMajorMatrix, int arrayStride, int matrixStride);
-};
-
-// Block layout packed according to the D3D9 or default D3D10+ register packing rules
-// See http://msdn.microsoft.com/en-us/library/windows/desktop/bb509632(v=vs.85).aspx
-// The strategy should be ENCODE_LOOSE for D3D9 constant blocks, and ENCODE_PACKED
-// for everything else (D3D10+ constant blocks and all attributes/varyings).
-
-class HLSLBlockEncoder : public BlockLayoutEncoder
-{
- public:
- enum HLSLBlockEncoderStrategy
- {
- ENCODE_PACKED,
- ENCODE_LOOSE
- };
-
- HLSLBlockEncoder(HLSLBlockEncoderStrategy strategy);
-
- virtual void enterAggregateType();
- virtual void exitAggregateType();
- void skipRegisters(unsigned int numRegisters);
-
- bool isPacked() const { return mEncoderStrategy == ENCODE_PACKED; }
-
- static HLSLBlockEncoderStrategy GetStrategyFor(ShShaderOutput outputType);
-
- protected:
- virtual void getBlockLayoutInfo(GLenum type, unsigned int arraySize, bool isRowMajorMatrix, int *arrayStrideOut, int *matrixStrideOut);
- virtual void advanceOffset(GLenum type, unsigned int arraySize, bool isRowMajorMatrix, int arrayStride, int matrixStride);
-
- HLSLBlockEncoderStrategy mEncoderStrategy;
-};
-
-// This method returns the number of used registers for a ShaderVariable. It is dependent on the HLSLBlockEncoder
-// class to count the number of used registers in a struct (which are individually packed according to the same rules).
-unsigned int HLSLVariableRegisterCount(const Varying &variable);
-unsigned int HLSLVariableRegisterCount(const Uniform &variable, ShShaderOutput outputType);
-
-}
-
-#endif // COMMON_BLOCKLAYOUT_H_
diff --git a/src/3rdparty/angle/src/common/debug.cpp b/src/3rdparty/angle/src/common/debug.cpp
index 5f55ff1e39..2fc0a2984a 100644
--- a/src/3rdparty/angle/src/common/debug.cpp
+++ b/src/3rdparty/angle/src/common/debug.cpp
@@ -17,172 +17,9 @@
namespace gl
{
-#if defined(ANGLE_ENABLE_DEBUG_ANNOTATIONS)
-// Wraps the D3D9/D3D11 debug annotation functions.
-class DebugAnnotationWrapper
-{
- public:
- DebugAnnotationWrapper() { };
- virtual ~DebugAnnotationWrapper() { };
- virtual void beginEvent(const std::wstring &eventName) = 0;
- virtual void endEvent() = 0;
- virtual void setMarker(const std::wstring &markerName) = 0;
- virtual bool getStatus() = 0;
-};
-#if defined(ANGLE_ENABLE_D3D9)
-class D3D9DebugAnnotationWrapper : public DebugAnnotationWrapper
+namespace
{
- public:
- void beginEvent(const std::wstring &eventName)
- {
- D3DPERF_BeginEvent(0, eventName.c_str());
- }
-
- void endEvent()
- {
- D3DPERF_EndEvent();
- }
-
- void setMarker(const std::wstring &markerName)
- {
- D3DPERF_SetMarker(0, markerName.c_str());
- }
-
- bool getStatus()
- {
- return !!D3DPERF_GetStatus();
- }
-};
-#endif // ANGLE_ENABLE_D3D9
-
-#if defined(ANGLE_ENABLE_D3D11)
-class D3D11DebugAnnotationWrapper : public DebugAnnotationWrapper
-{
- public:
-
- D3D11DebugAnnotationWrapper()
- : mInitialized(false),
- mD3d11Module(NULL),
- mUserDefinedAnnotation(NULL)
- {
- // D3D11 devices can't be created during DllMain.
- // We defer device creation until the object is actually used.
- }
-
- ~D3D11DebugAnnotationWrapper()
- {
- if (mInitialized)
- {
- SafeRelease(mUserDefinedAnnotation);
- FreeLibrary(mD3d11Module);
- }
- }
-
- virtual void beginEvent(const std::wstring &eventName)
- {
- initializeDevice();
-
- mUserDefinedAnnotation->BeginEvent(eventName.c_str());
- }
-
- virtual void endEvent()
- {
- initializeDevice();
-
- mUserDefinedAnnotation->EndEvent();
- }
-
- virtual void setMarker(const std::wstring &markerName)
- {
- initializeDevice();
-
- mUserDefinedAnnotation->SetMarker(markerName.c_str());
- }
-
- virtual bool getStatus()
- {
- // ID3DUserDefinedAnnotation::GetStatus doesn't work with the Graphics Diagnostics tools in Visual Studio 2013.
-
-#if defined(_DEBUG) && defined(ANGLE_ENABLE_WINDOWS_STORE)
- // In the Windows Store, we can use IDXGraphicsAnalysis. The call to GetDebugInterface1 only succeeds if the app is under capture.
- // This should only be called in DEBUG mode.
- // If an app links against DXGIGetDebugInterface1 in release mode then it will fail Windows Store ingestion checks.
- IDXGraphicsAnalysis* graphicsAnalysis;
- DXGIGetDebugInterface1(0, IID_PPV_ARGS(&graphicsAnalysis));
- bool underCapture = (graphicsAnalysis != NULL);
- SafeRelease(graphicsAnalysis);
- return underCapture;
-#endif
-
- // Otherwise, we have to return true here.
- return true;
- }
-
- protected:
-
- void initializeDevice()
- {
- if (!mInitialized)
- {
-#if !defined(ANGLE_ENABLE_WINDOWS_STORE)
- mD3d11Module = LoadLibrary(TEXT("d3d11.dll"));
- ASSERT(mD3d11Module);
-
- PFN_D3D11_CREATE_DEVICE D3D11CreateDevice = (PFN_D3D11_CREATE_DEVICE)GetProcAddress(mD3d11Module, "D3D11CreateDevice");
- ASSERT(D3D11CreateDevice != NULL);
-#endif // !ANGLE_ENABLE_WINDOWS_STORE
-
- ID3D11Device* device = NULL;
- ID3D11DeviceContext* context = NULL;
-
- HRESULT hr = E_FAIL;
-
- // Create a D3D_DRIVER_TYPE_NULL device, which is much cheaper than other types of device.
- hr = D3D11CreateDevice(NULL, D3D_DRIVER_TYPE_NULL, NULL, 0, NULL, 0, D3D11_SDK_VERSION, &device, NULL, &context);
- ASSERT(SUCCEEDED(hr));
-
- hr = context->QueryInterface(__uuidof(mUserDefinedAnnotation), reinterpret_cast<void**>(&mUserDefinedAnnotation));
- ASSERT(SUCCEEDED(hr) && mUserDefinedAnnotation != NULL);
-
- SafeRelease(device);
- SafeRelease(context);
-
- mInitialized = true;
- }
- }
-
- bool mInitialized;
- HMODULE mD3d11Module;
- ID3DUserDefinedAnnotation* mUserDefinedAnnotation;
-};
-#endif // ANGLE_ENABLE_D3D11
-
-static DebugAnnotationWrapper* g_DebugAnnotationWrapper = NULL;
-
-void InitializeDebugAnnotations()
-{
-#if defined(ANGLE_ENABLE_D3D9)
- g_DebugAnnotationWrapper = new D3D9DebugAnnotationWrapper();
-#elif defined(ANGLE_ENABLE_D3D11)
- // If the project uses D3D9 then we can use the D3D9 debug annotations, even with the D3D11 renderer.
- // However, if D3D9 is unavailable (e.g. in Windows Store), then we use D3D11 debug annotations.
- // The D3D11 debug annotations are methods on ID3DUserDefinedAnnotation, which is implemented by the DeviceContext.
- // This doesn't have to be the same DeviceContext that the renderer uses, though.
- g_DebugAnnotationWrapper = new D3D11DebugAnnotationWrapper();
-#endif
-}
-
-void UninitializeDebugAnnotations()
-{
- if (g_DebugAnnotationWrapper != NULL)
- {
- SafeDelete(g_DebugAnnotationWrapper);
- }
-}
-
-#endif // ANGLE_ENABLE_DEBUG_ANNOTATIONS
-
enum DebugTraceOutputType
{
DebugTraceOutputTypeNone,
@@ -190,29 +27,44 @@ enum DebugTraceOutputType
DebugTraceOutputTypeBeginEvent
};
-static void output(bool traceInDebugOnly, DebugTraceOutputType outputType, const char *format, va_list vararg)
-{
-#if defined(ANGLE_ENABLE_DEBUG_ANNOTATIONS)
- static std::vector<char> buffer(512);
+DebugAnnotator *g_debugAnnotator = nullptr;
- if (perfActive())
+void output(bool traceInDebugOnly, MessageType messageType, DebugTraceOutputType outputType,
+ const char *format, va_list vararg)
+{
+ if (DebugAnnotationsActive())
{
+ static std::vector<char> buffer(512);
size_t len = FormatStringIntoVector(format, vararg, buffer);
std::wstring formattedWideMessage(buffer.begin(), buffer.begin() + len);
+ ASSERT(g_debugAnnotator != nullptr);
switch (outputType)
{
- case DebugTraceOutputTypeNone:
- break;
- case DebugTraceOutputTypeBeginEvent:
- g_DebugAnnotationWrapper->beginEvent(formattedWideMessage);
- break;
- case DebugTraceOutputTypeSetMarker:
- g_DebugAnnotationWrapper->setMarker(formattedWideMessage);
- break;
+ case DebugTraceOutputTypeNone:
+ break;
+ case DebugTraceOutputTypeBeginEvent:
+ g_debugAnnotator->beginEvent(formattedWideMessage);
+ break;
+ case DebugTraceOutputTypeSetMarker:
+ g_debugAnnotator->setMarker(formattedWideMessage);
+ break;
}
}
-#endif // ANGLE_ENABLE_DEBUG_ANNOTATIONS
+
+ std::string formattedMessage;
+ UNUSED_TRACE_VARIABLE(formattedMessage);
+
+#if !defined(NDEBUG) && defined(_MSC_VER)
+ if (messageType == MESSAGE_ERR)
+ {
+ if (formattedMessage.empty())
+ {
+ formattedMessage = FormatString(format, vararg);
+ }
+ OutputDebugStringA(formattedMessage.c_str());
+ }
+#endif
#if defined(ANGLE_ENABLE_DEBUG_TRACE)
#if defined(NDEBUG)
@@ -221,7 +73,10 @@ static void output(bool traceInDebugOnly, DebugTraceOutputType outputType, const
return;
}
#endif // NDEBUG
- std::string formattedMessage = FormatString(format, vararg);
+ if (formattedMessage.empty())
+ {
+ formattedMessage = FormatString(format, vararg);
+ }
static std::ofstream file(TRACE_OUTPUT_FILE, std::ofstream::app);
if (file)
@@ -237,53 +92,57 @@ static void output(bool traceInDebugOnly, DebugTraceOutputType outputType, const
#endif // ANGLE_ENABLE_DEBUG_TRACE
}
-void trace(bool traceInDebugOnly, const char *format, ...)
+} // namespace
+
+bool DebugAnnotationsActive()
{
- va_list vararg;
- va_start(vararg, format);
#if defined(ANGLE_ENABLE_DEBUG_ANNOTATIONS)
- output(traceInDebugOnly, DebugTraceOutputTypeSetMarker, format, vararg);
+ return g_debugAnnotator != nullptr && g_debugAnnotator->getStatus();
#else
- output(traceInDebugOnly, DebugTraceOutputTypeNone, format, vararg);
+ return false;
#endif
- va_end(vararg);
}
-bool perfActive()
+void InitializeDebugAnnotations(DebugAnnotator *debugAnnotator)
{
-#if defined(ANGLE_ENABLE_DEBUG_ANNOTATIONS)
- static bool active = g_DebugAnnotationWrapper->getStatus();
- return active;
-#else
- return false;
-#endif
+ UninitializeDebugAnnotations();
+ g_debugAnnotator = debugAnnotator;
+}
+
+void UninitializeDebugAnnotations()
+{
+ // Pointer is not managed.
+ g_debugAnnotator = nullptr;
+}
+
+void trace(bool traceInDebugOnly, MessageType messageType, const char *format, ...)
+{
+ va_list vararg;
+ va_start(vararg, format);
+ output(traceInDebugOnly, messageType, DebugTraceOutputTypeSetMarker, format, vararg);
+ va_end(vararg);
}
ScopedPerfEventHelper::ScopedPerfEventHelper(const char* format, ...)
{
#if !defined(ANGLE_ENABLE_DEBUG_TRACE)
- if (!perfActive())
+ if (!DebugAnnotationsActive())
{
return;
}
#endif // !ANGLE_ENABLE_DEBUG_TRACE
va_list vararg;
va_start(vararg, format);
-#if defined(ANGLE_ENABLE_DEBUG_ANNOTATIONS)
- output(true, DebugTraceOutputTypeBeginEvent, format, vararg);
-#else
- output(true, DebugTraceOutputTypeNone, format, vararg);
-#endif // ANGLE_ENABLE_DEBUG_ANNOTATIONS
+ output(true, MESSAGE_EVENT, DebugTraceOutputTypeBeginEvent, format, vararg);
va_end(vararg);
}
ScopedPerfEventHelper::~ScopedPerfEventHelper()
{
-#if defined(ANGLE_ENABLE_DEBUG_ANNOTATIONS)
- if (perfActive())
+ if (DebugAnnotationsActive())
{
- g_DebugAnnotationWrapper->endEvent();
+ g_debugAnnotator->endEvent();
}
-#endif
}
+
}
diff --git a/src/3rdparty/angle/src/common/debug.h b/src/3rdparty/angle/src/common/debug.h
index c177f51314..c4f118ebae 100644
--- a/src/3rdparty/angle/src/common/debug.h
+++ b/src/3rdparty/angle/src/common/debug.h
@@ -9,8 +9,9 @@
#ifndef COMMON_DEBUG_H_
#define COMMON_DEBUG_H_
-#include <stdio.h>
#include <assert.h>
+#include <stdio.h>
+#include <string>
#include "common/angleutils.h"
@@ -20,50 +21,71 @@
namespace gl
{
- // Outputs text to the debugging log, or the debugging window
- void trace(bool traceInDebugOnly, const char *format, ...);
- // Returns whether D3DPERF is active.
- bool perfActive();
+enum MessageType
+{
+ MESSAGE_TRACE,
+ MESSAGE_FIXME,
+ MESSAGE_ERR,
+ MESSAGE_EVENT,
+};
- // Pairs a D3D begin event with an end event.
- class ScopedPerfEventHelper
- {
- public:
- ScopedPerfEventHelper(const char* format, ...);
- ~ScopedPerfEventHelper();
+// Outputs text to the debugging log, or the debugging window
+void trace(bool traceInDebugOnly, MessageType messageType, const char *format, ...);
- private:
- DISALLOW_COPY_AND_ASSIGN(ScopedPerfEventHelper);
- };
+// Pairs a D3D begin event with an end event.
+class ScopedPerfEventHelper : angle::NonCopyable
+{
+ public:
+ ScopedPerfEventHelper(const char* format, ...);
+ ~ScopedPerfEventHelper();
+};
+
+// Wraps the D3D9/D3D11 debug annotation functions.
+class DebugAnnotator : angle::NonCopyable
+{
+ public:
+ DebugAnnotator() { };
+ virtual ~DebugAnnotator() { };
+ virtual void beginEvent(const std::wstring &eventName) = 0;
+ virtual void endEvent() = 0;
+ virtual void setMarker(const std::wstring &markerName) = 0;
+ virtual bool getStatus() = 0;
+};
+
+void InitializeDebugAnnotations(DebugAnnotator *debugAnnotator);
+void UninitializeDebugAnnotations();
+bool DebugAnnotationsActive();
- void InitializeDebugAnnotations();
- void UninitializeDebugAnnotations();
}
-// A macro to output a trace of a function call and its arguments to the debugging log
#if defined(ANGLE_ENABLE_DEBUG_TRACE) || defined(ANGLE_ENABLE_DEBUG_ANNOTATIONS)
-#define TRACE(message, ...) gl::trace(true, "trace: %s(%d): " message "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__)
+#define ANGLE_TRACE_ENABLED
+#endif
+
+// A macro to output a trace of a function call and its arguments to the debugging log
+#if defined(ANGLE_TRACE_ENABLED)
+#define TRACE(message, ...) gl::trace(true, gl::MESSAGE_TRACE, "trace: %s(%d): " message "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__)
#else
#define TRACE(message, ...) (void(0))
#endif
// A macro to output a function call and its arguments to the debugging log, to denote an item in need of fixing.
-#if defined(ANGLE_ENABLE_DEBUG_TRACE) || defined(ANGLE_ENABLE_DEBUG_ANNOTATIONS)
-#define FIXME(message, ...) gl::trace(false, "fixme: %s(%d): " message "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__)
+#if defined(ANGLE_TRACE_ENABLED)
+#define FIXME(message, ...) gl::trace(false, gl::MESSAGE_FIXME, "fixme: %s(%d): " message "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__)
#else
#define FIXME(message, ...) (void(0))
#endif
// A macro to output a function call and its arguments to the debugging log, in case of error.
-#if defined(ANGLE_ENABLE_DEBUG_TRACE) || defined(ANGLE_ENABLE_DEBUG_ANNOTATIONS)
-#define ERR(message, ...) gl::trace(false, "err: %s(%d): " message "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__)
+#if defined(ANGLE_TRACE_ENABLED)
+#define ERR(message, ...) gl::trace(false, gl::MESSAGE_ERR, "err: %s(%d): " message "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__)
#else
#define ERR(message, ...) (void(0))
#endif
// A macro to log a performance event around a scope.
-#if defined(ANGLE_ENABLE_DEBUG_TRACE) || defined(ANGLE_ENABLE_DEBUG_ANNOTATIONS)
+#if defined(ANGLE_TRACE_ENABLED)
#if defined(_MSC_VER)
#define EVENT(message, ...) gl::ScopedPerfEventHelper scopedPerfEventHelper ## __LINE__("%s" message "\n", __FUNCTION__, __VA_ARGS__);
#else
@@ -73,6 +95,10 @@ namespace gl
#define EVENT(message, ...) (void(0))
#endif
+#if defined(ANGLE_TRACE_ENABLED)
+#undef ANGLE_TRACE_ENABLED
+#endif
+
// A macro asserting a condition and outputting failures to the debug log
#if !defined(NDEBUG)
#define ASSERT(expression) do { \
@@ -130,14 +156,4 @@ namespace gl
#define HAS_DYNAMIC_TYPE(type, obj) true
#endif
-// A macro functioning as a compile-time assert to validate constant conditions
-#if (defined(_MSC_VER) && _MSC_VER >= 1600) || (defined(__GNUC__) && (__GNUC__ > 4 || __GNUC_MINOR__ >= 3))
-#define META_ASSERT_MSG(condition, msg) static_assert(condition, msg)
-#else
-#define META_ASSERT_CONCAT(a, b) a ## b
-#define META_ASSERT_CONCAT2(a, b) META_ASSERT_CONCAT(a, b)
-#define META_ASSERT_MSG(condition, msg) typedef int META_ASSERT_CONCAT2(COMPILE_TIME_ASSERT_, __LINE__)[static_cast<bool>(condition)?1:-1]
-#endif
-#define META_ASSERT(condition) META_ASSERT_MSG(condition, "compile time assertion failed.")
-
#endif // COMMON_DEBUG_H_
diff --git a/src/3rdparty/angle/src/common/event_tracer.cpp b/src/3rdparty/angle/src/common/event_tracer.cpp
new file mode 100644
index 0000000000..eb0c98c9e5
--- /dev/null
+++ b/src/3rdparty/angle/src/common/event_tracer.cpp
@@ -0,0 +1,38 @@
+// Copyright (c) 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.
+
+#include "common/event_tracer.h"
+
+namespace gl
+{
+
+GetCategoryEnabledFlagFunc g_getCategoryEnabledFlag;
+AddTraceEventFunc g_addTraceEvent;
+
+} // namespace gl
+
+namespace gl
+{
+
+const unsigned char* TraceGetTraceCategoryEnabledFlag(const char* name)
+{
+ if (g_getCategoryEnabledFlag)
+ {
+ return g_getCategoryEnabledFlag(name);
+ }
+ static unsigned char disabled = 0;
+ return &disabled;
+}
+
+void TraceAddTraceEvent(char phase, const unsigned char* categoryGroupEnabled, const char* name, unsigned long long id,
+ int numArgs, const char** argNames, const unsigned char* argTypes,
+ const unsigned long long* argValues, unsigned char flags)
+{
+ if (g_addTraceEvent)
+ {
+ g_addTraceEvent(phase, categoryGroupEnabled, name, id, numArgs, argNames, argTypes, argValues, flags);
+ }
+}
+
+} // namespace gl
diff --git a/src/3rdparty/angle/src/common/event_tracer.h b/src/3rdparty/angle/src/common/event_tracer.h
new file mode 100644
index 0000000000..dbe4c1bef9
--- /dev/null
+++ b/src/3rdparty/angle/src/common/event_tracer.h
@@ -0,0 +1,34 @@
+// Copyright (c) 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.
+
+#ifndef COMMON_EVENT_TRACER_H_
+#define COMMON_EVENT_TRACER_H_
+
+#include "common/platform.h"
+
+extern "C" {
+
+typedef const unsigned char* (*GetCategoryEnabledFlagFunc)(const char* name);
+typedef void (*AddTraceEventFunc)(char phase, const unsigned char* categoryGroupEnabled, const char* name,
+ unsigned long long id, int numArgs, const char** argNames,
+ const unsigned char* argTypes, const unsigned long long* argValues,
+ unsigned char flags);
+
+}
+
+namespace gl
+{
+
+extern GetCategoryEnabledFlagFunc g_getCategoryEnabledFlag;
+extern AddTraceEventFunc g_addTraceEvent;
+
+const unsigned char* TraceGetTraceCategoryEnabledFlag(const char* name);
+
+void TraceAddTraceEvent(char phase, const unsigned char* categoryGroupEnabled, const char* name, unsigned long long id,
+ int numArgs, const char** argNames, const unsigned char* argTypes,
+ const unsigned long long* argValues, unsigned char flags);
+
+}
+
+#endif // COMMON_EVENT_TRACER_H_
diff --git a/src/3rdparty/angle/src/common/features.h b/src/3rdparty/angle/src/common/features.h
deleted file mode 100644
index b49a0ee852..0000000000
--- a/src/3rdparty/angle/src/common/features.h
+++ /dev/null
@@ -1,35 +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.
-//
-
-#define ANGLE_DISABLED 0
-#define ANGLE_ENABLED 1
-
-// Feature defaults
-
-// Direct3D9EX
-// The "Debug This Pixel..." feature in PIX often fails when using the
-// D3D9Ex interfaces. In order to get debug pixel to work on a Vista/Win 7
-// machine, define "ANGLE_D3D9EX=0" in your project file.
-#if !defined(ANGLE_D3D9EX)
-#define ANGLE_D3D9EX ANGLE_ENABLED
-#endif
-
-// Vsync
-// ENABLED allows Vsync to be configured at runtime
-// DISABLED disallows Vsync
-#if !defined(ANGLE_VSYNC)
-#define ANGLE_VSYNC ANGLE_ENABLED
-#endif
-
-// Program binary loading
-#if !defined(ANGLE_PROGRAM_BINARY_LOAD)
-#define ANGLE_PROGRAM_BINARY_LOAD ANGLE_ENABLED
-#endif
-
-// Shader debug info
-#if !defined(ANGLE_SHADER_DEBUG_INFO)
-#define ANGLE_SHADER_DEBUG_INFO ANGLE_DISABLED
-#endif
diff --git a/src/3rdparty/angle/src/common/mathutil.h b/src/3rdparty/angle/src/common/mathutil.h
index a1717892fd..1015bd2312 100644
--- a/src/3rdparty/angle/src/common/mathutil.h
+++ b/src/3rdparty/angle/src/common/mathutil.h
@@ -6,8 +6,8 @@
// mathutil.h: Math and bit manipulation functions.
-#ifndef LIBGLESV2_MATHUTIL_H_
-#define LIBGLESV2_MATHUTIL_H_
+#ifndef COMMON_MATHUTIL_H_
+#define COMMON_MATHUTIL_H_
#include "common/debug.h"
#include "common/platform.h"
@@ -15,6 +15,7 @@
#include <limits>
#include <algorithm>
#include <string.h>
+#include <stdlib.h>
namespace gl
{
@@ -118,6 +119,9 @@ inline bool supportsSSE2()
return supports;
}
+#if defined(__GNUC__)
+ supports = __builtin_cpu_supports("sse2");
+#else
int info[4];
__cpuid(info, 0);
@@ -127,6 +131,7 @@ inline bool supportsSSE2()
supports = (info[3] >> 26) & 1;
}
+#endif
checked = true;
@@ -353,7 +358,7 @@ inline float float11ToFloat32(unsigned short fp11)
}
else // The value is zero
{
- exponent = -112;
+ exponent = static_cast<unsigned short>(-112);
}
return bitCast<float>(((exponent + 112) << 23) | (mantissa << 17));
@@ -392,7 +397,7 @@ inline float float10ToFloat32(unsigned short fp11)
}
else // The value is zero
{
- exponent = -112;
+ exponent = static_cast<unsigned short>(-112);
}
return bitCast<float>(((exponent + 112) << 23) | (mantissa << 18));
@@ -402,7 +407,7 @@ inline float float10ToFloat32(unsigned short fp11)
template <typename T>
inline float normalizedToFloat(T input)
{
- META_ASSERT(std::numeric_limits<T>::is_integer);
+ static_assert(std::numeric_limits<T>::is_integer, "T must be an integer.");
const float inverseMax = 1.0f / std::numeric_limits<T>::max();
return input * inverseMax;
@@ -411,8 +416,8 @@ inline float normalizedToFloat(T input)
template <unsigned int inputBitCount, typename T>
inline float normalizedToFloat(T input)
{
- META_ASSERT(std::numeric_limits<T>::is_integer);
- META_ASSERT(inputBitCount < (sizeof(T) * 8));
+ static_assert(std::numeric_limits<T>::is_integer, "T must be an integer.");
+ static_assert(inputBitCount < (sizeof(T) * 8), "T must have more bits than inputBitCount.");
const float inverseMax = 1.0f / ((1 << inputBitCount) - 1);
return input * inverseMax;
@@ -427,14 +432,15 @@ inline T floatToNormalized(float input)
template <unsigned int outputBitCount, typename T>
inline T floatToNormalized(float input)
{
- META_ASSERT(outputBitCount < (sizeof(T) * 8));
+ static_assert(outputBitCount < (sizeof(T) * 8), "T must have more bits than outputBitCount.");
return ((1 << outputBitCount) - 1) * input + 0.5f;
}
template <unsigned int inputBitCount, unsigned int inputBitStart, typename T>
inline T getShiftedData(T input)
{
- META_ASSERT(inputBitCount + inputBitStart <= (sizeof(T) * 8));
+ static_assert(inputBitCount + inputBitStart <= (sizeof(T) * 8),
+ "T must have at least as many bits as inputBitCount + inputBitStart.");
const T mask = (1 << inputBitCount) - 1;
return (input >> inputBitStart) & mask;
}
@@ -442,7 +448,8 @@ inline T getShiftedData(T input)
template <unsigned int inputBitCount, unsigned int inputBitStart, typename T>
inline T shiftData(T input)
{
- META_ASSERT(inputBitCount + inputBitStart <= (sizeof(T) * 8));
+ static_assert(inputBitCount + inputBitStart <= (sizeof(T) * 8),
+ "T must have at least as many bits as inputBitCount + inputBitStart.");
const T mask = (1 << inputBitCount) - 1;
return (input & mask) << inputBitStart;
}
@@ -503,6 +510,7 @@ inline unsigned int averageFloat10(unsigned int a, unsigned int b)
namespace rx
{
+// Represents intervals of the type [a, b)
template <typename T>
struct Range
{
@@ -513,6 +521,18 @@ struct Range
T end;
T length() const { return end - start; }
+
+ bool intersects(Range<T> other)
+ {
+ if (start <= other.start)
+ {
+ return other.start < end;
+ }
+ else
+ {
+ return start < other.end;
+ }
+ }
};
typedef Range<int> RangeI;
@@ -533,14 +553,14 @@ inline unsigned int UnsignedCeilDivide(unsigned int value, unsigned int divisor)
template <class T>
inline bool IsUnsignedAdditionSafe(T lhs, T rhs)
{
- META_ASSERT(!std::numeric_limits<T>::is_signed);
+ static_assert(!std::numeric_limits<T>::is_signed, "T must be unsigned.");
return (rhs <= std::numeric_limits<T>::max() - lhs);
}
template <class T>
inline bool IsUnsignedMultiplicationSafe(T lhs, T rhs)
{
- META_ASSERT(!std::numeric_limits<T>::is_signed);
+ static_assert(!std::numeric_limits<T>::is_signed, "T must be unsigned.");
return (lhs == T(0) || rhs == T(0) || (rhs <= std::numeric_limits<T>::max() / lhs));
}
@@ -550,6 +570,21 @@ inline bool IsIntegerCastSafe(BigIntT bigValue)
return (static_cast<BigIntT>(static_cast<SmallIntT>(bigValue)) == bigValue);
}
+#if defined(_MSC_VER)
+
+#define ANGLE_ROTL(x,y) _rotl(x,y)
+
+#else
+
+inline uint32_t RotL(uint32_t x, int8_t r)
+{
+ return (x << r) | (x >> (32 - r));
+}
+
+#define ANGLE_ROTL(x,y) RotL(x,y)
+
+#endif // namespace rx
+
}
-#endif // LIBGLESV2_MATHUTIL_H_
+#endif // COMMON_MATHUTIL_H_
diff --git a/src/3rdparty/angle/src/common/platform.h b/src/3rdparty/angle/src/common/platform.h
index 5bf97f9184..3a2aa91bed 100644
--- a/src/3rdparty/angle/src/common/platform.h
+++ b/src/3rdparty/angle/src/common/platform.h
@@ -14,12 +14,12 @@
#elif defined(__APPLE__)
# define ANGLE_PLATFORM_APPLE 1
# define ANGLE_PLATFORM_POSIX 1
-#elif defined(__linux__)
-# define ANGLE_PLATFORM_LINUX 1
-# define ANGLE_PLATFORM_POSIX 1
#elif defined(ANDROID)
# define ANGLE_PLATFORM_ANDROID 1
# define ANGLE_PLATFORM_POSIX 1
+#elif defined(__linux__) || defined(EMSCRIPTEN)
+# define ANGLE_PLATFORM_LINUX 1
+# define ANGLE_PLATFORM_POSIX 1
#elif defined(__FreeBSD__) || \
defined(__OpenBSD__) || \
defined(__NetBSD__) || \
@@ -34,9 +34,6 @@
#endif
#ifdef ANGLE_PLATFORM_WINDOWS
-# if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PC_APP || WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
-# define ANGLE_ENABLE_WINDOWS_STORE 1
-# endif
# ifndef STRICT
# define STRICT 1
# endif
@@ -50,24 +47,32 @@
# include <windows.h>
# include <intrin.h>
+# if defined(WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP)
+# define ANGLE_ENABLE_WINDOWS_STORE 1
+# endif
+
# if defined(ANGLE_ENABLE_D3D9)
# include <d3d9.h>
-# include <dxgi.h>
-# if !defined(COMPILER_IMPLEMENTATION)
+# if !defined(ANGLE_TRANSLATOR_IMPLEMENTATION)
# include <d3dcompiler.h>
# endif
# endif
# if defined(ANGLE_ENABLE_D3D11)
# include <d3d10_1.h>
-# include <d3d10.h>
# include <d3d11.h>
# include <dxgi.h>
-# if defined(_MSC_VER) && (_MSC_VER >= 1700)
+# if defined(__MINGW32__) && !defined(__d3d11sdklayers_h__)
+# define ANGLE_MINGW32_COMPAT
+# endif
+# if defined(_MSC_VER) && _MSC_VER >= 1800
+# define ANGLE_ENABLE_D3D11_1
+# endif
+# if defined(ANGLE_ENABLE_D3D11_1)
# include <d3d11_1.h>
# include <dxgi1_2.h>
# endif
-# if !defined(COMPILER_IMPLEMENTATION)
+# if !defined(ANGLE_TRANSLATOR_IMPLEMENTATION)
# include <d3dcompiler.h>
# endif
# endif
@@ -75,88 +80,24 @@
# if defined(ANGLE_ENABLE_WINDOWS_STORE)
# include <dxgi1_3.h>
# if defined(_DEBUG)
-# if (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP)
+# if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP
# include <DXProgrammableCapture.h>
# endif
# include <dxgidebug.h>
# endif
# endif
-# if defined(__MINGW32__) // Missing defines on MinGW
-typedef enum D3D11_MAP_FLAG
-{
- D3D11_MAP_FLAG_DO_NOT_WAIT = 0x100000L
-} D3D11_MAP_FLAG;
-typedef struct D3D11_QUERY_DATA_SO_STATISTICS
-{
- UINT64 NumPrimitivesWritten;
- UINT64 PrimitivesStorageNeeded;
-} D3D11_QUERY_DATA_SO_STATISTICS;
-typedef HRESULT (WINAPI *PFN_D3D11_CREATE_DEVICE)(
- IDXGIAdapter *, D3D_DRIVER_TYPE, HMODULE, UINT, CONST D3D_FEATURE_LEVEL *,
- UINT FeatureLevels, UINT, ID3D11Device **, D3D_FEATURE_LEVEL *, ID3D11DeviceContext **);
-#define D3D11_MESSAGE_CATEGORY UINT
-#define D3D11_MESSAGE_SEVERITY UINT
-#define D3D11_MESSAGE_ID UINT
-struct D3D11_MESSAGE;
-typedef struct D3D11_INFO_QUEUE_FILTER_DESC
-{
- UINT NumCategories;
- D3D11_MESSAGE_CATEGORY *pCategoryList;
- UINT NumSeverities;
- D3D11_MESSAGE_SEVERITY *pSeverityList;
- UINT NumIDs;
- D3D11_MESSAGE_ID *pIDList;
-} D3D11_INFO_QUEUE_FILTER_DESC;
-typedef struct D3D11_INFO_QUEUE_FILTER
-{
- D3D11_INFO_QUEUE_FILTER_DESC AllowList;
- D3D11_INFO_QUEUE_FILTER_DESC DenyList;
-} D3D11_INFO_QUEUE_FILTER;
-static const IID IID_ID3D11InfoQueue = { 0x6543dbb6, 0x1b48, 0x42f5, 0xab, 0x82, 0xe9, 0x7e, 0xc7, 0x43, 0x26, 0xf6 };
-MIDL_INTERFACE("6543dbb6-1b48-42f5-ab82-e97ec74326f6") ID3D11InfoQueue : public IUnknown
-{
-public:
- virtual HRESULT __stdcall SetMessageCountLimit(UINT64) = 0;
- virtual void __stdcall ClearStoredMessages() = 0;
- virtual HRESULT __stdcall GetMessage(UINT64, D3D11_MESSAGE *, SIZE_T *) = 0;
- virtual UINT64 __stdcall GetNumMessagesAllowedByStorageFilter() = 0;
- virtual UINT64 __stdcall GetNumMessagesDeniedByStorageFilter() = 0;
- virtual UINT64 __stdcall GetNumStoredMessages() = 0;
- virtual UINT64 __stdcall GetNumStoredMessagesAllowedByRetrievalFilter() = 0;
- virtual UINT64 __stdcall GetNumMessagesDiscardedByMessageCountLimit() = 0;
- virtual UINT64 __stdcall GetMessageCountLimit() = 0;
- virtual HRESULT __stdcall AddStorageFilterEntries(D3D11_INFO_QUEUE_FILTER *) = 0;
- virtual HRESULT __stdcall GetStorageFilter(D3D11_INFO_QUEUE_FILTER *, SIZE_T *) = 0;
- virtual void __stdcall ClearStorageFilter() = 0;
- virtual HRESULT __stdcall PushEmptyStorageFilter() = 0;
- virtual HRESULT __stdcall PushCopyOfStorageFilter() = 0;
- virtual HRESULT __stdcall PushStorageFilter(D3D11_INFO_QUEUE_FILTER *) = 0;
- virtual void __stdcall PopStorageFilter() = 0;
- virtual UINT __stdcall GetStorageFilterStackSize() = 0;
- virtual HRESULT __stdcall AddRetrievalFilterEntries(D3D11_INFO_QUEUE_FILTER *) = 0;
- virtual HRESULT __stdcall GetRetrievalFilter(D3D11_INFO_QUEUE_FILTER *, SIZE_T *) = 0;
- virtual void __stdcall ClearRetrievalFilter() = 0;
- virtual HRESULT __stdcall PushEmptyRetrievalFilter() = 0;
- virtual HRESULT __stdcall PushCopyOfRetrievalFilter() = 0;
- virtual HRESULT __stdcall PushRetrievalFilter(D3D11_INFO_QUEUE_FILTER *) = 0;
- virtual void __stdcall PopRetrievalFilter() = 0;
- virtual UINT __stdcall GetRetrievalFilterStackSize() = 0;
- virtual HRESULT __stdcall AddMessage(D3D11_MESSAGE_CATEGORY, D3D11_MESSAGE_SEVERITY, D3D11_MESSAGE_ID, LPCSTR) = 0;
- virtual HRESULT __stdcall AddApplicationMessage(D3D11_MESSAGE_SEVERITY, LPCSTR) = 0;
- virtual HRESULT __stdcall SetBreakOnCategory(D3D11_MESSAGE_CATEGORY, BOOL) = 0;
- virtual HRESULT __stdcall SetBreakOnSeverity(D3D11_MESSAGE_SEVERITY, BOOL) = 0;
- virtual HRESULT __stdcall SetBreakOnID(D3D11_MESSAGE_ID, BOOL) = 0;
- virtual BOOL __stdcall GetBreakOnCategory(D3D11_MESSAGE_CATEGORY) = 0;
- virtual BOOL __stdcall GetBreakOnSeverity(D3D11_MESSAGE_SEVERITY) = 0;
- virtual BOOL __stdcall GetBreakOnID(D3D11_MESSAGE_ID) = 0;
- virtual void __stdcall SetMuteDebugOutput(BOOL) = 0;
- virtual BOOL __stdcall GetMuteDebugOutput() = 0;
-};
-#endif // __MINGW32__
+# if defined(_MSC_VER) && (_MSC_VER <= 1600)
+# define final
+# define override
+# endif
# undef near
# undef far
#endif
+#if !defined(_M_ARM) && !defined(ANGLE_PLATFORM_ANDROID)
+# define ANGLE_USE_SSE
+#endif
+
#endif // COMMON_PLATFORM_H_
diff --git a/src/3rdparty/angle/src/common/tls.h b/src/3rdparty/angle/src/common/tls.h
index 8a06e92d1a..ca9e07ab70 100644
--- a/src/3rdparty/angle/src/common/tls.h
+++ b/src/3rdparty/angle/src/common/tls.h
@@ -15,7 +15,9 @@
// TLS does not exist for Windows Store and needs to be emulated
# ifdef ANGLE_ENABLE_WINDOWS_STORE
-# define TLS_OUT_OF_INDEXES -1
+# ifndef TLS_OUT_OF_INDEXES
+# define TLS_OUT_OF_INDEXES static_cast<DWORD>(0xFFFFFFFF)
+# endif
# ifndef CREATE_SUSPENDED
# define CREATE_SUSPENDED 0x00000004
# endif
diff --git a/src/3rdparty/angle/src/common/utilities.cpp b/src/3rdparty/angle/src/common/utilities.cpp
index 0eae42cac2..501e9c2564 100644
--- a/src/3rdparty/angle/src/common/utilities.cpp
+++ b/src/3rdparty/angle/src/common/utilities.cpp
@@ -254,7 +254,7 @@ int VariableColumnCount(GLenum type)
return 0;
}
-bool IsSampler(GLenum type)
+bool IsSamplerType(GLenum type)
{
switch (type)
{
@@ -343,9 +343,27 @@ int AllocateFirstFreeBits(unsigned int *bits, unsigned int allocationSize, unsig
return -1;
}
-bool IsCubemapTextureTarget(GLenum target)
+static_assert(GL_TEXTURE_CUBE_MAP_NEGATIVE_X - GL_TEXTURE_CUBE_MAP_POSITIVE_X == 1, "Unexpected GL cube map enum value.");
+static_assert(GL_TEXTURE_CUBE_MAP_POSITIVE_Y - GL_TEXTURE_CUBE_MAP_POSITIVE_X == 2, "Unexpected GL cube map enum value.");
+static_assert(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y - GL_TEXTURE_CUBE_MAP_POSITIVE_X == 3, "Unexpected GL cube map enum value.");
+static_assert(GL_TEXTURE_CUBE_MAP_POSITIVE_Z - GL_TEXTURE_CUBE_MAP_POSITIVE_X == 4, "Unexpected GL cube map enum value.");
+static_assert(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z - GL_TEXTURE_CUBE_MAP_POSITIVE_X == 5, "Unexpected GL cube map enum value.");
+
+bool IsCubeMapTextureTarget(GLenum target)
+{
+ return (target >= FirstCubeMapTextureTarget && target <= LastCubeMapTextureTarget);
+}
+
+size_t CubeMapTextureTargetToLayerIndex(GLenum target)
{
- return (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X && target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z);
+ ASSERT(IsCubeMapTextureTarget(target));
+ return target - static_cast<size_t>(FirstCubeMapTextureTarget);
+}
+
+GLenum LayerIndexToCubeMapTextureTarget(size_t index)
+{
+ ASSERT(index <= (LastCubeMapTextureTarget - FirstCubeMapTextureTarget));
+ return FirstCubeMapTextureTarget + static_cast<GLenum>(index);
}
bool IsTriangleMode(GLenum drawMode)
@@ -486,10 +504,15 @@ void writeFile(const char* path, const void* content, size_t size)
}
#endif // !ANGLE_ENABLE_WINDOWS_STORE
-#if defined(ANGLE_ENABLE_WINDOWS_STORE) && _MSC_FULL_VER < 180031101
+#if defined (ANGLE_PLATFORM_WINDOWS)
-void Sleep(unsigned long dwMilliseconds)
+// Causes the thread to relinquish the remainder of its time slice to any
+// other thread that is ready to run.If there are no other threads ready
+// to run, the function returns immediately, and the thread continues execution.
+void ScheduleYield()
{
+#if defined(ANGLE_ENABLE_WINDOWS_STORE)
+ // This implementation of Sleep exists because it is not available prior to Update 4.
static HANDLE singletonEvent = nullptr;
HANDLE sleepEvent = singletonEvent;
if (!sleepEvent)
@@ -510,7 +533,10 @@ void Sleep(unsigned long dwMilliseconds)
}
// Emulate sleep by waiting with timeout on an event that is never signalled.
- WaitForSingleObjectEx(sleepEvent, dwMilliseconds, false);
+ WaitForSingleObjectEx(sleepEvent, 0, false);
+#else
+ Sleep(0);
+#endif
}
-#endif // ANGLE_ENABLE_WINDOWS_STORE
+#endif
diff --git a/src/3rdparty/angle/src/common/utilities.h b/src/3rdparty/angle/src/common/utilities.h
index 7583d3e160..9f7f5e03c0 100644
--- a/src/3rdparty/angle/src/common/utilities.h
+++ b/src/3rdparty/angle/src/common/utilities.h
@@ -6,8 +6,8 @@
// utilities.h: Conversion functions and other utility routines.
-#ifndef LIBGLESV2_UTILITIES_H
-#define LIBGLESV2_UTILITIES_H
+#ifndef COMMON_UTILITIES_H_
+#define COMMON_UTILITIES_H_
#include "angle_gl.h"
#include <string>
@@ -24,7 +24,7 @@ size_t VariableExternalSize(GLenum type);
GLenum VariableBoolVectorType(GLenum type);
int VariableRowCount(GLenum type);
int VariableColumnCount(GLenum type);
-bool IsSampler(GLenum type);
+bool IsSamplerType(GLenum type);
bool IsMatrixType(GLenum type);
GLenum TransposeMatrixType(GLenum type);
int VariableRegisterCount(GLenum type);
@@ -34,7 +34,11 @@ int VariableSortOrder(GLenum type);
int AllocateFirstFreeBits(unsigned int *bits, unsigned int allocationSize, unsigned int bitsSize);
-bool IsCubemapTextureTarget(GLenum target);
+static const GLenum FirstCubeMapTextureTarget = GL_TEXTURE_CUBE_MAP_POSITIVE_X;
+static const GLenum LastCubeMapTextureTarget = GL_TEXTURE_CUBE_MAP_NEGATIVE_Z;
+bool IsCubeMapTextureTarget(GLenum target);
+size_t CubeMapTextureTargetToLayerIndex(GLenum target);
+GLenum LayerIndexToCubeMapTextureTarget(size_t index);
bool IsTriangleMode(GLenum drawMode);
@@ -51,8 +55,8 @@ std::string getTempPath();
void writeFile(const char* path, const void* data, size_t size);
#endif
-#if defined(ANGLE_ENABLE_WINDOWS_STORE) && _MSC_FULL_VER < 180031101
-void Sleep(_In_ unsigned long dwMilliseconds);
+#if defined (ANGLE_PLATFORM_WINDOWS)
+void ScheduleYield();
#endif
-#endif // LIBGLESV2_UTILITIES_H
+#endif // COMMON_UTILITIES_H_
diff --git a/src/3rdparty/angle/src/common/version.h b/src/3rdparty/angle/src/common/version.h
index f01e0242cb..758c78d44a 100644
--- a/src/3rdparty/angle/src/common/version.h
+++ b/src/3rdparty/angle/src/common/version.h
@@ -1,4 +1,13 @@
-#include "../commit.h"
+//
+// 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 COMMON_VERSION_H_
+#define COMMON_VERSION_H_
+
+#include "id/commit.h"
#define ANGLE_MAJOR_VERSION 2
#define ANGLE_MINOR_VERSION 1
@@ -10,3 +19,5 @@
ANGLE_MACRO_STRINGIFY(ANGLE_MAJOR_VERSION) "." \
ANGLE_MACRO_STRINGIFY(ANGLE_MINOR_VERSION) "." \
ANGLE_COMMIT_HASH
+
+#endif // COMMON_VERSION_H_
diff --git a/src/3rdparty/angle/src/common/win32/NativeWindow.cpp b/src/3rdparty/angle/src/common/win32/NativeWindow.cpp
deleted file mode 100644
index 46082a2e28..0000000000
--- a/src/3rdparty/angle/src/common/win32/NativeWindow.cpp
+++ /dev/null
@@ -1,66 +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.
-//
-
-// NativeWindow.cpp: Handler for managing HWND native window types.
-
-#include "common/NativeWindow.h"
-#include "common/debug.h"
-
-namespace rx
-{
-bool IsValidEGLNativeWindowType(EGLNativeWindowType window)
-{
- return (IsWindow(window) == TRUE);
-}
-
-NativeWindow::NativeWindow(EGLNativeWindowType window, EGLNativeDisplayType display) : mWindow(window), mDisplay(display)
-{
-}
-
-bool NativeWindow::initialize()
-{
- return true;
-}
-
-bool NativeWindow::getClientRect(LPRECT rect)
-{
- return GetClientRect(mWindow, rect) == TRUE;
-}
-
-bool NativeWindow::isIconic()
-{
- return IsIconic(mWindow) == TRUE;
-}
-
-HRESULT NativeWindow::createSwapChain(NativeWindow::Device* device, DXGIFactory* factory,
- DXGI_FORMAT format, unsigned int width, unsigned int height,
- DXGISwapChain** swapChain)
-{
- if (device == NULL || factory == NULL || swapChain == NULL || width == 0 || height == 0)
- {
- return E_INVALIDARG;
- }
-
- DXGI_SWAP_CHAIN_DESC swapChainDesc = { 0 };
- swapChainDesc.BufferCount = 1;
- swapChainDesc.BufferDesc.Format = format;
- swapChainDesc.BufferDesc.Width = width;
- swapChainDesc.BufferDesc.Height = height;
- swapChainDesc.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
- swapChainDesc.BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
- swapChainDesc.BufferDesc.RefreshRate.Numerator = 0;
- swapChainDesc.BufferDesc.RefreshRate.Denominator = 1;
- swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT | DXGI_USAGE_BACK_BUFFER;
- swapChainDesc.Flags = 0;
- swapChainDesc.OutputWindow = mWindow;
- swapChainDesc.SampleDesc.Count = 1;
- swapChainDesc.SampleDesc.Quality = 0;
- swapChainDesc.Windowed = TRUE;
- swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
-
- return factory->CreateSwapChain(device, &swapChainDesc, swapChain);
-}
-}
diff --git a/src/3rdparty/angle/src/common/winrt/CoreWindowNativeWindow.cpp b/src/3rdparty/angle/src/common/winrt/CoreWindowNativeWindow.cpp
deleted file mode 100644
index 9b65c15625..0000000000
--- a/src/3rdparty/angle/src/common/winrt/CoreWindowNativeWindow.cpp
+++ /dev/null
@@ -1,200 +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.
-//
-
-// CoreWindowNativeWindow.cpp: NativeWindow for managing ICoreWindow native window types.
-
-#include <algorithm>
-#include "common/winrt/CoreWindowNativeWindow.h"
-using namespace ABI::Windows::Foundation::Collections;
-
-namespace rx
-{
-
-typedef ITypedEventHandler<ABI::Windows::UI::Core::CoreWindow *, ABI::Windows::UI::Core::WindowSizeChangedEventArgs *> SizeChangedHandler;
-
-CoreWindowNativeWindow::~CoreWindowNativeWindow()
-{
- unregisterForSizeChangeEvents();
-}
-
-bool CoreWindowNativeWindow::initialize(EGLNativeWindowType window, EGLNativeDisplayType display, IPropertySet *propertySet)
-{
- ComPtr<IPropertySet> props = propertySet;
- ComPtr<IInspectable> win = window;
- ComPtr<IInspectable> displayInformation = display;
- SIZE swapChainSize = {};
- bool swapChainSizeSpecified = false;
- HRESULT result = S_OK;
-
- // IPropertySet is an optional parameter and can be null.
- // If one is specified, cache as an IMap and read the properties
- // used for initial host initialization.
- if (propertySet)
- {
- result = props.As(&mPropertyMap);
- if (SUCCEEDED(result))
- {
- // The EGLRenderSurfaceSizeProperty is optional and may be missing. The IPropertySet
- // was prevalidated to contain the EGLNativeWindowType before being passed to
- // this host.
- result = GetOptionalSizePropertyValue(mPropertyMap, EGLRenderSurfaceSizeProperty, &swapChainSize, &swapChainSizeSpecified);
- }
- }
-
- if (SUCCEEDED(result))
- {
- result = win.As(&mCoreWindow);
- }
-
- if (SUCCEEDED(result))
- {
- result = displayInformation.As(&mDisplayInformation);
- }
-
- if (SUCCEEDED(result))
- {
-#if WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP
- ComPtr<ABI::Windows::Graphics::Display::IDisplayInformation2> displayInformation2;
- result = mDisplayInformation.As(&displayInformation2);
- ASSERT(SUCCEEDED(result));
-
- result = displayInformation2->get_RawPixelsPerViewPixel(&mScaleFactor);
- ASSERT(SUCCEEDED(result));
-#else
- ABI::Windows::Graphics::Display::ResolutionScale resolutionScale;
- result = mDisplayInformation->get_ResolutionScale(&resolutionScale);
- ASSERT(SUCCEEDED(result));
-
- mScaleFactor = DOUBLE(resolutionScale) / 100.0;
-#endif
- }
-
- if (SUCCEEDED(result))
- {
- // If a swapchain size is specfied, then the automatic resize
- // behaviors implemented by the host should be disabled. The swapchain
- // will be still be scaled when being rendered to fit the bounds
- // of the host.
- // Scaling of the swapchain output occurs automatically because if
- // the scaling mode setting DXGI_SCALING_STRETCH on the swapchain.
- if (swapChainSizeSpecified)
- {
- mClientRect = { 0, 0, swapChainSize.cx, swapChainSize.cy };
- mSupportsSwapChainResize = false;
- }
- else
- {
- ABI::Windows::Foundation::Rect rect;
- HRESULT result = mCoreWindow->get_Bounds(&rect);
- if (SUCCEEDED(result))
- {
- LONG width = std::floor(rect.Width * mScaleFactor + 0.5);
- LONG height = std::floor(rect.Height * mScaleFactor + 0.5);
- mClientRect = { 0, 0, width, height };
- }
- }
- }
-
- if (SUCCEEDED(result))
- {
- mNewClientRect = mClientRect;
- mClientRectChanged = false;
- return registerForSizeChangeEvents();
- }
-
- return false;
-}
-
-bool CoreWindowNativeWindow::registerForSizeChangeEvents()
-{
- HRESULT result = mCoreWindow->add_SizeChanged(Callback<SizeChangedHandler>(this, &CoreWindowNativeWindow::onSizeChanged).Get(),
- &mSizeChangedEventToken);
-
- if (SUCCEEDED(result))
- {
- return true;
- }
-
- return false;
-}
-
-void CoreWindowNativeWindow::unregisterForSizeChangeEvents()
-{
- if (mCoreWindow)
- {
- (void)mCoreWindow->remove_SizeChanged(mSizeChangedEventToken);
- }
- mSizeChangedEventToken.value = 0;
-}
-
-HRESULT CoreWindowNativeWindow::createSwapChain(ID3D11Device *device, DXGIFactory *factory, DXGI_FORMAT format, unsigned int width, unsigned int height, DXGISwapChain **swapChain)
-{
- if (device == NULL || factory == NULL || swapChain == NULL || width == 0 || height == 0)
- {
- return E_INVALIDARG;
- }
-
- DXGI_SWAP_CHAIN_DESC1 swapChainDesc = { 0 };
- swapChainDesc.Width = width;
- swapChainDesc.Height = height;
- swapChainDesc.Format = format;
- swapChainDesc.Stereo = FALSE;
- swapChainDesc.SampleDesc.Count = 1;
- swapChainDesc.SampleDesc.Quality = 0;
- swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT | DXGI_USAGE_BACK_BUFFER;
- swapChainDesc.BufferCount = 2;
- swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL;
- swapChainDesc.Scaling = DXGI_SCALING_STRETCH;
-
- *swapChain = nullptr;
-
- ComPtr<IDXGISwapChain1> newSwapChain;
- HRESULT result = factory->CreateSwapChainForCoreWindow(device, mCoreWindow.Get(), &swapChainDesc, nullptr, newSwapChain.ReleaseAndGetAddressOf());
- if (SUCCEEDED(result))
- {
-
-#if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) // This block is disabled for Qt applications, as the resize events are expected
- // Test if swapchain supports resize. On Windows Phone devices, this will return DXGI_ERROR_UNSUPPORTED. On
- // other devices DXGI_ERROR_INVALID_CALL should be returned because the combination of flags passed
- // (DXGI_SWAP_CHAIN_FLAG_NONPREROTATED | DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE) are invalid flag combinations.
- if (newSwapChain->ResizeBuffers(swapChainDesc.BufferCount, swapChainDesc.Width, swapChainDesc.Height, swapChainDesc.Format, DXGI_SWAP_CHAIN_FLAG_NONPREROTATED | DXGI_SWAP_CHAIN_FLAG_GDI_COMPATIBLE) == DXGI_ERROR_UNSUPPORTED)
- {
- mSupportsSwapChainResize = false;
- }
-#endif // (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
-
- result = newSwapChain.CopyTo(swapChain);
- }
-
- if (SUCCEEDED(result))
- {
- // If automatic swapchain resize behaviors have been disabled, then
- // unregister for the resize change events.
- if (mSupportsSwapChainResize == false)
- {
- unregisterForSizeChangeEvents();
- }
- }
-
- return result;
-}
-
-// Basically, this shouldn't be used on Phone
-HRESULT CoreWindowNativeWindow::onSizeChanged(ABI::Windows::UI::Core::ICoreWindow *, ABI::Windows::UI::Core::IWindowSizeChangedEventArgs *e)
-{
- ABI::Windows::Foundation::Size size;
- if (SUCCEEDED(e->get_Size(&size)))
- {
- SIZE windowSizeInPixels = {
- std::floor(size.Width * mScaleFactor + 0.5),
- std::floor(size.Height * mScaleFactor + 0.5)
- };
- setNewClientSize(windowSizeInPixels);
- }
-
- return S_OK;
-}
-}
diff --git a/src/3rdparty/angle/src/common/winrt/CoreWindowNativeWindow.h b/src/3rdparty/angle/src/common/winrt/CoreWindowNativeWindow.h
deleted file mode 100644
index 1c5512417d..0000000000
--- a/src/3rdparty/angle/src/common/winrt/CoreWindowNativeWindow.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.
-//
-
-// CoreWindowNativeWindow.h: NativeWindow for managing ICoreWindow native window types.
-
-#ifndef COMMON_WINRT_COREWINDOWNATIVEWINDOW_H_
-#define COMMON_WINRT_COREWINDOWNATIVEWINDOW_H_
-
-#include "common/winrt/InspectableNativeWindow.h"
-#include <memory>
-#include <windows.graphics.display.h>
-
-namespace rx
-{
-
-class CoreWindowNativeWindow : public InspectableNativeWindow, public std::enable_shared_from_this<CoreWindowNativeWindow>
-{
- public:
- ~CoreWindowNativeWindow();
-
- bool initialize(EGLNativeWindowType window, EGLNativeDisplayType display, IPropertySet *propertySet);
- bool registerForSizeChangeEvents();
- void unregisterForSizeChangeEvents();
- HRESULT createSwapChain(ID3D11Device *device, DXGIFactory *factory, DXGI_FORMAT format, unsigned int width, unsigned int height, DXGISwapChain **swapChain);
-
- private:
- HRESULT onSizeChanged(ABI::Windows::UI::Core::ICoreWindow *, ABI::Windows::UI::Core::IWindowSizeChangedEventArgs *);
-
- ComPtr<ABI::Windows::UI::Core::ICoreWindow> mCoreWindow;
- ComPtr<ABI::Windows::Graphics::Display::IDisplayInformation> mDisplayInformation;
- ComPtr<IMap<HSTRING, IInspectable*>> mPropertyMap;
-};
-
-}
-
-#endif // COMMON_WINRT_COREWINDOWNATIVEWINDOW_H_
diff --git a/src/3rdparty/angle/src/common/winrt/InspectableNativeWindow.cpp b/src/3rdparty/angle/src/common/winrt/InspectableNativeWindow.cpp
deleted file mode 100644
index 0589f6dce5..0000000000
--- a/src/3rdparty/angle/src/common/winrt/InspectableNativeWindow.cpp
+++ /dev/null
@@ -1,274 +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.
-//
-
-// InspectableNativeWindow.cpp: NativeWindow base class for managing IInspectable native window types.
-
-#include "common/winrt/CoreWindowNativeWindow.h"
-#include "common/winrt/SwapChainPanelNativeWindow.h"
-
-namespace rx
-{
-NativeWindow::NativeWindow(EGLNativeWindowType window, EGLNativeDisplayType display)
- : mWindow(window), mDisplay(display)
-{
-}
-
-bool NativeWindow::initialize()
-{
- // If the native window type is a IPropertySet, extract the
- // EGLNativeWindowType (IInspectable) and initialize the
- // proper host with this IPropertySet.
- ComPtr<ABI::Windows::Foundation::Collections::IPropertySet> propertySet;
- ComPtr<IInspectable> eglNativeWindow;
- if (IsEGLConfiguredPropertySet(mWindow, &propertySet, &eglNativeWindow))
- {
- // A property set was found and the EGLNativeWindowType was
- // retrieved. The mWindow member of the host to must be updated
- // to use the EGLNativeWindowType specified in the property set.
- // mWindow is treated as a raw pointer not an AddRef'd interface, so
- // the old mWindow does not need a Release() before this assignment.
- mWindow = eglNativeWindow.Get();
- }
-
- ComPtr<ABI::Windows::UI::Core::ICoreWindow> coreWindow;
- ComPtr<ABI::Windows::UI::Xaml::Controls::ISwapChainPanel> swapChainPanel;
- if (IsCoreWindow(mWindow, &coreWindow))
- {
- mImpl = std::make_shared<CoreWindowNativeWindow>();
- if (mImpl)
- {
- return mImpl->initialize(mWindow, mDisplay, propertySet.Get());
- }
- }
- else if (IsSwapChainPanel(mWindow, &swapChainPanel))
- {
- mImpl = std::make_shared<SwapChainPanelNativeWindow>();
- if (mImpl)
- {
- return mImpl->initialize(mWindow, mDisplay, propertySet.Get());
- }
- }
- else
- {
- ERR("Invalid IInspectable EGLNativeWindowType detected. Valid IInspectables include ICoreWindow, ISwapChainPanel and IPropertySet");
- }
-
- return false;
-}
-
-bool NativeWindow::getClientRect(RECT *rect)
-{
- if (mImpl)
- {
- return mImpl->getClientRect(rect);
- }
-
- return false;
-}
-
-bool NativeWindow::isIconic()
-{
- return false;
-}
-
-HRESULT NativeWindow::createSwapChain(ID3D11Device *device, DXGIFactory *factory, DXGI_FORMAT format, unsigned int width, unsigned int height, DXGISwapChain **swapChain)
-{
- if (mImpl)
- {
- return mImpl->createSwapChain(device, factory, format, width, height, swapChain);
- }
-
- return E_UNEXPECTED;
-}
-
-bool IsCoreWindow(EGLNativeWindowType window, ComPtr<ABI::Windows::UI::Core::ICoreWindow> *coreWindow)
-{
- if (!window)
- {
- return false;
- }
-
- ComPtr<IInspectable> win = window;
- ComPtr<ABI::Windows::UI::Core::ICoreWindow> coreWin;
- if (SUCCEEDED(win.As(&coreWin)))
- {
- if (coreWindow != nullptr)
- {
- *coreWindow = coreWin.Detach();
- }
- return true;
- }
-
- return false;
-}
-
-bool IsSwapChainPanel(EGLNativeWindowType window, ComPtr<ABI::Windows::UI::Xaml::Controls::ISwapChainPanel> *swapChainPanel)
-{
- if (!window)
- {
- return false;
- }
-
- ComPtr<IInspectable> win = window;
- ComPtr<ABI::Windows::UI::Xaml::Controls::ISwapChainPanel> panel;
- if (SUCCEEDED(win.As(&panel)))
- {
- if (swapChainPanel != nullptr)
- {
- *swapChainPanel = panel.Detach();
- }
- return true;
- }
-
- return false;
-}
-
-bool IsEGLConfiguredPropertySet(EGLNativeWindowType window, ABI::Windows::Foundation::Collections::IPropertySet **propertySet, IInspectable **eglNativeWindow)
-{
- if (!window)
- {
- return false;
- }
-
- ComPtr<IInspectable> props = window;
- ComPtr<IPropertySet> propSet;
- ComPtr<IInspectable> nativeWindow;
- ComPtr<ABI::Windows::Foundation::Collections::IMap<HSTRING, IInspectable*>> propMap;
- boolean hasEglNativeWindowPropertyKey = false;
-
- HRESULT result = props.As(&propSet);
- if (SUCCEEDED(result))
- {
- result = propSet.As(&propMap);
- }
-
- // Look for the presence of the EGLNativeWindowType in the property set
- if (SUCCEEDED(result))
- {
- result = propMap->HasKey(HStringReference(EGLNativeWindowTypeProperty).Get(), &hasEglNativeWindowPropertyKey);
- }
-
- // If the IPropertySet does not contain the required EglNativeWindowType key, the property set is
- // considered invalid.
- if (SUCCEEDED(result) && !hasEglNativeWindowPropertyKey)
- {
- ERR("Could not find EGLNativeWindowTypeProperty in IPropertySet. Valid EGLNativeWindowTypeProperty values include ICoreWindow");
- return false;
- }
-
- // The EglNativeWindowType property exists, so retreive the IInspectable that represents the EGLNativeWindowType
- if (SUCCEEDED(result) && hasEglNativeWindowPropertyKey)
- {
- result = propMap->Lookup(HStringReference(EGLNativeWindowTypeProperty).Get(), &nativeWindow);
- }
-
- if (SUCCEEDED(result))
- {
- if (propertySet != nullptr)
- {
- result = propSet.CopyTo(propertySet);
- }
- }
-
- if (SUCCEEDED(result))
- {
- if (eglNativeWindow != nullptr)
- {
- result = nativeWindow.CopyTo(eglNativeWindow);
- }
- }
-
- if (SUCCEEDED(result))
- {
- return true;
- }
-
- return false;
-}
-
-// A Valid EGLNativeWindowType IInspectable can only be:
-//
-// ICoreWindow
-// IPropertySet
-//
-// Anything else will be rejected as an invalid IInspectable.
-bool IsValidEGLNativeWindowType(EGLNativeWindowType window)
-{
- return IsCoreWindow(window) || IsSwapChainPanel(window) || IsEGLConfiguredPropertySet(window);
-}
-
-// Attempts to read an optional SIZE property value that is assumed to be in the form of
-// an ABI::Windows::Foundation::Size. This function validates the Size value before returning
-// it to the caller.
-//
-// Possible return values are:
-// S_OK, valueExists == true - optional SIZE value was successfully retrieved and validated
-// S_OK, valueExists == false - optional SIZE value was not found
-// E_INVALIDARG, valueExists = false - optional SIZE value was malformed in the property set.
-// * Incorrect property type ( must be PropertyType_Size)
-// * Invalid property value (width/height must be > 0)
-// Additional errors may be returned from IMap or IPropertyValue
-//
-HRESULT GetOptionalSizePropertyValue(const ComPtr<ABI::Windows::Foundation::Collections::IMap<HSTRING, IInspectable*>>& propertyMap, const wchar_t *propertyName, SIZE *value, bool *valueExists)
-{
- if (!propertyMap || !propertyName || !value || !valueExists)
- {
- return false;
- }
-
- // Assume that the value does not exist
- *valueExists = false;
- *value = { 0, 0 };
-
- ComPtr<ABI::Windows::Foundation::IPropertyValue> propertyValue;
- ABI::Windows::Foundation::PropertyType propertyType = ABI::Windows::Foundation::PropertyType::PropertyType_Empty;
- Size sizeValue = { 0, 0 };
- boolean hasKey = false;
-
- HRESULT result = propertyMap->HasKey(HStringReference(propertyName).Get(), &hasKey);
- if (SUCCEEDED(result) && !hasKey)
- {
- // Value does not exist, so return S_OK and set the exists parameter to false to indicate
- // that a the optional property does not exist.
- *valueExists = false;
- return S_OK;
- }
-
- if (SUCCEEDED(result))
- {
- result = propertyMap->Lookup(HStringReference(propertyName).Get(), &propertyValue);
- }
-
- if (SUCCEEDED(result))
- {
- result = propertyValue->get_Type(&propertyType);
- }
-
- // Check if the expected Size property is of PropertyType_Size type.
- if (SUCCEEDED(result) && propertyType == ABI::Windows::Foundation::PropertyType::PropertyType_Size)
- {
- if (SUCCEEDED(propertyValue->GetSize(&sizeValue)) && (sizeValue.Width > 0 && sizeValue.Height > 0))
- {
- // A valid property value exists
- *value = { static_cast<long>(sizeValue.Width), static_cast<long>(sizeValue.Height) };
- *valueExists = true;
- result = S_OK;
- }
- else
- {
- // An invalid Size property was detected. Width/Height values must > 0
- result = E_INVALIDARG;
- }
- }
- else
- {
- // An invalid property type was detected. Size property must be of PropertyType_Size
- result = E_INVALIDARG;
- }
-
- return result;
-}
-}
diff --git a/src/3rdparty/angle/src/common/winrt/InspectableNativeWindow.h b/src/3rdparty/angle/src/common/winrt/InspectableNativeWindow.h
deleted file mode 100644
index 402941a788..0000000000
--- a/src/3rdparty/angle/src/common/winrt/InspectableNativeWindow.h
+++ /dev/null
@@ -1,91 +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.
-//
-
-// InspectableNativeWindow.h: Host specific implementation interface for
-// managing IInspectable native window types.
-
-#ifndef COMMON_WINRT_INSPECTABLENATIVEWINDOW_H_
-#define COMMON_WINRT_INSPECTABLENATIVEWINDOW_H_
-
-#include "common/platform.h"
-#include "common/NativeWindow.h"
-#include "angle_windowsstore.h"
-
-#include <windows.ui.xaml.h>
-#include <windows.ui.xaml.media.dxinterop.h>
-
-using namespace Microsoft::WRL;
-using namespace Microsoft::WRL::Wrappers;
-using namespace ABI::Windows::Foundation;
-using namespace ABI::Windows::Foundation::Collections;
-
-namespace rx
-{
-class InspectableNativeWindow
-{
- public:
- InspectableNativeWindow() :
- mSupportsSwapChainResize(true),
- mRequiresSwapChainScaling(false),
- mClientRectChanged(false),
- mClientRect({0,0,0,0}),
- mNewClientRect({0,0,0,0}),
- mScaleFactor(1.0)
- {
- mSizeChangedEventToken.value = 0;
- }
- virtual ~InspectableNativeWindow(){}
-
- virtual bool initialize(EGLNativeWindowType window, EGLNativeDisplayType display, IPropertySet *propertySet) = 0;
- virtual HRESULT createSwapChain(ID3D11Device *device, DXGIFactory *factory, DXGI_FORMAT format, unsigned int width, unsigned int height, DXGISwapChain **swapChain) = 0;
- virtual bool registerForSizeChangeEvents() = 0;
- virtual void unregisterForSizeChangeEvents() = 0;
- virtual HRESULT scaleSwapChain(const SIZE& newSize) { return S_OK; }
-
- bool getClientRect(RECT *rect)
- {
- if (mClientRectChanged && mSupportsSwapChainResize)
- {
- mClientRect = mNewClientRect;
- mClientRectChanged = false;
- }
-
- *rect = mClientRect;
-
- return true;
- }
-
- void setNewClientSize(const SIZE &newSize)
- {
- if (mSupportsSwapChainResize && !mRequiresSwapChainScaling)
- {
- mNewClientRect = { 0, 0, newSize.cx, newSize.cy };
- mClientRectChanged = true;
- }
-
- if (mRequiresSwapChainScaling)
- {
- scaleSwapChain(newSize);
- }
- }
-
-protected:
- bool mSupportsSwapChainResize;
- bool mRequiresSwapChainScaling;
- RECT mClientRect;
- RECT mNewClientRect;
- bool mClientRectChanged;
- DOUBLE mScaleFactor;
-
- EventRegistrationToken mSizeChangedEventToken;
-};
-
-bool IsCoreWindow(EGLNativeWindowType window, ComPtr<ABI::Windows::UI::Core::ICoreWindow> *coreWindow = nullptr);
-bool IsSwapChainPanel(EGLNativeWindowType window, ComPtr<ABI::Windows::UI::Xaml::Controls::ISwapChainPanel> *swapChainPanel = nullptr);
-bool IsEGLConfiguredPropertySet(EGLNativeWindowType window, ABI::Windows::Foundation::Collections::IPropertySet **propertySet = nullptr, IInspectable **inspectable = nullptr);
-HRESULT GetOptionalSizePropertyValue(const ComPtr<ABI::Windows::Foundation::Collections::IMap<HSTRING, IInspectable*>>& propertyMap, const wchar_t *propertyName, SIZE *value, bool *valueExists);
-}
-#endif // COMMON_WINRT_INSPECTABLENATIVEWINDOW_H_
diff --git a/src/3rdparty/angle/src/common/winrt/SwapChainPanelNativeWindow.cpp b/src/3rdparty/angle/src/common/winrt/SwapChainPanelNativeWindow.cpp
deleted file mode 100644
index 268dfbd8f0..0000000000
--- a/src/3rdparty/angle/src/common/winrt/SwapChainPanelNativeWindow.cpp
+++ /dev/null
@@ -1,226 +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.
-//
-
-// SwapChainPanelNativeWindow.cpp: NativeWindow for managing ISwapChainPanel native window types.
-
-#include "common/winrt/SwapChainPanelNativeWindow.h"
-#include <algorithm>
-#include <math.h>
-using namespace ABI::Windows::Foundation::Collections;
-
-namespace rx
-{
-SwapChainPanelNativeWindow::~SwapChainPanelNativeWindow()
-{
- unregisterForSizeChangeEvents();
-}
-
-bool SwapChainPanelNativeWindow::initialize(EGLNativeWindowType window, EGLNativeDisplayType display, IPropertySet *propertySet)
-{
- ComPtr<IPropertySet> props = propertySet;
- ComPtr<IInspectable> win = window;
- SIZE swapChainSize = {};
- bool swapChainSizeSpecified = false;
- HRESULT result = S_OK;
-
- // IPropertySet is an optional parameter and can be null.
- // If one is specified, cache as an IMap and read the properties
- // used for initial host initialization.
- if (propertySet)
- {
- result = props.As(&mPropertyMap);
- if (SUCCEEDED(result))
- {
- // The EGLRenderSurfaceSizeProperty is optional and may be missing. The IPropertySet
- // was prevalidated to contain the EGLNativeWindowType before being passed to
- // this host.
- result = GetOptionalSizePropertyValue(mPropertyMap, EGLRenderSurfaceSizeProperty, &swapChainSize, &swapChainSizeSpecified);
- }
- }
-
- if (SUCCEEDED(result))
- {
- result = win.As(&mSwapChainPanel);
- }
-
- if (SUCCEEDED(result))
- {
- // If a swapchain size is specfied, then the automatic resize
- // behaviors implemented by the host should be disabled. The swapchain
- // will be still be scaled when being rendered to fit the bounds
- // of the host.
- // Scaling of the swapchain output needs to be handled by the
- // host for swapchain panels even though the scaling mode setting
- // DXGI_SCALING_STRETCH is configured on the swapchain.
- if (swapChainSizeSpecified)
- {
- mClientRect = { 0, 0, swapChainSize.cx, swapChainSize.cy };
-
- // Enable host swapchain scaling
- mRequiresSwapChainScaling = true;
- }
- else
- {
- result = GetSwapChainPanelSize(mSwapChainPanel, &mClientRect);
- }
- }
-
- if (SUCCEEDED(result))
- {
- mNewClientRect = mClientRect;
- mClientRectChanged = false;
- return registerForSizeChangeEvents();
- }
-
- return false;
-}
-
-bool SwapChainPanelNativeWindow::registerForSizeChangeEvents()
-{
- ComPtr<ABI::Windows::UI::Xaml::ISizeChangedEventHandler> sizeChangedHandler;
- ComPtr<ABI::Windows::UI::Xaml::IFrameworkElement> frameworkElement;
- HRESULT result = Microsoft::WRL::MakeAndInitialize<SwapChainPanelSizeChangedHandler>(sizeChangedHandler.ReleaseAndGetAddressOf(), this->shared_from_this());
-
- if (SUCCEEDED(result))
- {
- result = mSwapChainPanel.As(&frameworkElement);
- }
-
- if (SUCCEEDED(result))
- {
- result = frameworkElement->add_SizeChanged(sizeChangedHandler.Get(), &mSizeChangedEventToken);
- }
-
- if (SUCCEEDED(result))
- {
- return true;
- }
-
- return false;
-}
-
-void SwapChainPanelNativeWindow::unregisterForSizeChangeEvents()
-{
- ComPtr<ABI::Windows::UI::Xaml::IFrameworkElement> frameworkElement;
- if (SUCCEEDED(mSwapChainPanel.As(&frameworkElement)))
- {
- (void)frameworkElement->remove_SizeChanged(mSizeChangedEventToken);
- }
-
- mSizeChangedEventToken.value = 0;
-}
-
-HRESULT SwapChainPanelNativeWindow::createSwapChain(ID3D11Device *device, DXGIFactory *factory, DXGI_FORMAT format, unsigned int width, unsigned int height, DXGISwapChain **swapChain)
-{
- if (device == NULL || factory == NULL || swapChain == NULL || width == 0 || height == 0)
- {
- return E_INVALIDARG;
- }
-
- DXGI_SWAP_CHAIN_DESC1 swapChainDesc = { 0 };
- swapChainDesc.Width = width;
- swapChainDesc.Height = height;
- swapChainDesc.Format = format;
- swapChainDesc.Stereo = FALSE;
- swapChainDesc.SampleDesc.Count = 1;
- swapChainDesc.SampleDesc.Quality = 0;
- swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT | DXGI_USAGE_BACK_BUFFER;
- swapChainDesc.BufferCount = 2;
- swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_SEQUENTIAL;
- swapChainDesc.Scaling = DXGI_SCALING_STRETCH;
- swapChainDesc.AlphaMode = DXGI_ALPHA_MODE_IGNORE;
-
- *swapChain = nullptr;
-
- ComPtr<IDXGISwapChain1> newSwapChain;
- ComPtr<ISwapChainPanelNative> swapChainPanelNative;
- RECT currentPanelSize = {};
-
- HRESULT result = factory->CreateSwapChainForComposition(device, &swapChainDesc, nullptr, newSwapChain.ReleaseAndGetAddressOf());
-
- if (SUCCEEDED(result))
- {
- result = mSwapChainPanel.As(&swapChainPanelNative);
- }
-
- if (SUCCEEDED(result))
- {
- result = swapChainPanelNative->SetSwapChain(newSwapChain.Get());
- }
-
- if (SUCCEEDED(result))
- {
- // The swapchain panel host requires an instance of the swapchain set on the SwapChainPanel
- // to perform the runtime-scale behavior. This swapchain is cached here because there are
- // no methods for retreiving the currently configured on from ISwapChainPanelNative.
- mSwapChain = newSwapChain;
- result = newSwapChain.CopyTo(swapChain);
- }
-
- // If the host is responsible for scaling the output of the swapchain, then
- // scale it now before returning an instance to the caller. This is done by
- // first reading the current size of the swapchain panel, then scaling
- if (SUCCEEDED(result) && mRequiresSwapChainScaling)
- {
- result = GetSwapChainPanelSize(mSwapChainPanel, &currentPanelSize);
- }
-
- // Scale the swapchain to fit inside the contents of the panel.
- if (SUCCEEDED(result) && mRequiresSwapChainScaling)
- {
- SIZE currentSize = { currentPanelSize.right, currentPanelSize.bottom };
- result = scaleSwapChain(currentSize);
- }
-
- if (SUCCEEDED(result))
- {
- // If automatic swapchain resize behaviors have been disabled, then
- // unregister for the resize change events.
- if (mSupportsSwapChainResize == false)
- {
- unregisterForSizeChangeEvents();
- }
- }
-
- return result;
-}
-
-HRESULT SwapChainPanelNativeWindow::scaleSwapChain(const SIZE &newSize)
-{
- ABI::Windows::Foundation::Size renderScale = { (float)newSize.cx/(float)mClientRect.right, (float)newSize.cy/(float)mClientRect.bottom };
- // Setup a scale matrix for the swap chain
- DXGI_MATRIX_3X2_F scaleMatrix = {};
- scaleMatrix._11 = renderScale.Width;
- scaleMatrix._22 = renderScale.Height;
-
- ComPtr<IDXGISwapChain2> swapChain2;
- HRESULT result = mSwapChain.As(&swapChain2);
- if (SUCCEEDED(result))
- {
- result = swapChain2->SetMatrixTransform(&scaleMatrix);
- }
-
- return result;
-}
-
-HRESULT GetSwapChainPanelSize(const ComPtr<ABI::Windows::UI::Xaml::Controls::ISwapChainPanel> &swapChainPanel, RECT *windowSize)
-{
- ComPtr<ABI::Windows::UI::Xaml::IUIElement> uiElement;
- ABI::Windows::Foundation::Size renderSize = { 0, 0 };
- HRESULT result = swapChainPanel.As(&uiElement);
- if (SUCCEEDED(result))
- {
- result = uiElement->get_RenderSize(&renderSize);
- }
-
- if (SUCCEEDED(result))
- {
- *windowSize = { 0, 0, lround(renderSize.Width), lround(renderSize.Height) };
- }
-
- return result;
-}
-}
diff --git a/src/3rdparty/angle/src/common/winrt/SwapChainPanelNativeWindow.h b/src/3rdparty/angle/src/common/winrt/SwapChainPanelNativeWindow.h
deleted file mode 100644
index 5bbf274e64..0000000000
--- a/src/3rdparty/angle/src/common/winrt/SwapChainPanelNativeWindow.h
+++ /dev/null
@@ -1,79 +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.
-//
-
-// SwapChainPanelNativeWindow.h: NativeWindow for managing ISwapChainPanel native window types.
-
-#ifndef COMMON_WINRT_SWAPCHAINPANELNATIVEWINDOW_H_
-#define COMMON_WINRT_SWAPCHAINPANELNATIVEWINDOW_H_
-
-#include "common/winrt/InspectableNativeWindow.h"
-
-namespace rx
-{
-class SwapChainPanelNativeWindow : public InspectableNativeWindow, public std::enable_shared_from_this<SwapChainPanelNativeWindow>
-{
- public:
- ~SwapChainPanelNativeWindow();
-
- bool initialize(EGLNativeWindowType window, EGLNativeDisplayType display, IPropertySet *propertySet);
- bool registerForSizeChangeEvents();
- void unregisterForSizeChangeEvents();
- HRESULT createSwapChain(ID3D11Device *device, DXGIFactory *factory, DXGI_FORMAT format, unsigned int width, unsigned int height, DXGISwapChain **swapChain);
- HRESULT scaleSwapChain(const SIZE &newSize);
-
- private:
- ComPtr<ABI::Windows::UI::Xaml::Controls::ISwapChainPanel> mSwapChainPanel;
- ComPtr<IMap<HSTRING, IInspectable*>> mPropertyMap;
- ComPtr<DXGISwapChain> mSwapChain;
-};
-
-[uuid(8ACBD974-8187-4508-AD80-AEC77F93CF36)]
-class SwapChainPanelSizeChangedHandler :
- public Microsoft::WRL::RuntimeClass<Microsoft::WRL::RuntimeClassFlags<Microsoft::WRL::ClassicCom>, ABI::Windows::UI::Xaml::ISizeChangedEventHandler>
-{
- public:
- SwapChainPanelSizeChangedHandler() { }
- HRESULT RuntimeClassInitialize(std::shared_ptr<InspectableNativeWindow> host)
- {
- if (!host)
- {
- return E_INVALIDARG;
- }
-
- mHost = host;
- return S_OK;
- }
-
- // ISizeChangedEventHandler
- IFACEMETHOD(Invoke)(IInspectable *sender, ABI::Windows::UI::Xaml::ISizeChangedEventArgs *sizeChangedEventArgs)
- {
- std::shared_ptr<InspectableNativeWindow> host = mHost.lock();
- if (host)
- {
- // The size of the ISwapChainPanel control is returned in DIPs.
- // We are keeping these in dips because the swapchain created for composition
- // also uses dip units. This keeps dimensions, viewports, etc in the same unit.
- // XAML Clients of the ISwapChainPanel are required to use dips to define their
- // layout sizes as well.
- ABI::Windows::Foundation::Size newSize;
- HRESULT result = sizeChangedEventArgs->get_NewSize(&newSize);
- if (SUCCEEDED(result))
- {
- SIZE windowSize = { lround(newSize.Width), lround(newSize.Height) };
- host->setNewClientSize(windowSize);
- }
- }
-
- return S_OK;
- }
-
- private:
- std::weak_ptr<InspectableNativeWindow> mHost;
-};
-
-HRESULT GetSwapChainPanelSize(const ComPtr<ABI::Windows::UI::Xaml::Controls::ISwapChainPanel> &swapChainPanel, RECT *windowSize);
-}
-#endif // COMMON_WINRT_SWAPCHAINPANELNATIVEWINDOW_H_