summaryrefslogtreecommitdiff
path: root/libs/rs/rsVertexArray.cpp
diff options
context:
space:
mode:
author Alex Sakhartchouk <alexst@google.com> 2010-09-29 09:49:13 -0700
committer Alex Sakhartchouk <alexst@google.com> 2010-09-29 09:49:13 -0700
commit4378f1175546616c76ecb7f0b1159940ab22d5f4 (patch)
tree900b42e369c9cd58340c88dee93dc0139c7afe5c /libs/rs/rsVertexArray.cpp
parent5f421a56786cf7c71159280c51bd4280f5199cfb (diff)
More robust attribute binding
Adding attribute and uniform debug logging. Checking to see if aniso filtering is available. Change-Id: I2ed9d166ed7ff3df971d7af18b7a33f4e3ade928
Diffstat (limited to 'libs/rs/rsVertexArray.cpp')
-rw-r--r--libs/rs/rsVertexArray.cpp31
1 files changed, 8 insertions, 23 deletions
diff --git a/libs/rs/rsVertexArray.cpp b/libs/rs/rsVertexArray.cpp
index 16be5ea299a1..4d501246298e 100644
--- a/libs/rs/rsVertexArray.cpp
+++ b/libs/rs/rsVertexArray.cpp
@@ -84,10 +84,6 @@ void VertexArray::clear(uint32_t n)
void VertexArray::add(const Attrib &a, uint32_t stride)
{
- // Skip padding
- if(a.name[0] == '#') {
- return;
- }
rsAssert(mCount < RS_MAX_ATTRIBS);
mAttribs[mCount].set(a);
mAttribs[mCount].buffer = mActiveBuffer;
@@ -98,10 +94,6 @@ void VertexArray::add(const Attrib &a, uint32_t stride)
void VertexArray::add(uint32_t type, uint32_t size, uint32_t stride, bool normalized, uint32_t offset, const char *name)
{
- // Skip padding
- if(name[0] == '#') {
- return;
- }
rsAssert(mCount < RS_MAX_ATTRIBS);
mAttribs[mCount].clear();
mAttribs[mCount].type = type;
@@ -117,7 +109,11 @@ void VertexArray::add(uint32_t type, uint32_t size, uint32_t stride, bool normal
}
void VertexArray::logAttrib(uint32_t idx, uint32_t slot) const {
- LOGE("va %i: slot=%i name=%s buf=%i ptr=%p size=%i type=0x%x stride=0x%x norm=%i offset=0x%x", idx, slot,
+ if(idx == 0) {
+ LOGV("Starting vertex attribute binding");
+ }
+ LOGV("va %i: slot=%i name=%s buf=%i ptr=%p size=%i type=0x%x stride=0x%x norm=%i offset=0x%x",
+ idx, slot,
mAttribs[idx].name.string(),
mAttribs[idx].buffer,
mAttribs[idx].ptr,
@@ -137,24 +133,13 @@ void VertexArray::setupGL2(const Context *rsc, class VertexArrayState *state, Sh
rsc->checkError("VertexArray::setupGL2 disabled");
for (uint32_t ct=0; ct < mCount; ct++) {
- int32_t slot = -1;
- if (sc->isUserVertexProgram()) {
- slot = sc->vtxAttribSlot(ct);
- } else {
- 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 == "texture0") {
- slot = 3;
- }
+ int32_t slot = sc->vtxAttribSlot(mAttribs[ct].name);
+ if(rsc->props.mLogShadersAttr) {
+ logAttrib(ct, slot);
}
if(slot < 0) {
continue;
}
- //logAttrib(ct, slot);
glEnableVertexAttribArray(slot);
glBindBuffer(GL_ARRAY_BUFFER, mAttribs[ct].buffer);
glVertexAttribPointer(slot,