Move scriptc to script_api/include.
Part 1 of the directory re-organization. We're renaming the "api" directory
to "script_api" directory to distinguish between our control api (java or c++)
and our script api.
We're also moving the scriptc directory under that newly renamed directory,
and change its name to the more appropriate "include".
Test: scriptc/generate.sh
Test: compiled ImageProcessing_jb
Change-Id: I00c3bbf5728b652d1541ebe4123717f6ab639f09
diff --git a/script_api/GenerateDocumentation.cpp b/script_api/GenerateDocumentation.cpp
new file mode 100644
index 0000000..41f85cb
--- /dev/null
+++ b/script_api/GenerateDocumentation.cpp
@@ -0,0 +1,731 @@
+/*
+ * 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 const char OVERVIEW_HTML_FILE_NAME[] = "overview.html";
+static const char OVERVIEW_JD_FILE_NAME[] = "overview.jd";
+static const char INDEX_HTML_FILE_NAME[] = "index.html";
+static const char INDEX_JD_FILE_NAME[] = "index.jd";
+
+static void writeHeader(GeneratedFile* file, bool forVerification, const string& title) {
+ if (forVerification) {
+ *file << "<!DOCTYPE html>\n";
+ *file << "<!-- " << AUTO_GENERATED_WARNING << "-->\n";
+ *file << "<html><head>\n"
+ "<title>RenderScript Reference</title>\n"
+ "<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>\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='default.css' rel='stylesheet' type='text/css'>\n"
+ "<link href='fullscreen.css' rel='stylesheet' class='fullscreen' "
+ "type='text/css'>\n"
+ "<body class='gc-documentation develop reference'>\n\n";
+ *file << "<h1>" << title << "</h1>\n";
+ } else {
+ *file << "page.title=RenderScript " << title << "\n\n";
+ *file << "@jd:body\n\n";
+ }
+ *file << "<div class='renderscript'>\n";
+}
+
+static void writeFooter(GeneratedFile* file, bool forVerification) {
+ *file << "</div>\n";
+ if (forVerification) {
+ *file << "</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 string& label, bool labelIsHeading) {
+ if (labelIsHeading) {
+ *file << "<h2 style='margin-bottom: 0px;'>" << label << "</h2>\n";
+ }
+ *file << "<table class='jd-sumtable'><tbody>\n";
+ if (!labelIsHeading) {
+ *file << " <tr><th colspan='2'>" << label << "</th></tr>\n";
+ }
+}
+
+static void writeSummaryTableEnd(GeneratedFile* file) {
+ *file << "</tbody></table>\n";
+}
+
+enum DeprecatedSelector {
+ DEPRECATED_ONLY,
+ NON_DEPRECATED_ONLY,
+ ALL,
+};
+
+static void writeSummaryTableEntry(ostream* stream, Definition* definition,
+ DeprecatedSelector deprecatedSelector) {
+ if (definition->hidden()) {
+ return;
+ }
+ const bool deprecated = definition->deprecated();
+ if ((deprecatedSelector == DEPRECATED_ONLY && !deprecated) ||
+ (deprecatedSelector == NON_DEPRECATED_ONLY && deprecated)) {
+ return;
+ }
+
+ *stream << " <tr class='alt-color api apilevel-1'>\n";
+ *stream << " <td class='jd-linkcol'>\n";
+ *stream << " <a href='" << definition->getUrl() << "'>" << definition->getName()
+ << "</a>\n";
+ *stream << " </td>\n";
+ *stream << " <td class='jd-descrcol' width='100%'>\n";
+ *stream << " ";
+ if (deprecated) {
+ *stream << "<b>Deprecated</b>. ";
+ }
+ *stream << definition->getSummary() << "\n";
+ *stream << " </td>\n";
+ *stream << " </tr>\n";
+}
+
+static void writeSummaryTable(GeneratedFile* file, const ostringstream* entries, const char* name,
+ DeprecatedSelector deprecatedSelector, bool labelAsHeader) {
+ string s = entries->str();
+ if (!s.empty()) {
+ string prefix;
+ if (deprecatedSelector == DEPRECATED_ONLY) {
+ prefix = "Deprecated ";
+ }
+ writeSummaryTableStart(file, prefix + name, labelAsHeader);
+ *file << s;
+ writeSummaryTableEnd(file);
+ }
+}
+
+static void writeSummaryTables(GeneratedFile* file, const map<string, Constant*>& constants,
+ const map<string, Type*>& types,
+ const map<string, Function*>& functions,
+ DeprecatedSelector deprecatedSelector, bool labelAsHeader) {
+ ostringstream constantStream;
+ for (auto e : constants) {
+ writeSummaryTableEntry(&constantStream, e.second, deprecatedSelector);
+ }
+ writeSummaryTable(file, &constantStream, "Constants", deprecatedSelector, labelAsHeader);
+
+ ostringstream typeStream;
+ for (auto e : types) {
+ writeSummaryTableEntry(&typeStream, e.second, deprecatedSelector);
+ }
+ writeSummaryTable(file, &typeStream, "Types", deprecatedSelector, labelAsHeader);
+
+ ostringstream functionStream;
+ for (auto e : functions) {
+ writeSummaryTableEntry(&functionStream, e.second, deprecatedSelector);
+ }
+ writeSummaryTable(file, &functionStream, "Functions", deprecatedSelector, labelAsHeader);
+}
+
+static void writeHtmlVersionTag(GeneratedFile* file, VersionInfo info,
+ bool addSpacing) {
+ ostringstream stream;
+ if (info.intSize == 32) {
+ stream << "When compiling for 32 bits. ";
+ } else if (info.intSize == 64) {
+ stream << "When compiling for 64 bits. ";
+ }
+
+ if (info.minVersion > 1 || info.maxVersion) {
+ 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) {
+ stream << "Removed from " << mid << info.maxVersion + 1 << " and higher";
+ }
+ } else {
+ if (info.maxVersion == 0) {
+ // No maximum
+ stream << "Added in " << mid << info.minVersion;
+ } else {
+ stream << mid << info.minVersion << " - " << info.maxVersion;
+ }
+ }
+ stream << "</a>";
+ }
+ string s = stream.str();
+ // Remove any trailing whitespace
+ while (s.back() == ' ') {
+ s.pop_back();
+ }
+ if (!s.empty()) {
+ *file << (addSpacing ? " " : "") << s << "\n";
+ }
+}
+
+static void writeDetailedTypeSpecification(GeneratedFile* file, const TypeSpecification* spec) {
+ switch (spec->getKind()) {
+ case SIMPLE: {
+ Type* type = spec->getType();
+ *file << "<p>A typedef of: " << spec->getSimpleType()
+ << makeAttributeTag(spec->getAttribute(), "", type->getDeprecatedApiLevel(),
+ type->getDeprecatedMessage())
+ << " ";
+ writeHtmlVersionTag(file, spec->getVersionInfo(), false);
+ *file << "</p>\n";
+ break;
+ }
+ case RS_OBJECT: {
+ *file << "<p>";
+ writeHtmlVersionTag(file, spec->getVersionInfo(), false);
+ *file << "</p>\n";
+ break;
+ }
+ case ENUM: {
+ *file << "<p>An enum with the following values: \n";
+ writeHtmlVersionTag(file, spec->getVersionInfo(), false);
+ *file << "</p>\n";
+
+ *file << " <table class='jd-tagtable'><tbody>\n";
+ const vector<string>& values = spec->getValues();
+ const vector<string>& valueComments = spec->getValueComments();
+ for (size_t i = 0; i < values.size(); i++) {
+ *file << " <tr><th>" << values[i] << "</th><td>";
+ if (valueComments.size() > i) {
+ *file << valueComments[i];
+ }
+ *file << "</td></tr>\n";
+ }
+ *file << " </tbody></table><br/>\n";
+ break;
+ }
+ case STRUCT: {
+ *file << "<p>A structure with the following fields: ";
+ writeHtmlVersionTag(file, spec->getVersionInfo(), false);
+ *file << "</p>\n";
+
+ *file << " <table class='jd-tagtable'><tbody>\n";
+ const vector<string>& fields = spec->getFields();
+ const vector<string>& fieldComments = spec->getFieldComments();
+ for (size_t i = 0; i < fields.size(); i++) {
+ *file << " <tr><th>" << fields[i] << "</th><td>";
+ if (fieldComments.size() > i && !fieldComments[i].empty()) {
+ *file << fieldComments[i];
+ }
+ *file << "</td></tr>\n";
+ }
+ *file << " </tbody></table><br/>\n";
+ break;
+ }
+ }
+}
+
+static void writeDetailedConstantSpecification(GeneratedFile* file, ConstantSpecification* c) {
+ *file << " <tr><td>";
+ *file << "Value: " << c->getValue() << "\n";
+ writeHtmlVersionTag(file, c->getVersionInfo(), true);
+ *file << " </td></tr>\n";
+ *file << "<br/>\n";
+}
+
+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";
+ writeSummaryTables(file, specFile.getDocumentedConstants(), specFile.getDocumentedTypes(),
+ specFile.getDocumentedFunctions(), NON_DEPRECATED_ONLY, false);
+
+ return success;
+}
+
+static bool generateOverview(const string& directory, bool forVerification) {
+ GeneratedFile file;
+ if (!file.start(directory, forVerification ? OVERVIEW_HTML_FILE_NAME : OVERVIEW_JD_FILE_NAME)) {
+ return false;
+ }
+ bool success = true;
+
+ writeHeader(&file, forVerification, "Runtime API Reference");
+
+ for (auto specFile : systemSpecification.getSpecFiles()) {
+ if (!writeOverviewForFile(&file, *specFile)) {
+ success = false;
+ }
+ }
+
+ writeFooter(&file, forVerification);
+ file.close();
+ return success;
+}
+
+static bool generateAlphabeticalIndex(const string& directory, bool forVerification) {
+ GeneratedFile file;
+ if (!file.start(directory, forVerification ? INDEX_HTML_FILE_NAME : INDEX_JD_FILE_NAME)) {
+ return false;
+ }
+ writeHeader(&file, forVerification, "Index");
+
+ writeSummaryTables(&file, systemSpecification.getConstants(), systemSpecification.getTypes(),
+ systemSpecification.getFunctions(), NON_DEPRECATED_ONLY, true);
+
+ writeSummaryTables(&file, systemSpecification.getConstants(), systemSpecification.getTypes(),
+ systemSpecification.getFunctions(), DEPRECATED_ONLY, true);
+
+ writeFooter(&file, forVerification);
+ file.close();
+ return true;
+}
+
+static void writeDeprecatedWarning(GeneratedFile* file, Definition* definition) {
+ if (definition->deprecated()) {
+ *file << " <p><b>Deprecated.</b> ";
+ string s = definition->getDeprecatedMessage();
+ convertDocumentationRefences(&s);
+ if (!s.empty()) {
+ *file << s;
+ } else {
+ *file << "Do not use.";
+ }
+ *file << "</p>\n";
+ }
+}
+
+static bool writeDetailedConstant(GeneratedFile* file, Constant* constant) {
+ if (constant->hidden()) {
+ return true;
+ }
+ const string& name = constant->getName();
+
+ *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";
+ auto specifications = constant->getSpecifications();
+ bool addSeparator = specifications.size() > 1;
+ for (auto spec : specifications) {
+ if (addSeparator) {
+ *file << " <h5 class='jd-tagtitle'>Variant:</h5>\n";
+ }
+ writeDetailedConstantSpecification(file, spec);
+ }
+ *file << " </tbody></table>\n";
+ *file << " </div>\n";
+
+ *file << " <div class='jd-tagdata jd-tagdescr'>\n";
+
+ writeDeprecatedWarning(file, constant);
+ 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();
+
+ *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";
+ for (auto spec : type->getSpecifications()) {
+ writeDetailedTypeSpecification(file, spec);
+ }
+
+ writeDeprecatedWarning(file, type);
+ if (!generateHtmlParagraphs(file, type->getDescription())) {
+ return false;
+ }
+
+ *file << " </div>\n";
+ *file << "</div>\n";
+ *file << "\n";
+ return true;
+}
+
+static bool writeDetailedFunction(GeneratedFile* file, Function* function) {
+ if (function->hidden()) {
+ return true;
+ }
+ const string& name = function->getName();
+
+ *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";
+ map<string, DetailedFunctionEntry> entries;
+ if (!getUnifiedFunctionPrototypes(function, &entries)) {
+ return false;
+ }
+ *file << " <table class='jd-tagtable'><tbody>\n";
+ for (auto i : entries) {
+ *file << " <tr>\n";
+ *file << " <td>" << i.second.htmlDeclaration << "</td>\n";
+ *file << " <td>";
+ writeHtmlVersionTag(file, i.second.info, true);
+ *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";
+ writeDeprecatedWarning(file, function);
+ if (!generateHtmlParagraphs(file, function->getDescription())) {
+ return false;
+ }
+ *file << " </div>\n";
+
+ *file << "</div>\n";
+ *file << "\n";
+ return true;
+}
+
+static bool writeDetailedDocumentationFile(const string& directory, const SpecFile& specFile,
+ bool forVerification) {
+ if (!specFile.hasSpecifications()) {
+ // This is true for rs_core.spec
+ return true;
+ }
+
+ GeneratedFile file;
+ const string fileName = stringReplace(specFile.getSpecFileName(), ".spec",
+ forVerification ? ".html" : ".jd");
+ if (!file.start(directory, fileName)) {
+ return false;
+ }
+ bool success = true;
+
+ string title = specFile.getBriefDescription();
+ writeHeader(&file, forVerification, title);
+
+ 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.getDocumentedConstants();
+ const auto& types = specFile.getDocumentedTypes();
+ const auto& functions = specFile.getDocumentedFunctions();
+
+ writeSummaryTables(&file, constants, types, functions, NON_DEPRECATED_ONLY, false);
+ writeSummaryTables(&file, constants, types, functions, DEPRECATED_ONLY, 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;
+ }
+ }
+ }
+
+ writeFooter(&file, forVerification);
+ file.close();
+
+ if (!success) {
+ // If in error, write a final message to make it easier to figure out which file failed.
+ cerr << fileName << ": Failed due to errors.\n";
+ }
+ return success;
+}
+
+static void generateSnippet(GeneratedFile* file, const string& fileName, const string& title) {
+ const char offset[] = " ";
+ *file << offset << "<li><a href=\"<?cs var:toroot ?>guide/topics/renderscript/reference/"
+ << fileName << "\">\n";
+ *file << offset << " <span class=\"en\">" << title << "</span>\n";
+ *file << offset << "</a></li>\n";
+}
+
+/* Generate a partial file of links that should be cut & pasted into the proper section of the
+ * guide_toc.cs file.
+ */
+static bool generateAndroidTableOfContentSnippet(const string& directory) {
+ GeneratedFile file;
+ if (!file.start(directory, "guide_toc.cs")) {
+ return false;
+ }
+ file << "<!-- Copy and paste the following lines into the RenderScript section of\n";
+ file << " platform/frameworks/base/docs/html/guide/guide_toc.cs\n\n";
+
+ const char offset[] = " ";
+ file << offset << "<li class=\"nav-section\">\n";
+ file << offset << " <div class=\"nav-section-header\">\n";
+ file << offset << " <a href=\"<?cs var:toroot ?>guide/topics/renderscript/reference/" <<
+ OVERVIEW_HTML_FILE_NAME << "\">\n";
+ file << offset << " <span class=\"en\">Runtime API Reference</span>\n";
+ file << offset << " </a></div>\n";
+ file << offset << " <ul>\n";
+
+ for (auto specFile : systemSpecification.getSpecFiles()) {
+ if (specFile->hasSpecifications()) {
+ const string fileName = stringReplace(specFile->getSpecFileName(), ".spec", ".html");
+ generateSnippet(&file, fileName, specFile->getBriefDescription());
+ }
+ }
+ generateSnippet(&file, INDEX_HTML_FILE_NAME, "Index");
+
+ file << offset << " </ul>\n";
+ file << offset << "</li>\n";
+
+ return true;
+}
+
+bool generateDocumentation(const string& directory, bool forVerification) {
+ bool success = generateOverview(directory, forVerification) &&
+ generateAlphabeticalIndex(directory, forVerification) &&
+ generateAndroidTableOfContentSnippet(directory);
+ for (auto specFile : systemSpecification.getSpecFiles()) {
+ if (!writeDetailedDocumentationFile(directory, *specFile, forVerification)) {
+ success = false;
+ }
+ }
+ return success;
+}
diff --git a/script_api/GenerateHeaderFiles.cpp b/script_api/GenerateHeaderFiles.cpp
new file mode 100644
index 0000000..ce778b3
--- /dev/null
+++ b/script_api/GenerateHeaderFiles.cpp
@@ -0,0 +1,392 @@
+/*
+ * 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. If we're at the final version,
+ * add a check on a flag that can be set for internal builds. This enables us to keep supporting
+ * old APIs in the runtime code.
+ */
+static void writeVersionGuardStart(GeneratedFile* file, VersionInfo info, unsigned int finalVersion) {
+ if (info.intSize == 32) {
+ *file << "#ifndef __LP64__\n";
+ } else if (info.intSize == 64) {
+ *file << "#ifdef __LP64__\n";
+ }
+
+ ostringstream checkMaxVersion;
+ if (info.maxVersion > 0) {
+ checkMaxVersion << "(";
+ if (info.maxVersion == finalVersion) {
+ checkMaxVersion << "defined(RS_DECLARE_EXPIRED_APIS) || ";
+ }
+ checkMaxVersion << "RS_VERSION <= " << info.maxVersion << ")";
+ }
+
+ if (info.minVersion <= 1) {
+ // No minimum
+ if (info.maxVersion > 0) {
+ *file << "#if !defined(RS_VERSION) || " << checkMaxVersion.str() << "\n";
+ }
+ } else {
+ *file << "#if (defined(RS_VERSION) && (RS_VERSION >= " << info.minVersion << ")";
+ if (info.maxVersion > 0) {
+ *file << " && " << checkMaxVersion.str();
+ }
+ *file << ")\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 addDeprecatedWarning,
+ bool closeBlock) {
+ if (briefComment.empty() && comment.size() == 0) {
+ return;
+ }
+ *file << "/*\n";
+ if (!briefComment.empty()) {
+ *file << " * " << name << ": " << briefComment << "\n";
+ *file << " *\n";
+ }
+ if (addDeprecatedWarning) {
+ *file << " * DEPRECATED. Do not use.\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 writeConstantComment(GeneratedFile* file, const Constant& constant) {
+ const string name = constant.getName();
+ writeComment(file, name, constant.getSummary(), constant.getDescription(),
+ constant.deprecated(), true);
+}
+
+static void writeConstantSpecification(GeneratedFile* file, const ConstantSpecification& spec) {
+ const Constant* constant = spec.getConstant();
+ VersionInfo info = spec.getVersionInfo();
+ writeVersionGuardStart(file, info, constant->getFinalVersion());
+ *file << "#define " << constant->getName() << " " << spec.getValue() << "\n\n";
+ writeVersionGuardEnd(file, info);
+}
+
+static void writeTypeSpecification(GeneratedFile* file, const TypeSpecification& spec) {
+ const Type* type = spec.getType();
+ const string& typeName = type->getName();
+ const VersionInfo info = spec.getVersionInfo();
+ writeVersionGuardStart(file, info, type->getFinalVersion());
+
+ const string attribute =
+ makeAttributeTag(spec.getAttribute(), "", type->getDeprecatedApiLevel(),
+ type->getDeprecatedMessage());
+ *file << "typedef ";
+ switch (spec.getKind()) {
+ case SIMPLE:
+ *file << spec.getSimpleType() << attribute;
+ break;
+ case RS_OBJECT:
+ *file << "struct " << typeName << " _RS_OBJECT_DECL" << attribute;
+ break;
+ case ENUM: {
+ *file << "enum" << attribute << " ";
+ 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 << "}";
+ break;
+ }
+ case STRUCT: {
+ *file << "struct" << attribute << " ";
+ 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 << "}";
+ break;
+ }
+ }
+ *file << " " << typeName << ";\n";
+
+ writeVersionGuardEnd(file, info);
+ *file << "\n";
+}
+
+static void writeTypeComment(GeneratedFile* file, const Type& type) {
+ const string name = type.getName();
+ writeComment(file, name, type.getSummary(), type.getDescription(), type.deprecated(), true);
+}
+
+static void writeFunctionPermutation(GeneratedFile* file, const FunctionSpecification& spec,
+ const FunctionPermutation& permutation) {
+ Function* function = spec.getFunction();
+ writeVersionGuardStart(file, spec.getVersionInfo(), function->getFinalVersion());
+
+ // 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";
+ }
+
+ *file << makeAttributeTag(spec.getAttribute(), spec.isOverloadable() ? "overloadable" : "",
+ function->getDeprecatedApiLevel(), function->getDeprecatedMessage());
+ *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() && p->rsType != "...") {
+ 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 writeFunctionComment(GeneratedFile* file, const Function& function) {
+ // Write the generic documentation.
+ writeComment(file, function.getName(), function.getSummary(), function.getDescription(),
+ function.deprecated(), 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";
+}
+
+static void writeFunctionSpecification(GeneratedFile* file, const FunctionSpecification& spec) {
+ // Write all the variants.
+ for (auto permutation : spec.getPermutations()) {
+ writeFunctionPermutation(file, spec, *permutation);
+ }
+}
+
+static bool writeHeaderFile(const string& directory, const SpecFile& specFile) {
+ const string headerFileName = specFile.getHeaderFileName();
+
+ // We generate one header file for each spec file.
+ GeneratedFile file;
+ if (!file.start(directory, headerFileName)) {
+ return false;
+ }
+
+ // Write the comments that start the file.
+ file.writeNotices();
+ writeComment(&file, headerFileName, specFile.getBriefDescription(),
+ specFile.getFullDescription(), false, true);
+ file << "\n";
+
+ // 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.
+ */
+ set<Constant*> documentedConstants;
+ for (auto spec : specFile.getConstantSpecifications()) {
+ Constant* constant = spec->getConstant();
+ if (documentedConstants.find(constant) == documentedConstants.end()) {
+ documentedConstants.insert(constant);
+ writeConstantComment(&file, *constant);
+ }
+ writeConstantSpecification(&file, *spec);
+ }
+ set<Type*> documentedTypes;
+ for (auto spec : specFile.getTypeSpecifications()) {
+ Type* type = spec->getType();
+ if (documentedTypes.find(type) == documentedTypes.end()) {
+ documentedTypes.insert(type);
+ writeTypeComment(&file, *type);
+ }
+ writeTypeSpecification(&file, *spec);
+ }
+
+ set<Function*> documentedFunctions;
+ for (auto spec : specFile.getFunctionSpecifications()) {
+ // Do not include internal APIs in the header files.
+ if (spec->isInternal()) {
+ continue;
+ }
+ Function* function = spec->getFunction();
+ if (documentedFunctions.find(function) == documentedFunctions.end()) {
+ documentedFunctions.insert(function);
+ writeFunctionComment(&file, *function);
+ }
+ writeFunctionSpecification(&file, *spec);
+ }
+
+ file << "#endif // " << guard << "\n";
+ file.close();
+ return true;
+}
+
+bool generateHeaderFiles(const string& directory) {
+ bool success = true;
+ for (auto specFile : systemSpecification.getSpecFiles()) {
+ if (!writeHeaderFile(directory, *specFile)) {
+ success = false;
+ }
+ }
+ return success;
+}
diff --git a/script_api/GenerateStubsWhiteList.cpp b/script_api/GenerateStubsWhiteList.cpp
new file mode 100644
index 0000000..ed03a09
--- /dev/null
+++ b/script_api/GenerateStubsWhiteList.cpp
@@ -0,0 +1,561 @@
+/*
+ * 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 <algorithm>
+#include <climits>
+#include <iostream>
+#include <iterator>
+#include <sstream>
+
+#include "Generator.h"
+#include "Specification.h"
+#include "Utilities.h"
+
+using namespace std;
+
+const unsigned int kMinimumApiLevelForTests = 11;
+const unsigned int kApiLevelWithFirst64Bit = 21;
+
+// Used to map the built-in types to their mangled representations
+struct BuiltInMangling {
+ const char* token[3]; // The last two entries can be nullptr
+ const char* equivalence; // The mangled equivalent
+};
+
+BuiltInMangling builtInMangling[] = {
+ {{"long", "long"}, "x"},
+ {{"unsigned", "long", "long"}, "y"},
+ {{"long"}, "l"},
+ {{"unsigned", "long"}, "m"},
+ {{"int"}, "i"},
+ {{"unsigned", "int"}, "j"},
+ {{"short"}, "s"},
+ {{"unsigned", "short"}, "t"},
+ {{"char"}, "c"},
+ {{"unsigned", "char"}, "h"},
+ {{"signed", "char"}, "a"},
+ {{"void"}, "v"},
+ {{"wchar_t"}, "w"},
+ {{"bool"}, "b"},
+ {{"__fp16"}, "Dh"},
+ {{"float"}, "f"},
+ {{"double"}, "d"},
+};
+
+/* For the given API level and bitness (e.g. 32 or 64 bit), try to find a
+ * substitution for the provided type name, as would be done (mostly) by a
+ * preprocessor. Returns empty string if there's no substitution.
+ */
+static string findSubstitute(const string& typeName, unsigned int apiLevel, int intSize) {
+ const auto& types = systemSpecification.getTypes();
+ const auto type = types.find(typeName);
+ if (type != types.end()) {
+ for (TypeSpecification* spec : type->second->getSpecifications()) {
+ // Verify this specification applies
+ const VersionInfo info = spec->getVersionInfo();
+ if (!info.includesVersion(apiLevel) || (info.intSize != 0 && info.intSize != intSize)) {
+ continue;
+ }
+ switch (spec->getKind()) {
+ case SIMPLE: {
+ return spec->getSimpleType();
+ }
+ case RS_OBJECT: {
+ // Do nothing for RS object types.
+ break;
+ }
+ case STRUCT: {
+ return spec->getStructName();
+ }
+ case ENUM:
+ // Do nothing
+ break;
+ }
+ }
+ }
+ return "";
+}
+
+/* Expand the typedefs found in 'type' into their equivalents and tokenize
+ * the resulting list. 'apiLevel' and 'intSize' specifies the API level and bitness
+ * we are currently processing.
+ */
+list<string> expandTypedefs(const string type, unsigned int apiLevel, int intSize, string& vectorSize) {
+ // Split the string in tokens.
+ istringstream stream(type);
+ list<string> tokens{istream_iterator<string>{stream}, istream_iterator<string>{}};
+ // Try to substitue each token.
+ for (auto i = tokens.begin(); i != tokens.end();) {
+ const string substitute = findSubstitute(*i, apiLevel, intSize);
+ if (substitute.empty()) {
+ // No substitution possible, just go to the next token.
+ i++;
+ } else {
+ // Split the replacement string in tokens.
+ istringstream stream(substitute);
+
+ /* Get the new vector size. This is for the case of the type being for example
+ * rs_quaternion* == float4*, where we need the vector size to be 4 for the
+ * purposes of mangling, although the parameter itself is not determined to be
+ * a vector. */
+ string unused;
+ string newVectorSize;
+ getVectorSizeAndBaseType(*i, newVectorSize, unused);
+
+ istringstream vectorSizeBuf(vectorSize);
+ int vectorSizeVal;
+ vectorSizeBuf >> vectorSizeVal;
+
+ istringstream newVectorSizeBuf(newVectorSize);
+ int newVectorSizeVal;
+ newVectorSizeBuf >> newVectorSizeVal;
+
+ if (newVectorSizeVal > vectorSizeVal)
+ vectorSize = newVectorSize;
+
+ list<string> newTokens{istream_iterator<string>{stream}, istream_iterator<string>{}};
+ // Replace the token with the substitution. Don't advance, as the new substitution
+ // might itself be replaced.
+ auto prev = i;
+ --prev;
+ tokens.insert(i, newTokens.begin(), newTokens.end());
+ tokens.erase(i);
+ advance(i, -newTokens.size());
+ }
+ }
+ return tokens;
+}
+
+// Remove the first element of the list if it equals 'prefix'. Return true in that case.
+static bool eatFront(list<string>* tokens, const char* prefix) {
+ if (tokens->front() == prefix) {
+ tokens->pop_front();
+ return true;
+ }
+ return false;
+}
+
+/* Search the table of translations for the built-ins for the mangling that
+ * corresponds to this list of tokens. If a match is found, consume these tokens
+ * and return a pointer to the string. If not, return nullptr.
+ */
+static const char* findManglingOfBuiltInType(list<string>* tokens) {
+ for (const BuiltInMangling& a : builtInMangling) {
+ auto t = tokens->begin();
+ auto end = tokens->end();
+ bool match = true;
+ // We match up to three tokens.
+ for (int i = 0; i < 3; i++) {
+ if (!a.token[i]) {
+ // No more tokens
+ break;
+ }
+ if (t == end || *t++ != a.token[i]) {
+ match = false;
+ }
+ }
+ if (match) {
+ tokens->erase(tokens->begin(), t);
+ return a.equivalence;
+ }
+ }
+ return nullptr;
+}
+
+// Mangle a long name by prefixing it with its length, e.g. "13rs_allocation".
+static inline string mangleLongName(const string& name) {
+ return to_string(name.size()) + name;
+}
+
+/* Mangle the type name that's represented by the vector size and list of tokens.
+ * The mangling will be returned in full form in 'mangling'. 'compressedMangling'
+ * will have the compressed equivalent. This is built using the 'previousManglings'
+ * list. false is returned if an error is encountered.
+ *
+ * This function is recursive because compression is possible at each level of the definition.
+ * See http://mentorembedded.github.io/cxx-abi/abi.html#mangle.type for a description
+ * of the Itanium mangling used by llvm.
+ *
+ * This function mangles correctly the types currently used by RenderScript. It does
+ * not currently mangle more complicated types like function pointers, namespaces,
+ * or other C++ types. In particular, we don't deal correctly with parenthesis.
+ */
+static bool mangleType(string vectorSize, list<string>* tokens, vector<string>* previousManglings,
+ string* mangling, string* compressedMangling) {
+ string delta; // The part of the mangling we're generating for this recursion.
+ bool isTerminal = false; // True if this iteration parses a terminal node in the production.
+ bool canBeCompressed = true; // Will be false for manglings of builtins.
+
+ if (tokens->back() == "*") {
+ delta = "P";
+ tokens->pop_back();
+ } else if (eatFront(tokens, "const")) {
+ delta = "K";
+ } else if (eatFront(tokens, "volatile")) {
+ delta = "V";
+ } else if (vectorSize != "1" && vectorSize != "") {
+ // For vector, prefix with the abbreviation for a vector, including the size.
+ delta = "Dv" + vectorSize + "_";
+ vectorSize.clear(); // Reset to mark the size as consumed.
+ } else if (eatFront(tokens, "struct")) {
+ // For a structure, we just use the structure name
+ if (tokens->size() == 0) {
+ cerr << "Expected a name after struct\n";
+ return false;
+ }
+ delta = mangleLongName(tokens->front());
+ isTerminal = true;
+ tokens->pop_front();
+ } else if (eatFront(tokens, "...")) {
+ delta = "z";
+ isTerminal = true;
+ } else {
+ const char* c = findManglingOfBuiltInType(tokens);
+ if (c) {
+ // It's a basic type. We don't use those directly for compression.
+ delta = c;
+ isTerminal = true;
+ canBeCompressed = false;
+ } else if (tokens->size() > 0) {
+ // It's a complex type name.
+ delta = mangleLongName(tokens->front());
+ isTerminal = true;
+ tokens->pop_front();
+ }
+ }
+
+ if (isTerminal) {
+ // If we're the terminal node, there should be nothing left to mangle.
+ if (tokens->size() > 0) {
+ cerr << "Expected nothing else but found";
+ for (const auto& t : *tokens) {
+ cerr << " " << t;
+ }
+ cerr << "\n";
+ return false;
+ }
+ *mangling = delta;
+ *compressedMangling = delta;
+ } else {
+ // We're not terminal. Recurse and prefix what we've translated this pass.
+ if (tokens->size() == 0) {
+ cerr << "Expected a more complete type\n";
+ return false;
+ }
+ string rest, compressedRest;
+ if (!mangleType(vectorSize, tokens, previousManglings, &rest, &compressedRest)) {
+ return false;
+ }
+ *mangling = delta + rest;
+ *compressedMangling = delta + compressedRest;
+ }
+
+ /* If it's a built-in type, we don't look at previously emitted ones and we
+ * don't keep track of it.
+ */
+ if (!canBeCompressed) {
+ return true;
+ }
+
+ // See if we've encountered this mangling before.
+ for (size_t i = 0; i < previousManglings->size(); ++i) {
+ if ((*previousManglings)[i] == *mangling) {
+ // We have a match, construct an index reference to that previously emitted mangling.
+ ostringstream stream2;
+ stream2 << 'S';
+ if (i > 0) {
+ stream2 << (char)('0' + i - 1);
+ }
+ stream2 << '_';
+ *compressedMangling = stream2.str();
+ return true;
+ }
+ }
+
+ // We have not encountered this before. Add it to the list.
+ previousManglings->push_back(*mangling);
+ return true;
+}
+
+// Write to the stream the mangled representation of each parameter.
+static bool writeParameters(ostringstream* stream, const std::vector<ParameterDefinition*>& params,
+ unsigned int apiLevel, int intSize) {
+ if (params.empty()) {
+ *stream << "v";
+ return true;
+ }
+ /* We keep track of the previously generated parameter types, as type mangling
+ * is compressed by reusing previous manglings.
+ */
+ vector<string> previousManglings;
+ for (ParameterDefinition* p : params) {
+ // Expand the typedefs and create a tokenized list.
+ string vectorSize = p->mVectorSize;
+ list<string> tokens = expandTypedefs(p->rsType, apiLevel, intSize, vectorSize);
+ if (p->isOutParameter) {
+ tokens.push_back("*");
+ }
+ string mangling, compressedMangling;
+
+ if (!mangleType(vectorSize, &tokens, &previousManglings, &mangling,
+ &compressedMangling)) {
+ return false;
+ }
+ *stream << compressedMangling;
+ }
+ return true;
+}
+
+/* Add the mangling for this permutation of the function. apiLevel and intSize is used
+ * to select the correct type when expanding complex type.
+ */
+static bool addFunctionManglingToSet(const Function& function,
+ const FunctionPermutation& permutation, bool overloadable,
+ unsigned int apiLevel, int intSize, set<string>* allManglings) {
+ const string& functionName = permutation.getName();
+ string mangling;
+ if (overloadable) {
+ ostringstream stream;
+ stream << "_Z" << mangleLongName(functionName);
+ if (!writeParameters(&stream, permutation.getParams(), apiLevel, intSize)) {
+ cerr << "Error mangling " << functionName << ". See above message.\n";
+ return false;
+ }
+ mangling = stream.str();
+ } else {
+ mangling = functionName;
+ }
+ allManglings->insert(mangling);
+ return true;
+}
+
+/* Add to the set the mangling of each function prototype that can be generated from this
+ * specification, i.e. for all the versions covered and for 32/64 bits. We call this
+ * for each API level because the implementation of a type may have changed in the range
+ * of API levels covered.
+ */
+static bool addManglingsForSpecification(const Function& function,
+ const FunctionSpecification& spec, unsigned int lastApiLevel,
+ set<string>* allManglings) {
+ // If the function is inlined, we won't generate an unresolved external for that.
+ if (spec.hasInline()) {
+ return true;
+ }
+ const VersionInfo info = spec.getVersionInfo();
+ unsigned int minApiLevel, maxApiLevel;
+ minApiLevel = info.minVersion ? info.minVersion : kMinimumApiLevelForTests;
+ maxApiLevel = info.maxVersion ? info.maxVersion : lastApiLevel;
+ const bool overloadable = spec.isOverloadable();
+
+ /* We track success rather than aborting early in case of failure so that we
+ * generate all the error messages.
+ */
+ bool success = true;
+ // Use 64-bit integer here for the loop count to avoid overflow
+ // (minApiLevel == maxApiLevel == UINT_MAX for unreleased API)
+ for (int64_t apiLevel = minApiLevel; apiLevel <= maxApiLevel; ++apiLevel) {
+ for (auto permutation : spec.getPermutations()) {
+ if (info.intSize == 0 || info.intSize == 32) {
+ if (!addFunctionManglingToSet(function, *permutation, overloadable, apiLevel, 32,
+ allManglings)) {
+ success = false;
+ }
+ }
+ if (apiLevel >= kApiLevelWithFirst64Bit && (info.intSize == 0 || info.intSize == 64)) {
+ if (!addFunctionManglingToSet(function, *permutation, overloadable, apiLevel, 64,
+ allManglings)) {
+ success = false;
+ }
+ }
+ }
+ }
+ return success;
+}
+
+/* Generate the white list file of the mangled function prototypes. This generated list is used
+ * to validate unresolved external references. 'lastApiLevel' is the largest api level found in
+ * all spec files.
+ */
+static bool generateWhiteListFile(unsigned int lastApiLevel) {
+ bool success = true;
+ // We generate all the manglings in a set to remove duplicates and to order them.
+ set<string> allManglings;
+ for (auto f : systemSpecification.getFunctions()) {
+ const Function* function = f.second;
+ for (auto spec : function->getSpecifications()) {
+ // Compiler intrinsics are not runtime APIs. Do not include them in the whitelist.
+ if (spec->isIntrinsic()) {
+ continue;
+ }
+ if (!addManglingsForSpecification(*function, *spec, lastApiLevel, &allManglings)) {
+ success = false; // We continue so we can generate all errors.
+ }
+ }
+ }
+
+ if (success) {
+ GeneratedFile file;
+ if (!file.start(".", "RSStubsWhiteList.cpp")) {
+ return false;
+ }
+
+ file.writeNotices();
+ file << "#include \"RSStubsWhiteList.h\"\n\n";
+ file << "std::vector<std::string> stubList = {\n";
+ for (const auto& e : allManglings) {
+ file << "\"" << e << "\",\n";
+ }
+ file << "};\n";
+ }
+ return success;
+}
+
+// Add a uniquely named variable definition to the file and return its name.
+static const string addVariable(GeneratedFile* file, unsigned int* variableNumber) {
+ const string name = "buf" + to_string((*variableNumber)++);
+ /* Some data structures like rs_tm can't be exported. We'll just use a dumb buffer
+ * and cast its address later on.
+ */
+ *file << "char " << name << "[200];\n";
+ return name;
+}
+
+/* Write to the file the globals needed to make the call for this permutation. The actual
+ * call is stored in 'calls', as we'll need to generate all the global variable declarations
+ * before the function definition.
+ */
+static void generateTestCall(GeneratedFile* file, ostringstream* calls,
+ unsigned int* variableNumber, const Function& function,
+ const FunctionPermutation& permutation) {
+ *calls << " ";
+
+ // Handle the return type.
+ const auto ret = permutation.getReturn();
+ if (ret && ret->rsType != "void" && ret->rsType != "const void") {
+ *calls << "*(" << ret->rsType << "*)" << addVariable(file, variableNumber) << " = ";
+ }
+
+ *calls << permutation.getName() << "(";
+
+ // Generate the arguments.
+ const char* separator = "";
+ for (auto p : permutation.getParams()) {
+ *calls << separator;
+ if (p->rsType == "rs_kernel_context") {
+ // Special case for the kernel context, as it has a special existence.
+ *calls << "context";
+ } else if (p->rsType == "...") {
+ // Special case for varargs. No need for casting.
+ *calls << addVariable(file, variableNumber);
+ } else if (p->isOutParameter) {
+ *calls << "(" << p->rsType << "*) " << addVariable(file, variableNumber);
+ } else {
+ *calls << "*(" << p->rsType << "*)" << addVariable(file, variableNumber);
+ }
+ separator = ", ";
+ }
+ *calls << ");\n";
+}
+
+/* Generate a test file that will be used in the frameworks/compile/slang/tests unit tests.
+ * This file tests that all RenderScript APIs can be called for the specified API level.
+ * To avoid the compiler agressively pruning out our calls, we use globals as inputs and outputs.
+ *
+ * Since some structures can't be defined at the global level, we use casts of simple byte
+ * buffers to get around that restriction.
+ *
+ * This file can be used to verify the white list that's also generated in this file. To do so,
+ * run "llvm-nm -undefined-only -just-symbol-name" on the resulting bit code.
+ */
+static bool generateApiTesterFile(const string& slangTestDirectory, unsigned int apiLevel) {
+ GeneratedFile file;
+ if (!file.start(slangTestDirectory, "all" + to_string(apiLevel) + ".rs")) {
+ return false;
+ }
+
+ /* This unusual comment is used by slang/tests/test.py to know which parameter to pass
+ * to llvm-rs-cc when compiling the test.
+ */
+ file << "// -target-api " << apiLevel << " -Wno-deprecated-declarations\n";
+
+ file.writeNotices();
+ file << "#pragma version(1)\n";
+ file << "#pragma rs java_package_name(com.example.renderscript.testallapi)\n\n";
+ if (apiLevel < 23) { // All rs_graphics APIs were deprecated in api level 23.
+ file << "#include \"rs_graphics.rsh\"\n\n";
+ }
+
+ /* The code below emits globals and calls to functions in parallel. We store
+ * the calls in a stream so that we can emit them in the file in the proper order.
+ */
+ ostringstream calls;
+ unsigned int variableNumber = 0; // Used to generate unique names.
+ for (auto f : systemSpecification.getFunctions()) {
+ const Function* function = f.second;
+ for (auto spec : function->getSpecifications()) {
+ // Do not include internal APIs in the API tests.
+ if (spec->isInternal()) {
+ continue;
+ }
+ VersionInfo info = spec->getVersionInfo();
+ if (!info.includesVersion(apiLevel)) {
+ continue;
+ }
+ if (info.intSize == 32) {
+ calls << "#ifndef __LP64__\n";
+ } else if (info.intSize == 64) {
+ calls << "#ifdef __LP64__\n";
+ }
+ for (auto permutation : spec->getPermutations()) {
+ // http://b/27358969 Do not test rsForEach in the all-api test.
+ if (apiLevel >= 24 && permutation->getName().compare(0, 9, "rsForEach") == 0)
+ continue;
+ generateTestCall(&file, &calls, &variableNumber, *function, *permutation);
+ }
+ if (info.intSize != 0) {
+ calls << "#endif\n";
+ }
+ }
+ }
+ file << "\n";
+
+ // Modify the style of kernel as required by the API level.
+ if (apiLevel >= 23) {
+ file << "void RS_KERNEL test(int in, rs_kernel_context context) {\n";
+ } else if (apiLevel >= 17) {
+ file << "void RS_KERNEL test(int in) {\n";
+ } else {
+ file << "void root(const int* in) {\n";
+ }
+ file << calls.str();
+ file << "}\n";
+
+ return true;
+}
+
+bool generateStubsWhiteList(const string& slangTestDirectory, unsigned int maxApiLevel) {
+ unsigned int lastApiLevel = min(systemSpecification.getMaximumApiLevel(), maxApiLevel);
+ if (!generateWhiteListFile(lastApiLevel)) {
+ return false;
+ }
+ // Generate a test file for each apiLevel.
+ for (unsigned int i = kMinimumApiLevelForTests; i <= lastApiLevel; ++i) {
+ if (!generateApiTesterFile(slangTestDirectory, i)) {
+ return false;
+ }
+ }
+ return true;
+}
diff --git a/script_api/GenerateTestFiles.cpp b/script_api/GenerateTestFiles.cpp
new file mode 100644
index 0000000..3c28801
--- /dev/null
+++ b/script_api/GenerateTestFiles.cpp
@@ -0,0 +1,1142 @@
+/*
+ * 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, unsigned 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 line that creates the Target.
+ void writeJavaCreateTarget() 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 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) {
+ bool isFieldArray = !scalar && p->mVectorSize != "1";
+ bool isFloatyField = p->isOutParameter && p->isFloatType && mPermutation.getTest() != "custom";
+
+ mJava->indent() << "public ";
+ if (isFloatyField) {
+ *mJava << "Target.Floaty";
+ } else {
+ *mJava << p->javaBaseType;
+ }
+ if (isFieldArray) {
+ *mJava << "[]";
+ }
+ *mJava << " " << p->variableName << ";\n";
+
+ // For Float16 parameters, add an extra 'double' field in the class
+ // to hold the Double value converted from the input.
+ if (p->isFloat16Parameter() && !isFloatyField) {
+ mJava->indent() << "public double";
+ if (isFieldArray) {
+ *mJava << "[]";
+ }
+ *mJava << " " + p->variableName << "Double;\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() << "StringBuilder message = new StringBuilder();\n";
+ mJava->indent() << "boolean errorFound = false;\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";
+
+ // Convert the Float16 parameter to double and store it in the appropriate field in the
+ // Arguments class.
+ if (p->isFloat16Parameter()) {
+ mJava->indent() << "args." << p->doubleVariableName
+ << " = Float16Utils.convertFloat16ToDouble(args."
+ << p->variableName << ");\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";
+ if (p->isFloat16Parameter()) {
+ mJava->indent() << "args." << p->doubleVariableName
+ << " = Float16Utils.convertFloat16ToDouble(args."
+ << p->variableName << ");\n";
+ }
+ }
+ }
+ mJava->indent() << "// Ask the CoreMathVerifier to validate.\n";
+ if (hasFloat) {
+ writeJavaCreateTarget();
+ }
+ 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) {
+ writeJavaCreateTarget();
+ }
+ 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() << "if (!errorFound)";
+ mJava->startBlock();
+ mJava->indent() << "errorFound = true;\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() << "message.append(\"Errors at\");\n";
+ mJava->endBlock();
+
+ mJava->indent() << "message.append(\" [\");\n";
+ mJava->indent() << "message.append(Integer.toString(i));\n";
+ mJava->indent() << "message.append(\", \");\n";
+ mJava->indent() << "message.append(Integer.toString(j));\n";
+ mJava->indent() << "message.append(\"]\");\n";
+
+ mJava->endBlock();
+ mJava->endBlock();
+ mJava->endBlock();
+
+ mJava->indent() << "assertFalse(\"Incorrect output for " << mJavaCheckMethodName << "\" +\n";
+ mJava->indentPlus()
+ << "(relaxed ? \"_relaxed\" : \"\") + \":\\n\" + message.toString(), errorFound);\n";
+
+ mJava->endBlock();
+ *mJava << "\n";
+}
+
+void PermutationWriter::writeJavaVerifyVectorMethod() const {
+ writeJavaVerifyMethodHeader();
+ mJava->startBlock();
+
+ for (auto p : mAllInputsAndOutputs) {
+ writeJavaArrayInitialization(*p);
+ }
+ mJava->indent() << "StringBuilder message = new StringBuilder();\n";
+ mJava->indent() << "boolean errorFound = false;\n";
+ 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";
+ if (p->isFloat16Parameter() && !p->isOutParameter) {
+ mJava->indent() << "args." << p->variableName << "Double = new double["
+ << 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";
+ // Convert the Float16 parameter to double and store it in the appropriate field in
+ // the Arguments class.
+ if (p->isFloat16Parameter()) {
+ mJava->indent() << "args." << p->doubleVariableName << " = "
+ << "Float16Utils.convertFloat16ToDouble(args."
+ << p->variableName << ");\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";
+
+ // Convert the Float16 parameter to double and store it in the appropriate field in
+ // the Arguments class.
+ if (p->isFloat16Parameter()) {
+ mJava->indent() << "args." << p->doubleVariableName << "[j] = "
+ << "Float16Utils.convertFloat16ToDouble(args."
+ << p->variableName << "[j]);\n";
+ }
+ mJava->endBlock();
+ }
+ }
+ }
+ writeJavaCreateTarget();
+ 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() << "if (!errorFound)";
+ mJava->startBlock();
+ mJava->indent() << "errorFound = true;\n";
+
+ for (auto p : mAllInputsAndOutputs) {
+ if (p->isOutParameter) {
+ writeJavaAppendVectorOutputToMessage(*p);
+ } else {
+ writeJavaAppendVectorInputToMessage(*p);
+ }
+ }
+ mJava->indent() << "message.append(\"Errors at\");\n";
+ mJava->endBlock();
+
+ mJava->indent() << "message.append(\" [\");\n";
+ mJava->indent() << "message.append(Integer.toString(i));\n";
+ mJava->indent() << "message.append(\"]\");\n";
+
+ mJava->endBlock();
+ mJava->endBlock();
+
+ mJava->indent() << "assertFalse(\"Incorrect output for " << mJavaCheckMethodName << "\" +\n";
+ mJava->indentPlus()
+ << "(relaxed ? \"_relaxed\" : \"\") + \":\\n\" + message.toString(), errorFound);\n";
+
+ mJava->endBlock();
+ *mJava << "\n";
+}
+
+
+void PermutationWriter::writeJavaCreateTarget() const {
+ string name = mPermutation.getName();
+
+ const char* functionType = "NORMAL";
+ size_t end = name.find('_');
+ if (end != string::npos) {
+ if (name.compare(0, end, "native") == 0) {
+ functionType = "NATIVE";
+ } else if (name.compare(0, end, "half") == 0) {
+ functionType = "HALF";
+ } else if (name.compare(0, end, "fast") == 0) {
+ functionType = "FAST";
+ }
+ }
+
+ string floatType = mReturnParam->specType;
+ const char* precisionStr = "";
+ if (floatType.compare("f16") == 0) {
+ precisionStr = "HALF";
+ } else if (floatType.compare("f32") == 0) {
+ precisionStr = "FLOAT";
+ } else if (floatType.compare("f64") == 0) {
+ precisionStr = "DOUBLE";
+ } else {
+ cerr << "Error. Unreachable. Return type is not floating point\n";
+ }
+
+ mJava->indent() << "Target target = new Target(Target.FunctionType." <<
+ functionType << ", Target.ReturnType." << precisionStr <<
+ ", relaxed);\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";
+
+ /* For basic types, populate the array with values, to help understand failures. We have had
+ * bugs where the output buffer was all 0. We were not sure if there was a failed copy or
+ * the GPU driver was copying zeroes.
+ */
+ if (p.typeIndex >= 0) {
+ mJava->indent() << "Arrays.fill(" << p.javaArrayName << ", (" << TYPES[p.typeIndex].javaType
+ << ") 42);\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 {
+ string actualOut;
+ if (p.isFloat16Parameter()) {
+ // For Float16 values, the output needs to be converted to Double.
+ actualOut = "Float16Utils.convertFloat16ToDouble(" + p.javaArrayName + actualIndex + ")";
+ } else {
+ actualOut = p.javaArrayName + actualIndex;
+ }
+
+ mJava->indent() << "if (";
+ if (p.isFloatType) {
+ *mJava << "!args." << p.variableName << argsIndex << ".couldBe(" << actualOut;
+ 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) {
+ mJava->indent() << "message.append(\"Output " << p.variableName << ": \");\n";
+ mJava->indent() << "appendVariableToMessage(message, args." << p.variableName << argsIndex
+ << ");\n";
+ writeJavaAppendNewLineToMessage();
+ if (p.isFloat16Parameter()) {
+ writeJavaAppendNewLineToMessage();
+ mJava->indent() << "message.append(\"Output " << p.variableName
+ << " (in double): \");\n";
+ mJava->indent() << "appendVariableToMessage(message, args." << p.doubleVariableName
+ << ");\n";
+ writeJavaAppendNewLineToMessage();
+ }
+ } else {
+ mJava->indent() << "message.append(\"Expected output " << p.variableName << ": \");\n";
+ mJava->indent() << "appendVariableToMessage(message, args." << p.variableName << argsIndex
+ << ");\n";
+ writeJavaAppendNewLineToMessage();
+
+ mJava->indent() << "message.append(\"Actual output " << p.variableName << ": \");\n";
+ mJava->indent() << "appendVariableToMessage(message, " << p.javaArrayName << actualIndex
+ << ");\n";
+
+ if (p.isFloat16Parameter()) {
+ writeJavaAppendNewLineToMessage();
+ mJava->indent() << "message.append(\"Actual output " << p.variableName
+ << " (in double): \");\n";
+ mJava->indent() << "appendVariableToMessage(message, Float16Utils.convertFloat16ToDouble("
+ << p.javaArrayName << actualIndex << "));\n";
+ }
+
+ 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";
+ mJava->indent() << "appendVariableToMessage(message, " << actual << ");\n";
+ writeJavaAppendNewLineToMessage();
+}
+
+void PermutationWriter::writeJavaAppendNewLineToMessage() const {
+ mJava->indent() << "message.append(\"\\n\");\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& directory,
+ const string& testName, const string& relaxedTestName) {
+ const string fileName = testName + ".java";
+ if (!file->start(directory, 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";
+ *file << "import android.renderscript.cts.Target;\n\n";
+ *file << "import java.util.Arrays;\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& directory,
+ const string& testName) {
+ string fileName = testName + ".rs";
+ if (!file->start(directory, 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& directory,
+ const string& testName, const string& relaxedTestName) {
+ string name = relaxedTestName + ".rs";
+
+ GeneratedFile file;
+ if (!file.start(directory, 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, const string& directory,
+ unsigned int versionOfTestFiles) {
+ // Avoid creating empty files if we're not testing this function.
+ if (!needTestFiles(function, versionOfTestFiles)) {
+ return true;
+ }
+
+ const string testName = "Test" + function.getCapitalizedName();
+ const string relaxedTestName = testName + "Relaxed";
+
+ if (!writeRelaxedRsFile(function, directory, 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, directory, testName)) {
+ return false;
+ }
+
+ if (!startJavaFile(&javaFile, function, directory, 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(const string& directory, unsigned int versionOfTestFiles) {
+ bool success = true;
+ for (auto f : systemSpecification.getFunctions()) {
+ if (!writeTestFilesForFunction(*f.second, directory, versionOfTestFiles)) {
+ success = false;
+ }
+ }
+ return success;
+}
diff --git a/script_api/Generator.cpp b/script_api/Generator.cpp
new file mode 100644
index 0000000..456f214
--- /dev/null
+++ b/script_api/Generator.cpp
@@ -0,0 +1,209 @@
+/*
+ * 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 API level to target. The generated
+ * files will not contain APIs passed that API level. Note that this does not affect
+ * generic comments found in headers.
+ *
+ * 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.}] | UNRELEASED)
+ * [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.
+ * [deprecated: [{Deprecation message.}] ... This is deprecated. Compiler will issue a wrning.
+ * 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.}] | UNRELEASED)
+ * [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.
+ * [deprecated: [{Deprecation message.}] ... This is deprecated. Compiler will issue a wrning.
+ * 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.}] | UNRELEASED)
+ * [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.}] | UNRELEASED)
+ * [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.}] | UNRELEASED)
+ * [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})]|{Elipsis})[, {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.
+ * [deprecated: [{Deprecation message.}] ... This is deprecated. Compiler will issue a wrning.
+ * 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[], unsigned int* maxApiLevel, bool* forVerification,
+ 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;
+ *maxApiLevel = 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 if (argv[i][1] == 'H') {
+ *forVerification = true;
+ } 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.
+ unsigned int maxApiLevel = VersionInfo::kUnreleasedVersion;
+ vector<string> specFileNames;
+ bool forVerification = false;
+ if (!parseCommandLine(argc, argv, &maxApiLevel, &forVerification, &specFileNames)) {
+ cout << "Usage: gen_runtime spec_file [spec_file...] [-v version_of_test_files][-H]\n";
+ return -1;
+ }
+ bool success = true;
+ for (auto i : specFileNames) {
+ if (!systemSpecification.readSpecFile(i, maxApiLevel)) {
+ success = false;
+ }
+ }
+ if (success) {
+ success = systemSpecification.generateFiles(forVerification, maxApiLevel);
+ }
+ return success ? 0 : -2;
+}
diff --git a/script_api/Generator.h b/script_api/Generator.h
new file mode 100644
index 0000000..5d72101
--- /dev/null
+++ b/script_api/Generator.h
@@ -0,0 +1,38 @@
+/*
+ * 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(const std::string& directory);
+
+// Generates the Java and RenderScript test files. The implementation is in GenerateTestFiles.cpp.
+bool generateTestFiles(const std::string& directory, unsigned int versionOfTestFiles);
+
+/* Generates the documentation files. The implementation is in GenerateDocumentation.cpp.
+ * If forVerification is false (the default), we generate the .jd files needed by the
+ * documentation system. If it's true, we generate complete .html files for local debugging.
+ */
+bool generateDocumentation(const std::string& director, bool forVerification);
+
+/* Generates the RSStubsWhiteList.cpp file. Also generates script test files that are used
+ * when testing slang and that can be used to manually verify the white list.
+ * The implementation is in GenerateStubsWhiteList.cpp.
+ */
+bool generateStubsWhiteList(const std::string& slangTestDirectory, unsigned int maxApiLevel);
+
+#endif // ANDROID_RS_API_GENERATOR_GENERATOR_H
diff --git a/script_api/Scanner.cpp b/script_api/Scanner.cpp
new file mode 100644
index 0000000..aa382f3
--- /dev/null
+++ b/script_api/Scanner.cpp
@@ -0,0 +1,201 @@
+/*
+ * 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::skipUntilTag(const char* tag) {
+ while(!findOptionalTag(tag)) {
+ mTagConsumed = true;
+ }
+}
+
+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) {
+ if (s == "...") {
+ p->name = s;
+ p->type = s;
+ p->lineNumber = mLineNumber;
+ return p;
+ } else {
+ 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/script_api/Scanner.h b/script_api/Scanner.h
new file mode 100644
index 0000000..82a4e8f
--- /dev/null
+++ b/script_api/Scanner.h
@@ -0,0 +1,104 @@
+/*
+ * 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>
+
+struct 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);
+ // Keep reading from the stream until the tag is found.
+ void skipUntilTag(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/script_api/Specification.cpp b/script_api/Specification.cpp
new file mode 100644
index 0000000..c103dc1
--- /dev/null
+++ b/script_api/Specification.cpp
@@ -0,0 +1,965 @@
+/*
+ * 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 unsigned int MIN_API_LEVEL = 9;
+
+const NumericalType TYPES[] = {
+ {"f16", "FLOAT_16", "half", "short", 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]);
+
+static const char kTagUnreleased[] = "UNRELEASED";
+
+// Patterns that get substituted with C type or RS Data type names in function
+// names, arguments, return types, and inlines.
+static const string kCTypePatterns[] = {"#1", "#2", "#3", "#4"};
+static const string kRSTypePatterns[] = {"#RST_1", "#RST_2", "#RST_3", "#RST_4"};
+
+// 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;
+}
+
+// Returns true if each entry in typeVector is an RS numerical type
+static bool isRSTValid(const vector<string> &typeVector) {
+ for (auto type: typeVector) {
+ if (findCType(type) == -1)
+ return false;
+ }
+ return true;
+}
+
+void getVectorSizeAndBaseType(const string& type, string& vectorSize, string& baseType) {
+ vectorSize = "1";
+ baseType = type;
+
+ /* If it's a vector type, we need to split the base type from the size.
+ * We know that's it's a vector type if the last character is a digit and
+ * the rest is an actual base type. We used to only verify the first part,
+ * which created a problem with rs_matrix2x2.
+ */
+ const int last = type.size() - 1;
+ const char lastChar = type[last];
+ if (lastChar >= '0' && lastChar <= '9') {
+ const string trimmed = type.substr(0, last);
+ int i = findCType(trimmed);
+ if (i >= 0) {
+ baseType = trimmed;
+ vectorSize = lastChar;
+ }
+ }
+}
+
+void ParameterDefinition::parseParameterDefinition(const string& type, const string& name,
+ const string& testOption, int lineNumber,
+ bool isReturn, Scanner* scanner) {
+ rsType = type;
+ specName = name;
+
+ // Determine if this is an output.
+ isOutParameter = isReturn || charRemoved('*', &rsType);
+
+ getVectorSizeAndBaseType(rsType, mVectorSize, rsBaseType);
+ typeIndex = findCType(rsBaseType);
+
+ 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";
+ }
+ doubleVariableName = variableName + "Double";
+ } else {
+ variableName = "in";
+ if (specName.empty()) {
+ scanner->error(lineNumber) << "Should have a name.\n";
+ }
+ variableName += capitalize(specName);
+ doubleVariableName = variableName + "Double";
+ }
+ 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";
+ }
+ }
+
+ 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";
+ }
+ }
+}
+
+bool VersionInfo::scan(Scanner* scanner, unsigned int maxApiLevel) {
+ if (scanner->findOptionalTag("version:")) {
+ const string s = scanner->getValue();
+ if (s.compare(0, sizeof(kTagUnreleased), kTagUnreleased) == 0) {
+ // The API is still under development and does not have
+ // an official version number.
+ minVersion = maxVersion = kUnreleasedVersion;
+ } else {
+ sscanf(s.c_str(), "%u %u", &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);
+ }
+
+ if (maxVersion > maxApiLevel) {
+ maxVersion = maxApiLevel;
+ }
+
+ return minVersion == 0 || minVersion <= maxApiLevel;
+}
+
+Definition::Definition(const std::string& name)
+ : mName(name), mDeprecatedApiLevel(0), mHidden(false), mFinalVersion(-1) {
+}
+
+void Definition::updateFinalVersion(const VersionInfo& info) {
+ /* We set it if:
+ * - We have never set mFinalVersion before, or
+ * - The max version is 0, which means we have not expired this API, or
+ * - We have a max that's later than what we currently have.
+ */
+ if (mFinalVersion < 0 || info.maxVersion == 0 ||
+ (mFinalVersion > 0 && info.maxVersion > mFinalVersion)) {
+ mFinalVersion = info.maxVersion;
+ }
+}
+
+void Definition::scanDocumentationTags(Scanner* scanner, bool firstOccurence,
+ const SpecFile* specFile) {
+ if (scanner->findOptionalTag("hidden:")) {
+ scanner->checkNoValue();
+ mHidden = true;
+ }
+ if (scanner->findOptionalTag("deprecated:")) {
+ string value = scanner->getValue();
+ size_t pComma = value.find(", ");
+ if (pComma != string::npos) {
+ mDeprecatedMessage = value.substr(pComma + 2);
+ value.erase(pComma);
+ }
+ sscanf(value.c_str(), "%i", &mDeprecatedApiLevel);
+ if (mDeprecatedApiLevel <= 0) {
+ scanner->error() << "deprecated entries should have a level > 0\n";
+ }
+ }
+ if (firstOccurence) {
+ if (scanner->findTag("summary:")) {
+ mSummary = scanner->getValue();
+ }
+ if (scanner->findTag("description:")) {
+ scanner->checkNoValue();
+ while (scanner->findOptionalTag("")) {
+ mDescription.push_back(scanner->getValue());
+ }
+ }
+ mUrl = specFile->getDetailedDocumentationUrl() + "#android_rs:" + mName;
+ } 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) : Definition(name) {
+ 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 ConstantSpecification::scanConstantSpecification(Scanner* scanner, SpecFile* specFile,
+ unsigned int maxApiLevel) {
+ string name = scanner->getValue();
+ VersionInfo info;
+ if (!info.scan(scanner, maxApiLevel)) {
+ cout << "Skipping some " << name << " definitions.\n";
+ scanner->skipUntilTag("end:");
+ return;
+ }
+
+ bool created = false;
+ Constant* constant = systemSpecification.findOrCreateConstant(name, &created);
+ ConstantSpecification* spec = new ConstantSpecification(constant);
+ constant->addSpecification(spec);
+ constant->updateFinalVersion(info);
+ specFile->addConstantSpecification(spec, created);
+ spec->mVersionInfo = info;
+
+ if (scanner->findTag("value:")) {
+ spec->mValue = scanner->getValue();
+ }
+ constant->scanDocumentationTags(scanner, created, specFile);
+
+ scanner->findTag("end:");
+}
+
+void TypeSpecification::scanTypeSpecification(Scanner* scanner, SpecFile* specFile,
+ unsigned int maxApiLevel) {
+ string name = scanner->getValue();
+ VersionInfo info;
+ if (!info.scan(scanner, maxApiLevel)) {
+ cout << "Skipping some " << name << " definitions.\n";
+ scanner->skipUntilTag("end:");
+ return;
+ }
+
+ bool created = false;
+ Type* type = systemSpecification.findOrCreateType(name, &created);
+ TypeSpecification* spec = new TypeSpecification(type);
+ type->addSpecification(spec);
+ type->updateFinalVersion(info);
+ specFile->addTypeSpecification(spec, created);
+ spec->mVersionInfo = info;
+
+ if (scanner->findOptionalTag("simple:")) {
+ spec->mKind = SIMPLE;
+ spec->mSimpleType = scanner->getValue();
+ }
+ if (scanner->findOptionalTag("rs_object:")) {
+ spec->mKind = RS_OBJECT;
+ }
+ 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("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);
+ }
+ }
+ if (scanner->findOptionalTag("attrib:")) {
+ spec->mAttribute = scanner->getValue();
+ }
+ type->scanDocumentationTags(scanner, created, specFile);
+
+ scanner->findTag("end:");
+}
+
+FunctionSpecification::~FunctionSpecification() {
+ for (auto i : mParameters) {
+ delete i;
+ }
+ delete mReturn;
+ for (auto i : mPermutations) {
+ delete i;
+ }
+}
+
+string FunctionSpecification::expandRSTypeInString(const string &s,
+ const string &pattern,
+ const string &cTypeStr) const {
+ // Find index of numerical type corresponding to cTypeStr. The case where
+ // pattern is found in s but cTypeStr is not a numerical type is checked in
+ // checkRSTPatternValidity.
+ int typeIdx = findCType(cTypeStr);
+ if (typeIdx == -1) {
+ return s;
+ }
+ // If index exists, perform replacement.
+ return stringReplace(s, pattern, TYPES[typeIdx].rsDataType);
+}
+
+string FunctionSpecification::expandString(string s,
+ int replacementIndexes[MAX_REPLACEABLES]) const {
+
+
+ for (unsigned idx = 0; idx < mReplaceables.size(); idx ++) {
+ string toString = mReplaceables[idx][replacementIndexes[idx]];
+
+ // replace #RST_i patterns with RS datatype corresponding to toString
+ s = expandRSTypeInString(s, kRSTypePatterns[idx], toString);
+
+ // replace #i patterns with C type from mReplaceables
+ s = stringReplace(s, kCTypePatterns[idx], toString);
+ }
+
+ 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(unsigned int versionOfTestFiles) const {
+ if (mVersionInfo.maxVersion != 0 && mVersionInfo.maxVersion < versionOfTestFiles) {
+ return false;
+ }
+ if (mTest == "none") {
+ return false;
+ }
+ return true;
+}
+
+void FunctionSpecification::checkRSTPatternValidity(const string &inlineStr, bool allow,
+ Scanner *scanner) {
+ for (int i = 0; i < MAX_REPLACEABLES; i ++) {
+ bool patternFound = inlineStr.find(kRSTypePatterns[i]) != string::npos;
+
+ if (patternFound) {
+ if (!allow) {
+ scanner->error() << "RST_i pattern not allowed here\n";
+ }
+ else if (mIsRSTAllowed[i] == false) {
+ scanner->error() << "Found pattern \"" << kRSTypePatterns[i]
+ << "\" in spec. But some entry in the corresponding"
+ << " parameter list cannot be translated to an RS type\n";
+ }
+ }
+ }
+}
+
+void FunctionSpecification::scanFunctionSpecification(Scanner* scanner, SpecFile* specFile,
+ unsigned int maxApiLevel) {
+ // Some functions like convert have # part of the name. Truncate at that point.
+ const string& unexpandedName = scanner->getValue();
+ string name = unexpandedName;
+ size_t p = name.find('#');
+ if (p != string::npos) {
+ if (p > 0 && name[p - 1] == '_') {
+ p--;
+ }
+ name.erase(p);
+ }
+ VersionInfo info;
+ if (!info.scan(scanner, maxApiLevel)) {
+ cout << "Skipping some " << name << " definitions.\n";
+ scanner->skipUntilTag("end:");
+ return;
+ }
+
+ bool created = false;
+ Function* function = systemSpecification.findOrCreateFunction(name, &created);
+ FunctionSpecification* spec = new FunctionSpecification(function);
+ function->addSpecification(spec);
+ function->updateFinalVersion(info);
+ specFile->addFunctionSpecification(spec, created);
+
+ spec->mUnexpandedName = unexpandedName;
+ spec->mTest = "scalar"; // default
+ spec->mVersionInfo = info;
+
+ if (scanner->findOptionalTag("internal:")) {
+ spec->mInternal = (scanner->getValue() == "true");
+ }
+ if (scanner->findOptionalTag("intrinsic:")) {
+ spec->mIntrinsic = (scanner->getValue() == "true");
+ }
+ 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);
+ // RST_i pattern not applicable for width.
+ spec->mIsRSTAllowed.push_back(false);
+ }
+
+ while (scanner->findOptionalTag("t:")) {
+ spec->mReplaceables.push_back(convertToTypeVector(scanner->getValue()));
+ spec->mIsRSTAllowed.push_back(isRSTValid(spec->mReplaceables.back()));
+ }
+
+ // Disallow RST_* pattern in function name
+ // FIXME the line number for this error would be wrong
+ spec->checkRSTPatternValidity(unexpandedName, false, scanner);
+
+ if (scanner->findTag("ret:")) {
+ ParameterEntry* p = scanner->parseArgString(true);
+ function->addReturn(p, scanner);
+ spec->mReturn = p;
+
+ // Disallow RST_* pattern in return type
+ spec->checkRSTPatternValidity(p->type, false, scanner);
+ }
+ while (scanner->findOptionalTag("arg:")) {
+ ParameterEntry* p = scanner->parseArgString(false);
+ function->addParameter(p, scanner);
+ spec->mParameters.push_back(p);
+
+ // Disallow RST_* pattern in parameter type or testOption
+ spec->checkRSTPatternValidity(p->type, false, scanner);
+ spec->checkRSTPatternValidity(p->testOption, false, scanner);
+ }
+
+ function->scanDocumentationTags(scanner, created, specFile);
+
+ if (scanner->findOptionalTag("inline:")) {
+ scanner->checkNoValue();
+ while (scanner->findOptionalTag("")) {
+ spec->mInline.push_back(scanner->getValue());
+
+ // Allow RST_* pattern in inline definitions
+ spec->checkRSTPatternValidity(spec->mInline.back(), true, scanner);
+ }
+ }
+ 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)
+ : 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 = core + ".html";
+}
+
+void SpecFile::addConstantSpecification(ConstantSpecification* spec, bool hasDocumentation) {
+ mConstantSpecificationsList.push_back(spec);
+ if (hasDocumentation) {
+ Constant* constant = spec->getConstant();
+ mDocumentedConstants.insert(pair<string, Constant*>(constant->getName(), constant));
+ }
+}
+
+void SpecFile::addTypeSpecification(TypeSpecification* spec, bool hasDocumentation) {
+ mTypeSpecificationsList.push_back(spec);
+ if (hasDocumentation) {
+ Type* type = spec->getType();
+ mDocumentedTypes.insert(pair<string, Type*>(type->getName(), type));
+ }
+}
+
+void SpecFile::addFunctionSpecification(FunctionSpecification* spec, bool hasDocumentation) {
+ mFunctionSpecificationsList.push_back(spec);
+ if (hasDocumentation) {
+ Function* function = spec->getFunction();
+ mDocumentedFunctions.insert(pair<string, Function*>(function->getName(), function));
+ }
+}
+
+// Read the specification, adding the definitions to the global functions map.
+bool SpecFile::readSpecFile(unsigned int maxApiLevel) {
+ 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, maxApiLevel);
+ } else if (tag == "type:") {
+ TypeSpecification::scanTypeSpecification(&scanner, this, maxApiLevel);
+ } else if (tag == "constant:") {
+ ConstantSpecification::scanConstantSpecification(&scanner, this, maxApiLevel);
+ } else {
+ scanner.error() << "Expected function:, type:, or constant:. Found: " << tag << "\n";
+ return false;
+ }
+ }
+
+ fclose(specFile);
+ return scanner.getErrorCount() == 0;
+}
+
+SystemSpecification::~SystemSpecification() {
+ for (auto i : mConstants) {
+ delete i.second;
+ }
+ for (auto i : mTypes) {
+ delete i.second;
+ }
+ for (auto i : mFunctions) {
+ delete i.second;
+ }
+ for (auto i : mSpecFiles) {
+ delete i;
+ }
+}
+
+// Returns the named entry in the map. Creates it if it's not there.
+template <class T>
+T* findOrCreate(const string& name, map<string, T*>* map, bool* created) {
+ auto iter = map->find(name);
+ if (iter != map->end()) {
+ *created = false;
+ return iter->second;
+ }
+ *created = true;
+ T* f = new T(name);
+ map->insert(pair<string, T*>(name, f));
+ return f;
+}
+
+Constant* SystemSpecification::findOrCreateConstant(const string& name, bool* created) {
+ return findOrCreate<Constant>(name, &mConstants, created);
+}
+
+Type* SystemSpecification::findOrCreateType(const string& name, bool* created) {
+ return findOrCreate<Type>(name, &mTypes, created);
+}
+
+Function* SystemSpecification::findOrCreateFunction(const string& name, bool* created) {
+ return findOrCreate<Function>(name, &mFunctions, created);
+}
+
+bool SystemSpecification::readSpecFile(const string& fileName, unsigned int maxApiLevel) {
+ SpecFile* spec = new SpecFile(fileName);
+ if (!spec->readSpecFile(maxApiLevel)) {
+ cerr << fileName << ": Failed to parse.\n";
+ return false;
+ }
+ mSpecFiles.push_back(spec);
+ return true;
+}
+
+
+static void updateMaxApiLevel(const VersionInfo& info, unsigned int* maxApiLevel) {
+ if (info.minVersion == VersionInfo::kUnreleasedVersion) {
+ // Ignore development API level in consideration of max API level.
+ return;
+ }
+ *maxApiLevel = max(*maxApiLevel, max(info.minVersion, info.maxVersion));
+}
+
+unsigned int SystemSpecification::getMaximumApiLevel() {
+ unsigned int maxApiLevel = 0;
+ for (auto i : mConstants) {
+ for (auto j: i.second->getSpecifications()) {
+ updateMaxApiLevel(j->getVersionInfo(), &maxApiLevel);
+ }
+ }
+ for (auto i : mTypes) {
+ for (auto j: i.second->getSpecifications()) {
+ updateMaxApiLevel(j->getVersionInfo(), &maxApiLevel);
+ }
+ }
+ for (auto i : mFunctions) {
+ for (auto j: i.second->getSpecifications()) {
+ updateMaxApiLevel(j->getVersionInfo(), &maxApiLevel);
+ }
+ }
+ return maxApiLevel;
+}
+
+bool SystemSpecification::generateFiles(bool forVerification, unsigned int maxApiLevel) const {
+ bool success = generateHeaderFiles("include") &&
+ generateDocumentation("docs", forVerification) &&
+ generateTestFiles("test", maxApiLevel) &&
+ generateStubsWhiteList("slangtest", maxApiLevel);
+ 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/script_api/Specification.h b/script_api/Specification.h
new file mode 100644
index 0000000..bcd5737
--- /dev/null
+++ b/script_api/Specification.h
@@ -0,0 +1,625 @@
+/*
+ * 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 <climits>
+#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
+ std::string doubleVariableName; // e.g. inXDouble, used in .java for storing Float16 parameters
+ // in double.
+
+ // 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);
+
+ bool isFloat16Parameter() const { return specType.compare("f16") == 0; }
+};
+
+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.
+ */
+ unsigned int minVersion;
+ unsigned 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) {}
+ /* Scan the version info from the spec file. maxApiLevel specifies the maximum level
+ * we are interested in. This may alter maxVersion. This method returns false if the
+ * minVersion is greater than the maxApiLevel.
+ */
+ bool scan(Scanner* scanner, unsigned int maxApiLevel);
+ /* Return true if the target can be found whitin the range. */
+ bool includesVersion(int target) const {
+ return (minVersion == 0 || target >= minVersion) &&
+ (maxVersion == 0 || target <= maxVersion);
+ }
+
+ static constexpr unsigned int kUnreleasedVersion = UINT_MAX;
+};
+
+// We have three type of definitions
+class Definition {
+protected:
+ std::string mName;
+ /* If greater than 0, this definition is deprecated. It's the API level at which
+ * we added the deprecation warning.
+ */
+ int mDeprecatedApiLevel;
+ std::string mDeprecatedMessage; // Optional specific warning if the API is deprecated
+ 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
+ int mFinalVersion; // API level at which this API was removed, 0 if API is still valid
+
+public:
+ Definition(const std::string& name);
+
+ std::string getName() const { return mName; }
+ bool deprecated() const { return mDeprecatedApiLevel > 0; }
+ int getDeprecatedApiLevel() const { return mDeprecatedApiLevel; }
+ std::string getDeprecatedMessage() const { return mDeprecatedMessage; }
+ 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; }
+ int getFinalVersion() const { return mFinalVersion; }
+
+ void scanDocumentationTags(Scanner* scanner, bool firstOccurence, const SpecFile* specFile);
+ // Keep track of the final version of this API, if any.
+ void updateFinalVersion(const VersionInfo& info);
+};
+
+/* 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) : Definition(name) {}
+ ~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) : Definition(name) {}
+ ~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);
+ ~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:
+ Constant* mConstant; // Not owned
+
+ std::string mValue; // E.g. "3.1415"
+public:
+ ConstantSpecification(Constant* constant) : mConstant(constant) {}
+
+ Constant* getConstant() const { return mConstant; }
+ std::string getValue() const { return mValue; }
+
+ // Parse a constant specification and add it to specFile.
+ static void scanConstantSpecification(Scanner* scanner, SpecFile* specFile, unsigned int maxApiLevel);
+};
+
+enum TypeKind {
+ SIMPLE,
+ RS_OBJECT,
+ 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:
+ Type* mType; // Not owned
+
+ 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 mAttribute; // 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:
+ TypeSpecification(Type* type) : mType(type) {}
+
+ Type* getType() const { return mType; }
+ 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 getAttribute() const { return mAttribute; }
+ 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, unsigned int maxApiLevel);
+};
+
+// 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:
+ Function* mFunction; // Not owned
+
+ /* 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.
+ * "": Don't test. This is the default.
+ */
+ std::string mTest;
+ bool mInternal; // Internal. Not visible to users. (Default: false)
+ bool mIntrinsic; // Compiler intrinsic that is lowered to an internal API.
+ // (Default: false)
+ 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;
+
+ // i-th entry is true if each entry in mReplaceables[i] has an equivalent
+ // RS numerical type (i.e. present in TYPES global)
+ std::vector<bool> mIsRSTAllowed;
+
+ /* 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.
+ 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. Substitute placeholders for RS
+ * types (#RST_1, #RST_2, ...) by the RS Data type strings (UNSIGNED_8,
+ * FLOAT_32 etc.) of the corresponding types 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;
+
+ // Helper function used by expandString to perform #RST_* substitution
+ std::string expandRSTypeInString(const std::string &s,
+ const std::string &pattern,
+ const std::string &cTypeStr) const;
+
+ // Fill the mPermutations field.
+ void createPermutations(Function* function, Scanner* scanner);
+
+public:
+ FunctionSpecification(Function* function) : mFunction(function), mInternal(false),
+ mIntrinsic(false), mReturn(nullptr) {}
+ ~FunctionSpecification();
+
+ Function* getFunction() const { return mFunction; }
+ bool isInternal() const { return mInternal; }
+ bool isIntrinsic() const { return mIntrinsic; }
+ 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(unsigned int versionOfTestFiles) const;
+
+ bool hasInline() const { return mInline.size() > 0; }
+
+ /* Return true if this function can be overloaded. This is added by default to all
+ * specifications, so except for the very few exceptions that start the attributes
+ * with an '=' to avoid this, we'll return true.
+ */
+ bool isOverloadable() const {
+ return mAttribute.empty() || mAttribute[0] != '=';
+ }
+
+ /* Check if RST_i is present in 's' and report an error if 'allow' is false
+ * or the i-th replacement list is not a valid candidate for RST_i
+ * replacement
+ */
+ void checkRSTPatternValidity(const std::string &s, bool allow, Scanner *scanner);
+
+ // Parse a function specification and add it to specFile.
+ static void scanFunctionSpecification(Scanner* scanner, SpecFile* specFile, unsigned int maxApiLevel);
+};
+
+/* A concrete version of a function specification, where all placeholders have been replaced by
+ * actual values.
+ */
+class FunctionPermutation {
+private:
+ // 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 specifications 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 not owned.
+ */
+ std::list<ConstantSpecification*> mConstantSpecificationsList;
+ std::list<TypeSpecification*> mTypeSpecificationsList;
+ std::list<FunctionSpecification*> mFunctionSpecificationsList;
+
+ /* The constants, types, and functions that are documented in this file.
+ * In very rare cases, specifications for an API are split across multiple
+ * files, e.g. currently for ClearObject(). The documentation for
+ * that function must be found in the first spec file encountered, so the
+ * order of the files on the command line matters.
+ */
+ std::map<std::string, Constant*> mDocumentedConstants;
+ std::map<std::string, Type*> mDocumentedTypes;
+ std::map<std::string, Function*> mDocumentedFunctions;
+
+public:
+ explicit SpecFile(const std::string& specFileName);
+
+ 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<ConstantSpecification*>& getConstantSpecifications() const {
+ return mConstantSpecificationsList;
+ }
+ const std::list<TypeSpecification*>& getTypeSpecifications() const {
+ return mTypeSpecificationsList;
+ }
+ const std::list<FunctionSpecification*>& getFunctionSpecifications() const {
+ return mFunctionSpecificationsList;
+ }
+ const std::map<std::string, Constant*>& getDocumentedConstants() const {
+ return mDocumentedConstants;
+ }
+ const std::map<std::string, Type*>& getDocumentedTypes() const { return mDocumentedTypes; }
+ const std::map<std::string, Function*>& getDocumentedFunctions() const {
+ return mDocumentedFunctions;
+ }
+
+ bool hasSpecifications() const {
+ return !mDocumentedConstants.empty() || !mDocumentedTypes.empty() ||
+ !mDocumentedFunctions.empty();
+ }
+
+ bool readSpecFile(unsigned int maxApiLevel);
+
+ /* These are called by the parser to keep track of the specifications defined in this file.
+ * hasDocumentation is true if this specification containes the documentation.
+ */
+ void addConstantSpecification(ConstantSpecification* spec, bool hasDocumentation);
+ void addTypeSpecification(TypeSpecification* spec, bool hasDocumentation);
+ void addFunctionSpecification(FunctionSpecification* spec, bool hasDocumentation);
+};
+
+// 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 owned.
+ */
+ std::map<std::string, Constant*> mConstants;
+ std::map<std::string, Type*> mTypes;
+ std::map<std::string, Function*> mFunctions;
+
+public:
+ ~SystemSpecification();
+
+ /* These are called the parser to create unique instances per name. Set *created to true
+ * if the named specification did not already exist.
+ */
+ Constant* findOrCreateConstant(const std::string& name, bool* created);
+ Type* findOrCreateType(const std::string& name, bool* created);
+ Function* findOrCreateFunction(const std::string& name, bool* created);
+
+ /* Parse the spec file and create the object hierarchy, adding a pointer to mSpecFiles.
+ * We won't include information passed the specified level.
+ */
+ bool readSpecFile(const std::string& fileName, unsigned int maxApiLevel);
+ // Generate all the files.
+ bool generateFiles(bool forVerification, unsigned int maxApiLevel) 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;
+
+ // Returns the maximum API level specified in any spec file.
+ unsigned int getMaximumApiLevel();
+};
+
+// 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;
+
+/* Given a renderscript type (string) calculate the vector size and base type. If the type
+ * is not a vector the vector size is 1 and baseType is just the type itself.
+ */
+void getVectorSizeAndBaseType(const std::string& type, std::string& vectorSize,
+ std::string& baseType);
+
+#endif // ANDROID_RS_API_GENERATOR_SPECIFICATION_H
diff --git a/script_api/Utilities.cpp b/script_api/Utilities.cpp
new file mode 100644
index 0000000..fa9fd36
--- /dev/null
+++ b/script_api/Utilities.cpp
@@ -0,0 +1,217 @@
+/*
+ * 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 <algorithm>
+#include <iostream>
+#include <sstream>
+
+#include "Utilities.h"
+
+using namespace std;
+
+const char LEGAL_NOTICE[] =
+ "/*\n"
+ " * Copyright (C) 2016 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/generate.sh.";
+
+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 in = stringReplace(html, "<li>", "- ");
+ string out;
+ for (size_t start = 0; start < in.size(); start++) {
+ size_t lt = in.find('<', start);
+ if (lt == string::npos) {
+ out += in.substr(start);
+ break;
+ }
+ out += in.substr(start, lt - start);
+ if (isalpha(in[lt + 1]) || in[lt + 1] == '/') {
+ // It's an HTML tag. Search for the end.
+ start = in.find('>', lt + 1);
+ if (start == string::npos) {
+ break;
+ }
+ } else {
+ out += '<';
+ }
+ }
+ out = stringReplace(out, ">", ">");
+ out = stringReplace(out, "<", "<");
+ out = stringReplace(out, " ", " ");
+ out = stringReplace(out, "&", "&");
+ return out;
+}
+
+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);
+ uint64_t l = (0xffffffffffffffff >> (64 - numberOfIntegerBits + lowZeroBits))
+ << lowZeroBits;
+ return (double)l;
+}
+
+// Add the value to the stream, prefixed with a ", " if needed.
+static void addCommaSeparated(const string& value, ostringstream* stream, bool* needComma) {
+ if (value.empty()) {
+ return;
+ }
+ if (*needComma) {
+ *stream << ", ";
+ }
+ *stream << value;
+ *needComma = true;
+}
+
+string makeAttributeTag(const string& userAttribute, const string& additionalAttribute,
+ unsigned int deprecatedApiLevel, const string& deprecatedMessage) {
+ ostringstream stream;
+ bool needComma = false;
+ if (userAttribute[0] == '=') {
+ /* If starts with an equal, we don't automatically add additionalAttribute.
+ * This is because of the error we made defining rsUnpackColor8888().
+ */
+ addCommaSeparated(userAttribute.substr(1), &stream, &needComma);
+ } else {
+ addCommaSeparated(userAttribute, &stream, &needComma);
+ addCommaSeparated(additionalAttribute, &stream, &needComma);
+ }
+ if (deprecatedApiLevel > 0) {
+ stream << "\n#if (defined(RS_VERSION) && (RS_VERSION >= " << deprecatedApiLevel << "))\n";
+ addCommaSeparated("deprecated", &stream, &needComma);
+ if (!deprecatedMessage.empty()) {
+ // Remove any @ that's used for generating documentation cross references.
+ string s = deprecatedMessage;
+ s.erase(std::remove(s.begin(), s.end(), '@'), s.end());
+ stream << "(\"" << s << "\")";
+ }
+ stream << "\n#endif\n";
+ }
+ if (stream.tellp() == 0) {
+ return "";
+ }
+ return " __attribute__((" + stream.str() + "))";
+}
+
+// Opens the stream. Reports an error if it can't.
+bool GeneratedFile::start(const string& directory, const string& name) {
+ const string path = directory + "/" + name;
+ open(path.c_str(), ios::out | ios::trunc);
+ if (!is_open()) {
+ cerr << "Error. Can't open the output file: " << path << "\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/script_api/Utilities.h b/script_api/Utilities.h
new file mode 100644
index 0000000..eced68d
--- /dev/null
+++ b/script_api/Utilities.h
@@ -0,0 +1,104 @@
+/*
+ * 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);
+
+/* Creates an " __attribute__((...))" tag. If userAttribute starts with '=', we don't
+ * use the additionalAttribute. An empty string will be returned if there are no attributes.
+ */
+std::string makeAttributeTag(const std::string& userAttribute,
+ const std::string& additionalAttribute, unsigned int deprecatedApiLevel,
+ const std::string& deprecatedMessage);
+
+/* 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& directory, 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/script_api/generate.sh b/script_api/generate.sh
new file mode 100755
index 0000000..fbcde0c
--- /dev/null
+++ b/script_api/generate.sh
@@ -0,0 +1,56 @@
+#!/bin/bash
+#
+# Copyright (C) 2014 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.
+#
+
+CLANG=$ANDROID_BUILD_TOP/prebuilts/clang/host/linux-x86/clang-stable/bin/clang++
+
+set -e
+$CLANG Generator.cpp Specification.cpp GenerateDocumentation.cpp GenerateHeaderFiles.cpp GenerateTestFiles.cpp Scanner.cpp Utilities.cpp GenerateStubsWhiteList.cpp -g -std=c++11 -Wall -o generator
+
+mkdir -p test
+mkdir -p include
+mkdir -p docs
+mkdir -p slangtest
+
+# The order of the arguments passed to generator matter because:
+# 1. The overview is expected to be in the first file.
+# 2. The order specified will be the order they will show in the guide_toc.cs snippet.
+# This can be manually changed when cut&pasting the snippet into guide_toc.cs.
+# 3. rsIs/Clear/SetObject is documented in rs_object_info but also found in rs_graphics.
+# The latter must appear after the former.
+./generator rs_core.spec rs_value_types.spec rs_object_types.spec rs_convert.spec rs_math.spec rs_vector_math.spec rs_matrix.spec rs_quaternion.spec rs_atomic.spec rs_time.spec rs_allocation_create.spec rs_allocation_data.spec rs_object_info.spec rs_for_each.spec rs_io.spec rs_debug.spec rs_graphics.spec
+
+rm generator
+
+rm -f ../../../cts/tests/tests/renderscript/src/android/renderscript/cts/generated/*
+mv test/* ../../../cts/tests/tests/renderscript/src/android/renderscript/cts/generated/
+rmdir test
+
+rm -f ../../base/docs/html/guide/topics/renderscript/reference/*.jd
+mv docs/*.jd ../../base/docs/html/guide/topics/renderscript/reference/
+
+# Current API level : 24
+RS_API_LEVEL=24
+
+for ((i=11; i<=RS_API_LEVEL; i++))
+ do
+ mv slangtest/all$i.rs ../../compile/slang/tests/P_all_api_$i
+done
+rm -rf slangtest
+
+mv RSStubsWhiteList.cpp ../../compile/libbcc/lib/Renderscript/
+
+echo "Be sure to update platform/frameworks/base/docs/html/guide/guide_toc.cs if needed."
diff --git a/script_api/include/rs_allocation_create.rsh b/script_api/include/rs_allocation_create.rsh
new file mode 100644
index 0000000..d7f9fd6
--- /dev/null
+++ b/script_api/include/rs_allocation_create.rsh
@@ -0,0 +1,1345 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/generate.sh.
+
+/*
+ * rs_allocation_create.rsh: Allocation Creation Functions
+ *
+ * The functions below can be used to create Allocations from a Script.
+ *
+ * These functions can be called directly or indirectly from an invokable
+ * function. If some control-flow path can result in a call to these functions
+ * from a RenderScript kernel function, a compiler error will be generated.
+ */
+
+#ifndef RENDERSCRIPT_RS_ALLOCATION_CREATE_RSH
+#define RENDERSCRIPT_RS_ALLOCATION_CREATE_RSH
+
+/*
+ * rsCreateElement: Creates an rs_element object of the specified data type
+ *
+ * Creates an rs_element object of the specified data type. The data kind of
+ * the Element will be set to RS_KIND_USER and vector_width will be set to 1,
+ * indicating non-vector.
+ *
+ * Parameters:
+ * data_type: Data type of the Element
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern rs_element __attribute__((overloadable))
+ rsCreateElement(rs_data_type data_type);
+#endif
+
+/*
+ * rsCreateVectorElement: Creates an rs_element object of the specified data type and vector width
+ *
+ * Creates an rs_element object of the specified data type and vector width.
+ * Value of vector_width must be 2, 3 or 4. The data kind of the Element will
+ * be set to RS_KIND_USER.
+ *
+ * Parameters:
+ * data_type: Data type of the Element
+ * vector_width: Vector width (either 2, 3, or 4)
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern rs_element __attribute__((overloadable))
+ rsCreateVectorElement(rs_data_type data_type, uint32_t vector_width);
+#endif
+
+/*
+ * rsCreatePixelElement: Creates an rs_element object of the specified data type and data kind
+ *
+ * Creates an rs_element object of the specified data type and data kind. The
+ * vector_width of the Element will be set to 1, indicating non-vector.
+ *
+ * Parameters:
+ * data_type: Data type of the Element
+ * data_kind: Data kind of the Element
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern rs_element __attribute__((overloadable))
+ rsCreatePixelElement(rs_data_type data_type, rs_data_kind data_kind);
+#endif
+
+/*
+ * rsCreateType: Creates an rs_type object with the specified Element and shape attributes
+ *
+ * Creates an rs_type object with the specified Element and shape attributes.
+ *
+ * dimX specifies the size of the X dimension.
+ *
+ * dimY, if present and non-zero, indicates that the Y dimension is present and
+ * indicates its size.
+ *
+ * dimZ, if present and non-zero, indicates that the Z dimension is present and
+ * indicates its size.
+ *
+ * mipmaps indicates the presence of level of detail (LOD).
+ *
+ * faces indicates the presence of cubemap faces.
+ *
+ * yuv_format indicates the associated YUV format (or RS_YUV_NONE).
+ *
+ * Parameters:
+ * element: Element to be associated with the Type
+ * dimX: Size along the X dimension
+ * dimY: Size along the Y dimension
+ * dimZ: Size along the Z dimension
+ * mipmaps: Flag indicating if the Type has a mipmap chain
+ * faces: Flag indicating if the Type is a cubemap
+ * yuv_format: YUV layout for the Type
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern rs_type __attribute__((overloadable))
+ rsCreateType(rs_element element, uint32_t dimX, uint32_t dimY, uint32_t dimZ, bool mipmaps,
+ bool faces, rs_yuv_format yuv_format);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern rs_type __attribute__((overloadable))
+ rsCreateType(rs_element element, uint32_t dimX, uint32_t dimY, uint32_t dimZ);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern rs_type __attribute__((overloadable))
+ rsCreateType(rs_element element, uint32_t dimX, uint32_t dimY);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern rs_type __attribute__((overloadable))
+ rsCreateType(rs_element element, uint32_t dimX);
+#endif
+
+/*
+ * rsCreateAllocation: Create an rs_allocation object of given Type.
+ *
+ * Creates an rs_allocation object of the given Type and usage.
+ *
+ * RS_ALLOCATION_USAGE_SCRIPT and RS_ALLOCATION_USAGE_GRAPHICS_TEXTURE are the
+ * only supported usage flags for Allocations created from within a RenderScript
+ * Script.
+ *
+ * You can also use rsCreateAllocation_ wrapper functions to directly
+ * create Allocations of scalar and vector numerical types without creating
+ * intermediate rs_element or rs_type objects.
+ *
+ * E.g. rsCreateAllocation_int4() returns an Allocation of int4 data type of
+ * specified dimensions.
+ *
+ * Parameters:
+ * type: Type of the Allocation
+ * usage: Usage flag for the allocation
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern rs_allocation __attribute__((overloadable))
+ rsCreateAllocation(rs_type type, uint32_t usage);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern rs_allocation __attribute__((overloadable))
+ rsCreateAllocation(rs_type type);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_half(uint32_t dimX, uint32_t dimY, uint32_t dimZ) {
+ rs_element e = rsCreateElement(RS_TYPE_FLOAT_16);
+ rs_type t = rsCreateType(e, dimX, dimY, dimZ);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_float(uint32_t dimX, uint32_t dimY, uint32_t dimZ) {
+ rs_element e = rsCreateElement(RS_TYPE_FLOAT_32);
+ rs_type t = rsCreateType(e, dimX, dimY, dimZ);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_double(uint32_t dimX, uint32_t dimY, uint32_t dimZ) {
+ rs_element e = rsCreateElement(RS_TYPE_FLOAT_64);
+ rs_type t = rsCreateType(e, dimX, dimY, dimZ);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_char(uint32_t dimX, uint32_t dimY, uint32_t dimZ) {
+ rs_element e = rsCreateElement(RS_TYPE_SIGNED_8);
+ rs_type t = rsCreateType(e, dimX, dimY, dimZ);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_uchar(uint32_t dimX, uint32_t dimY, uint32_t dimZ) {
+ rs_element e = rsCreateElement(RS_TYPE_UNSIGNED_8);
+ rs_type t = rsCreateType(e, dimX, dimY, dimZ);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_short(uint32_t dimX, uint32_t dimY, uint32_t dimZ) {
+ rs_element e = rsCreateElement(RS_TYPE_SIGNED_16);
+ rs_type t = rsCreateType(e, dimX, dimY, dimZ);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_ushort(uint32_t dimX, uint32_t dimY, uint32_t dimZ) {
+ rs_element e = rsCreateElement(RS_TYPE_UNSIGNED_16);
+ rs_type t = rsCreateType(e, dimX, dimY, dimZ);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_int(uint32_t dimX, uint32_t dimY, uint32_t dimZ) {
+ rs_element e = rsCreateElement(RS_TYPE_SIGNED_32);
+ rs_type t = rsCreateType(e, dimX, dimY, dimZ);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_uint(uint32_t dimX, uint32_t dimY, uint32_t dimZ) {
+ rs_element e = rsCreateElement(RS_TYPE_UNSIGNED_32);
+ rs_type t = rsCreateType(e, dimX, dimY, dimZ);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_long(uint32_t dimX, uint32_t dimY, uint32_t dimZ) {
+ rs_element e = rsCreateElement(RS_TYPE_SIGNED_64);
+ rs_type t = rsCreateType(e, dimX, dimY, dimZ);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_ulong(uint32_t dimX, uint32_t dimY, uint32_t dimZ) {
+ rs_element e = rsCreateElement(RS_TYPE_UNSIGNED_64);
+ rs_type t = rsCreateType(e, dimX, dimY, dimZ);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_half2(uint32_t dimX, uint32_t dimY, uint32_t dimZ) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_FLOAT_16, 2);
+ rs_type t = rsCreateType(e, dimX, dimY, dimZ);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_half3(uint32_t dimX, uint32_t dimY, uint32_t dimZ) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_FLOAT_16, 3);
+ rs_type t = rsCreateType(e, dimX, dimY, dimZ);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_half4(uint32_t dimX, uint32_t dimY, uint32_t dimZ) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_FLOAT_16, 4);
+ rs_type t = rsCreateType(e, dimX, dimY, dimZ);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_float2(uint32_t dimX, uint32_t dimY, uint32_t dimZ) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_FLOAT_32, 2);
+ rs_type t = rsCreateType(e, dimX, dimY, dimZ);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_float3(uint32_t dimX, uint32_t dimY, uint32_t dimZ) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_FLOAT_32, 3);
+ rs_type t = rsCreateType(e, dimX, dimY, dimZ);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_float4(uint32_t dimX, uint32_t dimY, uint32_t dimZ) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_FLOAT_32, 4);
+ rs_type t = rsCreateType(e, dimX, dimY, dimZ);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_double2(uint32_t dimX, uint32_t dimY, uint32_t dimZ) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_FLOAT_64, 2);
+ rs_type t = rsCreateType(e, dimX, dimY, dimZ);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_double3(uint32_t dimX, uint32_t dimY, uint32_t dimZ) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_FLOAT_64, 3);
+ rs_type t = rsCreateType(e, dimX, dimY, dimZ);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_double4(uint32_t dimX, uint32_t dimY, uint32_t dimZ) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_FLOAT_64, 4);
+ rs_type t = rsCreateType(e, dimX, dimY, dimZ);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_char2(uint32_t dimX, uint32_t dimY, uint32_t dimZ) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_SIGNED_8, 2);
+ rs_type t = rsCreateType(e, dimX, dimY, dimZ);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_char3(uint32_t dimX, uint32_t dimY, uint32_t dimZ) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_SIGNED_8, 3);
+ rs_type t = rsCreateType(e, dimX, dimY, dimZ);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_char4(uint32_t dimX, uint32_t dimY, uint32_t dimZ) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_SIGNED_8, 4);
+ rs_type t = rsCreateType(e, dimX, dimY, dimZ);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_uchar2(uint32_t dimX, uint32_t dimY, uint32_t dimZ) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_UNSIGNED_8, 2);
+ rs_type t = rsCreateType(e, dimX, dimY, dimZ);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_uchar3(uint32_t dimX, uint32_t dimY, uint32_t dimZ) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_UNSIGNED_8, 3);
+ rs_type t = rsCreateType(e, dimX, dimY, dimZ);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_uchar4(uint32_t dimX, uint32_t dimY, uint32_t dimZ) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_UNSIGNED_8, 4);
+ rs_type t = rsCreateType(e, dimX, dimY, dimZ);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_short2(uint32_t dimX, uint32_t dimY, uint32_t dimZ) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_SIGNED_16, 2);
+ rs_type t = rsCreateType(e, dimX, dimY, dimZ);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_short3(uint32_t dimX, uint32_t dimY, uint32_t dimZ) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_SIGNED_16, 3);
+ rs_type t = rsCreateType(e, dimX, dimY, dimZ);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_short4(uint32_t dimX, uint32_t dimY, uint32_t dimZ) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_SIGNED_16, 4);
+ rs_type t = rsCreateType(e, dimX, dimY, dimZ);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_ushort2(uint32_t dimX, uint32_t dimY, uint32_t dimZ) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_UNSIGNED_16, 2);
+ rs_type t = rsCreateType(e, dimX, dimY, dimZ);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_ushort3(uint32_t dimX, uint32_t dimY, uint32_t dimZ) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_UNSIGNED_16, 3);
+ rs_type t = rsCreateType(e, dimX, dimY, dimZ);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_ushort4(uint32_t dimX, uint32_t dimY, uint32_t dimZ) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_UNSIGNED_16, 4);
+ rs_type t = rsCreateType(e, dimX, dimY, dimZ);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_int2(uint32_t dimX, uint32_t dimY, uint32_t dimZ) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_SIGNED_32, 2);
+ rs_type t = rsCreateType(e, dimX, dimY, dimZ);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_int3(uint32_t dimX, uint32_t dimY, uint32_t dimZ) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_SIGNED_32, 3);
+ rs_type t = rsCreateType(e, dimX, dimY, dimZ);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_int4(uint32_t dimX, uint32_t dimY, uint32_t dimZ) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_SIGNED_32, 4);
+ rs_type t = rsCreateType(e, dimX, dimY, dimZ);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_uint2(uint32_t dimX, uint32_t dimY, uint32_t dimZ) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_UNSIGNED_32, 2);
+ rs_type t = rsCreateType(e, dimX, dimY, dimZ);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_uint3(uint32_t dimX, uint32_t dimY, uint32_t dimZ) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_UNSIGNED_32, 3);
+ rs_type t = rsCreateType(e, dimX, dimY, dimZ);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_uint4(uint32_t dimX, uint32_t dimY, uint32_t dimZ) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_UNSIGNED_32, 4);
+ rs_type t = rsCreateType(e, dimX, dimY, dimZ);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_long2(uint32_t dimX, uint32_t dimY, uint32_t dimZ) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_SIGNED_64, 2);
+ rs_type t = rsCreateType(e, dimX, dimY, dimZ);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_long3(uint32_t dimX, uint32_t dimY, uint32_t dimZ) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_SIGNED_64, 3);
+ rs_type t = rsCreateType(e, dimX, dimY, dimZ);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_long4(uint32_t dimX, uint32_t dimY, uint32_t dimZ) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_SIGNED_64, 4);
+ rs_type t = rsCreateType(e, dimX, dimY, dimZ);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_ulong2(uint32_t dimX, uint32_t dimY, uint32_t dimZ) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_UNSIGNED_64, 2);
+ rs_type t = rsCreateType(e, dimX, dimY, dimZ);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_ulong3(uint32_t dimX, uint32_t dimY, uint32_t dimZ) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_UNSIGNED_64, 3);
+ rs_type t = rsCreateType(e, dimX, dimY, dimZ);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_ulong4(uint32_t dimX, uint32_t dimY, uint32_t dimZ) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_UNSIGNED_64, 4);
+ rs_type t = rsCreateType(e, dimX, dimY, dimZ);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_half(uint32_t dimX, uint32_t dimY) {
+ rs_element e = rsCreateElement(RS_TYPE_FLOAT_16);
+ rs_type t = rsCreateType(e, dimX, dimY);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_float(uint32_t dimX, uint32_t dimY) {
+ rs_element e = rsCreateElement(RS_TYPE_FLOAT_32);
+ rs_type t = rsCreateType(e, dimX, dimY);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_double(uint32_t dimX, uint32_t dimY) {
+ rs_element e = rsCreateElement(RS_TYPE_FLOAT_64);
+ rs_type t = rsCreateType(e, dimX, dimY);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_char(uint32_t dimX, uint32_t dimY) {
+ rs_element e = rsCreateElement(RS_TYPE_SIGNED_8);
+ rs_type t = rsCreateType(e, dimX, dimY);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_uchar(uint32_t dimX, uint32_t dimY) {
+ rs_element e = rsCreateElement(RS_TYPE_UNSIGNED_8);
+ rs_type t = rsCreateType(e, dimX, dimY);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_short(uint32_t dimX, uint32_t dimY) {
+ rs_element e = rsCreateElement(RS_TYPE_SIGNED_16);
+ rs_type t = rsCreateType(e, dimX, dimY);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_ushort(uint32_t dimX, uint32_t dimY) {
+ rs_element e = rsCreateElement(RS_TYPE_UNSIGNED_16);
+ rs_type t = rsCreateType(e, dimX, dimY);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_int(uint32_t dimX, uint32_t dimY) {
+ rs_element e = rsCreateElement(RS_TYPE_SIGNED_32);
+ rs_type t = rsCreateType(e, dimX, dimY);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_uint(uint32_t dimX, uint32_t dimY) {
+ rs_element e = rsCreateElement(RS_TYPE_UNSIGNED_32);
+ rs_type t = rsCreateType(e, dimX, dimY);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_long(uint32_t dimX, uint32_t dimY) {
+ rs_element e = rsCreateElement(RS_TYPE_SIGNED_64);
+ rs_type t = rsCreateType(e, dimX, dimY);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_ulong(uint32_t dimX, uint32_t dimY) {
+ rs_element e = rsCreateElement(RS_TYPE_UNSIGNED_64);
+ rs_type t = rsCreateType(e, dimX, dimY);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_half2(uint32_t dimX, uint32_t dimY) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_FLOAT_16, 2);
+ rs_type t = rsCreateType(e, dimX, dimY);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_half3(uint32_t dimX, uint32_t dimY) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_FLOAT_16, 3);
+ rs_type t = rsCreateType(e, dimX, dimY);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_half4(uint32_t dimX, uint32_t dimY) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_FLOAT_16, 4);
+ rs_type t = rsCreateType(e, dimX, dimY);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_float2(uint32_t dimX, uint32_t dimY) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_FLOAT_32, 2);
+ rs_type t = rsCreateType(e, dimX, dimY);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_float3(uint32_t dimX, uint32_t dimY) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_FLOAT_32, 3);
+ rs_type t = rsCreateType(e, dimX, dimY);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_float4(uint32_t dimX, uint32_t dimY) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_FLOAT_32, 4);
+ rs_type t = rsCreateType(e, dimX, dimY);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_double2(uint32_t dimX, uint32_t dimY) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_FLOAT_64, 2);
+ rs_type t = rsCreateType(e, dimX, dimY);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_double3(uint32_t dimX, uint32_t dimY) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_FLOAT_64, 3);
+ rs_type t = rsCreateType(e, dimX, dimY);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_double4(uint32_t dimX, uint32_t dimY) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_FLOAT_64, 4);
+ rs_type t = rsCreateType(e, dimX, dimY);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_char2(uint32_t dimX, uint32_t dimY) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_SIGNED_8, 2);
+ rs_type t = rsCreateType(e, dimX, dimY);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_char3(uint32_t dimX, uint32_t dimY) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_SIGNED_8, 3);
+ rs_type t = rsCreateType(e, dimX, dimY);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_char4(uint32_t dimX, uint32_t dimY) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_SIGNED_8, 4);
+ rs_type t = rsCreateType(e, dimX, dimY);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_uchar2(uint32_t dimX, uint32_t dimY) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_UNSIGNED_8, 2);
+ rs_type t = rsCreateType(e, dimX, dimY);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_uchar3(uint32_t dimX, uint32_t dimY) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_UNSIGNED_8, 3);
+ rs_type t = rsCreateType(e, dimX, dimY);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_uchar4(uint32_t dimX, uint32_t dimY) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_UNSIGNED_8, 4);
+ rs_type t = rsCreateType(e, dimX, dimY);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_short2(uint32_t dimX, uint32_t dimY) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_SIGNED_16, 2);
+ rs_type t = rsCreateType(e, dimX, dimY);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_short3(uint32_t dimX, uint32_t dimY) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_SIGNED_16, 3);
+ rs_type t = rsCreateType(e, dimX, dimY);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_short4(uint32_t dimX, uint32_t dimY) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_SIGNED_16, 4);
+ rs_type t = rsCreateType(e, dimX, dimY);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_ushort2(uint32_t dimX, uint32_t dimY) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_UNSIGNED_16, 2);
+ rs_type t = rsCreateType(e, dimX, dimY);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_ushort3(uint32_t dimX, uint32_t dimY) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_UNSIGNED_16, 3);
+ rs_type t = rsCreateType(e, dimX, dimY);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_ushort4(uint32_t dimX, uint32_t dimY) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_UNSIGNED_16, 4);
+ rs_type t = rsCreateType(e, dimX, dimY);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_int2(uint32_t dimX, uint32_t dimY) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_SIGNED_32, 2);
+ rs_type t = rsCreateType(e, dimX, dimY);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_int3(uint32_t dimX, uint32_t dimY) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_SIGNED_32, 3);
+ rs_type t = rsCreateType(e, dimX, dimY);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_int4(uint32_t dimX, uint32_t dimY) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_SIGNED_32, 4);
+ rs_type t = rsCreateType(e, dimX, dimY);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_uint2(uint32_t dimX, uint32_t dimY) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_UNSIGNED_32, 2);
+ rs_type t = rsCreateType(e, dimX, dimY);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_uint3(uint32_t dimX, uint32_t dimY) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_UNSIGNED_32, 3);
+ rs_type t = rsCreateType(e, dimX, dimY);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_uint4(uint32_t dimX, uint32_t dimY) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_UNSIGNED_32, 4);
+ rs_type t = rsCreateType(e, dimX, dimY);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_long2(uint32_t dimX, uint32_t dimY) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_SIGNED_64, 2);
+ rs_type t = rsCreateType(e, dimX, dimY);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_long3(uint32_t dimX, uint32_t dimY) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_SIGNED_64, 3);
+ rs_type t = rsCreateType(e, dimX, dimY);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_long4(uint32_t dimX, uint32_t dimY) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_SIGNED_64, 4);
+ rs_type t = rsCreateType(e, dimX, dimY);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_ulong2(uint32_t dimX, uint32_t dimY) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_UNSIGNED_64, 2);
+ rs_type t = rsCreateType(e, dimX, dimY);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_ulong3(uint32_t dimX, uint32_t dimY) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_UNSIGNED_64, 3);
+ rs_type t = rsCreateType(e, dimX, dimY);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_ulong4(uint32_t dimX, uint32_t dimY) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_UNSIGNED_64, 4);
+ rs_type t = rsCreateType(e, dimX, dimY);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_half(uint32_t dimX) {
+ rs_element e = rsCreateElement(RS_TYPE_FLOAT_16);
+ rs_type t = rsCreateType(e, dimX);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_float(uint32_t dimX) {
+ rs_element e = rsCreateElement(RS_TYPE_FLOAT_32);
+ rs_type t = rsCreateType(e, dimX);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_double(uint32_t dimX) {
+ rs_element e = rsCreateElement(RS_TYPE_FLOAT_64);
+ rs_type t = rsCreateType(e, dimX);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_char(uint32_t dimX) {
+ rs_element e = rsCreateElement(RS_TYPE_SIGNED_8);
+ rs_type t = rsCreateType(e, dimX);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_uchar(uint32_t dimX) {
+ rs_element e = rsCreateElement(RS_TYPE_UNSIGNED_8);
+ rs_type t = rsCreateType(e, dimX);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_short(uint32_t dimX) {
+ rs_element e = rsCreateElement(RS_TYPE_SIGNED_16);
+ rs_type t = rsCreateType(e, dimX);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_ushort(uint32_t dimX) {
+ rs_element e = rsCreateElement(RS_TYPE_UNSIGNED_16);
+ rs_type t = rsCreateType(e, dimX);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_int(uint32_t dimX) {
+ rs_element e = rsCreateElement(RS_TYPE_SIGNED_32);
+ rs_type t = rsCreateType(e, dimX);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_uint(uint32_t dimX) {
+ rs_element e = rsCreateElement(RS_TYPE_UNSIGNED_32);
+ rs_type t = rsCreateType(e, dimX);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_long(uint32_t dimX) {
+ rs_element e = rsCreateElement(RS_TYPE_SIGNED_64);
+ rs_type t = rsCreateType(e, dimX);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_ulong(uint32_t dimX) {
+ rs_element e = rsCreateElement(RS_TYPE_UNSIGNED_64);
+ rs_type t = rsCreateType(e, dimX);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_half2(uint32_t dimX) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_FLOAT_16, 2);
+ rs_type t = rsCreateType(e, dimX);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_half3(uint32_t dimX) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_FLOAT_16, 3);
+ rs_type t = rsCreateType(e, dimX);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_half4(uint32_t dimX) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_FLOAT_16, 4);
+ rs_type t = rsCreateType(e, dimX);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_float2(uint32_t dimX) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_FLOAT_32, 2);
+ rs_type t = rsCreateType(e, dimX);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_float3(uint32_t dimX) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_FLOAT_32, 3);
+ rs_type t = rsCreateType(e, dimX);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_float4(uint32_t dimX) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_FLOAT_32, 4);
+ rs_type t = rsCreateType(e, dimX);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_double2(uint32_t dimX) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_FLOAT_64, 2);
+ rs_type t = rsCreateType(e, dimX);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_double3(uint32_t dimX) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_FLOAT_64, 3);
+ rs_type t = rsCreateType(e, dimX);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_double4(uint32_t dimX) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_FLOAT_64, 4);
+ rs_type t = rsCreateType(e, dimX);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_char2(uint32_t dimX) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_SIGNED_8, 2);
+ rs_type t = rsCreateType(e, dimX);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_char3(uint32_t dimX) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_SIGNED_8, 3);
+ rs_type t = rsCreateType(e, dimX);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_char4(uint32_t dimX) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_SIGNED_8, 4);
+ rs_type t = rsCreateType(e, dimX);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_uchar2(uint32_t dimX) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_UNSIGNED_8, 2);
+ rs_type t = rsCreateType(e, dimX);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_uchar3(uint32_t dimX) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_UNSIGNED_8, 3);
+ rs_type t = rsCreateType(e, dimX);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_uchar4(uint32_t dimX) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_UNSIGNED_8, 4);
+ rs_type t = rsCreateType(e, dimX);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_short2(uint32_t dimX) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_SIGNED_16, 2);
+ rs_type t = rsCreateType(e, dimX);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_short3(uint32_t dimX) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_SIGNED_16, 3);
+ rs_type t = rsCreateType(e, dimX);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_short4(uint32_t dimX) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_SIGNED_16, 4);
+ rs_type t = rsCreateType(e, dimX);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_ushort2(uint32_t dimX) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_UNSIGNED_16, 2);
+ rs_type t = rsCreateType(e, dimX);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_ushort3(uint32_t dimX) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_UNSIGNED_16, 3);
+ rs_type t = rsCreateType(e, dimX);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_ushort4(uint32_t dimX) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_UNSIGNED_16, 4);
+ rs_type t = rsCreateType(e, dimX);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_int2(uint32_t dimX) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_SIGNED_32, 2);
+ rs_type t = rsCreateType(e, dimX);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_int3(uint32_t dimX) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_SIGNED_32, 3);
+ rs_type t = rsCreateType(e, dimX);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_int4(uint32_t dimX) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_SIGNED_32, 4);
+ rs_type t = rsCreateType(e, dimX);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_uint2(uint32_t dimX) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_UNSIGNED_32, 2);
+ rs_type t = rsCreateType(e, dimX);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_uint3(uint32_t dimX) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_UNSIGNED_32, 3);
+ rs_type t = rsCreateType(e, dimX);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_uint4(uint32_t dimX) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_UNSIGNED_32, 4);
+ rs_type t = rsCreateType(e, dimX);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_long2(uint32_t dimX) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_SIGNED_64, 2);
+ rs_type t = rsCreateType(e, dimX);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_long3(uint32_t dimX) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_SIGNED_64, 3);
+ rs_type t = rsCreateType(e, dimX);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_long4(uint32_t dimX) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_SIGNED_64, 4);
+ rs_type t = rsCreateType(e, dimX);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_ulong2(uint32_t dimX) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_UNSIGNED_64, 2);
+ rs_type t = rsCreateType(e, dimX);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_ulong3(uint32_t dimX) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_UNSIGNED_64, 3);
+ rs_type t = rsCreateType(e, dimX);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+static inline rs_allocation __attribute__((overloadable))
+ rsCreateAllocation_ulong4(uint32_t dimX) {
+ rs_element e = rsCreateVectorElement(RS_TYPE_UNSIGNED_64, 4);
+ rs_type t = rsCreateType(e, dimX);
+ return rsCreateAllocation(t);
+}
+#endif
+
+#endif // RENDERSCRIPT_RS_ALLOCATION_CREATE_RSH
diff --git a/script_api/include/rs_allocation_data.rsh b/script_api/include/rs_allocation_data.rsh
new file mode 100644
index 0000000..ea16767
--- /dev/null
+++ b/script_api/include/rs_allocation_data.rsh
@@ -0,0 +1,3365 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/generate.sh.
+
+/*
+ * rs_allocation_data.rsh: Allocation Data Access Functions
+ *
+ * The functions below can be used to get and set the cells that comprise
+ * an allocation.
+ *
+ * - Individual cells are accessed using the rsGetElementAt* and
+ * rsSetElementAt functions.
+ * - Multiple cells can be copied using the rsAllocationCopy* and
+ * rsAllocationV* functions.
+ * - For getting values through a sampler, use rsSample.
+ *
+ * The rsGetElementAt and rsSetElement* functions are somewhat misnamed.
+ * They don't get or set elements, which are akin to data types; they get
+ * or set cells. Think of them as rsGetCellAt and and rsSetCellAt.
+ */
+
+#ifndef RENDERSCRIPT_RS_ALLOCATION_DATA_RSH
+#define RENDERSCRIPT_RS_ALLOCATION_DATA_RSH
+
+/*
+ * rsAllocationCopy1DRange: Copy consecutive cells between allocations
+ *
+ * Copies the specified number of cells from one allocation to another.
+ *
+ * The two allocations must be different. Using this function to copy whithin
+ * the same allocation yields undefined results.
+ *
+ * The function does not validate whether the offset plus count exceeds the size
+ * of either allocation. Be careful!
+ *
+ * This function should only be called between 1D allocations. Calling it
+ * on other allocations is undefined.
+ *
+ * This function should not be called from inside a kernel, or from any function
+ * that may be called directly or indirectly from a kernel. Doing so would cause a
+ * runtime error.
+ *
+ * Parameters:
+ * dstAlloc: Allocation to copy cells into.
+ * dstOff: Offset in the destination of the first cell to be copied into.
+ * dstMip: Mip level in the destination allocation. 0 if mip mapping is not used.
+ * count: Number of cells to be copied.
+ * srcAlloc: Source allocation.
+ * srcOff: Offset in the source of the first cell to be copied.
+ * srcMip: Mip level in the source allocation. 0 if mip mapping is not used.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 14))
+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);
+#endif
+
+/*
+ * rsAllocationCopy2DRange: Copy a rectangular region of cells between allocations
+ *
+ * Copies a rectangular region of cells from one allocation to another.
+ * (width * heigth) cells are copied.
+ *
+ * The two allocations must be different. Using this function to copy whithin
+ * the same allocation yields undefined results.
+ *
+ * The function does not validate whether the the source or destination region
+ * exceeds the size of its respective allocation. Be careful!
+ *
+ * This function should only be called between 2D allocations. Calling it
+ * on other allocations is undefined.
+ *
+ * This function should not be called from inside a kernel, or from any function
+ * that may be called directly or indirectly from a kernel. Doing so would cause a
+ * runtime error.
+ *
+ * Parameters:
+ * dstAlloc: Allocation to copy cells into.
+ * dstXoff: X offset in the destination of the region to be set.
+ * dstYoff: Y offset in the destination of the region to be set.
+ * dstMip: Mip level in the destination allocation. 0 if mip mapping is not used.
+ * 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: Source allocation.
+ * srcXoff: X offset in the source.
+ * srcYoff: Y offset in the source.
+ * srcMip: Mip level in the source allocation. 0 if mip mapping is not used.
+ * 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))
+ 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
+
+/*
+ * rsAllocationVLoadX: Get a vector from an allocation of scalars
+ *
+ * This function returns a vector composed of successive cells of the allocation.
+ * It assumes that the allocation contains scalars.
+ *
+ * The "X" in the name indicates that successive values are extracted by
+ * increasing the X index. There are currently no functions to get successive
+ * values incrementing other dimensions. Use multiple calls to rsGetElementAt()
+ * instead.
+ *
+ * For example, when calling rsAllocationVLoadX_int4(a, 20, 30), an int4 composed
+ * of a[20, 30], a[21, 30], a[22, 30], and a[23, 30] is returned.
+ *
+ * When retrieving from a three dimensional allocations, use the x, y, z variant.
+ * Similarly, use the x, y variant for two dimensional allocations and x for the
+ * mono dimensional allocations.
+ *
+ * For efficiency, this function does not validate the inputs. Trying to wrap
+ * the X index, exceeding the size of the allocation, or using indices incompatible
+ * with the dimensionality of the allocation yields undefined results.
+ *
+ * See also rsAllocationVStoreX().
+ *
+ * Parameters:
+ * a: Allocation to get the data from.
+ * x: X offset in the allocation of the first cell to be copied from.
+ * y: Y offset in the allocation of the first cell to be copied from.
+ * z: Z offset in the allocation of the first cell to be copied from.
+ */
+#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))
+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
+
+/*
+ * rsAllocationVStoreX: Store a vector into an allocation of scalars
+ *
+ * This function stores the entries of a vector into successive cells of an allocation.
+ * It assumes that the allocation contains scalars.
+ *
+ * The "X" in the name indicates that successive values are stored by increasing
+ * the X index. There are currently no functions to store successive values
+ * incrementing other dimensions. Use multiple calls to rsSetElementAt() instead.
+ *
+ * For example, when calling rsAllocationVStoreX_int3(a, v, 20, 30), v.x is stored
+ * at a[20, 30], v.y at a[21, 30], and v.z at a[22, 30].
+ *
+ * When storing into a three dimensional allocations, use the x, y, z variant.
+ * Similarly, use the x, y variant for two dimensional allocations and x for the
+ * mono dimensional allocations.
+ *
+ * For efficiency, this function does not validate the inputs. Trying to wrap the
+ * X index, exceeding the size of the allocation, or using indices incompatible
+ * with the dimensionality of the allocation yiels undefined results.
+ *
+ * See also rsAllocationVLoadX().
+ *
+ * Parameters:
+ * a: Allocation to store the data into.
+ * val: Value to be stored.
+ * x: X offset in the allocation of the first cell to be copied into.
+ * y: Y offset in the allocation of the first cell to be copied into.
+ * z: Z offset in the allocation of the first cell to be copied into.
+ */
+#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
+
+/*
+ * rsGetElementAt: Return a cell from an allocation
+ *
+ * This function extracts a single cell from an allocation.
+ *
+ * When retrieving from a three dimensional allocations, use the x, y, z variant.
+ * Similarly, use the x, y variant for two dimensional allocations and x for the
+ * mono dimensional allocations.
+ *
+ * This function has two styles. One returns the address of the value using a void*,
+ * the other returns the actual value, e.g. rsGetElementAt() vs. rsGetElementAt_int4().
+ * For primitive types, always use the latter as it is more efficient.
+ */
+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
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern half __attribute__((overloadable))
+ rsGetElementAt_half(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern half2 __attribute__((overloadable))
+ rsGetElementAt_half2(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern half3 __attribute__((overloadable))
+ rsGetElementAt_half3(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern half4 __attribute__((overloadable))
+ rsGetElementAt_half4(rs_allocation a, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern half __attribute__((overloadable))
+ rsGetElementAt_half(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern half2 __attribute__((overloadable))
+ rsGetElementAt_half2(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern half3 __attribute__((overloadable))
+ rsGetElementAt_half3(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern half4 __attribute__((overloadable))
+ rsGetElementAt_half4(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern half __attribute__((overloadable))
+ rsGetElementAt_half(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern half2 __attribute__((overloadable))
+ rsGetElementAt_half2(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern half3 __attribute__((overloadable))
+ rsGetElementAt_half3(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern half4 __attribute__((overloadable))
+ rsGetElementAt_half4(rs_allocation a, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+/*
+ * rsGetElementAtYuv_uchar_U: Get the U component of an allocation of YUVs
+ *
+ * Extracts the U component of a single YUV value from a 2D allocation of YUVs.
+ *
+ * Inside an allocation, Y, U, and V components may be stored if different planes
+ * and at different resolutions. The x, y coordinates provided here are in the
+ * dimensions of the Y plane.
+ *
+ * See rsGetElementAtYuv_uchar_Y().
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern uchar __attribute__((overloadable))
+ rsGetElementAtYuv_uchar_U(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+/*
+ * rsGetElementAtYuv_uchar_V: Get the V component of an allocation of YUVs
+ *
+ * Extracts the V component of a single YUV value from a 2D allocation of YUVs.
+ *
+ * Inside an allocation, Y, U, and V components may be stored if different planes
+ * and at different resolutions. The x, y coordinates provided here are in the
+ * dimensions of the Y plane.
+ *
+ * See rsGetElementAtYuv_uchar_Y().
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern uchar __attribute__((overloadable))
+ rsGetElementAtYuv_uchar_V(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+/*
+ * rsGetElementAtYuv_uchar_Y: Get the Y component of an allocation of YUVs
+ *
+ * Extracts the Y component of a single YUV value from a 2D allocation of YUVs.
+ *
+ * Inside an allocation, Y, U, and V components may be stored if different planes
+ * and at different resolutions. The x, y coordinates provided here are in the
+ * dimensions of the Y plane.
+ *
+ * See rsGetElementAtYuv_uchar_U() and rsGetElementAtYuv_uchar_V().
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern uchar __attribute__((overloadable))
+ rsGetElementAtYuv_uchar_Y(rs_allocation a, uint32_t x, uint32_t y);
+#endif
+
+/*
+ * rsSample: Sample a value from a texture allocation
+ *
+ * Fetches a value from a texture 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.
+ *
+ * See android.renderscript.Sampler for more details.
+ *
+ * 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 a cell of an allocation
+ *
+ * This function stores a value into a single cell of an allocation.
+ *
+ * When storing into a three dimensional allocations, use the x, y, z variant.
+ * Similarly, use the x, y variant for two dimensional allocations and x for
+ * the mono dimensional allocations.
+ *
+ * This function has two styles. One passes the value to be stored using a void*,
+ * the other has the actual value as an argument, e.g. rsSetElementAt() vs.
+ * rsSetElementAt_int4(). For primitive types, always use the latter as it is
+ * more efficient.
+ *
+ * See also rsGetElementAt().
+ */
+#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
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern void __attribute__((overloadable))
+ rsSetElementAt_half(rs_allocation a, half val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern void __attribute__((overloadable))
+ rsSetElementAt_half2(rs_allocation a, half2 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern void __attribute__((overloadable))
+ rsSetElementAt_half3(rs_allocation a, half3 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern void __attribute__((overloadable))
+ rsSetElementAt_half4(rs_allocation a, half4 val, uint32_t x);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern void __attribute__((overloadable))
+ rsSetElementAt_half(rs_allocation a, half val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern void __attribute__((overloadable))
+ rsSetElementAt_half2(rs_allocation a, half2 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern void __attribute__((overloadable))
+ rsSetElementAt_half3(rs_allocation a, half3 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern void __attribute__((overloadable))
+ rsSetElementAt_half4(rs_allocation a, half4 val, uint32_t x, uint32_t y);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern void __attribute__((overloadable))
+ rsSetElementAt_half(rs_allocation a, half val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern void __attribute__((overloadable))
+ rsSetElementAt_half2(rs_allocation a, half2 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern void __attribute__((overloadable))
+ rsSetElementAt_half3(rs_allocation a, half3 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern void __attribute__((overloadable))
+ rsSetElementAt_half4(rs_allocation a, half4 val, uint32_t x, uint32_t y, uint32_t z);
+#endif
+
+#endif // RENDERSCRIPT_RS_ALLOCATION_DATA_RSH
diff --git a/script_api/include/rs_atomic.rsh b/script_api/include/rs_atomic.rsh
new file mode 100644
index 0000000..98a8784
--- /dev/null
+++ b/script_api/include/rs_atomic.rsh
@@ -0,0 +1,257 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/generate.sh.
+
+/*
+ * rs_atomic.rsh: Atomic Update Functions
+ *
+ * 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 done in the right order.
+ *
+ * These functions are slower than their non-atomic equivalents, 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
+
+/*
+ * 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: Value of *addr prior to the operation.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 14))
+extern int32_t __attribute__((overloadable))
+ rsAtomicAdd(volatile int32_t* addr, int32_t value);
+#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: Value of *addr prior to the operation.
+ */
+#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: Address of the value to compare and replace if the test passes.
+ * compareValue: Value to test *addr against.
+ * newValue: Value to write if the test passes.
+ *
+ * Returns: Value of *addr prior to the operation.
+ */
+#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. This is equivalent to rsAtomicSub(addr, 1).
+ *
+ * Parameters:
+ * addr: Address of the value to decrement.
+ *
+ * Returns: Value of *addr prior to the operation.
+ */
+#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. This is equivalent to rsAtomicAdd(addr, 1).
+ *
+ * Parameters:
+ * addr: Address of the value to increment.
+ *
+ * Returns: Value of *addr prior to the operation.
+ */
+#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: Value of *addr prior to the operation.
+ */
+#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: Value of *addr prior to the operation.
+ */
+#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: Value of *addr prior to the operation.
+ */
+#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: Value of *addr prior to the operation.
+ */
+#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: Value of *addr prior to the operation.
+ */
+#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/script_api/include/rs_convert.rsh b/script_api/include/rs_convert.rsh
new file mode 100644
index 0000000..4c318d4
--- /dev/null
+++ b/script_api/include/rs_convert.rsh
@@ -0,0 +1,1623 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/generate.sh.
+
+/*
+ * rs_convert.rsh: Conversion Functions
+ *
+ * The functions below convert from a numerical vector type to another, or from one color
+ * representation to another.
+ */
+
+#ifndef RENDERSCRIPT_RS_CONVERT_RSH
+#define RENDERSCRIPT_RS_CONVERT_RSH
+
+/*
+ * convert: Convert numerical vectors
+ *
+ * Converts a vector from one numerical type to another. The conversion are done entry per entry.
+ *
+ * E.g calling a = convert_short3(b); is equivalent to doing
+ * a.x = (short)b.x; a.y = (short)b.y; a.z = (short)b.z;.
+ *
+ * Converting floating point values to integer types truncates.
+ *
+ * Converting numbers too large to fit the destination type yields undefined results.
+ * For example, converting a float that contains 1.0e18 to a short is undefined.
+ * Use clamp() to avoid this.
+ */
+extern float2 __attribute__((const, overloadable))
+ convert_float2(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+ convert_float3(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+ convert_float4(float4 v);
+
+extern float2 __attribute__((const, overloadable))
+ convert_float2(char2 v);
+
+extern float3 __attribute__((const, overloadable))
+ convert_float3(char3 v);
+
+extern float4 __attribute__((const, overloadable))
+ convert_float4(char4 v);
+
+extern float2 __attribute__((const, overloadable))
+ convert_float2(uchar2 v);
+
+extern float3 __attribute__((const, overloadable))
+ convert_float3(uchar3 v);
+
+extern float4 __attribute__((const, overloadable))
+ convert_float4(uchar4 v);
+
+extern float2 __attribute__((const, overloadable))
+ convert_float2(short2 v);
+
+extern float3 __attribute__((const, overloadable))
+ convert_float3(short3 v);
+
+extern float4 __attribute__((const, overloadable))
+ convert_float4(short4 v);
+
+extern float2 __attribute__((const, overloadable))
+ convert_float2(ushort2 v);
+
+extern float3 __attribute__((const, overloadable))
+ convert_float3(ushort3 v);
+
+extern float4 __attribute__((const, overloadable))
+ convert_float4(ushort4 v);
+
+extern float2 __attribute__((const, overloadable))
+ convert_float2(int2 v);
+
+extern float3 __attribute__((const, overloadable))
+ convert_float3(int3 v);
+
+extern float4 __attribute__((const, overloadable))
+ convert_float4(int4 v);
+
+extern float2 __attribute__((const, overloadable))
+ convert_float2(uint2 v);
+
+extern float3 __attribute__((const, overloadable))
+ convert_float3(uint3 v);
+
+extern float4 __attribute__((const, overloadable))
+ convert_float4(uint4 v);
+
+extern char2 __attribute__((const, overloadable))
+ convert_char2(float2 v);
+
+extern char3 __attribute__((const, overloadable))
+ convert_char3(float3 v);
+
+extern char4 __attribute__((const, overloadable))
+ convert_char4(float4 v);
+
+extern char2 __attribute__((const, overloadable))
+ convert_char2(char2 v);
+
+extern char3 __attribute__((const, overloadable))
+ convert_char3(char3 v);
+
+extern char4 __attribute__((const, overloadable))
+ convert_char4(char4 v);
+
+extern char2 __attribute__((const, overloadable))
+ convert_char2(uchar2 v);
+
+extern char3 __attribute__((const, overloadable))
+ convert_char3(uchar3 v);
+
+extern char4 __attribute__((const, overloadable))
+ convert_char4(uchar4 v);
+
+extern char2 __attribute__((const, overloadable))
+ convert_char2(short2 v);
+
+extern char3 __attribute__((const, overloadable))
+ convert_char3(short3 v);
+
+extern char4 __attribute__((const, overloadable))
+ convert_char4(short4 v);
+
+extern char2 __attribute__((const, overloadable))
+ convert_char2(ushort2 v);
+
+extern char3 __attribute__((const, overloadable))
+ convert_char3(ushort3 v);
+
+extern char4 __attribute__((const, overloadable))
+ convert_char4(ushort4 v);
+
+extern char2 __attribute__((const, overloadable))
+ convert_char2(int2 v);
+
+extern char3 __attribute__((const, overloadable))
+ convert_char3(int3 v);
+
+extern char4 __attribute__((const, overloadable))
+ convert_char4(int4 v);
+
+extern char2 __attribute__((const, overloadable))
+ convert_char2(uint2 v);
+
+extern char3 __attribute__((const, overloadable))
+ convert_char3(uint3 v);
+
+extern char4 __attribute__((const, overloadable))
+ convert_char4(uint4 v);
+
+extern uchar2 __attribute__((const, overloadable))
+ convert_uchar2(float2 v);
+
+extern uchar3 __attribute__((const, overloadable))
+ convert_uchar3(float3 v);
+
+extern uchar4 __attribute__((const, overloadable))
+ convert_uchar4(float4 v);
+
+extern uchar2 __attribute__((const, overloadable))
+ convert_uchar2(char2 v);
+
+extern uchar3 __attribute__((const, overloadable))
+ convert_uchar3(char3 v);
+
+extern uchar4 __attribute__((const, overloadable))
+ convert_uchar4(char4 v);
+
+extern uchar2 __attribute__((const, overloadable))
+ convert_uchar2(uchar2 v);
+
+extern uchar3 __attribute__((const, overloadable))
+ convert_uchar3(uchar3 v);
+
+extern uchar4 __attribute__((const, overloadable))
+ convert_uchar4(uchar4 v);
+
+extern uchar2 __attribute__((const, overloadable))
+ convert_uchar2(short2 v);
+
+extern uchar3 __attribute__((const, overloadable))
+ convert_uchar3(short3 v);
+
+extern uchar4 __attribute__((const, overloadable))
+ convert_uchar4(short4 v);
+
+extern uchar2 __attribute__((const, overloadable))
+ convert_uchar2(ushort2 v);
+
+extern uchar3 __attribute__((const, overloadable))
+ convert_uchar3(ushort3 v);
+
+extern uchar4 __attribute__((const, overloadable))
+ convert_uchar4(ushort4 v);
+
+extern uchar2 __attribute__((const, overloadable))
+ convert_uchar2(int2 v);
+
+extern uchar3 __attribute__((const, overloadable))
+ convert_uchar3(int3 v);
+
+extern uchar4 __attribute__((const, overloadable))
+ convert_uchar4(int4 v);
+
+extern uchar2 __attribute__((const, overloadable))
+ convert_uchar2(uint2 v);
+
+extern uchar3 __attribute__((const, overloadable))
+ convert_uchar3(uint3 v);
+
+extern uchar4 __attribute__((const, overloadable))
+ convert_uchar4(uint4 v);
+
+extern short2 __attribute__((const, overloadable))
+ convert_short2(float2 v);
+
+extern short3 __attribute__((const, overloadable))
+ convert_short3(float3 v);
+
+extern short4 __attribute__((const, overloadable))
+ convert_short4(float4 v);
+
+extern short2 __attribute__((const, overloadable))
+ convert_short2(char2 v);
+
+extern short3 __attribute__((const, overloadable))
+ convert_short3(char3 v);
+
+extern short4 __attribute__((const, overloadable))
+ convert_short4(char4 v);
+
+extern short2 __attribute__((const, overloadable))
+ convert_short2(uchar2 v);
+
+extern short3 __attribute__((const, overloadable))
+ convert_short3(uchar3 v);
+
+extern short4 __attribute__((const, overloadable))
+ convert_short4(uchar4 v);
+
+extern short2 __attribute__((const, overloadable))
+ convert_short2(short2 v);
+
+extern short3 __attribute__((const, overloadable))
+ convert_short3(short3 v);
+
+extern short4 __attribute__((const, overloadable))
+ convert_short4(short4 v);
+
+extern short2 __attribute__((const, overloadable))
+ convert_short2(ushort2 v);
+
+extern short3 __attribute__((const, overloadable))
+ convert_short3(ushort3 v);
+
+extern short4 __attribute__((const, overloadable))
+ convert_short4(ushort4 v);
+
+extern short2 __attribute__((const, overloadable))
+ convert_short2(int2 v);
+
+extern short3 __attribute__((const, overloadable))
+ convert_short3(int3 v);
+
+extern short4 __attribute__((const, overloadable))
+ convert_short4(int4 v);
+
+extern short2 __attribute__((const, overloadable))
+ convert_short2(uint2 v);
+
+extern short3 __attribute__((const, overloadable))
+ convert_short3(uint3 v);
+
+extern short4 __attribute__((const, overloadable))
+ convert_short4(uint4 v);
+
+extern ushort2 __attribute__((const, overloadable))
+ convert_ushort2(float2 v);
+
+extern ushort3 __attribute__((const, overloadable))
+ convert_ushort3(float3 v);
+
+extern ushort4 __attribute__((const, overloadable))
+ convert_ushort4(float4 v);
+
+extern ushort2 __attribute__((const, overloadable))
+ convert_ushort2(char2 v);
+
+extern ushort3 __attribute__((const, overloadable))
+ convert_ushort3(char3 v);
+
+extern ushort4 __attribute__((const, overloadable))
+ convert_ushort4(char4 v);
+
+extern ushort2 __attribute__((const, overloadable))
+ convert_ushort2(uchar2 v);
+
+extern ushort3 __attribute__((const, overloadable))
+ convert_ushort3(uchar3 v);
+
+extern ushort4 __attribute__((const, overloadable))
+ convert_ushort4(uchar4 v);
+
+extern ushort2 __attribute__((const, overloadable))
+ convert_ushort2(short2 v);
+
+extern ushort3 __attribute__((const, overloadable))
+ convert_ushort3(short3 v);
+
+extern ushort4 __attribute__((const, overloadable))
+ convert_ushort4(short4 v);
+
+extern ushort2 __attribute__((const, overloadable))
+ convert_ushort2(ushort2 v);
+
+extern ushort3 __attribute__((const, overloadable))
+ convert_ushort3(ushort3 v);
+
+extern ushort4 __attribute__((const, overloadable))
+ convert_ushort4(ushort4 v);
+
+extern ushort2 __attribute__((const, overloadable))
+ convert_ushort2(int2 v);
+
+extern ushort3 __attribute__((const, overloadable))
+ convert_ushort3(int3 v);
+
+extern ushort4 __attribute__((const, overloadable))
+ convert_ushort4(int4 v);
+
+extern ushort2 __attribute__((const, overloadable))
+ convert_ushort2(uint2 v);
+
+extern ushort3 __attribute__((const, overloadable))
+ convert_ushort3(uint3 v);
+
+extern ushort4 __attribute__((const, overloadable))
+ convert_ushort4(uint4 v);
+
+extern int2 __attribute__((const, overloadable))
+ convert_int2(float2 v);
+
+extern int3 __attribute__((const, overloadable))
+ convert_int3(float3 v);
+
+extern int4 __attribute__((const, overloadable))
+ convert_int4(float4 v);
+
+extern int2 __attribute__((const, overloadable))
+ convert_int2(char2 v);
+
+extern int3 __attribute__((const, overloadable))
+ convert_int3(char3 v);
+
+extern int4 __attribute__((const, overloadable))
+ convert_int4(char4 v);
+
+extern int2 __attribute__((const, overloadable))
+ convert_int2(uchar2 v);
+
+extern int3 __attribute__((const, overloadable))
+ convert_int3(uchar3 v);
+
+extern int4 __attribute__((const, overloadable))
+ convert_int4(uchar4 v);
+
+extern int2 __attribute__((const, overloadable))
+ convert_int2(short2 v);
+
+extern int3 __attribute__((const, overloadable))
+ convert_int3(short3 v);
+
+extern int4 __attribute__((const, overloadable))
+ convert_int4(short4 v);
+
+extern int2 __attribute__((const, overloadable))
+ convert_int2(ushort2 v);
+
+extern int3 __attribute__((const, overloadable))
+ convert_int3(ushort3 v);
+
+extern int4 __attribute__((const, overloadable))
+ convert_int4(ushort4 v);
+
+extern int2 __attribute__((const, overloadable))
+ convert_int2(int2 v);
+
+extern int3 __attribute__((const, overloadable))
+ convert_int3(int3 v);
+
+extern int4 __attribute__((const, overloadable))
+ convert_int4(int4 v);
+
+extern int2 __attribute__((const, overloadable))
+ convert_int2(uint2 v);
+
+extern int3 __attribute__((const, overloadable))
+ convert_int3(uint3 v);
+
+extern int4 __attribute__((const, overloadable))
+ convert_int4(uint4 v);
+
+extern uint2 __attribute__((const, overloadable))
+ convert_uint2(float2 v);
+
+extern uint3 __attribute__((const, overloadable))
+ convert_uint3(float3 v);
+
+extern uint4 __attribute__((const, overloadable))
+ convert_uint4(float4 v);
+
+extern uint2 __attribute__((const, overloadable))
+ convert_uint2(char2 v);
+
+extern uint3 __attribute__((const, overloadable))
+ convert_uint3(char3 v);
+
+extern uint4 __attribute__((const, overloadable))
+ convert_uint4(char4 v);
+
+extern uint2 __attribute__((const, overloadable))
+ convert_uint2(uchar2 v);
+
+extern uint3 __attribute__((const, overloadable))
+ convert_uint3(uchar3 v);
+
+extern uint4 __attribute__((const, overloadable))
+ convert_uint4(uchar4 v);
+
+extern uint2 __attribute__((const, overloadable))
+ convert_uint2(short2 v);
+
+extern uint3 __attribute__((const, overloadable))
+ convert_uint3(short3 v);
+
+extern uint4 __attribute__((const, overloadable))
+ convert_uint4(short4 v);
+
+extern uint2 __attribute__((const, overloadable))
+ convert_uint2(ushort2 v);
+
+extern uint3 __attribute__((const, overloadable))
+ convert_uint3(ushort3 v);
+
+extern uint4 __attribute__((const, overloadable))
+ convert_uint4(ushort4 v);
+
+extern uint2 __attribute__((const, overloadable))
+ convert_uint2(int2 v);
+
+extern uint3 __attribute__((const, overloadable))
+ convert_uint3(int3 v);
+
+extern uint4 __attribute__((const, overloadable))
+ convert_uint4(int4 v);
+
+extern uint2 __attribute__((const, overloadable))
+ convert_uint2(uint2 v);
+
+extern uint3 __attribute__((const, overloadable))
+ convert_uint3(uint3 v);
+
+extern uint4 __attribute__((const, overloadable))
+ convert_uint4(uint4 v);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern double2 __attribute__((const, overloadable))
+ convert_double2(double2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern double3 __attribute__((const, overloadable))
+ convert_double3(double3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern double4 __attribute__((const, overloadable))
+ convert_double4(double4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern double2 __attribute__((const, overloadable))
+ convert_double2(long2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern double3 __attribute__((const, overloadable))
+ convert_double3(long3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern double4 __attribute__((const, overloadable))
+ convert_double4(long4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern double2 __attribute__((const, overloadable))
+ convert_double2(ulong2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern double3 __attribute__((const, overloadable))
+ convert_double3(ulong3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern double4 __attribute__((const, overloadable))
+ convert_double4(ulong4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern long2 __attribute__((const, overloadable))
+ convert_long2(double2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern long3 __attribute__((const, overloadable))
+ convert_long3(double3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern long4 __attribute__((const, overloadable))
+ convert_long4(double4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern long2 __attribute__((const, overloadable))
+ convert_long2(long2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern long3 __attribute__((const, overloadable))
+ convert_long3(long3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern long4 __attribute__((const, overloadable))
+ convert_long4(long4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern long2 __attribute__((const, overloadable))
+ convert_long2(ulong2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern long3 __attribute__((const, overloadable))
+ convert_long3(ulong3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern long4 __attribute__((const, overloadable))
+ convert_long4(ulong4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ulong2 __attribute__((const, overloadable))
+ convert_ulong2(double2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ulong3 __attribute__((const, overloadable))
+ convert_ulong3(double3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ulong4 __attribute__((const, overloadable))
+ convert_ulong4(double4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ulong2 __attribute__((const, overloadable))
+ convert_ulong2(long2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ulong3 __attribute__((const, overloadable))
+ convert_ulong3(long3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ulong4 __attribute__((const, overloadable))
+ convert_ulong4(long4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ulong2 __attribute__((const, overloadable))
+ convert_ulong2(ulong2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ulong3 __attribute__((const, overloadable))
+ convert_ulong3(ulong3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ulong4 __attribute__((const, overloadable))
+ convert_ulong4(ulong4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float2 __attribute__((const, overloadable))
+ convert_float2(double2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float3 __attribute__((const, overloadable))
+ convert_float3(double3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float4 __attribute__((const, overloadable))
+ convert_float4(double4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float2 __attribute__((const, overloadable))
+ convert_float2(long2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float3 __attribute__((const, overloadable))
+ convert_float3(long3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float4 __attribute__((const, overloadable))
+ convert_float4(long4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float2 __attribute__((const, overloadable))
+ convert_float2(ulong2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float3 __attribute__((const, overloadable))
+ convert_float3(ulong3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float4 __attribute__((const, overloadable))
+ convert_float4(ulong4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern char2 __attribute__((const, overloadable))
+ convert_char2(double2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern char3 __attribute__((const, overloadable))
+ convert_char3(double3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern char4 __attribute__((const, overloadable))
+ convert_char4(double4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern char2 __attribute__((const, overloadable))
+ convert_char2(long2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern char3 __attribute__((const, overloadable))
+ convert_char3(long3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern char4 __attribute__((const, overloadable))
+ convert_char4(long4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern char2 __attribute__((const, overloadable))
+ convert_char2(ulong2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern char3 __attribute__((const, overloadable))
+ convert_char3(ulong3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern char4 __attribute__((const, overloadable))
+ convert_char4(ulong4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern uchar2 __attribute__((const, overloadable))
+ convert_uchar2(double2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern uchar3 __attribute__((const, overloadable))
+ convert_uchar3(double3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern uchar4 __attribute__((const, overloadable))
+ convert_uchar4(double4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern uchar2 __attribute__((const, overloadable))
+ convert_uchar2(long2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern uchar3 __attribute__((const, overloadable))
+ convert_uchar3(long3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern uchar4 __attribute__((const, overloadable))
+ convert_uchar4(long4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern uchar2 __attribute__((const, overloadable))
+ convert_uchar2(ulong2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern uchar3 __attribute__((const, overloadable))
+ convert_uchar3(ulong3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern uchar4 __attribute__((const, overloadable))
+ convert_uchar4(ulong4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern short2 __attribute__((const, overloadable))
+ convert_short2(double2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern short3 __attribute__((const, overloadable))
+ convert_short3(double3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern short4 __attribute__((const, overloadable))
+ convert_short4(double4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern short2 __attribute__((const, overloadable))
+ convert_short2(long2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern short3 __attribute__((const, overloadable))
+ convert_short3(long3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern short4 __attribute__((const, overloadable))
+ convert_short4(long4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern short2 __attribute__((const, overloadable))
+ convert_short2(ulong2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern short3 __attribute__((const, overloadable))
+ convert_short3(ulong3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern short4 __attribute__((const, overloadable))
+ convert_short4(ulong4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ushort2 __attribute__((const, overloadable))
+ convert_ushort2(double2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ushort3 __attribute__((const, overloadable))
+ convert_ushort3(double3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ushort4 __attribute__((const, overloadable))
+ convert_ushort4(double4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ushort2 __attribute__((const, overloadable))
+ convert_ushort2(long2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ushort3 __attribute__((const, overloadable))
+ convert_ushort3(long3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ushort4 __attribute__((const, overloadable))
+ convert_ushort4(long4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ushort2 __attribute__((const, overloadable))
+ convert_ushort2(ulong2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ushort3 __attribute__((const, overloadable))
+ convert_ushort3(ulong3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ushort4 __attribute__((const, overloadable))
+ convert_ushort4(ulong4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern int2 __attribute__((const, overloadable))
+ convert_int2(double2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern int3 __attribute__((const, overloadable))
+ convert_int3(double3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern int4 __attribute__((const, overloadable))
+ convert_int4(double4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern int2 __attribute__((const, overloadable))
+ convert_int2(long2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern int3 __attribute__((const, overloadable))
+ convert_int3(long3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern int4 __attribute__((const, overloadable))
+ convert_int4(long4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern int2 __attribute__((const, overloadable))
+ convert_int2(ulong2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern int3 __attribute__((const, overloadable))
+ convert_int3(ulong3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern int4 __attribute__((const, overloadable))
+ convert_int4(ulong4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern uint2 __attribute__((const, overloadable))
+ convert_uint2(double2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern uint3 __attribute__((const, overloadable))
+ convert_uint3(double3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern uint4 __attribute__((const, overloadable))
+ convert_uint4(double4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern uint2 __attribute__((const, overloadable))
+ convert_uint2(long2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern uint3 __attribute__((const, overloadable))
+ convert_uint3(long3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern uint4 __attribute__((const, overloadable))
+ convert_uint4(long4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern uint2 __attribute__((const, overloadable))
+ convert_uint2(ulong2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern uint3 __attribute__((const, overloadable))
+ convert_uint3(ulong3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern uint4 __attribute__((const, overloadable))
+ convert_uint4(ulong4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern double2 __attribute__((const, overloadable))
+ convert_double2(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern double3 __attribute__((const, overloadable))
+ convert_double3(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern double4 __attribute__((const, overloadable))
+ convert_double4(float4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern double2 __attribute__((const, overloadable))
+ convert_double2(char2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern double3 __attribute__((const, overloadable))
+ convert_double3(char3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern double4 __attribute__((const, overloadable))
+ convert_double4(char4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern double2 __attribute__((const, overloadable))
+ convert_double2(uchar2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern double3 __attribute__((const, overloadable))
+ convert_double3(uchar3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern double4 __attribute__((const, overloadable))
+ convert_double4(uchar4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern double2 __attribute__((const, overloadable))
+ convert_double2(short2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern double3 __attribute__((const, overloadable))
+ convert_double3(short3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern double4 __attribute__((const, overloadable))
+ convert_double4(short4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern double2 __attribute__((const, overloadable))
+ convert_double2(ushort2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern double3 __attribute__((const, overloadable))
+ convert_double3(ushort3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern double4 __attribute__((const, overloadable))
+ convert_double4(ushort4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern double2 __attribute__((const, overloadable))
+ convert_double2(int2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern double3 __attribute__((const, overloadable))
+ convert_double3(int3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern double4 __attribute__((const, overloadable))
+ convert_double4(int4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern double2 __attribute__((const, overloadable))
+ convert_double2(uint2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern double3 __attribute__((const, overloadable))
+ convert_double3(uint3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern double4 __attribute__((const, overloadable))
+ convert_double4(uint4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern long2 __attribute__((const, overloadable))
+ convert_long2(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern long3 __attribute__((const, overloadable))
+ convert_long3(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern long4 __attribute__((const, overloadable))
+ convert_long4(float4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern long2 __attribute__((const, overloadable))
+ convert_long2(char2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern long3 __attribute__((const, overloadable))
+ convert_long3(char3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern long4 __attribute__((const, overloadable))
+ convert_long4(char4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern long2 __attribute__((const, overloadable))
+ convert_long2(uchar2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern long3 __attribute__((const, overloadable))
+ convert_long3(uchar3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern long4 __attribute__((const, overloadable))
+ convert_long4(uchar4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern long2 __attribute__((const, overloadable))
+ convert_long2(short2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern long3 __attribute__((const, overloadable))
+ convert_long3(short3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern long4 __attribute__((const, overloadable))
+ convert_long4(short4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern long2 __attribute__((const, overloadable))
+ convert_long2(ushort2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern long3 __attribute__((const, overloadable))
+ convert_long3(ushort3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern long4 __attribute__((const, overloadable))
+ convert_long4(ushort4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern long2 __attribute__((const, overloadable))
+ convert_long2(int2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern long3 __attribute__((const, overloadable))
+ convert_long3(int3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern long4 __attribute__((const, overloadable))
+ convert_long4(int4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern long2 __attribute__((const, overloadable))
+ convert_long2(uint2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern long3 __attribute__((const, overloadable))
+ convert_long3(uint3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern long4 __attribute__((const, overloadable))
+ convert_long4(uint4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ulong2 __attribute__((const, overloadable))
+ convert_ulong2(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ulong3 __attribute__((const, overloadable))
+ convert_ulong3(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ulong4 __attribute__((const, overloadable))
+ convert_ulong4(float4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ulong2 __attribute__((const, overloadable))
+ convert_ulong2(char2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ulong3 __attribute__((const, overloadable))
+ convert_ulong3(char3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ulong4 __attribute__((const, overloadable))
+ convert_ulong4(char4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ulong2 __attribute__((const, overloadable))
+ convert_ulong2(uchar2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ulong3 __attribute__((const, overloadable))
+ convert_ulong3(uchar3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ulong4 __attribute__((const, overloadable))
+ convert_ulong4(uchar4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ulong2 __attribute__((const, overloadable))
+ convert_ulong2(short2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ulong3 __attribute__((const, overloadable))
+ convert_ulong3(short3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ulong4 __attribute__((const, overloadable))
+ convert_ulong4(short4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ulong2 __attribute__((const, overloadable))
+ convert_ulong2(ushort2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ulong3 __attribute__((const, overloadable))
+ convert_ulong3(ushort3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ulong4 __attribute__((const, overloadable))
+ convert_ulong4(ushort4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ulong2 __attribute__((const, overloadable))
+ convert_ulong2(int2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ulong3 __attribute__((const, overloadable))
+ convert_ulong3(int3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ulong4 __attribute__((const, overloadable))
+ convert_ulong4(int4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ulong2 __attribute__((const, overloadable))
+ convert_ulong2(uint2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ulong3 __attribute__((const, overloadable))
+ convert_ulong3(uint3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ulong4 __attribute__((const, overloadable))
+ convert_ulong4(uint4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ convert_half2(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ convert_half3(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ convert_half4(half4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern float2 __attribute__((const, overloadable))
+ convert_float2(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern float3 __attribute__((const, overloadable))
+ convert_float3(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern float4 __attribute__((const, overloadable))
+ convert_float4(half4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern double2 __attribute__((const, overloadable))
+ convert_double2(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern double3 __attribute__((const, overloadable))
+ convert_double3(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern double4 __attribute__((const, overloadable))
+ convert_double4(half4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern char2 __attribute__((const, overloadable))
+ convert_char2(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern char3 __attribute__((const, overloadable))
+ convert_char3(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern char4 __attribute__((const, overloadable))
+ convert_char4(half4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern uchar2 __attribute__((const, overloadable))
+ convert_uchar2(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern uchar3 __attribute__((const, overloadable))
+ convert_uchar3(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern uchar4 __attribute__((const, overloadable))
+ convert_uchar4(half4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern short2 __attribute__((const, overloadable))
+ convert_short2(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern short3 __attribute__((const, overloadable))
+ convert_short3(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern short4 __attribute__((const, overloadable))
+ convert_short4(half4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern ushort2 __attribute__((const, overloadable))
+ convert_ushort2(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern ushort3 __attribute__((const, overloadable))
+ convert_ushort3(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern ushort4 __attribute__((const, overloadable))
+ convert_ushort4(half4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern int2 __attribute__((const, overloadable))
+ convert_int2(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern int3 __attribute__((const, overloadable))
+ convert_int3(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern int4 __attribute__((const, overloadable))
+ convert_int4(half4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern uint2 __attribute__((const, overloadable))
+ convert_uint2(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern uint3 __attribute__((const, overloadable))
+ convert_uint3(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern uint4 __attribute__((const, overloadable))
+ convert_uint4(half4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern long2 __attribute__((const, overloadable))
+ convert_long2(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern long3 __attribute__((const, overloadable))
+ convert_long3(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern long4 __attribute__((const, overloadable))
+ convert_long4(half4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern ulong2 __attribute__((const, overloadable))
+ convert_ulong2(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern ulong3 __attribute__((const, overloadable))
+ convert_ulong3(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern ulong4 __attribute__((const, overloadable))
+ convert_ulong4(half4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ convert_half2(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ convert_half3(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ convert_half4(float4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ convert_half2(double2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ convert_half3(double3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ convert_half4(double4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ convert_half2(char2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ convert_half3(char3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ convert_half4(char4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ convert_half2(uchar2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ convert_half3(uchar3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ convert_half4(uchar4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ convert_half2(short2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ convert_half3(short3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ convert_half4(short4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ convert_half2(ushort2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ convert_half3(ushort3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ convert_half4(ushort4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ convert_half2(int2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ convert_half3(int3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ convert_half4(int4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ convert_half2(uint2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ convert_half3(uint3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ convert_half4(uint4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ convert_half2(long2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ convert_half3(long3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ convert_half4(long4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ convert_half2(ulong2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ convert_half3(ulong3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ convert_half4(ulong4 v);
+#endif
+
+/*
+ * rsPackColorTo8888: Create a uchar4 RGBA from floats
+ *
+ * Packs three or four floating point RGBA values into a uchar4.
+ *
+ * The input values are typically between 0.0f and 1.0f inclusive. For input values outside
+ * of this range, the resulting outputs will be clamped to be between 0 and 255. As this
+ * clamping may be done after the input is multiplied by 255.f and converted to an integer,
+ * input numbers greater than INT_MAX/255.f or less than INT_MIN/255.f result in
+ * undefined behavior.
+ *
+ * If the alpha component is not specified, it is assumed to be 1.0, i.e. the result will
+ * have an alpha set to 255.
+ *
+ * Parameters:
+ * r: Red component.
+ * g: Green component.
+ * b: Blue component.
+ * a: Alpha component.
+ * color: Vector of 3 or 4 floats containing the R, G, B, and A values.
+ */
+extern uchar4 __attribute__((const, overloadable))
+ rsPackColorTo8888(float r, float g, float b);
+
+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);
+
+/*
+ * rsUnpackColor8888: Create a float4 RGBA from uchar4
+ *
+ * Unpacks a uchar4 color to float4. The resulting floats will be between 0.0 and 1.0 inclusive.
+ */
+extern float4 __attribute__((const))
+ rsUnpackColor8888(uchar4 c);
+
+/*
+ * rsYuvToRGBA: Convert a YUV value to RGBA
+ *
+ * Converts a color from a YUV representation to RGBA.
+ *
+ * We currently don't provide a function to do the reverse conversion.
+ *
+ * Parameters:
+ * y: Luminance component.
+ * u: U chrominance component.
+ * v: V chrominance component.
+ */
+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 // RENDERSCRIPT_RS_CONVERT_RSH
diff --git a/script_api/include/rs_core.rsh b/script_api/include/rs_core.rsh
new file mode 100644
index 0000000..ae93d60
--- /dev/null
+++ b/script_api/include/rs_core.rsh
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/generate.sh.
+
+/*
+ * rs_core.rsh: Overview
+ *
+ * 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 RENDERSCRIPT_RS_CORE_RSH
+#define RENDERSCRIPT_RS_CORE_RSH
+
+#define RS_KERNEL __attribute__((kernel))
+
+#include "stdbool.h"
+
+#include "rs_value_types.rsh"
+#include "rs_object_types.rsh"
+
+#include "rs_allocation_create.rsh"
+#include "rs_allocation_data.rsh"
+#include "rs_atomic.rsh"
+#include "rs_convert.rsh"
+#include "rs_debug.rsh"
+#include "rs_for_each.rsh"
+#include "rs_io.rsh"
+#include "rs_math.rsh"
+#include "rs_matrix.rsh"
+#include "rs_object_info.rsh"
+#include "rs_quaternion.rsh"
+#include "rs_time.rsh"
+#include "rs_vector_math.rsh"
+
+#endif // RENDERSCRIPT_RS_CORE_RSH
diff --git a/script_api/include/rs_debug.rsh b/script_api/include/rs_debug.rsh
new file mode 100644
index 0000000..13c5faa
--- /dev/null
+++ b/script_api/include/rs_debug.rsh
@@ -0,0 +1,269 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/generate.sh.
+
+/*
+ * rs_debug.rsh: Debugging Functions
+ *
+ * The functions below are intended to be used during application developement.
+ * They should not be used in shipping applications.
+ */
+
+#ifndef RENDERSCRIPT_RS_DEBUG_RSH
+#define RENDERSCRIPT_RS_DEBUG_RSH
+
+#define RS_DEBUG(a) rsDebug(#a, a)
+#define RS_DEBUG_MARKER rsDebug(__FILE__, __LINE__)
+
+/*
+ * rsDebug: Log a message and values
+ *
+ * This function prints a message to the standard log, followed by the provided values.
+ *
+ * This function is intended for debugging only and should not be used in shipping
+ * applications.
+ */
+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
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern void __attribute__((overloadable))
+ rsDebug(const char* message, double2 a);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern void __attribute__((overloadable))
+ rsDebug(const char* message, double3 a);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern void __attribute__((overloadable))
+ rsDebug(const char* message, double4 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 >= 24))
+extern void __attribute__((overloadable))
+ rsDebug(const char* message, half a);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern void __attribute__((overloadable))
+ rsDebug(const char* message, half2 a);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern void __attribute__((overloadable))
+ rsDebug(const char* message, half3 a);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern void __attribute__((overloadable))
+ rsDebug(const char* message, half4 a);
+#endif
+
+#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/script_api/include/rs_for_each.rsh b/script_api/include/rs_for_each.rsh
new file mode 100644
index 0000000..bcc5db9
--- /dev/null
+++ b/script_api/include/rs_for_each.rsh
@@ -0,0 +1,434 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/generate.sh.
+
+/*
+ * rs_for_each.rsh: Kernel Invocation Functions and Types
+ *
+ * The rsForEach() function can be used to invoke the root kernel of a script.
+ *
+ * The other functions are used to get the characteristics of the invocation of
+ * an executing kernel, like dimensions and current indices. These functions take
+ * a rs_kernel_context as argument.
+ */
+
+#ifndef RENDERSCRIPT_RS_FOR_EACH_RSH
+#define RENDERSCRIPT_RS_FOR_EACH_RSH
+
+/*
+ * rs_for_each_strategy_t: Suggested cell processing order
+ *
+ * This type is used to suggest how the invoked kernel should iterate over the cells of the
+ * allocations. This is a hint only. Implementations may not follow the suggestion.
+ *
+ * This specification can help the caching behavior of the running kernel, e.g. the cache
+ * locality when the processing is distributed over multiple cores.
+ */
+typedef enum rs_for_each_strategy {
+ RS_FOR_EACH_STRATEGY_SERIAL = 0, // Prefer contiguous memory regions.
+ RS_FOR_EACH_STRATEGY_DONT_CARE = 1, // No prefrences.
+ RS_FOR_EACH_STRATEGY_DST_LINEAR = 2, // Prefer DST.
+ RS_FOR_EACH_STRATEGY_TILE_SMALL = 3, // Prefer processing small rectangular regions.
+ RS_FOR_EACH_STRATEGY_TILE_MEDIUM = 4, // Prefer processing medium rectangular regions.
+ RS_FOR_EACH_STRATEGY_TILE_LARGE = 5 // Prefer processing large rectangular regions.
+} rs_for_each_strategy_t;
+
+/*
+ * rs_kernel_context: Handle to a kernel invocation context
+ *
+ * The kernel context contains common characteristics of the allocations being iterated
+ * over, like dimensions. It also contains rarely used indices of the currently processed
+ * cell, like the Array0 index or the current level of detail.
+ *
+ * You can access the kernel context by adding a special parameter named "context" of type
+ * rs_kernel_context to your kernel function. See rsGetDimX() and rsGetArray0() for examples.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+typedef const struct rs_kernel_context_t * rs_kernel_context;
+#endif
+
+/*
+ * rs_script_call_t: Cell iteration information
+ *
+ * This structure is used to provide iteration information to a rsForEach call.
+ * It is currently used to restrict processing to a subset of cells. In future
+ * versions, it will also be used to provide hint on how to best iterate over
+ * the cells.
+ *
+ * The Start fields are inclusive and the End fields are exclusive. E.g. to iterate
+ * over cells 4, 5, 6, and 7 in the X dimension, set xStart to 4 and xEnd to 8.
+ */
+typedef struct rs_script_call {
+ rs_for_each_strategy_t strategy; // Currently ignored. In the future, will be suggested cell iteration strategy.
+ uint32_t xStart; // Starting index in the X dimension.
+ uint32_t xEnd; // Ending index (exclusive) in the X dimension.
+ uint32_t yStart; // Starting index in the Y dimension.
+ uint32_t yEnd; // Ending index (exclusive) in the Y dimension.
+ uint32_t zStart; // Starting index in the Z dimension.
+ uint32_t zEnd; // Ending index (exclusive) in the Z dimension.
+ uint32_t arrayStart; // Starting index in the Array0 dimension.
+ uint32_t arrayEnd; // Ending index (exclusive) in the Array0 dimension.
+ uint32_t array1Start; // Starting index in the Array1 dimension.
+ uint32_t array1End; // Ending index (exclusive) in the Array1 dimension.
+ uint32_t array2Start; // Starting index in the Array2 dimension.
+ uint32_t array2End; // Ending index (exclusive) in the Array2 dimension.
+ uint32_t array3Start; // Starting index in the Array3 dimension.
+ uint32_t array3End; // Ending index (exclusive) in the Array3 dimension.
+} rs_script_call_t;
+
+/*
+ * rs_kernel: Handle to a kernel function
+ *
+ * An opaque type for a function that is defined with the kernel attribute. A value
+ * of this type can be used in a rsForEach call to launch a kernel.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+typedef void* rs_kernel;
+#endif
+
+/*
+ * rsForEach: Launches a kernel
+ *
+ * Runs the kernel over zero or more input allocations. They are passed after the
+ * rs_kernel argument. If the specified kernel returns a value, an output allocation
+ * must be specified as the last argument. All input allocations,
+ * and the output allocation if it exists, must have the same dimensions.
+ *
+ * This is a synchronous function. A call to this function only returns after all
+ * the work has completed for all cells of the input allocations. If the kernel
+ * function returns any value, the call waits until all results have been written
+ * to the output allocation.
+ *
+ * Up to API level 23, the kernel is implicitly specified as the kernel named
+ * "root" in the specified script, and only a single input allocation can be used.
+ * Starting in API level 24, an arbitrary kernel function can be used,
+ * as specified by the kernel argument. The script argument is removed.
+ * The kernel must be defined in the current script. In addition, more than one
+ * input can be used.
+ *
+ * E.g.
+ * float __attribute__((kernel)) square(float a) {
+ * return a * a;
+ * }
+ *
+ * void compute(rs_allocation ain, rs_allocation aout) {
+ * rsForEach(square, ain, aout);
+ * }
+ *
+ *
+ * Parameters:
+ * script: Script to call.
+ * input: Allocation to source data from.
+ * output: Allocation to write date into.
+ * usrData: User defined data to pass to the script. May be NULL.
+ * sc: Extra control information used to select a sub-region of the allocation to be processed or suggest a walking strategy. May be NULL.
+ * usrDataLen: Size of the userData structure. This will be used to perform a shallow copy of the data if necessary.
+ * kernel: Function designator to a function that is defined with the kernel attribute.
+ * ...: Input and output allocations
+ */
+#if !defined(RS_VERSION) || (RS_VERSION <= 13)
+extern void __attribute__((overloadable))
+ rsForEach(rs_script script, rs_allocation input, rs_allocation output, const void* usrData,
+ const rs_script_call_t* sc);
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 13)
+extern void __attribute__((overloadable))
+ rsForEach(rs_script script, rs_allocation input, rs_allocation output, const void* usrData);
+#endif
+
+#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, const rs_script_call_t* sc);
+#endif
+
+#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) && (RS_VERSION <= 23))
+extern void __attribute__((overloadable))
+ rsForEach(rs_script script, rs_allocation input, rs_allocation output);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern void
+ rsForEach(rs_kernel kernel, ...);
+#endif
+
+/*
+ * rsForEachWithOptions: Launches a kernel with options
+ *
+ * Launches kernel in a way similar to rsForEach. However, instead of processing
+ * all cells in the input, this function only processes cells in the subspace of
+ * the index space specified in options. With the index space explicitly specified
+ * by options, no input or output allocation is required for a kernel launch using
+ * this API. If allocations are passed in, they must match the number of arguments
+ * and return value expected by the kernel function. The output allocation is
+ * present if and only if the kernel has a non-void return value.
+ *
+ * E.g.,
+ * rs_script_call_t opts = {0};
+ * opts.xStart = 0;
+ * opts.xEnd = dimX;
+ * opts.yStart = 0;
+ * opts.yEnd = dimY / 2;
+ * rsForEachWithOptions(foo, &opts, out, out);
+ *
+ *
+ * Parameters:
+ * kernel: Function designator to a function that is defined with the kernel attribute.
+ * options: Launch options
+ * ...: Input and output allocations
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern void
+ rsForEachWithOptions(rs_kernel kernel, rs_script_call_t* options, ...);
+#endif
+
+/*
+ * rsGetArray0: Index in the Array0 dimension for the specified kernel context
+ *
+ * Returns the index in the Array0 dimension of the cell being processed, as specified
+ * by the supplied kernel context.
+ *
+ * The kernel context contains common characteristics of the allocations being iterated
+ * over and rarely used indices, like the Array0 index.
+ *
+ * You can access the kernel context by adding a special parameter named "context" of
+ * type rs_kernel_context 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 dimensions are accessed by
+ * // adding these variables as arguments. For the more rarely used indices
+ * // to the other dimensions, extract them from the kernel 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 context);
+#endif
+
+/*
+ * rsGetArray1: Index in the Array1 dimension for the specified kernel context
+ *
+ * Returns the index in the Array1 dimension of the cell being processed, as specified
+ * by the supplied kernel 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 context);
+#endif
+
+/*
+ * rsGetArray2: Index in the Array2 dimension for the specified kernel context
+ *
+ * Returns the index in the Array2 dimension of the cell being processed,
+ * as specified by the supplied kernel 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 context);
+#endif
+
+/*
+ * rsGetArray3: Index in the Array3 dimension for the specified kernel context
+ *
+ * Returns the index in the Array3 dimension of the cell being processed, as specified
+ * by the supplied kernel 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 context);
+#endif
+
+/*
+ * rsGetDimArray0: Size of the Array0 dimension for the specified kernel context
+ *
+ * Returns the size of the Array0 dimension for the specified kernel 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 context);
+#endif
+
+/*
+ * rsGetDimArray1: Size of the Array1 dimension for the specified kernel context
+ *
+ * Returns the size of the Array1 dimension for the specified kernel 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 context);
+#endif
+
+/*
+ * rsGetDimArray2: Size of the Array2 dimension for the specified kernel context
+ *
+ * Returns the size of the Array2 dimension for the specified kernel 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 context);
+#endif
+
+/*
+ * rsGetDimArray3: Size of the Array3 dimension for the specified kernel context
+ *
+ * Returns the size of the Array3 dimension for the specified kernel 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 context);
+#endif
+
+/*
+ * rsGetDimHasFaces: Presence of more than one face for the specified kernel context
+ *
+ * If the kernel is iterating over 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 context);
+#endif
+
+/*
+ * rsGetDimLod: Number of levels of detail for the specified kernel context
+ *
+ * Returns the number of levels of detail for the specified kernel 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 context);
+#endif
+
+/*
+ * rsGetDimX: Size of the X dimension for the specified kernel context
+ *
+ * Returns the size of the X dimension for the specified kernel context.
+ *
+ * The kernel context contains common characteristics of the allocations being iterated
+ * over and rarely used indices, like the Array0 index.
+ *
+ * You can access it by adding a special parameter named "context" of
+ * type rs_kernel_context to your kernel function. E.g.
+ * int4 RS_KERNEL myKernel(int4 value, rs_kernel_context context) {
+ * uint32_t size = rsGetDimX(context); //...
+ *
+ * To get the dimension of specific allocation, use rsAllocationGetDimX().
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern uint32_t __attribute__((overloadable))
+ rsGetDimX(rs_kernel_context context);
+#endif
+
+/*
+ * rsGetDimY: Size of the Y dimension for the specified kernel context
+ *
+ * Returns the size of the X dimension for the specified kernel context.
+ * See rsGetDimX() for an explanation of the context.
+ *
+ * Returns 0 if the Y dimension is not present.
+ *
+ * To get the dimension of specific allocation, use rsAllocationGetDimY().
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern uint32_t __attribute__((overloadable))
+ rsGetDimY(rs_kernel_context context);
+#endif
+
+/*
+ * rsGetDimZ: Size of the Z dimension for the specified kernel context
+ *
+ * Returns the size of the Z dimension for the specified kernel context.
+ * See rsGetDimX() for an explanation of the context.
+ *
+ * Returns 0 if the Z dimension is not present.
+ *
+ * To get the dimension of specific allocation, use rsAllocationGetDimZ().
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+extern uint32_t __attribute__((overloadable))
+ rsGetDimZ(rs_kernel_context context);
+#endif
+
+/*
+ * rsGetFace: Coordinate of the Face for the specified kernel context
+ *
+ * Returns the face on which the cell being processed is found, as specified by the
+ * supplied kernel 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 context);
+#endif
+
+/*
+ * rsGetLod: Index in the Levels of Detail dimension for the specified kernel context
+ *
+ * Returns the index in the Levels of Detail dimension of the cell being processed,
+ * as specified by the supplied kernel 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 context);
+#endif
+
+#endif // RENDERSCRIPT_RS_FOR_EACH_RSH
diff --git a/script_api/include/rs_graphics.rsh b/script_api/include/rs_graphics.rsh
new file mode 100644
index 0000000..10ec640
--- /dev/null
+++ b/script_api/include/rs_graphics.rsh
@@ -0,0 +1,1522 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/generate.sh.
+
+/*
+ * rs_graphics.rsh: Graphics Functions and Types
+ *
+ * The graphics subsystem of RenderScript was removed at API level 23.
+ */
+
+#ifndef RENDERSCRIPT_RS_GRAPHICS_RSH
+#define RENDERSCRIPT_RS_GRAPHICS_RSH
+
+#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."
+#endif
+
+// TODO we seem to assume order for the other headers too.
+#include "rs_object_types.rsh"
+
+/*
+ * rs_blend_src_func: Blend source function
+ *
+ * DEPRECATED. Do not use.
+ *
+ */
+#ifndef __LP64__
+#if (defined(RS_VERSION) && (RS_VERSION >= 16) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+typedef enum __attribute__((
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+deprecated
+#endif
+)) {
+ RS_BLEND_SRC_ZERO = 0,
+ RS_BLEND_SRC_ONE = 1,
+ RS_BLEND_SRC_DST_COLOR = 2,
+ RS_BLEND_SRC_ONE_MINUS_DST_COLOR = 3,
+ RS_BLEND_SRC_SRC_ALPHA = 4,
+ RS_BLEND_SRC_ONE_MINUS_SRC_ALPHA = 5,
+ 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_func;
+#endif
+#endif
+
+/*
+ * rs_blend_dst_func: Blend destination function
+ *
+ * DEPRECATED. Do not use.
+ *
+ */
+#ifndef __LP64__
+#if (defined(RS_VERSION) && (RS_VERSION >= 16) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+typedef enum __attribute__((
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+deprecated
+#endif
+)) {
+ RS_BLEND_DST_ZERO = 0,
+ RS_BLEND_DST_ONE = 1,
+ RS_BLEND_DST_SRC_COLOR = 2,
+ RS_BLEND_DST_ONE_MINUS_SRC_COLOR = 3,
+ RS_BLEND_DST_SRC_ALPHA = 4,
+ 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_func;
+#endif
+#endif
+
+/*
+ * rs_cull_mode: Culling mode
+ *
+ * DEPRECATED. Do not use.
+ *
+ */
+#ifndef __LP64__
+#if (defined(RS_VERSION) && (RS_VERSION >= 16) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+typedef enum __attribute__((
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+deprecated
+#endif
+)) {
+ RS_CULL_BACK = 0,
+ RS_CULL_FRONT = 1,
+ RS_CULL_NONE = 2,
+ RS_CULL_INVALID = 100
+} rs_cull_mode;
+#endif
+#endif
+
+/*
+ * rs_depth_func: Depth function
+ *
+ * DEPRECATED. Do not use.
+ *
+ * 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) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+typedef enum __attribute__((
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+deprecated
+#endif
+)) {
+ 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_primitive: How to intepret mesh vertex data
+ *
+ * DEPRECATED. Do not use.
+ *
+ * Describes the way mesh vertex data is interpreted when rendering
+ */
+#ifndef __LP64__
+#if (defined(RS_VERSION) && (RS_VERSION >= 16) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+typedef enum __attribute__((
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+deprecated
+#endif
+)) {
+ 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
+#endif
+
+/*
+ * rs_font: Handle to a Font
+ *
+ * DEPRECATED. Do not use.
+ *
+ * Opaque handle to a RenderScript font object.
+ * See: android.renderscript.Font
+ */
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+typedef struct rs_font _RS_OBJECT_DECL __attribute__((
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+deprecated
+#endif
+)) rs_font;
+#endif
+#endif
+
+/*
+ * rs_mesh: Handle to a Mesh
+ *
+ * DEPRECATED. Do not use.
+ *
+ * Opaque handle to a RenderScript mesh object.
+ * See: android.renderscript.Mesh
+ */
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+typedef struct rs_mesh _RS_OBJECT_DECL __attribute__((
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+deprecated
+#endif
+)) rs_mesh;
+#endif
+#endif
+
+/*
+ * rs_program_fragment: Handle to a ProgramFragment
+ *
+ * DEPRECATED. Do not use.
+ *
+ * Opaque handle to a RenderScript ProgramFragment object.
+ * See: android.renderscript.ProgramFragment
+ */
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+typedef struct rs_program_fragment _RS_OBJECT_DECL __attribute__((
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+deprecated
+#endif
+)) rs_program_fragment;
+#endif
+#endif
+
+/*
+ * rs_program_vertex: Handle to a ProgramVertex
+ *
+ * DEPRECATED. Do not use.
+ *
+ * Opaque handle to a RenderScript ProgramVertex object.
+ * See: android.renderscript.ProgramVertex
+ */
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+typedef struct rs_program_vertex _RS_OBJECT_DECL __attribute__((
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+deprecated
+#endif
+)) rs_program_vertex;
+#endif
+#endif
+
+/*
+ * rs_program_raster: Handle to a ProgramRaster
+ *
+ * DEPRECATED. Do not use.
+ *
+ * Opaque handle to a RenderScript ProgramRaster object.
+ * See: android.renderscript.ProgramRaster
+ */
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+typedef struct rs_program_raster _RS_OBJECT_DECL __attribute__((
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+deprecated
+#endif
+)) rs_program_raster;
+#endif
+#endif
+
+/*
+ * rs_program_store: Handle to a ProgramStore
+ *
+ * DEPRECATED. Do not use.
+ *
+ * Opaque handle to a RenderScript ProgramStore object.
+ * See: android.renderscript.ProgramStore
+ */
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+typedef struct rs_program_store _RS_OBJECT_DECL __attribute__((
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+deprecated
+#endif
+)) rs_program_store;
+#endif
+#endif
+
+/*
+ * rsClearObject: Release an object
+ *
+ * Tells the run time that this handle will no longer be used to access the the related
+ * object. If this was the last handle to that object, resource recovery may happen.
+ *
+ * After calling this function, *dst will be set to an empty handle. See rsIsObject().
+ */
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (RS_VERSION <= 22)
+extern void __attribute__((overloadable))
+ rsClearObject(rs_mesh* dst);
+#endif
+#endif
+
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (RS_VERSION <= 22)
+extern void __attribute__((overloadable))
+ rsClearObject(rs_program_fragment* dst);
+#endif
+#endif
+
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (RS_VERSION <= 22)
+extern void __attribute__((overloadable))
+ rsClearObject(rs_program_vertex* dst);
+#endif
+#endif
+
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (RS_VERSION <= 22)
+extern void __attribute__((overloadable))
+ rsClearObject(rs_program_raster* dst);
+#endif
+#endif
+
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (RS_VERSION <= 22)
+extern void __attribute__((overloadable))
+ rsClearObject(rs_program_store* dst);
+#endif
+#endif
+
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (RS_VERSION <= 22)
+extern void __attribute__((overloadable))
+ rsClearObject(rs_font* dst);
+#endif
+#endif
+
+/*
+ * rsIsObject: Check for an empty handle
+ *
+ * Returns true if the handle contains a non-null reference.
+ *
+ * This function does not validate that the internal pointer used in the handle
+ * points to an actual valid object; it only checks for null.
+ *
+ * This function can be used to check the Element returned by rsElementGetSubElement()
+ * or see if rsClearObject() has been called on a handle.
+ */
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (RS_VERSION <= 22)
+extern bool __attribute__((overloadable))
+ rsIsObject(rs_mesh v);
+#endif
+#endif
+
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (RS_VERSION <= 22)
+extern bool __attribute__((overloadable))
+ rsIsObject(rs_program_fragment v);
+#endif
+#endif
+
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (RS_VERSION <= 22)
+extern bool __attribute__((overloadable))
+ rsIsObject(rs_program_vertex v);
+#endif
+#endif
+
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (RS_VERSION <= 22)
+extern bool __attribute__((overloadable))
+ rsIsObject(rs_program_raster v);
+#endif
+#endif
+
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (RS_VERSION <= 22)
+extern bool __attribute__((overloadable))
+ rsIsObject(rs_program_store v);
+#endif
+#endif
+
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (RS_VERSION <= 22)
+extern bool __attribute__((overloadable))
+ rsIsObject(rs_font v);
+#endif
+#endif
+
+/*
+ * rsSetObject: For internal use.
+ *
+ */
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (RS_VERSION <= 22)
+extern void __attribute__((overloadable))
+ rsSetObject(rs_mesh* dst, rs_mesh src);
+#endif
+#endif
+
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (RS_VERSION <= 22)
+extern void __attribute__((overloadable))
+ rsSetObject(rs_program_fragment* dst, rs_program_fragment src);
+#endif
+#endif
+
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (RS_VERSION <= 22)
+extern void __attribute__((overloadable))
+ rsSetObject(rs_program_vertex* dst, rs_program_vertex src);
+#endif
+#endif
+
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (RS_VERSION <= 22)
+extern void __attribute__((overloadable))
+ rsSetObject(rs_program_raster* dst, rs_program_raster src);
+#endif
+#endif
+
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (RS_VERSION <= 22)
+extern void __attribute__((overloadable))
+ rsSetObject(rs_program_store* dst, rs_program_store src);
+#endif
+#endif
+
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (RS_VERSION <= 22)
+extern void __attribute__((overloadable))
+ rsSetObject(rs_font* dst, rs_font src);
+#endif
+#endif
+
+/*
+ * rsgAllocationSyncAll: Sync the contents of an allocation
+ *
+ * DEPRECATED. Do not use.
+ *
+ * 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__
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgAllocationSyncAll(rs_allocation alloc);
+#endif
+#endif
+
+#ifndef __LP64__
+#if (defined(RS_VERSION) && (RS_VERSION >= 14) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgAllocationSyncAll(rs_allocation alloc, rs_allocation_usage_type source);
+#endif
+#endif
+
+/*
+ * rsgBindColorTarget: Set the color target
+ *
+ * DEPRECATED. Do not use.
+ *
+ * Set the color target used for all subsequent rendering calls
+ */
+#ifndef __LP64__
+#if (defined(RS_VERSION) && (RS_VERSION >= 14) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgBindColorTarget(rs_allocation colorTarget, uint slot);
+#endif
+#endif
+
+/*
+ * rsgBindConstant: Bind a constant allocation
+ *
+ * DEPRECATED. Do not use.
+ *
+ * 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__
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgBindConstant(rs_program_fragment ps, uint slot, rs_allocation c);
+#endif
+#endif
+
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgBindConstant(rs_program_vertex pv, uint slot, rs_allocation c);
+#endif
+#endif
+
+/*
+ * rsgBindDepthTarget: Set the depth target
+ *
+ * DEPRECATED. Do not use.
+ *
+ * Set the depth target used for all subsequent rendering calls
+ */
+#ifndef __LP64__
+#if (defined(RS_VERSION) && (RS_VERSION >= 14) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgBindDepthTarget(rs_allocation depthTarget);
+#endif
+#endif
+
+/*
+ * rsgBindFont: Bind a font object
+ *
+ * DEPRECATED. Do not use.
+ *
+ * Binds the font object to be used for all subsequent font rendering calls
+ *
+ * Parameters:
+ * font: object to bind
+ */
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgBindFont(rs_font font);
+#endif
+#endif
+
+/*
+ * rsgBindProgramFragment: Bind a ProgramFragment
+ *
+ * DEPRECATED. Do not use.
+ *
+ * Bind a new ProgramFragment to the rendering context.
+ */
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgBindProgramFragment(rs_program_fragment pf);
+#endif
+#endif
+
+/*
+ * rsgBindProgramRaster: Bind a ProgramRaster
+ *
+ * DEPRECATED. Do not use.
+ *
+ * Bind a new ProgramRaster to the rendering context.
+ */
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgBindProgramRaster(rs_program_raster pr);
+#endif
+#endif
+
+/*
+ * rsgBindProgramStore: Bind a ProgramStore
+ *
+ * DEPRECATED. Do not use.
+ *
+ * Bind a new ProgramStore to the rendering context.
+ */
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgBindProgramStore(rs_program_store ps);
+#endif
+#endif
+
+/*
+ * rsgBindProgramVertex: Bind a ProgramVertex
+ *
+ * DEPRECATED. Do not use.
+ *
+ * Bind a new ProgramVertex to the rendering context.
+ */
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgBindProgramVertex(rs_program_vertex pv);
+#endif
+#endif
+
+/*
+ * rsgBindSampler: Bind a sampler
+ *
+ * DEPRECATED. Do not use.
+ *
+ * Bind a new Sampler object to a ProgramFragment. The sampler will
+ * operate on the texture bound at the matching slot.
+ */
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgBindSampler(rs_program_fragment fragment, uint slot, rs_sampler sampler);
+#endif
+#endif
+
+/*
+ * rsgBindTexture: Bind a texture allocation
+ *
+ * DEPRECATED. Do not use.
+ *
+ * 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.
+ */
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgBindTexture(rs_program_fragment v, uint slot, rs_allocation alloc);
+#endif
+#endif
+
+/*
+ * rsgClearAllRenderTargets: Clear all color and depth targets
+ *
+ * DEPRECATED. Do not use.
+ *
+ * Clear all color and depth targets and resume rendering into
+ * the framebuffer
+ */
+#ifndef __LP64__
+#if (defined(RS_VERSION) && (RS_VERSION >= 14) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgClearAllRenderTargets(void);
+#endif
+#endif
+
+/*
+ * rsgClearColor: Clear the specified color from the surface
+ *
+ * DEPRECATED. Do not use.
+ *
+ * Clears the rendering surface to the specified color.
+ */
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgClearColor(float r, float g, float b, float a);
+#endif
+#endif
+
+/*
+ * rsgClearColorTarget: Clear the color target
+ *
+ * DEPRECATED. Do not use.
+ *
+ * Clear the previously set color target
+ */
+#ifndef __LP64__
+#if (defined(RS_VERSION) && (RS_VERSION >= 14) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgClearColorTarget(uint slot);
+#endif
+#endif
+
+/*
+ * rsgClearDepth: Clear the depth surface
+ *
+ * DEPRECATED. Do not use.
+ *
+ * Clears the depth suface to the specified value.
+ */
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgClearDepth(float value);
+#endif
+#endif
+
+/*
+ * rsgClearDepthTarget: Clear the depth target
+ *
+ * DEPRECATED. Do not use.
+ *
+ * Clear the previously set depth target
+ */
+#ifndef __LP64__
+#if (defined(RS_VERSION) && (RS_VERSION >= 14) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgClearDepthTarget(void);
+#endif
+#endif
+
+/*
+ * rsgDrawMesh: Draw a mesh
+ *
+ * DEPRECATED. Do not use.
+ *
+ * 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__
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgDrawMesh(rs_mesh ism);
+#endif
+#endif
+
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgDrawMesh(rs_mesh ism, uint primitiveIndex);
+#endif
+#endif
+
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgDrawMesh(rs_mesh ism, uint primitiveIndex, uint start, uint len);
+#endif
+#endif
+
+/*
+ * rsgDrawQuad: Draw a quad
+ *
+ * DEPRECATED. Do not use.
+ *
+ * Low performance utility function for drawing a simple quad. Not intended for
+ * drawing large quantities of geometry.
+ */
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ 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
+#endif
+
+/*
+ * rsgDrawQuadTexCoords: Draw a textured quad
+ *
+ * DEPRECATED. Do not use.
+ *
+ * Low performance utility function for drawing a textured quad. Not intended
+ * for drawing large quantities of geometry.
+ */
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ 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
+#endif
+
+/*
+ * rsgDrawRect: Draw a rectangle
+ *
+ * DEPRECATED. Do not use.
+ *
+ * Low performance utility function for drawing a simple rectangle. Not
+ * intended for drawing large quantities of geometry.
+ */
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgDrawRect(float x1, float y1, float x2, float y2, float z);
+#endif
+#endif
+
+/*
+ * rsgDrawSpriteScreenspace: Draw rectangles in screenspace
+ *
+ * DEPRECATED. Do not use.
+ *
+ * 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.
+ */
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgDrawSpriteScreenspace(float x, float y, float z, float w, float h);
+#endif
+#endif
+
+/*
+ * rsgDrawText: Draw a text string
+ *
+ * DEPRECATED. Do not use.
+ *
+ * Draws text given a string and location
+ */
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgDrawText(const char* text, int x, int y);
+#endif
+#endif
+
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgDrawText(rs_allocation alloc, int x, int y);
+#endif
+#endif
+
+/*
+ * rsgFinish: End rendering commands
+ *
+ * DEPRECATED. Do not use.
+ *
+ * Force RenderScript to finish all rendering commands
+ */
+#ifndef __LP64__
+#if (defined(RS_VERSION) && (RS_VERSION >= 14) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+extern uint __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgFinish(void);
+#endif
+#endif
+
+/*
+ * rsgFontColor: Set the font color
+ *
+ * DEPRECATED. Do not use.
+ *
+ * Sets the font color for all subsequent rendering calls
+ *
+ * Parameters:
+ * r: red component
+ * g: green component
+ * b: blue component
+ * a: alpha component
+ */
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgFontColor(float r, float g, float b, float a);
+#endif
+#endif
+
+/*
+ * rsgGetHeight: Get the surface height
+ *
+ * DEPRECATED. Do not use.
+ *
+ * Get the height of the current rendering surface.
+ */
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern uint __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgGetHeight(void);
+#endif
+#endif
+
+/*
+ * rsgGetWidth: Get the surface width
+ *
+ * DEPRECATED. Do not use.
+ *
+ * Get the width of the current rendering surface.
+ */
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern uint __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgGetWidth(void);
+#endif
+#endif
+
+/*
+ * rsgMeasureText: Get the bounding box for a text string
+ *
+ * DEPRECATED. Do not use.
+ *
+ * Returns the bounding box of the text relative to (0, 0)
+ * Any of left, right, top, bottom could be NULL
+ */
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgMeasureText(const char* text, int* left, int* right, int* top, int* bottom);
+#endif
+#endif
+
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgMeasureText(rs_allocation alloc, int* left, int* right, int* top, int* bottom);
+#endif
+#endif
+
+/*
+ * rsgMeshComputeBoundingBox: Compute a bounding box
+ *
+ * DEPRECATED. Do not use.
+ *
+ * Computes an axis aligned bounding box of a mesh object
+ */
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgMeshComputeBoundingBox(rs_mesh mesh, float* minX, float* minY, float* min, float* maxX,
+ float* maxY, float* maxZ);
+#endif
+#endif
+
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+static inline void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ 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;
+ bBoxMin->y = y1;
+ bBoxMin->z = z1;
+ bBoxMax->x = x2;
+ bBoxMax->y = y2;
+ bBoxMax->z = z2;
+}
+#endif
+#endif
+
+/*
+ * rsgMeshGetIndexAllocation: Return an allocation containing index data
+ *
+ * DEPRECATED. Do not use.
+ *
+ * Returns an allocation containing index data or a null
+ * allocation if only the primitive is specified
+ *
+ * Parameters:
+ * m: mesh to get data from
+ * index: index of the index allocation
+ *
+ * Returns: allocation containing index data
+ */
+#ifndef __LP64__
+#if (defined(RS_VERSION) && (RS_VERSION >= 16) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+extern rs_allocation __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgMeshGetIndexAllocation(rs_mesh m, uint32_t index);
+#endif
+#endif
+
+/*
+ * rsgMeshGetPrimitive: Return the primitive
+ *
+ * DEPRECATED. Do not use.
+ *
+ * Returns the primitive describing how a part of the mesh is
+ * rendered
+ *
+ * Parameters:
+ * m: mesh to get data from
+ * index: index of the primitive
+ *
+ * Returns: primitive describing how the mesh is rendered
+ */
+#ifndef __LP64__
+#if (defined(RS_VERSION) && (RS_VERSION >= 16) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+extern rs_primitive __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgMeshGetPrimitive(rs_mesh m, uint32_t index);
+#endif
+#endif
+
+/*
+ * rsgMeshGetPrimitiveCount: Return the number of index sets
+ *
+ * DEPRECATED. Do not use.
+ *
+ * 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
+ */
+#ifndef __LP64__
+#if (defined(RS_VERSION) && (RS_VERSION >= 16) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+extern uint32_t __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgMeshGetPrimitiveCount(rs_mesh m);
+#endif
+#endif
+
+/*
+ * rsgMeshGetVertexAllocation: Return a vertex allocation
+ *
+ * DEPRECATED. Do not use.
+ *
+ * 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
+ */
+#ifndef __LP64__
+#if (defined(RS_VERSION) && (RS_VERSION >= 16) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+extern rs_allocation __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgMeshGetVertexAllocation(rs_mesh m, uint32_t index);
+#endif
+#endif
+
+/*
+ * rsgMeshGetVertexAllocationCount: Return the number of vertex allocations
+ *
+ * DEPRECATED. Do not use.
+ *
+ * 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
+ */
+#ifndef __LP64__
+#if (defined(RS_VERSION) && (RS_VERSION >= 16) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+extern uint32_t __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgMeshGetVertexAllocationCount(rs_mesh m);
+#endif
+#endif
+
+/*
+ * rsgProgramFragmentConstantColor: Set the constant color for a fixed function emulation program
+ *
+ * DEPRECATED. Do not use.
+ *
+ * Set the constant color for a fixed function emulation program.
+ */
+#ifndef __LP64__
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgProgramFragmentConstantColor(rs_program_fragment pf, float r, float g, float b, float a);
+#endif
+#endif
+
+/*
+ * rsgProgramVertexGetProjectionMatrix: Get the projection matrix for a fixed function vertex program
+ *
+ * DEPRECATED. Do not use.
+ *
+ * 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__
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgProgramVertexGetProjectionMatrix(rs_matrix4x4* proj);
+#endif
+#endif
+
+/*
+ * rsgProgramVertexLoadModelMatrix: Load the model matrix for a bound fixed function vertex program
+ *
+ * DEPRECATED. Do not use.
+ *
+ * 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__
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgProgramVertexLoadModelMatrix(const rs_matrix4x4* model);
+#endif
+#endif
+
+/*
+ * rsgProgramVertexLoadProjectionMatrix: Load the projection matrix for a bound fixed function vertex program
+ *
+ * DEPRECATED. Do not use.
+ *
+ * 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__
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgProgramVertexLoadProjectionMatrix(const rs_matrix4x4* proj);
+#endif
+#endif
+
+/*
+ * rsgProgramVertexLoadTextureMatrix: Load the texture matrix for a bound fixed function vertex program
+ *
+ * DEPRECATED. Do not use.
+ *
+ * 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__
+#if !defined(RS_VERSION) || (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22)
+extern void __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgProgramVertexLoadTextureMatrix(const rs_matrix4x4* tex);
+#endif
+#endif
+
+/*
+ * rsgProgramRasterGetCullMode: Get program raster cull mode
+ *
+ * DEPRECATED. Do not use.
+ *
+ * Get program raster cull mode
+ *
+ * Parameters:
+ * pr: program raster to query
+ */
+#ifndef __LP64__
+#if (defined(RS_VERSION) && (RS_VERSION >= 16) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+extern rs_cull_mode __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgProgramRasterGetCullMode(rs_program_raster pr);
+#endif
+#endif
+
+/*
+ * rsgProgramRasterIsPointSpriteEnabled: Get program raster point sprite state
+ *
+ * DEPRECATED. Do not use.
+ *
+ * Get program raster point sprite state
+ *
+ * Parameters:
+ * pr: program raster to query
+ */
+#ifndef __LP64__
+#if (defined(RS_VERSION) && (RS_VERSION >= 16) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+extern bool __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgProgramRasterIsPointSpriteEnabled(rs_program_raster pr);
+#endif
+#endif
+
+/*
+ * rsgProgramStoreGetBlendDstFunc: Get program store blend destination function
+ *
+ * DEPRECATED. Do not use.
+ *
+ * Get program store blend destination function
+ *
+ * Parameters:
+ * ps: program store to query
+ */
+#ifndef __LP64__
+#if (defined(RS_VERSION) && (RS_VERSION >= 16) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+extern rs_blend_dst_func __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgProgramStoreGetBlendDstFunc(rs_program_store ps);
+#endif
+#endif
+
+/*
+ * rsgProgramStoreGetBlendSrcFunc: Get program store blend source function
+ *
+ * DEPRECATED. Do not use.
+ *
+ * Get program store blend source function
+ *
+ * Parameters:
+ * ps: program store to query
+ */
+#ifndef __LP64__
+#if (defined(RS_VERSION) && (RS_VERSION >= 16) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+extern rs_blend_src_func __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgProgramStoreGetBlendSrcFunc(rs_program_store ps);
+#endif
+#endif
+
+/*
+ * rsgProgramStoreGetDepthFunc: Get program store depth function
+ *
+ * DEPRECATED. Do not use.
+ *
+ * Get program store depth function
+ *
+ * Parameters:
+ * ps: program store to query
+ */
+#ifndef __LP64__
+#if (defined(RS_VERSION) && (RS_VERSION >= 16) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+extern rs_depth_func __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgProgramStoreGetDepthFunc(rs_program_store ps);
+#endif
+#endif
+
+/*
+ * rsgProgramStoreIsColorMaskAlphaEnabled: Get program store alpha component color mask
+ *
+ * DEPRECATED. Do not use.
+ *
+ * Get program store alpha component color mask
+ *
+ * Parameters:
+ * ps: program store to query
+ */
+#ifndef __LP64__
+#if (defined(RS_VERSION) && (RS_VERSION >= 16) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+extern bool __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgProgramStoreIsColorMaskAlphaEnabled(rs_program_store ps);
+#endif
+#endif
+
+/*
+ * rsgProgramStoreIsColorMaskBlueEnabled: Get program store blur component color mask
+ *
+ * DEPRECATED. Do not use.
+ *
+ * Get program store blur component color mask
+ *
+ * Parameters:
+ * ps: program store to query
+ */
+#ifndef __LP64__
+#if (defined(RS_VERSION) && (RS_VERSION >= 16) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+extern bool __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgProgramStoreIsColorMaskBlueEnabled(rs_program_store ps);
+#endif
+#endif
+
+/*
+ * rsgProgramStoreIsColorMaskGreenEnabled: Get program store green component color mask
+ *
+ * DEPRECATED. Do not use.
+ *
+ * Get program store green component color mask
+ *
+ * Parameters:
+ * ps: program store to query
+ */
+#ifndef __LP64__
+#if (defined(RS_VERSION) && (RS_VERSION >= 16) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+extern bool __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgProgramStoreIsColorMaskGreenEnabled(rs_program_store ps);
+#endif
+#endif
+
+/*
+ * rsgProgramStoreIsColorMaskRedEnabled: Get program store red component color mask
+ *
+ * DEPRECATED. Do not use.
+ *
+ * Get program store red component color mask
+ *
+ * Parameters:
+ * ps: program store to query
+ */
+#ifndef __LP64__
+#if (defined(RS_VERSION) && (RS_VERSION >= 16) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+extern bool __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgProgramStoreIsColorMaskRedEnabled(rs_program_store ps);
+#endif
+#endif
+
+/*
+ * rsgProgramStoreIsDepthMaskEnabled: Get program store depth mask
+ *
+ * DEPRECATED. Do not use.
+ *
+ * Get program store depth mask
+ *
+ * Parameters:
+ * ps: program store to query
+ */
+#ifndef __LP64__
+#if (defined(RS_VERSION) && (RS_VERSION >= 16) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+extern bool __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgProgramStoreIsDepthMaskEnabled(rs_program_store ps);
+#endif
+#endif
+
+/*
+ * rsgProgramStoreIsDitherEnabled: Get program store dither state
+ *
+ * DEPRECATED. Do not use.
+ *
+ * Get program store dither state
+ *
+ * Parameters:
+ * ps: program store to query
+ */
+#ifndef __LP64__
+#if (defined(RS_VERSION) && (RS_VERSION >= 16) && (defined(RS_DECLARE_EXPIRED_APIS) || RS_VERSION <= 22))
+extern bool __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated
+#endif
+))
+ rsgProgramStoreIsDitherEnabled(rs_program_store ps);
+#endif
+#endif
+
+#endif // RENDERSCRIPT_RS_GRAPHICS_RSH
diff --git a/script_api/include/rs_io.rsh b/script_api/include/rs_io.rsh
new file mode 100644
index 0000000..2ffbe4b
--- /dev/null
+++ b/script_api/include/rs_io.rsh
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/generate.sh.
+
+/*
+ * rs_io.rsh: Input/Output Functions
+ *
+ * These functions are used to:
+ * - Send information to the Java client, and
+ * - Send the processed allocation or receive the next allocation to process.
+ */
+
+#ifndef RENDERSCRIPT_RS_IO_RSH
+#define RENDERSCRIPT_RS_IO_RSH
+
+/*
+ * rsAllocationIoReceive: Receive new content from the queue
+ *
+ * Receive a new set of contents from the queue.
+ *
+ * This function should not be called from inside a kernel, or from any function
+ * that may be called directly or indirectly from a kernel. Doing so would cause a
+ * runtime error.
+ *
+ * Parameters:
+ * a: Allocation to work on.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+extern void __attribute__((overloadable))
+ rsAllocationIoReceive(rs_allocation a);
+#endif
+
+/*
+ * rsAllocationIoSend: Send new content to the queue
+ *
+ * Send the contents of the Allocation to the queue.
+ *
+ * This function should not be called from inside a kernel, or from any function
+ * that may be called directly or indirectly from a kernel. Doing so would cause a
+ * runtime error.
+ *
+ * Parameters:
+ * a: Allocation to work on.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+extern void __attribute__((overloadable))
+ rsAllocationIoSend(rs_allocation a);
+#endif
+
+/*
+ * rsSendToClient: Send a message to the client, non-blocking
+ *
+ * Sends a message back to the client. This call does not block.
+ * It returns true if the message was sent and false if the
+ * message queue is full.
+ *
+ * A message ID is required. The data payload is optional.
+ *
+ * See RenderScript.RSMessageHandler.
+ *
+ * Parameters:
+ * data: Application specific data.
+ * len: Length of the data, in bytes.
+ */
+extern bool __attribute__((overloadable))
+ rsSendToClient(int cmdID);
+
+extern bool __attribute__((overloadable))
+ rsSendToClient(int cmdID, const void* data, uint len);
+
+/*
+ * rsSendToClientBlocking: Send a message to the client, blocking
+ *
+ * Sends a message back to the client. This function will block
+ * until there is room on the message queue for this message.
+ * This function may return before the message was delivered and
+ * processed by the client.
+ *
+ * A message ID is required. The data payload is optional.
+ *
+ * See RenderScript.RSMessageHandler.
+ *
+ * Parameters:
+ * data: Application specific data.
+ * len: Length of the data, in bytes.
+ */
+extern void __attribute__((overloadable))
+ rsSendToClientBlocking(int cmdID);
+
+extern void __attribute__((overloadable))
+ rsSendToClientBlocking(int cmdID, const void* data, uint len);
+
+#endif // RENDERSCRIPT_RS_IO_RSH
diff --git a/script_api/include/rs_math.rsh b/script_api/include/rs_math.rsh
new file mode 100644
index 0000000..3d034d0
--- /dev/null
+++ b/script_api/include/rs_math.rsh
@@ -0,0 +1,6550 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/generate.sh.
+
+/*
+ * rs_math.rsh: Mathematical Constants and Functions
+ *
+ * The mathematical functions below can be applied to scalars and vectors. When applied
+ * to vectors, the returned value is a vector of the function applied to each entry of the input.
+ *
+ * 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);
+ *
+ *
+ * See Vector Math Functions for functions like distance() and length() that interpret
+ * instead the input as a single vector in n-dimensional space.
+ *
+ * The precision of the mathematical operations on 32 bit floats is affected by the pragmas
+ * rs_fp_relaxed and rs_fp_full. Under rs_fp_relaxed, subnormal values may be flushed to zero and
+ * rounding may be done towards zero. In comparison, rs_fp_full requires correct handling of
+ * subnormal values, i.e. smaller than 1.17549435e-38f. rs_fp_rull also requires round to nearest
+ * with ties to even.
+ *
+ * Different precision/speed tradeoffs can be achieved by using variants of the common math
+ * functions. Functions with a name starting with
+ * - native_: May have custom hardware implementations with weaker precision. Additionally,
+ * subnormal values may be flushed to zero, rounding towards zero may be used, and NaN and
+ * infinity input may not be handled correctly.
+ * - half_: May perform internal computations using 16 bit floats. Additionally, subnormal
+ * values may be flushed to zero, and rounding towards zero may be used.
+ *
+ */
+
+#ifndef RENDERSCRIPT_RS_MATH_RSH
+#define RENDERSCRIPT_RS_MATH_RSH
+
+/*
+ * 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: 2 / pi, as a 32 bit float
+ *
+ * DEPRECATED. Do not use.
+ *
+ * 2 divided by pi, as a 32 bit float.
+ */
+#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
+
+/*
+ * abs: Absolute value of an integer
+ *
+ * Returns the absolute value of an integer.
+ *
+ * For floats, use fabs().
+ */
+extern uchar __attribute__((const, overloadable))
+ abs(char v);
+
+extern uchar2 __attribute__((const, overloadable))
+ abs(char2 v);
+
+extern uchar3 __attribute__((const, overloadable))
+ abs(char3 v);
+
+extern uchar4 __attribute__((const, overloadable))
+ abs(char4 v);
+
+extern ushort __attribute__((const, overloadable))
+ abs(short v);
+
+extern ushort2 __attribute__((const, overloadable))
+ abs(short2 v);
+
+extern ushort3 __attribute__((const, overloadable))
+ abs(short3 v);
+
+extern ushort4 __attribute__((const, overloadable))
+ abs(short4 v);
+
+extern uint __attribute__((const, overloadable))
+ abs(int v);
+
+extern uint2 __attribute__((const, overloadable))
+ abs(int2 v);
+
+extern uint3 __attribute__((const, overloadable))
+ abs(int3 v);
+
+extern uint4 __attribute__((const, overloadable))
+ abs(int4 v);
+
+/*
+ * acos: Inverse cosine
+ *
+ * Returns the inverse cosine, in radians.
+ *
+ * See also native_acos().
+ */
+extern float __attribute__((const, overloadable))
+ acos(float v);
+
+extern float2 __attribute__((const, overloadable))
+ acos(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+ acos(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+ acos(float4 v);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ acos(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ acos(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ acos(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ acos(half4 v);
+#endif
+
+/*
+ * acosh: Inverse hyperbolic cosine
+ *
+ * Returns the inverse hyperbolic cosine, in radians.
+ *
+ * See also native_acosh().
+ */
+extern float __attribute__((const, overloadable))
+ acosh(float v);
+
+extern float2 __attribute__((const, overloadable))
+ acosh(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+ acosh(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+ acosh(float4 v);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ acosh(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ acosh(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ acosh(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ acosh(half4 v);
+#endif
+
+/*
+ * acospi: Inverse cosine divided by pi
+ *
+ * Returns the inverse cosine in radians, divided by pi.
+ *
+ * To get an inverse cosine measured in degrees, use acospi(a) * 180.f.
+ *
+ * See also native_acospi().
+ */
+extern float __attribute__((const, overloadable))
+ acospi(float v);
+
+extern float2 __attribute__((const, overloadable))
+ acospi(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+ acospi(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+ acospi(float4 v);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ acospi(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ acospi(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ acospi(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ acospi(half4 v);
+#endif
+
+/*
+ * asin: Inverse sine
+ *
+ * Returns the inverse sine, in radians.
+ *
+ * See also native_asin().
+ */
+extern float __attribute__((const, overloadable))
+ asin(float v);
+
+extern float2 __attribute__((const, overloadable))
+ asin(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+ asin(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+ asin(float4 v);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ asin(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ asin(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ asin(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ asin(half4 v);
+#endif
+
+/*
+ * asinh: Inverse hyperbolic sine
+ *
+ * Returns the inverse hyperbolic sine, in radians.
+ *
+ * See also native_asinh().
+ */
+extern float __attribute__((const, overloadable))
+ asinh(float v);
+
+extern float2 __attribute__((const, overloadable))
+ asinh(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+ asinh(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+ asinh(float4 v);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ asinh(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ asinh(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ asinh(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ asinh(half4 v);
+#endif
+
+/*
+ * asinpi: Inverse sine divided by pi
+ *
+ * Returns the inverse sine in radians, divided by pi.
+ *
+ * To get an inverse sine measured in degrees, use asinpi(a) * 180.f.
+ *
+ * See also native_asinpi().
+ */
+extern float __attribute__((const, overloadable))
+ asinpi(float v);
+
+extern float2 __attribute__((const, overloadable))
+ asinpi(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+ asinpi(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+ asinpi(float4 v);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ asinpi(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ asinpi(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ asinpi(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ asinpi(half4 v);
+#endif
+
+/*
+ * atan: Inverse tangent
+ *
+ * Returns the inverse tangent, in radians.
+ *
+ * See also native_atan().
+ */
+extern float __attribute__((const, overloadable))
+ atan(float v);
+
+extern float2 __attribute__((const, overloadable))
+ atan(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+ atan(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+ atan(float4 v);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ atan(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ atan(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ atan(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ atan(half4 v);
+#endif
+
+/*
+ * atan2: Inverse tangent of a ratio
+ *
+ * Returns the inverse tangent of (numerator / denominator), in radians.
+ *
+ * See also native_atan2().
+ *
+ * Parameters:
+ * numerator: Numerator.
+ * denominator: Denominator. Can be 0.
+ */
+extern float __attribute__((const, overloadable))
+ atan2(float numerator, float denominator);
+
+extern float2 __attribute__((const, overloadable))
+ atan2(float2 numerator, float2 denominator);
+
+extern float3 __attribute__((const, overloadable))
+ atan2(float3 numerator, float3 denominator);
+
+extern float4 __attribute__((const, overloadable))
+ atan2(float4 numerator, float4 denominator);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ atan2(half numerator, half denominator);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ atan2(half2 numerator, half2 denominator);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ atan2(half3 numerator, half3 denominator);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ atan2(half4 numerator, half4 denominator);
+#endif
+
+/*
+ * 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.
+ *
+ * See also native_atan2pi().
+ *
+ * Parameters:
+ * numerator: Numerator.
+ * denominator: Denominator. Can be 0.
+ */
+extern float __attribute__((const, overloadable))
+ atan2pi(float numerator, float denominator);
+
+extern float2 __attribute__((const, overloadable))
+ atan2pi(float2 numerator, float2 denominator);
+
+extern float3 __attribute__((const, overloadable))
+ atan2pi(float3 numerator, float3 denominator);
+
+extern float4 __attribute__((const, overloadable))
+ atan2pi(float4 numerator, float4 denominator);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ atan2pi(half numerator, half denominator);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ atan2pi(half2 numerator, half2 denominator);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ atan2pi(half3 numerator, half3 denominator);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ atan2pi(half4 numerator, half4 denominator);
+#endif
+
+/*
+ * atanh: Inverse hyperbolic tangent
+ *
+ * Returns the inverse hyperbolic tangent, in radians.
+ *
+ * See also native_atanh().
+ */
+extern float __attribute__((const, overloadable))
+ atanh(float v);
+
+extern float2 __attribute__((const, overloadable))
+ atanh(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+ atanh(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+ atanh(float4 v);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ atanh(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ atanh(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ atanh(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ atanh(half4 v);
+#endif
+
+/*
+ * atanpi: Inverse tangent divided by pi
+ *
+ * Returns the inverse tangent in radians, divided by pi.
+ *
+ * To get an inverse tangent measured in degrees, use atanpi(a) * 180.f.
+ *
+ * See also native_atanpi().
+ */
+extern float __attribute__((const, overloadable))
+ atanpi(float v);
+
+extern float2 __attribute__((const, overloadable))
+ atanpi(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+ atanpi(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+ atanpi(float4 v);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ atanpi(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ atanpi(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ atanpi(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ atanpi(half4 v);
+#endif
+
+/*
+ * cbrt: Cube root
+ *
+ * Returns the cube root.
+ *
+ * See also native_cbrt().
+ */
+extern float __attribute__((const, overloadable))
+ cbrt(float v);
+
+extern float2 __attribute__((const, overloadable))
+ cbrt(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+ cbrt(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+ cbrt(float4 v);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ cbrt(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ cbrt(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ cbrt(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ cbrt(half4 v);
+#endif
+
+/*
+ * ceil: Smallest integer not less than a value
+ *
+ * Returns the smallest integer not less than a value.
+ *
+ * For example, ceil(1.2f) returns 2.f, and ceil(-1.2f) returns -1.f.
+ *
+ * See also floor().
+ */
+extern float __attribute__((const, overloadable))
+ ceil(float v);
+
+extern float2 __attribute__((const, overloadable))
+ ceil(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+ ceil(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+ ceil(float4 v);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ ceil(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ ceil(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ ceil(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ ceil(half4 v);
+#endif
+
+/*
+ * clamp: Restrain a value to a range
+ *
+ * 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.
+ *
+ * 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);
+
+extern float2 __attribute__((const, overloadable))
+ clamp(float2 value, float2 min_value, float2 max_value);
+
+extern float3 __attribute__((const, overloadable))
+ clamp(float3 value, float3 min_value, float3 max_value);
+
+extern float4 __attribute__((const, overloadable))
+ clamp(float4 value, float4 min_value, float4 max_value);
+
+extern float2 __attribute__((const, overloadable))
+ clamp(float2 value, float min_value, float max_value);
+
+extern float3 __attribute__((const, overloadable))
+ clamp(float3 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))
+extern char2 __attribute__((const, overloadable))
+ clamp(char2 value, char2 min_value, char2 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern char3 __attribute__((const, overloadable))
+ clamp(char3 value, char3 min_value, char3 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern char4 __attribute__((const, overloadable))
+ clamp(char4 value, char4 min_value, char4 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern uchar __attribute__((const, overloadable))
+ clamp(uchar value, uchar min_value, uchar max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern uchar2 __attribute__((const, overloadable))
+ clamp(uchar2 value, uchar2 min_value, uchar2 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern uchar3 __attribute__((const, overloadable))
+ clamp(uchar3 value, uchar3 min_value, uchar3 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern uchar4 __attribute__((const, overloadable))
+ clamp(uchar4 value, uchar4 min_value, uchar4 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern short __attribute__((const, overloadable))
+ clamp(short value, short min_value, short max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern short2 __attribute__((const, overloadable))
+ clamp(short2 value, short2 min_value, short2 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern short3 __attribute__((const, overloadable))
+ clamp(short3 value, short3 min_value, short3 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern short4 __attribute__((const, overloadable))
+ clamp(short4 value, short4 min_value, short4 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern ushort __attribute__((const, overloadable))
+ clamp(ushort value, ushort min_value, ushort max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern ushort2 __attribute__((const, overloadable))
+ clamp(ushort2 value, ushort2 min_value, ushort2 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern ushort3 __attribute__((const, overloadable))
+ clamp(ushort3 value, ushort3 min_value, ushort3 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern ushort4 __attribute__((const, overloadable))
+ clamp(ushort4 value, ushort4 min_value, ushort4 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern int __attribute__((const, overloadable))
+ clamp(int value, int min_value, int max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern int2 __attribute__((const, overloadable))
+ clamp(int2 value, int2 min_value, int2 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern int3 __attribute__((const, overloadable))
+ clamp(int3 value, int3 min_value, int3 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern int4 __attribute__((const, overloadable))
+ clamp(int4 value, int4 min_value, int4 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern uint __attribute__((const, overloadable))
+ clamp(uint value, uint min_value, uint max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern uint2 __attribute__((const, overloadable))
+ clamp(uint2 value, uint2 min_value, uint2 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern uint3 __attribute__((const, overloadable))
+ clamp(uint3 value, uint3 min_value, uint3 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern uint4 __attribute__((const, overloadable))
+ clamp(uint4 value, uint4 min_value, uint4 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern long __attribute__((const, overloadable))
+ clamp(long value, long min_value, long max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern long2 __attribute__((const, overloadable))
+ clamp(long2 value, long2 min_value, long2 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern long3 __attribute__((const, overloadable))
+ clamp(long3 value, long3 min_value, long3 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern long4 __attribute__((const, overloadable))
+ clamp(long4 value, long4 min_value, long4 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern ulong __attribute__((const, overloadable))
+ clamp(ulong value, ulong min_value, ulong max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern ulong2 __attribute__((const, overloadable))
+ clamp(ulong2 value, ulong2 min_value, ulong2 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern ulong3 __attribute__((const, overloadable))
+ clamp(ulong3 value, ulong3 min_value, ulong3 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern ulong4 __attribute__((const, overloadable))
+ clamp(ulong4 value, ulong4 min_value, ulong4 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern char2 __attribute__((const, overloadable))
+ clamp(char2 value, char min_value, char max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern char3 __attribute__((const, overloadable))
+ clamp(char3 value, char min_value, char max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern char4 __attribute__((const, overloadable))
+ clamp(char4 value, char min_value, char max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern uchar2 __attribute__((const, overloadable))
+ clamp(uchar2 value, uchar min_value, uchar max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern uchar3 __attribute__((const, overloadable))
+ clamp(uchar3 value, uchar min_value, uchar max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern uchar4 __attribute__((const, overloadable))
+ clamp(uchar4 value, uchar min_value, uchar max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern short2 __attribute__((const, overloadable))
+ clamp(short2 value, short min_value, short max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern short3 __attribute__((const, overloadable))
+ clamp(short3 value, short min_value, short max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern short4 __attribute__((const, overloadable))
+ clamp(short4 value, short min_value, short max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern ushort2 __attribute__((const, overloadable))
+ clamp(ushort2 value, ushort min_value, ushort max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern ushort3 __attribute__((const, overloadable))
+ clamp(ushort3 value, ushort min_value, ushort max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern ushort4 __attribute__((const, overloadable))
+ clamp(ushort4 value, ushort min_value, ushort max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern int2 __attribute__((const, overloadable))
+ clamp(int2 value, int min_value, int max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern int3 __attribute__((const, overloadable))
+ clamp(int3 value, int min_value, int max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern int4 __attribute__((const, overloadable))
+ clamp(int4 value, int min_value, int max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern uint2 __attribute__((const, overloadable))
+ clamp(uint2 value, uint min_value, uint max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern uint3 __attribute__((const, overloadable))
+ clamp(uint3 value, uint min_value, uint max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern uint4 __attribute__((const, overloadable))
+ clamp(uint4 value, uint min_value, uint max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern long2 __attribute__((const, overloadable))
+ clamp(long2 value, long min_value, long max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern long3 __attribute__((const, overloadable))
+ clamp(long3 value, long min_value, long max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern long4 __attribute__((const, overloadable))
+ clamp(long4 value, long min_value, long max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern ulong2 __attribute__((const, overloadable))
+ clamp(ulong2 value, ulong min_value, ulong max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern ulong3 __attribute__((const, overloadable))
+ clamp(ulong3 value, ulong min_value, ulong max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 19))
+extern ulong4 __attribute__((const, overloadable))
+ clamp(ulong4 value, ulong min_value, ulong max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ clamp(half value, half min_value, half max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ clamp(half2 value, half2 min_value, half2 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ clamp(half3 value, half3 min_value, half3 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ clamp(half4 value, half4 min_value, half4 max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ clamp(half2 value, half min_value, half max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ clamp(half3 value, half min_value, half max_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ clamp(half4 value, half min_value, half max_value);
+#endif
+
+/*
+ * clz: Number of leading 0 bits
+ *
+ * Returns the number of leading 0-bits in a value.
+ *
+ * For example, clz((char)0x03) returns 6.
+ */
+extern char __attribute__((const, overloadable))
+ clz(char value);
+
+extern char2 __attribute__((const, overloadable))
+ clz(char2 value);
+
+extern char3 __attribute__((const, overloadable))
+ clz(char3 value);
+
+extern char4 __attribute__((const, overloadable))
+ clz(char4 value);
+
+extern uchar __attribute__((const, overloadable))
+ clz(uchar value);
+
+extern uchar2 __attribute__((const, overloadable))
+ clz(uchar2 value);
+
+extern uchar3 __attribute__((const, overloadable))
+ clz(uchar3 value);
+
+extern uchar4 __attribute__((const, overloadable))
+ clz(uchar4 value);
+
+extern short __attribute__((const, overloadable))
+ clz(short value);
+
+extern short2 __attribute__((const, overloadable))
+ clz(short2 value);
+
+extern short3 __attribute__((const, overloadable))
+ clz(short3 value);
+
+extern short4 __attribute__((const, overloadable))
+ clz(short4 value);
+
+extern ushort __attribute__((const, overloadable))
+ clz(ushort value);
+
+extern ushort2 __attribute__((const, overloadable))
+ clz(ushort2 value);
+
+extern ushort3 __attribute__((const, overloadable))
+ clz(ushort3 value);
+
+extern ushort4 __attribute__((const, overloadable))
+ clz(ushort4 value);
+
+extern int __attribute__((const, overloadable))
+ clz(int value);
+
+extern int2 __attribute__((const, overloadable))
+ clz(int2 value);
+
+extern int3 __attribute__((const, overloadable))
+ clz(int3 value);
+
+extern int4 __attribute__((const, overloadable))
+ clz(int4 value);
+
+extern uint __attribute__((const, overloadable))
+ clz(uint value);
+
+extern uint2 __attribute__((const, overloadable))
+ clz(uint2 value);
+
+extern uint3 __attribute__((const, overloadable))
+ clz(uint3 value);
+
+extern uint4 __attribute__((const, overloadable))
+ clz(uint4 value);
+
+/*
+ * 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.
+ */
+extern float __attribute__((const, overloadable))
+ copysign(float magnitude_value, float sign_value);
+
+extern float2 __attribute__((const, overloadable))
+ copysign(float2 magnitude_value, float2 sign_value);
+
+extern float3 __attribute__((const, overloadable))
+ copysign(float3 magnitude_value, float3 sign_value);
+
+extern float4 __attribute__((const, overloadable))
+ copysign(float4 magnitude_value, float4 sign_value);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ copysign(half magnitude_value, half sign_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ copysign(half2 magnitude_value, half2 sign_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ copysign(half3 magnitude_value, half3 sign_value);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ copysign(half4 magnitude_value, half4 sign_value);
+#endif
+
+/*
+ * cos: Cosine
+ *
+ * Returns the cosine of an angle measured in radians.
+ *
+ * See also native_cos().
+ */
+extern float __attribute__((const, overloadable))
+ cos(float v);
+
+extern float2 __attribute__((const, overloadable))
+ cos(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+ cos(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+ cos(float4 v);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ cos(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ cos(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ cos(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ cos(half4 v);
+#endif
+
+/*
+ * cosh: Hypebolic cosine
+ *
+ * Returns the hypebolic cosine of v, where v is measured in radians.
+ *
+ * See also native_cosh().
+ */
+extern float __attribute__((const, overloadable))
+ cosh(float v);
+
+extern float2 __attribute__((const, overloadable))
+ cosh(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+ cosh(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+ cosh(float4 v);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ cosh(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ cosh(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ cosh(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ cosh(half4 v);
+#endif
+
+/*
+ * cospi: Cosine of a number multiplied by pi
+ *
+ * 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).
+ *
+ * See also native_cospi().
+ */
+extern float __attribute__((const, overloadable))
+ cospi(float v);
+
+extern float2 __attribute__((const, overloadable))
+ cospi(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+ cospi(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+ cospi(float4 v);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ cospi(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ cospi(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ cospi(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ cospi(half4 v);
+#endif
+
+/*
+ * degrees: Converts radians into degrees
+ *
+ * Converts from radians to degrees.
+ */
+extern float __attribute__((const, overloadable))
+ degrees(float v);
+
+extern float2 __attribute__((const, overloadable))
+ degrees(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+ degrees(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+ degrees(float4 v);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ degrees(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ degrees(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ degrees(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ degrees(half4 v);
+#endif
+
+/*
+ * erf: Mathematical error function
+ *
+ * Returns the error function.
+ */
+extern float __attribute__((const, overloadable))
+ erf(float v);
+
+extern float2 __attribute__((const, overloadable))
+ erf(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+ erf(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+ erf(float4 v);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ erf(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ erf(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ erf(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ erf(half4 v);
+#endif
+
+/*
+ * erfc: Mathematical complementary error function
+ *
+ * Returns the complementary error function.
+ */
+extern float __attribute__((const, overloadable))
+ erfc(float v);
+
+extern float2 __attribute__((const, overloadable))
+ erfc(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+ erfc(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+ erfc(float4 v);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ erfc(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ erfc(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ erfc(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ erfc(half4 v);
+#endif
+
+/*
+ * exp: e raised to a number
+ *
+ * Returns e raised to v, i.e. e ^ v.
+ *
+ * See also native_exp().
+ */
+extern float __attribute__((const, overloadable))
+ exp(float 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);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ exp(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ exp(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ exp(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ exp(half4 v);
+#endif
+
+/*
+ * exp10: 10 raised to a number
+ *
+ * Returns 10 raised to v, i.e. 10.f ^ v.
+ *
+ * See also native_exp10().
+ */
+extern float __attribute__((const, overloadable))
+ exp10(float 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);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ exp10(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ exp10(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ exp10(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ exp10(half4 v);
+#endif
+
+/*
+ * exp2: 2 raised to a number
+ *
+ * Returns 2 raised to v, i.e. 2.f ^ v.
+ *
+ * See also native_exp2().
+ */
+extern float __attribute__((const, overloadable))
+ exp2(float 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);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ exp2(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ exp2(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ exp2(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ exp2(half4 v);
+#endif
+
+/*
+ * expm1: e raised to a number minus one
+ *
+ * Returns e raised to v minus 1, i.e. (e ^ v) - 1.
+ *
+ * See also native_expm1().
+ */
+extern float __attribute__((const, overloadable))
+ expm1(float v);
+
+extern float2 __attribute__((const, overloadable))
+ expm1(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+ expm1(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+ expm1(float4 v);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ expm1(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ expm1(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ expm1(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ expm1(half4 v);
+#endif
+
+/*
+ * fabs: Absolute value of a float
+ *
+ * Returns the absolute value of the float v.
+ *
+ * For integers, use abs().
+ */
+extern float __attribute__((const, overloadable))
+ fabs(float v);
+
+extern float2 __attribute__((const, overloadable))
+ fabs(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+ fabs(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+ fabs(float4 v);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ fabs(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ fabs(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ fabs(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ fabs(half4 v);
+#endif
+
+/*
+ * fdim: Positive difference between two values
+ *
+ * Returns the positive difference between two values.
+ *
+ * If a > b, returns (a - b) otherwise returns 0f.
+ */
+extern float __attribute__((const, overloadable))
+ fdim(float a, float b);
+
+extern float2 __attribute__((const, overloadable))
+ fdim(float2 a, float2 b);
+
+extern float3 __attribute__((const, overloadable))
+ fdim(float3 a, float3 b);
+
+extern float4 __attribute__((const, overloadable))
+ fdim(float4 a, float4 b);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ fdim(half a, half b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ fdim(half2 a, half2 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ fdim(half3 a, half3 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ fdim(half4 a, half4 b);
+#endif
+
+/*
+ * floor: Smallest integer not greater than a value
+ *
+ * Returns the smallest integer not greater than a value.
+ *
+ * For example, floor(1.2f) returns 1.f, and floor(-1.2f) returns -2.f.
+ *
+ * See also ceil().
+ */
+extern float __attribute__((const, overloadable))
+ floor(float v);
+
+extern float2 __attribute__((const, overloadable))
+ floor(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+ floor(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+ floor(float4 v);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ floor(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ floor(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ floor(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ floor(half4 v);
+#endif
+
+/*
+ * fma: Multiply and add
+ *
+ * Multiply and add. Returns (multiplicand1 * multiplicand2) + offset.
+ *
+ * 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);
+
+extern float2 __attribute__((const, overloadable))
+ fma(float2 multiplicand1, float2 multiplicand2, float2 offset);
+
+extern float3 __attribute__((const, overloadable))
+ fma(float3 multiplicand1, float3 multiplicand2, float3 offset);
+
+extern float4 __attribute__((const, overloadable))
+ fma(float4 multiplicand1, float4 multiplicand2, float4 offset);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ fma(half multiplicand1, half multiplicand2, half offset);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ fma(half2 multiplicand1, half2 multiplicand2, half2 offset);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ fma(half3 multiplicand1, half3 multiplicand2, half3 offset);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ fma(half4 multiplicand1, half4 multiplicand2, half4 offset);
+#endif
+
+/*
+ * 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.
+ */
+extern float __attribute__((const, overloadable))
+ fmax(float a, float b);
+
+extern float2 __attribute__((const, overloadable))
+ fmax(float2 a, float2 b);
+
+extern float3 __attribute__((const, overloadable))
+ fmax(float3 a, float3 b);
+
+extern float4 __attribute__((const, overloadable))
+ fmax(float4 a, float4 b);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ fmax(half a, half b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ fmax(half2 a, half2 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ fmax(half3 a, half3 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ fmax(half4 a, half4 b);
+#endif
+
+extern float2 __attribute__((const, overloadable))
+ fmax(float2 a, float b);
+
+extern float3 __attribute__((const, overloadable))
+ fmax(float3 a, float b);
+
+extern float4 __attribute__((const, overloadable))
+ fmax(float4 a, float b);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ fmax(half2 a, half b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ fmax(half3 a, half b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ fmax(half4 a, half b);
+#endif
+
+/*
+ * 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.
+ */
+extern float __attribute__((const, overloadable))
+ fmin(float a, float b);
+
+extern float2 __attribute__((const, overloadable))
+ fmin(float2 a, float2 b);
+
+extern float3 __attribute__((const, overloadable))
+ fmin(float3 a, float3 b);
+
+extern float4 __attribute__((const, overloadable))
+ fmin(float4 a, float4 b);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ fmin(half a, half b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ fmin(half2 a, half2 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ fmin(half3 a, half3 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ fmin(half4 a, half4 b);
+#endif
+
+extern float2 __attribute__((const, overloadable))
+ fmin(float2 a, float b);
+
+extern float3 __attribute__((const, overloadable))
+ fmin(float3 a, float b);
+
+extern float4 __attribute__((const, overloadable))
+ fmin(float4 a, float b);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ fmin(half2 a, half b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ fmin(half3 a, half b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ fmin(half4 a, half b);
+#endif
+
+/*
+ * 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).
+ */
+extern float __attribute__((const, overloadable))
+ fmod(float numerator, float denominator);
+
+extern float2 __attribute__((const, overloadable))
+ fmod(float2 numerator, float2 denominator);
+
+extern float3 __attribute__((const, overloadable))
+ fmod(float3 numerator, float3 denominator);
+
+extern float4 __attribute__((const, overloadable))
+ fmod(float4 numerator, float4 denominator);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ fmod(half numerator, half denominator);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ fmod(half2 numerator, half2 denominator);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ fmod(half3 numerator, half3 denominator);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ fmod(half4 numerator, half4 denominator);
+#endif
+
+/*
+ * 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.
+ *
+ * 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);
+
+extern float2 __attribute__((overloadable))
+ fract(float2 v, float2* floor);
+
+extern float3 __attribute__((overloadable))
+ fract(float3 v, float3* floor);
+
+extern float4 __attribute__((overloadable))
+ fract(float4 v, float4* floor);
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 23)
+static inline float __attribute__((const, overloadable))
+ fract(float v) {
+ float unused;
+ return fract(v, &unused);
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 23)
+static inline float2 __attribute__((const, overloadable))
+ fract(float2 v) {
+ float2 unused;
+ return fract(v, &unused);
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 23)
+static inline float3 __attribute__((const, overloadable))
+ fract(float3 v) {
+ float3 unused;
+ return fract(v, &unused);
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 23)
+static inline float4 __attribute__((const, overloadable))
+ fract(float4 v) {
+ float4 unused;
+ return fract(v, &unused);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern float __attribute__((overloadable))
+ fract(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern float2 __attribute__((overloadable))
+ fract(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern float3 __attribute__((overloadable))
+ fract(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern float4 __attribute__((overloadable))
+ fract(float4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((overloadable))
+ fract(half v, half* floor);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((overloadable))
+ fract(half2 v, half2* floor);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((overloadable))
+ fract(half3 v, half3* floor);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((overloadable))
+ fract(half4 v, half4* floor);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((overloadable))
+ fract(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((overloadable))
+ fract(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((overloadable))
+ fract(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((overloadable))
+ fract(half4 v);
+#endif
+
+/*
+ * 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. See also logb() and ilogb().
+ *
+ * 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);
+
+extern float2 __attribute__((overloadable))
+ frexp(float2 v, int2* exponent);
+
+extern float3 __attribute__((overloadable))
+ frexp(float3 v, int3* exponent);
+
+extern float4 __attribute__((overloadable))
+ frexp(float4 v, int4* exponent);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((overloadable))
+ frexp(half v, int* exponent);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((overloadable))
+ frexp(half2 v, int2* exponent);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((overloadable))
+ frexp(half3 v, int3* exponent);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((overloadable))
+ frexp(half4 v, int4* exponent);
+#endif
+
+/*
+ * 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.
+ *
+ * See also native_recip().
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern float __attribute__((const, overloadable))
+ half_recip(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern float2 __attribute__((const, overloadable))
+ half_recip(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern float3 __attribute__((const, overloadable))
+ half_recip(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern float4 __attribute__((const, overloadable))
+ half_recip(float4 v);
+#endif
+
+/*
+ * 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.
+ *
+ * See also rsqrt(), native_rsqrt().
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern float __attribute__((const, overloadable))
+ half_rsqrt(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern float2 __attribute__((const, overloadable))
+ half_rsqrt(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern float3 __attribute__((const, overloadable))
+ half_rsqrt(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern float4 __attribute__((const, overloadable))
+ half_rsqrt(float4 v);
+#endif
+
+/*
+ * 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.
+ *
+ * See also sqrt(), native_sqrt().
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern float __attribute__((const, overloadable))
+ half_sqrt(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern float2 __attribute__((const, overloadable))
+ half_sqrt(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern float3 __attribute__((const, overloadable))
+ half_sqrt(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern float4 __attribute__((const, overloadable))
+ half_sqrt(float4 v);
+#endif
+
+/*
+ * hypot: Hypotenuse
+ *
+ * Returns the hypotenuse, i.e. sqrt(a * a + b * b).
+ *
+ * See also native_hypot().
+ */
+extern float __attribute__((const, overloadable))
+ hypot(float a, float b);
+
+extern float2 __attribute__((const, overloadable))
+ hypot(float2 a, float2 b);
+
+extern float3 __attribute__((const, overloadable))
+ hypot(float3 a, float3 b);
+
+extern float4 __attribute__((const, overloadable))
+ hypot(float4 a, float4 b);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ hypot(half a, half b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ hypot(half2 a, half2 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ hypot(half3 a, half3 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ hypot(half4 a, half4 b);
+#endif
+
+/*
+ * ilogb: Base two exponent
+ *
+ * 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.
+ */
+extern int __attribute__((const, overloadable))
+ ilogb(float v);
+
+extern int2 __attribute__((const, overloadable))
+ ilogb(float2 v);
+
+extern int3 __attribute__((const, overloadable))
+ ilogb(float3 v);
+
+extern int4 __attribute__((const, overloadable))
+ ilogb(float4 v);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern int __attribute__((const, overloadable))
+ ilogb(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern int2 __attribute__((const, overloadable))
+ ilogb(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern int3 __attribute__((const, overloadable))
+ ilogb(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern int4 __attribute__((const, overloadable))
+ ilogb(half4 v);
+#endif
+
+/*
+ * 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.
+ *
+ * Parameters:
+ * mantissa: Mantissa.
+ * exponent: Exponent, a single component or matching vector.
+ */
+extern float __attribute__((const, overloadable))
+ ldexp(float mantissa, int exponent);
+
+extern float2 __attribute__((const, overloadable))
+ ldexp(float2 mantissa, int2 exponent);
+
+extern float3 __attribute__((const, overloadable))
+ ldexp(float3 mantissa, int3 exponent);
+
+extern float4 __attribute__((const, overloadable))
+ ldexp(float4 mantissa, int4 exponent);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ ldexp(half mantissa, int exponent);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ ldexp(half2 mantissa, int2 exponent);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ ldexp(half3 mantissa, int3 exponent);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ ldexp(half4 mantissa, int4 exponent);
+#endif
+
+extern float2 __attribute__((const, overloadable))
+ ldexp(float2 mantissa, int exponent);
+
+extern float3 __attribute__((const, overloadable))
+ ldexp(float3 mantissa, int exponent);
+
+extern float4 __attribute__((const, overloadable))
+ ldexp(float4 mantissa, int exponent);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ ldexp(half2 mantissa, int exponent);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ ldexp(half3 mantissa, int exponent);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ ldexp(half4 mantissa, int exponent);
+#endif
+
+/*
+ * lgamma: Natural logarithm of the gamma function
+ *
+ * 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))
+ lgamma(float v);
+
+extern float2 __attribute__((const, overloadable))
+ lgamma(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+ lgamma(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+ lgamma(float4 v);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ lgamma(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ lgamma(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ lgamma(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ lgamma(half4 v);
+#endif
+
+extern float __attribute__((overloadable))
+ lgamma(float v, int* sign_of_gamma);
+
+extern float2 __attribute__((overloadable))
+ lgamma(float2 v, int2* sign_of_gamma);
+
+extern float3 __attribute__((overloadable))
+ lgamma(float3 v, int3* sign_of_gamma);
+
+extern float4 __attribute__((overloadable))
+ lgamma(float4 v, int4* sign_of_gamma);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((overloadable))
+ lgamma(half v, int* sign_of_gamma);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((overloadable))
+ lgamma(half2 v, int2* sign_of_gamma);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((overloadable))
+ lgamma(half3 v, int3* sign_of_gamma);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((overloadable))
+ lgamma(half4 v, int4* sign_of_gamma);
+#endif
+
+/*
+ * log: Natural logarithm
+ *
+ * Returns the natural logarithm.
+ *
+ * See also native_log().
+ */
+extern float __attribute__((const, overloadable))
+ log(float v);
+
+extern float2 __attribute__((const, overloadable))
+ log(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+ log(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+ log(float4 v);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ log(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ log(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ log(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ log(half4 v);
+#endif
+
+/*
+ * log10: Base 10 logarithm
+ *
+ * Returns the base 10 logarithm.
+ *
+ * See also native_log10().
+ */
+extern float __attribute__((const, overloadable))
+ log10(float v);
+
+extern float2 __attribute__((const, overloadable))
+ log10(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+ log10(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+ log10(float4 v);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ log10(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ log10(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ log10(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ log10(half4 v);
+#endif
+
+/*
+ * log1p: Natural logarithm of a value plus 1
+ *
+ * Returns the natural logarithm of (v + 1.f).
+ *
+ * See also native_log1p().
+ */
+extern float __attribute__((const, overloadable))
+ log1p(float v);
+
+extern float2 __attribute__((const, overloadable))
+ log1p(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+ log1p(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+ log1p(float4 v);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ log1p(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ log1p(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ log1p(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ log1p(half4 v);
+#endif
+
+/*
+ * log2: Base 2 logarithm
+ *
+ * Returns the base 2 logarithm.
+ *
+ * See also native_log2().
+ */
+extern float __attribute__((const, overloadable))
+ log2(float v);
+
+extern float2 __attribute__((const, overloadable))
+ log2(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+ log2(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+ log2(float4 v);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ log2(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ log2(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ log2(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ log2(half4 v);
+#endif
+
+/*
+ * logb: Base two exponent
+ *
+ * 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.
+ */
+extern float __attribute__((const, overloadable))
+ logb(float v);
+
+extern float2 __attribute__((const, overloadable))
+ logb(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+ logb(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+ logb(float4 v);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ logb(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ logb(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ logb(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ logb(half4 v);
+#endif
+
+/*
+ * mad: Multiply and add
+ *
+ * Multiply and add. Returns (multiplicand1 * multiplicand2) + offset.
+ *
+ * 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);
+
+extern float2 __attribute__((const, overloadable))
+ mad(float2 multiplicand1, float2 multiplicand2, float2 offset);
+
+extern float3 __attribute__((const, overloadable))
+ mad(float3 multiplicand1, float3 multiplicand2, float3 offset);
+
+extern float4 __attribute__((const, overloadable))
+ mad(float4 multiplicand1, float4 multiplicand2, float4 offset);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ mad(half multiplicand1, half multiplicand2, half offset);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ mad(half2 multiplicand1, half2 multiplicand2, half2 offset);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ mad(half3 multiplicand1, half3 multiplicand2, half3 offset);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ mad(half4 multiplicand1, half4 multiplicand2, half4 offset);
+#endif
+
+/*
+ * max: Maximum
+ *
+ * Returns the maximum value of two arguments.
+ */
+extern float __attribute__((const, overloadable))
+ max(float a, float b);
+
+extern float2 __attribute__((const, overloadable))
+ max(float2 a, float2 b);
+
+extern float3 __attribute__((const, overloadable))
+ max(float3 a, float3 b);
+
+extern float4 __attribute__((const, overloadable))
+ max(float4 a, float4 b);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ max(half a, half b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ max(half2 a, half2 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ max(half3 a, half3 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ max(half4 a, half4 b);
+#endif
+
+extern float2 __attribute__((const, overloadable))
+ max(float2 a, float b);
+
+extern float3 __attribute__((const, overloadable))
+ max(float3 a, float b);
+
+extern float4 __attribute__((const, overloadable))
+ max(float4 a, float b);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ max(half2 a, half b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ max(half3 a, half b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ max(half4 a, half b);
+#endif
+
+#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 <= 20)
+static inline uchar __attribute__((const, overloadable))
+ max(uchar a, uchar b) {
+ return (a > b ? a : b);
+}
+#endif
+
+#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 <= 20)
+static inline ushort __attribute__((const, overloadable))
+ max(ushort a, ushort b) {
+ return (a > b ? a : b);
+}
+#endif
+
+#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 <= 20)
+static inline uint __attribute__((const, overloadable))
+ max(uint a, uint b) {
+ return (a > b ? a : b);
+}
+#endif
+
+#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 <= 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 <= 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 <= 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 <= 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 <= 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 <= 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 <= 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 <= 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 <= 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 <= 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 <= 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 <= 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 <= 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 <= 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 <= 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 <= 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 <= 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))
+extern char __attribute__((const, overloadable))
+ max(char a, char b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern char2 __attribute__((const, overloadable))
+ max(char2 a, char2 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern char3 __attribute__((const, overloadable))
+ max(char3 a, char3 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern char4 __attribute__((const, overloadable))
+ max(char4 a, char4 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern uchar __attribute__((const, overloadable))
+ max(uchar a, uchar b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern uchar2 __attribute__((const, overloadable))
+ max(uchar2 a, uchar2 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern uchar3 __attribute__((const, overloadable))
+ max(uchar3 a, uchar3 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern uchar4 __attribute__((const, overloadable))
+ max(uchar4 a, uchar4 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern short __attribute__((const, overloadable))
+ max(short a, short b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern short2 __attribute__((const, overloadable))
+ max(short2 a, short2 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern short3 __attribute__((const, overloadable))
+ max(short3 a, short3 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern short4 __attribute__((const, overloadable))
+ max(short4 a, short4 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ushort __attribute__((const, overloadable))
+ max(ushort a, ushort b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ushort2 __attribute__((const, overloadable))
+ max(ushort2 a, ushort2 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ushort3 __attribute__((const, overloadable))
+ max(ushort3 a, ushort3 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ushort4 __attribute__((const, overloadable))
+ max(ushort4 a, ushort4 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern int __attribute__((const, overloadable))
+ max(int a, int b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern int2 __attribute__((const, overloadable))
+ max(int2 a, int2 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern int3 __attribute__((const, overloadable))
+ max(int3 a, int3 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern int4 __attribute__((const, overloadable))
+ max(int4 a, int4 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern uint __attribute__((const, overloadable))
+ max(uint a, uint b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern uint2 __attribute__((const, overloadable))
+ max(uint2 a, uint2 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern uint3 __attribute__((const, overloadable))
+ max(uint3 a, uint3 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern uint4 __attribute__((const, overloadable))
+ max(uint4 a, uint4 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern long __attribute__((const, overloadable))
+ max(long a, long b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern long2 __attribute__((const, overloadable))
+ max(long2 a, long2 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern long3 __attribute__((const, overloadable))
+ max(long3 a, long3 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern long4 __attribute__((const, overloadable))
+ max(long4 a, long4 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ulong __attribute__((const, overloadable))
+ max(ulong a, ulong b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ulong2 __attribute__((const, overloadable))
+ max(ulong2 a, ulong2 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ulong3 __attribute__((const, overloadable))
+ max(ulong3 a, ulong3 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ulong4 __attribute__((const, overloadable))
+ max(ulong4 a, ulong4 b);
+#endif
+
+/*
+ * min: Minimum
+ *
+ * Returns the minimum value of two arguments.
+ */
+extern float __attribute__((const, overloadable))
+ min(float a, float b);
+
+extern float2 __attribute__((const, overloadable))
+ min(float2 a, float2 b);
+
+extern float3 __attribute__((const, overloadable))
+ min(float3 a, float3 b);
+
+extern float4 __attribute__((const, overloadable))
+ min(float4 a, float4 b);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ min(half a, half b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ min(half2 a, half2 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ min(half3 a, half3 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ min(half4 a, half4 b);
+#endif
+
+extern float2 __attribute__((const, overloadable))
+ min(float2 a, float b);
+
+extern float3 __attribute__((const, overloadable))
+ min(float3 a, float b);
+
+extern float4 __attribute__((const, overloadable))
+ min(float4 a, float b);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ min(half2 a, half b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ min(half3 a, half b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ min(half4 a, half b);
+#endif
+
+#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 <= 20)
+static inline uchar __attribute__((const, overloadable))
+ min(uchar a, uchar b) {
+ return (a < b ? a : b);
+}
+#endif
+
+#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 <= 20)
+static inline ushort __attribute__((const, overloadable))
+ min(ushort a, ushort b) {
+ return (a < b ? a : b);
+}
+#endif
+
+#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 <= 20)
+static inline uint __attribute__((const, overloadable))
+ min(uint a, uint b) {
+ return (a < b ? a : b);
+}
+#endif
+
+#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 <= 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 <= 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 <= 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 <= 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 <= 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 <= 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 <= 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 <= 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 <= 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 <= 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 <= 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 <= 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 <= 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 <= 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 <= 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 <= 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 <= 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))
+extern char __attribute__((const, overloadable))
+ min(char a, char b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern char2 __attribute__((const, overloadable))
+ min(char2 a, char2 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern char3 __attribute__((const, overloadable))
+ min(char3 a, char3 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern char4 __attribute__((const, overloadable))
+ min(char4 a, char4 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern uchar __attribute__((const, overloadable))
+ min(uchar a, uchar b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern uchar2 __attribute__((const, overloadable))
+ min(uchar2 a, uchar2 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern uchar3 __attribute__((const, overloadable))
+ min(uchar3 a, uchar3 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern uchar4 __attribute__((const, overloadable))
+ min(uchar4 a, uchar4 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern short __attribute__((const, overloadable))
+ min(short a, short b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern short2 __attribute__((const, overloadable))
+ min(short2 a, short2 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern short3 __attribute__((const, overloadable))
+ min(short3 a, short3 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern short4 __attribute__((const, overloadable))
+ min(short4 a, short4 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ushort __attribute__((const, overloadable))
+ min(ushort a, ushort b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ushort2 __attribute__((const, overloadable))
+ min(ushort2 a, ushort2 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ushort3 __attribute__((const, overloadable))
+ min(ushort3 a, ushort3 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ushort4 __attribute__((const, overloadable))
+ min(ushort4 a, ushort4 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern int __attribute__((const, overloadable))
+ min(int a, int b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern int2 __attribute__((const, overloadable))
+ min(int2 a, int2 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern int3 __attribute__((const, overloadable))
+ min(int3 a, int3 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern int4 __attribute__((const, overloadable))
+ min(int4 a, int4 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern uint __attribute__((const, overloadable))
+ min(uint a, uint b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern uint2 __attribute__((const, overloadable))
+ min(uint2 a, uint2 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern uint3 __attribute__((const, overloadable))
+ min(uint3 a, uint3 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern uint4 __attribute__((const, overloadable))
+ min(uint4 a, uint4 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern long __attribute__((const, overloadable))
+ min(long a, long b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern long2 __attribute__((const, overloadable))
+ min(long2 a, long2 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern long3 __attribute__((const, overloadable))
+ min(long3 a, long3 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern long4 __attribute__((const, overloadable))
+ min(long4 a, long4 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ulong __attribute__((const, overloadable))
+ min(ulong a, ulong b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ulong2 __attribute__((const, overloadable))
+ min(ulong2 a, ulong2 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ulong3 __attribute__((const, overloadable))
+ min(ulong3 a, ulong3 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern ulong4 __attribute__((const, overloadable))
+ min(ulong4 a, ulong4 b);
+#endif
+
+/*
+ * 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).
+ */
+extern float __attribute__((const, overloadable))
+ mix(float start, float stop, float fraction);
+
+extern float2 __attribute__((const, overloadable))
+ mix(float2 start, float2 stop, float2 fraction);
+
+extern float3 __attribute__((const, overloadable))
+ mix(float3 start, float3 stop, float3 fraction);
+
+extern float4 __attribute__((const, overloadable))
+ mix(float4 start, float4 stop, float4 fraction);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ mix(half start, half stop, half fraction);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ mix(half2 start, half2 stop, half2 fraction);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ mix(half3 start, half3 stop, half3 fraction);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ mix(half4 start, half4 stop, half4 fraction);
+#endif
+
+extern float2 __attribute__((const, overloadable))
+ mix(float2 start, float2 stop, float fraction);
+
+extern float3 __attribute__((const, overloadable))
+ mix(float3 start, float3 stop, float fraction);
+
+extern float4 __attribute__((const, overloadable))
+ mix(float4 start, float4 stop, float fraction);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ mix(half2 start, half2 stop, half fraction);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ mix(half3 start, half3 stop, half fraction);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ mix(half4 start, half4 stop, half fraction);
+#endif
+
+/*
+ * 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,
+ * *integral_part will be set to -3.f and .72f will be returned.
+ *
+ * Parameters:
+ * v: Source value.
+ * integral_part: *integral_part will be set to the integral portion of the number.
+ *
+ * Returns: Floating point portion of the value.
+ */
+extern float __attribute__((overloadable))
+ modf(float v, float* integral_part);
+
+extern float2 __attribute__((overloadable))
+ modf(float2 v, float2* integral_part);
+
+extern float3 __attribute__((overloadable))
+ modf(float3 v, float3* integral_part);
+
+extern float4 __attribute__((overloadable))
+ modf(float4 v, float4* integral_part);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((overloadable))
+ modf(half v, half* integral_part);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((overloadable))
+ modf(half2 v, half2* integral_part);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((overloadable))
+ modf(half3 v, half3* integral_part);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((overloadable))
+ modf(half4 v, half4* integral_part);
+#endif
+
+/*
+ * nan: Not a Number
+ *
+ * Returns a NaN value (Not a Number).
+ *
+ * Parameters:
+ * v: Not used.
+ */
+extern float __attribute__((const, overloadable))
+ nan(uint v);
+
+/*
+ * nan_half: Not a Number
+ *
+ * Returns a half-precision floating point NaN value (Not a Number).
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ nan_half(void);
+#endif
+
+/*
+ * native_acos: Approximate inverse cosine
+ *
+ * Returns the approximate inverse cosine, in radians.
+ *
+ * This function yields undefined results from input values less than -1 or greater than 1.
+ *
+ * See also acos().
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+ native_acos(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+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
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ native_acos(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ native_acos(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ native_acos(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ native_acos(half4 v);
+#endif
+
+/*
+ * native_acosh: Approximate inverse hyperbolic cosine
+ *
+ * Returns the approximate inverse hyperbolic cosine, in radians.
+ *
+ * See also acosh().
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+ native_acosh(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+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
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ native_acosh(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ native_acosh(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ native_acosh(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ native_acosh(half4 v);
+#endif
+
+/*
+ * native_acospi: Approximate inverse cosine divided by pi
+ *
+ * Returns the approximate inverse cosine in radians, divided by pi.
+ *
+ * To get an inverse cosine measured in degrees, use acospi(a) * 180.f.
+ *
+ * This function yields undefined results from input values less than -1 or greater than 1.
+ *
+ * See also acospi().
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+ native_acospi(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float2 __attribute__((const, overloadable))
+ native_acospi(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float3 __attribute__((const, overloadable))
+ native_acospi(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float4 __attribute__((const, overloadable))
+ native_acospi(float4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ native_acospi(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ native_acospi(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ native_acospi(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ native_acospi(half4 v);
+#endif
+
+/*
+ * native_asin: Approximate inverse sine
+ *
+ * Returns the approximate inverse sine, in radians.
+ *
+ * This function yields undefined results from input values less than -1 or greater than 1.
+ *
+ * See also asin().
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+ native_asin(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+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
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ native_asin(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ native_asin(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ native_asin(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ native_asin(half4 v);
+#endif
+
+/*
+ * native_asinh: Approximate inverse hyperbolic sine
+ *
+ * Returns the approximate inverse hyperbolic sine, in radians.
+ *
+ * See also asinh().
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+ native_asinh(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+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
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ native_asinh(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ native_asinh(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ native_asinh(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ native_asinh(half4 v);
+#endif
+
+/*
+ * native_asinpi: Approximate inverse sine divided by pi
+ *
+ * Returns the approximate inverse sine in radians, divided by pi.
+ *
+ * To get an inverse sine measured in degrees, use asinpi(a) * 180.f.
+ *
+ * This function yields undefined results from input values less than -1 or greater than 1.
+ *
+ * See also asinpi().
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+ native_asinpi(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float2 __attribute__((const, overloadable))
+ native_asinpi(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float3 __attribute__((const, overloadable))
+ native_asinpi(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float4 __attribute__((const, overloadable))
+ native_asinpi(float4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ native_asinpi(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ native_asinpi(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ native_asinpi(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ native_asinpi(half4 v);
+#endif
+
+/*
+ * native_atan: Approximate inverse tangent
+ *
+ * Returns the approximate inverse tangent, in radians.
+ *
+ * See also atan().
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+ native_atan(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float2 __attribute__((const, overloadable))
+ native_atan(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float3 __attribute__((const, overloadable))
+ native_atan(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float4 __attribute__((const, overloadable))
+ native_atan(float4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ native_atan(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ native_atan(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ native_atan(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ native_atan(half4 v);
+#endif
+
+/*
+ * native_atan2: Approximate inverse tangent of a ratio
+ *
+ * Returns the approximate inverse tangent of (numerator / denominator), in radians.
+ *
+ * See also atan2().
+ *
+ * Parameters:
+ * numerator: Numerator.
+ * denominator: Denominator. Can be 0.
+ */
+#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))
+extern float2 __attribute__((const, overloadable))
+ native_atan2(float2 numerator, float2 denominator);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float3 __attribute__((const, overloadable))
+ native_atan2(float3 numerator, float3 denominator);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float4 __attribute__((const, overloadable))
+ native_atan2(float4 numerator, float4 denominator);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ native_atan2(half numerator, half denominator);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ native_atan2(half2 numerator, half2 denominator);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ native_atan2(half3 numerator, half3 denominator);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ native_atan2(half4 numerator, half4 denominator);
+#endif
+
+/*
+ * native_atan2pi: Approximate inverse tangent of a ratio, 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.
+ *
+ * See also atan2pi().
+ *
+ * Parameters:
+ * numerator: Numerator.
+ * denominator: Denominator. Can be 0.
+ */
+#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))
+extern float2 __attribute__((const, overloadable))
+ native_atan2pi(float2 numerator, float2 denominator);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float3 __attribute__((const, overloadable))
+ native_atan2pi(float3 numerator, float3 denominator);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float4 __attribute__((const, overloadable))
+ native_atan2pi(float4 numerator, float4 denominator);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ native_atan2pi(half numerator, half denominator);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ native_atan2pi(half2 numerator, half2 denominator);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ native_atan2pi(half3 numerator, half3 denominator);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ native_atan2pi(half4 numerator, half4 denominator);
+#endif
+
+/*
+ * native_atanh: Approximate inverse hyperbolic tangent
+ *
+ * Returns the approximate inverse hyperbolic tangent, in radians.
+ *
+ * See also atanh().
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+ native_atanh(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+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
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ native_atanh(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ native_atanh(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ native_atanh(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ native_atanh(half4 v);
+#endif
+
+/*
+ * native_atanpi: Approximate inverse tangent divided by pi
+ *
+ * Returns the approximate inverse tangent in radians, divided by pi.
+ *
+ * To get an inverse tangent measured in degrees, use atanpi(a) * 180.f.
+ *
+ * See also atanpi().
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+ native_atanpi(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float2 __attribute__((const, overloadable))
+ native_atanpi(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float3 __attribute__((const, overloadable))
+ native_atanpi(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float4 __attribute__((const, overloadable))
+ native_atanpi(float4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ native_atanpi(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ native_atanpi(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ native_atanpi(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ native_atanpi(half4 v);
+#endif
+
+/*
+ * native_cbrt: Approximate cube root
+ *
+ * Returns the approximate cubic root.
+ *
+ * See also cbrt().
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+ native_cbrt(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+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
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ native_cbrt(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ native_cbrt(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ native_cbrt(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ native_cbrt(half4 v);
+#endif
+
+/*
+ * native_cos: Approximate cosine
+ *
+ * Returns the approximate cosine of an angle measured in radians.
+ *
+ * See also cos().
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+ native_cos(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+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
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ native_cos(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ native_cos(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ native_cos(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ native_cos(half4 v);
+#endif
+
+/*
+ * native_cosh: Approximate hypebolic cosine
+ *
+ * Returns the approximate hypebolic cosine.
+ *
+ * See also cosh().
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+ native_cosh(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+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
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ native_cosh(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ native_cosh(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ native_cosh(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ native_cosh(half4 v);
+#endif
+
+/*
+ * native_cospi: Approximate cosine of a number multiplied by pi
+ *
+ * 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).
+ *
+ * See also cospi().
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+ native_cospi(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float2 __attribute__((const, overloadable))
+ native_cospi(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float3 __attribute__((const, overloadable))
+ native_cospi(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float4 __attribute__((const, overloadable))
+ native_cospi(float4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ native_cospi(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ native_cospi(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ native_cospi(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ native_cospi(half4 v);
+#endif
+
+/*
+ * native_divide: Approximate division
+ *
+ * Computes the approximate division of two values.
+ */
+#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))
+extern float2 __attribute__((const, overloadable))
+ native_divide(float2 left_vector, float2 right_vector);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float3 __attribute__((const, overloadable))
+ native_divide(float3 left_vector, float3 right_vector);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float4 __attribute__((const, overloadable))
+ native_divide(float4 left_vector, float4 right_vector);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ native_divide(half left_vector, half right_vector);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ native_divide(half2 left_vector, half2 right_vector);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ native_divide(half3 left_vector, half3 right_vector);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ native_divide(half4 left_vector, half4 right_vector);
+#endif
+
+/*
+ * native_exp: Approximate e raised to a number
+ *
+ * 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.
+ *
+ * See also exp().
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern float __attribute__((const, overloadable))
+ native_exp(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern float2 __attribute__((const, overloadable))
+ native_exp(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern float3 __attribute__((const, overloadable))
+ native_exp(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern float4 __attribute__((const, overloadable))
+ native_exp(float4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ native_exp(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ native_exp(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ native_exp(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ native_exp(half4 v);
+#endif
+
+/*
+ * 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.
+ *
+ * See also exp10().
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern float __attribute__((const, overloadable))
+ native_exp10(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern float2 __attribute__((const, overloadable))
+ native_exp10(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern float3 __attribute__((const, overloadable))
+ native_exp10(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern float4 __attribute__((const, overloadable))
+ native_exp10(float4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ native_exp10(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ native_exp10(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ native_exp10(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ native_exp10(half4 v);
+#endif
+
+/*
+ * 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.
+ *
+ * See also exp2().
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern float __attribute__((const, overloadable))
+ native_exp2(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern float2 __attribute__((const, overloadable))
+ native_exp2(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern float3 __attribute__((const, overloadable))
+ native_exp2(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern float4 __attribute__((const, overloadable))
+ native_exp2(float4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ native_exp2(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ native_exp2(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ native_exp2(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ native_exp2(half4 v);
+#endif
+
+/*
+ * native_expm1: Approximate e raised to a number minus one
+ *
+ * Returns the approximate (e ^ v) - 1.
+ *
+ * See also expm1().
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+ native_expm1(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+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
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ native_expm1(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ native_expm1(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ native_expm1(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ native_expm1(half4 v);
+#endif
+
+/*
+ * native_hypot: Approximate hypotenuse
+ *
+ * Returns the approximate native_sqrt(a * a + b * b)
+ *
+ * See also hypot().
+ */
+#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))
+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
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ native_hypot(half a, half b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ native_hypot(half2 a, half2 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ native_hypot(half3 a, half3 b);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ native_hypot(half4 a, half4 b);
+#endif
+
+/*
+ * native_log: Approximate natural logarithm
+ *
+ * Fast approximate log.
+ *
+ * It is not accurate for values very close to zero.
+ *
+ * See also log().
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern float __attribute__((const, overloadable))
+ native_log(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern float2 __attribute__((const, overloadable))
+ native_log(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern float3 __attribute__((const, overloadable))
+ native_log(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern float4 __attribute__((const, overloadable))
+ native_log(float4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ native_log(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ native_log(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ native_log(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ native_log(half4 v);
+#endif
+
+/*
+ * native_log10: Approximate base 10 logarithm
+ *
+ * Fast approximate log10.
+ *
+ * It is not accurate for values very close to zero.
+ *
+ * See also log10().
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern float __attribute__((const, overloadable))
+ native_log10(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern float2 __attribute__((const, overloadable))
+ native_log10(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern float3 __attribute__((const, overloadable))
+ native_log10(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern float4 __attribute__((const, overloadable))
+ native_log10(float4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ native_log10(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ native_log10(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ native_log10(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ native_log10(half4 v);
+#endif
+
+/*
+ * native_log1p: Approximate natural logarithm of a value plus 1
+ *
+ * Returns the approximate natural logarithm of (v + 1.0f)
+ *
+ * See also log1p().
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+ native_log1p(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float2 __attribute__((const, overloadable))
+ native_log1p(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float3 __attribute__((const, overloadable))
+ native_log1p(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float4 __attribute__((const, overloadable))
+ native_log1p(float4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ native_log1p(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ native_log1p(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ native_log1p(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ native_log1p(half4 v);
+#endif
+
+/*
+ * native_log2: Approximate base 2 logarithm
+ *
+ * Fast approximate log2.
+ *
+ * It is not accurate for values very close to zero.
+ *
+ * See also log2().
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern float __attribute__((const, overloadable))
+ native_log2(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern float2 __attribute__((const, overloadable))
+ native_log2(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern float3 __attribute__((const, overloadable))
+ native_log2(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern float4 __attribute__((const, overloadable))
+ native_log2(float4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ native_log2(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ native_log2(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ native_log2(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ native_log2(half4 v);
+#endif
+
+/*
+ * native_powr: Approximate positive base raised to an exponent
+ *
+ * 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.
+ */
+#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))
+extern float2 __attribute__((const, overloadable))
+ native_powr(float2 base, float2 exponent);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern float3 __attribute__((const, overloadable))
+ native_powr(float3 base, float3 exponent);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 18))
+extern float4 __attribute__((const, overloadable))
+ native_powr(float4 base, float4 exponent);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ native_powr(half base, half exponent);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ native_powr(half2 base, half2 exponent);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ native_powr(half3 base, half3 exponent);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ native_powr(half4 base, half4 exponent);
+#endif
+
+/*
+ * native_recip: Approximate reciprocal
+ *
+ * Returns the approximate approximate reciprocal of a value.
+ *
+ * See also half_recip().
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+ native_recip(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+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
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ native_recip(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ native_recip(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ native_recip(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ native_recip(half4 v);
+#endif
+
+/*
+ * native_rootn: Approximate nth root
+ *
+ * Compute the approximate Nth root of a value.
+ *
+ * See also rootn().
+ */
+#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))
+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
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ native_rootn(half v, int n);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ native_rootn(half2 v, int2 n);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ native_rootn(half3 v, int3 n);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ native_rootn(half4 v, int4 n);
+#endif
+
+/*
+ * native_rsqrt: Approximate reciprocal of a square root
+ *
+ * Returns approximate (1 / sqrt(v)).
+ *
+ * See also rsqrt(), half_rsqrt().
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+ native_rsqrt(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+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
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ native_rsqrt(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ native_rsqrt(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ native_rsqrt(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ native_rsqrt(half4 v);
+#endif
+
+/*
+ * native_sin: Approximate sine
+ *
+ * Returns the approximate sine of an angle measured in radians.
+ *
+ * See also sin().
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+ native_sin(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+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
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ native_sin(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ native_sin(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ native_sin(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ native_sin(half4 v);
+#endif
+
+/*
+ * native_sincos: Approximate sine and cosine
+ *
+ * Returns the approximate sine and cosine of a value.
+ *
+ * See also sincos().
+ *
+ * Parameters:
+ * v: Incoming value in radians.
+ * cos: *cos will be set to the cosine value.
+ *
+ * Returns: Sine.
+ */
+#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))
+extern float2 __attribute__((overloadable))
+ native_sincos(float2 v, float2* cos);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float3 __attribute__((overloadable))
+ native_sincos(float3 v, float3* cos);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float4 __attribute__((overloadable))
+ native_sincos(float4 v, float4* cos);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((overloadable))
+ native_sincos(half v, half* cos);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((overloadable))
+ native_sincos(half2 v, half2* cos);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((overloadable))
+ native_sincos(half3 v, half3* cos);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((overloadable))
+ native_sincos(half4 v, half4* cos);
+#endif
+
+/*
+ * native_sinh: Approximate hyperbolic sine
+ *
+ * Returns the approximate hyperbolic sine of a value specified in radians.
+ *
+ * See also sinh().
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+ native_sinh(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+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
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ native_sinh(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ native_sinh(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ native_sinh(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ native_sinh(half4 v);
+#endif
+
+/*
+ * native_sinpi: Approximate sine of a number multiplied by pi
+ *
+ * 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).
+ *
+ * See also sinpi().
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+ native_sinpi(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float2 __attribute__((const, overloadable))
+ native_sinpi(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float3 __attribute__((const, overloadable))
+ native_sinpi(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float4 __attribute__((const, overloadable))
+ native_sinpi(float4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ native_sinpi(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ native_sinpi(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ native_sinpi(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ native_sinpi(half4 v);
+#endif
+
+/*
+ * native_sqrt: Approximate square root
+ *
+ * Returns the approximate sqrt(v).
+ *
+ * See also sqrt(), half_sqrt().
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+ native_sqrt(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+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
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ native_sqrt(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ native_sqrt(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ native_sqrt(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ native_sqrt(half4 v);
+#endif
+
+/*
+ * native_tan: Approximate tangent
+ *
+ * Returns the approximate tangent of an angle measured in radians.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+ native_tan(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float2 __attribute__((const, overloadable))
+ native_tan(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float3 __attribute__((const, overloadable))
+ native_tan(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float4 __attribute__((const, overloadable))
+ native_tan(float4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ native_tan(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ native_tan(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ native_tan(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ native_tan(half4 v);
+#endif
+
+/*
+ * native_tanh: Approximate hyperbolic tangent
+ *
+ * Returns the approximate hyperbolic tangent of a value.
+ *
+ * See also tanh().
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+ native_tanh(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+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
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ native_tanh(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ native_tanh(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ native_tanh(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ native_tanh(half4 v);
+#endif
+
+/*
+ * native_tanpi: Approximate tangent of a number multiplied by pi
+ *
+ * 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).
+ *
+ * See also tanpi().
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+ native_tanpi(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float2 __attribute__((const, overloadable))
+ native_tanpi(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float3 __attribute__((const, overloadable))
+ native_tanpi(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float4 __attribute__((const, overloadable))
+ native_tanpi(float4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ native_tanpi(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ native_tanpi(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ native_tanpi(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ native_tanpi(half4 v);
+#endif
+
+/*
+ * nextafter: Next floating point number
+ *
+ * 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.
+ */
+extern float __attribute__((const, overloadable))
+ nextafter(float v, float 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);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ nextafter(half v, half target);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ nextafter(half2 v, half2 target);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ nextafter(half3 v, half3 target);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ nextafter(half4 v, half4 target);
+#endif
+
+/*
+ * 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.
+ */
+extern float __attribute__((const, overloadable))
+ pow(float base, float exponent);
+
+extern float2 __attribute__((const, overloadable))
+ pow(float2 base, float2 exponent);
+
+extern float3 __attribute__((const, overloadable))
+ pow(float3 base, float3 exponent);
+
+extern float4 __attribute__((const, overloadable))
+ pow(float4 base, float4 exponent);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ pow(half base, half exponent);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ pow(half2 base, half2 exponent);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ pow(half3 base, half3 exponent);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ pow(half4 base, half4 exponent);
+#endif
+
+/*
+ * 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.
+ */
+extern float __attribute__((const, overloadable))
+ pown(float base, int exponent);
+
+extern float2 __attribute__((const, overloadable))
+ pown(float2 base, int2 exponent);
+
+extern float3 __attribute__((const, overloadable))
+ pown(float3 base, int3 exponent);
+
+extern float4 __attribute__((const, overloadable))
+ pown(float4 base, int4 exponent);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ pown(half base, int exponent);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ pown(half2 base, int2 exponent);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ pown(half3 base, int3 exponent);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ pown(half4 base, int4 exponent);
+#endif
+
+/*
+ * 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.
+ *
+ * See also native_powr().
+ */
+extern float __attribute__((const, overloadable))
+ powr(float base, float exponent);
+
+extern float2 __attribute__((const, overloadable))
+ powr(float2 base, float2 exponent);
+
+extern float3 __attribute__((const, overloadable))
+ powr(float3 base, float3 exponent);
+
+extern float4 __attribute__((const, overloadable))
+ powr(float4 base, float4 exponent);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ powr(half base, half exponent);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ powr(half2 base, half2 exponent);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ powr(half3 base, half3 exponent);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ powr(half4 base, half4 exponent);
+#endif
+
+/*
+ * radians: Converts degrees into radians
+ *
+ * Converts from degrees to radians.
+ */
+extern float __attribute__((const, overloadable))
+ radians(float v);
+
+extern float2 __attribute__((const, overloadable))
+ radians(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+ radians(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+ radians(float4 v);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ radians(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ radians(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ radians(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ radians(half4 v);
+#endif
+
+/*
+ * remainder: Remainder of a division
+ *
+ * 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).
+ */
+extern float __attribute__((const, overloadable))
+ remainder(float numerator, float denominator);
+
+extern float2 __attribute__((const, overloadable))
+ remainder(float2 numerator, float2 denominator);
+
+extern float3 __attribute__((const, overloadable))
+ remainder(float3 numerator, float3 denominator);
+
+extern float4 __attribute__((const, overloadable))
+ remainder(float4 numerator, float4 denominator);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ remainder(half numerator, half denominator);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ remainder(half2 numerator, half2 denominator);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ remainder(half3 numerator, half3 denominator);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ remainder(half4 numerator, half4 denominator);
+#endif
+
+/*
+ * 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.
+ *
+ * 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, ") sets the lowest three bits of quot to 3
+ * and the sign negative. It returns 0.5f.
+ *
+ * Parameters:
+ * numerator: Numerator.
+ * denominator: Denominator.
+ * quotient: *quotient will be set to the integer quotient.
+ *
+ * Returns: Remainder, precise only for the low three bits.
+ */
+extern float __attribute__((overloadable))
+ remquo(float numerator, float denominator, int* quotient);
+
+extern float2 __attribute__((overloadable))
+ remquo(float2 numerator, float2 denominator, int2* quotient);
+
+extern float3 __attribute__((overloadable))
+ remquo(float3 numerator, float3 denominator, int3* quotient);
+
+extern float4 __attribute__((overloadable))
+ remquo(float4 numerator, float4 denominator, int4* quotient);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((overloadable))
+ remquo(half numerator, half denominator, int* quotient);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((overloadable))
+ remquo(half2 numerator, half2 denominator, int2* quotient);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((overloadable))
+ remquo(half3 numerator, half3 denominator, int3* quotient);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((overloadable))
+ remquo(half4 numerator, half4 denominator, int4* quotient);
+#endif
+
+/*
+ * 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.
+ */
+extern float __attribute__((const, overloadable))
+ rint(float v);
+
+extern float2 __attribute__((const, overloadable))
+ rint(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+ rint(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+ rint(float4 v);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ rint(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ rint(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ rint(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ rint(half4 v);
+#endif
+
+/*
+ * rootn: Nth root
+ *
+ * Compute the Nth root of a value.
+ *
+ * See also native_rootn().
+ */
+extern float __attribute__((const, overloadable))
+ rootn(float v, int n);
+
+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);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ rootn(half v, int n);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ rootn(half2 v, int2 n);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ rootn(half3 v, int3 n);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ rootn(half4 v, int4 n);
+#endif
+
+/*
+ * round: Round away from zero
+ *
+ * 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.
+ */
+extern float __attribute__((const, overloadable))
+ round(float v);
+
+extern float2 __attribute__((const, overloadable))
+ round(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+ round(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+ round(float4 v);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ round(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ round(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ round(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ round(half4 v);
+#endif
+
+/*
+ * rsqrt: Reciprocal of a square root
+ *
+ * Returns (1 / sqrt(v)).
+ *
+ * See also half_rsqrt(), native_rsqrt().
+ */
+extern float __attribute__((const, overloadable))
+ rsqrt(float 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);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ rsqrt(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ rsqrt(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ rsqrt(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ rsqrt(half4 v);
+#endif
+
+/*
+ * sign: Sign of a value
+ *
+ * Returns the sign of a value.
+ *
+ * if (v < 0) return -1.f;
+ * else if (v > 0) return 1.f;
+ * else return 0.f;
+ */
+extern float __attribute__((const, overloadable))
+ sign(float v);
+
+extern float2 __attribute__((const, overloadable))
+ sign(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+ sign(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+ sign(float4 v);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ sign(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ sign(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ sign(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ sign(half4 v);
+#endif
+
+/*
+ * sin: Sine
+ *
+ * Returns the sine of an angle measured in radians.
+ *
+ * See also native_sin().
+ */
+extern float __attribute__((const, overloadable))
+ sin(float v);
+
+extern float2 __attribute__((const, overloadable))
+ sin(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+ sin(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+ sin(float4 v);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ sin(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ sin(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ sin(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ sin(half4 v);
+#endif
+
+/*
+ * sincos: Sine and cosine
+ *
+ * Returns the sine and cosine of a value.
+ *
+ * See also native_sincos().
+ *
+ * Parameters:
+ * v: 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);
+
+extern float2 __attribute__((overloadable))
+ sincos(float2 v, float2* cos);
+
+extern float3 __attribute__((overloadable))
+ sincos(float3 v, float3* cos);
+
+extern float4 __attribute__((overloadable))
+ sincos(float4 v, float4* cos);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((overloadable))
+ sincos(half v, half* cos);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((overloadable))
+ sincos(half2 v, half2* cos);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((overloadable))
+ sincos(half3 v, half3* cos);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((overloadable))
+ sincos(half4 v, half4* cos);
+#endif
+
+/*
+ * sinh: Hyperbolic sine
+ *
+ * Returns the hyperbolic sine of v, where v is measured in radians.
+ *
+ * See also native_sinh().
+ */
+extern float __attribute__((const, overloadable))
+ sinh(float v);
+
+extern float2 __attribute__((const, overloadable))
+ sinh(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+ sinh(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+ sinh(float4 v);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ sinh(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ sinh(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ sinh(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ sinh(half4 v);
+#endif
+
+/*
+ * sinpi: Sine of a number multiplied by pi
+ *
+ * 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).
+ *
+ * See also native_sinpi().
+ */
+extern float __attribute__((const, overloadable))
+ sinpi(float v);
+
+extern float2 __attribute__((const, overloadable))
+ sinpi(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+ sinpi(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+ sinpi(float4 v);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ sinpi(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ sinpi(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ sinpi(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ sinpi(half4 v);
+#endif
+
+/*
+ * sqrt: Square root
+ *
+ * Returns the square root of a value.
+ *
+ * See also half_sqrt(), native_sqrt().
+ */
+extern float __attribute__((const, overloadable))
+ sqrt(float v);
+
+extern float2 __attribute__((const, overloadable))
+ sqrt(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+ sqrt(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+ sqrt(float4 v);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ sqrt(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ sqrt(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ sqrt(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ sqrt(half4 v);
+#endif
+
+/*
+ * step: 0 if less than a value, 0 otherwise
+ *
+ * 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).
+ */
+extern float __attribute__((const, overloadable))
+ step(float edge, float v);
+
+extern float2 __attribute__((const, overloadable))
+ step(float2 edge, float2 v);
+
+extern float3 __attribute__((const, overloadable))
+ step(float3 edge, float3 v);
+
+extern float4 __attribute__((const, overloadable))
+ step(float4 edge, float4 v);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ step(half edge, half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ step(half2 edge, half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ step(half3 edge, half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ step(half4 edge, half4 v);
+#endif
+
+extern float2 __attribute__((const, overloadable))
+ step(float2 edge, float v);
+
+extern float3 __attribute__((const, overloadable))
+ step(float3 edge, float v);
+
+extern float4 __attribute__((const, overloadable))
+ step(float4 edge, float v);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ step(half2 edge, half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ step(half3 edge, half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ step(half4 edge, half v);
+#endif
+
+#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))
+extern float3 __attribute__((const, overloadable))
+ step(float edge, float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float4 __attribute__((const, overloadable))
+ step(float edge, float4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ step(half edge, half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ step(half edge, half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ step(half edge, half4 v);
+#endif
+
+/*
+ * tan: Tangent
+ *
+ * Returns the tangent of an angle measured in radians.
+ *
+ * See also native_tan().
+ */
+extern float __attribute__((const, overloadable))
+ tan(float v);
+
+extern float2 __attribute__((const, overloadable))
+ tan(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+ tan(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+ tan(float4 v);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ tan(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ tan(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ tan(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ tan(half4 v);
+#endif
+
+/*
+ * tanh: Hyperbolic tangent
+ *
+ * Returns the hyperbolic tangent of a value.
+ *
+ * See also native_tanh().
+ */
+extern float __attribute__((const, overloadable))
+ tanh(float v);
+
+extern float2 __attribute__((const, overloadable))
+ tanh(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+ tanh(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+ tanh(float4 v);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ tanh(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ tanh(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ tanh(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ tanh(half4 v);
+#endif
+
+/*
+ * tanpi: Tangent of a number multiplied by pi
+ *
+ * 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).
+ *
+ * See also native_tanpi().
+ */
+extern float __attribute__((const, overloadable))
+ tanpi(float v);
+
+extern float2 __attribute__((const, overloadable))
+ tanpi(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+ tanpi(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+ tanpi(float4 v);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ tanpi(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ tanpi(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ tanpi(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ tanpi(half4 v);
+#endif
+
+/*
+ * tgamma: Gamma function
+ *
+ * Returns the gamma function of a value.
+ *
+ * See also lgamma().
+ */
+extern float __attribute__((const, overloadable))
+ tgamma(float v);
+
+extern float2 __attribute__((const, overloadable))
+ tgamma(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+ tgamma(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+ tgamma(float4 v);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ tgamma(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ tgamma(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ tgamma(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ tgamma(half4 v);
+#endif
+
+/*
+ * trunc: Truncates a floating point
+ *
+ * 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.
+ */
+extern float __attribute__((const, overloadable))
+ trunc(float v);
+
+extern float2 __attribute__((const, overloadable))
+ trunc(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+ trunc(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+ trunc(float4 v);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ trunc(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ trunc(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ trunc(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ trunc(half4 v);
+#endif
+
+/*
+ * rsClamp: Restrain a value to a range
+ *
+ * DEPRECATED. Do not use.
+ *
+ * Clamp a value between low and high.
+ *
+ * Parameters:
+ * amount: Value to clamp.
+ * low: Lower bound.
+ * high: Upper bound.
+ */
+extern char __attribute__((const, overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated("Use clamp() instead.")
+#endif
+))
+ rsClamp(char amount, char low, char high);
+
+extern uchar __attribute__((const, overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated("Use clamp() instead.")
+#endif
+))
+ rsClamp(uchar amount, uchar low, uchar high);
+
+extern short __attribute__((const, overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated("Use clamp() instead.")
+#endif
+))
+ rsClamp(short amount, short low, short high);
+
+extern ushort __attribute__((const, overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated("Use clamp() instead.")
+#endif
+))
+ rsClamp(ushort amount, ushort low, ushort high);
+
+extern int __attribute__((const, overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated("Use clamp() instead.")
+#endif
+))
+ rsClamp(int amount, int low, int high);
+
+extern uint __attribute__((const, overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated("Use clamp() instead.")
+#endif
+))
+ rsClamp(uint amount, uint low, uint high);
+
+/*
+ * rsFrac: Returns the fractional part of a float
+ *
+ * DEPRECATED. Do not use.
+ *
+ * Returns the fractional part of a float
+ */
+extern float __attribute__((const, overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated("Use fract() instead.")
+#endif
+))
+ rsFrac(float v);
+
+/*
+ * rsRand: Pseudo-random number
+ *
+ * Return a random value between 0 (or min_value) and max_malue.
+ */
+extern int __attribute__((overloadable))
+ rsRand(int max_value);
+
+extern int __attribute__((overloadable))
+ rsRand(int min_value, int max_value);
+
+extern float __attribute__((overloadable))
+ rsRand(float max_value);
+
+extern float __attribute__((overloadable))
+ rsRand(float min_value, float max_value);
+
+#endif // RENDERSCRIPT_RS_MATH_RSH
diff --git a/script_api/include/rs_matrix.rsh b/script_api/include/rs_matrix.rsh
new file mode 100644
index 0000000..9cdc27f
--- /dev/null
+++ b/script_api/include/rs_matrix.rsh
@@ -0,0 +1,612 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/generate.sh.
+
+/*
+ * 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.
+ *
+ * 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. (matrix * vector),
+ * 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 rsMatrixLoadMultiply(&combined, &s2, &s1).
+ * This derives from s2 * (s1 * v), which is (s2 * s1) * v.
+ *
+ * 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 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
+
+#include "rs_vector_math.rsh"
+
+/*
+ * rsExtractFrustumPlanes: Compute frustum planes
+ *
+ * Computes 6 frustum planes from the view projection matrix
+ *
+ * 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.
+ */
+#if !defined(RS_VERSION) || (RS_VERSION <= 23)
+static inline void __attribute__((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];
+ 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;
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern void __attribute__((overloadable))
+ rsExtractFrustumPlanes(const rs_matrix4x4* viewProj, float4* left, float4* righ, float4* top,
+ float4* bottom, float4* near, float4* far);
+#endif
+
+/*
+ * rsIsSphereInFrustum: Checks if a sphere is within the frustum planes
+ *
+ * Returns true if the sphere is within 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.
+ */
+#if !defined(RS_VERSION) || (RS_VERSION <= 23)
+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;
+ }
+ 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;
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern bool __attribute__((overloadable))
+ rsIsSphereInFrustum(float4* sphere, float4* left, float4* right, float4* top, float4* bottom,
+ float4* near, float4* far);
+#endif
+
+/*
+ * rsMatrixGet: Get one element
+ *
+ * Returns one element of a matrix.
+ *
+ * Warning: The order of the column and row parameters may be unexpected.
+ *
+ * Parameters:
+ * m: Matrix to extract the element from.
+ * col: Zero-based column of the element to be extracted.
+ * row: Zero-based row of the element to extracted.
+ */
+extern float __attribute__((overloadable))
+ rsMatrixGet(const rs_matrix4x4* m, uint32_t col, uint32_t row);
+
+extern float __attribute__((overloadable))
+ rsMatrixGet(const rs_matrix3x3* m, uint32_t col, uint32_t row);
+
+extern float __attribute__((overloadable))
+ rsMatrixGet(const rs_matrix2x2* m, uint32_t col, uint32_t row);
+
+/*
+ * rsMatrixInverse: Inverts a matrix in place
+ *
+ * Returns true if the matrix was successfully inverted.
+ *
+ * Parameters:
+ * m: Matrix to invert.
+ */
+extern bool __attribute__((overloadable))
+ rsMatrixInverse(rs_matrix4x4* m);
+
+/*
+ * rsMatrixInverseTranspose: Inverts and transpose a matrix in place
+ *
+ * The matrix is first inverted then transposed. Returns true if the matrix was
+ * successfully inverted.
+ *
+ * Parameters:
+ * m: 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:
+ *
+ * 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
+ *
+ *
+ * Parameters:
+ * destination: Matrix to set.
+ * array: Array of values to set the matrix to. These arrays should be 4, 9, or 16 floats long, depending on the matrix size.
+ * source: Source matrix.
+ */
+extern void __attribute__((overloadable))
+ rsMatrixLoad(rs_matrix4x4* destination, const float* array);
+
+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: 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: 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: Matrix to set.
+ * lhs: Left matrix of the product.
+ * rhs: 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: 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: Matrix to set.
+ * fovy: Field of view, in degrees along the Y axis.
+ * aspect: Ratio of x / y.
+ * near: Near clipping plane.
+ * far: 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 (x, y, z) vector.
+ *
+ * To rotate a vector, multiply the vector by the created matrix using rsMatrixMultiply().
+ *
+ * See http://en.wikipedia.org/wiki/Rotation_matrix .
+ *
+ * Parameters:
+ * m: Matrix to set.
+ * rot: How much rotation to do, in degrees.
+ * x: X component of the vector that is the axis of rotation.
+ * y: Y component of the vector that is the axis of rotation.
+ * z: 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);
+
+/*
+ * 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 rsMatrixMultiply().
+ *
+ * Parameters:
+ * m: Matrix to set.
+ * x: Multiple to scale the x components by.
+ * y: Multiple to scale the y components by.
+ * z: Multiple to scale the z components by.
+ */
+extern void __attribute__((overloadable))
+ rsMatrixLoadScale(rs_matrix4x4* m, float x, float y, float z);
+
+/*
+ * 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
+ * rsMatrixMultiply().
+ *
+ * Parameters:
+ * m: Matrix to set.
+ * x: Number to add to each x component.
+ * y: Number to add to each y component.
+ * z: Number to add to each z component.
+ */
+extern void __attribute__((overloadable))
+ rsMatrixLoadTranslate(rs_matrix4x4* m, float x, float y, float z);
+
+/*
+ * rsMatrixMultiply: Multiply a matrix by a vector or another matrix
+ *
+ * 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 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. 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: Left matrix of the product and the matrix to be set.
+ * rhs: Right matrix of the product.
+ */
+extern void __attribute__((overloadable))
+ rsMatrixMultiply(rs_matrix4x4* m, const rs_matrix4x4* rhs);
+
+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 (x, y, z) vector.
+ *
+ * To apply this combined transformation to a vector, multiply the vector by the created
+ * matrix using rsMatrixMultiply().
+ *
+ * Parameters:
+ * m: Matrix to modify.
+ * rot: How much rotation to do, in degrees.
+ * x: X component of the vector that is the axis of rotation.
+ * y: Y component of the vector that is the axis of rotation.
+ * z: 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);
+
+/*
+ * 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 rsMatrixMultiply().
+ *
+ * Parameters:
+ * m: Matrix to modify.
+ * x: Multiple to scale the x components by.
+ * y: Multiple to scale the y components by.
+ * z: Multiple to scale the z components by.
+ */
+extern void __attribute__((overloadable))
+ rsMatrixScale(rs_matrix4x4* m, float x, float y, float z);
+
+/*
+ * rsMatrixSet: Set one element
+ *
+ * Set an element of a matrix.
+ *
+ * Warning: The order of the column and row parameters may be unexpected.
+ *
+ * Parameters:
+ * m: Matrix that will be modified.
+ * col: Zero-based column of the element to be set.
+ * row: Zero-based row of the element to be set.
+ * v: 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 rsMatrixMultiply().
+ *
+ * Parameters:
+ * m: Matrix to modify.
+ * x: Number to add to each x component.
+ * y: Number to add to each y component.
+ * z: Number to add to each z component.
+ */
+extern void __attribute__((overloadable))
+ rsMatrixTranslate(rs_matrix4x4* m, float x, float y, float z);
+
+/*
+ * rsMatrixTranspose: Transpose a matrix place
+ *
+ * Transpose the matrix m in place.
+ *
+ * Parameters:
+ * m: Matrix to transpose.
+ */
+extern void __attribute__((overloadable))
+ rsMatrixTranspose(rs_matrix4x4* m);
+
+extern void __attribute__((overloadable))
+ rsMatrixTranspose(rs_matrix3x3* m);
+
+extern void __attribute__((overloadable))
+ rsMatrixTranspose(rs_matrix2x2* m);
+
+#endif // RENDERSCRIPT_RS_MATRIX_RSH
diff --git a/script_api/include/rs_object_info.rsh b/script_api/include/rs_object_info.rsh
new file mode 100644
index 0000000..0b18de3
--- /dev/null
+++ b/script_api/include/rs_object_info.rsh
@@ -0,0 +1,462 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/generate.sh.
+
+/*
+ * rs_object_info.rsh: Object Characteristics Functions
+ *
+ * The functions below can be used to query the characteristics of an Allocation, Element,
+ * or Sampler object. These objects are created from Java. You can't create them from a
+ * script.
+ *
+ * Allocations:
+ *
+ * Allocations are the primary method used to pass data to and from RenderScript kernels.
+ *
+ * They are a structured collection of cells that can be used to store bitmaps, textures,
+ * arbitrary data points, etc.
+ *
+ * This collection of cells may have many dimensions (X, Y, Z, Array0, Array1, Array2, Array3),
+ * faces (for cubemaps), and level of details (for mipmapping).
+ *
+ * See the android.renderscript.Allocation for details on to create Allocations.
+ *
+ * Elements:
+ *
+ * The term "element" is used a bit ambiguously in RenderScript, as both type information
+ * for the cells of an Allocation and the instantiation of that type. For example:
+ * - rs_element is a handle to a type specification, and
+ * - In functions like rsGetElementAt(), "element" means the instantiation of the type,
+ * i.e. a cell of an Allocation.
+ *
+ * The functions below let you query the characteristics of the type specificiation.
+ *
+ * An Element can specify a simple data types as found in C, e.g. an integer, float, or
+ * boolean. It can also specify a handle to a RenderScript object. See rs_data_type for
+ * a list of basic types.
+ *
+ * Elements can specify fixed size vector (of size 2, 3, or 4) versions of the basic types.
+ * Elements can be grouped together into complex Elements, creating the equivalent of
+ * C structure definitions.
+ *
+ * Elements can also have a kind, which is semantic information used to interpret pixel
+ * data. See rs_data_kind.
+ *
+ * When creating Allocations of common elements, you can simply use one of the many predefined
+ * Elements like F32_2.
+ *
+ * To create complex Elements, use the Element.Builder Java class.
+ *
+ * Samplers:
+ *
+ * Samplers objects define how Allocations can be read as structure within a kernel.
+ * See android.renderscript.S.
+ */
+
+#ifndef RENDERSCRIPT_RS_OBJECT_INFO_RSH
+#define RENDERSCRIPT_RS_OBJECT_INFO_RSH
+
+/*
+ * 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.
+ *
+ * Use rsGetDimHasFaces() to get the dimension of a currently running kernel.
+ *
+ * Returns: Returns 1 if more than one face is present, 0 otherwise.
+ */
+extern uint32_t __attribute__((overloadable))
+ rsAllocationGetDimFaces(rs_allocation a);
+
+/*
+ * rsAllocationGetDimLOD: Presence of levels of detail
+ *
+ * Query an Allocation for the presence of more than one Level Of Detail. This is useful
+ * for mipmaps.
+ *
+ * Use rsGetDimLod() to get the dimension of a currently running kernel.
+ *
+ * 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.
+ *
+ * Use rsGetDimX() to get the dimension of a currently running kernel.
+ *
+ * Returns: 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.
+ *
+ * Use rsGetDimY() to get the dimension of a currently running kernel.
+ *
+ * Returns: 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.
+ *
+ * Use rsGetDimZ() to get the dimension of a currently running kernel.
+ *
+ * Returns: Z dimension of the Allocation.
+ */
+extern uint32_t __attribute__((overloadable))
+ rsAllocationGetDimZ(rs_allocation a);
+
+/*
+ * rsAllocationGetElement: Get the object that describes the cell of an Allocation
+ *
+ * Get the Element object describing the type, kind, and other characteristics of a cell
+ * of an Allocation. See the rsElement* functions below.
+ *
+ * Parameters:
+ * a: Allocation to get data from.
+ *
+ * Returns: Element describing Allocation layout.
+ */
+extern rs_element __attribute__((overloadable))
+ rsAllocationGetElement(rs_allocation a);
+
+/*
+ * rsClearObject: Release an object
+ *
+ * Tells the run time that this handle will no longer be used to access the the related
+ * object. If this was the last handle to that object, resource recovery may happen.
+ *
+ * After calling this function, *dst will be set to an empty handle. See rsIsObject().
+ */
+extern void __attribute__((overloadable))
+ rsClearObject(rs_element* dst);
+
+extern void __attribute__((overloadable))
+ rsClearObject(rs_type* dst);
+
+extern void __attribute__((overloadable))
+ rsClearObject(rs_allocation* dst);
+
+extern void __attribute__((overloadable))
+ rsClearObject(rs_sampler* dst);
+
+extern void __attribute__((overloadable))
+ rsClearObject(rs_script* dst);
+
+/*
+ * rsIsObject: Check for an empty handle
+ *
+ * Returns true if the handle contains a non-null reference.
+ *
+ * This function does not validate that the internal pointer used in the handle
+ * points to an actual valid object; it only checks for null.
+ *
+ * This function can be used to check the Element returned by rsElementGetSubElement()
+ * or see if rsClearObject() has been called on a handle.
+ */
+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);
+
+/*
+ * rsElementGetBytesSize: Size of an Element
+ *
+ * Returns the size in bytes that an instantiation of this Element will occupy.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+extern uint32_t __attribute__((overloadable))
+ rsElementGetBytesSize(rs_element e);
+#endif
+
+/*
+ * rsElementGetDataKind: Kind of an Element
+ *
+ * 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: 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).
+ * See rs_data_type.
+ *
+ * If the Element describes a vector, this function returns the data type of one of its items.
+ * Use rsElementGetVectorSize to get the size of the vector.
+ *
+ * If the Element describes a structure, RS_TYPE_NONE is returned. Use the rsElementGetSub*
+ * functions to explore this complex Element.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+extern rs_data_type __attribute__((overloadable))
+ rsElementGetDataType(rs_element e);
+#endif
+
+/*
+ * rsElementGetSubElement: Sub-element of a complex Element
+ *
+ * For Elements that 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: Array size of a sub-element of a complex Element
+ *
+ * For complex Elements, sub-elements can be statically sized arrays. This function
+ * returns the array size of the sub-element at the index. This sub-element repetition
+ * is different than fixed size vectors.
+ *
+ * Parameters:
+ * e: Element to query.
+ * index: Index of the sub-element.
+ *
+ * Returns: Array size of the sub-element.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+extern uint32_t __attribute__((overloadable))
+ rsElementGetSubElementArraySize(rs_element e, uint32_t index);
+#endif
+
+/*
+ * rsElementGetSubElementCount: Number of sub-elements
+ *
+ * Elements can be simple, such as an int or a float, or a structure with multiple
+ * sub-elements. This function returns zero for simple Elements and the number of
+ * sub-elements for complex Elements.
+ *
+ * Parameters:
+ * e: Element to get data from.
+ *
+ * Returns: Number of sub-elements.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+extern uint32_t __attribute__((overloadable))
+ rsElementGetSubElementCount(rs_element e);
+#endif
+
+/*
+ * rsElementGetSubElementName: 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: Address of the array to store the name into.
+ * nameLength: Length of the provided name array.
+ *
+ * Returns: Number of characters copied, 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: Length of the name of a sub-element
+ *
+ * For complex Elements, this function returns the length of the name of the sub-element
+ * at the specified index.
+ *
+ * Parameters:
+ * e: Element to get data from.
+ * index: Index of the sub-element.
+ *
+ * Returns: Length of the sub-element name including the null terminator.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+extern uint32_t __attribute__((overloadable))
+ rsElementGetSubElementNameLength(rs_element e, uint32_t index);
+#endif
+
+/*
+ * rsElementGetSubElementOffsetBytes: Offset of the instantiated sub-element
+ *
+ * This function returns the relative position of the instantiation of the specified
+ * sub-element within the instantiation of the Element.
+ *
+ * For example, if the Element describes a 32 bit float followed by a 32 bit integer,
+ * the offset return for the first will be 0 and the second 4.
+ *
+ * Parameters:
+ * e: Element to get data from.
+ * index: Index of the sub-element.
+ *
+ * Returns: Offset in bytes.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+extern uint32_t __attribute__((overloadable))
+ rsElementGetSubElementOffsetBytes(rs_element e, uint32_t index);
+#endif
+
+/*
+ * rsElementGetVectorSize: Vector size of the Element
+ *
+ * Returns the Element's vector size. If the Element does not represent a vector,
+ * 1 is returned.
+ *
+ * Parameters:
+ * e: Element to get data from.
+ *
+ * Returns: Length of the element vector.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+extern uint32_t __attribute__((overloadable))
+ rsElementGetVectorSize(rs_element e);
+#endif
+
+/*
+ * rsGetAllocation: Return the Allocation for a given pointer
+ *
+ * DEPRECATED. Do not use.
+ *
+ * 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.
+ */
+extern rs_allocation __attribute__((overloadable
+#if (defined(RS_VERSION) && (RS_VERSION >= 22))
+, deprecated("This function is deprecated and will be removed from the SDK in a future release.")
+#endif
+))
+ rsGetAllocation(const void* p);
+
+/*
+ * rsSamplerGetAnisotropy: Anisotropy of the Sampler
+ *
+ * Get the Sampler's anisotropy.
+ *
+ * See android.renderscript.S.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+extern float __attribute__((overloadable))
+ rsSamplerGetAnisotropy(rs_sampler s);
+#endif
+
+/*
+ * rsSamplerGetMagnification: Sampler magnification value
+ *
+ * Get the Sampler's magnification value.
+ *
+ * See android.renderscript.S.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+extern rs_sampler_value __attribute__((overloadable))
+ rsSamplerGetMagnification(rs_sampler s);
+#endif
+
+/*
+ * rsSamplerGetMinification: Sampler minification value
+ *
+ * Get the Sampler's minification value.
+ *
+ * See android.renderscript.S.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+extern rs_sampler_value __attribute__((overloadable))
+ rsSamplerGetMinification(rs_sampler s);
+#endif
+
+/*
+ * rsSamplerGetWrapS: Sampler wrap S value
+ *
+ * Get the Sampler's wrap S value.
+ *
+ * See android.renderscript.S.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+extern rs_sampler_value __attribute__((overloadable))
+ rsSamplerGetWrapS(rs_sampler s);
+#endif
+
+/*
+ * rsSamplerGetWrapT: Sampler wrap T value
+ *
+ * Get the sampler's wrap T value.
+ *
+ * See android.renderscript.S.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+extern rs_sampler_value __attribute__((overloadable))
+ rsSamplerGetWrapT(rs_sampler s);
+#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);
+
+#endif // RENDERSCRIPT_RS_OBJECT_INFO_RSH
diff --git a/script_api/include/rs_object_types.rsh b/script_api/include/rs_object_types.rsh
new file mode 100644
index 0000000..e6511a5
--- /dev/null
+++ b/script_api/include/rs_object_types.rsh
@@ -0,0 +1,232 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/generate.sh.
+
+/*
+ * rs_object_types.rsh: Object Types
+ *
+ * The types below are used to manipulate RenderScript objects like allocations, samplers,
+ * elements, and scripts. Most of these object are created using the Java RenderScript APIs.
+ */
+
+#ifndef RENDERSCRIPT_RS_OBJECT_TYPES_RSH
+#define RENDERSCRIPT_RS_OBJECT_TYPES_RSH
+
+#define NULL ((void *)0)
+
+// Opaque handle to a RenderScript object. Do not use this directly.
+#ifndef __LP64__
+#define _RS_OBJECT_DECL \
+{\
+ const int* const p;\
+} __attribute__((packed, aligned(4)))
+#else
+#define _RS_OBJECT_DECL \
+{\
+ const long* const p;\
+ const long* const r;\
+ const long* const v1;\
+ const long* const v2;\
+}
+#endif
+
+/*
+ * rs_element: Handle to an element
+ *
+ * An opaque handle to a RenderScript element.
+ *
+ * See android.renderscript.Element.
+ */
+typedef struct rs_element _RS_OBJECT_DECL rs_element;
+
+/*
+ * rs_type: Handle to a Type
+ *
+ * An opaque handle to a RenderScript type.
+ *
+ * See android.renderscript.Type.
+ */
+typedef struct rs_type _RS_OBJECT_DECL rs_type;
+
+/*
+ * rs_allocation: Handle to an allocation
+ *
+ * An opaque handle to a RenderScript allocation.
+ *
+ * See android.renderscript.Allocation.
+ */
+typedef struct rs_allocation _RS_OBJECT_DECL rs_allocation;
+
+/*
+ * rs_sampler: Handle to a Sampler
+ *
+ * An opaque handle to a RenderScript sampler object.
+ *
+ * See android.renderscript.Sampler.
+ */
+typedef struct rs_sampler _RS_OBJECT_DECL rs_sampler;
+
+/*
+ * rs_script: Handle to a Script
+ *
+ * An opaque handle to a RenderScript script object.
+ *
+ * See android.renderscript.ScriptC.
+ */
+typedef struct rs_script _RS_OBJECT_DECL rs_script;
+
+/*
+ * rs_allocation_cubemap_face: Enum for selecting cube map faces
+ *
+ * An enum used to specify one the six faces of a cubemap.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 14))
+typedef enum {
+ RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_X = 0,
+ RS_ALLOCATION_CUBEMAP_FACE_NEGATIVE_X = 1,
+ RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_Y = 2,
+ RS_ALLOCATION_CUBEMAP_FACE_NEGATIVE_Y = 3,
+ RS_ALLOCATION_CUBEMAP_FACE_POSITIVE_Z = 4,
+ RS_ALLOCATION_CUBEMAP_FACE_NEGATIVE_Z = 5
+} rs_allocation_cubemap_face;
+#endif
+
+/*
+ * rs_allocation_usage_type: Bitfield to specify how an allocation is used
+ *
+ * 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, // Allocation is bound to and accessed by scripts.
+ RS_ALLOCATION_USAGE_GRAPHICS_TEXTURE = 0x0002, // Allocation is used as a texture source.
+ 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_IO_INPUT = 0x0020, // Allocation is used as a Surface consumer.
+ RS_ALLOCATION_USAGE_IO_OUTPUT = 0x0040, // Allocation is used as a Surface producer.
+ RS_ALLOCATION_USAGE_SHARED = 0x0080 // Allocation's backing store is shared with another object (usually a Bitmap). Copying to or from the original source Bitmap will cause a synchronization rather than a full copy.
+} rs_allocation_usage_type;
+#endif
+
+/*
+ * rs_data_type: Element basic data type
+ *
+ * rs_data_type is used to encode the type information of a basic element.
+ *
+ * RS_TYPE_UNSIGNED_5_6_5, RS_TYPE_UNSIGNED_5_5_5_1, RS_TYPE_UNSIGNED_4_4_4_4 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.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+typedef enum {
+ RS_TYPE_NONE = 0, // Element is a complex type, i.e. a struct.
+ RS_TYPE_FLOAT_16 = 1, // A 16 bit floating point value.
+ RS_TYPE_FLOAT_32 = 2, // A 32 bit floating point value.
+ RS_TYPE_FLOAT_64 = 3, // A 64 bit floating point value.
+ RS_TYPE_SIGNED_8 = 4, // An 8 bit signed integer.
+ RS_TYPE_SIGNED_16 = 5, // A 16 bit signed integer.
+ RS_TYPE_SIGNED_32 = 6, // A 32 bit signed integer.
+ RS_TYPE_SIGNED_64 = 7, // A 64 bit signed integer.
+ RS_TYPE_UNSIGNED_8 = 8, // An 8 bit unsigned integer.
+ RS_TYPE_UNSIGNED_16 = 9, // A 16 bit unsigned integer.
+ RS_TYPE_UNSIGNED_32 = 10, // A 32 bit unsigned integer.
+ RS_TYPE_UNSIGNED_64 = 11, // A 64 bit unsigned integer.
+ RS_TYPE_BOOLEAN = 12, // 0 or 1 (false or true) stored in an 8 bit container.
+ RS_TYPE_UNSIGNED_5_6_5 = 13, // A 16 bit unsigned integer packing graphical data in 5, 6, and 5 bit sections.
+ RS_TYPE_UNSIGNED_5_5_5_1 = 14, // A 16 bit unsigned integer packing graphical data in 5, 5, 5, and 1 bit sections.
+ RS_TYPE_UNSIGNED_4_4_4_4 = 15, // A 16 bit unsigned integer packing graphical data in 4, 4, 4, and 4 bit sections.
+ RS_TYPE_MATRIX_4X4 = 16, // A 4x4 matrix of 32 bit floats, aligned on a 32 bit boundary.
+ RS_TYPE_MATRIX_3X3 = 17, // A 3x3 matrix of 32 bit floats, aligned on a 32 bit boundary.
+ RS_TYPE_MATRIX_2X2 = 18, // A 2x2 matrix of 32 bit floats, aligned on a 32 bit boundary.
+ RS_TYPE_ELEMENT = 1000, // A handle to an Element.
+ RS_TYPE_TYPE = 1001, // A handle to a Type.
+ RS_TYPE_ALLOCATION = 1002, // A handle to an Allocation.
+ RS_TYPE_SAMPLER = 1003, // A handle to a Sampler.
+ RS_TYPE_SCRIPT = 1004, // A handle to a Script.
+ RS_TYPE_MESH = 1005, // Deprecated.
+ RS_TYPE_PROGRAM_FRAGMENT = 1006, // Deprecated.
+ RS_TYPE_PROGRAM_VERTEX = 1007, // Deprecated.
+ RS_TYPE_PROGRAM_RASTER = 1008, // Deprecated.
+ RS_TYPE_PROGRAM_STORE = 1009, // Deprecated.
+ RS_TYPE_FONT = 1010, // Deprecated.
+ RS_TYPE_INVALID = 10000
+} rs_data_type;
+#endif
+
+/*
+ * rs_data_kind: Element data kind
+ *
+ * This enumeration is primarly useful for graphical data. It provides additional information to
+ * help interpret the rs_data_type.
+ *
+ * RS_KIND_USER indicates no special interpretation is expected.
+ *
+ * The RS_KIND_PIXEL_* values are used in conjunction with the standard data types for representing
+ * texture formats.
+ *
+ * See the Element.createPixel() method.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 16))
+typedef enum {
+ RS_KIND_USER = 0, // No special interpretation.
+ RS_KIND_PIXEL_L = 7, // Luminance.
+ RS_KIND_PIXEL_A = 8, // Alpha.
+ RS_KIND_PIXEL_LA = 9, // Luminance and Alpha.
+ RS_KIND_PIXEL_RGB = 10, // Red, Green, Blue.
+ RS_KIND_PIXEL_RGBA = 11, // Red, Green, Blue, and Alpha.
+ RS_KIND_PIXEL_DEPTH = 12, // Depth for a depth texture.
+ RS_KIND_PIXEL_YUV = 13, // Luminance and chrominance.
+ RS_KIND_INVALID = 100
+} rs_data_kind;
+#endif
+
+/*
+ * rs_yuv_format: YUV format
+ *
+ * Android YUV formats that can be associated with a RenderScript Type.
+ *
+ * See android.graphics.ImageFormat for a description of each format.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+typedef enum {
+ RS_YUV_NONE = 0,
+ RS_YUV_YV12 = 0x32315659,
+ RS_YUV_NV21 = 0x11,
+ RS_YUV_420_888 = 0x23
+} rs_yuv_format;
+#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,
+ RS_SAMPLER_LINEAR_MIP_LINEAR = 2,
+ RS_SAMPLER_WRAP = 3,
+ RS_SAMPLER_CLAMP = 4,
+ RS_SAMPLER_LINEAR_MIP_NEAREST = 5,
+ RS_SAMPLER_MIRRORED_REPEAT = 6,
+ RS_SAMPLER_INVALID = 100
+} rs_sampler_value;
+#endif
+
+#endif // RENDERSCRIPT_RS_OBJECT_TYPES_RSH
diff --git a/script_api/include/rs_quaternion.rsh b/script_api/include/rs_quaternion.rsh
new file mode 100644
index 0000000..55d33cf
--- /dev/null
+++ b/script_api/include/rs_quaternion.rsh
@@ -0,0 +1,374 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/generate.sh.
+
+/*
+ * rs_quaternion.rsh: Quaternion Functions
+ *
+ * The following functions manipulate quaternions.
+ */
+
+#ifndef RENDERSCRIPT_RS_QUATERNION_RSH
+#define RENDERSCRIPT_RS_QUATERNION_RSH
+
+/*
+ * rsQuaternionAdd: Add two quaternions
+ *
+ * Adds two quaternions, i.e. *q += *rhs;
+ *
+ * Parameters:
+ * q: Destination quaternion to add to.
+ * rhs: Quaternion to add.
+ */
+#if !defined(RS_VERSION) || (RS_VERSION <= 23)
+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;
+}
+#endif
+
+/*
+ * rsQuaternionConjugate: Conjugate a quaternion
+ *
+ * Conjugates the quaternion.
+ *
+ * Parameters:
+ * q: Quaternion to modify.
+ */
+#if !defined(RS_VERSION) || (RS_VERSION <= 23)
+static inline void __attribute__((overloadable))
+ rsQuaternionConjugate(rs_quaternion* q) {
+ q->x = -q->x;
+ q->y = -q->y;
+ q->z = -q->z;
+}
+#endif
+
+/*
+ * rsQuaternionDot: Dot product of two quaternions
+ *
+ * Returns the dot product of two quaternions.
+ *
+ * Parameters:
+ * q0: First quaternion.
+ * q1: Second quaternion.
+ */
+#if !defined(RS_VERSION) || (RS_VERSION <= 23)
+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;
+}
+#endif
+
+/*
+ * rsQuaternionGetMatrixUnit: Get a rotation matrix from a quaternion
+ *
+ * Computes a rotation matrix from the normalized quaternion.
+ *
+ * Parameters:
+ * m: Resulting matrix.
+ * q: Normalized quaternion.
+ */
+#if !defined(RS_VERSION) || (RS_VERSION <= 23)
+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;
+}
+#endif
+
+/*
+ * rsQuaternionLoadRotateUnit: Quaternion that represents a rotation about an arbitrary unit vector
+ *
+ * Loads a quaternion that represents a rotation about an arbitrary unit vector.
+ *
+ * Parameters:
+ * q: Destination quaternion.
+ * rot: Angle to rotate by, in radians.
+ * x: X component of the vector.
+ * y: Y component of the vector.
+ * z: Z component of the vector.
+ */
+#if !defined(RS_VERSION) || (RS_VERSION <= 23)
+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);
+
+ q->w = c;
+ q->x = x * s;
+ q->y = y * s;
+ q->z = z * s;
+}
+#endif
+
+/*
+ * rsQuaternionSet: Create a quaternion
+ *
+ * Creates a quaternion from its four components or from another quaternion.
+ *
+ * Parameters:
+ * q: Destination quaternion.
+ * w: W component.
+ * x: X component.
+ * y: Y component.
+ * z: Z component.
+ * rhs: Source quaternion.
+ */
+#if !defined(RS_VERSION) || (RS_VERSION <= 23)
+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;
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 23)
+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;
+}
+#endif
+
+/*
+ * rsQuaternionLoadRotate: Create a rotation quaternion
+ *
+ * Loads a quaternion that represents a rotation about an arbitrary vector
+ * (doesn't have to be unit)
+ *
+ * Parameters:
+ * q: Destination quaternion.
+ * rot: Angle to rotate by.
+ * x: X component of a vector.
+ * y: Y component of a vector.
+ * z: Z component of a vector.
+ */
+#if !defined(RS_VERSION) || (RS_VERSION <= 23)
+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);
+ x *= recipLen;
+ y *= recipLen;
+ z *= recipLen;
+ }
+ rsQuaternionLoadRotateUnit(q, rot, x, y, z);
+}
+#endif
+
+/*
+ * rsQuaternionNormalize: Normalize a quaternion
+ *
+ * Normalizes the quaternion.
+ *
+ * Parameters:
+ * q: Quaternion to normalize.
+ */
+#if !defined(RS_VERSION) || (RS_VERSION <= 23)
+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);
+ q->w *= recipLen;
+ q->x *= recipLen;
+ q->y *= recipLen;
+ q->z *= recipLen;
+ }
+}
+#endif
+
+/*
+ * rsQuaternionMultiply: Multiply a quaternion by a scalar or another quaternion
+ *
+ * Multiplies a quaternion by a scalar or by another quaternion, e.g
+ * *q = *q * scalar; or *q = *q * *rhs;.
+ *
+ * Parameters:
+ * q: Destination quaternion.
+ * scalar: Scalar to multiply the quaternion by.
+ * rhs: Quaternion to multiply the destination quaternion by.
+ */
+#if !defined(RS_VERSION) || (RS_VERSION <= 23)
+static inline void __attribute__((overloadable))
+ rsQuaternionMultiply(rs_quaternion* q, float scalar) {
+ q->w *= scalar;
+ q->x *= scalar;
+ q->y *= scalar;
+ q->z *= scalar;
+}
+#endif
+
+#if !defined(RS_VERSION) || (RS_VERSION <= 23)
+static inline void __attribute__((overloadable))
+ rsQuaternionMultiply(rs_quaternion* q, const rs_quaternion* rhs) {
+ 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);
+}
+#endif
+
+/*
+ * rsQuaternionSlerp: Spherical linear interpolation between two quaternions
+ *
+ * Performs spherical linear interpolation between two quaternions.
+ *
+ * Parameters:
+ * q: Result quaternion from the interpolation.
+ * q0: First input quaternion.
+ * q1: Second input quaternion.
+ * t: How much to interpolate by.
+ */
+#if !defined(RS_VERSION) || (RS_VERSION <= 23)
+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;
+ }
+ 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);
+}
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern void __attribute__((overloadable))
+ rsQuaternionAdd(rs_quaternion* q, const rs_quaternion* rhs);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern void __attribute__((overloadable))
+ rsQuaternionConjugate(rs_quaternion* q);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern float __attribute__((overloadable))
+ rsQuaternionDot(const rs_quaternion* q0, const rs_quaternion* q1);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern void __attribute__((overloadable))
+ rsQuaternionGetMatrixUnit(rs_matrix4x4* m, const rs_quaternion* q);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern void __attribute__((overloadable))
+ rsQuaternionLoadRotateUnit(rs_quaternion* q, float rot, float x, float y, float z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern void __attribute__((overloadable))
+ rsQuaternionSet(rs_quaternion* q, float w, float x, float y, float z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern void __attribute__((overloadable))
+ rsQuaternionSet(rs_quaternion* q, const rs_quaternion* rhs);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern void __attribute__((overloadable))
+ rsQuaternionLoadRotate(rs_quaternion* q, float rot, float x, float y, float z);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern void __attribute__((overloadable))
+ rsQuaternionNormalize(rs_quaternion* q);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern void __attribute__((overloadable))
+ rsQuaternionMultiply(rs_quaternion* q, float scalar);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern void __attribute__((overloadable))
+ rsQuaternionMultiply(rs_quaternion* q, const rs_quaternion* rhs);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern void __attribute__((overloadable))
+ rsQuaternionSlerp(rs_quaternion* q, const rs_quaternion* q0, const rs_quaternion* q1, float t);
+#endif
+
+#endif // RENDERSCRIPT_RS_QUATERNION_RSH
diff --git a/script_api/include/rs_time.rsh b/script_api/include/rs_time.rsh
new file mode 100644
index 0000000..6c0eeb0
--- /dev/null
+++ b/script_api/include/rs_time.rsh
@@ -0,0 +1,126 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/generate.sh.
+
+/*
+ * rs_time.rsh: Time Functions and Types
+ *
+ * The functions below can be used to tell the current clock time and the current
+ * system up time. It is not recommended to call these functions inside of a kernel.
+ */
+
+#ifndef RENDERSCRIPT_RS_TIME_RSH
+#define RENDERSCRIPT_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;
+#endif
+
+#ifdef __LP64__
+typedef long rs_time_t;
+#endif
+
+/*
+ * rs_tm: Date and time structure
+ *
+ * Data structure for broken-down time components.
+ */
+typedef struct {
+ 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;
+
+/*
+ * rsGetDt: Elapsed time since last call
+ *
+ * Returns the time in seconds since this function was last called in this script.
+ *
+ * Returns: Time in seconds.
+ */
+extern float __attribute__((overloadable))
+ rsGetDt(void);
+
+/*
+ * rsLocaltime: Convert to local time
+ *
+ * Converts the time specified by timer into a rs_tm structure that provides year, month,
+ * hour, etc. This value is stored at *local.
+ *
+ * This functions returns the same pointer that is passed as first argument. If the
+ * local parameter is NULL, this function does nothing and returns NULL.
+ *
+ * Parameters:
+ * local: Pointer to time structure where the local time will be stored.
+ * timer: Input time as a number of seconds since January 1, 1970.
+ *
+ * Returns: Pointer to the output local time, i.e. the same value as the parameter local.
+ */
+extern rs_tm* __attribute__((overloadable))
+ rsLocaltime(rs_tm* local, const rs_time_t* timer);
+
+/*
+ * rsTime: Seconds since January 1, 1970
+ *
+ * Returns the number of seconds since the Epoch (00:00:00 UTC, January 1, 1970).
+ *
+ * If timer is non-NULL, the result is also stored in the memory pointed to by
+ * this variable.
+ *
+ * Parameters:
+ * timer: Location to also store the returned calendar time.
+ *
+ * Returns: Seconds since the Epoch, -1 if there's an error.
+ */
+extern rs_time_t __attribute__((overloadable))
+ rsTime(rs_time_t* timer);
+
+/*
+ * rsUptimeMillis: System uptime in milliseconds
+ *
+ * Returns the current system clock (uptime) in milliseconds.
+ *
+ * Returns: Uptime in milliseconds.
+ */
+extern int64_t __attribute__((overloadable))
+ rsUptimeMillis(void);
+
+/*
+ * rsUptimeNanos: System uptime in nanoseconds
+ *
+ * Returns the current system clock (uptime) in nanoseconds.
+ *
+ * The granularity of the values return by this call may be much larger than a nanosecond.
+ *
+ * Returns: Uptime in nanoseconds.
+ */
+extern int64_t __attribute__((overloadable))
+ rsUptimeNanos(void);
+
+#endif // RENDERSCRIPT_RS_TIME_RSH
diff --git a/script_api/include/rs_value_types.rsh b/script_api/include/rs_value_types.rsh
new file mode 100644
index 0000000..180b297
--- /dev/null
+++ b/script_api/include/rs_value_types.rsh
@@ -0,0 +1,543 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/generate.sh.
+
+/*
+ * rs_value_types.rsh: Numerical Types
+ *
+ * Scalars:
+ *
+ * RenderScript supports the following scalar numerical types:
+ *
+ * 8 bits 16 bits 32 bits 64 bits
+ * Integer: char, int8_t short, int16_t int32_t long, long long, int64_t
+ * Unsigned integer: uchar, uint8_t ushort, uint16_t uint, uint32_t ulong, uint64_t
+ * Floating point: half float double
+ *
+ *
+ * Vectors:
+ *
+ * RenderScript supports fixed size vectors of length 2, 3, and 4.
+ * Vectors are declared using the common type name followed by a 2, 3, or 4.
+ * E.g. float4, int3, double2, ulong4.
+ *
+ * To create vector literals, use the vector type followed by the values enclosed
+ * between curly braces, e.g. (float3){1.0f, 2.0f, 3.0f}.
+ *
+ * Entries of a vector can be accessed using different naming styles.
+ *
+ * Single entries can be accessed by following the variable name with a dot and:
+ * - The letters x, y, z, and w,
+ * - The letters r, g, b, and a,
+ * - The letter s or S, followed by a zero based index.
+ *
+ * For example, with int4 myVar; the following are equivalent:
+ * myVar.x == myVar.r == myVar.s0 == myVar.S0
+ * myVar.y == myVar.g == myVar.s1 == myVar.S1
+ * myVar.z == myVar.b == myVar.s2 == myVar.S2
+ * myVar.w == myVar.a == myVar.s3 == myVar.S3
+ *
+ * Multiple entries of a vector can be accessed at once by using an identifier that is
+ * the concatenation of multiple letters or indices. The resulting vector has a size
+ * equal to the number of entries named.
+ *
+ * With the example above, the middle two entries can be accessed using
+ * myVar.yz, myVar.gb, myVar.s12, and myVar.S12.
+ *
+ * The entries don't have to be contiguous or in increasing order. Entries can even be
+ * repeated, as long as we're not trying to assign to it. You also can't mix the naming
+ * styles.
+ *
+ * Here are examples of what can or can't be done:
+ * float4 v4;
+ * float3 v3;
+ * float2 v2;
+ * v2 = v4.xx; // Valid
+ * v3 = v4.zxw; // Valid
+ * v3 = v4.bba; // Valid
+ * v3 = v4.s032; // Valid
+ * v3.s120 = v4.S233; // Valid
+ * v4.yz = v3.rg; // Valid
+ * v4.yzx = v3.rg; // Invalid: mismatched sizes
+ * v4.yzz = v3; // Invalid: z appears twice in an assignment
+ * v3 = v3.xas0; // Invalid: can't mix xyzw with rgba nor s0...
+ * v3 = v4.s034; // Invalid: the digit can only be 0, 1, 2, or 3
+ *
+ *
+ * Matrices and Quaternions:
+ *
+ * RenderScript supports fixed size square matrices of floats of size 2x2, 3x3, and 4x4.
+ * The types are named rs_matrix2x2, rs_matrix3x3, and rs_matrix4x4. See
+ * Matrix Functions for the list of operations.
+ *
+ * Quaternions are also supported via rs_quaternion. See Quaterion Functions for the list
+ * of operations.
+ */
+
+#ifndef RENDERSCRIPT_RS_VALUE_TYPES_RSH
+#define RENDERSCRIPT_RS_VALUE_TYPES_RSH
+
+/*
+ * half: 16 bit floating point value
+ *
+ * A 16 bit floating point value.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+typedef __fp16 half;
+#endif
+
+/*
+ * half2: Two 16 bit floats
+ *
+ * Vector version of the half float type. Provides two half fields packed
+ * into a single 32 bit field with 32 bit alignment.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+typedef half __attribute__((ext_vector_type(2))) half2;
+#endif
+
+/*
+ * half3: Three 16 bit floats
+ *
+ * Vector version of the half float type. Provides three half fields packed
+ * into a single 64 bit field with 64 bit alignment.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+typedef half __attribute__((ext_vector_type(3))) half3;
+#endif
+
+/*
+ * half4: Four 16 bit floats
+ *
+ * Vector version of the half float type. Provides four half fields packed
+ * into a single 64 bit field with 64 bit alignment.
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 23))
+typedef half __attribute__((ext_vector_type(4))) half4;
+#endif
+
+/*
+ * int8_t: 8 bit signed integer
+ *
+ * 8 bit signed integer type.
+ */
+typedef char int8_t;
+
+/*
+ * int16_t: 16 bit signed integer
+ *
+ * A 16 bit signed integer type.
+ */
+typedef short int16_t;
+
+/*
+ * int32_t: 32 bit signed integer
+ *
+ * A 32 bit signed integer type.
+ */
+typedef int int32_t;
+
+/*
+ * int64_t: 64 bit signed integer
+ *
+ * A 64 bit signed integer type.
+ */
+#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
+ *
+ * A 16 bit unsigned integer type.
+ */
+typedef unsigned short uint16_t;
+
+/*
+ * uint32_t: 32 bit unsigned integer
+ *
+ * A 32 bit unsigned integer type.
+ */
+typedef unsigned int uint32_t;
+
+/*
+ * uint64_t: 64 bit unsigned integer
+ *
+ * A 64 bit unsigned integer type.
+ */
+#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
+ *
+ * A 16 bit unsigned integer type.
+ */
+typedef uint16_t ushort;
+
+/*
+ * uint: 32 bit unsigned integer
+ *
+ * A 32 bit unsigned integer type.
+ */
+typedef uint32_t uint;
+
+/*
+ * ulong: 64 bit unsigned integer
+ *
+ * A 64 bit unsigned integer type.
+ */
+typedef uint64_t ulong;
+
+/*
+ * size_t: Unsigned size type
+ *
+ * Unsigned size type. The number of bits depend on the compilation flags.
+ */
+#ifdef __LP64__
+typedef uint64_t size_t;
+#endif
+
+#ifndef __LP64__
+typedef uint32_t size_t;
+#endif
+
+/*
+ * ssize_t: Signed size type
+ *
+ * Signed size type. The number of bits depend on the compilation flags.
+ */
+#ifdef __LP64__
+typedef int64_t ssize_t;
+#endif
+
+#ifndef __LP64__
+typedef int32_t ssize_t;
+#endif
+
+/*
+ * float2: Two 32 bit floats
+ *
+ * A vector of two floats. These two floats are packed into a single 64 bit field
+ * with a 64 bit alignment.
+ *
+ * A vector of two floats. These two floats are packed into a single 64 bit field
+ * with a 64 bit alignment.
+ */
+typedef float __attribute__((ext_vector_type(2))) float2;
+
+/*
+ * float3: Three 32 bit floats
+ *
+ * A vector of three floats. These three floats are packed into a single 128 bit field
+ * with a 128 bit alignment.
+ */
+typedef float __attribute__((ext_vector_type(3))) float3;
+
+/*
+ * float4: Four 32 bit floats
+ *
+ * A vector of four floats type. These four floats are packed into a single 128 bit field
+ * with a 128 bit alignment.
+ */
+typedef float __attribute__((ext_vector_type(4))) float4;
+
+/*
+ * double2: Two 64 bit floats
+ *
+ * A vector of two doubles. These two double fields packed into a single 128 bit field
+ * with a 128 bit alignment.
+ */
+typedef double __attribute__((ext_vector_type(2))) double2;
+
+/*
+ * double3: Three 64 bit floats
+ *
+ * A vector of three doubles. These three double fields packed into a single 256 bit field
+ * with a 256 bit alignment.
+ */
+typedef double __attribute__((ext_vector_type(3))) double3;
+
+/*
+ * double4: Four 64 bit floats
+ *
+ * A vector of four doubles. These four double fields packed into a single 256 bit field
+ * with a 256 bit alignment.
+ */
+typedef double __attribute__((ext_vector_type(4))) double4;
+
+/*
+ * uchar2: Two 8 bit unsigned integers
+ *
+ * A vector of two uchars. These two uchar fields packed into a single 16 bit field
+ * with a 16 bit alignment.
+ */
+typedef uchar __attribute__((ext_vector_type(2))) uchar2;
+
+/*
+ * uchar3: Three 8 bit unsigned integers
+ *
+ * A vector of three uchars. These three uchar fields packed into a single 32 bit field
+ * with a 32 bit alignment.
+ */
+typedef uchar __attribute__((ext_vector_type(3))) uchar3;
+
+/*
+ * uchar4: Four 8 bit unsigned integers
+ *
+ * A vector of four uchars. These four uchar fields packed into a single 32 bit field
+ * with a 32 bit alignment.
+ */
+typedef uchar __attribute__((ext_vector_type(4))) uchar4;
+
+/*
+ * ushort2: Two 16 bit unsigned integers
+ *
+ * A vector of two ushorts. These two ushort fields packed into a single 32 bit field
+ * with a 32 bit alignment.
+ */
+typedef ushort __attribute__((ext_vector_type(2))) ushort2;
+
+/*
+ * ushort3: Three 16 bit unsigned integers
+ *
+ * A vector of three ushorts. These three ushort fields packed into a single 64 bit field
+ * with a 64 bit alignment.
+ */
+typedef ushort __attribute__((ext_vector_type(3))) ushort3;
+
+/*
+ * ushort4: Four 16 bit unsigned integers
+ *
+ * A vector of four ushorts. These four ushort fields packed into a single 64 bit field
+ * with a 64 bit alignment.
+ */
+typedef ushort __attribute__((ext_vector_type(4))) ushort4;
+
+/*
+ * uint2: Two 32 bit unsigned integers
+ *
+ * A vector of two uints. These two uints are packed into a single 64 bit field
+ * with a 64 bit alignment.
+ */
+typedef uint __attribute__((ext_vector_type(2))) uint2;
+
+/*
+ * uint3: Three 32 bit unsigned integers
+ *
+ * A vector of three uints. These three uints are packed into a single 128 bit field
+ * with a 128 bit alignment.
+ */
+typedef uint __attribute__((ext_vector_type(3))) uint3;
+
+/*
+ * uint4: Four 32 bit unsigned integers
+ *
+ * A vector of four uints. These four uints are packed into a single 128 bit field
+ * with a 128 bit alignment.
+ */
+typedef uint __attribute__((ext_vector_type(4))) uint4;
+
+/*
+ * ulong2: Two 64 bit unsigned integers
+ *
+ * A vector of two ulongs. These two ulongs are packed into a single 128 bit field
+ * with a 128 bit alignment.
+ */
+typedef ulong __attribute__((ext_vector_type(2))) ulong2;
+
+/*
+ * ulong3: Three 64 bit unsigned integers
+ *
+ * A vector of three ulongs. These three ulong fields packed into a single 256 bit field
+ * with a 256 bit alignment.
+ */
+typedef ulong __attribute__((ext_vector_type(3))) ulong3;
+
+/*
+ * ulong4: Four 64 bit unsigned integers
+ *
+ * A vector of four ulongs. These four ulong fields packed into a single 256 bit field
+ * with a 256 bit alignment.
+ */
+typedef ulong __attribute__((ext_vector_type(4))) ulong4;
+
+/*
+ * char2: Two 8 bit signed integers
+ *
+ * A vector of two chars. These two chars are packed into a single 16 bit field
+ * with a 16 bit alignment.
+ */
+typedef char __attribute__((ext_vector_type(2))) char2;
+
+/*
+ * char3: Three 8 bit signed integers
+ *
+ * A vector of three chars. These three chars are packed into a single 32 bit field
+ * with a 32 bit alignment.
+ */
+typedef char __attribute__((ext_vector_type(3))) char3;
+
+/*
+ * char4: Four 8 bit signed integers
+ *
+ * A vector of four chars. These four chars are packed into a single 32 bit field
+ * with a 32 bit alignment.
+ */
+typedef char __attribute__((ext_vector_type(4))) char4;
+
+/*
+ * short2: Two 16 bit signed integers
+ *
+ * A vector of two shorts. These two shorts are packed into a single 32 bit field
+ * with a 32 bit alignment.
+ */
+typedef short __attribute__((ext_vector_type(2))) short2;
+
+/*
+ * short3: Three 16 bit signed integers
+ *
+ * A vector of three shorts. These three short fields packed into a single 64 bit field
+ * with a 64 bit alignment.
+ */
+typedef short __attribute__((ext_vector_type(3))) short3;
+
+/*
+ * short4: Four 16 bit signed integers
+ *
+ * A vector of four shorts. These four short fields packed into a single 64 bit field
+ * with a 64 bit alignment.
+ */
+typedef short __attribute__((ext_vector_type(4))) short4;
+
+/*
+ * int2: Two 32 bit signed integers
+ *
+ * A vector of two ints. These two ints are packed into a single 64 bit field
+ * with a 64 bit alignment.
+ */
+typedef int __attribute__((ext_vector_type(2))) int2;
+
+/*
+ * int3: Three 32 bit signed integers
+ *
+ * A vector of three ints. These three ints are packed into a single 128 bit field
+ * with a 128 bit alignment.
+ */
+typedef int __attribute__((ext_vector_type(3))) int3;
+
+/*
+ * int4: Four 32 bit signed integers
+ *
+ * A vector of four ints. These two fours are packed into a single 128 bit field
+ * with a 128 bit alignment.
+ */
+typedef int __attribute__((ext_vector_type(4))) int4;
+
+/*
+ * long2: Two 64 bit signed integers
+ *
+ * A vector of two longs. These two longs are packed into a single 128 bit field
+ * with a 128 bit alignment.
+ */
+typedef long __attribute__((ext_vector_type(2))) long2;
+
+/*
+ * long3: Three 64 bit signed integers
+ *
+ * A vector of three longs. These three longs are packed into a single 256 bit field
+ * with a 256 bit alignment.
+ */
+typedef long __attribute__((ext_vector_type(3))) long3;
+
+/*
+ * long4: Four 64 bit signed integers
+ *
+ * A vector of four longs. These four longs are packed into a single 256 bit field
+ * with a 256 bit alignment.
+ */
+typedef long __attribute__((ext_vector_type(4))) long4;
+
+/*
+ * rs_matrix2x2: 2x2 matrix of 32 bit floats
+ *
+ * A square 2x2 matrix of floats. The entries are stored in the array at the
+ * location [row*2 + col].
+ *
+ * See Matrix Functions.
+ */
+typedef struct {
+ float m[4];
+} rs_matrix2x2;
+
+/*
+ * rs_matrix3x3: 3x3 matrix of 32 bit floats
+ *
+ * A square 3x3 matrix of floats. The entries are stored in the array at the
+ * location [row*3 + col].
+ *
+ * See Matrix Functions.
+ */
+typedef struct {
+ float m[9];
+} rs_matrix3x3;
+
+/*
+ * rs_matrix4x4: 4x4 matrix of 32 bit floats
+ *
+ * A square 4x4 matrix of floats. The entries are stored in the array at the
+ * location [row*4 + col].
+ *
+ * See Matrix Functions.
+ */
+typedef struct {
+ float m[16];
+} rs_matrix4x4;
+
+/*
+ * rs_quaternion: Quaternion
+ *
+ * A square 4x4 matrix of floats that represents a quaternion.
+ *
+ * See Quaternion Functions.
+ */
+typedef float4 rs_quaternion;
+
+#endif // RENDERSCRIPT_RS_VALUE_TYPES_RSH
diff --git a/script_api/include/rs_vector_math.rsh b/script_api/include/rs_vector_math.rsh
new file mode 100644
index 0000000..2f5e8e7
--- /dev/null
+++ b/script_api/include/rs_vector_math.rsh
@@ -0,0 +1,453 @@
+/*
+ * Copyright (C) 2016 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.
+ */
+
+// Don't edit this file! It is auto-generated by frameworks/rs/api/generate.sh.
+
+/*
+ * rs_vector_math.rsh: Vector Math Functions
+ *
+ * These functions interpret the input arguments as representation of vectors in
+ * n-dimensional space.
+ *
+ * The precision of the mathematical operations on 32 bit floats is affected by the pragmas
+ * rs_fp_relaxed and rs_fp_full. See Mathematical Constants and Functions for details.
+ *
+ * Different precision/speed tradeoffs can be achieved by using variants of the common math
+ * functions. Functions with a name starting with
+ * - native_: May have custom hardware implementations with weaker precision. Additionally,
+ * subnormal values may be flushed to zero, rounding towards zero may be used, and NaN and
+ * infinity input may not be handled correctly.
+ * - fast_: May perform internal computations using 16 bit floats. Additionally, subnormal
+ * values may be flushed to zero, and rounding towards zero may be used.
+ *
+ */
+
+#ifndef RENDERSCRIPT_RS_VECTOR_MATH_RSH
+#define RENDERSCRIPT_RS_VECTOR_MATH_RSH
+
+/*
+ * cross: Cross product of two vectors
+ *
+ * Computes the cross product of two vectors.
+ */
+extern float3 __attribute__((const, overloadable))
+ cross(float3 left_vector, float3 right_vector);
+
+extern float4 __attribute__((const, overloadable))
+ cross(float4 left_vector, float4 right_vector);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ cross(half3 left_vector, half3 right_vector);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ cross(half4 left_vector, half4 right_vector);
+#endif
+
+/*
+ * distance: Distance between two points
+ *
+ * Compute the distance between two points.
+ *
+ * See also fast_distance(), native_distance().
+ */
+extern float __attribute__((const, overloadable))
+ distance(float left_vector, float right_vector);
+
+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);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ distance(half left_vector, half right_vector);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ distance(half2 left_vector, half2 right_vector);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ distance(half3 left_vector, half3 right_vector);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ distance(half4 left_vector, half4 right_vector);
+#endif
+
+/*
+ * dot: Dot product of two vectors
+ *
+ * Computes the dot product of two vectors.
+ */
+extern float __attribute__((const, overloadable))
+ dot(float left_vector, float right_vector);
+
+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);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ dot(half left_vector, half right_vector);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ dot(half2 left_vector, half2 right_vector);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ dot(half3 left_vector, half3 right_vector);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ dot(half4 left_vector, half4 right_vector);
+#endif
+
+/*
+ * 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.
+ *
+ * See also distance(), native_distance().
+ */
+#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))
+extern float __attribute__((const, overloadable))
+ fast_distance(float2 left_vector, float2 right_vector);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern float __attribute__((const, overloadable))
+ fast_distance(float3 left_vector, float3 right_vector);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern float __attribute__((const, overloadable))
+ fast_distance(float4 left_vector, float4 right_vector);
+#endif
+
+/*
+ * 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.
+ *
+ * See also length(), native_length().
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern float __attribute__((const, overloadable))
+ fast_length(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern float __attribute__((const, overloadable))
+ fast_length(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern float __attribute__((const, overloadable))
+ fast_length(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern float __attribute__((const, overloadable))
+ fast_length(float4 v);
+#endif
+
+/*
+ * 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.
+ *
+ * See also normalize(), native_normalize().
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern float __attribute__((const, overloadable))
+ fast_normalize(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern float2 __attribute__((const, overloadable))
+ fast_normalize(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern float3 __attribute__((const, overloadable))
+ fast_normalize(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 17))
+extern float4 __attribute__((const, overloadable))
+ fast_normalize(float4 v);
+#endif
+
+/*
+ * length: Length of a vector
+ *
+ * Computes the length of a vector.
+ *
+ * See also fast_length(), native_length().
+ */
+extern float __attribute__((const, overloadable))
+ length(float v);
+
+extern float __attribute__((const, overloadable))
+ length(float2 v);
+
+extern float __attribute__((const, overloadable))
+ length(float3 v);
+
+extern float __attribute__((const, overloadable))
+ length(float4 v);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ length(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ length(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ length(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ length(half4 v);
+#endif
+
+/*
+ * native_distance: Approximate distance between two points
+ *
+ * Computes the approximate distance between two points.
+ *
+ * See also distance(), fast_distance().
+ */
+#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))
+extern float __attribute__((const, overloadable))
+ native_distance(float2 left_vector, float2 right_vector);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+ native_distance(float3 left_vector, float3 right_vector);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+ native_distance(float4 left_vector, float4 right_vector);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ native_distance(half left_vector, half right_vector);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ native_distance(half2 left_vector, half2 right_vector);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ native_distance(half3 left_vector, half3 right_vector);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ native_distance(half4 left_vector, half4 right_vector);
+#endif
+
+/*
+ * native_length: Approximate length of a vector
+ *
+ * Compute the approximate length of a vector.
+ *
+ * See also length(), fast_length().
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+ native_length(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+ native_length(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+ native_length(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+ native_length(float4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ native_length(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ native_length(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ native_length(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ native_length(half4 v);
+#endif
+
+/*
+ * native_normalize: Approximately normalize a vector
+ *
+ * Approximately normalizes a vector.
+ *
+ * See also normalize(), fast_normalize().
+ */
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float __attribute__((const, overloadable))
+ native_normalize(float v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float2 __attribute__((const, overloadable))
+ native_normalize(float2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float3 __attribute__((const, overloadable))
+ native_normalize(float3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 21))
+extern float4 __attribute__((const, overloadable))
+ native_normalize(float4 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ native_normalize(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ native_normalize(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ native_normalize(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ native_normalize(half4 v);
+#endif
+
+/*
+ * normalize: Normalize a vector
+ *
+ * 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.
+ *
+ * See also fast_normalize(), native_normalize().
+ */
+extern float __attribute__((const, overloadable))
+ normalize(float v);
+
+extern float2 __attribute__((const, overloadable))
+ normalize(float2 v);
+
+extern float3 __attribute__((const, overloadable))
+ normalize(float3 v);
+
+extern float4 __attribute__((const, overloadable))
+ normalize(float4 v);
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half __attribute__((const, overloadable))
+ normalize(half v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half2 __attribute__((const, overloadable))
+ normalize(half2 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half3 __attribute__((const, overloadable))
+ normalize(half3 v);
+#endif
+
+#if (defined(RS_VERSION) && (RS_VERSION >= 24))
+extern half4 __attribute__((const, overloadable))
+ normalize(half4 v);
+#endif
+
+#endif // RENDERSCRIPT_RS_VECTOR_MATH_RSH
diff --git a/script_api/rs_allocation_create.spec b/script_api/rs_allocation_create.spec
new file mode 100644
index 0000000..9a020a2
--- /dev/null
+++ b/script_api/rs_allocation_create.spec
@@ -0,0 +1,251 @@
+#
+# 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 Creation Functions
+description:
+ The functions below can be used to create Allocations from a Script.
+
+ These functions can be called directly or indirectly from an invokable
+ function. If some control-flow path can result in a call to these functions
+ from a RenderScript kernel function, a compiler error will be generated.
+end:
+
+function: rsCreateElement
+version: 24
+ret: rs_element
+arg: rs_data_type data_type, "Data type of the Element"
+summary: Creates an rs_element object of the specified data type
+description:
+ Creates an rs_element object of the specified data type. The data kind of
+ the Element will be set to RS_KIND_USER and vector_width will be set to 1,
+ indicating non-vector.
+test: none
+end:
+
+function: rsCreateVectorElement
+version: 24
+ret: rs_element
+arg: rs_data_type data_type, "Data type of the Element"
+arg: uint32_t vector_width, "Vector width (either 2, 3, or 4)"
+summary: Creates an rs_element object of the specified data type and vector width
+description:
+ Creates an rs_element object of the specified data type and vector width.
+ Value of vector_width must be 2, 3 or 4. The data kind of the Element will
+ be set to RS_KIND_USER.
+test: none
+end:
+
+function: rsCreatePixelElement
+version: 24
+ret: rs_element
+arg: rs_data_type data_type, "Data type of the Element"
+arg: rs_data_kind data_kind, "Data kind of the Element"
+summary: Creates an rs_element object of the specified data type and data kind
+description:
+ Creates an rs_element object of the specified data type and data kind. The
+ vector_width of the Element will be set to 1, indicating non-vector.
+test: none
+end:
+
+function: rsCreateElement
+version: 24
+internal: true
+ret: rs_element
+arg: int32_t data_type
+arg: int32_t data_kind
+arg: bool isNormalized
+arg: uint32_t vecSize
+test: none
+end:
+
+function: rsCreateType
+version: 24
+ret: rs_type
+arg: rs_element element, "Element to be associated with the Type"
+arg: uint32_t dimX, "Size along the X dimension"
+arg: uint32_t dimY, "Size along the Y dimension"
+arg: uint32_t dimZ, "Size along the Z dimension"
+arg: bool mipmaps, "Flag indicating if the Type has a mipmap chain"
+arg: bool faces, "Flag indicating if the Type is a cubemap"
+arg: rs_yuv_format yuv_format, "YUV layout for the Type"
+summary: Creates an rs_type object with the specified Element and shape attributes
+description:
+ Creates an rs_type object with the specified Element and shape attributes.
+
+ dimX specifies the size of the X dimension.
+
+ dimY, if present and non-zero, indicates that the Y dimension is present and
+ indicates its size.
+
+ dimZ, if present and non-zero, indicates that the Z dimension is present and
+ indicates its size.
+
+ mipmaps indicates the presence of level of detail (LOD).
+
+ faces indicates the presence of cubemap faces.
+
+ yuv_format indicates the associated YUV format (or RS_YUV_NONE).
+test: none
+end:
+
+function: rsCreateType
+version: 24
+ret: rs_type
+arg: rs_element element
+arg: uint32_t dimX
+arg: uint32_t dimY
+arg: uint32_t dimZ
+test:none
+end:
+
+function: rsCreateType
+version: 24
+ret: rs_type
+arg: rs_element element
+arg: uint32_t dimX
+arg: uint32_t dimY
+test:none
+end:
+
+function: rsCreateType
+version: 24
+ret: rs_type
+arg: rs_element element
+arg: uint32_t dimX
+test:none
+end:
+
+function: rsCreateAllocation
+version: 24
+ret: rs_allocation
+arg: rs_type type, "Type of the Allocation"
+arg: uint32_t usage, "Usage flag for the allocation"
+summary: Create an rs_allocation object of given Type.
+description:
+ Creates an rs_allocation object of the given Type and usage.
+
+ RS_ALLOCATION_USAGE_SCRIPT and RS_ALLOCATION_USAGE_GRAPHICS_TEXTURE are the
+ only supported usage flags for Allocations created from within a RenderScript
+ Script.
+
+ You can also use rsCreateAllocation_<type><width> wrapper functions to directly
+ create Allocations of scalar and vector numerical types without creating
+ intermediate rs_element or rs_type objects.
+
+ E.g. rsCreateAllocation_int4() returns an Allocation of int4 data type of
+ specified dimensions.
+test: none
+end:
+
+function: rsCreateAllocation
+version: 24
+ret: rs_allocation
+arg: rs_type type
+test: none
+end:
+
+function: rsCreateAllocation
+version: 24
+internal: true
+ret: rs_allocation
+arg: rs_type type
+arg: rs_allocation_mipmap_control mipmap
+arg: uint32_t usages
+arg: void* ptr
+test: none
+end:
+
+function: rsCreateAllocation_#1
+version: 24
+t: u8, u16, u32, u64, i8, i16, i32, i64, f16, f32, f64
+ret: rs_allocation
+arg: uint32_t dimX
+arg: uint32_t dimY
+arg: uint32_t dimZ
+inline:
+ rs_element e = rsCreateElement(RS_TYPE_#RST_1);
+ rs_type t = rsCreateType(e, dimX, dimY, dimZ);
+ return rsCreateAllocation(t);
+test: none
+end:
+
+function: rsCreateAllocation_#2#1
+version: 24
+w: 2, 3, 4
+t: u8, u16, u32, u64, i8, i16, i32, i64, f16, f32, f64
+ret: rs_allocation
+arg: uint32_t dimX
+arg: uint32_t dimY
+arg: uint32_t dimZ
+inline:
+ rs_element e = rsCreateVectorElement(RS_TYPE_#RST_2, #1);
+ rs_type t = rsCreateType(e, dimX, dimY, dimZ);
+ return rsCreateAllocation(t);
+test: none
+end:
+
+function: rsCreateAllocation_#1
+version: 24
+t: u8, u16, u32, u64, i8, i16, i32, i64, f16, f32, f64
+ret: rs_allocation
+arg: uint32_t dimX
+arg: uint32_t dimY
+inline:
+ rs_element e = rsCreateElement(RS_TYPE_#RST_1);
+ rs_type t = rsCreateType(e, dimX, dimY);
+ return rsCreateAllocation(t);
+test: none
+end:
+
+function: rsCreateAllocation_#2#1
+version: 24
+w: 2, 3, 4
+t: u8, u16, u32, u64, i8, i16, i32, i64, f16, f32, f64
+ret: rs_allocation
+arg: uint32_t dimX
+arg: uint32_t dimY
+inline:
+ rs_element e = rsCreateVectorElement(RS_TYPE_#RST_2, #1);
+ rs_type t = rsCreateType(e, dimX, dimY);
+ return rsCreateAllocation(t);
+test: none
+end:
+
+function: rsCreateAllocation_#1
+version: 24
+t: u8, u16, u32, u64, i8, i16, i32, i64, f16, f32, f64
+ret: rs_allocation
+arg: uint32_t dimX
+inline:
+ rs_element e = rsCreateElement(RS_TYPE_#RST_1);
+ rs_type t = rsCreateType(e, dimX);
+ return rsCreateAllocation(t);
+test: none
+end:
+
+function: rsCreateAllocation_#2#1
+version: 24
+w: 2, 3, 4
+t: u8, u16, u32, u64, i8, i16, i32, i64, f16, f32, f64
+ret: rs_allocation
+arg: uint32_t dimX
+inline:
+ rs_element e = rsCreateVectorElement(RS_TYPE_#RST_2, #1);
+ rs_type t = rsCreateType(e, dimX);
+ return rsCreateAllocation(t);
+test: none
+end:
diff --git a/script_api/rs_allocation_data.spec b/script_api/rs_allocation_data.spec
new file mode 100644
index 0000000..4ec1d48
--- /dev/null
+++ b/script_api/rs_allocation_data.spec
@@ -0,0 +1,553 @@
+#
+# 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 Data Access Functions
+description:
+ The functions below can be used to get and set the cells that comprise
+ an allocation.
+ <ul>
+ <li>Individual cells are accessed using the rsGetElementAt* and
+ @rsSetElementAt functions.</li>
+ <li>Multiple cells can be copied using the rsAllocationCopy* and
+ rsAllocationV* functions.</li>
+ <li>For getting values through a sampler, use @rsSample.</li>
+ </ul>
+ The @rsGetElementAt and rsSetElement* functions are somewhat misnamed.
+ They don't get or set elements, which are akin to data types; they get
+ or set cells. Think of them as rsGetCellAt and and rsSetCellAt.
+end:
+
+function: rsAllocationCopy1DRange
+version: 14
+ret: void
+arg: rs_allocation dstAlloc, "Allocation to copy cells into."
+arg: uint32_t dstOff, "Offset in the destination of the first cell to be copied into."
+arg: uint32_t dstMip, "Mip level in the destination allocation. 0 if mip mapping is not used."
+arg: uint32_t count, "Number of cells to be copied."
+arg: rs_allocation srcAlloc, "Source allocation."
+arg: uint32_t srcOff, "Offset in the source of the first cell to be copied."
+arg: uint32_t srcMip, "Mip level in the source allocation. 0 if mip mapping is not used."
+summary: Copy consecutive cells between allocations
+description:
+ Copies the specified number of cells from one allocation to another.
+
+ The two allocations must be different. Using this function to copy whithin
+ the same allocation yields undefined results.
+
+ The function does not validate whether the offset plus count exceeds the size
+ of either allocation. Be careful!
+
+ This function should only be called between 1D allocations. Calling it
+ on other allocations is undefined.
+
+ This function should not be called from inside a kernel, or from any function
+ that may be called directly or indirectly from a kernel. Doing so would cause a
+ runtime error.
+test: none
+end:
+
+function: rsAllocationCopy2DRange
+version: 14
+ret: void
+arg: rs_allocation dstAlloc, "Allocation to copy cells into."
+arg: uint32_t dstXoff, "X offset in the destination of the region to be set."
+arg: uint32_t dstYoff, "Y offset in the destination of the region to be set."
+arg: uint32_t dstMip, "Mip level in the destination allocation. 0 if mip mapping is not used."
+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, "Source allocation."
+arg: uint32_t srcXoff, "X offset in the source."
+arg: uint32_t srcYoff, "Y offset in the source."
+arg: uint32_t srcMip, "Mip level in the source allocation. 0 if mip mapping is not used."
+arg: rs_allocation_cubemap_face srcFace, "Cubemap face of the source allocation. Ignored for allocations that aren't cubemaps."
+summary: Copy a rectangular region of cells between allocations
+description:
+ Copies a rectangular region of cells from one allocation to another.
+ (width * heigth) cells are copied.
+
+ The two allocations must be different. Using this function to copy whithin
+ the same allocation yields undefined results.
+
+ The function does not validate whether the the source or destination region
+ exceeds the size of its respective allocation. Be careful!
+
+ This function should only be called between 2D allocations. Calling it
+ on other allocations is undefined.
+
+ This function should not be called from inside a kernel, or from any function
+ that may be called directly or indirectly from a kernel. Doing so would cause a
+ runtime error.
+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, "Allocation to get the data from."
+arg: uint32_t x, "X offset in the allocation of the first cell to be copied from."
+summary: Get a vector from an allocation of scalars
+description:
+ This function returns a vector composed of successive cells of the allocation.
+ It assumes that the allocation contains scalars.
+
+ The "X" in the name indicates that successive values are extracted by
+ increasing the X index. There are currently no functions to get successive
+ values incrementing other dimensions. Use multiple calls to rsGetElementAt()
+ instead.
+
+ For example, when calling rsAllocationVLoadX_int4(a, 20, 30), an int4 composed
+ of a[20, 30], a[21, 30], a[22, 30], and a[23, 30] is returned.
+
+ When retrieving from a three dimensional allocations, use the x, y, z variant.
+ Similarly, use the x, y variant for two dimensional allocations and x for the
+ mono dimensional allocations.
+
+ For efficiency, this function does not validate the inputs. Trying to wrap
+ the X index, exceeding the size of the allocation, or using indices incompatible
+ with the dimensionality of the allocation yields undefined results.
+
+ See also @rsAllocationVStoreX().
+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, "Y offset in the allocation of the first cell to be copied from."
+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, "Z offset in the allocation of the first cell to be copied from."
+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, "Allocation to store the data into."
+arg: #2#1 val, "Value to be stored."
+arg: uint32_t x, "X offset in the allocation of the first cell to be copied into."
+summary: Store a vector into an allocation of scalars
+description:
+ This function stores the entries of a vector into successive cells of an allocation.
+ It assumes that the allocation contains scalars.
+
+ The "X" in the name indicates that successive values are stored by increasing
+ the X index. There are currently no functions to store successive values
+ incrementing other dimensions. Use multiple calls to rsSetElementAt() instead.
+
+ For example, when calling rsAllocationVStoreX_int3(a, v, 20, 30), v.x is stored
+ at a[20, 30], v.y at a[21, 30], and v.z at a[22, 30].
+
+ When storing into a three dimensional allocations, use the x, y, z variant.
+ Similarly, use the x, y variant for two dimensional allocations and x for the
+ mono dimensional allocations.
+
+ For efficiency, this function does not validate the inputs. Trying to wrap the
+ X index, exceeding the size of the allocation, or using indices incompatible
+ with the dimensionality of the allocation yiels undefined results.
+
+ See also @rsAllocationVLoadX().
+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, "Y offset in the allocation of the first cell to be copied into."
+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, "Z offset in the allocation of the first cell to be copied into."
+test: none
+end:
+
+function: rsGetElementAt
+ret: const void*
+arg: rs_allocation a
+arg: uint32_t x
+summary: Return a cell from an allocation
+description:
+ This function extracts a single cell from an allocation.
+
+ When retrieving from a three dimensional allocations, use the x, y, z variant.
+ Similarly, use the x, y variant for two dimensional allocations and x for the
+ mono dimensional allocations.
+
+ This function has two styles. One returns the address of the value using a void*,
+ the other returns the actual value, e.g. rsGetElementAt() vs. rsGetElementAt_int4().
+ For primitive types, always use the latter as it is more efficient.
+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: rsGetElementAt_#2#1
+version: 23
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: rs_allocation a
+arg: uint32_t x
+test: none
+end:
+
+function: rsGetElementAt_#2#1
+version: 23
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: rs_allocation a
+arg: uint32_t x
+arg: uint32_t y
+test: none
+end:
+
+function: rsGetElementAt_#2#1
+version: 23
+w: 1, 2, 3, 4
+t: f16
+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: Get the U component of an allocation of YUVs
+description:
+ Extracts the U component of a single YUV value from a 2D allocation of YUVs.
+
+ Inside an allocation, Y, U, and V components may be stored if different planes
+ and at different resolutions. The x, y coordinates provided here are in the
+ dimensions of the Y plane.
+
+ See @rsGetElementAtYuv_uchar_Y().
+test: none
+end:
+
+function: rsGetElementAtYuv_uchar_V
+version: 18
+ret: uchar
+arg: rs_allocation a
+arg: uint32_t x
+arg: uint32_t y
+summary: Get the V component of an allocation of YUVs
+description:
+ Extracts the V component of a single YUV value from a 2D allocation of YUVs.
+
+ Inside an allocation, Y, U, and V components may be stored if different planes
+ and at different resolutions. The x, y coordinates provided here are in the
+ dimensions of the Y plane.
+
+ See @rsGetElementAtYuv_uchar_Y().
+test: none
+end:
+
+function: rsGetElementAtYuv_uchar_Y
+version: 18
+ret: uchar
+arg: rs_allocation a
+arg: uint32_t x
+arg: uint32_t y
+summary: Get the Y component of an allocation of YUVs
+description:
+ Extracts the Y component of a single YUV value from a 2D allocation of YUVs.
+
+ Inside an allocation, Y, U, and V components may be stored if different planes
+ and at different resolutions. The x, y coordinates provided here are in the
+ dimensions of the Y plane.
+
+ See @rsGetElementAtYuv_uchar_U() and @rsGetElementAtYuv_uchar_V().
+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: Sample a value from a texture allocation
+description:
+ Fetches a value from a texture 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.
+
+ See <a href='http://developer.android.com/reference/android/renderscript/Sampler.html'>android.renderscript.Sampler</a> for more details.
+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 a cell of an allocation
+description:
+ This function stores a value into a single cell of an allocation.
+
+ When storing into a three dimensional allocations, use the x, y, z variant.
+ Similarly, use the x, y variant for two dimensional allocations and x for
+ the mono dimensional allocations.
+
+ This function has two styles. One passes the value to be stored using a void*,
+ the other has the actual value as an argument, e.g. rsSetElementAt() vs.
+ rsSetElementAt_int4(). For primitive types, always use the latter as it is
+ more efficient.
+
+ See also @rsGetElementAt().
+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:
+
+function: rsSetElementAt_#2#1
+version: 23
+w: 1, 2, 3, 4
+t: f16
+ret: void
+arg: rs_allocation a
+arg: #2#1 val
+arg: uint32_t x
+test: none
+end:
+
+function: rsSetElementAt_#2#1
+version: 23
+w: 1, 2, 3, 4
+t: f16
+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: 23
+w: 1, 2, 3, 4
+t: f16
+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/script_api/rs_atomic.spec b/script_api/rs_atomic.spec
new file mode 100644
index 0000000..07713c2
--- /dev/null
+++ b/script_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 Update Functions
+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 done in the right order.
+
+ These functions are slower than their non-atomic equivalents, 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, "Value of *addr prior to the operation."
+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, "Value of *addr prior to the operation."
+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, "Value of *addr prior to the operation."
+arg: volatile int32_t* addr, "Address of the value to compare and replace if the test passes."
+arg: int32_t compareValue, "Value to test *addr against."
+arg: int32_t newValue, "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, "Value of *addr prior to the operation."
+arg: volatile int32_t* addr, "Address of the value to decrement."
+summary: Thread-safe decrement
+description:
+ Atomicly subtracts one from the value at addr. This is equivalent 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, "Value of *addr prior to the operation."
+arg: volatile int32_t* addr, "Address of the value to increment."
+summary: Thread-safe increment
+description:
+ Atomicly adds one to the value at addr. This is equivalent 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, "Value of *addr prior to the operation."
+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, "Value of *addr prior to the operation."
+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, "Value of *addr prior to the operation."
+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, "Value of *addr prior to the operation."
+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, "Value of *addr prior to the operation."
+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/script_api/rs_convert.spec b/script_api/rs_convert.spec
new file mode 100644
index 0000000..6ae7b40
--- /dev/null
+++ b/script_api/rs_convert.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: Conversion Functions
+description:
+ The functions below convert from a numerical vector type to another, or from one color
+ representation to another.
+end:
+
+function: convert_#3#1
+version: 9
+attrib: const
+w: 2, 3, 4
+t: u8, u16, u32, i8, i16, i32, f32
+t: u8, u16, u32, i8, i16, i32, f32
+ret: #3#1
+arg: #2#1 v, compatible(#3)
+summary: Convert numerical vectors
+description:
+ Converts a vector from one numerical type to another. The conversion are done entry per entry.
+
+ E.g calling <code>a = convert_short3(b);</code> is equivalent to doing
+ <code>a.x = (short)b.x; a.y = (short)b.y; a.z = (short)b.z;</code>.
+
+ Converting floating point values to integer types truncates.
+
+ Converting numbers too large to fit the destination type yields 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: convert_#3#1
+version: 24
+attrib: const
+w: 2, 3, 4
+t: f16
+t: u8, u16, u32, u64, i8, i16, i32, i64, f16, f32, f64
+ret: #3#1
+arg: #2#1 v, compatible(#3)
+end:
+
+function: convert_#3#1
+version: 24
+attrib: const
+w: 2, 3, 4
+t: u8, u16, u32, u64, i8, i16, i32, i64, f32, f64
+t: f16
+ret: #3#1
+arg: #2#1 v, compatible(#3)
+end:
+
+function: rsPackColorTo8888
+attrib: const
+ret: uchar4
+arg: float r, "Red component."
+arg: float g, "Green component."
+arg: float b, "Blue component."
+summary: Create a uchar4 RGBA from floats
+description:
+ Packs three or four floating point RGBA values into a uchar4.
+
+ The input values are typically between 0.0f and 1.0f inclusive. For input values outside
+ of this range, the resulting outputs will be clamped to be between 0 and 255. As this
+ clamping may be done after the input is multiplied by 255.f and converted to an integer,
+ input numbers greater than INT_MAX/255.f or less than INT_MIN/255.f result in
+ undefined behavior.
+
+ If the alpha component is not specified, it is assumed to be 1.0, i.e. the result will
+ have an alpha set to 255.
+test: none
+end:
+
+function: rsPackColorTo8888
+attrib: const
+ret: uchar4
+arg: float r
+arg: float g
+arg: float b
+arg: float a, "Alpha component."
+test: none
+end:
+
+function: rsPackColorTo8888
+attrib: const
+ret: uchar4
+arg: float3 color, "Vector of 3 or 4 floats containing the R, G, B, and A values."
+test: none
+end:
+
+function: rsPackColorTo8888
+attrib: const
+ret: uchar4
+arg: float4 color
+test: none
+end:
+
+function: rsUnpackColor8888
+# NOTE: The = below indicates that the generator should not add "overloadable" by default.
+# We're doing this to stay backward compatible with the unusual declaration used when this
+# function was introduced.
+attrib: =const
+ret: float4
+arg: uchar4 c
+summary: Create a float4 RGBA from uchar4
+description:
+ Unpacks a uchar4 color to float4. The resulting floats will be between 0.0 and 1.0 inclusive.
+test: none
+end:
+
+function: rsYuvToRGBA_#2#1
+attrib: const
+w: 4
+t: u8, f32
+ret: #2#1
+arg: uchar y, "Luminance component."
+arg: uchar u, "U chrominance component."
+arg: uchar v, "V chrominance component."
+summary: Convert a YUV value to RGBA
+description:
+ Converts a color from a YUV representation to RGBA.
+
+ We currently don't provide a function to do the reverse conversion.
+test: none
+end:
diff --git a/script_api/rs_core.spec b/script_api/rs_core.spec
new file mode 100644
index 0000000..afc7cf4
--- /dev/null
+++ b/script_api/rs_core.spec
@@ -0,0 +1,54 @@
+#
+# 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: Overview
+description:
+ 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 "stdbool.h"
+
+ #include "rs_value_types.rsh"
+ #include "rs_object_types.rsh"
+
+ #include "rs_allocation_create.rsh"
+ #include "rs_allocation_data.rsh"
+ #include "rs_atomic.rsh"
+ #include "rs_convert.rsh"
+ #include "rs_debug.rsh"
+ #include "rs_for_each.rsh"
+ #include "rs_io.rsh"
+ #include "rs_math.rsh"
+ #include "rs_matrix.rsh"
+ #include "rs_object_info.rsh"
+ #include "rs_quaternion.rsh"
+ #include "rs_time.rsh"
+ #include "rs_vector_math.rsh"
+end:
diff --git a/script_api/rs_debug.spec b/script_api/rs_debug.spec
new file mode 100644
index 0000000..35d9265
--- /dev/null
+++ b/script_api/rs_debug.spec
@@ -0,0 +1,158 @@
+#
+# 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: Debugging Functions
+description:
+ The functions below are intended to be used during application developement.
+ They should not be used in shipping applications.
+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: Log a message and values
+description:
+ This function prints a message to the standard log, followed by the provided values.
+
+ This function is intended for debugging only and should not be used in shipping
+ applications.
+test: none
+end:
+
+function: rsDebug
+version: 17
+w: 2, 3, 4
+t: i32, u32, i64, u64
+ret: void
+arg: const char* message
+arg: #2#1 a
+test: none
+end:
+
+function: rsDebug
+version: 23
+w: 2, 3, 4
+t: f64
+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: 24
+w: 1, 2, 3, 4
+ret: void
+arg: const char* message
+arg: half#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/script_api/rs_for_each.spec b/script_api/rs_for_each.spec
new file mode 100644
index 0000000..a59f618
--- /dev/null
+++ b/script_api/rs_for_each.spec
@@ -0,0 +1,458 @@
+#
+# 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: Kernel Invocation Functions and Types
+description:
+ The @rsForEach() function can be used to invoke the root kernel of a script.
+
+ The other functions are used to get the characteristics of the invocation of
+ an executing kernel, like dimensions and current indices. These functions take
+ a @rs_kernel_context as argument.
+end:
+
+type: rs_for_each_strategy_t
+enum: rs_for_each_strategy
+value: RS_FOR_EACH_STRATEGY_SERIAL = 0, "Prefer contiguous memory regions."
+value: RS_FOR_EACH_STRATEGY_DONT_CARE = 1, "No prefrences."
+#TODO explain this better
+value: RS_FOR_EACH_STRATEGY_DST_LINEAR = 2, "Prefer DST."
+value: RS_FOR_EACH_STRATEGY_TILE_SMALL = 3, "Prefer processing small rectangular regions."
+value: RS_FOR_EACH_STRATEGY_TILE_MEDIUM = 4, "Prefer processing medium rectangular regions."
+value: RS_FOR_EACH_STRATEGY_TILE_LARGE = 5, "Prefer processing large rectangular regions."
+summary: Suggested cell processing order
+description:
+ This type is used to suggest how the invoked kernel should iterate over the cells of the
+ allocations. This is a hint only. Implementations may not follow the suggestion.
+
+ This specification can help the caching behavior of the running kernel, e.g. the cache
+ locality when the processing is distributed over multiple cores.
+end:
+
+type: rs_kernel_context
+version: 23
+simple: const struct rs_kernel_context_t *
+summary: Handle to a kernel invocation context
+description:
+ The kernel context contains common characteristics of the allocations being iterated
+ over, like dimensions. It also contains rarely used indices of the currently processed
+ cell, like the Array0 index or the current level of detail.
+
+ You can access the kernel context by adding a special parameter named "context" of type
+ rs_kernel_context to your kernel function. See @rsGetDimX() and @rsGetArray0() for examples.
+end:
+
+type: rs_script_call_t
+struct: rs_script_call
+field: rs_for_each_strategy_t strategy, "Currently ignored. In the future, will be suggested cell iteration strategy."
+field: uint32_t xStart, "Starting index in the X dimension."
+field: uint32_t xEnd, "Ending index (exclusive) in the X dimension."
+field: uint32_t yStart, "Starting index in the Y dimension."
+field: uint32_t yEnd, "Ending index (exclusive) in the Y dimension."
+field: uint32_t zStart, "Starting index in the Z dimension."
+field: uint32_t zEnd, "Ending index (exclusive) in the Z dimension."
+field: uint32_t arrayStart, "Starting index in the Array0 dimension."
+field: uint32_t arrayEnd, "Ending index (exclusive) in the Array0 dimension."
+field: uint32_t array1Start, "Starting index in the Array1 dimension."
+field: uint32_t array1End, "Ending index (exclusive) in the Array1 dimension."
+field: uint32_t array2Start, "Starting index in the Array2 dimension."
+field: uint32_t array2End, "Ending index (exclusive) in the Array2 dimension."
+field: uint32_t array3Start, "Starting index in the Array3 dimension."
+field: uint32_t array3End, "Ending index (exclusive) in the Array3 dimension."
+summary: Cell iteration information
+description:
+ This structure is used to provide iteration information to a rsForEach call.
+ It is currently used to restrict processing to a subset of cells. In future
+ versions, it will also be used to provide hint on how to best iterate over
+ the cells.
+
+ The Start fields are inclusive and the End fields are exclusive. E.g. to iterate
+ over cells 4, 5, 6, and 7 in the X dimension, set xStart to 4 and xEnd to 8.
+end:
+
+type: rs_kernel
+version: 24
+simple: void*
+summary: Handle to a kernel function
+description:
+ An opaque type for a function that is defined with the kernel attribute. A value
+ of this type can be used in a @rsForEach call to launch a kernel.
+end:
+
+function: rsForEach
+version: 9 13
+ret: void
+arg: rs_script script, "Script to call."
+arg: rs_allocation input, "Allocation to source data from."
+arg: rs_allocation output, "Allocation to write date into."
+arg: const void* usrData, "User defined data to pass to the script. May be NULL."
+arg: const rs_script_call_t* sc, "Extra control information used to select a sub-region of the allocation to be processed or suggest a walking strategy. May be NULL."
+summary: Launches a kernel
+description:
+ Runs the kernel over zero or more input allocations. They are passed after the
+ @rs_kernel argument. If the specified kernel returns a value, an output allocation
+ must be specified as the last argument. All input allocations,
+ and the output allocation if it exists, must have the same dimensions.
+
+ This is a synchronous function. A call to this function only returns after all
+ the work has completed for all cells of the input allocations. If the kernel
+ function returns any value, the call waits until all results have been written
+ to the output allocation.
+
+ Up to API level 23, the kernel is implicitly specified as the kernel named
+ "root" in the specified script, and only a single input allocation can be used.
+ Starting in API level 24, an arbitrary kernel function can be used,
+ as specified by the kernel argument. The script argument is removed.
+ The kernel must be defined in the current script. In addition, more than one
+ input can be used.
+
+ E.g.<code><br/>
+ float __attribute__((kernel)) square(float a) {<br/>
+ return a * a;<br/>
+ }<br/>
+ <br/>
+ void compute(rs_allocation ain, rs_allocation aout) {<br/>
+ rsForEach(square, ain, aout);<br/>
+ }<br/>
+ <br/></code>
+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, "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 23
+ret: void
+arg: rs_script script
+arg: rs_allocation input
+arg: rs_allocation output
+test: none
+end:
+
+function: rsForEach
+version: 24
+intrinsic: true
+# Not overloadable
+attrib: =
+ret: void
+arg: rs_kernel kernel, "Function designator to a function that is defined with the kernel attribute."
+arg: ..., "Input and output allocations"
+test: none
+end:
+
+function: rsForEachWithOptions
+version: 24
+intrinsic: true
+# Not overloadable
+attrib: =
+ret: void
+arg: rs_kernel kernel, "Function designator to a function that is defined with the kernel attribute."
+arg: rs_script_call_t* options, "Launch options"
+arg: ..., "Input and output allocations"
+summary: Launches a kernel with options
+description:
+ Launches kernel in a way similar to @rsForEach. However, instead of processing
+ all cells in the input, this function only processes cells in the subspace of
+ the index space specified in options. With the index space explicitly specified
+ by options, no input or output allocation is required for a kernel launch using
+ this API. If allocations are passed in, they must match the number of arguments
+ and return value expected by the kernel function. The output allocation is
+ present if and only if the kernel has a non-void return value.
+
+ E.g.,<code><br/>
+ rs_script_call_t opts = {0};<br/>
+ opts.xStart = 0;<br/>
+ opts.xEnd = dimX;<br/>
+ opts.yStart = 0;<br/>
+ opts.yEnd = dimY / 2;<br/>
+ rsForEachWithOptions(foo, &opts, out, out);<br/>
+ </code>
+test: none
+end:
+
+function: rsForEachInternal
+version: 24
+internal: true
+ret: void
+arg: int slot
+arg: rs_script_call_t* options
+arg: int hasOutput, "Indicates whether the kernel generates output"
+arg: int numInputs, "Number of input allocations"
+arg: rs_allocation* allocs, "Input and output allocations"
+summary: (Internal API) Launch a kernel in the current Script (with the slot number)
+description:
+ Internal API to launch a kernel.
+test: none
+end:
+
+function: rsGetArray0
+version: 23
+ret: uint32_t
+arg: rs_kernel_context context
+summary: Index in the Array0 dimension for the specified kernel context
+description:
+ Returns the index in the Array0 dimension of the cell being processed, as specified
+ by the supplied kernel context.
+
+ The kernel context contains common characteristics of the allocations being iterated
+ over and rarely used indices, like the Array0 index.
+
+ You can access the kernel context by adding a special parameter named "context" of
+ type rs_kernel_context to your kernel function. E.g.<br/>
+ <code>short RS_KERNEL myKernel(short value, uint32_t x, rs_kernel_context context) {<br/>
+ // The current index in the common x, y, z dimensions are accessed by<br/>
+ // adding these variables as arguments. For the more rarely used indices<br/>
+ // to the other dimensions, extract them from the kernel context:<br/>
+ uint32_t index_a0 = rsGetArray0(context);<br/>
+ //...<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 context
+summary: Index in the Array1 dimension for the specified kernel context
+description:
+ Returns the index in the Array1 dimension of the cell being processed, as specified
+ by the supplied kernel 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 context
+summary: Index in the Array2 dimension for the specified kernel context
+description:
+ Returns the index in the Array2 dimension of the cell being processed,
+ as specified by the supplied kernel 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 context
+summary: Index in the Array3 dimension for the specified kernel context
+description:
+ Returns the index in the Array3 dimension of the cell being processed, as specified
+ by the supplied kernel 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 context
+summary: Size of the Array0 dimension for the specified kernel context
+description:
+ Returns the size of the Array0 dimension for the specified kernel 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 context
+summary: Size of the Array1 dimension for the specified kernel context
+description:
+ Returns the size of the Array1 dimension for the specified kernel 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 context
+summary: Size of the Array2 dimension for the specified kernel context
+description:
+ Returns the size of the Array2 dimension for the specified kernel 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 context
+summary: Size of the Array3 dimension for the specified kernel context
+description:
+ Returns the size of the Array3 dimension for the specified kernel 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 context
+summary: Presence of more than one face for the specified kernel context
+description:
+ If the kernel is iterating over 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 context
+summary: Number of levels of detail for the specified kernel context
+description:
+ Returns the number of levels of detail for the specified kernel 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 context
+summary: Size of the X dimension for the specified kernel context
+description:
+ Returns the size of the X dimension for the specified kernel context.
+
+ The kernel context contains common characteristics of the allocations being iterated
+ over and rarely used indices, like the Array0 index.
+
+ You can access it by adding a special parameter named "context" of
+ type rs_kernel_context to your kernel function. E.g.<br/>
+ <code>int4 RS_KERNEL myKernel(int4 value, rs_kernel_context context) {<br/>
+ uint32_t size = rsGetDimX(context); //...<br/></code>
+
+ To get the dimension of specific allocation, use @rsAllocationGetDimX().
+test: none
+end:
+
+function: rsGetDimY
+version: 23
+ret: uint32_t
+arg: rs_kernel_context context
+summary: Size of the Y dimension for the specified kernel context
+description:
+ Returns the size of the X dimension for the specified kernel context.
+ See @rsGetDimX() for an explanation of the context.
+
+ Returns 0 if the Y dimension is not present.
+
+ To get the dimension of specific allocation, use @rsAllocationGetDimY().
+test: none
+end:
+
+function: rsGetDimZ
+version: 23
+ret: uint32_t
+arg: rs_kernel_context context
+summary: Size of the Z dimension for the specified kernel context
+description:
+ Returns the size of the Z dimension for the specified kernel context.
+ See @rsGetDimX() for an explanation of the context.
+
+ Returns 0 if the Z dimension is not present.
+
+ To get the dimension of specific allocation, use @rsAllocationGetDimZ().
+test: none
+end:
+
+function: rsGetFace
+version: 23
+ret: rs_allocation_cubemap_face
+arg: rs_kernel_context context
+summary: Coordinate of the Face for the specified kernel context
+description:
+ Returns the face on which the cell being processed is found, as specified by the
+ supplied kernel 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 context
+summary: Index in the Levels of Detail dimension for the specified kernel context
+description:
+ Returns the index in the Levels of Detail dimension of the cell being processed,
+ as specified by the supplied kernel 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/script_api/rs_graphics.spec b/script_api/rs_graphics.spec
new file mode 100644
index 0000000..db93cfc
--- /dev/null
+++ b/script_api/rs_graphics.spec
@@ -0,0 +1,980 @@
+#
+# 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: Graphics Functions and Types
+description:
+ The graphics subsystem of RenderScript was removed at API level 23.
+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."
+ #endif
+
+ // TODO we seem to assume order for the other headers too.
+ #include "rs_object_types.rsh"
+end:
+
+type: rs_blend_src_func
+version: 16 22
+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
+deprecated: 22
+summary: Blend source function
+description:
+end:
+
+type: rs_blend_dst_func
+version: 16 22
+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
+deprecated: 22
+summary: Blend destination function
+description:
+end:
+
+type: rs_cull_mode
+version: 16 22
+size: 32
+enum:
+value: RS_CULL_BACK = 0
+value: RS_CULL_FRONT = 1
+value: RS_CULL_NONE = 2
+value: RS_CULL_INVALID = 100
+deprecated: 22
+summary: Culling mode
+description:
+end:
+
+type: rs_depth_func
+version: 16 22
+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"
+deprecated: 22
+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_primitive
+version: 16 22
+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"
+deprecated: 22
+summary: How to intepret mesh vertex data
+description:
+ Describes the way mesh vertex data is interpreted when rendering
+end:
+
+type: rs_font
+version: 9 22
+size: 32
+rs_object:
+deprecated: 22
+summary: Handle to a Font
+description:
+ Opaque handle to a RenderScript font object.
+ See: android.renderscript.Font
+end:
+
+
+type: rs_mesh
+version: 9 22
+size: 32
+rs_object:
+deprecated: 22
+summary: Handle to a Mesh
+description:
+ Opaque handle to a RenderScript mesh object.
+ See: android.renderscript.Mesh
+end:
+
+type: rs_program_fragment
+version: 9 22
+size: 32
+rs_object:
+deprecated: 22
+summary: Handle to a ProgramFragment
+description:
+ Opaque handle to a RenderScript ProgramFragment object.
+ See: android.renderscript.ProgramFragment
+end:
+
+type: rs_program_vertex
+version: 9 22
+size: 32
+rs_object:
+deprecated: 22
+summary: Handle to a ProgramVertex
+description:
+ Opaque handle to a RenderScript ProgramVertex object.
+ See: android.renderscript.ProgramVertex
+end:
+
+type: rs_program_raster
+version: 9 22
+size: 32
+rs_object:
+deprecated: 22
+summary: Handle to a ProgramRaster
+description:
+ Opaque handle to a RenderScript ProgramRaster object.
+ See: android.renderscript.ProgramRaster
+end:
+
+type: rs_program_store
+version: 9 22
+size: 32
+rs_object:
+deprecated: 22
+summary: Handle to a ProgramStore
+description:
+ Opaque handle to a RenderScript ProgramStore object.
+ See: android.renderscript.ProgramStore
+end:
+
+function: rsClearObject
+version: 9 22
+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
+version: 9 22
+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
+version: 9 22
+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:
+
+function: rsgAllocationSyncAll
+version: 9 22
+size: 32
+ret: void
+arg: rs_allocation alloc
+deprecated: 22
+summary: Sync the contents of an allocation
+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 22
+size: 32
+ret: void
+arg: rs_allocation alloc
+arg: rs_allocation_usage_type source
+test: none
+end:
+
+function: rsgBindColorTarget
+version: 14 22
+size: 32
+ret: void
+arg: rs_allocation colorTarget
+arg: uint slot
+deprecated: 22
+summary: Set the color target
+description:
+ Set the color target used for all subsequent rendering calls
+test: none
+end:
+
+function: rsgBindConstant
+version: 9 22
+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"
+deprecated: 22
+summary: Bind a constant allocation
+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
+version: 9 22
+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 22
+size: 32
+ret: void
+arg: rs_allocation depthTarget
+deprecated: 22
+summary: Set the depth target
+description:
+ Set the depth target used for all subsequent rendering calls
+test: none
+end:
+
+function: rsgBindFont
+version: 9 22
+size: 32
+ret: void
+arg: rs_font font, "object to bind"
+deprecated: 22
+summary: Bind a font object
+description:
+ Binds the font object to be used for all subsequent font rendering calls
+test: none
+end:
+
+function: rsgBindProgramFragment
+version: 9 22
+size: 32
+ret: void
+arg: rs_program_fragment pf
+deprecated: 22
+summary: Bind a ProgramFragment
+description:
+ Bind a new ProgramFragment to the rendering context.
+test: none
+end:
+
+function: rsgBindProgramRaster
+version: 9 22
+size: 32
+ret: void
+arg: rs_program_raster pr
+deprecated: 22
+summary: Bind a ProgramRaster
+description:
+ Bind a new ProgramRaster to the rendering context.
+test: none
+end:
+
+function: rsgBindProgramStore
+version: 9 22
+size: 32
+ret: void
+arg: rs_program_store ps
+deprecated: 22
+summary: Bind a ProgramStore
+description:
+ Bind a new ProgramStore to the rendering context.
+test: none
+end:
+
+function: rsgBindProgramVertex
+version: 9 22
+size: 32
+ret: void
+arg: rs_program_vertex pv
+deprecated: 22
+summary: Bind a ProgramVertex
+description:
+ Bind a new ProgramVertex to the rendering context.
+test: none
+end:
+
+function: rsgBindSampler
+version: 9 22
+size: 32
+ret: void
+arg: rs_program_fragment fragment
+arg: uint slot
+arg: rs_sampler sampler
+deprecated: 22
+summary: Bind a sampler
+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
+version: 9 22
+size: 32
+ret: void
+arg: rs_program_fragment v
+arg: uint slot
+arg: rs_allocation alloc
+deprecated: 22
+summary: Bind a texture allocation
+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 22
+size: 32
+ret: void
+deprecated: 22
+summary: Clear all color and depth targets
+description:
+ Clear all color and depth targets and resume rendering into
+ the framebuffer
+test: none
+end:
+
+function: rsgClearColor
+version: 9 22
+size: 32
+ret: void
+arg: float r
+arg: float g
+arg: float b
+arg: float a
+deprecated: 22
+summary: Clear the specified color from the surface
+description:
+ Clears the rendering surface to the specified color.
+test: none
+end:
+
+function: rsgClearColorTarget
+version: 14 22
+size: 32
+ret: void
+arg: uint slot
+deprecated: 22
+summary: Clear the color target
+description:
+ Clear the previously set color target
+test: none
+end:
+
+function: rsgClearDepth
+version: 9 22
+size: 32
+ret: void
+arg: float value
+deprecated: 22
+summary: Clear the depth surface
+description:
+ Clears the depth suface to the specified value.
+test: none
+end:
+
+function: rsgClearDepthTarget
+version: 14 22
+size: 32
+ret: void
+deprecated: 22
+summary: Clear the depth target
+description:
+ Clear the previously set depth target
+test: none
+end:
+
+function: rsgDrawMesh
+version: 9 22
+size: 32
+ret: void
+arg: rs_mesh ism, "mesh object to render"
+deprecated: 22
+summary: Draw a mesh
+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
+version: 9 22
+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
+version: 9 22
+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
+version: 9 22
+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
+deprecated: 22
+summary: Draw a quad
+description:
+ Low performance utility function for drawing a simple quad. Not intended for
+ drawing large quantities of geometry.
+test: none
+end:
+
+function: rsgDrawQuadTexCoords
+version: 9 22
+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
+deprecated: 22
+summary: Draw a textured quad
+description:
+ Low performance utility function for drawing a textured quad. Not intended
+ for drawing large quantities of geometry.
+test: none
+end:
+
+function: rsgDrawRect
+version: 9 22
+size: 32
+ret: void
+arg: float x1
+arg: float y1
+arg: float x2
+arg: float y2
+arg: float z
+deprecated: 22
+summary: Draw a rectangle
+description:
+ Low performance utility function for drawing a simple rectangle. Not
+ intended for drawing large quantities of geometry.
+test: none
+end:
+
+function: rsgDrawSpriteScreenspace
+version: 9 22
+size: 32
+ret: void
+arg: float x
+arg: float y
+arg: float z
+arg: float w
+arg: float h
+deprecated: 22
+summary: Draw rectangles in screenspace
+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
+version: 9 22
+size: 32
+ret: void
+arg: const char* text
+arg: int x
+arg: int y
+deprecated: 22
+summary: Draw a text string
+description:
+ Draws text given a string and location
+test: none
+end:
+
+function: rsgDrawText
+version: 9 22
+size: 32
+ret: void
+arg: rs_allocation alloc
+arg: int x
+arg: int y
+test: none
+end:
+
+function: rsgFinish
+version: 14 22
+size: 32
+ret: uint
+deprecated: 22
+summary: End rendering commands
+description:
+ Force RenderScript to finish all rendering commands
+test: none
+end:
+
+function: rsgFontColor
+version: 9 22
+size: 32
+ret: void
+arg: float r, "red component"
+arg: float g, "green component"
+arg: float b, "blue component"
+arg: float a, "alpha component"
+deprecated: 22
+summary: Set the font color
+description:
+ Sets the font color for all subsequent rendering calls
+test: none
+end:
+
+function: rsgGetHeight
+version: 9 22
+size: 32
+ret: uint
+deprecated: 22
+summary: Get the surface height
+description:
+ Get the height of the current rendering surface.
+test: none
+end:
+
+function: rsgGetWidth
+version: 9 22
+size: 32
+ret: uint
+deprecated: 22
+summary: Get the surface width
+description:
+ Get the width of the current rendering surface.
+test: none
+end:
+
+function: rsgMeasureText
+version: 9 22
+size: 32
+ret: void
+arg: const char* text
+arg: int* left
+arg: int* right
+arg: int* top
+arg: int* bottom
+deprecated: 22
+summary: Get the bounding box for a text string
+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
+version: 9 22
+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
+version: 9 22
+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
+deprecated: 22
+summary: Compute a bounding box
+description:
+ Computes an axis aligned bounding box of a mesh object
+test: none
+end:
+
+function: rsgMeshComputeBoundingBox
+version: 9 22
+size: 32
+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: rsgMeshGetIndexAllocation
+version: 16 22
+size: 32
+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"
+deprecated: 22
+summary: Return an allocation containing index data
+description:
+ Returns an allocation containing index data or a null
+ allocation if only the primitive is specified
+test: none
+end:
+
+function: rsgMeshGetPrimitive
+version: 16 22
+size: 32
+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"
+deprecated: 22
+summary: Return the primitive
+description:
+ Returns the primitive describing how a part of the mesh is
+ rendered
+test: none
+end:
+
+function: rsgMeshGetPrimitiveCount
+version: 16 22
+size: 32
+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"
+deprecated: 22
+summary: Return the number of index sets
+description:
+ Meshes could have multiple index sets, this function returns
+ the number.
+test: none
+end:
+
+function: rsgMeshGetVertexAllocation
+version: 16 22
+size: 32
+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"
+deprecated: 22
+summary: Return a vertex allocation
+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 22
+size: 32
+ret: uint32_t, "number of allocations in the mesh that contain vertex data"
+arg: rs_mesh m, "mesh to get data from"
+deprecated: 22
+summary: Return the number of vertex allocations
+description:
+ Returns the number of allocations in the mesh that contain
+ vertex data
+test: none
+end:
+
+function: rsgProgramFragmentConstantColor
+version: 9 22
+size: 32
+ret: void
+arg: rs_program_fragment pf
+arg: float r
+arg: float g
+arg: float b
+arg: float a
+deprecated: 22
+summary: Set the constant color for a fixed function emulation program
+description:
+ Set the constant color for a fixed function emulation program.
+test: none
+end:
+
+function: rsgProgramVertexGetProjectionMatrix
+version: 9 22
+size: 32
+ret: void
+arg: rs_matrix4x4* proj, "matrix to store the current projection matrix into"
+deprecated: 22
+summary: Get the projection matrix for a fixed function vertex program
+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
+version: 9 22
+size: 32
+ret: void
+arg: const rs_matrix4x4* model, "model matrix"
+deprecated: 22
+summary: Load the model matrix for a bound fixed function vertex program
+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
+version: 9 22
+size: 32
+ret: void
+arg: const rs_matrix4x4* proj, "projection matrix"
+deprecated: 22
+summary: Load the projection matrix for a bound fixed function vertex program
+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
+version: 9 22
+size: 32
+ret: void
+arg: const rs_matrix4x4* tex, "texture matrix"
+deprecated: 22
+summary: Load the texture matrix for a bound fixed function vertex program
+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:
+
+function: rsgProgramRasterGetCullMode
+version: 16 22
+size: 32
+ret: rs_cull_mode
+arg: rs_program_raster pr, "program raster to query"
+deprecated: 22
+summary: Get program raster cull mode
+description:
+ Get program raster cull mode
+test: none
+end:
+
+function: rsgProgramRasterIsPointSpriteEnabled
+version: 16 22
+size: 32
+ret: bool
+arg: rs_program_raster pr, "program raster to query"
+deprecated: 22
+summary: Get program raster point sprite state
+description:
+ Get program raster point sprite state
+test: none
+end:
+
+function: rsgProgramStoreGetBlendDstFunc
+version: 16 22
+size: 32
+ret: rs_blend_dst_func
+arg: rs_program_store ps, "program store to query"
+deprecated: 22
+summary: Get program store blend destination function
+description:
+ Get program store blend destination function
+test: none
+end:
+
+function: rsgProgramStoreGetBlendSrcFunc
+version: 16 22
+size: 32
+ret: rs_blend_src_func
+arg: rs_program_store ps, "program store to query"
+deprecated: 22
+summary: Get program store blend source function
+description:
+ Get program store blend source function
+test: none
+end:
+
+function: rsgProgramStoreGetDepthFunc
+version: 16 22
+size: 32
+ret: rs_depth_func
+arg: rs_program_store ps, "program store to query"
+deprecated: 22
+summary: Get program store depth function
+description:
+ Get program store depth function
+test: none
+end:
+
+function: rsgProgramStoreIsColorMaskAlphaEnabled
+version: 16 22
+size: 32
+ret: bool
+arg: rs_program_store ps, "program store to query"
+deprecated: 22
+summary: Get program store alpha component color mask
+description:
+ Get program store alpha component color mask
+test: none
+end:
+
+function: rsgProgramStoreIsColorMaskBlueEnabled
+version: 16 22
+size: 32
+ret: bool
+arg: rs_program_store ps, "program store to query"
+deprecated: 22
+summary: Get program store blur component color mask
+description:
+ Get program store blur component color mask
+test: none
+end:
+
+function: rsgProgramStoreIsColorMaskGreenEnabled
+version: 16 22
+size: 32
+ret: bool
+arg: rs_program_store ps, "program store to query"
+deprecated: 22
+summary: Get program store green component color mask
+description:
+ Get program store green component color mask
+test: none
+end:
+
+function: rsgProgramStoreIsColorMaskRedEnabled
+version: 16 22
+size: 32
+ret: bool
+arg: rs_program_store ps, "program store to query"
+deprecated: 22
+summary: Get program store red component color mask
+description:
+ Get program store red component color mask
+test: none
+end:
+
+function: rsgProgramStoreIsDepthMaskEnabled
+version: 16 22
+size: 32
+ret: bool
+arg: rs_program_store ps, "program store to query"
+deprecated: 22
+summary: Get program store depth mask
+description:
+ Get program store depth mask
+test: none
+end:
+
+function: rsgProgramStoreIsDitherEnabled
+version: 16 22
+size: 32
+ret: bool
+arg: rs_program_store ps, "program store to query"
+deprecated: 22
+summary: Get program store dither state
+description:
+ Get program store dither state
+test: none
+end:
diff --git a/script_api/rs_io.spec b/script_api/rs_io.spec
new file mode 100644
index 0000000..f10b58f
--- /dev/null
+++ b/script_api/rs_io.spec
@@ -0,0 +1,101 @@
+#
+# 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: Input/Output Functions
+description:
+ These functions are used to:<ul>
+ <li>Send information to the Java client, and</li>
+#TODO We need better documentation for:
+ <li>Send the processed allocation or receive the next allocation to process.</li></ul>
+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.
+#TODO We need better documentation.
+
+ This function should not be called from inside a kernel, or from any function
+ that may be called directly or indirectly from a kernel. Doing so would cause a
+ runtime error.
+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.
+#TODO We need better documentation.
+
+ This function should not be called from inside a kernel, or from any function
+ that may be called directly or indirectly from a kernel. Doing so would cause a
+ runtime error.
+test: none
+end:
+
+function: rsSendToClient
+ret: bool
+arg: int cmdID
+summary: Send a message to the client, non-blocking
+description:
+ Sends a message back to the client. This call does not block.
+ It returns true if the message was sent and false if the
+ message queue is full.
+
+ A message ID is required. The data payload is optional.
+
+ See <a href='http://developer.android.com/reference/android/renderscript/RenderScript.RSMessageHandler.html'>RenderScript.RSMessageHandler</a>.
+test: none
+end:
+
+function: rsSendToClient
+ret: bool
+arg: int cmdID
+arg: const void* data, "Application specific data."
+arg: uint len, "Length of the data, in bytes."
+test: none
+end:
+
+function: rsSendToClientBlocking
+ret: void
+arg: int cmdID
+summary: Send a message to the client, blocking
+description:
+ Sends a message back to the client. This function will block
+ until there is room on the message queue for this message.
+ This function may return before the message was delivered and
+ processed by the client.
+
+ A message ID is required. The data payload is optional.
+
+ See <a href='http://developer.android.com/reference/android/renderscript/RenderScript.RSMessageHandler.html'>RenderScript.RSMessageHandler</a>.
+test: none
+end:
+
+function: rsSendToClientBlocking
+ret: void
+arg: int cmdID
+arg: const void* data, "Application specific data."
+arg: uint len, "Length of the data, in bytes."
+test: none
+end:
diff --git a/script_api/rs_math.spec b/script_api/rs_math.spec
new file mode 100644
index 0000000..b4093e8
--- /dev/null
+++ b/script_api/rs_math.spec
@@ -0,0 +1,3409 @@
+#
+# Copyright (C) 2014 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: Mathematical Constants and Functions
+description:
+ The mathematical functions below can be applied to scalars and vectors. When applied
+ to vectors, the returned value is a vector of the function applied to each entry of the input.
+
+ For example:<code><br/>
+ 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>
+
+ See <a href='rs_vector_math.html'>Vector Math Functions</a> for functions like @distance() and @length() that interpret
+ instead the input as a single vector in n-dimensional space.
+
+ The precision of the mathematical operations on 32 bit floats is affected by the pragmas
+ rs_fp_relaxed and rs_fp_full. Under rs_fp_relaxed, subnormal values may be flushed to zero and
+ rounding may be done towards zero. In comparison, rs_fp_full requires correct handling of
+ subnormal values, i.e. smaller than 1.17549435e-38f. rs_fp_rull also requires round to nearest
+ with ties to even.
+
+ Different precision/speed tradeoffs can be achieved by using variants of the common math
+ functions. Functions with a name starting with<ul>
+ <li>native_: May have custom hardware implementations with weaker precision. Additionally,
+ subnormal values may be flushed to zero, rounding towards zero may be used, and NaN and
+ infinity input may not be handled correctly.</li>
+ <li>half_: May perform internal computations using 16 bit floats. Additionally, subnormal
+ values may be flushed to zero, and rounding towards zero may be used.</li>
+ </ul>
+end:
+
+# TODO Add f16 versions of these constants.
+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:
+deprecated: 22, Use M_2_PI instead.
+summary: 2 / pi, as a 32 bit float
+description:
+ 2 divided by pi, as a 32 bit float.
+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:
+
+function: abs
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: i8, i16, i32
+ret: u#2#1
+arg: #2#1 v
+summary: Absolute value of an integer
+description:
+ Returns the absolute value of an integer.
+
+ For floats, use @fabs().
+end:
+
+function: acos
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v, range(-1,1)
+summary: Inverse cosine
+description:
+ Returns the inverse cosine, in radians.
+
+ See also @native_acos().
+end:
+
+function: acos
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v, range(-1,1)
+end:
+
+function: acosh
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+summary: Inverse hyperbolic cosine
+description:
+ Returns the inverse hyperbolic cosine, in radians.
+
+ See also @native_acosh().
+end:
+
+function: acosh
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+end:
+
+function: acospi
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+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 <code>acospi(a) * 180.f</code>.
+
+ See also @native_acospi().
+end:
+
+function: acospi
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v, range(-1,1)
+end:
+
+function: asin
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v, range(-1,1)
+summary: Inverse sine
+description:
+ Returns the inverse sine, in radians.
+
+ See also @native_asin().
+end:
+
+function: asin
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v, range(-1,1)
+end:
+
+function: asinh
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+summary: Inverse hyperbolic sine
+description:
+ Returns the inverse hyperbolic sine, in radians.
+
+ See also @native_asinh().
+end:
+
+function: asinh
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+end:
+
+function: asinpi
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+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 <code>asinpi(a) * 180.f</code>.
+
+ See also @native_asinpi().
+end:
+
+function: asinpi
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v, range(-1,1)
+end:
+
+function: atan
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v, range(-1,1)
+summary: Inverse tangent
+description:
+ Returns the inverse tangent, in radians.
+
+ See also @native_atan().
+end:
+
+function: atan
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v, range(-1,1)
+end:
+
+function: atan2
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 numerator, "Numerator."
+arg: #2#1 denominator, "Denominator. Can be 0."
+summary: Inverse tangent of a ratio
+description:
+ Returns the inverse tangent of <code>(numerator / denominator)</code>, in radians.
+
+ See also @native_atan2().
+end:
+
+function: atan2
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 numerator
+arg: #2#1 denominator
+end:
+
+function: atan2pi
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 numerator, "Numerator."
+arg: #2#1 denominator, "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 <code>atan2pi(n, d) * 180.f</code>.
+
+ See also @native_atan2pi().
+end:
+
+function: atan2pi
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 numerator
+arg: #2#1 denominator
+end:
+
+function: atanh
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v, range(-1,1)
+summary: Inverse hyperbolic tangent
+description:
+ Returns the inverse hyperbolic tangent, in radians.
+
+ See also @native_atanh().
+end:
+
+function: atanh
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v, range(-1,1)
+end:
+
+function: atanpi
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+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 <code>atanpi(a) * 180.f</code>.
+
+ See also @native_atanpi().
+end:
+
+function: atanpi
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v, range(-1,1)
+end:
+
+function: cbrt
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+summary: Cube root
+description:
+ Returns the cube root.
+
+ See also @native_cbrt().
+end:
+
+function: cbrt
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+end:
+
+function: ceil
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+summary: Smallest integer not less than a value
+description:
+ Returns the smallest integer not less than a value.
+
+ For example, <code>ceil(1.2f)</code> returns 2.f, and <code>ceil(-1.2f)</code> returns -1.f.
+
+ See also @floor().
+end:
+
+function: ceil
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+end:
+
+function: clamp
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+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 < 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.
+end:
+
+function: clamp
+version: 9
+attrib: const
+w: 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 value
+arg: #2 min_value
+arg: #2 max_value, above(min_value)
+end:
+
+function: clamp
+version: 19
+attrib: const
+w: 1, 2, 3, 4
+t: u8, u16, u32, u64, i8, i16, i32, i64
+ret: #2#1
+arg: #2#1 value
+arg: #2#1 min_value
+arg: #2#1 max_value, above(min_value)
+end:
+
+function: clamp
+version: 19
+attrib: const
+w: 2, 3, 4
+t: u8, u16, u32, u64, i8, i16, i32, i64
+ret: #2#1
+arg: #2#1 value
+arg: #2 min_value
+arg: #2 max_value, above(min_value)
+end:
+
+function: clamp
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 value
+arg: #2#1 min_value
+arg: #2#1 max_value, above(min_value)
+end:
+
+function: clamp
+version: 24
+attrib: const
+w: 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 value
+arg: #2 min_value
+arg: #2 max_value, above(min_value)
+end:
+
+function: clz
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: u8, u16, u32, i8, i16, i32
+ret: #2#1
+arg: #2#1 value
+summary: Number of leading 0 bits
+description:
+ Returns the number of leading 0-bits in a value.
+
+ For example, <code>clz((char)0x03)</code> returns 6.
+end:
+
+function: copysign
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 magnitude_value
+arg: #2#1 sign_value
+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, <code>copysign(4.0f, -2.7f)</code> returns -4.0f and <code>copysign(-4.0f, 2.7f)</code> returns 4.0f.
+end:
+
+function: copysign
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 magnitude_value
+arg: #2#1 sign_value
+end:
+
+function: cos
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+summary: Cosine
+description:
+ Returns the cosine of an angle measured in radians.
+
+ See also @native_cos().
+end:
+
+function: cos
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+end:
+
+function: cosh
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+summary: Hypebolic cosine
+description:
+ Returns the hypebolic cosine of v, where v is measured in radians.
+
+ See also @native_cosh().
+end:
+
+function: cosh
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+end:
+
+function: cospi
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+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 <code>cospi(v / 180.f)</code>.
+
+ See also @native_cospi().
+end:
+
+function: cospi
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+end:
+
+function: degrees
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+summary: Converts radians into degrees
+description:
+ Converts from radians to degrees.
+end:
+
+function: degrees
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+end:
+
+function: erf
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+summary: Mathematical error function
+description:
+ Returns the error function.
+end:
+
+function: erf
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+end:
+
+function: erfc
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+summary: Mathematical complementary error function
+description:
+ Returns the complementary error function.
+end:
+
+function: erfc
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+end:
+
+function: exp
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+summary: e raised to a number
+description:
+ Returns e raised to v, i.e. e ^ v.
+
+ See also @native_exp().
+end:
+
+function: exp
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+end:
+
+function: exp10
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+summary: 10 raised to a number
+description:
+ Returns 10 raised to v, i.e. 10.f ^ v.
+
+ See also @native_exp10().
+end:
+
+function: exp10
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+end:
+
+function: exp2
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+summary: 2 raised to a number
+description:
+ Returns 2 raised to v, i.e. 2.f ^ v.
+
+ See also @native_exp2().
+end:
+
+function: exp2
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+end:
+
+function: expm1
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+summary: e raised to a number minus one
+description:
+ Returns e raised to v minus 1, i.e. (e ^ v) - 1.
+
+ See also @native_expm1().
+end:
+
+function: expm1
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+end:
+
+function: fabs
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+summary: Absolute value of a float
+description:
+ Returns the absolute value of the float v.
+
+ For integers, use @abs().
+end:
+
+function: fabs
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+end:
+
+function: fdim
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 a
+arg: #2#1 b
+summary: Positive difference between two values
+description:
+ Returns the positive difference between two values.
+
+ If a > b, returns (a - b) otherwise returns 0f.
+end:
+
+function: fdim
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 a
+arg: #2#1 b
+end:
+
+function: floor
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+summary: Smallest integer not greater than a value
+description:
+ Returns the smallest integer not greater than a value.
+
+ For example, <code>floor(1.2f)</code> returns 1.f, and <code>floor(-1.2f)</code> returns -2.f.
+
+ See also @ceil().
+end:
+
+function: floor
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+end:
+
+function: fma
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 multiplicand1
+arg: #2#1 multiplicand2
+arg: #2#1 offset
+summary: Multiply and add
+description:
+ Multiply and add. Returns <code>(multiplicand1 * multiplicand2) + offset</code>.
+
+ 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:
+
+function: fma
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 multiplicand1
+arg: #2#1 multiplicand2
+arg: #2#1 offset
+end:
+
+function: fmax
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 a
+arg: #2#1 b
+summary: Maximum of two floats
+description:
+ Returns the maximum of a and b, i.e. <code>(a < b ? b : a)</code>.
+
+ The @max() function returns identical results but can be applied to more data types.
+end:
+
+function: fmax
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 a
+arg: #2#1 b
+end:
+
+function: fmax
+version: 9
+attrib: const
+w: 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 a
+arg: #2 b
+end:
+
+function: fmax
+version: 24
+attrib: const
+w: 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 a
+arg: #2 b
+end:
+
+function: fmin
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 a
+arg: #2#1 b
+summary: Minimum of two floats
+description:
+ Returns the minimum of a and b, i.e. <code>(a > b ? b : a)</code>.
+
+ The @min() function returns identical results but can be applied to more data types.
+end:
+
+function: fmin
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 a
+arg: #2#1 b
+end:
+
+function: fmin
+version: 9
+attrib: const
+w: 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 a
+arg: #2 b
+end:
+
+function: fmin
+version: 24
+attrib: const
+w: 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 a
+arg: #2 b
+end:
+
+function: fmod
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 numerator
+arg: #2#1 denominator
+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, <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:
+
+function: fmod
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 numerator
+arg: #2#1 denominator
+end:
+
+function: fract
+version: 9
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+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, <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:
+
+function: fract
+version: 9 23
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+inline:
+ #2#1 unused;
+ return fract(v, &unused);
+end:
+
+function: fract
+version: 24
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+end:
+
+function: fract
+version: 24
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+arg: #2#1* floor
+end:
+
+function: fract
+version: 24
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+end:
+
+function: frexp
+version: 9
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+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. See also @logb() and @ilogb().
+end:
+
+function: frexp
+version: 24
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+arg: int#1* exponent
+test: none
+end:
+
+function: half_recip
+version: 17
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+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.
+
+ See also @native_recip().
+end:
+
+function: half_rsqrt
+version: 17
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+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.
+
+ See also @rsqrt(), @native_rsqrt().
+end:
+
+function: half_sqrt
+version: 17
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+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.
+
+ See also @sqrt(), @native_sqrt().
+end:
+
+function: hypot
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 a
+arg: #2#1 b
+summary: Hypotenuse
+description:
+ Returns the hypotenuse, i.e. <code>sqrt(a * a + b * b)</code>.
+
+ See also @native_hypot().
+end:
+
+function: hypot
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 a
+arg: #2#1 b
+end:
+
+function: ilogb
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: int#1
+arg: float#1 v
+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, <code>ilogb(8.5f)</code> 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.
+test: custom
+end:
+
+function: ilogb
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: int#1
+arg: half#1 v
+test: none
+end:
+
+function: ldexp
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+ret: float#1
+arg: float#1 mantissa, "Mantissa."
+arg: int#1 exponent, "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:
+
+function: ldexp
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+ret: half#1
+arg: half#1 mantissa
+arg: int#1 exponent
+test: none
+end:
+
+function: ldexp
+version: 9
+attrib: const
+w: 2, 3, 4
+ret: float#1
+arg: float#1 mantissa
+arg: int exponent
+end:
+
+function: ldexp
+version: 24
+attrib: const
+w: 2, 3, 4
+ret: half#1
+arg: half#1 mantissa
+arg: int exponent
+test: none
+end:
+
+function: lgamma
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+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:
+
+function: lgamma
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: none
+end:
+
+function: lgamma
+version: 9
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+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:
+
+function: lgamma
+version: 24
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+arg: int#1* sign_of_gamma
+test: none
+end:
+
+function: log
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+summary: Natural logarithm
+description:
+ Returns the natural logarithm.
+
+ See also @native_log().
+end:
+
+function: log
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+end:
+
+function: log10
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+summary: Base 10 logarithm
+description:
+ Returns the base 10 logarithm.
+
+ See also @native_log10().
+end:
+
+function: log10
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+end:
+
+function: log1p
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+summary: Natural logarithm of a value plus 1
+description:
+ Returns the natural logarithm of <code>(v + 1.f)</code>.
+
+ See also @native_log1p().
+end:
+
+function: log1p
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+end:
+
+function: log2
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+summary: Base 2 logarithm
+description:
+ Returns the base 2 logarithm.
+
+ See also @native_log2().
+end:
+
+function: log2
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+end:
+
+function: logb
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+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, <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.
+end:
+
+function: logb
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+end:
+
+function: mad
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 multiplicand1
+arg: #2#1 multiplicand2
+arg: #2#1 offset
+summary: Multiply and add
+description:
+ Multiply and add. Returns <code>(multiplicand1 * multiplicand2) + offset</code>.
+
+ 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:
+
+function: mad
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 multiplicand1
+arg: #2#1 multiplicand2
+arg: #2#1 offset
+end:
+
+function: max
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 a
+arg: #2#1 b
+summary: Maximum
+description:
+ Returns the maximum value of two arguments.
+end:
+
+function: max
+version:24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 a
+arg: #2#1 b
+end:
+
+function: max
+version: 9
+attrib: const
+w: 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 a
+arg: #2 b
+end:
+
+function: max
+version: 24
+attrib: const
+w: 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 a
+arg: #2 b
+end:
+
+function: max
+version: 9 20
+attrib: const
+w: 1
+t: i8, i16, i32, u8, u16, u32
+ret: #2#1
+arg: #2#1 a
+arg: #2#1 b
+inline:
+ return (a > b ? a : b);
+end:
+
+function: max
+version: 9 20
+attrib: const
+w: 2
+t: i8, i16, i32, u8, u16, u32
+ret: #2#1
+arg: #2#1 a
+arg: #2#1 b
+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;
+end:
+
+function: max
+version: 9 20
+attrib: const
+w: 3
+t: i8, i16, i32, u8, u16, u32
+ret: #2#1
+arg: #2#1 a
+arg: #2#1 b
+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;
+end:
+
+function: max
+version: 9 20
+attrib: const
+w: 4
+t: i8, i16, i32, u8, u16, u32
+ret: #2#1
+arg: #2#1 a
+arg: #2#1 b
+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);
+ tmp.w = (a.w > b.w ? a.w : b.w);
+ return tmp;
+end:
+
+function: max
+version: 21
+attrib: const
+w: 1, 2, 3, 4
+t: i8, i16, i32, i64, u8, u16, u32, u64
+ret: #2#1
+arg: #2#1 a
+arg: #2#1 b
+end:
+
+function: min
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 a
+arg: #2#1 b
+summary: Minimum
+description:
+ Returns the minimum value of two arguments.
+end:
+
+function: min
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 a
+arg: #2#1 b
+end:
+
+function: min
+version: 9
+attrib: const
+w: 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 a
+arg: #2 b
+end:
+
+function: min
+version: 24
+attrib: const
+w: 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 a
+arg: #2 b
+end:
+
+function: min
+version: 9 20
+attrib: const
+w: 1
+t: i8, i16, i32, u8, u16, u32
+ret: #2#1
+arg: #2#1 a
+arg: #2#1 b
+inline:
+ return (a < b ? a : b);
+end:
+
+function: min
+version: 9 20
+attrib: const
+w: 2
+t: i8, i16, i32, u8, u16, u32
+ret: #2#1
+arg: #2#1 a
+arg: #2#1 b
+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;
+end:
+
+function: min
+version: 9 20
+attrib: const
+w: 3
+t: i8, i16, i32, u8, u16, u32
+ret: #2#1
+arg: #2#1 a
+arg: #2#1 b
+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;
+end:
+
+function: min
+version: 9 20
+attrib: const
+w: 4
+t: i8, i16, i32, u8, u16, u32
+ret: #2#1
+arg: #2#1 a
+arg: #2#1 b
+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);
+ tmp.w = (a.w < b.w ? a.w : b.w);
+ return tmp;
+end:
+
+function: min
+version: 21
+attrib: const
+w: 1, 2, 3, 4
+t: i8, i16, i32, i64, u8, u16, u32, u64
+ret: #2#1
+arg: #2#1 a
+arg: #2#1 b
+end:
+
+function: mix
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 start
+arg: #2#1 stop
+arg: #2#1 fraction
+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 <code>mix(color1, color2, 0.6f)</code>.
+end:
+
+function: mix
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 start
+arg: #2#1 stop
+arg: #2#1 fraction
+end:
+
+function: mix
+version: 9
+attrib: const
+w: 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 start
+arg: #2#1 stop
+arg: #2 fraction
+end:
+
+function: mix
+version: 24
+attrib: const
+w: 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 start
+arg: #2#1 stop
+arg: #2 fraction
+end:
+
+function: modf
+version: 9
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1, "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,
+ *integral_part will be set to -3.f and .72f will be returned.
+end:
+
+function: modf
+version: 24
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+arg: #2#1* integral_part
+test: none
+end:
+
+function: nan
+version: 9
+attrib: const
+w: 1
+t: f32
+ret: #2#1
+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.
+summary: Not a Number
+description:
+ Returns a NaN value (Not a Number).
+end:
+
+function: nan_half
+version: 24
+attrib: const
+t: f16
+ret: #1
+summary: Not a Number
+description:
+ Returns a half-precision floating point NaN value (Not a Number).
+end:
+
+function: native_acos
+version: 21
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v, range(-1,1)
+summary: Approximate inverse cosine
+description:
+ Returns the approximate inverse cosine, in radians.
+
+ 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:
+
+function: native_acos
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v, range(-1,1)
+# Absolute error of 2^-11, i.e. 0.00048828125
+test: limited(0.00048828125)
+end:
+
+function: native_acosh
+version: 21
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+summary: Approximate inverse hyperbolic cosine
+description:
+ Returns the approximate inverse hyperbolic cosine, in radians.
+
+ See also @acosh().
+# TODO Temporary
+test: limited(0.0005)
+end:
+
+function: native_acosh
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+end:
+
+function: native_acospi
+version: 21
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+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 <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:
+
+function: native_acospi
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v, range(-1,1)
+# Absolute error of 2^-11, i.e. 0.00048828125
+test: limited(0.00048828125)
+end:
+
+function: native_asin
+version: 21
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v, range(-1,1)
+summary: Approximate inverse sine
+description:
+ Returns the approximate inverse sine, in radians.
+
+ 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:
+
+function: native_asin
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v, range(-1,1)
+# Absolute error of 2^-11, i.e. 0.00048828125
+test: limited(0.00048828125)
+end:
+
+function: native_asinh
+version: 21
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+summary: Approximate inverse hyperbolic sine
+description:
+ Returns the approximate inverse hyperbolic sine, in radians.
+
+ See also @asinh().
+# TODO Temporary
+test: limited(0.0005)
+end:
+
+function: native_asinh
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+end:
+
+function: native_asinpi
+version: 21
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+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 <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:
+
+function: native_asinpi
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v, range(-1,1)
+# Absolute error of 2^-11, i.e. 0.00048828125
+test: limited(0.00048828125)
+end:
+
+function: native_atan
+version: 21
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v, range(-1,1)
+summary: Approximate inverse tangent
+description:
+ Returns the approximate inverse tangent, in radians.
+
+ See also @atan().
+# TODO Temporary
+test: limited(0.0005)
+end:
+
+function: native_atan
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v, range(-1, 1)
+end:
+
+function: native_atan2
+version: 21
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 numerator, "Numerator."
+arg: #2#1 denominator, "Denominator. Can be 0."
+summary: Approximate inverse tangent of a ratio
+description:
+ Returns the approximate inverse tangent of <code>(numerator / denominator)</code>, in radians.
+
+ See also @atan2().
+# TODO Temporary
+test: limited(0.0005)
+end:
+
+function: native_atan2
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 numerator
+arg: #2#1 denominator
+end:
+
+function: native_atan2pi
+version: 21
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 numerator, "Numerator."
+arg: #2#1 denominator, "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 <code>atan2pi(n, d) * 180.f</code>.
+
+ See also @atan2pi().
+# TODO Temporary
+test: limited(0.0005)
+end:
+
+function: native_atan2pi
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 numerator
+arg: #2#1 denominator
+end:
+
+function: native_atanh
+version: 21
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v, range(-1,1)
+summary: Approximate inverse hyperbolic tangent
+description:
+ Returns the approximate inverse hyperbolic tangent, in radians.
+
+ See also @atanh().
+# TODO Temporary
+test: limited(0.0005)
+end:
+
+function: native_atanh
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v, range(-1,1)
+end:
+
+function: native_atanpi
+version: 21
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+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 <code>atanpi(a) * 180.f</code>.
+
+ See also @atanpi().
+# TODO Temporary
+test: limited(0.0005)
+end:
+
+function: native_atanpi
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v, range(-1,1)
+end:
+
+function: native_cbrt
+version: 21
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+summary: Approximate cube root
+description:
+ Returns the approximate cubic root.
+
+ See also @cbrt().
+end:
+
+function: native_cbrt
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+end:
+
+function: native_cos
+version: 21
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+summary: Approximate cosine
+description:
+ Returns the approximate cosine of an angle measured in radians.
+
+ See also @cos().
+end:
+
+function: native_cos
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v, range(-314,314)
+# Absolute error of 2^-11, i.e. 0.00048828125
+test: limited(0.00048828125)
+end:
+
+function: native_cosh
+version: 21
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+summary: Approximate hypebolic cosine
+description:
+ Returns the approximate hypebolic cosine.
+
+ See also @cosh().
+end:
+
+function: native_cosh
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+end:
+
+function: native_cospi
+version: 21
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+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 <code>cospi(v / 180.f)</code>.
+
+ See also @cospi().
+end:
+
+function: native_cospi
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v, range(-100,100)
+# Absolute error of 2^-11, i.e. 0.00048828125
+test: limited(0.00048828125)
+end:
+
+function: native_divide
+version: 21
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 left_vector
+arg: #2#1 right_vector
+summary: Approximate division
+description:
+ Computes the approximate division of two values.
+end:
+
+function: native_divide
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 left_vector
+arg: #2#1 right_vector
+end:
+
+function: native_exp
+version: 18
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+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.
+
+ See also @exp().
+test: limited
+end:
+
+function: native_exp
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v, range(-86,86)
+end:
+
+function: native_exp10
+version: 18
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+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.
+
+ See also @exp10().
+test: limited
+end:
+
+function: native_exp10
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v, range(-37,37)
+end:
+
+function: native_exp2
+version: 18
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+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.
+
+ See also @exp2().
+test: limited
+end:
+
+function: native_exp2
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v, range(-125,125)
+end:
+
+function: native_expm1
+version: 21
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+summary: Approximate e raised to a number minus one
+description:
+ Returns the approximate (e ^ v) - 1.
+
+ See also @expm1().
+end:
+
+function: native_expm1
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: custom
+end:
+
+function: native_hypot
+version: 21
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 a
+arg: #2#1 b
+summary: Approximate hypotenuse
+description:
+ Returns the approximate native_sqrt(a * a + b * b)
+
+ See also @hypot().
+end:
+
+function: native_hypot
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 a
+arg: #2#1 b
+end:
+
+function: native_log
+version: 18
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+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.
+
+ See also @log().
+test: limited
+end:
+
+function: native_log
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v, range(10e-5,65504)
+end:
+
+function: native_log10
+version: 18
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+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.
+
+ See also @log10().
+test: limited
+end:
+
+function: native_log10
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v, range(10e-5,65504)
+end:
+
+function: native_log1p
+version: 21
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+summary: Approximate natural logarithm of a value plus 1
+description:
+ Returns the approximate natural logarithm of (v + 1.0f)
+
+ See also @log1p().
+end:
+
+function: native_log1p
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+end:
+
+function: native_log2
+version: 18
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+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.
+
+ See also @log2().
+test: limited
+end:
+
+function: native_log2
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v, range(10e-5,65504)
+end:
+
+function: native_powr
+version: 18
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+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).
+
+ See also @powr().
+test: limited
+end:
+
+function: native_powr
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 base, range(0,256)
+arg: #2#1 exponent, range(-15,15)
+end:
+
+function: native_recip
+version: 21
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+summary: Approximate reciprocal
+description:
+ Returns the approximate approximate reciprocal of a value.
+
+ See also @half_recip().
+end:
+
+function: native_recip
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+end:
+
+function: native_rootn
+version: 21
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+arg: int#1 n
+summary: Approximate nth root
+description:
+ Compute the approximate Nth root of a value.
+
+ See also @rootn().
+end:
+
+function: native_rootn
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+arg: int#1 n
+test: none
+end:
+
+function: native_rsqrt
+version: 21
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+summary: Approximate reciprocal of a square root
+description:
+ Returns approximate (1 / sqrt(v)).
+
+ See also @rsqrt(), @half_rsqrt().
+end:
+
+function: native_rsqrt
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+end:
+
+function: native_sin
+version: 21
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+summary: Approximate sine
+description:
+ Returns the approximate sine of an angle measured in radians.
+
+ See also @sin().
+end:
+
+function: native_sin
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v, range(-314,314)
+# Absolute error of 2^-11, i.e. 0.00048828125
+test: limited(0.00048828125)
+end:
+
+function: native_sincos
+version: 21
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1, "Sine."
+arg: #2#1 v, "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.
+
+ See also @sincos().
+# TODO Temporary
+test: limited(0.0005)
+end:
+
+function: native_sincos
+version: 24
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+arg: #2#1* cos, range(-314,314)
+# Absolute error of 2^-11, i.e. 0.00048828125
+test: limited(0.00048828125)
+end:
+
+function: native_sinh
+version: 21
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+summary: Approximate hyperbolic sine
+description:
+ Returns the approximate hyperbolic sine of a value specified in radians.
+
+ See also @sinh().
+end:
+
+function: native_sinh
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+end:
+
+function: native_sinpi
+version: 21
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+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 <code>sinpi(v / 180.f)</code>.
+
+ See also @sinpi().
+end:
+
+function: native_sinpi
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v, range(-100,100)
+# Absolute error of 2^-11, i.e. 0.00048828125
+test: limited(0.00048828125)
+end:
+
+function: native_sqrt
+version: 21
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+summary: Approximate square root
+description:
+ Returns the approximate sqrt(v).
+
+ See also @sqrt(), @half_sqrt().
+end:
+
+function: native_sqrt
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+end:
+
+function: native_tan
+version: 21
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+summary: Approximate tangent
+description:
+ Returns the approximate tangent of an angle measured in radians.
+end:
+
+function: native_tan
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v, range(-314,314)
+test: custom
+end:
+
+function: native_tanh
+version: 21
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+summary: Approximate hyperbolic tangent
+description:
+ Returns the approximate hyperbolic tangent of a value.
+
+ See also @tanh().
+end:
+
+function: native_tanh
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+end:
+
+function: native_tanpi
+version: 21
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+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 <code>tanpi(v / 180.f)</code>.
+
+ See also @tanpi().
+end:
+
+function: native_tanpi
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v, range(-100,100)
+test: custom
+end:
+
+function: nextafter
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+arg: #2#1 target
+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:
+
+function: nextafter
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+arg: #2#1 target
+test: none
+end:
+
+function: pow
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 base
+arg: #2#1 exponent
+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.
+end:
+
+function: pow
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 base
+arg: #2#1 exponent
+end:
+
+function: pown
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 base
+arg: int#1 exponent
+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.
+end:
+
+function: pown
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 base
+arg: int#1 exponent
+end:
+
+function: powr
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 base, range(0,3000)
+arg: #2#1 exponent
+summary: Positive base raised to an exponent
+description:
+ 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.
+
+ See also @native_powr().
+end:
+
+function: powr
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 base, range(0,300)
+arg: #2#1 exponent
+end:
+
+function: radians
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+summary: Converts degrees into radians
+description:
+ Converts from degrees to radians.
+end:
+
+function: radians
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+end:
+
+function: remainder
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 numerator
+arg: #2#1 denominator
+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, <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:
+
+function: remainder
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 numerator
+arg: #2#1 denominator
+end:
+
+function: remquo
+version: 9
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1, "Remainder, precise only for the low three bits."
+arg: #2#1 numerator, "Numerator."
+arg: #2#1 denominator, "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 <code>remquo(x, PI / 2.f, &quadrant)</code>
+ to reduce very large value of x to something within a limited range.
+
+ 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:
+
+function: remquo
+version: 24
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 numerator
+arg: #2#1 denominator
+arg: int#1* quotient
+test: none
+end:
+
+function: rint
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+summary: Round to even
+description:
+ Rounds to the nearest integral value.
+
+ 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.
+end:
+
+function: rint
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+end:
+
+function: rootn
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+arg: int#1 n
+summary: Nth root
+description:
+ Compute the Nth root of a value.
+
+ See also @native_rootn().
+end:
+
+function: rootn
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+arg: int#1 n
+test: none
+end:
+
+function: round
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+summary: Round away from zero
+description:
+ Round to the nearest integral value.
+
+ 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.
+end:
+
+function: round
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+end:
+
+function: rsqrt
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+summary: Reciprocal of a square root
+description:
+ Returns (1 / sqrt(v)).
+
+ See also @half_rsqrt(), @native_rsqrt().
+end:
+
+function: rsqrt
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+end:
+
+function: sign
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+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;
+ else return 0.f;
+end:
+
+function: sign
+version:24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+end:
+
+function: sin
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+summary: Sine
+description:
+ Returns the sine of an angle measured in radians.
+
+ See also @native_sin().
+end:
+
+function: sin
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+end:
+
+function: sincos
+version: 9
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1, "Sine of v."
+arg: #2#1 v, "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.
+
+ See also @native_sincos().
+end:
+
+function: sincos
+version: 24
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+arg: #2#1* cos
+end:
+
+function: sinh
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+summary: Hyperbolic sine
+description:
+ Returns the hyperbolic sine of v, where v is measured in radians.
+
+ See also @native_sinh().
+end:
+
+function: sinh
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+end:
+
+function: sinpi
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+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 <code>sinpi(v / 180.f)</code>.
+
+ See also @native_sinpi().
+end:
+
+function: sinpi
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+end:
+
+function: sqrt
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+summary: Square root
+description:
+ Returns the square root of a value.
+
+ See also @half_sqrt(), @native_sqrt().
+end:
+
+function: sqrt
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+end:
+
+function: step
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 edge
+arg: #2#1 v
+summary: 0 if less than a value, 0 otherwise
+description:
+ 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 <code>(a[i] < 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:
+
+function: step
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 edge
+arg: #2#1 v
+end:
+
+function: step
+version: 9
+attrib: const
+w: 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 edge
+arg: #2 v
+end:
+
+function: step
+version: 24
+attrib: const
+w: 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 edge
+arg: #2 v
+end:
+
+function: step
+version: 21
+attrib: const
+w: 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2 edge
+arg: #2#1 v
+end:
+
+function: step
+version: 24
+attrib: const
+w: 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2 edge
+arg: #2#1 v
+end:
+
+function: tan
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+summary: Tangent
+description:
+ Returns the tangent of an angle measured in radians.
+
+ See also @native_tan().
+end:
+
+function: tan
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+end:
+
+function: tanh
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+summary: Hyperbolic tangent
+description:
+ Returns the hyperbolic tangent of a value.
+
+ See also @native_tanh().
+end:
+
+function: tanh
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+end:
+
+function: tanpi
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+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 <code>tanpi(v / 180.f)</code>.
+
+ See also @native_tanpi().
+end:
+
+function: tanpi
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+end:
+
+function: tgamma
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+summary: Gamma function
+description:
+ Returns the gamma function of a value.
+
+ See also @lgamma().
+end:
+
+function: tgamma
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+end:
+
+function: trunc
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+summary: Truncates a floating point
+description:
+ Rounds to integral using truncation.
+
+ 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.
+end:
+
+function: trunc
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+end:
+
+function: rsClamp
+attrib: const
+t: i8, i16, i32, u8, u16, u32
+ret: #1
+arg: #1 amount, "Value to clamp."
+arg: #1 low, "Lower bound."
+arg: #1 high, "Upper bound."
+deprecated: 22, Use @clamp() instead.
+summary: Restrain a value to a range
+description:
+ Clamp a value between low and high.
+test: none
+end:
+
+function: rsFrac
+attrib: const
+ret: float
+arg: float v
+deprecated: 22, Use @fract() instead.
+summary: Returns the fractional part of a float
+description:
+ Returns the fractional part of a float
+test: none
+end:
+
+function: rsRand
+ret: int
+arg: int max_value
+summary: Pseudo-random number
+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:
diff --git a/script_api/rs_matrix.spec b/script_api/rs_matrix.spec
new file mode 100644
index 0000000..89f09c4
--- /dev/null
+++ b/script_api/rs_matrix.spec
@@ -0,0 +1,589 @@
+#
+# 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.
+include:
+ #include "rs_vector_math.rsh"
+end:
+
+function: rsExtractFrustumPlanes
+version: 9 23
+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: Compute frustum planes
+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:
+
+# New version. Same signature but doesn't contain a body.
+function: rsExtractFrustumPlanes
+version: 24
+ret: void
+arg: const rs_matrix4x4* viewProj
+arg: float4* left
+arg: float4* righ
+arg: float4* top
+arg: float4* bottom
+arg: float4* near
+arg: float4* far
+test: none
+end:
+
+function: rsIsSphereInFrustum
+version: 9 23
+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: Checks if a sphere is within the frustum planes
+description:
+ Returns true if the sphere is within 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:
+
+# New version. Same signature but doesn't contain a body.
+function: rsIsSphereInFrustum
+version: 24
+ret: bool
+arg: float4* sphere
+arg: float4* left
+arg: float4* right
+arg: float4* top
+arg: float4* bottom
+arg: float4* near
+arg: float4* far
+test: none
+end:
+
+function: rsMatrixGet
+t: rs_matrix4x4, rs_matrix3x3, rs_matrix2x2
+ret: float
+arg: const #1* m, "Matrix to extract the element from."
+arg: uint32_t col, "Zero-based column of the element to be extracted."
+arg: uint32_t row, "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, "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, "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, "Matrix to set."
+arg: const float* array, "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, "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, "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, "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, "Matrix to set."
+arg: const #1* lhs, "Left matrix of the product."
+arg: const #1* rhs, "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, "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, "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, "Near clipping plane."
+arg: float far, "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, "Matrix to set."
+arg: float rot, "How much rotation to do, in degrees."
+arg: float x, "X component of the vector that is the axis of rotation."
+arg: float y, "Y component of the vector that is the axis of rotation."
+arg: float z, "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, "Matrix to set."
+arg: float x, "Multiple to scale the x components by."
+arg: float y, "Multiple to scale the y components by."
+arg: float z, "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, "Matrix to set."
+arg: float x, "Number to add to each x component."
+arg: float y, "Number to add to each y component."
+arg: float z, "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, "Left matrix of the product and the matrix to be set."
+arg: const #1* rhs, "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, "Matrix to modify."
+arg: float rot, "How much rotation to do, in degrees."
+arg: float x, "X component of the vector that is the axis of rotation."
+arg: float y, "Y component of the vector that is the axis of rotation."
+arg: float z, "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, "Matrix to modify."
+arg: float x, "Multiple to scale the x components by."
+arg: float y, "Multiple to scale the y components by."
+arg: float z, "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, "Matrix that will be modified."
+arg: uint32_t col, "Zero-based column of the element to be set."
+arg: uint32_t row, "Zero-based row of the element to be set."
+arg: float v, "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, "Matrix to modify."
+arg: float x, "Number to add to each x component."
+arg: float y, "Number to add to each y component."
+arg: float z, "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, "Matrix to transpose."
+summary: Transpose a matrix place
+description:
+ Transpose the matrix m in place.
+test: none
+end:
diff --git a/script_api/rs_object_info.spec b/script_api/rs_object_info.spec
new file mode 100644
index 0000000..6a6336d
--- /dev/null
+++ b/script_api/rs_object_info.spec
@@ -0,0 +1,379 @@
+#
+# Copyright (C) 2014 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 Characteristics Functions
+description:
+ The functions below can be used to query the characteristics of an Allocation, Element,
+ or Sampler object. These objects are created from Java. You can't create them from a
+ script.
+
+ <h5>Allocations:</h5>
+
+ Allocations are the primary method used to pass data to and from RenderScript kernels.
+
+ They are a structured collection of cells that can be used to store bitmaps, textures,
+ arbitrary data points, etc.
+
+ This collection of cells may have many dimensions (X, Y, Z, Array0, Array1, Array2, Array3),
+ faces (for cubemaps), and level of details (for mipmapping).
+
+ See the <a href='http://developer.android.com/reference/android/renderscript/Allocation.html'>android.renderscript.Allocation</a> for details on to create Allocations.
+
+ <h5>Elements:</h5>
+
+ The term "element" is used a bit ambiguously in RenderScript, as both type information
+ for the cells of an Allocation and the instantiation of that type. For example:<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. a cell of an Allocation.</li></ul>
+
+ The functions below let you query the characteristics of the type specificiation.
+
+ An Element can specify a simple data types as found in C, e.g. an integer, float, or
+ boolean. It can also specify a handle to a RenderScript object. See @rs_data_type for
+ a list of basic types.
+
+ Elements can specify fixed size vector (of size 2, 3, or 4) versions of the basic types.
+ Elements can be grouped together into complex Elements, creating the equivalent of
+ C structure definitions.
+
+ Elements can also have a kind, which is semantic information used to interpret pixel
+ data. See @rs_data_kind.
+
+ When creating Allocations of common elements, 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>.
+
+ To create complex Elements, use the <a href='http://developer.android.com/reference/android/renderscript/Element.Builder.html'>Element.Builder</a> Java class.
+
+ <h5>Samplers:</h5>
+
+ Samplers objects define how Allocations can be read as structure within a kernel.
+ See <a href='http://developer.android.com/reference/android/renderscript/Sampler.html'>android.renderscript.S</a>.
+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.
+
+ Use @rsGetDimHasFaces() to get the dimension of a currently running kernel.
+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 detail
+description:
+ Query an Allocation for the presence of more than one Level Of Detail. This is useful
+ for mipmaps.
+
+ Use @rsGetDimLod() to get the dimension of a currently running kernel.
+test: none
+end:
+
+function: rsAllocationGetDimX
+ret: uint32_t, "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.
+
+ Use @rsGetDimX() to get the dimension of a currently running kernel.
+test: none
+end:
+
+function: rsAllocationGetDimY
+ret: uint32_t, "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.
+
+ Use @rsGetDimY() to get the dimension of a currently running kernel.
+test: none
+end:
+
+function: rsAllocationGetDimZ
+ret: uint32_t, "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.
+
+ Use @rsGetDimZ() to get the dimension of a currently running kernel.
+test: none
+end:
+
+function: rsAllocationGetElement
+ret: rs_element, "Element describing Allocation layout."
+arg: rs_allocation a, "Allocation to get data from."
+summary: Get the object that describes the cell of an Allocation
+description:
+ Get the Element object describing the type, kind, and other characteristics of a cell
+ of an Allocation. See the rsElement* functions below.
+test: none
+end:
+
+function: rsClearObject
+t: rs_element, rs_type, rs_allocation, rs_sampler, rs_script
+ret: void
+arg: #1* dst
+summary: Release an object
+description:
+ Tells the run time that this handle will no longer be used to access the the related
+ object. If this was the last handle to that object, resource recovery may happen.
+
+ After calling this function, *dst will be set to an empty handle. See @rsIsObject().
+test: none
+end:
+
+function: rsIsObject
+t: rs_element, rs_type, rs_allocation, rs_sampler, rs_script
+ret: bool
+arg: #1 v
+summary: Check for an empty handle
+description:
+ Returns true if the handle contains a non-null reference.
+
+ This function does not validate that the internal pointer used in the handle
+ points to an actual valid object; it only checks for null.
+
+ This function can be used to check the Element returned by @rsElementGetSubElement()
+ or see if @rsClearObject() has been called on a handle.
+test: none
+end:
+
+function: rsElementGetBytesSize
+version: 16
+ret: uint32_t
+arg: rs_element e
+summary: 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: 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: 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).
+ See @rs_data_type.
+
+ If the Element describes a vector, this function returns the data type of one of its items.
+ Use @rsElementGetVectorSize to get the size of the vector.
+
+ If the Element describes a structure, RS_TYPE_NONE is returned. Use the rsElementGetSub*
+ functions to explore this complex Element.
+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: Sub-element of a complex Element
+description:
+ For Elements that 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."
+arg: rs_element e, "Element to query."
+arg: uint32_t index, "Index of the sub-element."
+summary: Array size of a sub-element of a complex Element
+description:
+ For complex Elements, sub-elements can be statically sized arrays. This function
+ returns the array size of the sub-element at the index. This sub-element repetition
+ is different than fixed size vectors.
+test: none
+end:
+
+function: rsElementGetSubElementCount
+version: 16
+ret: uint32_t, "Number of sub-elements."
+arg: rs_element e, "Element to get data from."
+summary: Number of sub-elements
+description:
+ Elements can be simple, such as an int or a float, or a structure with multiple
+ sub-elements. This function returns zero for simple Elements and the number of
+ sub-elements for complex Elements.
+test: none
+end:
+
+function: rsElementGetSubElementName
+version: 16
+ret: uint32_t, "Number of characters copied, 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, "Address of the array to store the name into."
+arg: uint32_t nameLength, "Length of the provided name array."
+summary: 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."
+arg: rs_element e, "Element to get data from."
+arg: uint32_t index, "Index of the sub-element."
+summary: Length of the name of a sub-element
+description:
+ For complex Elements, this function returns the length of the name of the sub-element
+ at the specified index.
+test: none
+end:
+
+function: rsElementGetSubElementOffsetBytes
+version: 16
+ret: uint32_t, "Offset in bytes."
+arg: rs_element e, "Element to get data from."
+arg: uint32_t index, "Index of the sub-element."
+summary: Offset of the instantiated sub-element
+description:
+ This function returns the relative position of the instantiation of the specified
+ sub-element within the instantiation of the Element.
+
+ For example, if the Element describes a 32 bit float followed by a 32 bit integer,
+ the offset return for the first will be 0 and the second 4.
+test: none
+end:
+
+function: rsElementGetVectorSize
+version: 16
+ret: uint32_t, "Length of the element vector."
+arg: rs_element e, "Element to get data from."
+summary: Vector size of the Element
+description:
+ Returns the Element's vector size. If the Element does not represent a vector,
+ 1 is returned.
+test: none
+end:
+
+function: rsGetAllocation
+ret: rs_allocation
+arg: const void* p
+deprecated: 22, This function is deprecated and will be removed from the SDK in a future release.
+summary: Return 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.
+test: none
+end:
+
+function: rsSamplerGetAnisotropy
+version: 16
+ret: float
+arg: rs_sampler s
+summary: Anisotropy of the Sampler
+description:
+ Get the Sampler's anisotropy.
+
+ See <a href='http://developer.android.com/reference/android/renderscript/Sampler.html'>android.renderscript.S</a>.
+test: none
+end:
+
+function: rsSamplerGetMagnification
+version: 16
+ret: rs_sampler_value
+arg: rs_sampler s
+summary: Sampler magnification value
+description:
+ Get the Sampler's magnification value.
+
+ See <a href='http://developer.android.com/reference/android/renderscript/Sampler.html'>android.renderscript.S</a>.
+test: none
+end:
+
+function: rsSamplerGetMinification
+version: 16
+ret: rs_sampler_value
+arg: rs_sampler s
+summary: Sampler minification value
+description:
+ Get the Sampler's minification value.
+
+ See <a href='http://developer.android.com/reference/android/renderscript/Sampler.html'>android.renderscript.S</a>.
+test: none
+end:
+
+function: rsSamplerGetWrapS
+version: 16
+ret: rs_sampler_value
+arg: rs_sampler s
+summary: Sampler wrap S value
+description:
+ Get the Sampler's wrap S value.
+
+ See <a href='http://developer.android.com/reference/android/renderscript/Sampler.html'>android.renderscript.S</a>.
+test: none
+end:
+
+function: rsSamplerGetWrapT
+version: 16
+ret: rs_sampler_value
+arg: rs_sampler s
+summary: Sampler wrap T value
+description:
+ Get the sampler's wrap T value.
+
+ See <a href='http://developer.android.com/reference/android/renderscript/Sampler.html'>android.renderscript.S</a>.
+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:
diff --git a/script_api/rs_object_types.spec b/script_api/rs_object_types.spec
new file mode 100644
index 0000000..883aa71
--- /dev/null
+++ b/script_api/rs_object_types.spec
@@ -0,0 +1,213 @@
+#
+# 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 Types
+description:
+ The types below are used to manipulate RenderScript objects like allocations, samplers,
+ elements, and scripts. Most of these object are created using the Java RenderScript APIs.
+include:
+ #define NULL ((void *)0)
+
+ // Opaque handle to a RenderScript object. Do not use this directly.
+ #ifndef __LP64__
+ #define _RS_OBJECT_DECL \
+ {\
+ const int* const p;\
+ } __attribute__((packed, aligned(4)))
+ #else
+ #define _RS_OBJECT_DECL \
+ {\
+ const long* const p;\
+ const long* const r;\
+ const long* const v1;\
+ const long* const v2;\
+ }
+ #endif
+end:
+
+type: rs_element
+rs_object:
+summary: Handle to an element
+description:
+ An opaque handle to a RenderScript element.
+
+ See <a href="http://developer.android.com/reference/android/renderscript/Element.html">android.renderscript.Element</a>.
+end:
+
+type: rs_type
+rs_object:
+summary: Handle to a Type
+description:
+ An opaque handle to a RenderScript type.
+
+ See <a href="http://developer.android.com/reference/android/renderscript/Type.html">android.renderscript.Type</a>.
+end:
+
+type: rs_allocation
+rs_object:
+summary: Handle to an allocation
+description:
+ An opaque handle to a RenderScript allocation.
+
+ See <a href="http://developer.android.com/reference/android/renderscript/Allocation.html">android.renderscript.Allocation</a>.
+end:
+
+type: rs_sampler
+rs_object:
+summary: Handle to a Sampler
+description:
+ An opaque handle to a RenderScript sampler object.
+
+ See <a href="http://developer.android.com/reference/android/renderscript/Sampler.html">android.renderscript.Sampler</a>.
+end:
+
+type: rs_script
+rs_object:
+summary: Handle to a Script
+description:
+ An opaque handle to a RenderScript script object.
+
+ See <a href="http://developer.android.com/reference/android/renderscript/ScriptC.html">android.renderscript.ScriptC</a>.
+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:
+ An enum used to specify one the six faces of a cubemap.
+end:
+
+type: rs_allocation_usage_type
+version: 14
+enum:
+value: RS_ALLOCATION_USAGE_SCRIPT = 0x0001, "Allocation is bound to and accessed by scripts."
+value: RS_ALLOCATION_USAGE_GRAPHICS_TEXTURE = 0x0002, "Allocation is used as a texture source."
+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."
+value: RS_ALLOCATION_USAGE_IO_INPUT = 0x0020, "Allocation is used as a Surface consumer."
+value: RS_ALLOCATION_USAGE_IO_OUTPUT = 0x0040, "Allocation is used as a Surface producer."
+value: RS_ALLOCATION_USAGE_SHARED = 0x0080, "Allocation's backing store is shared with another object (usually a Bitmap). Copying to or from the original source Bitmap will cause a synchronization rather than a full copy."
+summary: Bitfield to specify how an allocation is used
+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_data_type
+version: 16
+enum:
+value: RS_TYPE_NONE = 0, "Element is a complex type, i.e. a struct."
+value: RS_TYPE_FLOAT_16 = 1, "A 16 bit floating point value."
+value: RS_TYPE_FLOAT_32 = 2, "A 32 bit floating point value."
+value: RS_TYPE_FLOAT_64 = 3, "A 64 bit floating point value."
+value: RS_TYPE_SIGNED_8 = 4, "An 8 bit signed integer."
+value: RS_TYPE_SIGNED_16 = 5, "A 16 bit signed integer."
+value: RS_TYPE_SIGNED_32 = 6, "A 32 bit signed integer."
+value: RS_TYPE_SIGNED_64 = 7, "A 64 bit signed integer."
+value: RS_TYPE_UNSIGNED_8 = 8, "An 8 bit unsigned integer."
+value: RS_TYPE_UNSIGNED_16 = 9, "A 16 bit unsigned integer."
+value: RS_TYPE_UNSIGNED_32 = 10, "A 32 bit unsigned integer."
+value: RS_TYPE_UNSIGNED_64 = 11, "A 64 bit unsigned integer."
+value: RS_TYPE_BOOLEAN = 12, "0 or 1 (false or true) stored in an 8 bit container."
+value: RS_TYPE_UNSIGNED_5_6_5 = 13, "A 16 bit unsigned integer packing graphical data in 5, 6, and 5 bit sections."
+value: RS_TYPE_UNSIGNED_5_5_5_1 = 14, "A 16 bit unsigned integer packing graphical data in 5, 5, 5, and 1 bit sections."
+value: RS_TYPE_UNSIGNED_4_4_4_4 = 15, "A 16 bit unsigned integer packing graphical data in 4, 4, 4, and 4 bit sections."
+value: RS_TYPE_MATRIX_4X4 = 16, "A 4x4 matrix of 32 bit floats, aligned on a 32 bit boundary."
+value: RS_TYPE_MATRIX_3X3 = 17, "A 3x3 matrix of 32 bit floats, aligned on a 32 bit boundary."
+value: RS_TYPE_MATRIX_2X2 = 18, "A 2x2 matrix of 32 bit floats, aligned on a 32 bit boundary."
+value: RS_TYPE_ELEMENT = 1000, "A handle to an Element."
+value: RS_TYPE_TYPE = 1001, "A handle to a Type."
+value: RS_TYPE_ALLOCATION = 1002, "A handle to an Allocation."
+value: RS_TYPE_SAMPLER = 1003, "A handle to a Sampler."
+value: RS_TYPE_SCRIPT = 1004, "A handle to a Script."
+value: RS_TYPE_MESH = 1005, "Deprecated."
+value: RS_TYPE_PROGRAM_FRAGMENT = 1006, "Deprecated."
+value: RS_TYPE_PROGRAM_VERTEX = 1007, "Deprecated."
+value: RS_TYPE_PROGRAM_RASTER = 1008, "Deprecated."
+value: RS_TYPE_PROGRAM_STORE = 1009, "Deprecated."
+value: RS_TYPE_FONT = 1010, "Deprecated."
+value: RS_TYPE_INVALID = 10000
+summary: Element basic data type
+description:
+ rs_data_type is used to encode the type information of a basic element.
+
+ RS_TYPE_UNSIGNED_5_6_5, RS_TYPE_UNSIGNED_5_5_5_1, RS_TYPE_UNSIGNED_4_4_4_4 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.
+end:
+
+type: rs_data_kind
+version: 16
+enum:
+value: RS_KIND_USER = 0, "No special interpretation."
+value: RS_KIND_PIXEL_L = 7, "Luminance."
+value: RS_KIND_PIXEL_A = 8, "Alpha."
+value: RS_KIND_PIXEL_LA = 9, "Luminance and Alpha."
+value: RS_KIND_PIXEL_RGB = 10, "Red, Green, Blue."
+value: RS_KIND_PIXEL_RGBA = 11, "Red, Green, Blue, and Alpha."
+value: RS_KIND_PIXEL_DEPTH = 12, "Depth for a depth texture."
+value: RS_KIND_PIXEL_YUV = 13, "Luminance and chrominance."
+value: RS_KIND_INVALID = 100
+summary: Element data kind
+description:
+ This enumeration is primarly useful for graphical data. It provides additional information to
+ help interpret the rs_data_type.
+
+ RS_KIND_USER indicates no special interpretation is expected.
+
+ The RS_KIND_PIXEL_* values are used in conjunction with the standard data types for representing
+ texture formats.
+
+ See the <a href='http://developer.android.com/reference/android/renderscript/Element.html#createPixel(android.renderscript.RenderScript,%20android.renderscript.Element.DataType, android.renderscript.Element.DataKind)'>Element.createPixel()</a> method.
+end:
+
+type: rs_yuv_format
+version: 24
+enum:
+value: RS_YUV_NONE = 0
+value: RS_YUV_YV12 = 0x32315659
+value: RS_YUV_NV21 = 0x11
+value: RS_YUV_420_888 = 0x23
+summary: YUV format
+description:
+ Android YUV formats that can be associated with a RenderScript Type.
+
+ See <a href='http://developer.android.com/reference/android/graphics/ImageFormat.html'>android.graphics.ImageFormat</a> for a description of each format.
+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/script_api/rs_quaternion.spec b/script_api/rs_quaternion.spec
new file mode 100644
index 0000000..dc5a76d
--- /dev/null
+++ b/script_api/rs_quaternion.spec
@@ -0,0 +1,393 @@
+#
+# 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 Functions
+description:
+ The following functions manipulate quaternions.
+end:
+
+function: rsQuaternionAdd
+version: 9 23
+ret: void
+arg: rs_quaternion* q, "Destination quaternion to add to."
+arg: const rs_quaternion* rhs, "Quaternion to add."
+summary: Add two quaternions
+description:
+ Adds two quaternions, i.e. <code>*q += *rhs;</code>
+inline:
+ q->w += rhs->w;
+ q->x += rhs->x;
+ q->y += rhs->y;
+ q->z += rhs->z;
+test: none
+end:
+
+function: rsQuaternionConjugate
+version: 9 23
+ret: void
+arg: rs_quaternion* q, "Quaternion to modify."
+summary: Conjugate a quaternion
+description:
+ Conjugates the quaternion.
+inline:
+ q->x = -q->x;
+ q->y = -q->y;
+ q->z = -q->z;
+test: none
+end:
+
+function: rsQuaternionDot
+version: 9 23
+ret: float
+arg: const rs_quaternion* q0, "First quaternion."
+arg: const rs_quaternion* q1, "Second quaternion."
+summary: Dot product of two quaternions
+description:
+ Returns the 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
+version: 9 23
+ret: void
+arg: rs_matrix4x4* m, "Resulting matrix."
+arg: const rs_quaternion* q, "Normalized quaternion."
+summary: Get a rotation matrix from a quaternion
+description:
+ Computes a 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
+version: 9 23
+ret: void
+arg: rs_quaternion* q, "Destination quaternion."
+arg: float rot, "Angle to rotate by, in radians."
+arg: float x, "X component of the vector."
+arg: float y, "Y component of the vector."
+arg: float z, "Z component of the vector."
+summary: Quaternion that represents a rotation about an arbitrary unit vector
+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
+version: 9 23
+ret: void
+arg: rs_quaternion* q, "Destination quaternion."
+arg: float w, "W component."
+arg: float x, "X component."
+arg: float y, "Y component."
+arg: float z, "Z component."
+summary: Create a quaternion
+description:
+ Creates a quaternion from its four components or from another quaternion.
+inline:
+ q->w = w;
+ q->x = x;
+ q->y = y;
+ q->z = z;
+test: none
+end:
+
+function: rsQuaternionSet
+version: 9 23
+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
+version: 9 23
+ret: void
+arg: rs_quaternion* q, "Destination quaternion."
+arg: float rot, "Angle to rotate by."
+arg: float x, "X component of a vector."
+arg: float y, "Y component of a vector."
+arg: float z, "Z component of a vector."
+summary: Create a rotation quaternion
+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
+version: 9 23
+ret: void
+arg: rs_quaternion* q, "Quaternion to normalize."
+summary: Normalize a quaternion
+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
+version: 9 23
+ret: void
+arg: rs_quaternion* q, "Destination quaternion."
+arg: float scalar, "Scalar to multiply the quaternion by."
+summary: Multiply a quaternion by a scalar or another quaternion
+description:
+ Multiplies a quaternion by a scalar or by another quaternion, e.g
+ <code>*q = *q * scalar;</code> or <code>*q = *q * *rhs;</code>.
+inline:
+ q->w *= scalar;
+ q->x *= scalar;
+ q->y *= scalar;
+ q->z *= scalar;
+test: none
+end:
+
+function: rsQuaternionMultiply
+version: 9 23
+ret: void
+arg: rs_quaternion* q
+arg: const rs_quaternion* rhs, "Quaternion to multiply the destination quaternion 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
+version: 9 23
+ret: void
+arg: rs_quaternion* q, "Result quaternion from the interpolation."
+arg: const rs_quaternion* q0, "First input quaternion."
+arg: const rs_quaternion* q1, "Second input quaternion."
+arg: float t, "How much to interpolate by."
+summary: Spherical linear interpolation between two quaternions
+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:
+
+# New versions. Same signatures but don't contain a body.
+function: rsQuaternionAdd
+version: 24
+ret: void
+arg: rs_quaternion* q
+arg: const rs_quaternion* rhs
+test: none
+end:
+
+function: rsQuaternionConjugate
+version: 24
+ret: void
+arg: rs_quaternion* q
+test: none
+end:
+
+function: rsQuaternionDot
+version: 24
+ret: float
+arg: const rs_quaternion* q0
+arg: const rs_quaternion* q1
+test: none
+end:
+
+function: rsQuaternionGetMatrixUnit
+version: 24
+ret: void
+arg: rs_matrix4x4* m
+arg: const rs_quaternion* q
+test: none
+end:
+
+function: rsQuaternionLoadRotateUnit
+version: 24
+ret: void
+arg: rs_quaternion* q
+arg: float rot
+arg: float x
+arg: float y
+arg: float z
+test: none
+end:
+
+function: rsQuaternionSet
+version: 24
+ret: void
+arg: rs_quaternion* q
+arg: float w
+arg: float x
+arg: float y
+arg: float z
+test: none
+end:
+
+function: rsQuaternionSet
+version: 24
+ret: void
+arg: rs_quaternion* q
+arg: const rs_quaternion* rhs
+test: none
+end:
+
+# NOTE: The following inline definitions depend on each other. The order must be preserved
+# for the compilation to work.
+
+function: rsQuaternionLoadRotate
+version: 24
+ret: void
+arg: rs_quaternion* q
+arg: float rot
+arg: float x
+arg: float y
+arg: float z
+test: none
+end:
+
+function: rsQuaternionNormalize
+version: 24
+ret: void
+arg: rs_quaternion* q
+test: none
+end:
+
+function: rsQuaternionMultiply
+version: 24
+ret: void
+arg: rs_quaternion* q
+arg: float scalar
+test: none
+end:
+
+function: rsQuaternionMultiply
+version: 24
+ret: void
+arg: rs_quaternion* q
+arg: const rs_quaternion* rhs
+test: none
+end:
+
+function: rsQuaternionSlerp
+version: 24
+ret: void
+arg: rs_quaternion* q
+arg: const rs_quaternion* q0
+arg: const rs_quaternion* q1
+arg: float t
+test: none
+end:
diff --git a/script_api/rs_time.spec b/script_api/rs_time.spec
new file mode 100644
index 0000000..bd31e09
--- /dev/null
+++ b/script_api/rs_time.spec
@@ -0,0 +1,104 @@
+#
+# 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: Time Functions and Types
+description:
+ The functions below can be used to tell the current clock time and the current
+ system up time. It is not recommended to call these functions inside of a kernel.
+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: Elapsed time since last call
+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 the output local time, i.e. the same value as the parameter local."
+arg: rs_tm* local, "Pointer to time structure where the local time will be stored."
+arg: const rs_time_t* timer, "Input time as a number of seconds since January 1, 1970."
+summary: Convert to local time
+description:
+ Converts the time specified by timer into a @rs_tm structure that provides year, month,
+ hour, etc. This value is stored at *local.
+
+ This functions returns the same pointer that is passed as first argument. If the
+ local parameter is NULL, this function does nothing and returns NULL.
+test: none
+end:
+
+function: rsTime
+ret: rs_time_t, "Seconds since the Epoch, -1 if there's an error."
+arg: rs_time_t* timer, "Location to also store the returned calendar time."
+summary: Seconds since January 1, 1970
+description:
+ Returns the number of seconds since the Epoch (00:00:00 UTC, January 1, 1970).
+
+ If timer is non-NULL, the result is also stored in the memory pointed to by
+ this variable.
+test: none
+end:
+
+function: rsUptimeMillis
+ret: int64_t, "Uptime in milliseconds."
+summary: System uptime in milliseconds
+description:
+ Returns the current system clock (uptime) in milliseconds.
+test: none
+end:
+
+function: rsUptimeNanos
+ret: int64_t, "Uptime in nanoseconds."
+summary: System uptime in nanoseconds
+description:
+ Returns the current system clock (uptime) in nanoseconds.
+
+ The granularity of the values return by this call may be much larger than a nanosecond.
+test: none
+end:
diff --git a/script_api/rs_value_types.spec b/script_api/rs_value_types.spec
new file mode 100644
index 0000000..6b404cc
--- /dev/null
+++ b/script_api/rs_value_types.spec
@@ -0,0 +1,574 @@
+#
+# 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: Numerical Types
+description:
+ <h5>Scalars:</h5>
+
+ RenderScript supports the following scalar numerical types:
+ <table>
+ <tr><td> </td> <td>8 bits </td> <td>16 bits </td> <td>32 bits </td> <td>64 bits</td></tr>
+ <tr><td>Integer: </td> <td>char, @int8_t </td> <td>short, @int16_t </td> <td>@int32_t </td> <td>long, long long, @int64_t</td></tr>
+ <tr><td>Unsigned integer:</td> <td>uchar, @uint8_t</td> <td>ushort, @uint16_t</td> <td>uint, @uint32_t</td> <td>ulong, @uint64_t</td></tr>
+ <tr><td>Floating point: </td> <td> </td> <td>half </td> <td>float </td> <td>double</td></tr>
+ </table>
+
+ <h5>Vectors:</h5>
+
+ RenderScript supports fixed size vectors of length 2, 3, and 4.
+ Vectors are declared using the common type name followed by a 2, 3, or 4.
+ E.g. @float4, @int3, @double2, @ulong4.
+
+ To create vector literals, use the vector type followed by the values enclosed
+ between curly braces, e.g. <code>(float3){1.0f, 2.0f, 3.0f}</code>.
+
+ Entries of a vector can be accessed using different naming styles.
+
+ Single entries can be accessed by following the variable name with a dot and:<ul>
+ <li>The letters x, y, z, and w,</li>
+ <li>The letters r, g, b, and a,</li>
+ <li>The letter s or S, followed by a zero based index.</li></ul>
+
+ For example, with <code>int4 myVar;</code> the following are equivalent:<code><br/>
+ myVar.x == myVar.r == myVar.s0 == myVar.S0<br/>
+ myVar.y == myVar.g == myVar.s1 == myVar.S1<br/>
+ myVar.z == myVar.b == myVar.s2 == myVar.S2<br/>
+ myVar.w == myVar.a == myVar.s3 == myVar.S3</code>
+
+ Multiple entries of a vector can be accessed at once by using an identifier that is
+ the concatenation of multiple letters or indices. The resulting vector has a size
+ equal to the number of entries named.
+
+ With the example above, the middle two entries can be accessed using
+ <code>myVar.yz</code>, <code>myVar.gb</code>, <code>myVar.s12</code>, and <code>myVar.S12</code>.
+
+ The entries don't have to be contiguous or in increasing order. Entries can even be
+ repeated, as long as we're not trying to assign to it. You also can't mix the naming
+ styles.
+
+ Here are examples of what can or can't be done:<code><br/>
+ float4 v4;<br/>
+ float3 v3;<br/>
+ float2 v2;<br/>
+ v2 = v4.xx; // Valid<br/>
+ v3 = v4.zxw; // Valid<br/>
+ v3 = v4.bba; // Valid<br/>
+ v3 = v4.s032; // Valid<br/>
+ v3.s120 = v4.S233; // Valid<br/>
+ v4.yz = v3.rg; // Valid<br/>
+ v4.yzx = v3.rg; // Invalid: mismatched sizes<br/>
+ v4.yzz = v3; // Invalid: z appears twice in an assignment<br/>
+ v3 = v3.xas0; // Invalid: can't mix xyzw with rgba nor s0...<br/>
+ v3 = v4.s034; // Invalid: the digit can only be 0, 1, 2, or 3<br/>
+ </code>
+
+ <h5>Matrices and Quaternions:</h5>
+
+ RenderScript supports fixed size square matrices of floats of size 2x2, 3x3, and 4x4.
+ The types are named @rs_matrix2x2, @rs_matrix3x3, and @rs_matrix4x4. See
+ <a href='rs_matrix.html'>Matrix Functions</a> for the list of operations.
+
+ Quaternions are also supported via @rs_quaternion. See <a href='rs_quaternion.html'>Quaterion Functions</a> for the list
+ of operations.
+end:
+
+type: half
+version: 23
+simple: __fp16
+summary: 16 bit floating point value
+description:
+ A 16 bit floating point value.
+end:
+
+type: half2
+version: 23
+simple: half
+attrib: ext_vector_type(2)
+summary: Two 16 bit floats
+description:
+ Vector version of the half float type. Provides two half fields packed
+ into a single 32 bit field with 32 bit alignment.
+end:
+
+type: half3
+version: 23
+simple: half
+attrib: ext_vector_type(3)
+summary: Three 16 bit floats
+description:
+ Vector version of the half float type. Provides three half fields packed
+ into a single 64 bit field with 64 bit alignment.
+end:
+
+type: half4
+version: 23
+simple: half
+attrib: ext_vector_type(4)
+summary: Four 16 bit floats
+description:
+ Vector version of the half float type. Provides four half fields packed
+ into a single 64 bit field with 64 bit alignment.
+end:
+
+
+type: int8_t
+simple: char
+summary: 8 bit signed integer
+description:
+ 8 bit signed integer type.
+end:
+
+type: int16_t
+simple: short
+summary: 16 bit signed integer
+description:
+ A 16 bit signed integer type.
+end:
+
+type: int32_t
+simple: int
+summary: 32 bit signed integer
+description:
+ A 32 bit signed integer type.
+end:
+
+type: int64_t
+version: 9 20
+simple: long long
+summary: 64 bit signed integer
+description:
+ A 64 bit signed 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:
+ A 16 bit unsigned integer type.
+end:
+
+type: uint32_t
+simple: unsigned int
+summary: 32 bit unsigned integer
+description:
+ A 32 bit unsigned integer type.
+end:
+
+type: uint64_t
+version: 9 20
+simple: unsigned long long
+summary: 64 bit unsigned integer
+description:
+ A 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:
+ A 16 bit unsigned integer type.
+end:
+
+type: uint
+simple: uint32_t
+summary: 32 bit unsigned integer
+description:
+ A 32 bit unsigned integer type.
+end:
+
+type: ulong
+simple: uint64_t
+summary: 64 bit unsigned integer
+description:
+ A 64 bit unsigned integer type.
+end:
+
+type: size_t
+size: 64
+simple: uint64_t
+summary: Unsigned size type
+description:
+ Unsigned size type. The number of bits depend on the compilation flags.
+end:
+
+type: size_t
+size: 32
+simple: uint32_t
+end:
+
+type: ssize_t
+size: 64
+simple: int64_t
+summary: Signed size type
+description:
+ Signed size type. The number of bits depend on the compilation flags.
+end:
+
+type: ssize_t
+size: 32
+simple: int32_t
+end:
+
+type: float2
+simple: float
+attrib: ext_vector_type(2)
+summary: Two 32 bit floats
+description:
+ A vector of two floats. These two floats are packed into a single 64 bit field
+ with a 64 bit alignment.
+
+ A vector of two floats. These two floats are packed into a single 64 bit field
+ with a 64 bit alignment.
+end:
+
+type: float3
+simple: float
+attrib: ext_vector_type(3)
+summary: Three 32 bit floats
+description:
+ A vector of three floats. These three floats are packed into a single 128 bit field
+ with a 128 bit alignment.
+end:
+
+type: float4
+simple: float
+attrib: ext_vector_type(4)
+summary: Four 32 bit floats
+description:
+ A vector of four floats type. These four floats are packed into a single 128 bit field
+ with a 128 bit alignment.
+end:
+
+
+type: double2
+simple: double
+attrib: ext_vector_type(2)
+summary: Two 64 bit floats
+description:
+ A vector of two doubles. These two double fields packed into a single 128 bit field
+ with a 128 bit alignment.
+end:
+
+type: double3
+simple: double
+attrib: ext_vector_type(3)
+summary: Three 64 bit floats
+description:
+ A vector of three doubles. These three double fields packed into a single 256 bit field
+ with a 256 bit alignment.
+end:
+
+type: double4
+simple: double
+attrib: ext_vector_type(4)
+summary: Four 64 bit floats
+description:
+ A vector of four doubles. These four double fields packed into a single 256 bit field
+ with a 256 bit alignment.
+end:
+
+
+type: uchar2
+simple: uchar
+attrib: ext_vector_type(2)
+summary: Two 8 bit unsigned integers
+description:
+ A vector of two uchars. These two uchar fields packed into a single 16 bit field
+ with a 16 bit alignment.
+end:
+
+type: uchar3
+simple: uchar
+attrib: ext_vector_type(3)
+summary: Three 8 bit unsigned integers
+description:
+ A vector of three uchars. These three uchar fields packed into a single 32 bit field
+ with a 32 bit alignment.
+end:
+
+type: uchar4
+simple: uchar
+attrib: ext_vector_type(4)
+summary: Four 8 bit unsigned integers
+description:
+ A vector of four uchars. These four uchar fields packed into a single 32 bit field
+ with a 32 bit alignment.
+end:
+
+
+type: ushort2
+simple: ushort
+attrib: ext_vector_type(2)
+summary: Two 16 bit unsigned integers
+description:
+ A vector of two ushorts. These two ushort fields packed into a single 32 bit field
+ with a 32 bit alignment.
+end:
+
+type: ushort3
+simple: ushort
+attrib: ext_vector_type(3)
+summary: Three 16 bit unsigned integers
+description:
+ A vector of three ushorts. These three ushort fields packed into a single 64 bit field
+ with a 64 bit alignment.
+end:
+
+type: ushort4
+simple: ushort
+attrib: ext_vector_type(4)
+summary: Four 16 bit unsigned integers
+description:
+ A vector of four ushorts. These four ushort fields packed into a single 64 bit field
+ with a 64 bit alignment.
+end:
+
+
+type: uint2
+simple: uint
+attrib: ext_vector_type(2)
+summary: Two 32 bit unsigned integers
+description:
+ A vector of two uints. These two uints are packed into a single 64 bit field
+ with a 64 bit alignment.
+end:
+
+type: uint3
+simple: uint
+attrib: ext_vector_type(3)
+summary: Three 32 bit unsigned integers
+description:
+ A vector of three uints. These three uints are packed into a single 128 bit field
+ with a 128 bit alignment.
+end:
+
+type: uint4
+simple: uint
+attrib: ext_vector_type(4)
+summary: Four 32 bit unsigned integers
+description:
+ A vector of four uints. These four uints are packed into a single 128 bit field
+ with a 128 bit alignment.
+end:
+
+
+type: ulong2
+simple: ulong
+attrib: ext_vector_type(2)
+summary: Two 64 bit unsigned integers
+description:
+ A vector of two ulongs. These two ulongs are packed into a single 128 bit field
+ with a 128 bit alignment.
+end:
+
+type: ulong3
+simple: ulong
+attrib: ext_vector_type(3)
+summary: Three 64 bit unsigned integers
+description:
+ A vector of three ulongs. These three ulong fields packed into a single 256 bit field
+ with a 256 bit alignment.
+end:
+
+type: ulong4
+simple: ulong
+attrib: ext_vector_type(4)
+summary: Four 64 bit unsigned integers
+description:
+ A vector of four ulongs. These four ulong fields packed into a single 256 bit field
+ with a 256 bit alignment.
+end:
+
+
+type: char2
+simple: char
+attrib: ext_vector_type(2)
+summary: Two 8 bit signed integers
+description:
+ A vector of two chars. These two chars are packed into a single 16 bit field
+ with a 16 bit alignment.
+end:
+
+type: char3
+simple: char
+attrib: ext_vector_type(3)
+summary: Three 8 bit signed integers
+description:
+ A vector of three chars. These three chars are packed into a single 32 bit field
+ with a 32 bit alignment.
+end:
+
+type: char4
+simple: char
+attrib: ext_vector_type(4)
+summary: Four 8 bit signed integers
+description:
+ A vector of four chars. These four chars are packed into a single 32 bit field
+ with a 32 bit alignment.
+end:
+
+
+type: short2
+simple: short
+attrib: ext_vector_type(2)
+summary: Two 16 bit signed integers
+description:
+ A vector of two shorts. These two shorts are packed into a single 32 bit field
+ with a 32 bit alignment.
+end:
+
+type: short3
+simple: short
+attrib: ext_vector_type(3)
+summary: Three 16 bit signed integers
+description:
+ A vector of three shorts. These three short fields packed into a single 64 bit field
+ with a 64 bit alignment.
+end:
+
+type: short4
+simple: short
+attrib: ext_vector_type(4)
+summary: Four 16 bit signed integers
+description:
+ A vector of four shorts. These four short fields packed into a single 64 bit field
+ with a 64 bit alignment.
+end:
+
+
+type: int2
+simple: int
+attrib: ext_vector_type(2)
+summary: Two 32 bit signed integers
+description:
+ A vector of two ints. These two ints are packed into a single 64 bit field
+ with a 64 bit alignment.
+end:
+
+type: int3
+simple: int
+attrib: ext_vector_type(3)
+summary: Three 32 bit signed integers
+description:
+ A vector of three ints. These three ints are packed into a single 128 bit field
+ with a 128 bit alignment.
+end:
+
+type: int4
+simple: int
+attrib: ext_vector_type(4)
+summary: Four 32 bit signed integers
+description:
+ A vector of four ints. These two fours are packed into a single 128 bit field
+ with a 128 bit alignment.
+end:
+
+
+type: long2
+simple: long
+attrib: ext_vector_type(2)
+summary: Two 64 bit signed integers
+description:
+ A vector of two longs. These two longs are packed into a single 128 bit field
+ with a 128 bit alignment.
+end:
+
+type: long3
+simple: long
+attrib: ext_vector_type(3)
+summary: Three 64 bit signed integers
+description:
+ A vector of three longs. These three longs are packed into a single 256 bit field
+ with a 256 bit alignment.
+end:
+
+type: long4
+simple: long
+attrib: ext_vector_type(4)
+summary: Four 64 bit signed integers
+description:
+ A vector of four longs. These four longs are packed into a single 256 bit field
+ with a 256 bit alignment.
+end:
+
+
+type: rs_matrix2x2
+struct:
+field: float m[4]
+summary: 2x2 matrix of 32 bit floats
+description:
+ A square 2x2 matrix of floats. The entries are stored in the array at the
+ location [row*2 + col].
+
+ See <a href='rs_matrix.html'>Matrix Functions</a>.
+end:
+
+type: rs_matrix3x3
+struct:
+field: float m[9]
+summary: 3x3 matrix of 32 bit floats
+description:
+ A square 3x3 matrix of floats. The entries are stored in the array at the
+ location [row*3 + col].
+
+ See <a href='rs_matrix.html'>Matrix Functions</a>.
+end:
+
+type: rs_matrix4x4
+struct:
+field: float m[16]
+summary: 4x4 matrix of 32 bit floats
+description:
+ A square 4x4 matrix of floats. The entries are stored in the array at the
+ location [row*4 + col].
+
+ See <a href='rs_matrix.html'>Matrix Functions</a>.
+end:
+
+
+type: rs_quaternion
+simple: float4
+summary: Quaternion
+description:
+ A square 4x4 matrix of floats that represents a quaternion.
+
+ See <a href='rs_quaternion.html'>Quaternion Functions</a>.
+end:
diff --git a/script_api/rs_vector_math.spec b/script_api/rs_vector_math.spec
new file mode 100644
index 0000000..c1d464d
--- /dev/null
+++ b/script_api/rs_vector_math.spec
@@ -0,0 +1,300 @@
+#
+# 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: Vector Math Functions
+description:
+ These functions interpret the input arguments as representation of vectors in
+ n-dimensional space.
+
+ The precision of the mathematical operations on 32 bit floats 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. See <a href='rs_math.html'>Mathematical Constants and Functions</a> for details.
+
+ Different precision/speed tradeoffs can be achieved by using variants of the common math
+ functions. Functions with a name starting with<ul>
+ <li>native_: May have custom hardware implementations with weaker precision. Additionally,
+ subnormal values may be flushed to zero, rounding towards zero may be used, and NaN and
+ infinity input may not be handled correctly.</li>
+ <li>fast_: May perform internal computations using 16 bit floats. Additionally, subnormal
+ values may be flushed to zero, and rounding towards zero may be used.</li>
+ </ul>
+end:
+
+function: cross
+version: 9
+attrib: const
+w: 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 left_vector
+arg: #2#1 right_vector
+summary: Cross product of two vectors
+description:
+ Computes the cross product of two vectors.
+test: vector
+end:
+
+function: cross
+version: 24
+attrib: const
+w: 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 left_vector
+arg: #2#1 right_vector
+test: vector
+end:
+
+function: distance
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2
+arg: #2#1 left_vector
+arg: #2#1 right_vector
+summary: Distance between two points
+description:
+ Compute the distance between two points.
+
+ See also @fast_distance(), @native_distance().
+test: vector
+end:
+
+function: distance
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2
+arg: #2#1 left_vector
+arg: #2#1 right_vector
+test: vector
+end:
+
+function: dot
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2
+arg: #2#1 left_vector
+arg: #2#1 right_vector
+summary: Dot product of two vectors
+description:
+ Computes the dot product of two vectors.
+test: vector
+end:
+
+function: dot
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2
+arg: #2#1 left_vector
+arg: #2#1 right_vector
+test: vector
+end:
+
+function: fast_distance
+version: 17
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2
+arg: #2#1 left_vector
+arg: #2#1 right_vector
+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.
+
+ See also @distance(), @native_distance().
+test: vector
+end:
+
+function: fast_length
+version: 17
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2
+arg: #2#1 v
+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.
+
+ See also @length(), @native_length().
+test: vector
+end:
+
+function: fast_normalize
+version: 17
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+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.
+
+ See also @normalize(), @native_normalize().
+test: vector
+end:
+
+function: length
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2
+arg: #2#1 v
+summary: Length of a vector
+description:
+ Computes the length of a vector.
+
+ See also @fast_length(), @native_length().
+test: vector
+end:
+
+function: length
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2
+arg: #2#1 v
+test: vector
+end:
+
+function: native_distance
+version: 21
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2
+arg: #2#1 left_vector
+arg: #2#1 right_vector
+summary: Approximate distance between two points
+description:
+ Computes the approximate distance between two points.
+
+ See also @distance(), @fast_distance().
+test: vector
+end:
+
+function: native_distance
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2
+arg: #2#1 left_vector
+arg: #2#1 right_vector
+test: vector
+end:
+
+function: native_length
+version: 21
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2
+arg: #2#1 v
+summary: Approximate length of a vector
+description:
+ Compute the approximate length of a vector.
+
+ See also @length(), @fast_length().
+test: vector
+end:
+
+function: native_length
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2
+arg: #2#1 v
+test: vector
+end:
+
+function: native_normalize
+version: 21
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+summary: Approximately normalize a vector
+description:
+ Approximately normalizes a vector.
+
+ See also @normalize(), @fast_normalize().
+test: vector
+end:
+
+function: native_normalize
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: vector
+end:
+
+function: normalize
+version: 9
+attrib: const
+w: 1, 2, 3, 4
+t: f32
+ret: #2#1
+arg: #2#1 v
+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.
+
+ See also @fast_normalize(), @native_normalize().
+test: vector
+end:
+
+function: normalize
+version: 24
+attrib: const
+w: 1, 2, 3, 4
+t: f16
+ret: #2#1
+arg: #2#1 v
+test: vector
+end: