From 311157c3c6849e8efccd88f7594bb34c570a6780 Mon Sep 17 00:00:00 2001 From: Andrew Knight Date: Thu, 25 Sep 2014 13:22:55 +0300 Subject: ANGLE: Upgrade to 2.1~abce76206141 Upgrade to address issues discovered since the last upgrade. Patch notes: 0000-General-fixes-for-ANGLE-2.1.patch added removal of the unused third-party tracing functions 0003-Fix-compilation-with-MinGW-gcc-64-bit.patch removed as it is no longer needed 0011-ANGLE-Fix-compilation-error-on-MinGW-caused-by-trace.patch removed as it is no longer needed 0016-ANGLE-Fix-compilation-with-MinGW-D3D11.patch now supports MinGW 64-bit [ChangeLog][Third-party libraries] ANGLE updated to 2.1~f8602ad91e4f Task-number: QTBUG-40649 Task-number: QTBUG-40658 Task-number: QTBUG-41031 Task-number: QTBUG-41081 Task-number: QTBUG-41308 Task-number: QTBUG-41563 Change-Id: I9f776c8d5cb94ddb12d608a8d5630bfc54437bea Reviewed-by: Friedemann Kleint Reviewed-by: Oliver Wolff Reviewed-by: Kai Koehne --- src/3rdparty/angle/src/common/RefCountObject.h | 4 +- src/3rdparty/angle/src/common/angleutils.cpp | 37 ++++++ src/3rdparty/angle/src/common/angleutils.h | 8 +- src/3rdparty/angle/src/common/blocklayout.cpp | 44 +------ src/3rdparty/angle/src/common/blocklayout.h | 7 +- src/3rdparty/angle/src/common/debug.cpp | 26 +--- src/3rdparty/angle/src/common/debug.h | 4 + src/3rdparty/angle/src/common/event_tracer.cpp | 49 -------- src/3rdparty/angle/src/common/event_tracer.h | 43 ------- src/3rdparty/angle/src/common/mathutil.cpp | 1 + src/3rdparty/angle/src/common/mathutil.h | 18 ++- src/3rdparty/angle/src/common/platform.h | 20 +++- src/3rdparty/angle/src/common/shadervars.h | 157 ------------------------- 13 files changed, 93 insertions(+), 325 deletions(-) create mode 100644 src/3rdparty/angle/src/common/angleutils.cpp delete mode 100644 src/3rdparty/angle/src/common/event_tracer.cpp delete mode 100644 src/3rdparty/angle/src/common/event_tracer.h delete mode 100644 src/3rdparty/angle/src/common/shadervars.h (limited to 'src/3rdparty/angle/src/common') diff --git a/src/3rdparty/angle/src/common/RefCountObject.h b/src/3rdparty/angle/src/common/RefCountObject.h index 8635aa59d8..6eeaee1928 100644 --- a/src/3rdparty/angle/src/common/RefCountObject.h +++ b/src/3rdparty/angle/src/common/RefCountObject.h @@ -12,11 +12,11 @@ #ifndef COMMON_REFCOUNTOBJECT_H_ #define COMMON_REFCOUNTOBJECT_H_ -#include +#include "common/debug.h" #include "angle_gl.h" -#include "common/debug.h" +#include class RefCountObject { diff --git a/src/3rdparty/angle/src/common/angleutils.cpp b/src/3rdparty/angle/src/common/angleutils.cpp new file mode 100644 index 0000000000..2673abf30a --- /dev/null +++ b/src/3rdparty/angle/src/common/angleutils.cpp @@ -0,0 +1,37 @@ +// +// 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/angleutils.h" + +#include + +std::string FormatString(const char *fmt, va_list vararg) +{ + static std::vector buffer(512); + + // Attempt to just print to the current buffer + int len = vsnprintf(&buffer[0], buffer.size(), fmt, vararg); + if (len < 0 || static_cast(len) >= buffer.size()) + { + // Buffer was not large enough, calculate the required size and resize the buffer + len = vsnprintf(NULL, 0, fmt, vararg); + buffer.resize(len + 1); + + // Print again + vsnprintf(&buffer[0], buffer.size(), fmt, vararg); + } + + return std::string(buffer.data(), len); +} + +std::string FormatString(const char *fmt, ...) +{ + va_list vararg; + va_start(vararg, fmt); + std::string result = FormatString(fmt, vararg); + va_end(vararg); + return result; +} diff --git a/src/3rdparty/angle/src/common/angleutils.h b/src/3rdparty/angle/src/common/angleutils.h index d94b4f5ff9..ddbbd5f501 100644 --- a/src/3rdparty/angle/src/common/angleutils.h +++ b/src/3rdparty/angle/src/common/angleutils.h @@ -16,6 +16,7 @@ #include #include #include +#include // A macro to disallow the copy constructor and operator= functions // This must be used in the private: declarations for a class @@ -23,8 +24,8 @@ TypeName(const TypeName&); \ void operator=(const TypeName&) -template -inline unsigned int ArraySize(T(&)[N]) +template +inline size_t ArraySize(T(&)[N]) { return N; } @@ -131,6 +132,9 @@ inline std::string Str(int i) return strstr.str(); } +std::string FormatString(const char *fmt, va_list vararg); +std::string FormatString(const char *fmt, ...); + #if defined(_MSC_VER) && _MSC_VER < 1900 #define snprintf _snprintf #endif diff --git a/src/3rdparty/angle/src/common/blocklayout.cpp b/src/3rdparty/angle/src/common/blocklayout.cpp index 7db6e980f1..e3b2d43566 100644 --- a/src/3rdparty/angle/src/common/blocklayout.cpp +++ b/src/3rdparty/angle/src/common/blocklayout.cpp @@ -8,7 +8,6 @@ // #include "common/blocklayout.h" -#include "common/shadervars.h" #include "common/mathutil.h" #include "common/utilities.h" @@ -20,46 +19,7 @@ BlockLayoutEncoder::BlockLayoutEncoder() { } -void BlockLayoutEncoder::encodeInterfaceBlockFields(const std::vector &fields) -{ - for (unsigned int fieldIndex = 0; fieldIndex < fields.size(); fieldIndex++) - { - const InterfaceBlockField &variable = fields[fieldIndex]; - - if (variable.fields.size() > 0) - { - const unsigned int elementCount = std::max(1u, variable.arraySize); - - for (unsigned int elementIndex = 0; elementIndex < elementCount; elementIndex++) - { - enterAggregateType(); - encodeInterfaceBlockFields(variable.fields); - exitAggregateType(); - } - } - else - { - encodeInterfaceBlockField(variable); - } - } -} - -BlockMemberInfo BlockLayoutEncoder::encodeInterfaceBlockField(const InterfaceBlockField &field) -{ - int arrayStride; - int matrixStride; - - ASSERT(field.fields.empty()); - getBlockLayoutInfo(field.type, field.arraySize, field.isRowMajorMatrix, &arrayStride, &matrixStride); - - const BlockMemberInfo memberInfo(mCurrentOffset * BytesPerComponent, arrayStride * BytesPerComponent, matrixStride * BytesPerComponent, field.isRowMajorMatrix); - - advanceOffset(field.type, field.arraySize, field.isRowMajorMatrix, arrayStride, matrixStride); - - return memberInfo; -} - -void BlockLayoutEncoder::encodeType(GLenum type, unsigned int arraySize, bool isRowMajorMatrix) +BlockMemberInfo BlockLayoutEncoder::encodeType(GLenum type, unsigned int arraySize, bool isRowMajorMatrix) { int arrayStride; int matrixStride; @@ -69,6 +29,8 @@ void BlockLayoutEncoder::encodeType(GLenum type, unsigned int arraySize, bool is const BlockMemberInfo memberInfo(mCurrentOffset * BytesPerComponent, arrayStride * BytesPerComponent, matrixStride * BytesPerComponent, isRowMajorMatrix); advanceOffset(type, arraySize, isRowMajorMatrix, arrayStride, matrixStride); + + return memberInfo; } void BlockLayoutEncoder::nextRegister() diff --git a/src/3rdparty/angle/src/common/blocklayout.h b/src/3rdparty/angle/src/common/blocklayout.h index 3a1ab5ccb0..d46ac6e547 100644 --- a/src/3rdparty/angle/src/common/blocklayout.h +++ b/src/3rdparty/angle/src/common/blocklayout.h @@ -10,10 +10,11 @@ #ifndef COMMON_BLOCKLAYOUT_H_ #define COMMON_BLOCKLAYOUT_H_ +#include #include + #include "angle_gl.h" #include -#include namespace sh { @@ -48,9 +49,7 @@ class BlockLayoutEncoder public: BlockLayoutEncoder(); - void encodeInterfaceBlockFields(const std::vector &fields); - BlockMemberInfo encodeInterfaceBlockField(const InterfaceBlockField &field); - void encodeType(GLenum type, unsigned int arraySize, bool isRowMajorMatrix); + BlockMemberInfo encodeType(GLenum type, unsigned int arraySize, bool isRowMajorMatrix); size_t getBlockSize() const { return mCurrentOffset * BytesPerComponent; } size_t getCurrentRegister() const { return mCurrentOffset / ComponentsPerRegister; } diff --git a/src/3rdparty/angle/src/common/debug.cpp b/src/3rdparty/angle/src/common/debug.cpp index d6eecf7157..dcad327564 100644 --- a/src/3rdparty/angle/src/common/debug.cpp +++ b/src/3rdparty/angle/src/common/debug.cpp @@ -8,6 +8,7 @@ #include "common/debug.h" #include "common/platform.h" +#include "common/angleutils.h" #include #include @@ -25,22 +26,7 @@ typedef void (*PerfOutputFunction)(unsigned int, const wchar_t*); static void output(bool traceFileDebugOnly, PerfOutputFunction perfFunc, const char *format, va_list vararg) { #if defined(ANGLE_ENABLE_PERF) || defined(ANGLE_ENABLE_TRACE) - static std::vector asciiMessageBuffer(512); - - // Attempt to just print to the current buffer - int len = vsnprintf(&asciiMessageBuffer[0], asciiMessageBuffer.size(), format, vararg); - if (len < 0 || static_cast(len) >= asciiMessageBuffer.size()) - { - // Buffer was not large enough, calculate the required size and resize the buffer - len = vsnprintf(NULL, 0, format, vararg); - asciiMessageBuffer.resize(len + 1); - - // Print again - vsnprintf(&asciiMessageBuffer[0], asciiMessageBuffer.size(), format, vararg); - } - - // NULL terminate the buffer to be safe - asciiMessageBuffer[len] = '\0'; + std::string formattedMessage = FormatString(format, vararg); #endif #if defined(ANGLE_ENABLE_PERF) @@ -48,12 +34,12 @@ static void output(bool traceFileDebugOnly, PerfOutputFunction perfFunc, const c { // The perf function only accepts wide strings, widen the ascii message static std::wstring wideMessage; - if (wideMessage.capacity() < asciiMessageBuffer.size()) + if (wideMessage.capacity() < formattedMessage.length()) { - wideMessage.reserve(asciiMessageBuffer.size()); + wideMessage.reserve(formattedMessage.size()); } - wideMessage.assign(asciiMessageBuffer.begin(), asciiMessageBuffer.begin() + len); + wideMessage.assign(formattedMessage.begin(), formattedMessage.end()); perfFunc(0, wideMessage.c_str()); } @@ -70,7 +56,7 @@ static void output(bool traceFileDebugOnly, PerfOutputFunction perfFunc, const c static std::ofstream file(TRACE_OUTPUT_FILE, std::ofstream::app); if (file) { - file.write(&asciiMessageBuffer[0], len); + file.write(formattedMessage.c_str(), formattedMessage.length()); file.flush(); } diff --git a/src/3rdparty/angle/src/common/debug.h b/src/3rdparty/angle/src/common/debug.h index 997ebca6be..bf2bca8f24 100644 --- a/src/3rdparty/angle/src/common/debug.h +++ b/src/3rdparty/angle/src/common/debug.h @@ -91,6 +91,10 @@ namespace gl // A macro to indicate unimplemented functionality +#if defined (ANGLE_TEST_CONFIG) +#define NOASSERT_UNIMPLEMENTED 1 +#endif + // Define NOASSERT_UNIMPLEMENTED to non zero to skip the assert fail in the unimplemented checks // This will allow us to test with some automated test suites (eg dEQP) without crashing #ifndef NOASSERT_UNIMPLEMENTED diff --git a/src/3rdparty/angle/src/common/event_tracer.cpp b/src/3rdparty/angle/src/common/event_tracer.cpp deleted file mode 100644 index 353c69d05c..0000000000 --- a/src/3rdparty/angle/src/common/event_tracer.cpp +++ /dev/null @@ -1,49 +0,0 @@ -// 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 - -extern "C" { - -void TRACE_ENTRY SetTraceFunctionPointers(GetCategoryEnabledFlagFunc getCategoryEnabledFlag, - AddTraceEventFunc addTraceEvent) -{ - gl::g_getCategoryEnabledFlag = getCategoryEnabledFlag; - gl::g_addTraceEvent = addTraceEvent; -} - -} // extern "C" - -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 deleted file mode 100644 index fa97435faa..0000000000 --- a/src/3rdparty/angle/src/common/event_tracer.h +++ /dev/null @@ -1,43 +0,0 @@ -// 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" - -#if !defined(TRACE_ENTRY) -# ifdef ANGLE_PLATFORM_WINDOWS -# define TRACE_ENTRY __stdcall -# else -# define TRACE_ENTRY -# endif // ANGLE_PLATFORM_WINDOWS -#endif //TRACE_ENTRY - -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); - -// extern "C" so that it has a reasonable name for GetProcAddress. -void TRACE_ENTRY SetTraceFunctionPointers(GetCategoryEnabledFlagFunc get_category_enabled_flag, - AddTraceEventFunc add_trace_event_func); - -} - -namespace gl -{ - -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/mathutil.cpp b/src/3rdparty/angle/src/common/mathutil.cpp index 20b3f0c113..496633632b 100644 --- a/src/3rdparty/angle/src/common/mathutil.cpp +++ b/src/3rdparty/angle/src/common/mathutil.cpp @@ -7,6 +7,7 @@ // mathutil.cpp: Math and bit manipulation functions. #include "common/mathutil.h" + #include #include diff --git a/src/3rdparty/angle/src/common/mathutil.h b/src/3rdparty/angle/src/common/mathutil.h index f32663fa02..52f2bc1c0e 100644 --- a/src/3rdparty/angle/src/common/mathutil.h +++ b/src/3rdparty/angle/src/common/mathutil.h @@ -505,21 +505,33 @@ inline unsigned int averageFloat10(unsigned int a, unsigned int b) namespace rx { +template struct Range { Range() {} - Range(int lo, int hi) : start(lo), end(hi) { ASSERT(lo <= hi); } + Range(T lo, T hi) : start(lo), end(hi) { ASSERT(lo <= hi); } + + T start; + T end; - int start; - int end; + T length() const { return end - start; } }; +typedef Range RangeI; +typedef Range RangeUI; + template T roundUp(const T value, const T alignment) { return value + alignment - 1 - (value - 1) % alignment; } +inline unsigned int UnsignedCeilDivide(unsigned int value, unsigned int divisor) +{ + unsigned int divided = value / divisor; + return (divided + ((value % divisor == 0) ? 0 : 1)); +} + template inline bool IsUnsignedAdditionSafe(T lhs, T rhs) { diff --git a/src/3rdparty/angle/src/common/platform.h b/src/3rdparty/angle/src/common/platform.h index 44c5c7c03b..b53394f337 100644 --- a/src/3rdparty/angle/src/common/platform.h +++ b/src/3rdparty/angle/src/common/platform.h @@ -52,6 +52,9 @@ # if defined(ANGLE_ENABLE_D3D9) || defined(ANGLE_ENABLE_PERF) # include +# if !defined(COMPILER_IMPLEMENTATION) +# include +# endif # endif # if defined(ANGLE_ENABLE_D3D11) @@ -61,16 +64,25 @@ # include # if _MSC_VER >= 1700 # include +# endif +# if !defined(COMPILER_IMPLEMENTATION) # include # endif +# if defined(__MINGW32__) +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; +# endif # endif # undef near # undef far -# undef NEAR -# define NEAR -# undef FAR -# define FAR #endif #endif // COMMON_PLATFORM_H_ diff --git a/src/3rdparty/angle/src/common/shadervars.h b/src/3rdparty/angle/src/common/shadervars.h deleted file mode 100644 index 0442d81500..0000000000 --- a/src/3rdparty/angle/src/common/shadervars.h +++ /dev/null @@ -1,157 +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. -// -// shadervars.h: -// Types to represent GL variables (varyings, uniforms, etc) -// - -#ifndef COMMON_SHADERVARIABLE_H_ -#define COMMON_SHADERVARIABLE_H_ - -#include -#include -#include -#include "GLSLANG/ShaderLang.h" - -namespace sh -{ - -// Varying interpolation qualifier, see section 4.3.9 of the ESSL 3.00.4 spec -enum InterpolationType -{ - INTERPOLATION_SMOOTH, - INTERPOLATION_CENTROID, - INTERPOLATION_FLAT -}; - -// Uniform block layout qualifier, see section 4.3.8.3 of the ESSL 3.00.4 spec -enum BlockLayoutType -{ - BLOCKLAYOUT_STANDARD, - BLOCKLAYOUT_PACKED, - BLOCKLAYOUT_SHARED -}; - -// Base class for all variables defined in shaders, including Varyings, Uniforms, etc -struct ShaderVariable -{ - ShaderVariable() - : type(0), - precision(0), - arraySize(0), - staticUse(false) - {} - - ShaderVariable(GLenum typeIn, GLenum precisionIn, const char *nameIn, unsigned int arraySizeIn) - : type(typeIn), - precision(precisionIn), - name(nameIn), - arraySize(arraySizeIn), - staticUse(false) - {} - - bool isArray() const { return arraySize > 0; } - unsigned int elementCount() const { return std::max(1u, arraySize); } - - GLenum type; - GLenum precision; - std::string name; - std::string mappedName; - unsigned int arraySize; - bool staticUse; -}; - -struct Uniform : public ShaderVariable -{ - Uniform() - {} - - Uniform(GLenum typeIn, GLenum precisionIn, const char *nameIn, unsigned int arraySizeIn) - : ShaderVariable(typeIn, precisionIn, nameIn, arraySizeIn) - {} - - bool isStruct() const { return !fields.empty(); } - - std::vector fields; -}; - -struct Attribute : public ShaderVariable -{ - Attribute() - : location(-1) - {} - - Attribute(GLenum typeIn, GLenum precisionIn, const char *nameIn, unsigned int arraySizeIn, int locationIn) - : ShaderVariable(typeIn, precisionIn, nameIn, arraySizeIn), - location(locationIn) - {} - - int location; -}; - -struct InterfaceBlockField : public ShaderVariable -{ - InterfaceBlockField() - : isRowMajorMatrix(false) - {} - - InterfaceBlockField(GLenum typeIn, GLenum precisionIn, const char *nameIn, unsigned int arraySizeIn, bool isRowMajorMatrix) - : ShaderVariable(typeIn, precisionIn, nameIn, arraySizeIn), - isRowMajorMatrix(isRowMajorMatrix) - {} - - bool isStruct() const { return !fields.empty(); } - - bool isRowMajorMatrix; - std::vector fields; -}; - -struct Varying : public ShaderVariable -{ - Varying() - : interpolation(INTERPOLATION_SMOOTH) - {} - - Varying(GLenum typeIn, GLenum precisionIn, const char *nameIn, unsigned int arraySizeIn, InterpolationType interpolationIn) - : ShaderVariable(typeIn, precisionIn, nameIn, arraySizeIn), - interpolation(interpolationIn) - {} - - bool isStruct() const { return !fields.empty(); } - - InterpolationType interpolation; - std::vector fields; - std::string structName; -}; - -struct InterfaceBlock -{ - InterfaceBlock() - : arraySize(0), - layout(BLOCKLAYOUT_PACKED), - isRowMajorLayout(false), - staticUse(false) - {} - - InterfaceBlock(const char *name, unsigned int arraySize) - : name(name), - arraySize(arraySize), - layout(BLOCKLAYOUT_SHARED), - isRowMajorLayout(false), - staticUse(false) - {} - - std::string name; - std::string mappedName; - unsigned int arraySize; - BlockLayoutType layout; - bool isRowMajorLayout; - bool staticUse; - std::vector fields; -}; - -} - -#endif // COMMON_SHADERVARIABLE_H_ -- cgit v1.2.3