Generate all APIs.

This CL expands the generator to create all the .rsh files, not just
the core_math one.  To do so, processing of types (simple, struct, enums)
and constants was added.  .spec files corresponding to each .rsh file was
created.  Documentation was added.

This CL also generates HTML documentation files.  This generation will soon
be upgraded.

To make the code easier to expand, I've done fairly extensive refactoring.

In a subsequent CL, the APIs will be regrouped in different header files to
simplify learning the APIs.  In an other, the documentation generation will
be futher improved and incorporated in the actual online help.

Also removes rs_path & related functions.

Change-Id: I2c88554c9c6a8625233772b89e055fc6c4ad5da5
diff --git a/api/GenerateHeaderFiles.cpp b/api/GenerateHeaderFiles.cpp
new file mode 100644
index 0000000..4b2ecc7
--- /dev/null
+++ b/api/GenerateHeaderFiles.cpp
@@ -0,0 +1,360 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <iostream>
+#include <sstream>
+
+#include "Generator.h"
+#include "Specification.h"
+#include "Utilities.h"
+
+using namespace std;
+
+// Convert a file name into a string that can be used to guard the include file with #ifdef...
+static string makeGuardString(const string& filename) {
+    string s;
+    s.resize(15 + filename.size());
+    s = "RENDERSCRIPT_";
+    for (char c : filename) {
+        if (c == '.') {
+            s += '_';
+        } else {
+            s += toupper(c);
+        }
+    }
+    return s;
+}
+
+// Write #ifdef's that ensure that the specified version is present
+static void writeVersionGuardStart(GeneratedFile* file, VersionInfo info) {
+    if (info.intSize == 32) {
+        *file << "#ifndef __LP64__\n";
+    } else if (info.intSize == 64) {
+        *file << "#ifdef __LP64__\n";
+    }
+
+    if (info.minVersion <= 1) {
+        // No minimum
+        if (info.maxVersion > 0) {
+            *file << "#if !defined(RS_VERSION) || (RS_VERSION <= " << info.maxVersion << ")\n";
+        }
+    } else {
+        if (info.maxVersion == 0) {
+            // No maximum
+            *file << "#if (defined(RS_VERSION) && (RS_VERSION >= " << info.minVersion << "))\n";
+        } else {
+            *file << "#if (defined(RS_VERSION) && (RS_VERSION >= " << info.minVersion
+                  << ") && (RS_VERSION <= " << info.maxVersion << "))\n";
+        }
+    }
+}
+
+static void writeVersionGuardEnd(GeneratedFile* file, VersionInfo info) {
+    if (info.minVersion > 1 || info.maxVersion != 0) {
+        *file << "#endif\n";
+    }
+    if (info.intSize != 0) {
+        *file << "#endif\n";
+    }
+}
+
+static void writeComment(GeneratedFile* file, const string& name, const string& briefComment,
+                         const vector<string>& comment, bool closeBlock) {
+    if (briefComment.empty() && comment.size() == 0) {
+        return;
+    }
+    *file << "/*\n";
+    if (!briefComment.empty()) {
+        *file << " * " << name << ": " << briefComment << "\n";
+        *file << " *\n";
+    }
+    for (size_t ct = 0; ct < comment.size(); ct++) {
+        string s = stripHtml(comment[ct]);
+        s = stringReplace(s, "@", "");
+        if (!s.empty()) {
+            *file << " * " << s << "\n";
+        } else {
+            *file << " *\n";
+        }
+    }
+    if (closeBlock) {
+        *file << " */\n";
+    }
+}
+
+static void writeConstant(GeneratedFile* file, const Constant& constant) {
+    const string name = constant.getName();
+    writeComment(file, name, constant.getSummary(), constant.getDescription(), true);
+
+    for (auto spec : constant.getSpecifications()) {
+        VersionInfo info = spec->getVersionInfo();
+        writeVersionGuardStart(file, info);
+        *file << "#define " << name << " " << spec->getValue() << "\n";
+        writeVersionGuardEnd(file, info);
+    }
+    *file << "\n";
+}
+
+static void writeTypeSpecification(GeneratedFile* file, const string& typeName,
+                                   const TypeSpecification& spec) {
+    const VersionInfo info = spec.getVersionInfo();
+    writeVersionGuardStart(file, info);
+    switch (spec.getKind()) {
+        case SIMPLE:
+            *file << "typedef " << spec.getSimpleType() << " " << typeName << ";\n";
+            break;
+        case ENUM: {
+            *file << "typedef enum ";
+            const string name = spec.getEnumName();
+            if (!name.empty()) {
+                *file << name << " ";
+            }
+            *file << "{\n";
+
+            const vector<string>& values = spec.getValues();
+            const vector<string>& valueComments = spec.getValueComments();
+            const size_t last = values.size() - 1;
+            for (size_t i = 0; i <= last; i++) {
+                *file << "    " << values[i];
+                if (i != last) {
+                    *file << ",";
+                }
+                if (valueComments.size() > i && !valueComments[i].empty()) {
+                    *file << " // " << valueComments[i];
+                }
+                *file << "\n";
+            }
+            *file << "} " << typeName << ";\n";
+            break;
+        }
+        case STRUCT: {
+            *file << "typedef struct ";
+            const string name = spec.getStructName();
+            if (!name.empty()) {
+                *file << name << " ";
+            }
+            *file << "{\n";
+
+            const vector<string>& fields = spec.getFields();
+            const vector<string>& fieldComments = spec.getFieldComments();
+            for (size_t i = 0; i < fields.size(); i++) {
+                *file << "    " << fields[i] << ";";
+                if (fieldComments.size() > i && !fieldComments[i].empty()) {
+                    *file << " // " << fieldComments[i];
+                }
+                *file << "\n";
+            }
+            *file << "} ";
+            const string attrib = spec.getAttrib();
+            if (!attrib.empty()) {
+                *file << attrib << " ";
+            }
+            *file << typeName << ";\n";
+            break;
+        }
+    }
+    writeVersionGuardEnd(file, info);
+    *file << "\n";
+}
+
+static void writeType(GeneratedFile* file, const Type& type) {
+    const string name = type.getName();
+    writeComment(file, name, type.getSummary(), type.getDescription(), true);
+
+    for (auto spec : type.getSpecifications()) {
+        writeTypeSpecification(file, name, *spec);
+    }
+    *file << "\n";
+}
+
+static void writeFunctionPermutation(GeneratedFile* file, const FunctionSpecification& spec,
+                                     const FunctionPermutation& permutation) {
+    writeVersionGuardStart(file, spec.getVersionInfo());
+
+    // Write linkage info.
+    const auto inlineCodeLines = permutation.getInline();
+    if (inlineCodeLines.size() > 0) {
+        *file << "static inline ";
+    } else {
+        *file << "extern ";
+    }
+
+    // Write the return type.
+    auto ret = permutation.getReturn();
+    if (ret) {
+        *file << ret->rsType;
+    } else {
+        *file << "void";
+    }
+
+    // Write the attribute.
+    *file << " __attribute__((";
+    const string attrib = spec.getAttribute();
+    if (attrib.empty()) {
+        *file << "overloadable";
+    } else if (attrib[0] == '=') {
+        /* If starts with an equal, we don't automatically add overloadable.
+         * This is because of the error we made defining rsUnpackColor8888().
+         */
+        *file << attrib.substr(1);
+    } else {
+        *file << attrib << ", overloadable";
+    }
+    *file << "))\n";
+
+    // Write the function name.
+    *file << "    " << permutation.getName() << "(";
+    const int offset = 4 + permutation.getName().size() + 1;  // Size of above
+
+    // Write the arguments.  We wrap on mulitple lines if a line gets too long.
+    int charsOnLine = offset;
+    bool hasGenerated = false;
+    for (auto p : permutation.getParams()) {
+        if (hasGenerated) {
+            *file << ",";
+            charsOnLine++;
+        }
+        ostringstream ps;
+        ps << p->rsType;
+        if (p->isOutParameter) {
+            ps << "*";
+        }
+        if (!p->specName.empty()) {
+            ps << " " << p->specName;
+        }
+        const string s = ps.str();
+        if (charsOnLine + s.size() >= 100) {
+            *file << "\n" << string(offset, ' ');
+            charsOnLine = offset;
+        } else if (hasGenerated) {
+            *file << " ";
+            charsOnLine++;
+        }
+        *file << s;
+        charsOnLine += s.size();
+        hasGenerated = true;
+    }
+    // In C, if no parameters, we need to output void, e.g. fn(void).
+    if (!hasGenerated) {
+        *file << "void";
+    }
+    *file << ")";
+
+    // Write the inline code, if any.
+    if (inlineCodeLines.size() > 0) {
+        *file << " {\n";
+        for (size_t ct = 0; ct < inlineCodeLines.size(); ct++) {
+            if (inlineCodeLines[ct].empty()) {
+                *file << "\n";
+            } else {
+                *file << "    " << inlineCodeLines[ct] << "\n";
+            }
+        }
+        *file << "}\n";
+    } else {
+        *file << ";\n";
+    }
+
+    writeVersionGuardEnd(file, spec.getVersionInfo());
+    *file << "\n";
+}
+
+static void writeFunction(GeneratedFile* file, const Function& function) {
+    // Write the generic documentation.
+    writeComment(file, function.getName(), function.getSummary(), function.getDescription(), false);
+
+    // Comment the parameters.
+    if (function.someParametersAreDocumented()) {
+        *file << " *\n";
+        *file << " * Parameters:\n";
+        for (auto p : function.getParameters()) {
+            if (!p->documentation.empty()) {
+                *file << " *   " << p->name << " " << p->documentation << "\n";
+            }
+        }
+    }
+
+    // Comment the return type.
+    const string returnDoc = function.getReturnDocumentation();
+    if (!returnDoc.empty()) {
+        *file << " *\n";
+        *file << " * Returns: " << returnDoc << "\n";
+    }
+
+    *file << " */\n";
+
+    // Write all the variants.
+    for (auto spec : function.getSpecifications()) {
+        for (auto permutation : spec->getPermutations()) {
+            writeFunctionPermutation(file, *spec, *permutation);
+        }
+    }
+}
+
+static bool writeHeaderFile(const SpecFile& specFile) {
+    const string headerFileName = specFile.getHeaderFileName();
+
+    // We generate one header file for each spec file.
+    GeneratedFile file;
+    if (!file.start(headerFileName)) {
+        return false;
+    }
+
+    // Write the comments that start the file.
+    file.writeNotices();
+    writeComment(&file, headerFileName, specFile.getBriefDescription(),
+                 specFile.getFullDescription(), true);
+
+    // Write the ifndef that prevents the file from being included twice.
+    const string guard = makeGuardString(headerFileName);
+    file << "#ifndef " << guard << "\n";
+    file << "#define " << guard << "\n\n";
+
+    // Add lines that need to be put in "as is".
+    if (specFile.getVerbatimInclude().size() > 0) {
+        for (auto s : specFile.getVerbatimInclude()) {
+            file << s << "\n";
+        }
+        file << "\n";
+    }
+
+    /* Write the constants, types, and functions in the same order as
+     * encountered in the spec file.
+     */
+    for (auto iter : specFile.getConstantsList()) {
+        writeConstant(&file, *iter);
+    }
+    for (auto iter : specFile.getTypesList()) {
+        writeType(&file, *iter);
+    }
+    for (auto iter : specFile.getFunctionsList()) {
+        writeFunction(&file, *iter);
+    }
+
+    file << "#endif // " << guard << "\n";
+    file.close();
+    return true;
+}
+
+bool GenerateHeaderFiles() {
+    bool success = true;
+    for (auto specFile : systemSpecification.getSpecFiles()) {
+        if (!writeHeaderFile(*specFile)) {
+            success = false;
+        }
+    }
+    return success;
+}
diff --git a/api/GenerateHtmlDocumentation.cpp b/api/GenerateHtmlDocumentation.cpp
new file mode 100644
index 0000000..a7782c8
--- /dev/null
+++ b/api/GenerateHtmlDocumentation.cpp
@@ -0,0 +1,672 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <iostream>
+#include <sstream>
+
+#include "Generator.h"
+#include "Specification.h"
+#include "Utilities.h"
+
+using namespace std;
+
+struct DetailedFunctionEntry {
+    VersionInfo info;
+    string htmlDeclaration;
+};
+
+static void writeHtmlHeader(GeneratedFile* file) {
+    *file << "<!DOCTYPE html>\n";
+    *file << "<!-- " << AUTO_GENERATED_WARNING << "-->\n";
+
+    *file << "<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>\n"
+             "<meta name='viewport' content='width=device-width'>\n"
+             "<link rel='shortcut icon' type='image/x-icon' "
+             "href='http://developer.android.com/favicon.ico'>\n"
+             "<title>android.renderscript | Android Developers</title>\n"
+             "<!-- STYLESHEETS -->\n"
+             "<link rel='stylesheet' "
+             "href='http://fonts.googleapis.com/css?family=Roboto+Condensed'>\n"
+             "<link rel='stylesheet' href='http://fonts.googleapis.com/"
+             "css?family=Roboto:light,regular,medium,thin,italic,mediumitalic,bold' "
+             "title='roboto'>\n"
+             "<link href='./test_files/default.css' rel='stylesheet' type='text/css'>\n"
+             "<!-- FULLSCREEN STYLESHEET -->\n"
+             "<link href='./test_files/fullscreen.css' rel='stylesheet' class='fullscreen' "
+             "type='text/css'>\n"
+             "<!-- JAVASCRIPT -->\n"
+             "<script src='./test_files/cb=gapi.loaded_0' async=''></script><script "
+             "type='text/javascript' async='' src='./test_files/plusone.js' "
+             "gapi_processed='true'></script><script async='' "
+             "src='./test_files/analytics.js'></script><script src='./test_files/jsapi' "
+             "type='text/javascript'></script>\n"
+             "<script src='./test_files/android_3p-bundle.js' type='text/javascript'></script>\n"
+             "<script type='text/javascript'>\n"
+             "  var toRoot = '/';\n"
+             "  var metaTags = [];\n"
+             "  var devsite = false;\n"
+             "</script>\n"
+             "<script src='./test_files/docs.js' type='text/javascript'></script><script "
+             "type='text/javascript' src='./test_files/saved_resource'></script>\n"
+             "<script>\n"
+             "  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n"
+             "  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\n"
+             "  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n"
+             "  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n"
+             "  ga('create', 'UA-5831155-1', 'android.com');\n"
+             "  ga('create', 'UA-49880327-2', 'android.com', {'name': 'universal'});  // New "
+             "tracker);\n"
+             "  ga('send', 'pageview');\n"
+             "  ga('universal.send', 'pageview'); // Send page view for new tracker.\n"
+             "</script>\n"
+             "<link type='text/css' href='./test_files/default+en.css' rel='stylesheet'><script "
+             "type='text/javascript' src='./test_files/default+en.I.js'></script></head>\n"
+             "<body class='gc-documentation\n"
+             "  develop reference'>\n";
+    //"  <div id='doc-api-level' class='11' style='display:none'></div>\n"
+    //"  <a name='top'></a>\n";
+}
+
+static void writeHtmlFooter(GeneratedFile* file) {
+    *file << "</div> <!-- end body-content -->\n"
+             "</body></html>\n";
+}
+
+// If prefix starts input, copy it to stream and remove it from input.
+static void skipPrefix(ostringstream* stream, string* input, const string& prefix) {
+    size_t size = prefix.size();
+    if (input->compare(0, size, prefix) != 0) {
+        return;
+    }
+    input->erase(0, size);
+    *stream << prefix;
+}
+
+// Merge b into a.  Returns true if successful
+static bool mergeVersionInfo(VersionInfo* a, const VersionInfo& b) {
+    if (a->intSize != b.intSize) {
+        cerr << "Error.  We don't currently support versions that differ based on int size\n";
+        return false;
+    }
+    if (b.minVersion != 0 && a->maxVersion == b.minVersion - 1) {
+        a->maxVersion = b.maxVersion;
+    } else if (b.maxVersion != 0 && a->minVersion == b.maxVersion + 1) {
+        a->minVersion = b.minVersion;
+    } else {
+        cerr << "Error.  This code currently assume that all versions are contiguous.  Don't know "
+                "how to merge versions (" << a->minVersion << " - " << a->maxVersion << ") and ("
+             << b.minVersion << " - " << b.maxVersion << ")\n";
+        return false;
+    }
+    return true;
+}
+
+static string getHtmlStringForType(const ParameterDefinition& parameter) {
+    string s = parameter.rsType;
+    ostringstream stream;
+    skipPrefix(&stream, &s, "const ");
+    skipPrefix(&stream, &s, "volatile ");
+    bool endsWithAsterisk = s.size() > 0 && s[s.size() - 1] == '*';
+    if (endsWithAsterisk) {
+        s.erase(s.size() - 1, 1);
+    }
+
+    string anchor = systemSpecification.getHtmlAnchor(s);
+    if (anchor.empty()) {
+        // Not a RenderScript specific type.
+        return parameter.rsType;
+    } else {
+        stream << anchor;
+    }
+    if (endsWithAsterisk) {
+        stream << "*";
+    }
+    return stream.str();
+}
+
+static string getDetailedHtmlDeclaration(const FunctionPermutation& permutation) {
+    ostringstream stream;
+    auto ret = permutation.getReturn();
+    if (ret) {
+        stream << getHtmlStringForType(*ret);
+    } else {
+        stream << "void";
+    }
+    stream << " " << permutation.getName() << "(";
+    bool needComma = false;
+    for (auto p : permutation.getParams()) {
+        if (needComma) {
+            stream << ", ";
+        }
+        stream << getHtmlStringForType(*p);
+        if (p->isOutParameter) {
+            stream << "*";
+        }
+        if (!p->specName.empty()) {
+            stream << " " << p->specName;
+        }
+        needComma = true;
+    }
+    stream << ");\n";
+    return stream.str();
+}
+
+/* Some functions (like max) have changed implementations but not their
+ * declaration.  We need to unify these so that we don't end up with entries
+ * like:
+ *   char max(char a, char b);  Removed from API level 20
+ *   char max(char a, char b);  Added to API level 20
+ */
+static bool getUnifiedFunctionPrototypes(Function* function,
+                                         map<string, DetailedFunctionEntry>* entries) {
+    for (auto f : function->getSpecifications()) {
+        DetailedFunctionEntry entry;
+        entry.info = f->getVersionInfo();
+        for (auto p : f->getPermutations()) {
+            entry.htmlDeclaration = getDetailedHtmlDeclaration(*p);
+            const string s = stripHtml(entry.htmlDeclaration);
+            auto i = entries->find(s);
+            if (i == entries->end()) {
+                entries->insert(pair<string, DetailedFunctionEntry>(s, entry));
+            } else {
+                if (!mergeVersionInfo(&i->second.info, entry.info)) {
+                    return false;
+                }
+            }
+        }
+    }
+    return true;
+}
+
+// Convert words starting with @ into HTML references.  Returns false if error.
+static bool convertDocumentationRefences(string* s) {
+    bool success = true;
+    size_t end = 0;
+    for (;;) {
+        size_t start = s->find('@', end);
+        if (start == string::npos) {
+            break;
+        }
+        // Find the end of the identifier
+        end = start;
+        char c;
+        do {
+            c = (*s)[++end];
+        } while (isalnum(c) || c == '_');
+
+        const string id = s->substr(start + 1, end - start - 1);
+        string anchor = systemSpecification.getHtmlAnchor(id);
+        if (anchor.empty()) {
+            cerr << "Error:  Can't convert the documentation reference @" << id << "\n";
+            success = false;
+        }
+        s->replace(start, end - start, anchor);
+    }
+    return success;
+}
+
+static bool generateHtmlParagraphs(GeneratedFile* file, const vector<string>& description) {
+    bool inParagraph = false;
+    for (auto s : description) {
+        // Empty lines in the .spec marks paragraphs.
+        if (s.empty()) {
+            if (inParagraph) {
+                *file << "</p>\n";
+                inParagraph = false;
+            }
+        } else {
+            if (!inParagraph) {
+                *file << "<p> ";
+                inParagraph = true;
+            }
+        }
+        if (!convertDocumentationRefences(&s)) {
+            return false;
+        }
+        *file << s << "\n";
+    }
+    if (inParagraph) {
+        *file << "</p>\n";
+    }
+    return true;
+}
+
+static void writeSummaryTableStart(GeneratedFile* file, const char* label, bool labelIsHeading) {
+    if (labelIsHeading) {
+        *file << "<h2 style='margin-bottom: 0px;'>" << label << "</h2><hr>\n";
+    }
+    //#TODO promethods was the id.  implication?
+    *file << "<table id='id" << label << "' class='jd-sumtable'><tbody>\n";
+    if (!labelIsHeading) {
+        *file << "  <tr><th colspan='12'>" << label << "</th></tr>\n";
+    }
+}
+
+static void writeSummaryTableEnd(GeneratedFile* file) {
+    *file << "</tbody></table>\n";
+}
+
+static void writeSummaryTableEntry(GeneratedFile* file, Constant* constant) {
+    if (constant->hidden()) {
+        return;
+    }
+    *file << "  <tr class='alt-color api apilevel-1'>\n";
+    *file << "    <td class='jd-linkcol'><nobr>\n";
+    *file << "      <a href='" << constant->getUrl() << "'>" << constant->getName()
+          << "</a></nobr>\n";
+    *file << "    </td>\n";
+    *file << "    <td class='jd-descrcol' width='100%'><nobr>\n";
+    *file << "        " << constant->getSummary() << "\n";
+    *file << "    </td>\n";
+    *file << "  </tr>\n";
+}
+
+static void writeSummaryTableEntry(GeneratedFile* file, Type* type) {
+    if (type->hidden()) {
+        return;
+    }
+    *file << "  <tr class='alt-color api apilevel-1'>\n";
+    *file << "    <td class='jd-linkcol'><nobr>\n";
+    *file << "      <a href='" << type->getUrl() << "'>" << type->getName() << "</a></nobr>\n";
+    *file << "    </td>\n";
+    *file << "    <td class='jd-descrcol' width='100%'><nobr>\n";
+    *file << "        " << type->getSummary() << "\n";
+    *file << "    </td>\n";
+    *file << "  </tr>\n";
+}
+
+static void writeSummaryTableEntry(GeneratedFile* file, Function* function) {
+    *file << "  <tr class='alt-color api apilevel-1'>\n";
+    *file << "    <td class='jd-linkcol'>\n";
+    *file << "      <a href='" << function->getUrl() << "'>" << function->getName() << "</a>\n";
+    *file << "    </td>\n";
+    *file << "    <td class='jd-linkcol' width='100%'>\n";  // TODO jd-typecol
+    //    *file << "      <nobr><span class='sympad'></span></nobr>\n";
+    *file << "      <div class='jd-descrdiv'>\n";
+    *file << "        " << function->getSummary() << "\n";
+    *file << "      </div>\n";
+    *file << "    </td>\n";
+    *file << "  </tr>\n";
+}
+
+static void writeSummaryTables(GeneratedFile* file, const map<string, Constant*>& constants,
+                               const map<string, Type*>& types,
+                               const map<string, Function*>& functions, bool labelAsHeader) {
+    if (constants.size() > 0) {
+        writeSummaryTableStart(file, "Constants", labelAsHeader);
+        for (auto e : constants) {
+            writeSummaryTableEntry(file, e.second);
+        }
+        writeSummaryTableEnd(file);
+    }
+
+    if (types.size() > 0) {
+        writeSummaryTableStart(file, "Types", labelAsHeader);
+        for (auto e : types) {
+            writeSummaryTableEntry(file, e.second);
+        }
+        writeSummaryTableEnd(file);
+    }
+
+    if (functions.size() > 0) {
+        writeSummaryTableStart(file, "Functions", labelAsHeader);
+        for (auto e : functions) {
+            writeSummaryTableEntry(file, e.second);
+        }
+        writeSummaryTableEnd(file);
+    }
+}
+
+static void writeHtmlVersionTag(GeneratedFile* file, VersionInfo info) {
+    if (info.intSize == 32) {
+        *file << "For 32 bits: ";
+    } else if (info.intSize == 64) {
+        *file << "For 64 bits: ";
+    }
+
+    if (info.minVersion > 1 || info.maxVersion) {
+        *file << "<div>";
+        const char* mid =
+                    "<a "
+                    "href='http://developer.android.com/guide/topics/manifest/"
+                    "uses-sdk-element.html#ApiLevels'>API level ";
+        if (info.minVersion <= 1) {
+            // No minimum
+            if (info.maxVersion > 0) {
+                *file << "Removed from " << mid << info.maxVersion + 1;
+            }
+        } else {
+            if (info.maxVersion == 0) {
+                // No maximum
+                *file << "Added in " << mid << info.minVersion;
+            } else {
+                *file << mid << info.minVersion << " - " << info.maxVersion;
+            }
+        }
+        *file << "</a></div>\n";
+    }
+}
+
+static void writeDetailedType(GeneratedFile* file, const TypeSpecification* type) {
+    switch (type->getKind()) {
+        case SIMPLE:
+            *file << "Base type: " << type->getSimpleType() << "\n";
+            break;
+        case ENUM: {
+            *file << "An enum<br>\n";
+            *file << "    <table class='jd-tagtable'><tbody>\n";
+
+            const vector<string>& values = type->getValues();
+            const vector<string>& valueComments = type->getValueComments();
+            for (size_t i = 0; i < values.size(); i++) {
+                *file << "    <tr><th>" << values[i] << "</th>";
+                if (valueComments.size() > i && !valueComments[i].empty()) {
+                    *file << "<td>" << valueComments[i] << "</td>";
+                }
+                *file << "</tr>\n";
+            }
+            *file << "    </tbody></table>\n";
+            break;
+        }
+        case STRUCT: {
+            // TODO string mStructName;             // The name found after the struct keyword
+            *file << "A structure<br>\n";
+            *file << "    <table class='jd-tagtable'><tbody>\n";
+            const vector<string>& fields = type->getFields();
+            const vector<string>& fieldComments = type->getFieldComments();
+            for (size_t i = 0; i < fields.size(); i++) {
+                *file << "    <tr><th>" << fields[i] << "</th>";
+                if (fieldComments.size() > i && !fieldComments[i].empty()) {
+                    *file << "<td>" << fieldComments[i] << "</td>";
+                }
+                *file << "</tr>\n";
+            }
+            *file << "    </tbody></table>\n";
+            break;
+        }
+    }
+    writeHtmlVersionTag(file, type->getVersionInfo());
+}
+
+static void writeDetailedConstant(GeneratedFile* file, ConstantSpecification* c) {
+    *file << "Value: " << c->getValue() << "\n";
+    writeHtmlVersionTag(file, c->getVersionInfo());
+}
+
+static bool writeOverviewForFile(GeneratedFile* file, const SpecFile& specFile) {
+    bool success = true;
+    *file << "<h2>" << specFile.getBriefDescription() << "</h2>\n";
+    if (!generateHtmlParagraphs(file, specFile.getFullDescription())) {
+        success = false;
+    }
+
+    // Write the summary tables.
+    // file << "<h2>Summary</h2>\n";
+    const auto& constants = specFile.getConstantsMap();
+    const auto& types = specFile.getTypesMap();
+    const auto& functions = specFile.getFunctionsMap();
+    writeSummaryTables(file, constants, types, functions, false);
+    return success;
+}
+
+static bool generateOverview() {
+    GeneratedFile file;
+    if (!file.start("index.html")) {
+        return false;
+    }
+    bool success = true;
+    writeHtmlHeader(&file);
+
+    file << "<h1 itemprop='name'>Overview</h1>\n";
+    // TODO Have the overview text here!
+
+    for (auto specFile : systemSpecification.getSpecFiles()) {
+        if (!writeOverviewForFile(&file, *specFile)) {
+            success = false;
+        }
+    }
+
+    writeHtmlFooter(&file);
+    file.close();
+    return success;
+}
+
+static bool generateAlphabeticalIndex() {
+    GeneratedFile file;
+    if (!file.start("alpha_index.html")) {
+        return false;
+    }
+    writeHtmlHeader(&file);
+
+    writeSummaryTables(&file, systemSpecification.getConstants(), systemSpecification.getTypes(),
+                       systemSpecification.getFunctions(), true);
+
+    writeHtmlFooter(&file);
+    file.close();
+    return true;
+}
+
+static bool writeDetailedConstant(GeneratedFile* file, Constant* constant) {
+    if (constant->hidden()) {
+        return true;
+    }
+    const string& name = constant->getName();
+
+    // TODO need names that distinguish fn.const. type
+    // TODO had attr_android:...
+    *file << "<a name='android_rs:" << name << "'></a>\n";
+    *file << "<div class='jd-details'>\n";
+    *file << "  <h4 class='jd-details-title'>\n";
+    *file << "    <span class='sympad'>" << name << "</span>\n";
+    *file << "    <span class='normal'>: " << constant->getSummary() << "</span>\n";
+    *file << "  </h4>\n";
+
+    *file << "  <div class='jd-details-descr'>\n";
+    *file << "    <table class='jd-tagtable'><tbody>\n";
+    for (auto f : constant->getSpecifications()) {
+        *file << "      <tr><td>";
+        writeDetailedConstant(file, f);
+        *file << "      </td></tr>\n";
+        *file << "<br/>\n";
+    }
+    *file << "    </tbody></table>\n";
+    *file << "  </div>\n";
+
+    *file << "    <div class='jd-tagdata jd-tagdescr'>\n";
+
+    if (!generateHtmlParagraphs(file, constant->getDescription())) {
+        return false;
+    }
+    *file << "    </div>\n";
+
+    *file << "</div>\n";
+    *file << "\n";
+    return true;
+}
+
+static bool writeDetailedType(GeneratedFile* file, Type* type) {
+    if (type->hidden()) {
+        return true;
+    }
+    const string& name = type->getName();
+
+    // TODO need names that distinguish fn.const. type
+    // TODO had attr_android:...
+    *file << "<a name='android_rs:" << name << "'></a>\n";
+    *file << "<div class='jd-details'>\n";
+    *file << "  <h4 class='jd-details-title'>\n";
+    *file << "    <span class='sympad'>" << name << "</span>\n";
+    *file << "    <span class='normal'>: " << type->getSummary() << "</span>\n";
+    *file << "  </h4>\n";
+
+    *file << "  <div class='jd-details-descr'>\n";
+    *file << "    <h5 class='jd-tagtitle'>Variants</h5>\n";
+    *file << "    <table class='jd-tagtable'><tbody>\n";
+    for (auto f : type->getSpecifications()) {
+        *file << "      <tr><td>";
+        writeDetailedType(file, f);
+        *file << "      </td></tr>\n";
+        *file << "<br/>\n";
+    }
+    *file << "    </tbody></table>\n";
+    *file << "  </div>\n";
+
+    *file << "    <div class='jd-tagdata jd-tagdescr'>\n";
+
+    if (!generateHtmlParagraphs(file, type->getDescription())) {
+        return false;
+    }
+
+    *file << "    </div>\n";
+
+    *file << "</div>\n";
+    *file << "\n";
+    return true;
+}
+
+static bool writeDetailedFunction(GeneratedFile* file, Function* function) {
+    const string& name = function->getName();
+
+    // TODO need names that distinguish fn.const. type
+    // TODO had attr_android:...
+    *file << "<a name='android_rs:" << name << "'></a>\n";
+    *file << "<div class='jd-details'>\n";
+    *file << "  <h4 class='jd-details-title'>\n";
+    *file << "    <span class='sympad'>" << name << "</span>\n";
+    *file << "    <span class='normal'>: " << function->getSummary() << "</span>\n";
+    *file << "  </h4>\n";
+
+    *file << "  <div class='jd-details-descr'>\n";
+    *file << "    <table class='jd-tagtable'><tbody>\n";
+    map<string, DetailedFunctionEntry> entries;
+    if (!getUnifiedFunctionPrototypes(function, &entries)) {
+        return false;
+    }
+    for (auto i : entries) {
+        *file << "      <tr>\n";
+        *file << "        <td>" << i.second.htmlDeclaration << "<td/>\n";
+        *file << "        <td>";
+        writeHtmlVersionTag(file, i.second.info);
+        *file << "</td>\n";
+        *file << "      </tr>\n";
+    }
+    *file << "    </tbody></table>\n";
+    *file << "  </div>\n";
+
+    if (function->someParametersAreDocumented()) {
+        *file << "  <div class='jd-tagdata'>";
+        *file << "    <h5 class='jd-tagtitle'>Parameters</h5>\n";
+        *file << "    <table class='jd-tagtable'><tbody>\n";
+        for (ParameterEntry* p : function->getParameters()) {
+            *file << "    <tr><th>" << p->name << "</th><td>" << p->documentation << "</td></tr>\n";
+        }
+        *file << "    </tbody></table>\n";
+        *file << "  </div>\n";
+    }
+
+    string ret = function->getReturnDocumentation();
+    if (!ret.empty()) {
+        *file << "  <div class='jd-tagdata'>";
+        *file << "    <h5 class='jd-tagtitle'>Returns</h5>\n";
+        *file << "    <table class='jd-tagtable'><tbody>\n";
+        *file << "    <tr><td>" << ret << "</td></tr>\n";
+        *file << "    </tbody></table>\n";
+        *file << "  </div>\n";
+    }
+
+    *file << "  <div class='jd-tagdata jd-tagdescr'>\n";
+    if (!generateHtmlParagraphs(file, function->getDescription())) {
+        return false;
+    }
+    *file << "  </div>\n";
+
+    *file << "</div>\n";
+    *file << "\n";
+    return true;
+}
+
+static bool writeDetailedDocumentationFile(const SpecFile& specFile) {
+    GeneratedFile file;
+    const string htmlFileName = stringReplace(specFile.getSpecFileName(), ".spec", ".html");
+    if (!file.start(htmlFileName)) {
+        return false;
+    }
+    bool success = true;
+
+    writeHtmlHeader(&file);
+    file << "<br/>";
+
+    // Write the file documentation.
+    file << "<h1 itemprop='name'>" << specFile.getBriefDescription()
+         << "</h1>\n";  // TODO not sure about itemprop
+
+    file << "<h2>Overview</h2>\n";
+    if (!generateHtmlParagraphs(&file, specFile.getFullDescription())) {
+        success = false;
+    }
+
+    // Write the summary tables.
+    file << "<h2>Summary</h2>\n";
+    const auto& constants = specFile.getConstantsMap();
+    const auto& types = specFile.getTypesMap();
+    const auto& functions = specFile.getFunctionsMap();
+    writeSummaryTables(&file, constants, types, functions, false);
+
+    // Write the full details of each constant, type, and function.
+    if (!constants.empty()) {
+        file << "<h2>Constants</h2>\n";
+        for (auto i : constants) {
+            if (!writeDetailedConstant(&file, i.second)) {
+                success = false;
+            }
+        }
+    }
+    if (!types.empty()) {
+        file << "<h2>Types</h2>\n";
+        for (auto i : types) {
+            if (!writeDetailedType(&file, i.second)) {
+                success = false;
+            }
+        }
+    }
+    if (!functions.empty()) {
+        file << "<h2>Functions</h2>\n";
+        for (auto i : functions) {
+            if (!writeDetailedFunction(&file, i.second)) {
+                success = false;
+            }
+        }
+    }
+
+    writeHtmlFooter(&file);
+    file.close();
+
+    if (!success) {
+        // If in error, write a final message to make it easier to figure out which file failed.
+        cerr << htmlFileName << ": Failed due to errors.\n";
+    }
+    return success;
+}
+
+bool generateHtmlDocumentation() {
+    bool success = generateOverview() && generateAlphabeticalIndex();
+    for (auto specFile : systemSpecification.getSpecFiles()) {
+        if (!writeDetailedDocumentationFile(*specFile)) {
+            success = false;
+        }
+    }
+    return success;
+}
diff --git a/api/GenerateTestFiles.cpp b/api/GenerateTestFiles.cpp
new file mode 100644
index 0000000..7cf1099
--- /dev/null
+++ b/api/GenerateTestFiles.cpp
@@ -0,0 +1,1039 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <iomanip>
+#include <iostream>
+#include <cmath>
+#include <sstream>
+
+#include "Generator.h"
+#include "Specification.h"
+#include "Utilities.h"
+
+using namespace std;
+
+// Converts float2 to FLOAT_32 and 2, etc.
+static void convertToRsType(const string& name, string* dataType, char* vectorSize) {
+    string s = name;
+    int last = s.size() - 1;
+    char lastChar = s[last];
+    if (lastChar >= '1' && lastChar <= '4') {
+        s.erase(last);
+        *vectorSize = lastChar;
+    } else {
+        *vectorSize = '1';
+    }
+    dataType->clear();
+    for (int i = 0; i < NUM_TYPES; i++) {
+        if (s == TYPES[i].cType) {
+            *dataType = TYPES[i].rsDataType;
+            break;
+        }
+    }
+}
+
+// Returns true if any permutation of the function have tests to b
+static bool needTestFiles(const Function& function, int versionOfTestFiles) {
+    for (auto spec : function.getSpecifications()) {
+        if (spec->hasTests(versionOfTestFiles)) {
+            return true;
+        }
+    }
+    return false;
+}
+
+/* One instance of this class is generated for each permutation of a function for which
+ * we are generating test code.  This instance will generate both the script and the Java
+ * section of the test files for this permutation.  The class is mostly used to keep track
+ * of the various names shared between script and Java files.
+ * WARNING: Because the constructor keeps a reference to the FunctionPermutation, PermutationWriter
+ * should not exceed the lifetime of FunctionPermutation.
+ */
+class PermutationWriter {
+private:
+    FunctionPermutation& mPermutation;
+
+    string mRsKernelName;
+    string mJavaArgumentsClassName;
+    string mJavaArgumentsNClassName;
+    string mJavaVerifierComputeMethodName;
+    string mJavaVerifierVerifyMethodName;
+    string mJavaCheckMethodName;
+    string mJavaVerifyMethodName;
+
+    // Pointer to the files we are generating.  Handy to avoid always passing them in the calls.
+    GeneratedFile* mRs;
+    GeneratedFile* mJava;
+
+    /* Shortcuts to the return parameter and the first input parameter of the function
+     * specification.
+     */
+    const ParameterDefinition* mReturnParam;      // Can be nullptr.  NOT OWNED.
+    const ParameterDefinition* mFirstInputParam;  // Can be nullptr.  NOT OWNED.
+
+    /* All the parameters plus the return param, if present.  Collecting them together
+     * simplifies code generation.  NOT OWNED.
+     */
+    vector<const ParameterDefinition*> mAllInputsAndOutputs;
+
+    /* We use a class to pass the arguments between the generated code and the CoreVerifier.  This
+     * method generates this class.  The set keeps track if we've generated this class already
+     * for this test file, as more than one permutation may use the same argument class.
+     */
+    void writeJavaArgumentClass(bool scalar, set<string>* javaGeneratedArgumentClasses) const;
+
+    // Generate the Check* method that invokes the script and calls the verifier.
+    void writeJavaCheckMethod(bool generateCallToVerifier) const;
+
+    // Generate code to define and randomly initialize the input allocation.
+    void writeJavaInputAllocationDefinition(const ParameterDefinition& param) const;
+
+    /* Generate code that instantiate an allocation of floats or integers and fills it with
+     * random data. This random data must be compatible with the specified type.  This is
+     * used for the convert_* tests, as converting values that don't fit yield undefined results.
+     */
+    void writeJavaRandomCompatibleFloatAllocation(const string& dataType, const string& seed,
+                                                  char vectorSize,
+                                                  const NumericalType& compatibleType,
+                                                  const NumericalType& generatedType) const;
+    void writeJavaRandomCompatibleIntegerAllocation(const string& dataType, const string& seed,
+                                                    char vectorSize,
+                                                    const NumericalType& compatibleType,
+                                                    const NumericalType& generatedType) const;
+
+    // Generate code that defines an output allocation.
+    void writeJavaOutputAllocationDefinition(const ParameterDefinition& param) const;
+
+    /* Generate the code that verifies the results for RenderScript functions where each entry
+     * of a vector is evaluated independently.  If verifierValidates is true, CoreMathVerifier
+     * does the actual validation instead of more commonly returning the range of acceptable values.
+     */
+    void writeJavaVerifyScalarMethod(bool verifierValidates) const;
+
+    /* Generate the code that verify the results for a RenderScript function where a vector
+     * is a point in n-dimensional space.
+     */
+    void writeJavaVerifyVectorMethod() const;
+
+    // Generate the method header of the verify function.
+    void writeJavaVerifyMethodHeader() const;
+
+    // Generate codes that copies the content of an allocation to an array.
+    void writeJavaArrayInitialization(const ParameterDefinition& p) const;
+
+    // Generate code that tests one value returned from the script.
+    void writeJavaTestAndSetValid(const ParameterDefinition& p, const string& argsIndex,
+                                  const string& actualIndex) const;
+    void writeJavaTestOneValue(const ParameterDefinition& p, const string& argsIndex,
+                               const string& actualIndex) const;
+    // For test:vector cases, generate code that compares returned vector vs. expected value.
+    void writeJavaVectorComparison(const ParameterDefinition& p) const;
+
+    // Muliple functions that generates code to build the error message if an error is found.
+    void writeJavaAppendOutputToMessage(const ParameterDefinition& p, const string& argsIndex,
+                                        const string& actualIndex, bool verifierValidates) const;
+    void writeJavaAppendInputToMessage(const ParameterDefinition& p, const string& actual) const;
+    void writeJavaAppendNewLineToMessage() const;
+    void writeJavaAppendVariableToMessage(const ParameterDefinition& p, const string& value) const;
+    void writeJavaAppendFloatVariableToMessage(const string& value, bool regularFloat) const;
+    void writeJavaAppendVectorInputToMessage(const ParameterDefinition& p) const;
+    void writeJavaAppendVectorOutputToMessage(const ParameterDefinition& p) const;
+
+    // Generate the set of instructions to call the script.
+    void writeJavaCallToRs(bool relaxed, bool generateCallToVerifier) const;
+
+    // Write an allocation definition if not already emitted in the .rs file.
+    void writeRsAllocationDefinition(const ParameterDefinition& param,
+                                     set<string>* rsAllocationsGenerated) const;
+
+public:
+    /* NOTE: We keep pointers to the permutation and the files.  This object should not
+     * outlive the arguments.
+     */
+    PermutationWriter(FunctionPermutation& permutation, GeneratedFile* rsFile,
+                      GeneratedFile* javaFile);
+    string getJavaCheckMethodName() const { return mJavaCheckMethodName; }
+
+    // Write the script test function for this permutation.
+    void writeRsSection(set<string>* rsAllocationsGenerated) const;
+    // Write the section of the Java code that calls the script and validates the results
+    void writeJavaSection(set<string>* javaGeneratedArgumentClasses) const;
+};
+
+PermutationWriter::PermutationWriter(FunctionPermutation& permutation, GeneratedFile* rsFile,
+                                     GeneratedFile* javaFile)
+    : mPermutation(permutation),
+      mRs(rsFile),
+      mJava(javaFile),
+      mReturnParam(nullptr),
+      mFirstInputParam(nullptr) {
+    mRsKernelName = "test" + capitalize(permutation.getName());
+
+    mJavaArgumentsClassName = "Arguments";
+    mJavaArgumentsNClassName = "Arguments";
+    const string trunk = capitalize(permutation.getNameTrunk());
+    mJavaCheckMethodName = "check" + trunk;
+    mJavaVerifyMethodName = "verifyResults" + trunk;
+
+    for (auto p : permutation.getParams()) {
+        mAllInputsAndOutputs.push_back(p);
+        if (mFirstInputParam == nullptr && !p->isOutParameter) {
+            mFirstInputParam = p;
+        }
+    }
+    mReturnParam = permutation.getReturn();
+    if (mReturnParam) {
+        mAllInputsAndOutputs.push_back(mReturnParam);
+    }
+
+    for (auto p : mAllInputsAndOutputs) {
+        const string capitalizedRsType = capitalize(p->rsType);
+        const string capitalizedBaseType = capitalize(p->rsBaseType);
+        mRsKernelName += capitalizedRsType;
+        mJavaArgumentsClassName += capitalizedBaseType;
+        mJavaArgumentsNClassName += capitalizedBaseType;
+        if (p->mVectorSize != "1") {
+            mJavaArgumentsNClassName += "N";
+        }
+        mJavaCheckMethodName += capitalizedRsType;
+        mJavaVerifyMethodName += capitalizedRsType;
+    }
+    mJavaVerifierComputeMethodName = "compute" + trunk;
+    mJavaVerifierVerifyMethodName = "verify" + trunk;
+}
+
+void PermutationWriter::writeJavaSection(set<string>* javaGeneratedArgumentClasses) const {
+    // By default, we test the results using item by item comparison.
+    const string test = mPermutation.getTest();
+    if (test == "scalar" || test == "limited") {
+        writeJavaArgumentClass(true, javaGeneratedArgumentClasses);
+        writeJavaCheckMethod(true);
+        writeJavaVerifyScalarMethod(false);
+    } else if (test == "custom") {
+        writeJavaArgumentClass(true, javaGeneratedArgumentClasses);
+        writeJavaCheckMethod(true);
+        writeJavaVerifyScalarMethod(true);
+    } else if (test == "vector") {
+        writeJavaArgumentClass(false, javaGeneratedArgumentClasses);
+        writeJavaCheckMethod(true);
+        writeJavaVerifyVectorMethod();
+    } else if (test == "noverify") {
+        writeJavaCheckMethod(false);
+    }
+}
+
+void PermutationWriter::writeJavaArgumentClass(bool scalar,
+                                               set<string>* javaGeneratedArgumentClasses) const {
+    string name;
+    if (scalar) {
+        name = mJavaArgumentsClassName;
+    } else {
+        name = mJavaArgumentsNClassName;
+    }
+
+    // Make sure we have not generated the argument class already.
+    if (!testAndSet(name, javaGeneratedArgumentClasses)) {
+        mJava->indent() << "public class " << name;
+        mJava->startBlock();
+
+        for (auto p : mAllInputsAndOutputs) {
+            mJava->indent() << "public ";
+            if (p->isOutParameter && p->isFloatType && mPermutation.getTest() != "custom") {
+                *mJava << "Target.Floaty";
+            } else {
+                *mJava << p->javaBaseType;
+            }
+            if (!scalar && p->mVectorSize != "1") {
+                *mJava << "[]";
+            }
+            *mJava << " " << p->variableName << ";\n";
+        }
+        mJava->endBlock();
+        *mJava << "\n";
+    }
+}
+
+void PermutationWriter::writeJavaCheckMethod(bool generateCallToVerifier) const {
+    mJava->indent() << "private void " << mJavaCheckMethodName << "()";
+    mJava->startBlock();
+
+    // Generate the input allocations and initialization.
+    for (auto p : mAllInputsAndOutputs) {
+        if (!p->isOutParameter) {
+            writeJavaInputAllocationDefinition(*p);
+        }
+    }
+    // Generate code to enforce ordering between two allocations if needed.
+    for (auto p : mAllInputsAndOutputs) {
+        if (!p->isOutParameter && !p->smallerParameter.empty()) {
+            string smallerAlloc = "in" + capitalize(p->smallerParameter);
+            mJava->indent() << "enforceOrdering(" << smallerAlloc << ", " << p->javaAllocName
+                            << ");\n";
+        }
+    }
+
+    // Generate code to check the full and relaxed scripts.
+    writeJavaCallToRs(false, generateCallToVerifier);
+    writeJavaCallToRs(true, generateCallToVerifier);
+
+    mJava->endBlock();
+    *mJava << "\n";
+}
+
+void PermutationWriter::writeJavaInputAllocationDefinition(const ParameterDefinition& param) const {
+    string dataType;
+    char vectorSize;
+    convertToRsType(param.rsType, &dataType, &vectorSize);
+
+    const string seed = hashString(mJavaCheckMethodName + param.javaAllocName);
+    mJava->indent() << "Allocation " << param.javaAllocName << " = ";
+    if (param.compatibleTypeIndex >= 0) {
+        if (TYPES[param.typeIndex].kind == FLOATING_POINT) {
+            writeJavaRandomCompatibleFloatAllocation(dataType, seed, vectorSize,
+                                                     TYPES[param.compatibleTypeIndex],
+                                                     TYPES[param.typeIndex]);
+        } else {
+            writeJavaRandomCompatibleIntegerAllocation(dataType, seed, vectorSize,
+                                                       TYPES[param.compatibleTypeIndex],
+                                                       TYPES[param.typeIndex]);
+        }
+    } else if (!param.minValue.empty()) {
+        *mJava << "createRandomFloatAllocation(mRS, Element.DataType." << dataType << ", "
+               << vectorSize << ", " << seed << ", " << param.minValue << ", " << param.maxValue
+               << ")";
+    } else {
+        /* TODO Instead of passing always false, check whether we are doing a limited test.
+         * Use instead: (mPermutation.getTest() == "limited" ? "false" : "true")
+         */
+        *mJava << "createRandomAllocation(mRS, Element.DataType." << dataType << ", " << vectorSize
+               << ", " << seed << ", false)";
+    }
+    *mJava << ";\n";
+}
+
+void PermutationWriter::writeJavaRandomCompatibleFloatAllocation(
+            const string& dataType, const string& seed, char vectorSize,
+            const NumericalType& compatibleType, const NumericalType& generatedType) const {
+    *mJava << "createRandomFloatAllocation"
+           << "(mRS, Element.DataType." << dataType << ", " << vectorSize << ", " << seed << ", ";
+    double minValue = 0.0;
+    double maxValue = 0.0;
+    switch (compatibleType.kind) {
+        case FLOATING_POINT: {
+            // We're generating floating point values.  We just worry about the exponent.
+            // Subtract 1 for the exponent sign.
+            int bits = min(compatibleType.exponentBits, generatedType.exponentBits) - 1;
+            maxValue = ldexp(0.95, (1 << bits) - 1);
+            minValue = -maxValue;
+            break;
+        }
+        case UNSIGNED_INTEGER:
+            maxValue = maxDoubleForInteger(compatibleType.significantBits,
+                                           generatedType.significantBits);
+            minValue = 0.0;
+            break;
+        case SIGNED_INTEGER:
+            maxValue = maxDoubleForInteger(compatibleType.significantBits,
+                                           generatedType.significantBits);
+            minValue = -maxValue - 1.0;
+            break;
+    }
+    *mJava << scientific << std::setprecision(19);
+    *mJava << minValue << ", " << maxValue << ")";
+    mJava->unsetf(ios_base::floatfield);
+}
+
+void PermutationWriter::writeJavaRandomCompatibleIntegerAllocation(
+            const string& dataType, const string& seed, char vectorSize,
+            const NumericalType& compatibleType, const NumericalType& generatedType) const {
+    *mJava << "createRandomIntegerAllocation"
+           << "(mRS, Element.DataType." << dataType << ", " << vectorSize << ", " << seed << ", ";
+
+    if (compatibleType.kind == FLOATING_POINT) {
+        // Currently, all floating points can take any number we generate.
+        bool isSigned = generatedType.kind == SIGNED_INTEGER;
+        *mJava << (isSigned ? "true" : "false") << ", " << generatedType.significantBits;
+    } else {
+        bool isSigned =
+                    compatibleType.kind == SIGNED_INTEGER && generatedType.kind == SIGNED_INTEGER;
+        *mJava << (isSigned ? "true" : "false") << ", "
+               << min(compatibleType.significantBits, generatedType.significantBits);
+    }
+    *mJava << ")";
+}
+
+void PermutationWriter::writeJavaOutputAllocationDefinition(
+            const ParameterDefinition& param) const {
+    string dataType;
+    char vectorSize;
+    convertToRsType(param.rsType, &dataType, &vectorSize);
+    mJava->indent() << "Allocation " << param.javaAllocName << " = Allocation.createSized(mRS, "
+                    << "getElement(mRS, Element.DataType." << dataType << ", " << vectorSize
+                    << "), INPUTSIZE);\n";
+}
+
+void PermutationWriter::writeJavaVerifyScalarMethod(bool verifierValidates) const {
+    writeJavaVerifyMethodHeader();
+    mJava->startBlock();
+
+    string vectorSize = "1";
+    for (auto p : mAllInputsAndOutputs) {
+        writeJavaArrayInitialization(*p);
+        if (p->mVectorSize != "1" && p->mVectorSize != vectorSize) {
+            if (vectorSize == "1") {
+                vectorSize = p->mVectorSize;
+            } else {
+                cerr << "Error.  Had vector " << vectorSize << " and " << p->mVectorSize << "\n";
+            }
+        }
+    }
+
+    mJava->indent() << "for (int i = 0; i < INPUTSIZE; i++)";
+    mJava->startBlock();
+
+    mJava->indent() << "for (int j = 0; j < " << vectorSize << " ; j++)";
+    mJava->startBlock();
+
+    mJava->indent() << "// Extract the inputs.\n";
+    mJava->indent() << mJavaArgumentsClassName << " args = new " << mJavaArgumentsClassName
+                    << "();\n";
+    for (auto p : mAllInputsAndOutputs) {
+        if (!p->isOutParameter) {
+            mJava->indent() << "args." << p->variableName << " = " << p->javaArrayName << "[i";
+            if (p->vectorWidth != "1") {
+                *mJava << " * " << p->vectorWidth << " + j";
+            }
+            *mJava << "];\n";
+        }
+    }
+    const bool hasFloat = mPermutation.hasFloatAnswers();
+    if (verifierValidates) {
+        mJava->indent() << "// Extract the outputs.\n";
+        for (auto p : mAllInputsAndOutputs) {
+            if (p->isOutParameter) {
+                mJava->indent() << "args." << p->variableName << " = " << p->javaArrayName
+                                << "[i * " + p->vectorWidth + " + j];\n";
+            }
+        }
+        mJava->indent() << "// Ask the CoreMathVerifier to validate.\n";
+        if (hasFloat) {
+            mJava->indent() << "Target target = new Target(relaxed);\n";
+        }
+        mJava->indent() << "String errorMessage = CoreMathVerifier."
+                        << mJavaVerifierVerifyMethodName << "(args";
+        if (hasFloat) {
+            *mJava << ", target";
+        }
+        *mJava << ");\n";
+        mJava->indent() << "boolean valid = errorMessage == null;\n";
+    } else {
+        mJava->indent() << "// Figure out what the outputs should have been.\n";
+        if (hasFloat) {
+            mJava->indent() << "Target target = new Target(relaxed);\n";
+        }
+        mJava->indent() << "CoreMathVerifier." << mJavaVerifierComputeMethodName << "(args";
+        if (hasFloat) {
+            *mJava << ", target";
+        }
+        *mJava << ");\n";
+        mJava->indent() << "// Validate the outputs.\n";
+        mJava->indent() << "boolean valid = true;\n";
+        for (auto p : mAllInputsAndOutputs) {
+            if (p->isOutParameter) {
+                writeJavaTestAndSetValid(*p, "", "[i * " + p->vectorWidth + " + j]");
+            }
+        }
+    }
+
+    mJava->indent() << "if (!valid)";
+    mJava->startBlock();
+
+    mJava->indent() << "StringBuilder message = new StringBuilder();\n";
+    for (auto p : mAllInputsAndOutputs) {
+        if (p->isOutParameter) {
+            writeJavaAppendOutputToMessage(*p, "", "[i * " + p->vectorWidth + " + j]",
+                                           verifierValidates);
+        } else {
+            writeJavaAppendInputToMessage(*p, "args." + p->variableName);
+        }
+    }
+    if (verifierValidates) {
+        mJava->indent() << "message.append(errorMessage);\n";
+    }
+
+    mJava->indent() << "assertTrue(\"Incorrect output for " << mJavaCheckMethodName << "\" +\n";
+    mJava->indentPlus()
+                << "(relaxed ? \"_relaxed\" : \"\") + \":\\n\" + message.toString(), valid);\n";
+
+    mJava->endBlock();
+    mJava->endBlock();
+    mJava->endBlock();
+    mJava->endBlock();
+    *mJava << "\n";
+}
+
+void PermutationWriter::writeJavaVerifyVectorMethod() const {
+    writeJavaVerifyMethodHeader();
+    mJava->startBlock();
+
+    for (auto p : mAllInputsAndOutputs) {
+        writeJavaArrayInitialization(*p);
+    }
+    mJava->indent() << "for (int i = 0; i < INPUTSIZE; i++)";
+    mJava->startBlock();
+
+    mJava->indent() << mJavaArgumentsNClassName << " args = new " << mJavaArgumentsNClassName
+                    << "();\n";
+
+    mJava->indent() << "// Create the appropriate sized arrays in args\n";
+    for (auto p : mAllInputsAndOutputs) {
+        if (p->mVectorSize != "1") {
+            string type = p->javaBaseType;
+            if (p->isOutParameter && p->isFloatType) {
+                type = "Target.Floaty";
+            }
+            mJava->indent() << "args." << p->variableName << " = new " << type << "["
+                            << p->mVectorSize << "];\n";
+        }
+    }
+
+    mJava->indent() << "// Fill args with the input values\n";
+    for (auto p : mAllInputsAndOutputs) {
+        if (!p->isOutParameter) {
+            if (p->mVectorSize == "1") {
+                mJava->indent() << "args." << p->variableName << " = " << p->javaArrayName + "[i]"
+                                << ";\n";
+            } else {
+                mJava->indent() << "for (int j = 0; j < " << p->mVectorSize << " ; j++)";
+                mJava->startBlock();
+                mJava->indent() << "args." << p->variableName + "[j] = "
+                                << p->javaArrayName + "[i * " + p->vectorWidth + " + j]"
+                                << ";\n";
+                mJava->endBlock();
+            }
+        }
+    }
+    mJava->indent() << "Target target = new Target(relaxed);\n";
+    mJava->indent() << "CoreMathVerifier." << mJavaVerifierComputeMethodName
+                    << "(args, target);\n\n";
+
+    mJava->indent() << "// Compare the expected outputs to the actual values returned by RS.\n";
+    mJava->indent() << "boolean valid = true;\n";
+    for (auto p : mAllInputsAndOutputs) {
+        if (p->isOutParameter) {
+            writeJavaVectorComparison(*p);
+        }
+    }
+
+    mJava->indent() << "if (!valid)";
+    mJava->startBlock();
+
+    mJava->indent() << "StringBuilder message = new StringBuilder();\n";
+    for (auto p : mAllInputsAndOutputs) {
+        if (p->isOutParameter) {
+            writeJavaAppendVectorOutputToMessage(*p);
+        } else {
+            writeJavaAppendVectorInputToMessage(*p);
+        }
+    }
+
+    mJava->indent() << "assertTrue(\"Incorrect output for " << mJavaCheckMethodName << "\" +\n";
+    mJava->indentPlus()
+                << "(relaxed ? \"_relaxed\" : \"\") + \":\\n\" + message.toString(), valid);\n";
+
+    mJava->endBlock();
+    mJava->endBlock();
+    mJava->endBlock();
+    *mJava << "\n";
+}
+
+void PermutationWriter::writeJavaVerifyMethodHeader() const {
+    mJava->indent() << "private void " << mJavaVerifyMethodName << "(";
+    for (auto p : mAllInputsAndOutputs) {
+        *mJava << "Allocation " << p->javaAllocName << ", ";
+    }
+    *mJava << "boolean relaxed)";
+}
+
+void PermutationWriter::writeJavaArrayInitialization(const ParameterDefinition& p) const {
+    mJava->indent() << p.javaBaseType << "[] " << p.javaArrayName << " = new " << p.javaBaseType
+                    << "[INPUTSIZE * " << p.vectorWidth << "];\n";
+    mJava->indent() << p.javaAllocName << ".copyTo(" << p.javaArrayName << ");\n";
+}
+
+void PermutationWriter::writeJavaTestAndSetValid(const ParameterDefinition& p,
+                                                 const string& argsIndex,
+                                                 const string& actualIndex) const {
+    writeJavaTestOneValue(p, argsIndex, actualIndex);
+    mJava->startBlock();
+    mJava->indent() << "valid = false;\n";
+    mJava->endBlock();
+}
+
+void PermutationWriter::writeJavaTestOneValue(const ParameterDefinition& p, const string& argsIndex,
+                                              const string& actualIndex) const {
+    mJava->indent() << "if (";
+    if (p.isFloatType) {
+        *mJava << "!args." << p.variableName << argsIndex << ".couldBe(" << p.javaArrayName
+               << actualIndex;
+        const string s = mPermutation.getPrecisionLimit();
+        if (!s.empty()) {
+            *mJava << ", " << s;
+        }
+        *mJava << ")";
+    } else {
+        *mJava << "args." << p.variableName << argsIndex << " != " << p.javaArrayName
+               << actualIndex;
+    }
+
+    if (p.undefinedIfOutIsNan && mReturnParam) {
+        *mJava << " && !args." << mReturnParam->variableName << argsIndex << ".isNaN()";
+    }
+    *mJava << ")";
+}
+
+void PermutationWriter::writeJavaVectorComparison(const ParameterDefinition& p) const {
+    if (p.mVectorSize == "1") {
+        writeJavaTestAndSetValid(p, "", "[i]");
+    } else {
+        mJava->indent() << "for (int j = 0; j < " << p.mVectorSize << " ; j++)";
+        mJava->startBlock();
+        writeJavaTestAndSetValid(p, "[j]", "[i * " + p.vectorWidth + " + j]");
+        mJava->endBlock();
+    }
+}
+
+void PermutationWriter::writeJavaAppendOutputToMessage(const ParameterDefinition& p,
+                                                       const string& argsIndex,
+                                                       const string& actualIndex,
+                                                       bool verifierValidates) const {
+    if (verifierValidates) {
+        const string actual = "args." + p.variableName + argsIndex;
+        mJava->indent() << "message.append(\"Output " + p.variableName + ": \");\n";
+        if (p.isFloatType) {
+            writeJavaAppendFloatVariableToMessage(actual, true);
+        } else {
+            writeJavaAppendVariableToMessage(p, actual);
+        }
+        writeJavaAppendNewLineToMessage();
+    } else {
+        const string expected = "args." + p.variableName + argsIndex;
+        const string actual = p.javaArrayName + actualIndex;
+        mJava->indent() << "message.append(\"Expected output " + p.variableName + ": \");\n";
+        if (p.isFloatType) {
+            writeJavaAppendFloatVariableToMessage(expected, false);
+        } else {
+            writeJavaAppendVariableToMessage(p, expected);
+        }
+        writeJavaAppendNewLineToMessage();
+        mJava->indent() << "message.append(\"Actual   output " + p.variableName + ": \");\n";
+        writeJavaAppendVariableToMessage(p, actual);
+
+        writeJavaTestOneValue(p, argsIndex, actualIndex);
+        mJava->startBlock();
+        mJava->indent() << "message.append(\" FAIL\");\n";
+        mJava->endBlock();
+        writeJavaAppendNewLineToMessage();
+    }
+}
+
+void PermutationWriter::writeJavaAppendInputToMessage(const ParameterDefinition& p,
+                                                      const string& actual) const {
+    mJava->indent() << "message.append(\"Input " + p.variableName + ": \");\n";
+    writeJavaAppendVariableToMessage(p, actual);
+    writeJavaAppendNewLineToMessage();
+}
+
+void PermutationWriter::writeJavaAppendNewLineToMessage() const {
+    mJava->indent() << "message.append(\"\\n\");\n";
+}
+
+void PermutationWriter::writeJavaAppendVariableToMessage(const ParameterDefinition& p,
+                                                         const string& value) const {
+    if (p.specType == "f16" || p.specType == "f32") {
+        mJava->indent() << "message.append(String.format(\"%14.8g {%8x} %15a\",\n";
+        mJava->indentPlus() << value << ", "
+                            << "Float.floatToRawIntBits(" << value << "), " << value << "));\n";
+    } else if (p.specType == "f64") {
+        mJava->indent() << "message.append(String.format(\"%24.8g {%16x} %31a\",\n";
+        mJava->indentPlus() << value << ", "
+                            << "Double.doubleToRawLongBits(" << value << "), " << value << "));\n";
+    } else if (p.specType[0] == 'u') {
+        mJava->indent() << "message.append(String.format(\"0x%x\", " << value << "));\n";
+    } else {
+        mJava->indent() << "message.append(String.format(\"%d\", " << value << "));\n";
+    }
+}
+
+void PermutationWriter::writeJavaAppendFloatVariableToMessage(const string& value,
+                                                              bool regularFloat) const {
+    mJava->indent() << "message.append(";
+    if (regularFloat) {
+        *mJava << "Float.toString(" << value << ")";
+    } else {
+        *mJava << value << ".toString()";
+    }
+    *mJava << ");\n";
+}
+
+void PermutationWriter::writeJavaAppendVectorInputToMessage(const ParameterDefinition& p) const {
+    if (p.mVectorSize == "1") {
+        writeJavaAppendInputToMessage(p, p.javaArrayName + "[i]");
+    } else {
+        mJava->indent() << "for (int j = 0; j < " << p.mVectorSize << " ; j++)";
+        mJava->startBlock();
+        writeJavaAppendInputToMessage(p, p.javaArrayName + "[i * " + p.vectorWidth + " + j]");
+        mJava->endBlock();
+    }
+}
+
+void PermutationWriter::writeJavaAppendVectorOutputToMessage(const ParameterDefinition& p) const {
+    if (p.mVectorSize == "1") {
+        writeJavaAppendOutputToMessage(p, "", "[i]", false);
+    } else {
+        mJava->indent() << "for (int j = 0; j < " << p.mVectorSize << " ; j++)";
+        mJava->startBlock();
+        writeJavaAppendOutputToMessage(p, "[j]", "[i * " + p.vectorWidth + " + j]", false);
+        mJava->endBlock();
+    }
+}
+
+void PermutationWriter::writeJavaCallToRs(bool relaxed, bool generateCallToVerifier) const {
+    string script = "script";
+    if (relaxed) {
+        script += "Relaxed";
+    }
+
+    mJava->indent() << "try";
+    mJava->startBlock();
+
+    for (auto p : mAllInputsAndOutputs) {
+        if (p->isOutParameter) {
+            writeJavaOutputAllocationDefinition(*p);
+        }
+    }
+
+    for (auto p : mPermutation.getParams()) {
+        if (p != mFirstInputParam) {
+            mJava->indent() << script << ".set_" << p->rsAllocName << "(" << p->javaAllocName
+                            << ");\n";
+        }
+    }
+
+    mJava->indent() << script << ".forEach_" << mRsKernelName << "(";
+    bool needComma = false;
+    if (mFirstInputParam) {
+        *mJava << mFirstInputParam->javaAllocName;
+        needComma = true;
+    }
+    if (mReturnParam) {
+        if (needComma) {
+            *mJava << ", ";
+        }
+        *mJava << mReturnParam->variableName << ");\n";
+    }
+
+    if (generateCallToVerifier) {
+        mJava->indent() << mJavaVerifyMethodName << "(";
+        for (auto p : mAllInputsAndOutputs) {
+            *mJava << p->variableName << ", ";
+        }
+
+        if (relaxed) {
+            *mJava << "true";
+        } else {
+            *mJava << "false";
+        }
+        *mJava << ");\n";
+    }
+    mJava->decreaseIndent();
+    mJava->indent() << "} catch (Exception e) {\n";
+    mJava->increaseIndent();
+    mJava->indent() << "throw new RSRuntimeException(\"RenderScript. Can't invoke forEach_"
+                    << mRsKernelName << ": \" + e.toString());\n";
+    mJava->endBlock();
+}
+
+/* Write the section of the .rs file for this permutation.
+ *
+ * We communicate the extra input and output parameters via global allocations.
+ * For example, if we have a function that takes three arguments, two for input
+ * and one for output:
+ *
+ * start:
+ * name: gamn
+ * ret: float3
+ * arg: float3 a
+ * arg: int b
+ * arg: float3 *c
+ * end:
+ *
+ * We'll produce:
+ *
+ * rs_allocation gAllocInB;
+ * rs_allocation gAllocOutC;
+ *
+ * float3 __attribute__((kernel)) test_gamn_float3_int_float3(float3 inA, unsigned int x) {
+ *    int inB;
+ *    float3 outC;
+ *    float2 out;
+ *    inB = rsGetElementAt_int(gAllocInB, x);
+ *    out = gamn(a, in_b, &outC);
+ *    rsSetElementAt_float4(gAllocOutC, &outC, x);
+ *    return out;
+ * }
+ *
+ * We avoid re-using x and y from the definition because these have reserved
+ * meanings in a .rs file.
+ */
+void PermutationWriter::writeRsSection(set<string>* rsAllocationsGenerated) const {
+    // Write the allocation declarations we'll need.
+    for (auto p : mPermutation.getParams()) {
+        // Don't need allocation for one input and one return value.
+        if (p != mFirstInputParam) {
+            writeRsAllocationDefinition(*p, rsAllocationsGenerated);
+        }
+    }
+    *mRs << "\n";
+
+    // Write the function header.
+    if (mReturnParam) {
+        *mRs << mReturnParam->rsType;
+    } else {
+        *mRs << "void";
+    }
+    *mRs << " __attribute__((kernel)) " << mRsKernelName;
+    *mRs << "(";
+    bool needComma = false;
+    if (mFirstInputParam) {
+        *mRs << mFirstInputParam->rsType << " " << mFirstInputParam->variableName;
+        needComma = true;
+    }
+    if (mPermutation.getOutputCount() > 1 || mPermutation.getInputCount() > 1) {
+        if (needComma) {
+            *mRs << ", ";
+        }
+        *mRs << "unsigned int x";
+    }
+    *mRs << ")";
+    mRs->startBlock();
+
+    // Write the local variable declarations and initializations.
+    for (auto p : mPermutation.getParams()) {
+        if (p == mFirstInputParam) {
+            continue;
+        }
+        mRs->indent() << p->rsType << " " << p->variableName;
+        if (p->isOutParameter) {
+            *mRs << " = 0;\n";
+        } else {
+            *mRs << " = rsGetElementAt_" << p->rsType << "(" << p->rsAllocName << ", x);\n";
+        }
+    }
+
+    // Write the function call.
+    if (mReturnParam) {
+        if (mPermutation.getOutputCount() > 1) {
+            mRs->indent() << mReturnParam->rsType << " " << mReturnParam->variableName << " = ";
+        } else {
+            mRs->indent() << "return ";
+        }
+    }
+    *mRs << mPermutation.getName() << "(";
+    needComma = false;
+    for (auto p : mPermutation.getParams()) {
+        if (needComma) {
+            *mRs << ", ";
+        }
+        if (p->isOutParameter) {
+            *mRs << "&";
+        }
+        *mRs << p->variableName;
+        needComma = true;
+    }
+    *mRs << ");\n";
+
+    if (mPermutation.getOutputCount() > 1) {
+        // Write setting the extra out parameters into the allocations.
+        for (auto p : mPermutation.getParams()) {
+            if (p->isOutParameter) {
+                mRs->indent() << "rsSetElementAt_" << p->rsType << "(" << p->rsAllocName << ", ";
+                // Check if we need to use '&' for this type of argument.
+                char lastChar = p->variableName.back();
+                if (lastChar >= '0' && lastChar <= '9') {
+                    *mRs << "&";
+                }
+                *mRs << p->variableName << ", x);\n";
+            }
+        }
+        if (mReturnParam) {
+            mRs->indent() << "return " << mReturnParam->variableName << ";\n";
+        }
+    }
+    mRs->endBlock();
+}
+
+void PermutationWriter::writeRsAllocationDefinition(const ParameterDefinition& param,
+                                                    set<string>* rsAllocationsGenerated) const {
+    if (!testAndSet(param.rsAllocName, rsAllocationsGenerated)) {
+        *mRs << "rs_allocation " << param.rsAllocName << ";\n";
+    }
+}
+
+// Open the mJavaFile and writes the header.
+static bool startJavaFile(GeneratedFile* file, const Function& function, const string& testName,
+                          const string& relaxedTestName) {
+    const string fileName = testName + ".java";
+    if (!file->start(fileName)) {
+        return false;
+    }
+    file->writeNotices();
+
+    *file << "package android.renderscript.cts;\n\n";
+
+    *file << "import android.renderscript.Allocation;\n";
+    *file << "import android.renderscript.RSRuntimeException;\n";
+    *file << "import android.renderscript.Element;\n\n";
+
+    *file << "public class " << testName << " extends RSBaseCompute";
+    file->startBlock();  // The corresponding endBlock() is in finishJavaFile()
+    *file << "\n";
+
+    file->indent() << "private ScriptC_" << testName << " script;\n";
+    file->indent() << "private ScriptC_" << relaxedTestName << " scriptRelaxed;\n\n";
+
+    file->indent() << "@Override\n";
+    file->indent() << "protected void setUp() throws Exception";
+    file->startBlock();
+
+    file->indent() << "super.setUp();\n";
+    file->indent() << "script = new ScriptC_" << testName << "(mRS);\n";
+    file->indent() << "scriptRelaxed = new ScriptC_" << relaxedTestName << "(mRS);\n";
+
+    file->endBlock();
+    *file << "\n";
+    return true;
+}
+
+// Write the test method that calls all the generated Check methods.
+static void finishJavaFile(GeneratedFile* file, const Function& function,
+                           const vector<string>& javaCheckMethods) {
+    file->indent() << "public void test" << function.getCapitalizedName() << "()";
+    file->startBlock();
+    for (auto m : javaCheckMethods) {
+        file->indent() << m << "();\n";
+    }
+    file->endBlock();
+
+    file->endBlock();
+}
+
+// Open the script file and write its header.
+static bool startRsFile(GeneratedFile* file, const Function& function, const string& testName) {
+    string fileName = testName + ".rs";
+    if (!file->start(fileName)) {
+        return false;
+    }
+    file->writeNotices();
+
+    *file << "#pragma version(1)\n";
+    *file << "#pragma rs java_package_name(android.renderscript.cts)\n\n";
+    return true;
+}
+
+// Write the entire *Relaxed.rs test file, as it only depends on the name.
+static bool writeRelaxedRsFile(const Function& function, const string& testName,
+                               const string& relaxedTestName) {
+    string name = relaxedTestName + ".rs";
+
+    GeneratedFile file;
+    if (!file.start(name)) {
+        return false;
+    }
+    file.writeNotices();
+
+    file << "#include \"" << testName << ".rs\"\n";
+    file << "#pragma rs_fp_relaxed\n";
+    file.close();
+    return true;
+}
+
+/* Write the .java and the two .rs test files.  versionOfTestFiles is used to restrict which API
+ * to test.
+ */
+static bool writeTestFilesForFunction(const Function& function, int versionOfTestFiles) {
+    // Avoid creating empty files if we're not testing this function.
+    if (!needTestFiles(function, versionOfTestFiles)) {
+        return true;
+    }
+
+    const string testName = "GeneratedTest" + function.getCapitalizedName();
+    const string relaxedTestName = testName + "Relaxed";
+
+    if (!writeRelaxedRsFile(function, testName, relaxedTestName)) {
+        return false;
+    }
+
+    GeneratedFile rsFile;    // The Renderscript test file we're generating.
+    GeneratedFile javaFile;  // The Jave test file we're generating.
+    if (!startRsFile(&rsFile, function, testName)) {
+        return false;
+    }
+
+    if (!startJavaFile(&javaFile, function, testName, relaxedTestName)) {
+        return false;
+    }
+
+    /* We keep track of the allocations generated in the .rs file and the argument classes defined
+     * in the Java file, as we share these between the functions created for each specification.
+     */
+    set<string> rsAllocationsGenerated;
+    set<string> javaGeneratedArgumentClasses;
+    // Lines of Java code to invoke the check methods.
+    vector<string> javaCheckMethods;
+
+    for (auto spec : function.getSpecifications()) {
+        if (spec->hasTests(versionOfTestFiles)) {
+            for (auto permutation : spec->getPermutations()) {
+                PermutationWriter w(*permutation, &rsFile, &javaFile);
+                w.writeRsSection(&rsAllocationsGenerated);
+                w.writeJavaSection(&javaGeneratedArgumentClasses);
+
+                // Store the check method to be called.
+                javaCheckMethods.push_back(w.getJavaCheckMethodName());
+            }
+        }
+    }
+
+    finishJavaFile(&javaFile, function, javaCheckMethods);
+    // There's no work to wrap-up in the .rs file.
+
+    rsFile.close();
+    javaFile.close();
+    return true;
+}
+
+bool GenerateTestFiles(int versionOfTestFiles) {
+    bool success = true;
+    for (auto specFile : systemSpecification.getSpecFiles()) {
+        for (auto f : specFile->getFunctionsMap()) {
+            if (!writeTestFilesForFunction(*f.second, versionOfTestFiles)) {
+                success = false;
+            }
+        }
+    }
+    return success;
+}
diff --git a/api/Generator.cpp b/api/Generator.cpp
new file mode 100644
index 0000000..376364c
--- /dev/null
+++ b/api/Generator.cpp
@@ -0,0 +1,202 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* This program processes Renderscript function definitions described in spec files.
+ * For each spec file provided on the command line, it generates a corresponding
+ * Renderscript header (*.rsh) which is meant for inclusion in client scripts.
+ *
+ * This program also generates Junit test files to automatically test each of the
+ * functions using randomly generated data.  We create two files for each function:
+ * - a Renderscript file named Test{Function}.rs,
+ * - a Junit file named Test{function}.java, which calls the above RS file.
+ *
+ * Finally, this program generates HTML documentation files.
+ *
+ * This program takes an optional -v parameter, the RS version to target the
+ * test files for.  The header file will always contain all the functions.
+ *
+ * This program contains five main classes:
+ * - SpecFile: Represents on spec file.
+ * - Function: Each instance represents a function, like clamp.  Even though the
+ *      spec file contains many entries for clamp, we'll only have one clamp instance.
+ * - FunctionSpecification: Defines one of the many variations of the function.  There's
+ *      a one to one correspondance between FunctionSpecification objects and entries in the
+ *      spec file.  Strings that are parts of a FunctionSpecification can include placeholders,
+ *      which are "#1", "#2", "#3", and "#4".  We'll replace these by values before
+ *      generating the files.
+ * - Permutation: A concrete version of a specification, where all placeholders have
+ *      been replaced by actual values.
+ * - ParameterDefinition: A definition of a parameter of a concrete function.
+ *
+ * The format of the .spec files is described below.  Line that starts with # are comments.
+ * Replace the {} sections with your own contents.  [] indicates optional parts.
+ *
+ * It should start with a header as follows:
+ *
+ * header:
+ * summary:  {A one line string describing this section.}
+ * description:
+ *     {Multiline description.  Can include HTML.  References to constants, types,
+ *      and functions can be created by prefixing with a '@'.}
+ * [include:
+ *     { Multiline code lines to be included as-is in the generated header file.}]
+ * end:
+ *
+ * Constants are defined as follows:
+ *
+ * constant:  {The name of the constant.}
+ * [version: {Starting API level} [ {Last API level that supports this.}]
+ * [size: {32 or 64.  Used if this is available only for 32 or 64 bit code.}]
+ * value: {The value of the constant.}
+ * [hidden:]   ...If present, don't document the constant.  Omit the following two fields.
+ * summary: {A one line string describing this section.}
+ * description:
+ *     {Multiline description.  Can include HTML.  References to constants, types,
+ *      and functions can be created by prefixing with a '@'.}
+ * end:
+ *
+ * Types can either be simple types, structs, or enums.  They have the format:
+ *
+ * type:  {The typedef name of the type.}
+ * [version: {Starting API level} [ {Last API level that supports this.}]
+ * [size: {32 or 64.  Used if this is available only for 32 or 64 bit code.}]
+ * simple: {The C declaration that this type is the typedef equivalent.}
+ * [hidden:]   ...If present, don't document the type.  Omit the following two fields.
+ * summary: {A one line string describing this section.}
+ * description:
+ *     {Multiline description.  Can include HTML.  References to constants, types,
+ *      and functions can be created by prefixing with a '@'.}
+ * end:
+ *
+ * type:  {The typedef name of the type.}
+ * [version: {Starting API level} [ {Last API level that supports this.}]
+ * [size: {32 or 64.  Used if this is available only for 32 or 64 bit code.}]
+ * struct: [{The name that will appear right after the struct keyword}]
+ * field: {Type and name of the field}[, "{One line documentation of the field}"]
+ * field:   ... Same for all the other fields of the struct.
+ * [attrib: {Attributes of the struct.}]
+ * [hidden:]   ...If present, don't document the type.  Omit the following two fields.
+ * summary: {A one line string describing this section.}
+ * description:
+ *     {Multiline description.  Can include HTML.  References to constants, types,
+ *      and functions can be created by prefixing with a '@'.}
+ * end:
+ *
+ * type:  {The typedef name of the type.}
+ * [version: {Starting API level} [ {Last API level that supports this.}]
+ * [size: {32 or 64.  Used if this is available only for 32 or 64 bit code.}]
+ * enum: [{The name that will appear right after the enum keyword}]
+ * value: {Type and name of the field}[, "{One line documentation of the field}"]
+ * value:   ... Same for all the other values of the enum.
+ * [hidden:]   ...If present, don't document the type.  Omit the following two fields.
+ * summary: {A one line string describing this section.}
+ * description:
+ *     {Multiline description.  Can include HTML.  References to constants, types,
+ *      and functions can be created by prefixing with a '@'.}
+ * end:
+
+ * Functions have the following format:
+ *
+ * function:  {The name of the function.}
+ * [version: {Starting API level} [ {Last API level that supports this.}]
+ * [size: {32 or 64.  Used if this is available only for 32 or 64 bit code.}]
+ * [attrib: {Attributes of the function.}]
+ * [w: {A comma separated list of width supported.  Only 1, 2, 3, 4 are supported.
+ * [t: {A comma separated list of the types supported.}]]
+ * ... Up to four w: or t: can be defined.  The order matter.  These will be replace
+ * ... the #1, #2, #3, #4 that can be found in the rest of the specification.
+ * ret: [{The return type} [, "{One line documentation of the return}"]]
+ * [arg: {Type}[, {Name}][, {ParameterEntry.testOption}][, "{One line documentation of the field}"]]
+ * [arg:   ... Same for all the other arguments of the function.]
+ * [hidden:]   ... If present, don't include in the HTML documentation.
+ * summary: {A one line string describing this section.}
+ * description:
+ *     {Multiline description.  Can include HTML.  References to constants, types,
+ *      and functions can be created by prefixing with a '@'.}
+ * [inline:
+ *     {Multiline code that implements this function inline.}]
+ * [test: {How to test this function.  See FunctionSpecification::mTest.}]
+ * end:
+ */
+
+#include <stdio.h>
+#include <cctype>
+#include <cstdlib>
+#include <fstream>
+#include <functional>
+#include <iostream>
+#include <memory>
+#include <sstream>
+#include <strings.h>
+
+#include "Generator.h"
+#include "Scanner.h"
+#include "Specification.h"
+#include "Utilities.h"
+
+using namespace std;
+
+static bool parseCommandLine(int argc, char* argv[], int* versionOfTestFiles,
+                             vector<string>* specFileNames) {
+    for (int i = 1; i < argc; i++) {
+        if (argv[i][0] == '-') {
+            if (argv[i][1] == 'v') {
+                i++;
+                if (i < argc) {
+                    char* end;
+                    *versionOfTestFiles = strtol(argv[i], &end, 10);
+                    if (*end != '\0') {
+                        cerr << "Error. Can't parse the version number" << argv[i] << "\n";
+                        return false;
+                    }
+                } else {
+                    cerr << "Missing version number after -v\n";
+                    return false;
+                }
+            } else {
+                cerr << "Unrecognized flag %s\n" << argv[i] << "\n";
+                return false;
+            }
+        } else {
+            specFileNames->push_back(argv[i]);
+        }
+    }
+    if (specFileNames->size() == 0) {
+        cerr << "No spec file specified\n";
+        return false;
+    }
+    return true;
+}
+
+int main(int argc, char* argv[]) {
+    // If there's no restriction, generated test files for the very highest version.
+    int versionOfTestFiles = 999999;
+    vector<string> specFileNames;
+    if (!parseCommandLine(argc, argv, &versionOfTestFiles, &specFileNames)) {
+        cout << "Usage: gen_runtime spec_file [spec_file...] [-v version_of_test_files]\n";
+        return -1;
+    }
+    bool success = true;
+    for (auto i : specFileNames) {
+        if (!systemSpecification.readSpecFile(i)) {
+            success = false;
+        }
+    }
+    if (success) {
+        success = systemSpecification.generateFiles(versionOfTestFiles);
+    }
+    return success ? 0 : -2;
+}
diff --git a/api/Generator.h b/api/Generator.h
new file mode 100644
index 0000000..21ce5f9
--- /dev/null
+++ b/api/Generator.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_RS_API_GENERATOR_GENERATOR_H
+#define ANDROID_RS_API_GENERATOR_GENERATOR_H
+
+// Generates the RenderScript header files.  The implementation is in GenerateHeaderFiles.cpp.
+bool GenerateHeaderFiles();
+
+// Generates the Java and RenderScript test files.  The implementation is in GenerateTestFiles.cpp.
+bool GenerateTestFiles(int versionOfTestFiles);
+
+// Generates all HTML documentation files.  The implementation is in GenerateHtmlDocumentation.cpp.
+bool generateHtmlDocumentation();
+
+#endif  // ANDROID_RS_API_GENERATOR_GENERATOR_H
diff --git a/api/Scanner.cpp b/api/Scanner.cpp
new file mode 100644
index 0000000..660dd24
--- /dev/null
+++ b/api/Scanner.cpp
@@ -0,0 +1,188 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <iostream>
+#include <sstream>
+
+#include "Scanner.h"
+#include "Specification.h"
+#include "Utilities.h"
+
+using namespace std;
+
+// Maximum of errors we'll report before bailing out.
+const int MAX_ERRORS = 10;
+
+Scanner::Scanner(const string& fileName, FILE* file)
+    : mFileName(fileName), mFile(file), mLineNumber(0), mTagConsumed(true), mErrorCount(0) {
+}
+
+bool Scanner::atEnd() {
+    return (mTagConsumed && feof(mFile)) || mErrorCount > MAX_ERRORS;
+}
+
+int Scanner::getChar() {
+    int c = fgetc(mFile);
+    if (c == '\n') {
+        mLineNumber++;
+    }
+    return c;
+}
+
+void Scanner::readUpTo(char delimiter, string* segment) {
+    for (;;) {
+        int c = getChar();
+        if (c == EOF || c == '\n') {
+            break;
+        }
+        segment->push_back((char)c);
+        if (c == delimiter) {
+            break;
+        }
+    }
+}
+
+void Scanner::readRestOfLine(string* segment) {
+    for (;;) {
+        int c = getChar();
+        if (c == EOF || c == '\n') {
+            return;
+        }
+        segment->push_back((char)c);
+    }
+}
+
+bool Scanner::getNextEntry() {
+    mTag.clear();
+    mValue.clear();
+    for (;;) {
+        int c = getChar();
+        if (c == EOF) {
+            return false;
+        }
+        if (c == '#') {
+            // Skip the comment
+            string comment;
+            readRestOfLine(&comment);
+            continue;
+        }
+        if (c == ' ') {
+            readRestOfLine(&mValue);
+            break;
+        } else if (c == '\n') {
+            break;
+        } else {
+            mTag = c;
+            readUpTo(':', &mTag);
+            readRestOfLine(&mValue);
+            trimSpaces(&mValue);
+            break;
+        }
+    }
+    return true;
+}
+
+ostream& Scanner::error() {
+    return error(mLineNumber);
+}
+
+ostream& Scanner::error(int lineNumber) {
+    if (++mErrorCount <= MAX_ERRORS) {
+        cerr << mFileName << ":" << lineNumber << ": error: ";
+    }
+    return cerr;
+}
+
+void Scanner::skipBlankEntries() {
+    while (findOptionalTag("")) {
+        if (!mValue.empty()) {
+            error() << "Unexpected: \" " << mValue << "\".\n";
+        }
+    }
+}
+
+bool Scanner::findTag(const char* tag) {
+    bool found = findOptionalTag(tag);
+    if (!found) {
+        error() << "Found \"" << mTag << "\" while looking for \"" << tag << "\".\n";
+    }
+    mTagConsumed = true;
+    return found;
+}
+
+bool Scanner::findOptionalTag(const char* tag) {
+    if (mTagConsumed) {
+        if (!getNextEntry()) {
+            return false;
+        }
+    }
+    mTagConsumed = (mTag == tag);
+    return mTagConsumed;
+}
+
+void Scanner::checkNoValue() {
+    if (!mValue.empty()) {
+        error() << "Did not expect \"" << mValue << "\" after \"" << mTag << "\".\n";
+    }
+}
+
+void Scanner::parseDocumentation(string* s, string* documentation) {
+    size_t docStart = s->find(", \"");
+    if (docStart == string::npos) {
+        documentation->erase();
+    } else {
+        size_t first = docStart + 3;
+        size_t last = s->find('\"', first);
+        if (last == string::npos) {
+            error() << "Missing closing double quote\n";
+        }
+        *documentation = s->substr(first, last - first);
+        s->erase(docStart);
+    }
+}
+
+ParameterEntry* Scanner::parseArgString(bool isReturn) {
+    string s = mValue;
+    ParameterEntry* p = new ParameterEntry();
+    parseDocumentation(&s, &p->documentation);
+
+    size_t optionStart = s.find(", ");
+    if (optionStart != string::npos) {
+        p->testOption = s.substr(optionStart + 2);
+        s.erase(optionStart);
+    }
+
+    trimSpaces(&s);
+    if (!isReturn) {
+        size_t nameStart = s.rfind(' ');
+        if (nameStart == string::npos) {
+            error() << "Missing variable name\n";
+        } else {
+            p->name = s.substr(nameStart + 1);
+            s.erase(nameStart);
+            if (p->name.find('*') != string::npos) {
+                error() << "The '*' should be attached to the type\n";
+            }
+        }
+    }
+
+    if (s == "void" && !isReturn) {
+        error() << "void is only allowed for ret:\n";
+    }
+    p->type = s;
+    p->lineNumber = mLineNumber;
+    return p;
+}
diff --git a/api/Scanner.h b/api/Scanner.h
new file mode 100644
index 0000000..593ff49
--- /dev/null
+++ b/api/Scanner.h
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_RS_API_GENERATOR_SCANNER_H
+#define ANDROID_RS_API_GENERATOR_SCANNER_H
+
+#include <fstream>
+#include <string>
+
+class ParameterEntry;
+
+class Scanner {
+private:
+    std::string mFileName;
+    // The file being parsed
+    FILE* mFile;
+    // The line number of the current entry.
+    int mLineNumber;
+    // The tag of the current entry to be processed.  See FindTag().
+    std::string mTag;
+    // The value of this entry.  See FindTag().
+    std::string mValue;
+    // Was the current tag processed?
+    bool mTagConsumed;
+    // Number of errors encountered.
+    int mErrorCount;
+
+    /* Returns the next character from the file, incrementing the line count
+     * if \n is found.
+     */
+    int getChar();
+    /* Reads from the file, adding the characters to "segment" until
+     * the delimiter is found, a new line, or the eof.  The delimiter is added.
+     */
+    void readUpTo(char delimiter, std::string* segment);
+    /* Reads from the file, adding the characters to "segment" until
+     * the end of the line.
+     */
+    void readRestOfLine(std::string* segment);
+
+    /* Finds the next line that's not a comment (a line that starts with #).
+     * This line is parsed into a tag and a value.
+     * A line that starts with a space (or is empty) is considered to have
+     * a null tag and all but the first character are the value.
+     * Lines that start with a non-space charcter should have a ": " to
+     * separate the tag from the value.
+     * Returns false if no more entries.
+     */
+    bool getNextEntry();
+
+public:
+    Scanner(const std::string& fileName, FILE* file);
+    bool atEnd();
+    std::string getValue() { return mValue; }
+    std::string getNextTag() {
+        mTagConsumed = true;
+        return mTag;
+    }
+
+    // Skips over blank entries, reporting errors that start with a space.
+    void skipBlankEntries();
+    /* Finds the next unprocessed tag.  This entry should start with the specified tag.
+     * Returns false if the tag is not found and prints an error.
+     */
+    bool findTag(const char* tag);
+    // Same as findTag but does not print an error if the tag is not found.
+    bool findOptionalTag(const char* tag);
+    // Verifies there's no value.
+    void checkNoValue();
+
+    std::ostream& error();
+    std::ostream& error(int lineNumber);
+
+    /* Removes an optional double quoted "documentation" found at the end of a line.
+     * Erases that documention from the input string.
+     */
+    void parseDocumentation(std::string* s, std::string* documentation);
+    /* Parse an arg: definition.  It's of the form:
+     *    type[*] name [, test_option] [, "documentation"]
+     * The type and name are required.  The * indicates it's an output parameter.
+     * The test_option specifiies restrictions on values used when generating the test cases.
+     * It's one of range(), compatible(), conditional(), above().
+     * The documentation is enclosed in double quotes.
+     */
+    ParameterEntry* parseArgString(bool isReturn);
+    bool getErrorCount() const { return mErrorCount; }
+};
+
+#endif  // ANDROID_RS_API_GENERATOR_SCANNER_H
diff --git a/api/Specification.cpp b/api/Specification.cpp
new file mode 100644
index 0000000..36f406c
--- /dev/null
+++ b/api/Specification.cpp
@@ -0,0 +1,809 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <cctype>
+#include <cstdlib>
+#include <fstream>
+#include <functional>
+#include <iostream>
+#include <memory>
+#include <sstream>
+#include <strings.h>
+
+#include "Generator.h"
+#include "Scanner.h"
+#include "Specification.h"
+#include "Utilities.h"
+
+using namespace std;
+
+// API level when RenderScript was added.
+const int MIN_API_LEVEL = 9;
+
+const NumericalType TYPES[] = {
+            {"f16", "FLOAT_16", "half", "half", FLOATING_POINT, 11, 5},
+            {"f32", "FLOAT_32", "float", "float", FLOATING_POINT, 24, 8},
+            {"f64", "FLOAT_64", "double", "double", FLOATING_POINT, 53, 11},
+            {"i8", "SIGNED_8", "char", "byte", SIGNED_INTEGER, 7, 0},
+            {"u8", "UNSIGNED_8", "uchar", "byte", UNSIGNED_INTEGER, 8, 0},
+            {"i16", "SIGNED_16", "short", "short", SIGNED_INTEGER, 15, 0},
+            {"u16", "UNSIGNED_16", "ushort", "short", UNSIGNED_INTEGER, 16, 0},
+            {"i32", "SIGNED_32", "int", "int", SIGNED_INTEGER, 31, 0},
+            {"u32", "UNSIGNED_32", "uint", "int", UNSIGNED_INTEGER, 32, 0},
+            {"i64", "SIGNED_64", "long", "long", SIGNED_INTEGER, 63, 0},
+            {"u64", "UNSIGNED_64", "ulong", "long", UNSIGNED_INTEGER, 64, 0},
+};
+
+const int NUM_TYPES = sizeof(TYPES) / sizeof(TYPES[0]);
+
+const char BASE_URL[] = "http://developer.android.com/reference/android/graphics/drawable/";
+
+// The singleton of the collected information of all the spec files.
+SystemSpecification systemSpecification;
+
+// Returns the index in TYPES for the provided cType
+static int findCType(const string& cType) {
+    for (int i = 0; i < NUM_TYPES; i++) {
+        if (cType == TYPES[i].cType) {
+            return i;
+        }
+    }
+    return -1;
+}
+
+/* Converts a string like "u8, u16" to a vector of "ushort", "uint".
+ * For non-numerical types, we don't need to convert the abbreviation.
+ */
+static vector<string> convertToTypeVector(const string& input) {
+    // First convert the string to an array of strings.
+    vector<string> entries;
+    stringstream stream(input);
+    string entry;
+    while (getline(stream, entry, ',')) {
+        trimSpaces(&entry);
+        entries.push_back(entry);
+    }
+
+    /* Second, we look for present numerical types. We do it this way
+     * so the order of numerical types is always the same, no matter
+     * how specified in the spec file.
+     */
+    vector<string> result;
+    for (auto t : TYPES) {
+        for (auto i = entries.begin(); i != entries.end(); ++i) {
+            if (*i == t.specType) {
+                result.push_back(t.cType);
+                entries.erase(i);
+                break;
+            }
+        }
+    }
+
+    // Add the remaining; they are not numerical types.
+    for (auto s : entries) {
+        result.push_back(s);
+    }
+
+    return result;
+}
+
+void ParameterDefinition::parseParameterDefinition(const string& type, const string& name,
+                                                   const string& testOption, int lineNumber,
+                                                   bool isReturn, Scanner* scanner) {
+    rsType = type;
+    specName = name;
+
+    // Determine if this is an output.
+    isOutParameter = isReturn || charRemoved('*', &rsType);
+
+    // Extract the vector size out of the type.
+    int last = rsType.size() - 1;
+    char lastChar = rsType[last];
+    if (lastChar >= '0' && lastChar <= '9') {
+        rsBaseType = rsType.substr(0, last);
+        mVectorSize = lastChar;
+    } else {
+        rsBaseType = rsType;
+        mVectorSize = "1";
+    }
+    if (mVectorSize == "3") {
+        vectorWidth = "4";
+    } else {
+        vectorWidth = mVectorSize;
+    }
+
+    /* Create variable names to be used in the java and .rs files.  Because x and
+     * y are reserved in .rs files, we prefix variable names with "in" or "out".
+     */
+    if (isOutParameter) {
+        variableName = "out";
+        if (!specName.empty()) {
+            variableName += capitalize(specName);
+        } else if (!isReturn) {
+            scanner->error(lineNumber) << "Should have a name.\n";
+        }
+    } else {
+        variableName = "in";
+        if (specName.empty()) {
+            scanner->error(lineNumber) << "Should have a name.\n";
+        }
+        variableName += capitalize(specName);
+    }
+    rsAllocName = "gAlloc" + capitalize(variableName);
+    javaAllocName = variableName;
+    javaArrayName = "array" + capitalize(javaAllocName);
+
+    // Process the option.
+    undefinedIfOutIsNan = false;
+    compatibleTypeIndex = -1;
+    if (!testOption.empty()) {
+        if (testOption.compare(0, 6, "range(") == 0) {
+            size_t pComma = testOption.find(',');
+            size_t pParen = testOption.find(')');
+            if (pComma == string::npos || pParen == string::npos) {
+                scanner->error(lineNumber) << "Incorrect range " << testOption << "\n";
+            } else {
+                minValue = testOption.substr(6, pComma - 6);
+                maxValue = testOption.substr(pComma + 1, pParen - pComma - 1);
+            }
+        } else if (testOption.compare(0, 6, "above(") == 0) {
+            size_t pParen = testOption.find(')');
+            if (pParen == string::npos) {
+                scanner->error(lineNumber) << "Incorrect testOption " << testOption << "\n";
+            } else {
+                smallerParameter = testOption.substr(6, pParen - 6);
+            }
+        } else if (testOption.compare(0, 11, "compatible(") == 0) {
+            size_t pParen = testOption.find(')');
+            if (pParen == string::npos) {
+                scanner->error(lineNumber) << "Incorrect testOption " << testOption << "\n";
+            } else {
+                compatibleTypeIndex = findCType(testOption.substr(11, pParen - 11));
+            }
+        } else if (testOption.compare(0, 11, "conditional") == 0) {
+            undefinedIfOutIsNan = true;
+        } else {
+            scanner->error(lineNumber) << "Unrecognized testOption " << testOption << "\n";
+        }
+    }
+
+    typeIndex = findCType(rsBaseType);
+    isFloatType = false;
+    if (typeIndex >= 0) {
+        javaBaseType = TYPES[typeIndex].javaType;
+        specType = TYPES[typeIndex].specType;
+        isFloatType = TYPES[typeIndex].exponentBits > 0;
+    }
+    if (!minValue.empty()) {
+        if (typeIndex < 0 || TYPES[typeIndex].kind != FLOATING_POINT) {
+            scanner->error(lineNumber) << "range(,) is only supported for floating point\n";
+        }
+    }
+}
+
+void VersionInfo::scan(Scanner* scanner) {
+    if (scanner->findOptionalTag("version:")) {
+        const string s = scanner->getValue();
+        sscanf(s.c_str(), "%i %i", &minVersion, &maxVersion);
+        if (minVersion && minVersion < MIN_API_LEVEL) {
+            scanner->error() << "Minimum version must >= 9\n";
+        }
+        if (minVersion == MIN_API_LEVEL) {
+            minVersion = 0;
+        }
+        if (maxVersion && maxVersion < MIN_API_LEVEL) {
+            scanner->error() << "Maximum version must >= 9\n";
+        }
+    }
+    if (scanner->findOptionalTag("size:")) {
+        sscanf(scanner->getValue().c_str(), "%i", &intSize);
+    }
+}
+
+Definition::Definition(const std::string& name, SpecFile* specFile) : mName(name), mHidden(false) {
+    mSpecFileName = specFile->getSpecFileName();
+    mUrl = specFile->getDetailedDocumentationUrl() + "#android_rs:" + name;
+}
+
+void Definition::scanDocumentationTags(Scanner* scanner, bool firstOccurence) {
+    if (scanner->findOptionalTag("hidden:")) {
+        scanner->checkNoValue();
+        mHidden = true;
+    }
+    if (firstOccurence) {
+        if (scanner->findTag("summary:")) {
+            mSummary = scanner->getValue();
+        }
+        if (scanner->findTag("description:")) {
+            scanner->checkNoValue();
+            while (scanner->findOptionalTag("")) {
+                mDescription.push_back(scanner->getValue());
+            }
+        }
+    } else if (scanner->findOptionalTag("summary:")) {
+        scanner->error() << "Only the first specification should have a summary.\n";
+    }
+}
+
+Constant::~Constant() {
+    for (auto i : mSpecifications) {
+        delete i;
+    }
+}
+
+Type::~Type() {
+    for (auto i : mSpecifications) {
+        delete i;
+    }
+}
+
+Function::Function(const string& name, SpecFile* specFile) : Definition(name, specFile) {
+    mCapitalizedName = capitalize(mName);
+}
+
+Function::~Function() {
+    for (auto i : mSpecifications) {
+        delete i;
+    }
+}
+
+bool Function::someParametersAreDocumented() const {
+    for (auto p : mParameters) {
+        if (!p->documentation.empty()) {
+            return true;
+        }
+    }
+    return false;
+}
+
+void Function::addParameter(ParameterEntry* entry, Scanner* scanner) {
+    for (auto i : mParameters) {
+        if (i->name == entry->name) {
+            // It's a duplicate.
+            if (!entry->documentation.empty()) {
+                scanner->error(entry->lineNumber)
+                            << "Only the first occurence of an arg should have the "
+                               "documentation.\n";
+            }
+            return;
+        }
+    }
+    mParameters.push_back(entry);
+}
+
+void Function::addReturn(ParameterEntry* entry, Scanner* scanner) {
+    if (entry->documentation.empty()) {
+        return;
+    }
+    if (!mReturnDocumentation.empty()) {
+        scanner->error() << "ret: should be documented only for the first variant\n";
+    }
+    mReturnDocumentation = entry->documentation;
+}
+
+void Specification::scanVersionInfo(Scanner* scanner) {
+    mVersionInfo.scan(scanner);
+}
+
+void ConstantSpecification::scanConstantSpecification(Scanner* scanner, SpecFile* specFile) {
+    string name = scanner->getValue();
+
+    bool created = false;
+    Constant* constant = specFile->findOrCreateConstant(name, &created);
+
+    ConstantSpecification* spec = new ConstantSpecification();
+    constant->addSpecification(spec);
+
+    spec->scanVersionInfo(scanner);
+    if (scanner->findTag("value:")) {
+        spec->mValue = scanner->getValue();
+    }
+    constant->scanDocumentationTags(scanner, created);
+
+    scanner->findTag("end:");
+}
+
+void TypeSpecification::scanTypeSpecification(Scanner* scanner, SpecFile* specFile) {
+    string name = scanner->getValue();
+
+    bool created = false;
+    Type* type = specFile->findOrCreateType(name, &created);
+
+    TypeSpecification* spec = new TypeSpecification();
+    type->addSpecification(spec);
+
+    spec->scanVersionInfo(scanner);
+    if (scanner->findOptionalTag("simple:")) {
+        spec->mKind = SIMPLE;
+        spec->mSimpleType = scanner->getValue();
+    }
+    if (scanner->findOptionalTag("struct:")) {
+        spec->mKind = STRUCT;
+        spec->mStructName = scanner->getValue();
+        while (scanner->findOptionalTag("field:")) {
+            string s = scanner->getValue();
+            string comment;
+            scanner->parseDocumentation(&s, &comment);
+            spec->mFields.push_back(s);
+            spec->mFieldComments.push_back(comment);
+        }
+        if (scanner->findOptionalTag("attrib:")) {
+            spec->mAttrib = scanner->getValue();
+        }
+    }
+    if (scanner->findOptionalTag("enum:")) {
+        spec->mKind = ENUM;
+        spec->mEnumName = scanner->getValue();
+        while (scanner->findOptionalTag("value:")) {
+            string s = scanner->getValue();
+            string comment;
+            scanner->parseDocumentation(&s, &comment);
+            spec->mValues.push_back(s);
+            spec->mValueComments.push_back(comment);
+        }
+    }
+    type->scanDocumentationTags(scanner, created);
+
+    scanner->findTag("end:");
+}
+
+FunctionSpecification::~FunctionSpecification() {
+    for (auto i : mParameters) {
+        delete i;
+    }
+    delete mReturn;
+    for (auto i : mPermutations) {
+        delete i;
+    }
+}
+
+string FunctionSpecification::expandString(string s,
+                                           int replacementIndexes[MAX_REPLACEABLES]) const {
+    if (mReplaceables.size() > 0) {
+        s = stringReplace(s, "#1", mReplaceables[0][replacementIndexes[0]]);
+    }
+    if (mReplaceables.size() > 1) {
+        s = stringReplace(s, "#2", mReplaceables[1][replacementIndexes[1]]);
+    }
+    if (mReplaceables.size() > 2) {
+        s = stringReplace(s, "#3", mReplaceables[2][replacementIndexes[2]]);
+    }
+    if (mReplaceables.size() > 3) {
+        s = stringReplace(s, "#4", mReplaceables[3][replacementIndexes[3]]);
+    }
+    return s;
+}
+
+void FunctionSpecification::expandStringVector(const vector<string>& in,
+                                               int replacementIndexes[MAX_REPLACEABLES],
+                                               vector<string>* out) const {
+    out->clear();
+    for (vector<string>::const_iterator iter = in.begin(); iter != in.end(); iter++) {
+        out->push_back(expandString(*iter, replacementIndexes));
+    }
+}
+
+void FunctionSpecification::createPermutations(Function* function, Scanner* scanner) {
+    int start[MAX_REPLACEABLES];
+    int end[MAX_REPLACEABLES];
+    for (int i = 0; i < MAX_REPLACEABLES; i++) {
+        if (i < (int)mReplaceables.size()) {
+            start[i] = 0;
+            end[i] = mReplaceables[i].size();
+        } else {
+            start[i] = -1;
+            end[i] = 0;
+        }
+    }
+    int replacementIndexes[MAX_REPLACEABLES];
+    // TODO: These loops assume that MAX_REPLACEABLES is 4.
+    for (replacementIndexes[3] = start[3]; replacementIndexes[3] < end[3];
+         replacementIndexes[3]++) {
+        for (replacementIndexes[2] = start[2]; replacementIndexes[2] < end[2];
+             replacementIndexes[2]++) {
+            for (replacementIndexes[1] = start[1]; replacementIndexes[1] < end[1];
+                 replacementIndexes[1]++) {
+                for (replacementIndexes[0] = start[0]; replacementIndexes[0] < end[0];
+                     replacementIndexes[0]++) {
+                    auto p = new FunctionPermutation(function, this, replacementIndexes, scanner);
+                    mPermutations.push_back(p);
+                }
+            }
+        }
+    }
+}
+
+string FunctionSpecification::getName(int replacementIndexes[MAX_REPLACEABLES]) const {
+    return expandString(mUnexpandedName, replacementIndexes);
+}
+
+void FunctionSpecification::getReturn(int replacementIndexes[MAX_REPLACEABLES],
+                                      std::string* retType, int* lineNumber) const {
+    *retType = expandString(mReturn->type, replacementIndexes);
+    *lineNumber = mReturn->lineNumber;
+}
+
+void FunctionSpecification::getParam(size_t index, int replacementIndexes[MAX_REPLACEABLES],
+                                     std::string* type, std::string* name, std::string* testOption,
+                                     int* lineNumber) const {
+    ParameterEntry* p = mParameters[index];
+    *type = expandString(p->type, replacementIndexes);
+    *name = p->name;
+    *testOption = expandString(p->testOption, replacementIndexes);
+    *lineNumber = p->lineNumber;
+}
+
+void FunctionSpecification::getInlines(int replacementIndexes[MAX_REPLACEABLES],
+                                       std::vector<std::string>* inlines) const {
+    expandStringVector(mInline, replacementIndexes, inlines);
+}
+
+void FunctionSpecification::parseTest(Scanner* scanner) {
+    const string value = scanner->getValue();
+    if (value == "scalar" || value == "vector" || value == "noverify" || value == "custom" ||
+        value == "none") {
+        mTest = value;
+    } else if (value.compare(0, 7, "limited") == 0) {
+        mTest = "limited";
+        if (value.compare(7, 1, "(") == 0) {
+            size_t pParen = value.find(')');
+            if (pParen == string::npos) {
+                scanner->error() << "Incorrect test: \"" << value << "\"\n";
+            } else {
+                mPrecisionLimit = value.substr(8, pParen - 8);
+            }
+        }
+    } else {
+        scanner->error() << "Unrecognized test option: \"" << value << "\"\n";
+    }
+}
+
+bool FunctionSpecification::hasTests(int versionOfTestFiles) const {
+    if (mVersionInfo.minVersion != 0 && mVersionInfo.minVersion > versionOfTestFiles) {
+        return false;
+    }
+    if (mVersionInfo.maxVersion != 0 && mVersionInfo.maxVersion < versionOfTestFiles) {
+        return false;
+    }
+    if (mTest == "none") {
+        return false;
+    }
+    return true;
+}
+
+void FunctionSpecification::scanFunctionSpecification(Scanner* scanner, SpecFile* specFile) {
+    // Some functions like convert have # part of the name.  Truncate at that point.
+    string name = scanner->getValue();
+    size_t p = name.find('#');
+    if (p != string::npos) {
+        if (p > 0 && name[p - 1] == '_') {
+            p--;
+        }
+        name.erase(p);
+    }
+
+    bool created = false;
+    Function* function = specFile->findOrCreateFunction(name, &created);
+
+    FunctionSpecification* spec = new FunctionSpecification();
+    function->addSpecification(spec);
+
+    spec->mUnexpandedName = scanner->getValue();
+    spec->mTest = "scalar";  // default
+
+    spec->scanVersionInfo(scanner);
+
+    if (scanner->findOptionalTag("attrib:")) {
+        spec->mAttribute = scanner->getValue();
+    }
+    if (scanner->findOptionalTag("w:")) {
+        vector<string> t;
+        if (scanner->getValue().find("1") != string::npos) {
+            t.push_back("");
+        }
+        if (scanner->getValue().find("2") != string::npos) {
+            t.push_back("2");
+        }
+        if (scanner->getValue().find("3") != string::npos) {
+            t.push_back("3");
+        }
+        if (scanner->getValue().find("4") != string::npos) {
+            t.push_back("4");
+        }
+        spec->mReplaceables.push_back(t);
+    }
+
+    while (scanner->findOptionalTag("t:")) {
+        spec->mReplaceables.push_back(convertToTypeVector(scanner->getValue()));
+    }
+
+    if (scanner->findTag("ret:")) {
+        ParameterEntry* p = scanner->parseArgString(true);
+        function->addReturn(p, scanner);
+        spec->mReturn = p;
+    }
+    while (scanner->findOptionalTag("arg:")) {
+        ParameterEntry* p = scanner->parseArgString(false);
+        function->addParameter(p, scanner);
+        spec->mParameters.push_back(p);
+    }
+
+    function->scanDocumentationTags(scanner, created);
+
+    if (scanner->findOptionalTag("inline:")) {
+        scanner->checkNoValue();
+        while (scanner->findOptionalTag("")) {
+            spec->mInline.push_back(scanner->getValue());
+        }
+    }
+    if (scanner->findOptionalTag("test:")) {
+        spec->parseTest(scanner);
+    }
+
+    scanner->findTag("end:");
+
+    spec->createPermutations(function, scanner);
+}
+
+FunctionPermutation::FunctionPermutation(Function* func, FunctionSpecification* spec,
+                                         int replacementIndexes[MAX_REPLACEABLES], Scanner* scanner)
+    : mFunction(func), mReturn(nullptr), mInputCount(0), mOutputCount(0) {
+    // We expand the strings now to make capitalization easier.  The previous code preserved
+    // the #n
+    // markers just before emitting, which made capitalization difficult.
+    mName = spec->getName(replacementIndexes);
+    mNameTrunk = func->getName();
+    mTest = spec->getTest();
+    mPrecisionLimit = spec->getPrecisionLimit();
+    spec->getInlines(replacementIndexes, &mInline);
+
+    mHasFloatAnswers = false;
+    for (size_t i = 0; i < spec->getNumberOfParams(); i++) {
+        string type, name, testOption;
+        int lineNumber = 0;
+        spec->getParam(i, replacementIndexes, &type, &name, &testOption, &lineNumber);
+        ParameterDefinition* def = new ParameterDefinition();
+        def->parseParameterDefinition(type, name, testOption, lineNumber, false, scanner);
+        if (def->isOutParameter) {
+            mOutputCount++;
+        } else {
+            mInputCount++;
+        }
+
+        if (def->typeIndex < 0 && mTest != "none") {
+            scanner->error(lineNumber)
+                        << "Could not find " << def->rsBaseType
+                        << " while generating automated tests.  Use test: none if not needed.\n";
+        }
+        if (def->isOutParameter && def->isFloatType) {
+            mHasFloatAnswers = true;
+        }
+        mParams.push_back(def);
+    }
+
+    string retType;
+    int lineNumber = 0;
+    spec->getReturn(replacementIndexes, &retType, &lineNumber);
+    if (!retType.empty()) {
+        mReturn = new ParameterDefinition();
+        mReturn->parseParameterDefinition(retType, "", "", lineNumber, true, scanner);
+        if (mReturn->isFloatType) {
+            mHasFloatAnswers = true;
+        }
+        mOutputCount++;
+    }
+}
+
+FunctionPermutation::~FunctionPermutation() {
+    for (auto i : mParams) {
+        delete i;
+    }
+    delete mReturn;
+}
+
+SpecFile::SpecFile(const string& specFileName) : mSpecFileName(specFileName) {
+    string core = mSpecFileName;
+    // Remove .spec
+    size_t l = core.length();
+    const char SPEC[] = ".spec";
+    const int SPEC_SIZE = sizeof(SPEC) - 1;
+    const int start = l - SPEC_SIZE;
+    if (start >= 0 && core.compare(start, SPEC_SIZE, SPEC) == 0) {
+        core.erase(start);
+    }
+
+    // The header file name should have the same base but with a ".rsh" extension.
+    mHeaderFileName = core + ".rsh";
+
+    mDetailedDocumentationUrl = BASE_URL;
+    mDetailedDocumentationUrl += core + ".html";
+}
+
+SpecFile::~SpecFile() {
+    for (auto i : mConstantsList) {
+        delete i;
+    }
+    for (auto i : mTypesList) {
+        delete i;
+    }
+    for (auto i : mFunctionsList) {
+        delete i;
+    }
+}
+
+// Read the specification, adding the definitions to the global functions map.
+bool SpecFile::readSpecFile() {
+    FILE* specFile = fopen(mSpecFileName.c_str(), "rt");
+    if (!specFile) {
+        cerr << "Error opening input file: " << mSpecFileName << "\n";
+        return false;
+    }
+
+    Scanner scanner(mSpecFileName, specFile);
+
+    // Scan the header that should start the file.
+    scanner.skipBlankEntries();
+    if (scanner.findTag("header:")) {
+        if (scanner.findTag("summary:")) {
+            mBriefDescription = scanner.getValue();
+        }
+        if (scanner.findTag("description:")) {
+            scanner.checkNoValue();
+            while (scanner.findOptionalTag("")) {
+                mFullDescription.push_back(scanner.getValue());
+            }
+        }
+        if (scanner.findOptionalTag("include:")) {
+            scanner.checkNoValue();
+            while (scanner.findOptionalTag("")) {
+                mVerbatimInclude.push_back(scanner.getValue());
+            }
+        }
+        scanner.findTag("end:");
+    }
+
+    while (1) {
+        scanner.skipBlankEntries();
+        if (scanner.atEnd()) {
+            break;
+        }
+        const string tag = scanner.getNextTag();
+        if (tag == "function:") {
+            FunctionSpecification::scanFunctionSpecification(&scanner, this);
+        } else if (tag == "type:") {
+            TypeSpecification::scanTypeSpecification(&scanner, this);
+        } else if (tag == "constant:") {
+            ConstantSpecification::scanConstantSpecification(&scanner, this);
+        } else {
+            scanner.error() << "Expected function:, type:, or constant:.  Found: " << tag << "\n";
+            return false;
+        }
+    }
+
+    fclose(specFile);
+    return scanner.getErrorCount() == 0;
+}
+
+// Returns the named entry in the map.  Creates it if it's not there.
+template <class T>
+T* findOrCreate(const string& name, list<T*>* list, map<string, T*>* map, bool* created,
+                SpecFile* specFile) {
+    auto iter = map->find(name);
+    if (iter != map->end()) {
+        *created = false;
+        return iter->second;
+    }
+    *created = true;
+    T* f = new T(name, specFile);
+    map->insert(pair<string, T*>(name, f));
+    list->push_back(f);
+    return f;
+}
+
+Constant* SpecFile::findOrCreateConstant(const string& name, bool* created) {
+    return findOrCreate<Constant>(name, &mConstantsList, &mConstantsMap, created, this);
+}
+
+Type* SpecFile::findOrCreateType(const string& name, bool* created) {
+    return findOrCreate<Type>(name, &mTypesList, &mTypesMap, created, this);
+}
+
+Function* SpecFile::findOrCreateFunction(const string& name, bool* created) {
+    return findOrCreate<Function>(name, &mFunctionsList, &mFunctionsMap, created, this);
+}
+
+SystemSpecification::~SystemSpecification() {
+    for (auto i : mSpecFiles) {
+        delete i;
+    }
+}
+
+template <class T>
+static bool addDefinitionToMap(map<string, T*>* map, T* object) {
+    const string& name = object->getName();
+    auto i = map->find(name);
+    if (i != map->end()) {
+        T* existing = i->second;
+        cerr << object->getSpecFileName() << ": Error. " << name << " has already been defined in "
+             << existing->getSpecFileName() << "\n";
+        return false;
+    }
+    (*map)[name] = object;
+    return true;
+}
+
+bool SystemSpecification::readSpecFile(const string& fileName) {
+    SpecFile* spec = new SpecFile(fileName);
+    if (!spec->readSpecFile()) {
+        cerr << fileName << ": Failed to parse.\n";
+        return false;
+    }
+    mSpecFiles.push_back(spec);
+
+    // Store links to the definitions in a global table.
+    bool success = true;
+    for (auto i : spec->getConstantsMap()) {
+        if (!addDefinitionToMap(&mConstants, i.second)) {
+            success = false;
+        }
+    }
+    for (auto i : spec->getTypesMap()) {
+        if (!addDefinitionToMap(&mTypes, i.second)) {
+            success = false;
+        }
+    }
+    for (auto i : spec->getFunctionsMap()) {
+        if (!addDefinitionToMap(&mFunctions, i.second)) {
+            success = false;
+        }
+    }
+
+    return success;
+}
+
+bool SystemSpecification::generateFiles(int versionOfTestFiles) const {
+    bool success = GenerateHeaderFiles() && generateHtmlDocumentation() &&
+                   GenerateTestFiles(versionOfTestFiles);
+    if (success) {
+        cout << "Successfully processed " << mTypes.size() << " types, " << mConstants.size()
+             << " constants, and " << mFunctions.size() << " functions.\n";
+    }
+    return success;
+}
+
+string SystemSpecification::getHtmlAnchor(const string& name) const {
+    Definition* d = nullptr;
+    auto c = mConstants.find(name);
+    if (c != mConstants.end()) {
+        d = c->second;
+    } else {
+        auto t = mTypes.find(name);
+        if (t != mTypes.end()) {
+            d = t->second;
+        } else {
+            auto f = mFunctions.find(name);
+            if (f != mFunctions.end()) {
+                d = f->second;
+            } else {
+                return string();
+            }
+        }
+    }
+    ostringstream stream;
+    stream << "<a href='" << d->getUrl() << "'>" << name << "</a>";
+    return stream.str();
+}
diff --git a/api/Specification.h b/api/Specification.h
new file mode 100644
index 0000000..6146665
--- /dev/null
+++ b/api/Specification.h
@@ -0,0 +1,517 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_RS_API_GENERATOR_SPECIFICATION_H
+#define ANDROID_RS_API_GENERATOR_SPECIFICATION_H
+
+// See Generator.cpp for documentation of the .spec file format.
+
+#include <fstream>
+#include <list>
+#include <map>
+#include <string>
+#include <vector>
+
+class Constant;
+class ConstantSpecification;
+class Function;
+class FunctionPermutation;
+class FunctionSpecification;
+class SpecFile;
+class Specification;
+class Scanner;
+class SystemSpecification;
+class Type;
+class TypeSpecification;
+
+enum NumberKind { SIGNED_INTEGER, UNSIGNED_INTEGER, FLOATING_POINT };
+
+// Table of type equivalences.
+struct NumericalType {
+    const char* specType;    // Name found in the .spec file
+    const char* rsDataType;  // RS data type
+    const char* cType;       // Type in a C file
+    const char* javaType;    // Type in a Java file
+    NumberKind kind;
+    /* For integers, number of bits of the number, excluding the sign bit.
+     * For floats, number of implied bits of the mantissa.
+     */
+    int significantBits;
+    // For floats, number of bits of the exponent.  0 for integer types.
+    int exponentBits;
+};
+
+/* Corresponds to one parameter line in a .spec file.  These will be parsed when
+ * we instantiate the FunctionPermutation(s) that correspond to one FunctionSpecification.
+ */
+struct ParameterEntry {
+    std::string type;
+    std::string name;
+    /* Optional information on how to generate test values for this parameter.  Can be:
+     * - range(low, high): Generates values between these two limits only.
+     * - above(other_parameter): The values must be greater than those of the named parameter.
+     *       Used for clamp.
+     * - compatible(type): The values must also be fully representable in the specified type.
+     * - conditional: Don't verify this value the function return NaN.
+     */
+    std::string testOption;
+    std::string documentation;
+    int lineNumber;
+};
+
+/* Information about a parameter to a function.  The values of all the fields should only be set by
+ * parseParameterDefinition.
+ */
+struct ParameterDefinition {
+    std::string rsType;        // The Renderscript type, e.g. "uint3"
+    std::string rsBaseType;    // As above but without the number, e.g. "uint"
+    std::string javaBaseType;  // The type we need to declare in Java, e.g. "unsigned int"
+    std::string specType;      // The type found in the spec, e.g. "f16"
+    bool isFloatType;          // True if it's a floating point value
+    /* The number of entries in the vector.  It should be either "1", "2", "3", or "4".  It's also
+     * "1" for scalars.
+     */
+    std::string mVectorSize;
+    /* The space the vector takes in an array.  It's the same as the vector size, except for size
+     * "3", where the width is "4".
+     */
+    std::string vectorWidth;
+
+    std::string specName;       // e.g. x, as found in the spec file
+    std::string variableName;   // e.g. inX, used both in .rs and .java
+    std::string rsAllocName;    // e.g. gAllocInX
+    std::string javaAllocName;  // e.g. inX
+    std::string javaArrayName;  // e.g. arrayInX
+
+    // If non empty, the mininum and maximum values to be used when generating the test data.
+    std::string minValue;
+    std::string maxValue;
+    /* If non empty, contains the name of another parameter that should be smaller or equal to this
+     * parameter, i.e.  value(smallerParameter) <= value(this).  This is used when testing clamp.
+     */
+    std::string smallerParameter;
+
+    bool isOutParameter;       // True if this parameter returns data from the script.
+    bool undefinedIfOutIsNan;  // If true, we don't validate if 'out' is NaN.
+
+    int typeIndex;            // Index in the TYPES array. Negative if not found in the array.
+    int compatibleTypeIndex;  // Index in TYPES for which the test data must also fit.
+
+    /* Fill this object from the type, name, and testOption.
+     * isReturn is true if we're processing the "return:"
+     */
+    void parseParameterDefinition(const std::string& type, const std::string& name,
+                                  const std::string& testOption, int lineNumber, bool isReturn,
+                                  Scanner* scanner);
+};
+
+struct VersionInfo {
+    /* The range of versions a specification applies to. Zero if there's no restriction,
+     * so an API that became available at 12 and is still valid would have min:12 max:0.
+     * If non zero, both versions should be at least 9, the API level that introduced
+     * RenderScript.
+     */
+    int minVersion;
+    int maxVersion;
+    // Either 0, 32 or 64.  If 0, this definition is valid for both 32 and 64 bits.
+    int intSize;
+
+    VersionInfo() : minVersion(0), maxVersion(0), intSize(0) {}
+    void scan(Scanner* scanner);
+};
+
+// We have three type of definitions
+class Definition {
+protected:
+    std::string mName;
+    std::string mSpecFileName;
+
+    bool mHidden;                           // True if it should not be documented
+    std::string mSummary;                   // A one-line description
+    std::vector<std::string> mDescription;  // The comments to be included in the header
+    std::string mUrl;                       // The URL of the detailed documentation
+
+public:
+    Definition(const std::string& name, SpecFile* specFile);
+
+    std::string getName() const { return mName; }
+    std::string getSpecFileName() const { return mSpecFileName; }
+
+    bool hidden() const { return mHidden; }
+    std::string getSummary() const { return mSummary; }
+    const std::vector<std::string>& getDescription() const { return mDescription; }
+    std::string getUrl() const { return mUrl; }
+
+    void scanDocumentationTags(Scanner* scanner, bool firstOccurence);
+};
+
+/* Represents a constant, like M_PI.  This is a grouping of the version specific specifications.
+ * We'll only have one instance of Constant for each name.
+ */
+class Constant : public Definition {
+private:
+    std::vector<ConstantSpecification*> mSpecifications;  // Owned
+
+public:
+    Constant(const std::string& name, SpecFile* specFile) : Definition(name, specFile) {}
+    ~Constant();
+
+    const std::vector<ConstantSpecification*> getSpecifications() const { return mSpecifications; }
+    // This method should only be called by the scanning code.
+    void addSpecification(ConstantSpecification* spec) { mSpecifications.push_back(spec); }
+};
+
+/* Represents a type, like "float4".  This is a grouping of the version specific specifications.
+ * We'll only have one instance of Type for each name.
+ */
+class Type : public Definition {
+private:
+    std::vector<TypeSpecification*> mSpecifications;  // Owned
+
+public:
+    Type(const std::string& name, SpecFile* specFile) : Definition(name, specFile) {}
+    ~Type();
+
+    const std::vector<TypeSpecification*> getSpecifications() const { return mSpecifications; }
+    // This method should only be called by the scanning code.
+    void addSpecification(TypeSpecification* spec) { mSpecifications.push_back(spec); }
+};
+
+/* Represents a function, like "clamp".  Even though the spec file contains many entries for clamp,
+ * we'll only have one clamp instance.
+ */
+class Function : public Definition {
+private:
+    // mName in the base class contains the lower case name, e.g. native_log
+    std::string mCapitalizedName;  // The capitalized name, e.g. NativeLog
+
+    // The unique parameters between all the specifications.  NOT OWNED.
+    std::vector<ParameterEntry*> mParameters;
+    std::string mReturnDocumentation;
+
+    std::vector<FunctionSpecification*> mSpecifications;  // Owned
+
+public:
+    Function(const std::string& name, SpecFile* specFile);
+    ~Function();
+
+    std::string getCapitalizedName() const { return mCapitalizedName; }
+    const std::vector<ParameterEntry*>& getParameters() const { return mParameters; }
+    std::string getReturnDocumentation() const { return mReturnDocumentation; }
+    const std::vector<FunctionSpecification*> getSpecifications() const { return mSpecifications; }
+
+    bool someParametersAreDocumented() const;
+
+    // The following methods should only be called by the scanning code.
+    void addParameter(ParameterEntry* entry, Scanner* scanner);
+    void addReturn(ParameterEntry* entry, Scanner* scanner);
+    void addSpecification(FunctionSpecification* spec) { mSpecifications.push_back(spec); }
+};
+
+/* Base class for TypeSpecification, ConstantSpecification, and FunctionSpecification.
+ * A specification can be specific to a range of RenderScript version or 32bits vs 64 bits.
+ * This base class contains code to parse and store this version information.
+ */
+class Specification {
+protected:
+    VersionInfo mVersionInfo;
+    void scanVersionInfo(Scanner* scanner);
+
+public:
+    VersionInfo getVersionInfo() const { return mVersionInfo; }
+};
+
+/* Defines one of the many variations of a constant.  There's a one to one correspondance between
+ * ConstantSpecification objects and entries in the spec file.
+ */
+class ConstantSpecification : public Specification {
+private:
+    std::string mValue;  // E.g. "3.1415"
+public:
+    std::string getValue() const { return mValue; }
+
+    // Parse a constant specification and add it to specFile.
+    static void scanConstantSpecification(Scanner* scanner, SpecFile* specFile);
+};
+
+enum TypeKind {
+    SIMPLE,
+    STRUCT,
+    ENUM,
+};
+
+/* Defines one of the many variations of a type.  There's a one to one correspondance between
+ * TypeSpecification objects and entries in the spec file.
+ */
+class TypeSpecification : public Specification {
+private:
+    TypeKind mKind;  // The kind of type specification
+
+    // If mKind is SIMPLE:
+    std::string mSimpleType;  // The definition of the type
+
+    // If mKind is STRUCT:
+    std::string mStructName;                  // The name found after the struct keyword
+    std::vector<std::string> mFields;         // One entry per struct field
+    std::vector<std::string> mFieldComments;  // One entry per struct field
+    std::string mAttrib;                      // Some structures may have attributes
+
+    // If mKind is ENUM:
+    std::string mEnumName;                    // The name found after the enum keyword
+    std::vector<std::string> mValues;         // One entry per enum value
+    std::vector<std::string> mValueComments;  // One entry per enum value
+public:
+    TypeKind getKind() const { return mKind; }
+    std::string getSimpleType() const { return mSimpleType; }
+    std::string getStructName() const { return mStructName; }
+    const std::vector<std::string>& getFields() const { return mFields; }
+    const std::vector<std::string>& getFieldComments() const { return mFieldComments; }
+    std::string getAttrib() const { return mAttrib; }
+    std::string getEnumName() const { return mEnumName; }
+    const std::vector<std::string>& getValues() const { return mValues; }
+    const std::vector<std::string>& getValueComments() const { return mValueComments; }
+
+    // Parse a type specification and add it to specFile.
+    static void scanTypeSpecification(Scanner* scanner, SpecFile* specFile);
+};
+
+// Maximum number of placeholders (like #1, #2) in function specifications.
+const int MAX_REPLACEABLES = 4;
+
+/* Defines one of the many variations of the function.  There's a one to one correspondance between
+ * FunctionSpecification objects and entries in the spec file.  Some of the strings that are parts
+ * of a FunctionSpecification can include placeholders, which are "#1", "#2", "#3", and "#4".  We'll
+ * replace these by values before generating the files.
+ */
+class FunctionSpecification : public Specification {
+private:
+    /* How to test.  One of:
+     * "scalar": Generate test code that checks entries of each vector indepently.  E.g. for
+     *           sin(float3), the test code will call the CoreMathVerfier.computeSin 3 times.
+     * "limited": Like "scalar" but we don't generate extreme values.  This is not currently
+     *            enabled as we were generating to many errors.
+     * "custom": Like "scalar" but instead of calling CoreMathVerifier.computeXXX() to compute
+     *           the expected value, we call instead CoreMathVerifier.verifyXXX().  This method
+     *           returns a string that contains the error message, null if there's no error.
+     * "vector": Generate test code that calls the CoreMathVerifier only once for each vector.
+     *           This is useful for APIs like dot() or length().
+     * "noverify": Generate test code that calls the API but don't verify the returned value.
+     *             This can discover unresolved references.
+     */
+    std::string mTest;
+    std::string mAttribute;       // Function attributes.
+    std::string mPrecisionLimit;  // Maximum precision required when checking output of this
+                                  // function.
+
+    // The vectors of values with which we'll replace #1, #2, ...
+    std::vector<std::vector<std::string> > mReplaceables;
+
+    /* The collection of permutations for this specification, i.e. this class instantianted
+     * for specific values of #1, #2, etc.  Owned.
+     */
+    std::vector<FunctionPermutation*> mPermutations;
+
+    // The following fields may contain placeholders that will be replaced using the mReplaceables.
+
+    /* As of this writing, convert_... is the only function with #1 in its name.
+     * The related Function object contains the name of the function without #n, e.g. convert.
+     * This is the name with the #, e.g. convert_#1_#2
+     */
+    std::string mUnexpandedName;
+    ParameterEntry* mReturn;  // The return type. The name should be empty.  Owned.
+    int mReturnLineNumber;
+    std::vector<ParameterEntry*> mParameters;  // The parameters.  Owned.
+    std::vector<std::string> mInline;          // The inline code to be included in the header
+
+    /* Substitute the placeholders in the strings (e.g. #1, #2, ...) by the corresponding
+     * entries in mReplaceables.  indexOfReplaceable1 selects with value to use for #1,
+     * same for 2, 3, and 4.
+     */
+    std::string expandString(std::string s, int indexOfReplaceable[MAX_REPLACEABLES]) const;
+    void expandStringVector(const std::vector<std::string>& in,
+                            int replacementIndexes[MAX_REPLACEABLES],
+                            std::vector<std::string>* out) const;
+
+    // Fill the mPermutations field.
+    void createPermutations(Function* function, Scanner* scanner);
+
+public:
+    FunctionSpecification() : mReturn(nullptr) {}
+    ~FunctionSpecification();
+
+    std::string getAttribute() const { return mAttribute; }
+    std::string getTest() const { return mTest; }
+    std::string getPrecisionLimit() const { return mPrecisionLimit; }
+
+    const std::vector<FunctionPermutation*>& getPermutations() const { return mPermutations; }
+
+    std::string getName(int replacementIndexes[MAX_REPLACEABLES]) const;
+    void getReturn(int replacementIndexes[MAX_REPLACEABLES], std::string* retType,
+                   int* lineNumber) const;
+    size_t getNumberOfParams() const { return mParameters.size(); }
+    void getParam(size_t index, int replacementIndexes[MAX_REPLACEABLES], std::string* type,
+                  std::string* name, std::string* testOption, int* lineNumber) const;
+    void getInlines(int replacementIndexes[MAX_REPLACEABLES],
+                    std::vector<std::string>* inlines) const;
+
+    // Parse the "test:" line.
+    void parseTest(Scanner* scanner);
+
+    // Return true if we need to generate tests for this function.
+    bool hasTests(int versionOfTestFiles) const;
+
+    // Parse a function specification and add it to specFile.
+    static void scanFunctionSpecification(Scanner* scanner, SpecFile* specFile);
+};
+
+/* A concrete version of a function specification, where all placeholders have been replaced by
+ * actual values.
+ */
+class FunctionPermutation {
+private:
+    Function* mFunction;  // NOT OWNED.
+
+    // These are the expanded version of those found on FunctionSpecification
+    std::string mName;
+    std::string mNameTrunk;  // The name without any expansion, e.g. convert
+    std::string mTest;       // How to test.  One of "scalar", "vector", "noverify", "limited", and
+                             // "none".
+    std::string mPrecisionLimit;  // Maximum precision required when checking output of this
+                                  // function.
+
+    // The parameters of the function.  This does not include the return type.  Owned.
+    std::vector<ParameterDefinition*> mParams;
+    // The return type.  nullptr if a void function.  Owned.
+    ParameterDefinition* mReturn;
+
+    // The number of input and output parameters.  mOutputCount counts the return type.
+    int mInputCount;
+    int mOutputCount;
+
+    // Whether one of the output parameters is a float.
+    bool mHasFloatAnswers;
+
+    // The inline code that implements this function.  Will be empty if not an inline.
+    std::vector<std::string> mInline;
+
+public:
+    FunctionPermutation(Function* function, FunctionSpecification* specification,
+                        int replacementIndexes[MAX_REPLACEABLES], Scanner* scanner);
+    ~FunctionPermutation();
+
+    std::string getName() const { return mName; }
+    std::string getNameTrunk() const { return mNameTrunk; }
+    std::string getTest() const { return mTest; }
+    std::string getPrecisionLimit() const { return mPrecisionLimit; }
+
+    const std::vector<std::string> getInline() const { return mInline; }
+    const ParameterDefinition* getReturn() const { return mReturn; }
+    int getInputCount() const { return mInputCount; }
+    int getOutputCount() const { return mOutputCount; }
+    bool hasFloatAnswers() const { return mHasFloatAnswers; }
+
+    const std::vector<ParameterDefinition*> getParams() const { return mParams; }
+};
+
+// An entire spec file and the methods to process it.
+class SpecFile {
+private:
+    std::string mSpecFileName;
+    std::string mHeaderFileName;
+    std::string mDetailedDocumentationUrl;
+    std::string mBriefDescription;
+    std::vector<std::string> mFullDescription;
+    // Text to insert as-is in the generated header.
+    std::vector<std::string> mVerbatimInclude;
+
+    /* The constants, types, and functions declared in this file,
+     * in the order they are found in the file.  This matters for
+     * header generation, as some types and inline functions depend
+     * on each other.
+     *
+     * Pointers are owned by this list.
+     */
+    std::list<Constant*> mConstantsList;
+    std::list<Type*> mTypesList;
+    std::list<Function*> mFunctionsList;
+
+    // Quick way to find entries in the previous lists.  Pointers not owned.
+    std::map<std::string, Constant*> mConstantsMap;
+    std::map<std::string, Type*> mTypesMap;
+    std::map<std::string, Function*> mFunctionsMap;
+
+public:
+    explicit SpecFile(const std::string& specFileName);
+    ~SpecFile();
+
+    std::string getSpecFileName() const { return mSpecFileName; }
+    std::string getHeaderFileName() const { return mHeaderFileName; }
+    std::string getDetailedDocumentationUrl() const { return mDetailedDocumentationUrl; }
+    const std::string getBriefDescription() const { return mBriefDescription; }
+    const std::vector<std::string>& getFullDescription() const { return mFullDescription; }
+    const std::vector<std::string>& getVerbatimInclude() const { return mVerbatimInclude; }
+
+    const std::list<Constant*>& getConstantsList() const { return mConstantsList; }
+    const std::list<Type*>& getTypesList() const { return mTypesList; }
+    const std::list<Function*>& getFunctionsList() const { return mFunctionsList; }
+
+    const std::map<std::string, Constant*>& getConstantsMap() const { return mConstantsMap; }
+    const std::map<std::string, Type*>& getTypesMap() const { return mTypesMap; }
+    const std::map<std::string, Function*>& getFunctionsMap() const { return mFunctionsMap; }
+
+    bool readSpecFile();
+
+    Constant* findOrCreateConstant(const std::string& name, bool* created);
+    Type* findOrCreateType(const std::string& name, bool* created);
+    Function* findOrCreateFunction(const std::string& name, bool* created);
+};
+
+// The collection of all the spec files.
+class SystemSpecification {
+private:
+    std::vector<SpecFile*> mSpecFiles;
+
+    /* Entries in the table of contents.  We accumulate them in a map to sort them.
+     * Pointers are not owned, they belong to the SpecFile object.
+     */
+    std::map<std::string, Constant*> mConstants;
+    std::map<std::string, Type*> mTypes;
+    std::map<std::string, Function*> mFunctions;
+
+public:
+    ~SystemSpecification();
+    // Parse the spec file and create the object hierarchy, adding a pointer to mSpecFiles.
+    bool readSpecFile(const std::string& fileName);
+    // Generate all the files.
+    bool generateFiles(int versionOfTestFiles) const;
+
+    const std::vector<SpecFile*>& getSpecFiles() const { return mSpecFiles; }
+    const std::map<std::string, Constant*>& getConstants() const { return mConstants; }
+    const std::map<std::string, Type*>& getTypes() const { return mTypes; }
+    const std::map<std::string, Function*>& getFunctions() const { return mFunctions; }
+
+    // Returns "<a href='...'> for the named specification, or empty if not found.
+    std::string getHtmlAnchor(const std::string& name) const;
+};
+
+// Singleton that represents the collection of all the specs we're processing.
+extern SystemSpecification systemSpecification;
+
+// Table of equivalences of numerical types.
+extern const NumericalType TYPES[];
+extern const int NUM_TYPES;
+
+#endif  // ANDROID_RS_API_GENERATOR_SPECIFICATION_H
diff --git a/api/Utilities.cpp b/api/Utilities.cpp
new file mode 100644
index 0000000..80ebb0d
--- /dev/null
+++ b/api/Utilities.cpp
@@ -0,0 +1,171 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <iostream>
+#include <sstream>
+
+#include "Utilities.h"
+
+using namespace std;
+
+const char LEGAL_NOTICE[] =
+            "/*\n"
+            " * Copyright (C) 2015 The Android Open Source Project\n"
+            " *\n"
+            " * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
+            " * you may not use this file except in compliance with the License.\n"
+            " * You may obtain a copy of the License at\n"
+            " *\n"
+            " *      http://www.apache.org/licenses/LICENSE-2.0\n"
+            " *\n"
+            " * Unless required by applicable law or agreed to in writing, software\n"
+            " * distributed under the License is distributed on an \"AS IS\" BASIS,\n"
+            " * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n"
+            " * See the License for the specific language governing permissions and\n"
+            " * limitations under the License.\n"
+            " */\n\n";
+
+const char AUTO_GENERATED_WARNING[] =
+            "Don't edit this file!  It is auto-generated by frameworks/rs/api/gen_runtime.";
+
+string capitalize(const string& source) {
+    int length = source.length();
+    string result;
+    bool capitalize = true;
+    for (int s = 0; s < length; s++) {
+        if (source[s] == '_') {
+            capitalize = true;
+        } else if (capitalize) {
+            result += toupper(source[s]);
+            capitalize = false;
+        } else {
+            result += source[s];
+        }
+    }
+    return result;
+}
+
+void trimSpaces(string* s) {
+    const size_t end = s->find_last_not_of(" ");
+    if (end == string::npos) {
+        // All spaces
+        s->erase();
+        return;
+    } else {
+        s->erase(end + 1);
+    }
+    const size_t start = s->find_first_not_of(" ");
+    if (start > 0) {
+        s->erase(0, start);
+    }
+}
+
+string stringReplace(string s, string match, string rep) {
+    while (1) {
+        // This is not efficient but we don't care, as this program runs very rarely.
+        size_t p = s.find(match);
+        if (p == string::npos) break;
+
+        s.erase(p, match.size());
+        s.insert(p, rep);
+    }
+    return s;
+}
+
+bool charRemoved(char c, string* s) {
+    size_t p = s->find(c);
+    if (p != string::npos) {
+        s->erase(p, 1);
+        return true;
+    }
+    return false;
+}
+
+string stripHtml(const string& html) {
+    string s;
+    for (size_t start = 0; start < html.size(); start++) {
+        size_t lt = html.find('<', start);
+        if (lt == string::npos) {
+            s += html.substr(start);
+            break;
+        }
+        s += html.substr(start, lt - start);
+        if (isalpha(html[lt + 1]) || html[lt + 1] == '/') {
+            // It's an HTML tag.  Search for the end.
+            start = html.find('>', lt + 1);
+            if (start == string::npos) {
+                break;
+            }
+        } else {
+            s += '<';
+        }
+    }
+    s = stringReplace(s, "&gt;", ">");
+    s = stringReplace(s, "&lt;", "<");
+    s = stringReplace(s, "&nbsp;", " ");
+    return s;
+}
+
+string hashString(const string& s) {
+    long hash = 0;
+    for (size_t i = 0; i < s.length(); i++) {
+        hash = hash * 43 + s[i];
+    }
+    stringstream stream;
+    stream << "0x" << std::hex << hash << "l";
+    return stream.str();
+}
+
+bool testAndSet(const string& flag, set<string>* set) {
+    if (set->find(flag) == set->end()) {
+        set->insert(flag);
+        return false;
+    }
+    return true;
+}
+
+double maxDoubleForInteger(int numberOfIntegerBits, int mantissaSize) {
+    /* Double has only 52 bits of precision (53 implied). So for longs, we want
+     * to create smaller values to avoid a round up.  Same for floats and halfs.
+     */
+    int lowZeroBits = max(0, numberOfIntegerBits - mantissaSize);
+    unsigned long l = (0xffffffffffffffff >> (64 - numberOfIntegerBits + lowZeroBits))
+                      << lowZeroBits;
+    return (double)l;
+}
+
+// Opens the stream.  Reports an error if it can't.
+bool GeneratedFile::start(const string& name) {
+    open(name.c_str(), ios::out | ios::trunc);
+    if (!is_open()) {
+        cerr << "Error.  Can't open the output file: " << name << "\n";
+        return false;
+    }
+    return true;
+}
+
+void GeneratedFile::writeNotices() {
+    *this << LEGAL_NOTICE;
+    *this << "// " << AUTO_GENERATED_WARNING << "\n\n";
+}
+
+void GeneratedFile::increaseIndent() {
+    mIndent.append(string(TAB_SIZE, ' '));
+}
+
+void GeneratedFile::decreaseIndent() {
+    mIndent.erase(0, TAB_SIZE);
+}
diff --git a/api/Utilities.h b/api/Utilities.h
new file mode 100644
index 0000000..8b0cd9c
--- /dev/null
+++ b/api/Utilities.h
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_RS_API_GENERATOR_UTILITIES_H
+#define ANDROID_RS_API_GENERATOR_UTILITIES_H
+
+#include <fstream>
+#include <set>
+#include <string>
+
+// Capitalizes and removes underscores.  E.g. converts "native_log" to NativeLog.
+std::string capitalize(const std::string& source);
+
+// Trim trailing and leading spaces from a string.
+void trimSpaces(std::string* s);
+
+// Replaces in string s all occurences of match with rep.
+std::string stringReplace(std::string s, std::string match, std::string rep);
+
+// Removes the character from present. Returns true if the string contained the character.
+bool charRemoved(char c, std::string* s);
+
+// Removes HTML references from the string.
+std::string stripHtml(const std::string& html);
+
+// Returns a string that's an hexadecimal constant of the hash of the string.
+std::string hashString(const std::string& s);
+
+// Adds a string to a set.  Return true if it was already in.
+bool testAndSet(const std::string& flag, std::set<std::string>* set);
+
+/* Returns a double that should be able to be converted to an integer of size
+ * numberOfIntegerBits.
+ */
+double maxDoubleForInteger(int numberOfIntegerBits, int mantissaSize);
+
+/* This class is used to generate one source file.  There will be one instance
+ * for each generated file.
+ */
+class GeneratedFile : public std::ofstream {
+private:
+    std::string mIndent;  // The correct spacing at the beginning of each line.
+    const int TAB_SIZE = 4;
+
+public:
+    // Opens the stream.  Reports an error if it can't.
+    bool start(const std::string& name);
+
+    // Write copyright notice & auto-generated warning in Java/C style comments.
+    void writeNotices();
+
+    void increaseIndent();               // Increases the new line indentation by 4.
+    void decreaseIndent();               // Decreases the new line indentation by 4.
+    void comment(const std::string& s);  // Outputs a multiline comment.
+
+    // Starts a control block.  This works both for Java and C++.
+    void startBlock() {
+        *this << " {\n";
+        increaseIndent();
+    }
+
+    // Ends a control block.
+    void endBlock(bool addSemicolon = false) {
+        decreaseIndent();
+        indent() << "}" << (addSemicolon ? ";" : "") << "\n";
+    }
+
+    /* Indents the line.  By returning *this, we can use like this:
+     *  mOut.ident() << "a = b;\n";
+     */
+    std::ofstream& indent() {
+        *this << mIndent;
+        return *this;
+    }
+
+    std::ofstream& indentPlus() {
+        *this << mIndent << std::string(2 * TAB_SIZE, ' ');
+        return *this;
+    }
+};
+
+extern const char AUTO_GENERATED_WARNING[];
+
+#endif  // ANDROID_RS_API_GENERATOR_UTILITIES_H
diff --git a/api/gen_runtime.cpp b/api/gen_runtime.cpp
deleted file mode 100644
index 812a755..0000000
--- a/api/gen_runtime.cpp
+++ /dev/null
@@ -1,1969 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* This program processes Renderscript function definitions described in spec files.
- * For each spec file provided on the command line, it generates a corresponding
- * Renderscript header (*.rsh) which is meant for inclusion in client scripts.
- *
- * This program also generates Junit test files to automatically test each of the
- * functions using randomly generated data.  We create two files for each function:
- * - a Renderscript file named Test{Function}.rs,
- * - a Junit file named Test{function}.java, which calls the above RS file.
- *
- * This program takes an optional -v parameter, the RS version to target the
- * test files for.  The header file will always contain all the functions.
- *
- * This program contains five main classes:
- * - SpecFile: Represents on spec file.
- * - Function: Each instance represents a function, like clamp.  Even though the
- *      spec file contains many entries for clamp, we'll only have one clamp instance.
- * - Specification: Defines one of the many variations of the function.  There's
- *      a one to one correspondance between Specification objects and entries in the
- *      spec file.  Strings that are parts of a Specification can include placeholders,
- *      which are "#1", "#2", "#3", and "#4".  We'll replace these by values before
- *      generating the files.
- * - Permutation: A concrete version of a specification, where all placeholders have
- *      been replaced by actual values.
- * - ParameterDefinition: A definition of a parameter of a concrete function.
- */
-
-#include <math.h>
-#include <stdio.h>
-#include <cctype>
-#include <cstdlib>
-#include <fstream>
-#include <functional>
-#include <iomanip>
-#include <list>
-#include <map>
-#include <set>
-#include <sstream>
-#include <string>
-#include <vector>
-
-using namespace std;
-
-namespace {
-
-const char* AUTO_GENERATED_WARNING =
-            "// Don't edit this file!  It is auto-generated by "
-            "frameworks/rs/api/gen_runtime.\n\n";
-const char* LEGAL_NOTICE =
-            "/*\n"
-            " * Copyright (C) 2014 The Android Open Source Project\n"
-            " *\n"
-            " * Licensed under the Apache License, Version 2.0 (the \"License\");\n"
-            " * you may not use this file except in compliance with the License.\n"
-            " * You may obtain a copy of the License at\n"
-            " *\n"
-            " *      http://www.apache.org/licenses/LICENSE-2.0\n"
-            " *\n"
-            " * Unless required by applicable law or agreed to in writing, software\n"
-            " * distributed under the License is distributed on an \"AS IS\" BASIS,\n"
-            " * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n"
-            " * See the License for the specific language governing permissions and\n"
-            " * limitations under the License.\n"
-            " */\n\n";
-const char* DOX_HEADER =
-            "/** @file\n"
-            " *\n"
-            " */\n\n";
-
-class Function;
-class Specification;
-class Permutation;
-struct Type;
-
-/* Information about a parameter to a function.  The values of all the fields should only be set by
- * parseParameterDefinition.
- */
-struct ParameterDefinition {
-    string rsType;        // The Renderscript type, e.g. "uint3"
-    string rsBaseType;    // As above but without the number, e.g. "uint"
-    string javaBaseType;  // The type we need to declare in Java, e.g. "unsigned int"
-    string specType;      // The type found in the spec, e.g. "f16"
-    bool isFloatType;     // True if it's a floating point value
-
-    /* The number of entries in the vector.  It should be either "1", "2", "3", or "4".  It's also
-     * "1" for scalars.
-     */
-    string mVectorSize;
-    /* The space the vector takes in an array.  It's the same as the vector size, except for size
-     * "3", where the width is "4".
-     */
-    string vectorWidth;
-
-    string specName;       // e.g. x, as found in the spec file
-    string variableName;   // e.g. inX, used both in .rs and .java
-    string rsAllocName;    // e.g. gAllocInX
-    string javaAllocName;  // e.g. inX
-    string javaArrayName;  // e.g. arrayInX
-
-    // If non empty, the mininum and maximum values to be used when generating the test data.
-    string minValue;
-    string maxValue;
-    /* If non empty, contains the name of another parameter that should be smaller or equal to this
-     * parameter, i.e.  value(smallerParameter) <= value(this).  This is used when testing clamp.
-     */
-    string smallerParameter;
-
-    bool isOutParameter;       // True if this parameter returns data from the script.
-    bool undefinedIfOutIsNan;  // If true, we don't validate if 'out' is NaN.
-
-    int typeIndex;            // Index in the TYPES array.
-    int compatibleTypeIndex;  // Index in TYPES for which the test data must also fit.
-
-    /* Parse the parameter definition found in the spec file.  It will generate a name if none
-     * are present in the file.  One of the two counts will be incremented, and potentially
-     * used to generate unique names.  isReturn is true if we're processing the "return:"
-     * definition.
-     */
-    void parseParameterDefinition(string s, bool isReturn, int* inputCount, int* outputCount);
-};
-
-// An entire spec file and the methods to process it.
-class SpecFile {
-public:
-    explicit SpecFile(const string& specFileName) : mSpecFileName(specFileName) {}
-    bool process(int versionOfTestFiles);
-
-private:
-    const string mSpecFileName;
-    // The largest version number that we have found in all the specifications.
-    int mLargestVersionNumber;
-
-    map<string, Function*> mFunctionsMap;  // All the known functions.
-    typedef map<string, Function*>::iterator FunctionsIterator;
-
-    bool readSpecFile();
-    Function* getFunction(const string& name);
-    bool generateFiles(int versionOfTestFiles);
-    bool writeAllFunctions(ofstream& headerFile, int versionOfTestFiles);
-};
-
-/* Represents a function, like "clamp".  Even though the spec file contains many entries for clamp,
- * we'll only have one clamp instance.
- */
-class Function {
-private:
-    string mName;             // The lower case name, e.g. native_log
-    string mCapitalizedName;  // The capitalized name, e.g. NativeLog
-    string mTestName;         // e.g. GeneratedTestNativeLog
-    string mRelaxedTestName;  // e.g. GeneratedTestNativeLogRelaxed
-
-    vector<Specification*> mSpecifications;
-    typedef vector<Specification*>::iterator SpecificationIterator;
-
-    /* We keep track of the allocations generated in the .rs file and the argument classes defined
-     * in the Java file, as we share these between the functions created for each specification.
-     */
-    set<string> mRsAllocationsGenerated;
-    set<string> mJavaGeneratedArgumentClasses;
-
-    string mJavaCallAllCheckMethods;  // Lines of Java code to invoke the check methods.
-
-    ofstream mRsFile;    // The Renderscript test file we're generating.
-    ofstream mJavaFile;  // The Jave test file we're generating.
-
-    bool startRsFile();         // Open the mRsFile and writes its header.
-    bool writeRelaxedRsFile();  // Write the entire relaxed rs test file (an include essentially)
-    bool startJavaFile();       // Open the mJavaFile and writes the header.
-    void finishJavaFile();      // Write the test method and closes the file.
-
-public:
-    explicit Function(const string& name);
-    void addSpecification(Specification* spec) { mSpecifications.push_back(spec); }
-    /* Write the .java and the two .rs test files.  versionOfTestFiles is used to restrict which API
-     * to test.  Also writes the section of the header file.
-     */
-    bool writeFiles(ofstream& headerFile, int versionOfTestFiles);
-    // Write an allocation and keep track of having it written, so it can be shared.
-    void writeRsAllocationDefinition(const ParameterDefinition& param);
-    // Write an argument class definiton and keep track of having it written, so it can be shared.
-    void writeJavaArgumentClassDefinition(const string& className, const string& definition);
-    // Add a call to mJavaCallAllCheckMethods to be used at the end of the file generation.
-    void addJavaCheckCall(const string& call);
-};
-
-/* Defines one of the many variations of the function.  There's a one to one correspondance between
- * Specification objects and entries in the spec file.  Some of the strings that are parts of a
- * Specification can include placeholders, which are "#1", "#2", "#3", and "#4".  We'll replace
- * these by values before generating the files.
- */
-class Specification {
-private:
-    /* The range of versions this specification applies to. 0 if there's no restriction, so an API
-     * that became available at 9 and is still valid would have min:9 max:0.
-     */
-    int mMinVersion;
-    int mMaxVersion;
-
-    /* The name of the function without #n, e.g. convert.  As of this writing, it only differs for
-     * convert.
-     */
-    string mCleanName;
-    /* How to test.  One of:
-     * "scalar": Generate test code that checks entries of each vector indepently.  E.g. for
-     *           sin(float3), the test code will call the CoreMathVerfier.computeSin 3 times.
-     * "vector": Generate test code that calls the CoreMathVerifier only once for each vector.
-     *           This is useful for APIs like dot() or length().
-     * "noverify": Generate test code that calls the API but don't verify the returned value.
-     * "limited": Like "scalar" but tests a limited range of input values.
-     * "custom": Like "scalar" but instead of calling CoreMathVerifier.computeXXX() to compute
-     *           the expected value, we call instead CoreMathVerifier.verifyXXX().  This method
-     *           returns a string that contains the error message, null if there's no error.
-     */
-    string mTest;
-    string mPrecisionLimit;  // Maximum precision required when checking output of this function.
-
-    vector<vector<string> > mReplaceables;
-
-    // The following fields may contain placeholders that will be replaced using the mReplaceables.
-
-    // The name of this function, can include #, e.g. convert_#1_#2
-    string mName;
-
-    string mReturn;           // The return type
-    vector<string> mComment;  // The comments to be included in the header
-    vector<string> mInline;   // The inline code to be included in the header
-    vector<string> mParam;    // One entry per parameter defined
-
-    // Substitute the placeholders in the strings by the corresponding entries in mReplaceables.
-    string expandString(string s, int i1, int i2, int i3, int i4) const;
-    void expandStringVector(const vector<string>& in, int i1, int i2, int i3, int i4,
-                            vector<string>* out) const;
-
-public:
-    Specification() {
-        mMinVersion = 0;
-        mMaxVersion = 0;
-    }
-    int getMinVersion() const { return mMinVersion; }
-    int getMaxVersion() const { return mMaxVersion; }
-
-    string getName(int i1, int i2, int i3, int i4) const {
-        return expandString(mName, i1, i2, i3, i4);
-    }
-    string getReturn(int i1, int i2, int i3, int i4) const {
-        return expandString(mReturn, i1, i2, i3, i4);
-    }
-    void getComments(int i1, int i2, int i3, int i4, vector<string>* comments) const {
-        return expandStringVector(mComment, i1, i2, i3, i4, comments);
-    }
-    void getInlines(int i1, int i2, int i3, int i4, vector<string>* inlines) const {
-        return expandStringVector(mInline, i1, i2, i3, i4, inlines);
-    }
-    void getParams(int i1, int i2, int i3, int i4, vector<string>* params) const {
-        return expandStringVector(mParam, i1, i2, i3, i4, params);
-    }
-    string getTest() const { return mTest; }
-    string getPrecisionLimit() const { return mPrecisionLimit; }
-    string getCleanName() const { return mCleanName; }
-
-    void writeFiles(ofstream& headerFile, ofstream& rsFile, ofstream& javaFile, Function* function,
-                    int versionOfTestFiles);
-    bool writeRelaxedRsFile() const;
-    // Return true if this specification should be generated for this version.
-    bool relevantForVersion(int versionOfTestFiles) const;
-
-    static Specification* scanSpecification(FILE* in);
-};
-
-// A concrete version of a specification, where all placeholders have been replaced by actual
-// values.
-class Permutation {
-private:
-    Function* mFunction;
-    Specification* mSpecification;
-
-    // These are the expanded version of those found on Specification
-    string mName;
-    string mCleanName;
-    string mTest;  // How to test.  One of "scalar", "vector", "noverify", "limited", and "none".
-    string mPrecisionLimit;  // Maximum precision required when checking output of this function.
-    vector<string> mInline;
-    vector<string> mComment;
-
-    // The inputs and outputs of the function.  This include the return type, if present.
-    vector<ParameterDefinition*> mParams;
-    // The index of the return value in mParams, -1 if the function is void.
-    int mReturnIndex;
-    // The index of the first input value in mParams, -1 if there's no input.
-    int mFirstInputIndex;
-    // The number of input and output parameters.
-    int mInputCount;
-    int mOutputCount;
-    // Whether one of the output parameters is a float.
-    bool mHasFloatAnswers;
-
-    string mRsKernelName;
-    string mJavaArgumentsClassName;
-    string mJavaArgumentsNClassName;
-    string mJavaVerifierComputeMethodName;
-    string mJavaVerifierVerifyMethodName;
-    string mJavaCheckMethodName;
-    string mJavaVerifyMethodName;
-
-    void writeHeaderSection(ofstream& file) const;
-
-    void writeRsSection(ofstream& rs) const;
-
-    void writeJavaSection(ofstream& file) const;
-    void writeJavaArgumentClass(ofstream& file, bool scalar) const;
-    void writeJavaCheckMethod(ofstream& file, bool generateCallToVerifier) const;
-    void writeJavaVerifyScalarMethod(ofstream& file, bool verifierValidates) const;
-    void writeJavaVerifyVectorMethod(ofstream& file) const;
-    void writeJavaVerifyFunctionHeader(ofstream& file) const;
-    void writeJavaInputAllocationDefinition(ofstream& file, const string& indent,
-                                            const ParameterDefinition& param) const;
-    void writeJavaOutputAllocationDefinition(ofstream& file, const string& indent,
-                                             const ParameterDefinition& param) const;
-    // Write code to create a random allocation for which the data must be compatible for two types.
-    void writeJavaRandomCompatibleFloatAllocation(ofstream& file, const string& dataType,
-                                                  const string& seed, char vectorSize,
-                                                  const Type& compatibleType,
-                                                  const Type& generatedType) const;
-    void writeJavaRandomCompatibleIntegerAllocation(ofstream& file, const string& dataType,
-                                                    const string& seed, char vectorSize,
-                                                    const Type& compatibleType,
-                                                    const Type& generatedType) const;
-    void writeJavaCallToRs(ofstream& file, bool relaxed, bool generateCallToVerifier) const;
-
-    void writeJavaTestAndSetValid(ofstream& file, int indent, const ParameterDefinition& p,
-                                  const string& argsIndex, const string& actualIndex) const;
-    void writeJavaTestOneValue(ofstream& file, int indent, const ParameterDefinition& p,
-                               const string& argsIndex, const string& actualIndex) const;
-    void writeJavaAppendOutputToMessage(ofstream& file, int indent, const ParameterDefinition& p,
-                                        const string& argsIndex, const string& actualIndex,
-                                        bool verifierValidates) const;
-    void writeJavaAppendInputToMessage(ofstream& file, int indent, const ParameterDefinition& p,
-                                       const string& actual) const;
-    void writeJavaAppendNewLineToMessage(ofstream& file, int indent) const;
-    void writeJavaAppendVariableToMessage(ofstream& file, int indent, const ParameterDefinition& p,
-                                          const string& value) const;
-    void writeJavaAppendFloatVariableToMessage(ofstream& file, int indent, const string& value,
-                                               bool regularFloat) const;
-    void writeJavaVectorComparison(ofstream& file, int indent, const ParameterDefinition& p) const;
-    void writeJavaAppendVectorInputToMessage(ofstream& file, int indent,
-                                             const ParameterDefinition& p) const;
-    void writeJavaAppendVectorOutputToMessage(ofstream& file, int indent,
-                                              const ParameterDefinition& p) const;
-    bool passByAddressToSet(const string& name) const;
-    void convertToRsType(const string& name, string* dataType, char* vectorSize) const;
-
-public:
-    Permutation(Function* function, Specification* specification, int i1, int i2, int i3, int i4);
-    void writeFiles(ofstream& headerFile, ofstream& rsFile, ofstream& javaFile,
-                    int versionOfTestFiles);
-};
-
-// Table of type equivalences
-// TODO: We should just be pulling this from a shared header. Slang does exactly the same thing.
-
-enum NumberKind { SIGNED_INTEGER, UNSIGNED_INTEGER, FLOATING_POINT };
-
-struct Type {
-    const char* specType;  // Name found in the .spec file
-    string rsDataType;     // RS data type
-    string cType;          // Type in a C file
-    const char* javaType;  // Type in a Java file
-    NumberKind kind;
-    /* For integers, number of bits of the number, excluding the sign bit.
-     * For floats, number of implied bits of the mantissa.
-     */
-    int significantBits;
-    // For floats, number of bits of the exponent.  0 for integer types.
-    int exponentBits;
-};
-
-const Type TYPES[] = {{"f16", "FLOAT_16", "half", "half", FLOATING_POINT, 11, 5},
-                      {"f32", "FLOAT_32", "float", "float", FLOATING_POINT, 24, 8},
-                      {"f64", "FLOAT_64", "double", "double", FLOATING_POINT, 53, 11},
-                      {"i8", "SIGNED_8", "char", "byte", SIGNED_INTEGER, 7, 0},
-                      {"u8", "UNSIGNED_8", "uchar", "byte", UNSIGNED_INTEGER, 8, 0},
-                      {"i16", "SIGNED_16", "short", "short", SIGNED_INTEGER, 15, 0},
-                      {"u16", "UNSIGNED_16", "ushort", "short", UNSIGNED_INTEGER, 16, 0},
-                      {"i32", "SIGNED_32", "int", "int", SIGNED_INTEGER, 31, 0},
-                      {"u32", "UNSIGNED_32", "uint", "int", UNSIGNED_INTEGER, 32, 0},
-                      {"i64", "SIGNED_64", "long", "long", SIGNED_INTEGER, 63, 0},
-                      {"u64", "UNSIGNED_64", "ulong", "long", UNSIGNED_INTEGER, 64, 0}};
-
-const int NUM_TYPES = sizeof(TYPES) / sizeof(TYPES[0]);
-
-// Returns the index in TYPES for the provided cType
-int FindCType(const string& cType) {
-    for (int i = 0; i < NUM_TYPES; i++) {
-        if (cType == TYPES[i].cType) {
-            return i;
-        }
-    }
-    return -1;
-}
-
-// Capitalizes and removes underscores.  E.g. converts "native_log" to NativeLog.
-string capitalize(const string& source) {
-    int length = source.length();
-    string result;
-    bool capitalize = true;
-    for (int s = 0; s < length; s++) {
-        if (source[s] == '_') {
-            capitalize = true;
-        } else if (capitalize) {
-            result += toupper(source[s]);
-            capitalize = false;
-        } else {
-            result += source[s];
-        }
-    }
-    return result;
-}
-
-string tab(int n) { return string(n * 4, ' '); }
-
-// Returns a string that's an hexadecimal constant fo the hash of the string.
-string hashString(const string& s) {
-    long hash = 0;
-    for (size_t i = 0; i < s.length(); i++) {
-        hash = hash * 43 + s[i];
-    }
-    stringstream stream;
-    stream << "0x" << std::hex << hash << "l";
-    return stream.str();
-}
-
-// Removes the character from present. Returns true if the string contained the character.
-static bool charRemoved(char c, string* s) {
-    size_t p = s->find(c);
-    if (p != string::npos) {
-        s->erase(p, 1);
-        return true;
-    }
-    return false;
-}
-
-// Return true if the string is already in the set.  Inserts it if not.
-bool testAndSet(const string& flag, set<string>* set) {
-    if (set->find(flag) == set->end()) {
-        set->insert(flag);
-        return false;
-    }
-    return true;
-}
-
-// Convert an int into a string.
-string toString(int n) {
-    char buf[100];
-    snprintf(buf, sizeof(buf), "%d", n);
-    return string(buf);
-}
-
-void trim(string* s, size_t start) {
-    if (start > 0) {
-        s->erase(0, start);
-    }
-
-    while (s->size() && (s->at(0) == ' ')) {
-        s->erase(0, 1);
-    }
-
-    size_t p = s->find_first_of("\n\r");
-    if (p != string::npos) {
-        s->erase(p);
-    }
-
-    while ((s->size() > 0) && (s->at(s->size() - 1) == ' ')) {
-        s->erase(s->size() - 1);
-    }
-}
-
-string stringReplace(string s, string match, string rep) {
-    while (1) {
-        size_t p = s.find(match);
-        if (p == string::npos) break;
-
-        s.erase(p, match.size());
-        s.insert(p, rep);
-    }
-    return s;
-}
-
-// Return the next line from the input file.
-bool getNextLine(FILE* in, string* s) {
-    s->clear();
-    while (1) {
-        int c = fgetc(in);
-        if (c == EOF) return s->size() != 0;
-        if (c == '\n') break;
-        s->push_back((char)c);
-    }
-    return true;
-}
-
-void writeIfdef(ofstream& file, string filename, bool isStart) {
-    string t = "__";
-    t += filename;
-    t += "__";
-
-    for (size_t i = 2; i < t.size(); i++) {
-        if (t[i] == '.') {
-            t[i] = '_';
-        }
-    }
-
-    if (isStart) {
-        file << "#ifndef " << t << "\n";
-        file << "#define " << t << "\n";
-    } else {
-        file << "#endif // " << t << "\n";
-    }
-}
-
-void writeJavaArrayInitialization(ofstream& file, const ParameterDefinition& p) {
-    file << tab(2) << p.javaBaseType << "[] " << p.javaArrayName << " = new " << p.javaBaseType
-         << "[INPUTSIZE * " << p.vectorWidth << "];\n";
-    file << tab(2) << p.javaAllocName << ".copyTo(" << p.javaArrayName << ");\n";
-}
-
-bool parseCommandLine(int argc, char* argv[], int* versionOfTestFiles,
-                      vector<string>* specFileNames) {
-    for (int i = 1; i < argc; i++) {
-        if (argv[i][0] == '-') {
-            if (argv[i][1] == 'v') {
-                i++;
-                if (i < argc) {
-                    char* end;
-                    *versionOfTestFiles = strtol(argv[i], &end, 10);
-                    if (*end != '\0') {
-                        printf("Can't parse the version number %s\n", argv[i]);
-                        return false;
-                    }
-                } else {
-                    printf("Missing version number after -v\n");
-                    return false;
-                }
-            } else {
-                printf("Unrecognized flag %s\n", argv[i]);
-                return false;
-            }
-        } else {
-            specFileNames->push_back(argv[i]);
-        }
-    }
-    if (specFileNames->size() == 0) {
-        printf("No spec file specified\n");
-        return false;
-    }
-    return true;
-}
-
-/* Returns a double that should be able to be converted to an integer of size
- * numberOfIntegerBits.
- */
-static double MaxDoubleForInteger(int numberOfIntegerBits, int mantissaSize) {
-    /* Double has only 52 bits of precision (53 implied). So for longs, we want
-     * to create smaller values to avoid a round up.  Same for floats and halfs.
-     */
-    int lowZeroBits = max(0, numberOfIntegerBits - mantissaSize);
-    unsigned long l = (0xffffffffffffffff >> (64 - numberOfIntegerBits + lowZeroBits))
-                      << lowZeroBits;
-    return (double)l;
-}
-
-/* Parse a parameter definition.  It's of the form "type [*][name]".  The type
- * is required.  The name is optional.  The * indicates it's an output
- * parameter.  We also pass the indexed of this parameter in the definition, so
- * we can create names like in2, in3, etc. */
-void ParameterDefinition::parseParameterDefinition(string s, bool isReturn, int* inputCount,
-                                                   int* outputCount) {
-    istringstream stream(s);
-    string name, type, option;
-    stream >> rsType;
-    stream >> specName;
-    stream >> option;
-
-    // Determine if this is an output.
-    isOutParameter = charRemoved('*', &rsType) || charRemoved('*', &specName) || isReturn;
-
-    // Extract the vector size out of the type.
-    int last = rsType.size() - 1;
-    char lastChar = rsType[last];
-    if (lastChar >= '0' && lastChar <= '9') {
-        rsBaseType = rsType.substr(0, last);
-        mVectorSize = lastChar;
-    } else {
-        rsBaseType = rsType;
-        mVectorSize = "1";
-    }
-    if (mVectorSize == "3") {
-        vectorWidth = "4";
-    } else {
-        vectorWidth = mVectorSize;
-    }
-
-    /* Create variable names to be used in the java and .rs files.  Because x and
-     * y are reserved in .rs files, we prefix variable names with "in" or "out".
-     */
-    if (isOutParameter) {
-        variableName = "out";
-        if (!specName.empty()) {
-            variableName += capitalize(specName);
-        } else if (!isReturn) {
-            variableName += toString(*outputCount);
-        }
-        (*outputCount)++;
-    } else {
-        variableName = "in";
-        if (!specName.empty()) {
-            variableName += capitalize(specName);
-        } else if (*inputCount > 0) {
-            variableName += toString(*inputCount);
-        }
-        (*inputCount)++;
-    }
-    rsAllocName = "gAlloc" + capitalize(variableName);
-    javaAllocName = variableName;
-    javaArrayName = "array" + capitalize(javaAllocName);
-
-    // Process the option.
-    undefinedIfOutIsNan = false;
-    compatibleTypeIndex = -1;
-    if (!option.empty()) {
-        if (option.compare(0, 6, "range(") == 0) {
-            size_t pComma = option.find(',');
-            size_t pParen = option.find(')');
-            if (pComma == string::npos || pParen == string::npos) {
-                printf("Incorrect range %s\n", option.c_str());
-            } else {
-                minValue = option.substr(6, pComma - 6);
-                maxValue = option.substr(pComma + 1, pParen - pComma - 1);
-            }
-        } else if (option.compare(0, 6, "above(") == 0) {
-            size_t pParen = option.find(')');
-            if (pParen == string::npos) {
-                printf("Incorrect option %s\n", option.c_str());
-            } else {
-                smallerParameter = option.substr(6, pParen - 6);
-            }
-        } else if (option.compare(0, 11, "compatible(") == 0) {
-            size_t pParen = option.find(')');
-            if (pParen == string::npos) {
-                printf("Incorrect option %s\n", option.c_str());
-            } else {
-                compatibleTypeIndex = FindCType(option.substr(11, pParen - 11));
-            }
-        } else if (option.compare(0, 11, "conditional") == 0) {
-            undefinedIfOutIsNan = true;
-        } else {
-            printf("Unrecognized option %s\n", option.c_str());
-        }
-    }
-
-    typeIndex = FindCType(rsBaseType);
-    isFloatType = false;
-    if (typeIndex < 0) {
-        // TODO set a global flag when we encounter an error & abort
-        printf("Error, could not find %s\n", rsBaseType.c_str());
-    } else {
-        javaBaseType = TYPES[typeIndex].javaType;
-        specType = TYPES[typeIndex].specType;
-        isFloatType = TYPES[typeIndex].exponentBits > 0;
-    }
-}
-
-bool SpecFile::process(int versionOfTestFiles) {
-    if (!readSpecFile()) {
-        return false;
-    }
-    if (versionOfTestFiles == 0) {
-        versionOfTestFiles = mLargestVersionNumber;
-    }
-    if (!generateFiles(versionOfTestFiles)) {
-        return false;
-    }
-    printf("%s: %ld functions processed.\n", mSpecFileName.c_str(), mFunctionsMap.size());
-    return true;
-}
-
-// Read the specification, adding the definitions to the global functions map.
-bool SpecFile::readSpecFile() {
-    FILE* specFile = fopen(mSpecFileName.c_str(), "rt");
-    if (!specFile) {
-        printf("Error opening input file: %s\n", mSpecFileName.c_str());
-        return false;
-    }
-
-    mLargestVersionNumber = 0;
-    while (1) {
-        Specification* spec = Specification::scanSpecification(specFile);
-        if (spec == nullptr) {
-            break;
-        }
-        getFunction(spec->getCleanName())->addSpecification(spec);
-        int specMin = spec->getMinVersion();
-        int specMax = spec->getMaxVersion();
-        if (specMin && specMin > mLargestVersionNumber) {
-            mLargestVersionNumber = specMin;
-        }
-        if (specMax && specMax > mLargestVersionNumber) {
-            mLargestVersionNumber = specMax;
-        }
-    }
-
-    fclose(specFile);
-    return true;
-}
-
-bool SpecFile::generateFiles(int versionOfTestFiles) {
-    printf("%s: Generating test files for version %d\n", mSpecFileName.c_str(), versionOfTestFiles);
-
-    // The header file name should have the same base but with a ".rsh" extension.
-    string headerFileName = mSpecFileName;
-    size_t l = headerFileName.length();
-    const char SPEC[] = ".spec";
-    const int SPEC_SIZE = sizeof(SPEC) - 1;
-    const int start = l - SPEC_SIZE;
-    if (start >= 0 && headerFileName.compare(start, SPEC_SIZE, SPEC) == 0) {
-        headerFileName.erase(start);
-    }
-    headerFileName += ".rsh";
-
-    // Write the start of the header file.
-    ofstream headerFile;
-    headerFile.open(headerFileName.c_str(), ios::out | ios::trunc);
-    if (!headerFile.is_open()) {
-        printf("Error opening output file: %s\n", headerFileName.c_str());
-        return false;
-    }
-    headerFile << LEGAL_NOTICE;
-    headerFile << AUTO_GENERATED_WARNING;
-    headerFile << DOX_HEADER;
-
-    writeIfdef(headerFile, headerFileName, true);
-
-    // Write the functions to the header and test files.
-    bool success = writeAllFunctions(headerFile, versionOfTestFiles);
-
-    // Finish the header file.
-    writeIfdef(headerFile, headerFileName, false);
-    headerFile.close();
-
-    return success;
-}
-
-// Return the named function from the map.  Creates it if it's not there.
-Function* SpecFile::getFunction(const string& name) {
-    FunctionsIterator iter = mFunctionsMap.find(name);
-    if (iter != mFunctionsMap.end()) {
-        return iter->second;
-    }
-    Function* f = new Function(name);
-    mFunctionsMap[name] = f;
-    return f;
-}
-
-bool SpecFile::writeAllFunctions(ofstream& headerFile, int versionOfTestFiles) {
-    bool success = true;
-    for (FunctionsIterator iter = mFunctionsMap.begin(); iter != mFunctionsMap.end(); iter++) {
-        Function* func = iter->second;
-        if (!func->writeFiles(headerFile, versionOfTestFiles)) {
-            success = false;
-        }
-    }
-    return success;
-}
-
-Function::Function(const string& name) {
-    mName = name;
-    mCapitalizedName = capitalize(mName);
-    mTestName = "GeneratedTest" + mCapitalizedName;
-    mRelaxedTestName = mTestName + "Relaxed";
-}
-
-bool Function::writeFiles(ofstream& headerFile, int versionOfTestFiles) {
-    if (!startRsFile() || !startJavaFile() || !writeRelaxedRsFile()) {
-        return false;
-    }
-
-    for (SpecificationIterator i = mSpecifications.begin(); i < mSpecifications.end(); i++) {
-        (*i)->writeFiles(headerFile, mRsFile, mJavaFile, this, versionOfTestFiles);
-    }
-
-    finishJavaFile();
-    // There's no work to wrap-up in the .rs file.
-
-    mRsFile.close();
-    mJavaFile.close();
-    return true;
-}
-
-bool Function::startRsFile() {
-    string fileName = mTestName + ".rs";
-    mRsFile.open(fileName.c_str(), ios::out | ios::trunc);
-    if (!mRsFile.is_open()) {
-        printf("Error opening file: %s\n", fileName.c_str());
-        return false;
-    }
-    mRsFile << LEGAL_NOTICE;
-    mRsFile << "#pragma version(1)\n";
-    mRsFile << "#pragma rs java_package_name(android.renderscript.cts)\n\n";
-    mRsFile << AUTO_GENERATED_WARNING;
-    return true;
-}
-
-// Write an allocation definition if not already emitted in the .rs file.
-void Function::writeRsAllocationDefinition(const ParameterDefinition& param) {
-    if (!testAndSet(param.rsAllocName, &mRsAllocationsGenerated)) {
-        mRsFile << "rs_allocation " << param.rsAllocName << ";\n";
-    }
-}
-
-// Write the entire *Relaxed.rs test file, as it only depends on the name.
-bool Function::writeRelaxedRsFile() {
-    string name = mRelaxedTestName + ".rs";
-    FILE* file = fopen(name.c_str(), "wt");
-    if (!file) {
-        printf("Error opening file: %s\n", name.c_str());
-        return false;
-    }
-    fputs(LEGAL_NOTICE, file);
-    string s;
-    s += "#include \"" + mTestName + ".rs\"\n";
-    s += "#pragma rs_fp_relaxed\n";
-    s += AUTO_GENERATED_WARNING;
-    fputs(s.c_str(), file);
-    fclose(file);
-    return true;
-}
-
-bool Function::startJavaFile() {
-    string fileName = mTestName + ".java";
-    mJavaFile.open(fileName.c_str(), ios::out | ios::trunc);
-    if (!mJavaFile.is_open()) {
-        printf("Error opening file: %s\n", fileName.c_str());
-        return false;
-    }
-    mJavaFile << LEGAL_NOTICE;
-    mJavaFile << AUTO_GENERATED_WARNING;
-    mJavaFile << "package android.renderscript.cts;\n\n";
-
-    mJavaFile << "import android.renderscript.Allocation;\n";
-    mJavaFile << "import android.renderscript.RSRuntimeException;\n";
-    mJavaFile << "import android.renderscript.Element;\n\n";
-
-    mJavaFile << "public class " << mTestName << " extends RSBaseCompute {\n\n";
-
-    mJavaFile << tab(1) << "private ScriptC_" << mTestName << " script;\n";
-    mJavaFile << tab(1) << "private ScriptC_" << mRelaxedTestName << " scriptRelaxed;\n\n";
-
-    mJavaFile << tab(1) << "@Override\n";
-    mJavaFile << tab(1) << "protected void setUp() throws Exception {\n";
-    mJavaFile << tab(2) << "super.setUp();\n";
-    mJavaFile << tab(2) << "script = new ScriptC_" << mTestName << "(mRS);\n";
-    mJavaFile << tab(2) << "scriptRelaxed = new ScriptC_" << mRelaxedTestName << "(mRS);\n";
-    mJavaFile << tab(1) << "}\n\n";
-    return true;
-}
-
-void Function::writeJavaArgumentClassDefinition(const string& className, const string& definition) {
-    if (!testAndSet(className, &mJavaGeneratedArgumentClasses)) {
-        mJavaFile << definition;
-    }
-}
-
-void Function::addJavaCheckCall(const string& call) {
-    mJavaCallAllCheckMethods += tab(2) + call + "\n";
-}
-
-void Function::finishJavaFile() {
-    mJavaFile << tab(1) << "public void test" << mCapitalizedName << "() {\n";
-    mJavaFile << mJavaCallAllCheckMethods;
-    mJavaFile << tab(1) << "}\n";
-    mJavaFile << "}\n";
-}
-
-void Specification::expandStringVector(const vector<string>& in, int i1, int i2, int i3, int i4,
-                                       vector<string>* out) const {
-    out->clear();
-    for (vector<string>::const_iterator iter = in.begin(); iter != in.end(); iter++) {
-        out->push_back(expandString(*iter, i1, i2, i3, i4));
-    }
-}
-
-Specification* Specification::scanSpecification(FILE* in) {
-    Specification* spec = new Specification();
-    spec->mTest = "scalar";  // default
-    bool modeComment = false;
-    bool modeInline = false;
-    bool success = true;
-
-    while (1) {
-        string s;
-        bool ret = getNextLine(in, &s);
-        if (!ret) break;
-
-        if (modeComment) {
-            if (!s.size() || (s[0] == ' ')) {
-                trim(&s, 0);
-                spec->mComment.push_back(s);
-                continue;
-            } else {
-                modeComment = false;
-            }
-        }
-
-        if (modeInline) {
-            if (!s.size() || (s[0] == ' ')) {
-                trim(&s, 0);
-                spec->mInline.push_back(s);
-                continue;
-            } else {
-                modeInline = false;
-            }
-        }
-
-        if (s[0] == '#') {
-            continue;
-        }
-
-        if (s.compare(0, 5, "name:") == 0) {
-            trim(&s, 5);
-            spec->mName = s;
-            // Some functions like convert have # part of the name.  Truncate at that point.
-            size_t p = s.find('#');
-            if (p != string::npos) {
-                if (p > 0 && s[p - 1] == '_') {
-                    p--;
-                }
-                s.erase(p);
-            }
-            spec->mCleanName = s;
-            continue;
-        }
-
-        if (s.compare(0, 4, "arg:") == 0) {
-            trim(&s, 4);
-            spec->mParam.push_back(s);
-            continue;
-        }
-
-        if (s.compare(0, 4, "ret:") == 0) {
-            trim(&s, 4);
-            spec->mReturn = s;
-            continue;
-        }
-
-        if (s.compare(0, 5, "test:") == 0) {
-            trim(&s, 5);
-            if (s == "scalar" || s == "vector" || s == "noverify" || s == "custom" || s == "none") {
-                spec->mTest = s;
-            } else if (s.compare(0, 7, "limited") == 0) {
-                spec->mTest = "limited";
-                if (s.compare(7, 1, "(") == 0) {
-                    size_t pParen = s.find(')');
-                    if (pParen == string::npos) {
-                        printf("Incorrect test %s\n", s.c_str());
-                    } else {
-                        spec->mPrecisionLimit = s.substr(8, pParen - 8);
-                    }
-                }
-            } else {
-                printf("Error: Unrecognized test option: %s\n", s.c_str());
-                success = false;
-            }
-            continue;
-        }
-
-        if (s.compare(0, 4, "end:") == 0) {
-            if (success) {
-                return spec;
-            } else {
-                delete spec;
-                return nullptr;
-            }
-        }
-
-        if (s.compare(0, 8, "comment:") == 0) {
-            modeComment = true;
-            continue;
-        }
-
-        if (s.compare(0, 7, "inline:") == 0) {
-            modeInline = true;
-            continue;
-        }
-
-        if (s.compare(0, 8, "version:") == 0) {
-            trim(&s, 8);
-            sscanf(s.c_str(), "%i %i", &spec->mMinVersion, &spec->mMaxVersion);
-            continue;
-        }
-
-        if (s.compare(0, 8, "start:") == 0) {
-            continue;
-        }
-
-        if (s.compare(0, 2, "w:") == 0) {
-            vector<string> t;
-            if (s.find("1") != string::npos) {
-                t.push_back("");
-            }
-            if (s.find("2") != string::npos) {
-                t.push_back("2");
-            }
-            if (s.find("3") != string::npos) {
-                t.push_back("3");
-            }
-            if (s.find("4") != string::npos) {
-                t.push_back("4");
-            }
-            spec->mReplaceables.push_back(t);
-            continue;
-        }
-
-        if (s.compare(0, 2, "t:") == 0) {
-            vector<string> t;
-            for (int i = 0; i < NUM_TYPES; i++) {
-                if (s.find(TYPES[i].specType) != string::npos) {
-                    t.push_back(TYPES[i].cType);
-                }
-            }
-            spec->mReplaceables.push_back(t);
-            continue;
-        }
-
-        if (s.size() == 0) {
-            // eat empty line
-            continue;
-        }
-
-        printf("Error, line:\n");
-        printf("  %s\n", s.c_str());
-    }
-
-    delete spec;
-    return nullptr;
-}
-
-void Specification::writeFiles(ofstream& headerFile, ofstream& rsFile, ofstream& javaFile,
-                               Function* function, int versionOfTestFiles) {
-    int start[4];
-    int end[4];
-    for (int i = 0; i < 4; i++) {
-        if (i < (int)mReplaceables.size()) {
-            start[i] = 0;
-            end[i] = mReplaceables[i].size();
-        } else {
-            start[i] = -1;
-            end[i] = 0;
-        }
-    }
-    for (int i4 = start[3]; i4 < end[3]; i4++) {
-        for (int i3 = start[2]; i3 < end[2]; i3++) {
-            for (int i2 = start[1]; i2 < end[1]; i2++) {
-                for (int i1 = start[0]; i1 < end[0]; i1++) {
-                    Permutation p(function, this, i1, i2, i3, i4);
-                    p.writeFiles(headerFile, rsFile, javaFile, versionOfTestFiles);
-                }
-            }
-        }
-    }
-}
-
-bool Specification::relevantForVersion(int versionOfTestFiles) const {
-    if (mMinVersion != 0 && mMinVersion > versionOfTestFiles) {
-        return false;
-    }
-    if (mMaxVersion != 0 && mMaxVersion < versionOfTestFiles) {
-        return false;
-    }
-    return true;
-}
-
-string Specification::expandString(string s, int i1, int i2, int i3, int i4) const {
-    if (mReplaceables.size() > 0) {
-        s = stringReplace(s, "#1", mReplaceables[0][i1]);
-    }
-    if (mReplaceables.size() > 1) {
-        s = stringReplace(s, "#2", mReplaceables[1][i2]);
-    }
-    if (mReplaceables.size() > 2) {
-        s = stringReplace(s, "#3", mReplaceables[2][i3]);
-    }
-    if (mReplaceables.size() > 3) {
-        s = stringReplace(s, "#4", mReplaceables[3][i4]);
-    }
-    return s;
-}
-
-Permutation::Permutation(Function* func, Specification* spec, int i1, int i2, int i3, int i4)
-    : mFunction(func),
-      mSpecification(spec),
-      mReturnIndex(-1),
-      mFirstInputIndex(-1),
-      mInputCount(0),
-      mOutputCount(0) {
-    // We expand the strings now to make capitalization easier.  The previous code preserved the #n
-    // markers just before emitting, which made capitalization difficult.
-    mName = spec->getName(i1, i2, i3, i4);
-    mCleanName = spec->getCleanName();
-    mTest = spec->getTest();
-    mPrecisionLimit = spec->getPrecisionLimit();
-    spec->getInlines(i1, i2, i3, i4, &mInline);
-    spec->getComments(i1, i2, i3, i4, &mComment);
-
-    vector<string> paramDefinitions;
-    spec->getParams(i1, i2, i3, i4, &paramDefinitions);
-    mHasFloatAnswers = false;
-    for (size_t i = 0; i < paramDefinitions.size(); i++) {
-        ParameterDefinition* def = new ParameterDefinition();
-        def->parseParameterDefinition(paramDefinitions[i], false, &mInputCount, &mOutputCount);
-        if (!def->isOutParameter && mFirstInputIndex < 0) {
-            mFirstInputIndex = mParams.size();
-        }
-        if (def->isOutParameter && def->isFloatType) {
-            mHasFloatAnswers = true;
-        }
-        mParams.push_back(def);
-    }
-
-    const string s = spec->getReturn(i1, i2, i3, i4);
-    if (!s.empty() && s != "void") {
-        ParameterDefinition* def = new ParameterDefinition();
-        // Adding "*" tells the parse method it's an output.
-        def->parseParameterDefinition(s, true, &mInputCount, &mOutputCount);
-        if (def->isOutParameter && def->isFloatType) {
-            mHasFloatAnswers = true;
-        }
-        mReturnIndex = mParams.size();
-        mParams.push_back(def);
-    }
-
-    mRsKernelName = "test" + capitalize(mName);
-    mJavaArgumentsClassName = "Arguments";
-    mJavaArgumentsNClassName = "Arguments";
-    mJavaCheckMethodName = "check" + capitalize(mCleanName);
-    mJavaVerifyMethodName = "verifyResults" + capitalize(mCleanName);
-    for (int i = 0; i < (int)mParams.size(); i++) {
-        const ParameterDefinition& p = *mParams[i];
-        mRsKernelName += capitalize(p.rsType);
-        mJavaArgumentsClassName += capitalize(p.rsBaseType);
-        mJavaArgumentsNClassName += capitalize(p.rsBaseType);
-        if (p.mVectorSize != "1") {
-            mJavaArgumentsNClassName += "N";
-        }
-        mJavaCheckMethodName += capitalize(p.rsType);
-        mJavaVerifyMethodName += capitalize(p.rsType);
-    }
-    mJavaVerifierComputeMethodName = "compute" + capitalize(mCleanName);
-    mJavaVerifierVerifyMethodName = "verify" + capitalize(mCleanName);
-}
-
-void Permutation::writeFiles(ofstream& headerFile, ofstream& rsFile, ofstream& javaFile,
-                             int versionOfTestFiles) {
-    writeHeaderSection(headerFile);
-    if (mSpecification->relevantForVersion(versionOfTestFiles) && mTest != "none") {
-        writeRsSection(rsFile);
-        writeJavaSection(javaFile);
-    }
-}
-
-void Permutation::writeHeaderSection(ofstream& file) const {
-    int minVersion = mSpecification->getMinVersion();
-    int maxVersion = mSpecification->getMaxVersion();
-    bool hasVersion = minVersion || maxVersion;
-
-    if (hasVersion) {
-        if (maxVersion) {
-            file << "#if (defined(RS_VERSION) && (RS_VERSION >= " << minVersion
-                 << ") && (RS_VERSION <= " << maxVersion << "))\n";
-        } else {
-            file << "#if (defined(RS_VERSION) && (RS_VERSION >= " << minVersion << "))\n";
-        }
-    }
-
-    file << "/**\n";
-    for (size_t ct = 0; ct < mComment.size(); ct++) {
-        if (!mComment[ct].empty()) {
-            file << " * " << mComment[ct] << "\n";
-        } else {
-            file << " *\n";
-        }
-    }
-    file << " *\n";
-    if (minVersion || maxVersion) {
-        if (maxVersion) {
-            file << " * Suppored by API versions " << minVersion << " - " << maxVersion << "\n";
-        } else {
-            file << " * Supported by API versions " << minVersion << " and newer.\n";
-        }
-    }
-    file << " */\n";
-    if (mInline.size() > 0) {
-        file << "static ";
-    } else {
-        file << "extern ";
-    }
-    if (mReturnIndex >= 0) {
-        file << mParams[mReturnIndex]->rsType;
-    } else {
-        file << "void";
-    }
-    file << " __attribute__((";
-    if (mOutputCount <= 1) {
-        file << "const, ";
-    }
-    file << "overloadable))";
-    file << mName;
-    file << "(";
-    bool needComma = false;
-    for (int i = 0; i < (int)mParams.size(); i++) {
-        if (i != mReturnIndex) {
-            const ParameterDefinition& p = *mParams[i];
-            if (needComma) {
-                file << ", ";
-            }
-            file << p.rsType;
-            if (p.isOutParameter) {
-                file << "*";
-            }
-            if (!p.specName.empty()) {
-                file << " " << p.specName;
-            }
-            needComma = true;
-        }
-    }
-    if (mInline.size() > 0) {
-        file << ") {\n";
-        for (size_t ct = 0; ct < mInline.size(); ct++) {
-            file << " " << mInline[ct].c_str() << "\n";
-        }
-        file << "}\n";
-    } else {
-        file << ");\n";
-    }
-    if (hasVersion) {
-        file << "#endif\n";
-    }
-    file << "\n";
-}
-
-/* Write the section of the .rs file for this permutation.
- *
- * We communicate the extra input and output parameters via global allocations.
- * For example, if we have a function that takes three arguments, two for input
- * and one for output:
- *
- * start:
- * name: gamn
- * ret: float3
- * arg: float3 a
- * arg: int b
- * arg: float3 *c
- * end:
- *
- * We'll produce:
- *
- * rs_allocation gAllocInB;
- * rs_allocation gAllocOutC;
- *
- * float3 __attribute__((kernel)) test_gamn_float3_int_float3(float3 inA, unsigned int x) {
- *    int inB;
- *    float3 outC;
- *    float2 out;
- *    inB = rsGetElementAt_int(gAllocInB, x);
- *    out = gamn(a, in_b, &outC);
- *    rsSetElementAt_float4(gAllocOutC, &outC, x);
- *    return out;
- * }
- *
- * We avoid re-using x and y from the definition because these have reserved
- * meanings in a .rs file.
- */
-void Permutation::writeRsSection(ofstream& rs) const {
-    // Write the allocation declarations we'll need.
-    for (int i = 0; i < (int)mParams.size(); i++) {
-        const ParameterDefinition& p = *mParams[i];
-        // Don't need allocation for one input and one return value.
-        if (i != mReturnIndex && i != mFirstInputIndex) {
-            mFunction->writeRsAllocationDefinition(p);
-        }
-    }
-    rs << "\n";
-
-    // Write the function header.
-    if (mReturnIndex >= 0) {
-        rs << mParams[mReturnIndex]->rsType;
-    } else {
-        rs << "void";
-    }
-    rs << " __attribute__((kernel)) " << mRsKernelName;
-    rs << "(";
-    bool needComma = false;
-    if (mFirstInputIndex >= 0) {
-        rs << mParams[mFirstInputIndex]->rsType << " " << mParams[mFirstInputIndex]->variableName;
-        needComma = true;
-    }
-    if (mOutputCount > 1 || mInputCount > 1) {
-        if (needComma) {
-            rs << ", ";
-        }
-        rs << "unsigned int x";
-    }
-    rs << ") {\n";
-
-    // Write the local variable declarations and initializations.
-    for (int i = 0; i < (int)mParams.size(); i++) {
-        if (i == mFirstInputIndex || i == mReturnIndex) {
-            continue;
-        }
-        const ParameterDefinition& p = *mParams[i];
-        rs << tab(1) << p.rsType << " " << p.variableName;
-        if (p.isOutParameter) {
-            rs << " = 0;\n";
-        } else {
-            rs << " = rsGetElementAt_" << p.rsType << "(" << p.rsAllocName << ", x);\n";
-        }
-    }
-
-    // Write the function call.
-    if (mReturnIndex >= 0) {
-        if (mOutputCount > 1) {
-            rs << tab(1) << mParams[mReturnIndex]->rsType << " "
-               << mParams[mReturnIndex]->variableName << " = ";
-        } else {
-            rs << tab(1) << "return ";
-        }
-    }
-    rs << mName << "(";
-    needComma = false;
-    for (int i = 0; i < (int)mParams.size(); i++) {
-        const ParameterDefinition& p = *mParams[i];
-        if (i == mReturnIndex) {
-            continue;
-        }
-        if (needComma) {
-            rs << ", ";
-        }
-        if (p.isOutParameter) {
-            rs << "&";
-        }
-        rs << p.variableName;
-        needComma = true;
-    }
-    rs << ");\n";
-
-    if (mOutputCount > 1) {
-        // Write setting the extra out parameters into the allocations.
-        for (int i = 0; i < (int)mParams.size(); i++) {
-            const ParameterDefinition& p = *mParams[i];
-            if (p.isOutParameter && i != mReturnIndex) {
-                rs << tab(1) << "rsSetElementAt_" << p.rsType << "(" << p.rsAllocName << ", ";
-                if (passByAddressToSet(p.variableName)) {
-                    rs << "&";
-                }
-                rs << p.variableName << ", x);\n";
-            }
-        }
-        if (mReturnIndex >= 0) {
-            rs << tab(1) << "return " << mParams[mReturnIndex]->variableName << ";\n";
-        }
-    }
-    rs << "}\n";
-}
-
-bool Permutation::passByAddressToSet(const string& name) const {
-    string s = name;
-    int last = s.size() - 1;
-    char lastChar = s[last];
-    return lastChar >= '0' && lastChar <= '9';
-}
-
-void Permutation::writeJavaSection(ofstream& file) const {
-    // By default, we test the results using item by item comparison.
-    if (mTest == "scalar" || mTest == "limited") {
-        writeJavaArgumentClass(file, true);
-        writeJavaCheckMethod(file, true);
-        writeJavaVerifyScalarMethod(file, false);
-    } else if (mTest == "custom") {
-        writeJavaArgumentClass(file, true);
-        writeJavaCheckMethod(file, true);
-        writeJavaVerifyScalarMethod(file, true);
-    } else if (mTest == "vector") {
-        writeJavaArgumentClass(file, false);
-        writeJavaCheckMethod(file, true);
-        writeJavaVerifyVectorMethod(file);
-    } else if (mTest == "noverify") {
-        writeJavaCheckMethod(file, false);
-    }
-
-    // Register the check method to be called.  This code will be written at the end.
-    mFunction->addJavaCheckCall(mJavaCheckMethodName + "();");
-}
-
-void Permutation::writeJavaArgumentClass(ofstream& file, bool scalar) const {
-    string name;
-    if (scalar) {
-        name = mJavaArgumentsClassName;
-    } else {
-        name = mJavaArgumentsNClassName;
-    }
-    string s;
-    s += tab(1) + "public class " + name + " {\n";
-    for (size_t i = 0; i < mParams.size(); i++) {
-        const ParameterDefinition& p = *mParams[i];
-        s += tab(2) + "public ";
-        if (p.isOutParameter && p.isFloatType && mTest != "custom") {
-            s += "Target.Floaty";
-        } else {
-            s += p.javaBaseType;
-        }
-        if (!scalar && p.mVectorSize != "1") {
-            s += "[]";
-        }
-        s += " " + p.variableName + ";\n";
-    }
-    s += tab(1) + "}\n\n";
-
-    mFunction->writeJavaArgumentClassDefinition(name, s);
-}
-
-void Permutation::writeJavaCheckMethod(ofstream& file, bool generateCallToVerifier) const {
-    file << tab(1) << "private void " << mJavaCheckMethodName << "() {\n";
-    // Generate the input allocations and initialization.
-    for (size_t i = 0; i < mParams.size(); i++) {
-        const ParameterDefinition& p = *mParams[i];
-        if (!p.isOutParameter) {
-            writeJavaInputAllocationDefinition(file, tab(2), p);
-        }
-    }
-    // Enforce ordering if needed.
-    for (size_t i = 0; i < mParams.size(); i++) {
-        const ParameterDefinition& p = *mParams[i];
-        if (!p.isOutParameter && !p.smallerParameter.empty()) {
-            string smallerAlloc = "in" + capitalize(p.smallerParameter);
-            file << tab(2) << "enforceOrdering(" << smallerAlloc << ", " << p.javaAllocName
-                 << ");\n";
-        }
-    }
-    writeJavaCallToRs(file, false, generateCallToVerifier);
-    writeJavaCallToRs(file, true, generateCallToVerifier);
-    file << tab(1) << "}\n\n";
-}
-
-void Permutation::writeJavaInputAllocationDefinition(ofstream& file, const string& indent,
-                                                     const ParameterDefinition& param) const {
-    string dataType;
-    char vectorSize;
-    convertToRsType(param.rsType, &dataType, &vectorSize);
-
-    string seed = hashString(mJavaCheckMethodName + param.javaAllocName);
-    file << indent << "Allocation " << param.javaAllocName << " = ";
-    if (param.compatibleTypeIndex >= 0) {
-        if (TYPES[param.typeIndex].kind == FLOATING_POINT) {
-            writeJavaRandomCompatibleFloatAllocation(file, dataType, seed, vectorSize,
-                                                     TYPES[param.compatibleTypeIndex],
-                                                     TYPES[param.typeIndex]);
-        } else {
-            writeJavaRandomCompatibleIntegerAllocation(file, dataType, seed, vectorSize,
-                                                       TYPES[param.compatibleTypeIndex],
-                                                       TYPES[param.typeIndex]);
-        }
-    } else if (!param.minValue.empty()) {
-        if (TYPES[param.typeIndex].kind != FLOATING_POINT) {
-            printf("range(,) is only supported for floating point\n");
-        } else {
-            file << "createRandomFloatAllocation(mRS, Element.DataType." << dataType << ", "
-                 << vectorSize << ", " << seed << ", " << param.minValue << ", " << param.maxValue
-                 << ")";
-        }
-    } else {
-        file << "createRandomAllocation(mRS, Element.DataType." << dataType << ", " << vectorSize
-            // TODO set to false only for native, i.e.
-            // << ", " << seed << ", " << (mTest == "limited" ? "false" : "true") << ")";
-            << ", " << seed << ", false)";
-    }
-    file << ";\n";
-}
-
-void Permutation::writeJavaRandomCompatibleFloatAllocation(ofstream& file, const string& dataType,
-                                                           const string& seed, char vectorSize,
-                                                           const Type& compatibleType,
-                                                           const Type& generatedType) const {
-    file << "createRandomFloatAllocation"
-         << "(mRS, Element.DataType." << dataType << ", " << vectorSize << ", " << seed << ", ";
-    double minValue = 0.0;
-    double maxValue = 0.0;
-    switch (compatibleType.kind) {
-        case FLOATING_POINT: {
-            // We're generating floating point values.  We just worry about the exponent.
-            // Subtract 1 for the exponent sign.
-            int bits = min(compatibleType.exponentBits, generatedType.exponentBits) - 1;
-            maxValue = ldexp(0.95, (1 << bits) - 1);
-            minValue = -maxValue;
-            break;
-        }
-        case UNSIGNED_INTEGER:
-            maxValue = MaxDoubleForInteger(compatibleType.significantBits,
-                                           generatedType.significantBits);
-            minValue = 0.0;
-            break;
-        case SIGNED_INTEGER:
-            maxValue = MaxDoubleForInteger(compatibleType.significantBits,
-                                           generatedType.significantBits);
-            minValue = -maxValue - 1.0;
-            break;
-    }
-    file << scientific << std::setprecision(19);
-    file << minValue << ", " << maxValue << ")";
-    file.unsetf(ios_base::floatfield);
-}
-
-void Permutation::writeJavaRandomCompatibleIntegerAllocation(ofstream& file, const string& dataType,
-                                                             const string& seed, char vectorSize,
-                                                             const Type& compatibleType,
-                                                             const Type& generatedType) const {
-    file << "createRandomIntegerAllocation"
-         << "(mRS, Element.DataType." << dataType << ", " << vectorSize << ", " << seed << ", ";
-
-    if (compatibleType.kind == FLOATING_POINT) {
-        // Currently, all floating points can take any number we generate.
-        bool isSigned = generatedType.kind == SIGNED_INTEGER;
-        file << (isSigned ? "true" : "false") << ", " << generatedType.significantBits;
-    } else {
-        bool isSigned =
-                    compatibleType.kind == SIGNED_INTEGER && generatedType.kind == SIGNED_INTEGER;
-        file << (isSigned ? "true" : "false") << ", "
-             << min(compatibleType.significantBits, generatedType.significantBits);
-    }
-    file << ")";
-}
-
-void Permutation::writeJavaOutputAllocationDefinition(ofstream& file, const string& indent,
-                                                      const ParameterDefinition& param) const {
-    string dataType;
-    char vectorSize;
-    convertToRsType(param.rsType, &dataType, &vectorSize);
-    file << indent << "Allocation " << param.javaAllocName << " = Allocation.createSized(mRS, "
-         << "getElement(mRS, Element.DataType." << dataType << ", " << vectorSize
-         << "), INPUTSIZE);\n";
-}
-
-// Converts float2 to FLOAT_32 and 2, etc.
-void Permutation::convertToRsType(const string& name, string* dataType, char* vectorSize) const {
-    string s = name;
-    int last = s.size() - 1;
-    char lastChar = s[last];
-    if (lastChar >= '1' && lastChar <= '4') {
-        s.erase(last);
-        *vectorSize = lastChar;
-    } else {
-        *vectorSize = '1';
-    }
-    dataType->clear();
-    for (int i = 0; i < NUM_TYPES; i++) {
-        if (s == TYPES[i].cType) {
-            *dataType = TYPES[i].rsDataType;
-            break;
-        }
-    }
-}
-
-void Permutation::writeJavaVerifyScalarMethod(ofstream& file, bool verifierValidates) const {
-    writeJavaVerifyFunctionHeader(file);
-    string vectorSize = "1";
-    for (size_t i = 0; i < mParams.size(); i++) {
-        const ParameterDefinition& p = *mParams[i];
-        writeJavaArrayInitialization(file, p);
-        if (p.mVectorSize != "1" && p.mVectorSize != vectorSize) {
-            if (vectorSize == "1") {
-                vectorSize = p.mVectorSize;
-            } else {
-                printf("Yikes, had vector %s and %s\n", vectorSize.c_str(), p.mVectorSize.c_str());
-            }
-        }
-    }
-
-    file << tab(2) << "for (int i = 0; i < INPUTSIZE; i++) {\n";
-    file << tab(3) << "for (int j = 0; j < " << vectorSize << " ; j++) {\n";
-
-    file << tab(4) << "// Extract the inputs.\n";
-    file << tab(4) << mJavaArgumentsClassName << " args = new " << mJavaArgumentsClassName
-         << "();\n";
-    for (size_t i = 0; i < mParams.size(); i++) {
-        const ParameterDefinition& p = *mParams[i];
-        if (!p.isOutParameter) {
-            file << tab(4) << "args." << p.variableName << " = " << p.javaArrayName << "[i";
-            if (p.vectorWidth != "1") {
-                file << " * " << p.vectorWidth << " + j";
-            }
-            file << "];\n";
-        }
-    }
-
-    if (verifierValidates) {
-        file << tab(4) << "// Extract the outputs.\n";
-        for (size_t i = 0; i < mParams.size(); i++) {
-            const ParameterDefinition& p = *mParams[i];
-            if (p.isOutParameter) {
-                file << tab(4) << "args." << p.variableName << " = " << p.javaArrayName
-                     << "[i * " + p.vectorWidth + " + j];\n";
-            }
-        }
-        file << tab(4) << "// Ask the CoreMathVerifier to validate.\n";
-        if (mHasFloatAnswers) {
-            file << tab(4) << "Target target = new Target(relaxed);\n";
-        }
-        file << tab(4) << "String errorMessage = CoreMathVerifier." << mJavaVerifierVerifyMethodName
-             << "(args";
-        if (mHasFloatAnswers) {
-            file << ", target";
-        }
-        file << ");\n";
-        file << tab(4) << "boolean valid = errorMessage == null;\n";
-    } else {
-        file << tab(4) << "// Figure out what the outputs should have been.\n";
-        if (mHasFloatAnswers) {
-            file << tab(4) << "Target target = new Target(relaxed);\n";
-        }
-        file << tab(4) << "CoreMathVerifier." << mJavaVerifierComputeMethodName << "(args";
-        if (mHasFloatAnswers) {
-            file << ", target";
-        }
-        file << ");\n";
-        file << tab(4) << "// Validate the outputs.\n";
-        file << tab(4) << "boolean valid = true;\n";
-        for (size_t i = 0; i < mParams.size(); i++) {
-            const ParameterDefinition& p = *mParams[i];
-            if (p.isOutParameter) {
-                writeJavaTestAndSetValid(file, 4, p, "", "[i * " + p.vectorWidth + " + j]");
-            }
-        }
-    }
-
-    file << tab(4) << "if (!valid) {\n";
-    file << tab(5) << "StringBuilder message = new StringBuilder();\n";
-    for (size_t i = 0; i < mParams.size(); i++) {
-        const ParameterDefinition& p = *mParams[i];
-        if (p.isOutParameter) {
-            writeJavaAppendOutputToMessage(file, 5, p, "", "[i * " + p.vectorWidth + " + j]",
-                                           verifierValidates);
-        } else {
-            writeJavaAppendInputToMessage(file, 5, p, "args." + p.variableName);
-        }
-    }
-    if (verifierValidates) {
-        file << tab(5) << "message.append(errorMessage);\n";
-    }
-
-    file << tab(5) << "assertTrue(\"Incorrect output for " << mJavaCheckMethodName << "\" +\n";
-    file << tab(7) << "(relaxed ? \"_relaxed\" : \"\") + \":\\n\" + message.toString(), valid);\n";
-    file << tab(4) << "}\n";
-    file << tab(3) << "}\n";
-    file << tab(2) << "}\n";
-    file << tab(1) << "}\n\n";
-}
-
-void Permutation::writeJavaVerifyFunctionHeader(ofstream& file) const {
-    file << tab(1) << "private void " << mJavaVerifyMethodName << "(";
-    for (size_t i = 0; i < mParams.size(); i++) {
-        const ParameterDefinition& p = *mParams[i];
-        file << "Allocation " << p.javaAllocName << ", ";
-    }
-    file << "boolean relaxed) {\n";
-}
-
-void Permutation::writeJavaTestAndSetValid(ofstream& file, int indent, const ParameterDefinition& p,
-                                           const string& argsIndex,
-                                           const string& actualIndex) const {
-    writeJavaTestOneValue(file, indent, p, argsIndex, actualIndex);
-    file << tab(indent + 1) << "valid = false;\n";
-    file << tab(indent) << "}\n";
-}
-
-void Permutation::writeJavaTestOneValue(ofstream& file, int indent, const ParameterDefinition& p,
-                                        const string& argsIndex, const string& actualIndex) const {
-    file << tab(indent) << "if (";
-    if (p.isFloatType) {
-        file << "!args." << p.variableName << argsIndex << ".couldBe(" << p.javaArrayName
-             << actualIndex;
-        if (!mPrecisionLimit.empty()) {
-            file << ", " << mPrecisionLimit;
-        }
-        file << ")";
-    } else {
-        file << "args." << p.variableName << argsIndex << " != " << p.javaArrayName << actualIndex;
-    }
-    if (p.undefinedIfOutIsNan && mReturnIndex >= 0) {
-        file << " && !args." << mParams[mReturnIndex]->variableName << argsIndex << ".isNaN()";
-    }
-    file << ") {\n";
-}
-
-void Permutation::writeJavaAppendOutputToMessage(ofstream& file, int indent,
-                                                 const ParameterDefinition& p,
-                                                 const string& argsIndex, const string& actualIndex,
-                                                 bool verifierValidates) const {
-    if (verifierValidates) {
-        const string actual = "args." + p.variableName + argsIndex;
-        file << tab(indent) << "message.append(\"Output " + p.variableName + ": \");\n";
-        if (p.isFloatType) {
-            writeJavaAppendFloatVariableToMessage(file, indent, actual, true);
-        } else {
-            writeJavaAppendVariableToMessage(file, indent, p, actual);
-        }
-        writeJavaAppendNewLineToMessage(file, indent);
-    } else {
-        const string expected = "args." + p.variableName + argsIndex;
-        const string actual = p.javaArrayName + actualIndex;
-        file << tab(indent) << "message.append(\"Expected output " + p.variableName + ": \");\n";
-        if (p.isFloatType) {
-            writeJavaAppendFloatVariableToMessage(file, indent, expected, false);
-        } else {
-            writeJavaAppendVariableToMessage(file, indent, p, expected);
-        }
-        writeJavaAppendNewLineToMessage(file, indent);
-        file << tab(indent) << "message.append(\"Actual   output " + p.variableName + ": \");\n";
-        writeJavaAppendVariableToMessage(file, indent, p, actual);
-
-        writeJavaTestOneValue(file, indent, p, argsIndex, actualIndex);
-        file << tab(indent + 1) << "message.append(\" FAIL\");\n";
-        file << tab(indent) << "}\n";
-        writeJavaAppendNewLineToMessage(file, indent);
-    }
-}
-
-void Permutation::writeJavaAppendInputToMessage(ofstream& file, int indent,
-                                                const ParameterDefinition& p,
-                                                const string& actual) const {
-    file << tab(indent) << "message.append(\"Input " + p.variableName + ": \");\n";
-    writeJavaAppendVariableToMessage(file, indent, p, actual);
-    writeJavaAppendNewLineToMessage(file, indent);
-}
-
-void Permutation::writeJavaAppendNewLineToMessage(ofstream& file, int indent) const {
-    file << tab(indent) << "message.append(\"\\n\");\n";
-}
-
-void Permutation::writeJavaAppendVariableToMessage(ofstream& file, int indent,
-                                                   const ParameterDefinition& p,
-                                                   const string& value) const {
-    if (p.specType == "f16" || p.specType == "f32") {
-        file << tab(indent) << "message.append(String.format(\"%14.8g {%8x} %15a\",\n";
-        file << tab(indent + 2) << value << ", "
-             << "Float.floatToRawIntBits(" << value << "), " << value << "));\n";
-    } else if (p.specType == "f64") {
-        file << tab(indent) << "message.append(String.format(\"%24.8g {%16x} %31a\",\n";
-        file << tab(indent + 2) << value << ", "
-             << "Double.doubleToRawLongBits(" << value << "), " << value << "));\n";
-    } else if (p.specType[0] == 'u') {
-        file << tab(indent) << "message.append(String.format(\"0x%x\", " << value << "));\n";
-    } else {
-        file << tab(indent) << "message.append(String.format(\"%d\", " << value << "));\n";
-    }
-}
-
-void Permutation::writeJavaAppendFloatVariableToMessage(ofstream& file, int indent,
-                                                        const string& value,
-                                                        bool regularFloat) const {
-    file << tab(indent) << "message.append(";
-    if (regularFloat) {
-        file << "Float.toString(" << value << ")";
-    } else {
-        file << value << ".toString()";
-    }
-    file << ");\n";
-}
-
-void Permutation::writeJavaVectorComparison(ofstream& file, int indent,
-                                            const ParameterDefinition& p) const {
-    if (p.mVectorSize == "1") {
-        writeJavaTestAndSetValid(file, indent, p, "", "[i]");
-
-    } else {
-        file << tab(indent) << "for (int j = 0; j < " << p.mVectorSize << " ; j++) {\n";
-        writeJavaTestAndSetValid(file, indent + 1, p, "[j]", "[i * " + p.vectorWidth + " + j]");
-        file << tab(indent) << "}\n";
-    }
-}
-
-void Permutation::writeJavaAppendVectorInputToMessage(ofstream& file, int indent,
-                                                      const ParameterDefinition& p) const {
-    if (p.mVectorSize == "1") {
-        writeJavaAppendInputToMessage(file, indent, p, p.javaArrayName + "[i]");
-    } else {
-        file << tab(indent) << "for (int j = 0; j < " << p.mVectorSize << " ; j++) {\n";
-        writeJavaAppendInputToMessage(file, indent + 1, p,
-                                      p.javaArrayName + "[i * " + p.vectorWidth + " + j]");
-        file << tab(indent) << "}\n";
-    }
-}
-
-void Permutation::writeJavaAppendVectorOutputToMessage(ofstream& file, int indent,
-                                                       const ParameterDefinition& p) const {
-    if (p.mVectorSize == "1") {
-        writeJavaAppendOutputToMessage(file, indent, p, "", "[i]", false);
-
-    } else {
-        file << tab(indent) << "for (int j = 0; j < " << p.mVectorSize << " ; j++) {\n";
-        writeJavaAppendOutputToMessage(file, indent + 1, p, "[j]",
-                                       "[i * " + p.vectorWidth + " + j]", false);
-        file << tab(indent) << "}\n";
-    }
-}
-
-void Permutation::writeJavaVerifyVectorMethod(ofstream& file) const {
-    writeJavaVerifyFunctionHeader(file);
-    for (size_t i = 0; i < mParams.size(); i++) {
-        const ParameterDefinition& p = *mParams[i];
-        writeJavaArrayInitialization(file, p);
-    }
-    file << tab(2) + "for (int i = 0; i < INPUTSIZE; i++) {\n";
-    file << tab(3) << mJavaArgumentsNClassName << " args = new " << mJavaArgumentsNClassName
-         << "();\n";
-
-    file << tab(3) << "// Create the appropriate sized arrays in args\n";
-    for (size_t i = 0; i < mParams.size(); i++) {
-        const ParameterDefinition& p = *mParams[i];
-        if (p.mVectorSize != "1") {
-            string type = p.javaBaseType;
-            if (p.isOutParameter && p.isFloatType) {
-                type = "Target.Floaty";
-            }
-            file << tab(3) << "args." << p.variableName << " = new " << type << "[" << p.mVectorSize
-                 << "];\n";
-        }
-    }
-
-    file << tab(3) << "// Fill args with the input values\n";
-    for (size_t i = 0; i < mParams.size(); i++) {
-        const ParameterDefinition& p = *mParams[i];
-        if (!p.isOutParameter) {
-            if (p.mVectorSize == "1") {
-                file << tab(3) << "args." << p.variableName << " = " << p.javaArrayName + "[i]"
-                     << ";\n";
-            } else {
-                file << tab(3) << "for (int j = 0; j < " << p.mVectorSize << " ; j++) {\n";
-                file << tab(4) << "args." << p.variableName + "[j] = "
-                     << p.javaArrayName + "[i * " + p.vectorWidth + " + j]"
-                     << ";\n";
-                file << tab(3) << "}\n";
-            }
-        }
-    }
-    file << tab(3) << "Target target = new Target(relaxed);\n";
-    file << tab(3) << "CoreMathVerifier." << mJavaVerifierComputeMethodName
-         << "(args, target);\n\n";
-
-    file << tab(3) << "// Compare the expected outputs to the actual values returned by RS.\n";
-    file << tab(3) << "boolean valid = true;\n";
-    for (size_t i = 0; i < mParams.size(); i++) {
-        const ParameterDefinition& p = *mParams[i];
-        if (p.isOutParameter) {
-            writeJavaVectorComparison(file, 3, p);
-        }
-    }
-
-    file << tab(3) << "if (!valid) {\n";
-    file << tab(4) << "StringBuilder message = new StringBuilder();\n";
-    for (size_t i = 0; i < mParams.size(); i++) {
-        const ParameterDefinition& p = *mParams[i];
-        if (p.isOutParameter) {
-            writeJavaAppendVectorOutputToMessage(file, 4, p);
-        } else {
-            writeJavaAppendVectorInputToMessage(file, 4, p);
-        }
-    }
-
-    file << tab(4) << "assertTrue(\"Incorrect output for " << mJavaCheckMethodName << "\" +\n";
-    file << tab(6) << "(relaxed ? \"_relaxed\" : \"\") + \":\\n\" + message.toString(), valid);\n";
-    file << tab(3) << "}\n";
-    file << tab(2) << "}\n";
-    file << tab(1) << "}\n\n";
-}
-
-void Permutation::writeJavaCallToRs(ofstream& file, bool relaxed, bool generateCallToVerifier) const {
-    string script = "script";
-    if (relaxed) {
-        script += "Relaxed";
-    }
-
-    file << tab(2) << "try {\n";
-    for (size_t i = 0; i < mParams.size(); i++) {
-        const ParameterDefinition& p = *mParams[i];
-        if (p.isOutParameter) {
-            writeJavaOutputAllocationDefinition(file, tab(3), p);
-        }
-    }
-
-    for (int i = 0; i < (int)mParams.size(); i++) {
-        const ParameterDefinition& p = *mParams[i];
-        if (i != mReturnIndex && i != mFirstInputIndex) {
-            file << tab(3) << script << ".set_" << p.rsAllocName << "(" << p.javaAllocName
-                 << ");\n";
-        }
-    }
-
-    file << tab(3) << script << ".forEach_" << mRsKernelName << "(";
-    bool needComma = false;
-    if (mFirstInputIndex >= 0) {
-        file << mParams[mFirstInputIndex]->javaAllocName;
-        needComma = true;
-    }
-    if (mReturnIndex >= 0) {
-        if (needComma) {
-            file << ", ";
-        }
-        file << mParams[mReturnIndex]->variableName << ");\n";
-    }
-
-    if (generateCallToVerifier) {
-        file << tab(3) << mJavaVerifyMethodName << "(";
-        for (size_t i = 0; i < mParams.size(); i++) {
-            const ParameterDefinition& p = *mParams[i];
-            file << p.variableName << ", ";
-        }
-
-        if (relaxed) {
-            file << "true";
-        } else {
-            file << "false";
-        }
-        file << ");\n";
-    }
-    file << tab(2) << "} catch (Exception e) {\n";
-    file << tab(3) << "throw new RSRuntimeException(\"RenderScript. Can't invoke forEach_"
-         << mRsKernelName << ": \" + e.toString());\n";
-    file << tab(2) << "}\n";
-}
-
-}  // namespace
-
-int main(int argc, char* argv[]) {
-    int versionOfTestFiles = 0;
-    vector<string> specFileNames;
-    if (!parseCommandLine(argc, argv, &versionOfTestFiles, &specFileNames)) {
-        printf("Usage: gen_runtime spec_file [spec_file...] [-v version_of_test_files]\n");
-        return -1;
-    }
-    int result = 0;
-    for (size_t i = 0; i < specFileNames.size(); i++) {
-        SpecFile specFile(specFileNames[i]);
-        if (!specFile.process(versionOfTestFiles)) {
-            result = -1;
-        }
-    }
-    return result;
-}
diff --git a/api/generate.sh b/api/generate.sh
index 44c9e80..0881690 100755
--- a/api/generate.sh
+++ b/api/generate.sh
@@ -16,9 +16,14 @@
 #
 
 set -e
-g++ gen_runtime.cpp -std=c++11 -Wall -o gen_runtime
-./gen_runtime -v 21 rs_core_math.spec
-mv GeneratedTest*.java ../../../cts/tests/tests/renderscript/src/android/renderscript/cts/
-mv GeneratedTest*.rs ../../../cts/tests/tests/renderscript/src/android/renderscript/cts/
-mv rs_core_math.rsh ../scriptc/
-rm ./gen_runtime
+g++ Generator.cpp Specification.cpp GenerateHtmlDocumentation.cpp GenerateHeaderFiles.cpp GenerateTestFiles.cpp Scanner.cpp Utilities.cpp -g -std=c++11 -Wall -o generator
+
+./generator rs_allocation.spec rs_atomic.spec rs_core_math.spec rs_core.spec rs_debug.spec rs_element.spec rs_graphics.spec rs_math.spec rs_matrix.spec rs_mesh.spec rs_object.spec rs_program.spec rs_quaternion.spec rs_sampler.spec rs_time.spec rs_types.spec
+
+rm ../../../cts/tests/tests/renderscript/src/android/renderscript/cts/GeneratedTest*
+mv GeneratedTest* ../../../cts/tests/tests/renderscript/src/android/renderscript/cts/
+
+mv *.rsh ../scriptc
+
+rm *.html # TODO handle the documentation files.
+rm generator
diff --git a/api/rs_allocation.spec b/api/rs_allocation.spec
new file mode 100644
index 0000000..51ec190
--- /dev/null
+++ b/api/rs_allocation.spec
@@ -0,0 +1,473 @@
+#
+# Copyright (C) 2015 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+header:
+summary: Allocation routines
+description:
+ Functions that can be used to query the characteristics of an allocation,
+ to set and get elements of the allocation.
+end:
+
+function: rsAllocationCopy1DRange
+version: 14
+ret: void
+arg: rs_allocation dstAlloc, "Allocation to copy data into."
+arg: uint32_t dstOff, "The offset of the first element to be copied in the destination allocation."
+arg: uint32_t dstMip, "Mip level in the destination allocation."
+arg: uint32_t count, "The number of elements to be copied."
+arg: rs_allocation srcAlloc, "The source data allocation."
+arg: uint32_t srcOff, "The offset of the first element in data to be copied in the source allocation."
+arg: uint32_t srcMip, "Mip level in the source allocation."
+summary: Copy consecutive values between allocations
+description:
+ Copies part of an allocation into another allocation.
+
+ The two allocations must be different.  Using this function to copy whithin
+ the same allocation yields undefined results.
+test: none
+end:
+
+
+function: rsAllocationCopy2DRange
+version: 14
+ret: void
+arg: rs_allocation dstAlloc, "Allocation to copy data into."
+arg: uint32_t dstXoff, "X offset of the region to update in the destination allocation."
+arg: uint32_t dstYoff, "Y offset of the region to update in the destination allocation."
+arg: uint32_t dstMip, "Mip level in the destination allocation."
+arg: rs_allocation_cubemap_face dstFace, "Cubemap face of the destination allocation, ignored for allocations that aren't cubemaps."
+arg: uint32_t width, "Width of the incoming region to update."
+arg: uint32_t height, "Height of the incoming region to update."
+arg: rs_allocation srcAlloc, "The source data allocation."
+arg: uint32_t srcXoff, "X offset in data of the source allocation."
+arg: uint32_t srcYoff, "Y offset in data of the source allocation."
+arg: uint32_t srcMip, "Mip level in the source allocation."
+arg: rs_allocation_cubemap_face srcFace, "Cubemap face of the source allocation, ignored for allocations that aren't cubemaps."
+summary: Copy a rectangular region between allocations
+description:
+ Copy a rectangular region into the allocation from another allocation.
+
+ The two allocations must be different.  Using this function to copy whithin
+ the same allocation yields undefined results.
+test: none
+end:
+
+function: rsAllocationGetDimFaces
+ret: uint32_t, "Returns 1 if more than one face is present, 0 otherwise."
+arg: rs_allocation a
+summary: Presence of more than one face
+description:
+ If the allocation is a cubemap, this function returns 1 if there's more than one
+ face present.  In all other cases, it returns 0.
+test: none
+end:
+
+function: rsAllocationGetDimLOD
+ret: uint32_t, "Returns 1 if more than one LOD is present, 0 otherwise."
+arg: rs_allocation a
+summary: Presence of levels of details
+description:
+ Query an allocation for the presence of more than one Level Of Details.  This is useful for mipmaps.
+test: none
+end:
+
+function: rsAllocationGetDimX
+ret: uint32_t, "The X dimension of the allocation."
+arg: rs_allocation a
+summary: Size of the X dimension
+description:
+ Returns the size of the X dimension of the allocation.
+test: none
+end:
+
+function: rsAllocationGetDimY
+ret: uint32_t, "The Y dimension of the allocation."
+arg: rs_allocation a
+summary: Size of the Y dimension
+description:
+ Returns the size of the Y dimension of the allocation.
+ If the allocation has less than two dimensions, returns 0.
+test: none
+end:
+
+function: rsAllocationGetDimZ
+ret: uint32_t, "The Z dimension of the allocation."
+arg: rs_allocation a
+summary: Size of the Z dimension
+description:
+ Returns the size of the Z dimension of the allocation.
+ If the allocation has less than three dimensions, returns 0.
+test: none
+end:
+
+function: rsAllocationGetElement
+ret: rs_element, "element describing allocation layout"
+arg: rs_allocation a, "allocation to get data from"
+summary:
+description:
+ Get the element object describing the allocation's layout
+test: none
+end:
+
+function: rsAllocationIoReceive
+version: 16
+ret: void
+arg: rs_allocation a, "allocation to work on"
+summary: Receive new content from the queue
+description:
+ Receive a new set of contents from the queue.
+test: none
+end:
+
+function: rsAllocationIoSend
+version: 16
+ret: void
+arg: rs_allocation a, "allocation to work on"
+summary: Send new content to the queue
+description:
+ Send the contents of the Allocation to the queue.
+test: none
+end:
+
+function: rsAllocationVLoadX_#2#1
+version: 22
+w: 2, 3, 4
+t: u8, u16, u32, u64, i8, i16, i32, i64, f32, f64
+ret: #2#1
+arg: rs_allocation a
+arg: uint32_t x
+summary:
+description:
+ Get a single element from an allocation.
+test: none
+end:
+
+function: rsAllocationVLoadX_#2#1
+version: 22
+w: 2, 3, 4
+t: u8, u16, u32, u64, i8, i16, i32, i64, f32, f64
+ret: #2#1
+arg: rs_allocation a
+arg: uint32_t x
+arg: uint32_t y
+test: none
+end:
+
+function: rsAllocationVLoadX_#2#1
+version: 22
+w: 2, 3, 4
+t: u8, u16, u32, u64, i8, i16, i32, i64, f32, f64
+ret: #2#1
+arg: rs_allocation a
+arg: uint32_t x
+arg: uint32_t y
+arg: uint32_t z
+test: none
+end:
+
+function: rsAllocationVStoreX_#2#1
+version: 22
+w: 2, 3, 4
+t: u8, u16, u32, u64, i8, i16, i32, i64, f32, f64
+ret: void
+arg: rs_allocation a
+arg: #2#1 val
+arg: uint32_t x
+summary:
+description:
+ Set a single element of an allocation.
+test: none
+end:
+
+function: rsAllocationVStoreX_#2#1
+version: 22
+w: 2, 3, 4
+t: u8, u16, u32, u64, i8, i16, i32, i64, f32, f64
+ret: void
+arg: rs_allocation a
+arg: #2#1 val
+arg: uint32_t x
+arg: uint32_t y
+test: none
+end:
+
+function: rsAllocationVStoreX_#2#1
+version: 22
+w: 2, 3, 4
+t: u8, u16, u32, u64, i8, i16, i32, i64, f32, f64
+ret: void
+arg: rs_allocation a
+arg: #2#1 val
+arg: uint32_t x
+arg: uint32_t y
+arg: uint32_t z
+test: none
+end:
+
+function: rsGetAllocation
+ret: rs_allocation
+arg: const void* p
+summary: Returns the Allocation for a given pointer
+description:
+ Returns the Allocation for a given pointer.  The pointer should point within
+ a valid allocation.  The results are undefined if the pointer is not from a
+ valid allocation.
+
+ This function is deprecated and will be removed from the SDK in a future
+ release.
+test: none
+end:
+
+function: rsGetElementAt
+ret: const void*
+arg: rs_allocation a
+arg: uint32_t x
+summary: Get an element
+description:
+ Extract a single element from an allocation.
+test: none
+end:
+
+function: rsGetElementAt
+ret: const void*
+arg: rs_allocation a
+arg: uint32_t x
+arg: uint32_t y
+test: none
+end:
+
+function: rsGetElementAt
+ret: const void*
+arg: rs_allocation a
+arg: uint32_t x
+arg: uint32_t y
+arg: uint32_t z
+test: none
+end:
+
+function: rsGetElementAt_#2#1
+version: 9 17
+w: 1, 2, 3, 4
+t: u8, u16, u32, u64, i8, i16, i32, i64, f32, f64
+ret: #2#1
+arg: rs_allocation a
+arg: uint32_t x
+inline:
+ return ((#2#1 *)rsGetElementAt(a, x))[0];
+test: none
+end:
+
+function: rsGetElementAt_#2#1
+version: 9 17
+w: 1, 2, 3, 4
+t: u8, u16, u32, u64, i8, i16, i32, i64, f32, f64
+ret: #2#1
+arg: rs_allocation a
+arg: uint32_t x
+arg: uint32_t y
+inline:
+ return ((#2#1 *)rsGetElementAt(a, x, y))[0];
+test: none
+end:
+
+function: rsGetElementAt_#2#1
+version: 9 17
+w: 1, 2, 3, 4
+t: u8, u16, u32, u64, i8, i16, i32, i64, f32, f64
+ret: #2#1
+arg: rs_allocation a
+arg: uint32_t x
+arg: uint32_t y
+arg: uint32_t z
+inline:
+ return ((#2#1 *)rsGetElementAt(a, x, y, z))[0];
+test: none
+end:
+
+function: rsGetElementAt_#2#1
+version: 18
+w: 1, 2, 3, 4
+t: u8, u16, u32, u64, i8, i16, i32, i64, f32, f64
+ret: #2#1
+arg: rs_allocation a
+arg: uint32_t x
+test: none
+end:
+
+function: rsGetElementAt_#2#1
+version: 18
+w: 1, 2, 3, 4
+t: u8, u16, u32, u64, i8, i16, i32, i64, f32, f64
+ret: #2#1
+arg: rs_allocation a
+arg: uint32_t x
+arg: uint32_t y
+test: none
+end:
+
+function: rsGetElementAt_#2#1
+version: 18
+w: 1, 2, 3, 4
+t: u8, u16, u32, u64, i8, i16, i32, i64, f32, f64
+ret: #2#1
+arg: rs_allocation a
+arg: uint32_t x
+arg: uint32_t y
+arg: uint32_t z
+test: none
+end:
+
+function: rsGetElementAtYuv_uchar_U
+version: 18
+ret: uchar
+arg: rs_allocation a
+arg: uint32_t x
+arg: uint32_t y
+summary:
+description:
+ Extract a single element from an allocation.
+
+ Coordinates are in the dimensions of the Y plane
+test: none
+end:
+
+function: rsGetElementAtYuv_uchar_V
+version: 18
+ret: uchar
+arg: rs_allocation a
+arg: uint32_t x
+arg: uint32_t y
+summary:
+description:
+ Extract a single element from an allocation.
+
+ Coordinates are in the dimensions of the Y plane
+test: none
+end:
+
+function: rsGetElementAtYuv_uchar_Y
+version: 18
+ret: uchar
+arg: rs_allocation a
+arg: uint32_t x
+arg: uint32_t y
+summary:
+description:
+ Extract a single element from an allocation.
+test: none
+end:
+
+function: rsSample
+version: 16
+ret: float4
+arg: rs_allocation a, "allocation to sample from"
+arg: rs_sampler s, "sampler state"
+arg: float location, "location to sample from"
+summary:
+description:
+ Fetch allocation in a way described by the sampler
+
+ If your allocation is 1D, use the variant with float for location.
+ For 2D, use the float2 variant.
+test: none
+end:
+
+function: rsSample
+version: 16
+ret: float4
+arg: rs_allocation a
+arg: rs_sampler s
+arg: float location
+arg: float lod, "mip level to sample from, for fractional values mip levels will be interpolated if RS_SAMPLER_LINEAR_MIP_LINEAR is used"
+test: none
+end:
+
+function: rsSample
+version: 16
+ret: float4
+arg: rs_allocation a
+arg: rs_sampler s
+arg: float2 location
+test: none
+end:
+
+function: rsSample
+version: 16
+ret: float4
+arg: rs_allocation a
+arg: rs_sampler s
+arg: float2 location
+arg: float lod
+test: none
+end:
+
+function: rsSetElementAt
+version: 18
+ret: void
+arg: rs_allocation a
+arg: void* ptr
+arg: uint32_t x
+summary: Set an element
+description:
+ Set single element of an allocation.
+test: none
+end:
+
+function: rsSetElementAt
+version: 18
+ret: void
+arg: rs_allocation a
+arg: void* ptr
+arg: uint32_t x
+arg: uint32_t y
+test: none
+end:
+
+function: rsSetElementAt_#2#1
+version: 18
+w: 1, 2, 3, 4
+t: u8, u16, u32, u64, i8, i16, i32, i64, f32, f64
+ret: void
+arg: rs_allocation a
+arg: #2#1 val
+arg: uint32_t x
+test: none
+end:
+
+function: rsSetElementAt_#2#1
+version: 18
+w: 1, 2, 3, 4
+t: u8, u16, u32, u64, i8, i16, i32, i64, f32, f64
+ret: void
+arg: rs_allocation a
+arg: #2#1 val
+arg: uint32_t x
+arg: uint32_t y
+test: none
+end:
+
+function: rsSetElementAt_#2#1
+version: 18
+w: 1, 2, 3, 4
+t: u8, u16, u32, u64, i8, i16, i32, i64, f32, f64
+ret: void
+arg: rs_allocation a
+arg: #2#1 val
+arg: uint32_t x
+arg: uint32_t y
+arg: uint32_t z
+test: none
+end:
diff --git a/api/rs_atomic.spec b/api/rs_atomic.spec
new file mode 100644
index 0000000..8add583
--- /dev/null
+++ b/api/rs_atomic.spec
@@ -0,0 +1,229 @@
+#
+# Copyright (C) 2015 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+header:
+summary: Atomic routines
+description:
+ To update values shared between multiple threads, use the functions below.
+ They ensure that the values are atomically updated, i.e. that the memory
+ reads, the updates, and the memory writes are all done in the right order.
+
+ These functions are slower than just doing the non-atomic variants, so use
+ them only when synchronization is needed.
+
+ Note that in RenderScript, your code is likely to be running in separate
+ threads even though you did not explicitely create them.  The RenderScript
+ runtime will very often split the execution of one kernel across multiple
+ threads.  Updating globals should be done with atomic functions.  If possible,
+ modify your algorithm to avoid them altogether.
+end:
+
+function: rsAtomicAdd
+version: 14
+ret: int32_t, "Old value"
+arg: volatile int32_t* addr, "Address of the value to modify"
+arg: int32_t value, "Amount to add"
+summary: Thread-safe addition
+description:
+ Atomicly adds a value to the value at addr, i.e. <code>*addr += value</code>.
+test: none
+end:
+
+function: rsAtomicAdd
+version: 20
+ret: int32_t
+arg: volatile uint32_t* addr
+arg: uint32_t value
+test: none
+end:
+
+function: rsAtomicAnd
+version: 14
+ret: int32_t, "Old value"
+arg: volatile int32_t* addr, "Address of the value to modify"
+arg: int32_t value, "Value to and with"
+summary: Thread-safe bitwise and
+description:
+ Atomicly performs a bitwise and of two values, storing the result back at addr,
+ i.e. <code>*addr &= value</code>
+test: none
+end:
+
+function: rsAtomicAnd
+version: 20
+ret: int32_t
+arg: volatile uint32_t* addr
+arg: uint32_t value
+test: none
+end:
+
+function: rsAtomicCas
+version: 14
+ret: int32_t, "Old value"
+arg: volatile int32_t* addr, "The address to compare and replace if the compare passes."
+arg: int32_t compareValue, "The value to test *addr against."
+arg: int32_t newValue, "The value to write if the test passes."
+summary: Thread-safe compare and set
+description:
+ If the value at addr matches compareValue then the newValue is written at addr,
+ i.e. <code>if (*addr == compareValue) { *addr = newValue; }</code>
+
+ You can check that the value was written by checking that the value returned
+ by rsAtomicCas is compareValue.
+test: none
+end:
+
+function: rsAtomicCas
+version: 14
+ret: uint32_t
+arg: volatile uint32_t* addr
+arg: uint32_t compareValue
+arg: uint32_t newValue
+test: none
+end:
+
+function: rsAtomicDec
+version: 14
+ret: int32_t, "Old value"
+arg: volatile int32_t* addr, "Address of the value to decrement"
+summary: Thread-safe decrement
+description:
+ Atomicly subtracts one from the value at addr.  Equal to <code>@rsAtomicSub(addr, 1)</code>
+test: none
+end:
+
+function: rsAtomicDec
+version: 20
+ret: int32_t
+arg: volatile uint32_t* addr
+test: none
+end:
+
+function: rsAtomicInc
+version: 14
+ret: int32_t, "Old value"
+arg: volatile int32_t* addr, "Address of the value to increment"
+summary: Thread-safe increment
+description:
+ Atomicly adds one to the value at addr.  Equal to <code>@rsAtomicAdd(addr, 1)</code>
+test: none
+end:
+
+function: rsAtomicInc
+version: 20
+ret: int32_t
+arg: volatile uint32_t* addr
+test: none
+end:
+
+function: rsAtomicMax
+version: 14
+ret: uint32_t, "Old value"
+arg: volatile uint32_t* addr, "Address of the value to modify"
+arg: uint32_t value, "Comparison value"
+summary: Thread-safe maximum
+description:
+ Atomicly sets the value at addr to the maximum of addr and value, i.e.
+ <code>*addr = max(*addr, value)</code>
+test: none
+end:
+
+function: rsAtomicMax
+version: 14
+ret: int32_t
+arg: volatile int32_t* addr
+arg: int32_t value
+test: none
+end:
+
+function: rsAtomicMin
+version: 14
+ret: uint32_t, "Old value"
+arg: volatile uint32_t* addr, "Address of the value to modify"
+arg: uint32_t value, "Comparison value"
+summary: Thread-safe minimum
+description:
+ Atomicly sets the value at addr to the minimum of addr and value, i.e.
+ <code>*addr = min(*addr, value)</code>
+test: none
+end:
+
+function: rsAtomicMin
+version: 14
+ret: int32_t
+arg: volatile int32_t* addr
+arg: int32_t value
+test: none
+end:
+
+function: rsAtomicOr
+version: 14
+ret: int32_t, "Old value"
+arg: volatile int32_t* addr, "Address of the value to modify"
+arg: int32_t value, "Value to or with"
+summary: Thread-safe bitwise or
+description:
+ Atomicly perform a bitwise or two values, storing the result at addr,
+ i.e. <code>*addr |= value</code>
+test: none
+end:
+
+function: rsAtomicOr
+version: 20
+ret: int32_t
+arg: volatile uint32_t* addr
+arg: uint32_t value
+test: none
+end:
+
+function: rsAtomicSub
+version: 14
+ret: int32_t, "Old value"
+arg: volatile int32_t* addr, "Address of the value to modify"
+arg: int32_t value, "Amount to subtract"
+summary: Thread-safe subtraction
+description:
+ Atomicly subtracts a value from the value at addr, i.e. <code>*addr -= value</code>
+test: none
+end:
+
+function: rsAtomicSub
+version: 20
+ret: int32_t
+arg: volatile uint32_t* addr
+arg: uint32_t value
+test: none
+end:
+
+function: rsAtomicXor
+version: 14
+ret: int32_t, "Old value"
+arg: volatile int32_t* addr, "Address of the value to modify"
+arg: int32_t value, "Value to xor with"
+summary: Thread-safe bitwise exclusive or
+description:
+ Atomicly performs a bitwise xor of two values, storing the result at addr,
+ i.e. <code>*addr ^= value</code>
+test: none
+end:
+
+function: rsAtomicXor
+version: 20
+ret: int32_t
+arg: volatile uint32_t* addr
+arg: uint32_t value
+test: none
+end:
diff --git a/api/rs_core.spec b/api/rs_core.spec
new file mode 100644
index 0000000..bd5cda8
--- /dev/null
+++ b/api/rs_core.spec
@@ -0,0 +1,411 @@
+#
+# Copyright (C) 2015 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+header:
+summary: TODO
+description:
+# TODO move elsewhere?
+ RenderScript is a high-performance runtime that provides
+ compute operations at the native level. RenderScript code is compiled on devices
+ at runtime to allow platform-independence as well.
+ This reference documentation describes the RenderScript runtime APIs, which you
+ can utilize to write RenderScript code in C99. The RenderScript compute header
+ files are automatically included for you.
+
+ To use RenderScript, you need to utilize the RenderScript runtime APIs documented here
+ as well as the Android framework APIs for RenderScript.
+ For documentation on the Android framework APIs, see the <a target="_parent" href="http://developer.android.com/reference/android/renderscript/package-summary.html">android.renderscript</a> package reference.
+ For more information on how to develop with RenderScript and how the runtime and
+ Android framework APIs interact, see the <a target="_parent" href="http://developer.android.com/guide/topics/renderscript/index.html">RenderScript developer guide</a>
+ and the <a target="_parent" href="http://developer.android.com/resources/samples/RenderScript/index.html">RenderScript samples</a>.
+include:
+ #define RS_KERNEL __attribute__((kernel))
+
+ #include "rs_types.rsh"
+ #include "rs_allocation.rsh"
+ #include "rs_atomic.rsh"
+ #include "rs_core_math.rsh"
+ #include "rs_debug.rsh"
+ #include "rs_element.rsh"
+ #include "rs_math.rsh"
+ #include "rs_matrix.rsh"
+ #include "rs_object.rsh"
+ #include "rs_quaternion.rsh"
+ #include "rs_sampler.rsh"
+ #include "rs_time.rsh"
+end:
+
+type: rs_for_each_strategy_t
+enum: rs_for_each_strategy
+value: RS_FOR_EACH_STRATEGY_SERIAL = 0
+value: RS_FOR_EACH_STRATEGY_DONT_CARE = 1
+value: RS_FOR_EACH_STRATEGY_DST_LINEAR = 2
+value: RS_FOR_EACH_STRATEGY_TILE_SMALL = 3
+value: RS_FOR_EACH_STRATEGY_TILE_MEDIUM = 4
+value: RS_FOR_EACH_STRATEGY_TILE_LARGE = 5
+summary: Launch order hint for rsForEach calls
+description:
+ Launch order hint for rsForEach calls.  This provides a hint to the system to
+ determine in which order the root function of the target is called with each
+ cell of the allocation.
+
+ This is a hint and implementations may not obey the order.
+end:
+
+type: rs_kernel_context
+version: 23
+simple: const struct rs_kernel_context_t *
+summary: Opaque handle to RenderScript kernel invocation context
+description:
+ TODO
+end:
+
+type: rs_script_call_t
+struct: rs_script_call
+field: rs_for_each_strategy_t strategy
+field: uint32_t xStart
+field: uint32_t xEnd
+field: uint32_t yStart
+field: uint32_t yEnd
+field: uint32_t zStart
+field: uint32_t zEnd
+field: uint32_t arrayStart
+field: uint32_t arrayEnd
+summary: Provides extra information to a rsForEach call
+description:
+ Structure to provide extra information to a rsForEach call.  Primarly used to
+ restrict the call to a subset of cells in the allocation.
+end:
+
+function: rsForEach
+version: 9 13
+ret: void
+arg: rs_script script, "The target script to call"
+arg: rs_allocation input, "The allocation to source data from"
+arg: rs_allocation output, "the allocation to write date into"
+arg: const void* usrData, "The user defined params to pass to the root script.  May be NULL."
+arg: const rs_script_call_t* sc, "Extra control infomation used to select a sub-region of the allocation to be processed or suggest a walking strategy.  May be NULL."
+summary:
+description:
+ Make a script to script call to launch work. One of the input or output is
+ required to be a valid object. The input and output must be of the same
+ dimensions.
+test: none
+end:
+
+function: rsForEach
+version: 9 13
+ret: void
+arg: rs_script script
+arg: rs_allocation input
+arg: rs_allocation output
+arg: const void* usrData
+test: none
+end:
+
+function: rsForEach
+version: 14 20
+ret: void
+arg: rs_script script
+arg: rs_allocation input
+arg: rs_allocation output
+arg: const void* usrData
+arg: size_t usrDataLen, "The size of the userData structure.  This will be used to perform a shallow copy of the data if necessary."
+arg: const rs_script_call_t* sc
+test: none
+end:
+
+function: rsForEach
+version: 14 20
+ret: void
+arg: rs_script script
+arg: rs_allocation input
+arg: rs_allocation output
+arg: const void* usrData
+arg: size_t usrDataLen
+test: none
+end:
+
+function: rsForEach
+version: 14
+ret: void
+arg: rs_script script
+arg: rs_allocation input
+arg: rs_allocation output
+test: none
+end:
+
+function: rsSendToClient
+ret: bool
+arg: int cmdID
+summary:
+description:
+ Send a message back to the client.  Will not block and returns true
+ if the message was sendable and false if the fifo was full.
+ A message ID is required.  Data payload is optional.
+test: none
+end:
+
+function: rsSendToClient
+ret: bool
+arg: int cmdID
+arg: const void* data
+arg: uint len
+test: none
+end:
+
+function: rsSendToClientBlocking
+ret: void
+arg: int cmdID
+summary:
+description:
+ Send a message back to the client, blocking until the message is queued.
+ A message ID is required.  Data payload is optional.
+test: none
+end:
+
+function: rsSendToClientBlocking
+ret: void
+arg: int cmdID
+arg: const void* data
+arg: uint len
+test: none
+end:
+
+function: rsGetArray0
+version: 23
+ret: uint32_t
+arg: rs_kernel_context ctxt
+summary: Index in the Array0 dimension for the specified context
+description:
+ Returns the index in the Array0 dimension of the cell being processed,
+ as specified by the supplied context.
+
+ This context is created when a kernel is launched and updated at each
+ iteration.  It contains common characteristics of the allocations being
+ iterated over and rarely used indexes, like the Array0 index.
+
+ You can access the context by adding a rs_kernel_context argument to your
+ kernel function.  E.g.<br/>
+ <code>short RS_KERNEL myKernel(short value, uint32_t x, rs_kernel_context context) {<br/>
+ &nbsp;&nbsp;// The current index in the common x, y, z, w dimensions are accessed by<br/>
+ &nbsp;&nbsp;// adding these variables as arguments.  For the more rarely used indexes<br/>
+ &nbsp;&nbsp;// to the other dimensions, extract them from the context:<br/>
+ &nbsp;&nbsp;uint32_t index_a0 = rsGetArray0(context);<br/>
+ &nbsp;&nbsp;//...<br/>
+ }<br/></code>
+
+ This function returns 0 if the Array0 dimension is not present.
+test: none
+end:
+
+function: rsGetArray1
+version: 23
+ret: uint32_t
+arg: rs_kernel_context ctxt
+summary: Index in the Array1 dimension for the specified context
+description:
+ Returns the index in the Array1 dimension of the cell being processed,
+ as specified by the supplied context.  See @rsGetArray0() for an explanation
+ of the context.
+
+ Returns 0 if the Array1 dimension is not present.
+test: none
+end:
+
+function: rsGetArray2
+version: 23
+ret: uint32_t
+arg: rs_kernel_context ctxt
+summary: Index in the Array2 dimension for the specified context
+description:
+ Returns the index in the Array2 dimension of the cell being processed,
+ as specified by the supplied context.  See @rsGetArray0() for an explanation
+ of the context.
+
+ Returns 0 if the Array2 dimension is not present.
+test: none
+end:
+
+function: rsGetArray3
+version: 23
+ret: uint32_t
+arg: rs_kernel_context ctxt
+summary: Index in the Array3 dimension for the specified context
+description:
+ Returns the index in the Array3 dimension of the cell being processed,
+ as specified by the supplied context.  See @rsGetArray0() for an explanation
+ of the context.
+
+ Returns 0 if the Array3 dimension is not present.
+test: none
+end:
+
+function: rsGetDimArray0
+version: 23
+ret: uint32_t
+arg: rs_kernel_context ctxt
+summary: Size of the Array0 dimension for the specified context
+description:
+ Returns the size of the Array0 dimension for the specified context.
+ See @rsGetDimX() for an explanation of the context.
+
+ Returns 0 if the Array0 dimension is not present.
+#TODO Add an hyperlink to something that explains Array0/1/2/3
+# for the relevant functions.
+test: none
+end:
+
+function: rsGetDimArray1
+version: 23
+ret: uint32_t
+arg: rs_kernel_context ctxt
+summary: Size of the Array1 dimension for the specified context
+description:
+ Returns the size of the Array1 dimension for the specified context.
+ See @rsGetDimX() for an explanation of the context.
+
+ Returns 0 if the Array1 dimension is not present.
+test: none
+end:
+
+function: rsGetDimArray2
+version: 23
+ret: uint32_t
+arg: rs_kernel_context ctxt
+summary: Size of the Array2 dimension for the specified context
+description:
+ Returns the size of the Array2 dimension for the specified context.
+ See @rsGetDimX() for an explanation of the context.
+
+ Returns 0 if the Array2 dimension is not present.
+test: none
+end:
+
+function: rsGetDimArray3
+version: 23
+ret: uint32_t
+arg: rs_kernel_context ctxt
+summary: Size of the Array3 dimension for the specified context
+description:
+ Returns the size of the Array3 dimension for the specified context.
+ See @rsGetDimX() for an explanation of the context.
+
+ Returns 0 if the Array3 dimension is not present.
+test: none
+end:
+
+function: rsGetDimHasFaces
+version: 23
+ret: bool, "Returns true if more than one face is present, false otherwise."
+arg: rs_kernel_context ctxt
+summary: Presence of more than one face for the specified context
+description:
+ If the context refers to a cubemap, this function returns true if there's
+ more than one face present.  In all other cases, it returns false.
+ See @rsGetDimX() for an explanation of the context.
+
+ @rsAllocationGetDimFaces() is similar but returns 0 or 1 instead of a bool.
+test: none
+end:
+
+function: rsGetDimLod
+version: 23
+ret: uint32_t
+arg: rs_kernel_context ctxt
+summary: Number of levels of detail for the specified context
+description:
+ Returns the number of levels of detail for the specified context.
+ This is useful for mipmaps.  See @rsGetDimX() for an explanation of the context.
+ Returns 0 if Level of Detail is not used.
+
+ @rsAllocationGetDimLOD() is similar but returns 0 or 1 instead the actual
+ number of levels.
+test: none
+end:
+
+function: rsGetDimX
+version: 23
+ret: uint32_t
+arg: rs_kernel_context ctxt
+summary: Size of the X dimension for the specified context
+description:
+ Returns the size of the X dimension for the specified context.
+
+ This context is created when a kernel is launched.  It contains common
+ characteristics of the allocations being iterated over by the kernel in
+ a very efficient structure.  It also contains rarely used indexes.
+
+ You can access it by adding a rs_kernel_context argument to your kernel
+ function.  E.g.<br/>
+ <code>int4 RS_KERNEL myKernel(int4 value, rs_kernel_context context) {<br/>
+ &nbsp;&nbsp;uint32_t size = rsGetDimX(context); //...<br/></code>
+test: none
+end:
+
+function: rsGetDimY
+version: 23
+ret: uint32_t
+arg: rs_kernel_context ctxt
+summary: Size of the Y dimension for the specified context
+description:
+ Returns the size of the X dimension for the specified context.
+ See @rsGetDimX() for an explanation of the context.
+
+ Returns 0 if the Y dimension is not present.
+test: none
+end:
+
+function: rsGetDimZ
+version: 23
+ret: uint32_t
+arg: rs_kernel_context ctxt
+summary: Size of the Z dimension for the specified context
+description:
+ Returns the size of the Z dimension for the specified context.
+ See @rsGetDimX() for an explanation of the context.
+
+ Returns 0 if the Z dimension is not present.
+test: none
+end:
+
+function: rsGetFace
+version: 23
+ret: rs_allocation_cubemap_face
+arg: rs_kernel_context ctxt
+summary: Coordinate of the Face for the specified context
+description:
+ Returns the face on which the cell being processed is found, as specified
+ by the supplied context.  See @rsGetArray0() for an explanation of the context.
+
+ Returns RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_X if the face dimension is not
+ present.
+test: none
+end:
+
+function: rsGetLod
+version: 23
+ret: uint32_t
+arg: rs_kernel_context ctxt
+summary: Index in the Levels of Detail dimension for the specified context.
+description:
+ Returns the index in the Levels of Detail dimension of the cell being
+ processed, as specified by the supplied context.  See @rsGetArray0() for
+ an explanation of the context.
+
+ Returns 0 if the Levels of Detail dimension is not present.
+test: none
+end:
diff --git a/api/rs_core_math.spec b/api/rs_core_math.spec
index 3b0b601..bf47bdc 100644
--- a/api/rs_core_math.spec
+++ b/api/rs_core_math.spec
@@ -14,1016 +14,1095 @@
 # limitations under the License.
 #
 
-start:
+header:
+summary: Mathematical functions
+description:
+ Most mathematical functions can be applied to scalars and vectors.
+ When applied to vectors, a vector of the function applied to each entry
+ of the input is returned.
+
+ For example:<br/>
+ <code>
+ float3 a, b;<br/>
+ // The following call sets<br/>
+ //   a.x to sin(b.x),<br/>
+ //   a.y to sin(b.y), and<br/>
+ //   a.z to sin(b.z).<br/>
+ a = sin(b);<br/>
+ </code>
+
+ A few functions like @distance() and @length() interpret instead the input
+ as a single vector in n-dimensional space.
+
+ The precision of the mathematical operations is affected by the pragmas
+# TODO Create an anchor for the section of http://developer.android.com/guide/topics/renderscript/compute.html that details rs_fp_* and link them here.
+ rs_fp_relaxed and rs_fp_full.
+
+ Different precision/speed tradeoffs can be achieved by using three variants
+ of common math functions.  Functions with a name starting with<ul>
+ <li>native_ may have custom hardware implementations with weaker precision,</li>
+ <li>half_ may perform internal computations using 16 bit floats, and</li>
+ <li>fast_ are n-dimensional space computations that may use 16 bit floats.
+ </ul>
+end:
+
+function: abs
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: i8, i16, i32
-name: abs
 ret: u#2#1
 arg: #2#1 v
-comment:
+summary: Absolute value of an integer
+description:
  Returns the absolute value of an integer.
 
- For floats, use fabs().
-version: 9
+ For floats, use @fabs().
 end:
 
-start:
+function: acos
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: acos
 ret: #2#1
-arg: #2#1 v range(-1,1)
-comment:
+arg: #2#1 v, range(-1,1)
+summary: Inverse cosine
+description:
  Returns the inverse cosine, in radians.
-version: 9
+
+ See also @native_acos().
 end:
 
-start:
+function: acosh
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: acosh
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: Inverse hyperbolic cosine
+description:
  Returns the inverse hyperbolic cosine, in radians.
-version: 9
+
+ See also @native_acosh().
 end:
 
-start:
+function: acospi
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: acospi
 ret: #2#1
-arg: #2#1 v range(-1,1)
-comment:
+arg: #2#1 v, range(-1,1)
+summary: Inverse cosine divided by pi
+description:
  Returns the inverse cosine in radians, divided by pi.
 
- To get an inverse cosine measured in degrees, use acospi(a) * 180.f.
-version: 9
+ To get an inverse cosine measured in degrees, use <code>acospi(a) * 180.f</code>.
+
+ See also @native_acospi().
 end:
 
-start:
+function: asin
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: asin
 ret: #2#1
-arg: #2#1 v range(-1,1)
-comment:
+arg: #2#1 v, range(-1,1)
+summary: Inverse sine
+description:
  Returns the inverse sine, in radians.
-version: 9
+
+ See also @native_asin().
 end:
 
-start:
+function: asinh
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: asinh
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: Inverse hyperbolic sine
+description:
  Returns the inverse hyperbolic sine, in radians.
-version: 9
+
+ See also @native_asinh().
 end:
 
-start:
+function: asinpi
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: asinpi
 ret: #2#1
-arg: #2#1 v range(-1,1)
-comment:
+arg: #2#1 v, range(-1,1)
+summary: Inverse sine divided by pi
+description:
  Returns the inverse sine in radians, divided by pi.
 
- To get an inverse sine measured in degrees, use asinpi(a) * 180.f.
-version: 9
+ To get an inverse sine measured in degrees, use <code>asinpi(a) * 180.f</code>.
+
+ See also @native_asinpi().
 end:
 
-start:
+function: atan
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: atan
 ret: #2#1
-arg: #2#1 v range(-1,1)
-comment:
+arg: #2#1 v, range(-1,1)
+summary: Inverse tangent
+description:
  Returns the inverse tangent, in radians.
-version: 9
+
+ See also @native_atan().
 end:
 
-start:
+function: atan2
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: atan2
 ret: #2#1
-arg: #2#1 numerator
-arg: #2#1 denominator
-comment:
- Returns the inverse tangent of (numerator / denominator), in radians.
+arg: #2#1 numerator, "The numerator"
+arg: #2#1 denominator, "The denominator.  Can be 0."
+summary: Inverse tangent of a ratio
+description:
+ Returns the inverse tangent of <code>(numerator / denominator)</code>, in radians.
 
- denominator can be 0.
-version: 9
+ See also @native_atan2().
 end:
 
-start:
+function: atan2pi
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: atan2pi
 ret: #2#1
-arg: #2#1 numerator
-arg: #2#1 denominator
-comment:
- Returns the inverse tangent of (numerator / denominator), in radians, divided by pi.
+arg: #2#1 numerator, "The numerator"
+arg: #2#1 denominator, "The denominator.  Can be 0."
+summary: Inverse tangent of a ratio, divided by pi
+description:
+ Returns the inverse tangent of <code>(numerator / denominator)</code>, in radians, divided by pi.
 
- To get an inverse tangent measured in degrees, use atan2pi(n, d) * 180.f.
+ To get an inverse tangent measured in degrees, use <code>atan2pi(n, d) * 180.f</code>.
 
- denominator can be 0.
-version: 9
+ See also @native_atan2pi().
 end:
 
-start:
+function: atanh
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: atanh
 ret: #2#1
-arg: #2#1 v range(-1,1)
-comment:
+arg: #2#1 v, range(-1,1)
+summary: Inverse hyperbolic tangent
+description:
  Returns the inverse hyperbolic tangent, in radians.
-version: 9
+
+ See also @native_atanh().
 end:
 
-start:
+function: atanpi
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: atanpi
 ret: #2#1
-arg: #2#1 v range(-1,1)
-comment:
+arg: #2#1 v, range(-1,1)
+summary: Inverse tangent divided by pi
+description:
  Returns the inverse tangent in radians, divided by pi.
 
- To get an inverse tangent measured in degrees, use atanpi(a) * 180.f.
-version: 9
+ To get an inverse tangent measured in degrees, use <code>atanpi(a) * 180.f</code>.
+
+ See also @native_atanpi().
 end:
 
-start:
+function: cbrt
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: cbrt
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: Cube root
+description:
  Returns the cube root.
-version: 9
+
+ See also @native_cbrt().
 end:
 
-start:
+function: ceil
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: ceil
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: Smallest integer not less than a value
+description:
  Returns the smallest integer not less than a value.
 
- For example, ceil(1.2f) returns 2.f, and ceil(-1.2f) returns -1.f.
-version: 9
+ For example, <code>ceil(1.2f)</code> returns 2.f, and <code>ceil(-1.2f)</code> returns -1.f.
+
+ See also @floor().
 end:
 
-start:
+function: clamp
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: clamp
 ret: #2#1
-arg: #2#1 value
-arg: #2#1 min_value
-arg: #2#1 max_value above(min_value)
-comment:
- Clamps a value to a specified high and low bound.
+arg: #2#1 value, "Value to be clamped."
+arg: #2#1 min_value, "Lower bound, a scalar or matching vector."
+arg: #2#1 max_value, above(min_value), "High bound, must match the type of low."
+summary: Restrain a value to a range
+description:
+ Clamps a value to a specified high and low bound.  clamp() returns min_value
+ if value &lt; min_value, max_value if value &gt; max_value, otherwise value.
 
- clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
+ There are two variants of clamp: one where the min and max are scalars applied
+ to all entries of the value, the other where the min and max are also vectors.
 
  If min_value is greater than max_value, the results are undefined.
-
- @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- @param min_value Lower bound, must be scalar or matching vector.
- @param max_value High bound, must match the type of low.
-version: 9
 end:
 
-start:
+function: clamp
+version: 9
+attrib: const
 w: 2, 3, 4
 t: f32
-name: clamp
 ret: #2#1
 arg: #2#1 value
 arg: #2 min_value
-arg: #2 max_value above(min_value)
-comment:
- Clamps a value to a specified high and low bound.
-
- clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
-
- If min_value is greater than max_value, the results are undefined.
-
- @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- @param min_value Lower bound, must be scalar or matching vector.
- @param max_value High bound, must match the type of low.
-version: 9
+arg: #2 max_value, above(min_value)
 end:
 
-start:
+function: clamp
+version: 19
+attrib: const
 w: 1, 2, 3, 4
 t: u8, u16, u32, u64, i8, i16, i32, i64
-name: clamp
 ret: #2#1
 arg: #2#1 value
 arg: #2#1 min_value
-arg: #2#1 max_value above(min_value)
-comment:
- Clamps a value to a specified high and low bound.
-
- clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
-
- If min_value is greater than max_value, the results are undefined.
-
- @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- @param min_value Lower bound, must be scalar or matching vector.
- @param max_value High bound, must match the type of low.
-version: 19
+arg: #2#1 max_value, above(min_value)
 end:
 
-start:
+function: clamp
+version: 19
+attrib: const
 w: 2, 3, 4
 t: u8, u16, u32, u64, i8, i16, i32, i64
-name: clamp
 ret: #2#1
 arg: #2#1 value
 arg: #2 min_value
-arg: #2 max_value above(min_value)
-comment:
- Clamps a value to a specified high and low bound.
-
- clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
-
- If min_value is greater than max_value, the results are undefined.
-
- @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- @param min_value Lower bound, must be scalar or matching vector.
- @param max_value High bound, must match the type of low.
-version: 19
+arg: #2 max_value, above(min_value)
 end:
 
-start:
+function: clz
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: u8, u16, u32, i8, i16, i32
-name: clz
 ret: #2#1
 arg: #2#1 value
-comment:
+summary: Number of leading 0 bits
+description:
  Returns the number of leading 0-bits in a value.
 
- For example, clz((char)0x03) returns 5.
+ For example, <code>clz((char)0x03)</code> returns 6.
+end:
+
+function: convert_#3#1
 version: 9
-end:
-
-start:
+attrib: const
 w: 2, 3, 4
 t: u8, u16, u32, i8, i16, i32, f32
 t: u8, u16, u32, i8, i16, i32, f32
-name: convert_#3#1
-arg: #2#1 v compatible(#3)
 ret: #3#1
-comment:
- Component wise conversion from #2#1 to #3#1.
+arg: #2#1 v, compatible(#3)
+summary: Converts numerical vectors
+description:
+ Component wise conversion from a numerical type to another.
 
- For the convert_* functions, conversions of floating point values to integer will truncate.
+ Conversions of floating point values to integer will truncate.
+
  Conversions of numbers too large to fit the destination type yield undefined results.
  For example, converting a float that contains 1.0e18 to a short is undefined.
+ Use @clamp() to avoid this.
+end:
+
+function: convert_#3#1
+version: 21
+attrib: const
+w: 2, 3, 4
+t: u64, i64, f64
+t: u64, i64, f64
+ret: #3#1
+arg: #2#1 v, compatible(#3)
+end:
+
+function: convert_#3#1
+version: 21
+attrib: const
+w: 2, 3, 4
+t: u64, i64, f64
+t: u8, u16, u32, i8, i16, i32, f32
+ret: #3#1
+arg: #2#1 v, compatible(#3)
+end:
+
+function: convert_#3#1
+version: 21
+attrib: const
+w: 2, 3, 4
+t: u8, u16, u32, i8, i16, i32, f32
+t: u64, i64, f64
+ret: #3#1
+arg: #2#1 v, compatible(#3)
+end:
+
+function: copysign
 version: 9
-end:
-
-start:
-w: 2, 3, 4
-t: u64, i64, f64
-t: u64, i64, f64
-name: convert_#3#1
-arg: #2#1 v compatible(#3)
-ret: #3#1
-comment:
- Component wise conversion from #2#1 to #3#1.
-
- For the convert_* functions, conversions of floating point values to integer will truncate.
- Conversions of numbers too large to fit the destination type yield undefined results.
- For example, converting a float that contains 1.0e18 to a short is undefined.
-version: 21
-end:
-
-start:
-w: 2, 3, 4
-t: u64, i64, f64
-t: u8, u16, u32, i8, i16, i32, f32
-name: convert_#3#1
-arg: #2#1 v compatible(#3)
-ret: #3#1
-comment:
- Component wise conversion from #2#1 to #3#1.
-
- For the convert_* functions, conversions of floating point values to integer will truncate.
- Conversions of numbers too large to fit the destination type yield undefined results.
- For example, converting a float that contains 1.0e18 to a short is undefined.
-version: 21
-end:
-
-start:
-w: 2, 3, 4
-t: u8, u16, u32, i8, i16, i32, f32
-t: u64, i64, f64
-name: convert_#3#1
-arg: #2#1 v compatible(#3)
-ret: #3#1
-comment:
- Component wise conversion from #2#1 to #3#1.
-
- For the convert_* functions, conversions of floating point values to integer will truncate.
- Conversions of numbers too large to fit the destination type yield undefined results.
- For example, converting a float that contains 1.0e18 to a short is undefined.
-version: 21
-end:
-
-start:
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: copysign
 ret: #2#1
 arg: #2#1 magnitude_value
 arg: #2#1 sign_value
-comment:
+summary: Copies the sign of a number to another
+description:
  Copies the sign from sign_value to magnitude_value.
 
  The value returned is either magnitude_value or -magnitude_value.
 
- For example, copysign(4.0f, -2.7f) returns -4.0f and copysign(-4.0f, 2.7f) returns 4.0f.
-version: 9
+ For example, <code>copysign(4.0f, -2.7f)</code> returns -4.0f and <code>copysign(-4.0f, 2.7f)</code> returns 4.0f.
 end:
 
-start:
+function: cos
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: cos
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: Cosine
+description:
  Returns the cosine of an angle measured in radians.
-version: 9
+
+ See also @native_cos().
 end:
 
-start:
+function: cosh
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: cosh
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: Hypebolic cosine
+description:
  Returns the hypebolic cosine of v, where v is measured in radians.
-version: 9
+
+ See also @native_cosh().
 end:
 
-start:
+function: cospi
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: cospi
 ret: #2#1
 arg: #2#1 v
-comment:
- Returns the cosine of (v * pi), where (v * pi) is measured in radians.
+summary: Cosine of a number multiplied by pi
+description:
+ Returns the cosine of <code>(v * pi)</code>, where <code>(v * pi)</code> is measured in radians.
 
- To get the cosine of a value measured in degrees, call cospi(v / 180.f).
-version: 9
+ To get the cosine of a value measured in degrees, call <code>cospi(v / 180.f)</code>.
+
+ See also @native_cospi().
 end:
 
-start:
+function: cross
+version: 9
+attrib: const
 w: 3, 4
 t: f32
-name: cross
 ret: #2#1
 arg: #2#1 left_vector
 arg: #2#1 right_vector
-comment:
+summary: Cross product of two vectors
+description:
  Computes the cross product of two vectors.
-version: 9
 test: vector
 end:
 
-start:
+function: degrees
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: degrees
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: Converts radians into degrees
+description:
  Converts from radians to degrees.
-version: 9
 end:
 
-start:
+function: distance
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: distance
 ret: #2
 arg: #2#1 left_vector
 arg: #2#1 right_vector
-comment:
+summary: Distance between two points
+description:
  Compute the distance between two points.
-version: 9
+
+ See also @fast_distance(), @native_distance().
 test: vector
 end:
 
-start:
+function: dot
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: dot
 ret: #2
 arg: #2#1 left_vector
 arg: #2#1 right_vector
-comment:
+summary: Dot product of two vectors
+description:
  Computes the dot product of two vectors.
-version: 9
 test: vector
 end:
 
-start:
+function: erf
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: erf
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: Mathematical error function
+description:
  Returns the error function.
-version: 9
 end:
 
-start:
+function: erfc
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: erfc
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: Mathematical complementary error function
+description:
  Returns the complementary error function.
-version: 9
 end:
 
-start:
+function: exp
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: exp
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: e raised to a number
+description:
  Returns e raised to v, i.e. e ^ v.
-version: 9
+
+ See also @native_exp().
 end:
 
-start:
+function: exp10
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: exp10
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: 10 raised to a number
+description:
  Returns 10 raised to v, i.e. 10.f ^ v.
-version: 9
+
+ See also @native_exp10().
 end:
 
-start:
+function: exp2
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: exp2
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: 2 raised to a number
+description:
  Returns 2 raised to v, i.e. 2.f ^ v.
-version: 9
+
+ See also @native_exp2().
 end:
 
-start:
+function: expm1
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: expm1
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: e raised to a number minus one
+description:
  Returns e raised to v minus 1, i.e. (e ^ v) - 1.
-version: 9
+
+ See also @native_expm1().
 end:
 
-start:
+function: fabs
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: fabs
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: Absolute value of a float
+description:
  Returns the absolute value of the float v.
 
- For integers, use abs().
-version: 9
+ For integers, use @abs().
 end:
 
-start:
+function: fast_distance
+version: 17
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: fast_distance
 ret: #2
 arg: #2#1 left_vector
 arg: #2#1 right_vector
-comment:
+summary: Approximate distance between two points
+description:
  Computes the approximate distance between two points.
 
  The precision is what would be expected from doing the computation using 16 bit floating point values.
-version: 17
+
+ See also @distance(), @native_distance().
 test: vector
 end:
 
-start:
+function: fast_length
+version: 17
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: fast_length
 ret: #2
 arg: #2#1 v
-comment:
+summary: Approximate length of a vector
+description:
  Computes the approximate length of a vector.
 
  The precision is what would be expected from doing the computation using 16 bit floating point values.
-version: 17
+
+ See also @length(), @native_length().
 test: vector
 end:
 
-start:
+function: fast_normalize
+version: 17
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: fast_normalize
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: Approximate normalized vector
+description:
  Approximately normalizes a vector.
 
  For vectors of size 1, returns -1.f for negative values, 0.f for null values, and 1.f for positive values.
 
  The precision is what would be expected from doing the computation using 16 bit floating point values.
-version: 17
+
+ See also @normalize(), @native_normalize().
 test: vector
 end:
 
-start:
+function: fdim
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: fdim
 ret: #2#1
 arg: #2#1 a
 arg: #2#1 b
-comment:
+summary: Positive difference between two values
+description:
  Returns the positive difference between two values.
 
- If a > b, returns (a - b) otherwise returns 0f.
-version: 9
+ If a &gt; b, returns (a - b) otherwise returns 0f.
 end:
 
-start:
+function: floor
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: floor
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: Smallest integer not greater than a value
+description:
  Returns the smallest integer not greater than a value.
-version: 9
+
+ For example, <code>floor(1.2f)</code> returns 1.f, and <code>floor(-1.2f)</code> returns -2.f.
+
+ See also @ceil().
 end:
 
-start:
+function: fma
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: fma
 ret: #2#1
 arg: #2#1 multiplicand1
 arg: #2#1 multiplicand2
 arg: #2#1 offset
-comment:
- Multiply and add.  Returns (multiplicand1 * multiplicand2) + offset.
+summary: Multiply and add
+description:
+ Multiply and add.  Returns <code>(multiplicand1 * multiplicand2) + offset</code>.
 
- This function is identical to mad().
-version: 9
+ This function is similar to @mad().  fma() retains full precision of the
+ multiplied result and rounds only after the addition.  @mad() rounds after the
+ multiplication and the addition.  This extra precision is not guaranteed in
+ rs_fp_relaxed mode.
 end:
 
-start:
+function: fmax
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: fmax
 ret: #2#1
 arg: #2#1 a
 arg: #2#1 b
-comment:
- Returns the maximum of a and b, i.e. (a < b ? b : a).
+summary: Maximum of two floats
+description:
+ Returns the maximum of a and b, i.e. <code>(a &lt; b ? b : a)</code>.
 
- The max() function returns identical results but can be applied to more data types.
-version: 9
+ The @max() function returns identical results but can be applied to more data types.
 end:
 
-start:
+function: fmax
+version: 9
+attrib: const
 w: 2, 3, 4
 t: f32
-name: fmax
 ret: #2#1
 arg: #2#1 a
 arg: #2 b
-comment:
- Returns the maximum of a and b, i.e. (a < b ? b : a).
-
- Unlike the other variants of fmax() and max(), this function compare each element of a to the scalar b.
-version: 9
 end:
 
-start:
+function: fmin
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: fmin
 ret: #2#1
 arg: #2#1 a
 arg: #2#1 b
-comment:
- Returns the minimum of a and b, i.e. (a > b ? b : a).
+summary: Minimum of two floats
+description:
+ Returns the minimum of a and b, i.e. <code>(a &gt; b ? b : a)</code>.
 
- The min() function returns identical results but can be applied to more data types.
-version: 9
+ The @min() function returns identical results but can be applied to more data types.
 end:
 
-start:
+function: fmin
+version: 9
+attrib: const
 w: 2, 3, 4
 t: f32
-name: fmin
 ret: #2#1
 arg: #2#1 a
 arg: #2 b
-comment:
- Returns the minimum of a and b, i.e. (a > b ? b : a)
-
- Unlike the other variants of fmin() and min(), this function compare each element of a to the scalar b.
-version: 9
 end:
 
-start:
+function: fmod
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: fmod
 ret: #2#1
 arg: #2#1 numerator
 arg: #2#1 denominator
-comment:
+summary: Modulo
+description:
  Returns the remainder of (numerator / denominator), where the quotient is rounded towards zero.
 
- The function remainder() is similar but rounds toward the closest interger.
- For example, fmod(-3.8f, 2.f) returns -1.8f (-3.8f - -1.f * 2.f)
- while remainder(-3.8f, 2.f) returns 0.2f (-3.8f - -2.f * 2.f).
-version: 9
+ The function @remainder() is similar but rounds toward the closest interger.
+ For example, <code>fmod(-3.8f, 2.f)</code> returns -1.8f (-3.8f - -1.f * 2.f)
+ while <code>@remainder(-3.8f, 2.f)</code> returns 0.2f (-3.8f - -2.f * 2.f).
 end:
 
-start:
+function: fract
+version: 9
 w: 1, 2, 3, 4
 t: f32
-name: fract
 ret: #2#1
-arg: #2#1 v
-arg: #2#1 *floor
-comment:
- Returns the positive fractional part of v, i.e. v - floor(v).
+arg: #2#1 v, "Input value."
+arg: #2#1* floor, "If floor is not null, *floor will be set to the floor of v."
+summary: Positive fractional part
+description:
+ Returns the positive fractional part of v, i.e. <code>v - floor(v)</code>.
 
- For example, fract(1.3f, &val) returns 0.3f and sets val to 1.f.
- fract(-1.3f, &val) returns 0.7f and sets val to -2.f.
-
- @param v Input value.
- @param floor  If floor is not null, each element of floor will be set to the floor of the corresponding element of v.
-version: 9
+ For example, <code>fract(1.3f, &val)</code> returns 0.3f and sets val to 1.f.
+ <code>fract(-1.3f, &val)</code> returns 0.7f and sets val to -2.f.
 end:
 
-start:
+function: fract
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: fract
 ret: #2#1
 arg: #2#1 v
-comment:
- Returns the positive fractional part of v, i.e. v - floor(v).
-
- For example, fract(1.3f, &val) returns 0.3f and sets val to 1.f.
- fract(-1.3f, &val) returns 0.7f and sets val to -2.f.
 inline:
-    #2#1 unused;
-    return fract(v, &unused);
-version: 9
+ #2#1 unused;
+ return fract(v, &unused);
 end:
 
-start:
+function: frexp
+version: 9
 w: 1, 2, 3, 4
 t: f32
-name: frexp
 ret: #2#1
-arg: #2#1 v
-arg: int#1 *exponent
-comment:
- Returns the binary mantissa and exponent of v, e.g. v == mantissa * 2 ^ exponent.
+arg: #2#1 v, "Input value."
+arg: int#1* exponent, "If exponent is not null, *exponent will be set to the exponent of v."
+summary: Binary mantissa and exponent
+description:
+ Returns the binary mantissa and exponent of v, i.e. <code>v == mantissa * 2 ^ exponent</code>.
 
  The mantissa is always between 0.5 (inclusive) and 1.0 (exclusive).
- See ldexp() for the reverse operation.
 
- @param v Supports float, float2, float3, float4.
- @param exponent  If exponent is not null, each element of exponent will be set to the exponent of the corresponding element of v.
-version: 9
+ See @ldexp() for the reverse operation.  See also @logb() and @ilogb().
 end:
 
-start:
+function: half_recip
+version: 17
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: half_recip
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: Reciprocal computed to 16 bit precision
+description:
  Returns the approximate reciprocal of a value.
 
  The precision is that of a 16 bit floating point value.
-version: 17
+
+ See also @native_recip().
 end:
 
-start:
+function: half_rsqrt
+version: 17
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: half_rsqrt
 ret: #2#1
 arg: #2#1 v
-comment:
- Returns the approximate value of (1.f / sqrt(value)).
+summary: Reciprocal of a square root computed to 16 bit precision
+description:
+ Returns the approximate value of <code>(1.f / sqrt(value))</code>.
 
  The precision is that of a 16 bit floating point value.
-version: 17
+
+ See also @rsqrt(), @native_rsqrt().
 end:
 
-start:
+function: half_sqrt
+version: 17
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: half_sqrt
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: Square root computed to 16 bit precision
+description:
  Returns the approximate square root of a value.
 
  The precision is that of a 16 bit floating point value.
-version: 17
+
+ See also @sqrt(), @native_sqrt().
 end:
 
-start:
+function: hypot
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: hypot
 ret: #2#1
 arg: #2#1 a
 arg: #2#1 b
-comment:
- Returns the hypotenuse, i.e. sqrt(a * a + b * b).
-version: 9
+summary: Hypotenuse
+description:
+ Returns the hypotenuse, i.e. <code>sqrt(a * a + b * b)</code>.
+
+ See also @native_hypot().
 end:
 
-start:
+function: ilogb
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: ilogb
 ret: int#1
 arg: float#1 v
-comment:
- Returns the base two exponent of a value, where the mantissa is between 1.f (inclusive) and 2.f (exclusive).
+summary: Base two exponent
+description:
+ Returns the base two exponent of a value, where the mantissa is between
+ 1.f (inclusive) and 2.f (exclusive).
 
- For example, ilogb(8.5f) returns 3.  Because of the difference in mantissa, this number is one less than
- is returned by frexp().
+ For example, <code>ilogb(8.5f)</code> returns 3.
 
- logb() is similar but returns a float.
-version: 9
+ Because of the difference in mantissa, this number is one less than
+ is returned by @frexp().
+
+ @logb() is similar but returns a float.
 test: custom
 end:
 
-start:
-w: 1, 2, 3, 4
-name: ldexp
-ret: float#1
-arg: float#1 mantissa
-arg: int#1 exponent
-comment:
- Returns the floating point created from the mantissa and exponent, i.e. (mantissa * 2 ^ exponent).
-
- See frexp() for the reverse operation.
-
- @param mantissa Supports float, float2, float3, and float4.
- @param exponent Supports single component or matching vector.
+function: ldexp
 version: 9
+attrib: const
+w: 1, 2, 3, 4
+ret: float#1
+arg: float#1 mantissa, "The mantissa"
+arg: int#1 exponent, "The exponent, a single component or matching vector."
+summary: Creates a floating point from mantissa and exponent
+description:
+ Returns the floating point created from the mantissa and exponent,
+ i.e. (mantissa * 2 ^ exponent).
+
+ See @frexp() for the reverse operation.
 end:
 
-start:
+function: ldexp
+version: 9
+attrib: const
 w: 2, 3, 4
-name: ldexp
 ret: float#1
 arg: float#1 mantissa
 arg: int exponent
-comment:
- Returns the floating point created from the mantissa and exponent, i.e. (mantissa * 2 ^ exponent).
- See frexp() for the reverse operation.
-
- @param mantissa Supports float, float2, float3, and float4.
- @param exponent Supports single component or matching vector.
-version: 9
 end:
 
-start:
+function: length
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: length
 ret: #2
 arg: #2#1 v
-comment:
+summary: Length of a vector
+description:
  Computes the length of a vector.
-version: 9
+
+ See also @fast_length(), @native_length().
 test: vector
 end:
 
-start:
+function: lgamma
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: lgamma
 ret: #2#1
 arg: #2#1 v
-comment:
- Returns the natural logarithm of the absolute value of the gamma function, i.e. log(fabs(gamma(v))).
-version: 9
+summary: Natural logarithm of the gamma function
+description:
+ Returns the natural logarithm of the absolute value of the gamma function,
+ i.e. <code>@log(@fabs(@tgamma(v)))</code>.
+
+ See also @tgamma().
 end:
 
-start:
+function: lgamma
+version: 9
 w: 1, 2, 3, 4
 t: f32
-name: lgamma
 ret: #2#1
 arg: #2#1 v
-arg: int#1 *sign_of_gamma
-comment:
- Returns the natural logarithm of the absolute value of the gamma function, i.e. log(fabs(gamma(v))).
-
- Can also return the sign of the gamma function.
-
- @param v Input value.
- @param sign_of_gamma  If sign is not null, each element of sign will be set to -1.f if the gamma of the corresponding element of v is negative, otherwise to 1.f.
-
-version: 9
-#TODO Temporary until bionic & associated drivers are fixed
+arg: int#1* sign_of_gamma, "If sign_of_gamma is not null, *sign_of_gamma will be set to -1.f if the gamma of v is negative, otherwise to 1.f."
 test: custom
+#TODO Temporary until bionic & associated drivers are fixed
 end:
 
-start:
+function: log
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: log
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: Natural logarithm
+description:
  Returns the natural logarithm.
-version: 9
+
+ See also @native_log().
 end:
 
-start:
+function: log10
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: log10
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: Base 10 logarithm
+description:
  Returns the base 10 logarithm.
-version: 9
+
+ See also @native_log10().
 end:
 
-start:
+function: log1p
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: log1p
 ret: #2#1
 arg: #2#1 v
-comment:
- Returns the natural logarithm of (v + 1.f).
-version: 9
+summary: Natural logarithm of a value plus 1
+description:
+ Returns the natural logarithm of <code>(v + 1.f)</code>.
+
+ See also @native_log1p().
 end:
 
-start:
+function: log2
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: log2
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: Base 2 logarithm
+description:
  Returns the base 2 logarithm.
-version: 9
+
+ See also @native_log2().
 end:
 
-start:
+function: logb
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: logb
 ret: #2#1
 arg: #2#1 v
-comment:
- Returns the base two exponent of a value, where the mantissa is between 1.f (inclusive) and 2.f (exclusive).
+summary: Base two exponent
+description:
+ Returns the base two exponent of a value, where the mantissa is between
+ 1.f (inclusive) and 2.f (exclusive).
 
- For example, logb(8.5f) returns 3.f.  Because of the difference in mantissa, this number is one less than
+ For example, <code>logb(8.5f)</code> returns 3.f.
+
+ Because of the difference in mantissa, this number is one less than
  is returned by frexp().
 
- ilogb() is similar but returns an integer.
-version: 9
+ @ilogb() is similar but returns an integer.
 end:
 
-start:
+function: mad
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: mad
 ret: #2#1
 arg: #2#1 multiplicand1
 arg: #2#1 multiplicand2
 arg: #2#1 offset
-comment:
- Multiply and add.  Returns (multiplicand1 * multiplicand2) + offset.
+summary: Multiply and add
+description:
+ Multiply and add.  Returns <code>(multiplicand1 * multiplicand2) + offset</code>.
 
- This function is identical to fma().
-version: 9
+ This function is similar to @fma().  @fma() retains full precision of the
+ multiplied result and rounds only after the addition.  mad() rounds after the
+ multiplication and the addition.  In rs_fp_relaxed mode, mad() may not do the
+ rounding after multiplicaiton.
 end:
 
-start:
+function: max
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: max
 ret: #2#1
 arg: #2#1 a
 arg: #2#1 b
-comment:
+summary: Maximum
+description:
  Returns the maximum value of two arguments.
-version: 9
 end:
 
-start:
+function: max
+version: 9 20
+attrib: const
 w: 1
-t: i8 i16 i32 u8 u16 u32
-name: max
+t: i8, i16, i32, u8, u16, u32
 ret: #2#1
 arg: #2#1 a
 arg: #2#1 b
-comment:
- Returns the maximum value of two arguments.
 inline:
  return (a > b ? a : b);
-version: 9 20
 end:
 
-start:
+function: max
+version: 9 20
+attrib: const
 w: 2
-t: i8 i16 i32 u8 u16 u32
-name: max
+t: i8, i16, i32, u8, u16, u32
 ret: #2#1
 arg: #2#1 a
 arg: #2#1 b
-comment:
- Returns the maximum value of two arguments.
 inline:
  #2#1 tmp;
  tmp.x = (a.x > b.x ? a.x : b.x);
  tmp.y = (a.y > b.y ? a.y : b.y);
  return tmp;
-version: 9 20
 end:
 
-start:
+function: max
+version: 9 20
+attrib: const
 w: 3
-t: i8 i16 i32 u8 u16 u32
-name: max
+t: i8, i16, i32, u8, u16, u32
 ret: #2#1
 arg: #2#1 a
 arg: #2#1 b
-comment:
- Returns the maximum value of two arguments.
 inline:
  #2#1 tmp;
  tmp.x = (a.x > b.x ? a.x : b.x);
  tmp.y = (a.y > b.y ? a.y : b.y);
  tmp.z = (a.z > b.z ? a.z : b.z);
  return tmp;
-version: 9 20
 end:
 
-start:
+function: max
+version: 9 20
+attrib: const
 w: 4
-t: i8 i16 i32 u8 u16 u32
-name: max
+t: i8, i16, i32, u8, u16, u32
 ret: #2#1
 arg: #2#1 a
 arg: #2#1 b
-comment:
- Returns the maximum value of two arguments.
 inline:
  #2#1 tmp;
  tmp.x = (a.x > b.x ? a.x : b.x);
@@ -1031,91 +1110,82 @@
  tmp.z = (a.z > b.z ? a.z : b.z);
  tmp.w = (a.w > b.w ? a.w : b.w);
  return tmp;
-version: 9 20
 end:
 
-start:
+function: max
+version: 21
+attrib: const
 w: 1, 2, 3, 4
-t: i8 i16 i32 i64 u8 u16 u32 u64
-name: max
+t: i8, i16, i32, i64, u8, u16, u32, u64
 ret: #2#1
 arg: #2#1 a
 arg: #2#1 b
-comment:
- Returns the maximum value of two arguments.
-version: 21
 end:
 
-start:
+function: min
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: min
 ret: #2#1
 arg: #2#1 a
 arg: #2#1 b
-comment:
+summary: Minimum
+description:
  Returns the minimum value of two arguments.
-version: 9
 end:
 
-start:
+function: min
+version: 9 20
+attrib: const
 w: 1
-t: i8 i16 i32 u8 u16 u32
-name: min
+t: i8, i16, i32, u8, u16, u32
 ret: #2#1
 arg: #2#1 a
 arg: #2#1 b
-comment:
- Returns the minimum value of two arguments.
 inline:
  return (a < b ? a : b);
-version: 9 20
 end:
 
-start:
+function: min
+version: 9 20
+attrib: const
 w: 2
-t: i8 i16 i32 u8 u16 u32
-name: min
+t: i8, i16, i32, u8, u16, u32
 ret: #2#1
 arg: #2#1 a
 arg: #2#1 b
-comment:
- Returns the minimum value of two arguments.
 inline:
  #2#1 tmp;
  tmp.x = (a.x < b.x ? a.x : b.x);
  tmp.y = (a.y < b.y ? a.y : b.y);
  return tmp;
-version: 9 20
 end:
 
-start:
+function: min
+version: 9 20
+attrib: const
 w: 3
-t: i8 i16 i32 u8 u16 u32
-name: min
+t: i8, i16, i32, u8, u16, u32
 ret: #2#1
 arg: #2#1 a
 arg: #2#1 b
-comment:
- Returns the minimum value of two arguments.
 inline:
  #2#1 tmp;
  tmp.x = (a.x < b.x ? a.x : b.x);
  tmp.y = (a.y < b.y ? a.y : b.y);
  tmp.z = (a.z < b.z ? a.z : b.z);
  return tmp;
-version: 9 20
 end:
 
-start:
+function: min
+version: 9 20
+attrib: const
 w: 4
-t: i8 i16 i32 u8 u16 u32
-name: min
+t: i8, i16, i32, u8, u16, u32
 ret: #2#1
 arg: #2#1 a
 arg: #2#1 b
-comment:
- Returns the minimum value of two arguments.
 inline:
  #2#1 tmp;
  tmp.x = (a.x < b.x ? a.x : b.x);
@@ -1123,952 +1193,1092 @@
  tmp.z = (a.z < b.z ? a.z : b.z);
  tmp.w = (a.w < b.w ? a.w : b.w);
  return tmp;
-version: 9 20
 end:
 
-start:
+function: min
+version: 21
+attrib: const
 w: 1, 2, 3, 4
-t: i8 i16 i32 i64 u8 u16 u32 u64
-name: min
+t: i8, i16, i32, i64, u8, u16, u32, u64
 ret: #2#1
 arg: #2#1 a
 arg: #2#1 b
-comment:
- Returns the minimum value of two arguments.
-version: 21
 end:
 
-start:
+function: mix
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: mix
 ret: #2#1
 arg: #2#1 start
 arg: #2#1 stop
 arg: #2#1 fraction
-comment:
+summary: Mixes two values
+description:
  Returns start + ((stop - start) * fraction).
 
- This can be useful for mixing two values.  For example, to create a new color that is 40% color1 and 60% color2, use mix(color1, color2, 0.6f).
-version: 9
+ This can be useful for mixing two values.  For example, to create a new color that is 40% color1 and 60% color2, use <code>mix(color1, color2, 0.6f)</code>.
 end:
 
-start:
+function: mix
+version: 9
+attrib: const
 w: 2, 3, 4
 t: f32
-name: mix
 ret: #2#1
 arg: #2#1 start
 arg: #2#1 stop
 arg: #2 fraction
-comment:
- Returns start + ((stop - start) * fraction).
-
- This can be useful for mixing two values.  For example, to create a new color that is 40% color1 and 60% color2, use mix(color1, color2, 0.6f).
-version: 9
 end:
 
-start:
+function: modf
+version: 9
 w: 1, 2, 3, 4
 t: f32
-name: modf
-ret: #2#1
-arg: #2#1 v
-arg: #2#1 *integral_part
-comment:
+ret: #2#1, "The floating point portion of the value."
+arg: #2#1 v, "Source value"
+arg: #2#1* integral_part, "*integral_part will be set to the integral portion of the number."
+summary: Integral and fractional components
+description:
  Returns the integral and fractional components of a number.
 
  Both components will have the same sign as x.  For example, for an input of -3.72f, iret will be set to -3.f and .72f will be returned.
-
- @param v Source value
- @param integral_part integral_part[0] will be set to the integral portion of the number.
- @return The floating point portion of the value.
-version: 9
 end:
 
-start:
+function: nan
+version: 9
+attrib: const
 w: 1
 t: f32
-name: nan
 ret: #2#1
-arg: uint#1 v
-comment:
- Returns a NaN value (Not a Number).
-
- @param v Not used.
+arg: uint#1 v, "Not used."
 #TODO We're not using the argument.  Once we do, add this documentation line:
 # The argument is embedded into the return value and can be used to distinguish various NaNs.
-version: 9
+summary: Not a Number
+description:
+ Returns a NaN value (Not a Number).
 end:
 
-start:
+function: native_acos
+version: 21
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: native_acos
 ret: #2#1
-arg: #2#1 v range(-1,1)
-comment:
+arg: #2#1 v, range(-1,1)
+summary: Approximate inverse cosine
+description:
  Returns the approximate inverse cosine, in radians.
-version: 21
+
+ This function yields undefined results from input values less than -1 or greater
+ than 1.
+
+ See also @acos().
 # TODO Temporary
 test: limited(0.0005)
 end:
 
-start:
+function: native_acosh
+version: 21
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: native_acosh
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: Approximate inverse hyperbolic cosine
+description:
  Returns the approximate inverse hyperbolic cosine, in radians.
-version: 21
+
+ See also @acosh().
 # TODO Temporary
 test: limited(0.0005)
 end:
 
-start:
+function: native_acospi
+version: 21
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: native_acospi
 ret: #2#1
-arg: #2#1 v range(-1,1)
-comment:
+arg: #2#1 v, range(-1,1)
+summary: Approximate inverse cosine divided by pi
+description:
  Returns the approximate inverse cosine in radians, divided by pi.
 
- To get an inverse cosine measured in degrees, use acospi(a) * 180.f.
-version: 21
+ To get an inverse cosine measured in degrees, use <code>acospi(a) * 180.f</code>.
+
+ This function yields undefined results from input values less than -1 or greater
+ than 1.
+
+ See also @acospi().
 # TODO Temporary
 test: limited(0.0005)
 end:
 
-start:
+function: native_asin
+version: 21
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: native_asin
 ret: #2#1
-arg: #2#1 v range(-1,1)
-comment:
+arg: #2#1 v, range(-1,1)
+summary: Approximate inverse sine
+description:
  Returns the approximate inverse sine, in radians.
-version: 21
+
+ This function yields undefined results from input values less than -1 or greater
+ than 1.
+
+ See also @asin().
 # TODO Temporary
 test: limited(0.0005)
 end:
 
-start:
+function: native_asinh
+version: 21
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: native_asinh
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: Approximate inverse hyperbolic sine
+description:
  Returns the approximate inverse hyperbolic sine, in radians.
-version: 21
+
+ See also @asinh().
 # TODO Temporary
 test: limited(0.0005)
 end:
 
-start:
+function: native_asinpi
+version: 21
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: native_asinpi
 ret: #2#1
-arg: #2#1 v range(-1,1)
-comment:
+arg: #2#1 v, range(-1,1)
+summary: Approximate inverse sine divided by pi
+description:
  Returns the approximate inverse sine in radians, divided by pi.
 
- To get an inverse sine measured in degrees, use asinpi(a) * 180.f.
-version: 21
+ To get an inverse sine measured in degrees, use <code>asinpi(a) * 180.f</code>.
+
+ This function yields undefined results from input values less than -1 or greater
+ than 1.
+
+ See also @asinpi().
 # TODO Temporary
 test: limited(0.0005)
 end:
 
-start:
+function: native_atan
+version: 21
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: native_atan
 ret: #2#1
-arg: #2#1 v range(-1,1)
-comment:
+arg: #2#1 v, range(-1,1)
+summary: Approximate inverse tangent
+description:
  Returns the approximate inverse tangent, in radians.
-version: 21
+
+ See also @atan().
 # TODO Temporary
 test: limited(0.0005)
 end:
 
-start:
+function: native_atan2
+version: 21
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: native_atan2
 ret: #2#1
-arg: #2#1 numerator
-arg: #2#1 denominator
-comment:
- Returns the approximate inverse tangent of numerator / denominator, in radians.
+arg: #2#1 numerator, "The numerator"
+arg: #2#1 denominator, "The denominator.  Can be 0."
+summary: Approximate inverse tangent of a ratio
+description:
+ Returns the approximate inverse tangent of <code>(numerator / denominator)</code>, in radians.
 
- denominator can be 0.
-version: 21
+ See also @atan2().
 # TODO Temporary
 test: limited(0.0005)
 end:
 
-start:
+function: native_atan2pi
+version: 21
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: native_atan2pi
 ret: #2#1
-arg: #2#1 numerator
-arg: #2#1 denominator
-comment:
- Returns the approximate inverse tangent of numerator / denominator, in radians, divided by pi.
+arg: #2#1 numerator, "The numerator"
+arg: #2#1 denominator, "The denominator.  Can be 0."
+summary: Approximate inverse tangent of a ratio, divided by pi
+description:
+ Returns the approximate inverse tangent of <code>(numerator / denominator)</code>, in radians, divided by pi.
 
- To get an inverse tangent measured in degrees, use atan2pi(n, d) * 180.f.
+ To get an inverse tangent measured in degrees, use <code>atan2pi(n, d) * 180.f</code>.
 
- denominator can be 0.
-version: 21
+ See also @atan2pi().
 # TODO Temporary
 test: limited(0.0005)
 end:
 
-start:
+function: native_atanh
+version: 21
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: native_atanh
 ret: #2#1
-arg: #2#1 v range(-1,1)
-comment:
+arg: #2#1 v, range(-1,1)
+summary: Approximate inverse hyperbolic tangent
+description:
  Returns the approximate inverse hyperbolic tangent, in radians.
-version: 21
+
+ See also @atanh().
 # TODO Temporary
 test: limited(0.0005)
 end:
 
-start:
+function: native_atanpi
+version: 21
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: native_atanpi
 ret: #2#1
-arg: #2#1 v range(-1,1)
-comment:
+arg: #2#1 v, range(-1,1)
+summary: Approximate inverse tangent divided by pi
+description:
  Returns the approximate inverse tangent in radians, divided by pi.
 
- To get an inverse tangent measured in degrees, use atanpi(a) * 180.f.
-version: 21
+ To get an inverse tangent measured in degrees, use <code>atanpi(a) * 180.f</code>.
+
+ See also @atanpi().
 # TODO Temporary
 test: limited(0.0005)
 end:
 
-start:
+function: native_cbrt
+version: 21
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: native_cbrt
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: Approximate cube root
+description:
  Returns the approximate cubic root.
-version: 21
+
+ See also @cbrt().
 end:
 
-start:
+function: native_cos
+version: 21
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: native_cos
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: Approximate cosine
+description:
  Returns the approximate cosine of an angle measured in radians.
-version: 21
+
+ See also @cos().
 end:
 
-start:
+function: native_cosh
+version: 21
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: native_cosh
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: Approximate hypebolic cosine
+description:
  Returns the approximate hypebolic cosine.
-version: 21
+
+ See also @cosh().
 end:
 
-start:
+function: native_cospi
+version: 21
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: native_cospi
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: Approximate cosine of a number multiplied by pi
+description:
  Returns the approximate cosine of (v * pi), where (v * pi) is measured in radians.
 
- To get the cosine of a value measured in degrees, call cospi(v / 180.f).
-version: 21
+ To get the cosine of a value measured in degrees, call <code>cospi(v / 180.f)</code>.
+
+ See also @cospi().
 end:
 
-start:
+function: native_distance
+version: 21
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: native_distance
 ret: #2
 arg: #2#1 left_vector
 arg: #2#1 right_vector
-comment:
+summary: Approximate distance between two points
+description:
  Computes the approximate distance between two points.
-version: 21
+
+ See also @distance(), @fast_distance().
 test: vector
 end:
 
-start:
+function: native_divide
+version: 21
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: native_divide
 ret: #2#1
 arg: #2#1 left_vector
 arg: #2#1 right_vector
-comment:
- Computes the approximate division result of two values.
-version: 21
+summary: Approximate division
+description:
+ Computes the approximate division of two values.
 end:
 
-start:
+function: native_exp
+version: 18
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: native_exp
 ret: #2#1
-arg: #2#1 v range(-86,86)
-comment:
+arg: #2#1 v, range(-86,86)
+summary: Approximate e raised to a number
+description:
  Fast approximate exp.
 
  It is valid for inputs from -86.f to 86.f.  The precision is no worse than what would be expected from using 16 bit floating point values.
-version: 18
+
+ See also @exp().
 test: limited
 end:
 
-start:
+function: native_exp10
+version: 18
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: native_exp10
 ret: #2#1
-arg: #2#1 v range(-37,37)
-comment:
+arg: #2#1 v, range(-37,37)
+summary: Approximate 10 raised to a number
+description:
  Fast approximate exp10.
 
  It is valid for inputs from -37.f to 37.f.  The precision is no worse than what would be expected from using 16 bit floating point values.
-version: 18
+
+ See also @exp10().
 test: limited
 end:
 
-start:
+function: native_exp2
+version: 18
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: native_exp2
 ret: #2#1
-arg: #2#1 v range(-125,125)
-comment:
+arg: #2#1 v, range(-125,125)
+summary: Approximate 2 raised to a number
+description:
  Fast approximate exp2.
 
  It is valid for inputs from -125.f to 125.f.  The precision is no worse than what would be expected from using 16 bit floating point values.
-version: 18
+
+ See also @exp2().
 test: limited
 end:
 
-start:
+function: native_expm1
+version: 21
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: native_expm1
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: Approximate e raised to a number minus one
+description:
  Returns the approximate (e ^ v) - 1.
-version: 21
+
+ See also @expm1().
 end:
 
-start:
+function: native_hypot
+version: 21
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: native_hypot
 ret: #2#1
 arg: #2#1 a
 arg: #2#1 b
-comment:
+summary: Approximate hypotenuse
+description:
  Returns the approximate native_sqrt(a * a + b * b)
-version: 21
+
+ See also @hypot().
 end:
 
-start:
+function: native_length
+version: 21
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: native_length
 ret: #2
 arg: #2#1 v
-comment:
+summary: Approximate length of a vector
+description:
  Compute the approximate length of a vector.
-version: 21
+
+ See also @length(), @fast_length().
 test: vector
 end:
 
-start:
+function: native_log
+version: 18
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: native_log
 ret: #2#1
-arg: #2#1 v range(10e-10,10e10)
-comment:
+arg: #2#1 v, range(10e-10,10e10)
+summary: Approximate natural logarithm
+description:
  Fast approximate log.
 
  It is not accurate for values very close to zero.
-version: 18
+
+ See also @log().
 test: limited
 end:
 
-start:
+function: native_log10
+version: 18
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: native_log10
 ret: #2#1
-arg: #2#1 v range(10e-10,10e10)
-comment:
+arg: #2#1 v, range(10e-10,10e10)
+summary: Approximate base 10 logarithm
+description:
  Fast approximate log10.
 
  It is not accurate for values very close to zero.
-version: 18
+
+ See also @log10().
 test: limited
 end:
 
-start:
+function: native_log1p
+version: 21
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: native_log1p
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: Approximate natural logarithm of a value plus 1
+description:
  Returns the approximate natural logarithm of (v + 1.0f)
-version: 21
+
+ See also @log1p().
 end:
 
-start:
+function: native_log2
+version: 18
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: native_log2
 ret: #2#1
-arg: #2#1 v range(10e-10,10e10)
-comment:
+arg: #2#1 v, range(10e-10,10e10)
+summary: Approximate base 2 logarithm
+description:
  Fast approximate log2.
 
  It is not accurate for values very close to zero.
-version: 18
+
+ See also @log2().
 test: limited
 end:
 
-start:
+function: native_normalize
+version: 21
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: native_normalize
 ret: #2#1
 arg: #2#1 v
-comment:
+summary:  Approximately normalize a vector
+description:
  Approximately normalizes a vector.
-version: 21
+
+ See also @normalize(), @fast_normalize().
 test: vector
 end:
 
-start:
+function: native_powr
+version: 18
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: native_powr
 ret: #2#1
-arg: #2#1 base range(0,256)
-arg: #2#1 exponent range(-15,15)
-comment:
+arg: #2#1 base, range(0,256), "Must be between 0.f and 256.f.  The function is not accurate for values very close to zero."
+arg: #2#1 exponent, range(-15,15), "Must be between -15.f and 15.f."
+summary: Approximate positive base raised to an exponent
+description:
  Fast approximate (base ^ exponent).
 
- @param base Must be between 0.f and 256.f.  The function is not accurate for values very close to zero.
- @param exponent Must be between -15.f and 15.f.
-version: 18
+ See also @powr().
 test: limited
 end:
 
-start:
+function: native_recip
+version: 21
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: native_recip
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: Approximate reciprocal
+description:
  Returns the approximate approximate reciprocal of a value.
-version: 21
+
+ See also @half_recip().
 end:
 
-start:
+function: native_rootn
+version: 21
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: native_rootn
 ret: #2#1
 arg: #2#1 v
 arg: int#1 n
-comment:
+summary: Approximate nth root
+description:
  Compute the approximate Nth root of a value.
-version: 21
+
+ See also @rootn().
 end:
 
-start:
+function: native_rsqrt
+version: 21
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: native_rsqrt
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: Approximate reciprocal of a square root
+description:
  Returns approximate (1 / sqrt(v)).
-version: 21
+
+ See also @rsqrt(), @half_rsqrt().
 end:
 
-start:
+function: native_sin
+version: 21
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: native_sin
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: Approximate sine
+description:
  Returns the approximate sine of an angle measured in radians.
-version: 21
+
+ See also @sin().
 end:
 
-start:
+function: native_sincos
+version: 21
 w: 1, 2, 3, 4
 t: f32
-name: native_sincos
-ret: #2#1
-arg: #2#1 v
-arg: #2#1 *cos
-comment:
+ret: #2#1, "sine"
+arg: #2#1 v, "The incoming value in radians."
+arg: #2#1* cos, "*cos will be set to the cosine value."
+summary: Approximate sine and cosine
+description:
  Returns the approximate sine and cosine of a value.
 
- @return sine
- @param v The incoming value in radians
- @param *cos cos[0] will be set to the cosine value.
-version: 21
+ See also @sincos().
 # TODO Temporary
 test: limited(0.0005)
 end:
 
-start:
+function: native_sinh
+version: 21
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: native_sinh
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: Approximate hyperbolic sine
+description:
  Returns the approximate hyperbolic sine of a value specified in radians.
-version: 21
+
+ See also @sinh().
 end:
 
-start:
+function: native_sinpi
+version: 21
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: native_sinpi
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: Approximate sine of a number multiplied by pi
+description:
  Returns the approximate sine of (v * pi), where (v * pi) is measured in radians.
 
- To get the sine of a value measured in degrees, call sinpi(v / 180.f).
-version: 21
+ To get the sine of a value measured in degrees, call <code>sinpi(v / 180.f)</code>.
+
+ See also @sinpi().
 end:
 
-start:
+function: native_sqrt
+version: 21
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: native_sqrt
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: Approximate square root
+description:
  Returns the approximate sqrt(v).
-version: 21
+
+ See also @sqrt(), @half_sqrt().
 end:
 
-start:
+function: native_tan
+version: 21
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: native_tan
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: Approximate tangent
+description:
  Returns the approximate tangent of an angle measured in radians.
-version: 21
 end:
 
-start:
+function: native_tanh
+version: 21
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: native_tanh
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: Approximate hyperbolic tangent
+description:
  Returns the approximate hyperbolic tangent of a value.
-version: 21
+
+ See also @tanh().
 end:
 
-start:
+function: native_tanpi
+version: 21
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: native_tanpi
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: Approximate tangent of a number multiplied by pi
+description:
  Returns the approximate tangent of (v * pi), where (v * pi) is measured in radians.
 
- To get the tangent of a value measured in degrees, call tanpi(v / 180.f).
-version: 21
+ To get the tangent of a value measured in degrees, call <code>tanpi(v / 180.f)</code>.
+
+ See also @tanpi().
 end:
 
-start:
+function: nextafter
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: nextafter
 ret: #2#1
 arg: #2#1 v
 arg: #2#1 target
-comment:
- Returns the next floating point number from v towards target.
-version: 9
+summary: Next floating point number
+description:
+ Returns the next representable floating point number from v towards target.
+
+ In rs_fp_relaxed mode, a denormalized input value may not yield the next
+ denormalized  value, as support of denormalized values is optional in
+ relaxed mode.
 end:
 
-start:
+function: normalize
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: normalize
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: Normalize a vector
+description:
  Normalize a vector.
 
  For vectors of size 1, returns -1.f for negative values, 0.f for null values, and 1.f for positive values.
-version: 9
+
+ See also @fast_normalize(), @native_normalize().
 test: vector
 end:
 
-start:
+function: pow
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: pow
 ret: #2#1
 arg: #2#1 base
 arg: #2#1 exponent
-comment:
+summary: Base raised to an exponent
+description:
  Returns base raised to the power exponent, i.e. base ^ exponent.
 
- pown() and powr() are similar.  pown() takes an integer exponent. powr() assumes the base to be non-negative.
-version: 9
+ @pown() and @powr() are similar.  @pown() takes an integer exponent. @powr() assumes the base to be non-negative.
 end:
 
-start:
+function: pown
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: pown
 ret: #2#1
 arg: #2#1 base
 arg: int#1 exponent
-comment:
+summary: Base raised to an integer exponent
+description:
  Returns base raised to the power exponent, i.e. base ^ exponent.
 
- pow() and powr() are similar.  The both take a float exponent. powr() also assumes the base to be non-negative.
-version: 9
+ @pow() and @powr() are similar.  The both take a float exponent. @powr() also assumes the base to be non-negative.
 end:
 
-start:
+function: powr
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: powr
 ret: #2#1
-arg: #2#1 base range(0,3000)
+arg: #2#1 base, range(0,3000)
 arg: #2#1 exponent
-comment:
- Returns base raised to the power exponent, i.e. base ^ exponent.  base must be >= 0.
+summary: Positive base raised to an exponent
+description:
+ Returns base raised to the power exponent, i.e. base ^ exponent.  base must be &gt;= 0.
 
- pow() and pown() are similar.  They both make no assumptions about the base.  pow() takes a float exponent while pown() take an integer.
-version: 9
+ @pow() and @pown() are similar.  They both make no assumptions about the base.  @pow() takes a float exponent while @pown() take an integer.
+
+ See also @native_powr().
 end:
 
-start:
+function: radians
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: radians
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: Converts degrees into radians
+description:
  Converts from degrees to radians.
-version: 9
 end:
 
-start:
+function: remainder
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: remainder
 ret: #2#1
 arg: #2#1 numerator
 arg: #2#1 denominator
-comment:
+summary: Remainder of a division
+description:
  Returns the remainder of (numerator / denominator), where the quotient is rounded towards the nearest integer.
 
- The function fmod() is similar but rounds toward the closest interger.
- For example, fmod(-3.8f, 2.f) returns -1.8f (-3.8f - -1.f * 2.f)
- while remainder(-3.8f, 2.f) returns 0.2f (-3.8f - -2.f * 2.f).
-version: 9
+ The function @fmod() is similar but rounds toward the closest interger.
+ For example, <code>@fmod(-3.8f, 2.f)</code> returns -1.8f (-3.8f - -1.f * 2.f)
+ while <code>remainder(-3.8f, 2.f)</code> returns 0.2f (-3.8f - -2.f * 2.f).
 end:
 
-start:
+function: remquo
+version: 9
 w: 1, 2, 3, 4
 t: f32
-name: remquo
-ret: #2#1
-arg: #2#1 numerator
-arg: #2#1 denominator
-arg: int#1 *quotient
-comment:
+ret: #2#1, "The remainder, precise only for the low three bits."
+arg: #2#1 numerator, "The numerator."
+arg: #2#1 denominator, "The denominator."
+arg: int#1* quotient, "*quotient will be set to the integer quotient."
+summary: Remainder and quotient of a division
+description:
  Returns the quotient and the remainder of (numerator / denominator).
 
  Only the sign and lowest three bits of the quotient are guaranteed to be accurate.
 
- This function is useful for implementing periodic functions.  The low three bits of the quotient gives the quadrant and the remainder the distance within the quadrant.  For example, an implementation of sin(x) could call remquo(x, PI / 2.f, &quadrant) to reduce very large value of x to something within a limited range.
+ This function is useful for implementing periodic functions.  The low three bits of the quotient gives the quadrant and the remainder the distance within the quadrant.  For example, an implementation of @sin(x) could call <code>remquo(x, PI / 2.f, &quadrant)</code> to reduce very large value of x to something within a limited range.
 
- Example: remquo(-23.5f, 8.f, &quot) sets the lowest three bits of quot to 3 and the sign negative.  It returns 0.5f.
-
- @param numerator The numerator.
- @param denominator The denominator.
- @param *quotient quotient[0] will be set to the integer quotient.
- @return The remainder, precise only for the low three bits.
-version: 9
+ Example: <code>remquo(-23.5f, 8.f, &quot)</code> sets the lowest three bits of quot to 3 and the sign negative.  It returns 0.5f.
 test: custom
 end:
 
-start:
+function: rint
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: rint
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: Round to even
+description:
  Rounds to the nearest integral value.
 
- rint() rounds half values to even.  For example, rint(0.5f) returns 0.f and rint(1.5f) returns 2.f.  Similarly, rint(-0.5f) returns -0.f and rint(-1.5f) returns -2.f.
+ rint() rounds half values to even.  For example, <code>rint(0.5f)</code> returns 0.f and <code>rint(1.5f)</code> returns 2.f.  Similarly, <code>rint(-0.5f)</code> returns -0.f and <code>rint(-1.5f)</code> returns -2.f.
 
- round() is similar but rounds away from zero.  trunc() truncates the decimal fraction.
-version: 9
+ @round() is similar but rounds away from zero.  @trunc() truncates the decimal fraction.
 end:
 
-start:
+function: rootn
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: rootn
 ret: #2#1
 arg: #2#1 v
 arg: int#1 n
-comment:
+summary: Nth root
+description:
  Compute the Nth root of a value.
-version: 9
+
+ See also @native_rootn().
 end:
 
-start:
+function: round
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: round
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: Round away from zero
+description:
  Round to the nearest integral value.
 
- round() rounds half values away from zero.  For example, round(0.5f) returns 1.f and round(1.5f) returns 2.f.  Similarly, round(-0.5f) returns -1.f and round(-1.5f) returns -2.f.
+ round() rounds half values away from zero.  For example, <code>round(0.5f)</code> returns 1.f and <code>round(1.5f)</code> returns 2.f.  Similarly, <code>round(-0.5f)</code> returns -1.f and <code>round(-1.5f)</code> returns -2.f.
 
- rint() is similar but rounds half values toward even.  trunc() truncates the decimal fraction.
-version: 9
+ @rint() is similar but rounds half values toward even.  @trunc() truncates the decimal fraction.
 end:
 
-start:
+function: rsqrt
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: rsqrt
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: Reciprocal of a square root
+description:
  Returns (1 / sqrt(v)).
-version: 9
+
+ See also @half_rsqrt(), @native_rsqrt().
 end:
 
-start:
+function: sign
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: sign
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: Sign of a value
+description:
  Returns the sign of a value.
 
- if (v < 0) return -1.f;
- else if (v > 0) return 1.f;
+ if (v &lt; 0) return -1.f;
+ else if (v &gt; 0) return 1.f;
  else return 0.f;
-version: 9
 end:
 
-start:
+function: sin
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: sin
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: Sine
+description:
  Returns the sine of an angle measured in radians.
-version: 9
+
+ See also @native_sin().
 end:
 
-start:
+function: sincos
+version: 9
 w: 1, 2, 3, 4
 t: f32
-name: sincos
-ret: #2#1
-arg: #2#1 v
-arg: #2#1 *cos
-comment:
+ret: #2#1, "sine of v"
+arg: #2#1 v, "The incoming value in radians"
+arg: #2#1* cos, "*cos will be set to the cosine value."
+summary: Sine and cosine
+description:
  Returns the sine and cosine of a value.
 
- @return sine of v
- @param v The incoming value in radians
- @param *cos cosptr[0] will be set to the cosine value.
-version: 9
+ See also @native_sincos().
 end:
 
-start:
+function: sinh
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: sinh
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: Hyperbolic sine
+description:
  Returns the hyperbolic sine of v, where v is measured in radians.
-version: 9
+
+ See also @native_sinh().
 end:
 
-start:
+function: sinpi
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: sinpi
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: Sine of a number multiplied by pi
+description:
  Returns the sine of (v * pi), where (v * pi) is measured in radians.
 
- To get the sine of a value measured in degrees, call sinpi(v / 180.f).
-version: 9
+ To get the sine of a value measured in degrees, call <code>sinpi(v / 180.f)</code>.
+
+ See also @native_sinpi().
 end:
 
-start:
+function: sqrt
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: sqrt
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: Square root
+description:
  Returns the square root of a value.
-version: 9
+
+ See also @half_sqrt(), @native_sqrt().
 end:
 
-start:
+function: step
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: step
 ret: #2#1
 arg: #2#1 edge
 arg: #2#1 v
-comment:
- Returns 0.f if v < edge, 1.f otherwise.
+summary: 0 if less than a value, 0 otherwise
+description:
+ Returns 0.f if v &lt; edge, 1.f otherwise.
 
- This can be useful to create conditional computations without using loops and branching instructions.  For example, instead of computing (a[i] < b[i]) ? 0.f : atan2(a[i], b[i]) for the corresponding elements of a vector, you could instead use step(a, b) * atan2(a, b).
-version: 9
+ This can be useful to create conditional computations without using loops and branching instructions.  For example, instead of computing <code>(a[i] &lt; b[i]) ? 0.f : @atan2(a[i], b[i])</code> for the corresponding elements of a vector, you could instead use <code>step(a, b) * @atan2(a, b)</code>.
 end:
 
-start:
+function: step
+version: 9
+attrib: const
 w: 2, 3, 4
 t: f32
-name: step
 ret: #2#1
 arg: #2#1 edge
 arg: #2 v
-comment:
- Returns 0.f if v < edge, 1.f otherwise.
-
- This can be useful to create conditional computations without using loops and branching instructions.  For example, instead of computing (a[i] < b) ? 0.f : atan2(a[i], b) for each element of a vector, you could instead use step(a, b) * atan2(a, b).
-version: 9
 end:
 
-start:
+function: step
+version: 21
+attrib: const
 w: 2, 3, 4
 t: f32
-name: step
 ret: #2#1
 arg: #2 edge
 arg: #2#1 v
-comment:
- Returns 0.f if v < edge, 1.f otherwise.
-
- This can be useful to create conditional computations without using loops and branching instructions.  For example, instead of computing (a < b[i]) ? 0.f : atan2(a, b[i]) for each element of a vector, you could instead use step(a, b) * atan2(a, b).
-version: 21
 end:
 
-start:
+function: tan
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: tan
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: Tangent
+description:
  Returns the tangent of an angle measured in radians.
-version: 9
+
+ See also @native_tan().
 end:
 
-start:
+function: tanh
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: tanh
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: Hyperbolic tangent
+description:
  Returns the hyperbolic tangent of a value.
-version: 9
+
+ See also @native_tanh().
 end:
 
-start:
+function: tanpi
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: tanpi
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: Tangent of a number multiplied by pi
+description:
  Returns the tangent of (v * pi), where (v * pi) is measured in radians.
 
- To get the tangent of a value measured in degrees, call tanpi(v / 180.f).
-version: 9
+ To get the tangent of a value measured in degrees, call <code>tanpi(v / 180.f)</code>.
+
+ See also @native_tanpi().
 end:
 
-start:
+function: tgamma
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: tgamma
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: Gamma function
+description:
  Returns the gamma function of a value.
-version: 9
+
+ See also @lgamma().
 end:
 
-start:
+function: trunc
+version: 9
+attrib: const
 w: 1, 2, 3, 4
 t: f32
-name: trunc
 ret: #2#1
 arg: #2#1 v
-comment:
+summary: Truncates a floating point
+description:
  Rounds to integral using truncation.
 
- For example, trunc(1.7f) returns 1.f and trunc(-1.7f) returns -1.f.
+ For example, <code>trunc(1.7f)</code> returns 1.f and <code>trunc(-1.7f)</code> returns -1.f.
 
- See rint() and round() for other rounding options.
-version: 9
+ See @rint() and @round() for other rounding options.
 end:
diff --git a/api/rs_debug.spec b/api/rs_debug.spec
new file mode 100644
index 0000000..b357b33
--- /dev/null
+++ b/api/rs_debug.spec
@@ -0,0 +1,138 @@
+#
+# Copyright (C) 2015 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+header:
+summary: Utility debugging routines
+description:
+ Routines intended to be used during application developement.  These should
+ not be used in shipping applications.  All print a string and value pair to
+ the standard log.
+include:
+ #define RS_DEBUG(a) rsDebug(#a, a)
+ #define RS_DEBUG_MARKER rsDebug(__FILE__, __LINE__)
+end:
+
+function: rsDebug
+t: i32, u32, i64, u64, f64
+ret: void
+arg: const char* message
+arg: #1 a
+summary:
+description:
+ Debug function.  Prints a string and value to the log.
+test: none
+end:
+
+function: rsDebug
+version: 17
+w: 2, 3, 4
+# TODO We're not doing it for f64?
+t: i32, u32, i64, u64
+ret: void
+arg: const char* message
+arg: #2#1 a
+test: none
+end:
+
+function: rsDebug
+w: 1, 2, 3, 4
+ret: void
+arg: const char* message
+arg: float#1 a
+test: none
+end:
+
+function: rsDebug
+version: 17
+w: 1, 2, 3, 4
+t: i8, u8, i16, u16
+ret: void
+arg: const char* message
+arg: #2#1 a
+test: none
+end:
+
+function: rsDebug
+ret: void
+arg: const char* message
+arg: float a
+arg: float b
+test: none
+end:
+
+function: rsDebug
+ret: void
+arg: const char* message
+arg: float a
+arg: float b
+arg: float c
+test: none
+end:
+
+function: rsDebug
+ret: void
+arg: const char* message
+arg: float a
+arg: float b
+arg: float c
+arg: float d
+test: none
+end:
+
+function: rsDebug
+ret: void
+arg: const char* message
+arg: long long a
+test: none
+end:
+
+function: rsDebug
+ret: void
+arg: const char* message
+arg: unsigned long long a
+test: none
+end:
+
+function: rsDebug
+ret: void
+arg: const char* message
+arg: const void* a
+test: none
+end:
+
+function: rsDebug
+ret: void
+arg: const char* message
+arg: const rs_matrix4x4* a
+test: none
+end:
+
+function: rsDebug
+ret: void
+arg: const char* message
+arg: const rs_matrix3x3* a
+test: none
+end:
+
+function: rsDebug
+ret: void
+arg: const char* message
+arg: const rs_matrix2x2* a
+test: none
+end:
+
+#define RS_DEBUG(a) rsDebug(#a, a)
+#define RS_DEBUG_MARKER rsDebug(__FILE__, __LINE__)
diff --git a/api/rs_element.spec b/api/rs_element.spec
new file mode 100644
index 0000000..76abd96
--- /dev/null
+++ b/api/rs_element.spec
@@ -0,0 +1,168 @@
+#
+# Copyright (C) 2015 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+header:
+summary: Element functions
+description:
+ The term "element" is used a bit ambiguously in RenderScript, as both
+ the type of an item of an allocation and the instantiation of that type:
+ <ul>
+ <li>@rs_element is a handle to a type specification, and</li>
+
+ <li>In functions like @rsGetElementAt(), "element" means the instantiation
+ of the type, i.e. an item of an allocation.</li></ul>
+
+ The functions below let you query the characteristics of the type specificiation.
+
+ To create complex elements, use the <a href='http://developer.android.com/reference/android/renderscript/Element.Builder.html'>Element.Builder</a> Java class.
+ For common elements, in Java you can simply use one of the many predefined elements
+ like <a href='http://developer.android.com/reference/android/renderscript/Element.html#F32_2(android.renderscript.RenderScript)'>F32_2</a>.  You can't create elements from a script.
+
+ An element can be a simple data type as found in C/C++, a handle type,
+ a structure, or a fixed size vector (of size 2, 3, or 4) of sub-elements.
+
+ Elements can also have a kind, which is semantic information used mostly to
+ interpret pixel data.
+end:
+
+function: rsElementGetBytesSize
+version: 16
+ret: uint32_t
+arg: rs_element e
+summary: Return the size of an element
+description:
+ Returns the size in bytes that an instantiation of this element will occupy.
+test: none
+end:
+
+function: rsElementGetDataKind
+version: 16
+ret: rs_data_kind
+arg: rs_element e
+summary: Return the kind of an element
+description:
+ Returns the element's data kind.  This is used to interpret pixel data.
+
+ See @rs_data_kind.
+test: none
+end:
+
+function: rsElementGetDataType
+version: 16
+ret: rs_data_type
+arg: rs_element e
+summary: Return the data type of an element
+description:
+ Returns the element's base data type.  This can be a type similar to C/C++ (e.g. RS_TYPE_UNSIGNED_8),
+ a handle (e.g. RS_TYPE_ALLOCATION and RS_TYPE_ELEMENT), or a more complex numerical type
+ (e.g.RS_TYPE_UNSIGNED_5_6_5 and RS_TYPE_MATRIX_4X4).
+
+ If the element describes a vector, this function returns the data type of one of its items.
+
+ If the element describes a structure, RS_TYPE_NONE is returned.
+
+ See @rs_data_type.
+test: none
+end:
+
+function: rsElementGetSubElement
+version: 16
+ret: rs_element, "Sub-element at the given index"
+arg: rs_element e, "Element to query"
+arg: uint32_t index, "Index of the sub-element to return"
+summary: Return a sub element of a complex element
+description:
+ For the element represents a structure, this function returns the sub-element at
+ the specified index.
+
+ If the element is not a structure or the index is greater or equal to the number
+ of sub-elements, an invalid handle is returned.
+test: none
+end:
+
+function: rsElementGetSubElementArraySize
+version: 16
+ret: uint32_t, "Array size of the sub-element at the given index"
+arg: rs_element e, "Element to query"
+arg: uint32_t index, "Index of the sub-element"
+summary: Return the array size of a sub element of a complex element
+description:
+ For complex elements, some sub-elements could be statically
+ sized arrays. This function returns the array size of the
+ sub-element at the index.
+test: none
+end:
+
+function: rsElementGetSubElementCount
+version: 16
+ret: uint32_t, "Number of sub-elements in this element"
+arg: rs_element e, "Element to get data from"
+summary: Return the number of sub-elements
+description:
+ Elements could be simple, such as an int or a float, or a
+ structure with multiple sub-elements, such as a collection of
+ floats, float2, float4.  This function returns zero for simple
+ elements or the number of sub-elements otherwise.
+test: none
+end:
+
+function: rsElementGetSubElementName
+version: 16
+ret: uint32_t, "Number of characters actually written, excluding the null terminator"
+arg: rs_element e, "Element to get data from"
+arg: uint32_t index, "Index of the sub-element"
+arg: char* name, "Array to store the name into"
+arg: uint32_t nameLength, "Length of the provided name array"
+summary: Return the name of a sub-element
+description:
+ For complex elements, this function returns the name of the sub-element
+ at the specified index.
+test: none
+end:
+
+function: rsElementGetSubElementNameLength
+version: 16
+ret: uint32_t, "Length of the sub-element name including the null terminator (size of buffer needed to write the name)"
+arg: rs_element e, "Element to get data from"
+arg: uint32_t index, "Index of the sub-element to return"
+summary: Return the length of the name of a sub-element
+description:
+ For complex elements, this function will return the length of
+ sub-element name at index
+test: none
+end:
+
+function: rsElementGetSubElementOffsetBytes
+version: 16
+ret: uint32_t, "Offset in bytes of sub-element in this element at given index"
+arg: rs_element e, "Element to get data from"
+arg: uint32_t index, "Index of the sub-element"
+summary:
+description:
+ This function specifies the location of a sub-element within
+ the element
+test: none
+end:
+
+function: rsElementGetVectorSize
+version: 16
+ret: uint32_t, "Length of the element vector (for float2, float3, etc.)"
+arg: rs_element e, "Element to get data from"
+summary:
+description:
+ Returns the element's vector size
+test: none
+end:
diff --git a/api/rs_graphics.spec b/api/rs_graphics.spec
new file mode 100644
index 0000000..37d421f
--- /dev/null
+++ b/api/rs_graphics.spec
@@ -0,0 +1,537 @@
+#
+# Copyright (C) 2015 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+header:
+summary: RenderScript graphics API
+description:
+ A set of graphics functions used by RenderScript.
+include:
+ #ifdef __LP64__
+ // TODO We need to fix some of the builds before enabling this error:
+ // #error "RenderScript graphics is deprecated and not supported in 64bit mode."
+ #else
+ #include "rs_mesh.rsh"
+ #include "rs_program.rsh"
+ #endif
+end:
+
+function: rsgAllocationSyncAll
+size: 32
+ret: void
+arg: rs_allocation alloc
+summary:
+description:
+ Sync the contents of an allocation.
+
+ If the source is specified, sync from memory space specified by source.
+
+ If the source is not specified, sync from its SCRIPT memory space to its HW
+ memory spaces.
+test: none
+end:
+
+function: rsgAllocationSyncAll
+version: 14
+size: 32
+ret: void
+arg: rs_allocation alloc
+arg: rs_allocation_usage_type source
+test: none
+end:
+
+function: rsgBindColorTarget
+version: 14
+size: 32
+ret: void
+arg: rs_allocation colorTarget
+arg: uint slot
+summary:
+description:
+ Set the color target used for all subsequent rendering calls
+test: none
+end:
+
+function: rsgBindConstant
+size: 32
+ret: void
+arg: rs_program_fragment ps, "program fragment object"
+arg: uint slot, "index of the constant buffer on the program"
+arg: rs_allocation c, "constants to bind"
+summary:
+description:
+ Bind a new Allocation object to a ProgramFragment or ProgramVertex.
+ The Allocation must be a valid constant input for the Program.
+test: none
+end:
+
+function: rsgBindConstant
+size: 32
+ret: void
+arg: rs_program_vertex pv, "program vertex object"
+arg: uint slot
+arg: rs_allocation c
+test: none
+end:
+
+function: rsgBindDepthTarget
+version: 14
+size: 32
+ret: void
+arg: rs_allocation depthTarget
+summary:
+description:
+ Set the depth target used for all subsequent rendering calls
+test: none
+end:
+
+function: rsgBindFont
+size: 32
+ret: void
+arg: rs_font font, "object to bind"
+summary:
+description:
+ Binds the font object to be used for all subsequent font rendering calls
+test: none
+end:
+
+function: rsgBindProgramFragment
+size: 32
+ret: void
+arg: rs_program_fragment pf
+summary:
+description:
+ Bind a new ProgramFragment to the rendering context.
+test: none
+end:
+
+function: rsgBindProgramRaster
+size: 32
+ret: void
+arg: rs_program_raster pr
+summary:
+description:
+ Bind a new ProgramRaster to the rendering context.
+test: none
+end:
+
+function: rsgBindProgramStore
+size: 32
+ret: void
+arg: rs_program_store ps
+summary:
+description:
+ Bind a new ProgramStore to the rendering context.
+test: none
+end:
+
+function: rsgBindProgramVertex
+size: 32
+ret: void
+arg: rs_program_vertex pv
+summary:
+description:
+ Bind a new ProgramVertex to the rendering context.
+test: none
+end:
+
+function: rsgBindSampler
+size: 32
+ret: void
+arg: rs_program_fragment fragment
+arg: uint slot
+arg: rs_sampler sampler
+summary:
+description:
+ Bind a new Sampler object to a ProgramFragment.  The sampler will
+ operate on the texture bound at the matching slot.
+test: none
+end:
+
+function: rsgBindTexture
+size: 32
+ret: void
+arg: rs_program_fragment v
+arg: uint slot
+arg: rs_allocation alloc
+summary:
+description:
+ Bind a new Allocation object to a ProgramFragment.  The
+ Allocation must be a valid texture for the Program.  The sampling
+ of the texture will be controled by the Sampler bound at the
+ matching slot.
+test: none
+end:
+
+function: rsgClearAllRenderTargets
+version: 14
+size: 32
+ret: void
+summary:
+description:
+ Clear all color and depth targets and resume rendering into
+ the framebuffer
+test: none
+end:
+
+function: rsgClearColor
+size: 32
+ret: void
+arg: float r
+arg: float g
+arg: float b
+arg: float a
+summary:
+description:
+ Clears the rendering surface to the specified color.
+test: none
+end:
+
+function: rsgClearColorTarget
+version: 14
+size: 32
+ret: void
+arg: uint slot
+summary:
+description:
+ Clear the previously set color target
+test: none
+end:
+
+function: rsgClearDepth
+size: 32
+ret: void
+arg: float value
+summary:
+description:
+ Clears the depth suface to the specified value.
+test: none
+end:
+
+function: rsgClearDepthTarget
+version: 14
+size: 32
+ret: void
+summary:
+description:
+ Clear the previously set depth target
+test: none
+end:
+
+function: rsgDrawMesh
+size: 32
+ret: void
+arg: rs_mesh ism, "mesh object to render"
+summary:
+description:
+ Draw a mesh using the current context state.
+
+ If primitiveIndex is specified, draw part of a mesh using the current context state.
+
+ If start and len are also specified, draw specified index range of part of a mesh using the current context state.
+
+ Otherwise the whole mesh is rendered.
+test: none
+end:
+
+function: rsgDrawMesh
+size: 32
+ret: void
+arg: rs_mesh ism
+arg: uint primitiveIndex, "for meshes that contain multiple primitive groups this parameter specifies the index of the group to draw."
+test: none
+end:
+
+function: rsgDrawMesh
+size: 32
+ret: void
+arg: rs_mesh ism
+arg: uint primitiveIndex
+arg: uint start, "starting index in the range"
+arg: uint len, "number of indices to draw"
+test: none
+end:
+
+function: rsgDrawQuad
+size: 32
+ret: void
+arg: float x1
+arg: float y1
+arg: float z1
+arg: float x2
+arg: float y2
+arg: float z2
+arg: float x3
+arg: float y3
+arg: float z3
+arg: float x4
+arg: float y4
+arg: float z4
+summary:
+description:
+ Low performance utility function for drawing a simple quad.  Not intended for
+ drawing large quantities of geometry.
+test: none
+end:
+
+function: rsgDrawQuadTexCoords
+size: 32
+ret: void
+arg: float x1
+arg: float y1
+arg: float z1
+arg: float u1
+arg: float v1
+arg: float x2
+arg: float y2
+arg: float z2
+arg: float u2
+arg: float v2
+arg: float x3
+arg: float y3
+arg: float z3
+arg: float u3
+arg: float v3
+arg: float x4
+arg: float y4
+arg: float z4
+arg: float u4
+arg: float v4
+summary:
+description:
+ Low performance utility function for drawing a textured quad.  Not intended
+ for drawing large quantities of geometry.
+test: none
+end:
+
+function: rsgDrawRect
+size: 32
+ret: void
+arg: float x1
+arg: float y1
+arg: float x2
+arg: float y2
+arg: float z
+summary:
+description:
+ Low performance utility function for drawing a simple rectangle.  Not
+ intended for drawing large quantities of geometry.
+test: none
+end:
+
+function: rsgDrawSpriteScreenspace
+size: 32
+ret: void
+arg: float x
+arg: float y
+arg: float z
+arg: float w
+arg: float h
+summary:
+description:
+ Low performance function for drawing rectangles in screenspace.  This
+ function uses the default passthough ProgramVertex.  Any bound ProgramVertex
+ is ignored.  This function has considerable overhead and should not be used
+ for drawing in shipping applications.
+test: none
+end:
+
+function: rsgDrawText
+size: 32
+ret: void
+arg: const char* text
+arg: int x
+arg: int y
+summary:
+description:
+ Draws text given a string and location
+test: none
+end:
+
+function: rsgDrawText
+size: 32
+ret: void
+arg: rs_allocation alloc
+arg: int x
+arg: int y
+test: none
+end:
+
+function: rsgFinish
+version: 14
+size: 32
+ret: uint
+summary:
+description:
+ Force RenderScript to finish all rendering commands
+test: none
+end:
+
+function: rsgFontColor
+size: 32
+ret: void
+arg: float r, "red component"
+arg: float g, "green component"
+arg: float b, "blue component"
+arg: float a, "alpha component"
+summary:
+description:
+ Sets the font color for all subsequent rendering calls
+test: none
+end:
+
+function: rsgGetHeight
+size: 32
+ret: uint
+summary:
+description:
+ Get the height of the current rendering surface.
+test: none
+end:
+
+function: rsgGetWidth
+size: 32
+ret: uint
+summary:
+description:
+ Get the width of the current rendering surface.
+test: none
+end:
+
+function: rsgMeasureText
+size: 32
+ret: void
+arg: const char* text
+arg: int* left
+arg: int* right
+arg: int* top
+arg: int* bottom
+summary:
+description:
+ Returns the bounding box of the text relative to (0, 0)
+ Any of left, right, top, bottom could be NULL
+test: none
+end:
+
+function: rsgMeasureText
+size: 32
+ret: void
+arg: rs_allocation alloc
+arg: int* left
+arg: int* right
+arg: int* top
+arg: int* bottom
+test: none
+end:
+
+function: rsgMeshComputeBoundingBox
+size: 32
+ret: void
+arg: rs_mesh mesh
+arg: float* minX
+arg: float* minY
+arg: float* min
+arg: float* maxX
+arg: float* maxY
+arg: float* maxZ
+summary:
+description:
+ Computes an axis aligned bounding box of a mesh object
+test: none
+end:
+
+function: rsgMeshComputeBoundingBox
+size: 32
+attrib: always_inline
+ret: void
+arg: rs_mesh mesh
+arg: float3* bBoxMin
+arg: float3* bBoxMax
+inline:
+ float x1, y1, z1, x2, y2, z2;
+ rsgMeshComputeBoundingBox(mesh, &x1, &y1, &z1, &x2, &y2, &z2);
+ bBoxMin->x = x1;
+ bBoxMin->y = y1;
+ bBoxMin->z = z1;
+ bBoxMax->x = x2;
+ bBoxMax->y = y2;
+ bBoxMax->z = z2;
+test: none
+end:
+
+
+function: rsgProgramFragmentConstantColor
+size: 32
+ret: void
+arg: rs_program_fragment pf
+arg: float r
+arg: float g
+arg: float b
+arg: float a
+summary:
+description:
+ Set the constant color for a fixed function emulation program.
+test: none
+end:
+
+function: rsgProgramVertexGetProjectionMatrix
+size: 32
+ret: void
+arg: rs_matrix4x4* proj, "matrix to store the current projection matrix into"
+summary:
+description:
+ Get the projection matrix for a currently bound fixed function
+ vertex program. Calling this function with a custom vertex shader
+ would result in an error.
+test: none
+end:
+
+function: rsgProgramVertexLoadModelMatrix
+size: 32
+ret: void
+arg: const rs_matrix4x4* model, "model matrix"
+summary:
+description:
+ Load the model matrix for a currently bound fixed function
+ vertex program. Calling this function with a custom vertex shader
+ would result in an error.
+test: none
+end:
+
+function: rsgProgramVertexLoadProjectionMatrix
+size: 32
+ret: void
+arg: const rs_matrix4x4* proj, "projection matrix"
+summary:
+description:
+ Load the projection matrix for a currently bound fixed function
+ vertex program. Calling this function with a custom vertex shader
+ would result in an error.
+test: none
+end:
+
+function: rsgProgramVertexLoadTextureMatrix
+size: 32
+ret: void
+arg: const rs_matrix4x4* tex, "texture matrix"
+summary:
+description:
+ Load the texture matrix for a currently bound fixed function
+ vertex program. Calling this function with a custom vertex shader
+ would result in an error.
+test: none
+end:
+
+#endif //__LP64__
diff --git a/api/rs_math.spec b/api/rs_math.spec
new file mode 100644
index 0000000..af84461
--- /dev/null
+++ b/api/rs_math.spec
@@ -0,0 +1,242 @@
+#
+# Copyright (C) 2015 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+header:
+summary: TODO Add documentation
+description:
+ TODO Add documentation
+end:
+
+function: rsClamp
+# TODO Why always_inline?
+attrib: const, always_inline
+t: i8, i16, i32, u8, u16, u32
+ret: #1
+arg: #1 amount, "The value to clamp"
+arg: #1 low, "Lower bound"
+arg: #1 high, "Upper bound"
+summary: Restrain a value to a range
+description:
+ Clamp a value between low and high.
+
+ Deprecated.  Use @clamp() instead.
+test: none
+end:
+
+function: rsExtractFrustumPlanes
+# TODO Why always_inline?
+attrib: always_inline
+ret: void
+arg: const rs_matrix4x4* viewProj, "matrix to extract planes from"
+arg: float4* left, "left plane"
+arg: float4* right, "right plane"
+arg: float4* top, "top plane"
+arg: float4* bottom, "bottom plane"
+arg: float4* near, "near plane"
+arg: float4* far, "far plane"
+summary:
+description:
+ Computes 6 frustum planes from the view projection matrix
+inline:
+ // x y z w = a b c d in the plane equation
+ left->x = viewProj->m[3] + viewProj->m[0];
+ left->y = viewProj->m[7] + viewProj->m[4];
+ left->z = viewProj->m[11] + viewProj->m[8];
+ left->w = viewProj->m[15] + viewProj->m[12];
+
+ right->x = viewProj->m[3] - viewProj->m[0];
+ right->y = viewProj->m[7] - viewProj->m[4];
+ right->z = viewProj->m[11] - viewProj->m[8];
+ right->w = viewProj->m[15] - viewProj->m[12];
+
+ top->x = viewProj->m[3] - viewProj->m[1];
+ top->y = viewProj->m[7] - viewProj->m[5];
+ top->z = viewProj->m[11] - viewProj->m[9];
+ top->w = viewProj->m[15] - viewProj->m[13];
+
+ bottom->x = viewProj->m[3] + viewProj->m[1];
+ bottom->y = viewProj->m[7] + viewProj->m[5];
+ bottom->z = viewProj->m[11] + viewProj->m[9];
+ bottom->w = viewProj->m[15] + viewProj->m[13];
+
+ near->x = viewProj->m[3] + viewProj->m[2];
+ near->y = viewProj->m[7] + viewProj->m[6];
+ near->z = viewProj->m[11] + viewProj->m[10];
+ near->w = viewProj->m[15] + viewProj->m[14];
+
+ far->x = viewProj->m[3] - viewProj->m[2];
+ far->y = viewProj->m[7] - viewProj->m[6];
+ far->z = viewProj->m[11] - viewProj->m[10];
+ far->w = viewProj->m[15] - viewProj->m[14];
+
+ float len = length(left->xyz);
+ *left /= len;
+ len = length(right->xyz);
+ *right /= len;
+ len = length(top->xyz);
+ *top /= len;
+ len = length(bottom->xyz);
+ *bottom /= len;
+ len = length(near->xyz);
+ *near /= len;
+ len = length(far->xyz);
+ *far /= len;
+test: none
+end:
+
+function: rsFrac
+attrib: const
+ret: float
+arg: float v
+summary:
+description:
+ Returns the fractional part of a float
+test: none
+end:
+
+function: rsIsSphereInFrustum
+attrib: always_inline
+ret: bool
+arg: float4* sphere, "float4 representing the sphere"
+arg: float4* left, "left plane"
+arg: float4* right, "right plane"
+arg: float4* top, "top plane"
+arg: float4* bottom, "bottom plane"
+arg: float4* near, "near plane"
+arg: float4* far, "far plane"
+summary:
+description:
+ Checks if a sphere is withing the 6 frustum planes
+inline:
+ float distToCenter = dot(left->xyz, sphere->xyz) + left->w;
+ if (distToCenter < -sphere->w) {
+     return false;
+ }
+ distToCenter = dot(right->xyz, sphere->xyz) + right->w;
+ if (distToCenter < -sphere->w) {
+     return false;
+ }
+ distToCenter = dot(top->xyz, sphere->xyz) + top->w;
+ if (distToCenter < -sphere->w) {
+     return false;
+ }
+ distToCenter = dot(bottom->xyz, sphere->xyz) + bottom->w;
+ if (distToCenter < -sphere->w) {
+     return false;
+ }
+ distToCenter = dot(near->xyz, sphere->xyz) + near->w;
+ if (distToCenter < -sphere->w) {
+     return false;
+ }
+ distToCenter = dot(far->xyz, sphere->xyz) + far->w;
+ if (distToCenter < -sphere->w) {
+     return false;
+ }
+ return true;
+test: none
+end:
+
+function: rsPackColorTo8888
+attrib: const
+ret: uchar4
+arg: float r
+arg: float g
+arg: float b
+summary:
+description:
+ Pack floating point (0-1) RGB values into a uchar4.
+
+ For the float3 variant and the variant that only specifies r, g, b,
+ the alpha component is set to 255 (1.0).
+test: none
+end:
+
+function: rsPackColorTo8888
+attrib: const
+ret: uchar4
+arg: float r
+arg: float g
+arg: float b
+arg: float a
+test: none
+end:
+
+function: rsPackColorTo8888
+attrib: const
+ret: uchar4
+arg: float3 color
+test: none
+end:
+
+function: rsPackColorTo8888
+attrib: const
+ret: uchar4
+arg: float4 color
+test: none
+end:
+
+function: rsRand
+ret: int
+arg: int max_value
+summary:
+description:
+ Return a random value between 0 (or min_value) and max_malue.
+test: none
+end:
+
+function: rsRand
+ret: int
+arg: int min_value
+arg: int max_value
+test: none
+end:
+
+function: rsRand
+ret: float
+arg: float max_value
+test: none
+end:
+
+function: rsRand
+ret: float
+arg: float min_value
+arg: float max_value
+test: none
+end:
+
+function: rsUnpackColor8888
+attrib: =const
+ret: float4
+arg: uchar4 c
+summary:
+description:
+ Unpack a uchar4 color to float4.  The resulting float range will be (0-1).
+test: none
+end:
+
+function: rsYuvToRGBA_#2#1
+attrib: const
+w: 4
+t: u8, f32
+ret: #2#1
+arg: uchar y
+arg: uchar u
+arg: uchar v
+summary:
+description:
+ Convert from YUV to RGBA.
+test: none
+end:
diff --git a/api/rs_matrix.spec b/api/rs_matrix.spec
new file mode 100644
index 0000000..7afbeff
--- /dev/null
+++ b/api/rs_matrix.spec
@@ -0,0 +1,466 @@
+#
+# Copyright (C) 2015 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+header:
+summary: Matrix functions
+description:
+ These functions let you manipulate square matrices of rank 2x2, 3x3, and 4x4.
+ They are particularly useful for graphical transformations and are
+ compatible with OpenGL.
+
+ We use a zero-based index for rows and columns.  E.g. the last element of
+ a @rs_matrix4x4 is found at (3, 3).
+
+ RenderScript uses column-major matrices and column-based vectors.
+ Transforming a vector is done by postmultiplying the vector,
+ e.g. <code>(matrix * vector)</code>, as provided by @rsMatrixMultiply().
+
+ To create a transformation matrix that performs two transformations at
+ once, multiply the two source matrices, with the first transformation as the
+ right argument.  E.g. to create a transformation matrix that applies the
+ transformation s1 followed by s2, call <code>rsMatrixLoadMultiply(&combined, &s2, &s1)</code>.
+ This derives from <code>s2 * (s1 * v)</code>, which is <code>(s2 * s1) * v</code>.
+
+ We have two style of functions to create transformation matrices:
+ rsMatrixLoad<i>Transformation</i> and rsMatrix<i>Transformation</i>.  The
+ former style simply stores the transformation matrix in the first argument.
+ The latter modifies a pre-existing transformation matrix so that the new
+ transformation happens first.  E.g. if you call @rsMatrixTranslate()
+ on a matrix that already does a scaling, the resulting matrix when applied
+ to a vector will first do the translation then the scaling.
+end:
+
+function: rsMatrixGet
+t: rs_matrix4x4, rs_matrix3x3, rs_matrix2x2
+ret: float
+arg: const #1* m, "The matrix to extract the element from."
+arg: uint32_t col, "The zero-based column of the element to be extracted."
+arg: uint32_t row, "The zero-based row of the element to extracted."
+summary: Get one element
+description:
+ Returns one element of a matrix.
+
+ <b>Warning:</b> The order of the column and row parameters may be unexpected.
+test: none
+end:
+
+function: rsMatrixInverse
+ret: bool
+arg: rs_matrix4x4* m, "The matrix to invert."
+summary: Inverts a matrix in place
+description:
+ Returns true if the matrix was successfully inverted.
+test: none
+end:
+
+
+function: rsMatrixInverseTranspose
+ret: bool
+arg: rs_matrix4x4* m, "The matrix to modify."
+summary: Inverts and transpose a matrix in place
+description:
+ The matrix is first inverted then transposed.
+ Returns true if the matrix was successfully inverted.
+test: none
+end:
+
+
+function: rsMatrixLoad
+t: rs_matrix4x4, rs_matrix3x3, rs_matrix2x2
+ret: void
+arg: #1* destination, "The matrix to set."
+arg: const float* array, "The array of values to set the matrix to. These arrays should be 4, 9, or 16 floats long, depending on the matrix size."
+summary: Load or copy a matrix
+description:
+ Set the elements of a matrix from an array of floats or from another matrix.
+
+ If loading from an array, the floats should be in row-major order, i.e. the element a
+ <code>row 0, column 0</code> should be first, followed by the element at
+ <code>row 0, column 1</code>, etc.
+
+ If loading from a matrix and the source is smaller than the destination, the rest of the
+ destination is filled with elements of the identity matrix.  E.g.
+ loading a rs_matrix2x2 into a rs_matrix4x4 will give:
+ <table style="max-width:300px">
+ <tr><td>m00</td> <td>m01</td> <td>0.0</td> <td>0.0</td></tr>
+ <tr><td>m10</td> <td>m11</td> <td>0.0</td> <td>0.0</td></tr>
+ <tr><td>0.0</td> <td>0.0</td> <td>1.0</td> <td>0.0</td></tr>
+ <tr><td>0.0</td> <td>0.0</td> <td>0.0</td> <td>1.0</td></tr>
+ </table>
+test: none
+end:
+
+function: rsMatrixLoad
+t: rs_matrix4x4, rs_matrix3x3, rs_matrix2x2
+ret: void
+arg: #1* destination
+arg: const #1* source, "The source matrix."
+test: none
+end:
+
+function: rsMatrixLoad
+t: rs_matrix3x3, rs_matrix2x2
+ret: void
+arg: rs_matrix4x4* destination
+arg: const #1* source
+test: none
+end:
+
+function: rsMatrixLoadFrustum
+ret: void
+arg: rs_matrix4x4* m, "The matrix to set."
+arg: float left
+arg: float right
+arg: float bottom
+arg: float top
+arg: float near
+arg: float far
+summary: Load a frustum projection matrix
+description:
+ Constructs a frustum projection matrix, transforming the box
+ identified by the six clipping planes <code>left, right, bottom, top,
+ near, far</code>.
+
+ To apply this projection to a vector, multiply the vector by the
+ created matrix using @rsMatrixMultiply().
+test: none
+end:
+
+function: rsMatrixLoadIdentity
+t: rs_matrix4x4, rs_matrix3x3, rs_matrix2x2
+ret: void
+arg: #1* m, "The matrix to set."
+summary: Load identity matrix
+description:
+ Set the elements of a matrix to the identity matrix.
+test: none
+end:
+
+function: rsMatrixLoadMultiply
+t: rs_matrix4x4, rs_matrix3x3, rs_matrix2x2
+ret: void
+arg: #1* m, "The matrix to set."
+arg: const #1* lhs, "The left matrix of the product."
+arg: const #1* rhs, "The right matrix of the product."
+summary: Multiply two matrices
+description:
+ Sets m to the matrix product of <code>lhs * rhs</code>.
+
+ To combine two 4x4 transformaton matrices, multiply the second transformation matrix
+ by the first transformation matrix.  E.g. to create a transformation matrix that applies
+ the transformation s1 followed by s2, call
+ <code>rsMatrixLoadMultiply(&combined, &s2, &s1)</code>.
+
+ <b>Warning:</b> Prior to version 21, storing the result back into right matrix is not supported and
+ will result in undefined behavior.  Use rsMatrixMulitply instead.   E.g. instead of doing
+ rsMatrixLoadMultiply (&m2r, &m2r, &m2l), use rsMatrixMultiply (&m2r, &m2l).
+ rsMatrixLoadMultiply (&m2l, &m2r, &m2l) works as expected.
+test: none
+end:
+
+function: rsMatrixLoadOrtho
+ret: void
+arg: rs_matrix4x4* m, "The matrix to set."
+arg: float left
+arg: float right
+arg: float bottom
+arg: float top
+arg: float near
+arg: float far
+summary: Load an orthographic projection matrix
+description:
+ Constructs an orthographic projection matrix, transforming the box
+ identified by the six clipping planes <code>left, right, bottom, top,
+ near, far</code> into a unit cube with a corner at
+ <code>(-1, -1, -1)</code> and the opposite at <code>(1, 1, 1)</code>.
+
+ To apply this projection to a vector, multiply the vector by the
+ created matrix using @rsMatrixMultiply().
+
+ See https://en.wikipedia.org/wiki/Orthographic_projection .
+test: none
+end:
+
+function: rsMatrixLoadPerspective
+ret: void
+arg: rs_matrix4x4* m, "The matrix to set."
+arg: float fovy, "Field of view, in degrees along the Y axis."
+arg: float aspect, "Ratio of x / y."
+arg: float near, "The near clipping plane."
+arg: float far, "The far clipping plane."
+summary: Load a perspective projection matrix
+description:
+ Constructs a perspective projection matrix, assuming a symmetrical field of view.
+
+ To apply this projection to a vector, multiply the vector by the
+ created matrix using @rsMatrixMultiply().
+test: none
+end:
+
+function: rsMatrixLoadRotate
+ret: void
+arg: rs_matrix4x4* m, "The matrix to set."
+arg: float rot, "How much rotation to do, in degrees."
+arg: float x, "The x component of the vector that is the axis of rotation."
+arg: float y, "The y component of the vector that is the axis of rotation."
+arg: float z, "The z component of the vector that is the axis of rotation."
+summary: Load a rotation matrix
+description:
+ This function creates a rotation matrix.  The axis of rotation is the
+ <code>(x, y, z)</code> vector.
+
+ To rotate a vector, multiply the vector by the created matrix
+ using @rsMatrixMultiply().
+
+ See http://en.wikipedia.org/wiki/Rotation_matrix .
+test: none
+end:
+
+function: rsMatrixLoadScale
+ret: void
+arg: rs_matrix4x4* m, "The matrix to set."
+arg: float x, "The multiple to scale the x components by."
+arg: float y, "The multiple to scale the y components by."
+arg: float z, "The multiple to scale the z components by."
+summary: Load a scaling matrix
+description:
+ This function creates a scaling matrix, where each component of a
+ vector is multiplied by a number.  This number can be negative.
+
+ To scale a vector, multiply the vector by the created matrix
+ using @rsMatrixMultiply().
+test: none
+end:
+
+function: rsMatrixLoadTranslate
+ret: void
+arg: rs_matrix4x4* m, "The matrix to set."
+arg: float x, "The number to add to each x component."
+arg: float y, "The number to add to each y component."
+arg: float z, "The number to add to each z component."
+summary: Load a translation matrix
+description:
+ This function creates a translation matrix, where a
+ number is added to each element of a vector.
+
+ To translate a vector, multiply the vector by the created matrix
+ using @rsMatrixMultiply().
+test: none
+end:
+
+function: rsMatrixMultiply
+t: rs_matrix4x4, rs_matrix3x3, rs_matrix2x2
+ret: void
+arg: #1* m, "The left matrix of the product and the matrix to be set."
+arg: const #1* rhs, "The right matrix of the product."
+summary: Multiply a matrix by a vector or another matrix
+description:
+ For the matrix by matrix variant, sets m to the matrix product <code>m * rhs</code>.
+
+ When combining two 4x4 transformation matrices using this function, the resulting
+ matrix will correspond to performing the rhs transformation first followed by
+ the original m transformation.
+
+ For the matrix by vector variant, returns the post-multiplication of the vector
+ by the matrix, ie. <code>m * in</code>.
+
+ When multiplying a float3 to a @rs_matrix4x4, the vector is expanded with (1).
+
+ When multiplying a float2 to a @rs_matrix4x4, the vector is expanded with (0, 1).
+
+ When multiplying a float2 to a @rs_matrix3x3, the vector is expanded with (0).
+
+ Starting with API 14, this function takes a const matrix as the first argument.
+test: none
+end:
+
+function: rsMatrixMultiply
+version: 9 13
+ret: float4
+arg: rs_matrix4x4* m
+arg: float4 in
+test: none
+end:
+
+function: rsMatrixMultiply
+version: 9 13
+ret: float4
+arg: rs_matrix4x4* m
+arg: float3 in
+test: none
+end:
+
+function: rsMatrixMultiply
+version: 9 13
+ret: float4
+arg: rs_matrix4x4* m
+arg: float2 in
+test: none
+end:
+
+function: rsMatrixMultiply
+version: 9 13
+ret: float3
+arg: rs_matrix3x3* m
+arg: float3 in
+test: none
+end:
+
+function: rsMatrixMultiply
+version: 9 13
+ret: float3
+arg: rs_matrix3x3* m
+arg: float2 in
+test: none
+end:
+
+function: rsMatrixMultiply
+version: 9 13
+ret: float2
+arg: rs_matrix2x2* m
+arg: float2 in
+test: none
+end:
+
+function: rsMatrixMultiply
+version: 14
+ret: float4
+arg: const rs_matrix4x4* m
+arg: float4 in
+test: none
+end:
+
+function: rsMatrixMultiply
+version: 14
+ret: float4
+arg: const rs_matrix4x4* m
+arg: float3 in
+test: none
+end:
+
+function: rsMatrixMultiply
+version: 14
+ret: float4
+arg: const rs_matrix4x4* m
+arg: float2 in
+test: none
+end:
+
+function: rsMatrixMultiply
+version: 14
+ret: float3
+arg: const rs_matrix3x3* m
+arg: float3 in
+test: none
+end:
+
+function: rsMatrixMultiply
+version: 14
+ret: float3
+arg: const rs_matrix3x3* m
+arg: float2 in
+test: none
+end:
+
+function: rsMatrixMultiply
+version: 14
+ret: float2
+arg: const rs_matrix2x2* m
+arg: float2 in
+test: none
+end:
+
+function: rsMatrixRotate
+ret: void
+arg: rs_matrix4x4* m, "The matrix to modify."
+arg: float rot, "How much rotation to do, in degrees."
+arg: float x, "The x component of the vector that is the axis of rotation."
+arg: float y, "The y component of the vector that is the axis of rotation."
+arg: float z, "The z component of the vector that is the axis of rotation."
+summary: Apply a rotation to a transformation matrix
+description:
+ Multiply the matrix m with a rotation matrix.
+
+ This function modifies a transformation matrix to first do a rotation.
+ The axis of rotation is the <code>(x, y, z)</code> vector.
+
+ To apply this combined transformation to a vector, multiply
+ the vector by the created matrix using @rsMatrixMultiply().
+test: none
+end:
+
+function: rsMatrixScale
+ret: void
+arg: rs_matrix4x4* m, "The matrix to modify."
+arg: float x, "The multiple to scale the x components by."
+arg: float y, "The multiple to scale the y components by."
+arg: float z, "The multiple to scale the z components by."
+summary: Apply a scaling to a transformation matrix
+description:
+ Multiply the matrix m with a scaling matrix.
+
+ This function modifies a transformation matrix to first do a scaling.
+ When scaling, each component of a vector is multiplied by a number.
+ This number can be negative.
+
+ To apply this combined transformation to a vector, multiply
+ the vector by the created matrix using @rsMatrixMultiply().
+test: none
+end:
+
+function: rsMatrixSet
+t: rs_matrix4x4, rs_matrix3x3, rs_matrix2x2
+ret: void
+arg: #1* m, "The matrix that will be modified."
+arg: uint32_t col, "The zero-based column of the element to be set."
+arg: uint32_t row, "The zero-based row of the element to be set."
+arg: float v, "The value to set."
+summary: Set one element
+description:
+ Set an element of a matrix.
+
+ <b>Warning:</b> The order of the column and row parameters may be unexpected.
+test: none
+end:
+
+function: rsMatrixTranslate
+ret: void
+arg: rs_matrix4x4* m, "The matrix to modify."
+arg: float x, "The number to add to each x component."
+arg: float y, "The number to add to each y component."
+arg: float z, "The number to add to each z component."
+summary: Apply a translation to a transformation matrix
+description:
+ Multiply the matrix m with a translation matrix.
+
+ This function modifies a transformation matrix to first
+ do a translation.  When translating, a number is added
+ to each component of a vector.
+
+ To apply this combined transformation to a vector, multiply
+ the vector by the created matrix using @rsMatrixMultiply().
+test: none
+end:
+
+function: rsMatrixTranspose
+t: rs_matrix4x4*, rs_matrix3x3*, rs_matrix2x2*
+ret: void
+arg: #1 m, "The matrix to transpose."
+summary: Transpose a matrix place
+description:
+ Transpose the matrix m in place.
+test: none
+end:
diff --git a/api/rs_mesh.spec b/api/rs_mesh.spec
new file mode 100644
index 0000000..9fe5e49
--- /dev/null
+++ b/api/rs_mesh.spec
@@ -0,0 +1,78 @@
+#
+# Copyright (C) 2015 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+header:
+summary: Mesh routines
+description:
+end:
+
+function: rsgMeshGetIndexAllocation
+version: 16
+ret: rs_allocation, "allocation containing index data"
+arg: rs_mesh m, "mesh to get data from"
+arg: uint32_t index, "index of the index allocation"
+summary:
+description:
+ Returns an allocation containing index data or a null
+ allocation if only the primitive is specified
+test: none
+end:
+
+function: rsgMeshGetPrimitive
+version: 16
+ret: rs_primitive, "primitive describing how the mesh is rendered"
+arg: rs_mesh m, "mesh to get data from"
+arg: uint32_t index, "index of the primitive"
+summary:
+description:
+ Returns the primitive describing how a part of the mesh is
+ rendered
+test: none
+end:
+
+function: rsgMeshGetPrimitiveCount
+version: 16
+ret: uint32_t, "number of primitive groups in the mesh. This would include simple primitives as well as allocations containing index data"
+arg: rs_mesh m, "mesh to get data from"
+summary:
+description:
+ Meshes could have multiple index sets, this function returns
+ the number.
+test: none
+end:
+
+function: rsgMeshGetVertexAllocation
+version: 16
+ret: rs_allocation, "allocation containing vertex data"
+arg: rs_mesh m, "mesh to get data from"
+arg: uint32_t index, "index of the vertex allocation"
+summary:
+description:
+ Returns an allocation that is part of the mesh and contains
+ vertex data, e.g. positions, normals, texcoords
+test: none
+end:
+
+function: rsgMeshGetVertexAllocationCount
+version: 16
+ret: uint32_t, "number of allocations in the mesh that contain vertex data"
+arg: rs_mesh m, "mesh to get data from"
+summary:
+description:
+ Returns the number of allocations in the mesh that contain
+ vertex data
+test: none
+end:
diff --git a/api/rs_object.spec b/api/rs_object.spec
new file mode 100644
index 0000000..bb8b446
--- /dev/null
+++ b/api/rs_object.spec
@@ -0,0 +1,76 @@
+#
+# Copyright (C) 2015 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+header:
+summary: Object routines
+description:
+end:
+
+function: rsClearObject
+t: rs_element, rs_type, rs_allocation, rs_sampler, rs_script
+ret: void
+arg: #1* dst
+hidden:
+summary: For internal use.
+description:
+test: none
+end:
+
+function: rsClearObject
+size: 32
+t: rs_mesh, rs_program_fragment, rs_program_vertex, rs_program_raster, rs_program_store, rs_font
+ret: void
+arg: #1* dst
+test: none
+end:
+
+function: rsIsObject
+t: rs_element, rs_type, rs_allocation, rs_sampler, rs_script
+ret: bool
+arg: #1 v
+hidden:
+summary: For internal use.
+description:
+test: none
+end:
+
+function: rsIsObject
+size: 32
+t: rs_mesh, rs_program_fragment, rs_program_vertex, rs_program_raster, rs_program_store, rs_font
+ret: bool
+arg: #1 v
+test: none
+end:
+
+function: rsSetObject
+t: rs_element, rs_type, rs_allocation, rs_sampler, rs_script
+ret: void
+arg: #1* dst
+arg: #1 src
+hidden:
+summary: For internal use.
+description:
+test: none
+end:
+
+function: rsSetObject
+size: 32
+t: rs_mesh, rs_program_fragment, rs_program_vertex, rs_program_raster, rs_program_store, rs_font
+ret: void
+arg: #1* dst
+arg: #1 src
+test: none
+end:
diff --git a/api/rs_program.spec b/api/rs_program.spec
new file mode 100644
index 0000000..a2c39a9
--- /dev/null
+++ b/api/rs_program.spec
@@ -0,0 +1,130 @@
+#
+# Copyright (C) 2015 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+header:
+summary: Program object routines
+description:
+end:
+
+function: rsgProgramRasterGetCullMode
+version: 16
+ret: rs_cull_mode
+arg: rs_program_raster pr, "program raster to query"
+summary:
+description:
+ Get program raster cull mode
+test: none
+end:
+
+function: rsgProgramRasterIsPointSpriteEnabled
+version: 16
+ret: bool
+arg: rs_program_raster pr, "program raster to query"
+summary:
+description:
+ Get program raster point sprite state
+test: none
+end:
+
+function: rsgProgramStoreGetBlendDstFunc
+version: 16
+ret: rs_blend_dst_func
+arg: rs_program_store ps, "program store to query"
+summary:
+description:
+ Get program store blend destination function
+test: none
+end:
+
+function: rsgProgramStoreGetBlendSrcFunc
+version: 16
+ret: rs_blend_src_func
+arg: rs_program_store ps, "program store to query"
+summary:
+description:
+ Get program store blend source function
+test: none
+end:
+
+function: rsgProgramStoreGetDepthFunc
+version: 16
+ret: rs_depth_func
+arg: rs_program_store ps, "program store to query"
+summary:
+description:
+ Get program store depth function
+test: none
+end:
+
+function: rsgProgramStoreIsColorMaskAlphaEnabled
+version: 16
+ret: bool
+arg: rs_program_store ps, "program store to query"
+summary:
+description:
+ Get program store alpha component color mask
+test: none
+end:
+
+function: rsgProgramStoreIsColorMaskBlueEnabled
+version: 16
+ret: bool
+arg: rs_program_store ps, "program store to query"
+summary:
+description:
+ Get program store blur component color mask
+test: none
+end:
+
+function: rsgProgramStoreIsColorMaskGreenEnabled
+version: 16
+ret: bool
+arg: rs_program_store ps, "program store to query"
+summary:
+description:
+ Get program store green component color mask
+test: none
+end:
+
+function: rsgProgramStoreIsColorMaskRedEnabled
+version: 16
+ret: bool
+arg: rs_program_store ps, "program store to query"
+summary:
+description:
+ Get program store red component color mask
+test: none
+end:
+
+function: rsgProgramStoreIsDepthMaskEnabled
+version: 16
+ret: bool
+arg: rs_program_store ps, "program store to query"
+summary:
+description:
+ Get program store depth mask
+test: none
+end:
+
+function: rsgProgramStoreIsDitherEnabled
+version: 16
+ret: bool
+arg: rs_program_store ps, "program store to query"
+summary:
+description:
+ Get program store dither state
+test: none
+end:
diff --git a/api/rs_quaternion.spec b/api/rs_quaternion.spec
new file mode 100644
index 0000000..07051a9
--- /dev/null
+++ b/api/rs_quaternion.spec
@@ -0,0 +1,270 @@
+#
+# Copyright (C) 2015 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+header:
+summary: Quaternion routines
+description:
+end:
+
+function: rsQuaternionAdd
+ret: void
+arg: rs_quaternion* q, "destination quaternion to add to"
+arg: const rs_quaternion* rhs, "right hand side quaternion to add"
+summary:
+description:
+ Add two quaternions
+inline:
+ q->w *= rhs->w;
+ q->x *= rhs->x;
+ q->y *= rhs->y;
+ q->z *= rhs->z;
+test: none
+end:
+
+function: rsQuaternionConjugate
+ret: void
+arg: rs_quaternion* q, "quaternion to conjugate"
+summary:
+description:
+ Conjugates the quaternion
+inline:
+ q->x = -q->x;
+ q->y = -q->y;
+ q->z = -q->z;
+test: none
+end:
+
+function: rsQuaternionDot
+ret: float, "dot product between q0 and q1"
+arg: const rs_quaternion* q0, "first quaternion"
+arg: const rs_quaternion* q1, "second quaternion"
+summary:
+description:
+ Dot product of two quaternions
+inline:
+ return q0->w*q1->w + q0->x*q1->x + q0->y*q1->y + q0->z*q1->z;
+test: none
+end:
+
+function: rsQuaternionGetMatrixUnit
+ret: void
+arg: rs_matrix4x4* m, "resulting matrix"
+arg: const rs_quaternion* q, "normalized quaternion"
+summary:
+description:
+ Computes rotation matrix from the normalized quaternion
+inline:
+ float xx = q->x * q->x;
+ float xy = q->x * q->y;
+ float xz = q->x * q->z;
+ float xw = q->x * q->w;
+ float yy = q->y * q->y;
+ float yz = q->y * q->z;
+ float yw = q->y * q->w;
+ float zz = q->z * q->z;
+ float zw = q->z * q->w;
+
+ m->m[0]  = 1.0f - 2.0f * ( yy + zz );
+ m->m[4]  =        2.0f * ( xy - zw );
+ m->m[8]  =        2.0f * ( xz + yw );
+ m->m[1]  =        2.0f * ( xy + zw );
+ m->m[5]  = 1.0f - 2.0f * ( xx + zz );
+ m->m[9]  =        2.0f * ( yz - xw );
+ m->m[2]  =        2.0f * ( xz - yw );
+ m->m[6]  =        2.0f * ( yz + xw );
+ m->m[10] = 1.0f - 2.0f * ( xx + yy );
+ m->m[3]  = m->m[7] = m->m[11] = m->m[12] = m->m[13] = m->m[14] = 0.0f;
+ m->m[15] = 1.0f;
+test: none
+end:
+
+function: rsQuaternionLoadRotateUnit
+ret: void
+arg: rs_quaternion* q, "quaternion to set"
+arg: float rot, "rot angle to rotate by"
+arg: float x, "component of a vector"
+arg: float y, "component of a vector"
+arg: float z, "component of a vector"
+summary:
+description:
+ Loads a quaternion that represents a rotation about an arbitrary unit vector
+inline:
+ rot *= (float)(M_PI / 180.0f) * 0.5f;
+ float c = cos(rot);
+ float s = sin(rot);
+
+ q->w = c;
+ q->x = x * s;
+ q->y = y * s;
+ q->z = z * s;
+test: none
+end:
+
+function: rsQuaternionSet
+ret: void
+arg: rs_quaternion* q, "destination quaternion"
+arg: float w, "component"
+arg: float x, "component"
+arg: float y, "component"
+arg: float z, "component"
+summary:
+description:
+ Set the quaternion from components or from another quaternion.
+inline:
+ q->w = w;
+ q->x = x;
+ q->y = y;
+ q->z = z;
+test: none
+end:
+
+function: rsQuaternionSet
+ret: void
+arg: rs_quaternion* q
+arg: const rs_quaternion* rhs, "source quaternion"
+inline:
+ q->w = rhs->w;
+ q->x = rhs->x;
+ q->y = rhs->y;
+ q->z = rhs->z;
+test: none
+end:
+
+# NOTE: The following inline definitions depend on each other.  The order must be preserved
+# for the compilation to work.
+
+function: rsQuaternionLoadRotate
+ret: void
+arg: rs_quaternion* q, "quaternion to set"
+arg: float rot, "angle to rotate by"
+arg: float x, "component of a vector"
+arg: float y, "component of a vector"
+arg: float z, "component of a vector"
+summary:
+description:
+ Loads a quaternion that represents a rotation about an arbitrary vector
+ (doesn't have to be unit)
+inline:
+ const float len = x*x + y*y + z*z;
+ if (len != 1) {
+     const float recipLen = 1.f / sqrt(len);
+     x *= recipLen;
+     y *= recipLen;
+     z *= recipLen;
+ }
+ rsQuaternionLoadRotateUnit(q, rot, x, y, z);
+test: none
+end:
+
+function: rsQuaternionNormalize
+ret: void
+arg: rs_quaternion* q, "quaternion to normalize"
+summary:
+description:
+ Normalizes the quaternion
+inline:
+ const float len = rsQuaternionDot(q, q);
+ if (len != 1) {
+     const float recipLen = 1.f / sqrt(len);
+     q->w *= recipLen;
+     q->x *= recipLen;
+     q->y *= recipLen;
+     q->z *= recipLen;
+ }
+test: none
+end:
+
+function: rsQuaternionMultiply
+ret: void
+arg: rs_quaternion* q, "destination quaternion"
+arg: float s, "scalar"
+summary:
+description:
+ Multiply quaternion by a scalar or another quaternion
+inline:
+ q->w *= s;
+ q->x *= s;
+ q->y *= s;
+ q->z *= s;
+test: none
+end:
+
+function: rsQuaternionMultiply
+ret: void
+arg: rs_quaternion* q
+arg: const rs_quaternion* rhs, "right hand side quaternion to multiply by"
+inline:
+ rs_quaternion qtmp;
+ rsQuaternionSet(&qtmp, q);
+
+ q->w = qtmp.w*rhs->w - qtmp.x*rhs->x - qtmp.y*rhs->y - qtmp.z*rhs->z;
+ q->x = qtmp.w*rhs->x + qtmp.x*rhs->w + qtmp.y*rhs->z - qtmp.z*rhs->y;
+ q->y = qtmp.w*rhs->y + qtmp.y*rhs->w + qtmp.z*rhs->x - qtmp.x*rhs->z;
+ q->z = qtmp.w*rhs->z + qtmp.z*rhs->w + qtmp.x*rhs->y - qtmp.y*rhs->x;
+ rsQuaternionNormalize(q);
+test: none
+end:
+
+function: rsQuaternionSlerp
+ret: void
+arg: rs_quaternion* q, "result quaternion from interpolation"
+arg: const rs_quaternion* q0, "first param"
+arg: const rs_quaternion* q1, "second param"
+arg: float t, "how much to interpolate by"
+summary:
+description:
+ Performs spherical linear interpolation between two quaternions
+inline:
+ if (t <= 0.0f) {
+     rsQuaternionSet(q, q0);
+     return;
+ }
+ if (t >= 1.0f) {
+     rsQuaternionSet(q, q1);
+     return;
+ }
+
+ rs_quaternion tempq0, tempq1;
+ rsQuaternionSet(&tempq0, q0);
+ rsQuaternionSet(&tempq1, q1);
+
+ float angle = rsQuaternionDot(q0, q1);
+ if (angle < 0) {
+     rsQuaternionMultiply(&tempq0, -1.0f);
+     angle *= -1.0f;
+ }
+
+ float scale, invScale;
+ if (angle + 1.0f > 0.05f) {
+     if (1.0f - angle >= 0.05f) {
+         float theta = acos(angle);
+         float invSinTheta = 1.0f / sin(theta);
+         scale = sin(theta * (1.0f - t)) * invSinTheta;
+         invScale = sin(theta * t) * invSinTheta;
+     } else {
+         scale = 1.0f - t;
+         invScale = t;
+     }
+ } else {
+     rsQuaternionSet(&tempq1, tempq0.z, -tempq0.y, tempq0.x, -tempq0.w);
+     scale = sin(M_PI * (0.5f - t));
+     invScale = sin(M_PI * t);
+ }
+
+ rsQuaternionSet(q, tempq0.w*scale + tempq1.w*invScale, tempq0.x*scale + tempq1.x*invScale,
+                     tempq0.y*scale + tempq1.y*invScale, tempq0.z*scale + tempq1.z*invScale);
+test: none
+end:
diff --git a/api/rs_sampler.spec b/api/rs_sampler.spec
new file mode 100644
index 0000000..35ab612
--- /dev/null
+++ b/api/rs_sampler.spec
@@ -0,0 +1,70 @@
+#
+# Copyright (C) 2015 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+header:
+summary: Sampler routines
+description:
+end:
+
+function: rsSamplerGetAnisotropy
+version: 16
+ret: float, "anisotropy"
+arg: rs_sampler s, "sampler to query"
+summary:
+description:
+  Get sampler anisotropy
+test: none
+end:
+
+function: rsSamplerGetMagnification
+version: 16
+ret: rs_sampler_value, "magnification value"
+arg: rs_sampler s, "sampler to query"
+summary:
+description:
+ Get sampler magnification value
+test: none
+end:
+
+function: rsSamplerGetMinification
+version: 16
+ret: rs_sampler_value, "minification value"
+arg: rs_sampler s, "sampler to query"
+summary:
+description:
+ Get sampler minification value
+test: none
+end:
+
+function: rsSamplerGetWrapS
+version: 16
+ret: rs_sampler_value, "wrap S value"
+arg: rs_sampler s, "sampler to query"
+summary:
+description:
+ Get sampler wrap S value
+test: none
+end:
+
+function: rsSamplerGetWrapT
+version: 16
+ret: rs_sampler_value, "wrap T value"
+arg: rs_sampler s, "sampler to query"
+summary:
+description:
+ Get sampler wrap T value
+test: none
+end:
diff --git a/api/rs_time.spec b/api/rs_time.spec
new file mode 100644
index 0000000..8011393
--- /dev/null
+++ b/api/rs_time.spec
@@ -0,0 +1,99 @@
+#
+# Copyright (C) 2015 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+header:
+summary: RenderScript time routines
+description:
+ This file contains RenderScript functions relating to time and date manipulation.
+end:
+
+type: rs_time_t
+size: 32
+simple: int
+summary: Seconds since January 1, 1970
+description:
+ Calendar time interpreted as seconds elapsed since the Epoch (00:00:00 on
+ January 1, 1970, Coordinated Universal Time (UTC)).
+end:
+
+type: rs_time_t
+size: 64
+simple: long
+end:
+
+type: rs_tm
+struct:
+field: int tm_sec, "Seconds after the minute. This ranges from 0 to 59, but possibly up to 60 for leap seconds."
+field: int tm_min, "Minutes after the hour. This ranges from 0 to 59."
+field: int tm_hour, "Hours past midnight. This ranges from 0 to 23."
+field: int tm_mday, "Day of the month. This ranges from 1 to 31."
+field: int tm_mon, "Months since January. This ranges from 0 to 11."
+field: int tm_year, "Years since 1900."
+field: int tm_wday, "Days since Sunday. This ranges from 0 to 6."
+field: int tm_yday, "Days since January 1. This ranges from 0 to 365."
+field: int tm_isdst, "Flag to indicate whether daylight saving time is in effect. The value is positive if it is in effect, zero if it is not, and negative if the information is not available."
+summary: Date and time structure
+description:
+ Data structure for broken-down time components.
+end:
+
+function: rsGetDt
+ret: float, "Time in seconds."
+summary:
+description:
+ Returns the time in seconds since this function was last called in this
+ script.
+test: none
+end:
+
+function: rsLocaltime
+ret: rs_tm*, "Pointer to broken-down time (same as input p local)."
+arg: rs_tm* local, "Broken-down time."
+arg: const rs_time_t* timer, "Input time as calendar time."
+summary:
+description:
+ Converts the time specified by p timer into broken-down time and stores it
+ in p local. This function also returns a pointer to p local. If p local
+ is NULL, this function does nothing and returns NULL.
+test: none
+end:
+
+function: rsTime
+ret: rs_time_t, "Seconds since the Epoch."
+arg: rs_time_t* timer, "Location to also store the returned calendar time."
+summary:
+description:
+ Returns the number of seconds since the Epoch (00:00:00 UTC, January 1,
+ 1970). If p timer is non-NULL, the result is also stored in the memory
+ pointed to by this variable. If an error occurs, a value of -1 is returned.
+test: none
+end:
+
+function: rsUptimeMillis
+ret: int64_t, "Uptime in milliseconds."
+summary:
+description:
+ Returns the current system clock (uptime) in milliseconds.
+test: none
+end:
+
+function: rsUptimeNanos
+ret: int64_t, "Uptime in nanoseconds."
+summary:
+description:
+ Returns the current system clock (uptime) in nanoseconds.
+test: none
+end:
diff --git a/api/rs_types.spec b/api/rs_types.spec
new file mode 100644
index 0000000..0eeac5b
--- /dev/null
+++ b/api/rs_types.spec
@@ -0,0 +1,849 @@
+#
+# Copyright (C) 2015 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+header:
+summary: Standard RenderScript types
+description:
+  Integers:<ul>
+  <li>8 bit: char, int8_t</li>
+  <li>16 bit: short, int16_t</li>
+  <li>32 bit: int, in32_t</li>
+  <li>64 bit: long, long long, int64_t</li></ul>
+
+  Unsigned integers:<ul>
+  <li>8 bit: uchar, uint8_t</li>
+  <li>16 bit: ushort, uint16_t</li>
+  <li>32 bit: uint, uint32_t</li>
+  <li>64 bit: ulong, uint64_t</li></ul>
+
+  Floating point:<ul>
+  <li>32 bit: float</li>
+  <li>64 bit: double</li></ul>
+
+  Vectors of length 2, 3, and 4 are supported for all the types above.
+include:
+ #include "stdbool.h"
+
+ #define RS_PACKED __attribute__((packed, aligned(4)))
+ #define NULL ((void *)0)
+
+ // Opaque handle to a RenderScript object. Do not use this directly.
+ #ifndef __LP64__
+ #define _RS_HANDLE \
+ struct {\
+   const int* const p;\
+ } __attribute__((packed, aligned(4)))
+ #else
+ #define _RS_HANDLE \
+ struct {\
+   const long* const p;\
+   const long* const r;\
+   const long* const v1;\
+   const long* const v2;\
+ }
+ #endif
+end:
+
+constant: M_1_PI
+value: 0.318309886183790671537767526745028724f
+summary: 1 / pi, as a 32 bit float
+description:
+ The inverse of pi, as a 32 bit float.
+end:
+
+constant: M_2_PI
+value: 0.636619772367581343075535053490057448f
+summary: 2 / pi, as a 32 bit float
+description:
+ 2 divided by pi, as a 32 bit float.
+end:
+
+constant: M_2_PIl
+value: 0.636619772367581343075535053490057448f
+hidden:
+summary: Deprecated.  Use M_2_PI instead.
+description:
+end:
+
+constant: M_2_SQRTPI
+value: 1.128379167095512573896158903121545172f
+summary:  2 / sqrt(pi), as a 32 bit float
+description:
+ 2 divided by the square root of pi, as a 32 bit float.
+end:
+
+constant: M_E
+value: 2.718281828459045235360287471352662498f
+summary: e, as a 32 bit float
+description:
+ The number e, the base of the natural logarithm, as a 32 bit float.
+end:
+
+constant: M_LN10
+value: 2.302585092994045684017991454684364208f
+summary: log_e(10), as a 32 bit float
+description:
+ The natural logarithm of 10, as a 32 bit float.
+end:
+
+constant: M_LN2
+value: 0.693147180559945309417232121458176568f
+summary: log_e(2), as a 32 bit float
+description:
+ The natural logarithm of 2, as a 32 bit float.
+end:
+
+constant: M_LOG10E
+value: 0.434294481903251827651128918916605082f
+summary: log_10(e), as a 32 bit float
+description:
+ The logarithm base 10 of e, as a 32 bit float.
+end:
+
+constant: M_LOG2E
+value: 1.442695040888963407359924681001892137f
+summary: log_2(e), as a 32 bit float
+description:
+ The logarithm base 2 of e, as a 32 bit float.
+end:
+
+constant: M_PI
+value: 3.141592653589793238462643383279502884f
+summary: pi, as a 32 bit float
+description:
+ The constant pi, as a 32 bit float.
+end:
+
+constant: M_PI_2
+value: 1.570796326794896619231321691639751442f
+summary: pi / 2, as a 32 bit float
+description:
+ Pi divided by 2, as a 32 bit float.
+end:
+
+constant: M_PI_4
+value: 0.785398163397448309615660845819875721f
+summary: pi / 4, as a 32 bit float
+description:
+ Pi divided by 4, as a 32 bit float.
+end:
+
+constant: M_SQRT1_2
+value: 0.707106781186547524400844362104849039f
+summary: 1 / sqrt(2), as a 32 bit float
+description:
+ The inverse of the square root of 2, as a 32 bit float.
+end:
+
+constant: M_SQRT2
+value: 1.414213562373095048801688724209698079f
+summary: sqrt(2), as a 32 bit float
+description:
+ The square root of 2, as a 32 bit float.
+end:
+
+type: int8_t
+simple: char
+summary: 8 bit signed integer
+description:
+ 8 bit integer type
+end:
+
+type: int16_t
+simple: short
+summary: 16 bit signed integer
+description:
+ 16 bit integer type
+end:
+
+type: int32_t
+simple: int
+summary: 32 bit signed integer
+description:
+ 32 bit integer type
+end:
+
+type: int64_t
+version: 9 20
+simple: long long
+summary: 64 bit signed integer
+description:
+ 64 bit integer type
+end:
+
+type: int64_t
+version: 21
+simple: long
+end:
+
+type: uint8_t
+simple: unsigned char
+summary: 8 bit unsigned integer
+description:
+ 8 bit unsigned integer type
+end:
+
+type: uint16_t
+simple: unsigned short
+summary: 16 bit unsigned integer
+description:
+ 16 bit unsigned integer type
+end:
+
+type: uint32_t
+simple: unsigned int
+summary: 32 bit unsigned integer
+description:
+ 32 bit unsigned integer type
+end:
+
+type: uint64_t
+version: 9 20
+simple: unsigned long long
+summary: 64 bit unsigned integer
+description:
+ 64 bit unsigned integer type
+end:
+
+type: uint64_t
+version: 21
+simple: unsigned long
+end:
+
+type: uchar
+simple: uint8_t
+summary: 8 bit unsigned integer
+description:
+ 8 bit unsigned integer type
+end:
+
+type: ushort
+simple: uint16_t
+summary: 16 bit unsigned integer
+description:
+ 16 bit unsigned integer type
+end:
+
+type: uint
+simple: uint32_t
+summary: 32 bit unsigned integer
+description:
+ 32 bit unsigned integer type
+end:
+
+type: ulong
+simple: uint64_t
+summary: 64 bit unsigned integer
+description:
+ Typedef for unsigned long (use for 64-bit unsigned integers)
+end:
+
+type: size_t
+size: 64
+simple: uint64_t
+summary: Unsigned size type
+description:
+ Typedef for size_t
+end:
+
+type: size_t
+size: 32
+simple: uint32_t
+end:
+
+type: ssize_t
+size: 64
+simple: int64_t
+summary: Signed size type
+description:
+ Typedef for ssize_t
+end:
+
+type: ssize_t
+size: 32
+simple: int32_t
+end:
+
+type: rs_element
+simple: _RS_HANDLE
+summary: Handle to an element
+description:
+ Opaque handle to a RenderScript element.
+ See: android.renderscript.Element
+end:
+
+type: rs_type
+simple: _RS_HANDLE
+summary: Handle to a Type
+description:
+ Opaque handle to a RenderScript type.
+ See: android.renderscript.Type
+end:
+
+type: rs_allocation
+simple: _RS_HANDLE
+summary: Handle to an allocation
+description:
+ Opaque handle to a RenderScript allocation.
+ See: android.renderscript.Allocation
+end:
+
+type: rs_sampler
+simple: _RS_HANDLE
+summary: Handle to a Sampler
+description:
+ Opaque handle to a RenderScript sampler object.
+ See: android.renderscript.Sampler
+end:
+
+type: rs_script
+simple: _RS_HANDLE
+summary: Handle to a Script
+description:
+ Opaque handle to a RenderScript script object.
+ See: android.renderscript.ScriptC
+end:
+
+
+type: rs_mesh
+size: 32
+simple: _RS_HANDLE
+summary: Handle to a Mesh
+description:
+ Opaque handle to a RenderScript mesh object.
+ See: android.renderscript.Mesh
+end:
+
+type: rs_program_fragment
+size: 32
+simple: _RS_HANDLE
+summary: Handle to a ProgramFragment
+description:
+ Opaque handle to a RenderScript ProgramFragment object.
+ See: android.renderscript.ProgramFragment
+end:
+
+type: rs_program_vertex
+size: 32
+simple: _RS_HANDLE
+summary: Handle to a ProgramVertex
+description:
+ Opaque handle to a RenderScript ProgramVertex object.
+ See: android.renderscript.ProgramVertex
+end:
+
+type: rs_program_raster
+size: 32
+simple: _RS_HANDLE
+summary: Handle to a ProgramRaster
+description:
+ Opaque handle to a RenderScript ProgramRaster object.
+ See: android.renderscript.ProgramRaster
+end:
+
+type: rs_program_store
+size: 32
+simple: _RS_HANDLE
+summary: Handle to a ProgramStore
+description:
+ Opaque handle to a RenderScript ProgramStore object.
+ See: android.renderscript.ProgramStore
+end:
+
+type: rs_font
+size: 32
+simple: _RS_HANDLE
+summary: Handle to a Font
+description:
+ Opaque handle to a RenderScript font object.
+ See: android.renderscript.Font
+end:
+
+type: float2
+simple: float __attribute__((ext_vector_type(2)))
+summary: Two 32 bit floats
+description:
+ Vector version of the basic float type.
+ Provides two float fields packed into a single 64 bit field with 64 bit alignment.
+end:
+
+type: float3
+simple: float __attribute__((ext_vector_type(3)))
+summary: Three 32 bit floats
+description:
+ Vector version of the basic float type.
+ Provides three float fields packed into a single 128 bit field with 128 bit alignment.
+end:
+
+type: float4
+simple: float __attribute__((ext_vector_type(4)))
+summary: Four 32 bit floats
+description:
+ Vector version of the basic float type.
+ Provides four float fields packed into a single 128 bit field with 128 bit alignment.
+end:
+
+
+type: double2
+simple: double __attribute__((ext_vector_type(2)))
+summary: Two 64 bit floats
+description:
+ Vector version of the basic double type. Provides two double fields packed
+ into a single 128 bit field with 128 bit alignment.
+end:
+
+type: double3
+simple: double __attribute__((ext_vector_type(3)))
+summary: Three 64 bit floats
+description:
+ Vector version of the basic double type. Provides three double fields packed
+ into a single 256 bit field with 256 bit alignment.
+end:
+
+type: double4
+simple: double __attribute__((ext_vector_type(4)))
+summary: Four 64 bit floats
+description:
+ Vector version of the basic double type. Provides four double fields packed
+ into a single 256 bit field with 256 bit alignment.
+end:
+
+
+type: uchar2
+simple: uchar __attribute__((ext_vector_type(2)))
+summary: Two 8 bit unsigned integers
+description:
+ Vector version of the basic uchar type. Provides two uchar fields packed
+ into a single 16 bit field with 16 bit alignment.
+end:
+
+type: uchar3
+simple: uchar __attribute__((ext_vector_type(3)))
+summary: Three 8 bit unsigned integers
+description:
+ Vector version of the basic uchar type. Provides three uchar fields packed
+ into a single 32 bit field with 32 bit alignment.
+end:
+
+type: uchar4
+simple: uchar __attribute__((ext_vector_type(4)))
+summary: Four 8 bit unsigned integers
+description:
+ Vector version of the basic uchar type. Provides four uchar fields packed
+ into a single 32 bit field with 32 bit alignment.
+end:
+
+
+type: ushort2
+simple: ushort __attribute__((ext_vector_type(2)))
+summary: Two 16 bit unsigned integers
+description:
+ Vector version of the basic ushort type. Provides two ushort fields packed
+ into a single 32 bit field with 32 bit alignment.
+end:
+
+type: ushort3
+simple: ushort __attribute__((ext_vector_type(3)))
+summary: Three 16 bit unsigned integers
+description:
+ Vector version of the basic ushort type. Provides three ushort fields packed
+ into a single 64 bit field with 64 bit alignment.
+end:
+
+type: ushort4
+simple: ushort __attribute__((ext_vector_type(4)))
+summary: Four 16 bit unsigned integers
+description:
+ Vector version of the basic ushort type. Provides four ushort fields packed
+ into a single 64 bit field with 64 bit alignment.
+end:
+
+
+type: uint2
+simple: uint __attribute__((ext_vector_type(2)))
+summary: Two 32 bit unsigned integers
+description:
+ Vector version of the basic uint type. Provides two uint fields packed into a
+ single 64 bit field with 64 bit alignment.
+end:
+
+type: uint3
+simple: uint __attribute__((ext_vector_type(3)))
+summary: Three 32 bit unsigned integers
+description:
+ Vector version of the basic uint type. Provides three uint fields packed into
+ a single 128 bit field with 128 bit alignment.
+end:
+
+type: uint4
+simple: uint __attribute__((ext_vector_type(4)))
+summary: Four 32 bit unsigned integers
+description:
+ Vector version of the basic uint type. Provides four uint fields packed into
+ a single 128 bit field with 128 bit alignment.
+end:
+
+
+type: ulong2
+simple: ulong __attribute__((ext_vector_type(2)))
+summary: Two 64 bit unsigned integers
+description:
+ Vector version of the basic ulong type. Provides two ulong fields packed into
+ a single 128 bit field with 128 bit alignment.
+end:
+
+type: ulong3
+simple: ulong __attribute__((ext_vector_type(3)))
+summary: Three 64 bit unsigned integers
+description:
+ Vector version of the basic ulong type. Provides three ulong fields packed
+ into a single 256 bit field with 256 bit alignment.
+end:
+
+type: ulong4
+simple: ulong __attribute__((ext_vector_type(4)))
+summary: Four 64 bit unsigned integers
+description:
+ Vector version of the basic ulong type. Provides four ulong fields packed
+ into a single 256 bit field with 256 bit alignment.
+end:
+
+
+type: char2
+simple: char __attribute__((ext_vector_type(2)))
+summary: Two 8 bit signed integers
+description:
+ Vector version of the basic char type. Provides two char fields packed into a
+ single 16 bit field with 16 bit alignment.
+end:
+
+type: char3
+simple: char __attribute__((ext_vector_type(3)))
+summary: Three 8 bit signed integers
+description:
+ Vector version of the basic char type. Provides three char fields packed into
+ a single 32 bit field with 32 bit alignment.
+end:
+
+type: char4
+simple: char __attribute__((ext_vector_type(4)))
+summary: Four 8 bit signed integers
+description:
+ Vector version of the basic char type. Provides four char fields packed into
+ a single 32 bit field with 32 bit alignment.
+end:
+
+type: short2
+simple: short __attribute__((ext_vector_type(2)))
+summary: Two 16 bit signed integers
+description:
+ Vector version of the basic short type. Provides two short fields packed into
+ a single 32 bit field with 32 bit alignment.
+end:
+
+type: short3
+simple: short __attribute__((ext_vector_type(3)))
+summary: Three 16 bit signed integers
+description:
+ Vector version of the basic short type. Provides three short fields packed
+ into a single 64 bit field with 64 bit alignment.
+end:
+
+type: short4
+simple: short __attribute__((ext_vector_type(4)))
+summary: Four 16 bit signed integers
+description:
+ Vector version of the basic short type. Provides four short fields packed
+ into a single 64 bit field with 64 bit alignment.
+end:
+
+
+type: int2
+simple: int __attribute__((ext_vector_type(2)))
+summary: Two 32 bit signed integers
+description:
+ Vector version of the basic int type. Provides two int fields packed into a
+ single 64 bit field with 64 bit alignment.
+end:
+
+type: int3
+simple: int __attribute__((ext_vector_type(3)))
+summary: Three 32 bit signed integers
+description:
+ Vector version of the basic int type. Provides three int fields packed into a
+ single 128 bit field with 128 bit alignment.
+end:
+
+type: int4
+simple: int __attribute__((ext_vector_type(4)))
+summary: Four 32 bit signed integers
+description:
+ Vector version of the basic int type. Provides two four fields packed into a
+ single 128 bit field with 128 bit alignment.
+end:
+
+
+type: long2
+simple: long __attribute__((ext_vector_type(2)))
+summary: Two 64 bit signed integers
+description:
+ Vector version of the basic long type. Provides two long fields packed into a
+ single 128 bit field with 128 bit alignment.
+end:
+
+type: long3
+simple: long __attribute__((ext_vector_type(3)))
+summary: Three 64 bit signed integers
+description:
+ Vector version of the basic long type. Provides three long fields packed into
+ a single 256 bit field with 256 bit alignment.
+end:
+
+type: long4
+simple: long __attribute__((ext_vector_type(4)))
+summary: Four 64 bit signed integers
+description:
+ Vector version of the basic long type. Provides four long fields packed into
+ a single 256 bit field with 256 bit alignment.
+end:
+
+type: rs_matrix4x4
+struct:
+field: float m[16]
+summary: 4x4 matrix of 32 bit floats
+description:
+ Native holder for RS matrix.  Elements are stored in the array at the
+ location [row*4 + col]
+end:
+
+type: rs_matrix3x3
+struct:
+field: float m[9]
+summary: 3x3 matrix of 32 bit floats
+description:
+ Native holder for RS matrix.  Elements are stored in the array at the
+ location [row*3 + col]
+end:
+
+type: rs_matrix2x2
+struct:
+field: float m[4]
+summary: 2x2 matrix of 32 bit floats
+description:
+ Native holder for RS matrix.  Elements are stored in the array at the
+ location [row*2 + col]
+end:
+
+type: rs_quaternion
+simple: float4
+summary: Quarternion
+description:
+ Quaternion type for use with the quaternion functions
+end:
+
+type: rs_allocation_cubemap_face
+version: 14
+enum:
+value: RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_X = 0
+value: RS_ALLOCATION_CUBEMAP_FACE_NEGATIVE_X = 1
+value: RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_Y = 2
+value: RS_ALLOCATION_CUBEMAP_FACE_NEGATIVE_Y = 3
+value: RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_Z = 4
+value: RS_ALLOCATION_CUBEMAP_FACE_NEGATIVE_Z = 5
+summary: Enum for selecting cube map faces
+description:
+end:
+
+type: rs_allocation_usage_type
+version: 14
+enum:
+value: RS_ALLOCATION_USAGE_SCRIPT = 0x0001
+value: RS_ALLOCATION_USAGE_GRAPHICS_TEXTURE = 0x0002, "Deprecated."
+value: RS_ALLOCATION_USAGE_GRAPHICS_VERTEX = 0x0004, "Deprecated."
+value: RS_ALLOCATION_USAGE_GRAPHICS_CONSTANTS = 0x0008, "Deprecated."
+value: RS_ALLOCATION_USAGE_GRAPHICS_RENDER_TARGET = 0x0010, "Deprecated."
+summary: Bitfield to specify the usage types for an allocation
+description:
+ These values are ORed together to specify which usages or memory spaces are
+ relevant to an allocation or an operation on an allocation.
+end:
+
+type: rs_primitive
+version: 16
+size: 32
+enum:
+value: RS_PRIMITIVE_POINT = 0, "Vertex data will be rendered as a series of points"
+value: RS_PRIMITIVE_LINE = 1, "Vertex pairs will be rendered as lines"
+value: RS_PRIMITIVE_LINE_STRIP = 2, "Vertex data will be rendered as a connected line strip"
+value: RS_PRIMITIVE_TRIANGLE = 3, "Vertices will be rendered as individual triangles"
+value: RS_PRIMITIVE_TRIANGLE_STRIP = 4, "Vertices will be rendered as a connected triangle strip defined by the first three vertices with each additional triangle defined by a new vertex"
+value: RS_PRIMITIVE_TRIANGLE_FAN = 5, "Vertices will be rendered as a sequence of triangles that all share first vertex as the origin"
+value: RS_PRIMITIVE_INVALID = 100, "Invalid primitive"
+summary: How to intepret mesh vertex data
+description:
+ Describes the way mesh vertex data is interpreted when rendering
+end:
+
+type: rs_data_type
+version: 16
+enum:
+value: RS_TYPE_NONE             = 0
+value: RS_TYPE_FLOAT_32         = 2
+value: RS_TYPE_FLOAT_64         = 3
+value: RS_TYPE_SIGNED_8         = 4
+value: RS_TYPE_SIGNED_16        = 5
+value: RS_TYPE_SIGNED_32        = 6
+value: RS_TYPE_SIGNED_64        = 7
+value: RS_TYPE_UNSIGNED_8       = 8
+value: RS_TYPE_UNSIGNED_16      = 9
+value: RS_TYPE_UNSIGNED_32      = 10
+value: RS_TYPE_UNSIGNED_64      = 11
+value: RS_TYPE_BOOLEAN          = 12
+value: RS_TYPE_UNSIGNED_5_6_5   = 13
+value: RS_TYPE_UNSIGNED_5_5_5_1 = 14
+value: RS_TYPE_UNSIGNED_4_4_4_4 = 15
+value: RS_TYPE_MATRIX_4X4       = 16
+value: RS_TYPE_MATRIX_3X3       = 17
+value: RS_TYPE_MATRIX_2X2       = 18
+value: RS_TYPE_ELEMENT          = 1000
+value: RS_TYPE_TYPE             = 1001
+value: RS_TYPE_ALLOCATION       = 1002
+value: RS_TYPE_SAMPLER          = 1003
+value: RS_TYPE_SCRIPT           = 1004
+value: RS_TYPE_MESH             = 1005
+value: RS_TYPE_PROGRAM_FRAGMENT = 1006
+value: RS_TYPE_PROGRAM_VERTEX   = 1007
+value: RS_TYPE_PROGRAM_RASTER   = 1008
+value: RS_TYPE_PROGRAM_STORE    = 1009
+value: RS_TYPE_FONT             = 1010
+value: RS_TYPE_INVALID          = 10000
+summary: Element data types
+description:
+ DataType represents the basic type information for a basic element.  The
+ naming convention follows.  For numeric types it is FLOAT,
+ SIGNED, or UNSIGNED followed by the _BITS where BITS is the
+ size of the data.  BOOLEAN is a true / false (1,0)
+ represented in an 8 bit container.  The UNSIGNED variants
+ with multiple bit definitions are for packed graphical data
+ formats and represent vectors with per vector member sizes
+ which are treated as a single unit for packing and alignment
+ purposes.
+
+ MATRIX the three matrix types contain FLOAT_32 elements and are treated
+ as 32 bits for alignment purposes.
+
+ RS_* objects.  32 bit opaque handles.
+end:
+
+type: rs_data_kind
+version: 16
+enum:
+value: RS_KIND_USER         = 0
+value: RS_KIND_PIXEL_L      = 7
+value: RS_KIND_PIXEL_A      = 8
+value: RS_KIND_PIXEL_LA     = 9
+value: RS_KIND_PIXEL_RGB    = 10
+value: RS_KIND_PIXEL_RGBA   = 11
+value: RS_KIND_PIXEL_DEPTH  = 12
+value: RS_KIND_PIXEL_YUV    = 13
+value: RS_KIND_INVALID      = 100
+summary: Element data kind
+description:
+ The special interpretation of the data if required.  This is primarly
+ useful for graphical data.  USER indicates no special interpretation is
+ expected.  PIXEL is used in conjunction with the standard data types for
+ representing texture formats.
+end:
+
+type: rs_depth_func
+version: 16
+size: 32
+enum:
+value: RS_DEPTH_FUNC_ALWAYS        = 0, "Always drawn"
+value: RS_DEPTH_FUNC_LESS          = 1, "Drawn if the incoming depth value is less than that in the depth buffer"
+value: RS_DEPTH_FUNC_LEQUAL        = 2, "Drawn if the incoming depth value is less or equal to that in the depth buffer"
+value: RS_DEPTH_FUNC_GREATER       = 3, "Drawn if the incoming depth value is greater than that in the depth buffer"
+value: RS_DEPTH_FUNC_GEQUAL        = 4, "Drawn if the incoming depth value is greater or equal to that in the depth buffer"
+value: RS_DEPTH_FUNC_EQUAL         = 5, "Drawn if the incoming depth value is equal to that in the depth buffer"
+value: RS_DEPTH_FUNC_NOTEQUAL      = 6, "Drawn if the incoming depth value is not equal to that in the depth buffer"
+value: RS_DEPTH_FUNC_INVALID       = 100, "Invalid depth function"
+summary: Depth function
+description:
+ Specifies conditional drawing depending on the comparison of the incoming
+ depth to that found in the depth buffer.
+end:
+
+type: rs_blend_src_func
+version: 16
+size: 32
+enum:
+value: RS_BLEND_SRC_ZERO                   = 0
+value: RS_BLEND_SRC_ONE                    = 1
+value: RS_BLEND_SRC_DST_COLOR              = 2
+value: RS_BLEND_SRC_ONE_MINUS_DST_COLOR    = 3
+value: RS_BLEND_SRC_SRC_ALPHA              = 4
+value: RS_BLEND_SRC_ONE_MINUS_SRC_ALPHA    = 5
+value: RS_BLEND_SRC_DST_ALPHA              = 6
+value: RS_BLEND_SRC_ONE_MINUS_DST_ALPHA    = 7
+value: RS_BLEND_SRC_SRC_ALPHA_SATURATE     = 8
+value: RS_BLEND_SRC_INVALID                = 100
+summary: Blend source function
+description:
+end:
+
+type: rs_blend_dst_func
+version: 16
+size: 32
+enum:
+value: RS_BLEND_DST_ZERO                   = 0
+value: RS_BLEND_DST_ONE                    = 1
+value: RS_BLEND_DST_SRC_COLOR              = 2
+value: RS_BLEND_DST_ONE_MINUS_SRC_COLOR    = 3
+value: RS_BLEND_DST_SRC_ALPHA              = 4
+value: RS_BLEND_DST_ONE_MINUS_SRC_ALPHA    = 5
+value: RS_BLEND_DST_DST_ALPHA              = 6
+value: RS_BLEND_DST_ONE_MINUS_DST_ALPHA    = 7
+value: RS_BLEND_DST_INVALID                = 100
+summary: Blend destination function
+description:
+end:
+
+type: rs_cull_mode
+version: 16
+size: 32
+enum:
+value: RS_CULL_BACK     = 0
+value: RS_CULL_FRONT    = 1
+value: RS_CULL_NONE     = 2
+value: RS_CULL_INVALID  = 100
+summary: Culling mode
+description:
+end:
+
+type: rs_sampler_value
+version: 16
+enum:
+value: RS_SAMPLER_NEAREST              = 0
+value: RS_SAMPLER_LINEAR               = 1
+value: RS_SAMPLER_LINEAR_MIP_LINEAR    = 2
+value: RS_SAMPLER_WRAP                 = 3
+value: RS_SAMPLER_CLAMP                = 4
+value: RS_SAMPLER_LINEAR_MIP_NEAREST   = 5
+value: RS_SAMPLER_MIRRORED_REPEAT      = 6
+value: RS_SAMPLER_INVALID              = 100
+summary: Sampler wrap T value
+description:
+end:
diff --git a/scriptc/rs_allocation.rsh b/scriptc/rs_allocation.rsh
index 96fc70e..2cc2a82 100644
--- a/scriptc/rs_allocation.rsh
+++ b/scriptc/rs_allocation.rsh
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011 The Android Open Source Project
+ * Copyright (C) 2015 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,416 +14,3206 @@
  * limitations under the License.
  */
 
-/** @file rs_allocation.rsh
- *  \brief Allocation routines
+// Don't edit this file!  It is auto-generated by frameworks/rs/api/gen_runtime.
+
+/*
+ * rs_allocation.rsh: Allocation routines
  *
- *
+ * Functions that can be used to query the characteristics of an allocation,
+ * to set and get elements of the allocation.
  */
+#ifndef RENDERSCRIPT_RS_ALLOCATION_RSH
+#define RENDERSCRIPT_RS_ALLOCATION_RSH
 
-#ifndef __RS_ALLOCATION_RSH__
-#define __RS_ALLOCATION_RSH__
-
-/**
- * Returns the Allocation for a given pointer.  The pointer should point within
- * a valid allocation.  The results are undefined if the pointer is not from a
- * valid allocation.
+/*
+ * rsAllocationCopy1DRange: Copy consecutive values between allocations
  *
- * This function is deprecated and will be removed in the SDK from a future
- * release.
- */
-extern rs_allocation __attribute__((overloadable))
-    rsGetAllocation(const void *);
-
-/**
- * Query the dimension of an allocation.
+ * Copies part of an allocation into another allocation.
  *
- * @return uint32_t The X dimension of the allocation.
- */
-extern uint32_t __attribute__((overloadable))
-    rsAllocationGetDimX(rs_allocation);
-
-/**
- * Query the dimension of an allocation.
+ * The two allocations must be different.  Using this function to copy whithin
+ * the same allocation yields undefined results.
  *
- * @return uint32_t The Y dimension of the allocation.
+ * Parameters:
+ *   dstAlloc Allocation to copy data into.
+ *   dstOff The offset of the first element to be copied in the destination allocation.
+ *   dstMip Mip level in the destination allocation.
+ *   count The number of elements to be copied.
+ *   srcAlloc The source data allocation.
+ *   srcOff The offset of the first element in data to be copied in the source allocation.
+ *   srcMip Mip level in the source allocation.
  */
-extern uint32_t __attribute__((overloadable))
-    rsAllocationGetDimY(rs_allocation);
-
-/**
- * Query the dimension of an allocation.
- *
- * @return uint32_t The Z dimension of the allocation.
- */
-extern uint32_t __attribute__((overloadable))
-    rsAllocationGetDimZ(rs_allocation);
-
-/**
- * Query an allocation for the presence of more than one LOD.
- *
- * @return uint32_t Returns 1 if more than one LOD is present, 0 otherwise.
- */
-extern uint32_t __attribute__((overloadable))
-    rsAllocationGetDimLOD(rs_allocation);
-
-/**
- * Query an allocation for the presence of more than one face.
- *
- * @return uint32_t Returns 1 if more than one face is present, 0 otherwise.
- */
-extern uint32_t __attribute__((overloadable))
-    rsAllocationGetDimFaces(rs_allocation);
-
 #if (defined(RS_VERSION) && (RS_VERSION >= 14))
-
-/**
- * Copy part of an allocation from another allocation.
- *
- * @param dstAlloc Allocation to copy data into.
- * @param dstOff The offset of the first element to be copied in
- *               the destination allocation.
- * @param dstMip Mip level in the destination allocation.
- * @param count The number of elements to be copied.
- * @param srcAlloc The source data allocation.
- * @param srcOff The offset of the first element in data to be
- *               copied in the source allocation.
- * @param srcMip Mip level in the source allocation.
- */
 extern void __attribute__((overloadable))
-    rsAllocationCopy1DRange(rs_allocation dstAlloc,
-                            uint32_t dstOff, uint32_t dstMip,
-                            uint32_t count,
-                            rs_allocation srcAlloc,
-                            uint32_t srcOff, uint32_t srcMip);
-
-/**
- * Copy a rectangular region into the allocation from another
- * allocation.
- *
- * @param dstAlloc allocation to copy data into.
- * @param dstXoff X offset of the region to update in the
- *                destination allocation.
- * @param dstYoff Y offset of the region to update in the
- *                destination allocation.
- * @param dstMip Mip level in the destination allocation.
- * @param dstFace Cubemap face of the destination allocation,
- *                ignored for allocations that aren't cubemaps.
- * @param width Width of the incoming region to update.
- * @param height Height of the incoming region to update.
- * @param srcAlloc The source data allocation.
- * @param srcXoff X offset in data of the source allocation.
- * @param srcYoff Y offset in data of the source allocation.
- * @param srcMip Mip level in the source allocation.
- * @param srcFace Cubemap face of the source allocation,
- *                ignored for allocations that aren't cubemaps.
- */
-extern void __attribute__((overloadable))
-    rsAllocationCopy2DRange(rs_allocation dstAlloc,
-                            uint32_t dstXoff, uint32_t dstYoff,
-                            uint32_t dstMip,
-                            rs_allocation_cubemap_face dstFace,
-                            uint32_t width, uint32_t height,
-                            rs_allocation srcAlloc,
-                            uint32_t srcXoff, uint32_t srcYoff,
-                            uint32_t srcMip,
-                            rs_allocation_cubemap_face srcFace);
-
-#endif //defined(RS_VERSION) && (RS_VERSION >= 14)
-
-/**
- * Extract a single element from an allocation.
- */
-extern const void * __attribute__((overloadable))
-    rsGetElementAt(rs_allocation a, uint32_t x);
-/**
- * \overload
- */
-extern const void * __attribute__((overloadable))
-    rsGetElementAt(rs_allocation a, uint32_t x, uint32_t y);
-/**
- * \overload
- */
-extern const void * __attribute__((overloadable))
-    rsGetElementAt(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
-
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 18))
-    #define GET_ELEMENT_AT(T) \
-    extern T __attribute__((overloadable)) \
-            rsGetElementAt_##T(rs_allocation a, uint32_t x); \
-    extern T __attribute__((overloadable)) \
-            rsGetElementAt_##T(rs_allocation a, uint32_t x, uint32_t y);  \
-    extern T __attribute__((overloadable)) \
-            rsGetElementAt_##T(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
-#else
-    #define GET_ELEMENT_AT(T) \
-    static inline T __attribute__((overloadable)) \
-            rsGetElementAt_##T(rs_allocation a, uint32_t x) {  \
-        return ((T *)rsGetElementAt(a, x))[0]; \
-    } \
-    static inline T __attribute__((overloadable)) \
-            rsGetElementAt_##T(rs_allocation a, uint32_t x, uint32_t y) {  \
-        return ((T *)rsGetElementAt(a, x, y))[0]; \
-    } \
-    static inline T __attribute__((overloadable)) \
-            rsGetElementAt_##T(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) {  \
-        return ((T *)rsGetElementAt(a, x, y, z))[0]; \
-    }
+    rsAllocationCopy1DRange(rs_allocation dstAlloc, uint32_t dstOff, uint32_t dstMip, uint32_t count,
+                            rs_allocation srcAlloc, uint32_t srcOff, uint32_t srcMip);
 #endif
 
-GET_ELEMENT_AT(char)
-GET_ELEMENT_AT(char2)
-GET_ELEMENT_AT(char3)
-GET_ELEMENT_AT(char4)
-GET_ELEMENT_AT(uchar)
-GET_ELEMENT_AT(uchar2)
-GET_ELEMENT_AT(uchar3)
-GET_ELEMENT_AT(uchar4)
-GET_ELEMENT_AT(short)
-GET_ELEMENT_AT(short2)
-GET_ELEMENT_AT(short3)
-GET_ELEMENT_AT(short4)
-GET_ELEMENT_AT(ushort)
-GET_ELEMENT_AT(ushort2)
-GET_ELEMENT_AT(ushort3)
-GET_ELEMENT_AT(ushort4)
-GET_ELEMENT_AT(int)
-GET_ELEMENT_AT(int2)
-GET_ELEMENT_AT(int3)
-GET_ELEMENT_AT(int4)
-GET_ELEMENT_AT(uint)
-GET_ELEMENT_AT(uint2)
-GET_ELEMENT_AT(uint3)
-GET_ELEMENT_AT(uint4)
-GET_ELEMENT_AT(long)
-GET_ELEMENT_AT(long2)
-GET_ELEMENT_AT(long3)
-GET_ELEMENT_AT(long4)
-GET_ELEMENT_AT(ulong)
-GET_ELEMENT_AT(ulong2)
-GET_ELEMENT_AT(ulong3)
-GET_ELEMENT_AT(ulong4)
-GET_ELEMENT_AT(float)
-GET_ELEMENT_AT(float2)
-GET_ELEMENT_AT(float3)
-GET_ELEMENT_AT(float4)
-GET_ELEMENT_AT(double)
-GET_ELEMENT_AT(double2)
-GET_ELEMENT_AT(double3)
-GET_ELEMENT_AT(double4)
-
-#undef GET_ELEMENT_AT
-
-// Jelly Bean
-#if (defined(RS_VERSION) && (RS_VERSION >= 16))
-
-/**
- * Send the contents of the Allocation to the queue.
- * @param a allocation to work on
+/*
+ * rsAllocationCopy2DRange: Copy a rectangular region between allocations
+ *
+ * Copy a rectangular region into the allocation from another allocation.
+ *
+ * The two allocations must be different.  Using this function to copy whithin
+ * the same allocation yields undefined results.
+ *
+ * Parameters:
+ *   dstAlloc Allocation to copy data into.
+ *   dstXoff X offset of the region to update in the destination allocation.
+ *   dstYoff Y offset of the region to update in the destination allocation.
+ *   dstMip Mip level in the destination allocation.
+ *   dstFace Cubemap face of the destination allocation, ignored for allocations that aren't cubemaps.
+ *   width Width of the incoming region to update.
+ *   height Height of the incoming region to update.
+ *   srcAlloc The source data allocation.
+ *   srcXoff X offset in data of the source allocation.
+ *   srcYoff Y offset in data of the source allocation.
+ *   srcMip Mip level in the source allocation.
+ *   srcFace Cubemap face of the source allocation, ignored for allocations that aren't cubemaps.
  */
+#if (defined(RS_VERSION) && (RS_VERSION >= 14))
 extern void __attribute__((overloadable))
-    rsAllocationIoSend(rs_allocation a);
+    rsAllocationCopy2DRange(rs_allocation dstAlloc, uint32_t dstXoff, uint32_t dstYoff,
+                            uint32_t dstMip, rs_allocation_cubemap_face dstFace, uint32_t width,
+                            uint32_t height, rs_allocation srcAlloc, uint32_t srcXoff,
+                            uint32_t srcYoff, uint32_t srcMip, rs_allocation_cubemap_face srcFace);
+#endif
 
-/**
- * Receive a new set of contents from the queue.
- * @param a allocation to work on
+/*
+ * rsAllocationGetDimFaces: Presence of more than one face
+ *
+ * If the allocation is a cubemap, this function returns 1 if there's more than one
+ * face present.  In all other cases, it returns 0.
+ *
+ * Returns: Returns 1 if more than one face is present, 0 otherwise.
  */
-extern void __attribute__((overloadable))
-    rsAllocationIoReceive(rs_allocation a);
+extern uint32_t __attribute__((overloadable))
+    rsAllocationGetDimFaces(rs_allocation a);
 
+/*
+ * rsAllocationGetDimLOD: Presence of levels of details
+ *
+ * Query an allocation for the presence of more than one Level Of Details.  This is useful for mipmaps.
+ *
+ * Returns: Returns 1 if more than one LOD is present, 0 otherwise.
+ */
+extern uint32_t __attribute__((overloadable))
+    rsAllocationGetDimLOD(rs_allocation a);
 
-/**
+/*
+ * rsAllocationGetDimX: Size of the X dimension
+ *
+ * Returns the size of the X dimension of the allocation.
+ *
+ * Returns: The X dimension of the allocation.
+ */
+extern uint32_t __attribute__((overloadable))
+    rsAllocationGetDimX(rs_allocation a);
+
+/*
+ * rsAllocationGetDimY: Size of the Y dimension
+ *
+ * Returns the size of the Y dimension of the allocation.
+ * If the allocation has less than two dimensions, returns 0.
+ *
+ * Returns: The Y dimension of the allocation.
+ */
+extern uint32_t __attribute__((overloadable))
+    rsAllocationGetDimY(rs_allocation a);
+
+/*
+ * rsAllocationGetDimZ: Size of the Z dimension
+ *
+ * Returns the size of the Z dimension of the allocation.
+ * If the allocation has less than three dimensions, returns 0.
+ *
+ * Returns: The Z dimension of the allocation.
+ */
+extern uint32_t __attribute__((overloadable))
+    rsAllocationGetDimZ(rs_allocation a);
+
+/*
  * Get the element object describing the allocation's layout
- * @param a allocation to get data from
- * @return element describing allocation layout
+ *
+ * Parameters:
+ *   a allocation to get data from
+ *
+ * Returns: element describing allocation layout
  */
 extern rs_element __attribute__((overloadable))
     rsAllocationGetElement(rs_allocation a);
 
-/**
- * Fetch allocation in a way described by the sampler
- * @param a 1D allocation to sample from
- * @param s sampler state
- * @param location to sample from
- */
-extern float4 __attribute__((overloadable))
-    rsSample(rs_allocation a, rs_sampler s, float location);
-/**
- * Fetch allocation in a way described by the sampler
- * @param a 1D allocation to sample from
- * @param s sampler state
- * @param location to sample from
- * @param lod mip level to sample from, for fractional values
- *            mip levels will be interpolated if
- *            RS_SAMPLER_LINEAR_MIP_LINEAR is used
- */
-extern float4 __attribute__((overloadable))
-    rsSample(rs_allocation a, rs_sampler s, float location, float lod);
-
-/**
- * Fetch allocation in a way described by the sampler
- * @param a 2D allocation to sample from
- * @param s sampler state
- * @param location to sample from
- */
-extern float4 __attribute__((overloadable))
-    rsSample(rs_allocation a, rs_sampler s, float2 location);
-
-/**
- * Fetch allocation in a way described by the sampler
- * @param a 2D allocation to sample from
- * @param s sampler state
- * @param location to sample from
- * @param lod mip level to sample from, for fractional values
- *            mip levels will be interpolated if
- *            RS_SAMPLER_LINEAR_MIP_LINEAR is used
- */
-extern float4 __attribute__((overloadable))
-    rsSample(rs_allocation a, rs_sampler s, float2 location, float lod);
-
-#endif // (defined(RS_VERSION) && (RS_VERSION >= 16))
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 18))
-
-/**
- * Set single element of an allocation.
- */
-extern void __attribute__((overloadable))
-    rsSetElementAt(rs_allocation a, void* ptr, uint32_t x);
-
-/**
- * \overload
- */
-extern void __attribute__((overloadable))
-    rsSetElementAt(rs_allocation a, void* ptr, uint32_t x, uint32_t y);
-
-#define SET_ELEMENT_AT(T)                                               \
-    extern void __attribute__((overloadable))                           \
-    rsSetElementAt_##T(rs_allocation a, T val, uint32_t x);             \
-    extern void __attribute__((overloadable))                           \
-    rsSetElementAt_##T(rs_allocation a, T val, uint32_t x, uint32_t y); \
-    extern void __attribute__((overloadable))                           \
-    rsSetElementAt_##T(rs_allocation a, T val, uint32_t x, uint32_t y, uint32_t z);
-
-
-SET_ELEMENT_AT(char)
-SET_ELEMENT_AT(char2)
-SET_ELEMENT_AT(char3)
-SET_ELEMENT_AT(char4)
-SET_ELEMENT_AT(uchar)
-SET_ELEMENT_AT(uchar2)
-SET_ELEMENT_AT(uchar3)
-SET_ELEMENT_AT(uchar4)
-SET_ELEMENT_AT(short)
-SET_ELEMENT_AT(short2)
-SET_ELEMENT_AT(short3)
-SET_ELEMENT_AT(short4)
-SET_ELEMENT_AT(ushort)
-SET_ELEMENT_AT(ushort2)
-SET_ELEMENT_AT(ushort3)
-SET_ELEMENT_AT(ushort4)
-SET_ELEMENT_AT(int)
-SET_ELEMENT_AT(int2)
-SET_ELEMENT_AT(int3)
-SET_ELEMENT_AT(int4)
-SET_ELEMENT_AT(uint)
-SET_ELEMENT_AT(uint2)
-SET_ELEMENT_AT(uint3)
-SET_ELEMENT_AT(uint4)
-SET_ELEMENT_AT(long)
-SET_ELEMENT_AT(long2)
-SET_ELEMENT_AT(long3)
-SET_ELEMENT_AT(long4)
-SET_ELEMENT_AT(ulong)
-SET_ELEMENT_AT(ulong2)
-SET_ELEMENT_AT(ulong3)
-SET_ELEMENT_AT(ulong4)
-SET_ELEMENT_AT(float)
-SET_ELEMENT_AT(float2)
-SET_ELEMENT_AT(float3)
-SET_ELEMENT_AT(float4)
-SET_ELEMENT_AT(double)
-SET_ELEMENT_AT(double2)
-SET_ELEMENT_AT(double3)
-SET_ELEMENT_AT(double4)
-
-#undef SET_ELEMENT_AT
-
-
-/**
- * Extract a single element from an allocation.
- */
-extern uchar __attribute__((overloadable))
-    rsGetElementAtYuv_uchar_Y(rs_allocation a, uint32_t x, uint32_t y);
-
-/**
- * Extract a single element from an allocation.
+/*
+ * rsAllocationIoReceive: Receive new content from the queue
  *
- * Coordinates are in the dimensions of the Y plane
- */
-extern uchar __attribute__((overloadable))
-    rsGetElementAtYuv_uchar_U(rs_allocation a, uint32_t x, uint32_t y);
-
-/**
- * Extract a single element from an allocation.
+ * Receive a new set of contents from the queue.
  *
- * Coordinates are in the dimensions of the Y plane
+ * Parameters:
+ *   a allocation to work on
  */
-extern uchar __attribute__((overloadable))
-    rsGetElementAtYuv_uchar_V(rs_allocation a, uint32_t x, uint32_t y);
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+extern void __attribute__((overloadable))
+    rsAllocationIoReceive(rs_allocation a);
+#endif
 
-#endif // (defined(RS_VERSION) && (RS_VERSION >= 18))
+/*
+ * rsAllocationIoSend: Send new content to the queue
+ *
+ * Send the contents of the Allocation to the queue.
+ *
+ * Parameters:
+ *   a allocation to work on
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+extern void __attribute__((overloadable))
+    rsAllocationIoSend(rs_allocation a);
+#endif
+
+/*
+ * Get a single element from an allocation.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern float2 __attribute__((overloadable))
+    rsAllocationVLoadX_float2(rs_allocation a, uint32_t x);
+#endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 22))
-
-#define VOP(T)                                                                   \
-    extern T __attribute__((overloadable))                                       \
-    rsAllocationVLoadX_##T(rs_allocation a, uint32_t x);                         \
-    extern T __attribute__((overloadable))                                       \
-    rsAllocationVLoadX_##T(rs_allocation a, uint32_t x, uint32_t y);             \
-    extern T __attribute__((overloadable))                                       \
-    rsAllocationVLoadX_##T(rs_allocation a, uint32_t x, uint32_t y, uint32_t z); \
-    extern void __attribute__((overloadable))                                    \
-    rsAllocationVStoreX_##T(rs_allocation a, T val, uint32_t x);                 \
-    extern void __attribute__((overloadable))                                    \
-    rsAllocationVStoreX_##T(rs_allocation a, T val, uint32_t x, uint32_t y);     \
-    extern void __attribute__((overloadable))                                    \
-    rsAllocationVStoreX_##T(rs_allocation a, T val, uint32_t x, uint32_t y, uint32_t z);
-
-VOP(char2)
-VOP(char3)
-VOP(char4)
-VOP(uchar2)
-VOP(uchar3)
-VOP(uchar4)
-VOP(short2)
-VOP(short3)
-VOP(short4)
-VOP(ushort2)
-VOP(ushort3)
-VOP(ushort4)
-VOP(int2)
-VOP(int3)
-VOP(int4)
-VOP(uint2)
-VOP(uint3)
-VOP(uint4)
-VOP(long2)
-VOP(long3)
-VOP(long4)
-VOP(ulong2)
-VOP(ulong3)
-VOP(ulong4)
-VOP(float2)
-VOP(float3)
-VOP(float4)
-VOP(double2)
-VOP(double3)
-VOP(double4)
-
-#undef VOP
-
-#endif //(defined(RS_VERSION) && (RS_VERSION >= 22))
-
-
+extern float3 __attribute__((overloadable))
+    rsAllocationVLoadX_float3(rs_allocation a, uint32_t x);
 #endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern float4 __attribute__((overloadable))
+    rsAllocationVLoadX_float4(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern double2 __attribute__((overloadable))
+    rsAllocationVLoadX_double2(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern double3 __attribute__((overloadable))
+    rsAllocationVLoadX_double3(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern double4 __attribute__((overloadable))
+    rsAllocationVLoadX_double4(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern char2 __attribute__((overloadable))
+    rsAllocationVLoadX_char2(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern char3 __attribute__((overloadable))
+    rsAllocationVLoadX_char3(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern char4 __attribute__((overloadable))
+    rsAllocationVLoadX_char4(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern uchar2 __attribute__((overloadable))
+    rsAllocationVLoadX_uchar2(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern uchar3 __attribute__((overloadable))
+    rsAllocationVLoadX_uchar3(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern uchar4 __attribute__((overloadable))
+    rsAllocationVLoadX_uchar4(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern short2 __attribute__((overloadable))
+    rsAllocationVLoadX_short2(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern short3 __attribute__((overloadable))
+    rsAllocationVLoadX_short3(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern short4 __attribute__((overloadable))
+    rsAllocationVLoadX_short4(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern ushort2 __attribute__((overloadable))
+    rsAllocationVLoadX_ushort2(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern ushort3 __attribute__((overloadable))
+    rsAllocationVLoadX_ushort3(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern ushort4 __attribute__((overloadable))
+    rsAllocationVLoadX_ushort4(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern int2 __attribute__((overloadable))
+    rsAllocationVLoadX_int2(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern int3 __attribute__((overloadable))
+    rsAllocationVLoadX_int3(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern int4 __attribute__((overloadable))
+    rsAllocationVLoadX_int4(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern uint2 __attribute__((overloadable))
+    rsAllocationVLoadX_uint2(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern uint3 __attribute__((overloadable))
+    rsAllocationVLoadX_uint3(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern uint4 __attribute__((overloadable))
+    rsAllocationVLoadX_uint4(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern long2 __attribute__((overloadable))
+    rsAllocationVLoadX_long2(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern long3 __attribute__((overloadable))
+    rsAllocationVLoadX_long3(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern long4 __attribute__((overloadable))
+    rsAllocationVLoadX_long4(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern ulong2 __attribute__((overloadable))
+    rsAllocationVLoadX_ulong2(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern ulong3 __attribute__((overloadable))
+    rsAllocationVLoadX_ulong3(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern ulong4 __attribute__((overloadable))
+    rsAllocationVLoadX_ulong4(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern float2 __attribute__((overloadable))
+    rsAllocationVLoadX_float2(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern float3 __attribute__((overloadable))
+    rsAllocationVLoadX_float3(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern float4 __attribute__((overloadable))
+    rsAllocationVLoadX_float4(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern double2 __attribute__((overloadable))
+    rsAllocationVLoadX_double2(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern double3 __attribute__((overloadable))
+    rsAllocationVLoadX_double3(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern double4 __attribute__((overloadable))
+    rsAllocationVLoadX_double4(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern char2 __attribute__((overloadable))
+    rsAllocationVLoadX_char2(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern char3 __attribute__((overloadable))
+    rsAllocationVLoadX_char3(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern char4 __attribute__((overloadable))
+    rsAllocationVLoadX_char4(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern uchar2 __attribute__((overloadable))
+    rsAllocationVLoadX_uchar2(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern uchar3 __attribute__((overloadable))
+    rsAllocationVLoadX_uchar3(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern uchar4 __attribute__((overloadable))
+    rsAllocationVLoadX_uchar4(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern short2 __attribute__((overloadable))
+    rsAllocationVLoadX_short2(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern short3 __attribute__((overloadable))
+    rsAllocationVLoadX_short3(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern short4 __attribute__((overloadable))
+    rsAllocationVLoadX_short4(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern ushort2 __attribute__((overloadable))
+    rsAllocationVLoadX_ushort2(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern ushort3 __attribute__((overloadable))
+    rsAllocationVLoadX_ushort3(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern ushort4 __attribute__((overloadable))
+    rsAllocationVLoadX_ushort4(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern int2 __attribute__((overloadable))
+    rsAllocationVLoadX_int2(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern int3 __attribute__((overloadable))
+    rsAllocationVLoadX_int3(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern int4 __attribute__((overloadable))
+    rsAllocationVLoadX_int4(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern uint2 __attribute__((overloadable))
+    rsAllocationVLoadX_uint2(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern uint3 __attribute__((overloadable))
+    rsAllocationVLoadX_uint3(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern uint4 __attribute__((overloadable))
+    rsAllocationVLoadX_uint4(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern long2 __attribute__((overloadable))
+    rsAllocationVLoadX_long2(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern long3 __attribute__((overloadable))
+    rsAllocationVLoadX_long3(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern long4 __attribute__((overloadable))
+    rsAllocationVLoadX_long4(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern ulong2 __attribute__((overloadable))
+    rsAllocationVLoadX_ulong2(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern ulong3 __attribute__((overloadable))
+    rsAllocationVLoadX_ulong3(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern ulong4 __attribute__((overloadable))
+    rsAllocationVLoadX_ulong4(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern float2 __attribute__((overloadable))
+    rsAllocationVLoadX_float2(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern float3 __attribute__((overloadable))
+    rsAllocationVLoadX_float3(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern float4 __attribute__((overloadable))
+    rsAllocationVLoadX_float4(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern double2 __attribute__((overloadable))
+    rsAllocationVLoadX_double2(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern double3 __attribute__((overloadable))
+    rsAllocationVLoadX_double3(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern double4 __attribute__((overloadable))
+    rsAllocationVLoadX_double4(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern char2 __attribute__((overloadable))
+    rsAllocationVLoadX_char2(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern char3 __attribute__((overloadable))
+    rsAllocationVLoadX_char3(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern char4 __attribute__((overloadable))
+    rsAllocationVLoadX_char4(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern uchar2 __attribute__((overloadable))
+    rsAllocationVLoadX_uchar2(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern uchar3 __attribute__((overloadable))
+    rsAllocationVLoadX_uchar3(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern uchar4 __attribute__((overloadable))
+    rsAllocationVLoadX_uchar4(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern short2 __attribute__((overloadable))
+    rsAllocationVLoadX_short2(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern short3 __attribute__((overloadable))
+    rsAllocationVLoadX_short3(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern short4 __attribute__((overloadable))
+    rsAllocationVLoadX_short4(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern ushort2 __attribute__((overloadable))
+    rsAllocationVLoadX_ushort2(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern ushort3 __attribute__((overloadable))
+    rsAllocationVLoadX_ushort3(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern ushort4 __attribute__((overloadable))
+    rsAllocationVLoadX_ushort4(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern int2 __attribute__((overloadable))
+    rsAllocationVLoadX_int2(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern int3 __attribute__((overloadable))
+    rsAllocationVLoadX_int3(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern int4 __attribute__((overloadable))
+    rsAllocationVLoadX_int4(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern uint2 __attribute__((overloadable))
+    rsAllocationVLoadX_uint2(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern uint3 __attribute__((overloadable))
+    rsAllocationVLoadX_uint3(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern uint4 __attribute__((overloadable))
+    rsAllocationVLoadX_uint4(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern long2 __attribute__((overloadable))
+    rsAllocationVLoadX_long2(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern long3 __attribute__((overloadable))
+    rsAllocationVLoadX_long3(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern long4 __attribute__((overloadable))
+    rsAllocationVLoadX_long4(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern ulong2 __attribute__((overloadable))
+    rsAllocationVLoadX_ulong2(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern ulong3 __attribute__((overloadable))
+    rsAllocationVLoadX_ulong3(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern ulong4 __attribute__((overloadable))
+    rsAllocationVLoadX_ulong4(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+/*
+ * Set a single element of an allocation.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_float2(rs_allocation a, float2 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_float3(rs_allocation a, float3 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_float4(rs_allocation a, float4 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_double2(rs_allocation a, double2 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_double3(rs_allocation a, double3 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_double4(rs_allocation a, double4 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_char2(rs_allocation a, char2 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_char3(rs_allocation a, char3 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_char4(rs_allocation a, char4 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_uchar2(rs_allocation a, uchar2 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_uchar3(rs_allocation a, uchar3 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_uchar4(rs_allocation a, uchar4 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_short2(rs_allocation a, short2 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_short3(rs_allocation a, short3 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_short4(rs_allocation a, short4 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_ushort2(rs_allocation a, ushort2 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_ushort3(rs_allocation a, ushort3 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_ushort4(rs_allocation a, ushort4 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_int2(rs_allocation a, int2 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_int3(rs_allocation a, int3 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_int4(rs_allocation a, int4 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_uint2(rs_allocation a, uint2 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_uint3(rs_allocation a, uint3 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_uint4(rs_allocation a, uint4 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_long2(rs_allocation a, long2 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_long3(rs_allocation a, long3 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_long4(rs_allocation a, long4 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_ulong2(rs_allocation a, ulong2 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_ulong3(rs_allocation a, ulong3 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_ulong4(rs_allocation a, ulong4 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_float2(rs_allocation a, float2 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_float3(rs_allocation a, float3 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_float4(rs_allocation a, float4 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_double2(rs_allocation a, double2 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_double3(rs_allocation a, double3 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_double4(rs_allocation a, double4 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_char2(rs_allocation a, char2 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_char3(rs_allocation a, char3 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_char4(rs_allocation a, char4 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_uchar2(rs_allocation a, uchar2 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_uchar3(rs_allocation a, uchar3 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_uchar4(rs_allocation a, uchar4 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_short2(rs_allocation a, short2 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_short3(rs_allocation a, short3 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_short4(rs_allocation a, short4 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_ushort2(rs_allocation a, ushort2 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_ushort3(rs_allocation a, ushort3 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_ushort4(rs_allocation a, ushort4 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_int2(rs_allocation a, int2 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_int3(rs_allocation a, int3 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_int4(rs_allocation a, int4 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_uint2(rs_allocation a, uint2 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_uint3(rs_allocation a, uint3 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_uint4(rs_allocation a, uint4 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_long2(rs_allocation a, long2 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_long3(rs_allocation a, long3 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_long4(rs_allocation a, long4 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_ulong2(rs_allocation a, ulong2 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_ulong3(rs_allocation a, ulong3 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_ulong4(rs_allocation a, ulong4 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_float2(rs_allocation a, float2 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_float3(rs_allocation a, float3 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_float4(rs_allocation a, float4 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_double2(rs_allocation a, double2 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_double3(rs_allocation a, double3 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_double4(rs_allocation a, double4 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_char2(rs_allocation a, char2 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_char3(rs_allocation a, char3 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_char4(rs_allocation a, char4 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_uchar2(rs_allocation a, uchar2 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_uchar3(rs_allocation a, uchar3 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_uchar4(rs_allocation a, uchar4 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_short2(rs_allocation a, short2 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_short3(rs_allocation a, short3 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_short4(rs_allocation a, short4 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_ushort2(rs_allocation a, ushort2 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_ushort3(rs_allocation a, ushort3 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_ushort4(rs_allocation a, ushort4 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_int2(rs_allocation a, int2 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_int3(rs_allocation a, int3 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_int4(rs_allocation a, int4 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_uint2(rs_allocation a, uint2 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_uint3(rs_allocation a, uint3 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_uint4(rs_allocation a, uint4 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_long2(rs_allocation a, long2 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_long3(rs_allocation a, long3 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_long4(rs_allocation a, long4 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_ulong2(rs_allocation a, ulong2 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_ulong3(rs_allocation a, ulong3 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+extern void __attribute__((overloadable))
+    rsAllocationVStoreX_ulong4(rs_allocation a, ulong4 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+/*
+ * rsGetAllocation: Returns the Allocation for a given pointer
+ *
+ * Returns the Allocation for a given pointer.  The pointer should point within
+ * a valid allocation.  The results are undefined if the pointer is not from a
+ * valid allocation.
+ *
+ * This function is deprecated and will be removed from the SDK in a future
+ * release.
+ */
+extern rs_allocation __attribute__((overloadable))
+    rsGetAllocation(const void* p);
+
+/*
+ * rsGetElementAt: Get an element
+ *
+ * Extract a single element from an allocation.
+ */
+extern const void* __attribute__((overloadable))
+    rsGetElementAt(rs_allocation a, uint32_t x);
+
+extern const void* __attribute__((overloadable))
+    rsGetElementAt(rs_allocation a, uint32_t x, uint32_t y);
+
+extern const void* __attribute__((overloadable))
+    rsGetElementAt(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline float __attribute__((overloadable))
+    rsGetElementAt_float(rs_allocation a, uint32_t x) {
+    return ((float *)rsGetElementAt(a, x))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline float2 __attribute__((overloadable))
+    rsGetElementAt_float2(rs_allocation a, uint32_t x) {
+    return ((float2 *)rsGetElementAt(a, x))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline float3 __attribute__((overloadable))
+    rsGetElementAt_float3(rs_allocation a, uint32_t x) {
+    return ((float3 *)rsGetElementAt(a, x))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline float4 __attribute__((overloadable))
+    rsGetElementAt_float4(rs_allocation a, uint32_t x) {
+    return ((float4 *)rsGetElementAt(a, x))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline double __attribute__((overloadable))
+    rsGetElementAt_double(rs_allocation a, uint32_t x) {
+    return ((double *)rsGetElementAt(a, x))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline double2 __attribute__((overloadable))
+    rsGetElementAt_double2(rs_allocation a, uint32_t x) {
+    return ((double2 *)rsGetElementAt(a, x))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline double3 __attribute__((overloadable))
+    rsGetElementAt_double3(rs_allocation a, uint32_t x) {
+    return ((double3 *)rsGetElementAt(a, x))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline double4 __attribute__((overloadable))
+    rsGetElementAt_double4(rs_allocation a, uint32_t x) {
+    return ((double4 *)rsGetElementAt(a, x))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline char __attribute__((overloadable))
+    rsGetElementAt_char(rs_allocation a, uint32_t x) {
+    return ((char *)rsGetElementAt(a, x))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline char2 __attribute__((overloadable))
+    rsGetElementAt_char2(rs_allocation a, uint32_t x) {
+    return ((char2 *)rsGetElementAt(a, x))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline char3 __attribute__((overloadable))
+    rsGetElementAt_char3(rs_allocation a, uint32_t x) {
+    return ((char3 *)rsGetElementAt(a, x))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline char4 __attribute__((overloadable))
+    rsGetElementAt_char4(rs_allocation a, uint32_t x) {
+    return ((char4 *)rsGetElementAt(a, x))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline uchar __attribute__((overloadable))
+    rsGetElementAt_uchar(rs_allocation a, uint32_t x) {
+    return ((uchar *)rsGetElementAt(a, x))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline uchar2 __attribute__((overloadable))
+    rsGetElementAt_uchar2(rs_allocation a, uint32_t x) {
+    return ((uchar2 *)rsGetElementAt(a, x))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline uchar3 __attribute__((overloadable))
+    rsGetElementAt_uchar3(rs_allocation a, uint32_t x) {
+    return ((uchar3 *)rsGetElementAt(a, x))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline uchar4 __attribute__((overloadable))
+    rsGetElementAt_uchar4(rs_allocation a, uint32_t x) {
+    return ((uchar4 *)rsGetElementAt(a, x))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline short __attribute__((overloadable))
+    rsGetElementAt_short(rs_allocation a, uint32_t x) {
+    return ((short *)rsGetElementAt(a, x))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline short2 __attribute__((overloadable))
+    rsGetElementAt_short2(rs_allocation a, uint32_t x) {
+    return ((short2 *)rsGetElementAt(a, x))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline short3 __attribute__((overloadable))
+    rsGetElementAt_short3(rs_allocation a, uint32_t x) {
+    return ((short3 *)rsGetElementAt(a, x))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline short4 __attribute__((overloadable))
+    rsGetElementAt_short4(rs_allocation a, uint32_t x) {
+    return ((short4 *)rsGetElementAt(a, x))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline ushort __attribute__((overloadable))
+    rsGetElementAt_ushort(rs_allocation a, uint32_t x) {
+    return ((ushort *)rsGetElementAt(a, x))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline ushort2 __attribute__((overloadable))
+    rsGetElementAt_ushort2(rs_allocation a, uint32_t x) {
+    return ((ushort2 *)rsGetElementAt(a, x))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline ushort3 __attribute__((overloadable))
+    rsGetElementAt_ushort3(rs_allocation a, uint32_t x) {
+    return ((ushort3 *)rsGetElementAt(a, x))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline ushort4 __attribute__((overloadable))
+    rsGetElementAt_ushort4(rs_allocation a, uint32_t x) {
+    return ((ushort4 *)rsGetElementAt(a, x))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline int __attribute__((overloadable))
+    rsGetElementAt_int(rs_allocation a, uint32_t x) {
+    return ((int *)rsGetElementAt(a, x))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline int2 __attribute__((overloadable))
+    rsGetElementAt_int2(rs_allocation a, uint32_t x) {
+    return ((int2 *)rsGetElementAt(a, x))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline int3 __attribute__((overloadable))
+    rsGetElementAt_int3(rs_allocation a, uint32_t x) {
+    return ((int3 *)rsGetElementAt(a, x))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline int4 __attribute__((overloadable))
+    rsGetElementAt_int4(rs_allocation a, uint32_t x) {
+    return ((int4 *)rsGetElementAt(a, x))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline uint __attribute__((overloadable))
+    rsGetElementAt_uint(rs_allocation a, uint32_t x) {
+    return ((uint *)rsGetElementAt(a, x))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline uint2 __attribute__((overloadable))
+    rsGetElementAt_uint2(rs_allocation a, uint32_t x) {
+    return ((uint2 *)rsGetElementAt(a, x))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline uint3 __attribute__((overloadable))
+    rsGetElementAt_uint3(rs_allocation a, uint32_t x) {
+    return ((uint3 *)rsGetElementAt(a, x))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline uint4 __attribute__((overloadable))
+    rsGetElementAt_uint4(rs_allocation a, uint32_t x) {
+    return ((uint4 *)rsGetElementAt(a, x))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline long __attribute__((overloadable))
+    rsGetElementAt_long(rs_allocation a, uint32_t x) {
+    return ((long *)rsGetElementAt(a, x))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline long2 __attribute__((overloadable))
+    rsGetElementAt_long2(rs_allocation a, uint32_t x) {
+    return ((long2 *)rsGetElementAt(a, x))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline long3 __attribute__((overloadable))
+    rsGetElementAt_long3(rs_allocation a, uint32_t x) {
+    return ((long3 *)rsGetElementAt(a, x))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline long4 __attribute__((overloadable))
+    rsGetElementAt_long4(rs_allocation a, uint32_t x) {
+    return ((long4 *)rsGetElementAt(a, x))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline ulong __attribute__((overloadable))
+    rsGetElementAt_ulong(rs_allocation a, uint32_t x) {
+    return ((ulong *)rsGetElementAt(a, x))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline ulong2 __attribute__((overloadable))
+    rsGetElementAt_ulong2(rs_allocation a, uint32_t x) {
+    return ((ulong2 *)rsGetElementAt(a, x))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline ulong3 __attribute__((overloadable))
+    rsGetElementAt_ulong3(rs_allocation a, uint32_t x) {
+    return ((ulong3 *)rsGetElementAt(a, x))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline ulong4 __attribute__((overloadable))
+    rsGetElementAt_ulong4(rs_allocation a, uint32_t x) {
+    return ((ulong4 *)rsGetElementAt(a, x))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline float __attribute__((overloadable))
+    rsGetElementAt_float(rs_allocation a, uint32_t x, uint32_t y) {
+    return ((float *)rsGetElementAt(a, x, y))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline float2 __attribute__((overloadable))
+    rsGetElementAt_float2(rs_allocation a, uint32_t x, uint32_t y) {
+    return ((float2 *)rsGetElementAt(a, x, y))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline float3 __attribute__((overloadable))
+    rsGetElementAt_float3(rs_allocation a, uint32_t x, uint32_t y) {
+    return ((float3 *)rsGetElementAt(a, x, y))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline float4 __attribute__((overloadable))
+    rsGetElementAt_float4(rs_allocation a, uint32_t x, uint32_t y) {
+    return ((float4 *)rsGetElementAt(a, x, y))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline double __attribute__((overloadable))
+    rsGetElementAt_double(rs_allocation a, uint32_t x, uint32_t y) {
+    return ((double *)rsGetElementAt(a, x, y))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline double2 __attribute__((overloadable))
+    rsGetElementAt_double2(rs_allocation a, uint32_t x, uint32_t y) {
+    return ((double2 *)rsGetElementAt(a, x, y))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline double3 __attribute__((overloadable))
+    rsGetElementAt_double3(rs_allocation a, uint32_t x, uint32_t y) {
+    return ((double3 *)rsGetElementAt(a, x, y))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline double4 __attribute__((overloadable))
+    rsGetElementAt_double4(rs_allocation a, uint32_t x, uint32_t y) {
+    return ((double4 *)rsGetElementAt(a, x, y))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline char __attribute__((overloadable))
+    rsGetElementAt_char(rs_allocation a, uint32_t x, uint32_t y) {
+    return ((char *)rsGetElementAt(a, x, y))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline char2 __attribute__((overloadable))
+    rsGetElementAt_char2(rs_allocation a, uint32_t x, uint32_t y) {
+    return ((char2 *)rsGetElementAt(a, x, y))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline char3 __attribute__((overloadable))
+    rsGetElementAt_char3(rs_allocation a, uint32_t x, uint32_t y) {
+    return ((char3 *)rsGetElementAt(a, x, y))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline char4 __attribute__((overloadable))
+    rsGetElementAt_char4(rs_allocation a, uint32_t x, uint32_t y) {
+    return ((char4 *)rsGetElementAt(a, x, y))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline uchar __attribute__((overloadable))
+    rsGetElementAt_uchar(rs_allocation a, uint32_t x, uint32_t y) {
+    return ((uchar *)rsGetElementAt(a, x, y))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline uchar2 __attribute__((overloadable))
+    rsGetElementAt_uchar2(rs_allocation a, uint32_t x, uint32_t y) {
+    return ((uchar2 *)rsGetElementAt(a, x, y))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline uchar3 __attribute__((overloadable))
+    rsGetElementAt_uchar3(rs_allocation a, uint32_t x, uint32_t y) {
+    return ((uchar3 *)rsGetElementAt(a, x, y))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline uchar4 __attribute__((overloadable))
+    rsGetElementAt_uchar4(rs_allocation a, uint32_t x, uint32_t y) {
+    return ((uchar4 *)rsGetElementAt(a, x, y))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline short __attribute__((overloadable))
+    rsGetElementAt_short(rs_allocation a, uint32_t x, uint32_t y) {
+    return ((short *)rsGetElementAt(a, x, y))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline short2 __attribute__((overloadable))
+    rsGetElementAt_short2(rs_allocation a, uint32_t x, uint32_t y) {
+    return ((short2 *)rsGetElementAt(a, x, y))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline short3 __attribute__((overloadable))
+    rsGetElementAt_short3(rs_allocation a, uint32_t x, uint32_t y) {
+    return ((short3 *)rsGetElementAt(a, x, y))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline short4 __attribute__((overloadable))
+    rsGetElementAt_short4(rs_allocation a, uint32_t x, uint32_t y) {
+    return ((short4 *)rsGetElementAt(a, x, y))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline ushort __attribute__((overloadable))
+    rsGetElementAt_ushort(rs_allocation a, uint32_t x, uint32_t y) {
+    return ((ushort *)rsGetElementAt(a, x, y))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline ushort2 __attribute__((overloadable))
+    rsGetElementAt_ushort2(rs_allocation a, uint32_t x, uint32_t y) {
+    return ((ushort2 *)rsGetElementAt(a, x, y))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline ushort3 __attribute__((overloadable))
+    rsGetElementAt_ushort3(rs_allocation a, uint32_t x, uint32_t y) {
+    return ((ushort3 *)rsGetElementAt(a, x, y))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline ushort4 __attribute__((overloadable))
+    rsGetElementAt_ushort4(rs_allocation a, uint32_t x, uint32_t y) {
+    return ((ushort4 *)rsGetElementAt(a, x, y))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline int __attribute__((overloadable))
+    rsGetElementAt_int(rs_allocation a, uint32_t x, uint32_t y) {
+    return ((int *)rsGetElementAt(a, x, y))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline int2 __attribute__((overloadable))
+    rsGetElementAt_int2(rs_allocation a, uint32_t x, uint32_t y) {
+    return ((int2 *)rsGetElementAt(a, x, y))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline int3 __attribute__((overloadable))
+    rsGetElementAt_int3(rs_allocation a, uint32_t x, uint32_t y) {
+    return ((int3 *)rsGetElementAt(a, x, y))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline int4 __attribute__((overloadable))
+    rsGetElementAt_int4(rs_allocation a, uint32_t x, uint32_t y) {
+    return ((int4 *)rsGetElementAt(a, x, y))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline uint __attribute__((overloadable))
+    rsGetElementAt_uint(rs_allocation a, uint32_t x, uint32_t y) {
+    return ((uint *)rsGetElementAt(a, x, y))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline uint2 __attribute__((overloadable))
+    rsGetElementAt_uint2(rs_allocation a, uint32_t x, uint32_t y) {
+    return ((uint2 *)rsGetElementAt(a, x, y))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline uint3 __attribute__((overloadable))
+    rsGetElementAt_uint3(rs_allocation a, uint32_t x, uint32_t y) {
+    return ((uint3 *)rsGetElementAt(a, x, y))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline uint4 __attribute__((overloadable))
+    rsGetElementAt_uint4(rs_allocation a, uint32_t x, uint32_t y) {
+    return ((uint4 *)rsGetElementAt(a, x, y))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline long __attribute__((overloadable))
+    rsGetElementAt_long(rs_allocation a, uint32_t x, uint32_t y) {
+    return ((long *)rsGetElementAt(a, x, y))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline long2 __attribute__((overloadable))
+    rsGetElementAt_long2(rs_allocation a, uint32_t x, uint32_t y) {
+    return ((long2 *)rsGetElementAt(a, x, y))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline long3 __attribute__((overloadable))
+    rsGetElementAt_long3(rs_allocation a, uint32_t x, uint32_t y) {
+    return ((long3 *)rsGetElementAt(a, x, y))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline long4 __attribute__((overloadable))
+    rsGetElementAt_long4(rs_allocation a, uint32_t x, uint32_t y) {
+    return ((long4 *)rsGetElementAt(a, x, y))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline ulong __attribute__((overloadable))
+    rsGetElementAt_ulong(rs_allocation a, uint32_t x, uint32_t y) {
+    return ((ulong *)rsGetElementAt(a, x, y))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline ulong2 __attribute__((overloadable))
+    rsGetElementAt_ulong2(rs_allocation a, uint32_t x, uint32_t y) {
+    return ((ulong2 *)rsGetElementAt(a, x, y))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline ulong3 __attribute__((overloadable))
+    rsGetElementAt_ulong3(rs_allocation a, uint32_t x, uint32_t y) {
+    return ((ulong3 *)rsGetElementAt(a, x, y))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline ulong4 __attribute__((overloadable))
+    rsGetElementAt_ulong4(rs_allocation a, uint32_t x, uint32_t y) {
+    return ((ulong4 *)rsGetElementAt(a, x, y))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline float __attribute__((overloadable))
+    rsGetElementAt_float(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) {
+    return ((float *)rsGetElementAt(a, x, y, z))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline float2 __attribute__((overloadable))
+    rsGetElementAt_float2(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) {
+    return ((float2 *)rsGetElementAt(a, x, y, z))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline float3 __attribute__((overloadable))
+    rsGetElementAt_float3(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) {
+    return ((float3 *)rsGetElementAt(a, x, y, z))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline float4 __attribute__((overloadable))
+    rsGetElementAt_float4(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) {
+    return ((float4 *)rsGetElementAt(a, x, y, z))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline double __attribute__((overloadable))
+    rsGetElementAt_double(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) {
+    return ((double *)rsGetElementAt(a, x, y, z))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline double2 __attribute__((overloadable))
+    rsGetElementAt_double2(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) {
+    return ((double2 *)rsGetElementAt(a, x, y, z))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline double3 __attribute__((overloadable))
+    rsGetElementAt_double3(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) {
+    return ((double3 *)rsGetElementAt(a, x, y, z))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline double4 __attribute__((overloadable))
+    rsGetElementAt_double4(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) {
+    return ((double4 *)rsGetElementAt(a, x, y, z))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline char __attribute__((overloadable))
+    rsGetElementAt_char(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) {
+    return ((char *)rsGetElementAt(a, x, y, z))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline char2 __attribute__((overloadable))
+    rsGetElementAt_char2(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) {
+    return ((char2 *)rsGetElementAt(a, x, y, z))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline char3 __attribute__((overloadable))
+    rsGetElementAt_char3(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) {
+    return ((char3 *)rsGetElementAt(a, x, y, z))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline char4 __attribute__((overloadable))
+    rsGetElementAt_char4(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) {
+    return ((char4 *)rsGetElementAt(a, x, y, z))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline uchar __attribute__((overloadable))
+    rsGetElementAt_uchar(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) {
+    return ((uchar *)rsGetElementAt(a, x, y, z))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline uchar2 __attribute__((overloadable))
+    rsGetElementAt_uchar2(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) {
+    return ((uchar2 *)rsGetElementAt(a, x, y, z))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline uchar3 __attribute__((overloadable))
+    rsGetElementAt_uchar3(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) {
+    return ((uchar3 *)rsGetElementAt(a, x, y, z))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline uchar4 __attribute__((overloadable))
+    rsGetElementAt_uchar4(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) {
+    return ((uchar4 *)rsGetElementAt(a, x, y, z))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline short __attribute__((overloadable))
+    rsGetElementAt_short(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) {
+    return ((short *)rsGetElementAt(a, x, y, z))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline short2 __attribute__((overloadable))
+    rsGetElementAt_short2(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) {
+    return ((short2 *)rsGetElementAt(a, x, y, z))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline short3 __attribute__((overloadable))
+    rsGetElementAt_short3(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) {
+    return ((short3 *)rsGetElementAt(a, x, y, z))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline short4 __attribute__((overloadable))
+    rsGetElementAt_short4(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) {
+    return ((short4 *)rsGetElementAt(a, x, y, z))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline ushort __attribute__((overloadable))
+    rsGetElementAt_ushort(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) {
+    return ((ushort *)rsGetElementAt(a, x, y, z))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline ushort2 __attribute__((overloadable))
+    rsGetElementAt_ushort2(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) {
+    return ((ushort2 *)rsGetElementAt(a, x, y, z))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline ushort3 __attribute__((overloadable))
+    rsGetElementAt_ushort3(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) {
+    return ((ushort3 *)rsGetElementAt(a, x, y, z))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline ushort4 __attribute__((overloadable))
+    rsGetElementAt_ushort4(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) {
+    return ((ushort4 *)rsGetElementAt(a, x, y, z))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline int __attribute__((overloadable))
+    rsGetElementAt_int(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) {
+    return ((int *)rsGetElementAt(a, x, y, z))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline int2 __attribute__((overloadable))
+    rsGetElementAt_int2(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) {
+    return ((int2 *)rsGetElementAt(a, x, y, z))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline int3 __attribute__((overloadable))
+    rsGetElementAt_int3(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) {
+    return ((int3 *)rsGetElementAt(a, x, y, z))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline int4 __attribute__((overloadable))
+    rsGetElementAt_int4(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) {
+    return ((int4 *)rsGetElementAt(a, x, y, z))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline uint __attribute__((overloadable))
+    rsGetElementAt_uint(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) {
+    return ((uint *)rsGetElementAt(a, x, y, z))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline uint2 __attribute__((overloadable))
+    rsGetElementAt_uint2(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) {
+    return ((uint2 *)rsGetElementAt(a, x, y, z))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline uint3 __attribute__((overloadable))
+    rsGetElementAt_uint3(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) {
+    return ((uint3 *)rsGetElementAt(a, x, y, z))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline uint4 __attribute__((overloadable))
+    rsGetElementAt_uint4(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) {
+    return ((uint4 *)rsGetElementAt(a, x, y, z))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline long __attribute__((overloadable))
+    rsGetElementAt_long(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) {
+    return ((long *)rsGetElementAt(a, x, y, z))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline long2 __attribute__((overloadable))
+    rsGetElementAt_long2(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) {
+    return ((long2 *)rsGetElementAt(a, x, y, z))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline long3 __attribute__((overloadable))
+    rsGetElementAt_long3(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) {
+    return ((long3 *)rsGetElementAt(a, x, y, z))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline long4 __attribute__((overloadable))
+    rsGetElementAt_long4(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) {
+    return ((long4 *)rsGetElementAt(a, x, y, z))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline ulong __attribute__((overloadable))
+    rsGetElementAt_ulong(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) {
+    return ((ulong *)rsGetElementAt(a, x, y, z))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline ulong2 __attribute__((overloadable))
+    rsGetElementAt_ulong2(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) {
+    return ((ulong2 *)rsGetElementAt(a, x, y, z))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline ulong3 __attribute__((overloadable))
+    rsGetElementAt_ulong3(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) {
+    return ((ulong3 *)rsGetElementAt(a, x, y, z))[0];
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 17)
+static inline ulong4 __attribute__((overloadable))
+    rsGetElementAt_ulong4(rs_allocation a, uint32_t x, uint32_t y, uint32_t z) {
+    return ((ulong4 *)rsGetElementAt(a, x, y, z))[0];
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern float __attribute__((overloadable))
+    rsGetElementAt_float(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern float2 __attribute__((overloadable))
+    rsGetElementAt_float2(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern float3 __attribute__((overloadable))
+    rsGetElementAt_float3(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern float4 __attribute__((overloadable))
+    rsGetElementAt_float4(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern double __attribute__((overloadable))
+    rsGetElementAt_double(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern double2 __attribute__((overloadable))
+    rsGetElementAt_double2(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern double3 __attribute__((overloadable))
+    rsGetElementAt_double3(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern double4 __attribute__((overloadable))
+    rsGetElementAt_double4(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern char __attribute__((overloadable))
+    rsGetElementAt_char(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern char2 __attribute__((overloadable))
+    rsGetElementAt_char2(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern char3 __attribute__((overloadable))
+    rsGetElementAt_char3(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern char4 __attribute__((overloadable))
+    rsGetElementAt_char4(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern uchar __attribute__((overloadable))
+    rsGetElementAt_uchar(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern uchar2 __attribute__((overloadable))
+    rsGetElementAt_uchar2(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern uchar3 __attribute__((overloadable))
+    rsGetElementAt_uchar3(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern uchar4 __attribute__((overloadable))
+    rsGetElementAt_uchar4(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern short __attribute__((overloadable))
+    rsGetElementAt_short(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern short2 __attribute__((overloadable))
+    rsGetElementAt_short2(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern short3 __attribute__((overloadable))
+    rsGetElementAt_short3(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern short4 __attribute__((overloadable))
+    rsGetElementAt_short4(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern ushort __attribute__((overloadable))
+    rsGetElementAt_ushort(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern ushort2 __attribute__((overloadable))
+    rsGetElementAt_ushort2(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern ushort3 __attribute__((overloadable))
+    rsGetElementAt_ushort3(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern ushort4 __attribute__((overloadable))
+    rsGetElementAt_ushort4(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern int __attribute__((overloadable))
+    rsGetElementAt_int(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern int2 __attribute__((overloadable))
+    rsGetElementAt_int2(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern int3 __attribute__((overloadable))
+    rsGetElementAt_int3(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern int4 __attribute__((overloadable))
+    rsGetElementAt_int4(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern uint __attribute__((overloadable))
+    rsGetElementAt_uint(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern uint2 __attribute__((overloadable))
+    rsGetElementAt_uint2(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern uint3 __attribute__((overloadable))
+    rsGetElementAt_uint3(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern uint4 __attribute__((overloadable))
+    rsGetElementAt_uint4(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern long __attribute__((overloadable))
+    rsGetElementAt_long(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern long2 __attribute__((overloadable))
+    rsGetElementAt_long2(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern long3 __attribute__((overloadable))
+    rsGetElementAt_long3(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern long4 __attribute__((overloadable))
+    rsGetElementAt_long4(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern ulong __attribute__((overloadable))
+    rsGetElementAt_ulong(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern ulong2 __attribute__((overloadable))
+    rsGetElementAt_ulong2(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern ulong3 __attribute__((overloadable))
+    rsGetElementAt_ulong3(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern ulong4 __attribute__((overloadable))
+    rsGetElementAt_ulong4(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern float __attribute__((overloadable))
+    rsGetElementAt_float(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern float2 __attribute__((overloadable))
+    rsGetElementAt_float2(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern float3 __attribute__((overloadable))
+    rsGetElementAt_float3(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern float4 __attribute__((overloadable))
+    rsGetElementAt_float4(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern double __attribute__((overloadable))
+    rsGetElementAt_double(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern double2 __attribute__((overloadable))
+    rsGetElementAt_double2(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern double3 __attribute__((overloadable))
+    rsGetElementAt_double3(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern double4 __attribute__((overloadable))
+    rsGetElementAt_double4(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern char __attribute__((overloadable))
+    rsGetElementAt_char(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern char2 __attribute__((overloadable))
+    rsGetElementAt_char2(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern char3 __attribute__((overloadable))
+    rsGetElementAt_char3(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern char4 __attribute__((overloadable))
+    rsGetElementAt_char4(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern uchar __attribute__((overloadable))
+    rsGetElementAt_uchar(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern uchar2 __attribute__((overloadable))
+    rsGetElementAt_uchar2(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern uchar3 __attribute__((overloadable))
+    rsGetElementAt_uchar3(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern uchar4 __attribute__((overloadable))
+    rsGetElementAt_uchar4(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern short __attribute__((overloadable))
+    rsGetElementAt_short(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern short2 __attribute__((overloadable))
+    rsGetElementAt_short2(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern short3 __attribute__((overloadable))
+    rsGetElementAt_short3(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern short4 __attribute__((overloadable))
+    rsGetElementAt_short4(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern ushort __attribute__((overloadable))
+    rsGetElementAt_ushort(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern ushort2 __attribute__((overloadable))
+    rsGetElementAt_ushort2(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern ushort3 __attribute__((overloadable))
+    rsGetElementAt_ushort3(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern ushort4 __attribute__((overloadable))
+    rsGetElementAt_ushort4(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern int __attribute__((overloadable))
+    rsGetElementAt_int(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern int2 __attribute__((overloadable))
+    rsGetElementAt_int2(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern int3 __attribute__((overloadable))
+    rsGetElementAt_int3(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern int4 __attribute__((overloadable))
+    rsGetElementAt_int4(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern uint __attribute__((overloadable))
+    rsGetElementAt_uint(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern uint2 __attribute__((overloadable))
+    rsGetElementAt_uint2(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern uint3 __attribute__((overloadable))
+    rsGetElementAt_uint3(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern uint4 __attribute__((overloadable))
+    rsGetElementAt_uint4(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern long __attribute__((overloadable))
+    rsGetElementAt_long(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern long2 __attribute__((overloadable))
+    rsGetElementAt_long2(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern long3 __attribute__((overloadable))
+    rsGetElementAt_long3(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern long4 __attribute__((overloadable))
+    rsGetElementAt_long4(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern ulong __attribute__((overloadable))
+    rsGetElementAt_ulong(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern ulong2 __attribute__((overloadable))
+    rsGetElementAt_ulong2(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern ulong3 __attribute__((overloadable))
+    rsGetElementAt_ulong3(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern ulong4 __attribute__((overloadable))
+    rsGetElementAt_ulong4(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern float __attribute__((overloadable))
+    rsGetElementAt_float(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern float2 __attribute__((overloadable))
+    rsGetElementAt_float2(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern float3 __attribute__((overloadable))
+    rsGetElementAt_float3(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern float4 __attribute__((overloadable))
+    rsGetElementAt_float4(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern double __attribute__((overloadable))
+    rsGetElementAt_double(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern double2 __attribute__((overloadable))
+    rsGetElementAt_double2(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern double3 __attribute__((overloadable))
+    rsGetElementAt_double3(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern double4 __attribute__((overloadable))
+    rsGetElementAt_double4(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern char __attribute__((overloadable))
+    rsGetElementAt_char(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern char2 __attribute__((overloadable))
+    rsGetElementAt_char2(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern char3 __attribute__((overloadable))
+    rsGetElementAt_char3(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern char4 __attribute__((overloadable))
+    rsGetElementAt_char4(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern uchar __attribute__((overloadable))
+    rsGetElementAt_uchar(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern uchar2 __attribute__((overloadable))
+    rsGetElementAt_uchar2(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern uchar3 __attribute__((overloadable))
+    rsGetElementAt_uchar3(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern uchar4 __attribute__((overloadable))
+    rsGetElementAt_uchar4(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern short __attribute__((overloadable))
+    rsGetElementAt_short(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern short2 __attribute__((overloadable))
+    rsGetElementAt_short2(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern short3 __attribute__((overloadable))
+    rsGetElementAt_short3(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern short4 __attribute__((overloadable))
+    rsGetElementAt_short4(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern ushort __attribute__((overloadable))
+    rsGetElementAt_ushort(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern ushort2 __attribute__((overloadable))
+    rsGetElementAt_ushort2(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern ushort3 __attribute__((overloadable))
+    rsGetElementAt_ushort3(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern ushort4 __attribute__((overloadable))
+    rsGetElementAt_ushort4(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern int __attribute__((overloadable))
+    rsGetElementAt_int(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern int2 __attribute__((overloadable))
+    rsGetElementAt_int2(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern int3 __attribute__((overloadable))
+    rsGetElementAt_int3(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern int4 __attribute__((overloadable))
+    rsGetElementAt_int4(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern uint __attribute__((overloadable))
+    rsGetElementAt_uint(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern uint2 __attribute__((overloadable))
+    rsGetElementAt_uint2(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern uint3 __attribute__((overloadable))
+    rsGetElementAt_uint3(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern uint4 __attribute__((overloadable))
+    rsGetElementAt_uint4(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern long __attribute__((overloadable))
+    rsGetElementAt_long(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern long2 __attribute__((overloadable))
+    rsGetElementAt_long2(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern long3 __attribute__((overloadable))
+    rsGetElementAt_long3(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern long4 __attribute__((overloadable))
+    rsGetElementAt_long4(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern ulong __attribute__((overloadable))
+    rsGetElementAt_ulong(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern ulong2 __attribute__((overloadable))
+    rsGetElementAt_ulong2(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern ulong3 __attribute__((overloadable))
+    rsGetElementAt_ulong3(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern ulong4 __attribute__((overloadable))
+    rsGetElementAt_ulong4(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+/*
+ * Extract a single element from an allocation.
+ *
+ * Coordinates are in the dimensions of the Y plane
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern uchar __attribute__((overloadable))
+    rsGetElementAtYuv_uchar_U(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+/*
+ * Extract a single element from an allocation.
+ *
+ * Coordinates are in the dimensions of the Y plane
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern uchar __attribute__((overloadable))
+    rsGetElementAtYuv_uchar_V(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+/*
+ * Extract a single element from an allocation.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern uchar __attribute__((overloadable))
+    rsGetElementAtYuv_uchar_Y(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+/*
+ * Fetch allocation in a way described by the sampler
+ *
+ * If your allocation is 1D, use the variant with float for location.
+ * For 2D, use the float2 variant.
+ *
+ * Parameters:
+ *   a allocation to sample from
+ *   s sampler state
+ *   location location to sample from
+ *   lod mip level to sample from, for fractional values mip levels will be interpolated if RS_SAMPLER_LINEAR_MIP_LINEAR is used
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+extern float4 __attribute__((overloadable))
+    rsSample(rs_allocation a, rs_sampler s, float location);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+extern float4 __attribute__((overloadable))
+    rsSample(rs_allocation a, rs_sampler s, float location, float lod);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+extern float4 __attribute__((overloadable))
+    rsSample(rs_allocation a, rs_sampler s, float2 location);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+extern float4 __attribute__((overloadable))
+    rsSample(rs_allocation a, rs_sampler s, float2 location, float lod);
+#endif
+
+/*
+ * rsSetElementAt: Set an element
+ *
+ * Set single element of an allocation.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt(rs_allocation a, void* ptr, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt(rs_allocation a, void* ptr, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_float(rs_allocation a, float val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_float2(rs_allocation a, float2 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_float3(rs_allocation a, float3 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_float4(rs_allocation a, float4 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_double(rs_allocation a, double val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_double2(rs_allocation a, double2 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_double3(rs_allocation a, double3 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_double4(rs_allocation a, double4 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_char(rs_allocation a, char val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_char2(rs_allocation a, char2 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_char3(rs_allocation a, char3 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_char4(rs_allocation a, char4 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_uchar(rs_allocation a, uchar val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_uchar2(rs_allocation a, uchar2 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_uchar3(rs_allocation a, uchar3 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_uchar4(rs_allocation a, uchar4 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_short(rs_allocation a, short val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_short2(rs_allocation a, short2 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_short3(rs_allocation a, short3 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_short4(rs_allocation a, short4 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_ushort(rs_allocation a, ushort val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_ushort2(rs_allocation a, ushort2 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_ushort3(rs_allocation a, ushort3 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_ushort4(rs_allocation a, ushort4 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_int(rs_allocation a, int val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_int2(rs_allocation a, int2 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_int3(rs_allocation a, int3 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_int4(rs_allocation a, int4 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_uint(rs_allocation a, uint val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_uint2(rs_allocation a, uint2 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_uint3(rs_allocation a, uint3 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_uint4(rs_allocation a, uint4 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_long(rs_allocation a, long val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_long2(rs_allocation a, long2 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_long3(rs_allocation a, long3 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_long4(rs_allocation a, long4 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_ulong(rs_allocation a, ulong val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_ulong2(rs_allocation a, ulong2 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_ulong3(rs_allocation a, ulong3 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_ulong4(rs_allocation a, ulong4 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_float(rs_allocation a, float val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_float2(rs_allocation a, float2 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_float3(rs_allocation a, float3 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_float4(rs_allocation a, float4 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_double(rs_allocation a, double val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_double2(rs_allocation a, double2 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_double3(rs_allocation a, double3 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_double4(rs_allocation a, double4 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_char(rs_allocation a, char val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_char2(rs_allocation a, char2 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_char3(rs_allocation a, char3 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_char4(rs_allocation a, char4 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_uchar(rs_allocation a, uchar val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_uchar2(rs_allocation a, uchar2 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_uchar3(rs_allocation a, uchar3 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_uchar4(rs_allocation a, uchar4 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_short(rs_allocation a, short val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_short2(rs_allocation a, short2 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_short3(rs_allocation a, short3 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_short4(rs_allocation a, short4 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_ushort(rs_allocation a, ushort val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_ushort2(rs_allocation a, ushort2 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_ushort3(rs_allocation a, ushort3 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_ushort4(rs_allocation a, ushort4 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_int(rs_allocation a, int val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_int2(rs_allocation a, int2 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_int3(rs_allocation a, int3 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_int4(rs_allocation a, int4 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_uint(rs_allocation a, uint val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_uint2(rs_allocation a, uint2 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_uint3(rs_allocation a, uint3 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_uint4(rs_allocation a, uint4 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_long(rs_allocation a, long val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_long2(rs_allocation a, long2 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_long3(rs_allocation a, long3 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_long4(rs_allocation a, long4 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_ulong(rs_allocation a, ulong val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_ulong2(rs_allocation a, ulong2 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_ulong3(rs_allocation a, ulong3 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_ulong4(rs_allocation a, ulong4 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_float(rs_allocation a, float val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_float2(rs_allocation a, float2 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_float3(rs_allocation a, float3 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_float4(rs_allocation a, float4 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_double(rs_allocation a, double val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_double2(rs_allocation a, double2 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_double3(rs_allocation a, double3 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_double4(rs_allocation a, double4 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_char(rs_allocation a, char val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_char2(rs_allocation a, char2 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_char3(rs_allocation a, char3 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_char4(rs_allocation a, char4 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_uchar(rs_allocation a, uchar val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_uchar2(rs_allocation a, uchar2 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_uchar3(rs_allocation a, uchar3 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_uchar4(rs_allocation a, uchar4 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_short(rs_allocation a, short val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_short2(rs_allocation a, short2 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_short3(rs_allocation a, short3 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_short4(rs_allocation a, short4 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_ushort(rs_allocation a, ushort val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_ushort2(rs_allocation a, ushort2 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_ushort3(rs_allocation a, ushort3 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_ushort4(rs_allocation a, ushort4 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_int(rs_allocation a, int val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_int2(rs_allocation a, int2 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_int3(rs_allocation a, int3 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_int4(rs_allocation a, int4 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_uint(rs_allocation a, uint val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_uint2(rs_allocation a, uint2 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_uint3(rs_allocation a, uint3 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_uint4(rs_allocation a, uint4 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_long(rs_allocation a, long val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_long2(rs_allocation a, long2 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_long3(rs_allocation a, long3 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_long4(rs_allocation a, long4 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_ulong(rs_allocation a, ulong val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_ulong2(rs_allocation a, ulong2 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_ulong3(rs_allocation a, ulong3 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern void __attribute__((overloadable))
+    rsSetElementAt_ulong4(rs_allocation a, ulong4 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#endif // RENDERSCRIPT_RS_ALLOCATION_RSH
diff --git a/scriptc/rs_atomic.rsh b/scriptc/rs_atomic.rsh
index ba847cf..29c294a 100644
--- a/scriptc/rs_atomic.rsh
+++ b/scriptc/rs_atomic.rsh
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011 The Android Open Source Project
+ * Copyright (C) 2015 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,248 +14,243 @@
  * limitations under the License.
  */
 
-/** @file rs_atomic.rsh
- *  \brief Atomic routines
+// Don't edit this file!  It is auto-generated by frameworks/rs/api/gen_runtime.
+
+/*
+ * rs_atomic.rsh: Atomic routines
  *
+ * To update values shared between multiple threads, use the functions below.
+ * They ensure that the values are atomically updated, i.e. that the memory
+ * reads, the updates, and the memory writes are all done in the right order.
  *
+ * These functions are slower than just doing the non-atomic variants, so use
+ * them only when synchronization is needed.
+ *
+ * Note that in RenderScript, your code is likely to be running in separate
+ * threads even though you did not explicitely create them.  The RenderScript
+ * runtime will very often split the execution of one kernel across multiple
+ * threads.  Updating globals should be done with atomic functions.  If possible,
+ * modify your algorithm to avoid them altogether.
  */
+#ifndef RENDERSCRIPT_RS_ATOMIC_RSH
+#define RENDERSCRIPT_RS_ATOMIC_RSH
 
-#ifndef __RS_ATOMIC_RSH__
-#define __RS_ATOMIC_RSH__
-
+/*
+ * rsAtomicAdd: Thread-safe addition
+ *
+ * Atomicly adds a value to the value at addr, i.e. *addr += value.
+ *
+ * Parameters:
+ *   addr Address of the value to modify
+ *   value Amount to add
+ *
+ * Returns: Old value
+ */
 #if (defined(RS_VERSION) && (RS_VERSION >= 14))
-
-/**
- * Atomic add one to the value at addr.
- * Equal to rsAtomicAdd(addr, 1)
- *
- * @param addr Address of value to increment
- *
- * @return old value
- */
-extern int32_t __attribute__((overloadable))
-    rsAtomicInc(volatile int32_t* addr);
-
-/**
- * Atomic subtract one from the value at addr. Equal to rsAtomicSub(addr, 1)
- *
- * @param addr Address of value to decrement
- *
- * @return old value
- */
-extern int32_t __attribute__((overloadable))
-    rsAtomicDec(volatile int32_t* addr);
-
-/**
- * Atomic add a value to the value at addr.  addr[0] += value
- *
- * @param addr Address of value to modify
- * @param value Amount to add to the value at addr
- *
- * @return old value
- */
 extern int32_t __attribute__((overloadable))
     rsAtomicAdd(volatile int32_t* addr, int32_t value);
-
-/**
- * Atomic Subtract a value from the value at addr.  addr[0] -= value
- *
- * @param addr Address of value to modify
- * @param value Amount to subtract from the value at addr
- *
- * @return old value
- */
-extern int32_t __attribute__((overloadable))
-    rsAtomicSub(volatile int32_t* addr, int32_t value);
-
-/**
- * Atomic Bitwise and a value from the value at addr.  addr[0] &= value
- *
- * @param addr Address of value to modify
- * @param value Amount to and with the value at addr
- *
- * @return old value
- */
-extern int32_t __attribute__((overloadable))
-    rsAtomicAnd(volatile int32_t* addr, int32_t value);
-
-/**
- * Atomic Bitwise or a value from the value at addr.  addr[0] |= value
- *
- * @param addr Address of value to modify
- * @param value Amount to or with the value at addr
- *
- * @return old value
- */
-extern int32_t __attribute__((overloadable))
-    rsAtomicOr(volatile int32_t* addr, int32_t value);
-
-/**
- * Atomic Bitwise xor a value from the value at addr.  addr[0] ^= value
- *
- * @param addr Address of value to modify
- * @param value Amount to xor with the value at addr
- *
- * @return old value
- */
-extern int32_t __attribute__((overloadable))
-    rsAtomicXor(volatile int32_t* addr, int32_t value);
-
-/**
- * Atomic Set the value at addr to the min of addr and value
- * addr[0] = rsMin(addr[0], value)
- *
- * @param addr Address of value to modify
- * @param value comparison value
- *
- * @return old value
- */
-extern uint32_t __attribute__((overloadable))
-    rsAtomicMin(volatile uint32_t* addr, uint32_t value);
-/**
- * Atomic Set the value at addr to the min of addr and value
- * addr[0] = rsMin(addr[0], value)
- *
- * @param addr Address of value to modify
- * @param value comparison value
- *
- * @return old value
- */
-extern int32_t __attribute__((overloadable))
-    rsAtomicMin(volatile int32_t* addr, int32_t value);
-
-/**
- * Atomic Set the value at addr to the max of addr and value
- * addr[0] = rsMax(addr[0], value)
- *
- * @param addr Address of value to modify
- * @param value comparison value
- *
- * @return old value
- */
-extern uint32_t __attribute__((overloadable))
-    rsAtomicMax(volatile uint32_t* addr, uint32_t value);
-/**
- * Atomic Set the value at addr to the max of addr and value
- * addr[0] = rsMin(addr[0], value)
- *
- * @param addr Address of value to modify
- * @param value comparison value
- *
- * @return old value
- */
-extern int32_t __attribute__((overloadable))
-    rsAtomicMax(volatile int32_t* addr, int32_t value);
-
-/**
- * Compare-and-set operation with a full memory barrier.
- *
- * If the value at addr matches compareValue then newValue is written.
- *
- * @param addr The address to compare and replace if the compare passes.
- * @param compareValue The value to test addr[0] against.
- * @param newValue The value to write if the test passes.
- *
- * @return old value
- */
-extern int32_t __attribute__((overloadable))
-    rsAtomicCas(volatile int32_t* addr, int32_t compareValue, int32_t newValue);
-
-/**
- * Compare-and-set operation with a full memory barrier.
- *
- * If the value at addr matches compareValue then newValue is written.
- *
- * @param addr The address to compare and replace if the compare passes.
- * @param compareValue The value to test addr[0] against.
- * @param newValue The value to write if the test passes.
- *
- * @return old value
- */
-extern uint32_t __attribute__((overloadable))
-    rsAtomicCas(volatile uint32_t* addr, uint32_t compareValue, uint32_t newValue);
-
-#endif //defined(RS_VERSION) && (RS_VERSION >= 14)
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 20))   // TODO: api 21
-
-/**
- * Atomic add one to the value at addr.
- * Equal to rsAtomicAdd(addr, 1)
- *
- * @param addr Address of value to increment
- *
- * @return old value
- */
-extern int32_t __attribute__((overloadable))
-    rsAtomicInc(volatile uint32_t* addr);
-
-/**
- * Atomic subtract one from the value at addr. Equal to rsAtomicSub(addr, 1)
- *
- * @param addr Address of value to decrement
- *
- * @return old value
- */
-extern int32_t __attribute__((overloadable))
-    rsAtomicDec(volatile uint32_t* addr);
-
-/**
- * Atomic add a value to the value at addr.  addr[0] += value
- *
- * @param addr Address of value to modify
- * @param value Amount to add to the value at addr
- *
- * @return old value
- */
-extern int32_t __attribute__((overloadable))
-    rsAtomicAdd(volatile uint32_t* addr, uint32_t value);
-
-/**
- * Atomic Subtract a value from the value at addr.  addr[0] -= value
- *
- * @param addr Address of value to modify
- * @param value Amount to subtract from the value at addr
- *
- * @return old value
- */
-extern int32_t __attribute__((overloadable))
-    rsAtomicSub(volatile uint32_t* addr, uint32_t value);
-
-/**
- * Atomic Bitwise and a value from the value at addr.  addr[0] &= value
- *
- * @param addr Address of value to modify
- * @param value Amount to and with the value at addr
- *
- * @return old value
- */
-extern int32_t __attribute__((overloadable))
-    rsAtomicAnd(volatile uint32_t* addr, uint32_t value);
-
-/**
- * Atomic Bitwise or a value from the value at addr.  addr[0] |= value
- *
- * @param addr Address of value to modify
- * @param value Amount to or with the value at addr
- *
- * @return old value
- */
-extern int32_t __attribute__((overloadable))
-    rsAtomicOr(volatile uint32_t* addr, uint32_t value);
-
-/**
- * Atomic Bitwise xor a value from the value at addr.  addr[0] ^= value
- *
- * @param addr Address of value to modify
- * @param value Amount to xor with the value at addr
- *
- * @return old value
- */
-extern int32_t __attribute__((overloadable))
-    rsAtomicXor(volatile uint32_t* addr, uint32_t value);
-
-#endif //defined(RS_VERSION) && (RS_VERSION >= 21)
-
 #endif
 
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+extern int32_t __attribute__((overloadable))
+    rsAtomicAdd(volatile uint32_t* addr, uint32_t value);
+#endif
+
+/*
+ * rsAtomicAnd: Thread-safe bitwise and
+ *
+ * Atomicly performs a bitwise and of two values, storing the result back at addr,
+ * i.e. *addr &= value
+ *
+ * Parameters:
+ *   addr Address of the value to modify
+ *   value Value to and with
+ *
+ * Returns: Old value
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 14))
+extern int32_t __attribute__((overloadable))
+    rsAtomicAnd(volatile int32_t* addr, int32_t value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+extern int32_t __attribute__((overloadable))
+    rsAtomicAnd(volatile uint32_t* addr, uint32_t value);
+#endif
+
+/*
+ * rsAtomicCas: Thread-safe compare and set
+ *
+ * If the value at addr matches compareValue then the newValue is written at addr,
+ * i.e. if (*addr == compareValue) { *addr = newValue; }
+ *
+ * You can check that the value was written by checking that the value returned
+ * by rsAtomicCas is compareValue.
+ *
+ * Parameters:
+ *   addr The address to compare and replace if the compare passes.
+ *   compareValue The value to test *addr against.
+ *   newValue The value to write if the test passes.
+ *
+ * Returns: Old value
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 14))
+extern int32_t __attribute__((overloadable))
+    rsAtomicCas(volatile int32_t* addr, int32_t compareValue, int32_t newValue);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 14))
+extern uint32_t __attribute__((overloadable))
+    rsAtomicCas(volatile uint32_t* addr, uint32_t compareValue, uint32_t newValue);
+#endif
+
+/*
+ * rsAtomicDec: Thread-safe decrement
+ *
+ * Atomicly subtracts one from the value at addr.  Equal to rsAtomicSub(addr, 1)
+ *
+ * Parameters:
+ *   addr Address of the value to decrement
+ *
+ * Returns: Old value
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 14))
+extern int32_t __attribute__((overloadable))
+    rsAtomicDec(volatile int32_t* addr);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+extern int32_t __attribute__((overloadable))
+    rsAtomicDec(volatile uint32_t* addr);
+#endif
+
+/*
+ * rsAtomicInc: Thread-safe increment
+ *
+ * Atomicly adds one to the value at addr.  Equal to rsAtomicAdd(addr, 1)
+ *
+ * Parameters:
+ *   addr Address of the value to increment
+ *
+ * Returns: Old value
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 14))
+extern int32_t __attribute__((overloadable))
+    rsAtomicInc(volatile int32_t* addr);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+extern int32_t __attribute__((overloadable))
+    rsAtomicInc(volatile uint32_t* addr);
+#endif
+
+/*
+ * rsAtomicMax: Thread-safe maximum
+ *
+ * Atomicly sets the value at addr to the maximum of addr and value, i.e.
+ * *addr = max(*addr, value)
+ *
+ * Parameters:
+ *   addr Address of the value to modify
+ *   value Comparison value
+ *
+ * Returns: Old value
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 14))
+extern uint32_t __attribute__((overloadable))
+    rsAtomicMax(volatile uint32_t* addr, uint32_t value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 14))
+extern int32_t __attribute__((overloadable))
+    rsAtomicMax(volatile int32_t* addr, int32_t value);
+#endif
+
+/*
+ * rsAtomicMin: Thread-safe minimum
+ *
+ * Atomicly sets the value at addr to the minimum of addr and value, i.e.
+ * *addr = min(*addr, value)
+ *
+ * Parameters:
+ *   addr Address of the value to modify
+ *   value Comparison value
+ *
+ * Returns: Old value
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 14))
+extern uint32_t __attribute__((overloadable))
+    rsAtomicMin(volatile uint32_t* addr, uint32_t value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 14))
+extern int32_t __attribute__((overloadable))
+    rsAtomicMin(volatile int32_t* addr, int32_t value);
+#endif
+
+/*
+ * rsAtomicOr: Thread-safe bitwise or
+ *
+ * Atomicly perform a bitwise or two values, storing the result at addr,
+ * i.e. *addr |= value
+ *
+ * Parameters:
+ *   addr Address of the value to modify
+ *   value Value to or with
+ *
+ * Returns: Old value
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 14))
+extern int32_t __attribute__((overloadable))
+    rsAtomicOr(volatile int32_t* addr, int32_t value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+extern int32_t __attribute__((overloadable))
+    rsAtomicOr(volatile uint32_t* addr, uint32_t value);
+#endif
+
+/*
+ * rsAtomicSub: Thread-safe subtraction
+ *
+ * Atomicly subtracts a value from the value at addr, i.e. *addr -= value
+ *
+ * Parameters:
+ *   addr Address of the value to modify
+ *   value Amount to subtract
+ *
+ * Returns: Old value
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 14))
+extern int32_t __attribute__((overloadable))
+    rsAtomicSub(volatile int32_t* addr, int32_t value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+extern int32_t __attribute__((overloadable))
+    rsAtomicSub(volatile uint32_t* addr, uint32_t value);
+#endif
+
+/*
+ * rsAtomicXor: Thread-safe bitwise exclusive or
+ *
+ * Atomicly performs a bitwise xor of two values, storing the result at addr,
+ * i.e. *addr ^= value
+ *
+ * Parameters:
+ *   addr Address of the value to modify
+ *   value Value to xor with
+ *
+ * Returns: Old value
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 14))
+extern int32_t __attribute__((overloadable))
+    rsAtomicXor(volatile int32_t* addr, int32_t value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 20))
+extern int32_t __attribute__((overloadable))
+    rsAtomicXor(volatile uint32_t* addr, uint32_t value);
+#endif
+
+#endif // RENDERSCRIPT_RS_ATOMIC_RSH
diff --git a/scriptc/rs_core.rsh b/scriptc/rs_core.rsh
index 0aed990..c8441b4 100644
--- a/scriptc/rs_core.rsh
+++ b/scriptc/rs_core.rsh
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011-2012 The Android Open Source Project
+ * Copyright (C) 2015 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,37 +14,27 @@
  * limitations under the License.
  */
 
- /*! \mainpage notitle
-  *
-  * RenderScript is a high-performance runtime that provides
-  * compute operations at the native level. RenderScript code is compiled on devices
-  * at runtime to allow platform-independence as well.
-  * This reference documentation describes the RenderScript runtime APIs, which you
-  * can utilize to write RenderScript code in C99. The RenderScript compute header
-  * files are automatically included for you.
-  *
-  * To use RenderScript, you need to utilize the RenderScript runtime APIs documented here
-  * as well as the Android framework APIs for RenderScript.
-  * For documentation on the Android framework APIs, see the <a target="_parent" href=
-  * "http://developer.android.com/reference/android/renderscript/package-summary.html">
-  * android.renderscript</a> package reference.
-  * For more information on how to develop with RenderScript and how the runtime and
-  * Android framework APIs interact, see the <a target="_parent" href=
-  * "http://developer.android.com/guide/topics/renderscript/index.html">RenderScript
-  * developer guide</a> and the <a target="_parent" href=
-  * "http://developer.android.com/resources/samples/RenderScript/index.html">
-  * RenderScript samples</a>.
-  */
+// Don't edit this file!  It is auto-generated by frameworks/rs/api/gen_runtime.
 
-/** @file rs_core.rsh
- *  \brief todo-jsams
+/*
+ * rs_core.rsh: TODO
  *
- *  todo-jsams
+ * RenderScript is a high-performance runtime that provides
+ * compute operations at the native level. RenderScript code is compiled on devices
+ * at runtime to allow platform-independence as well.
+ * This reference documentation describes the RenderScript runtime APIs, which you
+ * can utilize to write RenderScript code in C99. The RenderScript compute header
+ * files are automatically included for you.
  *
+ * To use RenderScript, you need to utilize the RenderScript runtime APIs documented here
+ * as well as the Android framework APIs for RenderScript.
+ * For documentation on the Android framework APIs, see the android.renderscript package reference.
+ * For more information on how to develop with RenderScript and how the runtime and
+ * Android framework APIs interact, see the RenderScript developer guide
+ * and the RenderScript samples.
  */
-
-#ifndef __RS_CORE_RSH__
-#define __RS_CORE_RSH__
+#ifndef RENDERSCRIPT_RS_CORE_RSH
+#define RENDERSCRIPT_RS_CORE_RSH
 
 #define RS_KERNEL __attribute__((kernel))
 
@@ -61,32 +51,9 @@
 #include "rs_sampler.rsh"
 #include "rs_time.rsh"
 
-/**
- * Send a message back to the client.  Will not block and returns true
- * if the message was sendable and false if the fifo was full.
- * A message ID is required.  Data payload is optional.
- */
-extern bool __attribute__((overloadable))
-    rsSendToClient(int cmdID);
-/**
- * \overload
- */
-extern bool __attribute__((overloadable))
-    rsSendToClient(int cmdID, const void *data, uint len);
-/**
- * Send a message back to the client, blocking until the message is queued.
- * A message ID is required.  Data payload is optional.
- */
-extern void __attribute__((overloadable))
-    rsSendToClientBlocking(int cmdID);
-/**
- * \overload
- */
-extern void __attribute__((overloadable))
-    rsSendToClientBlocking(int cmdID, const void *data, uint len);
-
-
-/**
+/*
+ * rs_for_each_strategy_t: Launch order hint for rsForEach calls
+ *
  * Launch order hint for rsForEach calls.  This provides a hint to the system to
  * determine in which order the root function of the target is called with each
  * cell of the allocation.
@@ -97,13 +64,25 @@
     RS_FOR_EACH_STRATEGY_SERIAL = 0,
     RS_FOR_EACH_STRATEGY_DONT_CARE = 1,
     RS_FOR_EACH_STRATEGY_DST_LINEAR = 2,
-    RS_FOR_EACH_STRATEGY_TILE_SMALL= 3,
+    RS_FOR_EACH_STRATEGY_TILE_SMALL = 3,
     RS_FOR_EACH_STRATEGY_TILE_MEDIUM = 4,
     RS_FOR_EACH_STRATEGY_TILE_LARGE = 5
 } rs_for_each_strategy_t;
 
 
-/**
+/*
+ * rs_kernel_context: Opaque handle to RenderScript kernel invocation context
+ *
+ * TODO
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+typedef const struct rs_kernel_context_t * rs_kernel_context;
+#endif
+
+
+/*
+ * rs_script_call_t: Provides extra information to a rsForEach call
+ *
  * Structure to provide extra information to a rsForEach call.  Primarly used to
  * restrict the call to a subset of cells in the allocation.
  */
@@ -119,189 +98,292 @@
     uint32_t arrayEnd;
 } rs_script_call_t;
 
-#if !defined(RS_VERSION) || (RS_VERSION < 14)
-/**
+
+/*
  * Make a script to script call to launch work. One of the input or output is
  * required to be a valid object. The input and output must be of the same
  * dimensions.
- * API 10-13
  *
- * @param script The target script to call
- * @param input The allocation to source data from
- * @param output the allocation to write date into
- * @param usrData The user definied params to pass to the root script.  May be
- *                NULL.
- * @param sc Extra control infomation used to select a sub-region of the
- *           allocation to be processed or suggest a walking strategy.  May be
- *           NULL.
- *
- *  */
-extern void __attribute__((overloadable))
-    rsForEach(rs_script script, rs_allocation input,
-              rs_allocation output, const void * usrData,
-              const rs_script_call_t *sc);
-/**
- * \overload
+ * Parameters:
+ *   script The target script to call
+ *   input The allocation to source data from
+ *   output the allocation to write date into
+ *   usrData The user defined params to pass to the root script.  May be NULL.
+ *   sc Extra control infomation used to select a sub-region of the allocation to be processed or suggest a walking strategy.  May be NULL.
+ *   usrDataLen The size of the userData structure.  This will be used to perform a shallow copy of the data if necessary.
  */
+#if !defined(RS_VERSION) || (RS_VERSION <= 13)
 extern void __attribute__((overloadable))
-    rsForEach(rs_script script, rs_allocation input,
-              rs_allocation output, const void * usrData);
+    rsForEach(rs_script script, rs_allocation input, rs_allocation output, const void* usrData,
+              const rs_script_call_t* sc);
+#endif
 
-#elif (RS_VERSION < 21)
-/**
- * Make a script to script call to launch work. One of the input or output is
- * required to be a valid object. The input and output must be of the same
- * dimensions.
- * API 14+
- *
- * @param script The target script to call
- * @param input The allocation to source data from
- * @param output the allocation to write date into
- * @param usrData The user definied params to pass to the root script.  May be
- *                NULL. Not supported in API 21 or higher.
- * @param usrDataLen The size of the userData structure.  This will be used to
- *                   perform a shallow copy of the data if necessary.
- * @param sc Extra control infomation used to select a sub-region of the
- *           allocation to be processed or suggest a walking strategy.  May be
- *           NULL.
- *
- */
+#if !defined(RS_VERSION) || (RS_VERSION <= 13)
 extern void __attribute__((overloadable))
-    rsForEach(rs_script script, rs_allocation input, rs_allocation output,
-              const void * usrData, size_t usrDataLen, const rs_script_call_t *sc);
-/**
- * \overload
- */
-extern void __attribute__((overloadable))
-    rsForEach(rs_script script, rs_allocation input, rs_allocation output,
-              const void * usrData, size_t usrDataLen);
+    rsForEach(rs_script script, rs_allocation input, rs_allocation output, const void* usrData);
+#endif
 
-/**
- * \overload
- */
+#if (defined(RS_VERSION) && (RS_VERSION >= 14) && (RS_VERSION <= 20))
 extern void __attribute__((overloadable))
-    rsForEach(rs_script script, rs_allocation input, rs_allocation output);
+    rsForEach(rs_script script, rs_allocation input, rs_allocation output, const void* usrData,
+              size_t usrDataLen, const rs_script_call_t* sc);
+#endif
 
-#else
-/**
- * Make a script to script call to launch work. One of the input or output is
- * required to be a valid object. The input and output must be of the same
- * dimensions.
- * API 21+
- *
- * @param script The target script to call
- * @param input The allocation to source data from
- * @param output the allocation to write date into
- */
+#if (defined(RS_VERSION) && (RS_VERSION >= 14) && (RS_VERSION <= 20))
+extern void __attribute__((overloadable))
+    rsForEach(rs_script script, rs_allocation input, rs_allocation output, const void* usrData,
+              size_t usrDataLen);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 14))
 extern void __attribute__((overloadable))
     rsForEach(rs_script script, rs_allocation input, rs_allocation output);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 23))
-
-/**
- * Return Array0 coordinate of kernel launch described by the specified launch context.
- * Returns 0 if Array0 dimension is not present.
- */
-extern uint32_t __attribute__((overloadable))
-    rsGetArray0(rs_kernel_context ctxt);
-
-/**
- * Return Array1 coordinate of kernel launch described by the specified launch context.
- * Returns 0 if Array1 dimension is not present.
- */
-extern uint32_t __attribute__((overloadable))
-    rsGetArray1(rs_kernel_context ctxt);
-
-/**
- * Return Array2 coordinate of kernel launch described by the specified launch context.
- * Returns 0 if Array2 dimension is not present.
- */
-extern uint32_t __attribute__((overloadable))
-    rsGetArray2(rs_kernel_context ctxt);
-
-/**
- * Return Array3 coordinate of kernel launch described by the specified launch context.
- * Returns 0 if Array3 dimension is not present.
- */
-extern uint32_t __attribute__((overloadable))
-    rsGetArray3(rs_kernel_context ctxt);
-
-/**
- * Return Face coordinate of kernel launch described by the specified launch context.
- * Returns RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_X if Face dimension is not present.
- */
-extern rs_allocation_cubemap_face __attribute__((overloadable))
-    rsGetFace(rs_kernel_context ctxt);
-
-/**
- * Return Lod coordinate of kernel launch described by the specificed launch context.
- * Returns 0 if Lod dimension is not present.
- */
-extern uint32_t __attribute__((overloadable))
-    rsGetLod(rs_kernel_context ctxt);
-
-/**
- * Return X dimension of kernel launch described by the specified launch context.
- */
-extern uint32_t __attribute__((overloadable))
-    rsGetDimX(rs_kernel_context ctxt);
-
-/**
- * Return Y dimension of kernel launch described by the specified launch context.
- * Returns 0 if Y dimension is not present.
- */
-extern uint32_t __attribute__((overloadable))
-    rsGetDimY(rs_kernel_context ctxt);
-
-/**
- * Return Z dimension of kernel launch described by the specified launch context.
- * Returns 0 if Z dimension is not present.
- */
-extern uint32_t __attribute__((overloadable))
-    rsGetDimZ(rs_kernel_context ctxt);
-
-/**
- * Return Array0 dimension of kernel launch described by the specificed launch context.
- * Returns 0 if Array0 dimension is not present.
- */
-extern uint32_t __attribute__((overloadable))
-    rsGetDimArray0(rs_kernel_context ctxt);
-
-/**
- * Return Array1 dimension of kernel launch described by the specificed launch context.
- * Returns 0 if Array1 dimension is not present.
- */
-extern uint32_t __attribute__((overloadable))
-    rsGetDimArray1(rs_kernel_context ctxt);
-
-/**
- * Return Array2 dimension of kernel launch described by the specificed launch context.
- * Returns 0 if Array2 dimension is not present.
- */
-extern uint32_t __attribute__((overloadable))
-    rsGetDimArray2(rs_kernel_context ctxt);
-
-/**
- * Return Array3 dimension of kernel launch described by the specificed launch context.
- * Returns 0 if Array3 dimension is not present.
- */
-extern uint32_t __attribute__((overloadable))
-    rsGetDimArray3(rs_kernel_context ctxt);
-
-/**
- * Is the Faces dimension present in the kernel launch described by the specified launch context?
+/*
+ * Send a message back to the client.  Will not block and returns true
+ * if the message was sendable and false if the fifo was full.
+ * A message ID is required.  Data payload is optional.
  */
 extern bool __attribute__((overloadable))
-    rsGetDimHasFaces(rs_kernel_context ctxt);
+    rsSendToClient(int cmdID);
 
-/**
- * Return Lod dimension of kernel launch described by the specificed launch context.
- * Returns 0 if Lod dimension is not present.
+extern bool __attribute__((overloadable))
+    rsSendToClient(int cmdID, const void* data, uint len);
+
+/*
+ * Send a message back to the client, blocking until the message is queued.
+ * A message ID is required.  Data payload is optional.
  */
+extern void __attribute__((overloadable))
+    rsSendToClientBlocking(int cmdID);
+
+extern void __attribute__((overloadable))
+    rsSendToClientBlocking(int cmdID, const void* data, uint len);
+
+/*
+ * rsGetArray0: Index in the Array0 dimension for the specified context
+ *
+ * Returns the index in the Array0 dimension of the cell being processed,
+ * as specified by the supplied context.
+ *
+ * This context is created when a kernel is launched and updated at each
+ * iteration.  It contains common characteristics of the allocations being
+ * iterated over and rarely used indexes, like the Array0 index.
+ *
+ * You can access the context by adding a rs_kernel_context argument to your
+ * kernel function.  E.g.
+ * short RS_KERNEL myKernel(short value, uint32_t x, rs_kernel_context context) {
+ *   // The current index in the common x, y, z, w dimensions are accessed by
+ *   // adding these variables as arguments.  For the more rarely used indexes
+ *   // to the other dimensions, extract them from the context:
+ *   uint32_t index_a0 = rsGetArray0(context);
+ *   //...
+ * }
+ *
+ * This function returns 0 if the Array0 dimension is not present.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern uint32_t __attribute__((overloadable))
+    rsGetArray0(rs_kernel_context ctxt);
+#endif
+
+/*
+ * rsGetArray1: Index in the Array1 dimension for the specified context
+ *
+ * Returns the index in the Array1 dimension of the cell being processed,
+ * as specified by the supplied context.  See rsGetArray0() for an explanation
+ * of the context.
+ *
+ * Returns 0 if the Array1 dimension is not present.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern uint32_t __attribute__((overloadable))
+    rsGetArray1(rs_kernel_context ctxt);
+#endif
+
+/*
+ * rsGetArray2: Index in the Array2 dimension for the specified context
+ *
+ * Returns the index in the Array2 dimension of the cell being processed,
+ * as specified by the supplied context.  See rsGetArray0() for an explanation
+ * of the context.
+ *
+ * Returns 0 if the Array2 dimension is not present.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern uint32_t __attribute__((overloadable))
+    rsGetArray2(rs_kernel_context ctxt);
+#endif
+
+/*
+ * rsGetArray3: Index in the Array3 dimension for the specified context
+ *
+ * Returns the index in the Array3 dimension of the cell being processed,
+ * as specified by the supplied context.  See rsGetArray0() for an explanation
+ * of the context.
+ *
+ * Returns 0 if the Array3 dimension is not present.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern uint32_t __attribute__((overloadable))
+    rsGetArray3(rs_kernel_context ctxt);
+#endif
+
+/*
+ * rsGetDimArray0: Size of the Array0 dimension for the specified context
+ *
+ * Returns the size of the Array0 dimension for the specified context.
+ * See rsGetDimX() for an explanation of the context.
+ *
+ * Returns 0 if the Array0 dimension is not present.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern uint32_t __attribute__((overloadable))
+    rsGetDimArray0(rs_kernel_context ctxt);
+#endif
+
+/*
+ * rsGetDimArray1: Size of the Array1 dimension for the specified context
+ *
+ * Returns the size of the Array1 dimension for the specified context.
+ * See rsGetDimX() for an explanation of the context.
+ *
+ * Returns 0 if the Array1 dimension is not present.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern uint32_t __attribute__((overloadable))
+    rsGetDimArray1(rs_kernel_context ctxt);
+#endif
+
+/*
+ * rsGetDimArray2: Size of the Array2 dimension for the specified context
+ *
+ * Returns the size of the Array2 dimension for the specified context.
+ * See rsGetDimX() for an explanation of the context.
+ *
+ * Returns 0 if the Array2 dimension is not present.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern uint32_t __attribute__((overloadable))
+    rsGetDimArray2(rs_kernel_context ctxt);
+#endif
+
+/*
+ * rsGetDimArray3: Size of the Array3 dimension for the specified context
+ *
+ * Returns the size of the Array3 dimension for the specified context.
+ * See rsGetDimX() for an explanation of the context.
+ *
+ * Returns 0 if the Array3 dimension is not present.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern uint32_t __attribute__((overloadable))
+    rsGetDimArray3(rs_kernel_context ctxt);
+#endif
+
+/*
+ * rsGetDimHasFaces: Presence of more than one face for the specified context
+ *
+ * If the context refers to a cubemap, this function returns true if there's
+ * more than one face present.  In all other cases, it returns false.
+ * See rsGetDimX() for an explanation of the context.
+ *
+ * rsAllocationGetDimFaces() is similar but returns 0 or 1 instead of a bool.
+ *
+ * Returns: Returns true if more than one face is present, false otherwise.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern bool __attribute__((overloadable))
+    rsGetDimHasFaces(rs_kernel_context ctxt);
+#endif
+
+/*
+ * rsGetDimLod: Number of levels of detail for the specified context
+ *
+ * Returns the number of levels of detail for the specified context.
+ * This is useful for mipmaps.  See rsGetDimX() for an explanation of the context.
+ * Returns 0 if Level of Detail is not used.
+ *
+ * rsAllocationGetDimLOD() is similar but returns 0 or 1 instead the actual
+ * number of levels.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
 extern uint32_t __attribute__((overloadable))
     rsGetDimLod(rs_kernel_context ctxt);
-
-#endif // (defined(RS_VERSION) && (RS_VERSION >= 23))
-
 #endif
+
+/*
+ * rsGetDimX: Size of the X dimension for the specified context
+ *
+ * Returns the size of the X dimension for the specified context.
+ *
+ * This context is created when a kernel is launched.  It contains common
+ * characteristics of the allocations being iterated over by the kernel in
+ * a very efficient structure.  It also contains rarely used indexes.
+ *
+ * You can access it by adding a rs_kernel_context argument to your kernel
+ * function.  E.g.
+ * int4 RS_KERNEL myKernel(int4 value, rs_kernel_context context) {
+ *   uint32_t size = rsGetDimX(context); //...
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern uint32_t __attribute__((overloadable))
+    rsGetDimX(rs_kernel_context ctxt);
+#endif
+
+/*
+ * rsGetDimY: Size of the Y dimension for the specified context
+ *
+ * Returns the size of the X dimension for the specified context.
+ * See rsGetDimX() for an explanation of the context.
+ *
+ * Returns 0 if the Y dimension is not present.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern uint32_t __attribute__((overloadable))
+    rsGetDimY(rs_kernel_context ctxt);
+#endif
+
+/*
+ * rsGetDimZ: Size of the Z dimension for the specified context
+ *
+ * Returns the size of the Z dimension for the specified context.
+ * See rsGetDimX() for an explanation of the context.
+ *
+ * Returns 0 if the Z dimension is not present.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern uint32_t __attribute__((overloadable))
+    rsGetDimZ(rs_kernel_context ctxt);
+#endif
+
+/*
+ * rsGetFace: Coordinate of the Face for the specified context
+ *
+ * Returns the face on which the cell being processed is found, as specified
+ * by the supplied context.  See rsGetArray0() for an explanation of the context.
+ *
+ * Returns RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_X if the face dimension is not
+ * present.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern rs_allocation_cubemap_face __attribute__((overloadable))
+    rsGetFace(rs_kernel_context ctxt);
+#endif
+
+/*
+ * rsGetLod: Index in the Levels of Detail dimension for the specified context.
+ *
+ * Returns the index in the Levels of Detail dimension of the cell being
+ * processed, as specified by the supplied context.  See rsGetArray0() for
+ * an explanation of the context.
+ *
+ * Returns 0 if the Levels of Detail dimension is not present.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern uint32_t __attribute__((overloadable))
+    rsGetLod(rs_kernel_context ctxt);
+#endif
+
+#endif // RENDERSCRIPT_RS_CORE_RSH
diff --git a/scriptc/rs_core_math.rsh b/scriptc/rs_core_math.rsh
index c0c7b5f..afa3638 100644
--- a/scriptc/rs_core_math.rsh
+++ b/scriptc/rs_core_math.rsh
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2014 The Android Open Source Project
+ * Copyright (C) 2015 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,11160 +16,5047 @@
 
 // Don't edit this file!  It is auto-generated by frameworks/rs/api/gen_runtime.
 
-/** @file
+/*
+ * rs_core_math.rsh: Mathematical functions
+ *
+ * Most mathematical functions can be applied to scalars and vectors.
+ * When applied to vectors, a vector of the function applied to each entry
+ * of the input is returned.
+ *
+ * For example:
+ *
+ * float3 a, b;
+ * // The following call sets
+ * //   a.x to sin(b.x),
+ * //   a.y to sin(b.y), and
+ * //   a.z to sin(b.z).
+ * a = sin(b);
+ *
+ *
+ * A few functions like distance() and length() interpret instead the input
+ * as a single vector in n-dimensional space.
+ *
+ * The precision of the mathematical operations is affected by the pragmas
+ * rs_fp_relaxed and rs_fp_full.
+ *
+ * Different precision/speed tradeoffs can be achieved by using three variants
+ * of common math functions.  Functions with a name starting with
+ * native_ may have custom hardware implementations with weaker precision,
+ * half_ may perform internal computations using 16 bit floats, and
+ * fast_ are n-dimensional space computations that may use 16 bit floats.
  *
  */
+#ifndef RENDERSCRIPT_RS_CORE_MATH_RSH
+#define RENDERSCRIPT_RS_CORE_MATH_RSH
 
-#ifndef __rs_core_math_rsh__
-#define __rs_core_math_rsh__
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
+/*
+ * abs: Absolute value of an integer
+ *
  * Returns the absolute value of an integer.
  *
  * For floats, use fabs().
- *
- * Supported by API versions 9 and newer.
  */
-extern uchar __attribute__((const, overloadable))abs(char v);
-#endif
+extern uchar __attribute__((const, overloadable))
+    abs(char v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the absolute value of an integer.
- *
- * For floats, use fabs().
- *
- * Supported by API versions 9 and newer.
- */
-extern uchar2 __attribute__((const, overloadable))abs(char2 v);
-#endif
+extern uchar2 __attribute__((const, overloadable))
+    abs(char2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the absolute value of an integer.
- *
- * For floats, use fabs().
- *
- * Supported by API versions 9 and newer.
- */
-extern uchar3 __attribute__((const, overloadable))abs(char3 v);
-#endif
+extern uchar3 __attribute__((const, overloadable))
+    abs(char3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the absolute value of an integer.
- *
- * For floats, use fabs().
- *
- * Supported by API versions 9 and newer.
- */
-extern uchar4 __attribute__((const, overloadable))abs(char4 v);
-#endif
+extern uchar4 __attribute__((const, overloadable))
+    abs(char4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the absolute value of an integer.
- *
- * For floats, use fabs().
- *
- * Supported by API versions 9 and newer.
- */
-extern ushort __attribute__((const, overloadable))abs(short v);
-#endif
+extern ushort __attribute__((const, overloadable))
+    abs(short v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the absolute value of an integer.
- *
- * For floats, use fabs().
- *
- * Supported by API versions 9 and newer.
- */
-extern ushort2 __attribute__((const, overloadable))abs(short2 v);
-#endif
+extern ushort2 __attribute__((const, overloadable))
+    abs(short2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the absolute value of an integer.
- *
- * For floats, use fabs().
- *
- * Supported by API versions 9 and newer.
- */
-extern ushort3 __attribute__((const, overloadable))abs(short3 v);
-#endif
+extern ushort3 __attribute__((const, overloadable))
+    abs(short3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the absolute value of an integer.
- *
- * For floats, use fabs().
- *
- * Supported by API versions 9 and newer.
- */
-extern ushort4 __attribute__((const, overloadable))abs(short4 v);
-#endif
+extern ushort4 __attribute__((const, overloadable))
+    abs(short4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the absolute value of an integer.
- *
- * For floats, use fabs().
- *
- * Supported by API versions 9 and newer.
- */
-extern uint __attribute__((const, overloadable))abs(int v);
-#endif
+extern uint __attribute__((const, overloadable))
+    abs(int v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the absolute value of an integer.
- *
- * For floats, use fabs().
- *
- * Supported by API versions 9 and newer.
- */
-extern uint2 __attribute__((const, overloadable))abs(int2 v);
-#endif
+extern uint2 __attribute__((const, overloadable))
+    abs(int2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the absolute value of an integer.
- *
- * For floats, use fabs().
- *
- * Supported by API versions 9 and newer.
- */
-extern uint3 __attribute__((const, overloadable))abs(int3 v);
-#endif
+extern uint3 __attribute__((const, overloadable))
+    abs(int3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the absolute value of an integer.
- *
- * For floats, use fabs().
- *
- * Supported by API versions 9 and newer.
- */
-extern uint4 __attribute__((const, overloadable))abs(int4 v);
-#endif
+extern uint4 __attribute__((const, overloadable))
+    abs(int4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
+/*
+ * acos: Inverse cosine
+ *
  * Returns the inverse cosine, in radians.
  *
- * Supported by API versions 9 and newer.
+ * See also native_acos().
  */
-extern float __attribute__((const, overloadable))acos(float v);
-#endif
+extern float __attribute__((const, overloadable))
+    acos(float v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the inverse cosine, in radians.
+extern float2 __attribute__((const, overloadable))
+    acos(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+    acos(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+    acos(float4 v);
+
+/*
+ * acosh: Inverse hyperbolic cosine
  *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))acos(float2 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the inverse cosine, in radians.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))acos(float3 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the inverse cosine, in radians.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))acos(float4 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
  * Returns the inverse hyperbolic cosine, in radians.
  *
- * Supported by API versions 9 and newer.
+ * See also native_acosh().
  */
-extern float __attribute__((const, overloadable))acosh(float v);
-#endif
+extern float __attribute__((const, overloadable))
+    acosh(float v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the inverse hyperbolic cosine, in radians.
+extern float2 __attribute__((const, overloadable))
+    acosh(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+    acosh(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+    acosh(float4 v);
+
+/*
+ * acospi: Inverse cosine divided by pi
  *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))acosh(float2 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the inverse hyperbolic cosine, in radians.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))acosh(float3 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the inverse hyperbolic cosine, in radians.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))acosh(float4 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
  * Returns the inverse cosine in radians, divided by pi.
  *
  * To get an inverse cosine measured in degrees, use acospi(a) * 180.f.
  *
- * Supported by API versions 9 and newer.
+ * See also native_acospi().
  */
-extern float __attribute__((const, overloadable))acospi(float v);
-#endif
+extern float __attribute__((const, overloadable))
+    acospi(float v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the inverse cosine in radians, divided by pi.
- *
- * To get an inverse cosine measured in degrees, use acospi(a) * 180.f.
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))acospi(float2 v);
-#endif
+extern float2 __attribute__((const, overloadable))
+    acospi(float2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the inverse cosine in radians, divided by pi.
- *
- * To get an inverse cosine measured in degrees, use acospi(a) * 180.f.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))acospi(float3 v);
-#endif
+extern float3 __attribute__((const, overloadable))
+    acospi(float3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the inverse cosine in radians, divided by pi.
- *
- * To get an inverse cosine measured in degrees, use acospi(a) * 180.f.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))acospi(float4 v);
-#endif
+extern float4 __attribute__((const, overloadable))
+    acospi(float4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
+/*
+ * asin: Inverse sine
+ *
  * Returns the inverse sine, in radians.
  *
- * Supported by API versions 9 and newer.
+ * See also native_asin().
  */
-extern float __attribute__((const, overloadable))asin(float v);
-#endif
+extern float __attribute__((const, overloadable))
+    asin(float v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the inverse sine, in radians.
+extern float2 __attribute__((const, overloadable))
+    asin(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+    asin(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+    asin(float4 v);
+
+/*
+ * asinh: Inverse hyperbolic sine
  *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))asin(float2 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the inverse sine, in radians.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))asin(float3 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the inverse sine, in radians.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))asin(float4 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
  * Returns the inverse hyperbolic sine, in radians.
  *
- * Supported by API versions 9 and newer.
+ * See also native_asinh().
  */
-extern float __attribute__((const, overloadable))asinh(float v);
-#endif
+extern float __attribute__((const, overloadable))
+    asinh(float v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the inverse hyperbolic sine, in radians.
+extern float2 __attribute__((const, overloadable))
+    asinh(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+    asinh(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+    asinh(float4 v);
+
+/*
+ * asinpi: Inverse sine divided by pi
  *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))asinh(float2 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the inverse hyperbolic sine, in radians.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))asinh(float3 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the inverse hyperbolic sine, in radians.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))asinh(float4 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
  * Returns the inverse sine in radians, divided by pi.
  *
  * To get an inverse sine measured in degrees, use asinpi(a) * 180.f.
  *
- * Supported by API versions 9 and newer.
+ * See also native_asinpi().
  */
-extern float __attribute__((const, overloadable))asinpi(float v);
-#endif
+extern float __attribute__((const, overloadable))
+    asinpi(float v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the inverse sine in radians, divided by pi.
- *
- * To get an inverse sine measured in degrees, use asinpi(a) * 180.f.
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))asinpi(float2 v);
-#endif
+extern float2 __attribute__((const, overloadable))
+    asinpi(float2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the inverse sine in radians, divided by pi.
- *
- * To get an inverse sine measured in degrees, use asinpi(a) * 180.f.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))asinpi(float3 v);
-#endif
+extern float3 __attribute__((const, overloadable))
+    asinpi(float3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the inverse sine in radians, divided by pi.
- *
- * To get an inverse sine measured in degrees, use asinpi(a) * 180.f.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))asinpi(float4 v);
-#endif
+extern float4 __attribute__((const, overloadable))
+    asinpi(float4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
+/*
+ * atan: Inverse tangent
+ *
  * Returns the inverse tangent, in radians.
  *
- * Supported by API versions 9 and newer.
+ * See also native_atan().
  */
-extern float __attribute__((const, overloadable))atan(float v);
-#endif
+extern float __attribute__((const, overloadable))
+    atan(float v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the inverse tangent, in radians.
+extern float2 __attribute__((const, overloadable))
+    atan(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+    atan(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+    atan(float4 v);
+
+/*
+ * atan2: Inverse tangent of a ratio
  *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))atan(float2 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the inverse tangent, in radians.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))atan(float3 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the inverse tangent, in radians.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))atan(float4 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
  * Returns the inverse tangent of (numerator / denominator), in radians.
  *
- * denominator can be 0.
+ * See also native_atan2().
  *
- * Supported by API versions 9 and newer.
+ * Parameters:
+ *   numerator The numerator
+ *   denominator The denominator.  Can be 0.
  */
-extern float __attribute__((const, overloadable))atan2(float numerator, float denominator);
-#endif
+extern float __attribute__((const, overloadable))
+    atan2(float numerator, float denominator);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the inverse tangent of (numerator / denominator), in radians.
- *
- * denominator can be 0.
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))atan2(float2 numerator, float2 denominator);
-#endif
+extern float2 __attribute__((const, overloadable))
+    atan2(float2 numerator, float2 denominator);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the inverse tangent of (numerator / denominator), in radians.
- *
- * denominator can be 0.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))atan2(float3 numerator, float3 denominator);
-#endif
+extern float3 __attribute__((const, overloadable))
+    atan2(float3 numerator, float3 denominator);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the inverse tangent of (numerator / denominator), in radians.
- *
- * denominator can be 0.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))atan2(float4 numerator, float4 denominator);
-#endif
+extern float4 __attribute__((const, overloadable))
+    atan2(float4 numerator, float4 denominator);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
+/*
+ * atan2pi: Inverse tangent of a ratio, divided by pi
+ *
  * Returns the inverse tangent of (numerator / denominator), in radians, divided by pi.
  *
  * To get an inverse tangent measured in degrees, use atan2pi(n, d) * 180.f.
  *
- * denominator can be 0.
+ * See also native_atan2pi().
  *
- * Supported by API versions 9 and newer.
+ * Parameters:
+ *   numerator The numerator
+ *   denominator The denominator.  Can be 0.
  */
-extern float __attribute__((const, overloadable))atan2pi(float numerator, float denominator);
-#endif
+extern float __attribute__((const, overloadable))
+    atan2pi(float numerator, float denominator);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the inverse tangent of (numerator / denominator), in radians, divided by pi.
- *
- * To get an inverse tangent measured in degrees, use atan2pi(n, d) * 180.f.
- *
- * denominator can be 0.
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))atan2pi(float2 numerator, float2 denominator);
-#endif
+extern float2 __attribute__((const, overloadable))
+    atan2pi(float2 numerator, float2 denominator);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the inverse tangent of (numerator / denominator), in radians, divided by pi.
- *
- * To get an inverse tangent measured in degrees, use atan2pi(n, d) * 180.f.
- *
- * denominator can be 0.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))atan2pi(float3 numerator, float3 denominator);
-#endif
+extern float3 __attribute__((const, overloadable))
+    atan2pi(float3 numerator, float3 denominator);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the inverse tangent of (numerator / denominator), in radians, divided by pi.
- *
- * To get an inverse tangent measured in degrees, use atan2pi(n, d) * 180.f.
- *
- * denominator can be 0.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))atan2pi(float4 numerator, float4 denominator);
-#endif
+extern float4 __attribute__((const, overloadable))
+    atan2pi(float4 numerator, float4 denominator);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
+/*
+ * atanh: Inverse hyperbolic tangent
+ *
  * Returns the inverse hyperbolic tangent, in radians.
  *
- * Supported by API versions 9 and newer.
+ * See also native_atanh().
  */
-extern float __attribute__((const, overloadable))atanh(float v);
-#endif
+extern float __attribute__((const, overloadable))
+    atanh(float v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the inverse hyperbolic tangent, in radians.
+extern float2 __attribute__((const, overloadable))
+    atanh(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+    atanh(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+    atanh(float4 v);
+
+/*
+ * atanpi: Inverse tangent divided by pi
  *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))atanh(float2 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the inverse hyperbolic tangent, in radians.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))atanh(float3 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the inverse hyperbolic tangent, in radians.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))atanh(float4 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
  * Returns the inverse tangent in radians, divided by pi.
  *
  * To get an inverse tangent measured in degrees, use atanpi(a) * 180.f.
  *
- * Supported by API versions 9 and newer.
+ * See also native_atanpi().
  */
-extern float __attribute__((const, overloadable))atanpi(float v);
-#endif
+extern float __attribute__((const, overloadable))
+    atanpi(float v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the inverse tangent in radians, divided by pi.
- *
- * To get an inverse tangent measured in degrees, use atanpi(a) * 180.f.
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))atanpi(float2 v);
-#endif
+extern float2 __attribute__((const, overloadable))
+    atanpi(float2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the inverse tangent in radians, divided by pi.
- *
- * To get an inverse tangent measured in degrees, use atanpi(a) * 180.f.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))atanpi(float3 v);
-#endif
+extern float3 __attribute__((const, overloadable))
+    atanpi(float3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the inverse tangent in radians, divided by pi.
- *
- * To get an inverse tangent measured in degrees, use atanpi(a) * 180.f.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))atanpi(float4 v);
-#endif
+extern float4 __attribute__((const, overloadable))
+    atanpi(float4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
+/*
+ * cbrt: Cube root
+ *
  * Returns the cube root.
  *
- * Supported by API versions 9 and newer.
+ * See also native_cbrt().
  */
-extern float __attribute__((const, overloadable))cbrt(float v);
-#endif
+extern float __attribute__((const, overloadable))
+    cbrt(float v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the cube root.
+extern float2 __attribute__((const, overloadable))
+    cbrt(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+    cbrt(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+    cbrt(float4 v);
+
+/*
+ * ceil: Smallest integer not less than a value
  *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))cbrt(float2 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the cube root.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))cbrt(float3 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the cube root.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))cbrt(float4 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
  * Returns the smallest integer not less than a value.
  *
  * For example, ceil(1.2f) returns 2.f, and ceil(-1.2f) returns -1.f.
  *
- * Supported by API versions 9 and newer.
+ * See also floor().
  */
-extern float __attribute__((const, overloadable))ceil(float v);
-#endif
+extern float __attribute__((const, overloadable))
+    ceil(float v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the smallest integer not less than a value.
- *
- * For example, ceil(1.2f) returns 2.f, and ceil(-1.2f) returns -1.f.
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))ceil(float2 v);
-#endif
+extern float2 __attribute__((const, overloadable))
+    ceil(float2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the smallest integer not less than a value.
- *
- * For example, ceil(1.2f) returns 2.f, and ceil(-1.2f) returns -1.f.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))ceil(float3 v);
-#endif
+extern float3 __attribute__((const, overloadable))
+    ceil(float3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the smallest integer not less than a value.
- *
- * For example, ceil(1.2f) returns 2.f, and ceil(-1.2f) returns -1.f.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))ceil(float4 v);
-#endif
+extern float4 __attribute__((const, overloadable))
+    ceil(float4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Clamps a value to a specified high and low bound.
+/*
+ * clamp: Restrain a value to a range
  *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
+ * Clamps a value to a specified high and low bound.  clamp() returns min_value
+ * if value < min_value, max_value if value > max_value, otherwise value.
+ *
+ * There are two variants of clamp: one where the min and max are scalars applied
+ * to all entries of the value, the other where the min and max are also vectors.
  *
  * If min_value is greater than max_value, the results are undefined.
  *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 9 and newer.
+ * Parameters:
+ *   value Value to be clamped.
+ *   min_value Lower bound, a scalar or matching vector.
+ *   max_value High bound, must match the type of low.
  */
-extern float __attribute__((const, overloadable))clamp(float value, float min_value, float max_value);
-#endif
+extern float __attribute__((const, overloadable))
+    clamp(float value, float min_value, float max_value);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))clamp(float2 value, float2 min_value, float2 max_value);
-#endif
+extern float2 __attribute__((const, overloadable))
+    clamp(float2 value, float2 min_value, float2 max_value);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))clamp(float3 value, float3 min_value, float3 max_value);
-#endif
+extern float3 __attribute__((const, overloadable))
+    clamp(float3 value, float3 min_value, float3 max_value);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))clamp(float4 value, float4 min_value, float4 max_value);
-#endif
+extern float4 __attribute__((const, overloadable))
+    clamp(float4 value, float4 min_value, float4 max_value);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))clamp(float2 value, float min_value, float max_value);
-#endif
+extern float2 __attribute__((const, overloadable))
+    clamp(float2 value, float min_value, float max_value);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))clamp(float3 value, float min_value, float max_value);
-#endif
+extern float3 __attribute__((const, overloadable))
+    clamp(float3 value, float min_value, float max_value);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))clamp(float4 value, float min_value, float max_value);
+extern float4 __attribute__((const, overloadable))
+    clamp(float4 value, float min_value, float max_value);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern char __attribute__((const, overloadable))
+    clamp(char value, char min_value, char max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern char __attribute__((const, overloadable))clamp(char value, char min_value, char max_value);
+extern char2 __attribute__((const, overloadable))
+    clamp(char2 value, char2 min_value, char2 max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern char2 __attribute__((const, overloadable))clamp(char2 value, char2 min_value, char2 max_value);
+extern char3 __attribute__((const, overloadable))
+    clamp(char3 value, char3 min_value, char3 max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern char3 __attribute__((const, overloadable))clamp(char3 value, char3 min_value, char3 max_value);
+extern char4 __attribute__((const, overloadable))
+    clamp(char4 value, char4 min_value, char4 max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern char4 __attribute__((const, overloadable))clamp(char4 value, char4 min_value, char4 max_value);
+extern uchar __attribute__((const, overloadable))
+    clamp(uchar value, uchar min_value, uchar max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern uchar __attribute__((const, overloadable))clamp(uchar value, uchar min_value, uchar max_value);
+extern uchar2 __attribute__((const, overloadable))
+    clamp(uchar2 value, uchar2 min_value, uchar2 max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern uchar2 __attribute__((const, overloadable))clamp(uchar2 value, uchar2 min_value, uchar2 max_value);
+extern uchar3 __attribute__((const, overloadable))
+    clamp(uchar3 value, uchar3 min_value, uchar3 max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern uchar3 __attribute__((const, overloadable))clamp(uchar3 value, uchar3 min_value, uchar3 max_value);
+extern uchar4 __attribute__((const, overloadable))
+    clamp(uchar4 value, uchar4 min_value, uchar4 max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern uchar4 __attribute__((const, overloadable))clamp(uchar4 value, uchar4 min_value, uchar4 max_value);
+extern short __attribute__((const, overloadable))
+    clamp(short value, short min_value, short max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern short __attribute__((const, overloadable))clamp(short value, short min_value, short max_value);
+extern short2 __attribute__((const, overloadable))
+    clamp(short2 value, short2 min_value, short2 max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern short2 __attribute__((const, overloadable))clamp(short2 value, short2 min_value, short2 max_value);
+extern short3 __attribute__((const, overloadable))
+    clamp(short3 value, short3 min_value, short3 max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern short3 __attribute__((const, overloadable))clamp(short3 value, short3 min_value, short3 max_value);
+extern short4 __attribute__((const, overloadable))
+    clamp(short4 value, short4 min_value, short4 max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern short4 __attribute__((const, overloadable))clamp(short4 value, short4 min_value, short4 max_value);
+extern ushort __attribute__((const, overloadable))
+    clamp(ushort value, ushort min_value, ushort max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern ushort __attribute__((const, overloadable))clamp(ushort value, ushort min_value, ushort max_value);
+extern ushort2 __attribute__((const, overloadable))
+    clamp(ushort2 value, ushort2 min_value, ushort2 max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern ushort2 __attribute__((const, overloadable))clamp(ushort2 value, ushort2 min_value, ushort2 max_value);
+extern ushort3 __attribute__((const, overloadable))
+    clamp(ushort3 value, ushort3 min_value, ushort3 max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern ushort3 __attribute__((const, overloadable))clamp(ushort3 value, ushort3 min_value, ushort3 max_value);
+extern ushort4 __attribute__((const, overloadable))
+    clamp(ushort4 value, ushort4 min_value, ushort4 max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern ushort4 __attribute__((const, overloadable))clamp(ushort4 value, ushort4 min_value, ushort4 max_value);
+extern int __attribute__((const, overloadable))
+    clamp(int value, int min_value, int max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern int __attribute__((const, overloadable))clamp(int value, int min_value, int max_value);
+extern int2 __attribute__((const, overloadable))
+    clamp(int2 value, int2 min_value, int2 max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern int2 __attribute__((const, overloadable))clamp(int2 value, int2 min_value, int2 max_value);
+extern int3 __attribute__((const, overloadable))
+    clamp(int3 value, int3 min_value, int3 max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern int3 __attribute__((const, overloadable))clamp(int3 value, int3 min_value, int3 max_value);
+extern int4 __attribute__((const, overloadable))
+    clamp(int4 value, int4 min_value, int4 max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern int4 __attribute__((const, overloadable))clamp(int4 value, int4 min_value, int4 max_value);
+extern uint __attribute__((const, overloadable))
+    clamp(uint value, uint min_value, uint max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern uint __attribute__((const, overloadable))clamp(uint value, uint min_value, uint max_value);
+extern uint2 __attribute__((const, overloadable))
+    clamp(uint2 value, uint2 min_value, uint2 max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern uint2 __attribute__((const, overloadable))clamp(uint2 value, uint2 min_value, uint2 max_value);
+extern uint3 __attribute__((const, overloadable))
+    clamp(uint3 value, uint3 min_value, uint3 max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern uint3 __attribute__((const, overloadable))clamp(uint3 value, uint3 min_value, uint3 max_value);
+extern uint4 __attribute__((const, overloadable))
+    clamp(uint4 value, uint4 min_value, uint4 max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern uint4 __attribute__((const, overloadable))clamp(uint4 value, uint4 min_value, uint4 max_value);
+extern long __attribute__((const, overloadable))
+    clamp(long value, long min_value, long max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern long __attribute__((const, overloadable))clamp(long value, long min_value, long max_value);
+extern long2 __attribute__((const, overloadable))
+    clamp(long2 value, long2 min_value, long2 max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern long2 __attribute__((const, overloadable))clamp(long2 value, long2 min_value, long2 max_value);
+extern long3 __attribute__((const, overloadable))
+    clamp(long3 value, long3 min_value, long3 max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern long3 __attribute__((const, overloadable))clamp(long3 value, long3 min_value, long3 max_value);
+extern long4 __attribute__((const, overloadable))
+    clamp(long4 value, long4 min_value, long4 max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern long4 __attribute__((const, overloadable))clamp(long4 value, long4 min_value, long4 max_value);
+extern ulong __attribute__((const, overloadable))
+    clamp(ulong value, ulong min_value, ulong max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern ulong __attribute__((const, overloadable))clamp(ulong value, ulong min_value, ulong max_value);
+extern ulong2 __attribute__((const, overloadable))
+    clamp(ulong2 value, ulong2 min_value, ulong2 max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern ulong2 __attribute__((const, overloadable))clamp(ulong2 value, ulong2 min_value, ulong2 max_value);
+extern ulong3 __attribute__((const, overloadable))
+    clamp(ulong3 value, ulong3 min_value, ulong3 max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern ulong3 __attribute__((const, overloadable))clamp(ulong3 value, ulong3 min_value, ulong3 max_value);
+extern ulong4 __attribute__((const, overloadable))
+    clamp(ulong4 value, ulong4 min_value, ulong4 max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern ulong4 __attribute__((const, overloadable))clamp(ulong4 value, ulong4 min_value, ulong4 max_value);
+extern char2 __attribute__((const, overloadable))
+    clamp(char2 value, char min_value, char max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern char2 __attribute__((const, overloadable))clamp(char2 value, char min_value, char max_value);
+extern char3 __attribute__((const, overloadable))
+    clamp(char3 value, char min_value, char max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern char3 __attribute__((const, overloadable))clamp(char3 value, char min_value, char max_value);
+extern char4 __attribute__((const, overloadable))
+    clamp(char4 value, char min_value, char max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern char4 __attribute__((const, overloadable))clamp(char4 value, char min_value, char max_value);
+extern uchar2 __attribute__((const, overloadable))
+    clamp(uchar2 value, uchar min_value, uchar max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern uchar2 __attribute__((const, overloadable))clamp(uchar2 value, uchar min_value, uchar max_value);
+extern uchar3 __attribute__((const, overloadable))
+    clamp(uchar3 value, uchar min_value, uchar max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern uchar3 __attribute__((const, overloadable))clamp(uchar3 value, uchar min_value, uchar max_value);
+extern uchar4 __attribute__((const, overloadable))
+    clamp(uchar4 value, uchar min_value, uchar max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern uchar4 __attribute__((const, overloadable))clamp(uchar4 value, uchar min_value, uchar max_value);
+extern short2 __attribute__((const, overloadable))
+    clamp(short2 value, short min_value, short max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern short2 __attribute__((const, overloadable))clamp(short2 value, short min_value, short max_value);
+extern short3 __attribute__((const, overloadable))
+    clamp(short3 value, short min_value, short max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern short3 __attribute__((const, overloadable))clamp(short3 value, short min_value, short max_value);
+extern short4 __attribute__((const, overloadable))
+    clamp(short4 value, short min_value, short max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern short4 __attribute__((const, overloadable))clamp(short4 value, short min_value, short max_value);
+extern ushort2 __attribute__((const, overloadable))
+    clamp(ushort2 value, ushort min_value, ushort max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern ushort2 __attribute__((const, overloadable))clamp(ushort2 value, ushort min_value, ushort max_value);
+extern ushort3 __attribute__((const, overloadable))
+    clamp(ushort3 value, ushort min_value, ushort max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern ushort3 __attribute__((const, overloadable))clamp(ushort3 value, ushort min_value, ushort max_value);
+extern ushort4 __attribute__((const, overloadable))
+    clamp(ushort4 value, ushort min_value, ushort max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern ushort4 __attribute__((const, overloadable))clamp(ushort4 value, ushort min_value, ushort max_value);
+extern int2 __attribute__((const, overloadable))
+    clamp(int2 value, int min_value, int max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern int2 __attribute__((const, overloadable))clamp(int2 value, int min_value, int max_value);
+extern int3 __attribute__((const, overloadable))
+    clamp(int3 value, int min_value, int max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern int3 __attribute__((const, overloadable))clamp(int3 value, int min_value, int max_value);
+extern int4 __attribute__((const, overloadable))
+    clamp(int4 value, int min_value, int max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern int4 __attribute__((const, overloadable))clamp(int4 value, int min_value, int max_value);
+extern uint2 __attribute__((const, overloadable))
+    clamp(uint2 value, uint min_value, uint max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern uint2 __attribute__((const, overloadable))clamp(uint2 value, uint min_value, uint max_value);
+extern uint3 __attribute__((const, overloadable))
+    clamp(uint3 value, uint min_value, uint max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern uint3 __attribute__((const, overloadable))clamp(uint3 value, uint min_value, uint max_value);
+extern uint4 __attribute__((const, overloadable))
+    clamp(uint4 value, uint min_value, uint max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern uint4 __attribute__((const, overloadable))clamp(uint4 value, uint min_value, uint max_value);
+extern long2 __attribute__((const, overloadable))
+    clamp(long2 value, long min_value, long max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern long2 __attribute__((const, overloadable))clamp(long2 value, long min_value, long max_value);
+extern long3 __attribute__((const, overloadable))
+    clamp(long3 value, long min_value, long max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern long3 __attribute__((const, overloadable))clamp(long3 value, long min_value, long max_value);
+extern long4 __attribute__((const, overloadable))
+    clamp(long4 value, long min_value, long max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern long4 __attribute__((const, overloadable))clamp(long4 value, long min_value, long max_value);
+extern ulong2 __attribute__((const, overloadable))
+    clamp(ulong2 value, ulong min_value, ulong max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern ulong2 __attribute__((const, overloadable))clamp(ulong2 value, ulong min_value, ulong max_value);
+extern ulong3 __attribute__((const, overloadable))
+    clamp(ulong3 value, ulong min_value, ulong max_value);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
- *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern ulong3 __attribute__((const, overloadable))clamp(ulong3 value, ulong min_value, ulong max_value);
+extern ulong4 __attribute__((const, overloadable))
+    clamp(ulong4 value, ulong min_value, ulong max_value);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 19))
-/**
- * Clamps a value to a specified high and low bound.
+/*
+ * clz: Number of leading 0 bits
  *
- * clamp() returns min_value if value < min_value, max_value if value > max_value, otherwise value.
- *
- * If min_value is greater than max_value, the results are undefined.
- *
- * @param value Value to be clamped.  Supports 1, 2, 3, 4 components.
- * @param min_value Lower bound, must be scalar or matching vector.
- * @param max_value High bound, must match the type of low.
- *
- * Supported by API versions 19 and newer.
- */
-extern ulong4 __attribute__((const, overloadable))clamp(ulong4 value, ulong min_value, ulong max_value);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
  * Returns the number of leading 0-bits in a value.
  *
- * For example, clz((char)0x03) returns 5.
- *
- * Supported by API versions 9 and newer.
+ * For example, clz((char)0x03) returns 6.
  */
-extern char __attribute__((const, overloadable))clz(char value);
-#endif
+extern char __attribute__((const, overloadable))
+    clz(char value);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the number of leading 0-bits in a value.
- *
- * For example, clz((char)0x03) returns 5.
- *
- * Supported by API versions 9 and newer.
- */
-extern char2 __attribute__((const, overloadable))clz(char2 value);
-#endif
+extern char2 __attribute__((const, overloadable))
+    clz(char2 value);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the number of leading 0-bits in a value.
- *
- * For example, clz((char)0x03) returns 5.
- *
- * Supported by API versions 9 and newer.
- */
-extern char3 __attribute__((const, overloadable))clz(char3 value);
-#endif
+extern char3 __attribute__((const, overloadable))
+    clz(char3 value);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the number of leading 0-bits in a value.
- *
- * For example, clz((char)0x03) returns 5.
- *
- * Supported by API versions 9 and newer.
- */
-extern char4 __attribute__((const, overloadable))clz(char4 value);
-#endif
+extern char4 __attribute__((const, overloadable))
+    clz(char4 value);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the number of leading 0-bits in a value.
- *
- * For example, clz((char)0x03) returns 5.
- *
- * Supported by API versions 9 and newer.
- */
-extern uchar __attribute__((const, overloadable))clz(uchar value);
-#endif
+extern uchar __attribute__((const, overloadable))
+    clz(uchar value);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the number of leading 0-bits in a value.
- *
- * For example, clz((char)0x03) returns 5.
- *
- * Supported by API versions 9 and newer.
- */
-extern uchar2 __attribute__((const, overloadable))clz(uchar2 value);
-#endif
+extern uchar2 __attribute__((const, overloadable))
+    clz(uchar2 value);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the number of leading 0-bits in a value.
- *
- * For example, clz((char)0x03) returns 5.
- *
- * Supported by API versions 9 and newer.
- */
-extern uchar3 __attribute__((const, overloadable))clz(uchar3 value);
-#endif
+extern uchar3 __attribute__((const, overloadable))
+    clz(uchar3 value);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the number of leading 0-bits in a value.
- *
- * For example, clz((char)0x03) returns 5.
- *
- * Supported by API versions 9 and newer.
- */
-extern uchar4 __attribute__((const, overloadable))clz(uchar4 value);
-#endif
+extern uchar4 __attribute__((const, overloadable))
+    clz(uchar4 value);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the number of leading 0-bits in a value.
- *
- * For example, clz((char)0x03) returns 5.
- *
- * Supported by API versions 9 and newer.
- */
-extern short __attribute__((const, overloadable))clz(short value);
-#endif
+extern short __attribute__((const, overloadable))
+    clz(short value);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the number of leading 0-bits in a value.
- *
- * For example, clz((char)0x03) returns 5.
- *
- * Supported by API versions 9 and newer.
- */
-extern short2 __attribute__((const, overloadable))clz(short2 value);
-#endif
+extern short2 __attribute__((const, overloadable))
+    clz(short2 value);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the number of leading 0-bits in a value.
- *
- * For example, clz((char)0x03) returns 5.
- *
- * Supported by API versions 9 and newer.
- */
-extern short3 __attribute__((const, overloadable))clz(short3 value);
-#endif
+extern short3 __attribute__((const, overloadable))
+    clz(short3 value);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the number of leading 0-bits in a value.
- *
- * For example, clz((char)0x03) returns 5.
- *
- * Supported by API versions 9 and newer.
- */
-extern short4 __attribute__((const, overloadable))clz(short4 value);
-#endif
+extern short4 __attribute__((const, overloadable))
+    clz(short4 value);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the number of leading 0-bits in a value.
- *
- * For example, clz((char)0x03) returns 5.
- *
- * Supported by API versions 9 and newer.
- */
-extern ushort __attribute__((const, overloadable))clz(ushort value);
-#endif
+extern ushort __attribute__((const, overloadable))
+    clz(ushort value);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the number of leading 0-bits in a value.
- *
- * For example, clz((char)0x03) returns 5.
- *
- * Supported by API versions 9 and newer.
- */
-extern ushort2 __attribute__((const, overloadable))clz(ushort2 value);
-#endif
+extern ushort2 __attribute__((const, overloadable))
+    clz(ushort2 value);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the number of leading 0-bits in a value.
- *
- * For example, clz((char)0x03) returns 5.
- *
- * Supported by API versions 9 and newer.
- */
-extern ushort3 __attribute__((const, overloadable))clz(ushort3 value);
-#endif
+extern ushort3 __attribute__((const, overloadable))
+    clz(ushort3 value);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the number of leading 0-bits in a value.
- *
- * For example, clz((char)0x03) returns 5.
- *
- * Supported by API versions 9 and newer.
- */
-extern ushort4 __attribute__((const, overloadable))clz(ushort4 value);
-#endif
+extern ushort4 __attribute__((const, overloadable))
+    clz(ushort4 value);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the number of leading 0-bits in a value.
- *
- * For example, clz((char)0x03) returns 5.
- *
- * Supported by API versions 9 and newer.
- */
-extern int __attribute__((const, overloadable))clz(int value);
-#endif
+extern int __attribute__((const, overloadable))
+    clz(int value);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the number of leading 0-bits in a value.
- *
- * For example, clz((char)0x03) returns 5.
- *
- * Supported by API versions 9 and newer.
- */
-extern int2 __attribute__((const, overloadable))clz(int2 value);
-#endif
+extern int2 __attribute__((const, overloadable))
+    clz(int2 value);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the number of leading 0-bits in a value.
- *
- * For example, clz((char)0x03) returns 5.
- *
- * Supported by API versions 9 and newer.
- */
-extern int3 __attribute__((const, overloadable))clz(int3 value);
-#endif
+extern int3 __attribute__((const, overloadable))
+    clz(int3 value);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the number of leading 0-bits in a value.
- *
- * For example, clz((char)0x03) returns 5.
- *
- * Supported by API versions 9 and newer.
- */
-extern int4 __attribute__((const, overloadable))clz(int4 value);
-#endif
+extern int4 __attribute__((const, overloadable))
+    clz(int4 value);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the number of leading 0-bits in a value.
- *
- * For example, clz((char)0x03) returns 5.
- *
- * Supported by API versions 9 and newer.
- */
-extern uint __attribute__((const, overloadable))clz(uint value);
-#endif
+extern uint __attribute__((const, overloadable))
+    clz(uint value);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the number of leading 0-bits in a value.
- *
- * For example, clz((char)0x03) returns 5.
- *
- * Supported by API versions 9 and newer.
- */
-extern uint2 __attribute__((const, overloadable))clz(uint2 value);
-#endif
+extern uint2 __attribute__((const, overloadable))
+    clz(uint2 value);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the number of leading 0-bits in a value.
- *
- * For example, clz((char)0x03) returns 5.
- *
- * Supported by API versions 9 and newer.
- */
-extern uint3 __attribute__((const, overloadable))clz(uint3 value);
-#endif
+extern uint3 __attribute__((const, overloadable))
+    clz(uint3 value);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the number of leading 0-bits in a value.
- *
- * For example, clz((char)0x03) returns 5.
- *
- * Supported by API versions 9 and newer.
- */
-extern uint4 __attribute__((const, overloadable))clz(uint4 value);
-#endif
+extern uint4 __attribute__((const, overloadable))
+    clz(uint4 value);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from float2 to float2.
+/*
+ * convert: Converts numerical vectors
  *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
+ * Component wise conversion from a numerical type to another.
  *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))convert_float2(float2 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from float3 to float3.
+ * Conversions of floating point values to integer will truncate.
  *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
  * Conversions of numbers too large to fit the destination type yield undefined results.
  * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
+ * Use clamp() to avoid this.
  */
-extern float3 __attribute__((const, overloadable))convert_float3(float3 v);
-#endif
+extern float2 __attribute__((const, overloadable))
+    convert_float2(float2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from float4 to float4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))convert_float4(float4 v);
-#endif
+extern float3 __attribute__((const, overloadable))
+    convert_float3(float3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from char2 to float2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))convert_float2(char2 v);
-#endif
+extern float4 __attribute__((const, overloadable))
+    convert_float4(float4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from char3 to float3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))convert_float3(char3 v);
-#endif
+extern float2 __attribute__((const, overloadable))
+    convert_float2(char2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from char4 to float4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))convert_float4(char4 v);
-#endif
+extern float3 __attribute__((const, overloadable))
+    convert_float3(char3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from uchar2 to float2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))convert_float2(uchar2 v);
-#endif
+extern float4 __attribute__((const, overloadable))
+    convert_float4(char4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from uchar3 to float3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))convert_float3(uchar3 v);
-#endif
+extern float2 __attribute__((const, overloadable))
+    convert_float2(uchar2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from uchar4 to float4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))convert_float4(uchar4 v);
-#endif
+extern float3 __attribute__((const, overloadable))
+    convert_float3(uchar3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from short2 to float2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))convert_float2(short2 v);
-#endif
+extern float4 __attribute__((const, overloadable))
+    convert_float4(uchar4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from short3 to float3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))convert_float3(short3 v);
-#endif
+extern float2 __attribute__((const, overloadable))
+    convert_float2(short2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from short4 to float4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))convert_float4(short4 v);
-#endif
+extern float3 __attribute__((const, overloadable))
+    convert_float3(short3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from ushort2 to float2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))convert_float2(ushort2 v);
-#endif
+extern float4 __attribute__((const, overloadable))
+    convert_float4(short4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from ushort3 to float3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))convert_float3(ushort3 v);
-#endif
+extern float2 __attribute__((const, overloadable))
+    convert_float2(ushort2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from ushort4 to float4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))convert_float4(ushort4 v);
-#endif
+extern float3 __attribute__((const, overloadable))
+    convert_float3(ushort3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from int2 to float2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))convert_float2(int2 v);
-#endif
+extern float4 __attribute__((const, overloadable))
+    convert_float4(ushort4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from int3 to float3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))convert_float3(int3 v);
-#endif
+extern float2 __attribute__((const, overloadable))
+    convert_float2(int2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from int4 to float4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))convert_float4(int4 v);
-#endif
+extern float3 __attribute__((const, overloadable))
+    convert_float3(int3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from uint2 to float2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))convert_float2(uint2 v);
-#endif
+extern float4 __attribute__((const, overloadable))
+    convert_float4(int4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from uint3 to float3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))convert_float3(uint3 v);
-#endif
+extern float2 __attribute__((const, overloadable))
+    convert_float2(uint2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from uint4 to float4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))convert_float4(uint4 v);
-#endif
+extern float3 __attribute__((const, overloadable))
+    convert_float3(uint3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from float2 to char2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern char2 __attribute__((const, overloadable))convert_char2(float2 v);
-#endif
+extern float4 __attribute__((const, overloadable))
+    convert_float4(uint4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from float3 to char3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern char3 __attribute__((const, overloadable))convert_char3(float3 v);
-#endif
+extern char2 __attribute__((const, overloadable))
+    convert_char2(float2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from float4 to char4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern char4 __attribute__((const, overloadable))convert_char4(float4 v);
-#endif
+extern char3 __attribute__((const, overloadable))
+    convert_char3(float3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from char2 to char2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern char2 __attribute__((const, overloadable))convert_char2(char2 v);
-#endif
+extern char4 __attribute__((const, overloadable))
+    convert_char4(float4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from char3 to char3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern char3 __attribute__((const, overloadable))convert_char3(char3 v);
-#endif
+extern char2 __attribute__((const, overloadable))
+    convert_char2(char2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from char4 to char4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern char4 __attribute__((const, overloadable))convert_char4(char4 v);
-#endif
+extern char3 __attribute__((const, overloadable))
+    convert_char3(char3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from uchar2 to char2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern char2 __attribute__((const, overloadable))convert_char2(uchar2 v);
-#endif
+extern char4 __attribute__((const, overloadable))
+    convert_char4(char4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from uchar3 to char3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern char3 __attribute__((const, overloadable))convert_char3(uchar3 v);
-#endif
+extern char2 __attribute__((const, overloadable))
+    convert_char2(uchar2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from uchar4 to char4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern char4 __attribute__((const, overloadable))convert_char4(uchar4 v);
-#endif
+extern char3 __attribute__((const, overloadable))
+    convert_char3(uchar3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from short2 to char2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern char2 __attribute__((const, overloadable))convert_char2(short2 v);
-#endif
+extern char4 __attribute__((const, overloadable))
+    convert_char4(uchar4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from short3 to char3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern char3 __attribute__((const, overloadable))convert_char3(short3 v);
-#endif
+extern char2 __attribute__((const, overloadable))
+    convert_char2(short2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from short4 to char4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern char4 __attribute__((const, overloadable))convert_char4(short4 v);
-#endif
+extern char3 __attribute__((const, overloadable))
+    convert_char3(short3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from ushort2 to char2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern char2 __attribute__((const, overloadable))convert_char2(ushort2 v);
-#endif
+extern char4 __attribute__((const, overloadable))
+    convert_char4(short4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from ushort3 to char3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern char3 __attribute__((const, overloadable))convert_char3(ushort3 v);
-#endif
+extern char2 __attribute__((const, overloadable))
+    convert_char2(ushort2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from ushort4 to char4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern char4 __attribute__((const, overloadable))convert_char4(ushort4 v);
-#endif
+extern char3 __attribute__((const, overloadable))
+    convert_char3(ushort3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from int2 to char2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern char2 __attribute__((const, overloadable))convert_char2(int2 v);
-#endif
+extern char4 __attribute__((const, overloadable))
+    convert_char4(ushort4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from int3 to char3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern char3 __attribute__((const, overloadable))convert_char3(int3 v);
-#endif
+extern char2 __attribute__((const, overloadable))
+    convert_char2(int2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from int4 to char4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern char4 __attribute__((const, overloadable))convert_char4(int4 v);
-#endif
+extern char3 __attribute__((const, overloadable))
+    convert_char3(int3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from uint2 to char2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern char2 __attribute__((const, overloadable))convert_char2(uint2 v);
-#endif
+extern char4 __attribute__((const, overloadable))
+    convert_char4(int4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from uint3 to char3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern char3 __attribute__((const, overloadable))convert_char3(uint3 v);
-#endif
+extern char2 __attribute__((const, overloadable))
+    convert_char2(uint2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from uint4 to char4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern char4 __attribute__((const, overloadable))convert_char4(uint4 v);
-#endif
+extern char3 __attribute__((const, overloadable))
+    convert_char3(uint3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from float2 to uchar2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern uchar2 __attribute__((const, overloadable))convert_uchar2(float2 v);
-#endif
+extern char4 __attribute__((const, overloadable))
+    convert_char4(uint4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from float3 to uchar3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern uchar3 __attribute__((const, overloadable))convert_uchar3(float3 v);
-#endif
+extern uchar2 __attribute__((const, overloadable))
+    convert_uchar2(float2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from float4 to uchar4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern uchar4 __attribute__((const, overloadable))convert_uchar4(float4 v);
-#endif
+extern uchar3 __attribute__((const, overloadable))
+    convert_uchar3(float3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from char2 to uchar2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern uchar2 __attribute__((const, overloadable))convert_uchar2(char2 v);
-#endif
+extern uchar4 __attribute__((const, overloadable))
+    convert_uchar4(float4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from char3 to uchar3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern uchar3 __attribute__((const, overloadable))convert_uchar3(char3 v);
-#endif
+extern uchar2 __attribute__((const, overloadable))
+    convert_uchar2(char2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from char4 to uchar4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern uchar4 __attribute__((const, overloadable))convert_uchar4(char4 v);
-#endif
+extern uchar3 __attribute__((const, overloadable))
+    convert_uchar3(char3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from uchar2 to uchar2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern uchar2 __attribute__((const, overloadable))convert_uchar2(uchar2 v);
-#endif
+extern uchar4 __attribute__((const, overloadable))
+    convert_uchar4(char4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from uchar3 to uchar3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern uchar3 __attribute__((const, overloadable))convert_uchar3(uchar3 v);
-#endif
+extern uchar2 __attribute__((const, overloadable))
+    convert_uchar2(uchar2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from uchar4 to uchar4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern uchar4 __attribute__((const, overloadable))convert_uchar4(uchar4 v);
-#endif
+extern uchar3 __attribute__((const, overloadable))
+    convert_uchar3(uchar3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from short2 to uchar2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern uchar2 __attribute__((const, overloadable))convert_uchar2(short2 v);
-#endif
+extern uchar4 __attribute__((const, overloadable))
+    convert_uchar4(uchar4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from short3 to uchar3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern uchar3 __attribute__((const, overloadable))convert_uchar3(short3 v);
-#endif
+extern uchar2 __attribute__((const, overloadable))
+    convert_uchar2(short2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from short4 to uchar4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern uchar4 __attribute__((const, overloadable))convert_uchar4(short4 v);
-#endif
+extern uchar3 __attribute__((const, overloadable))
+    convert_uchar3(short3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from ushort2 to uchar2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern uchar2 __attribute__((const, overloadable))convert_uchar2(ushort2 v);
-#endif
+extern uchar4 __attribute__((const, overloadable))
+    convert_uchar4(short4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from ushort3 to uchar3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern uchar3 __attribute__((const, overloadable))convert_uchar3(ushort3 v);
-#endif
+extern uchar2 __attribute__((const, overloadable))
+    convert_uchar2(ushort2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from ushort4 to uchar4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern uchar4 __attribute__((const, overloadable))convert_uchar4(ushort4 v);
-#endif
+extern uchar3 __attribute__((const, overloadable))
+    convert_uchar3(ushort3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from int2 to uchar2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern uchar2 __attribute__((const, overloadable))convert_uchar2(int2 v);
-#endif
+extern uchar4 __attribute__((const, overloadable))
+    convert_uchar4(ushort4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from int3 to uchar3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern uchar3 __attribute__((const, overloadable))convert_uchar3(int3 v);
-#endif
+extern uchar2 __attribute__((const, overloadable))
+    convert_uchar2(int2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from int4 to uchar4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern uchar4 __attribute__((const, overloadable))convert_uchar4(int4 v);
-#endif
+extern uchar3 __attribute__((const, overloadable))
+    convert_uchar3(int3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from uint2 to uchar2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern uchar2 __attribute__((const, overloadable))convert_uchar2(uint2 v);
-#endif
+extern uchar4 __attribute__((const, overloadable))
+    convert_uchar4(int4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from uint3 to uchar3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern uchar3 __attribute__((const, overloadable))convert_uchar3(uint3 v);
-#endif
+extern uchar2 __attribute__((const, overloadable))
+    convert_uchar2(uint2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from uint4 to uchar4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern uchar4 __attribute__((const, overloadable))convert_uchar4(uint4 v);
-#endif
+extern uchar3 __attribute__((const, overloadable))
+    convert_uchar3(uint3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from float2 to short2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern short2 __attribute__((const, overloadable))convert_short2(float2 v);
-#endif
+extern uchar4 __attribute__((const, overloadable))
+    convert_uchar4(uint4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from float3 to short3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern short3 __attribute__((const, overloadable))convert_short3(float3 v);
-#endif
+extern short2 __attribute__((const, overloadable))
+    convert_short2(float2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from float4 to short4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern short4 __attribute__((const, overloadable))convert_short4(float4 v);
-#endif
+extern short3 __attribute__((const, overloadable))
+    convert_short3(float3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from char2 to short2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern short2 __attribute__((const, overloadable))convert_short2(char2 v);
-#endif
+extern short4 __attribute__((const, overloadable))
+    convert_short4(float4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from char3 to short3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern short3 __attribute__((const, overloadable))convert_short3(char3 v);
-#endif
+extern short2 __attribute__((const, overloadable))
+    convert_short2(char2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from char4 to short4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern short4 __attribute__((const, overloadable))convert_short4(char4 v);
-#endif
+extern short3 __attribute__((const, overloadable))
+    convert_short3(char3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from uchar2 to short2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern short2 __attribute__((const, overloadable))convert_short2(uchar2 v);
-#endif
+extern short4 __attribute__((const, overloadable))
+    convert_short4(char4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from uchar3 to short3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern short3 __attribute__((const, overloadable))convert_short3(uchar3 v);
-#endif
+extern short2 __attribute__((const, overloadable))
+    convert_short2(uchar2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from uchar4 to short4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern short4 __attribute__((const, overloadable))convert_short4(uchar4 v);
-#endif
+extern short3 __attribute__((const, overloadable))
+    convert_short3(uchar3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from short2 to short2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern short2 __attribute__((const, overloadable))convert_short2(short2 v);
-#endif
+extern short4 __attribute__((const, overloadable))
+    convert_short4(uchar4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from short3 to short3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern short3 __attribute__((const, overloadable))convert_short3(short3 v);
-#endif
+extern short2 __attribute__((const, overloadable))
+    convert_short2(short2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from short4 to short4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern short4 __attribute__((const, overloadable))convert_short4(short4 v);
-#endif
+extern short3 __attribute__((const, overloadable))
+    convert_short3(short3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from ushort2 to short2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern short2 __attribute__((const, overloadable))convert_short2(ushort2 v);
-#endif
+extern short4 __attribute__((const, overloadable))
+    convert_short4(short4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from ushort3 to short3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern short3 __attribute__((const, overloadable))convert_short3(ushort3 v);
-#endif
+extern short2 __attribute__((const, overloadable))
+    convert_short2(ushort2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from ushort4 to short4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern short4 __attribute__((const, overloadable))convert_short4(ushort4 v);
-#endif
+extern short3 __attribute__((const, overloadable))
+    convert_short3(ushort3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from int2 to short2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern short2 __attribute__((const, overloadable))convert_short2(int2 v);
-#endif
+extern short4 __attribute__((const, overloadable))
+    convert_short4(ushort4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from int3 to short3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern short3 __attribute__((const, overloadable))convert_short3(int3 v);
-#endif
+extern short2 __attribute__((const, overloadable))
+    convert_short2(int2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from int4 to short4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern short4 __attribute__((const, overloadable))convert_short4(int4 v);
-#endif
+extern short3 __attribute__((const, overloadable))
+    convert_short3(int3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from uint2 to short2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern short2 __attribute__((const, overloadable))convert_short2(uint2 v);
-#endif
+extern short4 __attribute__((const, overloadable))
+    convert_short4(int4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from uint3 to short3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern short3 __attribute__((const, overloadable))convert_short3(uint3 v);
-#endif
+extern short2 __attribute__((const, overloadable))
+    convert_short2(uint2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from uint4 to short4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern short4 __attribute__((const, overloadable))convert_short4(uint4 v);
-#endif
+extern short3 __attribute__((const, overloadable))
+    convert_short3(uint3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from float2 to ushort2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern ushort2 __attribute__((const, overloadable))convert_ushort2(float2 v);
-#endif
+extern short4 __attribute__((const, overloadable))
+    convert_short4(uint4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from float3 to ushort3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern ushort3 __attribute__((const, overloadable))convert_ushort3(float3 v);
-#endif
+extern ushort2 __attribute__((const, overloadable))
+    convert_ushort2(float2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from float4 to ushort4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern ushort4 __attribute__((const, overloadable))convert_ushort4(float4 v);
-#endif
+extern ushort3 __attribute__((const, overloadable))
+    convert_ushort3(float3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from char2 to ushort2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern ushort2 __attribute__((const, overloadable))convert_ushort2(char2 v);
-#endif
+extern ushort4 __attribute__((const, overloadable))
+    convert_ushort4(float4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from char3 to ushort3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern ushort3 __attribute__((const, overloadable))convert_ushort3(char3 v);
-#endif
+extern ushort2 __attribute__((const, overloadable))
+    convert_ushort2(char2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from char4 to ushort4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern ushort4 __attribute__((const, overloadable))convert_ushort4(char4 v);
-#endif
+extern ushort3 __attribute__((const, overloadable))
+    convert_ushort3(char3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from uchar2 to ushort2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern ushort2 __attribute__((const, overloadable))convert_ushort2(uchar2 v);
-#endif
+extern ushort4 __attribute__((const, overloadable))
+    convert_ushort4(char4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from uchar3 to ushort3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern ushort3 __attribute__((const, overloadable))convert_ushort3(uchar3 v);
-#endif
+extern ushort2 __attribute__((const, overloadable))
+    convert_ushort2(uchar2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from uchar4 to ushort4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern ushort4 __attribute__((const, overloadable))convert_ushort4(uchar4 v);
-#endif
+extern ushort3 __attribute__((const, overloadable))
+    convert_ushort3(uchar3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from short2 to ushort2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern ushort2 __attribute__((const, overloadable))convert_ushort2(short2 v);
-#endif
+extern ushort4 __attribute__((const, overloadable))
+    convert_ushort4(uchar4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from short3 to ushort3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern ushort3 __attribute__((const, overloadable))convert_ushort3(short3 v);
-#endif
+extern ushort2 __attribute__((const, overloadable))
+    convert_ushort2(short2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from short4 to ushort4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern ushort4 __attribute__((const, overloadable))convert_ushort4(short4 v);
-#endif
+extern ushort3 __attribute__((const, overloadable))
+    convert_ushort3(short3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from ushort2 to ushort2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern ushort2 __attribute__((const, overloadable))convert_ushort2(ushort2 v);
-#endif
+extern ushort4 __attribute__((const, overloadable))
+    convert_ushort4(short4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from ushort3 to ushort3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern ushort3 __attribute__((const, overloadable))convert_ushort3(ushort3 v);
-#endif
+extern ushort2 __attribute__((const, overloadable))
+    convert_ushort2(ushort2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from ushort4 to ushort4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern ushort4 __attribute__((const, overloadable))convert_ushort4(ushort4 v);
-#endif
+extern ushort3 __attribute__((const, overloadable))
+    convert_ushort3(ushort3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from int2 to ushort2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern ushort2 __attribute__((const, overloadable))convert_ushort2(int2 v);
-#endif
+extern ushort4 __attribute__((const, overloadable))
+    convert_ushort4(ushort4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from int3 to ushort3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern ushort3 __attribute__((const, overloadable))convert_ushort3(int3 v);
-#endif
+extern ushort2 __attribute__((const, overloadable))
+    convert_ushort2(int2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from int4 to ushort4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern ushort4 __attribute__((const, overloadable))convert_ushort4(int4 v);
-#endif
+extern ushort3 __attribute__((const, overloadable))
+    convert_ushort3(int3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from uint2 to ushort2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern ushort2 __attribute__((const, overloadable))convert_ushort2(uint2 v);
-#endif
+extern ushort4 __attribute__((const, overloadable))
+    convert_ushort4(int4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from uint3 to ushort3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern ushort3 __attribute__((const, overloadable))convert_ushort3(uint3 v);
-#endif
+extern ushort2 __attribute__((const, overloadable))
+    convert_ushort2(uint2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from uint4 to ushort4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern ushort4 __attribute__((const, overloadable))convert_ushort4(uint4 v);
-#endif
+extern ushort3 __attribute__((const, overloadable))
+    convert_ushort3(uint3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from float2 to int2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern int2 __attribute__((const, overloadable))convert_int2(float2 v);
-#endif
+extern ushort4 __attribute__((const, overloadable))
+    convert_ushort4(uint4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from float3 to int3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern int3 __attribute__((const, overloadable))convert_int3(float3 v);
-#endif
+extern int2 __attribute__((const, overloadable))
+    convert_int2(float2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from float4 to int4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern int4 __attribute__((const, overloadable))convert_int4(float4 v);
-#endif
+extern int3 __attribute__((const, overloadable))
+    convert_int3(float3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from char2 to int2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern int2 __attribute__((const, overloadable))convert_int2(char2 v);
-#endif
+extern int4 __attribute__((const, overloadable))
+    convert_int4(float4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from char3 to int3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern int3 __attribute__((const, overloadable))convert_int3(char3 v);
-#endif
+extern int2 __attribute__((const, overloadable))
+    convert_int2(char2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from char4 to int4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern int4 __attribute__((const, overloadable))convert_int4(char4 v);
-#endif
+extern int3 __attribute__((const, overloadable))
+    convert_int3(char3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from uchar2 to int2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern int2 __attribute__((const, overloadable))convert_int2(uchar2 v);
-#endif
+extern int4 __attribute__((const, overloadable))
+    convert_int4(char4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from uchar3 to int3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern int3 __attribute__((const, overloadable))convert_int3(uchar3 v);
-#endif
+extern int2 __attribute__((const, overloadable))
+    convert_int2(uchar2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from uchar4 to int4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern int4 __attribute__((const, overloadable))convert_int4(uchar4 v);
-#endif
+extern int3 __attribute__((const, overloadable))
+    convert_int3(uchar3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from short2 to int2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern int2 __attribute__((const, overloadable))convert_int2(short2 v);
-#endif
+extern int4 __attribute__((const, overloadable))
+    convert_int4(uchar4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from short3 to int3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern int3 __attribute__((const, overloadable))convert_int3(short3 v);
-#endif
+extern int2 __attribute__((const, overloadable))
+    convert_int2(short2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from short4 to int4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern int4 __attribute__((const, overloadable))convert_int4(short4 v);
-#endif
+extern int3 __attribute__((const, overloadable))
+    convert_int3(short3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from ushort2 to int2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern int2 __attribute__((const, overloadable))convert_int2(ushort2 v);
-#endif
+extern int4 __attribute__((const, overloadable))
+    convert_int4(short4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from ushort3 to int3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern int3 __attribute__((const, overloadable))convert_int3(ushort3 v);
-#endif
+extern int2 __attribute__((const, overloadable))
+    convert_int2(ushort2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from ushort4 to int4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern int4 __attribute__((const, overloadable))convert_int4(ushort4 v);
-#endif
+extern int3 __attribute__((const, overloadable))
+    convert_int3(ushort3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from int2 to int2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern int2 __attribute__((const, overloadable))convert_int2(int2 v);
-#endif
+extern int4 __attribute__((const, overloadable))
+    convert_int4(ushort4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from int3 to int3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern int3 __attribute__((const, overloadable))convert_int3(int3 v);
-#endif
+extern int2 __attribute__((const, overloadable))
+    convert_int2(int2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from int4 to int4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern int4 __attribute__((const, overloadable))convert_int4(int4 v);
-#endif
+extern int3 __attribute__((const, overloadable))
+    convert_int3(int3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from uint2 to int2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern int2 __attribute__((const, overloadable))convert_int2(uint2 v);
-#endif
+extern int4 __attribute__((const, overloadable))
+    convert_int4(int4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from uint3 to int3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern int3 __attribute__((const, overloadable))convert_int3(uint3 v);
-#endif
+extern int2 __attribute__((const, overloadable))
+    convert_int2(uint2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from uint4 to int4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern int4 __attribute__((const, overloadable))convert_int4(uint4 v);
-#endif
+extern int3 __attribute__((const, overloadable))
+    convert_int3(uint3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from float2 to uint2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern uint2 __attribute__((const, overloadable))convert_uint2(float2 v);
-#endif
+extern int4 __attribute__((const, overloadable))
+    convert_int4(uint4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from float3 to uint3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern uint3 __attribute__((const, overloadable))convert_uint3(float3 v);
-#endif
+extern uint2 __attribute__((const, overloadable))
+    convert_uint2(float2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from float4 to uint4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern uint4 __attribute__((const, overloadable))convert_uint4(float4 v);
-#endif
+extern uint3 __attribute__((const, overloadable))
+    convert_uint3(float3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from char2 to uint2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern uint2 __attribute__((const, overloadable))convert_uint2(char2 v);
-#endif
+extern uint4 __attribute__((const, overloadable))
+    convert_uint4(float4 v);
+
+extern uint2 __attribute__((const, overloadable))
+    convert_uint2(char2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from char3 to uint3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern uint3 __attribute__((const, overloadable))convert_uint3(char3 v);
-#endif
+extern uint3 __attribute__((const, overloadable))
+    convert_uint3(char3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from char4 to uint4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern uint4 __attribute__((const, overloadable))convert_uint4(char4 v);
-#endif
+extern uint4 __attribute__((const, overloadable))
+    convert_uint4(char4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from uchar2 to uint2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern uint2 __attribute__((const, overloadable))convert_uint2(uchar2 v);
-#endif
+extern uint2 __attribute__((const, overloadable))
+    convert_uint2(uchar2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from uchar3 to uint3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern uint3 __attribute__((const, overloadable))convert_uint3(uchar3 v);
-#endif
+extern uint3 __attribute__((const, overloadable))
+    convert_uint3(uchar3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from uchar4 to uint4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern uint4 __attribute__((const, overloadable))convert_uint4(uchar4 v);
-#endif
+extern uint4 __attribute__((const, overloadable))
+    convert_uint4(uchar4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from short2 to uint2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern uint2 __attribute__((const, overloadable))convert_uint2(short2 v);
-#endif
+extern uint2 __attribute__((const, overloadable))
+    convert_uint2(short2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from short3 to uint3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern uint3 __attribute__((const, overloadable))convert_uint3(short3 v);
-#endif
+extern uint3 __attribute__((const, overloadable))
+    convert_uint3(short3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from short4 to uint4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern uint4 __attribute__((const, overloadable))convert_uint4(short4 v);
-#endif
+extern uint4 __attribute__((const, overloadable))
+    convert_uint4(short4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from ushort2 to uint2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern uint2 __attribute__((const, overloadable))convert_uint2(ushort2 v);
-#endif
+extern uint2 __attribute__((const, overloadable))
+    convert_uint2(ushort2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from ushort3 to uint3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern uint3 __attribute__((const, overloadable))convert_uint3(ushort3 v);
-#endif
+extern uint3 __attribute__((const, overloadable))
+    convert_uint3(ushort3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from ushort4 to uint4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern uint4 __attribute__((const, overloadable))convert_uint4(ushort4 v);
-#endif
+extern uint4 __attribute__((const, overloadable))
+    convert_uint4(ushort4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from int2 to uint2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern uint2 __attribute__((const, overloadable))convert_uint2(int2 v);
-#endif
+extern uint2 __attribute__((const, overloadable))
+    convert_uint2(int2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from int3 to uint3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern uint3 __attribute__((const, overloadable))convert_uint3(int3 v);
-#endif
+extern uint3 __attribute__((const, overloadable))
+    convert_uint3(int3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from int4 to uint4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern uint4 __attribute__((const, overloadable))convert_uint4(int4 v);
-#endif
+extern uint4 __attribute__((const, overloadable))
+    convert_uint4(int4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from uint2 to uint2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern uint2 __attribute__((const, overloadable))convert_uint2(uint2 v);
-#endif
+extern uint2 __attribute__((const, overloadable))
+    convert_uint2(uint2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from uint3 to uint3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern uint3 __attribute__((const, overloadable))convert_uint3(uint3 v);
-#endif
+extern uint3 __attribute__((const, overloadable))
+    convert_uint3(uint3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Component wise conversion from uint4 to uint4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 9 and newer.
- */
-extern uint4 __attribute__((const, overloadable))convert_uint4(uint4 v);
-#endif
+extern uint4 __attribute__((const, overloadable))
+    convert_uint4(uint4 v);
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from double2 to double2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern double2 __attribute__((const, overloadable))convert_double2(double2 v);
+extern double2 __attribute__((const, overloadable))
+    convert_double2(double2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from double3 to double3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern double3 __attribute__((const, overloadable))convert_double3(double3 v);
+extern double3 __attribute__((const, overloadable))
+    convert_double3(double3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from double4 to double4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern double4 __attribute__((const, overloadable))convert_double4(double4 v);
+extern double4 __attribute__((const, overloadable))
+    convert_double4(double4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from long2 to double2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern double2 __attribute__((const, overloadable))convert_double2(long2 v);
+extern double2 __attribute__((const, overloadable))
+    convert_double2(long2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from long3 to double3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern double3 __attribute__((const, overloadable))convert_double3(long3 v);
+extern double3 __attribute__((const, overloadable))
+    convert_double3(long3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from long4 to double4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern double4 __attribute__((const, overloadable))convert_double4(long4 v);
+extern double4 __attribute__((const, overloadable))
+    convert_double4(long4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from ulong2 to double2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern double2 __attribute__((const, overloadable))convert_double2(ulong2 v);
+extern double2 __attribute__((const, overloadable))
+    convert_double2(ulong2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from ulong3 to double3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern double3 __attribute__((const, overloadable))convert_double3(ulong3 v);
+extern double3 __attribute__((const, overloadable))
+    convert_double3(ulong3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from ulong4 to double4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern double4 __attribute__((const, overloadable))convert_double4(ulong4 v);
+extern double4 __attribute__((const, overloadable))
+    convert_double4(ulong4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from double2 to long2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern long2 __attribute__((const, overloadable))convert_long2(double2 v);
+extern long2 __attribute__((const, overloadable))
+    convert_long2(double2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from double3 to long3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern long3 __attribute__((const, overloadable))convert_long3(double3 v);
+extern long3 __attribute__((const, overloadable))
+    convert_long3(double3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from double4 to long4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern long4 __attribute__((const, overloadable))convert_long4(double4 v);
+extern long4 __attribute__((const, overloadable))
+    convert_long4(double4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from long2 to long2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern long2 __attribute__((const, overloadable))convert_long2(long2 v);
+extern long2 __attribute__((const, overloadable))
+    convert_long2(long2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from long3 to long3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern long3 __attribute__((const, overloadable))convert_long3(long3 v);
+extern long3 __attribute__((const, overloadable))
+    convert_long3(long3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from long4 to long4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern long4 __attribute__((const, overloadable))convert_long4(long4 v);
+extern long4 __attribute__((const, overloadable))
+    convert_long4(long4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from ulong2 to long2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern long2 __attribute__((const, overloadable))convert_long2(ulong2 v);
+extern long2 __attribute__((const, overloadable))
+    convert_long2(ulong2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from ulong3 to long3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern long3 __attribute__((const, overloadable))convert_long3(ulong3 v);
+extern long3 __attribute__((const, overloadable))
+    convert_long3(ulong3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from ulong4 to long4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern long4 __attribute__((const, overloadable))convert_long4(ulong4 v);
+extern long4 __attribute__((const, overloadable))
+    convert_long4(ulong4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from double2 to ulong2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern ulong2 __attribute__((const, overloadable))convert_ulong2(double2 v);
+extern ulong2 __attribute__((const, overloadable))
+    convert_ulong2(double2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from double3 to ulong3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern ulong3 __attribute__((const, overloadable))convert_ulong3(double3 v);
+extern ulong3 __attribute__((const, overloadable))
+    convert_ulong3(double3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from double4 to ulong4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern ulong4 __attribute__((const, overloadable))convert_ulong4(double4 v);
+extern ulong4 __attribute__((const, overloadable))
+    convert_ulong4(double4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from long2 to ulong2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern ulong2 __attribute__((const, overloadable))convert_ulong2(long2 v);
+extern ulong2 __attribute__((const, overloadable))
+    convert_ulong2(long2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from long3 to ulong3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern ulong3 __attribute__((const, overloadable))convert_ulong3(long3 v);
+extern ulong3 __attribute__((const, overloadable))
+    convert_ulong3(long3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from long4 to ulong4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern ulong4 __attribute__((const, overloadable))convert_ulong4(long4 v);
+extern ulong4 __attribute__((const, overloadable))
+    convert_ulong4(long4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from ulong2 to ulong2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern ulong2 __attribute__((const, overloadable))convert_ulong2(ulong2 v);
+extern ulong2 __attribute__((const, overloadable))
+    convert_ulong2(ulong2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from ulong3 to ulong3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern ulong3 __attribute__((const, overloadable))convert_ulong3(ulong3 v);
+extern ulong3 __attribute__((const, overloadable))
+    convert_ulong3(ulong3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from ulong4 to ulong4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern ulong4 __attribute__((const, overloadable))convert_ulong4(ulong4 v);
+extern ulong4 __attribute__((const, overloadable))
+    convert_ulong4(ulong4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from double2 to float2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern float2 __attribute__((const, overloadable))convert_float2(double2 v);
+extern float2 __attribute__((const, overloadable))
+    convert_float2(double2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from double3 to float3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern float3 __attribute__((const, overloadable))convert_float3(double3 v);
+extern float3 __attribute__((const, overloadable))
+    convert_float3(double3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from double4 to float4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern float4 __attribute__((const, overloadable))convert_float4(double4 v);
+extern float4 __attribute__((const, overloadable))
+    convert_float4(double4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from long2 to float2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern float2 __attribute__((const, overloadable))convert_float2(long2 v);
+extern float2 __attribute__((const, overloadable))
+    convert_float2(long2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from long3 to float3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern float3 __attribute__((const, overloadable))convert_float3(long3 v);
+extern float3 __attribute__((const, overloadable))
+    convert_float3(long3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from long4 to float4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern float4 __attribute__((const, overloadable))convert_float4(long4 v);
+extern float4 __attribute__((const, overloadable))
+    convert_float4(long4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from ulong2 to float2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern float2 __attribute__((const, overloadable))convert_float2(ulong2 v);
+extern float2 __attribute__((const, overloadable))
+    convert_float2(ulong2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from ulong3 to float3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern float3 __attribute__((const, overloadable))convert_float3(ulong3 v);
+extern float3 __attribute__((const, overloadable))
+    convert_float3(ulong3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from ulong4 to float4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern float4 __attribute__((const, overloadable))convert_float4(ulong4 v);
+extern float4 __attribute__((const, overloadable))
+    convert_float4(ulong4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from double2 to char2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern char2 __attribute__((const, overloadable))convert_char2(double2 v);
+extern char2 __attribute__((const, overloadable))
+    convert_char2(double2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from double3 to char3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern char3 __attribute__((const, overloadable))convert_char3(double3 v);
+extern char3 __attribute__((const, overloadable))
+    convert_char3(double3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from double4 to char4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern char4 __attribute__((const, overloadable))convert_char4(double4 v);
+extern char4 __attribute__((const, overloadable))
+    convert_char4(double4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from long2 to char2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern char2 __attribute__((const, overloadable))convert_char2(long2 v);
+extern char2 __attribute__((const, overloadable))
+    convert_char2(long2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from long3 to char3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern char3 __attribute__((const, overloadable))convert_char3(long3 v);
+extern char3 __attribute__((const, overloadable))
+    convert_char3(long3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from long4 to char4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern char4 __attribute__((const, overloadable))convert_char4(long4 v);
+extern char4 __attribute__((const, overloadable))
+    convert_char4(long4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from ulong2 to char2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern char2 __attribute__((const, overloadable))convert_char2(ulong2 v);
+extern char2 __attribute__((const, overloadable))
+    convert_char2(ulong2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from ulong3 to char3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern char3 __attribute__((const, overloadable))convert_char3(ulong3 v);
+extern char3 __attribute__((const, overloadable))
+    convert_char3(ulong3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from ulong4 to char4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern char4 __attribute__((const, overloadable))convert_char4(ulong4 v);
+extern char4 __attribute__((const, overloadable))
+    convert_char4(ulong4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from double2 to uchar2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern uchar2 __attribute__((const, overloadable))convert_uchar2(double2 v);
+extern uchar2 __attribute__((const, overloadable))
+    convert_uchar2(double2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from double3 to uchar3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern uchar3 __attribute__((const, overloadable))convert_uchar3(double3 v);
+extern uchar3 __attribute__((const, overloadable))
+    convert_uchar3(double3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from double4 to uchar4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern uchar4 __attribute__((const, overloadable))convert_uchar4(double4 v);
+extern uchar4 __attribute__((const, overloadable))
+    convert_uchar4(double4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from long2 to uchar2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern uchar2 __attribute__((const, overloadable))convert_uchar2(long2 v);
+extern uchar2 __attribute__((const, overloadable))
+    convert_uchar2(long2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from long3 to uchar3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern uchar3 __attribute__((const, overloadable))convert_uchar3(long3 v);
+extern uchar3 __attribute__((const, overloadable))
+    convert_uchar3(long3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from long4 to uchar4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern uchar4 __attribute__((const, overloadable))convert_uchar4(long4 v);
+extern uchar4 __attribute__((const, overloadable))
+    convert_uchar4(long4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from ulong2 to uchar2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern uchar2 __attribute__((const, overloadable))convert_uchar2(ulong2 v);
+extern uchar2 __attribute__((const, overloadable))
+    convert_uchar2(ulong2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from ulong3 to uchar3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern uchar3 __attribute__((const, overloadable))convert_uchar3(ulong3 v);
+extern uchar3 __attribute__((const, overloadable))
+    convert_uchar3(ulong3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from ulong4 to uchar4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern uchar4 __attribute__((const, overloadable))convert_uchar4(ulong4 v);
+extern uchar4 __attribute__((const, overloadable))
+    convert_uchar4(ulong4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from double2 to short2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern short2 __attribute__((const, overloadable))convert_short2(double2 v);
+extern short2 __attribute__((const, overloadable))
+    convert_short2(double2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from double3 to short3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern short3 __attribute__((const, overloadable))convert_short3(double3 v);
+extern short3 __attribute__((const, overloadable))
+    convert_short3(double3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from double4 to short4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern short4 __attribute__((const, overloadable))convert_short4(double4 v);
+extern short4 __attribute__((const, overloadable))
+    convert_short4(double4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from long2 to short2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern short2 __attribute__((const, overloadable))convert_short2(long2 v);
+extern short2 __attribute__((const, overloadable))
+    convert_short2(long2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from long3 to short3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern short3 __attribute__((const, overloadable))convert_short3(long3 v);
+extern short3 __attribute__((const, overloadable))
+    convert_short3(long3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from long4 to short4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern short4 __attribute__((const, overloadable))convert_short4(long4 v);
+extern short4 __attribute__((const, overloadable))
+    convert_short4(long4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from ulong2 to short2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern short2 __attribute__((const, overloadable))convert_short2(ulong2 v);
+extern short2 __attribute__((const, overloadable))
+    convert_short2(ulong2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from ulong3 to short3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern short3 __attribute__((const, overloadable))convert_short3(ulong3 v);
+extern short3 __attribute__((const, overloadable))
+    convert_short3(ulong3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from ulong4 to short4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern short4 __attribute__((const, overloadable))convert_short4(ulong4 v);
+extern short4 __attribute__((const, overloadable))
+    convert_short4(ulong4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from double2 to ushort2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern ushort2 __attribute__((const, overloadable))convert_ushort2(double2 v);
+extern ushort2 __attribute__((const, overloadable))
+    convert_ushort2(double2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from double3 to ushort3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern ushort3 __attribute__((const, overloadable))convert_ushort3(double3 v);
+extern ushort3 __attribute__((const, overloadable))
+    convert_ushort3(double3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from double4 to ushort4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern ushort4 __attribute__((const, overloadable))convert_ushort4(double4 v);
+extern ushort4 __attribute__((const, overloadable))
+    convert_ushort4(double4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from long2 to ushort2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern ushort2 __attribute__((const, overloadable))convert_ushort2(long2 v);
+extern ushort2 __attribute__((const, overloadable))
+    convert_ushort2(long2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from long3 to ushort3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern ushort3 __attribute__((const, overloadable))convert_ushort3(long3 v);
+extern ushort3 __attribute__((const, overloadable))
+    convert_ushort3(long3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from long4 to ushort4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern ushort4 __attribute__((const, overloadable))convert_ushort4(long4 v);
+extern ushort4 __attribute__((const, overloadable))
+    convert_ushort4(long4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from ulong2 to ushort2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern ushort2 __attribute__((const, overloadable))convert_ushort2(ulong2 v);
+extern ushort2 __attribute__((const, overloadable))
+    convert_ushort2(ulong2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from ulong3 to ushort3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern ushort3 __attribute__((const, overloadable))convert_ushort3(ulong3 v);
+extern ushort3 __attribute__((const, overloadable))
+    convert_ushort3(ulong3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from ulong4 to ushort4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern ushort4 __attribute__((const, overloadable))convert_ushort4(ulong4 v);
+extern ushort4 __attribute__((const, overloadable))
+    convert_ushort4(ulong4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from double2 to int2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern int2 __attribute__((const, overloadable))convert_int2(double2 v);
+extern int2 __attribute__((const, overloadable))
+    convert_int2(double2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from double3 to int3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern int3 __attribute__((const, overloadable))convert_int3(double3 v);
+extern int3 __attribute__((const, overloadable))
+    convert_int3(double3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from double4 to int4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern int4 __attribute__((const, overloadable))convert_int4(double4 v);
+extern int4 __attribute__((const, overloadable))
+    convert_int4(double4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from long2 to int2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern int2 __attribute__((const, overloadable))convert_int2(long2 v);
+extern int2 __attribute__((const, overloadable))
+    convert_int2(long2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from long3 to int3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern int3 __attribute__((const, overloadable))convert_int3(long3 v);
+extern int3 __attribute__((const, overloadable))
+    convert_int3(long3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from long4 to int4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern int4 __attribute__((const, overloadable))convert_int4(long4 v);
+extern int4 __attribute__((const, overloadable))
+    convert_int4(long4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from ulong2 to int2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern int2 __attribute__((const, overloadable))convert_int2(ulong2 v);
+extern int2 __attribute__((const, overloadable))
+    convert_int2(ulong2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from ulong3 to int3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern int3 __attribute__((const, overloadable))convert_int3(ulong3 v);
+extern int3 __attribute__((const, overloadable))
+    convert_int3(ulong3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from ulong4 to int4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern int4 __attribute__((const, overloadable))convert_int4(ulong4 v);
+extern int4 __attribute__((const, overloadable))
+    convert_int4(ulong4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from double2 to uint2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern uint2 __attribute__((const, overloadable))convert_uint2(double2 v);
+extern uint2 __attribute__((const, overloadable))
+    convert_uint2(double2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from double3 to uint3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern uint3 __attribute__((const, overloadable))convert_uint3(double3 v);
+extern uint3 __attribute__((const, overloadable))
+    convert_uint3(double3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from double4 to uint4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern uint4 __attribute__((const, overloadable))convert_uint4(double4 v);
+extern uint4 __attribute__((const, overloadable))
+    convert_uint4(double4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from long2 to uint2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern uint2 __attribute__((const, overloadable))convert_uint2(long2 v);
+extern uint2 __attribute__((const, overloadable))
+    convert_uint2(long2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from long3 to uint3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern uint3 __attribute__((const, overloadable))convert_uint3(long3 v);
+extern uint3 __attribute__((const, overloadable))
+    convert_uint3(long3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from long4 to uint4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern uint4 __attribute__((const, overloadable))convert_uint4(long4 v);
+extern uint4 __attribute__((const, overloadable))
+    convert_uint4(long4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from ulong2 to uint2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern uint2 __attribute__((const, overloadable))convert_uint2(ulong2 v);
+extern uint2 __attribute__((const, overloadable))
+    convert_uint2(ulong2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from ulong3 to uint3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern uint3 __attribute__((const, overloadable))convert_uint3(ulong3 v);
+extern uint3 __attribute__((const, overloadable))
+    convert_uint3(ulong3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from ulong4 to uint4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern uint4 __attribute__((const, overloadable))convert_uint4(ulong4 v);
+extern uint4 __attribute__((const, overloadable))
+    convert_uint4(ulong4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from float2 to double2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern double2 __attribute__((const, overloadable))convert_double2(float2 v);
+extern double2 __attribute__((const, overloadable))
+    convert_double2(float2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from float3 to double3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern double3 __attribute__((const, overloadable))convert_double3(float3 v);
+extern double3 __attribute__((const, overloadable))
+    convert_double3(float3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from float4 to double4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern double4 __attribute__((const, overloadable))convert_double4(float4 v);
+extern double4 __attribute__((const, overloadable))
+    convert_double4(float4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from char2 to double2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern double2 __attribute__((const, overloadable))convert_double2(char2 v);
+extern double2 __attribute__((const, overloadable))
+    convert_double2(char2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from char3 to double3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern double3 __attribute__((const, overloadable))convert_double3(char3 v);
+extern double3 __attribute__((const, overloadable))
+    convert_double3(char3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from char4 to double4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern double4 __attribute__((const, overloadable))convert_double4(char4 v);
+extern double4 __attribute__((const, overloadable))
+    convert_double4(char4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from uchar2 to double2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern double2 __attribute__((const, overloadable))convert_double2(uchar2 v);
+extern double2 __attribute__((const, overloadable))
+    convert_double2(uchar2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from uchar3 to double3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern double3 __attribute__((const, overloadable))convert_double3(uchar3 v);
+extern double3 __attribute__((const, overloadable))
+    convert_double3(uchar3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from uchar4 to double4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern double4 __attribute__((const, overloadable))convert_double4(uchar4 v);
+extern double4 __attribute__((const, overloadable))
+    convert_double4(uchar4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from short2 to double2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern double2 __attribute__((const, overloadable))convert_double2(short2 v);
+extern double2 __attribute__((const, overloadable))
+    convert_double2(short2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from short3 to double3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern double3 __attribute__((const, overloadable))convert_double3(short3 v);
+extern double3 __attribute__((const, overloadable))
+    convert_double3(short3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from short4 to double4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern double4 __attribute__((const, overloadable))convert_double4(short4 v);
+extern double4 __attribute__((const, overloadable))
+    convert_double4(short4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from ushort2 to double2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern double2 __attribute__((const, overloadable))convert_double2(ushort2 v);
+extern double2 __attribute__((const, overloadable))
+    convert_double2(ushort2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from ushort3 to double3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern double3 __attribute__((const, overloadable))convert_double3(ushort3 v);
+extern double3 __attribute__((const, overloadable))
+    convert_double3(ushort3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from ushort4 to double4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern double4 __attribute__((const, overloadable))convert_double4(ushort4 v);
+extern double4 __attribute__((const, overloadable))
+    convert_double4(ushort4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from int2 to double2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern double2 __attribute__((const, overloadable))convert_double2(int2 v);
+extern double2 __attribute__((const, overloadable))
+    convert_double2(int2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from int3 to double3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern double3 __attribute__((const, overloadable))convert_double3(int3 v);
+extern double3 __attribute__((const, overloadable))
+    convert_double3(int3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from int4 to double4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern double4 __attribute__((const, overloadable))convert_double4(int4 v);
+extern double4 __attribute__((const, overloadable))
+    convert_double4(int4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from uint2 to double2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern double2 __attribute__((const, overloadable))convert_double2(uint2 v);
+extern double2 __attribute__((const, overloadable))
+    convert_double2(uint2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from uint3 to double3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern double3 __attribute__((const, overloadable))convert_double3(uint3 v);
+extern double3 __attribute__((const, overloadable))
+    convert_double3(uint3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from uint4 to double4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern double4 __attribute__((const, overloadable))convert_double4(uint4 v);
+extern double4 __attribute__((const, overloadable))
+    convert_double4(uint4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from float2 to long2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern long2 __attribute__((const, overloadable))convert_long2(float2 v);
+extern long2 __attribute__((const, overloadable))
+    convert_long2(float2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from float3 to long3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern long3 __attribute__((const, overloadable))convert_long3(float3 v);
+extern long3 __attribute__((const, overloadable))
+    convert_long3(float3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from float4 to long4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern long4 __attribute__((const, overloadable))convert_long4(float4 v);
+extern long4 __attribute__((const, overloadable))
+    convert_long4(float4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from char2 to long2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern long2 __attribute__((const, overloadable))convert_long2(char2 v);
+extern long2 __attribute__((const, overloadable))
+    convert_long2(char2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from char3 to long3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern long3 __attribute__((const, overloadable))convert_long3(char3 v);
+extern long3 __attribute__((const, overloadable))
+    convert_long3(char3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from char4 to long4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern long4 __attribute__((const, overloadable))convert_long4(char4 v);
+extern long4 __attribute__((const, overloadable))
+    convert_long4(char4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from uchar2 to long2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern long2 __attribute__((const, overloadable))convert_long2(uchar2 v);
+extern long2 __attribute__((const, overloadable))
+    convert_long2(uchar2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from uchar3 to long3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern long3 __attribute__((const, overloadable))convert_long3(uchar3 v);
+extern long3 __attribute__((const, overloadable))
+    convert_long3(uchar3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from uchar4 to long4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern long4 __attribute__((const, overloadable))convert_long4(uchar4 v);
+extern long4 __attribute__((const, overloadable))
+    convert_long4(uchar4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from short2 to long2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern long2 __attribute__((const, overloadable))convert_long2(short2 v);
+extern long2 __attribute__((const, overloadable))
+    convert_long2(short2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from short3 to long3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern long3 __attribute__((const, overloadable))convert_long3(short3 v);
+extern long3 __attribute__((const, overloadable))
+    convert_long3(short3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from short4 to long4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern long4 __attribute__((const, overloadable))convert_long4(short4 v);
+extern long4 __attribute__((const, overloadable))
+    convert_long4(short4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from ushort2 to long2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern long2 __attribute__((const, overloadable))convert_long2(ushort2 v);
+extern long2 __attribute__((const, overloadable))
+    convert_long2(ushort2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from ushort3 to long3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern long3 __attribute__((const, overloadable))convert_long3(ushort3 v);
+extern long3 __attribute__((const, overloadable))
+    convert_long3(ushort3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from ushort4 to long4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern long4 __attribute__((const, overloadable))convert_long4(ushort4 v);
+extern long4 __attribute__((const, overloadable))
+    convert_long4(ushort4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from int2 to long2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern long2 __attribute__((const, overloadable))convert_long2(int2 v);
+extern long2 __attribute__((const, overloadable))
+    convert_long2(int2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from int3 to long3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern long3 __attribute__((const, overloadable))convert_long3(int3 v);
+extern long3 __attribute__((const, overloadable))
+    convert_long3(int3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from int4 to long4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern long4 __attribute__((const, overloadable))convert_long4(int4 v);
+extern long4 __attribute__((const, overloadable))
+    convert_long4(int4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from uint2 to long2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern long2 __attribute__((const, overloadable))convert_long2(uint2 v);
+extern long2 __attribute__((const, overloadable))
+    convert_long2(uint2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from uint3 to long3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern long3 __attribute__((const, overloadable))convert_long3(uint3 v);
+extern long3 __attribute__((const, overloadable))
+    convert_long3(uint3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from uint4 to long4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern long4 __attribute__((const, overloadable))convert_long4(uint4 v);
+extern long4 __attribute__((const, overloadable))
+    convert_long4(uint4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from float2 to ulong2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern ulong2 __attribute__((const, overloadable))convert_ulong2(float2 v);
+extern ulong2 __attribute__((const, overloadable))
+    convert_ulong2(float2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from float3 to ulong3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern ulong3 __attribute__((const, overloadable))convert_ulong3(float3 v);
+extern ulong3 __attribute__((const, overloadable))
+    convert_ulong3(float3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from float4 to ulong4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern ulong4 __attribute__((const, overloadable))convert_ulong4(float4 v);
+extern ulong4 __attribute__((const, overloadable))
+    convert_ulong4(float4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from char2 to ulong2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern ulong2 __attribute__((const, overloadable))convert_ulong2(char2 v);
+extern ulong2 __attribute__((const, overloadable))
+    convert_ulong2(char2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from char3 to ulong3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern ulong3 __attribute__((const, overloadable))convert_ulong3(char3 v);
+extern ulong3 __attribute__((const, overloadable))
+    convert_ulong3(char3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from char4 to ulong4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern ulong4 __attribute__((const, overloadable))convert_ulong4(char4 v);
+extern ulong4 __attribute__((const, overloadable))
+    convert_ulong4(char4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from uchar2 to ulong2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern ulong2 __attribute__((const, overloadable))convert_ulong2(uchar2 v);
+extern ulong2 __attribute__((const, overloadable))
+    convert_ulong2(uchar2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from uchar3 to ulong3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern ulong3 __attribute__((const, overloadable))convert_ulong3(uchar3 v);
+extern ulong3 __attribute__((const, overloadable))
+    convert_ulong3(uchar3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from uchar4 to ulong4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern ulong4 __attribute__((const, overloadable))convert_ulong4(uchar4 v);
+extern ulong4 __attribute__((const, overloadable))
+    convert_ulong4(uchar4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from short2 to ulong2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern ulong2 __attribute__((const, overloadable))convert_ulong2(short2 v);
+extern ulong2 __attribute__((const, overloadable))
+    convert_ulong2(short2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from short3 to ulong3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern ulong3 __attribute__((const, overloadable))convert_ulong3(short3 v);
+extern ulong3 __attribute__((const, overloadable))
+    convert_ulong3(short3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from short4 to ulong4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern ulong4 __attribute__((const, overloadable))convert_ulong4(short4 v);
+extern ulong4 __attribute__((const, overloadable))
+    convert_ulong4(short4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from ushort2 to ulong2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern ulong2 __attribute__((const, overloadable))convert_ulong2(ushort2 v);
+extern ulong2 __attribute__((const, overloadable))
+    convert_ulong2(ushort2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from ushort3 to ulong3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern ulong3 __attribute__((const, overloadable))convert_ulong3(ushort3 v);
+extern ulong3 __attribute__((const, overloadable))
+    convert_ulong3(ushort3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from ushort4 to ulong4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern ulong4 __attribute__((const, overloadable))convert_ulong4(ushort4 v);
+extern ulong4 __attribute__((const, overloadable))
+    convert_ulong4(ushort4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from int2 to ulong2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern ulong2 __attribute__((const, overloadable))convert_ulong2(int2 v);
+extern ulong2 __attribute__((const, overloadable))
+    convert_ulong2(int2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from int3 to ulong3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern ulong3 __attribute__((const, overloadable))convert_ulong3(int3 v);
+extern ulong3 __attribute__((const, overloadable))
+    convert_ulong3(int3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from int4 to ulong4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern ulong4 __attribute__((const, overloadable))convert_ulong4(int4 v);
+extern ulong4 __attribute__((const, overloadable))
+    convert_ulong4(int4 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from uint2 to ulong2.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern ulong2 __attribute__((const, overloadable))convert_ulong2(uint2 v);
+extern ulong2 __attribute__((const, overloadable))
+    convert_ulong2(uint2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from uint3 to ulong3.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern ulong3 __attribute__((const, overloadable))convert_ulong3(uint3 v);
+extern ulong3 __attribute__((const, overloadable))
+    convert_ulong3(uint3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Component wise conversion from uint4 to ulong4.
- *
- * For the convert_* functions, conversions of floating point values to integer will truncate.
- * Conversions of numbers too large to fit the destination type yield undefined results.
- * For example, converting a float that contains 1.0e18 to a short is undefined.
- *
- * Supported by API versions 21 and newer.
- */
-extern ulong4 __attribute__((const, overloadable))convert_ulong4(uint4 v);
+extern ulong4 __attribute__((const, overloadable))
+    convert_ulong4(uint4 v);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
+/*
+ * copysign: Copies the sign of a number to another
+ *
  * Copies the sign from sign_value to magnitude_value.
  *
  * The value returned is either magnitude_value or -magnitude_value.
  *
  * For example, copysign(4.0f, -2.7f) returns -4.0f and copysign(-4.0f, 2.7f) returns 4.0f.
- *
- * Supported by API versions 9 and newer.
  */
-extern float __attribute__((const, overloadable))copysign(float magnitude_value, float sign_value);
-#endif
+extern float __attribute__((const, overloadable))
+    copysign(float magnitude_value, float sign_value);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Copies the sign from sign_value to magnitude_value.
- *
- * The value returned is either magnitude_value or -magnitude_value.
- *
- * For example, copysign(4.0f, -2.7f) returns -4.0f and copysign(-4.0f, 2.7f) returns 4.0f.
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))copysign(float2 magnitude_value, float2 sign_value);
-#endif
+extern float2 __attribute__((const, overloadable))
+    copysign(float2 magnitude_value, float2 sign_value);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Copies the sign from sign_value to magnitude_value.
- *
- * The value returned is either magnitude_value or -magnitude_value.
- *
- * For example, copysign(4.0f, -2.7f) returns -4.0f and copysign(-4.0f, 2.7f) returns 4.0f.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))copysign(float3 magnitude_value, float3 sign_value);
-#endif
+extern float3 __attribute__((const, overloadable))
+    copysign(float3 magnitude_value, float3 sign_value);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Copies the sign from sign_value to magnitude_value.
- *
- * The value returned is either magnitude_value or -magnitude_value.
- *
- * For example, copysign(4.0f, -2.7f) returns -4.0f and copysign(-4.0f, 2.7f) returns 4.0f.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))copysign(float4 magnitude_value, float4 sign_value);
-#endif
+extern float4 __attribute__((const, overloadable))
+    copysign(float4 magnitude_value, float4 sign_value);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
+/*
+ * cos: Cosine
+ *
  * Returns the cosine of an angle measured in radians.
  *
- * Supported by API versions 9 and newer.
+ * See also native_cos().
  */
-extern float __attribute__((const, overloadable))cos(float v);
-#endif
+extern float __attribute__((const, overloadable))
+    cos(float v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the cosine of an angle measured in radians.
+extern float2 __attribute__((const, overloadable))
+    cos(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+    cos(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+    cos(float4 v);
+
+/*
+ * cosh: Hypebolic cosine
  *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))cos(float2 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the cosine of an angle measured in radians.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))cos(float3 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the cosine of an angle measured in radians.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))cos(float4 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
  * Returns the hypebolic cosine of v, where v is measured in radians.
  *
- * Supported by API versions 9 and newer.
+ * See also native_cosh().
  */
-extern float __attribute__((const, overloadable))cosh(float v);
-#endif
+extern float __attribute__((const, overloadable))
+    cosh(float v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the hypebolic cosine of v, where v is measured in radians.
+extern float2 __attribute__((const, overloadable))
+    cosh(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+    cosh(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+    cosh(float4 v);
+
+/*
+ * cospi: Cosine of a number multiplied by pi
  *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))cosh(float2 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the hypebolic cosine of v, where v is measured in radians.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))cosh(float3 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the hypebolic cosine of v, where v is measured in radians.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))cosh(float4 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
  * Returns the cosine of (v * pi), where (v * pi) is measured in radians.
  *
  * To get the cosine of a value measured in degrees, call cospi(v / 180.f).
  *
- * Supported by API versions 9 and newer.
+ * See also native_cospi().
  */
-extern float __attribute__((const, overloadable))cospi(float v);
-#endif
+extern float __attribute__((const, overloadable))
+    cospi(float v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the cosine of (v * pi), where (v * pi) is measured in radians.
- *
- * To get the cosine of a value measured in degrees, call cospi(v / 180.f).
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))cospi(float2 v);
-#endif
+extern float2 __attribute__((const, overloadable))
+    cospi(float2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the cosine of (v * pi), where (v * pi) is measured in radians.
- *
- * To get the cosine of a value measured in degrees, call cospi(v / 180.f).
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))cospi(float3 v);
-#endif
+extern float3 __attribute__((const, overloadable))
+    cospi(float3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the cosine of (v * pi), where (v * pi) is measured in radians.
- *
- * To get the cosine of a value measured in degrees, call cospi(v / 180.f).
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))cospi(float4 v);
-#endif
+extern float4 __attribute__((const, overloadable))
+    cospi(float4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
+/*
+ * cross: Cross product of two vectors
+ *
  * Computes the cross product of two vectors.
- *
- * Supported by API versions 9 and newer.
  */
-extern float3 __attribute__((const, overloadable))cross(float3 left_vector, float3 right_vector);
-#endif
+extern float3 __attribute__((const, overloadable))
+    cross(float3 left_vector, float3 right_vector);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Computes the cross product of two vectors.
+extern float4 __attribute__((const, overloadable))
+    cross(float4 left_vector, float4 right_vector);
+
+/*
+ * degrees: Converts radians into degrees
  *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))cross(float4 left_vector, float4 right_vector);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
  * Converts from radians to degrees.
- *
- * Supported by API versions 9 and newer.
  */
-extern float __attribute__((const, overloadable))degrees(float v);
-#endif
+extern float __attribute__((const, overloadable))
+    degrees(float v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Converts from radians to degrees.
+extern float2 __attribute__((const, overloadable))
+    degrees(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+    degrees(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+    degrees(float4 v);
+
+/*
+ * distance: Distance between two points
  *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))degrees(float2 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Converts from radians to degrees.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))degrees(float3 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Converts from radians to degrees.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))degrees(float4 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
  * Compute the distance between two points.
  *
- * Supported by API versions 9 and newer.
+ * See also fast_distance(), native_distance().
  */
-extern float __attribute__((const, overloadable))distance(float left_vector, float right_vector);
-#endif
+extern float __attribute__((const, overloadable))
+    distance(float left_vector, float right_vector);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Compute the distance between two points.
+extern float __attribute__((const, overloadable))
+    distance(float2 left_vector, float2 right_vector);
+
+extern float __attribute__((const, overloadable))
+    distance(float3 left_vector, float3 right_vector);
+
+extern float __attribute__((const, overloadable))
+    distance(float4 left_vector, float4 right_vector);
+
+/*
+ * dot: Dot product of two vectors
  *
- * Supported by API versions 9 and newer.
- */
-extern float __attribute__((const, overloadable))distance(float2 left_vector, float2 right_vector);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Compute the distance between two points.
- *
- * Supported by API versions 9 and newer.
- */
-extern float __attribute__((const, overloadable))distance(float3 left_vector, float3 right_vector);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Compute the distance between two points.
- *
- * Supported by API versions 9 and newer.
- */
-extern float __attribute__((const, overloadable))distance(float4 left_vector, float4 right_vector);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
  * Computes the dot product of two vectors.
- *
- * Supported by API versions 9 and newer.
  */
-extern float __attribute__((const, overloadable))dot(float left_vector, float right_vector);
-#endif
+extern float __attribute__((const, overloadable))
+    dot(float left_vector, float right_vector);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Computes the dot product of two vectors.
+extern float __attribute__((const, overloadable))
+    dot(float2 left_vector, float2 right_vector);
+
+extern float __attribute__((const, overloadable))
+    dot(float3 left_vector, float3 right_vector);
+
+extern float __attribute__((const, overloadable))
+    dot(float4 left_vector, float4 right_vector);
+
+/*
+ * erf: Mathematical error function
  *
- * Supported by API versions 9 and newer.
- */
-extern float __attribute__((const, overloadable))dot(float2 left_vector, float2 right_vector);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Computes the dot product of two vectors.
- *
- * Supported by API versions 9 and newer.
- */
-extern float __attribute__((const, overloadable))dot(float3 left_vector, float3 right_vector);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Computes the dot product of two vectors.
- *
- * Supported by API versions 9 and newer.
- */
-extern float __attribute__((const, overloadable))dot(float4 left_vector, float4 right_vector);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
  * Returns the error function.
- *
- * Supported by API versions 9 and newer.
  */
-extern float __attribute__((const, overloadable))erf(float v);
-#endif
+extern float __attribute__((const, overloadable))
+    erf(float v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the error function.
+extern float2 __attribute__((const, overloadable))
+    erf(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+    erf(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+    erf(float4 v);
+
+/*
+ * erfc: Mathematical complementary error function
  *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))erf(float2 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the error function.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))erf(float3 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the error function.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))erf(float4 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
  * Returns the complementary error function.
- *
- * Supported by API versions 9 and newer.
  */
-extern float __attribute__((const, overloadable))erfc(float v);
-#endif
+extern float __attribute__((const, overloadable))
+    erfc(float v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the complementary error function.
+extern float2 __attribute__((const, overloadable))
+    erfc(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+    erfc(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+    erfc(float4 v);
+
+/*
+ * exp: e raised to a number
  *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))erfc(float2 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the complementary error function.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))erfc(float3 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the complementary error function.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))erfc(float4 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
  * Returns e raised to v, i.e. e ^ v.
  *
- * Supported by API versions 9 and newer.
+ * See also native_exp().
  */
-extern float __attribute__((const, overloadable))exp(float v);
-#endif
+extern float __attribute__((const, overloadable))
+    exp(float v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns e raised to v, i.e. e ^ v.
+extern float2 __attribute__((const, overloadable))
+    exp(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+    exp(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+    exp(float4 v);
+
+/*
+ * exp10: 10 raised to a number
  *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))exp(float2 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns e raised to v, i.e. e ^ v.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))exp(float3 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns e raised to v, i.e. e ^ v.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))exp(float4 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
  * Returns 10 raised to v, i.e. 10.f ^ v.
  *
- * Supported by API versions 9 and newer.
+ * See also native_exp10().
  */
-extern float __attribute__((const, overloadable))exp10(float v);
-#endif
+extern float __attribute__((const, overloadable))
+    exp10(float v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns 10 raised to v, i.e. 10.f ^ v.
+extern float2 __attribute__((const, overloadable))
+    exp10(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+    exp10(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+    exp10(float4 v);
+
+/*
+ * exp2: 2 raised to a number
  *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))exp10(float2 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns 10 raised to v, i.e. 10.f ^ v.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))exp10(float3 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns 10 raised to v, i.e. 10.f ^ v.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))exp10(float4 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
  * Returns 2 raised to v, i.e. 2.f ^ v.
  *
- * Supported by API versions 9 and newer.
+ * See also native_exp2().
  */
-extern float __attribute__((const, overloadable))exp2(float v);
-#endif
+extern float __attribute__((const, overloadable))
+    exp2(float v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns 2 raised to v, i.e. 2.f ^ v.
+extern float2 __attribute__((const, overloadable))
+    exp2(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+    exp2(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+    exp2(float4 v);
+
+/*
+ * expm1: e raised to a number minus one
  *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))exp2(float2 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns 2 raised to v, i.e. 2.f ^ v.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))exp2(float3 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns 2 raised to v, i.e. 2.f ^ v.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))exp2(float4 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
  * Returns e raised to v minus 1, i.e. (e ^ v) - 1.
  *
- * Supported by API versions 9 and newer.
+ * See also native_expm1().
  */
-extern float __attribute__((const, overloadable))expm1(float v);
-#endif
+extern float __attribute__((const, overloadable))
+    expm1(float v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns e raised to v minus 1, i.e. (e ^ v) - 1.
+extern float2 __attribute__((const, overloadable))
+    expm1(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+    expm1(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+    expm1(float4 v);
+
+/*
+ * fabs: Absolute value of a float
  *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))expm1(float2 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns e raised to v minus 1, i.e. (e ^ v) - 1.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))expm1(float3 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns e raised to v minus 1, i.e. (e ^ v) - 1.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))expm1(float4 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
  * Returns the absolute value of the float v.
  *
  * For integers, use abs().
- *
- * Supported by API versions 9 and newer.
  */
-extern float __attribute__((const, overloadable))fabs(float v);
-#endif
+extern float __attribute__((const, overloadable))
+    fabs(float v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the absolute value of the float v.
- *
- * For integers, use abs().
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))fabs(float2 v);
-#endif
+extern float2 __attribute__((const, overloadable))
+    fabs(float2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the absolute value of the float v.
- *
- * For integers, use abs().
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))fabs(float3 v);
-#endif
+extern float3 __attribute__((const, overloadable))
+    fabs(float3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the absolute value of the float v.
- *
- * For integers, use abs().
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))fabs(float4 v);
-#endif
+extern float4 __attribute__((const, overloadable))
+    fabs(float4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 17))
-/**
+/*
+ * fast_distance: Approximate distance between two points
+ *
  * Computes the approximate distance between two points.
  *
  * The precision is what would be expected from doing the computation using 16 bit floating point values.
  *
- * Supported by API versions 17 and newer.
+ * See also distance(), native_distance().
  */
-extern float __attribute__((const, overloadable))fast_distance(float left_vector, float right_vector);
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern float __attribute__((const, overloadable))
+    fast_distance(float left_vector, float right_vector);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 17))
-/**
- * Computes the approximate distance between two points.
- *
- * The precision is what would be expected from doing the computation using 16 bit floating point values.
- *
- * Supported by API versions 17 and newer.
- */
-extern float __attribute__((const, overloadable))fast_distance(float2 left_vector, float2 right_vector);
+extern float __attribute__((const, overloadable))
+    fast_distance(float2 left_vector, float2 right_vector);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 17))
-/**
- * Computes the approximate distance between two points.
- *
- * The precision is what would be expected from doing the computation using 16 bit floating point values.
- *
- * Supported by API versions 17 and newer.
- */
-extern float __attribute__((const, overloadable))fast_distance(float3 left_vector, float3 right_vector);
+extern float __attribute__((const, overloadable))
+    fast_distance(float3 left_vector, float3 right_vector);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 17))
-/**
- * Computes the approximate distance between two points.
- *
- * The precision is what would be expected from doing the computation using 16 bit floating point values.
- *
- * Supported by API versions 17 and newer.
- */
-extern float __attribute__((const, overloadable))fast_distance(float4 left_vector, float4 right_vector);
+extern float __attribute__((const, overloadable))
+    fast_distance(float4 left_vector, float4 right_vector);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 17))
-/**
+/*
+ * fast_length: Approximate length of a vector
+ *
  * Computes the approximate length of a vector.
  *
  * The precision is what would be expected from doing the computation using 16 bit floating point values.
  *
- * Supported by API versions 17 and newer.
+ * See also length(), native_length().
  */
-extern float __attribute__((const, overloadable))fast_length(float v);
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern float __attribute__((const, overloadable))
+    fast_length(float v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 17))
-/**
- * Computes the approximate length of a vector.
- *
- * The precision is what would be expected from doing the computation using 16 bit floating point values.
- *
- * Supported by API versions 17 and newer.
- */
-extern float __attribute__((const, overloadable))fast_length(float2 v);
+extern float __attribute__((const, overloadable))
+    fast_length(float2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 17))
-/**
- * Computes the approximate length of a vector.
- *
- * The precision is what would be expected from doing the computation using 16 bit floating point values.
- *
- * Supported by API versions 17 and newer.
- */
-extern float __attribute__((const, overloadable))fast_length(float3 v);
+extern float __attribute__((const, overloadable))
+    fast_length(float3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 17))
-/**
- * Computes the approximate length of a vector.
- *
- * The precision is what would be expected from doing the computation using 16 bit floating point values.
- *
- * Supported by API versions 17 and newer.
- */
-extern float __attribute__((const, overloadable))fast_length(float4 v);
+extern float __attribute__((const, overloadable))
+    fast_length(float4 v);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 17))
-/**
+/*
+ * fast_normalize: Approximate normalized vector
+ *
  * Approximately normalizes a vector.
  *
  * For vectors of size 1, returns -1.f for negative values, 0.f for null values, and 1.f for positive values.
  *
  * The precision is what would be expected from doing the computation using 16 bit floating point values.
  *
- * Supported by API versions 17 and newer.
+ * See also normalize(), native_normalize().
  */
-extern float __attribute__((const, overloadable))fast_normalize(float v);
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern float __attribute__((const, overloadable))
+    fast_normalize(float v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 17))
-/**
- * Approximately normalizes a vector.
- *
- * For vectors of size 1, returns -1.f for negative values, 0.f for null values, and 1.f for positive values.
- *
- * The precision is what would be expected from doing the computation using 16 bit floating point values.
- *
- * Supported by API versions 17 and newer.
- */
-extern float2 __attribute__((const, overloadable))fast_normalize(float2 v);
+extern float2 __attribute__((const, overloadable))
+    fast_normalize(float2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 17))
-/**
- * Approximately normalizes a vector.
- *
- * For vectors of size 1, returns -1.f for negative values, 0.f for null values, and 1.f for positive values.
- *
- * The precision is what would be expected from doing the computation using 16 bit floating point values.
- *
- * Supported by API versions 17 and newer.
- */
-extern float3 __attribute__((const, overloadable))fast_normalize(float3 v);
+extern float3 __attribute__((const, overloadable))
+    fast_normalize(float3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 17))
-/**
- * Approximately normalizes a vector.
- *
- * For vectors of size 1, returns -1.f for negative values, 0.f for null values, and 1.f for positive values.
- *
- * The precision is what would be expected from doing the computation using 16 bit floating point values.
- *
- * Supported by API versions 17 and newer.
- */
-extern float4 __attribute__((const, overloadable))fast_normalize(float4 v);
+extern float4 __attribute__((const, overloadable))
+    fast_normalize(float4 v);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
+/*
+ * fdim: Positive difference between two values
+ *
  * Returns the positive difference between two values.
  *
  * If a > b, returns (a - b) otherwise returns 0f.
- *
- * Supported by API versions 9 and newer.
  */
-extern float __attribute__((const, overloadable))fdim(float a, float b);
-#endif
+extern float __attribute__((const, overloadable))
+    fdim(float a, float b);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the positive difference between two values.
- *
- * If a > b, returns (a - b) otherwise returns 0f.
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))fdim(float2 a, float2 b);
-#endif
+extern float2 __attribute__((const, overloadable))
+    fdim(float2 a, float2 b);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the positive difference between two values.
- *
- * If a > b, returns (a - b) otherwise returns 0f.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))fdim(float3 a, float3 b);
-#endif
+extern float3 __attribute__((const, overloadable))
+    fdim(float3 a, float3 b);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the positive difference between two values.
- *
- * If a > b, returns (a - b) otherwise returns 0f.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))fdim(float4 a, float4 b);
-#endif
+extern float4 __attribute__((const, overloadable))
+    fdim(float4 a, float4 b);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
+/*
+ * floor: Smallest integer not greater than a value
+ *
  * Returns the smallest integer not greater than a value.
  *
- * Supported by API versions 9 and newer.
- */
-extern float __attribute__((const, overloadable))floor(float v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the smallest integer not greater than a value.
+ * For example, floor(1.2f) returns 1.f, and floor(-1.2f) returns -2.f.
  *
- * Supported by API versions 9 and newer.
+ * See also ceil().
  */
-extern float2 __attribute__((const, overloadable))floor(float2 v);
-#endif
+extern float __attribute__((const, overloadable))
+    floor(float v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the smallest integer not greater than a value.
+extern float2 __attribute__((const, overloadable))
+    floor(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+    floor(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+    floor(float4 v);
+
+/*
+ * fma: Multiply and add
  *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))floor(float3 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the smallest integer not greater than a value.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))floor(float4 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
  * Multiply and add.  Returns (multiplicand1 * multiplicand2) + offset.
  *
- * This function is identical to mad().
- *
- * Supported by API versions 9 and newer.
+ * This function is similar to mad().  fma() retains full precision of the
+ * multiplied result and rounds only after the addition.  mad() rounds after the
+ * multiplication and the addition.  This extra precision is not guaranteed in
+ * rs_fp_relaxed mode.
  */
-extern float __attribute__((const, overloadable))fma(float multiplicand1, float multiplicand2, float offset);
-#endif
+extern float __attribute__((const, overloadable))
+    fma(float multiplicand1, float multiplicand2, float offset);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Multiply and add.  Returns (multiplicand1 * multiplicand2) + offset.
- *
- * This function is identical to mad().
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))fma(float2 multiplicand1, float2 multiplicand2, float2 offset);
-#endif
+extern float2 __attribute__((const, overloadable))
+    fma(float2 multiplicand1, float2 multiplicand2, float2 offset);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Multiply and add.  Returns (multiplicand1 * multiplicand2) + offset.
- *
- * This function is identical to mad().
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))fma(float3 multiplicand1, float3 multiplicand2, float3 offset);
-#endif
+extern float3 __attribute__((const, overloadable))
+    fma(float3 multiplicand1, float3 multiplicand2, float3 offset);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Multiply and add.  Returns (multiplicand1 * multiplicand2) + offset.
- *
- * This function is identical to mad().
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))fma(float4 multiplicand1, float4 multiplicand2, float4 offset);
-#endif
+extern float4 __attribute__((const, overloadable))
+    fma(float4 multiplicand1, float4 multiplicand2, float4 offset);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
+/*
+ * fmax: Maximum of two floats
+ *
  * Returns the maximum of a and b, i.e. (a < b ? b : a).
  *
  * The max() function returns identical results but can be applied to more data types.
- *
- * Supported by API versions 9 and newer.
  */
-extern float __attribute__((const, overloadable))fmax(float a, float b);
-#endif
+extern float __attribute__((const, overloadable))
+    fmax(float a, float b);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the maximum of a and b, i.e. (a < b ? b : a).
- *
- * The max() function returns identical results but can be applied to more data types.
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))fmax(float2 a, float2 b);
-#endif
+extern float2 __attribute__((const, overloadable))
+    fmax(float2 a, float2 b);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the maximum of a and b, i.e. (a < b ? b : a).
- *
- * The max() function returns identical results but can be applied to more data types.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))fmax(float3 a, float3 b);
-#endif
+extern float3 __attribute__((const, overloadable))
+    fmax(float3 a, float3 b);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the maximum of a and b, i.e. (a < b ? b : a).
- *
- * The max() function returns identical results but can be applied to more data types.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))fmax(float4 a, float4 b);
-#endif
+extern float4 __attribute__((const, overloadable))
+    fmax(float4 a, float4 b);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the maximum of a and b, i.e. (a < b ? b : a).
- *
- * Unlike the other variants of fmax() and max(), this function compare each element of a to the scalar b.
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))fmax(float2 a, float b);
-#endif
+extern float2 __attribute__((const, overloadable))
+    fmax(float2 a, float b);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the maximum of a and b, i.e. (a < b ? b : a).
- *
- * Unlike the other variants of fmax() and max(), this function compare each element of a to the scalar b.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))fmax(float3 a, float b);
-#endif
+extern float3 __attribute__((const, overloadable))
+    fmax(float3 a, float b);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the maximum of a and b, i.e. (a < b ? b : a).
- *
- * Unlike the other variants of fmax() and max(), this function compare each element of a to the scalar b.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))fmax(float4 a, float b);
-#endif
+extern float4 __attribute__((const, overloadable))
+    fmax(float4 a, float b);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
+/*
+ * fmin: Minimum of two floats
+ *
  * Returns the minimum of a and b, i.e. (a > b ? b : a).
  *
  * The min() function returns identical results but can be applied to more data types.
- *
- * Supported by API versions 9 and newer.
  */
-extern float __attribute__((const, overloadable))fmin(float a, float b);
-#endif
+extern float __attribute__((const, overloadable))
+    fmin(float a, float b);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the minimum of a and b, i.e. (a > b ? b : a).
- *
- * The min() function returns identical results but can be applied to more data types.
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))fmin(float2 a, float2 b);
-#endif
+extern float2 __attribute__((const, overloadable))
+    fmin(float2 a, float2 b);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the minimum of a and b, i.e. (a > b ? b : a).
- *
- * The min() function returns identical results but can be applied to more data types.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))fmin(float3 a, float3 b);
-#endif
+extern float3 __attribute__((const, overloadable))
+    fmin(float3 a, float3 b);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the minimum of a and b, i.e. (a > b ? b : a).
- *
- * The min() function returns identical results but can be applied to more data types.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))fmin(float4 a, float4 b);
-#endif
+extern float4 __attribute__((const, overloadable))
+    fmin(float4 a, float4 b);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the minimum of a and b, i.e. (a > b ? b : a)
- *
- * Unlike the other variants of fmin() and min(), this function compare each element of a to the scalar b.
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))fmin(float2 a, float b);
-#endif
+extern float2 __attribute__((const, overloadable))
+    fmin(float2 a, float b);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the minimum of a and b, i.e. (a > b ? b : a)
- *
- * Unlike the other variants of fmin() and min(), this function compare each element of a to the scalar b.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))fmin(float3 a, float b);
-#endif
+extern float3 __attribute__((const, overloadable))
+    fmin(float3 a, float b);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the minimum of a and b, i.e. (a > b ? b : a)
- *
- * Unlike the other variants of fmin() and min(), this function compare each element of a to the scalar b.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))fmin(float4 a, float b);
-#endif
+extern float4 __attribute__((const, overloadable))
+    fmin(float4 a, float b);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
+/*
+ * fmod: Modulo
+ *
  * Returns the remainder of (numerator / denominator), where the quotient is rounded towards zero.
  *
  * The function remainder() is similar but rounds toward the closest interger.
  * For example, fmod(-3.8f, 2.f) returns -1.8f (-3.8f - -1.f * 2.f)
  * while remainder(-3.8f, 2.f) returns 0.2f (-3.8f - -2.f * 2.f).
- *
- * Supported by API versions 9 and newer.
  */
-extern float __attribute__((const, overloadable))fmod(float numerator, float denominator);
-#endif
+extern float __attribute__((const, overloadable))
+    fmod(float numerator, float denominator);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the remainder of (numerator / denominator), where the quotient is rounded towards zero.
- *
- * The function remainder() is similar but rounds toward the closest interger.
- * For example, fmod(-3.8f, 2.f) returns -1.8f (-3.8f - -1.f * 2.f)
- * while remainder(-3.8f, 2.f) returns 0.2f (-3.8f - -2.f * 2.f).
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))fmod(float2 numerator, float2 denominator);
-#endif
+extern float2 __attribute__((const, overloadable))
+    fmod(float2 numerator, float2 denominator);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the remainder of (numerator / denominator), where the quotient is rounded towards zero.
- *
- * The function remainder() is similar but rounds toward the closest interger.
- * For example, fmod(-3.8f, 2.f) returns -1.8f (-3.8f - -1.f * 2.f)
- * while remainder(-3.8f, 2.f) returns 0.2f (-3.8f - -2.f * 2.f).
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))fmod(float3 numerator, float3 denominator);
-#endif
+extern float3 __attribute__((const, overloadable))
+    fmod(float3 numerator, float3 denominator);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the remainder of (numerator / denominator), where the quotient is rounded towards zero.
- *
- * The function remainder() is similar but rounds toward the closest interger.
- * For example, fmod(-3.8f, 2.f) returns -1.8f (-3.8f - -1.f * 2.f)
- * while remainder(-3.8f, 2.f) returns 0.2f (-3.8f - -2.f * 2.f).
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))fmod(float4 numerator, float4 denominator);
-#endif
+extern float4 __attribute__((const, overloadable))
+    fmod(float4 numerator, float4 denominator);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
+/*
+ * fract: Positive fractional part
+ *
  * Returns the positive fractional part of v, i.e. v - floor(v).
  *
  * For example, fract(1.3f, &val) returns 0.3f and sets val to 1.f.
  * fract(-1.3f, &val) returns 0.7f and sets val to -2.f.
  *
- * @param v Input value.
- * @param floor  If floor is not null, each element of floor will be set to the floor of the corresponding element of v.
- *
- * Supported by API versions 9 and newer.
+ * Parameters:
+ *   v Input value.
+ *   floor If floor is not null, *floor will be set to the floor of v.
  */
-extern float __attribute__((overloadable))fract(float v, float* floor);
-#endif
+extern float __attribute__((overloadable))
+    fract(float v, float* floor);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the positive fractional part of v, i.e. v - floor(v).
- *
- * For example, fract(1.3f, &val) returns 0.3f and sets val to 1.f.
- * fract(-1.3f, &val) returns 0.7f and sets val to -2.f.
- *
- * @param v Input value.
- * @param floor  If floor is not null, each element of floor will be set to the floor of the corresponding element of v.
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((overloadable))fract(float2 v, float2* floor);
-#endif
+extern float2 __attribute__((overloadable))
+    fract(float2 v, float2* floor);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the positive fractional part of v, i.e. v - floor(v).
- *
- * For example, fract(1.3f, &val) returns 0.3f and sets val to 1.f.
- * fract(-1.3f, &val) returns 0.7f and sets val to -2.f.
- *
- * @param v Input value.
- * @param floor  If floor is not null, each element of floor will be set to the floor of the corresponding element of v.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((overloadable))fract(float3 v, float3* floor);
-#endif
+extern float3 __attribute__((overloadable))
+    fract(float3 v, float3* floor);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the positive fractional part of v, i.e. v - floor(v).
- *
- * For example, fract(1.3f, &val) returns 0.3f and sets val to 1.f.
- * fract(-1.3f, &val) returns 0.7f and sets val to -2.f.
- *
- * @param v Input value.
- * @param floor  If floor is not null, each element of floor will be set to the floor of the corresponding element of v.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((overloadable))fract(float4 v, float4* floor);
-#endif
+extern float4 __attribute__((overloadable))
+    fract(float4 v, float4* floor);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the positive fractional part of v, i.e. v - floor(v).
- *
- * For example, fract(1.3f, &val) returns 0.3f and sets val to 1.f.
- * fract(-1.3f, &val) returns 0.7f and sets val to -2.f.
- *
- * Supported by API versions 9 and newer.
- */
-static float __attribute__((const, overloadable))fract(float v) {
- float unused;
- return fract(v, &unused);
+static inline float __attribute__((const, overloadable))
+    fract(float v) {
+    float unused;
+    return fract(v, &unused);
 }
-#endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the positive fractional part of v, i.e. v - floor(v).
- *
- * For example, fract(1.3f, &val) returns 0.3f and sets val to 1.f.
- * fract(-1.3f, &val) returns 0.7f and sets val to -2.f.
- *
- * Supported by API versions 9 and newer.
- */
-static float2 __attribute__((const, overloadable))fract(float2 v) {
- float2 unused;
- return fract(v, &unused);
+static inline float2 __attribute__((const, overloadable))
+    fract(float2 v) {
+    float2 unused;
+    return fract(v, &unused);
 }
-#endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the positive fractional part of v, i.e. v - floor(v).
- *
- * For example, fract(1.3f, &val) returns 0.3f and sets val to 1.f.
- * fract(-1.3f, &val) returns 0.7f and sets val to -2.f.
- *
- * Supported by API versions 9 and newer.
- */
-static float3 __attribute__((const, overloadable))fract(float3 v) {
- float3 unused;
- return fract(v, &unused);
+static inline float3 __attribute__((const, overloadable))
+    fract(float3 v) {
+    float3 unused;
+    return fract(v, &unused);
 }
-#endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the positive fractional part of v, i.e. v - floor(v).
- *
- * For example, fract(1.3f, &val) returns 0.3f and sets val to 1.f.
- * fract(-1.3f, &val) returns 0.7f and sets val to -2.f.
- *
- * Supported by API versions 9 and newer.
- */
-static float4 __attribute__((const, overloadable))fract(float4 v) {
- float4 unused;
- return fract(v, &unused);
+static inline float4 __attribute__((const, overloadable))
+    fract(float4 v) {
+    float4 unused;
+    return fract(v, &unused);
 }
-#endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the binary mantissa and exponent of v, e.g. v == mantissa * 2 ^ exponent.
+/*
+ * frexp: Binary mantissa and exponent
+ *
+ * Returns the binary mantissa and exponent of v, i.e. v == mantissa * 2 ^ exponent.
  *
  * The mantissa is always between 0.5 (inclusive) and 1.0 (exclusive).
- * See ldexp() for the reverse operation.
  *
- * @param v Supports float, float2, float3, float4.
- * @param exponent  If exponent is not null, each element of exponent will be set to the exponent of the corresponding element of v.
+ * See ldexp() for the reverse operation.  See also logb() and ilogb().
  *
- * Supported by API versions 9 and newer.
+ * Parameters:
+ *   v Input value.
+ *   exponent If exponent is not null, *exponent will be set to the exponent of v.
  */
-extern float __attribute__((overloadable))frexp(float v, int* exponent);
-#endif
+extern float __attribute__((overloadable))
+    frexp(float v, int* exponent);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the binary mantissa and exponent of v, e.g. v == mantissa * 2 ^ exponent.
- *
- * The mantissa is always between 0.5 (inclusive) and 1.0 (exclusive).
- * See ldexp() for the reverse operation.
- *
- * @param v Supports float, float2, float3, float4.
- * @param exponent  If exponent is not null, each element of exponent will be set to the exponent of the corresponding element of v.
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((overloadable))frexp(float2 v, int2* exponent);
-#endif
+extern float2 __attribute__((overloadable))
+    frexp(float2 v, int2* exponent);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the binary mantissa and exponent of v, e.g. v == mantissa * 2 ^ exponent.
- *
- * The mantissa is always between 0.5 (inclusive) and 1.0 (exclusive).
- * See ldexp() for the reverse operation.
- *
- * @param v Supports float, float2, float3, float4.
- * @param exponent  If exponent is not null, each element of exponent will be set to the exponent of the corresponding element of v.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((overloadable))frexp(float3 v, int3* exponent);
-#endif
+extern float3 __attribute__((overloadable))
+    frexp(float3 v, int3* exponent);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the binary mantissa and exponent of v, e.g. v == mantissa * 2 ^ exponent.
- *
- * The mantissa is always between 0.5 (inclusive) and 1.0 (exclusive).
- * See ldexp() for the reverse operation.
- *
- * @param v Supports float, float2, float3, float4.
- * @param exponent  If exponent is not null, each element of exponent will be set to the exponent of the corresponding element of v.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((overloadable))frexp(float4 v, int4* exponent);
-#endif
+extern float4 __attribute__((overloadable))
+    frexp(float4 v, int4* exponent);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 17))
-/**
+/*
+ * half_recip: Reciprocal computed to 16 bit precision
+ *
  * Returns the approximate reciprocal of a value.
  *
  * The precision is that of a 16 bit floating point value.
  *
- * Supported by API versions 17 and newer.
+ * See also native_recip().
  */
-extern float __attribute__((const, overloadable))half_recip(float v);
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern float __attribute__((const, overloadable))
+    half_recip(float v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 17))
-/**
- * Returns the approximate reciprocal of a value.
- *
- * The precision is that of a 16 bit floating point value.
- *
- * Supported by API versions 17 and newer.
- */
-extern float2 __attribute__((const, overloadable))half_recip(float2 v);
+extern float2 __attribute__((const, overloadable))
+    half_recip(float2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 17))
-/**
- * Returns the approximate reciprocal of a value.
- *
- * The precision is that of a 16 bit floating point value.
- *
- * Supported by API versions 17 and newer.
- */
-extern float3 __attribute__((const, overloadable))half_recip(float3 v);
+extern float3 __attribute__((const, overloadable))
+    half_recip(float3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 17))
-/**
- * Returns the approximate reciprocal of a value.
- *
- * The precision is that of a 16 bit floating point value.
- *
- * Supported by API versions 17 and newer.
- */
-extern float4 __attribute__((const, overloadable))half_recip(float4 v);
+extern float4 __attribute__((const, overloadable))
+    half_recip(float4 v);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 17))
-/**
+/*
+ * half_rsqrt: Reciprocal of a square root computed to 16 bit precision
+ *
  * Returns the approximate value of (1.f / sqrt(value)).
  *
  * The precision is that of a 16 bit floating point value.
  *
- * Supported by API versions 17 and newer.
+ * See also rsqrt(), native_rsqrt().
  */
-extern float __attribute__((const, overloadable))half_rsqrt(float v);
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern float __attribute__((const, overloadable))
+    half_rsqrt(float v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 17))
-/**
- * Returns the approximate value of (1.f / sqrt(value)).
- *
- * The precision is that of a 16 bit floating point value.
- *
- * Supported by API versions 17 and newer.
- */
-extern float2 __attribute__((const, overloadable))half_rsqrt(float2 v);
+extern float2 __attribute__((const, overloadable))
+    half_rsqrt(float2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 17))
-/**
- * Returns the approximate value of (1.f / sqrt(value)).
- *
- * The precision is that of a 16 bit floating point value.
- *
- * Supported by API versions 17 and newer.
- */
-extern float3 __attribute__((const, overloadable))half_rsqrt(float3 v);
+extern float3 __attribute__((const, overloadable))
+    half_rsqrt(float3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 17))
-/**
- * Returns the approximate value of (1.f / sqrt(value)).
- *
- * The precision is that of a 16 bit floating point value.
- *
- * Supported by API versions 17 and newer.
- */
-extern float4 __attribute__((const, overloadable))half_rsqrt(float4 v);
+extern float4 __attribute__((const, overloadable))
+    half_rsqrt(float4 v);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 17))
-/**
+/*
+ * half_sqrt: Square root computed to 16 bit precision
+ *
  * Returns the approximate square root of a value.
  *
  * The precision is that of a 16 bit floating point value.
  *
- * Supported by API versions 17 and newer.
+ * See also sqrt(), native_sqrt().
  */
-extern float __attribute__((const, overloadable))half_sqrt(float v);
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern float __attribute__((const, overloadable))
+    half_sqrt(float v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 17))
-/**
- * Returns the approximate square root of a value.
- *
- * The precision is that of a 16 bit floating point value.
- *
- * Supported by API versions 17 and newer.
- */
-extern float2 __attribute__((const, overloadable))half_sqrt(float2 v);
+extern float2 __attribute__((const, overloadable))
+    half_sqrt(float2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 17))
-/**
- * Returns the approximate square root of a value.
- *
- * The precision is that of a 16 bit floating point value.
- *
- * Supported by API versions 17 and newer.
- */
-extern float3 __attribute__((const, overloadable))half_sqrt(float3 v);
+extern float3 __attribute__((const, overloadable))
+    half_sqrt(float3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 17))
-/**
- * Returns the approximate square root of a value.
- *
- * The precision is that of a 16 bit floating point value.
- *
- * Supported by API versions 17 and newer.
- */
-extern float4 __attribute__((const, overloadable))half_sqrt(float4 v);
+extern float4 __attribute__((const, overloadable))
+    half_sqrt(float4 v);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
+/*
+ * hypot: Hypotenuse
+ *
  * Returns the hypotenuse, i.e. sqrt(a * a + b * b).
  *
- * Supported by API versions 9 and newer.
+ * See also native_hypot().
  */
-extern float __attribute__((const, overloadable))hypot(float a, float b);
-#endif
+extern float __attribute__((const, overloadable))
+    hypot(float a, float b);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the hypotenuse, i.e. sqrt(a * a + b * b).
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))hypot(float2 a, float2 b);
-#endif
+extern float2 __attribute__((const, overloadable))
+    hypot(float2 a, float2 b);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the hypotenuse, i.e. sqrt(a * a + b * b).
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))hypot(float3 a, float3 b);
-#endif
+extern float3 __attribute__((const, overloadable))
+    hypot(float3 a, float3 b);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the hypotenuse, i.e. sqrt(a * a + b * b).
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))hypot(float4 a, float4 b);
-#endif
+extern float4 __attribute__((const, overloadable))
+    hypot(float4 a, float4 b);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the base two exponent of a value, where the mantissa is between 1.f (inclusive) and 2.f (exclusive).
+/*
+ * ilogb: Base two exponent
  *
- * For example, ilogb(8.5f) returns 3.  Because of the difference in mantissa, this number is one less than
+ * Returns the base two exponent of a value, where the mantissa is between
+ * 1.f (inclusive) and 2.f (exclusive).
+ *
+ * For example, ilogb(8.5f) returns 3.
+ *
+ * Because of the difference in mantissa, this number is one less than
  * is returned by frexp().
  *
  * logb() is similar but returns a float.
- *
- * Supported by API versions 9 and newer.
  */
-extern int __attribute__((const, overloadable))ilogb(float v);
-#endif
+extern int __attribute__((const, overloadable))
+    ilogb(float v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the base two exponent of a value, where the mantissa is between 1.f (inclusive) and 2.f (exclusive).
- *
- * For example, ilogb(8.5f) returns 3.  Because of the difference in mantissa, this number is one less than
- * is returned by frexp().
- *
- * logb() is similar but returns a float.
- *
- * Supported by API versions 9 and newer.
- */
-extern int2 __attribute__((const, overloadable))ilogb(float2 v);
-#endif
+extern int2 __attribute__((const, overloadable))
+    ilogb(float2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the base two exponent of a value, where the mantissa is between 1.f (inclusive) and 2.f (exclusive).
- *
- * For example, ilogb(8.5f) returns 3.  Because of the difference in mantissa, this number is one less than
- * is returned by frexp().
- *
- * logb() is similar but returns a float.
- *
- * Supported by API versions 9 and newer.
- */
-extern int3 __attribute__((const, overloadable))ilogb(float3 v);
-#endif
+extern int3 __attribute__((const, overloadable))
+    ilogb(float3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the base two exponent of a value, where the mantissa is between 1.f (inclusive) and 2.f (exclusive).
- *
- * For example, ilogb(8.5f) returns 3.  Because of the difference in mantissa, this number is one less than
- * is returned by frexp().
- *
- * logb() is similar but returns a float.
- *
- * Supported by API versions 9 and newer.
- */
-extern int4 __attribute__((const, overloadable))ilogb(float4 v);
-#endif
+extern int4 __attribute__((const, overloadable))
+    ilogb(float4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the floating point created from the mantissa and exponent, i.e. (mantissa * 2 ^ exponent).
+/*
+ * ldexp: Creates a floating point from mantissa and exponent
+ *
+ * Returns the floating point created from the mantissa and exponent,
+ * i.e. (mantissa * 2 ^ exponent).
  *
  * See frexp() for the reverse operation.
  *
- * @param mantissa Supports float, float2, float3, and float4.
- * @param exponent Supports single component or matching vector.
- *
- * Supported by API versions 9 and newer.
+ * Parameters:
+ *   mantissa The mantissa
+ *   exponent The exponent, a single component or matching vector.
  */
-extern float __attribute__((const, overloadable))ldexp(float mantissa, int exponent);
-#endif
+extern float __attribute__((const, overloadable))
+    ldexp(float mantissa, int exponent);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the floating point created from the mantissa and exponent, i.e. (mantissa * 2 ^ exponent).
- *
- * See frexp() for the reverse operation.
- *
- * @param mantissa Supports float, float2, float3, and float4.
- * @param exponent Supports single component or matching vector.
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))ldexp(float2 mantissa, int2 exponent);
-#endif
+extern float2 __attribute__((const, overloadable))
+    ldexp(float2 mantissa, int2 exponent);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the floating point created from the mantissa and exponent, i.e. (mantissa * 2 ^ exponent).
- *
- * See frexp() for the reverse operation.
- *
- * @param mantissa Supports float, float2, float3, and float4.
- * @param exponent Supports single component or matching vector.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))ldexp(float3 mantissa, int3 exponent);
-#endif
+extern float3 __attribute__((const, overloadable))
+    ldexp(float3 mantissa, int3 exponent);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the floating point created from the mantissa and exponent, i.e. (mantissa * 2 ^ exponent).
- *
- * See frexp() for the reverse operation.
- *
- * @param mantissa Supports float, float2, float3, and float4.
- * @param exponent Supports single component or matching vector.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))ldexp(float4 mantissa, int4 exponent);
-#endif
+extern float4 __attribute__((const, overloadable))
+    ldexp(float4 mantissa, int4 exponent);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the floating point created from the mantissa and exponent, i.e. (mantissa * 2 ^ exponent).
- * See frexp() for the reverse operation.
- *
- * @param mantissa Supports float, float2, float3, and float4.
- * @param exponent Supports single component or matching vector.
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))ldexp(float2 mantissa, int exponent);
-#endif
+extern float2 __attribute__((const, overloadable))
+    ldexp(float2 mantissa, int exponent);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the floating point created from the mantissa and exponent, i.e. (mantissa * 2 ^ exponent).
- * See frexp() for the reverse operation.
- *
- * @param mantissa Supports float, float2, float3, and float4.
- * @param exponent Supports single component or matching vector.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))ldexp(float3 mantissa, int exponent);
-#endif
+extern float3 __attribute__((const, overloadable))
+    ldexp(float3 mantissa, int exponent);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the floating point created from the mantissa and exponent, i.e. (mantissa * 2 ^ exponent).
- * See frexp() for the reverse operation.
- *
- * @param mantissa Supports float, float2, float3, and float4.
- * @param exponent Supports single component or matching vector.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))ldexp(float4 mantissa, int exponent);
-#endif
+extern float4 __attribute__((const, overloadable))
+    ldexp(float4 mantissa, int exponent);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
+/*
+ * length: Length of a vector
+ *
  * Computes the length of a vector.
  *
- * Supported by API versions 9 and newer.
+ * See also fast_length(), native_length().
  */
-extern float __attribute__((const, overloadable))length(float v);
-#endif
+extern float __attribute__((const, overloadable))
+    length(float v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Computes the length of a vector.
+extern float __attribute__((const, overloadable))
+    length(float2 v);
+
+extern float __attribute__((const, overloadable))
+    length(float3 v);
+
+extern float __attribute__((const, overloadable))
+    length(float4 v);
+
+/*
+ * lgamma: Natural logarithm of the gamma function
  *
- * Supported by API versions 9 and newer.
+ * Returns the natural logarithm of the absolute value of the gamma function,
+ * i.e. log(fabs(tgamma(v))).
+ *
+ * See also tgamma().
+ *
+ * Parameters:
+ *   sign_of_gamma If sign_of_gamma is not null, *sign_of_gamma will be set to -1.f if the gamma of v is negative, otherwise to 1.f.
  */
-extern float __attribute__((const, overloadable))length(float2 v);
-#endif
+extern float __attribute__((const, overloadable))
+    lgamma(float v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Computes the length of a vector.
- *
- * Supported by API versions 9 and newer.
- */
-extern float __attribute__((const, overloadable))length(float3 v);
-#endif
+extern float2 __attribute__((const, overloadable))
+    lgamma(float2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Computes the length of a vector.
- *
- * Supported by API versions 9 and newer.
- */
-extern float __attribute__((const, overloadable))length(float4 v);
-#endif
+extern float3 __attribute__((const, overloadable))
+    lgamma(float3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the natural logarithm of the absolute value of the gamma function, i.e. log(fabs(gamma(v))).
- *
- * Supported by API versions 9 and newer.
- */
-extern float __attribute__((const, overloadable))lgamma(float v);
-#endif
+extern float4 __attribute__((const, overloadable))
+    lgamma(float4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the natural logarithm of the absolute value of the gamma function, i.e. log(fabs(gamma(v))).
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))lgamma(float2 v);
-#endif
+extern float __attribute__((overloadable))
+    lgamma(float v, int* sign_of_gamma);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the natural logarithm of the absolute value of the gamma function, i.e. log(fabs(gamma(v))).
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))lgamma(float3 v);
-#endif
+extern float2 __attribute__((overloadable))
+    lgamma(float2 v, int2* sign_of_gamma);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the natural logarithm of the absolute value of the gamma function, i.e. log(fabs(gamma(v))).
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))lgamma(float4 v);
-#endif
+extern float3 __attribute__((overloadable))
+    lgamma(float3 v, int3* sign_of_gamma);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the natural logarithm of the absolute value of the gamma function, i.e. log(fabs(gamma(v))).
- *
- * Can also return the sign of the gamma function.
- *
- * @param v Input value.
- * @param sign_of_gamma  If sign is not null, each element of sign will be set to -1.f if the gamma of the corresponding element of v is negative, otherwise to 1.f.
- *
- *
- * Supported by API versions 9 and newer.
- */
-extern float __attribute__((overloadable))lgamma(float v, int* sign_of_gamma);
-#endif
+extern float4 __attribute__((overloadable))
+    lgamma(float4 v, int4* sign_of_gamma);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the natural logarithm of the absolute value of the gamma function, i.e. log(fabs(gamma(v))).
+/*
+ * log: Natural logarithm
  *
- * Can also return the sign of the gamma function.
- *
- * @param v Input value.
- * @param sign_of_gamma  If sign is not null, each element of sign will be set to -1.f if the gamma of the corresponding element of v is negative, otherwise to 1.f.
- *
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((overloadable))lgamma(float2 v, int2* sign_of_gamma);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the natural logarithm of the absolute value of the gamma function, i.e. log(fabs(gamma(v))).
- *
- * Can also return the sign of the gamma function.
- *
- * @param v Input value.
- * @param sign_of_gamma  If sign is not null, each element of sign will be set to -1.f if the gamma of the corresponding element of v is negative, otherwise to 1.f.
- *
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((overloadable))lgamma(float3 v, int3* sign_of_gamma);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the natural logarithm of the absolute value of the gamma function, i.e. log(fabs(gamma(v))).
- *
- * Can also return the sign of the gamma function.
- *
- * @param v Input value.
- * @param sign_of_gamma  If sign is not null, each element of sign will be set to -1.f if the gamma of the corresponding element of v is negative, otherwise to 1.f.
- *
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((overloadable))lgamma(float4 v, int4* sign_of_gamma);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
  * Returns the natural logarithm.
  *
- * Supported by API versions 9 and newer.
+ * See also native_log().
  */
-extern float __attribute__((const, overloadable))log(float v);
-#endif
+extern float __attribute__((const, overloadable))
+    log(float v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the natural logarithm.
+extern float2 __attribute__((const, overloadable))
+    log(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+    log(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+    log(float4 v);
+
+/*
+ * log10: Base 10 logarithm
  *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))log(float2 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the natural logarithm.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))log(float3 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the natural logarithm.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))log(float4 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
  * Returns the base 10 logarithm.
  *
- * Supported by API versions 9 and newer.
+ * See also native_log10().
  */
-extern float __attribute__((const, overloadable))log10(float v);
-#endif
+extern float __attribute__((const, overloadable))
+    log10(float v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the base 10 logarithm.
+extern float2 __attribute__((const, overloadable))
+    log10(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+    log10(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+    log10(float4 v);
+
+/*
+ * log1p: Natural logarithm of a value plus 1
  *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))log10(float2 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the base 10 logarithm.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))log10(float3 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the base 10 logarithm.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))log10(float4 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
  * Returns the natural logarithm of (v + 1.f).
  *
- * Supported by API versions 9 and newer.
+ * See also native_log1p().
  */
-extern float __attribute__((const, overloadable))log1p(float v);
-#endif
+extern float __attribute__((const, overloadable))
+    log1p(float v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the natural logarithm of (v + 1.f).
+extern float2 __attribute__((const, overloadable))
+    log1p(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+    log1p(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+    log1p(float4 v);
+
+/*
+ * log2: Base 2 logarithm
  *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))log1p(float2 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the natural logarithm of (v + 1.f).
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))log1p(float3 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the natural logarithm of (v + 1.f).
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))log1p(float4 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
  * Returns the base 2 logarithm.
  *
- * Supported by API versions 9 and newer.
+ * See also native_log2().
  */
-extern float __attribute__((const, overloadable))log2(float v);
-#endif
+extern float __attribute__((const, overloadable))
+    log2(float v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the base 2 logarithm.
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))log2(float2 v);
-#endif
+extern float2 __attribute__((const, overloadable))
+    log2(float2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the base 2 logarithm.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))log2(float3 v);
-#endif
+extern float3 __attribute__((const, overloadable))
+    log2(float3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the base 2 logarithm.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))log2(float4 v);
-#endif
+extern float4 __attribute__((const, overloadable))
+    log2(float4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the base two exponent of a value, where the mantissa is between 1.f (inclusive) and 2.f (exclusive).
+/*
+ * logb: Base two exponent
  *
- * For example, logb(8.5f) returns 3.f.  Because of the difference in mantissa, this number is one less than
+ * Returns the base two exponent of a value, where the mantissa is between
+ * 1.f (inclusive) and 2.f (exclusive).
+ *
+ * For example, logb(8.5f) returns 3.f.
+ *
+ * Because of the difference in mantissa, this number is one less than
  * is returned by frexp().
  *
  * ilogb() is similar but returns an integer.
- *
- * Supported by API versions 9 and newer.
  */
-extern float __attribute__((const, overloadable))logb(float v);
-#endif
+extern float __attribute__((const, overloadable))
+    logb(float v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the base two exponent of a value, where the mantissa is between 1.f (inclusive) and 2.f (exclusive).
- *
- * For example, logb(8.5f) returns 3.f.  Because of the difference in mantissa, this number is one less than
- * is returned by frexp().
- *
- * ilogb() is similar but returns an integer.
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))logb(float2 v);
-#endif
+extern float2 __attribute__((const, overloadable))
+    logb(float2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the base two exponent of a value, where the mantissa is between 1.f (inclusive) and 2.f (exclusive).
- *
- * For example, logb(8.5f) returns 3.f.  Because of the difference in mantissa, this number is one less than
- * is returned by frexp().
- *
- * ilogb() is similar but returns an integer.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))logb(float3 v);
-#endif
+extern float3 __attribute__((const, overloadable))
+    logb(float3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the base two exponent of a value, where the mantissa is between 1.f (inclusive) and 2.f (exclusive).
- *
- * For example, logb(8.5f) returns 3.f.  Because of the difference in mantissa, this number is one less than
- * is returned by frexp().
- *
- * ilogb() is similar but returns an integer.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))logb(float4 v);
-#endif
+extern float4 __attribute__((const, overloadable))
+    logb(float4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
+/*
+ * mad: Multiply and add
+ *
  * Multiply and add.  Returns (multiplicand1 * multiplicand2) + offset.
  *
- * This function is identical to fma().
- *
- * Supported by API versions 9 and newer.
+ * This function is similar to fma().  fma() retains full precision of the
+ * multiplied result and rounds only after the addition.  mad() rounds after the
+ * multiplication and the addition.  In rs_fp_relaxed mode, mad() may not do the
+ * rounding after multiplicaiton.
  */
-extern float __attribute__((const, overloadable))mad(float multiplicand1, float multiplicand2, float offset);
-#endif
+extern float __attribute__((const, overloadable))
+    mad(float multiplicand1, float multiplicand2, float offset);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Multiply and add.  Returns (multiplicand1 * multiplicand2) + offset.
- *
- * This function is identical to fma().
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))mad(float2 multiplicand1, float2 multiplicand2, float2 offset);
-#endif
+extern float2 __attribute__((const, overloadable))
+    mad(float2 multiplicand1, float2 multiplicand2, float2 offset);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Multiply and add.  Returns (multiplicand1 * multiplicand2) + offset.
- *
- * This function is identical to fma().
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))mad(float3 multiplicand1, float3 multiplicand2, float3 offset);
-#endif
+extern float3 __attribute__((const, overloadable))
+    mad(float3 multiplicand1, float3 multiplicand2, float3 offset);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Multiply and add.  Returns (multiplicand1 * multiplicand2) + offset.
- *
- * This function is identical to fma().
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))mad(float4 multiplicand1, float4 multiplicand2, float4 offset);
-#endif
+extern float4 __attribute__((const, overloadable))
+    mad(float4 multiplicand1, float4 multiplicand2, float4 offset);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
+/*
+ * max: Maximum
+ *
  * Returns the maximum value of two arguments.
- *
- * Supported by API versions 9 and newer.
  */
-extern float __attribute__((const, overloadable))max(float a, float b);
-#endif
+extern float __attribute__((const, overloadable))
+    max(float a, float b);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the maximum value of two arguments.
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))max(float2 a, float2 b);
-#endif
+extern float2 __attribute__((const, overloadable))
+    max(float2 a, float2 b);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the maximum value of two arguments.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))max(float3 a, float3 b);
-#endif
+extern float3 __attribute__((const, overloadable))
+    max(float3 a, float3 b);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the maximum value of two arguments.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))max(float4 a, float4 b);
-#endif
+extern float4 __attribute__((const, overloadable))
+    max(float4 a, float4 b);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 20))
-/**
- * Returns the maximum value of two arguments.
- *
- * Suppored by API versions 9 - 20
- */
-static char __attribute__((const, overloadable))max(char a, char b) {
- return (a > b ? a : b);
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+static inline char __attribute__((const, overloadable))
+    max(char a, char b) {
+    return (a > b ? a : b);
 }
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 20))
-/**
- * Returns the maximum value of two arguments.
- *
- * Suppored by API versions 9 - 20
- */
-static uchar __attribute__((const, overloadable))max(uchar a, uchar b) {
- return (a > b ? a : b);
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+static inline uchar __attribute__((const, overloadable))
+    max(uchar a, uchar b) {
+    return (a > b ? a : b);
 }
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 20))
-/**
- * Returns the maximum value of two arguments.
- *
- * Suppored by API versions 9 - 20
- */
-static short __attribute__((const, overloadable))max(short a, short b) {
- return (a > b ? a : b);
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+static inline short __attribute__((const, overloadable))
+    max(short a, short b) {
+    return (a > b ? a : b);
 }
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 20))
-/**
- * Returns the maximum value of two arguments.
- *
- * Suppored by API versions 9 - 20
- */
-static ushort __attribute__((const, overloadable))max(ushort a, ushort b) {
- return (a > b ? a : b);
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+static inline ushort __attribute__((const, overloadable))
+    max(ushort a, ushort b) {
+    return (a > b ? a : b);
 }
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 20))
-/**
- * Returns the maximum value of two arguments.
- *
- * Suppored by API versions 9 - 20
- */
-static int __attribute__((const, overloadable))max(int a, int b) {
- return (a > b ? a : b);
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+static inline int __attribute__((const, overloadable))
+    max(int a, int b) {
+    return (a > b ? a : b);
 }
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 20))
-/**
- * Returns the maximum value of two arguments.
- *
- * Suppored by API versions 9 - 20
- */
-static uint __attribute__((const, overloadable))max(uint a, uint b) {
- return (a > b ? a : b);
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+static inline uint __attribute__((const, overloadable))
+    max(uint a, uint b) {
+    return (a > b ? a : b);
 }
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 20))
-/**
- * Returns the maximum value of two arguments.
- *
- * Suppored by API versions 9 - 20
- */
-static char2 __attribute__((const, overloadable))max(char2 a, char2 b) {
- char2 tmp;
- tmp.x = (a.x > b.x ? a.x : b.x);
- tmp.y = (a.y > b.y ? a.y : b.y);
- return tmp;
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+static inline char2 __attribute__((const, overloadable))
+    max(char2 a, char2 b) {
+    char2 tmp;
+    tmp.x = (a.x > b.x ? a.x : b.x);
+    tmp.y = (a.y > b.y ? a.y : b.y);
+    return tmp;
 }
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 20))
-/**
- * Returns the maximum value of two arguments.
- *
- * Suppored by API versions 9 - 20
- */
-static uchar2 __attribute__((const, overloadable))max(uchar2 a, uchar2 b) {
- uchar2 tmp;
- tmp.x = (a.x > b.x ? a.x : b.x);
- tmp.y = (a.y > b.y ? a.y : b.y);
- return tmp;
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+static inline uchar2 __attribute__((const, overloadable))
+    max(uchar2 a, uchar2 b) {
+    uchar2 tmp;
+    tmp.x = (a.x > b.x ? a.x : b.x);
+    tmp.y = (a.y > b.y ? a.y : b.y);
+    return tmp;
 }
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 20))
-/**
- * Returns the maximum value of two arguments.
- *
- * Suppored by API versions 9 - 20
- */
-static short2 __attribute__((const, overloadable))max(short2 a, short2 b) {
- short2 tmp;
- tmp.x = (a.x > b.x ? a.x : b.x);
- tmp.y = (a.y > b.y ? a.y : b.y);
- return tmp;
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+static inline short2 __attribute__((const, overloadable))
+    max(short2 a, short2 b) {
+    short2 tmp;
+    tmp.x = (a.x > b.x ? a.x : b.x);
+    tmp.y = (a.y > b.y ? a.y : b.y);
+    return tmp;
 }
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 20))
-/**
- * Returns the maximum value of two arguments.
- *
- * Suppored by API versions 9 - 20
- */
-static ushort2 __attribute__((const, overloadable))max(ushort2 a, ushort2 b) {
- ushort2 tmp;
- tmp.x = (a.x > b.x ? a.x : b.x);
- tmp.y = (a.y > b.y ? a.y : b.y);
- return tmp;
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+static inline ushort2 __attribute__((const, overloadable))
+    max(ushort2 a, ushort2 b) {
+    ushort2 tmp;
+    tmp.x = (a.x > b.x ? a.x : b.x);
+    tmp.y = (a.y > b.y ? a.y : b.y);
+    return tmp;
 }
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 20))
-/**
- * Returns the maximum value of two arguments.
- *
- * Suppored by API versions 9 - 20
- */
-static int2 __attribute__((const, overloadable))max(int2 a, int2 b) {
- int2 tmp;
- tmp.x = (a.x > b.x ? a.x : b.x);
- tmp.y = (a.y > b.y ? a.y : b.y);
- return tmp;
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+static inline int2 __attribute__((const, overloadable))
+    max(int2 a, int2 b) {
+    int2 tmp;
+    tmp.x = (a.x > b.x ? a.x : b.x);
+    tmp.y = (a.y > b.y ? a.y : b.y);
+    return tmp;
 }
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 20))
-/**
- * Returns the maximum value of two arguments.
- *
- * Suppored by API versions 9 - 20
- */
-static uint2 __attribute__((const, overloadable))max(uint2 a, uint2 b) {
- uint2 tmp;
- tmp.x = (a.x > b.x ? a.x : b.x);
- tmp.y = (a.y > b.y ? a.y : b.y);
- return tmp;
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+static inline uint2 __attribute__((const, overloadable))
+    max(uint2 a, uint2 b) {
+    uint2 tmp;
+    tmp.x = (a.x > b.x ? a.x : b.x);
+    tmp.y = (a.y > b.y ? a.y : b.y);
+    return tmp;
 }
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 20))
-/**
- * Returns the maximum value of two arguments.
- *
- * Suppored by API versions 9 - 20
- */
-static char3 __attribute__((const, overloadable))max(char3 a, char3 b) {
- char3 tmp;
- tmp.x = (a.x > b.x ? a.x : b.x);
- tmp.y = (a.y > b.y ? a.y : b.y);
- tmp.z = (a.z > b.z ? a.z : b.z);
- return tmp;
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+static inline char3 __attribute__((const, overloadable))
+    max(char3 a, char3 b) {
+    char3 tmp;
+    tmp.x = (a.x > b.x ? a.x : b.x);
+    tmp.y = (a.y > b.y ? a.y : b.y);
+    tmp.z = (a.z > b.z ? a.z : b.z);
+    return tmp;
 }
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 20))
-/**
- * Returns the maximum value of two arguments.
- *
- * Suppored by API versions 9 - 20
- */
-static uchar3 __attribute__((const, overloadable))max(uchar3 a, uchar3 b) {
- uchar3 tmp;
- tmp.x = (a.x > b.x ? a.x : b.x);
- tmp.y = (a.y > b.y ? a.y : b.y);
- tmp.z = (a.z > b.z ? a.z : b.z);
- return tmp;
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+static inline uchar3 __attribute__((const, overloadable))
+    max(uchar3 a, uchar3 b) {
+    uchar3 tmp;
+    tmp.x = (a.x > b.x ? a.x : b.x);
+    tmp.y = (a.y > b.y ? a.y : b.y);
+    tmp.z = (a.z > b.z ? a.z : b.z);
+    return tmp;
 }
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 20))
-/**
- * Returns the maximum value of two arguments.
- *
- * Suppored by API versions 9 - 20
- */
-static short3 __attribute__((const, overloadable))max(short3 a, short3 b) {
- short3 tmp;
- tmp.x = (a.x > b.x ? a.x : b.x);
- tmp.y = (a.y > b.y ? a.y : b.y);
- tmp.z = (a.z > b.z ? a.z : b.z);
- return tmp;
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+static inline short3 __attribute__((const, overloadable))
+    max(short3 a, short3 b) {
+    short3 tmp;
+    tmp.x = (a.x > b.x ? a.x : b.x);
+    tmp.y = (a.y > b.y ? a.y : b.y);
+    tmp.z = (a.z > b.z ? a.z : b.z);
+    return tmp;
 }
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 20))
-/**
- * Returns the maximum value of two arguments.
- *
- * Suppored by API versions 9 - 20
- */
-static ushort3 __attribute__((const, overloadable))max(ushort3 a, ushort3 b) {
- ushort3 tmp;
- tmp.x = (a.x > b.x ? a.x : b.x);
- tmp.y = (a.y > b.y ? a.y : b.y);
- tmp.z = (a.z > b.z ? a.z : b.z);
- return tmp;
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+static inline ushort3 __attribute__((const, overloadable))
+    max(ushort3 a, ushort3 b) {
+    ushort3 tmp;
+    tmp.x = (a.x > b.x ? a.x : b.x);
+    tmp.y = (a.y > b.y ? a.y : b.y);
+    tmp.z = (a.z > b.z ? a.z : b.z);
+    return tmp;
 }
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 20))
-/**
- * Returns the maximum value of two arguments.
- *
- * Suppored by API versions 9 - 20
- */
-static int3 __attribute__((const, overloadable))max(int3 a, int3 b) {
- int3 tmp;
- tmp.x = (a.x > b.x ? a.x : b.x);
- tmp.y = (a.y > b.y ? a.y : b.y);
- tmp.z = (a.z > b.z ? a.z : b.z);
- return tmp;
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+static inline int3 __attribute__((const, overloadable))
+    max(int3 a, int3 b) {
+    int3 tmp;
+    tmp.x = (a.x > b.x ? a.x : b.x);
+    tmp.y = (a.y > b.y ? a.y : b.y);
+    tmp.z = (a.z > b.z ? a.z : b.z);
+    return tmp;
 }
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 20))
-/**
- * Returns the maximum value of two arguments.
- *
- * Suppored by API versions 9 - 20
- */
-static uint3 __attribute__((const, overloadable))max(uint3 a, uint3 b) {
- uint3 tmp;
- tmp.x = (a.x > b.x ? a.x : b.x);
- tmp.y = (a.y > b.y ? a.y : b.y);
- tmp.z = (a.z > b.z ? a.z : b.z);
- return tmp;
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+static inline uint3 __attribute__((const, overloadable))
+    max(uint3 a, uint3 b) {
+    uint3 tmp;
+    tmp.x = (a.x > b.x ? a.x : b.x);
+    tmp.y = (a.y > b.y ? a.y : b.y);
+    tmp.z = (a.z > b.z ? a.z : b.z);
+    return tmp;
 }
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 20))
-/**
- * Returns the maximum value of two arguments.
- *
- * Suppored by API versions 9 - 20
- */
-static char4 __attribute__((const, overloadable))max(char4 a, char4 b) {
- char4 tmp;
- tmp.x = (a.x > b.x ? a.x : b.x);
- tmp.y = (a.y > b.y ? a.y : b.y);
- tmp.z = (a.z > b.z ? a.z : b.z);
- tmp.w = (a.w > b.w ? a.w : b.w);
- return tmp;
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+static inline char4 __attribute__((const, overloadable))
+    max(char4 a, char4 b) {
+    char4 tmp;
+    tmp.x = (a.x > b.x ? a.x : b.x);
+    tmp.y = (a.y > b.y ? a.y : b.y);
+    tmp.z = (a.z > b.z ? a.z : b.z);
+    tmp.w = (a.w > b.w ? a.w : b.w);
+    return tmp;
 }
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 20))
-/**
- * Returns the maximum value of two arguments.
- *
- * Suppored by API versions 9 - 20
- */
-static uchar4 __attribute__((const, overloadable))max(uchar4 a, uchar4 b) {
- uchar4 tmp;
- tmp.x = (a.x > b.x ? a.x : b.x);
- tmp.y = (a.y > b.y ? a.y : b.y);
- tmp.z = (a.z > b.z ? a.z : b.z);
- tmp.w = (a.w > b.w ? a.w : b.w);
- return tmp;
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+static inline uchar4 __attribute__((const, overloadable))
+    max(uchar4 a, uchar4 b) {
+    uchar4 tmp;
+    tmp.x = (a.x > b.x ? a.x : b.x);
+    tmp.y = (a.y > b.y ? a.y : b.y);
+    tmp.z = (a.z > b.z ? a.z : b.z);
+    tmp.w = (a.w > b.w ? a.w : b.w);
+    return tmp;
 }
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 20))
-/**
- * Returns the maximum value of two arguments.
- *
- * Suppored by API versions 9 - 20
- */
-static short4 __attribute__((const, overloadable))max(short4 a, short4 b) {
- short4 tmp;
- tmp.x = (a.x > b.x ? a.x : b.x);
- tmp.y = (a.y > b.y ? a.y : b.y);
- tmp.z = (a.z > b.z ? a.z : b.z);
- tmp.w = (a.w > b.w ? a.w : b.w);
- return tmp;
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+static inline short4 __attribute__((const, overloadable))
+    max(short4 a, short4 b) {
+    short4 tmp;
+    tmp.x = (a.x > b.x ? a.x : b.x);
+    tmp.y = (a.y > b.y ? a.y : b.y);
+    tmp.z = (a.z > b.z ? a.z : b.z);
+    tmp.w = (a.w > b.w ? a.w : b.w);
+    return tmp;
 }
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 20))
-/**
- * Returns the maximum value of two arguments.
- *
- * Suppored by API versions 9 - 20
- */
-static ushort4 __attribute__((const, overloadable))max(ushort4 a, ushort4 b) {
- ushort4 tmp;
- tmp.x = (a.x > b.x ? a.x : b.x);
- tmp.y = (a.y > b.y ? a.y : b.y);
- tmp.z = (a.z > b.z ? a.z : b.z);
- tmp.w = (a.w > b.w ? a.w : b.w);
- return tmp;
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+static inline ushort4 __attribute__((const, overloadable))
+    max(ushort4 a, ushort4 b) {
+    ushort4 tmp;
+    tmp.x = (a.x > b.x ? a.x : b.x);
+    tmp.y = (a.y > b.y ? a.y : b.y);
+    tmp.z = (a.z > b.z ? a.z : b.z);
+    tmp.w = (a.w > b.w ? a.w : b.w);
+    return tmp;
 }
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 20))
-/**
- * Returns the maximum value of two arguments.
- *
- * Suppored by API versions 9 - 20
- */
-static int4 __attribute__((const, overloadable))max(int4 a, int4 b) {
- int4 tmp;
- tmp.x = (a.x > b.x ? a.x : b.x);
- tmp.y = (a.y > b.y ? a.y : b.y);
- tmp.z = (a.z > b.z ? a.z : b.z);
- tmp.w = (a.w > b.w ? a.w : b.w);
- return tmp;
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+static inline int4 __attribute__((const, overloadable))
+    max(int4 a, int4 b) {
+    int4 tmp;
+    tmp.x = (a.x > b.x ? a.x : b.x);
+    tmp.y = (a.y > b.y ? a.y : b.y);
+    tmp.z = (a.z > b.z ? a.z : b.z);
+    tmp.w = (a.w > b.w ? a.w : b.w);
+    return tmp;
 }
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 20))
-/**
- * Returns the maximum value of two arguments.
- *
- * Suppored by API versions 9 - 20
- */
-static uint4 __attribute__((const, overloadable))max(uint4 a, uint4 b) {
- uint4 tmp;
- tmp.x = (a.x > b.x ? a.x : b.x);
- tmp.y = (a.y > b.y ? a.y : b.y);
- tmp.z = (a.z > b.z ? a.z : b.z);
- tmp.w = (a.w > b.w ? a.w : b.w);
- return tmp;
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+static inline uint4 __attribute__((const, overloadable))
+    max(uint4 a, uint4 b) {
+    uint4 tmp;
+    tmp.x = (a.x > b.x ? a.x : b.x);
+    tmp.y = (a.y > b.y ? a.y : b.y);
+    tmp.z = (a.z > b.z ? a.z : b.z);
+    tmp.w = (a.w > b.w ? a.w : b.w);
+    return tmp;
 }
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the maximum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern char __attribute__((const, overloadable))max(char a, char b);
+extern char __attribute__((const, overloadable))
+    max(char a, char b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the maximum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern char2 __attribute__((const, overloadable))max(char2 a, char2 b);
+extern char2 __attribute__((const, overloadable))
+    max(char2 a, char2 b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the maximum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern char3 __attribute__((const, overloadable))max(char3 a, char3 b);
+extern char3 __attribute__((const, overloadable))
+    max(char3 a, char3 b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the maximum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern char4 __attribute__((const, overloadable))max(char4 a, char4 b);
+extern char4 __attribute__((const, overloadable))
+    max(char4 a, char4 b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the maximum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern uchar __attribute__((const, overloadable))max(uchar a, uchar b);
+extern uchar __attribute__((const, overloadable))
+    max(uchar a, uchar b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the maximum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern uchar2 __attribute__((const, overloadable))max(uchar2 a, uchar2 b);
+extern uchar2 __attribute__((const, overloadable))
+    max(uchar2 a, uchar2 b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the maximum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern uchar3 __attribute__((const, overloadable))max(uchar3 a, uchar3 b);
+extern uchar3 __attribute__((const, overloadable))
+    max(uchar3 a, uchar3 b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the maximum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern uchar4 __attribute__((const, overloadable))max(uchar4 a, uchar4 b);
+extern uchar4 __attribute__((const, overloadable))
+    max(uchar4 a, uchar4 b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the maximum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern short __attribute__((const, overloadable))max(short a, short b);
+extern short __attribute__((const, overloadable))
+    max(short a, short b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the maximum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern short2 __attribute__((const, overloadable))max(short2 a, short2 b);
+extern short2 __attribute__((const, overloadable))
+    max(short2 a, short2 b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the maximum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern short3 __attribute__((const, overloadable))max(short3 a, short3 b);
+extern short3 __attribute__((const, overloadable))
+    max(short3 a, short3 b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the maximum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern short4 __attribute__((const, overloadable))max(short4 a, short4 b);
+extern short4 __attribute__((const, overloadable))
+    max(short4 a, short4 b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the maximum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern ushort __attribute__((const, overloadable))max(ushort a, ushort b);
+extern ushort __attribute__((const, overloadable))
+    max(ushort a, ushort b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the maximum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern ushort2 __attribute__((const, overloadable))max(ushort2 a, ushort2 b);
+extern ushort2 __attribute__((const, overloadable))
+    max(ushort2 a, ushort2 b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the maximum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern ushort3 __attribute__((const, overloadable))max(ushort3 a, ushort3 b);
+extern ushort3 __attribute__((const, overloadable))
+    max(ushort3 a, ushort3 b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the maximum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern ushort4 __attribute__((const, overloadable))max(ushort4 a, ushort4 b);
+extern ushort4 __attribute__((const, overloadable))
+    max(ushort4 a, ushort4 b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the maximum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern int __attribute__((const, overloadable))max(int a, int b);
+extern int __attribute__((const, overloadable))
+    max(int a, int b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the maximum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern int2 __attribute__((const, overloadable))max(int2 a, int2 b);
+extern int2 __attribute__((const, overloadable))
+    max(int2 a, int2 b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the maximum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern int3 __attribute__((const, overloadable))max(int3 a, int3 b);
+extern int3 __attribute__((const, overloadable))
+    max(int3 a, int3 b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the maximum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern int4 __attribute__((const, overloadable))max(int4 a, int4 b);
+extern int4 __attribute__((const, overloadable))
+    max(int4 a, int4 b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the maximum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern uint __attribute__((const, overloadable))max(uint a, uint b);
+extern uint __attribute__((const, overloadable))
+    max(uint a, uint b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the maximum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern uint2 __attribute__((const, overloadable))max(uint2 a, uint2 b);
+extern uint2 __attribute__((const, overloadable))
+    max(uint2 a, uint2 b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the maximum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern uint3 __attribute__((const, overloadable))max(uint3 a, uint3 b);
+extern uint3 __attribute__((const, overloadable))
+    max(uint3 a, uint3 b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the maximum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern uint4 __attribute__((const, overloadable))max(uint4 a, uint4 b);
+extern uint4 __attribute__((const, overloadable))
+    max(uint4 a, uint4 b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the maximum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern long __attribute__((const, overloadable))max(long a, long b);
+extern long __attribute__((const, overloadable))
+    max(long a, long b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the maximum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern long2 __attribute__((const, overloadable))max(long2 a, long2 b);
+extern long2 __attribute__((const, overloadable))
+    max(long2 a, long2 b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the maximum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern long3 __attribute__((const, overloadable))max(long3 a, long3 b);
+extern long3 __attribute__((const, overloadable))
+    max(long3 a, long3 b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the maximum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern long4 __attribute__((const, overloadable))max(long4 a, long4 b);
+extern long4 __attribute__((const, overloadable))
+    max(long4 a, long4 b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the maximum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern ulong __attribute__((const, overloadable))max(ulong a, ulong b);
+extern ulong __attribute__((const, overloadable))
+    max(ulong a, ulong b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the maximum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern ulong2 __attribute__((const, overloadable))max(ulong2 a, ulong2 b);
+extern ulong2 __attribute__((const, overloadable))
+    max(ulong2 a, ulong2 b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the maximum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern ulong3 __attribute__((const, overloadable))max(ulong3 a, ulong3 b);
+extern ulong3 __attribute__((const, overloadable))
+    max(ulong3 a, ulong3 b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the maximum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern ulong4 __attribute__((const, overloadable))max(ulong4 a, ulong4 b);
+extern ulong4 __attribute__((const, overloadable))
+    max(ulong4 a, ulong4 b);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
+/*
+ * min: Minimum
+ *
  * Returns the minimum value of two arguments.
- *
- * Supported by API versions 9 and newer.
  */
-extern float __attribute__((const, overloadable))min(float a, float b);
-#endif
+extern float __attribute__((const, overloadable))
+    min(float a, float b);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the minimum value of two arguments.
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))min(float2 a, float2 b);
-#endif
+extern float2 __attribute__((const, overloadable))
+    min(float2 a, float2 b);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the minimum value of two arguments.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))min(float3 a, float3 b);
-#endif
+extern float3 __attribute__((const, overloadable))
+    min(float3 a, float3 b);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the minimum value of two arguments.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))min(float4 a, float4 b);
-#endif
+extern float4 __attribute__((const, overloadable))
+    min(float4 a, float4 b);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 20))
-/**
- * Returns the minimum value of two arguments.
- *
- * Suppored by API versions 9 - 20
- */
-static char __attribute__((const, overloadable))min(char a, char b) {
- return (a < b ? a : b);
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+static inline char __attribute__((const, overloadable))
+    min(char a, char b) {
+    return (a < b ? a : b);
 }
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 20))
-/**
- * Returns the minimum value of two arguments.
- *
- * Suppored by API versions 9 - 20
- */
-static uchar __attribute__((const, overloadable))min(uchar a, uchar b) {
- return (a < b ? a : b);
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+static inline uchar __attribute__((const, overloadable))
+    min(uchar a, uchar b) {
+    return (a < b ? a : b);
 }
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 20))
-/**
- * Returns the minimum value of two arguments.
- *
- * Suppored by API versions 9 - 20
- */
-static short __attribute__((const, overloadable))min(short a, short b) {
- return (a < b ? a : b);
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+static inline short __attribute__((const, overloadable))
+    min(short a, short b) {
+    return (a < b ? a : b);
 }
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 20))
-/**
- * Returns the minimum value of two arguments.
- *
- * Suppored by API versions 9 - 20
- */
-static ushort __attribute__((const, overloadable))min(ushort a, ushort b) {
- return (a < b ? a : b);
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+static inline ushort __attribute__((const, overloadable))
+    min(ushort a, ushort b) {
+    return (a < b ? a : b);
 }
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 20))
-/**
- * Returns the minimum value of two arguments.
- *
- * Suppored by API versions 9 - 20
- */
-static int __attribute__((const, overloadable))min(int a, int b) {
- return (a < b ? a : b);
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+static inline int __attribute__((const, overloadable))
+    min(int a, int b) {
+    return (a < b ? a : b);
 }
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 20))
-/**
- * Returns the minimum value of two arguments.
- *
- * Suppored by API versions 9 - 20
- */
-static uint __attribute__((const, overloadable))min(uint a, uint b) {
- return (a < b ? a : b);
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+static inline uint __attribute__((const, overloadable))
+    min(uint a, uint b) {
+    return (a < b ? a : b);
 }
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 20))
-/**
- * Returns the minimum value of two arguments.
- *
- * Suppored by API versions 9 - 20
- */
-static char2 __attribute__((const, overloadable))min(char2 a, char2 b) {
- char2 tmp;
- tmp.x = (a.x < b.x ? a.x : b.x);
- tmp.y = (a.y < b.y ? a.y : b.y);
- return tmp;
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+static inline char2 __attribute__((const, overloadable))
+    min(char2 a, char2 b) {
+    char2 tmp;
+    tmp.x = (a.x < b.x ? a.x : b.x);
+    tmp.y = (a.y < b.y ? a.y : b.y);
+    return tmp;
 }
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 20))
-/**
- * Returns the minimum value of two arguments.
- *
- * Suppored by API versions 9 - 20
- */
-static uchar2 __attribute__((const, overloadable))min(uchar2 a, uchar2 b) {
- uchar2 tmp;
- tmp.x = (a.x < b.x ? a.x : b.x);
- tmp.y = (a.y < b.y ? a.y : b.y);
- return tmp;
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+static inline uchar2 __attribute__((const, overloadable))
+    min(uchar2 a, uchar2 b) {
+    uchar2 tmp;
+    tmp.x = (a.x < b.x ? a.x : b.x);
+    tmp.y = (a.y < b.y ? a.y : b.y);
+    return tmp;
 }
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 20))
-/**
- * Returns the minimum value of two arguments.
- *
- * Suppored by API versions 9 - 20
- */
-static short2 __attribute__((const, overloadable))min(short2 a, short2 b) {
- short2 tmp;
- tmp.x = (a.x < b.x ? a.x : b.x);
- tmp.y = (a.y < b.y ? a.y : b.y);
- return tmp;
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+static inline short2 __attribute__((const, overloadable))
+    min(short2 a, short2 b) {
+    short2 tmp;
+    tmp.x = (a.x < b.x ? a.x : b.x);
+    tmp.y = (a.y < b.y ? a.y : b.y);
+    return tmp;
 }
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 20))
-/**
- * Returns the minimum value of two arguments.
- *
- * Suppored by API versions 9 - 20
- */
-static ushort2 __attribute__((const, overloadable))min(ushort2 a, ushort2 b) {
- ushort2 tmp;
- tmp.x = (a.x < b.x ? a.x : b.x);
- tmp.y = (a.y < b.y ? a.y : b.y);
- return tmp;
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+static inline ushort2 __attribute__((const, overloadable))
+    min(ushort2 a, ushort2 b) {
+    ushort2 tmp;
+    tmp.x = (a.x < b.x ? a.x : b.x);
+    tmp.y = (a.y < b.y ? a.y : b.y);
+    return tmp;
 }
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 20))
-/**
- * Returns the minimum value of two arguments.
- *
- * Suppored by API versions 9 - 20
- */
-static int2 __attribute__((const, overloadable))min(int2 a, int2 b) {
- int2 tmp;
- tmp.x = (a.x < b.x ? a.x : b.x);
- tmp.y = (a.y < b.y ? a.y : b.y);
- return tmp;
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+static inline int2 __attribute__((const, overloadable))
+    min(int2 a, int2 b) {
+    int2 tmp;
+    tmp.x = (a.x < b.x ? a.x : b.x);
+    tmp.y = (a.y < b.y ? a.y : b.y);
+    return tmp;
 }
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 20))
-/**
- * Returns the minimum value of two arguments.
- *
- * Suppored by API versions 9 - 20
- */
-static uint2 __attribute__((const, overloadable))min(uint2 a, uint2 b) {
- uint2 tmp;
- tmp.x = (a.x < b.x ? a.x : b.x);
- tmp.y = (a.y < b.y ? a.y : b.y);
- return tmp;
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+static inline uint2 __attribute__((const, overloadable))
+    min(uint2 a, uint2 b) {
+    uint2 tmp;
+    tmp.x = (a.x < b.x ? a.x : b.x);
+    tmp.y = (a.y < b.y ? a.y : b.y);
+    return tmp;
 }
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 20))
-/**
- * Returns the minimum value of two arguments.
- *
- * Suppored by API versions 9 - 20
- */
-static char3 __attribute__((const, overloadable))min(char3 a, char3 b) {
- char3 tmp;
- tmp.x = (a.x < b.x ? a.x : b.x);
- tmp.y = (a.y < b.y ? a.y : b.y);
- tmp.z = (a.z < b.z ? a.z : b.z);
- return tmp;
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+static inline char3 __attribute__((const, overloadable))
+    min(char3 a, char3 b) {
+    char3 tmp;
+    tmp.x = (a.x < b.x ? a.x : b.x);
+    tmp.y = (a.y < b.y ? a.y : b.y);
+    tmp.z = (a.z < b.z ? a.z : b.z);
+    return tmp;
 }
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 20))
-/**
- * Returns the minimum value of two arguments.
- *
- * Suppored by API versions 9 - 20
- */
-static uchar3 __attribute__((const, overloadable))min(uchar3 a, uchar3 b) {
- uchar3 tmp;
- tmp.x = (a.x < b.x ? a.x : b.x);
- tmp.y = (a.y < b.y ? a.y : b.y);
- tmp.z = (a.z < b.z ? a.z : b.z);
- return tmp;
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+static inline uchar3 __attribute__((const, overloadable))
+    min(uchar3 a, uchar3 b) {
+    uchar3 tmp;
+    tmp.x = (a.x < b.x ? a.x : b.x);
+    tmp.y = (a.y < b.y ? a.y : b.y);
+    tmp.z = (a.z < b.z ? a.z : b.z);
+    return tmp;
 }
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 20))
-/**
- * Returns the minimum value of two arguments.
- *
- * Suppored by API versions 9 - 20
- */
-static short3 __attribute__((const, overloadable))min(short3 a, short3 b) {
- short3 tmp;
- tmp.x = (a.x < b.x ? a.x : b.x);
- tmp.y = (a.y < b.y ? a.y : b.y);
- tmp.z = (a.z < b.z ? a.z : b.z);
- return tmp;
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+static inline short3 __attribute__((const, overloadable))
+    min(short3 a, short3 b) {
+    short3 tmp;
+    tmp.x = (a.x < b.x ? a.x : b.x);
+    tmp.y = (a.y < b.y ? a.y : b.y);
+    tmp.z = (a.z < b.z ? a.z : b.z);
+    return tmp;
 }
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 20))
-/**
- * Returns the minimum value of two arguments.
- *
- * Suppored by API versions 9 - 20
- */
-static ushort3 __attribute__((const, overloadable))min(ushort3 a, ushort3 b) {
- ushort3 tmp;
- tmp.x = (a.x < b.x ? a.x : b.x);
- tmp.y = (a.y < b.y ? a.y : b.y);
- tmp.z = (a.z < b.z ? a.z : b.z);
- return tmp;
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+static inline ushort3 __attribute__((const, overloadable))
+    min(ushort3 a, ushort3 b) {
+    ushort3 tmp;
+    tmp.x = (a.x < b.x ? a.x : b.x);
+    tmp.y = (a.y < b.y ? a.y : b.y);
+    tmp.z = (a.z < b.z ? a.z : b.z);
+    return tmp;
 }
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 20))
-/**
- * Returns the minimum value of two arguments.
- *
- * Suppored by API versions 9 - 20
- */
-static int3 __attribute__((const, overloadable))min(int3 a, int3 b) {
- int3 tmp;
- tmp.x = (a.x < b.x ? a.x : b.x);
- tmp.y = (a.y < b.y ? a.y : b.y);
- tmp.z = (a.z < b.z ? a.z : b.z);
- return tmp;
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+static inline int3 __attribute__((const, overloadable))
+    min(int3 a, int3 b) {
+    int3 tmp;
+    tmp.x = (a.x < b.x ? a.x : b.x);
+    tmp.y = (a.y < b.y ? a.y : b.y);
+    tmp.z = (a.z < b.z ? a.z : b.z);
+    return tmp;
 }
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 20))
-/**
- * Returns the minimum value of two arguments.
- *
- * Suppored by API versions 9 - 20
- */
-static uint3 __attribute__((const, overloadable))min(uint3 a, uint3 b) {
- uint3 tmp;
- tmp.x = (a.x < b.x ? a.x : b.x);
- tmp.y = (a.y < b.y ? a.y : b.y);
- tmp.z = (a.z < b.z ? a.z : b.z);
- return tmp;
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+static inline uint3 __attribute__((const, overloadable))
+    min(uint3 a, uint3 b) {
+    uint3 tmp;
+    tmp.x = (a.x < b.x ? a.x : b.x);
+    tmp.y = (a.y < b.y ? a.y : b.y);
+    tmp.z = (a.z < b.z ? a.z : b.z);
+    return tmp;
 }
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 20))
-/**
- * Returns the minimum value of two arguments.
- *
- * Suppored by API versions 9 - 20
- */
-static char4 __attribute__((const, overloadable))min(char4 a, char4 b) {
- char4 tmp;
- tmp.x = (a.x < b.x ? a.x : b.x);
- tmp.y = (a.y < b.y ? a.y : b.y);
- tmp.z = (a.z < b.z ? a.z : b.z);
- tmp.w = (a.w < b.w ? a.w : b.w);
- return tmp;
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+static inline char4 __attribute__((const, overloadable))
+    min(char4 a, char4 b) {
+    char4 tmp;
+    tmp.x = (a.x < b.x ? a.x : b.x);
+    tmp.y = (a.y < b.y ? a.y : b.y);
+    tmp.z = (a.z < b.z ? a.z : b.z);
+    tmp.w = (a.w < b.w ? a.w : b.w);
+    return tmp;
 }
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 20))
-/**
- * Returns the minimum value of two arguments.
- *
- * Suppored by API versions 9 - 20
- */
-static uchar4 __attribute__((const, overloadable))min(uchar4 a, uchar4 b) {
- uchar4 tmp;
- tmp.x = (a.x < b.x ? a.x : b.x);
- tmp.y = (a.y < b.y ? a.y : b.y);
- tmp.z = (a.z < b.z ? a.z : b.z);
- tmp.w = (a.w < b.w ? a.w : b.w);
- return tmp;
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+static inline uchar4 __attribute__((const, overloadable))
+    min(uchar4 a, uchar4 b) {
+    uchar4 tmp;
+    tmp.x = (a.x < b.x ? a.x : b.x);
+    tmp.y = (a.y < b.y ? a.y : b.y);
+    tmp.z = (a.z < b.z ? a.z : b.z);
+    tmp.w = (a.w < b.w ? a.w : b.w);
+    return tmp;
 }
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 20))
-/**
- * Returns the minimum value of two arguments.
- *
- * Suppored by API versions 9 - 20
- */
-static short4 __attribute__((const, overloadable))min(short4 a, short4 b) {
- short4 tmp;
- tmp.x = (a.x < b.x ? a.x : b.x);
- tmp.y = (a.y < b.y ? a.y : b.y);
- tmp.z = (a.z < b.z ? a.z : b.z);
- tmp.w = (a.w < b.w ? a.w : b.w);
- return tmp;
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+static inline short4 __attribute__((const, overloadable))
+    min(short4 a, short4 b) {
+    short4 tmp;
+    tmp.x = (a.x < b.x ? a.x : b.x);
+    tmp.y = (a.y < b.y ? a.y : b.y);
+    tmp.z = (a.z < b.z ? a.z : b.z);
+    tmp.w = (a.w < b.w ? a.w : b.w);
+    return tmp;
 }
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 20))
-/**
- * Returns the minimum value of two arguments.
- *
- * Suppored by API versions 9 - 20
- */
-static ushort4 __attribute__((const, overloadable))min(ushort4 a, ushort4 b) {
- ushort4 tmp;
- tmp.x = (a.x < b.x ? a.x : b.x);
- tmp.y = (a.y < b.y ? a.y : b.y);
- tmp.z = (a.z < b.z ? a.z : b.z);
- tmp.w = (a.w < b.w ? a.w : b.w);
- return tmp;
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+static inline ushort4 __attribute__((const, overloadable))
+    min(ushort4 a, ushort4 b) {
+    ushort4 tmp;
+    tmp.x = (a.x < b.x ? a.x : b.x);
+    tmp.y = (a.y < b.y ? a.y : b.y);
+    tmp.z = (a.z < b.z ? a.z : b.z);
+    tmp.w = (a.w < b.w ? a.w : b.w);
+    return tmp;
 }
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 20))
-/**
- * Returns the minimum value of two arguments.
- *
- * Suppored by API versions 9 - 20
- */
-static int4 __attribute__((const, overloadable))min(int4 a, int4 b) {
- int4 tmp;
- tmp.x = (a.x < b.x ? a.x : b.x);
- tmp.y = (a.y < b.y ? a.y : b.y);
- tmp.z = (a.z < b.z ? a.z : b.z);
- tmp.w = (a.w < b.w ? a.w : b.w);
- return tmp;
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+static inline int4 __attribute__((const, overloadable))
+    min(int4 a, int4 b) {
+    int4 tmp;
+    tmp.x = (a.x < b.x ? a.x : b.x);
+    tmp.y = (a.y < b.y ? a.y : b.y);
+    tmp.z = (a.z < b.z ? a.z : b.z);
+    tmp.w = (a.w < b.w ? a.w : b.w);
+    return tmp;
 }
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9) && (RS_VERSION <= 20))
-/**
- * Returns the minimum value of two arguments.
- *
- * Suppored by API versions 9 - 20
- */
-static uint4 __attribute__((const, overloadable))min(uint4 a, uint4 b) {
- uint4 tmp;
- tmp.x = (a.x < b.x ? a.x : b.x);
- tmp.y = (a.y < b.y ? a.y : b.y);
- tmp.z = (a.z < b.z ? a.z : b.z);
- tmp.w = (a.w < b.w ? a.w : b.w);
- return tmp;
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+static inline uint4 __attribute__((const, overloadable))
+    min(uint4 a, uint4 b) {
+    uint4 tmp;
+    tmp.x = (a.x < b.x ? a.x : b.x);
+    tmp.y = (a.y < b.y ? a.y : b.y);
+    tmp.z = (a.z < b.z ? a.z : b.z);
+    tmp.w = (a.w < b.w ? a.w : b.w);
+    return tmp;
 }
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the minimum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern char __attribute__((const, overloadable))min(char a, char b);
+extern char __attribute__((const, overloadable))
+    min(char a, char b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the minimum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern char2 __attribute__((const, overloadable))min(char2 a, char2 b);
+extern char2 __attribute__((const, overloadable))
+    min(char2 a, char2 b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the minimum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern char3 __attribute__((const, overloadable))min(char3 a, char3 b);
+extern char3 __attribute__((const, overloadable))
+    min(char3 a, char3 b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the minimum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern char4 __attribute__((const, overloadable))min(char4 a, char4 b);
+extern char4 __attribute__((const, overloadable))
+    min(char4 a, char4 b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the minimum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern uchar __attribute__((const, overloadable))min(uchar a, uchar b);
+extern uchar __attribute__((const, overloadable))
+    min(uchar a, uchar b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the minimum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern uchar2 __attribute__((const, overloadable))min(uchar2 a, uchar2 b);
+extern uchar2 __attribute__((const, overloadable))
+    min(uchar2 a, uchar2 b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the minimum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern uchar3 __attribute__((const, overloadable))min(uchar3 a, uchar3 b);
+extern uchar3 __attribute__((const, overloadable))
+    min(uchar3 a, uchar3 b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the minimum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern uchar4 __attribute__((const, overloadable))min(uchar4 a, uchar4 b);
+extern uchar4 __attribute__((const, overloadable))
+    min(uchar4 a, uchar4 b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the minimum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern short __attribute__((const, overloadable))min(short a, short b);
+extern short __attribute__((const, overloadable))
+    min(short a, short b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the minimum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern short2 __attribute__((const, overloadable))min(short2 a, short2 b);
+extern short2 __attribute__((const, overloadable))
+    min(short2 a, short2 b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the minimum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern short3 __attribute__((const, overloadable))min(short3 a, short3 b);
+extern short3 __attribute__((const, overloadable))
+    min(short3 a, short3 b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the minimum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern short4 __attribute__((const, overloadable))min(short4 a, short4 b);
+extern short4 __attribute__((const, overloadable))
+    min(short4 a, short4 b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the minimum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern ushort __attribute__((const, overloadable))min(ushort a, ushort b);
+extern ushort __attribute__((const, overloadable))
+    min(ushort a, ushort b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the minimum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern ushort2 __attribute__((const, overloadable))min(ushort2 a, ushort2 b);
+extern ushort2 __attribute__((const, overloadable))
+    min(ushort2 a, ushort2 b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the minimum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern ushort3 __attribute__((const, overloadable))min(ushort3 a, ushort3 b);
+extern ushort3 __attribute__((const, overloadable))
+    min(ushort3 a, ushort3 b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the minimum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern ushort4 __attribute__((const, overloadable))min(ushort4 a, ushort4 b);
+extern ushort4 __attribute__((const, overloadable))
+    min(ushort4 a, ushort4 b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the minimum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern int __attribute__((const, overloadable))min(int a, int b);
+extern int __attribute__((const, overloadable))
+    min(int a, int b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the minimum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern int2 __attribute__((const, overloadable))min(int2 a, int2 b);
+extern int2 __attribute__((const, overloadable))
+    min(int2 a, int2 b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the minimum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern int3 __attribute__((const, overloadable))min(int3 a, int3 b);
+extern int3 __attribute__((const, overloadable))
+    min(int3 a, int3 b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the minimum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern int4 __attribute__((const, overloadable))min(int4 a, int4 b);
+extern int4 __attribute__((const, overloadable))
+    min(int4 a, int4 b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the minimum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern uint __attribute__((const, overloadable))min(uint a, uint b);
+extern uint __attribute__((const, overloadable))
+    min(uint a, uint b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the minimum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern uint2 __attribute__((const, overloadable))min(uint2 a, uint2 b);
+extern uint2 __attribute__((const, overloadable))
+    min(uint2 a, uint2 b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the minimum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern uint3 __attribute__((const, overloadable))min(uint3 a, uint3 b);
+extern uint3 __attribute__((const, overloadable))
+    min(uint3 a, uint3 b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the minimum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern uint4 __attribute__((const, overloadable))min(uint4 a, uint4 b);
+extern uint4 __attribute__((const, overloadable))
+    min(uint4 a, uint4 b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the minimum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern long __attribute__((const, overloadable))min(long a, long b);
+extern long __attribute__((const, overloadable))
+    min(long a, long b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the minimum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern long2 __attribute__((const, overloadable))min(long2 a, long2 b);
+extern long2 __attribute__((const, overloadable))
+    min(long2 a, long2 b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the minimum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern long3 __attribute__((const, overloadable))min(long3 a, long3 b);
+extern long3 __attribute__((const, overloadable))
+    min(long3 a, long3 b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the minimum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern long4 __attribute__((const, overloadable))min(long4 a, long4 b);
+extern long4 __attribute__((const, overloadable))
+    min(long4 a, long4 b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the minimum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern ulong __attribute__((const, overloadable))min(ulong a, ulong b);
+extern ulong __attribute__((const, overloadable))
+    min(ulong a, ulong b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the minimum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern ulong2 __attribute__((const, overloadable))min(ulong2 a, ulong2 b);
+extern ulong2 __attribute__((const, overloadable))
+    min(ulong2 a, ulong2 b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the minimum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern ulong3 __attribute__((const, overloadable))min(ulong3 a, ulong3 b);
+extern ulong3 __attribute__((const, overloadable))
+    min(ulong3 a, ulong3 b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the minimum value of two arguments.
- *
- * Supported by API versions 21 and newer.
- */
-extern ulong4 __attribute__((const, overloadable))min(ulong4 a, ulong4 b);
+extern ulong4 __attribute__((const, overloadable))
+    min(ulong4 a, ulong4 b);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
+/*
+ * mix: Mixes two values
+ *
  * Returns start + ((stop - start) * fraction).
  *
  * This can be useful for mixing two values.  For example, to create a new color that is 40% color1 and 60% color2, use mix(color1, color2, 0.6f).
- *
- * Supported by API versions 9 and newer.
  */
-extern float __attribute__((const, overloadable))mix(float start, float stop, float fraction);
-#endif
+extern float __attribute__((const, overloadable))
+    mix(float start, float stop, float fraction);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns start + ((stop - start) * fraction).
- *
- * This can be useful for mixing two values.  For example, to create a new color that is 40% color1 and 60% color2, use mix(color1, color2, 0.6f).
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))mix(float2 start, float2 stop, float2 fraction);
-#endif
+extern float2 __attribute__((const, overloadable))
+    mix(float2 start, float2 stop, float2 fraction);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns start + ((stop - start) * fraction).
- *
- * This can be useful for mixing two values.  For example, to create a new color that is 40% color1 and 60% color2, use mix(color1, color2, 0.6f).
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))mix(float3 start, float3 stop, float3 fraction);
-#endif
+extern float3 __attribute__((const, overloadable))
+    mix(float3 start, float3 stop, float3 fraction);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns start + ((stop - start) * fraction).
- *
- * This can be useful for mixing two values.  For example, to create a new color that is 40% color1 and 60% color2, use mix(color1, color2, 0.6f).
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))mix(float4 start, float4 stop, float4 fraction);
-#endif
+extern float4 __attribute__((const, overloadable))
+    mix(float4 start, float4 stop, float4 fraction);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns start + ((stop - start) * fraction).
- *
- * This can be useful for mixing two values.  For example, to create a new color that is 40% color1 and 60% color2, use mix(color1, color2, 0.6f).
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))mix(float2 start, float2 stop, float fraction);
-#endif
+extern float2 __attribute__((const, overloadable))
+    mix(float2 start, float2 stop, float fraction);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns start + ((stop - start) * fraction).
- *
- * This can be useful for mixing two values.  For example, to create a new color that is 40% color1 and 60% color2, use mix(color1, color2, 0.6f).
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))mix(float3 start, float3 stop, float fraction);
-#endif
+extern float3 __attribute__((const, overloadable))
+    mix(float3 start, float3 stop, float fraction);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns start + ((stop - start) * fraction).
- *
- * This can be useful for mixing two values.  For example, to create a new color that is 40% color1 and 60% color2, use mix(color1, color2, 0.6f).
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))mix(float4 start, float4 stop, float fraction);
-#endif
+extern float4 __attribute__((const, overloadable))
+    mix(float4 start, float4 stop, float fraction);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
+/*
+ * modf: Integral and fractional components
+ *
  * Returns the integral and fractional components of a number.
  *
  * Both components will have the same sign as x.  For example, for an input of -3.72f, iret will be set to -3.f and .72f will be returned.
  *
- * @param v Source value
- * @param integral_part integral_part[0] will be set to the integral portion of the number.
- * @return The floating point portion of the value.
+ * Parameters:
+ *   v Source value
+ *   integral_part *integral_part will be set to the integral portion of the number.
  *
- * Supported by API versions 9 and newer.
+ * Returns: The floating point portion of the value.
  */
-extern float __attribute__((overloadable))modf(float v, float* integral_part);
-#endif
+extern float __attribute__((overloadable))
+    modf(float v, float* integral_part);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the integral and fractional components of a number.
- *
- * Both components will have the same sign as x.  For example, for an input of -3.72f, iret will be set to -3.f and .72f will be returned.
- *
- * @param v Source value
- * @param integral_part integral_part[0] will be set to the integral portion of the number.
- * @return The floating point portion of the value.
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((overloadable))modf(float2 v, float2* integral_part);
-#endif
+extern float2 __attribute__((overloadable))
+    modf(float2 v, float2* integral_part);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the integral and fractional components of a number.
- *
- * Both components will have the same sign as x.  For example, for an input of -3.72f, iret will be set to -3.f and .72f will be returned.
- *
- * @param v Source value
- * @param integral_part integral_part[0] will be set to the integral portion of the number.
- * @return The floating point portion of the value.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((overloadable))modf(float3 v, float3* integral_part);
-#endif
+extern float3 __attribute__((overloadable))
+    modf(float3 v, float3* integral_part);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the integral and fractional components of a number.
- *
- * Both components will have the same sign as x.  For example, for an input of -3.72f, iret will be set to -3.f and .72f will be returned.
- *
- * @param v Source value
- * @param integral_part integral_part[0] will be set to the integral portion of the number.
- * @return The floating point portion of the value.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((overloadable))modf(float4 v, float4* integral_part);
-#endif
+extern float4 __attribute__((overloadable))
+    modf(float4 v, float4* integral_part);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
+/*
+ * nan: Not a Number
+ *
  * Returns a NaN value (Not a Number).
  *
- * @param v Not used.
- *
- * Supported by API versions 9 and newer.
+ * Parameters:
+ *   v Not used.
  */
-extern float __attribute__((const, overloadable))nan(uint v);
-#endif
+extern float __attribute__((const, overloadable))
+    nan(uint v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
+/*
+ * native_acos: Approximate inverse cosine
+ *
  * Returns the approximate inverse cosine, in radians.
  *
- * Supported by API versions 21 and newer.
- */
-extern float __attribute__((const, overloadable))native_acos(float v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate inverse cosine, in radians.
+ * This function yields undefined results from input values less than -1 or greater
+ * than 1.
  *
- * Supported by API versions 21 and newer.
+ * See also acos().
  */
-extern float2 __attribute__((const, overloadable))native_acos(float2 v);
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+    native_acos(float v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate inverse cosine, in radians.
+extern float2 __attribute__((const, overloadable))
+    native_acos(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float3 __attribute__((const, overloadable))
+    native_acos(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float4 __attribute__((const, overloadable))
+    native_acos(float4 v);
+#endif
+
+/*
+ * native_acosh: Approximate inverse hyperbolic cosine
  *
- * Supported by API versions 21 and newer.
- */
-extern float3 __attribute__((const, overloadable))native_acos(float3 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate inverse cosine, in radians.
- *
- * Supported by API versions 21 and newer.
- */
-extern float4 __attribute__((const, overloadable))native_acos(float4 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
  * Returns the approximate inverse hyperbolic cosine, in radians.
  *
- * Supported by API versions 21 and newer.
+ * See also acosh().
  */
-extern float __attribute__((const, overloadable))native_acosh(float v);
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+    native_acosh(float v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate inverse hyperbolic cosine, in radians.
+extern float2 __attribute__((const, overloadable))
+    native_acosh(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float3 __attribute__((const, overloadable))
+    native_acosh(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float4 __attribute__((const, overloadable))
+    native_acosh(float4 v);
+#endif
+
+/*
+ * native_acospi: Approximate inverse cosine divided by pi
  *
- * Supported by API versions 21 and newer.
- */
-extern float2 __attribute__((const, overloadable))native_acosh(float2 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate inverse hyperbolic cosine, in radians.
- *
- * Supported by API versions 21 and newer.
- */
-extern float3 __attribute__((const, overloadable))native_acosh(float3 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate inverse hyperbolic cosine, in radians.
- *
- * Supported by API versions 21 and newer.
- */
-extern float4 __attribute__((const, overloadable))native_acosh(float4 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
  * Returns the approximate inverse cosine in radians, divided by pi.
  *
  * To get an inverse cosine measured in degrees, use acospi(a) * 180.f.
  *
- * Supported by API versions 21 and newer.
+ * This function yields undefined results from input values less than -1 or greater
+ * than 1.
+ *
+ * See also acospi().
  */
-extern float __attribute__((const, overloadable))native_acospi(float v);
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+    native_acospi(float v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate inverse cosine in radians, divided by pi.
- *
- * To get an inverse cosine measured in degrees, use acospi(a) * 180.f.
- *
- * Supported by API versions 21 and newer.
- */
-extern float2 __attribute__((const, overloadable))native_acospi(float2 v);
+extern float2 __attribute__((const, overloadable))
+    native_acospi(float2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate inverse cosine in radians, divided by pi.
- *
- * To get an inverse cosine measured in degrees, use acospi(a) * 180.f.
- *
- * Supported by API versions 21 and newer.
- */
-extern float3 __attribute__((const, overloadable))native_acospi(float3 v);
+extern float3 __attribute__((const, overloadable))
+    native_acospi(float3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate inverse cosine in radians, divided by pi.
- *
- * To get an inverse cosine measured in degrees, use acospi(a) * 180.f.
- *
- * Supported by API versions 21 and newer.
- */
-extern float4 __attribute__((const, overloadable))native_acospi(float4 v);
+extern float4 __attribute__((const, overloadable))
+    native_acospi(float4 v);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
+/*
+ * native_asin: Approximate inverse sine
+ *
  * Returns the approximate inverse sine, in radians.
  *
- * Supported by API versions 21 and newer.
- */
-extern float __attribute__((const, overloadable))native_asin(float v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate inverse sine, in radians.
+ * This function yields undefined results from input values less than -1 or greater
+ * than 1.
  *
- * Supported by API versions 21 and newer.
+ * See also asin().
  */
-extern float2 __attribute__((const, overloadable))native_asin(float2 v);
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+    native_asin(float v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate inverse sine, in radians.
+extern float2 __attribute__((const, overloadable))
+    native_asin(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float3 __attribute__((const, overloadable))
+    native_asin(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float4 __attribute__((const, overloadable))
+    native_asin(float4 v);
+#endif
+
+/*
+ * native_asinh: Approximate inverse hyperbolic sine
  *
- * Supported by API versions 21 and newer.
- */
-extern float3 __attribute__((const, overloadable))native_asin(float3 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate inverse sine, in radians.
- *
- * Supported by API versions 21 and newer.
- */
-extern float4 __attribute__((const, overloadable))native_asin(float4 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
  * Returns the approximate inverse hyperbolic sine, in radians.
  *
- * Supported by API versions 21 and newer.
+ * See also asinh().
  */
-extern float __attribute__((const, overloadable))native_asinh(float v);
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+    native_asinh(float v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate inverse hyperbolic sine, in radians.
+extern float2 __attribute__((const, overloadable))
+    native_asinh(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float3 __attribute__((const, overloadable))
+    native_asinh(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float4 __attribute__((const, overloadable))
+    native_asinh(float4 v);
+#endif
+
+/*
+ * native_asinpi: Approximate inverse sine divided by pi
  *
- * Supported by API versions 21 and newer.
- */
-extern float2 __attribute__((const, overloadable))native_asinh(float2 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate inverse hyperbolic sine, in radians.
- *
- * Supported by API versions 21 and newer.
- */
-extern float3 __attribute__((const, overloadable))native_asinh(float3 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate inverse hyperbolic sine, in radians.
- *
- * Supported by API versions 21 and newer.
- */
-extern float4 __attribute__((const, overloadable))native_asinh(float4 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
  * Returns the approximate inverse sine in radians, divided by pi.
  *
  * To get an inverse sine measured in degrees, use asinpi(a) * 180.f.
  *
- * Supported by API versions 21 and newer.
+ * This function yields undefined results from input values less than -1 or greater
+ * than 1.
+ *
+ * See also asinpi().
  */
-extern float __attribute__((const, overloadable))native_asinpi(float v);
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+    native_asinpi(float v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate inverse sine in radians, divided by pi.
- *
- * To get an inverse sine measured in degrees, use asinpi(a) * 180.f.
- *
- * Supported by API versions 21 and newer.
- */
-extern float2 __attribute__((const, overloadable))native_asinpi(float2 v);
+extern float2 __attribute__((const, overloadable))
+    native_asinpi(float2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate inverse sine in radians, divided by pi.
- *
- * To get an inverse sine measured in degrees, use asinpi(a) * 180.f.
- *
- * Supported by API versions 21 and newer.
- */
-extern float3 __attribute__((const, overloadable))native_asinpi(float3 v);
+extern float3 __attribute__((const, overloadable))
+    native_asinpi(float3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate inverse sine in radians, divided by pi.
- *
- * To get an inverse sine measured in degrees, use asinpi(a) * 180.f.
- *
- * Supported by API versions 21 and newer.
- */
-extern float4 __attribute__((const, overloadable))native_asinpi(float4 v);
+extern float4 __attribute__((const, overloadable))
+    native_asinpi(float4 v);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
+/*
+ * native_atan: Approximate inverse tangent
+ *
  * Returns the approximate inverse tangent, in radians.
  *
- * Supported by API versions 21 and newer.
+ * See also atan().
  */
-extern float __attribute__((const, overloadable))native_atan(float v);
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+    native_atan(float v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate inverse tangent, in radians.
- *
- * Supported by API versions 21 and newer.
- */
-extern float2 __attribute__((const, overloadable))native_atan(float2 v);
+extern float2 __attribute__((const, overloadable))
+    native_atan(float2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate inverse tangent, in radians.
- *
- * Supported by API versions 21 and newer.
- */
-extern float3 __attribute__((const, overloadable))native_atan(float3 v);
+extern float3 __attribute__((const, overloadable))
+    native_atan(float3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate inverse tangent, in radians.
+extern float4 __attribute__((const, overloadable))
+    native_atan(float4 v);
+#endif
+
+/*
+ * native_atan2: Approximate inverse tangent of a ratio
  *
- * Supported by API versions 21 and newer.
+ * Returns the approximate inverse tangent of (numerator / denominator), in radians.
+ *
+ * See also atan2().
+ *
+ * Parameters:
+ *   numerator The numerator
+ *   denominator The denominator.  Can be 0.
  */
-extern float4 __attribute__((const, overloadable))native_atan(float4 v);
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+    native_atan2(float numerator, float denominator);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate inverse tangent of numerator / denominator, in radians.
- *
- * denominator can be 0.
- *
- * Supported by API versions 21 and newer.
- */
-extern float __attribute__((const, overloadable))native_atan2(float numerator, float denominator);
+extern float2 __attribute__((const, overloadable))
+    native_atan2(float2 numerator, float2 denominator);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate inverse tangent of numerator / denominator, in radians.
- *
- * denominator can be 0.
- *
- * Supported by API versions 21 and newer.
- */
-extern float2 __attribute__((const, overloadable))native_atan2(float2 numerator, float2 denominator);
+extern float3 __attribute__((const, overloadable))
+    native_atan2(float3 numerator, float3 denominator);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate inverse tangent of numerator / denominator, in radians.
- *
- * denominator can be 0.
- *
- * Supported by API versions 21 and newer.
- */
-extern float3 __attribute__((const, overloadable))native_atan2(float3 numerator, float3 denominator);
+extern float4 __attribute__((const, overloadable))
+    native_atan2(float4 numerator, float4 denominator);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate inverse tangent of numerator / denominator, in radians.
+/*
+ * native_atan2pi: Approximate inverse tangent of a ratio, divided by pi
  *
- * denominator can be 0.
- *
- * Supported by API versions 21 and newer.
- */
-extern float4 __attribute__((const, overloadable))native_atan2(float4 numerator, float4 denominator);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate inverse tangent of numerator / denominator, in radians, divided by pi.
+ * Returns the approximate inverse tangent of (numerator / denominator), in radians, divided by pi.
  *
  * To get an inverse tangent measured in degrees, use atan2pi(n, d) * 180.f.
  *
- * denominator can be 0.
+ * See also atan2pi().
  *
- * Supported by API versions 21 and newer.
+ * Parameters:
+ *   numerator The numerator
+ *   denominator The denominator.  Can be 0.
  */
-extern float __attribute__((const, overloadable))native_atan2pi(float numerator, float denominator);
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+    native_atan2pi(float numerator, float denominator);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate inverse tangent of numerator / denominator, in radians, divided by pi.
- *
- * To get an inverse tangent measured in degrees, use atan2pi(n, d) * 180.f.
- *
- * denominator can be 0.
- *
- * Supported by API versions 21 and newer.
- */
-extern float2 __attribute__((const, overloadable))native_atan2pi(float2 numerator, float2 denominator);
+extern float2 __attribute__((const, overloadable))
+    native_atan2pi(float2 numerator, float2 denominator);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate inverse tangent of numerator / denominator, in radians, divided by pi.
- *
- * To get an inverse tangent measured in degrees, use atan2pi(n, d) * 180.f.
- *
- * denominator can be 0.
- *
- * Supported by API versions 21 and newer.
- */
-extern float3 __attribute__((const, overloadable))native_atan2pi(float3 numerator, float3 denominator);
+extern float3 __attribute__((const, overloadable))
+    native_atan2pi(float3 numerator, float3 denominator);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate inverse tangent of numerator / denominator, in radians, divided by pi.
- *
- * To get an inverse tangent measured in degrees, use atan2pi(n, d) * 180.f.
- *
- * denominator can be 0.
- *
- * Supported by API versions 21 and newer.
- */
-extern float4 __attribute__((const, overloadable))native_atan2pi(float4 numerator, float4 denominator);
+extern float4 __attribute__((const, overloadable))
+    native_atan2pi(float4 numerator, float4 denominator);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
+/*
+ * native_atanh: Approximate inverse hyperbolic tangent
+ *
  * Returns the approximate inverse hyperbolic tangent, in radians.
  *
- * Supported by API versions 21 and newer.
+ * See also atanh().
  */
-extern float __attribute__((const, overloadable))native_atanh(float v);
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+    native_atanh(float v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate inverse hyperbolic tangent, in radians.
+extern float2 __attribute__((const, overloadable))
+    native_atanh(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float3 __attribute__((const, overloadable))
+    native_atanh(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float4 __attribute__((const, overloadable))
+    native_atanh(float4 v);
+#endif
+
+/*
+ * native_atanpi: Approximate inverse tangent divided by pi
  *
- * Supported by API versions 21 and newer.
- */
-extern float2 __attribute__((const, overloadable))native_atanh(float2 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate inverse hyperbolic tangent, in radians.
- *
- * Supported by API versions 21 and newer.
- */
-extern float3 __attribute__((const, overloadable))native_atanh(float3 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate inverse hyperbolic tangent, in radians.
- *
- * Supported by API versions 21 and newer.
- */
-extern float4 __attribute__((const, overloadable))native_atanh(float4 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
  * Returns the approximate inverse tangent in radians, divided by pi.
  *
  * To get an inverse tangent measured in degrees, use atanpi(a) * 180.f.
  *
- * Supported by API versions 21 and newer.
+ * See also atanpi().
  */
-extern float __attribute__((const, overloadable))native_atanpi(float v);
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+    native_atanpi(float v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate inverse tangent in radians, divided by pi.
- *
- * To get an inverse tangent measured in degrees, use atanpi(a) * 180.f.
- *
- * Supported by API versions 21 and newer.
- */
-extern float2 __attribute__((const, overloadable))native_atanpi(float2 v);
+extern float2 __attribute__((const, overloadable))
+    native_atanpi(float2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate inverse tangent in radians, divided by pi.
- *
- * To get an inverse tangent measured in degrees, use atanpi(a) * 180.f.
- *
- * Supported by API versions 21 and newer.
- */
-extern float3 __attribute__((const, overloadable))native_atanpi(float3 v);
+extern float3 __attribute__((const, overloadable))
+    native_atanpi(float3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate inverse tangent in radians, divided by pi.
- *
- * To get an inverse tangent measured in degrees, use atanpi(a) * 180.f.
- *
- * Supported by API versions 21 and newer.
- */
-extern float4 __attribute__((const, overloadable))native_atanpi(float4 v);
+extern float4 __attribute__((const, overloadable))
+    native_atanpi(float4 v);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
+/*
+ * native_cbrt: Approximate cube root
+ *
  * Returns the approximate cubic root.
  *
- * Supported by API versions 21 and newer.
+ * See also cbrt().
  */
-extern float __attribute__((const, overloadable))native_cbrt(float v);
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+    native_cbrt(float v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate cubic root.
+extern float2 __attribute__((const, overloadable))
+    native_cbrt(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float3 __attribute__((const, overloadable))
+    native_cbrt(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float4 __attribute__((const, overloadable))
+    native_cbrt(float4 v);
+#endif
+
+/*
+ * native_cos: Approximate cosine
  *
- * Supported by API versions 21 and newer.
- */
-extern float2 __attribute__((const, overloadable))native_cbrt(float2 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate cubic root.
- *
- * Supported by API versions 21 and newer.
- */
-extern float3 __attribute__((const, overloadable))native_cbrt(float3 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate cubic root.
- *
- * Supported by API versions 21 and newer.
- */
-extern float4 __attribute__((const, overloadable))native_cbrt(float4 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
  * Returns the approximate cosine of an angle measured in radians.
  *
- * Supported by API versions 21 and newer.
+ * See also cos().
  */
-extern float __attribute__((const, overloadable))native_cos(float v);
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+    native_cos(float v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate cosine of an angle measured in radians.
+extern float2 __attribute__((const, overloadable))
+    native_cos(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float3 __attribute__((const, overloadable))
+    native_cos(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float4 __attribute__((const, overloadable))
+    native_cos(float4 v);
+#endif
+
+/*
+ * native_cosh: Approximate hypebolic cosine
  *
- * Supported by API versions 21 and newer.
- */
-extern float2 __attribute__((const, overloadable))native_cos(float2 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate cosine of an angle measured in radians.
- *
- * Supported by API versions 21 and newer.
- */
-extern float3 __attribute__((const, overloadable))native_cos(float3 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate cosine of an angle measured in radians.
- *
- * Supported by API versions 21 and newer.
- */
-extern float4 __attribute__((const, overloadable))native_cos(float4 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
  * Returns the approximate hypebolic cosine.
  *
- * Supported by API versions 21 and newer.
+ * See also cosh().
  */
-extern float __attribute__((const, overloadable))native_cosh(float v);
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+    native_cosh(float v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate hypebolic cosine.
+extern float2 __attribute__((const, overloadable))
+    native_cosh(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float3 __attribute__((const, overloadable))
+    native_cosh(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float4 __attribute__((const, overloadable))
+    native_cosh(float4 v);
+#endif
+
+/*
+ * native_cospi: Approximate cosine of a number multiplied by pi
  *
- * Supported by API versions 21 and newer.
- */
-extern float2 __attribute__((const, overloadable))native_cosh(float2 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate hypebolic cosine.
- *
- * Supported by API versions 21 and newer.
- */
-extern float3 __attribute__((const, overloadable))native_cosh(float3 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate hypebolic cosine.
- *
- * Supported by API versions 21 and newer.
- */
-extern float4 __attribute__((const, overloadable))native_cosh(float4 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
  * Returns the approximate cosine of (v * pi), where (v * pi) is measured in radians.
  *
  * To get the cosine of a value measured in degrees, call cospi(v / 180.f).
  *
- * Supported by API versions 21 and newer.
+ * See also cospi().
  */
-extern float __attribute__((const, overloadable))native_cospi(float v);
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+    native_cospi(float v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate cosine of (v * pi), where (v * pi) is measured in radians.
- *
- * To get the cosine of a value measured in degrees, call cospi(v / 180.f).
- *
- * Supported by API versions 21 and newer.
- */
-extern float2 __attribute__((const, overloadable))native_cospi(float2 v);
+extern float2 __attribute__((const, overloadable))
+    native_cospi(float2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate cosine of (v * pi), where (v * pi) is measured in radians.
- *
- * To get the cosine of a value measured in degrees, call cospi(v / 180.f).
- *
- * Supported by API versions 21 and newer.
- */
-extern float3 __attribute__((const, overloadable))native_cospi(float3 v);
+extern float3 __attribute__((const, overloadable))
+    native_cospi(float3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate cosine of (v * pi), where (v * pi) is measured in radians.
- *
- * To get the cosine of a value measured in degrees, call cospi(v / 180.f).
- *
- * Supported by API versions 21 and newer.
- */
-extern float4 __attribute__((const, overloadable))native_cospi(float4 v);
+extern float4 __attribute__((const, overloadable))
+    native_cospi(float4 v);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
+/*
+ * native_distance: Approximate distance between two points
+ *
  * Computes the approximate distance between two points.
  *
- * Supported by API versions 21 and newer.
+ * See also distance(), fast_distance().
  */
-extern float __attribute__((const, overloadable))native_distance(float left_vector, float right_vector);
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+    native_distance(float left_vector, float right_vector);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Computes the approximate distance between two points.
- *
- * Supported by API versions 21 and newer.
- */
-extern float __attribute__((const, overloadable))native_distance(float2 left_vector, float2 right_vector);
+extern float __attribute__((const, overloadable))
+    native_distance(float2 left_vector, float2 right_vector);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Computes the approximate distance between two points.
- *
- * Supported by API versions 21 and newer.
- */
-extern float __attribute__((const, overloadable))native_distance(float3 left_vector, float3 right_vector);
+extern float __attribute__((const, overloadable))
+    native_distance(float3 left_vector, float3 right_vector);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Computes the approximate distance between two points.
+extern float __attribute__((const, overloadable))
+    native_distance(float4 left_vector, float4 right_vector);
+#endif
+
+/*
+ * native_divide: Approximate division
  *
- * Supported by API versions 21 and newer.
+ * Computes the approximate division of two values.
  */
-extern float __attribute__((const, overloadable))native_distance(float4 left_vector, float4 right_vector);
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+    native_divide(float left_vector, float right_vector);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Computes the approximate division result of two values.
- *
- * Supported by API versions 21 and newer.
- */
-extern float __attribute__((const, overloadable))native_divide(float left_vector, float right_vector);
+extern float2 __attribute__((const, overloadable))
+    native_divide(float2 left_vector, float2 right_vector);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Computes the approximate division result of two values.
- *
- * Supported by API versions 21 and newer.
- */
-extern float2 __attribute__((const, overloadable))native_divide(float2 left_vector, float2 right_vector);
+extern float3 __attribute__((const, overloadable))
+    native_divide(float3 left_vector, float3 right_vector);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Computes the approximate division result of two values.
- *
- * Supported by API versions 21 and newer.
- */
-extern float3 __attribute__((const, overloadable))native_divide(float3 left_vector, float3 right_vector);
+extern float4 __attribute__((const, overloadable))
+    native_divide(float4 left_vector, float4 right_vector);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Computes the approximate division result of two values.
+/*
+ * native_exp: Approximate e raised to a number
  *
- * Supported by API versions 21 and newer.
- */
-extern float4 __attribute__((const, overloadable))native_divide(float4 left_vector, float4 right_vector);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 18))
-/**
  * Fast approximate exp.
  *
  * It is valid for inputs from -86.f to 86.f.  The precision is no worse than what would be expected from using 16 bit floating point values.
  *
- * Supported by API versions 18 and newer.
+ * See also exp().
  */
-extern float __attribute__((const, overloadable))native_exp(float v);
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern float __attribute__((const, overloadable))
+    native_exp(float v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
-/**
- * Fast approximate exp.
- *
- * It is valid for inputs from -86.f to 86.f.  The precision is no worse than what would be expected from using 16 bit floating point values.
- *
- * Supported by API versions 18 and newer.
- */
-extern float2 __attribute__((const, overloadable))native_exp(float2 v);
+extern float2 __attribute__((const, overloadable))
+    native_exp(float2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
-/**
- * Fast approximate exp.
- *
- * It is valid for inputs from -86.f to 86.f.  The precision is no worse than what would be expected from using 16 bit floating point values.
- *
- * Supported by API versions 18 and newer.
- */
-extern float3 __attribute__((const, overloadable))native_exp(float3 v);
+extern float3 __attribute__((const, overloadable))
+    native_exp(float3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
-/**
- * Fast approximate exp.
- *
- * It is valid for inputs from -86.f to 86.f.  The precision is no worse than what would be expected from using 16 bit floating point values.
- *
- * Supported by API versions 18 and newer.
- */
-extern float4 __attribute__((const, overloadable))native_exp(float4 v);
+extern float4 __attribute__((const, overloadable))
+    native_exp(float4 v);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 18))
-/**
+/*
+ * native_exp10: Approximate 10 raised to a number
+ *
  * Fast approximate exp10.
  *
  * It is valid for inputs from -37.f to 37.f.  The precision is no worse than what would be expected from using 16 bit floating point values.
  *
- * Supported by API versions 18 and newer.
+ * See also exp10().
  */
-extern float __attribute__((const, overloadable))native_exp10(float v);
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern float __attribute__((const, overloadable))
+    native_exp10(float v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
-/**
- * Fast approximate exp10.
- *
- * It is valid for inputs from -37.f to 37.f.  The precision is no worse than what would be expected from using 16 bit floating point values.
- *
- * Supported by API versions 18 and newer.
- */
-extern float2 __attribute__((const, overloadable))native_exp10(float2 v);
+extern float2 __attribute__((const, overloadable))
+    native_exp10(float2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
-/**
- * Fast approximate exp10.
- *
- * It is valid for inputs from -37.f to 37.f.  The precision is no worse than what would be expected from using 16 bit floating point values.
- *
- * Supported by API versions 18 and newer.
- */
-extern float3 __attribute__((const, overloadable))native_exp10(float3 v);
+extern float3 __attribute__((const, overloadable))
+    native_exp10(float3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
-/**
- * Fast approximate exp10.
- *
- * It is valid for inputs from -37.f to 37.f.  The precision is no worse than what would be expected from using 16 bit floating point values.
- *
- * Supported by API versions 18 and newer.
- */
-extern float4 __attribute__((const, overloadable))native_exp10(float4 v);
+extern float4 __attribute__((const, overloadable))
+    native_exp10(float4 v);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 18))
-/**
+/*
+ * native_exp2: Approximate 2 raised to a number
+ *
  * Fast approximate exp2.
  *
  * It is valid for inputs from -125.f to 125.f.  The precision is no worse than what would be expected from using 16 bit floating point values.
  *
- * Supported by API versions 18 and newer.
+ * See also exp2().
  */
-extern float __attribute__((const, overloadable))native_exp2(float v);
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern float __attribute__((const, overloadable))
+    native_exp2(float v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
-/**
- * Fast approximate exp2.
- *
- * It is valid for inputs from -125.f to 125.f.  The precision is no worse than what would be expected from using 16 bit floating point values.
- *
- * Supported by API versions 18 and newer.
- */
-extern float2 __attribute__((const, overloadable))native_exp2(float2 v);
+extern float2 __attribute__((const, overloadable))
+    native_exp2(float2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
-/**
- * Fast approximate exp2.
- *
- * It is valid for inputs from -125.f to 125.f.  The precision is no worse than what would be expected from using 16 bit floating point values.
- *
- * Supported by API versions 18 and newer.
- */
-extern float3 __attribute__((const, overloadable))native_exp2(float3 v);
+extern float3 __attribute__((const, overloadable))
+    native_exp2(float3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
-/**
- * Fast approximate exp2.
- *
- * It is valid for inputs from -125.f to 125.f.  The precision is no worse than what would be expected from using 16 bit floating point values.
- *
- * Supported by API versions 18 and newer.
- */
-extern float4 __attribute__((const, overloadable))native_exp2(float4 v);
+extern float4 __attribute__((const, overloadable))
+    native_exp2(float4 v);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
+/*
+ * native_expm1: Approximate e raised to a number minus one
+ *
  * Returns the approximate (e ^ v) - 1.
  *
- * Supported by API versions 21 and newer.
+ * See also expm1().
  */
-extern float __attribute__((const, overloadable))native_expm1(float v);
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+    native_expm1(float v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate (e ^ v) - 1.
+extern float2 __attribute__((const, overloadable))
+    native_expm1(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float3 __attribute__((const, overloadable))
+    native_expm1(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float4 __attribute__((const, overloadable))
+    native_expm1(float4 v);
+#endif
+
+/*
+ * native_hypot: Approximate hypotenuse
  *
- * Supported by API versions 21 and newer.
- */
-extern float2 __attribute__((const, overloadable))native_expm1(float2 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate (e ^ v) - 1.
- *
- * Supported by API versions 21 and newer.
- */
-extern float3 __attribute__((const, overloadable))native_expm1(float3 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate (e ^ v) - 1.
- *
- * Supported by API versions 21 and newer.
- */
-extern float4 __attribute__((const, overloadable))native_expm1(float4 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
  * Returns the approximate native_sqrt(a * a + b * b)
  *
- * Supported by API versions 21 and newer.
+ * See also hypot().
  */
-extern float __attribute__((const, overloadable))native_hypot(float a, float b);
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+    native_hypot(float a, float b);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate native_sqrt(a * a + b * b)
+extern float2 __attribute__((const, overloadable))
+    native_hypot(float2 a, float2 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float3 __attribute__((const, overloadable))
+    native_hypot(float3 a, float3 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float4 __attribute__((const, overloadable))
+    native_hypot(float4 a, float4 b);
+#endif
+
+/*
+ * native_length: Approximate length of a vector
  *
- * Supported by API versions 21 and newer.
- */
-extern float2 __attribute__((const, overloadable))native_hypot(float2 a, float2 b);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate native_sqrt(a * a + b * b)
- *
- * Supported by API versions 21 and newer.
- */
-extern float3 __attribute__((const, overloadable))native_hypot(float3 a, float3 b);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate native_sqrt(a * a + b * b)
- *
- * Supported by API versions 21 and newer.
- */
-extern float4 __attribute__((const, overloadable))native_hypot(float4 a, float4 b);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
  * Compute the approximate length of a vector.
  *
- * Supported by API versions 21 and newer.
+ * See also length(), fast_length().
  */
-extern float __attribute__((const, overloadable))native_length(float v);
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+    native_length(float v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Compute the approximate length of a vector.
- *
- * Supported by API versions 21 and newer.
- */
-extern float __attribute__((const, overloadable))native_length(float2 v);
+extern float __attribute__((const, overloadable))
+    native_length(float2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Compute the approximate length of a vector.
- *
- * Supported by API versions 21 and newer.
- */
-extern float __attribute__((const, overloadable))native_length(float3 v);
+extern float __attribute__((const, overloadable))
+    native_length(float3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Compute the approximate length of a vector.
- *
- * Supported by API versions 21 and newer.
- */
-extern float __attribute__((const, overloadable))native_length(float4 v);
+extern float __attribute__((const, overloadable))
+    native_length(float4 v);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 18))
-/**
+/*
+ * native_log: Approximate natural logarithm
+ *
  * Fast approximate log.
  *
  * It is not accurate for values very close to zero.
  *
- * Supported by API versions 18 and newer.
+ * See also log().
  */
-extern float __attribute__((const, overloadable))native_log(float v);
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern float __attribute__((const, overloadable))
+    native_log(float v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
-/**
- * Fast approximate log.
- *
- * It is not accurate for values very close to zero.
- *
- * Supported by API versions 18 and newer.
- */
-extern float2 __attribute__((const, overloadable))native_log(float2 v);
+extern float2 __attribute__((const, overloadable))
+    native_log(float2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
-/**
- * Fast approximate log.
- *
- * It is not accurate for values very close to zero.
- *
- * Supported by API versions 18 and newer.
- */
-extern float3 __attribute__((const, overloadable))native_log(float3 v);
+extern float3 __attribute__((const, overloadable))
+    native_log(float3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
-/**
- * Fast approximate log.
- *
- * It is not accurate for values very close to zero.
- *
- * Supported by API versions 18 and newer.
- */
-extern float4 __attribute__((const, overloadable))native_log(float4 v);
+extern float4 __attribute__((const, overloadable))
+    native_log(float4 v);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 18))
-/**
+/*
+ * native_log10: Approximate base 10 logarithm
+ *
  * Fast approximate log10.
  *
  * It is not accurate for values very close to zero.
  *
- * Supported by API versions 18 and newer.
+ * See also log10().
  */
-extern float __attribute__((const, overloadable))native_log10(float v);
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern float __attribute__((const, overloadable))
+    native_log10(float v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
-/**
- * Fast approximate log10.
- *
- * It is not accurate for values very close to zero.
- *
- * Supported by API versions 18 and newer.
- */
-extern float2 __attribute__((const, overloadable))native_log10(float2 v);
+extern float2 __attribute__((const, overloadable))
+    native_log10(float2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
-/**
- * Fast approximate log10.
- *
- * It is not accurate for values very close to zero.
- *
- * Supported by API versions 18 and newer.
- */
-extern float3 __attribute__((const, overloadable))native_log10(float3 v);
+extern float3 __attribute__((const, overloadable))
+    native_log10(float3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
-/**
- * Fast approximate log10.
+extern float4 __attribute__((const, overloadable))
+    native_log10(float4 v);
+#endif
+
+/*
+ * native_log1p: Approximate natural logarithm of a value plus 1
  *
- * It is not accurate for values very close to zero.
+ * Returns the approximate natural logarithm of (v + 1.0f)
  *
- * Supported by API versions 18 and newer.
+ * See also log1p().
  */
-extern float4 __attribute__((const, overloadable))native_log10(float4 v);
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+    native_log1p(float v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate natural logarithm of (v + 1.0f)
- *
- * Supported by API versions 21 and newer.
- */
-extern float __attribute__((const, overloadable))native_log1p(float v);
+extern float2 __attribute__((const, overloadable))
+    native_log1p(float2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate natural logarithm of (v + 1.0f)
- *
- * Supported by API versions 21 and newer.
- */
-extern float2 __attribute__((const, overloadable))native_log1p(float2 v);
+extern float3 __attribute__((const, overloadable))
+    native_log1p(float3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate natural logarithm of (v + 1.0f)
- *
- * Supported by API versions 21 and newer.
- */
-extern float3 __attribute__((const, overloadable))native_log1p(float3 v);
+extern float4 __attribute__((const, overloadable))
+    native_log1p(float4 v);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate natural logarithm of (v + 1.0f)
+/*
+ * native_log2: Approximate base 2 logarithm
  *
- * Supported by API versions 21 and newer.
- */
-extern float4 __attribute__((const, overloadable))native_log1p(float4 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 18))
-/**
  * Fast approximate log2.
  *
  * It is not accurate for values very close to zero.
  *
- * Supported by API versions 18 and newer.
+ * See also log2().
  */
-extern float __attribute__((const, overloadable))native_log2(float v);
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern float __attribute__((const, overloadable))
+    native_log2(float v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
-/**
- * Fast approximate log2.
- *
- * It is not accurate for values very close to zero.
- *
- * Supported by API versions 18 and newer.
- */
-extern float2 __attribute__((const, overloadable))native_log2(float2 v);
+extern float2 __attribute__((const, overloadable))
+    native_log2(float2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
-/**
- * Fast approximate log2.
- *
- * It is not accurate for values very close to zero.
- *
- * Supported by API versions 18 and newer.
- */
-extern float3 __attribute__((const, overloadable))native_log2(float3 v);
+extern float3 __attribute__((const, overloadable))
+    native_log2(float3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
-/**
- * Fast approximate log2.
- *
- * It is not accurate for values very close to zero.
- *
- * Supported by API versions 18 and newer.
- */
-extern float4 __attribute__((const, overloadable))native_log2(float4 v);
+extern float4 __attribute__((const, overloadable))
+    native_log2(float4 v);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
+/*
+ * native_normalize: Approximately normalize a vector
+ *
  * Approximately normalizes a vector.
  *
- * Supported by API versions 21 and newer.
+ * See also normalize(), fast_normalize().
  */
-extern float __attribute__((const, overloadable))native_normalize(float v);
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+    native_normalize(float v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Approximately normalizes a vector.
- *
- * Supported by API versions 21 and newer.
- */
-extern float2 __attribute__((const, overloadable))native_normalize(float2 v);
+extern float2 __attribute__((const, overloadable))
+    native_normalize(float2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Approximately normalizes a vector.
- *
- * Supported by API versions 21 and newer.
- */
-extern float3 __attribute__((const, overloadable))native_normalize(float3 v);
+extern float3 __attribute__((const, overloadable))
+    native_normalize(float3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Approximately normalizes a vector.
+extern float4 __attribute__((const, overloadable))
+    native_normalize(float4 v);
+#endif
+
+/*
+ * native_powr: Approximate positive base raised to an exponent
  *
- * Supported by API versions 21 and newer.
+ * Fast approximate (base ^ exponent).
+ *
+ * See also powr().
+ *
+ * Parameters:
+ *   base Must be between 0.f and 256.f.  The function is not accurate for values very close to zero.
+ *   exponent Must be between -15.f and 15.f.
  */
-extern float4 __attribute__((const, overloadable))native_normalize(float4 v);
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern float __attribute__((const, overloadable))
+    native_powr(float base, float exponent);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
-/**
- * Fast approximate (base ^ exponent).
- *
- * @param base Must be between 0.f and 256.f.  The function is not accurate for values very close to zero.
- * @param exponent Must be between -15.f and 15.f.
- *
- * Supported by API versions 18 and newer.
- */
-extern float __attribute__((const, overloadable))native_powr(float base, float exponent);
+extern float2 __attribute__((const, overloadable))
+    native_powr(float2 base, float2 exponent);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
-/**
- * Fast approximate (base ^ exponent).
- *
- * @param base Must be between 0.f and 256.f.  The function is not accurate for values very close to zero.
- * @param exponent Must be between -15.f and 15.f.
- *
- * Supported by API versions 18 and newer.
- */
-extern float2 __attribute__((const, overloadable))native_powr(float2 base, float2 exponent);
+extern float3 __attribute__((const, overloadable))
+    native_powr(float3 base, float3 exponent);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 18))
-/**
- * Fast approximate (base ^ exponent).
- *
- * @param base Must be between 0.f and 256.f.  The function is not accurate for values very close to zero.
- * @param exponent Must be between -15.f and 15.f.
- *
- * Supported by API versions 18 and newer.
- */
-extern float3 __attribute__((const, overloadable))native_powr(float3 base, float3 exponent);
+extern float4 __attribute__((const, overloadable))
+    native_powr(float4 base, float4 exponent);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 18))
-/**
- * Fast approximate (base ^ exponent).
+/*
+ * native_recip: Approximate reciprocal
  *
- * @param base Must be between 0.f and 256.f.  The function is not accurate for values very close to zero.
- * @param exponent Must be between -15.f and 15.f.
- *
- * Supported by API versions 18 and newer.
- */
-extern float4 __attribute__((const, overloadable))native_powr(float4 base, float4 exponent);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
  * Returns the approximate approximate reciprocal of a value.
  *
- * Supported by API versions 21 and newer.
+ * See also half_recip().
  */
-extern float __attribute__((const, overloadable))native_recip(float v);
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+    native_recip(float v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate approximate reciprocal of a value.
+extern float2 __attribute__((const, overloadable))
+    native_recip(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float3 __attribute__((const, overloadable))
+    native_recip(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float4 __attribute__((const, overloadable))
+    native_recip(float4 v);
+#endif
+
+/*
+ * native_rootn: Approximate nth root
  *
- * Supported by API versions 21 and newer.
- */
-extern float2 __attribute__((const, overloadable))native_recip(float2 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate approximate reciprocal of a value.
- *
- * Supported by API versions 21 and newer.
- */
-extern float3 __attribute__((const, overloadable))native_recip(float3 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate approximate reciprocal of a value.
- *
- * Supported by API versions 21 and newer.
- */
-extern float4 __attribute__((const, overloadable))native_recip(float4 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
  * Compute the approximate Nth root of a value.
  *
- * Supported by API versions 21 and newer.
+ * See also rootn().
  */
-extern float __attribute__((const, overloadable))native_rootn(float v, int n);
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+    native_rootn(float v, int n);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Compute the approximate Nth root of a value.
+extern float2 __attribute__((const, overloadable))
+    native_rootn(float2 v, int2 n);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float3 __attribute__((const, overloadable))
+    native_rootn(float3 v, int3 n);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float4 __attribute__((const, overloadable))
+    native_rootn(float4 v, int4 n);
+#endif
+
+/*
+ * native_rsqrt: Approximate reciprocal of a square root
  *
- * Supported by API versions 21 and newer.
- */
-extern float2 __attribute__((const, overloadable))native_rootn(float2 v, int2 n);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Compute the approximate Nth root of a value.
- *
- * Supported by API versions 21 and newer.
- */
-extern float3 __attribute__((const, overloadable))native_rootn(float3 v, int3 n);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Compute the approximate Nth root of a value.
- *
- * Supported by API versions 21 and newer.
- */
-extern float4 __attribute__((const, overloadable))native_rootn(float4 v, int4 n);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
  * Returns approximate (1 / sqrt(v)).
  *
- * Supported by API versions 21 and newer.
+ * See also rsqrt(), half_rsqrt().
  */
-extern float __attribute__((const, overloadable))native_rsqrt(float v);
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+    native_rsqrt(float v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns approximate (1 / sqrt(v)).
+extern float2 __attribute__((const, overloadable))
+    native_rsqrt(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float3 __attribute__((const, overloadable))
+    native_rsqrt(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float4 __attribute__((const, overloadable))
+    native_rsqrt(float4 v);
+#endif
+
+/*
+ * native_sin: Approximate sine
  *
- * Supported by API versions 21 and newer.
- */
-extern float2 __attribute__((const, overloadable))native_rsqrt(float2 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns approximate (1 / sqrt(v)).
- *
- * Supported by API versions 21 and newer.
- */
-extern float3 __attribute__((const, overloadable))native_rsqrt(float3 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns approximate (1 / sqrt(v)).
- *
- * Supported by API versions 21 and newer.
- */
-extern float4 __attribute__((const, overloadable))native_rsqrt(float4 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
  * Returns the approximate sine of an angle measured in radians.
  *
- * Supported by API versions 21 and newer.
+ * See also sin().
  */
-extern float __attribute__((const, overloadable))native_sin(float v);
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+    native_sin(float v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate sine of an angle measured in radians.
+extern float2 __attribute__((const, overloadable))
+    native_sin(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float3 __attribute__((const, overloadable))
+    native_sin(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float4 __attribute__((const, overloadable))
+    native_sin(float4 v);
+#endif
+
+/*
+ * native_sincos: Approximate sine and cosine
  *
- * Supported by API versions 21 and newer.
- */
-extern float2 __attribute__((const, overloadable))native_sin(float2 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate sine of an angle measured in radians.
- *
- * Supported by API versions 21 and newer.
- */
-extern float3 __attribute__((const, overloadable))native_sin(float3 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate sine of an angle measured in radians.
- *
- * Supported by API versions 21 and newer.
- */
-extern float4 __attribute__((const, overloadable))native_sin(float4 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
  * Returns the approximate sine and cosine of a value.
  *
- * @return sine
- * @param v The incoming value in radians
- * @param *cos cos[0] will be set to the cosine value.
+ * See also sincos().
  *
- * Supported by API versions 21 and newer.
+ * Parameters:
+ *   v The incoming value in radians.
+ *   cos *cos will be set to the cosine value.
+ *
+ * Returns: sine
  */
-extern float __attribute__((overloadable))native_sincos(float v, float* cos);
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((overloadable))
+    native_sincos(float v, float* cos);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate sine and cosine of a value.
- *
- * @return sine
- * @param v The incoming value in radians
- * @param *cos cos[0] will be set to the cosine value.
- *
- * Supported by API versions 21 and newer.
- */
-extern float2 __attribute__((overloadable))native_sincos(float2 v, float2* cos);
+extern float2 __attribute__((overloadable))
+    native_sincos(float2 v, float2* cos);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate sine and cosine of a value.
- *
- * @return sine
- * @param v The incoming value in radians
- * @param *cos cos[0] will be set to the cosine value.
- *
- * Supported by API versions 21 and newer.
- */
-extern float3 __attribute__((overloadable))native_sincos(float3 v, float3* cos);
+extern float3 __attribute__((overloadable))
+    native_sincos(float3 v, float3* cos);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate sine and cosine of a value.
- *
- * @return sine
- * @param v The incoming value in radians
- * @param *cos cos[0] will be set to the cosine value.
- *
- * Supported by API versions 21 and newer.
- */
-extern float4 __attribute__((overloadable))native_sincos(float4 v, float4* cos);
+extern float4 __attribute__((overloadable))
+    native_sincos(float4 v, float4* cos);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
+/*
+ * native_sinh: Approximate hyperbolic sine
+ *
  * Returns the approximate hyperbolic sine of a value specified in radians.
  *
- * Supported by API versions 21 and newer.
+ * See also sinh().
  */
-extern float __attribute__((const, overloadable))native_sinh(float v);
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+    native_sinh(float v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate hyperbolic sine of a value specified in radians.
+extern float2 __attribute__((const, overloadable))
+    native_sinh(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float3 __attribute__((const, overloadable))
+    native_sinh(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float4 __attribute__((const, overloadable))
+    native_sinh(float4 v);
+#endif
+
+/*
+ * native_sinpi: Approximate sine of a number multiplied by pi
  *
- * Supported by API versions 21 and newer.
- */
-extern float2 __attribute__((const, overloadable))native_sinh(float2 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate hyperbolic sine of a value specified in radians.
- *
- * Supported by API versions 21 and newer.
- */
-extern float3 __attribute__((const, overloadable))native_sinh(float3 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate hyperbolic sine of a value specified in radians.
- *
- * Supported by API versions 21 and newer.
- */
-extern float4 __attribute__((const, overloadable))native_sinh(float4 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
  * Returns the approximate sine of (v * pi), where (v * pi) is measured in radians.
  *
  * To get the sine of a value measured in degrees, call sinpi(v / 180.f).
  *
- * Supported by API versions 21 and newer.
+ * See also sinpi().
  */
-extern float __attribute__((const, overloadable))native_sinpi(float v);
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+    native_sinpi(float v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate sine of (v * pi), where (v * pi) is measured in radians.
- *
- * To get the sine of a value measured in degrees, call sinpi(v / 180.f).
- *
- * Supported by API versions 21 and newer.
- */
-extern float2 __attribute__((const, overloadable))native_sinpi(float2 v);
+extern float2 __attribute__((const, overloadable))
+    native_sinpi(float2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate sine of (v * pi), where (v * pi) is measured in radians.
- *
- * To get the sine of a value measured in degrees, call sinpi(v / 180.f).
- *
- * Supported by API versions 21 and newer.
- */
-extern float3 __attribute__((const, overloadable))native_sinpi(float3 v);
+extern float3 __attribute__((const, overloadable))
+    native_sinpi(float3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate sine of (v * pi), where (v * pi) is measured in radians.
- *
- * To get the sine of a value measured in degrees, call sinpi(v / 180.f).
- *
- * Supported by API versions 21 and newer.
- */
-extern float4 __attribute__((const, overloadable))native_sinpi(float4 v);
+extern float4 __attribute__((const, overloadable))
+    native_sinpi(float4 v);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
+/*
+ * native_sqrt: Approximate square root
+ *
  * Returns the approximate sqrt(v).
  *
- * Supported by API versions 21 and newer.
+ * See also sqrt(), half_sqrt().
  */
-extern float __attribute__((const, overloadable))native_sqrt(float v);
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+    native_sqrt(float v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate sqrt(v).
+extern float2 __attribute__((const, overloadable))
+    native_sqrt(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float3 __attribute__((const, overloadable))
+    native_sqrt(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float4 __attribute__((const, overloadable))
+    native_sqrt(float4 v);
+#endif
+
+/*
+ * native_tan: Approximate tangent
  *
- * Supported by API versions 21 and newer.
- */
-extern float2 __attribute__((const, overloadable))native_sqrt(float2 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate sqrt(v).
- *
- * Supported by API versions 21 and newer.
- */
-extern float3 __attribute__((const, overloadable))native_sqrt(float3 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate sqrt(v).
- *
- * Supported by API versions 21 and newer.
- */
-extern float4 __attribute__((const, overloadable))native_sqrt(float4 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
  * Returns the approximate tangent of an angle measured in radians.
- *
- * Supported by API versions 21 and newer.
  */
-extern float __attribute__((const, overloadable))native_tan(float v);
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+    native_tan(float v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate tangent of an angle measured in radians.
- *
- * Supported by API versions 21 and newer.
- */
-extern float2 __attribute__((const, overloadable))native_tan(float2 v);
+extern float2 __attribute__((const, overloadable))
+    native_tan(float2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate tangent of an angle measured in radians.
- *
- * Supported by API versions 21 and newer.
- */
-extern float3 __attribute__((const, overloadable))native_tan(float3 v);
+extern float3 __attribute__((const, overloadable))
+    native_tan(float3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate tangent of an angle measured in radians.
- *
- * Supported by API versions 21 and newer.
- */
-extern float4 __attribute__((const, overloadable))native_tan(float4 v);
+extern float4 __attribute__((const, overloadable))
+    native_tan(float4 v);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
+/*
+ * native_tanh: Approximate hyperbolic tangent
+ *
  * Returns the approximate hyperbolic tangent of a value.
  *
- * Supported by API versions 21 and newer.
+ * See also tanh().
  */
-extern float __attribute__((const, overloadable))native_tanh(float v);
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+    native_tanh(float v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate hyperbolic tangent of a value.
+extern float2 __attribute__((const, overloadable))
+    native_tanh(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float3 __attribute__((const, overloadable))
+    native_tanh(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float4 __attribute__((const, overloadable))
+    native_tanh(float4 v);
+#endif
+
+/*
+ * native_tanpi: Approximate tangent of a number multiplied by pi
  *
- * Supported by API versions 21 and newer.
- */
-extern float2 __attribute__((const, overloadable))native_tanh(float2 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate hyperbolic tangent of a value.
- *
- * Supported by API versions 21 and newer.
- */
-extern float3 __attribute__((const, overloadable))native_tanh(float3 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate hyperbolic tangent of a value.
- *
- * Supported by API versions 21 and newer.
- */
-extern float4 __attribute__((const, overloadable))native_tanh(float4 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
  * Returns the approximate tangent of (v * pi), where (v * pi) is measured in radians.
  *
  * To get the tangent of a value measured in degrees, call tanpi(v / 180.f).
  *
- * Supported by API versions 21 and newer.
+ * See also tanpi().
  */
-extern float __attribute__((const, overloadable))native_tanpi(float v);
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+    native_tanpi(float v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate tangent of (v * pi), where (v * pi) is measured in radians.
- *
- * To get the tangent of a value measured in degrees, call tanpi(v / 180.f).
- *
- * Supported by API versions 21 and newer.
- */
-extern float2 __attribute__((const, overloadable))native_tanpi(float2 v);
+extern float2 __attribute__((const, overloadable))
+    native_tanpi(float2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate tangent of (v * pi), where (v * pi) is measured in radians.
- *
- * To get the tangent of a value measured in degrees, call tanpi(v / 180.f).
- *
- * Supported by API versions 21 and newer.
- */
-extern float3 __attribute__((const, overloadable))native_tanpi(float3 v);
+extern float3 __attribute__((const, overloadable))
+    native_tanpi(float3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns the approximate tangent of (v * pi), where (v * pi) is measured in radians.
- *
- * To get the tangent of a value measured in degrees, call tanpi(v / 180.f).
- *
- * Supported by API versions 21 and newer.
- */
-extern float4 __attribute__((const, overloadable))native_tanpi(float4 v);
+extern float4 __attribute__((const, overloadable))
+    native_tanpi(float4 v);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the next floating point number from v towards target.
+/*
+ * nextafter: Next floating point number
  *
- * Supported by API versions 9 and newer.
- */
-extern float __attribute__((const, overloadable))nextafter(float v, float target);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the next floating point number from v towards target.
+ * Returns the next representable floating point number from v towards target.
  *
- * Supported by API versions 9 and newer.
+ * In rs_fp_relaxed mode, a denormalized input value may not yield the next
+ * denormalized  value, as support of denormalized values is optional in
+ * relaxed mode.
  */
-extern float2 __attribute__((const, overloadable))nextafter(float2 v, float2 target);
-#endif
+extern float __attribute__((const, overloadable))
+    nextafter(float v, float target);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the next floating point number from v towards target.
+extern float2 __attribute__((const, overloadable))
+    nextafter(float2 v, float2 target);
+
+extern float3 __attribute__((const, overloadable))
+    nextafter(float3 v, float3 target);
+
+extern float4 __attribute__((const, overloadable))
+    nextafter(float4 v, float4 target);
+
+/*
+ * normalize: Normalize a vector
  *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))nextafter(float3 v, float3 target);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the next floating point number from v towards target.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))nextafter(float4 v, float4 target);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
  * Normalize a vector.
  *
  * For vectors of size 1, returns -1.f for negative values, 0.f for null values, and 1.f for positive values.
  *
- * Supported by API versions 9 and newer.
+ * See also fast_normalize(), native_normalize().
  */
-extern float __attribute__((const, overloadable))normalize(float v);
-#endif
+extern float __attribute__((const, overloadable))
+    normalize(float v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Normalize a vector.
- *
- * For vectors of size 1, returns -1.f for negative values, 0.f for null values, and 1.f for positive values.
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))normalize(float2 v);
-#endif
+extern float2 __attribute__((const, overloadable))
+    normalize(float2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Normalize a vector.
- *
- * For vectors of size 1, returns -1.f for negative values, 0.f for null values, and 1.f for positive values.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))normalize(float3 v);
-#endif
+extern float3 __attribute__((const, overloadable))
+    normalize(float3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Normalize a vector.
- *
- * For vectors of size 1, returns -1.f for negative values, 0.f for null values, and 1.f for positive values.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))normalize(float4 v);
-#endif
+extern float4 __attribute__((const, overloadable))
+    normalize(float4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
+/*
+ * pow: Base raised to an exponent
+ *
  * Returns base raised to the power exponent, i.e. base ^ exponent.
  *
  * pown() and powr() are similar.  pown() takes an integer exponent. powr() assumes the base to be non-negative.
- *
- * Supported by API versions 9 and newer.
  */
-extern float __attribute__((const, overloadable))pow(float base, float exponent);
-#endif
+extern float __attribute__((const, overloadable))
+    pow(float base, float exponent);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns base raised to the power exponent, i.e. base ^ exponent.
- *
- * pown() and powr() are similar.  pown() takes an integer exponent. powr() assumes the base to be non-negative.
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))pow(float2 base, float2 exponent);
-#endif
+extern float2 __attribute__((const, overloadable))
+    pow(float2 base, float2 exponent);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns base raised to the power exponent, i.e. base ^ exponent.
- *
- * pown() and powr() are similar.  pown() takes an integer exponent. powr() assumes the base to be non-negative.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))pow(float3 base, float3 exponent);
-#endif
+extern float3 __attribute__((const, overloadable))
+    pow(float3 base, float3 exponent);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns base raised to the power exponent, i.e. base ^ exponent.
- *
- * pown() and powr() are similar.  pown() takes an integer exponent. powr() assumes the base to be non-negative.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))pow(float4 base, float4 exponent);
-#endif
+extern float4 __attribute__((const, overloadable))
+    pow(float4 base, float4 exponent);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
+/*
+ * pown: Base raised to an integer exponent
+ *
  * Returns base raised to the power exponent, i.e. base ^ exponent.
  *
  * pow() and powr() are similar.  The both take a float exponent. powr() also assumes the base to be non-negative.
- *
- * Supported by API versions 9 and newer.
  */
-extern float __attribute__((const, overloadable))pown(float base, int exponent);
-#endif
+extern float __attribute__((const, overloadable))
+    pown(float base, int exponent);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns base raised to the power exponent, i.e. base ^ exponent.
- *
- * pow() and powr() are similar.  The both take a float exponent. powr() also assumes the base to be non-negative.
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))pown(float2 base, int2 exponent);
-#endif
+extern float2 __attribute__((const, overloadable))
+    pown(float2 base, int2 exponent);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns base raised to the power exponent, i.e. base ^ exponent.
- *
- * pow() and powr() are similar.  The both take a float exponent. powr() also assumes the base to be non-negative.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))pown(float3 base, int3 exponent);
-#endif
+extern float3 __attribute__((const, overloadable))
+    pown(float3 base, int3 exponent);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns base raised to the power exponent, i.e. base ^ exponent.
- *
- * pow() and powr() are similar.  The both take a float exponent. powr() also assumes the base to be non-negative.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))pown(float4 base, int4 exponent);
-#endif
+extern float4 __attribute__((const, overloadable))
+    pown(float4 base, int4 exponent);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
+/*
+ * powr: Positive base raised to an exponent
+ *
  * Returns base raised to the power exponent, i.e. base ^ exponent.  base must be >= 0.
  *
  * pow() and pown() are similar.  They both make no assumptions about the base.  pow() takes a float exponent while pown() take an integer.
  *
- * Supported by API versions 9 and newer.
+ * See also native_powr().
  */
-extern float __attribute__((const, overloadable))powr(float base, float exponent);
-#endif
+extern float __attribute__((const, overloadable))
+    powr(float base, float exponent);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns base raised to the power exponent, i.e. base ^ exponent.  base must be >= 0.
- *
- * pow() and pown() are similar.  They both make no assumptions about the base.  pow() takes a float exponent while pown() take an integer.
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))powr(float2 base, float2 exponent);
-#endif
+extern float2 __attribute__((const, overloadable))
+    powr(float2 base, float2 exponent);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns base raised to the power exponent, i.e. base ^ exponent.  base must be >= 0.
- *
- * pow() and pown() are similar.  They both make no assumptions about the base.  pow() takes a float exponent while pown() take an integer.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))powr(float3 base, float3 exponent);
-#endif
+extern float3 __attribute__((const, overloadable))
+    powr(float3 base, float3 exponent);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns base raised to the power exponent, i.e. base ^ exponent.  base must be >= 0.
- *
- * pow() and pown() are similar.  They both make no assumptions about the base.  pow() takes a float exponent while pown() take an integer.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))powr(float4 base, float4 exponent);
-#endif
+extern float4 __attribute__((const, overloadable))
+    powr(float4 base, float4 exponent);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
+/*
+ * radians: Converts degrees into radians
+ *
  * Converts from degrees to radians.
- *
- * Supported by API versions 9 and newer.
  */
-extern float __attribute__((const, overloadable))radians(float v);
-#endif
+extern float __attribute__((const, overloadable))
+    radians(float v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Converts from degrees to radians.
+extern float2 __attribute__((const, overloadable))
+    radians(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+    radians(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+    radians(float4 v);
+
+/*
+ * remainder: Remainder of a division
  *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))radians(float2 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Converts from degrees to radians.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))radians(float3 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Converts from degrees to radians.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))radians(float4 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
  * Returns the remainder of (numerator / denominator), where the quotient is rounded towards the nearest integer.
  *
  * The function fmod() is similar but rounds toward the closest interger.
  * For example, fmod(-3.8f, 2.f) returns -1.8f (-3.8f - -1.f * 2.f)
  * while remainder(-3.8f, 2.f) returns 0.2f (-3.8f - -2.f * 2.f).
- *
- * Supported by API versions 9 and newer.
  */
-extern float __attribute__((const, overloadable))remainder(float numerator, float denominator);
-#endif
+extern float __attribute__((const, overloadable))
+    remainder(float numerator, float denominator);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the remainder of (numerator / denominator), where the quotient is rounded towards the nearest integer.
- *
- * The function fmod() is similar but rounds toward the closest interger.
- * For example, fmod(-3.8f, 2.f) returns -1.8f (-3.8f - -1.f * 2.f)
- * while remainder(-3.8f, 2.f) returns 0.2f (-3.8f - -2.f * 2.f).
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))remainder(float2 numerator, float2 denominator);
-#endif
+extern float2 __attribute__((const, overloadable))
+    remainder(float2 numerator, float2 denominator);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the remainder of (numerator / denominator), where the quotient is rounded towards the nearest integer.
- *
- * The function fmod() is similar but rounds toward the closest interger.
- * For example, fmod(-3.8f, 2.f) returns -1.8f (-3.8f - -1.f * 2.f)
- * while remainder(-3.8f, 2.f) returns 0.2f (-3.8f - -2.f * 2.f).
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))remainder(float3 numerator, float3 denominator);
-#endif
+extern float3 __attribute__((const, overloadable))
+    remainder(float3 numerator, float3 denominator);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the remainder of (numerator / denominator), where the quotient is rounded towards the nearest integer.
- *
- * The function fmod() is similar but rounds toward the closest interger.
- * For example, fmod(-3.8f, 2.f) returns -1.8f (-3.8f - -1.f * 2.f)
- * while remainder(-3.8f, 2.f) returns 0.2f (-3.8f - -2.f * 2.f).
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))remainder(float4 numerator, float4 denominator);
-#endif
+extern float4 __attribute__((const, overloadable))
+    remainder(float4 numerator, float4 denominator);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
+/*
+ * remquo: Remainder and quotient of a division
+ *
  * Returns the quotient and the remainder of (numerator / denominator).
  *
  * Only the sign and lowest three bits of the quotient are guaranteed to be accurate.
@@ -11178,820 +5065,369 @@
  *
  * Example: remquo(-23.5f, 8.f, &quot) sets the lowest three bits of quot to 3 and the sign negative.  It returns 0.5f.
  *
- * @param numerator The numerator.
- * @param denominator The denominator.
- * @param *quotient quotient[0] will be set to the integer quotient.
- * @return The remainder, precise only for the low three bits.
+ * Parameters:
+ *   numerator The numerator.
+ *   denominator The denominator.
+ *   quotient *quotient will be set to the integer quotient.
  *
- * Supported by API versions 9 and newer.
+ * Returns: The remainder, precise only for the low three bits.
  */
-extern float __attribute__((overloadable))remquo(float numerator, float denominator, int* quotient);
-#endif
+extern float __attribute__((overloadable))
+    remquo(float numerator, float denominator, int* quotient);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the quotient and the remainder of (numerator / denominator).
- *
- * Only the sign and lowest three bits of the quotient are guaranteed to be accurate.
- *
- * This function is useful for implementing periodic functions.  The low three bits of the quotient gives the quadrant and the remainder the distance within the quadrant.  For example, an implementation of sin(x) could call remquo(x, PI / 2.f, &quadrant) to reduce very large value of x to something within a limited range.
- *
- * Example: remquo(-23.5f, 8.f, &quot) sets the lowest three bits of quot to 3 and the sign negative.  It returns 0.5f.
- *
- * @param numerator The numerator.
- * @param denominator The denominator.
- * @param *quotient quotient[0] will be set to the integer quotient.
- * @return The remainder, precise only for the low three bits.
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((overloadable))remquo(float2 numerator, float2 denominator, int2* quotient);
-#endif
+extern float2 __attribute__((overloadable))
+    remquo(float2 numerator, float2 denominator, int2* quotient);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the quotient and the remainder of (numerator / denominator).
- *
- * Only the sign and lowest three bits of the quotient are guaranteed to be accurate.
- *
- * This function is useful for implementing periodic functions.  The low three bits of the quotient gives the quadrant and the remainder the distance within the quadrant.  For example, an implementation of sin(x) could call remquo(x, PI / 2.f, &quadrant) to reduce very large value of x to something within a limited range.
- *
- * Example: remquo(-23.5f, 8.f, &quot) sets the lowest three bits of quot to 3 and the sign negative.  It returns 0.5f.
- *
- * @param numerator The numerator.
- * @param denominator The denominator.
- * @param *quotient quotient[0] will be set to the integer quotient.
- * @return The remainder, precise only for the low three bits.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((overloadable))remquo(float3 numerator, float3 denominator, int3* quotient);
-#endif
+extern float3 __attribute__((overloadable))
+    remquo(float3 numerator, float3 denominator, int3* quotient);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the quotient and the remainder of (numerator / denominator).
- *
- * Only the sign and lowest three bits of the quotient are guaranteed to be accurate.
- *
- * This function is useful for implementing periodic functions.  The low three bits of the quotient gives the quadrant and the remainder the distance within the quadrant.  For example, an implementation of sin(x) could call remquo(x, PI / 2.f, &quadrant) to reduce very large value of x to something within a limited range.
- *
- * Example: remquo(-23.5f, 8.f, &quot) sets the lowest three bits of quot to 3 and the sign negative.  It returns 0.5f.
- *
- * @param numerator The numerator.
- * @param denominator The denominator.
- * @param *quotient quotient[0] will be set to the integer quotient.
- * @return The remainder, precise only for the low three bits.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((overloadable))remquo(float4 numerator, float4 denominator, int4* quotient);
-#endif
+extern float4 __attribute__((overloadable))
+    remquo(float4 numerator, float4 denominator, int4* quotient);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
+/*
+ * rint: Round to even
+ *
  * Rounds to the nearest integral value.
  *
  * rint() rounds half values to even.  For example, rint(0.5f) returns 0.f and rint(1.5f) returns 2.f.  Similarly, rint(-0.5f) returns -0.f and rint(-1.5f) returns -2.f.
  *
  * round() is similar but rounds away from zero.  trunc() truncates the decimal fraction.
- *
- * Supported by API versions 9 and newer.
  */
-extern float __attribute__((const, overloadable))rint(float v);
-#endif
+extern float __attribute__((const, overloadable))
+    rint(float v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Rounds to the nearest integral value.
- *
- * rint() rounds half values to even.  For example, rint(0.5f) returns 0.f and rint(1.5f) returns 2.f.  Similarly, rint(-0.5f) returns -0.f and rint(-1.5f) returns -2.f.
- *
- * round() is similar but rounds away from zero.  trunc() truncates the decimal fraction.
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))rint(float2 v);
-#endif
+extern float2 __attribute__((const, overloadable))
+    rint(float2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Rounds to the nearest integral value.
- *
- * rint() rounds half values to even.  For example, rint(0.5f) returns 0.f and rint(1.5f) returns 2.f.  Similarly, rint(-0.5f) returns -0.f and rint(-1.5f) returns -2.f.
- *
- * round() is similar but rounds away from zero.  trunc() truncates the decimal fraction.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))rint(float3 v);
-#endif
+extern float3 __attribute__((const, overloadable))
+    rint(float3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Rounds to the nearest integral value.
- *
- * rint() rounds half values to even.  For example, rint(0.5f) returns 0.f and rint(1.5f) returns 2.f.  Similarly, rint(-0.5f) returns -0.f and rint(-1.5f) returns -2.f.
- *
- * round() is similar but rounds away from zero.  trunc() truncates the decimal fraction.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))rint(float4 v);
-#endif
+extern float4 __attribute__((const, overloadable))
+    rint(float4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
+/*
+ * rootn: Nth root
+ *
  * Compute the Nth root of a value.
  *
- * Supported by API versions 9 and newer.
+ * See also native_rootn().
  */
-extern float __attribute__((const, overloadable))rootn(float v, int n);
-#endif
+extern float __attribute__((const, overloadable))
+    rootn(float v, int n);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Compute the Nth root of a value.
+extern float2 __attribute__((const, overloadable))
+    rootn(float2 v, int2 n);
+
+extern float3 __attribute__((const, overloadable))
+    rootn(float3 v, int3 n);
+
+extern float4 __attribute__((const, overloadable))
+    rootn(float4 v, int4 n);
+
+/*
+ * round: Round away from zero
  *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))rootn(float2 v, int2 n);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Compute the Nth root of a value.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))rootn(float3 v, int3 n);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Compute the Nth root of a value.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))rootn(float4 v, int4 n);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
  * Round to the nearest integral value.
  *
  * round() rounds half values away from zero.  For example, round(0.5f) returns 1.f and round(1.5f) returns 2.f.  Similarly, round(-0.5f) returns -1.f and round(-1.5f) returns -2.f.
  *
  * rint() is similar but rounds half values toward even.  trunc() truncates the decimal fraction.
- *
- * Supported by API versions 9 and newer.
  */
-extern float __attribute__((const, overloadable))round(float v);
-#endif
+extern float __attribute__((const, overloadable))
+    round(float v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Round to the nearest integral value.
- *
- * round() rounds half values away from zero.  For example, round(0.5f) returns 1.f and round(1.5f) returns 2.f.  Similarly, round(-0.5f) returns -1.f and round(-1.5f) returns -2.f.
- *
- * rint() is similar but rounds half values toward even.  trunc() truncates the decimal fraction.
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))round(float2 v);
-#endif
+extern float2 __attribute__((const, overloadable))
+    round(float2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Round to the nearest integral value.
- *
- * round() rounds half values away from zero.  For example, round(0.5f) returns 1.f and round(1.5f) returns 2.f.  Similarly, round(-0.5f) returns -1.f and round(-1.5f) returns -2.f.
- *
- * rint() is similar but rounds half values toward even.  trunc() truncates the decimal fraction.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))round(float3 v);
-#endif
+extern float3 __attribute__((const, overloadable))
+    round(float3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Round to the nearest integral value.
- *
- * round() rounds half values away from zero.  For example, round(0.5f) returns 1.f and round(1.5f) returns 2.f.  Similarly, round(-0.5f) returns -1.f and round(-1.5f) returns -2.f.
- *
- * rint() is similar but rounds half values toward even.  trunc() truncates the decimal fraction.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))round(float4 v);
-#endif
+extern float4 __attribute__((const, overloadable))
+    round(float4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
+/*
+ * rsqrt: Reciprocal of a square root
+ *
  * Returns (1 / sqrt(v)).
  *
- * Supported by API versions 9 and newer.
+ * See also half_rsqrt(), native_rsqrt().
  */
-extern float __attribute__((const, overloadable))rsqrt(float v);
-#endif
+extern float __attribute__((const, overloadable))
+    rsqrt(float v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns (1 / sqrt(v)).
+extern float2 __attribute__((const, overloadable))
+    rsqrt(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+    rsqrt(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+    rsqrt(float4 v);
+
+/*
+ * sign: Sign of a value
  *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))rsqrt(float2 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns (1 / sqrt(v)).
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))rsqrt(float3 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns (1 / sqrt(v)).
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))rsqrt(float4 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
  * Returns the sign of a value.
  *
  * if (v < 0) return -1.f;
  * else if (v > 0) return 1.f;
  * else return 0.f;
- *
- * Supported by API versions 9 and newer.
  */
-extern float __attribute__((const, overloadable))sign(float v);
-#endif
+extern float __attribute__((const, overloadable))
+    sign(float v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the sign of a value.
- *
- * if (v < 0) return -1.f;
- * else if (v > 0) return 1.f;
- * else return 0.f;
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))sign(float2 v);
-#endif
+extern float2 __attribute__((const, overloadable))
+    sign(float2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the sign of a value.
- *
- * if (v < 0) return -1.f;
- * else if (v > 0) return 1.f;
- * else return 0.f;
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))sign(float3 v);
-#endif
+extern float3 __attribute__((const, overloadable))
+    sign(float3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the sign of a value.
- *
- * if (v < 0) return -1.f;
- * else if (v > 0) return 1.f;
- * else return 0.f;
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))sign(float4 v);
-#endif
+extern float4 __attribute__((const, overloadable))
+    sign(float4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
+/*
+ * sin: Sine
+ *
  * Returns the sine of an angle measured in radians.
  *
- * Supported by API versions 9 and newer.
+ * See also native_sin().
  */
-extern float __attribute__((const, overloadable))sin(float v);
-#endif
+extern float __attribute__((const, overloadable))
+    sin(float v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the sine of an angle measured in radians.
+extern float2 __attribute__((const, overloadable))
+    sin(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+    sin(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+    sin(float4 v);
+
+/*
+ * sincos: Sine and cosine
  *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))sin(float2 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the sine of an angle measured in radians.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))sin(float3 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the sine of an angle measured in radians.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))sin(float4 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
  * Returns the sine and cosine of a value.
  *
- * @return sine of v
- * @param v The incoming value in radians
- * @param *cos cosptr[0] will be set to the cosine value.
+ * See also native_sincos().
  *
- * Supported by API versions 9 and newer.
+ * Parameters:
+ *   v The incoming value in radians
+ *   cos *cos will be set to the cosine value.
+ *
+ * Returns: sine of v
  */
-extern float __attribute__((overloadable))sincos(float v, float* cos);
-#endif
+extern float __attribute__((overloadable))
+    sincos(float v, float* cos);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the sine and cosine of a value.
- *
- * @return sine of v
- * @param v The incoming value in radians
- * @param *cos cosptr[0] will be set to the cosine value.
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((overloadable))sincos(float2 v, float2* cos);
-#endif
+extern float2 __attribute__((overloadable))
+    sincos(float2 v, float2* cos);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the sine and cosine of a value.
- *
- * @return sine of v
- * @param v The incoming value in radians
- * @param *cos cosptr[0] will be set to the cosine value.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((overloadable))sincos(float3 v, float3* cos);
-#endif
+extern float3 __attribute__((overloadable))
+    sincos(float3 v, float3* cos);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the sine and cosine of a value.
- *
- * @return sine of v
- * @param v The incoming value in radians
- * @param *cos cosptr[0] will be set to the cosine value.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((overloadable))sincos(float4 v, float4* cos);
-#endif
+extern float4 __attribute__((overloadable))
+    sincos(float4 v, float4* cos);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
+/*
+ * sinh: Hyperbolic sine
+ *
  * Returns the hyperbolic sine of v, where v is measured in radians.
  *
- * Supported by API versions 9 and newer.
+ * See also native_sinh().
  */
-extern float __attribute__((const, overloadable))sinh(float v);
-#endif
+extern float __attribute__((const, overloadable))
+    sinh(float v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the hyperbolic sine of v, where v is measured in radians.
+extern float2 __attribute__((const, overloadable))
+    sinh(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+    sinh(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+    sinh(float4 v);
+
+/*
+ * sinpi: Sine of a number multiplied by pi
  *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))sinh(float2 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the hyperbolic sine of v, where v is measured in radians.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))sinh(float3 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the hyperbolic sine of v, where v is measured in radians.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))sinh(float4 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
  * Returns the sine of (v * pi), where (v * pi) is measured in radians.
  *
  * To get the sine of a value measured in degrees, call sinpi(v / 180.f).
  *
- * Supported by API versions 9 and newer.
+ * See also native_sinpi().
  */
-extern float __attribute__((const, overloadable))sinpi(float v);
-#endif
+extern float __attribute__((const, overloadable))
+    sinpi(float v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the sine of (v * pi), where (v * pi) is measured in radians.
- *
- * To get the sine of a value measured in degrees, call sinpi(v / 180.f).
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))sinpi(float2 v);
-#endif
+extern float2 __attribute__((const, overloadable))
+    sinpi(float2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the sine of (v * pi), where (v * pi) is measured in radians.
- *
- * To get the sine of a value measured in degrees, call sinpi(v / 180.f).
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))sinpi(float3 v);
-#endif
+extern float3 __attribute__((const, overloadable))
+    sinpi(float3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the sine of (v * pi), where (v * pi) is measured in radians.
- *
- * To get the sine of a value measured in degrees, call sinpi(v / 180.f).
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))sinpi(float4 v);
-#endif
+extern float4 __attribute__((const, overloadable))
+    sinpi(float4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
+/*
+ * sqrt: Square root
+ *
  * Returns the square root of a value.
  *
- * Supported by API versions 9 and newer.
+ * See also half_sqrt(), native_sqrt().
  */
-extern float __attribute__((const, overloadable))sqrt(float v);
-#endif
+extern float __attribute__((const, overloadable))
+    sqrt(float v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the square root of a value.
+extern float2 __attribute__((const, overloadable))
+    sqrt(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+    sqrt(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+    sqrt(float4 v);
+
+/*
+ * step: 0 if less than a value, 0 otherwise
  *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))sqrt(float2 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the square root of a value.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))sqrt(float3 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the square root of a value.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))sqrt(float4 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
  * Returns 0.f if v < edge, 1.f otherwise.
  *
  * This can be useful to create conditional computations without using loops and branching instructions.  For example, instead of computing (a[i] < b[i]) ? 0.f : atan2(a[i], b[i]) for the corresponding elements of a vector, you could instead use step(a, b) * atan2(a, b).
- *
- * Supported by API versions 9 and newer.
  */
-extern float __attribute__((const, overloadable))step(float edge, float v);
-#endif
+extern float __attribute__((const, overloadable))
+    step(float edge, float v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns 0.f if v < edge, 1.f otherwise.
- *
- * This can be useful to create conditional computations without using loops and branching instructions.  For example, instead of computing (a[i] < b[i]) ? 0.f : atan2(a[i], b[i]) for the corresponding elements of a vector, you could instead use step(a, b) * atan2(a, b).
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))step(float2 edge, float2 v);
-#endif
+extern float2 __attribute__((const, overloadable))
+    step(float2 edge, float2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns 0.f if v < edge, 1.f otherwise.
- *
- * This can be useful to create conditional computations without using loops and branching instructions.  For example, instead of computing (a[i] < b[i]) ? 0.f : atan2(a[i], b[i]) for the corresponding elements of a vector, you could instead use step(a, b) * atan2(a, b).
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))step(float3 edge, float3 v);
-#endif
+extern float3 __attribute__((const, overloadable))
+    step(float3 edge, float3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns 0.f if v < edge, 1.f otherwise.
- *
- * This can be useful to create conditional computations without using loops and branching instructions.  For example, instead of computing (a[i] < b[i]) ? 0.f : atan2(a[i], b[i]) for the corresponding elements of a vector, you could instead use step(a, b) * atan2(a, b).
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))step(float4 edge, float4 v);
-#endif
+extern float4 __attribute__((const, overloadable))
+    step(float4 edge, float4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns 0.f if v < edge, 1.f otherwise.
- *
- * This can be useful to create conditional computations without using loops and branching instructions.  For example, instead of computing (a[i] < b) ? 0.f : atan2(a[i], b) for each element of a vector, you could instead use step(a, b) * atan2(a, b).
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))step(float2 edge, float v);
-#endif
+extern float2 __attribute__((const, overloadable))
+    step(float2 edge, float v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns 0.f if v < edge, 1.f otherwise.
- *
- * This can be useful to create conditional computations without using loops and branching instructions.  For example, instead of computing (a[i] < b) ? 0.f : atan2(a[i], b) for each element of a vector, you could instead use step(a, b) * atan2(a, b).
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))step(float3 edge, float v);
-#endif
+extern float3 __attribute__((const, overloadable))
+    step(float3 edge, float v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns 0.f if v < edge, 1.f otherwise.
- *
- * This can be useful to create conditional computations without using loops and branching instructions.  For example, instead of computing (a[i] < b) ? 0.f : atan2(a[i], b) for each element of a vector, you could instead use step(a, b) * atan2(a, b).
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))step(float4 edge, float v);
+extern float4 __attribute__((const, overloadable))
+    step(float4 edge, float v);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float2 __attribute__((const, overloadable))
+    step(float edge, float2 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns 0.f if v < edge, 1.f otherwise.
- *
- * This can be useful to create conditional computations without using loops and branching instructions.  For example, instead of computing (a < b[i]) ? 0.f : atan2(a, b[i]) for each element of a vector, you could instead use step(a, b) * atan2(a, b).
- *
- * Supported by API versions 21 and newer.
- */
-extern float2 __attribute__((const, overloadable))step(float edge, float2 v);
+extern float3 __attribute__((const, overloadable))
+    step(float edge, float3 v);
 #endif
 
 #if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns 0.f if v < edge, 1.f otherwise.
- *
- * This can be useful to create conditional computations without using loops and branching instructions.  For example, instead of computing (a < b[i]) ? 0.f : atan2(a, b[i]) for each element of a vector, you could instead use step(a, b) * atan2(a, b).
- *
- * Supported by API versions 21 and newer.
- */
-extern float3 __attribute__((const, overloadable))step(float edge, float3 v);
+extern float4 __attribute__((const, overloadable))
+    step(float edge, float4 v);
 #endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-/**
- * Returns 0.f if v < edge, 1.f otherwise.
+/*
+ * tan: Tangent
  *
- * This can be useful to create conditional computations without using loops and branching instructions.  For example, instead of computing (a < b[i]) ? 0.f : atan2(a, b[i]) for each element of a vector, you could instead use step(a, b) * atan2(a, b).
- *
- * Supported by API versions 21 and newer.
- */
-extern float4 __attribute__((const, overloadable))step(float edge, float4 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
  * Returns the tangent of an angle measured in radians.
  *
- * Supported by API versions 9 and newer.
+ * See also native_tan().
  */
-extern float __attribute__((const, overloadable))tan(float v);
-#endif
+extern float __attribute__((const, overloadable))
+    tan(float v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the tangent of an angle measured in radians.
+extern float2 __attribute__((const, overloadable))
+    tan(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+    tan(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+    tan(float4 v);
+
+/*
+ * tanh: Hyperbolic tangent
  *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))tan(float2 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the tangent of an angle measured in radians.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))tan(float3 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the tangent of an angle measured in radians.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))tan(float4 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
  * Returns the hyperbolic tangent of a value.
  *
- * Supported by API versions 9 and newer.
+ * See also native_tanh().
  */
-extern float __attribute__((const, overloadable))tanh(float v);
-#endif
+extern float __attribute__((const, overloadable))
+    tanh(float v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the hyperbolic tangent of a value.
+extern float2 __attribute__((const, overloadable))
+    tanh(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+    tanh(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+    tanh(float4 v);
+
+/*
+ * tanpi: Tangent of a number multiplied by pi
  *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))tanh(float2 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the hyperbolic tangent of a value.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))tanh(float3 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the hyperbolic tangent of a value.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))tanh(float4 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
  * Returns the tangent of (v * pi), where (v * pi) is measured in radians.
  *
  * To get the tangent of a value measured in degrees, call tanpi(v / 180.f).
  *
- * Supported by API versions 9 and newer.
+ * See also native_tanpi().
  */
-extern float __attribute__((const, overloadable))tanpi(float v);
-#endif
+extern float __attribute__((const, overloadable))
+    tanpi(float v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the tangent of (v * pi), where (v * pi) is measured in radians.
- *
- * To get the tangent of a value measured in degrees, call tanpi(v / 180.f).
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))tanpi(float2 v);
-#endif
+extern float2 __attribute__((const, overloadable))
+    tanpi(float2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the tangent of (v * pi), where (v * pi) is measured in radians.
- *
- * To get the tangent of a value measured in degrees, call tanpi(v / 180.f).
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))tanpi(float3 v);
-#endif
+extern float3 __attribute__((const, overloadable))
+    tanpi(float3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the tangent of (v * pi), where (v * pi) is measured in radians.
- *
- * To get the tangent of a value measured in degrees, call tanpi(v / 180.f).
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))tanpi(float4 v);
-#endif
+extern float4 __attribute__((const, overloadable))
+    tanpi(float4 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
+/*
+ * tgamma: Gamma function
+ *
  * Returns the gamma function of a value.
  *
- * Supported by API versions 9 and newer.
+ * See also lgamma().
  */
-extern float __attribute__((const, overloadable))tgamma(float v);
-#endif
+extern float __attribute__((const, overloadable))
+    tgamma(float v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the gamma function of a value.
+extern float2 __attribute__((const, overloadable))
+    tgamma(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+    tgamma(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+    tgamma(float4 v);
+
+/*
+ * trunc: Truncates a floating point
  *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))tgamma(float2 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the gamma function of a value.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))tgamma(float3 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Returns the gamma function of a value.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))tgamma(float4 v);
-#endif
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
  * Rounds to integral using truncation.
  *
  * For example, trunc(1.7f) returns 1.f and trunc(-1.7f) returns -1.f.
  *
  * See rint() and round() for other rounding options.
- *
- * Supported by API versions 9 and newer.
  */
-extern float __attribute__((const, overloadable))trunc(float v);
-#endif
+extern float __attribute__((const, overloadable))
+    trunc(float v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Rounds to integral using truncation.
- *
- * For example, trunc(1.7f) returns 1.f and trunc(-1.7f) returns -1.f.
- *
- * See rint() and round() for other rounding options.
- *
- * Supported by API versions 9 and newer.
- */
-extern float2 __attribute__((const, overloadable))trunc(float2 v);
-#endif
+extern float2 __attribute__((const, overloadable))
+    trunc(float2 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Rounds to integral using truncation.
- *
- * For example, trunc(1.7f) returns 1.f and trunc(-1.7f) returns -1.f.
- *
- * See rint() and round() for other rounding options.
- *
- * Supported by API versions 9 and newer.
- */
-extern float3 __attribute__((const, overloadable))trunc(float3 v);
-#endif
+extern float3 __attribute__((const, overloadable))
+    trunc(float3 v);
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 9))
-/**
- * Rounds to integral using truncation.
- *
- * For example, trunc(1.7f) returns 1.f and trunc(-1.7f) returns -1.f.
- *
- * See rint() and round() for other rounding options.
- *
- * Supported by API versions 9 and newer.
- */
-extern float4 __attribute__((const, overloadable))trunc(float4 v);
-#endif
+extern float4 __attribute__((const, overloadable))
+    trunc(float4 v);
 
-#endif // __rs_core_math_rsh__
+#endif // RENDERSCRIPT_RS_CORE_MATH_RSH
diff --git a/scriptc/rs_debug.rsh b/scriptc/rs_debug.rsh
index 7a13c9d..b6a6fb2 100644
--- a/scriptc/rs_debug.rsh
+++ b/scriptc/rs_debug.rsh
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011 The Android Open Source Project
+ * Copyright (C) 2015 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,254 +14,216 @@
  * limitations under the License.
  */
 
-/** @file rs_debug.rsh
- *  \brief Utility debugging routines
+// Don't edit this file!  It is auto-generated by frameworks/rs/api/gen_runtime.
+
+/*
+ * rs_debug.rsh: Utility debugging routines
  *
- *  Routines intended to be used during application developement.  These should
- *  not be used in shipping applications.  All print a string and value pair to
- *  the standard log.
- *
+ * Routines intended to be used during application developement.  These should
+ * not be used in shipping applications.  All print a string and value pair to
+ * the standard log.
  */
-
-#ifndef __RS_DEBUG_RSH__
-#define __RS_DEBUG_RSH__
-
-
-/**
- * Debug function.  Prints a string and value to the log.
- */
-extern void __attribute__((overloadable))
-    rsDebug(const char *, float);
-/**
- * Debug function.  Prints a string and value to the log.
- */
-extern void __attribute__((overloadable))
-    rsDebug(const char *, float, float);
-/**
- * Debug function.  Prints a string and value to the log.
- */
-extern void __attribute__((overloadable))
-    rsDebug(const char *, float, float, float);
-/**
- * Debug function.  Prints a string and value to the log.
- */
-extern void __attribute__((overloadable))
-    rsDebug(const char *, float, float, float, float);
-/**
- * Debug function.  Prints a string and value to the log.
- */
-extern void __attribute__((overloadable))
-    rsDebug(const char *, float2);
-/**
- * Debug function.  Prints a string and value to the log.
- */
-extern void __attribute__((overloadable))
-    rsDebug(const char *, float3);
-/**
- * Debug function.  Prints a string and value to the log.
- */
-extern void __attribute__((overloadable))
-    rsDebug(const char *, float4);
-/**
- * Debug function.  Prints a string and value to the log.
- */
-extern void __attribute__((overloadable))
-    rsDebug(const char *, double);
-/**
- * Debug function.  Prints a string and value to the log.
- */
-extern void __attribute__((overloadable))
-    rsDebug(const char *, const rs_matrix4x4 *);
-/**
- * Debug function.  Prints a string and value to the log.
- */
-extern void __attribute__((overloadable))
-    rsDebug(const char *, const rs_matrix3x3 *);
-/**
- * Debug function.  Prints a string and value to the log.
- */
-extern void __attribute__((overloadable))
-    rsDebug(const char *, const rs_matrix2x2 *);
-/**
- * Debug function.  Prints a string and value to the log.
- */
-extern void __attribute__((overloadable))
-    rsDebug(const char *, int);
-/**
- * Debug function.  Prints a string and value to the log.
- */
-extern void __attribute__((overloadable))
-    rsDebug(const char *, uint);
-/**
- * Debug function.  Prints a string and value to the log.
- */
-extern void __attribute__((overloadable))
-    rsDebug(const char *, long);
-/**
- * Debug function.  Prints a string and value to the log.
- */
-extern void __attribute__((overloadable))
-    rsDebug(const char *, unsigned long);
-/**
- * Debug function.  Prints a string and value to the log.
- */
-extern void __attribute__((overloadable))
-    rsDebug(const char *, long long);
-/**
- * Debug function.  Prints a string and value to the log.
- */
-extern void __attribute__((overloadable))
-    rsDebug(const char *, unsigned long long);
-/**
- * Debug function.  Prints a string and value to the log.
- */
-extern void __attribute__((overloadable))
-    rsDebug(const char *, const void *);
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 17))
-/**
- * Debug function.  Prints a string and value to the log.
- */
-extern void __attribute__((overloadable))
-    rsDebug(const char *, char);
-/**
- * Debug function.  Prints a string and value to the log.
- */
-extern void __attribute__((overloadable))
-    rsDebug(const char *, char2);
-/**
- * Debug function.  Prints a string and value to the log.
- */
-extern void __attribute__((overloadable))
-    rsDebug(const char *, char3);
-/**
- * Debug function.  Prints a string and value to the log.
- */
-extern void __attribute__((overloadable))
-    rsDebug(const char *, char4);
-/**
- * Debug function.  Prints a string and value to the log.
- */
-extern void __attribute__((overloadable))
-    rsDebug(const char *, unsigned char);
-/**
- * Debug function.  Prints a string and value to the log.
- */
-extern void __attribute__((overloadable))
-    rsDebug(const char *, uchar2);
-/**
- * Debug function.  Prints a string and value to the log.
- */
-extern void __attribute__((overloadable))
-    rsDebug(const char *, uchar3);
-/**
- * Debug function.  Prints a string and value to the log.
- */
-extern void __attribute__((overloadable))
-    rsDebug(const char *, uchar4);
-/**
- * Debug function.  Prints a string and value to the log.
- */
-extern void __attribute__((overloadable))
-    rsDebug(const char *, short);
-/**
- * Debug function.  Prints a string and value to the log.
- */
-extern void __attribute__((overloadable))
-    rsDebug(const char *, short2);
-/**
- * Debug function.  Prints a string and value to the log.
- */
-extern void __attribute__((overloadable))
-    rsDebug(const char *, short3);
-/**
- * Debug function.  Prints a string and value to the log.
- */
-extern void __attribute__((overloadable))
-    rsDebug(const char *, short4);
-/**
- * Debug function.  Prints a string and value to the log.
- */
-extern void __attribute__((overloadable))
-    rsDebug(const char *, unsigned short);
-/**
- * Debug function.  Prints a string and value to the log.
- */
-extern void __attribute__((overloadable))
-    rsDebug(const char *, ushort2);
-/**
- * Debug function.  Prints a string and value to the log.
- */
-extern void __attribute__((overloadable))
-    rsDebug(const char *, ushort3);
-/**
- * Debug function.  Prints a string and value to the log.
- */
-extern void __attribute__((overloadable))
-    rsDebug(const char *, ushort4);
-/**
- * Debug function.  Prints a string and value to the log.
- */
-extern void __attribute__((overloadable))
-    rsDebug(const char *, int2);
-/**
- * Debug function.  Prints a string and value to the log.
- */
-extern void __attribute__((overloadable))
-    rsDebug(const char *, int3);
-/**
- * Debug function.  Prints a string and value to the log.
- */
-extern void __attribute__((overloadable))
-    rsDebug(const char *, int4);
-/**
- * Debug function.  Prints a string and value to the log.
- */
-extern void __attribute__((overloadable))
-    rsDebug(const char *, uint2);
-/**
- * Debug function.  Prints a string and value to the log.
- */
-extern void __attribute__((overloadable))
-    rsDebug(const char *, uint3);
-/**
- * Debug function.  Prints a string and value to the log.
- */
-extern void __attribute__((overloadable))
-    rsDebug(const char *, uint4);
-/**
- * Debug function.  Prints a string and value to the log.
- */
-extern void __attribute__((overloadable))
-    rsDebug(const char *, long2);
-/**
- * Debug function.  Prints a string and value to the log.
- */
-extern void __attribute__((overloadable))
-    rsDebug(const char *, long3);
-/**
- * Debug function.  Prints a string and value to the log.
- */
-extern void __attribute__((overloadable))
-    rsDebug(const char *, long4);
-/**
- * Debug function.  Prints a string and value to the log.
- */
-extern void __attribute__((overloadable))
-    rsDebug(const char *, ulong2);
-/**
- * Debug function.  Prints a string and value to the log.
- */
-extern void __attribute__((overloadable))
-    rsDebug(const char *, ulong3);
-/**
- * Debug function.  Prints a string and value to the log.
- */
-extern void __attribute__((overloadable))
-    rsDebug(const char *, ulong4);
-#endif  // (defined(RS_VERSION) && (RS_VERSION >= 17))
+#ifndef RENDERSCRIPT_RS_DEBUG_RSH
+#define RENDERSCRIPT_RS_DEBUG_RSH
 
 #define RS_DEBUG(a) rsDebug(#a, a)
 #define RS_DEBUG_MARKER rsDebug(__FILE__, __LINE__)
 
+/*
+ * Debug function.  Prints a string and value to the log.
+ */
+extern void __attribute__((overloadable))
+    rsDebug(const char* message, double a);
+
+extern void __attribute__((overloadable))
+    rsDebug(const char* message, int a);
+
+extern void __attribute__((overloadable))
+    rsDebug(const char* message, uint a);
+
+extern void __attribute__((overloadable))
+    rsDebug(const char* message, long a);
+
+extern void __attribute__((overloadable))
+    rsDebug(const char* message, ulong a);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern void __attribute__((overloadable))
+    rsDebug(const char* message, int2 a);
 #endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern void __attribute__((overloadable))
+    rsDebug(const char* message, int3 a);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern void __attribute__((overloadable))
+    rsDebug(const char* message, int4 a);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern void __attribute__((overloadable))
+    rsDebug(const char* message, uint2 a);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern void __attribute__((overloadable))
+    rsDebug(const char* message, uint3 a);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern void __attribute__((overloadable))
+    rsDebug(const char* message, uint4 a);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern void __attribute__((overloadable))
+    rsDebug(const char* message, long2 a);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern void __attribute__((overloadable))
+    rsDebug(const char* message, long3 a);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern void __attribute__((overloadable))
+    rsDebug(const char* message, long4 a);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern void __attribute__((overloadable))
+    rsDebug(const char* message, ulong2 a);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern void __attribute__((overloadable))
+    rsDebug(const char* message, ulong3 a);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern void __attribute__((overloadable))
+    rsDebug(const char* message, ulong4 a);
+#endif
+
+extern void __attribute__((overloadable))
+    rsDebug(const char* message, float a);
+
+extern void __attribute__((overloadable))
+    rsDebug(const char* message, float2 a);
+
+extern void __attribute__((overloadable))
+    rsDebug(const char* message, float3 a);
+
+extern void __attribute__((overloadable))
+    rsDebug(const char* message, float4 a);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern void __attribute__((overloadable))
+    rsDebug(const char* message, char a);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern void __attribute__((overloadable))
+    rsDebug(const char* message, char2 a);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern void __attribute__((overloadable))
+    rsDebug(const char* message, char3 a);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern void __attribute__((overloadable))
+    rsDebug(const char* message, char4 a);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern void __attribute__((overloadable))
+    rsDebug(const char* message, uchar a);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern void __attribute__((overloadable))
+    rsDebug(const char* message, uchar2 a);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern void __attribute__((overloadable))
+    rsDebug(const char* message, uchar3 a);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern void __attribute__((overloadable))
+    rsDebug(const char* message, uchar4 a);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern void __attribute__((overloadable))
+    rsDebug(const char* message, short a);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern void __attribute__((overloadable))
+    rsDebug(const char* message, short2 a);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern void __attribute__((overloadable))
+    rsDebug(const char* message, short3 a);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern void __attribute__((overloadable))
+    rsDebug(const char* message, short4 a);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern void __attribute__((overloadable))
+    rsDebug(const char* message, ushort a);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern void __attribute__((overloadable))
+    rsDebug(const char* message, ushort2 a);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern void __attribute__((overloadable))
+    rsDebug(const char* message, ushort3 a);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern void __attribute__((overloadable))
+    rsDebug(const char* message, ushort4 a);
+#endif
+
+extern void __attribute__((overloadable))
+    rsDebug(const char* message, float a, float b);
+
+extern void __attribute__((overloadable))
+    rsDebug(const char* message, float a, float b, float c);
+
+extern void __attribute__((overloadable))
+    rsDebug(const char* message, float a, float b, float c, float d);
+
+extern void __attribute__((overloadable))
+    rsDebug(const char* message, long long a);
+
+extern void __attribute__((overloadable))
+    rsDebug(const char* message, unsigned long long a);
+
+extern void __attribute__((overloadable))
+    rsDebug(const char* message, const void* a);
+
+extern void __attribute__((overloadable))
+    rsDebug(const char* message, const rs_matrix4x4* a);
+
+extern void __attribute__((overloadable))
+    rsDebug(const char* message, const rs_matrix3x3* a);
+
+extern void __attribute__((overloadable))
+    rsDebug(const char* message, const rs_matrix2x2* a);
+
+#endif // RENDERSCRIPT_RS_DEBUG_RSH
diff --git a/scriptc/rs_element.rsh b/scriptc/rs_element.rsh
index 9a53735..91233c2 100644
--- a/scriptc/rs_element.rsh
+++ b/scriptc/rs_element.rsh
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 The Android Open Source Project
+ * Copyright (C) 2015 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,129 +14,192 @@
  * limitations under the License.
  */
 
-/** @file rs_element.rsh
- *  \brief Element routines
+// Don't edit this file!  It is auto-generated by frameworks/rs/api/gen_runtime.
+
+/*
+ * rs_element.rsh: Element functions
  *
+ * The term "element" is used a bit ambiguously in RenderScript, as both
+ * the type of an item of an allocation and the instantiation of that type:
  *
+ * rs_element is a handle to a type specification, and
+ *
+ * In functions like rsGetElementAt(), "element" means the instantiation
+ * of the type, i.e. an item of an allocation.
+ *
+ * The functions below let you query the characteristics of the type specificiation.
+ *
+ * To create complex elements, use the Element.Builder Java class.
+ * For common elements, in Java you can simply use one of the many predefined elements
+ * like F32_2.  You can't create elements from a script.
+ *
+ * An element can be a simple data type as found in C/C++, a handle type,
+ * a structure, or a fixed size vector (of size 2, 3, or 4) of sub-elements.
+ *
+ * Elements can also have a kind, which is semantic information used mostly to
+ * interpret pixel data.
  */
+#ifndef RENDERSCRIPT_RS_ELEMENT_RSH
+#define RENDERSCRIPT_RS_ELEMENT_RSH
 
-#ifndef __RS_ELEMENT_RSH__
-#define __RS_ELEMENT_RSH__
-
-// New API's
+/*
+ * rsElementGetBytesSize: Return the size of an element
+ *
+ * Returns the size in bytes that an instantiation of this element will occupy.
+ */
 #if (defined(RS_VERSION) && (RS_VERSION >= 16))
-
-/**
- * Elements could be simple, such as an int or a float, or a
- * structure with multiple sub elements, such as a collection of
- * floats, float2, float4. This function returns zero for simple
- * elements or the number of sub-elements otherwise.
- *
- * @param e element to get data from
- * @return number of sub-elements in this element
- */
 extern uint32_t __attribute__((overloadable))
-    rsElementGetSubElementCount(rs_element e);
+    rsElementGetBytesSize(rs_element e);
+#endif
 
-/**
- * For complex elements, this function will return the
- * sub-element at index
+/*
+ * rsElementGetDataKind: Return the kind of an element
  *
- * @param e element to get data from
- * @param index index of the sub-element to return
- * @return sub-element in this element at given index
+ * Returns the element's data kind.  This is used to interpret pixel data.
+ *
+ * See rs_data_kind.
  */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+extern rs_data_kind __attribute__((overloadable))
+    rsElementGetDataKind(rs_element e);
+#endif
+
+/*
+ * rsElementGetDataType: Return the data type of an element
+ *
+ * Returns the element's base data type.  This can be a type similar to C/C++ (e.g. RS_TYPE_UNSIGNED_8),
+ * a handle (e.g. RS_TYPE_ALLOCATION and RS_TYPE_ELEMENT), or a more complex numerical type
+ * (e.g.RS_TYPE_UNSIGNED_5_6_5 and RS_TYPE_MATRIX_4X4).
+ *
+ * If the element describes a vector, this function returns the data type of one of its items.
+ *
+ * If the element describes a structure, RS_TYPE_NONE is returned.
+ *
+ * See rs_data_type.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+extern rs_data_type __attribute__((overloadable))
+    rsElementGetDataType(rs_element e);
+#endif
+
+/*
+ * rsElementGetSubElement: Return a sub element of a complex element
+ *
+ * For the element represents a structure, this function returns the sub-element at
+ * the specified index.
+ *
+ * If the element is not a structure or the index is greater or equal to the number
+ * of sub-elements, an invalid handle is returned.
+ *
+ * Parameters:
+ *   e Element to query
+ *   index Index of the sub-element to return
+ *
+ * Returns: Sub-element at the given index
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
 extern rs_element __attribute__((overloadable))
     rsElementGetSubElement(rs_element e, uint32_t index);
+#endif
 
-/**
+/*
+ * rsElementGetSubElementArraySize: Return the array size of a sub element of a complex element
+ *
+ * For complex elements, some sub-elements could be statically
+ * sized arrays. This function returns the array size of the
+ * sub-element at the index.
+ *
+ * Parameters:
+ *   e Element to query
+ *   index Index of the sub-element
+ *
+ * Returns: Array size of the sub-element at the given index
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+extern uint32_t __attribute__((overloadable))
+    rsElementGetSubElementArraySize(rs_element e, uint32_t index);
+#endif
+
+/*
+ * rsElementGetSubElementCount: Return the number of sub-elements
+ *
+ * Elements could be simple, such as an int or a float, or a
+ * structure with multiple sub-elements, such as a collection of
+ * floats, float2, float4.  This function returns zero for simple
+ * elements or the number of sub-elements otherwise.
+ *
+ * Parameters:
+ *   e Element to get data from
+ *
+ * Returns: Number of sub-elements in this element
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+extern uint32_t __attribute__((overloadable))
+    rsElementGetSubElementCount(rs_element e);
+#endif
+
+/*
+ * rsElementGetSubElementName: Return the name of a sub-element
+ *
+ * For complex elements, this function returns the name of the sub-element
+ * at the specified index.
+ *
+ * Parameters:
+ *   e Element to get data from
+ *   index Index of the sub-element
+ *   name Array to store the name into
+ *   nameLength Length of the provided name array
+ *
+ * Returns: Number of characters actually written, excluding the null terminator
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+extern uint32_t __attribute__((overloadable))
+    rsElementGetSubElementName(rs_element e, uint32_t index, char* name, uint32_t nameLength);
+#endif
+
+/*
+ * rsElementGetSubElementNameLength: Return the length of the name of a sub-element
+ *
  * For complex elements, this function will return the length of
  * sub-element name at index
  *
- * @param e element to get data from
- * @param index index of the sub-element to return
- * @return length of the sub-element name including the null
- *         terminator (size of buffer needed to write the name)
+ * Parameters:
+ *   e Element to get data from
+ *   index Index of the sub-element to return
+ *
+ * Returns: Length of the sub-element name including the null terminator (size of buffer needed to write the name)
  */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
 extern uint32_t __attribute__((overloadable))
     rsElementGetSubElementNameLength(rs_element e, uint32_t index);
+#endif
 
-/**
- * For complex elements, this function will return the
- * sub-element name at index
- *
- * @param e element to get data from
- * @param index index of the sub-element
- * @param name array to store the name into
- * @param nameLength length of the provided name array
- * @return number of characters actually written, excluding the
- *         null terminator
- */
-extern uint32_t __attribute__((overloadable))
-    rsElementGetSubElementName(rs_element e, uint32_t index, char *name, uint32_t nameLength);
-
-/**
- * For complex elements, some sub-elements could be statically
- * sized arrays. This function will return the array size for
- * sub-element at index
- *
- * @param e element to get data from
- * @param index index of the sub-element
- * @return array size of sub-element in this element at given
- *         index
- */
-extern uint32_t __attribute__((overloadable))
-    rsElementGetSubElementArraySize(rs_element e, uint32_t index);
-
-/**
+/*
  * This function specifies the location of a sub-element within
  * the element
  *
- * @param e element to get data from
- * @param index index of the sub-element
- * @return offset in bytes of sub-element in this element at
- *         given index
+ * Parameters:
+ *   e Element to get data from
+ *   index Index of the sub-element
+ *
+ * Returns: Offset in bytes of sub-element in this element at given index
  */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
 extern uint32_t __attribute__((overloadable))
     rsElementGetSubElementOffsetBytes(rs_element e, uint32_t index);
+#endif
 
-/**
- * Returns the size of element in bytes
- *
- * @param e element to get data from
- * @return total size of the element in bytes
- */
-extern uint32_t __attribute__((overloadable))
-    rsElementGetBytesSize(rs_element e);
-
-/**
- * Returns the element's data type
- *
- * @param e element to get data from
- * @return element's data type
- */
-extern rs_data_type __attribute__((overloadable))
-    rsElementGetDataType(rs_element e);
-
-/**
- * Returns the element's data kind
- *
- * @param e element to get data from
- * @return element's data size
- */
-extern rs_data_kind __attribute__((overloadable))
-    rsElementGetDataKind(rs_element e);
-
-/**
+/*
  * Returns the element's vector size
  *
- * @param e element to get data from
- * @return length of the element vector (for float2, float3,
- *         etc.)
+ * Parameters:
+ *   e Element to get data from
+ *
+ * Returns: Length of the element vector (for float2, float3, etc.)
  */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
 extern uint32_t __attribute__((overloadable))
     rsElementGetVectorSize(rs_element e);
+#endif
 
-#endif // (defined(RS_VERSION) && (RS_VERSION >= 16))
-
-#endif // __RS_ELEMENT_RSH__
+#endif // RENDERSCRIPT_RS_ELEMENT_RSH
diff --git a/scriptc/rs_graphics.rsh b/scriptc/rs_graphics.rsh
index 1fcb7ed..1f74518 100644
--- a/scriptc/rs_graphics.rsh
+++ b/scriptc/rs_graphics.rsh
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011-2012 The Android Open Source Project
+ * Copyright (C) 2015 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,403 +14,344 @@
  * limitations under the License.
  */
 
-/** @file rs_graphics.rsh
- *  \brief RenderScript graphics API
+// Don't edit this file!  It is auto-generated by frameworks/rs/api/gen_runtime.
+
+/*
+ * rs_graphics.rsh: RenderScript graphics API
  *
- *  A set of graphics functions used by RenderScript.
- *
+ * A set of graphics functions used by RenderScript.
  */
-#ifndef __RS_GRAPHICS_RSH__
-#define __RS_GRAPHICS_RSH__
+#ifndef RENDERSCRIPT_RS_GRAPHICS_RSH
+#define RENDERSCRIPT_RS_GRAPHICS_RSH
 
 #ifdef __LP64__
-//#error "RenderScript graphics is deprecated and not supported in 64bit mode."
+// TODO We need to fix some of the builds before enabling this error:
+// #error "RenderScript graphics is deprecated and not supported in 64bit mode."
 #else
-
 #include "rs_mesh.rsh"
 #include "rs_program.rsh"
+#endif
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 14))
-/**
- * Set the color target used for all subsequent rendering calls
- * @param colorTarget
- * @param slot
+/*
+ * Sync the contents of an allocation.
+ *
+ * If the source is specified, sync from memory space specified by source.
+ *
+ * If the source is not specified, sync from its SCRIPT memory space to its HW
+ * memory spaces.
  */
+#ifndef __LP64__
+extern void __attribute__((overloadable))
+    rsgAllocationSyncAll(rs_allocation alloc);
+#endif
+
+#ifndef __LP64__
+#if (defined(RS_VERSION) && (RS_VERSION >= 14))
+extern void __attribute__((overloadable))
+    rsgAllocationSyncAll(rs_allocation alloc, rs_allocation_usage_type source);
+#endif
+#endif
+
+/*
+ * Set the color target used for all subsequent rendering calls
+ */
+#ifndef __LP64__
+#if (defined(RS_VERSION) && (RS_VERSION >= 14))
 extern void __attribute__((overloadable))
     rsgBindColorTarget(rs_allocation colorTarget, uint slot);
+#endif
+#endif
 
-/**
- * Clear the previously set color target
- * @param slot
+/*
+ * Bind a new Allocation object to a ProgramFragment or ProgramVertex.
+ * The Allocation must be a valid constant input for the Program.
+ *
+ * Parameters:
+ *   ps program fragment object
+ *   slot index of the constant buffer on the program
+ *   c constants to bind
+ *   pv program vertex object
  */
+#ifndef __LP64__
 extern void __attribute__((overloadable))
-    rsgClearColorTarget(uint slot);
+    rsgBindConstant(rs_program_fragment ps, uint slot, rs_allocation c);
+#endif
 
-/**
+#ifndef __LP64__
+extern void __attribute__((overloadable))
+    rsgBindConstant(rs_program_vertex pv, uint slot, rs_allocation c);
+#endif
+
+/*
  * Set the depth target used for all subsequent rendering calls
- * @param depthTarget
  */
+#ifndef __LP64__
+#if (defined(RS_VERSION) && (RS_VERSION >= 14))
 extern void __attribute__((overloadable))
     rsgBindDepthTarget(rs_allocation depthTarget);
+#endif
+#endif
 
-/**
- * Clear the previously set depth target
- */
-extern void __attribute__((overloadable))
-    rsgClearDepthTarget(void);
-
-/**
- * Clear all color and depth targets and resume rendering into
- * the framebuffer
- */
-extern void __attribute__((overloadable))
-    rsgClearAllRenderTargets(void);
-
-/**
- * Force RenderScript to finish all rendering commands
- */
-extern uint __attribute__((overloadable))
-    rsgFinish(void);
-
-#endif //defined(RS_VERSION) && (RS_VERSION >= 14)
-
-/**
- * Bind a new ProgramFragment to the rendering context.
+/*
+ * Binds the font object to be used for all subsequent font rendering calls
  *
- * @param pf
+ * Parameters:
+ *   font object to bind
  */
+#ifndef __LP64__
+extern void __attribute__((overloadable))
+    rsgBindFont(rs_font font);
+#endif
+
+/*
+ * Bind a new ProgramFragment to the rendering context.
+ */
+#ifndef __LP64__
 extern void __attribute__((overloadable))
     rsgBindProgramFragment(rs_program_fragment pf);
+#endif
 
-/**
- * Bind a new ProgramStore to the rendering context.
- *
- * @param ps
- */
-extern void __attribute__((overloadable))
-    rsgBindProgramStore(rs_program_store ps);
-
-/**
- * Bind a new ProgramVertex to the rendering context.
- *
- * @param pv
- */
-extern void __attribute__((overloadable))
-    rsgBindProgramVertex(rs_program_vertex pv);
-
-/**
+/*
  * Bind a new ProgramRaster to the rendering context.
- *
- * @param pr
  */
+#ifndef __LP64__
 extern void __attribute__((overloadable))
     rsgBindProgramRaster(rs_program_raster pr);
+#endif
 
-/**
+/*
+ * Bind a new ProgramStore to the rendering context.
+ */
+#ifndef __LP64__
+extern void __attribute__((overloadable))
+    rsgBindProgramStore(rs_program_store ps);
+#endif
+
+/*
+ * Bind a new ProgramVertex to the rendering context.
+ */
+#ifndef __LP64__
+extern void __attribute__((overloadable))
+    rsgBindProgramVertex(rs_program_vertex pv);
+#endif
+
+/*
  * Bind a new Sampler object to a ProgramFragment.  The sampler will
  * operate on the texture bound at the matching slot.
- *
- * @param slot
  */
+#ifndef __LP64__
 extern void __attribute__((overloadable))
-    rsgBindSampler(rs_program_fragment, uint slot, rs_sampler);
+    rsgBindSampler(rs_program_fragment fragment, uint slot, rs_sampler sampler);
+#endif
 
-/**
+/*
  * Bind a new Allocation object to a ProgramFragment.  The
  * Allocation must be a valid texture for the Program.  The sampling
  * of the texture will be controled by the Sampler bound at the
  * matching slot.
- *
- * @param slot
  */
+#ifndef __LP64__
 extern void __attribute__((overloadable))
-    rsgBindTexture(rs_program_fragment, uint slot, rs_allocation);
+    rsgBindTexture(rs_program_fragment v, uint slot, rs_allocation alloc);
+#endif
 
-/**
- * Load the projection matrix for a currently bound fixed function
- * vertex program. Calling this function with a custom vertex shader
- * would result in an error.
- * @param proj projection matrix
+/*
+ * Clear all color and depth targets and resume rendering into
+ * the framebuffer
  */
-extern void __attribute__((overloadable))
-    rsgProgramVertexLoadProjectionMatrix(const rs_matrix4x4 *proj);
-/**
- * Load the model matrix for a currently bound fixed function
- * vertex program. Calling this function with a custom vertex shader
- * would result in an error.
- * @param model model matrix
- */
-extern void __attribute__((overloadable))
-    rsgProgramVertexLoadModelMatrix(const rs_matrix4x4 *model);
-/**
- * Load the texture matrix for a currently bound fixed function
- * vertex program. Calling this function with a custom vertex shader
- * would result in an error.
- * @param tex texture matrix
- */
-extern void __attribute__((overloadable))
-    rsgProgramVertexLoadTextureMatrix(const rs_matrix4x4 *tex);
-/**
- * Get the projection matrix for a currently bound fixed function
- * vertex program. Calling this function with a custom vertex shader
- * would result in an error.
- * @param proj matrix to store the current projection matrix into
- */
-extern void __attribute__((overloadable))
-    rsgProgramVertexGetProjectionMatrix(rs_matrix4x4 *proj);
-
-/**
- * Set the constant color for a fixed function emulation program.
- *
- * @param pf
- * @param r
- * @param g
- * @param b
- * @param a
- */
-extern void __attribute__((overloadable))
-    rsgProgramFragmentConstantColor(rs_program_fragment pf, float r, float g, float b, float a);
-
-/**
- * Bind a new Allocation object to a ProgramFragment.  The
- * Allocation must be a valid constant input for the Program.
- *
- * @param ps program object
- * @param slot index of the constant buffer on the program
- * @param c constants to bind
- */
-extern void __attribute__((overloadable))
-    rsgBindConstant(rs_program_fragment ps, uint slot, rs_allocation c);
-
-/**
- * Bind a new Allocation object to a ProgramVertex.  The
- * Allocation must be a valid constant input for the Program.
- *
- * @param pv program object
- * @param slot index of the constant buffer on the program
- * @param c constants to bind
- */
-extern void __attribute__((overloadable))
-    rsgBindConstant(rs_program_vertex pv, uint slot, rs_allocation c);
-
-/**
- * Get the width of the current rendering surface.
- *
- * @return uint
- */
-extern uint __attribute__((overloadable))
-    rsgGetWidth(void);
-
-/**
- * Get the height of the current rendering surface.
- *
- * @return uint
- */
-extern uint __attribute__((overloadable))
-    rsgGetHeight(void);
-
-
-/**
- * Sync the contents of an allocation from its SCRIPT memory space to its HW
- * memory spaces.
- *
- * @param alloc
- */
-extern void __attribute__((overloadable))
-    rsgAllocationSyncAll(rs_allocation alloc);
-
+#ifndef __LP64__
 #if (defined(RS_VERSION) && (RS_VERSION >= 14))
-
-/**
- * Sync the contents of an allocation from memory space
- * specified by source.
- *
- * @param alloc
- * @param source
- */
 extern void __attribute__((overloadable))
-    rsgAllocationSyncAll(rs_allocation alloc,
-                         rs_allocation_usage_type source);
+    rsgClearAllRenderTargets(void);
+#endif
+#endif
 
-#endif //defined(RS_VERSION) && (RS_VERSION >= 14)
-
-/**
- * Low performance utility function for drawing a simple rectangle.  Not
- * intended for drawing large quantities of geometry.
- *
- * @param x1
- * @param y1
- * @param x2
- * @param y2
- * @param z
+/*
+ * Clears the rendering surface to the specified color.
  */
+#ifndef __LP64__
 extern void __attribute__((overloadable))
-    rsgDrawRect(float x1, float y1, float x2, float y2, float z);
+    rsgClearColor(float r, float g, float b, float a);
+#endif
 
-/**
+/*
+ * Clear the previously set color target
+ */
+#ifndef __LP64__
+#if (defined(RS_VERSION) && (RS_VERSION >= 14))
+extern void __attribute__((overloadable))
+    rsgClearColorTarget(uint slot);
+#endif
+#endif
+
+/*
+ * Clears the depth suface to the specified value.
+ */
+#ifndef __LP64__
+extern void __attribute__((overloadable))
+    rsgClearDepth(float value);
+#endif
+
+/*
+ * Clear the previously set depth target
+ */
+#ifndef __LP64__
+#if (defined(RS_VERSION) && (RS_VERSION >= 14))
+extern void __attribute__((overloadable))
+    rsgClearDepthTarget(void);
+#endif
+#endif
+
+/*
+ * Draw a mesh using the current context state.
+ *
+ * If primitiveIndex is specified, draw part of a mesh using the current context state.
+ *
+ * If start and len are also specified, draw specified index range of part of a mesh using the current context state.
+ *
+ * Otherwise the whole mesh is rendered.
+ *
+ * Parameters:
+ *   ism mesh object to render
+ *   primitiveIndex for meshes that contain multiple primitive groups this parameter specifies the index of the group to draw.
+ *   start starting index in the range
+ *   len number of indices to draw
+ */
+#ifndef __LP64__
+extern void __attribute__((overloadable))
+    rsgDrawMesh(rs_mesh ism);
+#endif
+
+#ifndef __LP64__
+extern void __attribute__((overloadable))
+    rsgDrawMesh(rs_mesh ism, uint primitiveIndex);
+#endif
+
+#ifndef __LP64__
+extern void __attribute__((overloadable))
+    rsgDrawMesh(rs_mesh ism, uint primitiveIndex, uint start, uint len);
+#endif
+
+/*
  * Low performance utility function for drawing a simple quad.  Not intended for
  * drawing large quantities of geometry.
- *
- * @param x1
- * @param y1
- * @param z1
- * @param x2
- * @param y2
- * @param z2
- * @param x3
- * @param y3
- * @param z3
- * @param x4
- * @param y4
- * @param z4
  */
+#ifndef __LP64__
 extern void __attribute__((overloadable))
-    rsgDrawQuad(float x1, float y1, float z1,
-                float x2, float y2, float z2,
-                float x3, float y3, float z3,
-                float x4, float y4, float z4);
+    rsgDrawQuad(float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3,
+                float z3, float x4, float y4, float z4);
+#endif
 
-
-/**
+/*
  * Low performance utility function for drawing a textured quad.  Not intended
  * for drawing large quantities of geometry.
- *
- * @param x1
- * @param y1
- * @param z1
- * @param u1
- * @param v1
- * @param x2
- * @param y2
- * @param z2
- * @param u2
- * @param v2
- * @param x3
- * @param y3
- * @param z3
- * @param u3
- * @param v3
- * @param x4
- * @param y4
- * @param z4
- * @param u4
- * @param v4
  */
+#ifndef __LP64__
 extern void __attribute__((overloadable))
-    rsgDrawQuadTexCoords(float x1, float y1, float z1, float u1, float v1,
-                         float x2, float y2, float z2, float u2, float v2,
-                         float x3, float y3, float z3, float u3, float v3,
-                         float x4, float y4, float z4, float u4, float v4);
+    rsgDrawQuadTexCoords(float x1, float y1, float z1, float u1, float v1, float x2, float y2,
+                         float z2, float u2, float v2, float x3, float y3, float z3, float u3,
+                         float v3, float x4, float y4, float z4, float u4, float v4);
+#endif
 
+/*
+ * Low performance utility function for drawing a simple rectangle.  Not
+ * intended for drawing large quantities of geometry.
+ */
+#ifndef __LP64__
+extern void __attribute__((overloadable))
+    rsgDrawRect(float x1, float y1, float x2, float y2, float z);
+#endif
 
-/**
+/*
  * Low performance function for drawing rectangles in screenspace.  This
  * function uses the default passthough ProgramVertex.  Any bound ProgramVertex
  * is ignored.  This function has considerable overhead and should not be used
  * for drawing in shipping applications.
- *
- * @param x
- * @param y
- * @param z
- * @param w
- * @param h
  */
+#ifndef __LP64__
 extern void __attribute__((overloadable))
     rsgDrawSpriteScreenspace(float x, float y, float z, float w, float h);
+#endif
 
-extern void __attribute__((overloadable))
-    rsgDrawPath(rs_path p);
-
-/**
- * Draw a mesh using the current context state.  The whole mesh is
- * rendered.
- *
- * @param ism
- */
-extern void __attribute__((overloadable))
-    rsgDrawMesh(rs_mesh ism);
-/**
- * Draw part of a mesh using the current context state.
- * @param ism mesh object to render
- * @param primitiveIndex for meshes that contain multiple primitive groups
- *        this parameter specifies the index of the group to draw.
- */
-extern void __attribute__((overloadable))
-    rsgDrawMesh(rs_mesh ism, uint primitiveIndex);
-/**
- * Draw specified index range of part of a mesh using the current context state.
- * @param ism mesh object to render
- * @param primitiveIndex for meshes that contain multiple primitive groups
- *        this parameter specifies the index of the group to draw.
- * @param start starting index in the range
- * @param len number of indices to draw
- */
-extern void __attribute__((overloadable))
-    rsgDrawMesh(rs_mesh ism, uint primitiveIndex, uint start, uint len);
-
-/**
- * Clears the rendering surface to the specified color.
- *
- * @param r
- * @param g
- * @param b
- * @param a
- */
-extern void __attribute__((overloadable))
-    rsgClearColor(float r, float g, float b, float a);
-
-/**
- * Clears the depth suface to the specified value.
- */
-extern void __attribute__((overloadable))
-    rsgClearDepth(float value);
-/**
+/*
  * Draws text given a string and location
  */
+#ifndef __LP64__
 extern void __attribute__((overloadable))
-    rsgDrawText(const char *, int x, int y);
-/**
- * \overload
+    rsgDrawText(const char* text, int x, int y);
+#endif
+
+#ifndef __LP64__
+extern void __attribute__((overloadable))
+    rsgDrawText(rs_allocation alloc, int x, int y);
+#endif
+
+/*
+ * Force RenderScript to finish all rendering commands
  */
-extern void __attribute__((overloadable))
-    rsgDrawText(rs_allocation, int x, int y);
-/**
- * Binds the font object to be used for all subsequent font rendering calls
- * @param font object to bind
- */
-extern void __attribute__((overloadable))
-    rsgBindFont(rs_font font);
-/**
+#ifndef __LP64__
+#if (defined(RS_VERSION) && (RS_VERSION >= 14))
+extern uint __attribute__((overloadable))
+    rsgFinish(void);
+#endif
+#endif
+
+/*
  * Sets the font color for all subsequent rendering calls
- * @param r red component
- * @param g green component
- * @param b blue component
- * @param a alpha component
+ *
+ * Parameters:
+ *   r red component
+ *   g green component
+ *   b blue component
+ *   a alpha component
  */
+#ifndef __LP64__
 extern void __attribute__((overloadable))
     rsgFontColor(float r, float g, float b, float a);
-/**
+#endif
+
+/*
+ * Get the height of the current rendering surface.
+ */
+#ifndef __LP64__
+extern uint __attribute__((overloadable))
+    rsgGetHeight(void);
+#endif
+
+/*
+ * Get the width of the current rendering surface.
+ */
+#ifndef __LP64__
+extern uint __attribute__((overloadable))
+    rsgGetWidth(void);
+#endif
+
+/*
  * Returns the bounding box of the text relative to (0, 0)
  * Any of left, right, top, bottom could be NULL
  */
+#ifndef __LP64__
 extern void __attribute__((overloadable))
-    rsgMeasureText(const char *, int *left, int *right, int *top, int *bottom);
-/**
- * \overload
- */
+    rsgMeasureText(const char* text, int* left, int* right, int* top, int* bottom);
+#endif
+
+#ifndef __LP64__
 extern void __attribute__((overloadable))
-    rsgMeasureText(rs_allocation, int *left, int *right, int *top, int *bottom);
-/**
+    rsgMeasureText(rs_allocation alloc, int* left, int* right, int* top, int* bottom);
+#endif
+
+/*
  * Computes an axis aligned bounding box of a mesh object
  */
+#ifndef __LP64__
 extern void __attribute__((overloadable))
-    rsgMeshComputeBoundingBox(rs_mesh mesh, float *minX, float *minY, float *minZ,
-                                                float *maxX, float *maxY, float *maxZ);
-/**
- * \overload
- */
-__inline__ static void __attribute__((overloadable, always_inline))
-rsgMeshComputeBoundingBox(rs_mesh mesh, float3 *bBoxMin, float3 *bBoxMax) {
+    rsgMeshComputeBoundingBox(rs_mesh mesh, float* minX, float* minY, float* min, float* maxX,
+                              float* maxY, float* maxZ);
+#endif
+
+#ifndef __LP64__
+static inline void __attribute__((always_inline, overloadable))
+    rsgMeshComputeBoundingBox(rs_mesh mesh, float3* bBoxMin, float3* bBoxMax) {
     float x1, y1, z1, x2, y2, z2;
     rsgMeshComputeBoundingBox(mesh, &x1, &y1, &z1, &x2, &y2, &z2);
     bBoxMin->x = x1;
@@ -420,7 +361,66 @@
     bBoxMax->y = y2;
     bBoxMax->z = z2;
 }
-
-#endif //__LP64__
 #endif
 
+/*
+ * Set the constant color for a fixed function emulation program.
+ */
+#ifndef __LP64__
+extern void __attribute__((overloadable))
+    rsgProgramFragmentConstantColor(rs_program_fragment pf, float r, float g, float b, float a);
+#endif
+
+/*
+ * Get the projection matrix for a currently bound fixed function
+ * vertex program. Calling this function with a custom vertex shader
+ * would result in an error.
+ *
+ * Parameters:
+ *   proj matrix to store the current projection matrix into
+ */
+#ifndef __LP64__
+extern void __attribute__((overloadable))
+    rsgProgramVertexGetProjectionMatrix(rs_matrix4x4* proj);
+#endif
+
+/*
+ * Load the model matrix for a currently bound fixed function
+ * vertex program. Calling this function with a custom vertex shader
+ * would result in an error.
+ *
+ * Parameters:
+ *   model model matrix
+ */
+#ifndef __LP64__
+extern void __attribute__((overloadable))
+    rsgProgramVertexLoadModelMatrix(const rs_matrix4x4* model);
+#endif
+
+/*
+ * Load the projection matrix for a currently bound fixed function
+ * vertex program. Calling this function with a custom vertex shader
+ * would result in an error.
+ *
+ * Parameters:
+ *   proj projection matrix
+ */
+#ifndef __LP64__
+extern void __attribute__((overloadable))
+    rsgProgramVertexLoadProjectionMatrix(const rs_matrix4x4* proj);
+#endif
+
+/*
+ * Load the texture matrix for a currently bound fixed function
+ * vertex program. Calling this function with a custom vertex shader
+ * would result in an error.
+ *
+ * Parameters:
+ *   tex texture matrix
+ */
+#ifndef __LP64__
+extern void __attribute__((overloadable))
+    rsgProgramVertexLoadTextureMatrix(const rs_matrix4x4* tex);
+#endif
+
+#endif // RENDERSCRIPT_RS_GRAPHICS_RSH
diff --git a/scriptc/rs_math.rsh b/scriptc/rs_math.rsh
index 0a0e688..b6b6ee0 100644
--- a/scriptc/rs_math.rsh
+++ b/scriptc/rs_math.rsh
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011 The Android Open Source Project
+ * Copyright (C) 2015 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,95 +14,61 @@
  * limitations under the License.
  */
 
-/** @file rs_math.rsh
- *  \brief todo-jsams
+// Don't edit this file!  It is auto-generated by frameworks/rs/api/gen_runtime.
+
+/*
+ * rs_math.rsh: TODO Add documentation
  *
- *  todo-jsams
+ * TODO Add documentation
+ */
+#ifndef RENDERSCRIPT_RS_MATH_RSH
+#define RENDERSCRIPT_RS_MATH_RSH
+
+/*
+ * rsClamp: Restrain a value to a range
  *
- */
-
-#ifndef __RS_MATH_RSH__
-#define __RS_MATH_RSH__
-
-
-/**
- * Return a random value between 0 (or min_value) and max_malue.
- */
-extern int __attribute__((overloadable))
-    rsRand(int max_value);
-/**
- * \overload
- */
-extern int __attribute__((overloadable))
-    rsRand(int min_value, int max_value);
-/**
- * \overload
- */
-extern float __attribute__((overloadable))
-    rsRand(float max_value);
-/**
- * \overload
- */
-extern float __attribute__((overloadable))
-    rsRand(float min_value, float max_value);
-
-/**
- * Returns the fractional part of a float
- */
-extern float __attribute__((const, overloadable))
-    rsFrac(float);
-
-
-/////////////////////////////////////////////////////
-// int ops
-/////////////////////////////////////////////////////
-
-/**
- * Clamp the value amount between low and high.
+ * Clamp a value between low and high.
  *
- * @param amount  The value to clamp
- * @param low
- * @param high
+ * Deprecated.  Use clamp() instead.
+ *
+ * Parameters:
+ *   amount The value to clamp
+ *   low Lower bound
+ *   high Upper bound
  */
-extern uint __attribute__((const, overloadable, always_inline)) rsClamp(uint amount, uint low, uint high);
+extern char __attribute__((const, always_inline, overloadable))
+    rsClamp(char amount, char low, char high);
 
-/**
- * \overload
- */
-extern int __attribute__((const, overloadable, always_inline)) rsClamp(int amount, int low, int high);
-/**
- * \overload
- */
-extern ushort __attribute__((const, overloadable, always_inline)) rsClamp(ushort amount, ushort low, ushort high);
-/**
- * \overload
- */
-extern short __attribute__((const, overloadable, always_inline)) rsClamp(short amount, short low, short high);
-/**
- * \overload
- */
-extern uchar __attribute__((const, overloadable, always_inline)) rsClamp(uchar amount, uchar low, uchar high);
-/**
- * \overload
- */
-extern char __attribute__((const, overloadable, always_inline)) rsClamp(char amount, char low, char high);
+extern uchar __attribute__((const, always_inline, overloadable))
+    rsClamp(uchar amount, uchar low, uchar high);
 
+extern short __attribute__((const, always_inline, overloadable))
+    rsClamp(short amount, short low, short high);
 
-/**
+extern ushort __attribute__((const, always_inline, overloadable))
+    rsClamp(ushort amount, ushort low, ushort high);
+
+extern int __attribute__((const, always_inline, overloadable))
+    rsClamp(int amount, int low, int high);
+
+extern uint __attribute__((const, always_inline, overloadable))
+    rsClamp(uint amount, uint low, uint high);
+
+/*
  * Computes 6 frustum planes from the view projection matrix
- * @param viewProj matrix to extract planes from
- * @param left plane
- * @param right plane
- * @param top plane
- * @param bottom plane
- * @param near plane
- * @param far plane
+ *
+ * Parameters:
+ *   viewProj matrix to extract planes from
+ *   left left plane
+ *   right right plane
+ *   top top plane
+ *   bottom bottom plane
+ *   near near plane
+ *   far far plane
  */
-__inline__ static void __attribute__((overloadable, always_inline))
-rsExtractFrustumPlanes(const rs_matrix4x4 *viewProj,
-                         float4 *left, float4 *right,
-                         float4 *top, float4 *bottom,
-                         float4 *near, float4 *far) {
+static inline void __attribute__((always_inline, overloadable))
+    rsExtractFrustumPlanes(const rs_matrix4x4* viewProj, float4* left, float4* right, float4* top,
+                           float4* bottom, float4* near, float4* far) {
     // x y z w = a b c d in the plane equation
     left->x = viewProj->m[3] + viewProj->m[0];
     left->y = viewProj->m[7] + viewProj->m[4];
@@ -148,22 +114,27 @@
     *far /= len;
 }
 
-/**
- * Checks if a sphere is withing the 6 frustum planes
- * @param sphere float4 representing the sphere
- * @param left plane
- * @param right plane
- * @param top plane
- * @param bottom plane
- * @param near plane
- * @param far plane
+/*
+ * Returns the fractional part of a float
  */
-__inline__ static bool __attribute__((overloadable, always_inline))
-rsIsSphereInFrustum(float4 *sphere,
-                      float4 *left, float4 *right,
-                      float4 *top, float4 *bottom,
-                      float4 *near, float4 *far) {
+extern float __attribute__((const, overloadable))
+    rsFrac(float v);
 
+/*
+ * Checks if a sphere is withing the 6 frustum planes
+ *
+ * Parameters:
+ *   sphere float4 representing the sphere
+ *   left left plane
+ *   right right plane
+ *   top top plane
+ *   bottom bottom plane
+ *   near near plane
+ *   far far plane
+ */
+static inline bool __attribute__((always_inline, overloadable))
+    rsIsSphereInFrustum(float4* sphere, float4* left, float4* right, float4* top, float4* bottom,
+                        float4* near, float4* far) {
     float distToCenter = dot(left->xyz, sphere->xyz) + left->w;
     if (distToCenter < -sphere->w) {
         return false;
@@ -191,61 +162,52 @@
     return true;
 }
 
-
-/**
- * Pack floating point (0-1) RGB values into a uchar4.  The alpha component is
- * set to 255 (1.0).
+/*
+ * Pack floating point (0-1) RGB values into a uchar4.
  *
- * @param r
- * @param g
- * @param b
- *
- * @return uchar4
+ * For the float3 variant and the variant that only specifies r, g, b,
+ * the alpha component is set to 255 (1.0).
  */
-extern uchar4 __attribute__((const, overloadable)) rsPackColorTo8888(float r, float g, float b);
+extern uchar4 __attribute__((const, overloadable))
+    rsPackColorTo8888(float r, float g, float b);
 
-/**
- * Pack floating point (0-1) RGBA values into a uchar4.
- *
- * @param r
- * @param g
- * @param b
- * @param a
- *
- * @return uchar4
+extern uchar4 __attribute__((const, overloadable))
+    rsPackColorTo8888(float r, float g, float b, float a);
+
+extern uchar4 __attribute__((const, overloadable))
+    rsPackColorTo8888(float3 color);
+
+extern uchar4 __attribute__((const, overloadable))
+    rsPackColorTo8888(float4 color);
+
+/*
+ * Return a random value between 0 (or min_value) and max_malue.
  */
-extern uchar4 __attribute__((const, overloadable)) rsPackColorTo8888(float r, float g, float b, float a);
+extern int __attribute__((overloadable))
+    rsRand(int max_value);
 
-/**
- * Pack floating point (0-1) RGB values into a uchar4.  The alpha component is
- * set to 255 (1.0).
- *
- * @param color
- *
- * @return uchar4
- */
-extern uchar4 __attribute__((const, overloadable)) rsPackColorTo8888(float3 color);
+extern int __attribute__((overloadable))
+    rsRand(int min_value, int max_value);
 
-/**
- * Pack floating point (0-1) RGBA values into a uchar4.
- *
- * @param color
- *
- * @return uchar4
- */
-extern uchar4 __attribute__((const, overloadable)) rsPackColorTo8888(float4 color);
+extern float __attribute__((overloadable))
+    rsRand(float max_value);
 
-/**
+extern float __attribute__((overloadable))
+    rsRand(float min_value, float max_value);
+
+/*
  * Unpack a uchar4 color to float4.  The resulting float range will be (0-1).
- *
- * @param c
- *
- * @return float4
  */
-extern float4 __attribute__((const)) rsUnpackColor8888(uchar4 c);
+extern float4 __attribute__((const))
+    rsUnpackColor8888(uchar4 c);
 
-extern uchar4 __attribute__((const, overloadable)) rsYuvToRGBA_uchar4(uchar y, uchar u, uchar v);
-extern float4 __attribute__((const, overloadable)) rsYuvToRGBA_float4(uchar y, uchar u, uchar v);
+/*
+ * Convert from YUV to RGBA.
+ */
+extern float4 __attribute__((const, overloadable))
+    rsYuvToRGBA_float4(uchar y, uchar u, uchar v);
 
+extern uchar4 __attribute__((const, overloadable))
+    rsYuvToRGBA_uchar4(uchar y, uchar u, uchar v);
 
-#endif
+#endif // RENDERSCRIPT_RS_MATH_RSH
diff --git a/scriptc/rs_matrix.rsh b/scriptc/rs_matrix.rsh
index 252a109..3ed35a4 100644
--- a/scriptc/rs_matrix.rsh
+++ b/scriptc/rs_matrix.rsh
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011 The Android Open Source Project
+ * Copyright (C) 2015 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,517 +14,482 @@
  * limitations under the License.
  */
 
-/** @file rs_matrix.rsh
- *  \brief Matrix functions.
+// Don't edit this file!  It is auto-generated by frameworks/rs/api/gen_runtime.
+
+/*
+ * rs_matrix.rsh: Matrix functions
  *
  * These functions let you manipulate square matrices of rank 2x2, 3x3, and 4x4.
  * They are particularly useful for graphical transformations and are
  * compatible with OpenGL.
  *
- * A few general notes:
+ * We use a zero-based index for rows and columns.  E.g. the last element of
+ * a rs_matrix4x4 is found at (3, 3).
  *
- * \li We use a zero-based index for rows and columns.  E.g. the last element of
- * a \ref rs_matrix4x4 is found at (3, 3).
+ * RenderScript uses column-major matrices and column-based vectors.
+ * Transforming a vector is done by postmultiplying the vector,
+ * e.g. (matrix * vector), as provided by rsMatrixMultiply().
  *
- * \li RenderScript uses column-based vectors.  Transforming a vector is done by
- * postmultiplying the vector, e.g. <em>(matrix * vector)</em>, as provided by
- * \ref rsMatrixMultiply.
- *
- * \li To create a transformation matrix that performs two transformations at
+ * To create a transformation matrix that performs two transformations at
  * once, multiply the two source matrices, with the first transformation as the
  * right argument.  E.g. to create a transformation matrix that applies the
- * transformation \e s1 followed by \e s2, call
- * <c>rsMatrixLoadMultiply(&combined, &s2, &s1)</c>.
- * This derives from <em>s2 * (s1 * v)</em>, which is <em>(s2 * s1) * v</em>.
+ * transformation s1 followed by s2, call rsMatrixLoadMultiply(&combined, &s2, &s1).
+ * This derives from s2 * (s1 * v), which is (s2 * s1) * v.
  *
- * \li We have two style of functions to create transformation matrices:
- * rsMatrixLoad<em>Transformation</em> and rsMatrix<em>Transformation</em>.  The
+ * We have two style of functions to create transformation matrices:
+ * rsMatrixLoadTransformation and rsMatrixTransformation.  The
  * former style simply stores the transformation matrix in the first argument.
  * The latter modifies a pre-existing transformation matrix so that the new
- * transformation happens first.  E.g. if you call \ref rsMatrixTranslate
+ * transformation happens first.  E.g. if you call rsMatrixTranslate()
  * on a matrix that already does a scaling, the resulting matrix when applied
  * to a vector will first do the translation then the scaling.
- *
  */
+#ifndef RENDERSCRIPT_RS_MATRIX_RSH
+#define RENDERSCRIPT_RS_MATRIX_RSH
 
-#ifndef __RS_MATRIX_RSH__
-#define __RS_MATRIX_RSH__
-
-/**
- * Set an element of a matrix.
+/*
+ * rsMatrixGet: Get one element
  *
- * @param m The matrix that will be modified.
- * @param col The zero-based column of the element to be set.
- * @param row The zero-based row of the element to be set.
- * @param v The value to set.
- *
- * \warning The order of the column and row parameters may be
- * unexpected.
- */
-extern void __attribute__((overloadable))
-rsMatrixSet(rs_matrix4x4 *m, uint32_t col, uint32_t row, float v);
-/**
- * \overload
- */
-extern void __attribute__((overloadable))
-rsMatrixSet(rs_matrix3x3 *m, uint32_t col, uint32_t row, float v);
-/**
- * \overload
- */
-extern void __attribute__((overloadable))
-rsMatrixSet(rs_matrix2x2 *m, uint32_t col, uint32_t row, float v);
-
-/**
  * Returns one element of a matrix.
  *
- * @param m The matrix to extract the element from.
- * @param col The zero-based column of the element to be extracted.
- * @param row The zero-based row of the element to extracted.
+ * Warning: The order of the column and row parameters may be unexpected.
  *
- * \warning The order of the column and row parameters may be
- * unexpected.
- *
- * @return float
+ * Parameters:
+ *   m The matrix to extract the element from.
+ *   col The zero-based column of the element to be extracted.
+ *   row The zero-based row of the element to extracted.
  */
 extern float __attribute__((overloadable))
-rsMatrixGet(const rs_matrix4x4 *m, uint32_t col, uint32_t row);
-/**
- * \overload
- */
-extern float __attribute__((overloadable))
-rsMatrixGet(const rs_matrix3x3 *m, uint32_t col, uint32_t row);
-/**
- * \overload
- */
-extern float __attribute__((overloadable))
-rsMatrixGet(const rs_matrix2x2 *m, uint32_t col, uint32_t row);
+    rsMatrixGet(const rs_matrix4x4* m, uint32_t col, uint32_t row);
 
-/**
- * Set the elements of a matrix to the identity matrix.
- *
- * @param m The matrix to set.
- */
-extern void __attribute__((overloadable)) rsMatrixLoadIdentity(rs_matrix4x4 *m);
-/**
- * \overload
- */
-extern void __attribute__((overloadable)) rsMatrixLoadIdentity(rs_matrix3x3 *m);
-/**
- * \overload
- */
-extern void __attribute__((overloadable)) rsMatrixLoadIdentity(rs_matrix2x2 *m);
+extern float __attribute__((overloadable))
+    rsMatrixGet(const rs_matrix3x3* m, uint32_t col, uint32_t row);
 
-/**
- * Set the elements of a matrix from an array of floats.
+extern float __attribute__((overloadable))
+    rsMatrixGet(const rs_matrix2x2* m, uint32_t col, uint32_t row);
+
+/*
+ * rsMatrixInverse: Inverts a matrix in place
  *
- * The array of floats should be in row-major order, i.e. the element a
- * <em>row 0, column 0</em> should be first, followed by the element at
- * <em>row 0, column 1</em>, etc.
+ * Returns true if the matrix was successfully inverted.
  *
- * @param m The matrix to set.
- * @param v The array of values to set the matrix to. These arrays should be
- * 4, 9, or 16 floats long, depending on the matrix size.
+ * Parameters:
+ *   m The matrix to invert.
  */
-extern void __attribute__((overloadable)) rsMatrixLoad(rs_matrix4x4 *m, const float *v);
-/**
- * \overload
- */
-extern void __attribute__((overloadable)) rsMatrixLoad(rs_matrix3x3 *m, const float *v);
-/**
- * \overload
- */
-extern void __attribute__((overloadable)) rsMatrixLoad(rs_matrix2x2 *m, const float *v);
-/**
- * Set the elements of a matrix from another matrix.
+extern bool __attribute__((overloadable))
+    rsMatrixInverse(rs_matrix4x4* m);
+
+/*
+ * rsMatrixInverseTranspose: Inverts and transpose a matrix in place
  *
- * If the source matrix is smaller than the destination, the rest of the
+ * The matrix is first inverted then transposed.
+ * Returns true if the matrix was successfully inverted.
+ *
+ * Parameters:
+ *   m The matrix to modify.
+ */
+extern bool __attribute__((overloadable))
+    rsMatrixInverseTranspose(rs_matrix4x4* m);
+
+/*
+ * rsMatrixLoad: Load or copy a matrix
+ *
+ * Set the elements of a matrix from an array of floats or from another matrix.
+ *
+ * If loading from an array, the floats should be in row-major order, i.e. the element a
+ * row 0, column 0 should be first, followed by the element at
+ * row 0, column 1, etc.
+ *
+ * If loading from a matrix and the source is smaller than the destination, the rest of the
  * destination is filled with elements of the identity matrix.  E.g.
  * loading a rs_matrix2x2 into a rs_matrix4x4 will give:
  *
- * \htmlonly<table>
- * <tr><td>m00</td><td>m01</td><td>0.0</td><td>0.0</td></tr>
- * <tr><td>m10</td><td>m11</td><td>0.0</td><td>0.0</td></tr>
- * <tr><td>0.0</td><td>0.0</td><td>1.0</td><td>0.0</td></tr>
- * <tr><td>0.0</td><td>0.0</td><td>0.0</td><td>1.0</td></tr>
- * </table>\endhtmlonly
+ * m00 m01 0.0 0.0
+ * m10 m11 0.0 0.0
+ * 0.0 0.0 1.0 0.0
+ * 0.0 0.0 0.0 1.0
  *
- * @param m The matrix to set.
- * @param v The source matrix.
+ *
+ * Parameters:
+ *   destination The matrix to set.
+ *   array The array of values to set the matrix to. These arrays should be 4, 9, or 16 floats long, depending on the matrix size.
+ *   source The source matrix.
  */
-extern void __attribute__((overloadable)) rsMatrixLoad(rs_matrix4x4 *m, const rs_matrix4x4 *v);
-/**
- * \overload
- */
-extern void __attribute__((overloadable)) rsMatrixLoad(rs_matrix4x4 *m, const rs_matrix3x3 *v);
-/**
- * \overload
- */
-extern void __attribute__((overloadable)) rsMatrixLoad(rs_matrix4x4 *m, const rs_matrix2x2 *v);
-/**
- * \overload
- */
-extern void __attribute__((overloadable)) rsMatrixLoad(rs_matrix3x3 *m, const rs_matrix3x3 *v);
-/**
- * \overload
- */
-extern void __attribute__((overloadable)) rsMatrixLoad(rs_matrix2x2 *m, const rs_matrix2x2 *v);
+extern void __attribute__((overloadable))
+    rsMatrixLoad(rs_matrix4x4* destination, const float* array);
 
-/**
- * Load a rotation matrix.
+extern void __attribute__((overloadable))
+    rsMatrixLoad(rs_matrix3x3* destination, const float* array);
+
+extern void __attribute__((overloadable))
+    rsMatrixLoad(rs_matrix2x2* destination, const float* array);
+
+extern void __attribute__((overloadable))
+    rsMatrixLoad(rs_matrix4x4* destination, const rs_matrix4x4* source);
+
+extern void __attribute__((overloadable))
+    rsMatrixLoad(rs_matrix3x3* destination, const rs_matrix3x3* source);
+
+extern void __attribute__((overloadable))
+    rsMatrixLoad(rs_matrix2x2* destination, const rs_matrix2x2* source);
+
+extern void __attribute__((overloadable))
+    rsMatrixLoad(rs_matrix4x4* destination, const rs_matrix3x3* source);
+
+extern void __attribute__((overloadable))
+    rsMatrixLoad(rs_matrix4x4* destination, const rs_matrix2x2* source);
+
+/*
+ * rsMatrixLoadFrustum: Load a frustum projection matrix
+ *
+ * Constructs a frustum projection matrix, transforming the box
+ * identified by the six clipping planes left, right, bottom, top,
+ * near, far.
+ *
+ * To apply this projection to a vector, multiply the vector by the
+ * created matrix using rsMatrixMultiply().
+ *
+ * Parameters:
+ *   m The matrix to set.
+ */
+extern void __attribute__((overloadable))
+    rsMatrixLoadFrustum(rs_matrix4x4* m, float left, float right, float bottom, float top,
+                        float near, float far);
+
+/*
+ * rsMatrixLoadIdentity: Load identity matrix
+ *
+ * Set the elements of a matrix to the identity matrix.
+ *
+ * Parameters:
+ *   m The matrix to set.
+ */
+extern void __attribute__((overloadable))
+    rsMatrixLoadIdentity(rs_matrix4x4* m);
+
+extern void __attribute__((overloadable))
+    rsMatrixLoadIdentity(rs_matrix3x3* m);
+
+extern void __attribute__((overloadable))
+    rsMatrixLoadIdentity(rs_matrix2x2* m);
+
+/*
+ * rsMatrixLoadMultiply: Multiply two matrices
+ *
+ * Sets m to the matrix product of lhs * rhs.
+ *
+ * To combine two 4x4 transformaton matrices, multiply the second transformation matrix
+ * by the first transformation matrix.  E.g. to create a transformation matrix that applies
+ * the transformation s1 followed by s2, call
+ * rsMatrixLoadMultiply(&combined, &s2, &s1).
+ *
+ * Warning: Prior to version 21, storing the result back into right matrix is not supported and
+ * will result in undefined behavior.  Use rsMatrixMulitply instead.   E.g. instead of doing
+ * rsMatrixLoadMultiply (&m2r, &m2r, &m2l), use rsMatrixMultiply (&m2r, &m2l).
+ * rsMatrixLoadMultiply (&m2l, &m2r, &m2l) works as expected.
+ *
+ * Parameters:
+ *   m The matrix to set.
+ *   lhs The left matrix of the product.
+ *   rhs The right matrix of the product.
+ */
+extern void __attribute__((overloadable))
+    rsMatrixLoadMultiply(rs_matrix4x4* m, const rs_matrix4x4* lhs, const rs_matrix4x4* rhs);
+
+extern void __attribute__((overloadable))
+    rsMatrixLoadMultiply(rs_matrix3x3* m, const rs_matrix3x3* lhs, const rs_matrix3x3* rhs);
+
+extern void __attribute__((overloadable))
+    rsMatrixLoadMultiply(rs_matrix2x2* m, const rs_matrix2x2* lhs, const rs_matrix2x2* rhs);
+
+/*
+ * rsMatrixLoadOrtho: Load an orthographic projection matrix
+ *
+ * Constructs an orthographic projection matrix, transforming the box
+ * identified by the six clipping planes left, right, bottom, top,
+ * near, far into a unit cube with a corner at
+ * (-1, -1, -1) and the opposite at (1, 1, 1).
+ *
+ * To apply this projection to a vector, multiply the vector by the
+ * created matrix using rsMatrixMultiply().
+ *
+ * See https://en.wikipedia.org/wiki/Orthographic_projection .
+ *
+ * Parameters:
+ *   m The matrix to set.
+ */
+extern void __attribute__((overloadable))
+    rsMatrixLoadOrtho(rs_matrix4x4* m, float left, float right, float bottom, float top, float near,
+                      float far);
+
+/*
+ * rsMatrixLoadPerspective: Load a perspective projection matrix
+ *
+ * Constructs a perspective projection matrix, assuming a symmetrical field of view.
+ *
+ * To apply this projection to a vector, multiply the vector by the
+ * created matrix using rsMatrixMultiply().
+ *
+ * Parameters:
+ *   m The matrix to set.
+ *   fovy Field of view, in degrees along the Y axis.
+ *   aspect Ratio of x / y.
+ *   near The near clipping plane.
+ *   far The far clipping plane.
+ */
+extern void __attribute__((overloadable))
+    rsMatrixLoadPerspective(rs_matrix4x4* m, float fovy, float aspect, float near, float far);
+
+/*
+ * rsMatrixLoadRotate: Load a rotation matrix
  *
  * This function creates a rotation matrix.  The axis of rotation is the
- * <em>(x, y, z)</em> vector.
+ * (x, y, z) vector.
  *
  * To rotate a vector, multiply the vector by the created matrix
- * using \ref rsMatrixMultiply.
+ * using rsMatrixMultiply().
  *
  * See http://en.wikipedia.org/wiki/Rotation_matrix .
  *
- * @param m The matrix to set.
- * @param rot How much rotation to do, in degrees.
- * @param x The x component of the vector that is the axis of rotation.
- * @param y The y component of the vector that is the axis of rotation.
- * @param z The z component of the vector that is the axis of rotation.
+ * Parameters:
+ *   m The matrix to set.
+ *   rot How much rotation to do, in degrees.
+ *   x The x component of the vector that is the axis of rotation.
+ *   y The y component of the vector that is the axis of rotation.
+ *   z The z component of the vector that is the axis of rotation.
  */
 extern void __attribute__((overloadable))
-rsMatrixLoadRotate(rs_matrix4x4 *m, float rot, float x, float y, float z);
+    rsMatrixLoadRotate(rs_matrix4x4* m, float rot, float x, float y, float z);
 
-/**
- * Load a scale matrix.
+/*
+ * rsMatrixLoadScale: Load a scaling matrix
  *
  * This function creates a scaling matrix, where each component of a
  * vector is multiplied by a number.  This number can be negative.
  *
  * To scale a vector, multiply the vector by the created matrix
- * using \ref rsMatrixMultiply.
+ * using rsMatrixMultiply().
  *
- * @param m The matrix to set.
- * @param x The multiple to scale the x components by.
- * @param y The multiple to scale the y components by.
- * @param z The multiple to scale the z components by.
+ * Parameters:
+ *   m The matrix to set.
+ *   x The multiple to scale the x components by.
+ *   y The multiple to scale the y components by.
+ *   z The multiple to scale the z components by.
  */
 extern void __attribute__((overloadable))
-rsMatrixLoadScale(rs_matrix4x4 *m, float x, float y, float z);
+    rsMatrixLoadScale(rs_matrix4x4* m, float x, float y, float z);
 
-/**
- * Load a translation matrix.
+/*
+ * rsMatrixLoadTranslate: Load a translation matrix
  *
  * This function creates a translation matrix, where a
  * number is added to each element of a vector.
  *
  * To translate a vector, multiply the vector by the created matrix
- * using \ref rsMatrixMultiply.
+ * using rsMatrixMultiply().
  *
- * @param m The matrix to set.
- * @param x The number to add to each x component.
- * @param y The number to add to each y component.
- * @param z The number to add to each z component.
+ * Parameters:
+ *   m The matrix to set.
+ *   x The number to add to each x component.
+ *   y The number to add to each y component.
+ *   z The number to add to each z component.
  */
 extern void __attribute__((overloadable))
-rsMatrixLoadTranslate(rs_matrix4x4 *m, float x, float y, float z);
+    rsMatrixLoadTranslate(rs_matrix4x4* m, float x, float y, float z);
 
-/**
- * Multiply two matrices.
+/*
+ * rsMatrixMultiply: Multiply a matrix by a vector or another matrix
  *
- * Sets \e m to the matrix product of <em>lhs * rhs</em>.
- *
- * To combine two 4x4 transformaton matrices, multiply the second transformation matrix
- * by the first transformation matrix.  E.g. to create a transformation matrix that applies
- * the transformation \e s1 followed by \e s2, call
- * <c>rsMatrixLoadMultiply(&combined, &s2, &s1)</c>.
- *
- * \warning Prior to version 21, storing the result back into right matrix is not supported and
- * will result in undefined behavior.  Use rsMatrixMulitply instead.   E.g. instead of doing
- * rsMatrixLoadMultiply (&m2r, &m2r, &m2l), use rsMatrixMultiply (&m2r, &m2l).
- * rsMatrixLoadMultiply (&m2l, &m2r, &m2l) works as expected.
- *
- * @param m The matrix to set.
- * @param lhs The left matrix of the product.
- * @param rhs The right matrix of the product.
- */
-extern void __attribute__((overloadable))
-rsMatrixLoadMultiply(rs_matrix4x4 *m, const rs_matrix4x4 *lhs, const rs_matrix4x4 *rhs);
-/**
- * \overload
- */
-extern void __attribute__((overloadable))
-rsMatrixLoadMultiply(rs_matrix3x3 *m, const rs_matrix3x3 *lhs, const rs_matrix3x3 *rhs);
-/**
- * \overload
- */
-extern void __attribute__((overloadable))
-rsMatrixLoadMultiply(rs_matrix2x2 *m, const rs_matrix2x2 *lhs, const rs_matrix2x2 *rhs);
-
-/**
- * Multiply a matrix into another one.
- *
- * Sets \e m to the matrix product <em>m * rhs</em>.
+ * For the matrix by matrix variant, sets m to the matrix product m * rhs.
  *
  * When combining two 4x4 transformation matrices using this function, the resulting
- * matrix will correspond to performing the \e rhs transformation first followed by
- * the original \e m transformation.
+ * matrix will correspond to performing the rhs transformation first followed by
+ * the original m transformation.
  *
- * @param m The left matrix of the product and the matrix to be set.
- * @param rhs The right matrix of the product.
+ * For the matrix by vector variant, returns the post-multiplication of the vector
+ * by the matrix, ie. m * in.
+ *
+ * When multiplying a float3 to a rs_matrix4x4, the vector is expanded with (1).
+ *
+ * When multiplying a float2 to a rs_matrix4x4, the vector is expanded with (0, 1).
+ *
+ * When multiplying a float2 to a rs_matrix3x3, the vector is expanded with (0).
+ *
+ * Starting with API 14, this function takes a const matrix as the first argument.
+ *
+ * Parameters:
+ *   m The left matrix of the product and the matrix to be set.
+ *   rhs The right matrix of the product.
  */
 extern void __attribute__((overloadable))
-rsMatrixMultiply(rs_matrix4x4 *m, const rs_matrix4x4 *rhs);
-/**
- * \overload
- */
-extern void __attribute__((overloadable))
-rsMatrixMultiply(rs_matrix3x3 *m, const rs_matrix3x3 *rhs);
-/**
- * \overload
- */
-extern void __attribute__((overloadable))
-rsMatrixMultiply(rs_matrix2x2 *m, const rs_matrix2x2 *rhs);
+    rsMatrixMultiply(rs_matrix4x4* m, const rs_matrix4x4* rhs);
 
-/**
- * Multiply the matrix \e m with a rotation matrix.
+extern void __attribute__((overloadable))
+    rsMatrixMultiply(rs_matrix3x3* m, const rs_matrix3x3* rhs);
+
+extern void __attribute__((overloadable))
+    rsMatrixMultiply(rs_matrix2x2* m, const rs_matrix2x2* rhs);
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 13)
+extern float4 __attribute__((overloadable))
+    rsMatrixMultiply(rs_matrix4x4* m, float4 in);
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 13)
+extern float4 __attribute__((overloadable))
+    rsMatrixMultiply(rs_matrix4x4* m, float3 in);
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 13)
+extern float4 __attribute__((overloadable))
+    rsMatrixMultiply(rs_matrix4x4* m, float2 in);
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 13)
+extern float3 __attribute__((overloadable))
+    rsMatrixMultiply(rs_matrix3x3* m, float3 in);
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 13)
+extern float3 __attribute__((overloadable))
+    rsMatrixMultiply(rs_matrix3x3* m, float2 in);
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 13)
+extern float2 __attribute__((overloadable))
+    rsMatrixMultiply(rs_matrix2x2* m, float2 in);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 14))
+extern float4 __attribute__((overloadable))
+    rsMatrixMultiply(const rs_matrix4x4* m, float4 in);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 14))
+extern float4 __attribute__((overloadable))
+    rsMatrixMultiply(const rs_matrix4x4* m, float3 in);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 14))
+extern float4 __attribute__((overloadable))
+    rsMatrixMultiply(const rs_matrix4x4* m, float2 in);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 14))
+extern float3 __attribute__((overloadable))
+    rsMatrixMultiply(const rs_matrix3x3* m, float3 in);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 14))
+extern float3 __attribute__((overloadable))
+    rsMatrixMultiply(const rs_matrix3x3* m, float2 in);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 14))
+extern float2 __attribute__((overloadable))
+    rsMatrixMultiply(const rs_matrix2x2* m, float2 in);
+#endif
+
+/*
+ * rsMatrixRotate: Apply a rotation to a transformation matrix
+ *
+ * Multiply the matrix m with a rotation matrix.
  *
  * This function modifies a transformation matrix to first do a rotation.
- * The axis of rotation is the <em>(x, y, z)</em> vector.
+ * The axis of rotation is the (x, y, z) vector.
  *
  * To apply this combined transformation to a vector, multiply
- * the vector by the created matrix using \ref rsMatrixMultiply.
+ * the vector by the created matrix using rsMatrixMultiply().
  *
- * @param m The matrix to modify.
- * @param rot How much rotation to do, in degrees.
- * @param x The x component of the vector that is the axis of rotation.
- * @param y The y component of the vector that is the axis of rotation.
- * @param z The z component of the vector that is the axis of rotation.
+ * Parameters:
+ *   m The matrix to modify.
+ *   rot How much rotation to do, in degrees.
+ *   x The x component of the vector that is the axis of rotation.
+ *   y The y component of the vector that is the axis of rotation.
+ *   z The z component of the vector that is the axis of rotation.
  */
 extern void __attribute__((overloadable))
-rsMatrixRotate(rs_matrix4x4 *m, float rot, float x, float y, float z);
+    rsMatrixRotate(rs_matrix4x4* m, float rot, float x, float y, float z);
 
-/**
- * Multiply the matrix \e m with a scaling matrix.
+/*
+ * rsMatrixScale: Apply a scaling to a transformation matrix
+ *
+ * Multiply the matrix m with a scaling matrix.
  *
  * This function modifies a transformation matrix to first do a scaling.
  * When scaling, each component of a vector is multiplied by a number.
  * This number can be negative.
  *
  * To apply this combined transformation to a vector, multiply
- * the vector by the created matrix using \ref rsMatrixMultiply.
+ * the vector by the created matrix using rsMatrixMultiply().
  *
- * @param m The matrix to modify.
- * @param x The multiple to scale the x components by.
- * @param y The multiple to scale the y components by.
- * @param z The multiple to scale the z components by.
+ * Parameters:
+ *   m The matrix to modify.
+ *   x The multiple to scale the x components by.
+ *   y The multiple to scale the y components by.
+ *   z The multiple to scale the z components by.
  */
 extern void __attribute__((overloadable))
-rsMatrixScale(rs_matrix4x4 *m, float x, float y, float z);
+    rsMatrixScale(rs_matrix4x4* m, float x, float y, float z);
 
-/**
- * Multiply the matrix \e m with a translation matrix.
+/*
+ * rsMatrixSet: Set one element
+ *
+ * Set an element of a matrix.
+ *
+ * Warning: The order of the column and row parameters may be unexpected.
+ *
+ * Parameters:
+ *   m The matrix that will be modified.
+ *   col The zero-based column of the element to be set.
+ *   row The zero-based row of the element to be set.
+ *   v The value to set.
+ */
+extern void __attribute__((overloadable))
+    rsMatrixSet(rs_matrix4x4* m, uint32_t col, uint32_t row, float v);
+
+extern void __attribute__((overloadable))
+    rsMatrixSet(rs_matrix3x3* m, uint32_t col, uint32_t row, float v);
+
+extern void __attribute__((overloadable))
+    rsMatrixSet(rs_matrix2x2* m, uint32_t col, uint32_t row, float v);
+
+/*
+ * rsMatrixTranslate: Apply a translation to a transformation matrix
+ *
+ * Multiply the matrix m with a translation matrix.
  *
  * This function modifies a transformation matrix to first
  * do a translation.  When translating, a number is added
  * to each component of a vector.
  *
  * To apply this combined transformation to a vector, multiply
- * the vector by the created matrix using \ref rsMatrixMultiply.
+ * the vector by the created matrix using rsMatrixMultiply().
  *
- * @param m The matrix to modify.
- * @param x The number to add to each x component.
- * @param y The number to add to each y component.
- * @param z The number to add to each z component.
+ * Parameters:
+ *   m The matrix to modify.
+ *   x The number to add to each x component.
+ *   y The number to add to each y component.
+ *   z The number to add to each z component.
  */
 extern void __attribute__((overloadable))
-rsMatrixTranslate(rs_matrix4x4 *m, float x, float y, float z);
+    rsMatrixTranslate(rs_matrix4x4* m, float x, float y, float z);
 
-/**
- * Load an orthographic projection matrix.
+/*
+ * rsMatrixTranspose: Transpose a matrix place
  *
- * Constructs an orthographic projection matrix, transforming the box
- * identified by the six clipping planes <em>left, right, bottom, top,
- * near, far</em> into a unit cube with a corner at
- * <em>(-1, -1, -1)</em> and the opposite at <em>(1, 1, 1)</em>.
- *
- * To apply this projection to a vector, multiply the vector by the
- * created matrix using \ref rsMatrixMultiply.
- *
- * See https://en.wikipedia.org/wiki/Orthographic_projection .
- *
- * @param m The matrix to set.
- * @param left
- * @param right
- * @param bottom
- * @param top
- * @param near
- * @param far
- */
-extern void __attribute__((overloadable))
-rsMatrixLoadOrtho(rs_matrix4x4 *m, float left, float right, float bottom, float top, float near, float far);
-
-/**
- * Load a frustum projection matrix.
- *
- * Constructs a frustum projection matrix, transforming the box
- * identified by the six clipping planes <em>left, right, bottom, top,
- * near, far</em>.
- *
- * To apply this projection to a vector, multiply the vector by the
- * created matrix using \ref rsMatrixMultiply.
- *
- * @param m The matrix to set.
- * @param left
- * @param right
- * @param bottom
- * @param top
- * @param near
- * @param far
- */
-extern void __attribute__((overloadable))
-rsMatrixLoadFrustum(rs_matrix4x4 *m, float left, float right, float bottom, float top, float near, float far);
-
-/**
- * Load a perspective projection matrix.
- *
- * Constructs a perspective projection matrix, assuming a symmetrical field of view.
- *
- * To apply this projection to a vector, multiply the vector by the
- * created matrix using \ref rsMatrixMultiply.
- *
- * @param m The matrix to set.
- * @param fovy Field of view, in degrees along the Y axis.
- * @param aspect Ratio of x / y.
- * @param near The near clipping plane.
- * @param far The far clipping plane.
- */
-extern void __attribute__((overloadable))
-rsMatrixLoadPerspective(rs_matrix4x4* m, float fovy, float aspect, float near, float far);
-
-#if !defined(RS_VERSION) || (RS_VERSION < 14)
-/**
- * Multiply a vector by a matrix.
- *
- * Returns the post-multiplication of the vector by the matrix, ie. <em>m * in</em>.
- *
- * When multiplying a \e float3 to a \e rs_matrix4x4, the vector is expanded with (1).
- *
- * When multiplying a \e float2 to a \e rs_matrix4x4, the vector is expanded with (0, 1).
- *
- * When multiplying a \e float2 to a \e rs_matrix3x3, the vector is expanded with (0).
- *
- * This function is available in API version 10-13.  Starting with API 14,
- * the function takes a const matrix as the first argument.
- */
-extern float4 __attribute__((overloadable))
-rsMatrixMultiply(rs_matrix4x4 *m, float4 in);
-
-/**
- * \overload
- */
-extern float4 __attribute__((overloadable))
-rsMatrixMultiply(rs_matrix4x4 *m, float3 in);
-
-/**
- * \overload
- */
-extern float4 __attribute__((overloadable))
-rsMatrixMultiply(rs_matrix4x4 *m, float2 in);
-
-/**
- * \overload
- */
-extern float3 __attribute__((overloadable))
-rsMatrixMultiply(rs_matrix3x3 *m, float3 in);
-
-/**
- * \overload
- */
-extern float3 __attribute__((overloadable))
-rsMatrixMultiply(rs_matrix3x3 *m, float2 in);
-
-/**
- * \overload
- */
-extern float2 __attribute__((overloadable))
-rsMatrixMultiply(rs_matrix2x2 *m, float2 in);
-#else
-/**
- * Multiply a vector by a matrix.
- *
- * Returns the post-multiplication of the vector of the matrix, i.e. <em>m * in</em>.
- *
- * When multiplying a \e float3 to a \e rs_matrix4x4, the vector is expanded with (1).
- *
- * When multiplying a \e float2 to a \e rs_matrix4x4, the vector is expanded with (0, 1).
- *
- * When multiplying a \e float2 to a \e rs_matrix3x3, the vector is expanded with (0).
- *
- * This function is available starting with API version 14.
- */
-extern float4 __attribute__((overloadable))
-rsMatrixMultiply(const rs_matrix4x4 *m, float4 in);
-
-/**
- * \overload
- */
-extern float4 __attribute__((overloadable))
-rsMatrixMultiply(const rs_matrix4x4 *m, float3 in);
-
-/**
- * \overload
- */
-extern float4 __attribute__((overloadable))
-rsMatrixMultiply(const rs_matrix4x4 *m, float2 in);
-
-/**
- * \overload
- */
-extern float3 __attribute__((overloadable))
-rsMatrixMultiply(const rs_matrix3x3 *m, float3 in);
-
-/**
- * \overload
- */
-extern float3 __attribute__((overloadable))
-rsMatrixMultiply(const rs_matrix3x3 *m, float2 in);
-
-/**
- * \overload
- */
-extern float2 __attribute__((overloadable))
-rsMatrixMultiply(const rs_matrix2x2 *m, float2 in);
-#endif
-
-
-/**
- * Inverts a matrix in place.
- *
- * Returns true if the matrix was successfully inverted.
- *
- * @param m The matrix to invert.
- */
-extern bool __attribute__((overloadable)) rsMatrixInverse(rs_matrix4x4 *m);
-
-/**
- * Inverts and transpose a matrix in place.
- *
- * The matrix is first inverted then transposed.
- * Returns true if the matrix was successfully inverted.
- *
- * @param m The matrix to modify.
- */
-extern bool __attribute__((overloadable)) rsMatrixInverseTranspose(rs_matrix4x4 *m);
-
-/**
  * Transpose the matrix m in place.
  *
- * @param m The matrix to transpose.
+ * Parameters:
+ *   m The matrix to transpose.
  */
-extern void __attribute__((overloadable)) rsMatrixTranspose(rs_matrix4x4 *m);
-/**
- * \overload
- */
-extern void __attribute__((overloadable)) rsMatrixTranspose(rs_matrix3x3 *m);
-/**
- * \overload
- */
-extern void __attribute__((overloadable)) rsMatrixTranspose(rs_matrix2x2 *m);
+extern void __attribute__((overloadable))
+    rsMatrixTranspose(rs_matrix4x4* m);
 
+extern void __attribute__((overloadable))
+    rsMatrixTranspose(rs_matrix3x3* m);
 
-#endif
+extern void __attribute__((overloadable))
+    rsMatrixTranspose(rs_matrix2x2* m);
+
+#endif // RENDERSCRIPT_RS_MATRIX_RSH
diff --git a/scriptc/rs_mesh.rsh b/scriptc/rs_mesh.rsh
index 0ecd786..c404a5f 100644
--- a/scriptc/rs_mesh.rsh
+++ b/scriptc/rs_mesh.rsh
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 The Android Open Source Project
+ * Copyright (C) 2015 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,75 +14,86 @@
  * limitations under the License.
  */
 
-/** @file rs_mesh.rsh
- *  \brief Mesh routines
- *
+// Don't edit this file!  It is auto-generated by frameworks/rs/api/gen_runtime.
+
+/*
+ * rs_mesh.rsh: Mesh routines
  *
  */
+#ifndef RENDERSCRIPT_RS_MESH_RSH
+#define RENDERSCRIPT_RS_MESH_RSH
 
-#ifndef __RS_MESH_RSH__
-#define __RS_MESH_RSH__
-
-// New API's
-#if (defined(RS_VERSION) && (RS_VERSION >= 16))
-
-/**
- * Returns the number of allocations in the mesh that contain
- * vertex data
- *
- * @param m mesh to get data from
- * @return number of allocations in the mesh that contain vertex
- *         data
- */
-extern uint32_t __attribute__((overloadable))
-    rsgMeshGetVertexAllocationCount(rs_mesh m);
-
-/**
- * Meshes could have multiple index sets, this function returns
- * the number.
- *
- * @param m mesh to get data from
- * @return number of primitive groups in the mesh. This would
- *         include simple primitives as well as allocations
- *         containing index data
- */
-extern uint32_t __attribute__((overloadable))
-    rsgMeshGetPrimitiveCount(rs_mesh m);
-
-/**
- * Returns an allocation that is part of the mesh and contains
- * vertex data, e.g. positions, normals, texcoords
- *
- * @param m mesh to get data from
- * @param index index of the vertex allocation
- * @return allocation containing vertex data
- */
-extern rs_allocation __attribute__((overloadable))
-    rsgMeshGetVertexAllocation(rs_mesh m, uint32_t index);
-
-/**
+/*
  * Returns an allocation containing index data or a null
  * allocation if only the primitive is specified
  *
- * @param m mesh to get data from
- * @param index index of the index allocation
- * @return allocation containing index data
+ * Parameters:
+ *   m mesh to get data from
+ *   index index of the index allocation
+ *
+ * Returns: allocation containing index data
  */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
 extern rs_allocation __attribute__((overloadable))
     rsgMeshGetIndexAllocation(rs_mesh m, uint32_t index);
+#endif
 
-/**
+/*
  * Returns the primitive describing how a part of the mesh is
  * rendered
  *
- * @param m mesh to get data from
- * @param index index of the primitive
- * @return primitive describing how the mesh is rendered
+ * Parameters:
+ *   m mesh to get data from
+ *   index index of the primitive
+ *
+ * Returns: primitive describing how the mesh is rendered
  */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
 extern rs_primitive __attribute__((overloadable))
     rsgMeshGetPrimitive(rs_mesh m, uint32_t index);
+#endif
 
-#endif // (defined(RS_VERSION) && (RS_VERSION >= 16))
+/*
+ * Meshes could have multiple index sets, this function returns
+ * the number.
+ *
+ * Parameters:
+ *   m mesh to get data from
+ *
+ * Returns: number of primitive groups in the mesh. This would include simple primitives as well as allocations containing index data
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+extern uint32_t __attribute__((overloadable))
+    rsgMeshGetPrimitiveCount(rs_mesh m);
+#endif
 
-#endif // __RS_MESH_RSH__
+/*
+ * Returns an allocation that is part of the mesh and contains
+ * vertex data, e.g. positions, normals, texcoords
+ *
+ * Parameters:
+ *   m mesh to get data from
+ *   index index of the vertex allocation
+ *
+ * Returns: allocation containing vertex data
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+extern rs_allocation __attribute__((overloadable))
+    rsgMeshGetVertexAllocation(rs_mesh m, uint32_t index);
+#endif
 
+/*
+ * Returns the number of allocations in the mesh that contain
+ * vertex data
+ *
+ * Parameters:
+ *   m mesh to get data from
+ *
+ * Returns: number of allocations in the mesh that contain vertex data
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+extern uint32_t __attribute__((overloadable))
+    rsgMeshGetVertexAllocationCount(rs_mesh m);
+#endif
+
+#endif // RENDERSCRIPT_RS_MESH_RSH
diff --git a/scriptc/rs_object.rsh b/scriptc/rs_object.rsh
index ed6423b..c7205e3 100644
--- a/scriptc/rs_object.rsh
+++ b/scriptc/rs_object.rsh
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011 The Android Open Source Project
+ * Copyright (C) 2015 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,216 +14,160 @@
  * limitations under the License.
  */
 
-/** @file rs_object.rsh
- *  \brief Object routines
- *
+// Don't edit this file!  It is auto-generated by frameworks/rs/api/gen_runtime.
+
+/*
+ * rs_object.rsh: Object routines
  *
  */
+#ifndef RENDERSCRIPT_RS_OBJECT_RSH
+#define RENDERSCRIPT_RS_OBJECT_RSH
 
-#ifndef __RS_OBJECT_RSH__
-#define __RS_OBJECT_RSH__
-
-
-/**
- * Copy reference to the specified object.
+/*
+ * rsClearObject: For internal use.
  *
- * @param dst
- * @param src
  */
 extern void __attribute__((overloadable))
-    rsSetObject(rs_element *dst, rs_element src);
-/**
- * \overload
- */
+    rsClearObject(rs_element* dst);
+
 extern void __attribute__((overloadable))
-    rsSetObject(rs_type *dst, rs_type src);
-/**
- * \overload
- */
+    rsClearObject(rs_type* dst);
+
 extern void __attribute__((overloadable))
-    rsSetObject(rs_allocation *dst, rs_allocation src);
-/**
- * \overload
- */
+    rsClearObject(rs_allocation* dst);
+
 extern void __attribute__((overloadable))
-    rsSetObject(rs_sampler *dst, rs_sampler src);
-/**
- * \overload
- */
+    rsClearObject(rs_sampler* dst);
+
 extern void __attribute__((overloadable))
-    rsSetObject(rs_script *dst, rs_script src);
+    rsClearObject(rs_script* dst);
 
 #ifndef __LP64__
-/**
- * \overload
- */
 extern void __attribute__((overloadable))
-    rsSetObject(rs_path *dst, rs_path src);
-/**
- * \overload
- */
-extern void __attribute__((overloadable))
-    rsSetObject(rs_mesh *dst, rs_mesh src);
-/**
- * \overload
- */
-extern void __attribute__((overloadable))
-    rsSetObject(rs_program_fragment *dst, rs_program_fragment src);
-/**
- * \overload
- */
-extern void __attribute__((overloadable))
-    rsSetObject(rs_program_vertex *dst, rs_program_vertex src);
-/**
- * \overload
- */
-extern void __attribute__((overloadable))
-    rsSetObject(rs_program_raster *dst, rs_program_raster src);
-/**
- * \overload
- */
-extern void __attribute__((overloadable))
-    rsSetObject(rs_program_store *dst, rs_program_store src);
-/**
- * \overload
- */
-extern void __attribute__((overloadable))
-    rsSetObject(rs_font *dst, rs_font src);
-#endif //__LP64__
-
-/**
- * Sets the object to NULL.
- *
- * @return bool
- */
-extern void __attribute__((overloadable))
-    rsClearObject(rs_element *dst);
-/**
- * \overload
- */
-extern void __attribute__((overloadable))
-    rsClearObject(rs_type *dst);
-/**
- * \overload
- */
-extern void __attribute__((overloadable))
-    rsClearObject(rs_allocation *dst);
-/**
- * \overload
- */
-extern void __attribute__((overloadable))
-    rsClearObject(rs_sampler *dst);
-/**
- * \overload
- */
-extern void __attribute__((overloadable))
-    rsClearObject(rs_script *dst);
-
-
-#ifndef __LP64__
-/**
- * \overload
- */
-extern void __attribute__((overloadable))
-    rsClearObject(rs_path *dst);
-/**
- * \overload
- */
-extern void __attribute__((overloadable))
-    rsClearObject(rs_mesh *dst);
-/**
- * \overload
- */
-extern void __attribute__((overloadable))
-    rsClearObject(rs_program_fragment *dst);
-/**
- * \overload
- */
-extern void __attribute__((overloadable))
-    rsClearObject(rs_program_vertex *dst);
-/**
- * \overload
- */
-extern void __attribute__((overloadable))
-    rsClearObject(rs_program_raster *dst);
-/**
- * \overload
- */
-extern void __attribute__((overloadable))
-    rsClearObject(rs_program_store *dst);
-/**
- * \overload
- */
-extern void __attribute__((overloadable))
-    rsClearObject(rs_font *dst);
-#endif //__LP64__
-
-
-/**
- * Tests if the object is valid.  Returns true if the object is valid, false if
- * it is NULL.
- *
- * @return bool
- */
-extern bool __attribute__((overloadable))
-    rsIsObject(rs_element);
-/**
- * \overload
- */
-extern bool __attribute__((overloadable))
-    rsIsObject(rs_type);
-/**
- * \overload
- */
-extern bool __attribute__((overloadable))
-    rsIsObject(rs_allocation);
-/**
- * \overload
- */
-extern bool __attribute__((overloadable))
-    rsIsObject(rs_sampler);
-/**
- * \overload
- */
-extern bool __attribute__((overloadable))
-    rsIsObject(rs_script);
-
-#ifndef __LP64__
-/**
- * \overload
- */
-extern bool __attribute__((overloadable))
-    rsIsObject(rs_path);
-/**
- * \overload
- */
-extern bool __attribute__((overloadable))
-    rsIsObject(rs_mesh);
-/**
- * \overload
- */
-extern bool __attribute__((overloadable))
-    rsIsObject(rs_program_fragment);
-/**
- * \overload
- */
-extern bool __attribute__((overloadable))
-    rsIsObject(rs_program_vertex);
-/**
- * \overload
- */
-extern bool __attribute__((overloadable))
-    rsIsObject(rs_program_raster);
-/**
- * \overload
- */
-extern bool __attribute__((overloadable))
-    rsIsObject(rs_program_store);
-/**
- * \overload
- */
-extern bool __attribute__((overloadable))
-    rsIsObject(rs_font);
-#endif //__LP64__
-
+    rsClearObject(rs_mesh* dst);
 #endif
+
+#ifndef __LP64__
+extern void __attribute__((overloadable))
+    rsClearObject(rs_program_fragment* dst);
+#endif
+
+#ifndef __LP64__
+extern void __attribute__((overloadable))
+    rsClearObject(rs_program_vertex* dst);
+#endif
+
+#ifndef __LP64__
+extern void __attribute__((overloadable))
+    rsClearObject(rs_program_raster* dst);
+#endif
+
+#ifndef __LP64__
+extern void __attribute__((overloadable))
+    rsClearObject(rs_program_store* dst);
+#endif
+
+#ifndef __LP64__
+extern void __attribute__((overloadable))
+    rsClearObject(rs_font* dst);
+#endif
+
+/*
+ * rsIsObject: For internal use.
+ *
+ */
+extern bool __attribute__((overloadable))
+    rsIsObject(rs_element v);
+
+extern bool __attribute__((overloadable))
+    rsIsObject(rs_type v);
+
+extern bool __attribute__((overloadable))
+    rsIsObject(rs_allocation v);
+
+extern bool __attribute__((overloadable))
+    rsIsObject(rs_sampler v);
+
+extern bool __attribute__((overloadable))
+    rsIsObject(rs_script v);
+
+#ifndef __LP64__
+extern bool __attribute__((overloadable))
+    rsIsObject(rs_mesh v);
+#endif
+
+#ifndef __LP64__
+extern bool __attribute__((overloadable))
+    rsIsObject(rs_program_fragment v);
+#endif
+
+#ifndef __LP64__
+extern bool __attribute__((overloadable))
+    rsIsObject(rs_program_vertex v);
+#endif
+
+#ifndef __LP64__
+extern bool __attribute__((overloadable))
+    rsIsObject(rs_program_raster v);
+#endif
+
+#ifndef __LP64__
+extern bool __attribute__((overloadable))
+    rsIsObject(rs_program_store v);
+#endif
+
+#ifndef __LP64__
+extern bool __attribute__((overloadable))
+    rsIsObject(rs_font v);
+#endif
+
+/*
+ * rsSetObject: For internal use.
+ *
+ */
+extern void __attribute__((overloadable))
+    rsSetObject(rs_element* dst, rs_element src);
+
+extern void __attribute__((overloadable))
+    rsSetObject(rs_type* dst, rs_type src);
+
+extern void __attribute__((overloadable))
+    rsSetObject(rs_allocation* dst, rs_allocation src);
+
+extern void __attribute__((overloadable))
+    rsSetObject(rs_sampler* dst, rs_sampler src);
+
+extern void __attribute__((overloadable))
+    rsSetObject(rs_script* dst, rs_script src);
+
+#ifndef __LP64__
+extern void __attribute__((overloadable))
+    rsSetObject(rs_mesh* dst, rs_mesh src);
+#endif
+
+#ifndef __LP64__
+extern void __attribute__((overloadable))
+    rsSetObject(rs_program_fragment* dst, rs_program_fragment src);
+#endif
+
+#ifndef __LP64__
+extern void __attribute__((overloadable))
+    rsSetObject(rs_program_vertex* dst, rs_program_vertex src);
+#endif
+
+#ifndef __LP64__
+extern void __attribute__((overloadable))
+    rsSetObject(rs_program_raster* dst, rs_program_raster src);
+#endif
+
+#ifndef __LP64__
+extern void __attribute__((overloadable))
+    rsSetObject(rs_program_store* dst, rs_program_store src);
+#endif
+
+#ifndef __LP64__
+extern void __attribute__((overloadable))
+    rsSetObject(rs_font* dst, rs_font src);
+#endif
+
+#endif // RENDERSCRIPT_RS_OBJECT_RSH
diff --git a/scriptc/rs_program.rsh b/scriptc/rs_program.rsh
index 299aae6..78a9848 100644
--- a/scriptc/rs_program.rsh
+++ b/scriptc/rs_program.rsh
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 The Android Open Source Project
+ * Copyright (C) 2015 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,105 +14,134 @@
  * limitations under the License.
  */
 
-/** @file rs_program.rsh
- *  \brief Program object routines
- *
+// Don't edit this file!  It is auto-generated by frameworks/rs/api/gen_runtime.
+
+/*
+ * rs_program.rsh: Program object routines
  *
  */
+#ifndef RENDERSCRIPT_RS_PROGRAM_RSH
+#define RENDERSCRIPT_RS_PROGRAM_RSH
 
-#ifndef __RS_PROGRAM_RSH__
-#define __RS_PROGRAM_RSH__
-
-#if (defined(RS_VERSION) && (RS_VERSION >= 16))
-
-/**
- * Get program store depth function
- *
- * @param ps program store to query
- */
-extern rs_depth_func __attribute__((overloadable))
-    rsgProgramStoreGetDepthFunc(rs_program_store ps);
-
-/**
- * Get program store depth mask
- *
- * @param ps program store to query
- */
-extern bool __attribute__((overloadable))
-    rsgProgramStoreIsDepthMaskEnabled(rs_program_store ps);
-/**
- * Get program store red component color mask
- *
- * @param ps program store to query
- */
-extern bool __attribute__((overloadable))
-    rsgProgramStoreIsColorMaskRedEnabled(rs_program_store ps);
-
-/**
- * Get program store green component color mask
- *
- * @param ps program store to query
- */
-extern bool __attribute__((overloadable))
-    rsgProgramStoreIsColorMaskGreenEnabled(rs_program_store ps);
-
-/**
- * Get program store blur component color mask
- *
- * @param ps program store to query
- */
-extern bool __attribute__((overloadable))
-    rsgProgramStoreIsColorMaskBlueEnabled(rs_program_store ps);
-
-/**
- * Get program store alpha component color mask
- *
- * @param ps program store to query
- */
-extern bool __attribute__((overloadable))
-    rsgProgramStoreIsColorMaskAlphaEnabled(rs_program_store ps);
-
-/**
- * Get program store blend source function
- *
- * @param ps program store to query
- */
-extern rs_blend_src_func __attribute__((overloadable))
-        rsgProgramStoreGetBlendSrcFunc(rs_program_store ps);
-
-/**
- * Get program store blend destination function
- *
- * @param ps program store to query
- */
-extern rs_blend_dst_func __attribute__((overloadable))
-    rsgProgramStoreGetBlendDstFunc(rs_program_store ps);
-
-/**
- * Get program store dither state
- *
- * @param ps program store to query
- */
-extern bool __attribute__((overloadable))
-    rsgProgramStoreIsDitherEnabled(rs_program_store ps);
-
-/**
- * Get program raster point sprite state
- *
- * @param pr program raster to query
- */
-extern bool __attribute__((overloadable))
-    rsgProgramRasterIsPointSpriteEnabled(rs_program_raster pr);
-
-/**
+/*
  * Get program raster cull mode
  *
- * @param pr program raster to query
+ * Parameters:
+ *   pr program raster to query
  */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
 extern rs_cull_mode __attribute__((overloadable))
     rsgProgramRasterGetCullMode(rs_program_raster pr);
+#endif
 
-#endif // (defined(RS_VERSION) && (RS_VERSION >= 16))
+/*
+ * Get program raster point sprite state
+ *
+ * Parameters:
+ *   pr program raster to query
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+extern bool __attribute__((overloadable))
+    rsgProgramRasterIsPointSpriteEnabled(rs_program_raster pr);
+#endif
 
-#endif // __RS_PROGRAM_RSH__
+/*
+ * Get program store blend destination function
+ *
+ * Parameters:
+ *   ps program store to query
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+extern rs_blend_dst_func __attribute__((overloadable))
+    rsgProgramStoreGetBlendDstFunc(rs_program_store ps);
+#endif
 
+/*
+ * Get program store blend source function
+ *
+ * Parameters:
+ *   ps program store to query
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+extern rs_blend_src_func __attribute__((overloadable))
+    rsgProgramStoreGetBlendSrcFunc(rs_program_store ps);
+#endif
+
+/*
+ * Get program store depth function
+ *
+ * Parameters:
+ *   ps program store to query
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+extern rs_depth_func __attribute__((overloadable))
+    rsgProgramStoreGetDepthFunc(rs_program_store ps);
+#endif
+
+/*
+ * Get program store alpha component color mask
+ *
+ * Parameters:
+ *   ps program store to query
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+extern bool __attribute__((overloadable))
+    rsgProgramStoreIsColorMaskAlphaEnabled(rs_program_store ps);
+#endif
+
+/*
+ * Get program store blur component color mask
+ *
+ * Parameters:
+ *   ps program store to query
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+extern bool __attribute__((overloadable))
+    rsgProgramStoreIsColorMaskBlueEnabled(rs_program_store ps);
+#endif
+
+/*
+ * Get program store green component color mask
+ *
+ * Parameters:
+ *   ps program store to query
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+extern bool __attribute__((overloadable))
+    rsgProgramStoreIsColorMaskGreenEnabled(rs_program_store ps);
+#endif
+
+/*
+ * Get program store red component color mask
+ *
+ * Parameters:
+ *   ps program store to query
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+extern bool __attribute__((overloadable))
+    rsgProgramStoreIsColorMaskRedEnabled(rs_program_store ps);
+#endif
+
+/*
+ * Get program store depth mask
+ *
+ * Parameters:
+ *   ps program store to query
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+extern bool __attribute__((overloadable))
+    rsgProgramStoreIsDepthMaskEnabled(rs_program_store ps);
+#endif
+
+/*
+ * Get program store dither state
+ *
+ * Parameters:
+ *   ps program store to query
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+extern bool __attribute__((overloadable))
+    rsgProgramStoreIsDitherEnabled(rs_program_store ps);
+#endif
+
+#endif // RENDERSCRIPT_RS_PROGRAM_RSH
diff --git a/scriptc/rs_quaternion.rsh b/scriptc/rs_quaternion.rsh
index d2ec24c..c6ece96 100644
--- a/scriptc/rs_quaternion.rsh
+++ b/scriptc/rs_quaternion.rsh
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011 The Android Open Source Project
+ * Copyright (C) 2015 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,81 +14,101 @@
  * limitations under the License.
  */
 
-/** @file rs_quaternion.rsh
- *  \brief Quaternion routines
- *
+// Don't edit this file!  It is auto-generated by frameworks/rs/api/gen_runtime.
+
+/*
+ * rs_quaternion.rsh: Quaternion routines
  *
  */
+#ifndef RENDERSCRIPT_RS_QUATERNION_RSH
+#define RENDERSCRIPT_RS_QUATERNION_RSH
 
-#ifndef __RS_QUATERNION_RSH__
-#define __RS_QUATERNION_RSH__
-
-
-/**
- * Set the quaternion components
- * @param q destination quaternion
- * @param w component
- * @param x component
- * @param y component
- * @param z component
- */
-static void __attribute__((overloadable))
-rsQuaternionSet(rs_quaternion *q, float w, float x, float y, float z) {
-    q->w = w;
-    q->x = x;
-    q->y = y;
-    q->z = z;
-}
-
-/**
- * Set the quaternion from another quaternion
- * @param q destination quaternion
- * @param rhs source quaternion
- */
-static void __attribute__((overloadable))
-rsQuaternionSet(rs_quaternion *q, const rs_quaternion *rhs) {
-    q->w = rhs->w;
-    q->x = rhs->x;
-    q->y = rhs->y;
-    q->z = rhs->z;
-}
-
-/**
- * Multiply quaternion by a scalar
- * @param q quaternion to multiply
- * @param s scalar
- */
-static void __attribute__((overloadable))
-rsQuaternionMultiply(rs_quaternion *q, float s) {
-    q->w *= s;
-    q->x *= s;
-    q->y *= s;
-    q->z *= s;
-}
-
-/**
+/*
  * Add two quaternions
- * @param q destination quaternion to add to
- * @param rhs right hand side quaternion to add
+ *
+ * Parameters:
+ *   q destination quaternion to add to
+ *   rhs right hand side quaternion to add
  */
-static void
-rsQuaternionAdd(rs_quaternion *q, const rs_quaternion *rhs) {
+static inline void __attribute__((overloadable))
+    rsQuaternionAdd(rs_quaternion* q, const rs_quaternion* rhs) {
     q->w *= rhs->w;
     q->x *= rhs->x;
     q->y *= rhs->y;
     q->z *= rhs->z;
 }
 
-/**
- * Loads a quaternion that represents a rotation about an arbitrary unit vector
- * @param q quaternion to set
- * @param rot angle to rotate by
- * @param x component of a vector
- * @param y component of a vector
- * @param z component of a vector
+/*
+ * Conjugates the quaternion
+ *
+ * Parameters:
+ *   q quaternion to conjugate
  */
-static void
-rsQuaternionLoadRotateUnit(rs_quaternion *q, float rot, float x, float y, float z) {
+static inline void __attribute__((overloadable))
+    rsQuaternionConjugate(rs_quaternion* q) {
+    q->x = -q->x;
+    q->y = -q->y;
+    q->z = -q->z;
+}
+
+/*
+ * Dot product of two quaternions
+ *
+ * Parameters:
+ *   q0 first quaternion
+ *   q1 second quaternion
+ *
+ * Returns: dot product between q0 and q1
+ */
+static inline float __attribute__((overloadable))
+    rsQuaternionDot(const rs_quaternion* q0, const rs_quaternion* q1) {
+    return q0->w*q1->w + q0->x*q1->x + q0->y*q1->y + q0->z*q1->z;
+}
+
+/*
+ * Computes rotation matrix from the normalized quaternion
+ *
+ * Parameters:
+ *   m resulting matrix
+ *   q normalized quaternion
+ */
+static inline void __attribute__((overloadable))
+    rsQuaternionGetMatrixUnit(rs_matrix4x4* m, const rs_quaternion* q) {
+    float xx = q->x * q->x;
+    float xy = q->x * q->y;
+    float xz = q->x * q->z;
+    float xw = q->x * q->w;
+    float yy = q->y * q->y;
+    float yz = q->y * q->z;
+    float yw = q->y * q->w;
+    float zz = q->z * q->z;
+    float zw = q->z * q->w;
+
+    m->m[0]  = 1.0f - 2.0f * ( yy + zz );
+    m->m[4]  =        2.0f * ( xy - zw );
+    m->m[8]  =        2.0f * ( xz + yw );
+    m->m[1]  =        2.0f * ( xy + zw );
+    m->m[5]  = 1.0f - 2.0f * ( xx + zz );
+    m->m[9]  =        2.0f * ( yz - xw );
+    m->m[2]  =        2.0f * ( xz - yw );
+    m->m[6]  =        2.0f * ( yz + xw );
+    m->m[10] = 1.0f - 2.0f * ( xx + yy );
+    m->m[3]  = m->m[7] = m->m[11] = m->m[12] = m->m[13] = m->m[14] = 0.0f;
+    m->m[15] = 1.0f;
+}
+
+/*
+ * Loads a quaternion that represents a rotation about an arbitrary unit vector
+ *
+ * Parameters:
+ *   q quaternion to set
+ *   rot rot angle to rotate by
+ *   x component of a vector
+ *   y component of a vector
+ *   z component of a vector
+ */
+static inline void __attribute__((overloadable))
+    rsQuaternionLoadRotateUnit(rs_quaternion* q, float rot, float x, float y, float z) {
     rot *= (float)(M_PI / 180.0f) * 0.5f;
     float c = cos(rot);
     float s = sin(rot);
@@ -99,17 +119,46 @@
     q->z = z * s;
 }
 
-/**
+/*
+ * Set the quaternion from components or from another quaternion.
+ *
+ * Parameters:
+ *   q destination quaternion
+ *   w component
+ *   x component
+ *   y component
+ *   z component
+ *   rhs source quaternion
+ */
+static inline void __attribute__((overloadable))
+    rsQuaternionSet(rs_quaternion* q, float w, float x, float y, float z) {
+    q->w = w;
+    q->x = x;
+    q->y = y;
+    q->z = z;
+}
+
+static inline void __attribute__((overloadable))
+    rsQuaternionSet(rs_quaternion* q, const rs_quaternion* rhs) {
+    q->w = rhs->w;
+    q->x = rhs->x;
+    q->y = rhs->y;
+    q->z = rhs->z;
+}
+
+/*
  * Loads a quaternion that represents a rotation about an arbitrary vector
  * (doesn't have to be unit)
- * @param q quaternion to set
- * @param rot angle to rotate by
- * @param x component of a vector
- * @param y component of a vector
- * @param z component of a vector
+ *
+ * Parameters:
+ *   q quaternion to set
+ *   rot angle to rotate by
+ *   x component of a vector
+ *   y component of a vector
+ *   z component of a vector
  */
-static void
-rsQuaternionLoadRotate(rs_quaternion *q, float rot, float x, float y, float z) {
+static inline void __attribute__((overloadable))
+    rsQuaternionLoadRotate(rs_quaternion* q, float rot, float x, float y, float z) {
     const float len = x*x + y*y + z*z;
     if (len != 1) {
         const float recipLen = 1.f / sqrt(len);
@@ -120,48 +169,42 @@
     rsQuaternionLoadRotateUnit(q, rot, x, y, z);
 }
 
-/**
- * Conjugates the quaternion
- * @param q quaternion to conjugate
- */
-static void
-rsQuaternionConjugate(rs_quaternion *q) {
-    q->x = -q->x;
-    q->y = -q->y;
-    q->z = -q->z;
-}
-
-/**
- * Dot product of two quaternions
- * @param q0 first quaternion
- * @param q1 second quaternion
- * @return dot product between q0 and q1
- */
-static float
-rsQuaternionDot(const rs_quaternion *q0, const rs_quaternion *q1) {
-    return q0->w*q1->w + q0->x*q1->x + q0->y*q1->y + q0->z*q1->z;
-}
-
-/**
+/*
  * Normalizes the quaternion
- * @param q quaternion to normalize
+ *
+ * Parameters:
+ *   q quaternion to normalize
  */
-static void
-rsQuaternionNormalize(rs_quaternion *q) {
+static inline void __attribute__((overloadable))
+    rsQuaternionNormalize(rs_quaternion* q) {
     const float len = rsQuaternionDot(q, q);
     if (len != 1) {
         const float recipLen = 1.f / sqrt(len);
-        rsQuaternionMultiply(q, recipLen);
+        q->w *= recipLen;
+        q->x *= recipLen;
+        q->y *= recipLen;
+        q->z *= recipLen;
     }
 }
 
-/**
- * Multiply quaternion by another quaternion
- * @param q destination quaternion
- * @param rhs right hand side quaternion to multiply by
+/*
+ * Multiply quaternion by a scalar or another quaternion
+ *
+ * Parameters:
+ *   q destination quaternion
+ *   s scalar
+ *   rhs right hand side quaternion to multiply by
  */
-static void __attribute__((overloadable))
-rsQuaternionMultiply(rs_quaternion *q, const rs_quaternion *rhs) {
+static inline void __attribute__((overloadable))
+    rsQuaternionMultiply(rs_quaternion* q, float s) {
+    q->w *= s;
+    q->x *= s;
+    q->y *= s;
+    q->z *= s;
+}
+
+static inline void __attribute__((overloadable))
+    rsQuaternionMultiply(rs_quaternion* q, const rs_quaternion* rhs) {
     rs_quaternion qtmp;
     rsQuaternionSet(&qtmp, q);
 
@@ -172,15 +215,17 @@
     rsQuaternionNormalize(q);
 }
 
-/**
+/*
  * Performs spherical linear interpolation between two quaternions
- * @param q result quaternion from interpolation
- * @param q0 first param
- * @param q1 second param
- * @param t how much to interpolate by
+ *
+ * Parameters:
+ *   q result quaternion from interpolation
+ *   q0 first param
+ *   q1 second param
+ *   t how much to interpolate by
  */
-static void
-rsQuaternionSlerp(rs_quaternion *q, const rs_quaternion *q0, const rs_quaternion *q1, float t) {
+static inline void __attribute__((overloadable))
+    rsQuaternionSlerp(rs_quaternion* q, const rs_quaternion* q0, const rs_quaternion* q1, float t) {
     if (t <= 0.0f) {
         rsQuaternionSet(q, q0);
         return;
@@ -221,33 +266,4 @@
                         tempq0.y*scale + tempq1.y*invScale, tempq0.z*scale + tempq1.z*invScale);
 }
 
-/**
- * Computes rotation matrix from the normalized quaternion
- * @param m resulting matrix
- * @param q normalized quaternion
- */
-static void rsQuaternionGetMatrixUnit(rs_matrix4x4 *m, const rs_quaternion *q) {
-    float xx = q->x * q->x;
-    float xy = q->x * q->y;
-    float xz = q->x * q->z;
-    float xw = q->x * q->w;
-    float yy = q->y * q->y;
-    float yz = q->y * q->z;
-    float yw = q->y * q->w;
-    float zz = q->z * q->z;
-    float zw = q->z * q->w;
-
-    m->m[0]  = 1.0f - 2.0f * ( yy + zz );
-    m->m[4]  =        2.0f * ( xy - zw );
-    m->m[8]  =        2.0f * ( xz + yw );
-    m->m[1]  =        2.0f * ( xy + zw );
-    m->m[5]  = 1.0f - 2.0f * ( xx + zz );
-    m->m[9]  =        2.0f * ( yz - xw );
-    m->m[2]  =        2.0f * ( xz - yw );
-    m->m[6]  =        2.0f * ( yz + xw );
-    m->m[10] = 1.0f - 2.0f * ( xx + yy );
-    m->m[3]  = m->m[7] = m->m[11] = m->m[12] = m->m[13] = m->m[14] = 0.0f;
-    m->m[15] = 1.0f;
-}
-
-#endif
+#endif // RENDERSCRIPT_RS_QUATERNION_RSH
diff --git a/scriptc/rs_sampler.rsh b/scriptc/rs_sampler.rsh
index 2ff426c..4b1b778 100644
--- a/scriptc/rs_sampler.rsh
+++ b/scriptc/rs_sampler.rsh
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 The Android Open Source Project
+ * Copyright (C) 2015 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,64 +14,78 @@
  * limitations under the License.
  */
 
-/** @file rs_sampler.rsh
- *  \brief Sampler routines
- *
+// Don't edit this file!  It is auto-generated by frameworks/rs/api/gen_runtime.
+
+/*
+ * rs_sampler.rsh: Sampler routines
  *
  */
+#ifndef RENDERSCRIPT_RS_SAMPLER_RSH
+#define RENDERSCRIPT_RS_SAMPLER_RSH
 
-#ifndef __RS_SAMPLER_RSH__
-#define __RS_SAMPLER_RSH__
-
-// New API's
+/*
+ *  Get sampler anisotropy
+ *
+ * Parameters:
+ *   s sampler to query
+ *
+ * Returns: anisotropy
+ */
 #if (defined(RS_VERSION) && (RS_VERSION >= 16))
-
-/**
- * Get sampler minification value
- *
- * @param s sampler to query
- * @return minification value
- */
-extern rs_sampler_value __attribute__((overloadable))
-    rsSamplerGetMinification(rs_sampler s);
-
-/**
- * Get sampler magnification value
- *
- * @param s sampler to query
- * @return magnification value
- */
-extern rs_sampler_value __attribute__((overloadable))
-    rsSamplerGetMagnification(rs_sampler s);
-
-/**
- * Get sampler wrap S value
- *
- * @param s sampler to query
- * @return wrap S value
- */
-extern rs_sampler_value __attribute__((overloadable))
-    rsSamplerGetWrapS(rs_sampler s);
-
-/**
- * Get sampler wrap T value
- *
- * @param s sampler to query
- * @return wrap T value
- */
-extern rs_sampler_value __attribute__((overloadable))
-    rsSamplerGetWrapT(rs_sampler s);
-
-/**
-  Get sampler anisotropy
- *
- * @param s sampler to query
- * @return anisotropy
- */
 extern float __attribute__((overloadable))
     rsSamplerGetAnisotropy(rs_sampler s);
+#endif
 
-#endif // (defined(RS_VERSION) && (RS_VERSION >= 16))
+/*
+ * Get sampler magnification value
+ *
+ * Parameters:
+ *   s sampler to query
+ *
+ * Returns: magnification value
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+extern rs_sampler_value __attribute__((overloadable))
+    rsSamplerGetMagnification(rs_sampler s);
+#endif
 
-#endif // __RS_SAMPLER_RSH__
+/*
+ * Get sampler minification value
+ *
+ * Parameters:
+ *   s sampler to query
+ *
+ * Returns: minification value
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+extern rs_sampler_value __attribute__((overloadable))
+    rsSamplerGetMinification(rs_sampler s);
+#endif
 
+/*
+ * Get sampler wrap S value
+ *
+ * Parameters:
+ *   s sampler to query
+ *
+ * Returns: wrap S value
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+extern rs_sampler_value __attribute__((overloadable))
+    rsSamplerGetWrapS(rs_sampler s);
+#endif
+
+/*
+ * Get sampler wrap T value
+ *
+ * Parameters:
+ *   s sampler to query
+ *
+ * Returns: wrap T value
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+extern rs_sampler_value __attribute__((overloadable))
+    rsSamplerGetWrapT(rs_sampler s);
+#endif
+
+#endif // RENDERSCRIPT_RS_SAMPLER_RSH
diff --git a/scriptc/rs_time.rsh b/scriptc/rs_time.rsh
index abcb88b..d966d30 100644
--- a/scriptc/rs_time.rsh
+++ b/scriptc/rs_time.rsh
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011 The Android Open Source Project
+ * Copyright (C) 2015 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,102 +14,99 @@
  * limitations under the License.
  */
 
-/** @file rs_time.rsh
- *  \brief RenderScript time routines
+// Don't edit this file!  It is auto-generated by frameworks/rs/api/gen_runtime.
+
+/*
+ * rs_time.rsh: RenderScript time routines
  *
- *  This file contains RenderScript functions relating to time and date
- *  manipulation.
+ * This file contains RenderScript functions relating to time and date manipulation.
  */
+#ifndef RENDERSCRIPT_RS_TIME_RSH
+#define RENDERSCRIPT_RS_TIME_RSH
 
-#ifndef __RS_TIME_RSH__
-#define __RS_TIME_RSH__
-
-/**
+/*
+ * rs_time_t: Seconds since January 1, 1970
+ *
  * Calendar time interpreted as seconds elapsed since the Epoch (00:00:00 on
  * January 1, 1970, Coordinated Universal Time (UTC)).
  */
 #ifndef __LP64__
 typedef int rs_time_t;
-#else
+#endif
+
+#ifdef __LP64__
 typedef long rs_time_t;
 #endif
 
-/**
- * Data structure for broken-down time components.
+
+/*
+ * rs_tm: Date and time structure
  *
- * tm_sec   - Seconds after the minute. This ranges from 0 to 59, but possibly
- *            up to 60 for leap seconds.
- * tm_min   - Minutes after the hour. This ranges from 0 to 59.
- * tm_hour  - Hours past midnight. This ranges from 0 to 23.
- * tm_mday  - Day of the month. This ranges from 1 to 31.
- * tm_mon   - Months since January. This ranges from 0 to 11.
- * tm_year  - Years since 1900.
- * tm_wday  - Days since Sunday. This ranges from 0 to 6.
- * tm_yday  - Days since January 1. This ranges from 0 to 365.
- * tm_isdst - Flag to indicate whether daylight saving time is in effect. The
- *            value is positive if it is in effect, zero if it is not, and
- *            negative if the information is not available.
+ * Data structure for broken-down time components.
  */
 typedef struct {
-    int tm_sec;     ///< seconds
-    int tm_min;     ///< minutes
-    int tm_hour;    ///< hours
-    int tm_mday;    ///< day of the month
-    int tm_mon;     ///< month
-    int tm_year;    ///< year
-    int tm_wday;    ///< day of the week
-    int tm_yday;    ///< day of the year
-    int tm_isdst;   ///< daylight savings time
+    int tm_sec; // Seconds after the minute. This ranges from 0 to 59, but possibly up to 60 for leap seconds.
+    int tm_min; // Minutes after the hour. This ranges from 0 to 59.
+    int tm_hour; // Hours past midnight. This ranges from 0 to 23.
+    int tm_mday; // Day of the month. This ranges from 1 to 31.
+    int tm_mon; // Months since January. This ranges from 0 to 11.
+    int tm_year; // Years since 1900.
+    int tm_wday; // Days since Sunday. This ranges from 0 to 6.
+    int tm_yday; // Days since January 1. This ranges from 0 to 365.
+    int tm_isdst; // Flag to indicate whether daylight saving time is in effect. The value is positive if it is in effect, zero if it is not, and negative if the information is not available.
 } rs_tm;
 
-/**
- * Returns the number of seconds since the Epoch (00:00:00 UTC, January 1,
- * 1970). If @p timer is non-NULL, the result is also stored in the memory
- * pointed to by this variable. If an error occurs, a value of -1 is returned.
- *
- * @param timer Location to also store the returned calendar time.
- *
- * @return Seconds since the Epoch.
- */
-extern rs_time_t __attribute__((overloadable))
-    rsTime(rs_time_t *timer);
 
-/**
- * Converts the time specified by @p timer into broken-down time and stores it
- * in @p local. This function also returns a pointer to @p local. If @p local
- * is NULL, this function does nothing and returns NULL.
- *
- * @param local Broken-down time.
- * @param timer Input time as calendar time.
- *
- * @return Pointer to broken-down time (same as input @p local).
- */
-extern rs_tm * __attribute__((overloadable))
-    rsLocaltime(rs_tm *local, const rs_time_t *timer);
-
-/**
- * Returns the current system clock (uptime) in milliseconds.
- *
- * @return Uptime in milliseconds.
- */
-extern int64_t __attribute__((overloadable))
-    rsUptimeMillis(void);
-
-/**
- * Returns the current system clock (uptime) in nanoseconds.
- *
- * @return Uptime in nanoseconds.
- */
-extern int64_t __attribute__((overloadable))
-    rsUptimeNanos(void);
-
-/**
+/*
  * Returns the time in seconds since this function was last called in this
  * script.
  *
- * @return Time in seconds.
+ * Returns: Time in seconds.
  */
 extern float __attribute__((overloadable))
     rsGetDt(void);
 
-#endif
+/*
+ * Converts the time specified by p timer into broken-down time and stores it
+ * in p local. This function also returns a pointer to p local. If p local
+ * is NULL, this function does nothing and returns NULL.
+ *
+ * Parameters:
+ *   local Broken-down time.
+ *   timer Input time as calendar time.
+ *
+ * Returns: Pointer to broken-down time (same as input p local).
+ */
+extern rs_tm* __attribute__((overloadable))
+    rsLocaltime(rs_tm* local, const rs_time_t* timer);
+
+/*
+ * Returns the number of seconds since the Epoch (00:00:00 UTC, January 1,
+ * 1970). If p timer is non-NULL, the result is also stored in the memory
+ * pointed to by this variable. If an error occurs, a value of -1 is returned.
+ *
+ * Parameters:
+ *   timer Location to also store the returned calendar time.
+ *
+ * Returns: Seconds since the Epoch.
+ */
+extern rs_time_t __attribute__((overloadable))
+    rsTime(rs_time_t* timer);
+
+/*
+ * Returns the current system clock (uptime) in milliseconds.
+ *
+ * Returns: Uptime in milliseconds.
+ */
+extern int64_t __attribute__((overloadable))
+    rsUptimeMillis(void);
+
+/*
+ * Returns the current system clock (uptime) in nanoseconds.
+ *
+ * Returns: Uptime in nanoseconds.
+ */
+extern int64_t __attribute__((overloadable))
+    rsUptimeNanos(void);
+
+#endif // RENDERSCRIPT_RS_TIME_RSH
diff --git a/scriptc/rs_types.rsh b/scriptc/rs_types.rsh
index 7c6c6a4..e7cbc43 100644
--- a/scriptc/rs_types.rsh
+++ b/scriptc/rs_types.rsh
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 The Android Open Source Project
+ * Copyright (C) 2015 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -14,363 +14,669 @@
  * limitations under the License.
  */
 
-/** @file rs_types.rsh
+// Don't edit this file!  It is auto-generated by frameworks/rs/api/gen_runtime.
+
+/*
+ * rs_types.rsh: Standard RenderScript types
  *
- *  Define the standard RenderScript types
- *
- *  Integers
+ *  Integers:
  *  8 bit: char, int8_t
  *  16 bit: short, int16_t
  *  32 bit: int, in32_t
  *  64 bit: long, long long, int64_t
  *
- *  Unsigned Integers
+ *  Unsigned integers:
  *  8 bit: uchar, uint8_t
  *  16 bit: ushort, uint16_t
  *  32 bit: uint, uint32_t
  *  64 bit: ulong, uint64_t
  *
- *  Floating point
+ *  Floating point:
  *  32 bit: float
  *  64 bit: double
  *
  *  Vectors of length 2, 3, and 4 are supported for all the types above.
- *
  */
-
-#ifndef __RS_TYPES_RSH__
-#define __RS_TYPES_RSH__
-
-/* Constants */
-#define M_E         2.718281828459045235360287471352662498f     /* e */
-#define M_LOG2E     1.442695040888963407359924681001892137f     /* log_2 e */
-#define M_LOG10E    0.434294481903251827651128918916605082f     /* log_10 e */
-#define M_LN2       0.693147180559945309417232121458176568f     /* log_e 2 */
-#define M_LN10      2.302585092994045684017991454684364208f     /* log_e 10 */
-#define M_PI        3.141592653589793238462643383279502884f     /* pi */
-#define M_PI_2      1.570796326794896619231321691639751442f     /* pi/2 */
-#define M_PI_4      0.785398163397448309615660845819875721f     /* pi/4 */
-#define M_1_PI      0.318309886183790671537767526745028724f     /* 1/pi */
-#define M_2_PI      0.636619772367581343075535053490057448f     /* 2/pi */
-#define M_2_PIl     0.636619772367581343075535053490057448f     /* Deprecated */
-#define M_2_SQRTPI  1.128379167095512573896158903121545172f     /* 2/sqrt(pi) */
-#define M_SQRT2     1.414213562373095048801688724209698079f     /* sqrt(2) */
-#define M_SQRT1_2   0.707106781186547524400844362104849039f     /* 1/sqrt(2) */
+#ifndef RENDERSCRIPT_RS_TYPES_RSH
+#define RENDERSCRIPT_RS_TYPES_RSH
 
 #include "stdbool.h"
-/**
+
+#define RS_PACKED __attribute__((packed, aligned(4)))
+#define NULL ((void *)0)
+
+// Opaque handle to a RenderScript object. Do not use this directly.
+#ifndef __LP64__
+#define _RS_HANDLE \
+struct {\
+  const int* const p;\
+} __attribute__((packed, aligned(4)))
+#else
+#define _RS_HANDLE \
+struct {\
+  const long* const p;\
+  const long* const r;\
+  const long* const v1;\
+  const long* const v2;\
+}
+#endif
+
+/*
+ * M_1_PI: 1 / pi, as a 32 bit float
+ *
+ * The inverse of pi, as a 32 bit float.
+ */
+#define M_1_PI 0.318309886183790671537767526745028724f
+
+/*
+ * M_2_PI: 2 / pi, as a 32 bit float
+ *
+ * 2 divided by pi, as a 32 bit float.
+ */
+#define M_2_PI 0.636619772367581343075535053490057448f
+
+/*
+ * M_2_PIl: Deprecated.  Use M_2_PI instead.
+ *
+ */
+#define M_2_PIl 0.636619772367581343075535053490057448f
+
+/*
+ * M_2_SQRTPI: 2 / sqrt(pi), as a 32 bit float
+ *
+ * 2 divided by the square root of pi, as a 32 bit float.
+ */
+#define M_2_SQRTPI 1.128379167095512573896158903121545172f
+
+/*
+ * M_E: e, as a 32 bit float
+ *
+ * The number e, the base of the natural logarithm, as a 32 bit float.
+ */
+#define M_E 2.718281828459045235360287471352662498f
+
+/*
+ * M_LN10: log_e(10), as a 32 bit float
+ *
+ * The natural logarithm of 10, as a 32 bit float.
+ */
+#define M_LN10 2.302585092994045684017991454684364208f
+
+/*
+ * M_LN2: log_e(2), as a 32 bit float
+ *
+ * The natural logarithm of 2, as a 32 bit float.
+ */
+#define M_LN2 0.693147180559945309417232121458176568f
+
+/*
+ * M_LOG10E: log_10(e), as a 32 bit float
+ *
+ * The logarithm base 10 of e, as a 32 bit float.
+ */
+#define M_LOG10E 0.434294481903251827651128918916605082f
+
+/*
+ * M_LOG2E: log_2(e), as a 32 bit float
+ *
+ * The logarithm base 2 of e, as a 32 bit float.
+ */
+#define M_LOG2E 1.442695040888963407359924681001892137f
+
+/*
+ * M_PI: pi, as a 32 bit float
+ *
+ * The constant pi, as a 32 bit float.
+ */
+#define M_PI 3.141592653589793238462643383279502884f
+
+/*
+ * M_PI_2: pi / 2, as a 32 bit float
+ *
+ * Pi divided by 2, as a 32 bit float.
+ */
+#define M_PI_2 1.570796326794896619231321691639751442f
+
+/*
+ * M_PI_4: pi / 4, as a 32 bit float
+ *
+ * Pi divided by 4, as a 32 bit float.
+ */
+#define M_PI_4 0.785398163397448309615660845819875721f
+
+/*
+ * M_SQRT1_2: 1 / sqrt(2), as a 32 bit float
+ *
+ * The inverse of the square root of 2, as a 32 bit float.
+ */
+#define M_SQRT1_2 0.707106781186547524400844362104849039f
+
+/*
+ * M_SQRT2: sqrt(2), as a 32 bit float
+ *
+ * The square root of 2, as a 32 bit float.
+ */
+#define M_SQRT2 1.414213562373095048801688724209698079f
+
+/*
+ * int8_t: 8 bit signed integer
+ *
  * 8 bit integer type
  */
 typedef char int8_t;
-/**
+
+
+/*
+ * int16_t: 16 bit signed integer
+ *
  * 16 bit integer type
  */
 typedef short int16_t;
-/**
+
+
+/*
+ * int32_t: 32 bit signed integer
+ *
  * 32 bit integer type
  */
 typedef int int32_t;
-/**
+
+
+/*
+ * int64_t: 64 bit signed integer
+ *
  * 64 bit integer type
  */
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-    typedef long int64_t;
-#else
-    typedef long long int64_t;
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+typedef long long int64_t;
 #endif
-/**
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+typedef long int64_t;
+#endif
+
+
+/*
+ * uint8_t: 8 bit unsigned integer
+ *
  * 8 bit unsigned integer type
  */
 typedef unsigned char uint8_t;
-/**
+
+
+/*
+ * uint16_t: 16 bit unsigned integer
+ *
  * 16 bit unsigned integer type
  */
 typedef unsigned short uint16_t;
-/**
+
+
+/*
+ * uint32_t: 32 bit unsigned integer
+ *
  * 32 bit unsigned integer type
  */
 typedef unsigned int uint32_t;
-/**
+
+
+/*
+ * uint64_t: 64 bit unsigned integer
+ *
  * 64 bit unsigned integer type
  */
-#if (defined(RS_VERSION) && (RS_VERSION >= 21))
-    typedef unsigned long uint64_t;
-#else
-    typedef unsigned long long uint64_t;
+#if !defined(RS_VERSION) || (RS_VERSION <= 20)
+typedef unsigned long long uint64_t;
 #endif
-/**
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+typedef unsigned long uint64_t;
+#endif
+
+
+/*
+ * uchar: 8 bit unsigned integer
+ *
  * 8 bit unsigned integer type
  */
 typedef uint8_t uchar;
-/**
+
+
+/*
+ * ushort: 16 bit unsigned integer
+ *
  * 16 bit unsigned integer type
  */
 typedef uint16_t ushort;
-/**
+
+
+/*
+ * uint: 32 bit unsigned integer
+ *
  * 32 bit unsigned integer type
  */
 typedef uint32_t uint;
-/**
+
+
+/*
+ * ulong: 64 bit unsigned integer
+ *
  * Typedef for unsigned long (use for 64-bit unsigned integers)
  */
 typedef uint64_t ulong;
-/**
+
+
+/*
+ * size_t: Unsigned size type
+ *
  * Typedef for size_t
  */
+#ifdef __LP64__
+typedef uint64_t size_t;
+#endif
+
 #ifndef __LP64__
 typedef uint32_t size_t;
-typedef int32_t ssize_t;
-#else
-typedef uint64_t size_t;
+#endif
+
+
+/*
+ * ssize_t: Signed size type
+ *
+ * Typedef for ssize_t
+ */
+#ifdef __LP64__
 typedef int64_t ssize_t;
 #endif
 
 #ifndef __LP64__
-#define RS_BASE_OBJ typedef struct { const int* const p; } __attribute__((packed, aligned(4)))
-#else
-#define RS_BASE_OBJ typedef struct { const long* const p; const long* const r; const long* const v1; const long* const v2; }
+typedef int32_t ssize_t;
 #endif
 
-/**
- * \brief Opaque handle to a RenderScript element.
+
+/*
+ * rs_element: Handle to an element
  *
+ * Opaque handle to a RenderScript element.
  * See: android.renderscript.Element
  */
-RS_BASE_OBJ rs_element;
-/**
- * \brief Opaque handle to a RenderScript type.
+typedef _RS_HANDLE rs_element;
+
+
+/*
+ * rs_type: Handle to a Type
  *
+ * Opaque handle to a RenderScript type.
  * See: android.renderscript.Type
  */
-RS_BASE_OBJ rs_type;
-/**
- * \brief Opaque handle to a RenderScript allocation.
+typedef _RS_HANDLE rs_type;
+
+
+/*
+ * rs_allocation: Handle to an allocation
  *
+ * Opaque handle to a RenderScript allocation.
  * See: android.renderscript.Allocation
  */
-RS_BASE_OBJ rs_allocation;
-/**
- * \brief Opaque handle to a RenderScript sampler object.
+typedef _RS_HANDLE rs_allocation;
+
+
+/*
+ * rs_sampler: Handle to a Sampler
  *
+ * Opaque handle to a RenderScript sampler object.
  * See: android.renderscript.Sampler
  */
-RS_BASE_OBJ rs_sampler;
-/**
- * \brief Opaque handle to a RenderScript script object.
+typedef _RS_HANDLE rs_sampler;
+
+
+/*
+ * rs_script: Handle to a Script
  *
+ * Opaque handle to a RenderScript script object.
  * See: android.renderscript.ScriptC
  */
-RS_BASE_OBJ rs_script;
+typedef _RS_HANDLE rs_script;
 
-#ifndef __LP64__
-/**
- * \brief Opaque handle to a RenderScript mesh object.
+
+/*
+ * rs_mesh: Handle to a Mesh
  *
+ * Opaque handle to a RenderScript mesh object.
  * See: android.renderscript.Mesh
  */
-typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_mesh;
-/**
- * \brief Opaque handle to a RenderScript Path object.
+#ifndef __LP64__
+typedef _RS_HANDLE rs_mesh;
+#endif
+
+
+/*
+ * rs_program_fragment: Handle to a ProgramFragment
  *
- * See: android.renderscript.Path
- */
-typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_path;
-/**
- * \brief Opaque handle to a RenderScript ProgramFragment object.
- *
+ * Opaque handle to a RenderScript ProgramFragment object.
  * See: android.renderscript.ProgramFragment
  */
-typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_program_fragment;
-/**
- * \brief Opaque handle to a RenderScript ProgramVertex object.
+#ifndef __LP64__
+typedef _RS_HANDLE rs_program_fragment;
+#endif
+
+
+/*
+ * rs_program_vertex: Handle to a ProgramVertex
  *
+ * Opaque handle to a RenderScript ProgramVertex object.
  * See: android.renderscript.ProgramVertex
  */
-typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_program_vertex;
-/**
- * \brief Opaque handle to a RenderScript ProgramRaster object.
+#ifndef __LP64__
+typedef _RS_HANDLE rs_program_vertex;
+#endif
+
+
+/*
+ * rs_program_raster: Handle to a ProgramRaster
  *
+ * Opaque handle to a RenderScript ProgramRaster object.
  * See: android.renderscript.ProgramRaster
  */
-typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_program_raster;
-/**
- * \brief Opaque handle to a RenderScript ProgramStore object.
+#ifndef __LP64__
+typedef _RS_HANDLE rs_program_raster;
+#endif
+
+
+/*
+ * rs_program_store: Handle to a ProgramStore
  *
+ * Opaque handle to a RenderScript ProgramStore object.
  * See: android.renderscript.ProgramStore
  */
-typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_program_store;
-/**
- * \brief Opaque handle to a RenderScript font object.
+#ifndef __LP64__
+typedef _RS_HANDLE rs_program_store;
+#endif
+
+
+/*
+ * rs_font: Handle to a Font
  *
+ * Opaque handle to a RenderScript font object.
  * See: android.renderscript.Font
  */
-typedef struct { const int* const p; } __attribute__((packed, aligned(4))) rs_font;
-#endif // __LP64__
+#ifndef __LP64__
+typedef _RS_HANDLE rs_font;
+#endif
 
-/**
- * Vector version of the basic float type.
- * Provides two float fields packed into a single 64 bit field with 64 bit
- * alignment.
- */
-typedef float float2 __attribute__((ext_vector_type(2)));
-/**
- * Vector version of the basic float type. Provides three float fields packed
- * into a single 128 bit field with 128 bit alignment.
- */
-typedef float float3 __attribute__((ext_vector_type(3)));
-/**
- * Vector version of the basic float type.
- * Provides four float fields packed into a single 128 bit field with 128 bit
- * alignment.
- */
-typedef float float4 __attribute__((ext_vector_type(4)));
 
-/**
+/*
+ * float2: Two 32 bit floats
+ *
+ * Vector version of the basic float type.
+ * Provides two float fields packed into a single 64 bit field with 64 bit alignment.
+ */
+typedef float __attribute__((ext_vector_type(2))) float2;
+
+
+/*
+ * float3: Three 32 bit floats
+ *
+ * Vector version of the basic float type.
+ * Provides three float fields packed into a single 128 bit field with 128 bit alignment.
+ */
+typedef float __attribute__((ext_vector_type(3))) float3;
+
+
+/*
+ * float4: Four 32 bit floats
+ *
+ * Vector version of the basic float type.
+ * Provides four float fields packed into a single 128 bit field with 128 bit alignment.
+ */
+typedef float __attribute__((ext_vector_type(4))) float4;
+
+
+/*
+ * double2: Two 64 bit floats
+ *
  * Vector version of the basic double type. Provides two double fields packed
  * into a single 128 bit field with 128 bit alignment.
  */
-typedef double double2 __attribute__((ext_vector_type(2)));
-/**
+typedef double __attribute__((ext_vector_type(2))) double2;
+
+
+/*
+ * double3: Three 64 bit floats
+ *
  * Vector version of the basic double type. Provides three double fields packed
  * into a single 256 bit field with 256 bit alignment.
  */
-typedef double double3 __attribute__((ext_vector_type(3)));
-/**
+typedef double __attribute__((ext_vector_type(3))) double3;
+
+
+/*
+ * double4: Four 64 bit floats
+ *
  * Vector version of the basic double type. Provides four double fields packed
  * into a single 256 bit field with 256 bit alignment.
  */
-typedef double double4 __attribute__((ext_vector_type(4)));
+typedef double __attribute__((ext_vector_type(4))) double4;
 
-/**
+
+/*
+ * uchar2: Two 8 bit unsigned integers
+ *
  * Vector version of the basic uchar type. Provides two uchar fields packed
  * into a single 16 bit field with 16 bit alignment.
  */
-typedef uchar uchar2 __attribute__((ext_vector_type(2)));
-/**
+typedef uchar __attribute__((ext_vector_type(2))) uchar2;
+
+
+/*
+ * uchar3: Three 8 bit unsigned integers
+ *
  * Vector version of the basic uchar type. Provides three uchar fields packed
  * into a single 32 bit field with 32 bit alignment.
  */
-typedef uchar uchar3 __attribute__((ext_vector_type(3)));
-/**
+typedef uchar __attribute__((ext_vector_type(3))) uchar3;
+
+
+/*
+ * uchar4: Four 8 bit unsigned integers
+ *
  * Vector version of the basic uchar type. Provides four uchar fields packed
  * into a single 32 bit field with 32 bit alignment.
  */
-typedef uchar uchar4 __attribute__((ext_vector_type(4)));
+typedef uchar __attribute__((ext_vector_type(4))) uchar4;
 
-/**
+
+/*
+ * ushort2: Two 16 bit unsigned integers
+ *
  * Vector version of the basic ushort type. Provides two ushort fields packed
  * into a single 32 bit field with 32 bit alignment.
  */
-typedef ushort ushort2 __attribute__((ext_vector_type(2)));
-/**
+typedef ushort __attribute__((ext_vector_type(2))) ushort2;
+
+
+/*
+ * ushort3: Three 16 bit unsigned integers
+ *
  * Vector version of the basic ushort type. Provides three ushort fields packed
  * into a single 64 bit field with 64 bit alignment.
  */
-typedef ushort ushort3 __attribute__((ext_vector_type(3)));
-/**
+typedef ushort __attribute__((ext_vector_type(3))) ushort3;
+
+
+/*
+ * ushort4: Four 16 bit unsigned integers
+ *
  * Vector version of the basic ushort type. Provides four ushort fields packed
  * into a single 64 bit field with 64 bit alignment.
  */
-typedef ushort ushort4 __attribute__((ext_vector_type(4)));
+typedef ushort __attribute__((ext_vector_type(4))) ushort4;
 
-/**
+
+/*
+ * uint2: Two 32 bit unsigned integers
+ *
  * Vector version of the basic uint type. Provides two uint fields packed into a
  * single 64 bit field with 64 bit alignment.
  */
-typedef uint uint2 __attribute__((ext_vector_type(2)));
-/**
+typedef uint __attribute__((ext_vector_type(2))) uint2;
+
+
+/*
+ * uint3: Three 32 bit unsigned integers
+ *
  * Vector version of the basic uint type. Provides three uint fields packed into
  * a single 128 bit field with 128 bit alignment.
  */
-typedef uint uint3 __attribute__((ext_vector_type(3)));
-/**
+typedef uint __attribute__((ext_vector_type(3))) uint3;
+
+
+/*
+ * uint4: Four 32 bit unsigned integers
+ *
  * Vector version of the basic uint type. Provides four uint fields packed into
  * a single 128 bit field with 128 bit alignment.
  */
-typedef uint uint4 __attribute__((ext_vector_type(4)));
+typedef uint __attribute__((ext_vector_type(4))) uint4;
 
-/**
+
+/*
+ * ulong2: Two 64 bit unsigned integers
+ *
  * Vector version of the basic ulong type. Provides two ulong fields packed into
  * a single 128 bit field with 128 bit alignment.
  */
-typedef ulong ulong2 __attribute__((ext_vector_type(2)));
-/**
+typedef ulong __attribute__((ext_vector_type(2))) ulong2;
+
+
+/*
+ * ulong3: Three 64 bit unsigned integers
+ *
  * Vector version of the basic ulong type. Provides three ulong fields packed
  * into a single 256 bit field with 256 bit alignment.
  */
-typedef ulong ulong3 __attribute__((ext_vector_type(3)));
-/**
+typedef ulong __attribute__((ext_vector_type(3))) ulong3;
+
+
+/*
+ * ulong4: Four 64 bit unsigned integers
+ *
  * Vector version of the basic ulong type. Provides four ulong fields packed
  * into a single 256 bit field with 256 bit alignment.
  */
-typedef ulong ulong4 __attribute__((ext_vector_type(4)));
+typedef ulong __attribute__((ext_vector_type(4))) ulong4;
 
-/**
+
+/*
+ * char2: Two 8 bit signed integers
+ *
  * Vector version of the basic char type. Provides two char fields packed into a
  * single 16 bit field with 16 bit alignment.
  */
-typedef char char2 __attribute__((ext_vector_type(2)));
-/**
+typedef char __attribute__((ext_vector_type(2))) char2;
+
+
+/*
+ * char3: Three 8 bit signed integers
+ *
  * Vector version of the basic char type. Provides three char fields packed into
  * a single 32 bit field with 32 bit alignment.
  */
-typedef char char3 __attribute__((ext_vector_type(3)));
-/**
+typedef char __attribute__((ext_vector_type(3))) char3;
+
+
+/*
+ * char4: Four 8 bit signed integers
+ *
  * Vector version of the basic char type. Provides four char fields packed into
  * a single 32 bit field with 32 bit alignment.
  */
-typedef char char4 __attribute__((ext_vector_type(4)));
+typedef char __attribute__((ext_vector_type(4))) char4;
 
-/**
+
+/*
+ * short2: Two 16 bit signed integers
+ *
  * Vector version of the basic short type. Provides two short fields packed into
  * a single 32 bit field with 32 bit alignment.
  */
-typedef short short2 __attribute__((ext_vector_type(2)));
-/**
+typedef short __attribute__((ext_vector_type(2))) short2;
+
+
+/*
+ * short3: Three 16 bit signed integers
+ *
  * Vector version of the basic short type. Provides three short fields packed
  * into a single 64 bit field with 64 bit alignment.
  */
-typedef short short3 __attribute__((ext_vector_type(3)));
-/**
+typedef short __attribute__((ext_vector_type(3))) short3;
+
+
+/*
+ * short4: Four 16 bit signed integers
+ *
  * Vector version of the basic short type. Provides four short fields packed
  * into a single 64 bit field with 64 bit alignment.
  */
-typedef short short4 __attribute__((ext_vector_type(4)));
+typedef short __attribute__((ext_vector_type(4))) short4;
 
-/**
+
+/*
+ * int2: Two 32 bit signed integers
+ *
  * Vector version of the basic int type. Provides two int fields packed into a
  * single 64 bit field with 64 bit alignment.
  */
-typedef int int2 __attribute__((ext_vector_type(2)));
-/**
+typedef int __attribute__((ext_vector_type(2))) int2;
+
+
+/*
+ * int3: Three 32 bit signed integers
+ *
  * Vector version of the basic int type. Provides three int fields packed into a
  * single 128 bit field with 128 bit alignment.
  */
-typedef int int3 __attribute__((ext_vector_type(3)));
-/**
+typedef int __attribute__((ext_vector_type(3))) int3;
+
+
+/*
+ * int4: Four 32 bit signed integers
+ *
  * Vector version of the basic int type. Provides two four fields packed into a
  * single 128 bit field with 128 bit alignment.
  */
-typedef int int4 __attribute__((ext_vector_type(4)));
+typedef int __attribute__((ext_vector_type(4))) int4;
 
-/**
+
+/*
+ * long2: Two 64 bit signed integers
+ *
  * Vector version of the basic long type. Provides two long fields packed into a
  * single 128 bit field with 128 bit alignment.
  */
-typedef long long2 __attribute__((ext_vector_type(2)));
-/**
+typedef long __attribute__((ext_vector_type(2))) long2;
+
+
+/*
+ * long3: Three 64 bit signed integers
+ *
  * Vector version of the basic long type. Provides three long fields packed into
  * a single 256 bit field with 256 bit alignment.
  */
-typedef long long3 __attribute__((ext_vector_type(3)));
-/**
+typedef long __attribute__((ext_vector_type(3))) long3;
+
+
+/*
+ * long4: Four 64 bit signed integers
+ *
  * Vector version of the basic long type. Provides four long fields packed into
  * a single 256 bit field with 256 bit alignment.
  */
-typedef long long4 __attribute__((ext_vector_type(4)));
+typedef long __attribute__((ext_vector_type(4))) long4;
 
-/**
- * \brief 4x4 float matrix
+
+/*
+ * rs_matrix4x4: 4x4 matrix of 32 bit floats
  *
  * Native holder for RS matrix.  Elements are stored in the array at the
  * location [row*4 + col]
@@ -378,8 +684,10 @@
 typedef struct {
     float m[16];
 } rs_matrix4x4;
-/**
- * \brief 3x3 float matrix
+
+
+/*
+ * rs_matrix3x3: 3x3 matrix of 32 bit floats
  *
  * Native holder for RS matrix.  Elements are stored in the array at the
  * location [row*3 + col]
@@ -387,8 +695,10 @@
 typedef struct {
     float m[9];
 } rs_matrix3x3;
-/**
- * \brief 2x2 float matrix
+
+
+/*
+ * rs_matrix2x2: 2x2 matrix of 32 bit floats
  *
  * Native holder for RS matrix.  Elements are stored in the array at the
  * location [row*2 + col]
@@ -397,19 +707,20 @@
     float m[4];
 } rs_matrix2x2;
 
-/**
- * quaternion type for use with the quaternion functions
+
+/*
+ * rs_quaternion: Quarternion
+ *
+ * Quaternion type for use with the quaternion functions
  */
 typedef float4 rs_quaternion;
 
-#define RS_PACKED __attribute__((packed, aligned(4)))
-#define NULL ((void *)0)
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 14))
-
-/**
- * \brief Enum for selecting cube map faces
+/*
+ * rs_allocation_cubemap_face: Enum for selecting cube map faces
+ *
  */
+#if (defined(RS_VERSION) && (RS_VERSION >= 14))
 typedef enum {
     RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_X = 0,
     RS_ALLOCATION_CUBEMAP_FACE_NEGATIVE_X = 1,
@@ -418,69 +729,48 @@
     RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_Z = 4,
     RS_ALLOCATION_CUBEMAP_FACE_NEGATIVE_Z = 5
 } rs_allocation_cubemap_face;
+#endif
 
-/**
- * \brief Bitfield to specify the usage types for an allocation.
+
+/*
+ * rs_allocation_usage_type: Bitfield to specify the usage types for an allocation
  *
  * These values are ORed together to specify which usages or memory spaces are
  * relevant to an allocation or an operation on an allocation.
  */
+#if (defined(RS_VERSION) && (RS_VERSION >= 14))
 typedef enum {
     RS_ALLOCATION_USAGE_SCRIPT = 0x0001,
-    RS_ALLOCATION_USAGE_GRAPHICS_TEXTURE = 0x0002,
-    RS_ALLOCATION_USAGE_GRAPHICS_VERTEX = 0x0004,
-    RS_ALLOCATION_USAGE_GRAPHICS_CONSTANTS = 0x0008,
-    RS_ALLOCATION_USAGE_GRAPHICS_RENDER_TARGET = 0x0010
+    RS_ALLOCATION_USAGE_GRAPHICS_TEXTURE = 0x0002, // Deprecated.
+    RS_ALLOCATION_USAGE_GRAPHICS_VERTEX = 0x0004, // Deprecated.
+    RS_ALLOCATION_USAGE_GRAPHICS_CONSTANTS = 0x0008, // Deprecated.
+    RS_ALLOCATION_USAGE_GRAPHICS_RENDER_TARGET = 0x0010 // Deprecated.
 } rs_allocation_usage_type;
+#endif
 
-#endif //defined(RS_VERSION) && (RS_VERSION >= 14)
 
-// New API's
-#if (defined(RS_VERSION) && (RS_VERSION >= 16))
-
-#ifndef __LP64__
-/**
- * Describes the way mesh vertex data is interpreted when rendering
+/*
+ * rs_primitive: How to intepret mesh vertex data
  *
- **/
+ * Describes the way mesh vertex data is interpreted when rendering
+ */
+#ifndef __LP64__
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
 typedef enum {
-    /**
-    * Vertex data will be rendered as a series of points
-    */
-    RS_PRIMITIVE_POINT              = 0,
-    /**
-    * Vertex pairs will be rendered as lines
-    */
-    RS_PRIMITIVE_LINE               = 1,
-    /**
-    * Vertex data will be rendered as a connected line strip
-    */
-    RS_PRIMITIVE_LINE_STRIP         = 2,
-    /**
-    * Vertices will be rendered as individual triangles
-    */
-    RS_PRIMITIVE_TRIANGLE           = 3,
-    /**
-    * Vertices will be rendered as a connected triangle strip
-    * defined by the first three vertices with each additional
-    * triangle defined by a new vertex
-    */
-    RS_PRIMITIVE_TRIANGLE_STRIP     = 4,
-    /**
-    * Vertices will be rendered as a sequence of triangles that all
-    * share first vertex as the origin
-    */
-    RS_PRIMITIVE_TRIANGLE_FAN       = 5,
-
-    /**
-    * Invalid primitive
-    */
-    RS_PRIMITIVE_INVALID            = 100,
+    RS_PRIMITIVE_POINT = 0, // Vertex data will be rendered as a series of points
+    RS_PRIMITIVE_LINE = 1, // Vertex pairs will be rendered as lines
+    RS_PRIMITIVE_LINE_STRIP = 2, // Vertex data will be rendered as a connected line strip
+    RS_PRIMITIVE_TRIANGLE = 3, // Vertices will be rendered as individual triangles
+    RS_PRIMITIVE_TRIANGLE_STRIP = 4, // Vertices will be rendered as a connected triangle strip defined by the first three vertices with each additional triangle defined by a new vertex
+    RS_PRIMITIVE_TRIANGLE_FAN = 5, // Vertices will be rendered as a sequence of triangles that all share first vertex as the origin
+    RS_PRIMITIVE_INVALID = 100 // Invalid primitive
 } rs_primitive;
-#endif // __LP64__
+#endif
+#endif
 
-/**
- * \brief Enumeration for possible element data types
+
+/*
+ * rs_data_type: Element data types
  *
  * DataType represents the basic type information for a basic element.  The
  * naming convention follows.  For numeric types it is FLOAT,
@@ -497,6 +787,7 @@
  *
  * RS_* objects.  32 bit opaque handles.
  */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
 typedef enum {
     RS_TYPE_NONE             = 0,
     RS_TYPE_FLOAT_32         = 2,
@@ -509,17 +800,13 @@
     RS_TYPE_UNSIGNED_16      = 9,
     RS_TYPE_UNSIGNED_32      = 10,
     RS_TYPE_UNSIGNED_64      = 11,
-
     RS_TYPE_BOOLEAN          = 12,
-
     RS_TYPE_UNSIGNED_5_6_5   = 13,
     RS_TYPE_UNSIGNED_5_5_5_1 = 14,
     RS_TYPE_UNSIGNED_4_4_4_4 = 15,
-
     RS_TYPE_MATRIX_4X4       = 16,
     RS_TYPE_MATRIX_3X3       = 17,
     RS_TYPE_MATRIX_2X2       = 18,
-
     RS_TYPE_ELEMENT          = 1000,
     RS_TYPE_TYPE             = 1001,
     RS_TYPE_ALLOCATION       = 1002,
@@ -531,21 +818,22 @@
     RS_TYPE_PROGRAM_RASTER   = 1008,
     RS_TYPE_PROGRAM_STORE    = 1009,
     RS_TYPE_FONT             = 1010,
-
-    RS_TYPE_INVALID          = 10000,
+    RS_TYPE_INVALID          = 10000
 } rs_data_type;
+#endif
 
-/**
- * \brief Enumeration for possible element data kind
+
+/*
+ * rs_data_kind: Element data kind
  *
  * The special interpretation of the data if required.  This is primarly
  * useful for graphical data.  USER indicates no special interpretation is
  * expected.  PIXEL is used in conjunction with the standard data types for
  * representing texture formats.
  */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
 typedef enum {
     RS_KIND_USER         = 0,
-
     RS_KIND_PIXEL_L      = 7,
     RS_KIND_PIXEL_A      = 8,
     RS_KIND_PIXEL_LA     = 9,
@@ -553,57 +841,39 @@
     RS_KIND_PIXEL_RGBA   = 11,
     RS_KIND_PIXEL_DEPTH  = 12,
     RS_KIND_PIXEL_YUV    = 13,
-
-    RS_KIND_INVALID      = 100,
+    RS_KIND_INVALID      = 100
 } rs_data_kind;
+#endif
 
-#ifndef __LP64__
-/**
+
+/*
+ * rs_depth_func: Depth function
+ *
  * Specifies conditional drawing depending on the comparison of the incoming
  * depth to that found in the depth buffer.
- *
- **/
+ */
+#ifndef __LP64__
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
 typedef enum {
-    /**
-    * Always drawn
-    */
-    RS_DEPTH_FUNC_ALWAYS        = 0,
-    /**
-    * Drawn if the incoming depth value is less than that in the
-    * depth buffer
-    */
-    RS_DEPTH_FUNC_LESS          = 1,
-    /**
-    * Drawn if the incoming depth value is less or equal to that in
-    * the depth buffer
-    */
-    RS_DEPTH_FUNC_LEQUAL        = 2,
-    /**
-    * Drawn if the incoming depth value is greater than that in the
-    * depth buffer
-    */
-    RS_DEPTH_FUNC_GREATER       = 3,
-    /**
-    * Drawn if the incoming depth value is greater or equal to that
-    * in the depth buffer
-    */
-    RS_DEPTH_FUNC_GEQUAL        = 4,
-    /**
-    * Drawn if the incoming depth value is equal to that in the
-    * depth buffer
-    */
-    RS_DEPTH_FUNC_EQUAL         = 5,
-    /**
-    * Drawn if the incoming depth value is not equal to that in the
-    * depth buffer
-    */
-    RS_DEPTH_FUNC_NOTEQUAL      = 6,
-    /**
-    * Invalid depth function
-    */
-    RS_DEPTH_FUNC_INVALID       = 100,
+    RS_DEPTH_FUNC_ALWAYS        = 0, // Always drawn
+    RS_DEPTH_FUNC_LESS          = 1, // Drawn if the incoming depth value is less than that in the depth buffer
+    RS_DEPTH_FUNC_LEQUAL        = 2, // Drawn if the incoming depth value is less or equal to that in the depth buffer
+    RS_DEPTH_FUNC_GREATER       = 3, // Drawn if the incoming depth value is greater than that in the depth buffer
+    RS_DEPTH_FUNC_GEQUAL        = 4, // Drawn if the incoming depth value is greater or equal to that in the depth buffer
+    RS_DEPTH_FUNC_EQUAL         = 5, // Drawn if the incoming depth value is equal to that in the depth buffer
+    RS_DEPTH_FUNC_NOTEQUAL      = 6, // Drawn if the incoming depth value is not equal to that in the depth buffer
+    RS_DEPTH_FUNC_INVALID       = 100 // Invalid depth function
 } rs_depth_func;
+#endif
+#endif
 
+
+/*
+ * rs_blend_src_func: Blend source function
+ *
+ */
+#ifndef __LP64__
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
 typedef enum {
     RS_BLEND_SRC_ZERO                   = 0,
     RS_BLEND_SRC_ONE                    = 1,
@@ -614,10 +884,18 @@
     RS_BLEND_SRC_DST_ALPHA              = 6,
     RS_BLEND_SRC_ONE_MINUS_DST_ALPHA    = 7,
     RS_BLEND_SRC_SRC_ALPHA_SATURATE     = 8,
-
-    RS_BLEND_SRC_INVALID                = 100,
+    RS_BLEND_SRC_INVALID                = 100
 } rs_blend_src_func;
+#endif
+#endif
 
+
+/*
+ * rs_blend_dst_func: Blend destination function
+ *
+ */
+#ifndef __LP64__
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
 typedef enum {
     RS_BLEND_DST_ZERO                   = 0,
     RS_BLEND_DST_ONE                    = 1,
@@ -627,19 +905,33 @@
     RS_BLEND_DST_ONE_MINUS_SRC_ALPHA    = 5,
     RS_BLEND_DST_DST_ALPHA              = 6,
     RS_BLEND_DST_ONE_MINUS_DST_ALPHA    = 7,
-
-    RS_BLEND_DST_INVALID                = 100,
+    RS_BLEND_DST_INVALID                = 100
 } rs_blend_dst_func;
+#endif
+#endif
 
+
+/*
+ * rs_cull_mode: Culling mode
+ *
+ */
+#ifndef __LP64__
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
 typedef enum {
     RS_CULL_BACK     = 0,
     RS_CULL_FRONT    = 1,
     RS_CULL_NONE     = 2,
-
-    RS_CULL_INVALID  = 100,
+    RS_CULL_INVALID  = 100
 } rs_cull_mode;
-#endif //__LP64__
+#endif
+#endif
 
+
+/*
+ * rs_sampler_value: Sampler wrap T value
+ *
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
 typedef enum {
     RS_SAMPLER_NEAREST              = 0,
     RS_SAMPLER_LINEAR               = 1,
@@ -648,19 +940,9 @@
     RS_SAMPLER_CLAMP                = 4,
     RS_SAMPLER_LINEAR_MIP_NEAREST   = 5,
     RS_SAMPLER_MIRRORED_REPEAT      = 6,
-
-    RS_SAMPLER_INVALID              = 100,
+    RS_SAMPLER_INVALID              = 100
 } rs_sampler_value;
+#endif
 
-#endif // (defined(RS_VERSION) && (RS_VERSION >= 16))
 
-#if (defined(RS_VERSION) && (RS_VERSION >= 23))
-
-/**
- * \brief Opaque handle to RenderScript kernel invocation context.
- */
-typedef const struct rs_kernel_context_t *rs_kernel_context;
-
-#endif // (defined(RS_VERSION) && (RS_VERSION >= 23))
-
-#endif // __RS_TYPES_RSH__
+#endif // RENDERSCRIPT_RS_TYPES_RSH