summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--graphics/java/android/renderscript/FileA3D.java14
-rw-r--r--graphics/jni/android_renderscript_RenderScript.cpp29
-rw-r--r--libs/rs/RenderScript.h20
-rw-r--r--libs/rs/rs.spec76
-rw-r--r--libs/rs/rsAllocation.cpp13
-rw-r--r--libs/rs/rsContext.cpp14
-rw-r--r--libs/rs/rsContext.h2
-rw-r--r--libs/rs/rsElement.cpp11
-rw-r--r--libs/rs/rsFileA3D.cpp97
-rw-r--r--libs/rs/rsMesh.cpp15
-rw-r--r--libs/rs/rsSampler.cpp6
-rw-r--r--libs/rs/rsType.cpp32
12 files changed, 127 insertions, 202 deletions
diff --git a/graphics/java/android/renderscript/FileA3D.java b/graphics/java/android/renderscript/FileA3D.java
index 7548878..fc74fc4 100644
--- a/graphics/java/android/renderscript/FileA3D.java
+++ b/graphics/java/android/renderscript/FileA3D.java
@@ -141,9 +141,11 @@ public class FileA3D extends BaseObj {
}
IndexEntry[] mFileEntries;
+ InputStream mInputStream;
- FileA3D(int id, RenderScript rs) {
+ FileA3D(int id, RenderScript rs, InputStream stream) {
super(id, rs);
+ mInputStream = stream;
}
private void initEntries() {
@@ -193,20 +195,12 @@ public class FileA3D extends BaseObj {
if(fileId == 0) {
throw new IllegalStateException("Load failed.");
}
- FileA3D fa3d = new FileA3D(fileId, rs);
+ FileA3D fa3d = new FileA3D(fileId, rs, is);
fa3d.initEntries();
return fa3d;
} catch (Exception e) {
// Ignore
- } finally {
- if (is != null) {
- try {
- is.close();
- } catch (IOException e) {
- // Ignore
- }
- }
}
return null;
diff --git a/graphics/jni/android_renderscript_RenderScript.cpp b/graphics/jni/android_renderscript_RenderScript.cpp
index dd108c0..b0faacc 100644
--- a/graphics/jni/android_renderscript_RenderScript.cpp
+++ b/graphics/jni/android_renderscript_RenderScript.cpp
@@ -104,7 +104,10 @@ nGetName(JNIEnv *_env, jobject _this, RsContext con, jint obj)
{
LOG_API("nGetName, con(%p), obj(%p)", con, (void *)obj);
const char *name = NULL;
- rsGetName(con, (void *)obj, &name);
+ rsaGetName(con, (void *)obj, &name);
+ if(name == NULL || strlen(name) == 0) {
+ return NULL;
+ }
return _env->NewStringUTF(name);
}
@@ -306,7 +309,7 @@ nElementGetNativeData(JNIEnv *_env, jobject _this, RsContext con, jint id, jintA
assert(dataSize == 5);
uint32_t elementData[5];
- rsElementGetNativeData(con, (RsElement)id, elementData, dataSize);
+ rsaElementGetNativeData(con, (RsElement)id, elementData, dataSize);
for(jint i = 0; i < dataSize; i ++) {
_env->SetIntArrayRegion(_elementData, i, 1, (const jint*)&elementData[i]);
@@ -323,7 +326,7 @@ nElementGetSubElements(JNIEnv *_env, jobject _this, RsContext con, jint id, jint
uint32_t *ids = (uint32_t *)malloc((uint32_t)dataSize * sizeof(uint32_t));
const char **names = (const char **)malloc((uint32_t)dataSize * sizeof(const char *));
- rsElementGetSubElements(con, (RsElement)id, ids, names, (uint32_t)dataSize);
+ rsaElementGetSubElements(con, (RsElement)id, ids, names, (uint32_t)dataSize);
for(jint i = 0; i < dataSize; i++) {
_env->SetObjectArrayElement(_names, i, _env->NewStringUTF(names[i]));
@@ -364,7 +367,7 @@ nTypeGetNativeData(JNIEnv *_env, jobject _this, RsContext con, jint id, jintArra
LOG_API("nTypeCreate, con(%p)", con);
uint32_t typeData[6];
- rsTypeGetNativeData(con, (RsType)id, typeData, 6);
+ rsaTypeGetNativeData(con, (RsType)id, typeData, 6);
for(jint i = 0; i < elementCount; i ++) {
_env->SetIntArrayRegion(_typeData, i, 1, (const jint*)&typeData[i]);
@@ -590,7 +593,7 @@ static jint
nAllocationGetType(JNIEnv *_env, jobject _this, RsContext con, jint a)
{
LOG_API("nAllocationGetType, con(%p), a(%p)", con, (RsAllocation)a);
- return (jint) rsAllocationGetType(con, (RsAllocation)a);
+ return (jint) rsaAllocationGetType(con, (RsAllocation)a);
}
static void
@@ -616,7 +619,7 @@ nFileA3DCreateFromAssetStream(JNIEnv *_env, jobject _this, RsContext con, jint n
Asset* asset = reinterpret_cast<Asset*>(native_asset);
- jint id = (jint)rsFileA3DCreateFromAssetStream(con, asset->getBuffer(false), asset->getLength());
+ jint id = (jint)rsaFileA3DCreateFromAssetStream(con, asset->getBuffer(false), asset->getLength());
return id;
}
@@ -624,7 +627,7 @@ static int
nFileA3DGetNumIndexEntries(JNIEnv *_env, jobject _this, RsContext con, jint fileA3D)
{
int32_t numEntries = 0;
- rsFileA3DGetNumIndexEntries(con, &numEntries, (RsFile)fileA3D);
+ rsaFileA3DGetNumIndexEntries(con, &numEntries, (RsFile)fileA3D);
return numEntries;
}
@@ -634,7 +637,7 @@ nFileA3DGetIndexEntries(JNIEnv *_env, jobject _this, RsContext con, jint fileA3D
LOGV("______nFileA3D %u", (uint32_t) fileA3D);
RsFileIndexEntry *fileEntries = (RsFileIndexEntry*)malloc((uint32_t)numEntries * sizeof(RsFileIndexEntry));
- rsFileA3DGetIndexEntries(con, fileEntries, (uint32_t)numEntries, (RsFile)fileA3D);
+ rsaFileA3DGetIndexEntries(con, fileEntries, (uint32_t)numEntries, (RsFile)fileA3D);
for(jint i = 0; i < numEntries; i ++) {
_env->SetObjectArrayElement(_entries, i, _env->NewStringUTF(fileEntries[i].objectName));
@@ -648,7 +651,7 @@ static int
nFileA3DGetEntryByIndex(JNIEnv *_env, jobject _this, RsContext con, jint fileA3D, jint index)
{
LOGV("______nFileA3D %u", (uint32_t) fileA3D);
- jint id = (jint)rsFileA3DGetEntryByIndex(con, (uint32_t)index, (RsFile)fileA3D);
+ jint id = (jint)rsaFileA3DGetEntryByIndex(con, (uint32_t)index, (RsFile)fileA3D);
return id;
}
@@ -1166,7 +1169,7 @@ nMeshGetVertexBufferCount(JNIEnv *_env, jobject _this, RsContext con, jint mesh)
{
LOG_API("nMeshGetVertexBufferCount, con(%p), Mesh(%p)", con, (RsMesh)mesh);
jint vtxCount = 0;
- rsMeshGetVertexBufferCount(con, (RsMesh)mesh, &vtxCount);
+ rsaMeshGetVertexBufferCount(con, (RsMesh)mesh, &vtxCount);
return vtxCount;
}
@@ -1175,7 +1178,7 @@ nMeshGetIndexCount(JNIEnv *_env, jobject _this, RsContext con, jint mesh)
{
LOG_API("nMeshGetIndexCount, con(%p), Mesh(%p)", con, (RsMesh)mesh);
jint idxCount = 0;
- rsMeshGetIndexCount(con, (RsMesh)mesh, &idxCount);
+ rsaMeshGetIndexCount(con, (RsMesh)mesh, &idxCount);
return idxCount;
}
@@ -1185,7 +1188,7 @@ nMeshGetVertices(JNIEnv *_env, jobject _this, RsContext con, jint mesh, jintArra
LOG_API("nMeshGetVertices, con(%p), Mesh(%p)", con, (RsMesh)mesh);
RsAllocation *allocs = (RsAllocation*)malloc((uint32_t)numVtxIDs * sizeof(RsAllocation));
- rsMeshGetVertices(con, (RsMesh)mesh, allocs, (uint32_t)numVtxIDs);
+ rsaMeshGetVertices(con, (RsMesh)mesh, allocs, (uint32_t)numVtxIDs);
for(jint i = 0; i < numVtxIDs; i ++) {
_env->SetIntArrayRegion(_ids, i, 1, (const jint*)&allocs[i]);
@@ -1202,7 +1205,7 @@ nMeshGetIndices(JNIEnv *_env, jobject _this, RsContext con, jint mesh, jintArray
RsAllocation *allocs = (RsAllocation*)malloc((uint32_t)numIndices * sizeof(RsAllocation));
uint32_t *prims= (uint32_t*)malloc((uint32_t)numIndices * sizeof(uint32_t));
- rsMeshGetIndices(con, (RsMesh)mesh, allocs, prims, (uint32_t)numIndices);
+ rsaMeshGetIndices(con, (RsMesh)mesh, allocs, prims, (uint32_t)numIndices);
for(jint i = 0; i < numIndices; i ++) {
_env->SetIntArrayRegion(_idxIds, i, 1, (const jint*)&allocs[i]);
diff --git a/libs/rs/RenderScript.h b/libs/rs/RenderScript.h
index 1d67329..8c2081d 100644
--- a/libs/rs/RenderScript.h
+++ b/libs/rs/RenderScript.h
@@ -286,6 +286,25 @@ typedef struct {
} RsScriptCall;
+// A3D loading and object update code.
+// Should only be called at object creation, not thread safe
+RsObjectBase rsaFileA3DGetEntryByIndex(RsContext, uint32_t idx, RsFile);
+RsFile rsaFileA3DCreateFromAssetStream(RsContext, const void *data, uint32_t len);
+void rsaFileA3DGetNumIndexEntries(RsContext, int32_t *numEntries, RsFile);
+void rsaFileA3DGetIndexEntries(RsContext, RsFileIndexEntry *fileEntries,uint32_t numEntries, RsFile);
+void rsaGetName(RsContext, void * obj, const char **name);
+// Mesh update functions
+void rsaMeshGetVertexBufferCount(RsContext, RsMesh, int32_t *vtxCount);
+void rsaMeshGetIndexCount(RsContext, RsMesh, int32_t *idxCount);
+void rsaMeshGetVertices(RsContext, RsMesh, RsAllocation *vtxData, uint32_t vtxDataCount);
+void rsaMeshGetIndices(RsContext, RsMesh, RsAllocation *va, uint32_t *primType, uint32_t idxDataCount);
+// Allocation update
+const void* rsaAllocationGetType(RsContext con, RsAllocation va);
+// Type update
+void rsaTypeGetNativeData(RsContext, RsType, uint32_t *typeData, uint32_t typeDataSize);
+// Element update
+void rsaElementGetNativeData(RsContext, RsElement, uint32_t *elemData, uint32_t elemDataSize);
+void rsaElementGetSubElements(RsContext, RsElement, uint32_t *ids, const char **names, uint32_t dataSize);
// Async commands for returning new IDS
RsType rsaTypeCreate(RsContext, RsElement, uint32_t dimCount,
@@ -293,7 +312,6 @@ RsType rsaTypeCreate(RsContext, RsElement, uint32_t dimCount,
RsAllocation rsaAllocationCreateTyped(RsContext rsc, RsType vtype);
RsAllocation rsaAllocationCreateFromBitmap(RsContext con, uint32_t w, uint32_t h, RsElement _dst, RsElement _src, bool genMips, const void *data);
-
#ifndef NO_RS_FUNCS
#include "rsgApiFuncDecl.h"
#endif
diff --git a/libs/rs/rs.spec b/libs/rs/rs.spec
index 3e131b2..14809e9 100644
--- a/libs/rs/rs.spec
+++ b/libs/rs/rs.spec
@@ -58,11 +58,6 @@ AssignName {
param size_t len
}
-GetName {
- param void *obj
- param const char **name
- }
-
ObjDestroy {
param RsAsyncVoidPtr objPtr
}
@@ -84,26 +79,6 @@ ElementCreate2 {
ret RsElement
}
-ElementGetNativeData {
- param RsElement elem
- param uint32_t *elemData
- param uint32_t elemDataSize
- }
-
-ElementGetSubElements {
- param RsElement elem
- param uint32_t *ids
- param const char **names
- param uint32_t dataSize
- }
-
-
-TypeGetNativeData {
- param RsType type
- param uint32_t * typeData
- param uint32_t typeDataSize
- }
-
AllocationUpdateFromBitmap {
param RsAllocation alloc
param RsElement srcFmt
@@ -237,11 +212,6 @@ Adapter2DSubData {
param const void *data
}
-AllocationGetType {
- param RsAllocation va
- ret const void*
- }
-
AllocationResize1D {
param RsAllocation va
param uint32_t dimX
@@ -433,35 +403,12 @@ ProgramVertexCreate {
ret RsProgramVertex
}
-FileA3DCreateFromAssetStream {
- param const void * data
- param size_t len
- ret RsFile
- }
-
FileOpen {
ret RsFile
param const char *name
param size_t len
}
-FileA3DGetNumIndexEntries {
- param int32_t * numEntries
- param RsFile file
- }
-
-FileA3DGetIndexEntries {
- param RsFileIndexEntry * fileEntries
- param uint32_t numEntries
- param RsFile fileA3D
- }
-
-FileA3DGetEntryByIndex {
- param uint32_t index
- param RsFile file
- ret RsObjectBase
- }
-
FontCreateFromFile {
param const char *name
param uint32_t fontSize
@@ -488,29 +435,6 @@ MeshBindVertex {
param uint32_t slot
}
-MeshGetVertexBufferCount {
- param RsMesh mesh
- param int32_t *numVtx
- }
-
-MeshGetIndexCount {
- param RsMesh mesh
- param int32_t *numIdx
- }
-
-MeshGetVertices {
- param RsMesh mv
- param RsAllocation *vtxData
- param uint32_t vtxDataCount
- }
-
-MeshGetIndices {
- param RsMesh mv
- param RsAllocation *va
- param uint32_t *primType
- param uint32_t idxDataCount
- }
-
AnimationCreate {
param const float *inValues
param const float *outValues
diff --git a/libs/rs/rsAllocation.cpp b/libs/rs/rsAllocation.cpp
index b4872e3..b74fa8e 100644
--- a/libs/rs/rsAllocation.cpp
+++ b/libs/rs/rsAllocation.cpp
@@ -816,7 +816,12 @@ void rsi_AllocationResize2D(Context *rsc, RsAllocation va, uint32_t dimX, uint32
a->resize2D(rsc, dimX, dimY);
}
-const void* rsi_AllocationGetType(Context *rsc, RsAllocation va)
+#endif //ANDROID_RS_BUILD_FOR_HOST
+
+}
+}
+
+const void * rsaAllocationGetType(RsContext con, RsAllocation va)
{
Allocation *a = static_cast<Allocation *>(va);
a->getType()->incUserRef();
@@ -824,11 +829,6 @@ const void* rsi_AllocationGetType(Context *rsc, RsAllocation va)
return a->getType();
}
-#endif //ANDROID_RS_BUILD_FOR_HOST
-
-}
-}
-
RsAllocation rsaAllocationCreateTyped(RsContext con, RsType vtype)
{
Context *rsc = static_cast<Context *>(con);
@@ -873,4 +873,3 @@ RsAllocation rsaAllocationCreateFromBitmap(RsContext con, uint32_t w, uint32_t h
return texAlloc;
}
-
diff --git a/libs/rs/rsContext.cpp b/libs/rs/rsContext.cpp
index 944cd86..3f04585 100644
--- a/libs/rs/rsContext.cpp
+++ b/libs/rs/rsContext.cpp
@@ -222,6 +222,7 @@ void Context::initGLThread()
glGetIntegerv(GL_MAX_FRAGMENT_UNIFORM_VECTORS, &mGL.mMaxFragmentUniformVectors);
mGL.OES_texture_npot = NULL != strstr((const char *)mGL.mExtensions, "GL_OES_texture_npot");
+ mGL.GL_NV_texture_npot_2D_mipmap = NULL != strstr((const char *)mGL.mExtensions, "GL_NV_texture_npot_2D_mipmap");
mGL.EXT_texture_max_aniso = 1.0f;
bool hasAniso = NULL != strstr((const char *)mGL.mExtensions, "GL_EXT_texture_filter_anisotropic");
if(hasAniso) {
@@ -970,12 +971,6 @@ void rsi_AssignName(Context *rsc, void * obj, const char *name, uint32_t len)
rsc->assignName(ob, name, len);
}
-void rsi_GetName(Context *rsc, void * obj, const char **name)
-{
- ObjectBase *ob = static_cast<ObjectBase *>(obj);
- (*name) = ob->getName();
-}
-
void rsi_ObjDestroy(Context *rsc, void *optr)
{
ObjectBase *ob = static_cast<ObjectBase *>(optr);
@@ -1062,3 +1057,10 @@ void rsContextDeinitToClient(RsContext vrsc)
rsc->deinitToClient();
}
+// Only to be called at a3d load time, before object is visible to user
+// not thread safe
+void rsaGetName(RsContext con, void * obj, const char **name)
+{
+ ObjectBase *ob = static_cast<ObjectBase *>(obj);
+ (*name) = ob->getName();
+}
diff --git a/libs/rs/rsContext.h b/libs/rs/rsContext.h
index dbe2c79..e269d4e 100644
--- a/libs/rs/rsContext.h
+++ b/libs/rs/rsContext.h
@@ -190,6 +190,7 @@ public:
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;}
@@ -232,6 +233,7 @@ protected:
int32_t mMaxVertexTextureUnits;
bool OES_texture_npot;
+ bool GL_NV_texture_npot_2D_mipmap;
float EXT_texture_max_aniso;
} mGL;
diff --git a/libs/rs/rsElement.cpp b/libs/rs/rsElement.cpp
index 096115c..d207dcf 100644
--- a/libs/rs/rsElement.cpp
+++ b/libs/rs/rsElement.cpp
@@ -379,7 +379,10 @@ RsElement rsi_ElementCreate2(Context *rsc,
return (RsElement)e;
}
-void rsi_ElementGetNativeData(Context *rsc, RsElement elem, uint32_t *elemData, uint32_t elemDataSize)
+}
+}
+
+void rsaElementGetNativeData(RsContext con, RsElement elem, uint32_t *elemData, uint32_t elemDataSize)
{
rsAssert(elemDataSize == 5);
// we will pack mType; mKind; mNormalized; mVectorSize; NumSubElements
@@ -393,7 +396,7 @@ void rsi_ElementGetNativeData(Context *rsc, RsElement elem, uint32_t *elemData,
}
-void rsi_ElementGetSubElements(Context *rsc, RsElement elem, uint32_t *ids, const char **names, uint32_t dataSize)
+void rsaElementGetSubElements(RsContext con, RsElement elem, uint32_t *ids, const char **names, uint32_t dataSize)
{
Element *e = static_cast<Element *>(elem);
rsAssert(e->getFieldCount() == dataSize);
@@ -405,7 +408,3 @@ void rsi_ElementGetSubElements(Context *rsc, RsElement elem, uint32_t *ids, cons
}
}
-
-
-}
-}
diff --git a/libs/rs/rsFileA3D.cpp b/libs/rs/rsFileA3D.cpp
index c90edc2..e4c6dbd 100644
--- a/libs/rs/rsFileA3D.cpp
+++ b/libs/rs/rsFileA3D.cpp
@@ -115,19 +115,10 @@ bool FileA3D::load(const void *data, size_t length)
return false;
}
- uint8_t *headerData = (uint8_t *)malloc(headerSize);
- if(!headerData) {
- return false;
- }
-
- memcpy(headerData, localData, headerSize);
-
// Now open the stream to parse the header
- IStream headerStream(headerData, false);
+ IStream headerStream(localData, false);
parseHeader(&headerStream);
- free(headerData);
-
localData += headerSize;
lengthRemaining -= headerSize;
@@ -145,13 +136,7 @@ bool FileA3D::load(const void *data, size_t length)
}
// We should know enough to read the file in at this point.
- mAlloc = malloc(mDataSize);
- if (!mAlloc) {
- return false;
- }
- mData = (uint8_t *)mAlloc;
- memcpy(mAlloc, localData, mDataSize);
-
+ mData = (uint8_t *)localData;
mReadStream = new IStream(mData, mUse64BitOffsets);
return true;
@@ -383,7 +368,41 @@ void FileA3D::appendToFile(ObjectBase *obj) {
namespace android {
namespace renderscript {
-void rsi_FileA3DGetNumIndexEntries(Context *rsc, int32_t *numEntries, RsFile file)
+RsFile rsi_FileOpen(Context *rsc, char const *path, unsigned int len)
+{
+ FileA3D *fa3d = new FileA3D(rsc);
+
+ FILE *f = fopen("/sdcard/test.a3d", "rb");
+ if (f) {
+ fa3d->load(f);
+ fclose(f);
+ fa3d->incUserRef();
+ return fa3d;
+ }
+ delete fa3d;
+ return NULL;
+}
+
+
+}
+}
+
+RsObjectBase rsaFileA3DGetEntryByIndex(RsContext con, uint32_t index, RsFile file)
+{
+ FileA3D *fa3d = static_cast<FileA3D *>(file);
+ if(!fa3d) {
+ LOGE("Can't load entry. No valid file");
+ return NULL;
+ }
+
+ ObjectBase *obj = fa3d->initializeFromEntry(index);
+ LOGV("Returning object with name %s", obj->getName());
+
+ return obj;
+}
+
+
+void rsaFileA3DGetNumIndexEntries(RsContext con, int32_t *numEntries, RsFile file)
{
FileA3D *fa3d = static_cast<FileA3D *>(file);
@@ -395,7 +414,7 @@ void rsi_FileA3DGetNumIndexEntries(Context *rsc, int32_t *numEntries, RsFile fil
}
}
-void rsi_FileA3DGetIndexEntries(Context *rsc, RsFileIndexEntry *fileEntries, uint32_t numEntries, RsFile file)
+void rsaFileA3DGetIndexEntries(RsContext con, RsFileIndexEntry *fileEntries, uint32_t numEntries, RsFile file)
{
FileA3D *fa3d = static_cast<FileA3D *>(file);
@@ -418,51 +437,17 @@ void rsi_FileA3DGetIndexEntries(Context *rsc, RsFileIndexEntry *fileEntries, uin
}
-RsObjectBase rsi_FileA3DGetEntryByIndex(Context *rsc, uint32_t index, RsFile file)
-{
- FileA3D *fa3d = static_cast<FileA3D *>(file);
- if(!fa3d) {
- LOGE("Can't load entry. No valid file");
- return NULL;
- }
-
- ObjectBase *obj = fa3d->initializeFromEntry(index);
- LOGV("Returning object with name %s", obj->getName());
-
- return obj;
-}
-
-RsFile rsi_FileA3DCreateFromAssetStream(Context *rsc, const void *data, uint32_t len)
+RsFile rsaFileA3DCreateFromAssetStream(RsContext con, const void *data, uint32_t len)
{
if (data == NULL) {
LOGE("File load failed. Asset stream is NULL");
return NULL;
}
+ Context *rsc = static_cast<Context *>(con);
FileA3D *fa3d = new FileA3D(rsc);
-
- fa3d->load(data, len);
fa3d->incUserRef();
+ fa3d->load(data, len);
return fa3d;
}
-
-
-RsFile rsi_FileOpen(Context *rsc, char const *path, unsigned int len)
-{
- FileA3D *fa3d = new FileA3D(rsc);
-
- FILE *f = fopen("/sdcard/test.a3d", "rb");
- if (f) {
- fa3d->load(f);
- fclose(f);
- fa3d->incUserRef();
- return fa3d;
- }
- delete fa3d;
- return NULL;
-}
-
-
-}
-}
diff --git a/libs/rs/rsMesh.cpp b/libs/rs/rsMesh.cpp
index 761be93..fd604e5 100644
--- a/libs/rs/rsMesh.cpp
+++ b/libs/rs/rsMesh.cpp
@@ -310,19 +310,21 @@ void rsi_MeshBindIndex(Context *rsc, RsMesh mv, RsAllocation va, uint32_t primTy
sm->updateGLPrimitives();
}
-void rsi_MeshGetVertexBufferCount(Context *rsc, RsMesh mv, int32_t *numVtx)
+}}
+
+void rsaMeshGetVertexBufferCount(RsContext con, RsMesh mv, int32_t *numVtx)
{
Mesh *sm = static_cast<Mesh *>(mv);
*numVtx = sm->mVertexBufferCount;
}
-void rsi_MeshGetIndexCount(Context *rsc, RsMesh mv, int32_t *numIdx)
+void rsaMeshGetIndexCount(RsContext con, RsMesh mv, int32_t *numIdx)
{
Mesh *sm = static_cast<Mesh *>(mv);
*numIdx = sm->mPrimitivesCount;
}
-void rsi_MeshGetVertices(Context *rsc, RsMesh mv, RsAllocation *vtxData, uint32_t vtxDataCount)
+void rsaMeshGetVertices(RsContext con, RsMesh mv, RsAllocation *vtxData, uint32_t vtxDataCount)
{
Mesh *sm = static_cast<Mesh *>(mv);
rsAssert(vtxDataCount == sm->mVertexBufferCount);
@@ -333,7 +335,7 @@ void rsi_MeshGetVertices(Context *rsc, RsMesh mv, RsAllocation *vtxData, uint32_
}
}
-void rsi_MeshGetIndices(Context *rsc, RsMesh mv, RsAllocation *va, uint32_t *primType, uint32_t idxDataCount)
+void rsaMeshGetIndices(RsContext con, RsMesh mv, RsAllocation *va, uint32_t *primType, uint32_t idxDataCount)
{
Mesh *sm = static_cast<Mesh *>(mv);
rsAssert(idxDataCount == sm->mPrimitivesCount);
@@ -347,8 +349,3 @@ void rsi_MeshGetIndices(Context *rsc, RsMesh mv, RsAllocation *va, uint32_t *pri
}
}
-
-
-
-
-}}
diff --git a/libs/rs/rsSampler.cpp b/libs/rs/rsSampler.cpp
index cfae7b2..cbdc407 100644
--- a/libs/rs/rsSampler.cpp
+++ b/libs/rs/rsSampler.cpp
@@ -76,7 +76,11 @@ void Sampler::setupGL(const Context *rsc, const Allocation *tex)
};
if (!rsc->ext_OES_texture_npot() && tex->getType()->getIsNp2()) {
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, transNP[mMinFilter]);
+ if (tex->getHasGraphicsMipmaps() && rsc->ext_GL_NV_texture_npot_2D_mipmap()) {
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, trans[mMinFilter]);
+ } else {
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, transNP[mMinFilter]);
+ }
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, transNP[mMagFilter]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, transNP[mWrapS]);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, transNP[mWrapT]);
diff --git a/libs/rs/rsType.cpp b/libs/rs/rsType.cpp
index 7ef2464..caaa9f5 100644
--- a/libs/rs/rsType.cpp
+++ b/libs/rs/rsType.cpp
@@ -374,23 +374,6 @@ Type * Type::cloneAndResize2D(Context *rsc, uint32_t dimX, uint32_t dimY) const
namespace android {
namespace renderscript {
-void rsi_TypeGetNativeData(Context *rsc, RsType type, uint32_t *typeData, uint32_t typeDataSize)
-{
- rsAssert(typeDataSize == 6);
- // Pack the data in the follofing way mDimX; mDimY; mDimZ;
- // mDimLOD; mDimFaces; mElement; into typeData
- Type *t = static_cast<Type *>(type);
-
- (*typeData++) = t->getDimX();
- (*typeData++) = t->getDimY();
- (*typeData++) = t->getDimZ();
- (*typeData++) = t->getDimLOD();
- (*typeData++) = t->getDimFaces() ? 1 : 0;
- (*typeData++) = (uint32_t)t->getElement();
- t->getElement()->incUserRef();
-}
-
-
}
}
@@ -424,3 +407,18 @@ RsType rsaTypeCreate(RsContext con, RsElement _e, uint32_t dimCount,
return Type::getType(rsc, e, dimX, dimY, dimZ, dimLOD, dimFaces);
}
+void rsaTypeGetNativeData(RsContext con, RsType type, uint32_t *typeData, uint32_t typeDataSize)
+{
+ rsAssert(typeDataSize == 6);
+ // Pack the data in the follofing way mDimX; mDimY; mDimZ;
+ // mDimLOD; mDimFaces; mElement; into typeData
+ Type *t = static_cast<Type *>(type);
+
+ (*typeData++) = t->getDimX();
+ (*typeData++) = t->getDimY();
+ (*typeData++) = t->getDimZ();
+ (*typeData++) = t->getDimLOD();
+ (*typeData++) = t->getDimFaces() ? 1 : 0;
+ (*typeData++) = (uint32_t)t->getElement();
+ t->getElement()->incUserRef();
+}