aboutsummaryrefslogtreecommitdiffstats
path: root/slang_rs_reflection.cpp
diff options
context:
space:
mode:
authorDavid Gross <dgross@google.com>2015-04-02 22:14:57 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-04-02 22:14:57 +0000
commitd9e0ee21190d02bf8559798553ceb51ee38b7c01 (patch)
treee9498134afe037468fe89bf2f830e495aee14c7b /slang_rs_reflection.cpp
parentb672a467222657528b4ec9943d780e9c65ce5f86 (diff)
parentf8594739fcfbce7e35d3705f8df1577abb00d516 (diff)
downloadandroid_frameworks_compile_slang-d9e0ee21190d02bf8559798553ceb51ee38b7c01.tar.gz
android_frameworks_compile_slang-d9e0ee21190d02bf8559798553ceb51ee38b7c01.tar.bz2
android_frameworks_compile_slang-d9e0ee21190d02bf8559798553ceb51ee38b7c01.zip
am f8594739: am de68eb69: Merge "Support new-style kernels with no output and no input."
* commit 'f8594739fcfbce7e35d3705f8df1577abb00d516': Support new-style kernels with no output and no input.
Diffstat (limited to 'slang_rs_reflection.cpp')
-rw-r--r--slang_rs_reflection.cpp49
1 files changed, 27 insertions, 22 deletions
diff --git a/slang_rs_reflection.cpp b/slang_rs_reflection.cpp
index dfa6e75..f1d9d3d 100644
--- a/slang_rs_reflection.cpp
+++ b/slang_rs_reflection.cpp
@@ -692,17 +692,18 @@ void RSReflectionJava::genExportForEach(const RSExportForEach *EF) {
// forEach_*()
ArgTy Args;
-
- slangAssert(EF->getNumParameters() > 0 || EF->hasReturn());
+ bool HasAllocation = false; // at least one in/out allocation?
const RSExportForEach::InVec &Ins = EF->getIns();
const RSExportForEach::InTypeVec &InTypes = EF->getInTypes();
const RSExportType *OET = EF->getOutType();
if (Ins.size() == 1) {
+ HasAllocation = true;
Args.push_back(std::make_pair("Allocation", "ain"));
} else if (Ins.size() > 1) {
+ HasAllocation = true;
for (RSExportForEach::InIter BI = Ins.begin(), EI = Ins.end(); BI != EI;
BI++) {
@@ -711,8 +712,10 @@ void RSReflectionJava::genExportForEach(const RSExportForEach *EF) {
}
}
- if (EF->hasOut() || EF->hasReturn())
+ if (EF->hasOut() || EF->hasReturn()) {
+ HasAllocation = true;
Args.push_back(std::make_pair("Allocation", "aout"));
+ }
const RSExportRecordType *ERT = EF->getParamPacketType();
if (ERT) {
@@ -737,34 +740,36 @@ void RSReflectionJava::genExportForEach(const RSExportForEach *EF) {
}
if (mRSContext->getTargetAPI() >= SLANG_JB_MR2_TARGET_API) {
- startFunction(AM_Public, false, "void", "forEach_" + EF->getName(), Args);
+ if (HasAllocation) {
+ startFunction(AM_Public, false, "void", "forEach_" + EF->getName(), Args);
- mOut.indent() << "forEach_" << EF->getName();
- mOut << "(";
+ mOut.indent() << "forEach_" << EF->getName();
+ mOut << "(";
- if (Ins.size() == 1) {
- mOut << "ain, ";
+ if (Ins.size() == 1) {
+ mOut << "ain, ";
- } else if (Ins.size() > 1) {
- for (RSExportForEach::InIter BI = Ins.begin(), EI = Ins.end(); BI != EI;
- BI++) {
+ } else if (Ins.size() > 1) {
+ for (RSExportForEach::InIter BI = Ins.begin(), EI = Ins.end(); BI != EI;
+ BI++) {
- mOut << "ain_" << (*BI)->getName().str() << ", ";
+ mOut << "ain_" << (*BI)->getName().str() << ", ";
+ }
}
- }
- if (EF->hasOut() || EF->hasReturn()) {
- mOut << "aout, ";
- }
+ if (EF->hasOut() || EF->hasReturn()) {
+ mOut << "aout, ";
+ }
- if (EF->hasUsrData()) {
- mOut << Args.back().second << ", ";
- }
+ if (EF->hasUsrData()) {
+ mOut << Args.back().second << ", ";
+ }
- // No clipped bounds to pass in.
- mOut << "null);\n";
+ // No clipped bounds to pass in.
+ mOut << "null);\n";
- endFunction();
+ endFunction();
+ }
// Add the clipped kernel parameters to the Args list.
Args.push_back(std::make_pair("Script.LaunchOptions", "sc"));