diff options
Diffstat (limited to 'libs/rs')
| -rw-r--r-- | libs/rs/java/Fountain/res/raw/fountain.rs | 17 | ||||
| -rw-r--r-- | libs/rs/java/Fountain/res/raw/fountain_bc.bc | bin | 2196 -> 2384 bytes | |||
| -rw-r--r-- | libs/rs/java/Fountain/src/com/android/fountain/ScriptField_Point.java | 6 | ||||
| -rw-r--r-- | libs/rs/rsProgramVertex.cpp | 20 | ||||
| -rw-r--r-- | libs/rs/rsScriptC_LibGL.cpp | 27 | ||||
| -rw-r--r-- | libs/rs/rsShaderCache.cpp | 15 | ||||
| -rw-r--r-- | libs/rs/rsSimpleMesh.cpp | 19 | ||||
| -rw-r--r-- | libs/rs/rsType.cpp | 127 | ||||
| -rw-r--r-- | libs/rs/rsType.h | 11 | ||||
| -rw-r--r-- | libs/rs/rsVertexArray.cpp | 99 | ||||
| -rw-r--r-- | libs/rs/rsVertexArray.h | 6 | ||||
| -rw-r--r-- | libs/rs/scriptc/rs_core.rsh | 8 |
12 files changed, 80 insertions, 275 deletions
diff --git a/libs/rs/java/Fountain/res/raw/fountain.rs b/libs/rs/java/Fountain/res/raw/fountain.rs index 67f7ef5..fe2ca33 100644 --- a/libs/rs/java/Fountain/res/raw/fountain.rs +++ b/libs/rs/java/Fountain/res/raw/fountain.rs @@ -40,6 +40,18 @@ int root() { return 1; } +// Putting the overloadable attribute on this function breaks rendering +// appears to be a bug. +static uchar4 /*__attribute__((overloadable))*/ pack(float r, float g, float b) +{ + uchar4 c; + c.x = (uchar)(r * 255.f); + c.y = (uchar)(g * 255.f); + c.z = (uchar)(b * 255.f); + c.w = 255; + return c; +} + void addParticles(int rate, int x, int y) { //rsDebug("partColor", partColor); @@ -51,7 +63,10 @@ void addParticles(int rate, int x, int y) float rMax = ((float)rate) * 0.005f; int size = rsAllocationGetDimX(rsGetAllocation(point)); - uchar4 c = rsPackColorTo8888(partColor.x, partColor.y, partColor.z); + //uchar4 c = rsPackColorTo8888(partColor.x, partColor.y, partColor.z); + uchar4 c = pack(partColor.x, partColor.y, partColor.z); + c.x = 255; + c.w = 255; //rsDebug("color ", ((int *)&c)[0]); Point_t * np = &point[newPart]; diff --git a/libs/rs/java/Fountain/res/raw/fountain_bc.bc b/libs/rs/java/Fountain/res/raw/fountain_bc.bc Binary files differindex 7b2e88b..d223460 100644 --- a/libs/rs/java/Fountain/res/raw/fountain_bc.bc +++ b/libs/rs/java/Fountain/res/raw/fountain_bc.bc diff --git a/libs/rs/java/Fountain/src/com/android/fountain/ScriptField_Point.java b/libs/rs/java/Fountain/src/com/android/fountain/ScriptField_Point.java index b091f39..91db2c6 100644 --- a/libs/rs/java/Fountain/src/com/android/fountain/ScriptField_Point.java +++ b/libs/rs/java/Fountain/src/com/android/fountain/ScriptField_Point.java @@ -30,9 +30,9 @@ public class ScriptField_Point mItemArray = new Item[count]; Element.Builder eb = new Element.Builder(rs); - eb.add(Element.createVector(rs, Element.DataType.FLOAT_32, 2), "delta"); - eb.add(Element.createAttrib(rs, Element.DataType.FLOAT_32, Element.DataKind.POSITION, 2), "position"); - eb.add(Element.createAttrib(rs, Element.DataType.UNSIGNED_8, Element.DataKind.COLOR, 4), "color"); + eb.add(Element.F32_2(rs), "delta"); + eb.add(Element.F32_2(rs), "position"); + eb.add(Element.U8_4(rs), "color"); mElement = eb.create(); init(rs, count); diff --git a/libs/rs/rsProgramVertex.cpp b/libs/rs/rsProgramVertex.cpp index d4c29c8..d667c86 100644 --- a/libs/rs/rsProgramVertex.cpp +++ b/libs/rs/rsProgramVertex.cpp @@ -178,11 +178,11 @@ void ProgramVertex::createShader() } mShader.append(mUserShader); } else { - mShader.append("attribute vec4 ATTRIB_LegacyPosition;\n"); - mShader.append("attribute vec4 ATTRIB_LegacyColor;\n"); - mShader.append("attribute vec3 ATTRIB_LegacyNormal;\n"); - mShader.append("attribute float ATTRIB_LegacyPointSize;\n"); - mShader.append("attribute vec4 ATTRIB_LegacyTexture;\n"); + mShader.append("attribute vec4 ATTRIB_position;\n"); + mShader.append("attribute vec4 ATTRIB_color;\n"); + mShader.append("attribute vec3 ATTRIB_normal;\n"); + mShader.append("attribute float ATTRIB_pointSize;\n"); + mShader.append("attribute vec4 ATTRIB_texture0;\n"); for (uint32_t ct=0; ct < mUniformCount; ct++) { mShader.append("uniform mat4 "); @@ -191,14 +191,14 @@ void ProgramVertex::createShader() } mShader.append("void main() {\n"); - mShader.append(" gl_Position = UNI_MVP * ATTRIB_LegacyPosition;\n"); - mShader.append(" gl_PointSize = ATTRIB_LegacyPointSize;\n"); + mShader.append(" gl_Position = UNI_MVP * ATTRIB_position;\n"); + mShader.append(" gl_PointSize = ATTRIB_pointSize;\n"); - mShader.append(" varColor = ATTRIB_LegacyColor;\n"); + mShader.append(" varColor = ATTRIB_color;\n"); if (mTextureMatrixEnable) { - mShader.append(" varTex0 = UNI_TexMatrix * ATTRIB_LegacyTexture;\n"); + mShader.append(" varTex0 = UNI_TexMatrix * ATTRIB_texture0;\n"); } else { - mShader.append(" varTex0 = ATTRIB_LegacyTexture;\n"); + mShader.append(" varTex0 = ATTRIB_texture0;\n"); } //mShader.append(" pos.x = pos.x / 480.0;\n"); //mShader.append(" pos.y = pos.y / 800.0;\n"); diff --git a/libs/rs/rsScriptC_LibGL.cpp b/libs/rs/rsScriptC_LibGL.cpp index 18f873e..8f650f8 100644 --- a/libs/rs/rsScriptC_LibGL.cpp +++ b/libs/rs/rsScriptC_LibGL.cpp @@ -131,12 +131,8 @@ static void SC_drawLine(float x1, float y1, float z1, float vtx[] = { x1, y1, z1, x2, y2, z2 }; VertexArray va; - va.addLegacy(GL_FLOAT, 3, 12, RS_KIND_POSITION, false, (uint32_t)vtx); - if (rsc->checkVersion2_0()) { - va.setupGL2(rsc, &rsc->mStateVertexArray, &rsc->mShaderCache); - } else { - va.setupGL(rsc, &rsc->mStateVertexArray); - } + va.add(GL_FLOAT, 3, 12, false, (uint32_t)vtx, "position"); + va.setupGL2(rsc, &rsc->mStateVertexArray, &rsc->mShaderCache); glDrawArrays(GL_LINES, 0, 2); } @@ -151,12 +147,8 @@ static void SC_drawPoint(float x, float y, float z) float vtx[] = { x, y, z }; VertexArray va; - va.addLegacy(GL_FLOAT, 3, 12, RS_KIND_POSITION, false, (uint32_t)vtx); - if (rsc->checkVersion2_0()) { - va.setupGL2(rsc, &rsc->mStateVertexArray, &rsc->mShaderCache); - } else { - va.setupGL(rsc, &rsc->mStateVertexArray); - } + va.add(GL_FLOAT, 3, 12, false, (uint32_t)vtx, "position"); + va.setupGL2(rsc, &rsc->mStateVertexArray, &rsc->mShaderCache); glDrawArrays(GL_POINTS, 0, 1); } @@ -185,14 +177,9 @@ static void SC_drawQuadTexCoords(float x1, float y1, float z1, const float tex[] = {u1,v1, u2,v2, u3,v3, u4,v4}; VertexArray va; - va.addLegacy(GL_FLOAT, 3, 12, RS_KIND_POSITION, false, (uint32_t)vtx); - va.addLegacy(GL_FLOAT, 2, 8, RS_KIND_TEXTURE, false, (uint32_t)tex); - if (rsc->checkVersion2_0()) { - va.setupGL2(rsc, &rsc->mStateVertexArray, &rsc->mShaderCache); - } else { - va.setupGL(rsc, &rsc->mStateVertexArray); - } - + va.add(GL_FLOAT, 3, 12, false, (uint32_t)vtx, "position"); + va.add(GL_FLOAT, 2, 8, false, (uint32_t)tex, "texture0"); + va.setupGL2(rsc, &rsc->mStateVertexArray, &rsc->mShaderCache); glDrawArrays(GL_TRIANGLE_FAN, 0, 4); } diff --git a/libs/rs/rsShaderCache.cpp b/libs/rs/rsShaderCache.cpp index 0218dc5..504ffba 100644 --- a/libs/rs/rsShaderCache.cpp +++ b/libs/rs/rsShaderCache.cpp @@ -98,16 +98,11 @@ bool ShaderCache::lookup(Context *rsc, ProgramVertex *vtx, ProgramFragment *frag glAttachShader(pgm, frag->getShaderID()); if (!vtx->isUserProgram()) { - glBindAttribLocation(pgm, 0, "ATTRIB_LegacyPosition"); - glBindAttribLocation(pgm, 1, "ATTRIB_LegacyColor"); - glBindAttribLocation(pgm, 2, "ATTRIB_LegacyNormal"); - glBindAttribLocation(pgm, 3, "ATTRIB_LegacyPointSize"); - glBindAttribLocation(pgm, 4, "ATTRIB_LegacyTexture"); - e->mVtxAttribSlots[RS_KIND_POSITION] = 0; - e->mVtxAttribSlots[RS_KIND_COLOR] = 1; - e->mVtxAttribSlots[RS_KIND_NORMAL] = 2; - e->mVtxAttribSlots[RS_KIND_POINT_SIZE] = 3; - e->mVtxAttribSlots[RS_KIND_TEXTURE] = 4; + glBindAttribLocation(pgm, 0, "ATTRIB_position"); + glBindAttribLocation(pgm, 1, "ATTRIB_color"); + glBindAttribLocation(pgm, 2, "ATTRIB_normal"); + glBindAttribLocation(pgm, 3, "ATTRIB_pointSize"); + glBindAttribLocation(pgm, 4, "ATTRIB_texture0"); } //LOGE("e2 %x", glGetError()); diff --git a/libs/rs/rsSimpleMesh.cpp b/libs/rs/rsSimpleMesh.cpp index 170b792..2dd082d 100644 --- a/libs/rs/rsSimpleMesh.cpp +++ b/libs/rs/rsSimpleMesh.cpp @@ -68,21 +68,12 @@ void SimpleMesh::renderRange(Context *rsc, uint32_t start, uint32_t len) const rsc->checkError("SimpleMesh::renderRange 1"); VertexArray va; - if (rsc->checkVersion2_0()) { - for (uint32_t ct=0; ct < mVertexTypeCount; ct++) { - mVertexBuffers[ct]->uploadCheck(rsc); - va.setActiveBuffer(mVertexBuffers[ct]->getBufferObjectID()); - mVertexTypes[ct]->enableGLVertexBuffer2(&va); - } - va.setupGL2(rsc, &rsc->mStateVertexArray, &rsc->mShaderCache); - } else { - for (uint32_t ct=0; ct < mVertexTypeCount; ct++) { - mVertexBuffers[ct]->uploadCheck(rsc); - va.setActiveBuffer(mVertexBuffers[ct]->getBufferObjectID()); - mVertexTypes[ct]->enableGLVertexBuffer(&va); - } - va.setupGL(rsc, 0); + for (uint32_t ct=0; ct < mVertexTypeCount; ct++) { + mVertexBuffers[ct]->uploadCheck(rsc); + va.setActiveBuffer(mVertexBuffers[ct]->getBufferObjectID()); + mVertexTypes[ct]->enableGLVertexBuffer(&va); } + va.setupGL2(rsc, &rsc->mStateVertexArray, &rsc->mShaderCache); rsc->checkError("SimpleMesh::renderRange 2"); if (mIndexType.get()) { diff --git a/libs/rs/rsType.cpp b/libs/rs/rsType.cpp index 8f99209..89e73b0 100644 --- a/libs/rs/rsType.cpp +++ b/libs/rs/rsType.cpp @@ -148,131 +148,22 @@ void Type::makeGLComponents() for (uint32_t ct=0; ct < getElement()->getFieldCount(); ct++) { const Component &c = getElement()->getField(ct)->getComponent(); - switch(c.getKind()) { - case RS_KIND_USER: - mGL.mUser[userNum].size = c.getVectorSize(); - mGL.mUser[userNum].offset = mElement->getFieldOffsetBytes(ct); - mGL.mUser[userNum].type = c.getGLType(); - mGL.mUser[userNum].normalized = c.getType() != RS_TYPE_FLOAT_32;//c.getIsNormalized(); - mGL.mUser[userNum].name.setTo(getElement()->getFieldName(ct)); - userNum ++; - break; - - case RS_KIND_POSITION: - rsAssert(mGL.mVtx.size == 0); - mGL.mVtx.size = c.getVectorSize(); - mGL.mVtx.offset = mElement->getFieldOffsetBytes(ct); - mGL.mVtx.type = c.getGLType(); - mGL.mVtx.normalized = false; - mGL.mVtx.name.setTo("Position"); - break; - - case RS_KIND_COLOR: - rsAssert(mGL.mColor.size == 0); - mGL.mColor.size = c.getVectorSize(); - mGL.mColor.offset = mElement->getFieldOffsetBytes(ct); - mGL.mColor.type = c.getGLType(); - mGL.mColor.normalized = c.getType() != RS_TYPE_FLOAT_32; - mGL.mColor.name.setTo("Color"); - break; - - case RS_KIND_NORMAL: - rsAssert(mGL.mNorm.size == 0); - mGL.mNorm.size = c.getVectorSize(); - mGL.mNorm.offset = mElement->getFieldOffsetBytes(ct); - mGL.mNorm.type = c.getGLType(); - mGL.mNorm.normalized = false; - mGL.mNorm.name.setTo("Normal"); - break; - - case RS_KIND_TEXTURE: - rsAssert(mGL.mTex.size == 0); - mGL.mTex.size = c.getVectorSize(); - mGL.mTex.offset = mElement->getFieldOffsetBytes(ct); - mGL.mTex.type = c.getGLType(); - mGL.mTex.normalized = false; - mGL.mTex.name.setTo("Texture"); - break; - - case RS_KIND_POINT_SIZE: - rsAssert(!mGL.mPointSize.size); - mGL.mPointSize.size = c.getVectorSize(); - mGL.mPointSize.offset = mElement->getFieldOffsetBytes(ct); - mGL.mPointSize.type = c.getGLType(); - mGL.mPointSize.normalized = false; - mGL.mPointSize.name.setTo("PointSize"); - break; - - default: - break; - } + mAttribs[userNum].size = c.getVectorSize(); + mAttribs[userNum].offset = mElement->getFieldOffsetBytes(ct); + mAttribs[userNum].type = c.getGLType(); + mAttribs[userNum].normalized = c.getType() != RS_TYPE_FLOAT_32;//c.getIsNormalized(); + mAttribs[userNum].name.setTo(getElement()->getFieldName(ct)); + userNum ++; } } -void Type::enableGLVertexBuffer(VertexArray *va) const -{ - // Note: We are only going to enable buffers and never disable them - // here. The reason is more than one Allocation may be used as a vertex - // source. So we cannot disable arrays that may have been in use by - // another allocation. - uint32_t stride = mElement->getSizeBytes(); - if (mGL.mVtx.size) { - va->addLegacy(mGL.mVtx.type, - mGL.mVtx.size, - stride, - RS_KIND_POSITION, - false, - mGL.mVtx.offset); - } - - if (mGL.mNorm.size) { - va->addLegacy(mGL.mNorm.type, - 3, - stride, - RS_KIND_NORMAL, - false, - mGL.mNorm.offset); - } - - if (mGL.mColor.size) { - va->addLegacy(mGL.mColor.type, - mGL.mColor.size, - stride, - RS_KIND_COLOR, - true, - mGL.mColor.offset); - } - - if (mGL.mTex.size) { - va->addLegacy(mGL.mTex.type, - mGL.mTex.size, - stride, - RS_KIND_TEXTURE, - false, - mGL.mTex.offset); - } - - if (mGL.mPointSize.size) { - va->addLegacy(mGL.mPointSize.type, - 1, - stride, - RS_KIND_POINT_SIZE, - false, - mGL.mPointSize.offset); - } - -} - -void Type::enableGLVertexBuffer2(VertexArray *va) const +void Type::enableGLVertexBuffer(VertexArray *va) const { - // Do legacy buffers - enableGLVertexBuffer(va); - uint32_t stride = mElement->getSizeBytes(); for (uint32_t ct=0; ct < RS_MAX_ATTRIBS; ct++) { - if (mGL.mUser[ct].size) { - va->addUser(mGL.mUser[ct], stride); + if (mAttribs[ct].size) { + va->add(mAttribs[ct], stride); } } } diff --git a/libs/rs/rsType.h b/libs/rs/rsType.h index 664f343..f598f64 100644 --- a/libs/rs/rsType.h +++ b/libs/rs/rsType.h @@ -71,7 +71,6 @@ public: void compute(); void enableGLVertexBuffer(class VertexArray *) const; - void enableGLVertexBuffer2(class VertexArray *) const; void dumpLOGV(const char *prefix) const; virtual void serialize(OStream *stream) const; @@ -115,15 +114,7 @@ protected: LOD *mLODs; uint32_t mLODCount; - struct GLState_t { - VertexArray::Attrib mUser[RS_MAX_ATTRIBS]; - VertexArray::Attrib mVtx; - VertexArray::Attrib mNorm; - VertexArray::Attrib mColor; - VertexArray::Attrib mTex; - VertexArray::Attrib mPointSize; - }; - GLState_t mGL; + VertexArray::Attrib mAttribs[RS_MAX_ATTRIBS]; void makeGLComponents(); private: diff --git a/libs/rs/rsVertexArray.cpp b/libs/rs/rsVertexArray.cpp index b42d1c4..425b584 100644 --- a/libs/rs/rsVertexArray.cpp +++ b/libs/rs/rsVertexArray.cpp @@ -60,7 +60,6 @@ void VertexArray::Attrib::set(const Attrib &a) size = a.size; stride = a.stride; normalized = a.normalized; - kind = RS_KIND_USER; name.setTo(a.name); } @@ -80,17 +79,16 @@ void VertexArray::clear(uint32_t n) mAttribs[n].clear(); } -void VertexArray::addUser(const Attrib &a, uint32_t stride) +void VertexArray::add(const Attrib &a, uint32_t stride) { rsAssert(mCount < RS_MAX_ATTRIBS); mAttribs[mCount].set(a); mAttribs[mCount].buffer = mActiveBuffer; mAttribs[mCount].stride = stride; - mAttribs[mCount].kind = RS_KIND_USER; mCount ++; } -void VertexArray::addLegacy(uint32_t type, uint32_t size, uint32_t stride, RsDataKind kind, bool normalized, uint32_t offset) +void VertexArray::add(uint32_t type, uint32_t size, uint32_t stride, bool normalized, uint32_t offset, const char *name) { rsAssert(mCount < RS_MAX_ATTRIBS); mAttribs[mCount].clear(); @@ -100,96 +98,25 @@ void VertexArray::addLegacy(uint32_t type, uint32_t size, uint32_t stride, RsDat mAttribs[mCount].normalized = normalized; mAttribs[mCount].buffer = mActiveBuffer; mAttribs[mCount].stride = stride; - mAttribs[mCount].kind = kind; + mAttribs[mCount].name.setTo(name); mCount ++; } void VertexArray::logAttrib(uint32_t idx, uint32_t slot) const { - LOGE("va %i: slot=%i name=%s buf=%i size=%i type=0x%x kind=%i stride=0x%x norm=%i offset=0x%x", idx, slot, + LOGE("va %i: slot=%i name=%s buf=%i size=%i type=0x%x stride=0x%x norm=%i offset=0x%x", idx, slot, mAttribs[idx].name.string(), mAttribs[idx].buffer, mAttribs[idx].size, mAttribs[idx].type, - mAttribs[idx].kind, mAttribs[idx].stride, mAttribs[idx].normalized, mAttribs[idx].offset); } -void VertexArray::setupGL(const Context *rsc, class VertexArrayState *state) const -{ - glClientActiveTexture(GL_TEXTURE0); - glDisableClientState(GL_NORMAL_ARRAY); - glDisableClientState(GL_COLOR_ARRAY); - glDisableClientState(GL_TEXTURE_COORD_ARRAY); -#ifndef ANDROID_RS_BUILD_FOR_HOST // GLES only - glDisableClientState(GL_POINT_SIZE_ARRAY_OES); -#endif //ANDROID_RS_BUILD_FOR_HOST - - for (uint32_t ct=0; ct < mCount; ct++) { - switch(mAttribs[ct].kind) { - case RS_KIND_POSITION: - //logAttrib(POSITION); - glEnableClientState(GL_VERTEX_ARRAY); - glBindBuffer(GL_ARRAY_BUFFER, mAttribs[ct].buffer); - glVertexPointer(mAttribs[ct].size, - mAttribs[ct].type, - mAttribs[ct].stride, - (void *)mAttribs[ct].offset); - break; - - case RS_KIND_NORMAL: - //logAttrib(NORMAL); - glEnableClientState(GL_NORMAL_ARRAY); - rsAssert(mAttribs[ct].size == 3); - glBindBuffer(GL_ARRAY_BUFFER, mAttribs[ct].buffer); - glNormalPointer(mAttribs[ct].type, - mAttribs[ct].stride, - (void *)mAttribs[ct].offset); - break; - - case RS_KIND_COLOR: - //logAttrib(COLOR); - glEnableClientState(GL_COLOR_ARRAY); - glBindBuffer(GL_ARRAY_BUFFER, mAttribs[ct].buffer); - glColorPointer(mAttribs[ct].size, - mAttribs[ct].type, - mAttribs[ct].stride, - (void *)mAttribs[ct].offset); - break; - - case RS_KIND_TEXTURE: - //logAttrib(TEXTURE); - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glBindBuffer(GL_ARRAY_BUFFER, mAttribs[ct].buffer); - glTexCoordPointer(mAttribs[ct].size, - mAttribs[ct].type, - mAttribs[ct].stride, - (void *)mAttribs[ct].offset); - break; -#ifndef ANDROID_RS_BUILD_FOR_HOST // GLES only - case RS_KIND_POINT_SIZE: - //logAttrib(POINT_SIZE); - glEnableClientState(GL_POINT_SIZE_ARRAY_OES); - glBindBuffer(GL_ARRAY_BUFFER, mAttribs[ct].buffer); - glPointSizePointerOES(mAttribs[ct].type, - mAttribs[ct].stride, - (void *)mAttribs[ct].offset); - break; -#endif //ANDROID_RS_BUILD_FOR_HOST - - default: - rsAssert(0); - } - } - - rsc->checkError("VertexArray::setupGL"); -} - void VertexArray::setupGL2(const Context *rsc, class VertexArrayState *state, ShaderCache *sc) const { rsc->checkError("VertexArray::setupGL2 start"); - for (uint32_t ct=1; ct <= state->mLastEnableCount; ct++) { + for (uint32_t ct=1; ct <= 0xf/*state->mLastEnableCount*/; ct++) { glDisableVertexAttribArray(ct); } @@ -199,16 +126,24 @@ void VertexArray::setupGL2(const Context *rsc, class VertexArrayState *state, Sh if (sc->isUserVertexProgram()) { slot = sc->vtxAttribSlot(ct); } else { - if (mAttribs[ct].kind == RS_KIND_USER) { + if (mAttribs[ct].name == "position") { + slot = 0; + } else if (mAttribs[ct].name == "color") { + slot = 1; + } else if (mAttribs[ct].name == "normal") { + slot = 2; + } else if (mAttribs[ct].name == "pointSize") { + slot = 3; + } else if (mAttribs[ct].name == "texture0") { + slot = 4; + } else { continue; } - slot = sc->vtxAttribSlot(mAttribs[ct].kind); } - //logAttrib(ct, slot); + logAttrib(ct, slot); glEnableVertexAttribArray(slot); glBindBuffer(GL_ARRAY_BUFFER, mAttribs[ct].buffer); - glVertexAttribPointer(slot, mAttribs[ct].size, mAttribs[ct].type, diff --git a/libs/rs/rsVertexArray.h b/libs/rs/rsVertexArray.h index 3904cb6..e5b51d7 100644 --- a/libs/rs/rsVertexArray.h +++ b/libs/rs/rsVertexArray.h @@ -43,7 +43,6 @@ public: uint32_t stride; bool normalized; String8 name; - RsDataKind kind; Attrib(); void set(const Attrib &); @@ -53,8 +52,9 @@ public: void clearAll(); void setActiveBuffer(uint32_t id) {mActiveBuffer = id;} - void addUser(const Attrib &, uint32_t stride); - void addLegacy(uint32_t type, uint32_t size, uint32_t stride, RsDataKind kind, bool normalized, uint32_t offset); + void add(const Attrib &, uint32_t stride); + //void addLegacy(uint32_t type, uint32_t size, uint32_t stride, bool normalized, uint32_t offset); + void add(uint32_t type, uint32_t size, uint32_t stride, bool normalized, uint32_t offset, const char *name); void setupGL(const Context *rsc, class VertexArrayState *) const; void setupGL2(const Context *rsc, class VertexArrayState *, ShaderCache *) const; diff --git a/libs/rs/scriptc/rs_core.rsh b/libs/rs/scriptc/rs_core.rsh index a2a5bab..c0ba4af 100644 --- a/libs/rs/scriptc/rs_core.rsh +++ b/libs/rs/scriptc/rs_core.rsh @@ -1,10 +1,10 @@ #ifndef __RS_CORE_RSH__ #define __RS_CORE_RSH__ -uchar4 __attribute__((overloadable)) rsPackColorTo8888(float r, float g, float b); -uchar4 __attribute__((overloadable)) rsPackColorTo8888(float r, float g, float b, float a); +//uchar4 __attribute__((overloadable)) rsPackColorTo8888(float r, float g, float b); +//uchar4 __attribute__((overloadable)) rsPackColorTo8888(float r, float g, float b, float a); -uchar4 __attribute__((overloadable)) rsPackColorTo8888(float r, float g, float b) +static uchar4 __attribute__((overloadable)) rsPackColorTo8888(float r, float g, float b) { uchar4 c; c.x = (uchar)(r * 255.f); @@ -14,7 +14,7 @@ uchar4 __attribute__((overloadable)) rsPackColorTo8888(float r, float g, float b return c; } -uchar4 __attribute__((overloadable)) rsPackColorTo8888(float r, float g, float b, float a) +static uchar4 __attribute__((overloadable)) rsPackColorTo8888(float r, float g, float b, float a) { uchar4 c; c.x = (uchar)(r * 255.f); |
