Commit 1763eeba by Alexis Hetu Committed by Alexis Hétu

Fixed the compound-assignment-type-combination.html test

The fix is in 2 parts: 1) Multiplying a matrix by a float was failing due to attempting to use the matrix's index on the float, thus going out of bounds. 2) Multiplying a vector or matrix by vectors or matrices of a different size was not causing a failure, but now it does. BUG=18450319 Change-Id: Ie01a77eb32d7d52fcd0a803f3e5efc24c625dbfd Reviewed-on: https://swiftshader-review.googlesource.com/1450Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 7f0b105c
......@@ -1432,7 +1432,7 @@ namespace sh
TIntermTyped *arg = argument->getAsTyped();
const TType &type = arg->getType();
const TTypeList *structure = type.getStruct();
ASSERT(index < arg->totalRegisterCount());
index = (index >= arg->totalRegisterCount()) ? arg->totalRegisterCount() - 1 : index;
int size = registerSize(type, index);
......@@ -1522,8 +1522,15 @@ namespace sh
(swizzleElement(leftSwizzle, swizzleElement(rightSwizzle, 3)) << 6);
}
void OutputASM::assignLvalue(TIntermTyped *dst, TIntermNode *src)
void OutputASM::assignLvalue(TIntermTyped *dst, TIntermTyped *src)
{
if(src &&
((src->isVector() && (!dst->isVector() || (dst->getNominalSize() != dst->getNominalSize()))) ||
(src->isMatrix() && (!dst->isMatrix() || (src->getNominalSize() != dst->getNominalSize())))))
{
return mContext.error(src->getLine(), "Result type should match the l-value type in compound assignment", src->isVector() ? "vector" : "matrix");
}
TIntermBinary *binary = dst->getAsBinaryNode();
if(binary && binary->getOp() == EOpIndexIndirect && dst->isScalar())
......
......@@ -113,7 +113,7 @@ namespace sh
void emitCmp(sw::Shader::Control cmpOp, TIntermTyped *dst, TIntermNode *left, TIntermNode *right, int index = 0);
void argument(sw::Shader::SourceParameter &parameter, TIntermNode *argument, int index = 0);
void copy(TIntermTyped *dst, TIntermNode *src, int offset = 0);
void assignLvalue(TIntermTyped *dst, TIntermNode *src);
void assignLvalue(TIntermTyped *dst, TIntermTyped *src);
int lvalue(sw::Shader::DestinationParameter &dst, Temporary &address, TIntermTyped *node);
sw::Shader::ParameterType registerType(TIntermTyped *operand);
int registerIndex(TIntermTyped *operand);
......
......@@ -1432,7 +1432,7 @@ namespace sh
TIntermTyped *arg = argument->getAsTyped();
const TType &type = arg->getType();
const TTypeList *structure = type.getStruct();
ASSERT(index < arg->totalRegisterCount());
index = (index >= arg->totalRegisterCount()) ? arg->totalRegisterCount() - 1 : index;
int size = registerSize(type, index);
......@@ -1522,8 +1522,15 @@ namespace sh
(swizzleElement(leftSwizzle, swizzleElement(rightSwizzle, 3)) << 6);
}
void OutputASM::assignLvalue(TIntermTyped *dst, TIntermNode *src)
void OutputASM::assignLvalue(TIntermTyped *dst, TIntermTyped *src)
{
if(src &&
((src->isVector() && (!dst->isVector() || (dst->getNominalSize() != dst->getNominalSize()))) ||
(src->isMatrix() && (!dst->isMatrix() || (src->getNominalSize() != dst->getNominalSize())))))
{
return mContext.error(src->getLine(), "Result type should match the l-value type in compound assignment", src->isVector() ? "vector" : "matrix");
}
TIntermBinary *binary = dst->getAsBinaryNode();
if(binary && binary->getOp() == EOpIndexIndirect && dst->isScalar())
......
......@@ -113,7 +113,7 @@ namespace sh
void emitCmp(sw::Shader::Control cmpOp, TIntermTyped *dst, TIntermNode *left, TIntermNode *right, int index = 0);
void argument(sw::Shader::SourceParameter &parameter, TIntermNode *argument, int index = 0);
void copy(TIntermTyped *dst, TIntermNode *src, int offset = 0);
void assignLvalue(TIntermTyped *dst, TIntermNode *src);
void assignLvalue(TIntermTyped *dst, TIntermTyped *src);
int lvalue(sw::Shader::DestinationParameter &dst, Temporary &address, TIntermTyped *node);
sw::Shader::ParameterType registerType(TIntermTyped *operand);
int registerIndex(TIntermTyped *operand);
......
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