Implement type generation for user uniforms in vertex shader.
diff --git a/rsProgram.cpp b/rsProgram.cpp
index b7639be..b528c46 100644
--- a/rsProgram.cpp
+++ b/rsProgram.cpp
@@ -95,7 +95,9 @@
Program::~Program()
{
- bindAllocation(NULL);
+ for (uint32_t ct=0; ct < MAX_UNIFORMS; ct++) {
+ bindAllocation(NULL, ct);
+ }
delete[] mInputElements;
delete[] mOutputElements;
@@ -106,15 +108,16 @@
}
-void Program::bindAllocation(Allocation *alloc)
+void Program::bindAllocation(Allocation *alloc, uint32_t slot)
{
- if (mConstants.get() == alloc) {
+ LOGE("bind alloc %p %i", alloc, slot);
+ if (mConstants[slot].get() == alloc) {
return;
}
- if (mConstants.get()) {
- mConstants.get()->removeProgramToDirty(this);
+ if (mConstants[slot].get()) {
+ mConstants[slot].get()->removeProgramToDirty(this);
}
- mConstants.set(alloc);
+ mConstants[slot].set(alloc);
if (alloc) {
alloc->addProgramToDirty(this);
}
@@ -239,7 +242,7 @@
void rsi_ProgramBindConstants(Context *rsc, RsProgram vp, uint32_t slot, RsAllocation constants)
{
Program *p = static_cast<Program *>(vp);
- p->bindAllocation(static_cast<Allocation *>(constants));
+ p->bindAllocation(static_cast<Allocation *>(constants), slot);
}
void rsi_ProgramBindTexture(Context *rsc, RsProgram vpf, uint32_t slot, RsAllocation a)