summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Alex Sakhartchouk <alexst@google.com> 2011-01-31 14:53:24 -0800
committer Alex Sakhartchouk <alexst@google.com> 2011-01-31 14:53:24 -0800
commitd0f5bd130bdbd5b357b7f1db4562fa55e06d384c (patch)
tree48ee3f26d8879c2a92b8ee60df9821d46666e9e2
parente62e890b68cce46b4ed19010874707d3d45fa258 (diff)
Cleaning up the serialization change.
Renaming the define to be more in line with what it does and removing the host stub header file. Change-Id: Ibd3a0a6a398c7f81cc661f71e4478707fe1679ed
-rw-r--r--libs/rs/Android.mk2
-rw-r--r--libs/rs/RenderScript.h2
-rw-r--r--libs/rs/rsAdapter.cpp4
-rw-r--r--libs/rs/rsAllocation.cpp52
-rw-r--r--libs/rs/rsAnimation.cpp5
-rw-r--r--libs/rs/rsComponent.cpp10
-rw-r--r--libs/rs/rsContext.h50
-rw-r--r--libs/rs/rsContextHostStub.h123
-rw-r--r--libs/rs/rsDevice.cpp4
-rw-r--r--libs/rs/rsElement.cpp4
-rw-r--r--libs/rs/rsFileA3D.cpp5
-rw-r--r--libs/rs/rsFont.cpp4
-rw-r--r--libs/rs/rsMesh.cpp13
-rw-r--r--libs/rs/rsMesh.h2
-rw-r--r--libs/rs/rsObjectBase.cpp6
-rw-r--r--libs/rs/rsProgram.cpp8
-rw-r--r--libs/rs/rsProgramFragment.cpp8
-rw-r--r--libs/rs/rsProgramRaster.cpp8
-rw-r--r--libs/rs/rsProgramStore.cpp8
-rw-r--r--libs/rs/rsProgramVertex.cpp8
-rw-r--r--libs/rs/rsSampler.cpp10
-rw-r--r--libs/rs/rsShaderCache.cpp7
-rw-r--r--libs/rs/rsStream.cpp5
-rw-r--r--libs/rs/rsType.cpp4
-rw-r--r--libs/rs/rsUtils.h2
-rw-r--r--libs/rs/rsVertexArray.cpp5
26 files changed, 98 insertions, 261 deletions
diff --git a/libs/rs/Android.mk b/libs/rs/Android.mk
index 2d0b6c4e2f1e..25c8beb3b2f5 100644
--- a/libs/rs/Android.mk
+++ b/libs/rs/Android.mk
@@ -132,7 +132,7 @@ include $(BUILD_SHARED_LIBRARY)
# Now build a host version for serialization
include $(CLEAR_VARS)
-LOCAL_CFLAGS += -DANDROID_RS_BUILD_FOR_HOST
+LOCAL_CFLAGS += -DANDROID_RS_SERIALIZE
LOCAL_SRC_FILES:= \
rsAllocation.cpp \
diff --git a/libs/rs/RenderScript.h b/libs/rs/RenderScript.h
index 882a0b0777bb..bb5e4aa29015 100644
--- a/libs/rs/RenderScript.h
+++ b/libs/rs/RenderScript.h
@@ -365,7 +365,7 @@ RsAllocation rsaAllocationCreateFromBitmap(RsContext con, RsType vtype,
RsAllocation rsaAllocationCubeCreateFromBitmap(RsContext con, RsType vtype,
RsAllocationMipmapControl mips,
const void *data, uint32_t usages);
-#ifdef ANDROID_RS_BUILD_FOR_HOST
+#ifdef ANDROID_RS_SERIALIZE
#define NO_RS_FUNCS
#endif
diff --git a/libs/rs/rsAdapter.cpp b/libs/rs/rsAdapter.cpp
index 8d363fde19e1..6e8ca705110e 100644
--- a/libs/rs/rsAdapter.cpp
+++ b/libs/rs/rsAdapter.cpp
@@ -15,11 +15,7 @@
* limitations under the License.
*/
-#ifndef ANDROID_RS_BUILD_FOR_HOST
#include "rsContext.h"
-#else
-#include "rsContextHostStub.h"
-#endif
using namespace android;
using namespace android::renderscript;
diff --git a/libs/rs/rsAllocation.cpp b/libs/rs/rsAllocation.cpp
index 2839b76cdeb2..54dcbcbefc30 100644
--- a/libs/rs/rsAllocation.cpp
+++ b/libs/rs/rsAllocation.cpp
@@ -13,15 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#ifndef ANDROID_RS_BUILD_FOR_HOST
-#include "rsContext.h"
+#include "rsContext.h"
+#ifndef ANDROID_RS_SERIALIZE
#include <GLES/gl.h>
#include <GLES2/gl2.h>
#include <GLES/glext.h>
-#else
-#include "rsContextHostStub.h"
-#endif //ANDROID_RS_BUILD_FOR_HOST
+#endif //ANDROID_RS_SERIALIZE
static void rsaAllocationGenerateScriptMips(RsContext con, RsAllocation va);
@@ -78,7 +76,7 @@ Allocation::~Allocation() {
mPtr = NULL;
}
freeScriptMemory();
-#ifndef ANDROID_RS_BUILD_FOR_HOST
+#ifndef ANDROID_RS_SERIALIZE
if (mBufferID) {
// Causes a SW crash....
//LOGV(" mBufferID %i", mBufferID);
@@ -89,7 +87,7 @@ Allocation::~Allocation() {
glDeleteTextures(1, &mTextureID);
mTextureID = 0;
}
-#endif //ANDROID_RS_BUILD_FOR_HOST
+#endif //ANDROID_RS_SERIALIZE
}
void Allocation::setCpuWritable(bool) {
@@ -114,7 +112,7 @@ void Allocation::deferedUploadToTexture(const Context *rsc) {
}
uint32_t Allocation::getGLTarget() const {
-#ifndef ANDROID_RS_BUILD_FOR_HOST
+#ifndef ANDROID_RS_SERIALIZE
if (getIsTexture()) {
if (mType->getDimFaces()) {
return GL_TEXTURE_CUBE_MAP;
@@ -125,7 +123,7 @@ uint32_t Allocation::getGLTarget() const {
if (getIsBufferObject()) {
return GL_ARRAY_BUFFER;
}
-#endif //ANDROID_RS_BUILD_FOR_HOST
+#endif //ANDROID_RS_SERIALIZE
return 0;
}
@@ -156,7 +154,7 @@ void Allocation::syncAll(Context *rsc, RsAllocationUsageType src) {
}
void Allocation::uploadToTexture(const Context *rsc) {
-#ifndef ANDROID_RS_BUILD_FOR_HOST
+#ifndef ANDROID_RS_SERIALIZE
mUsageFlags |= RS_ALLOCATION_USAGE_GRAPHICS_TEXTURE;
GLenum type = mType->getElement()->getComponent().getGLType();
GLenum format = mType->getElement()->getComponent().getGLFormat();
@@ -193,10 +191,10 @@ void Allocation::uploadToTexture(const Context *rsc) {
}
rsc->checkError("Allocation::uploadToTexture");
-#endif //ANDROID_RS_BUILD_FOR_HOST
+#endif //ANDROID_RS_SERIALIZE
}
-#ifndef ANDROID_RS_BUILD_FOR_HOST
+#ifndef ANDROID_RS_SERIALIZE
const static GLenum gFaceOrder[] = {
GL_TEXTURE_CUBE_MAP_POSITIVE_X,
GL_TEXTURE_CUBE_MAP_NEGATIVE_X,
@@ -205,12 +203,12 @@ const static GLenum gFaceOrder[] = {
GL_TEXTURE_CUBE_MAP_POSITIVE_Z,
GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
};
-#endif //ANDROID_RS_BUILD_FOR_HOST
+#endif //ANDROID_RS_SERIALIZE
void Allocation::update2DTexture(const void *ptr, uint32_t xoff, uint32_t yoff,
uint32_t lod, RsAllocationCubemapFace face,
uint32_t w, uint32_t h) {
-#ifndef ANDROID_RS_BUILD_FOR_HOST
+#ifndef ANDROID_RS_SERIALIZE
GLenum type = mType->getElement()->getComponent().getGLType();
GLenum format = mType->getElement()->getComponent().getGLFormat();
GLenum target = (GLenum)getGLTarget();
@@ -222,11 +220,11 @@ void Allocation::update2DTexture(const void *ptr, uint32_t xoff, uint32_t yoff,
t = gFaceOrder[face];
}
glTexSubImage2D(t, lod, xoff, yoff, w, h, format, type, ptr);
-#endif //ANDROID_RS_BUILD_FOR_HOST
+#endif //ANDROID_RS_SERIALIZE
}
void Allocation::upload2DTexture(bool isFirstUpload) {
-#ifndef ANDROID_RS_BUILD_FOR_HOST
+#ifndef ANDROID_RS_SERIALIZE
GLenum type = mType->getElement()->getComponent().getGLType();
GLenum format = mType->getElement()->getComponent().getGLFormat();
@@ -264,7 +262,7 @@ void Allocation::upload2DTexture(bool isFirstUpload) {
if (mMipmapControl == RS_ALLOCATION_MIPMAP_ON_SYNC_TO_TEXTURE) {
glGenerateMipmap(target);
}
-#endif //ANDROID_RS_BUILD_FOR_HOST
+#endif //ANDROID_RS_SERIALIZE
}
void Allocation::deferedUploadToBufferObject(const Context *rsc) {
@@ -273,7 +271,7 @@ void Allocation::deferedUploadToBufferObject(const Context *rsc) {
}
void Allocation::uploadToBufferObject(const Context *rsc) {
-#ifndef ANDROID_RS_BUILD_FOR_HOST
+#ifndef ANDROID_RS_SERIALIZE
rsAssert(!mType->getDimY());
rsAssert(!mType->getDimZ());
@@ -292,7 +290,7 @@ void Allocation::uploadToBufferObject(const Context *rsc) {
glBufferData(target, mType->getSizeBytes(), getPtr(), GL_DYNAMIC_DRAW);
glBindBuffer(target, 0);
rsc->checkError("Allocation::uploadToBufferObject");
-#endif //ANDROID_RS_BUILD_FOR_HOST
+#endif //ANDROID_RS_SERIALIZE
}
void Allocation::uploadCheck(Context *rsc) {
@@ -450,13 +448,13 @@ void Allocation::elementData(Context *rsc, uint32_t x, uint32_t y,
}
void Allocation::addProgramToDirty(const Program *p) {
-#ifndef ANDROID_RS_BUILD_FOR_HOST
+#ifndef ANDROID_RS_SERIALIZE
mToDirtyList.push(p);
-#endif //ANDROID_RS_BUILD_FOR_HOST
+#endif //ANDROID_RS_SERIALIZE
}
void Allocation::removeProgramToDirty(const Program *p) {
-#ifndef ANDROID_RS_BUILD_FOR_HOST
+#ifndef ANDROID_RS_SERIALIZE
for (size_t ct=0; ct < mToDirtyList.size(); ct++) {
if (mToDirtyList[ct] == p) {
mToDirtyList.removeAt(ct);
@@ -464,7 +462,7 @@ void Allocation::removeProgramToDirty(const Program *p) {
}
}
rsAssert(0);
-#endif //ANDROID_RS_BUILD_FOR_HOST
+#endif //ANDROID_RS_SERIALIZE
}
void Allocation::dumpLOGV(const char *prefix) const {
@@ -539,11 +537,11 @@ Allocation *Allocation::createFromStream(Context *rsc, IStream *stream) {
}
void Allocation::sendDirty() const {
-#ifndef ANDROID_RS_BUILD_FOR_HOST
+#ifndef ANDROID_RS_SERIALIZE
for (size_t ct=0; ct < mToDirtyList.size(); ct++) {
mToDirtyList[ct]->forceDirty();
}
-#endif //ANDROID_RS_BUILD_FOR_HOST
+#endif //ANDROID_RS_SERIALIZE
}
void Allocation::incRefs(const void *ptr, size_t ct, size_t startOff) const {
@@ -602,7 +600,7 @@ void Allocation::resize2D(Context *rsc, uint32_t dimX, uint32_t dimY) {
/////////////////
//
-#ifndef ANDROID_RS_BUILD_FOR_HOST
+#ifndef ANDROID_RS_SERIALIZE
namespace android {
namespace renderscript {
@@ -848,4 +846,4 @@ RsAllocation rsaAllocationCubeCreateFromBitmap(RsContext con, RsType vtype,
return texAlloc;
}
-#endif //ANDROID_RS_BUILD_FOR_HOST
+#endif //ANDROID_RS_SERIALIZE
diff --git a/libs/rs/rsAnimation.cpp b/libs/rs/rsAnimation.cpp
index 6abda3c0cd14..48b4f029c6d0 100644
--- a/libs/rs/rsAnimation.cpp
+++ b/libs/rs/rsAnimation.cpp
@@ -14,12 +14,7 @@
* limitations under the License.
*/
-#ifndef ANDROID_RS_BUILD_FOR_HOST
#include "rsContext.h"
-#else
-#include "rsContextHostStub.h"
-#endif //ANDROID_RS_BUILD_FOR_HOST
-
#include "rsAnimation.h"
diff --git a/libs/rs/rsComponent.cpp b/libs/rs/rsComponent.cpp
index cb3caf805c5a..4c4987aaf7a4 100644
--- a/libs/rs/rsComponent.cpp
+++ b/libs/rs/rsComponent.cpp
@@ -16,7 +16,7 @@
#include "rsComponent.h"
-#ifndef ANDROID_RS_BUILD_FOR_HOST
+#ifndef ANDROID_RS_SERIALIZE
#include <GLES/gl.h>
#endif
@@ -181,7 +181,7 @@ bool Component::isReference() const {
}
uint32_t Component::getGLType() const {
-#ifndef ANDROID_RS_BUILD_FOR_HOST
+#ifndef ANDROID_RS_SERIALIZE
switch (mType) {
case RS_TYPE_UNSIGNED_5_6_5: return GL_UNSIGNED_SHORT_5_6_5;
case RS_TYPE_UNSIGNED_5_5_5_1: return GL_UNSIGNED_SHORT_5_5_5_1;
@@ -195,12 +195,12 @@ uint32_t Component::getGLType() const {
case RS_TYPE_SIGNED_16: return GL_SHORT;
default: break;
}
-#endif //ANDROID_RS_BUILD_FOR_HOST
+#endif //ANDROID_RS_SERIALIZE
return 0;
}
uint32_t Component::getGLFormat() const {
-#ifndef ANDROID_RS_BUILD_FOR_HOST
+#ifndef ANDROID_RS_SERIALIZE
switch (mKind) {
case RS_KIND_PIXEL_L: return GL_LUMINANCE;
case RS_KIND_PIXEL_A: return GL_ALPHA;
@@ -209,7 +209,7 @@ uint32_t Component::getGLFormat() const {
case RS_KIND_PIXEL_RGBA: return GL_RGBA;
default: break;
}
-#endif //ANDROID_RS_BUILD_FOR_HOST
+#endif //ANDROID_RS_SERIALIZE
return 0;
}
diff --git a/libs/rs/rsContext.h b/libs/rs/rsContext.h
index 9f94f26aa8e4..c5e32a67dd13 100644
--- a/libs/rs/rsContext.h
+++ b/libs/rs/rsContext.h
@@ -18,16 +18,16 @@
#define ANDROID_RS_CONTEXT_H
#include "rsUtils.h"
-#include "rsMutex.h"
-
-#include "rsThreadIO.h"
#include "rsType.h"
-#include "rsMatrix.h"
#include "rsAllocation.h"
#include "rsMesh.h"
+
+#ifndef ANDROID_RS_SERIALIZE
+#include "rsMutex.h"
+#include "rsThreadIO.h"
+#include "rsMatrix.h"
#include "rsDevice.h"
#include "rsScriptC.h"
-#include "rsAllocation.h"
#include "rsAdapter.h"
#include "rsSampler.h"
#include "rsFont.h"
@@ -42,6 +42,7 @@
#include "rsLocklessFifo.h"
#include <ui/egl/android_natives.h>
+#endif // ANDROID_RS_SERIALIZE
// ---------------------------------------------------------------------------
namespace android {
@@ -66,6 +67,8 @@ namespace renderscript {
#define CHECK_OBJ_OR_NULL(o)
#endif
+#ifndef ANDROID_RS_SERIALIZE
+
class Context {
public:
static Context * createContext(Device *, const RsSurfaceConfig *sc);
@@ -321,6 +324,39 @@ private:
uint32_t mAverageFPS;
};
-}
-}
+#else
+
+class Context {
+public:
+ Context() {
+ mObjHead = NULL;
+ }
+ ~Context() {
+ ObjectBase::zeroAllUserRef(this);
+ }
+
+ ElementState mStateElement;
+ TypeState mStateType;
+
+ struct {
+ bool mLogTimes;
+ bool mLogScripts;
+ bool mLogObjects;
+ bool mLogShaders;
+ bool mLogShadersAttr;
+ bool mLogShadersUniforms;
+ bool mLogVisual;
+ } props;
+
+ void setError(RsError e, const char *msg = NULL) { }
+
+ mutable const ObjectBase * mObjHead;
+
+protected:
+
+};
+#endif //ANDROID_RS_SERIALIZE
+
+} // renderscript
+} // android
#endif
diff --git a/libs/rs/rsContextHostStub.h b/libs/rs/rsContextHostStub.h
deleted file mode 100644
index 7e8ec3972696..000000000000
--- a/libs/rs/rsContextHostStub.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (C) 2009 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_CONTEXT_HOST_STUB_H
-#define ANDROID_RS_CONTEXT_HOST_STUB_H
-
-#include "rsUtils.h"
-#include "rsType.h"
-#include "rsAllocation.h"
-#include "rsMesh.h"
-#include "rsAllocation.h"
-
-// ---------------------------------------------------------------------------
-namespace android {
-namespace renderscript {
-
-#define CHECK_OBJ(o)
-#define CHECK_OBJ_OR_NULL(o)
-
-class Device;
-
-class Context {
-public:
- Context(Device *, bool isGraphics, bool useDepth) {
- mObjHead = NULL;
- }
- ~Context() {
- }
-
- //StructuredAllocationContext mStateAllocation;
- ElementState mStateElement;
- TypeState mStateType;
- RsSurfaceConfig mUserSurfaceConfig;
-
- //bool setupCheck();
-
-
- uint32_t getWidth() const {return 0;}
- uint32_t getHeight() const {return 0;}
-
- // Timers
- enum Timers {
- RS_TIMER_IDLE,
- RS_TIMER_INTERNAL,
- RS_TIMER_SCRIPT,
- RS_TIMER_CLEAR_SWAP,
- _RS_TIMER_TOTAL
- };
-
- void timerSet(Timers) { }
-
- bool checkVersion1_1() const {return false; }
- bool checkVersion2_0() const {return false; }
-
- struct {
- bool mLogTimes;
- bool mLogScripts;
- bool mLogObjects;
- bool mLogShaders;
- bool mLogShadersAttr;
- bool mLogShadersUniforms;
- bool mLogVisual;
- } props;
-
- void dumpDebug() const { }
- void checkError(const char *) const { };
- void setError(RsError e, const char *msg = NULL) { }
-
- mutable const ObjectBase * mObjHead;
-
- bool ext_OES_texture_npot() const {return mGL.OES_texture_npot;}
- bool ext_GL_NV_texture_npot_2D_mipmap() const {return mGL.GL_NV_texture_npot_2D_mipmap;}
- float ext_texture_max_aniso() const {return mGL.EXT_texture_max_aniso; }
- uint32_t getMaxFragmentTextures() const {return mGL.mMaxFragmentTextureImageUnits;}
- uint32_t getMaxFragmentUniformVectors() const {return mGL.mMaxFragmentUniformVectors;}
- uint32_t getMaxVertexUniformVectors() const {return mGL.mMaxVertexUniformVectors;}
- uint32_t getMaxVertexAttributes() const {return mGL.mMaxVertexAttribs;}
-
-protected:
-
- struct {
- const uint8_t * mVendor;
- const uint8_t * mRenderer;
- const uint8_t * mVersion;
- const uint8_t * mExtensions;
-
- uint32_t mMajorVersion;
- uint32_t mMinorVersion;
-
- int32_t mMaxVaryingVectors;
- int32_t mMaxTextureImageUnits;
-
- int32_t mMaxFragmentTextureImageUnits;
- int32_t mMaxFragmentUniformVectors;
-
- int32_t mMaxVertexAttribs;
- int32_t mMaxVertexUniformVectors;
- int32_t mMaxVertexTextureUnits;
-
- bool OES_texture_npot;
- bool GL_NV_texture_npot_2D_mipmap;
- float EXT_texture_max_aniso;
- } mGL;
-
-};
-
-}
-}
-#endif
-
diff --git a/libs/rs/rsDevice.cpp b/libs/rs/rsDevice.cpp
index dd964452e5b5..d7d03f6a283d 100644
--- a/libs/rs/rsDevice.cpp
+++ b/libs/rs/rsDevice.cpp
@@ -15,11 +15,7 @@
*/
#include "rsDevice.h"
-#ifndef ANDROID_RS_BUILD_FOR_HOST
#include "rsContext.h"
-#else
-#include "rsContextHostStub.h"
-#endif
using namespace android;
using namespace android::renderscript;
diff --git a/libs/rs/rsElement.cpp b/libs/rs/rsElement.cpp
index 7c3b9e8dc42d..477cb6166b21 100644
--- a/libs/rs/rsElement.cpp
+++ b/libs/rs/rsElement.cpp
@@ -15,11 +15,7 @@
*/
-#ifndef ANDROID_RS_BUILD_FOR_HOST
#include "rsContext.h"
-#else
-#include "rsContextHostStub.h"
-#endif
using namespace android;
using namespace android::renderscript;
diff --git a/libs/rs/rsFileA3D.cpp b/libs/rs/rsFileA3D.cpp
index 97ce8c8affa4..cd02c24b981f 100644
--- a/libs/rs/rsFileA3D.cpp
+++ b/libs/rs/rsFileA3D.cpp
@@ -15,12 +15,7 @@
* limitations under the License.
*/
-#ifndef ANDROID_RS_BUILD_FOR_HOST
#include "rsContext.h"
-#else
-#include "rsContextHostStub.h"
-#endif
-
#include "rsFileA3D.h"
#include "rsMesh.h"
diff --git a/libs/rs/rsFont.cpp b/libs/rs/rsFont.cpp
index 7fdfbe05f287..8a5ab99e8bad 100644
--- a/libs/rs/rsFont.cpp
+++ b/libs/rs/rsFont.cpp
@@ -15,11 +15,7 @@
* limitations under the License.
*/
-#ifndef ANDROID_RS_BUILD_FOR_HOST
#include "rsContext.h"
-#else
-#include "rsContextHostStub.h"
-#endif
#include "rsFont.h"
#include "rsProgramFragment.h"
diff --git a/libs/rs/rsMesh.cpp b/libs/rs/rsMesh.cpp
index 8cf76e5f64a1..76fe62da8830 100644
--- a/libs/rs/rsMesh.cpp
+++ b/libs/rs/rsMesh.cpp
@@ -14,14 +14,11 @@
* limitations under the License.
*/
-#ifndef ANDROID_RS_BUILD_FOR_HOST
#include "rsContext.h"
-
+#ifndef ANDROID_RS_SERIALIZE
#include <GLES/gl.h>
#include <GLES2/gl2.h>
#include <GLES/glext.h>
-#else
-#include "rsContextHostStub.h"
#endif
using namespace android;
@@ -33,7 +30,7 @@ Mesh::Mesh(Context *rsc) : ObjectBase(rsc) {
mVertexBuffers = NULL;
mVertexBufferCount = 0;
-#ifndef ANDROID_RS_BUILD_FOR_HOST
+#ifndef ANDROID_RS_SERIALIZE
mAttribs = NULL;
mAttribAllocationIndex = NULL;
@@ -53,7 +50,7 @@ Mesh::~Mesh() {
delete[] mPrimitives;
}
-#ifndef ANDROID_RS_BUILD_FOR_HOST
+#ifndef ANDROID_RS_SERIALIZE
if (mAttribs) {
delete[] mAttribs;
delete[] mAttribAllocationIndex;
@@ -134,7 +131,7 @@ Mesh *Mesh::createFromStream(Context *rsc, IStream *stream) {
}
}
-#ifndef ANDROID_RS_BUILD_FOR_HOST
+#ifndef ANDROID_RS_SERIALIZE
mesh->updateGLPrimitives();
mesh->initVertexAttribs();
mesh->uploadAll(rsc);
@@ -142,7 +139,7 @@ Mesh *Mesh::createFromStream(Context *rsc, IStream *stream) {
return mesh;
}
-#ifndef ANDROID_RS_BUILD_FOR_HOST
+#ifndef ANDROID_RS_SERIALIZE
bool Mesh::isValidGLComponent(const Element *elem, uint32_t fieldIdx) {
// Do not create attribs for padding
diff --git a/libs/rs/rsMesh.h b/libs/rs/rsMesh.h
index e44f90d226e6..3e080e2aabb9 100644
--- a/libs/rs/rsMesh.h
+++ b/libs/rs/rsMesh.h
@@ -54,7 +54,7 @@ public:
virtual RsA3DClassID getClassId() const { return RS_A3D_CLASS_ID_MESH; }
static Mesh *createFromStream(Context *rsc, IStream *stream);
-#ifndef ANDROID_RS_BUILD_FOR_HOST
+#ifndef ANDROID_RS_SERIALIZE
void render(Context *) const;
void renderPrimitive(Context *, uint32_t primIndex) const;
void renderPrimitiveRange(Context *, uint32_t primIndex, uint32_t start, uint32_t len) const;
diff --git a/libs/rs/rsObjectBase.cpp b/libs/rs/rsObjectBase.cpp
index aec2f6794de5..f428f9486d8d 100644
--- a/libs/rs/rsObjectBase.cpp
+++ b/libs/rs/rsObjectBase.cpp
@@ -15,13 +15,7 @@
*/
#include "rsObjectBase.h"
-
-#ifndef ANDROID_RS_BUILD_FOR_HOST
#include "rsContext.h"
-#else
-#include "rsContextHostStub.h"
-#endif
-
using namespace android;
using namespace android::renderscript;
diff --git a/libs/rs/rsProgram.cpp b/libs/rs/rsProgram.cpp
index 39b85e39ed3f..4ef05bf4372f 100644
--- a/libs/rs/rsProgram.cpp
+++ b/libs/rs/rsProgram.cpp
@@ -14,15 +14,11 @@
* limitations under the License.
*/
-#ifndef ANDROID_RS_BUILD_FOR_HOST
#include "rsContext.h"
+#ifndef ANDROID_RS_SERIALIZE
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
-#else
-#include "rsContextHostStub.h"
-#include <OpenGL/gl.h>
-#include <OpenGL/glext.h>
-#endif //ANDROID_RS_BUILD_FOR_HOST
+#endif //ANDROID_RS_SERIALIZE
#include "rsProgram.h"
diff --git a/libs/rs/rsProgramFragment.cpp b/libs/rs/rsProgramFragment.cpp
index 22cd5d39a69e..ff314b7f6429 100644
--- a/libs/rs/rsProgramFragment.cpp
+++ b/libs/rs/rsProgramFragment.cpp
@@ -14,17 +14,13 @@
* limitations under the License.
*/
-#ifndef ANDROID_RS_BUILD_FOR_HOST
#include "rsContext.h"
+#ifndef ANDROID_RS_SERIALIZE
#include <GLES/gl.h>
#include <GLES/glext.h>
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
-#else
-#include "rsContextHostStub.h"
-#include <OpenGL/gl.h>
-#include <OpenGL/glext.h>
-#endif //ANDROID_RS_BUILD_FOR_HOST
+#endif //ANDROID_RS_SERIALIZE
#include "rsProgramFragment.h"
diff --git a/libs/rs/rsProgramRaster.cpp b/libs/rs/rsProgramRaster.cpp
index f2b5b9af7d4b..ace1572f4010 100644
--- a/libs/rs/rsProgramRaster.cpp
+++ b/libs/rs/rsProgramRaster.cpp
@@ -14,15 +14,11 @@
* limitations under the License.
*/
-#ifndef ANDROID_RS_BUILD_FOR_HOST
#include "rsContext.h"
+#ifndef ANDROID_RS_SERIALIZE
#include <GLES/gl.h>
#include <GLES/glext.h>
-#else
-#include "rsContextHostStub.h"
-#include <OpenGL/gl.h>
-#include <OpenGl/glext.h>
-#endif //ANDROID_RS_BUILD_FOR_HOST
+#endif //ANDROID_RS_SERIALIZE
#include "rsProgramRaster.h"
diff --git a/libs/rs/rsProgramStore.cpp b/libs/rs/rsProgramStore.cpp
index 72ac574af2fe..09b759d9a340 100644
--- a/libs/rs/rsProgramStore.cpp
+++ b/libs/rs/rsProgramStore.cpp
@@ -14,15 +14,11 @@
* limitations under the License.
*/
-#ifndef ANDROID_RS_BUILD_FOR_HOST
#include "rsContext.h"
+#ifndef ANDROID_RS_SERIALIZE
#include <GLES/gl.h>
#include <GLES/glext.h>
-#else
-#include "rsContextHostStub.h"
-#include <OpenGL/gl.h>
-#include <OpenGl/glext.h>
-#endif //ANDROID_RS_BUILD_FOR_HOST
+#endif //ANDROID_RS_SERIALIZE
#include "rsProgramStore.h"
diff --git a/libs/rs/rsProgramVertex.cpp b/libs/rs/rsProgramVertex.cpp
index ad2beafbf9d2..403c2a6e356b 100644
--- a/libs/rs/rsProgramVertex.cpp
+++ b/libs/rs/rsProgramVertex.cpp
@@ -14,17 +14,13 @@
* limitations under the License.
*/
-#ifndef ANDROID_RS_BUILD_FOR_HOST
#include "rsContext.h"
+#ifndef ANDROID_RS_SERIALIZE
#include <GLES/gl.h>
#include <GLES/glext.h>
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
-#else
-#include "rsContextHostStub.h"
-#include <OpenGL/gl.h>
-#include <OpenGL/glext.h>
-#endif //ANDROID_RS_BUILD_FOR_HOST
+#endif //ANDROID_RS_SERIALIZE
#include "rsProgramVertex.h"
diff --git a/libs/rs/rsSampler.cpp b/libs/rs/rsSampler.cpp
index c80aecca79b8..db2383aca7eb 100644
--- a/libs/rs/rsSampler.cpp
+++ b/libs/rs/rsSampler.cpp
@@ -14,15 +14,11 @@
* limitations under the License.
*/
-#ifndef ANDROID_RS_BUILD_FOR_HOST
+#include "rsContext.h"
+#ifndef ANDROID_RS_SERIALIZE
#include <GLES/gl.h>
#include <GLES/glext.h>
-#include "rsContext.h"
-#else
-#include "rsContextHostStub.h"
-#include <OpenGL/gl.h>
-#include <OpenGL/glext.h>
-#endif //ANDROID_RS_BUILD_FOR_HOST
+#endif //ANDROID_RS_SERIALIZE
#include "rsSampler.h"
diff --git a/libs/rs/rsShaderCache.cpp b/libs/rs/rsShaderCache.cpp
index b958021b37a8..e8d89c21cb77 100644
--- a/libs/rs/rsShaderCache.cpp
+++ b/libs/rs/rsShaderCache.cpp
@@ -14,14 +14,11 @@
* limitations under the License.
*/
-#ifndef ANDROID_RS_BUILD_FOR_HOST
#include "rsContext.h"
+#ifndef ANDROID_RS_SERIALIZE
#include <GLES/gl.h>
#include <GLES2/gl2.h>
-#else
-#include "rsContextHostStub.h"
-#include <OpenGL/gl.h>
-#endif //ANDROID_RS_BUILD_FOR_HOST
+#endif //ANDROID_RS_SERIALIZE
using namespace android;
using namespace android::renderscript;
diff --git a/libs/rs/rsStream.cpp b/libs/rs/rsStream.cpp
index 49ed567dceca..b9df0ccfac6a 100644
--- a/libs/rs/rsStream.cpp
+++ b/libs/rs/rsStream.cpp
@@ -15,12 +15,7 @@
* limitations under the License.
*/
-#ifndef ANDROID_RS_BUILD_FOR_HOST
#include "rsContext.h"
-#else
-#include "rsContextHostStub.h"
-#endif
-
#include "rsStream.h"
using namespace android;
diff --git a/libs/rs/rsType.cpp b/libs/rs/rsType.cpp
index b94c2f8eaf44..cd2be94979a8 100644
--- a/libs/rs/rsType.cpp
+++ b/libs/rs/rsType.cpp
@@ -14,11 +14,7 @@
* limitations under the License.
*/
-#ifndef ANDROID_RS_BUILD_FOR_HOST
#include "rsContext.h"
-#else
-#include "rsContextHostStub.h"
-#endif
using namespace android;
using namespace android::renderscript;
diff --git a/libs/rs/rsUtils.h b/libs/rs/rsUtils.h
index 0699b57fa7fb..3b60af58fb4d 100644
--- a/libs/rs/rsUtils.h
+++ b/libs/rs/rsUtils.h
@@ -32,7 +32,7 @@
#include <time.h>
#include <cutils/atomic.h>
-#ifndef ANDROID_RS_BUILD_FOR_HOST
+#ifndef ANDROID_RS_SERIALIZE
#include <EGL/egl.h>
#endif
diff --git a/libs/rs/rsVertexArray.cpp b/libs/rs/rsVertexArray.cpp
index d9393fe303af..354ee89f7c5b 100644
--- a/libs/rs/rsVertexArray.cpp
+++ b/libs/rs/rsVertexArray.cpp
@@ -14,13 +14,10 @@
* limitations under the License.
*/
-#ifndef ANDROID_RS_BUILD_FOR_HOST
#include "rsContext.h"
+#ifndef ANDROID_RS_SERIALIZE
#include <GLES/gl.h>
#include <GLES2/gl2.h>
-#else
-#include "rsContextHostStub.h"
-#include <OpenGL/gl.h>
#endif
using namespace android;