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
TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIntermTyped* right, TSourceLoc line, TSymbolTable& symbolTable)
{
switch (op) {
case EOpEqual:
case EOpNotEqual:
if (left->isArray())
return 0;
break;
case EOpLessThan:
case EOpGreaterThan:
case EOpLessThanEqual:
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;
}
break;
case EOpLogicalOr:
case EOpLogicalXor:
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;
}
break;
......@@ -70,7 +75,7 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn
case EOpSub:
case EOpDiv:
case EOpMul:
if (left->getType().getBasicType() == EbtStruct || left->getType().getBasicType() == EbtBool)
if (left->getBasicType() == EbtStruct || left->getBasicType() == EbtBool)
return 0;
default: break;
}
......@@ -78,8 +83,10 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn
//
// 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);
if (child)
right = child;
......@@ -90,12 +97,8 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn
else
return 0;
}
} else {
if (left->getType() != right->getType())
return 0;
}
//
// Need a new node holding things together then. Make
// one and promote it to the right type.
......@@ -107,18 +110,16 @@ TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIn
node->setLeft(left);
node->setRight(right);
if (! node->promote(infoSink))
if (!node->promote(infoSink))
return 0;
TIntermConstantUnion *leftTempConstant = left->getAsConstantUnion();
TIntermConstantUnion *rightTempConstant = right->getAsConstantUnion();
//
// See if we can fold constants.
//
TIntermTyped* typedReturnNode = 0;
if ( leftTempConstant && rightTempConstant) {
TIntermConstantUnion *leftTempConstant = left->getAsConstantUnion();
TIntermConstantUnion *rightTempConstant = right->getAsConstantUnion();
if (leftTempConstant && rightTempConstant) {
typedReturnNode = leftTempConstant->fold(node->getOp(), rightTempConstant, infoSink);
if (typedReturnNode)
......@@ -760,6 +761,12 @@ bool TIntermUnary::promote(TInfoSink&)
//
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.
// So the basic type should always match.
if (left->getBasicType() != right->getBasicType())
......@@ -781,40 +788,6 @@ bool TIntermBinary::promote(TInfoSink& infoSink)
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());
//
......
......@@ -674,14 +674,11 @@ bool TParseContext::arraySizeErrorCheck(int line, TIntermTyped* expr, int& size)
//
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(), "");
return true;
}
if (type.qualifier == EvqConst && extensionErrorCheck(line, "GL_3DL_array_objects"))
return true;
return false;
}
......@@ -1387,8 +1384,6 @@ void TParseContext::initializeExtensionBehavior()
// example code: extensionBehavior["test"] = EBhDisable; // where "test" is the name of
// supported extension
//
extensionBehavior["GL_ARB_texture_rectangle"] = EBhRequire;
extensionBehavior["GL_3DL_array_objects"] = EBhDisable;
}
OS_TLSIndex GlobalParseContextIndex = OS_INVALID_TLS_INDEX;
......
......@@ -625,19 +625,16 @@ function_identifier
// Constructor
//
if ($1.array) {
if (parseContext->extensionErrorCheck($1.line, "GL_3DL_array_objects")) {
parseContext->recover();
$1.setArray(false);
}
// Constructors for arrays are not allowed.
parseContext->error($1.line, "cannot construct this type", "array", "");
parseContext->recover();
$1.setArray(false);
}
TOperator op = EOpNull;
if ($1.userDef) {
TString tempString = "";
TType type($1);
TFunction *function = new TFunction(&tempString, type, EOpConstructStruct);
$$ = function;
op = EOpConstructStruct;
} else {
TOperator op = EOpNull;
switch ($1.type) {
case EbtFloat:
if ($1.matrix) {
......@@ -671,6 +668,7 @@ function_identifier
case 4: FRAG_VERT_ONLY("bvec4", $1.line); op = EOpConstructBVec4; break;
}
break;
default: break;
}
if (op == EOpNull) {
parseContext->error($1.line, "cannot construct this type", getBasicString($1.type), "");
......@@ -678,11 +676,11 @@ function_identifier
$1.type = EbtFloat;
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 {
if (parseContext->reservedErrorCheck($1.line, *$1.string))
......@@ -851,8 +849,7 @@ equality_expression
ConstantUnion *unionArray = new ConstantUnion[1];
unionArray->setBConst(false);
$$ = 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 {
$$ = parseContext->intermediate.addBinaryMath(EOpNotEqual, $1, $3, $2.line, parseContext->symbolTable);
......@@ -862,8 +859,7 @@ equality_expression
ConstantUnion *unionArray = new ConstantUnion[1];
unionArray->setBConst(false);
$$ = 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
parseContext->assignError($2.line, "assign", $1->getCompleteString(), $3->getCompleteString());
parseContext->recover();
$$ = $1;
} else if (($1->isArray() || $3->isArray()) && parseContext->extensionErrorCheck($2.line, "GL_3DL_array_objects"))
parseContext->recover();
}
}
;
......@@ -1272,75 +1267,6 @@ init_declarator_list
$$.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 {
if (parseContext->structQualifierErrorCheck($3.line, $1.type))
parseContext->recover();
......@@ -1531,18 +1457,14 @@ fully_specified_type
$$ = $1;
if ($1.array) {
if (parseContext->extensionErrorCheck($1.line, "GL_3DL_array_objects")) {
parseContext->recover();
$1.setArray(false);
}
parseContext->error($1.line, "not supported", "first-class array", "");
parseContext->recover();
$1.setArray(false);
}
}
| type_qualifier type_specifier {
if ($2.array && parseContext->extensionErrorCheck($2.line, "GL_3DL_array_objects")) {
parseContext->recover();
$2.setArray(false);
}
if ($2.array && parseContext->arrayQualifierErrorCheck($2.line, $1)) {
if ($2.array) {
parseContext->error($2.line, "not supported", "first-class array", "");
parseContext->recover();
$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