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 --- .../angle/src/compiler/translator/ShaderLang.cpp | 124 +++++++++++++++------ 1 file changed, 90 insertions(+), 34 deletions(-) (limited to 'src/3rdparty/angle/src/compiler/translator/ShaderLang.cpp') diff --git a/src/3rdparty/angle/src/compiler/translator/ShaderLang.cpp b/src/3rdparty/angle/src/compiler/translator/ShaderLang.cpp index 6a801eacfe..20ce71605c 100644 --- a/src/3rdparty/angle/src/compiler/translator/ShaderLang.cpp +++ b/src/3rdparty/angle/src/compiler/translator/ShaderLang.cpp @@ -18,14 +18,26 @@ #include "compiler/translator/VariablePacker.h" #include "angle_gl.h" -static bool isInitialized = false; +namespace +{ + +enum ShaderVariableType +{ + SHADERVAR_UNIFORM, + SHADERVAR_VARYING, + SHADERVAR_ATTRIBUTE, + SHADERVAR_OUTPUTVARIABLE, + SHADERVAR_INTERFACEBLOCK +}; + +bool isInitialized = false; // // This is the platform independent interface between an OGL driver // and the shading language compiler. // -static bool checkVariableMaxLengths(const ShHandle handle, +static bool CheckVariableMaxLengths(const ShHandle handle, size_t expectedValue) { size_t activeUniformLimit = 0; @@ -39,7 +51,7 @@ static bool checkVariableMaxLengths(const ShHandle handle, expectedValue == varyingLimit); } -static bool checkMappedNameMaxLength(const ShHandle handle, size_t expectedValue) +bool CheckMappedNameMaxLength(const ShHandle handle, size_t expectedValue) { size_t mappedNameMaxLength = 0; ShGetInfo(handle, SH_MAPPED_NAME_MAX_LENGTH, &mappedNameMaxLength); @@ -47,7 +59,7 @@ static bool checkMappedNameMaxLength(const ShHandle handle, size_t expectedValue } template -static const sh::ShaderVariable *ReturnVariable(const std::vector &infoList, int index) +const sh::ShaderVariable *ReturnVariable(const std::vector &infoList, int index) { if (index < 0 || static_cast(index) >= infoList.size()) { @@ -57,7 +69,7 @@ static const sh::ShaderVariable *ReturnVariable(const std::vector &infoLis return &infoList[index]; } -static const sh::ShaderVariable *GetVariable(const TCompiler *compiler, ShShaderInfo varType, int index) +const sh::ShaderVariable *GetVariable(const TCompiler *compiler, ShShaderInfo varType, int index) { switch (varType) { @@ -73,7 +85,7 @@ static const sh::ShaderVariable *GetVariable(const TCompiler *compiler, ShShader } } -static ShPrecisionType ConvertPrecision(sh::GLenum precision) +ShPrecisionType ConvertPrecision(sh::GLenum precision) { switch (precision) { @@ -91,6 +103,55 @@ static ShPrecisionType ConvertPrecision(sh::GLenum precision) } } +template +const std::vector *GetVariableList(const TCompiler *compiler, ShaderVariableType variableType); + +template <> +const std::vector *GetVariableList(const TCompiler *compiler, ShaderVariableType) +{ + return &compiler->getUniforms(); +} + +template <> +const std::vector *GetVariableList(const TCompiler *compiler, ShaderVariableType) +{ + return &compiler->getVaryings(); +} + +template <> +const std::vector *GetVariableList(const TCompiler *compiler, ShaderVariableType variableType) +{ + return (variableType == SHADERVAR_ATTRIBUTE ? + &compiler->getAttributes() : + &compiler->getOutputVariables()); +} + +template <> +const std::vector *GetVariableList(const TCompiler *compiler, ShaderVariableType) +{ + return &compiler->getInterfaceBlocks(); +} + +template +const std::vector *GetShaderVariables(const ShHandle handle, ShaderVariableType variableType) +{ + if (!handle) + { + return NULL; + } + + TShHandleBase* base = static_cast(handle); + TCompiler* compiler = base->getAsCompiler(); + if (!compiler) + { + return NULL; + } + + return GetVariableList(compiler, variableType); +} + +} + // // Driver must call this first, once, before doing any other compiler operations. // Subsequent calls to this function are no-op. @@ -372,7 +433,7 @@ void ShGetVariableInfo(const ShHandle handle, // SH_ACTIVE_UNIFORM_MAX_LENGTH, SH_ACTIVE_ATTRIBUTE_MAX_LENGTH, SH_VARYING_MAX_LENGTH // in ShGetInfo, below. size_t variableLength = 1 + GetGlobalMaxTokenSize(compiler->getShaderSpec()); - ASSERT(checkVariableMaxLengths(handle, variableLength)); + ASSERT(CheckVariableMaxLengths(handle, variableLength)); strncpy(name, varInfo->name.c_str(), variableLength); name[variableLength - 1] = 0; if (mappedName) @@ -380,7 +441,7 @@ void ShGetVariableInfo(const ShHandle handle, // This size must match that queried by // SH_MAPPED_NAME_MAX_LENGTH in ShGetInfo, below. size_t maxMappedNameLength = 1 + GetGlobalMaxTokenSize(compiler->getShaderSpec()); - ASSERT(checkMappedNameMaxLength(handle, maxMappedNameLength)); + ASSERT(CheckMappedNameMaxLength(handle, maxMappedNameLength)); strncpy(mappedName, varInfo->mappedName.c_str(), maxMappedNameLength); mappedName[maxMappedNameLength - 1] = 0; } @@ -429,34 +490,29 @@ void ShGetNameHashingEntry(const ShHandle handle, hashedName[len - 1] = '\0'; } -void ShGetInfoPointer(const ShHandle handle, ShShaderInfo pname, void** params) +const std::vector *ShGetUniforms(const ShHandle handle) { - if (!handle || !params) - return; + return GetShaderVariables(handle, SHADERVAR_UNIFORM); +} - TShHandleBase* base = static_cast(handle); - TranslatorHLSL* translator = base->getAsTranslatorHLSL(); - if (!translator) return; +const std::vector *ShGetVaryings(const ShHandle handle) +{ + return GetShaderVariables(handle, SHADERVAR_VARYING); +} - switch(pname) - { - case SH_ACTIVE_UNIFORMS_ARRAY: - *params = (void*)&translator->getUniforms(); - break; - case SH_ACTIVE_INTERFACE_BLOCKS_ARRAY: - *params = (void*)&translator->getInterfaceBlocks(); - break; - case SH_ACTIVE_OUTPUT_VARIABLES_ARRAY: - *params = (void*)&translator->getOutputVariables(); - break; - case SH_ACTIVE_ATTRIBUTES_ARRAY: - *params = (void*)&translator->getAttributes(); - break; - case SH_ACTIVE_VARYINGS_ARRAY: - *params = (void*)&translator->getVaryings(); - break; - default: UNREACHABLE(); - } +const std::vector *ShGetAttributes(const ShHandle handle) +{ + return GetShaderVariables(handle, SHADERVAR_ATTRIBUTE); +} + +const std::vector *ShGetOutputVariables(const ShHandle handle) +{ + return GetShaderVariables(handle, SHADERVAR_OUTPUTVARIABLE); +} + +const std::vector *ShGetInterfaceBlocks(const ShHandle handle) +{ + return GetShaderVariables(handle, SHADERVAR_INTERFACEBLOCK); } int ShCheckVariablesWithinPackingLimits( @@ -468,7 +524,7 @@ int ShCheckVariablesWithinPackingLimits( std::vector variables; for (size_t ii = 0; ii < varInfoArraySize; ++ii) { - sh::ShaderVariable var(varInfoArray[ii].type, (sh::GLenum)0, "", varInfoArray[ii].size); + sh::ShaderVariable var(varInfoArray[ii].type, varInfoArray[ii].size); variables.push_back(var); } VariablePacker packer; -- cgit v1.2.3