Fix function mangling of rs_quaternion* arguments in stubs white list. Fix the generator of the RenderScript header files to allow functions that take rs_quaternion arguments. Previously they were wrongly mangled in the RenderScript stubs white list (float* instead of float4*). Factor out the calculation of vector length from the runtime header generator, and call it after expanding a typedef to update the vector length. This way it can calculate the right mangling for a function taking a pointer to rs_quaternion (which is not itself a vector but the mangling does need to output a vector length, i.e. Dv4_f). This fix is required by a following change list, which moves the bodies of the quaternion builtins to libclcore, so their mangled names are then added to the white list. (cherry picked from commit 1f08801f894a04d3f9221e7a85a93de1e3215def) Change-Id: If90d402830631e144afa91d6004f710fead89036
diff --git a/api/Specification.cpp b/api/Specification.cpp index 785f358..7afeea4 100644 --- a/api/Specification.cpp +++ b/api/Specification.cpp
@@ -115,6 +115,27 @@ return true; } +void getVectorSizeAndBaseType(const string& type, string& vectorSize, string& baseType) { + vectorSize = "1"; + baseType = type; + + /* If it's a vector type, we need to split the base type from the size. + * We know that's it's a vector type if the last character is a digit and + * the rest is an actual base type. We used to only verify the first part, + * which created a problem with rs_matrix2x2. + */ + const int last = type.size() - 1; + const char lastChar = type[last]; + if (lastChar >= '0' && lastChar <= '9') { + const string trimmed = type.substr(0, last); + int i = findCType(trimmed); + if (i >= 0) { + baseType = trimmed; + vectorSize = lastChar; + } + } +} + void ParameterDefinition::parseParameterDefinition(const string& type, const string& name, const string& testOption, int lineNumber, bool isReturn, Scanner* scanner) { @@ -124,23 +145,7 @@ // Determine if this is an output. isOutParameter = isReturn || charRemoved('*', &rsType); - rsBaseType = rsType; - mVectorSize = "1"; - /* If it's a vector type, we need to split the base type from the size. - * We know that's it's a vector type if the last character is a digit and - * the rest is an actual base type. We used to only verify the first part, - * which created a problem with rs_matrix2x2. - */ - const int last = rsType.size() - 1; - const char lastChar = rsType[last]; - if (lastChar >= '0' && lastChar <= '9') { - const string trimmed = rsType.substr(0, last); - int i = findCType(trimmed); - if (i >= 0) { - rsBaseType = trimmed; - mVectorSize = lastChar; - } - } + getVectorSizeAndBaseType(rsType, mVectorSize, rsBaseType); typeIndex = findCType(rsBaseType); if (mVectorSize == "3") {