summaryrefslogtreecommitdiffstats
path: root/libs/rs/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
commitea87e96959895ef94cc3aa9576f41a660d2bbf03 (patch)
tree651c5131fada7c1a2ab55c71e3d6b71901f0832c /libs/rs/rsProgram.cpp
parent917cd4fcda61c63429d73639284f34bb85c97f37 (diff)
downloadframeworks_base-ea87e96959895ef94cc3aa9576f41a660d2bbf03.zip
frameworks_base-ea87e96959895ef94cc3aa9576f41a660d2bbf03.tar.gz
frameworks_base-ea87e96959895ef94cc3aa9576f41a660d2bbf03.tar.bz2
Implement type generation for user uniforms in vertex shader.
Diffstat (limited to 'libs/rs/rsProgram.cpp')
-rw-r--r--libs/rs/rsProgram.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/libs/rs/rsProgram.cpp b/libs/rs/rsProgram.cpp
index b7639be..b528c46 100644
--- a/libs/rs/rsProgram.cpp
+++ b/libs/rs/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)