Commit 8f0f24a0 by alokp@chromium.org

Removed support for unused/deprecated extension - GL_3DL_array_object.

TEST=conformance tests. Review URL: http://codereview.appspot.com/2043043 git-svn-id: https://angleproject.googlecode.com/svn/trunk@412 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 4b6b4f79
...@@ -51,18 +51,23 @@ TIntermSymbol* TIntermediate::addSymbol(int id, const TString& name, const TType ...@@ -51,18 +51,23 @@ TIntermSymbol* TIntermediate::addSymbol(int id, const TString& name, const TType
TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIntermTyped* right, TSourceLoc line, TSymbolTable& symbolTable) TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIntermTyped* right, TSourceLoc line, TSymbolTable& symbolTable)
{ {
switch (op) { switch (op) {
case EOpEqual:
case EOpNotEqual:
if (left->isArray())
return 0;
break;
case EOpLessThan: case EOpLessThan:
case EOpGreaterThan: case EOpGreaterThan:
case EOpLessThanEqual: case EOpLessThanEqual:
case EOpGreaterThanEqual: case EOpGreaterThanEqual:
if (left->getType().isMatrix() || left->getType().isArray() || left->getType().isVector() || left->getType().getBasicType() == EbtStruct) { if (left->isMatrix() || left->isArray() || left->isVector() || left->getBasicType() == EbtStruct) {
return 0; return 0;
} }
break; break;
case EOpLogicalOr: case EOpLogicalOr:
case EOpLogicalXor: case EOpLogicalXor:
case EOpLogicalAnd: case EOpLogicalAnd:
if (left->getType().getBasicType() != EbtBool || left->getType().isMatrix() || left->getType().isArray() || left->getType().isVector()) { if (left->getBasicType() != EbtBool || left->isMatrix() || left->isArray() || left->isVector()) {
return 0; return 0;
} }
break; break;
...@@ -70,7 +75,7 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn ...@@ -70,7 +75,7 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn
case EOpSub: case EOpSub:
case EOpDiv: case EOpDiv:
case EOpMul: case EOpMul:
if (left->getType().getBasicType() == EbtStruct || left->getType().getBasicType() == EbtBool) if (left->getBasicType() == EbtStruct || left->getBasicType() == EbtBool)
return 0; return 0;
default: break; default: break;
} }
...@@ -78,8 +83,10 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn ...@@ -78,8 +83,10 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn
// //
// First try converting the children to compatible types. // First try converting the children to compatible types.
// //
if (left->getType().getStruct() && right->getType().getStruct()) {
if (!(left->getType().getStruct() && right->getType().getStruct())) { if (left->getType() != right->getType())
return 0;
} else {
TIntermTyped* child = addConversion(op, left->getType(), right); TIntermTyped* child = addConversion(op, left->getType(), right);
if (child) if (child)
right = child; right = child;
...@@ -90,12 +97,8 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn ...@@ -90,12 +97,8 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn
else else
return 0; return 0;
} }
} else {
if (left->getType() != right->getType())
return 0;
} }
// //
// Need a new node holding things together then. Make // Need a new node holding things together then. Make
// one and promote it to the right type. // one and promote it to the right type.
...@@ -107,18 +110,16 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn ...@@ -107,18 +110,16 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn
node->setLeft(left); node->setLeft(left);
node->setRight(right); node->setRight(right);
if (! node->promote(infoSink)) if (!node->promote(infoSink))
return 0; return 0;
TIntermConstantUnion *leftTempConstant = left->getAsConstantUnion();
TIntermConstantUnion *rightTempConstant = right->getAsConstantUnion();
// //
// See if we can fold constants. // See if we can fold constants.
// //
TIntermTyped* typedReturnNode = 0; TIntermTyped* typedReturnNode = 0;
if ( leftTempConstant && rightTempConstant) { TIntermConstantUnion *leftTempConstant = left->getAsConstantUnion();
TIntermConstantUnion *rightTempConstant = right->getAsConstantUnion();
if (leftTempConstant && rightTempConstant) {
typedReturnNode = leftTempConstant->fold(node->getOp(), rightTempConstant, infoSink); typedReturnNode = leftTempConstant->fold(node->getOp(), rightTempConstant, infoSink);
if (typedReturnNode) if (typedReturnNode)
...@@ -760,6 +761,12 @@ bool TIntermUnary::promote(TInfoSink&) ...@@ -760,6 +761,12 @@ bool TIntermUnary::promote(TInfoSink&)
// //
bool TIntermBinary::promote(TInfoSink& infoSink) bool TIntermBinary::promote(TInfoSink& infoSink)
{ {
// This function only handles scalars, vectors, and matrices.
if (left->isArray() || right->isArray()) {
infoSink.info.message(EPrefixInternalError, "Invalid operation for arrays", getLine());
return false;
}
// GLSL ES 2.0 does not support implicit type casting. // GLSL ES 2.0 does not support implicit type casting.
// So the basic type should always match. // So the basic type should always match.
if (left->getBasicType() != right->getBasicType()) if (left->getBasicType() != right->getBasicType())
...@@ -781,40 +788,6 @@ bool TIntermBinary::promote(TInfoSink& infoSink) ...@@ -781,40 +788,6 @@ bool TIntermBinary::promote(TInfoSink& infoSink)
getTypePointer()->setQualifier(EvqTemporary); getTypePointer()->setQualifier(EvqTemporary);
} }
//
// Array operations.
//
if (left->isArray() || right->isArray()) {
//
// Arrays types have to be exact matches.
//
if (left->getType() != right->getType())
return false;
switch (op) {
//
// Promote to conditional
//
case EOpEqual:
case EOpNotEqual:
setType(TType(EbtBool, EbpUndefined));
break;
//
// Set array information.
//
case EOpAssign:
case EOpInitialize:
getTypePointer()->setArraySize(left->getType().getArraySize());
getTypePointer()->setArrayInformationType(left->getType().getArrayInformationType());
break;
default:
return false;
}
return true;
}
int size = std::max(left->getNominalSize(), right->getNominalSize()); int size = std::max(left->getNominalSize(), right->getNominalSize());
// //
......
...@@ -674,14 +674,11 @@ bool TParseContext::arraySizeErrorCheck(int line, TIntermTyped* expr, int& size) ...@@ -674,14 +674,11 @@ bool TParseContext::arraySizeErrorCheck(int line, TIntermTyped* expr, int& size)
// //
bool TParseContext::arrayQualifierErrorCheck(int line, TPublicType type) bool TParseContext::arrayQualifierErrorCheck(int line, TPublicType type)
{ {
if (type.qualifier == EvqAttribute) { if ((type.qualifier == EvqAttribute) || (type.qualifier == EvqConst)) {
error(line, "cannot declare arrays of this qualifier", TType(type).getCompleteString().c_str(), ""); error(line, "cannot declare arrays of this qualifier", TType(type).getCompleteString().c_str(), "");
return true; return true;
} }
if (type.qualifier == EvqConst && extensionErrorCheck(line, "GL_3DL_array_objects"))
return true;
return false; return false;
} }
...@@ -1387,8 +1384,6 @@ void TParseContext::initializeExtensionBehavior() ...@@ -1387,8 +1384,6 @@ void TParseContext::initializeExtensionBehavior()
// example code: extensionBehavior["test"] = EBhDisable; // where "test" is the name of // example code: extensionBehavior["test"] = EBhDisable; // where "test" is the name of
// supported extension // supported extension
// //
extensionBehavior["GL_ARB_texture_rectangle"] = EBhRequire;
extensionBehavior["GL_3DL_array_objects"] = EBhDisable;
} }
OS_TLSIndex GlobalParseContextIndex = OS_INVALID_TLS_INDEX; OS_TLSIndex GlobalParseContextIndex = OS_INVALID_TLS_INDEX;
......
...@@ -625,19 +625,16 @@ function_identifier ...@@ -625,19 +625,16 @@ function_identifier
// Constructor // Constructor
// //
if ($1.array) { if ($1.array) {
if (parseContext->extensionErrorCheck($1.line, "GL_3DL_array_objects")) { // Constructors for arrays are not allowed.
parseContext->recover(); parseContext->error($1.line, "cannot construct this type", "array", "");
$1.setArray(false); parseContext->recover();
} $1.setArray(false);
} }
TOperator op = EOpNull;
if ($1.userDef) { if ($1.userDef) {
TString tempString = ""; op = EOpConstructStruct;
TType type($1);
TFunction *function = new TFunction(&tempString, type, EOpConstructStruct);
$$ = function;
} else { } else {
TOperator op = EOpNull;
switch ($1.type) { switch ($1.type) {
case EbtFloat: case EbtFloat:
if ($1.matrix) { if ($1.matrix) {
...@@ -671,6 +668,7 @@ function_identifier ...@@ -671,6 +668,7 @@ function_identifier
case 4: FRAG_VERT_ONLY("bvec4", $1.line); op = EOpConstructBVec4; break; case 4: FRAG_VERT_ONLY("bvec4", $1.line); op = EOpConstructBVec4; break;
} }
break; break;
default: break;
} }
if (op == EOpNull) { if (op == EOpNull) {
parseContext->error($1.line, "cannot construct this type", getBasicString($1.type), ""); parseContext->error($1.line, "cannot construct this type", getBasicString($1.type), "");
...@@ -678,11 +676,11 @@ function_identifier ...@@ -678,11 +676,11 @@ function_identifier
$1.type = EbtFloat; $1.type = EbtFloat;
op = EOpConstructFloat; op = EOpConstructFloat;
} }
TString tempString = "";
TType type($1);
TFunction *function = new TFunction(&tempString, type, op);
$$ = function;
} }
TString tempString;
TType type($1);
TFunction *function = new TFunction(&tempString, type, op);
$$ = function;
} }
| IDENTIFIER { | IDENTIFIER {
if (parseContext->reservedErrorCheck($1.line, *$1.string)) if (parseContext->reservedErrorCheck($1.line, *$1.string))
...@@ -851,8 +849,7 @@ equality_expression ...@@ -851,8 +849,7 @@ equality_expression
ConstantUnion *unionArray = new ConstantUnion[1]; ConstantUnion *unionArray = new ConstantUnion[1];
unionArray->setBConst(false); unionArray->setBConst(false);
$$ = parseContext->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), $2.line); $$ = parseContext->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), $2.line);
} else if (($1->isArray() || $3->isArray()) && parseContext->extensionErrorCheck($2.line, "GL_3DL_array_objects")) }
parseContext->recover();
} }
| equality_expression NE_OP relational_expression { | equality_expression NE_OP relational_expression {
$$ = parseContext->intermediate.addBinaryMath(EOpNotEqual, $1, $3, $2.line, parseContext->symbolTable); $$ = parseContext->intermediate.addBinaryMath(EOpNotEqual, $1, $3, $2.line, parseContext->symbolTable);
...@@ -862,8 +859,7 @@ equality_expression ...@@ -862,8 +859,7 @@ equality_expression
ConstantUnion *unionArray = new ConstantUnion[1]; ConstantUnion *unionArray = new ConstantUnion[1];
unionArray->setBConst(false); unionArray->setBConst(false);
$$ = parseContext->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), $2.line); $$ = parseContext->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConst), $2.line);
} else if (($1->isArray() || $3->isArray()) && parseContext->extensionErrorCheck($2.line, "GL_3DL_array_objects")) }
parseContext->recover();
} }
; ;
...@@ -949,8 +945,7 @@ assignment_expression ...@@ -949,8 +945,7 @@ assignment_expression
parseContext->assignError($2.line, "assign", $1->getCompleteString(), $3->getCompleteString()); parseContext->assignError($2.line, "assign", $1->getCompleteString(), $3->getCompleteString());
parseContext->recover(); parseContext->recover();
$$ = $1; $$ = $1;
} else if (($1->isArray() || $3->isArray()) && parseContext->extensionErrorCheck($2.line, "GL_3DL_array_objects")) }
parseContext->recover();
} }
; ;
...@@ -1272,75 +1267,6 @@ init_declarator_list ...@@ -1272,75 +1267,6 @@ init_declarator_list
$$.intermAggregate = parseContext->intermediate.growAggregate($1.intermNode, parseContext->intermediate.addSymbol(0, *$3.string, type, $3.line), $3.line); $$.intermAggregate = parseContext->intermediate.growAggregate($1.intermNode, parseContext->intermediate.addSymbol(0, *$3.string, type, $3.line), $3.line);
} }
} }
| init_declarator_list COMMA IDENTIFIER LEFT_BRACKET RIGHT_BRACKET EQUAL initializer {
if (parseContext->structQualifierErrorCheck($3.line, $1.type))
parseContext->recover();
$$ = $1;
TVariable* variable = 0;
if (parseContext->arrayTypeErrorCheck($4.line, $1.type) || parseContext->arrayQualifierErrorCheck($4.line, $1.type))
parseContext->recover();
else {
$1.type.setArray(true, $7->getType().getArraySize());
if (parseContext->arrayErrorCheck($4.line, *$3.string, $1.type, variable))
parseContext->recover();
}
if (parseContext->extensionErrorCheck($$.line, "GL_3DL_array_objects"))
parseContext->recover();
else {
TIntermNode* intermNode;
if (!parseContext->executeInitializer($3.line, *$3.string, $1.type, $7, intermNode, variable)) {
//
// build the intermediate representation
//
if (intermNode)
$$.intermAggregate = parseContext->intermediate.growAggregate($1.intermNode, intermNode, $6.line);
else
$$.intermAggregate = $1.intermAggregate;
} else {
parseContext->recover();
$$.intermAggregate = 0;
}
}
}
| init_declarator_list COMMA IDENTIFIER LEFT_BRACKET constant_expression RIGHT_BRACKET EQUAL initializer {
if (parseContext->structQualifierErrorCheck($3.line, $1.type))
parseContext->recover();
$$ = $1;
TVariable* variable = 0;
if (parseContext->arrayTypeErrorCheck($4.line, $1.type) || parseContext->arrayQualifierErrorCheck($4.line, $1.type))
parseContext->recover();
else {
int size;
if (parseContext->arraySizeErrorCheck($4.line, $5, size))
parseContext->recover();
$1.type.setArray(true, size);
if (parseContext->arrayErrorCheck($4.line, *$3.string, $1.type, variable))
parseContext->recover();
}
if (parseContext->extensionErrorCheck($$.line, "GL_3DL_array_objects"))
parseContext->recover();
else {
TIntermNode* intermNode;
if (!parseContext->executeInitializer($3.line, *$3.string, $1.type, $8, intermNode, variable)) {
//
// build the intermediate representation
//
if (intermNode)
$$.intermAggregate = parseContext->intermediate.growAggregate($1.intermNode, intermNode, $7.line);
else
$$.intermAggregate = $1.intermAggregate;
} else {
parseContext->recover();
$$.intermAggregate = 0;
}
}
}
| init_declarator_list COMMA IDENTIFIER EQUAL initializer { | init_declarator_list COMMA IDENTIFIER EQUAL initializer {
if (parseContext->structQualifierErrorCheck($3.line, $1.type)) if (parseContext->structQualifierErrorCheck($3.line, $1.type))
parseContext->recover(); parseContext->recover();
...@@ -1531,18 +1457,14 @@ fully_specified_type ...@@ -1531,18 +1457,14 @@ fully_specified_type
$$ = $1; $$ = $1;
if ($1.array) { if ($1.array) {
if (parseContext->extensionErrorCheck($1.line, "GL_3DL_array_objects")) { parseContext->error($1.line, "not supported", "first-class array", "");
parseContext->recover(); parseContext->recover();
$1.setArray(false); $1.setArray(false);
}
} }
} }
| type_qualifier type_specifier { | type_qualifier type_specifier {
if ($2.array && parseContext->extensionErrorCheck($2.line, "GL_3DL_array_objects")) { if ($2.array) {
parseContext->recover(); parseContext->error($2.line, "not supported", "first-class array", "");
$2.setArray(false);
}
if ($2.array && parseContext->arrayQualifierErrorCheck($2.line, $1)) {
parseContext->recover(); parseContext->recover();
$2.setArray(false); $2.setArray(false);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment