summaryrefslogtreecommitdiff
path: root/rsProgram.cpp
diff options
context:
space:
mode:
authorJason Sams <rjsams@android.com>2010-01-12 12:12:28 -0800
committerJason Sams <rjsams@android.com>2010-01-12 12:12:28 -0800
commit9ebb0c44ece47531f3d0a98ba52ae448de42032b (patch)
tree0b9c3b04fdad0b6951d564c09f4093bd27d8c32f /rsProgram.cpp
parent7c52898ac201043a26b3edb7526d414684cfb96b (diff)
Implement type generation for user uniforms in vertex shader.
Diffstat (limited to 'rsProgram.cpp')
-rw-r--r--rsProgram.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/rsProgram.cpp b/rsProgram.cpp
index b7639be6..b528c465 100644
--- a/rsProgram.cpp
+++ b/rsProgram.cpp
@@ -95,7 +95,9 @@ Program::Program(Context *rsc, const char * shaderText, uint32_t shaderLength,
Program::~Program()
{
- bindAllocation(NULL);
+ for (uint32_t ct=0; ct < MAX_UNIFORMS; ct++) {
+ bindAllocation(NULL, ct);
+ }
delete[] mInputElements;
delete[] mOutputElements;
@@ -106,15 +108,16 @@ Program::~Program()
}
-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 @@ namespace renderscript {
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)