Add support for CPU-only execution in C++ API.

Change-Id: Ifa6c211965eb14bfb9408404971e19827e7f5dc8
diff --git a/cpp/RenderScript.cpp b/cpp/RenderScript.cpp
index 3160b4d..fe4057d 100644
--- a/cpp/RenderScript.cpp
+++ b/cpp/RenderScript.cpp
@@ -54,18 +54,18 @@
     mDev = NULL;
 }
 
-bool RS::init() {
-    return RS::init(RS_VERSION);
+bool RS::init(bool forceCpu) {
+    return RS::init(RS_VERSION, forceCpu);
 }
 
-bool RS::init(int targetApi) {
+bool RS::init(int targetApi, bool forceCpu) {
     mDev = rsDeviceCreate();
     if (mDev == 0) {
         ALOGE("Device creation failed");
         return false;
     }
 
-    mContext = rsContextCreate(mDev, 0, targetApi);
+    mContext = rsContextCreate(mDev, 0, targetApi, forceCpu);
     if (mContext == 0) {
         ALOGE("Context creation failed");
         return false;
diff --git a/cpp/rsCppStructs.h b/cpp/rsCppStructs.h
index 6d0c89d..bee43d8 100644
--- a/cpp/rsCppStructs.h
+++ b/cpp/rsCppStructs.h
@@ -43,7 +43,8 @@
     RS();
     virtual ~RS();
 
-    bool init();
+    bool init() { return init(false); }
+    bool init(bool forceCpu);
 
     void setErrorHandler(ErrorHandlerFunc_t func);
     ErrorHandlerFunc_t getErrorHandler() { return mErrorFunc; }
@@ -56,7 +57,7 @@
     RsContext getContext() { return mContext; }
 
  private:
-    bool init(int targetApi);
+    bool init(int targetApi, bool forceCpu);
     static void * threadProc(void *);
 
     static bool gInitialized;