diff --git a/glslang/Include/revision.h b/glslang/Include/revision.h index 2418b21fd3fad42a52f2d7c5633229c89b5084f9..342c5d1fe0548275f63c5e30843aeb03c29e643c 100644 --- a/glslang/Include/revision.h +++ b/glslang/Include/revision.h @@ -2,5 +2,5 @@ // For the version, it uses the latest git tag followed by the number of commits. // For the date, it uses the current date (when then script is run). -#define GLSLANG_REVISION "Overload400-PrecQual.1886" +#define GLSLANG_REVISION "Overload400-PrecQual.1887" #define GLSLANG_DATE "08-Mar-2017" diff --git a/hlsl/hlslParseHelper.cpp b/hlsl/hlslParseHelper.cpp index eace42581e6f60bd65defa60009e9eeb96988984..e0dcc09d5de992760099e06fcf1804c07cc88134 100755 --- a/hlsl/hlslParseHelper.cpp +++ b/hlsl/hlslParseHelper.cpp @@ -984,7 +984,7 @@ TIntermTyped* HlslParseContext::handleDotDereference(const TSourceLoc& loc, TInt // // Handle seeing a base.field dereference in the grammar, where 'field' is a -// built-in method. +// built-in method name. // // Return nullptr if 'field' is not a built-in method. // @@ -993,13 +993,10 @@ TIntermTyped* HlslParseContext::handleBuiltInMethod(const TSourceLoc& loc, TInte variableCheck(base); // - // methods can't be resolved until we later see the function-calling syntax. - // Save away the name in the AST for now. Processing is completed in - // handleLengthMethod(), etc. + // Methods can't be resolved until we finish seeing the function-calling syntax. + // Save away the name in the AST for now. // - if (field == "length") { - return intermediate.addMethod(base, TType(EbtInt), &field, loc); - } else if (isSamplerMethod(field) && base->getType().getBasicType() == EbtSampler) { + if (isSamplerMethod(field) && base->getType().getBasicType() == EbtSampler) { // If it's not a method on a sampler object, we fall through to let other objects have a go. const TSampler& sampler = base->getType().getSampler(); if (! sampler.isPureSampler()) { @@ -3758,9 +3755,7 @@ TIntermTyped* HlslParseContext::handleFunctionCall(const TSourceLoc& loc, TFunct TIntermTyped* result = nullptr; TOperator op = function->getBuiltInOp(); - if (op == EOpArrayLength) - result = handleLengthMethod(loc, function, arguments); - else if (op != EOpNull) { + if (op != EOpNull) { // // Then this should be a constructor. // Don't go through the symbol table for constructors. @@ -3874,41 +3869,6 @@ TIntermTyped* HlslParseContext::handleFunctionCall(const TSourceLoc& loc, TFunct return result; } -// Finish processing object.length(). This started earlier in handleDotDereference(), where -// the ".length" part was recognized and semantically checked, and finished here where the -// function syntax "()" is recognized. -// -// Return resulting tree node. -TIntermTyped* HlslParseContext::handleLengthMethod(const TSourceLoc& loc, TFunction* function, TIntermNode* intermNode) -{ - int length = 0; - - if (function->getParamCount() > 0) - error(loc, "method does not accept any arguments", function->getName().c_str(), ""); - else { - const TType& type = intermNode->getAsTyped()->getType(); - if (type.isArray()) { - if (type.isRuntimeSizedArray()) { - // Create a unary op and let the back end handle it - return intermediate.addBuiltInFunctionCall(loc, EOpArrayLength, true, intermNode, TType(EbtInt)); - } else - length = type.getOuterArraySize(); - } else if (type.isMatrix()) - length = type.getMatrixCols(); - else if (type.isVector()) - length = type.getVectorSize(); - else { - // we should not get here, because earlier semantic checking should have prevented this path - error(loc, ".length()", "unexpected use of .length()", ""); - } - } - - if (length == 0) - length = 1; - - return intermediate.addConstantUnion(length, loc); -} - // // Add any needed implicit conversions for function-call arguments to input parameters. // diff --git a/hlsl/hlslParseHelper.h b/hlsl/hlslParseHelper.h index ecac1b3149ad07ebf257c20de25068207db4a29f..ecfdaa7c8f5f33d1988f04abecce87c6b81bf5c5 100755 --- a/hlsl/hlslParseHelper.h +++ b/hlsl/hlslParseHelper.h @@ -87,7 +87,6 @@ public: void decomposeSampleMethods(const TSourceLoc&, TIntermTyped*& node, TIntermNode* arguments); void decomposeStructBufferMethods(const TSourceLoc&, TIntermTyped*& node, TIntermNode* arguments); void decomposeGeometryMethods(const TSourceLoc&, TIntermTyped*& node, TIntermNode* arguments); - TIntermTyped* handleLengthMethod(const TSourceLoc&, TFunction*, TIntermNode*); void addInputArgumentConversions(const TFunction&, TIntermTyped*&); TIntermTyped* addOutputArgumentConversions(const TFunction&, TIntermOperator&); void builtInOpCheck(const TSourceLoc&, const TFunction&, TIntermOperator&);