summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorAlex Sakhartchouk <alexst@google.com>2011-06-03 10:18:01 -0700
committerAlex Sakhartchouk <alexst@google.com>2011-06-03 10:18:01 -0700
commit17a8a1939d4cbc74de54954c67f3dd61882420aa (patch)
tree96b3a818be8b3687e6197a1d100e0a105359e488 /libs
parent6c2cb3061d031b5d8ccc095ecc038959d4489709 (diff)
downloadframeworks_base-17a8a1939d4cbc74de54954c67f3dd61882420aa.zip
frameworks_base-17a8a1939d4cbc74de54954c67f3dd61882420aa.tar.gz
frameworks_base-17a8a1939d4cbc74de54954c67f3dd61882420aa.tar.bz2
More work to make libRS buildable on the host.
Change-Id: I239585ef7c1334f7fc19fa6423535dea7b9a753f
Diffstat (limited to 'libs')
-rw-r--r--libs/rs/Android.mk62
-rw-r--r--libs/rs/RenderScript.h8
-rw-r--r--libs/rs/driver/rsdCore.cpp1
-rw-r--r--libs/rs/driver/rsdCore.h1
-rw-r--r--libs/rs/rsAllocation.cpp18
-rw-r--r--libs/rs/rsAllocation.h9
-rw-r--r--libs/rs/rsContext.cpp60
-rw-r--r--libs/rs/rsContext.h47
-rw-r--r--libs/rs/rsFifoSocket.cpp4
-rw-r--r--libs/rs/rsFont.cpp25
-rw-r--r--libs/rs/rsFont.h4
-rw-r--r--libs/rs/rsMesh.cpp10
-rw-r--r--libs/rs/rsProgramFragment.cpp4
-rw-r--r--libs/rs/rsProgramVertex.cpp4
-rw-r--r--libs/rs/rsScript.cpp10
-rw-r--r--libs/rs/rsScript.h4
-rw-r--r--libs/rs/rsScriptC.cpp9
-rw-r--r--libs/rs/rsScriptC.h2
-rw-r--r--libs/rs/rsThreadIO.cpp2
-rw-r--r--libs/rs/rs_hal.h1
20 files changed, 151 insertions, 134 deletions
diff --git a/libs/rs/Android.mk b/libs/rs/Android.mk
index 9c9fae3..9fabf8d 100644
--- a/libs/rs/Android.mk
+++ b/libs/rs/Android.mk
@@ -149,24 +149,82 @@ include $(BUILD_SHARED_LIBRARY)
# Now build a host version for serialization
include $(CLEAR_VARS)
+LOCAL_MODULE:= libRS
+LOCAL_MODULE_TAGS := optional
+
+intermediates := $(call intermediates-dir-for,STATIC_LIBRARIES,libRS,HOST,)
+
+# Generate custom headers
+
+GEN := $(addprefix $(intermediates)/, \
+ rsgApiStructs.h \
+ rsgApiFuncDecl.h \
+ )
+
+$(GEN) : PRIVATE_PATH := $(LOCAL_PATH)
+$(GEN) : PRIVATE_CUSTOM_TOOL = $(RSG_GENERATOR) $< $@ <$(PRIVATE_PATH)/rs.spec
+$(GEN) : $(RSG_GENERATOR) $(LOCAL_PATH)/rs.spec
+$(GEN): $(intermediates)/%.h : $(LOCAL_PATH)/%.h.rsg
+ $(transform-generated-source)
+
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+# Generate custom source files
+
+GEN := $(addprefix $(intermediates)/, \
+ rsgApi.cpp \
+ rsgApiReplay.cpp \
+ )
+
+$(GEN) : PRIVATE_PATH := $(LOCAL_PATH)
+$(GEN) : PRIVATE_CUSTOM_TOOL = $(RSG_GENERATOR) $< $@ <$(PRIVATE_PATH)/rs.spec
+$(GEN) : $(RSG_GENERATOR) $(LOCAL_PATH)/rs.spec
+$(GEN): $(intermediates)/%.cpp : $(LOCAL_PATH)/%.cpp.rsg
+ $(transform-generated-source)
+
+LOCAL_GENERATED_SOURCES += $(GEN)
+
LOCAL_CFLAGS += -Werror -Wall -Wno-unused-parameter -Wno-unused-variable
LOCAL_CFLAGS += -DANDROID_RS_SERIALIZE
+LOCAL_CFLAGS += -fPIC
LOCAL_SRC_FILES:= \
+ rsAdapter.cpp \
rsAllocation.cpp \
+ rsAnimation.cpp \
rsComponent.cpp \
+ rsContext.cpp \
+ rsDevice.cpp \
rsElement.cpp \
+ rsFBOCache.cpp \
+ rsFifoSocket.cpp \
rsFileA3D.cpp \
+ rsFont.cpp \
+ rsLocklessFifo.cpp \
rsObjectBase.cpp \
+ rsMatrix2x2.cpp \
+ rsMatrix3x3.cpp \
+ rsMatrix4x4.cpp \
rsMesh.cpp \
+ rsMutex.cpp \
+ rsProgram.cpp \
+ rsProgramFragment.cpp \
+ rsProgramStore.cpp \
+ rsProgramRaster.cpp \
+ rsProgramVertex.cpp \
+ rsSampler.cpp \
+ rsScript.cpp \
+ rsScriptC.cpp \
+ rsScriptC_Lib.cpp \
+ rsScriptC_LibGL.cpp \
+ rsSignal.cpp \
rsStream.cpp \
+ rsThreadIO.cpp \
rsType.cpp
LOCAL_STATIC_LIBRARIES := libcutils libutils
LOCAL_LDLIBS := -lpthread
-LOCAL_MODULE:= libRSserialize
-LOCAL_MODULE_TAGS := optional
include $(BUILD_HOST_STATIC_LIBRARY)
diff --git a/libs/rs/RenderScript.h b/libs/rs/RenderScript.h
index 3f2d67a..535f713 100644
--- a/libs/rs/RenderScript.h
+++ b/libs/rs/RenderScript.h
@@ -55,15 +55,7 @@ void rsDeviceSetConfig(RsDevice dev, RsDeviceParam p, int32_t value);
RsContext rsContextCreate(RsDevice dev, uint32_t version);
RsContext rsContextCreateGL(RsDevice dev, uint32_t version, RsSurfaceConfig sc, uint32_t dpi);
-
-
-#ifdef ANDROID_RS_SERIALIZE
-#define NO_RS_FUNCS
-#endif
-
-#ifndef NO_RS_FUNCS
#include "rsgApiFuncDecl.h"
-#endif
#ifdef __cplusplus
};
diff --git a/libs/rs/driver/rsdCore.cpp b/libs/rs/driver/rsdCore.cpp
index 94d55a6..01cc369 100644
--- a/libs/rs/driver/rsdCore.cpp
+++ b/libs/rs/driver/rsdCore.cpp
@@ -36,6 +36,7 @@
#include <cutils/sched_policy.h>
#include <sys/syscall.h>
#include <string.h>
+#include <bcc/bcc.h>
using namespace android;
using namespace android::renderscript;
diff --git a/libs/rs/driver/rsdCore.h b/libs/rs/driver/rsdCore.h
index 422bb1b..f393b60 100644
--- a/libs/rs/driver/rsdCore.h
+++ b/libs/rs/driver/rsdCore.h
@@ -18,7 +18,6 @@
#define RSD_CORE_H
#include <rs_hal.h>
-#include <bcc/bcc.h>
#include "rsMutex.h"
#include "rsSignal.h"
diff --git a/libs/rs/rsAllocation.cpp b/libs/rs/rsAllocation.cpp
index 05412c7..bff3660 100644
--- a/libs/rs/rsAllocation.cpp
+++ b/libs/rs/rsAllocation.cpp
@@ -168,13 +168,10 @@ void Allocation::elementData(Context *rsc, uint32_t x, uint32_t y,
}
void Allocation::addProgramToDirty(const Program *p) {
-#ifndef ANDROID_RS_SERIALIZE
mToDirtyList.push(p);
-#endif //ANDROID_RS_SERIALIZE
}
void Allocation::removeProgramToDirty(const Program *p) {
-#ifndef ANDROID_RS_SERIALIZE
for (size_t ct=0; ct < mToDirtyList.size(); ct++) {
if (mToDirtyList[ct] == p) {
mToDirtyList.removeAt(ct);
@@ -182,7 +179,6 @@ void Allocation::removeProgramToDirty(const Program *p) {
}
}
rsAssert(0);
-#endif //ANDROID_RS_SERIALIZE
}
void Allocation::dumpLOGV(const char *prefix) const {
@@ -254,11 +250,9 @@ Allocation *Allocation::createFromStream(Context *rsc, IStream *stream) {
}
void Allocation::sendDirty(const Context *rsc) const {
-#ifndef ANDROID_RS_SERIALIZE
for (size_t ct=0; ct < mToDirtyList.size(); ct++) {
mToDirtyList[ct]->forceDirty();
}
-#endif //ANDROID_RS_SERIALIZE
mRSC->mHal.funcs.allocation.markDirty(rsc, this);
}
@@ -312,8 +306,6 @@ void Allocation::resize2D(Context *rsc, uint32_t dimX, uint32_t dimY) {
/////////////////
//
-#ifndef ANDROID_RS_SERIALIZE
-
namespace android {
namespace renderscript {
@@ -413,25 +405,25 @@ void rsi_AllocationCopyToBitmap(Context *rsc, RsAllocation va, void *data, size_
}
void rsi_Allocation1DData(Context *rsc, RsAllocation va, uint32_t xoff, uint32_t lod,
- uint32_t count, const void *data, uint32_t sizeBytes) {
+ uint32_t count, const void *data, size_t sizeBytes) {
Allocation *a = static_cast<Allocation *>(va);
a->data(rsc, xoff, lod, count, data, sizeBytes);
}
void rsi_Allocation2DElementData(Context *rsc, RsAllocation va, uint32_t x, uint32_t y, uint32_t lod, RsAllocationCubemapFace face,
- const void *data, uint32_t eoff, uint32_t sizeBytes) {
+ const void *data, size_t eoff, uint32_t sizeBytes) { // TODO: this seems wrong, eoff and sizeBytes may be swapped
Allocation *a = static_cast<Allocation *>(va);
a->elementData(rsc, x, y, data, eoff, sizeBytes);
}
void rsi_Allocation1DElementData(Context *rsc, RsAllocation va, uint32_t x, uint32_t lod,
- const void *data, uint32_t eoff, uint32_t sizeBytes) {
+ const void *data, size_t eoff, uint32_t sizeBytes) { // TODO: this seems wrong, eoff and sizeBytes may be swapped
Allocation *a = static_cast<Allocation *>(va);
a->elementData(rsc, x, data, eoff, sizeBytes);
}
void rsi_Allocation2DData(Context *rsc, RsAllocation va, uint32_t xoff, uint32_t yoff, uint32_t lod, RsAllocationCubemapFace face,
- uint32_t w, uint32_t h, const void *data, uint32_t sizeBytes) {
+ uint32_t w, uint32_t h, const void *data, size_t sizeBytes) {
Allocation *a = static_cast<Allocation *>(va);
a->data(rsc, xoff, yoff, lod, face, w, h, data, sizeBytes);
}
@@ -549,5 +541,3 @@ const void * rsaAllocationGetType(RsContext con, RsAllocation va) {
return a->getType();
}
-
-#endif //ANDROID_RS_SERIALIZE
diff --git a/libs/rs/rsAllocation.h b/libs/rs/rsAllocation.h
index 5cf6292..f538dd1 100644
--- a/libs/rs/rsAllocation.h
+++ b/libs/rs/rsAllocation.h
@@ -59,7 +59,6 @@ public:
static Allocation * createAllocation(Context *rsc, const Type *, uint32_t usages,
RsAllocationMipmapControl mc = RS_ALLOCATION_MIPMAP_NONE);
-
virtual ~Allocation();
void updateCache();
@@ -121,14 +120,6 @@ protected:
private:
Allocation(Context *rsc, const Type *, uint32_t usages, RsAllocationMipmapControl mc);
-
- void upload2DTexture(bool isFirstUpload);
- void update2DTexture(const void *ptr, uint32_t xoff, uint32_t yoff,
- uint32_t lod, RsAllocationCubemapFace face, uint32_t w, uint32_t h);
-
- void allocScriptMemory();
- void freeScriptMemory();
-
};
}
diff --git a/libs/rs/rsContext.cpp b/libs/rs/rsContext.cpp
index bab5c58..44e9d89 100644
--- a/libs/rs/rsContext.cpp
+++ b/libs/rs/rsContext.cpp
@@ -92,9 +92,13 @@ uint32_t Context::runRootScript() {
}
uint64_t Context::getTime() const {
+#ifndef ANDROID_RS_SERIALIZE
struct timespec t;
clock_gettime(CLOCK_MONOTONIC, &t);
return t.tv_nsec + ((uint64_t)t.tv_sec * 1000 * 1000 * 1000);
+#else
+ return 0;
+#endif //ANDROID_RS_SERIALIZE
}
void Context::timerReset() {
@@ -200,11 +204,11 @@ void Context::displayDebugStats() {
void * Context::threadProc(void *vrsc) {
Context *rsc = static_cast<Context *>(vrsc);
+#ifndef ANDROID_RS_SERIALIZE
rsc->mNativeThreadId = gettid();
-
setpriority(PRIO_PROCESS, rsc->mNativeThreadId, ANDROID_PRIORITY_DISPLAY);
rsc->mThreadPriority = ANDROID_PRIORITY_DISPLAY;
-
+#endif //ANDROID_RS_SERIALIZE
rsc->props.mLogTimes = getProp("debug.rs.profile");
rsc->props.mLogScripts = getProp("debug.rs.script");
rsc->props.mLogObjects = getProp("debug.rs.object");
@@ -330,10 +334,16 @@ Context::Context() {
mObjHead = NULL;
mError = RS_ERROR_NONE;
mDPI = 96;
+ mIsContextLite = false;
}
Context * Context::createContext(Device *dev, const RsSurfaceConfig *sc) {
Context * rsc = new Context();
+
+ // Temporary to avoid breaking the tools
+ if (!dev) {
+ return rsc;
+ }
if (!rsc->initContext(dev, sc)) {
delete rsc;
return NULL;
@@ -341,6 +351,12 @@ Context * Context::createContext(Device *dev, const RsSurfaceConfig *sc) {
return rsc;
}
+Context * Context::createContextLite() {
+ Context * rsc = new Context();
+ rsc->mIsContextLite = true;
+ return rsc;
+}
+
bool Context::initContext(Device *dev, const RsSurfaceConfig *sc) {
pthread_mutex_lock(&gInitMutex);
@@ -395,26 +411,28 @@ bool Context::initContext(Device *dev, const RsSurfaceConfig *sc) {
Context::~Context() {
LOGV("Context::~Context");
- mIO.coreFlush();
- rsAssert(mExit);
- mExit = true;
- mPaused = false;
- void *res;
+ if (!mIsContextLite) {
+ mIO.coreFlush();
+ rsAssert(mExit);
+ mExit = true;
+ mPaused = false;
+ void *res;
- mIO.shutdown();
- int status = pthread_join(mThreadId, &res);
+ mIO.shutdown();
+ int status = pthread_join(mThreadId, &res);
- if (mHal.funcs.shutdownDriver) {
- mHal.funcs.shutdownDriver(this);
- }
+ if (mHal.funcs.shutdownDriver) {
+ mHal.funcs.shutdownDriver(this);
+ }
- // Global structure cleanup.
- pthread_mutex_lock(&gInitMutex);
- if (mDev) {
- mDev->removeContext(this);
- mDev = NULL;
+ // Global structure cleanup.
+ pthread_mutex_lock(&gInitMutex);
+ if (mDev) {
+ mDev->removeContext(this);
+ mDev = NULL;
+ }
+ pthread_mutex_unlock(&gInitMutex);
}
- pthread_mutex_unlock(&gInitMutex);
LOGV("Context::~Context done");
}
@@ -542,7 +560,7 @@ void Context::dumpDebug() const {
LOGE(" RS width %i, height %i", mWidth, mHeight);
LOGE(" RS running %i, exit %i, paused %i", mRunning, mExit, mPaused);
- LOGE(" RS pThreadID %li, nativeThreadID %i", mThreadId, mNativeThreadId);
+ LOGE(" RS pThreadID %li, nativeThreadID %i", (long int)mThreadId, mNativeThreadId);
}
///////////////////////////////////////////////////////////////////////////////////////////
@@ -595,7 +613,7 @@ void rsi_ContextBindFont(Context *rsc, RsFont vfont) {
rsc->setFont(font);
}
-void rsi_AssignName(Context *rsc, RsObjectBase obj, const char *name, uint32_t name_length) {
+void rsi_AssignName(Context *rsc, RsObjectBase obj, const char *name, size_t name_length) {
ObjectBase *ob = static_cast<ObjectBase *>(obj);
rsc->assignName(ob, name, name_length);
}
@@ -627,7 +645,7 @@ void rsi_ContextDump(Context *rsc, int32_t bits) {
}
void rsi_ContextDestroyWorker(Context *rsc) {
- rsc->destroyWorkerThreadResources();;
+ rsc->destroyWorkerThreadResources();
}
void rsi_ContextDestroy(Context *rsc) {
diff --git a/libs/rs/rsContext.h b/libs/rs/rsContext.h
index 4ba00fe..309fe95 100644
--- a/libs/rs/rsContext.h
+++ b/libs/rs/rsContext.h
@@ -24,7 +24,6 @@
#include "rs_hal.h"
-#ifndef ANDROID_RS_SERIALIZE
#include "rsMutex.h"
#include "rsThreadIO.h"
#include "rsMatrix4x4.h"
@@ -42,8 +41,6 @@
#include "rsgApiStructs.h"
#include "rsLocklessFifo.h"
-#endif // ANDROID_RS_SERIALIZE
-
// ---------------------------------------------------------------------------
namespace android {
@@ -67,8 +64,6 @@ namespace renderscript {
#define CHECK_OBJ_OR_NULL(o)
#endif
-#ifndef ANDROID_RS_SERIALIZE
-
class Context {
public:
struct Hal {
@@ -79,6 +74,7 @@ public:
Hal mHal;
static Context * createContext(Device *, const RsSurfaceConfig *sc);
+ static Context * createContextLite();
~Context();
static pthread_mutex_t gInitMutex;
@@ -243,6 +239,7 @@ private:
static void * helperThreadProc(void *);
bool mHasSurface;
+ bool mIsContextLite;
Vector<ObjectBase *> mNames;
@@ -259,46 +256,6 @@ private:
uint32_t mAverageFPS;
};
-#else
-
-class Context {
-public:
- Context() {
- mObjHead = NULL;
- }
- ~Context() {
- ObjectBase::zeroAllUserRef(this);
- }
-
- struct Hal {
- void * drv;
-
- RsdHalFunctions funcs;
- };
- Hal mHal;
-
- 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/rsFifoSocket.cpp b/libs/rs/rsFifoSocket.cpp
index 848bba5..8b8008d 100644
--- a/libs/rs/rsFifoSocket.cpp
+++ b/libs/rs/rsFifoSocket.cpp
@@ -70,9 +70,9 @@ size_t FifoSocket::read(void *data, size_t bytes) {
}
void FifoSocket::readReturn(const void *data, size_t bytes) {
- LOGE("readReturn %p %i", data, bytes);
+ LOGE("readReturn %p %Zu", data, bytes);
size_t ret = ::send(sv[1], data, bytes, 0);
- LOGE("readReturn %i", ret);
+ LOGE("readReturn %Zu", ret);
rsAssert(ret == bytes);
}
diff --git a/libs/rs/rsFont.cpp b/libs/rs/rsFont.cpp
index b625504..ce674f4 100644
--- a/libs/rs/rsFont.cpp
+++ b/libs/rs/rsFont.cpp
@@ -21,9 +21,11 @@
#include "rsProgramFragment.h"
#include <cutils/properties.h>
+#ifndef ANDROID_RS_SERIALIZE
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_BITMAP_H
+#endif //ANDROID_RS_SERIALIZE
using namespace android;
using namespace android::renderscript;
@@ -35,6 +37,7 @@ Font::Font(Context *rsc) : ObjectBase(rsc), mCachedGlyphs(NULL) {
}
bool Font::init(const char *name, float fontSize, uint32_t dpi, const void *data, uint32_t dataLen) {
+#ifndef ANDROID_RS_SERIALIZE
if (mInitialized) {
LOGE("Reinitialization of fonts not supported");
return false;
@@ -65,6 +68,7 @@ bool Font::init(const char *name, float fontSize, uint32_t dpi, const void *data
mHasKerning = FT_HAS_KERNING(mFace);
mInitialized = true;
+#endif //ANDROID_RS_SERIALIZE
return true;
}
@@ -230,6 +234,7 @@ Font::CachedGlyphInfo* Font::getCachedUTFChar(int32_t utfChar) {
}
void Font::updateGlyphCache(CachedGlyphInfo *glyph) {
+#ifndef ANDROID_RS_SERIALIZE
FT_Error error = FT_Load_Glyph( mFace, glyph->mGlyphIndex, FT_LOAD_RENDER );
if (error) {
LOGE("Couldn't load glyph.");
@@ -270,15 +275,16 @@ void Font::updateGlyphCache(CachedGlyphInfo *glyph) {
glyph->mBitmapMinV = (float)startY / (float)cacheHeight;
glyph->mBitmapMaxU = (float)endX / (float)cacheWidth;
glyph->mBitmapMaxV = (float)endY / (float)cacheHeight;
+#endif //ANDROID_RS_SERIALIZE
}
Font::CachedGlyphInfo *Font::cacheGlyph(uint32_t glyph) {
CachedGlyphInfo *newGlyph = new CachedGlyphInfo();
mCachedGlyphs.add(glyph, newGlyph);
-
+#ifndef ANDROID_RS_SERIALIZE
newGlyph->mGlyphIndex = FT_Get_Char_Index(mFace, glyph);
newGlyph->mIsValid = false;
-
+#endif //ANDROID_RS_SERIALIZE
updateGlyphCache(newGlyph);
return newGlyph;
@@ -309,9 +315,11 @@ Font * Font::create(Context *rsc, const char *name, float fontSize, uint32_t dpi
}
Font::~Font() {
+#ifndef ANDROID_RS_SERIALIZE
if (mFace) {
FT_Done_Face(mFace);
}
+#endif
for (uint32_t i = 0; i < mCachedGlyphs.size(); i ++) {
CachedGlyphInfo *glyph = mCachedGlyphs.valueAt(i);
@@ -324,7 +332,9 @@ FontState::FontState() {
mMaxNumberOfQuads = 1024;
mCurrentQuadIndex = 0;
mRSC = NULL;
+#ifndef ANDROID_RS_SERIALIZE
mLibrary = NULL;
+#endif //ANDROID_RS_SERIALIZE
// Get the renderer properties
char property[PROPERTY_VALUE_MAX];
@@ -363,7 +373,7 @@ FontState::~FontState() {
rsAssert(!mActiveFonts.size());
}
-
+#ifndef ANDROID_RS_SERIALIZE
FT_Library FontState::getLib() {
if (!mLibrary) {
FT_Error error = FT_Init_FreeType(&mLibrary);
@@ -375,6 +385,8 @@ FT_Library FontState::getLib() {
return mLibrary;
}
+#endif //ANDROID_RS_SERIALIZE
+
void FontState::init(Context *rsc) {
mRSC = rsc;
@@ -393,6 +405,7 @@ void FontState::flushAllAndInvalidate() {
}
}
+#ifndef ANDROID_RS_SERIALIZE
bool FontState::cacheBitmap(FT_Bitmap *bitmap, uint32_t *retOriginX, uint32_t *retOriginY) {
// If the glyph is too tall, don't cache it
if ((uint32_t)bitmap->rows > mCacheLines[mCacheLines.size()-1]->mMaxHeight) {
@@ -466,6 +479,7 @@ bool FontState::cacheBitmap(FT_Bitmap *bitmap, uint32_t *retOriginX, uint32_t *r
return true;
}
+#endif //ANDROID_RS_SERIALIZE
void FontState::initRenderState() {
String8 shaderString("varying vec2 varTex0;\n");
@@ -791,13 +805,15 @@ void FontState::deinit(Context *rsc) {
mCacheLines.clear();
mDefault.clear();
-
+#ifndef ANDROID_RS_SERIALIZE
if (mLibrary) {
FT_Done_FreeType( mLibrary );
mLibrary = NULL;
}
+#endif //ANDROID_RS_SERIALIZE
}
+#ifndef ANDROID_RS_SERIALIZE
bool FontState::CacheTextureLine::fitBitmap(FT_Bitmap_ *bitmap, uint32_t *retOriginX, uint32_t *retOriginY) {
if ((uint32_t)bitmap->rows > mMaxHeight) {
return false;
@@ -813,6 +829,7 @@ bool FontState::CacheTextureLine::fitBitmap(FT_Bitmap_ *bitmap, uint32_t *retOri
return false;
}
+#endif //ANDROID_RS_SERIALIZE
namespace android {
namespace renderscript {
diff --git a/libs/rs/rsFont.h b/libs/rs/rsFont.h
index d18c0d9..b0e1430 100644
--- a/libs/rs/rsFont.h
+++ b/libs/rs/rsFont.h
@@ -199,8 +199,10 @@ protected:
float mWhiteThreshold;
// Free type library, we only need one copy
+#ifndef ANDROID_RS_SERIALIZE
FT_LibraryRec_ *mLibrary;
FT_LibraryRec_ *getLib();
+#endif //ANDROID_RS_SERIALIZE
Vector<Font*> mActiveFonts;
// Render state for the font
@@ -217,7 +219,9 @@ protected:
return (uint8_t*)mTextTexture->getPtr();
}
+#ifndef ANDROID_RS_SERIALIZE
bool cacheBitmap(FT_Bitmap_ *bitmap, uint32_t *retOriginX, uint32_t *retOriginY);
+#endif //ANDROID_RS_SERIALIZE
const Type* getCacheTextureType() {
return mTextTexture->getType();
}
diff --git a/libs/rs/rsMesh.cpp b/libs/rs/rsMesh.cpp
index 62e388c..359d09f 100644
--- a/libs/rs/rsMesh.cpp
+++ b/libs/rs/rsMesh.cpp
@@ -161,8 +161,6 @@ Mesh *Mesh::createFromStream(Context *rsc, IStream *stream) {
return mesh;
}
-#ifndef ANDROID_RS_SERIALIZE
-
void Mesh::render(Context *rsc) const {
for (uint32_t ct = 0; ct < mHal.state.primitivesCount; ct ++) {
renderPrimitive(rsc, ct);
@@ -255,9 +253,9 @@ namespace android {
namespace renderscript {
RsMesh rsi_MeshCreate(Context *rsc,
- RsAllocation *vtx, uint32_t vtxCount,
- RsAllocation *idx, uint32_t idxCount,
- uint32_t *primType, uint32_t primTypeCount) {
+ RsAllocation * vtx, size_t vtxCount,
+ RsAllocation * idx, size_t idxCount,
+ uint32_t * primType, size_t primTypeCount) {
rsAssert(idxCount == primTypeCount);
Mesh *sm = new Mesh(rsc, vtxCount, idxCount);
sm->incUserRef();
@@ -309,5 +307,3 @@ void rsaMeshGetIndices(RsContext con, RsMesh mv, RsAllocation *va, uint32_t *pri
}
}
}
-
-#endif
diff --git a/libs/rs/rsProgramFragment.cpp b/libs/rs/rsProgramFragment.cpp
index 0823d82..356ff77 100644
--- a/libs/rs/rsProgramFragment.cpp
+++ b/libs/rs/rsProgramFragment.cpp
@@ -127,8 +127,8 @@ namespace android {
namespace renderscript {
RsProgramFragment rsi_ProgramFragmentCreate(Context *rsc, const char * shaderText,
- uint32_t shaderLength, const uint32_t * params,
- uint32_t paramLength) {
+ size_t shaderLength, const uint32_t * params,
+ size_t paramLength) {
ProgramFragment *pf = new ProgramFragment(rsc, shaderText, shaderLength, params, paramLength);
pf->incUserRef();
//LOGE("rsi_ProgramFragmentCreate %p", pf);
diff --git a/libs/rs/rsProgramVertex.cpp b/libs/rs/rsProgramVertex.cpp
index e6790cb..058a456 100644
--- a/libs/rs/rsProgramVertex.cpp
+++ b/libs/rs/rsProgramVertex.cpp
@@ -223,8 +223,8 @@ namespace android {
namespace renderscript {
RsProgramVertex rsi_ProgramVertexCreate(Context *rsc, const char * shaderText,
- uint32_t shaderLength, const uint32_t * params,
- uint32_t paramLength) {
+ size_t shaderLength, const uint32_t * params,
+ size_t paramLength) {
ProgramVertex *pv = new ProgramVertex(rsc, shaderText, shaderLength, params, paramLength);
pv->incUserRef();
return pv;
diff --git a/libs/rs/rsScript.cpp b/libs/rs/rsScript.cpp
index 7641cab..f62c72e 100644
--- a/libs/rs/rsScript.cpp
+++ b/libs/rs/rsScript.cpp
@@ -53,7 +53,7 @@ void Script::setSlot(uint32_t slot, Allocation *a) {
}
}
-void Script::setVar(uint32_t slot, const void *val, uint32_t len) {
+void Script::setVar(uint32_t slot, const void *val, size_t len) {
//LOGE("setVar %i %p %i", slot, val, len);
if (slot >= mHal.info.exportedVariableCount) {
LOGE("Script::setVar unable to set allocation, invalid slot index");
@@ -82,14 +82,14 @@ void rsi_ScriptBindAllocation(Context * rsc, RsScript vs, RsAllocation va, uint3
//LOGE("rsi_ScriptBindAllocation %i %p %p", slot, a, a->getPtr());
}
-void rsi_ScriptSetTimeZone(Context * rsc, RsScript vs, const char * timeZone, uint32_t length) {
+void rsi_ScriptSetTimeZone(Context * rsc, RsScript vs, const char * timeZone, size_t length) {
Script *s = static_cast<Script *>(vs);
s->mEnviroment.mTimeZone = timeZone;
}
void rsi_ScriptForEach(Context *rsc, RsScript vs, uint32_t slot,
RsAllocation vain, RsAllocation vaout,
- const void *params, uint32_t paramLen) {
+ const void *params, size_t paramLen) {
Script *s = static_cast<Script *>(vs);
s->runForEach(rsc,
static_cast<const Allocation *>(vain), static_cast<Allocation *>(vaout),
@@ -108,7 +108,7 @@ void rsi_ScriptInvokeData(Context *rsc, RsScript vs, uint32_t slot, void *data)
s->Invoke(rsc, slot, NULL, 0);
}
-void rsi_ScriptInvokeV(Context *rsc, RsScript vs, uint32_t slot, const void *data, uint32_t len) {
+void rsi_ScriptInvokeV(Context *rsc, RsScript vs, uint32_t slot, const void *data, size_t len) {
Script *s = static_cast<Script *>(vs);
s->Invoke(rsc, slot, data, len);
}
@@ -139,7 +139,7 @@ void rsi_ScriptSetVarD(Context *rsc, RsScript vs, uint32_t slot, double value) {
s->setVar(slot, &value, sizeof(value));
}
-void rsi_ScriptSetVarV(Context *rsc, RsScript vs, uint32_t slot, const void *data, uint32_t len) {
+void rsi_ScriptSetVarV(Context *rsc, RsScript vs, uint32_t slot, const void *data, size_t len) {
Script *s = static_cast<Script *>(vs);
s->setVar(slot, data, len);
}
diff --git a/libs/rs/rsScript.h b/libs/rs/rsScript.h
index 088c8d1..c0324dd 100644
--- a/libs/rs/rsScript.h
+++ b/libs/rs/rsScript.h
@@ -70,7 +70,7 @@ public:
void initSlots();
void setSlot(uint32_t slot, Allocation *a);
- void setVar(uint32_t slot, const void *val, uint32_t len);
+ void setVar(uint32_t slot, const void *val, size_t len);
void setVarObj(uint32_t slot, ObjectBase *val);
virtual void runForEach(Context *rsc,
@@ -80,7 +80,7 @@ public:
size_t usrBytes,
const RsScriptCall *sc = NULL) = 0;
- virtual void Invoke(Context *rsc, uint32_t slot, const void *data, uint32_t len) = 0;
+ virtual void Invoke(Context *rsc, uint32_t slot, const void *data, size_t len) = 0;
virtual void setupScript(Context *rsc) = 0;
virtual uint32_t run(Context *) = 0;
protected:
diff --git a/libs/rs/rsScriptC.cpp b/libs/rs/rsScriptC.cpp
index 6d0701d..b230bb5 100644
--- a/libs/rs/rsScriptC.cpp
+++ b/libs/rs/rsScriptC.cpp
@@ -19,11 +19,6 @@
#include "utils/Timers.h"
#include "utils/StopWatch.h"
-#include <GLES/gl.h>
-#include <GLES/glext.h>
-
-#include <bcc/bcc.h>
-
using namespace android;
using namespace android::renderscript;
@@ -129,7 +124,7 @@ void ScriptC::runForEach(Context *rsc,
rsc->mHal.funcs.script.invokeForEach(rsc, this, ain, aout, usr, usrBytes, sc);
}
-void ScriptC::Invoke(Context *rsc, uint32_t slot, const void *data, uint32_t len) {
+void ScriptC::Invoke(Context *rsc, uint32_t slot, const void *data, size_t len) {
if (slot >= mHal.info.exportedFunctionCount) {
rsc->setError(RS_ERROR_BAD_SCRIPT, "Calling invoke on bad script");
return;
@@ -269,7 +264,7 @@ namespace renderscript {
RsScript rsi_ScriptCCreate(Context *rsc,
const char *resName, size_t resName_length,
const char *cacheDir, size_t cacheDir_length,
- const char *text, uint32_t text_length)
+ const char *text, size_t text_length)
{
ScriptC *s = new ScriptC(rsc);
diff --git a/libs/rs/rsScriptC.h b/libs/rs/rsScriptC.h
index 4c85745..5c191d9 100644
--- a/libs/rs/rsScriptC.h
+++ b/libs/rs/rsScriptC.h
@@ -39,7 +39,7 @@ public:
const Allocation *ptrToAllocation(const void *) const;
- virtual void Invoke(Context *rsc, uint32_t slot, const void *data, uint32_t len);
+ virtual void Invoke(Context *rsc, uint32_t slot, const void *data, size_t len);
virtual uint32_t run(Context *);
diff --git a/libs/rs/rsThreadIO.cpp b/libs/rs/rsThreadIO.cpp
index 4429556..ab164c3 100644
--- a/libs/rs/rsThreadIO.cpp
+++ b/libs/rs/rsThreadIO.cpp
@@ -149,7 +149,7 @@ RsMessageToClientType ThreadIO::getClientHeader(size_t *receiveLen, uint32_t *us
mToClientSocket.read(&mLastClientHeader, sizeof(mLastClientHeader));
} else {
size_t bytesData = 0;
- const uint32_t *d = (const uint32_t *)mToClient.get(&mLastClientHeader.cmdID, &bytesData);
+ const uint32_t *d = (const uint32_t *)mToClient.get(&mLastClientHeader.cmdID, (uint32_t*)&bytesData);
if (bytesData >= sizeof(uint32_t)) {
mLastClientHeader.userID = d[0];
mLastClientHeader.bytes = bytesData - sizeof(uint32_t);
diff --git a/libs/rs/rs_hal.h b/libs/rs/rs_hal.h
index 44c7e71..7bb09bb 100644
--- a/libs/rs/rs_hal.h
+++ b/libs/rs/rs_hal.h
@@ -18,7 +18,6 @@
#define RS_HAL_H
#include <RenderScriptDefines.h>
-#include <ui/egl/android_natives.h>
namespace android {
namespace renderscript {