summaryrefslogtreecommitdiffstats
path: root/libs/rs
diff options
context:
space:
mode:
authorAlex Sakhartchouk <alexst@google.com>2011-05-12 10:38:03 -0700
committerAlex Sakhartchouk <alexst@google.com>2011-05-12 10:49:39 -0700
commit25999a08a6652ff5d7d0973f279f1e92e04b3506 (patch)
treefd3a2678fee9bcf1217e03c17d9cb8a080ffacb7 /libs/rs
parent415c842aa6dd3cc797ed2ef1ae42351f594a6c74 (diff)
downloadframeworks_base-25999a08a6652ff5d7d0973f279f1e92e04b3506.zip
frameworks_base-25999a08a6652ff5d7d0973f279f1e92e04b3506.tar.gz
frameworks_base-25999a08a6652ff5d7d0973f279f1e92e04b3506.tar.bz2
Cleanup mesh creation.
Change-Id: Iaf5e060711dcb6341ac0f337dfb274528cb68d3e
Diffstat (limited to 'libs/rs')
-rw-r--r--libs/rs/rs.spec23
-rw-r--r--libs/rs/rsMesh.cpp31
-rw-r--r--libs/rs/rsMesh.h7
3 files changed, 16 insertions, 45 deletions
diff --git a/libs/rs/rs.spec b/libs/rs/rs.spec
index 00e3a0a..1da00a5 100644
--- a/libs/rs/rs.spec
+++ b/libs/rs/rs.spec
@@ -403,25 +403,8 @@ FontCreateFromMemory {
}
MeshCreate {
+ param RsAllocation *vtx
+ param RsAllocation *idx
+ param uint32_t *primType
ret RsMesh
- param uint32_t vtxCount
- param uint32_t idxCount
}
-
-MeshBindIndex {
- param RsMesh mesh
- param RsAllocation idx
- param uint32_t primType
- param uint32_t slot
- }
-
-MeshBindVertex {
- param RsMesh mesh
- param RsAllocation vtx
- param uint32_t slot
- }
-
-MeshInitVertexAttribs {
- param RsMesh mesh
- }
-
diff --git a/libs/rs/rsMesh.cpp b/libs/rs/rsMesh.cpp
index 35184c1..3d0342d 100644
--- a/libs/rs/rsMesh.cpp
+++ b/libs/rs/rsMesh.cpp
@@ -263,30 +263,25 @@ void Mesh::computeBBox() {
namespace android {
namespace renderscript {
-RsMesh rsi_MeshCreate(Context *rsc, uint32_t vtxCount, uint32_t idxCount) {
+RsMesh rsi_MeshCreate(Context *rsc,
+ RsAllocation *vtx, uint32_t vtxCount,
+ RsAllocation *idx, uint32_t idxCount,
+ uint32_t *primType, uint32_t primTypeCount) {
+ rsAssert(idxCount == primTypeCount);
Mesh *sm = new Mesh(rsc, vtxCount, idxCount);
sm->incUserRef();
- return sm;
-}
-
-void rsi_MeshBindVertex(Context *rsc, RsMesh mv, RsAllocation va, uint32_t slot) {
- Mesh *sm = static_cast<Mesh *>(mv);
- rsAssert(slot < sm->mHal.state.vertexBuffersCount);
-
- sm->setVertexBuffer((Allocation *)va, slot);
-}
-
-void rsi_MeshBindIndex(Context *rsc, RsMesh mv, RsAllocation va, uint32_t primType, uint32_t slot) {
- Mesh *sm = static_cast<Mesh *>(mv);
- rsAssert(slot < sm->mHal.state.primitivesCount);
+ for (uint32_t i = 0; i < vtxCount; i ++) {
+ sm->setVertexBuffer((Allocation*)vtx[i], i);
+ }
- sm->setPrimitive((Allocation *)va, (RsPrimitive)primType, slot);
-}
+ for (uint32_t i = 0; i < idxCount; i ++) {
+ sm->setPrimitive((Allocation*)idx[i], (RsPrimitive)primType[i], i);
+ }
-void rsi_MeshInitVertexAttribs(Context *rsc, RsMesh mv) {
- Mesh *sm = static_cast<Mesh *>(mv);
sm->init();
+
+ return sm;
}
}}
diff --git a/libs/rs/rsMesh.h b/libs/rs/rsMesh.h
index 1e279f4..ed1e93d 100644
--- a/libs/rs/rsMesh.h
+++ b/libs/rs/rsMesh.h
@@ -39,13 +39,6 @@ public:
RsPrimitive mPrimitive;
};
- // compatibility to not break the build
- ObjectBaseRef<Allocation> *mVertexBuffers;
- uint32_t mVertexBufferCount;
- Primitive_t ** mPrimitives;
- uint32_t mPrimitivesCount;
- // end compatibility
-
virtual void serialize(OStream *stream) const;
virtual RsA3DClassID getClassId() const { return RS_A3D_CLASS_ID_MESH; }
static Mesh *createFromStream(Context *rsc, IStream *stream);