HLSL: Non-functional: Remove dead .length() code.
This commit is contained in:
parent
516d92d3c5
commit
88e88e59cb
@ -2,5 +2,5 @@
|
|||||||
// For the version, it uses the latest git tag followed by the number of commits.
|
// 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).
|
// 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"
|
#define GLSLANG_DATE "08-Mar-2017"
|
||||||
|
@ -984,7 +984,7 @@ TIntermTyped* HlslParseContext::handleDotDereference(const TSourceLoc& loc, TInt
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Handle seeing a base.field dereference in the grammar, where 'field' is a
|
// 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.
|
// Return nullptr if 'field' is not a built-in method.
|
||||||
//
|
//
|
||||||
@ -993,13 +993,10 @@ TIntermTyped* HlslParseContext::handleBuiltInMethod(const TSourceLoc& loc, TInte
|
|||||||
variableCheck(base);
|
variableCheck(base);
|
||||||
|
|
||||||
//
|
//
|
||||||
// methods can't be resolved until we later see the function-calling syntax.
|
// Methods can't be resolved until we finish seeing the function-calling syntax.
|
||||||
// Save away the name in the AST for now. Processing is completed in
|
// Save away the name in the AST for now.
|
||||||
// handleLengthMethod(), etc.
|
|
||||||
//
|
//
|
||||||
if (field == "length") {
|
if (isSamplerMethod(field) && base->getType().getBasicType() == EbtSampler) {
|
||||||
return intermediate.addMethod(base, TType(EbtInt), &field, loc);
|
|
||||||
} else 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.
|
// 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();
|
const TSampler& sampler = base->getType().getSampler();
|
||||||
if (! sampler.isPureSampler()) {
|
if (! sampler.isPureSampler()) {
|
||||||
@ -3758,9 +3755,7 @@ TIntermTyped* HlslParseContext::handleFunctionCall(const TSourceLoc& loc, TFunct
|
|||||||
TIntermTyped* result = nullptr;
|
TIntermTyped* result = nullptr;
|
||||||
|
|
||||||
TOperator op = function->getBuiltInOp();
|
TOperator op = function->getBuiltInOp();
|
||||||
if (op == EOpArrayLength)
|
if (op != EOpNull) {
|
||||||
result = handleLengthMethod(loc, function, arguments);
|
|
||||||
else if (op != EOpNull) {
|
|
||||||
//
|
//
|
||||||
// Then this should be a constructor.
|
// Then this should be a constructor.
|
||||||
// Don't go through the symbol table for constructors.
|
// Don't go through the symbol table for constructors.
|
||||||
@ -3874,41 +3869,6 @@ TIntermTyped* HlslParseContext::handleFunctionCall(const TSourceLoc& loc, TFunct
|
|||||||
return result;
|
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.
|
// Add any needed implicit conversions for function-call arguments to input parameters.
|
||||||
//
|
//
|
||||||
|
@ -87,7 +87,6 @@ public:
|
|||||||
void decomposeSampleMethods(const TSourceLoc&, TIntermTyped*& node, TIntermNode* arguments);
|
void decomposeSampleMethods(const TSourceLoc&, TIntermTyped*& node, TIntermNode* arguments);
|
||||||
void decomposeStructBufferMethods(const TSourceLoc&, TIntermTyped*& node, TIntermNode* arguments);
|
void decomposeStructBufferMethods(const TSourceLoc&, TIntermTyped*& node, TIntermNode* arguments);
|
||||||
void decomposeGeometryMethods(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*&);
|
void addInputArgumentConversions(const TFunction&, TIntermTyped*&);
|
||||||
TIntermTyped* addOutputArgumentConversions(const TFunction&, TIntermOperator&);
|
TIntermTyped* addOutputArgumentConversions(const TFunction&, TIntermOperator&);
|
||||||
void builtInOpCheck(const TSourceLoc&, const TFunction&, TIntermOperator&);
|
void builtInOpCheck(const TSourceLoc&, const TFunction&, TIntermOperator&);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user