diff options
author | Jason Sams <rjsams@android.com> | 2009-12-17 16:55:08 -0800 |
---|---|---|
committer | Jason Sams <rjsams@android.com> | 2009-12-17 16:55:08 -0800 |
commit | 68afd01ec9fd37774d8291192952a25e5605b6fb (patch) | |
tree | b75c5b23b57446285d9c14a5d789722b916ea1e8 /libs/rs/rsProgram.cpp | |
parent | 8bb41dd61474e977aa61048ba8f733a984a3b22d (diff) |
Move texture bindings to base program object. Change ProgramFragment creation to require a texture format in 1.0 mode.
Diffstat (limited to 'libs/rs/rsProgram.cpp')
-rw-r--r-- | libs/rs/rsProgram.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/libs/rs/rsProgram.cpp b/libs/rs/rsProgram.cpp index e6d1e36d5719..ede8c860d0de 100644 --- a/libs/rs/rsProgram.cpp +++ b/libs/rs/rsProgram.cpp @@ -121,6 +121,30 @@ void Program::bindAllocation(Allocation *alloc) mDirty = true; } +void Program::bindTexture(uint32_t slot, Allocation *a) +{ + if (slot >= MAX_TEXTURE) { + LOGE("Attempt to bind a texture to a slot > MAX_TEXTURE"); + return; + } + + //LOGE("bindtex %i %p", slot, a); + mTextures[slot].set(a); + mDirty = true; +} + +void Program::bindSampler(uint32_t slot, Sampler *s) +{ + if (slot >= MAX_TEXTURE) { + LOGE("Attempt to bind a Sampler to a slot > MAX_TEXTURE"); + return; + } + + mSamplers[slot].set(s); + mDirty = true; +} + + void Program::createShader() { } @@ -182,6 +206,17 @@ void rsi_ProgramBindConstants(Context *rsc, RsProgram vp, uint32_t slot, RsAlloc p->bindAllocation(static_cast<Allocation *>(constants)); } +void rsi_ProgramBindTexture(Context *rsc, RsProgram vpf, uint32_t slot, RsAllocation a) +{ + Program *p = static_cast<Program *>(vpf); + p->bindTexture(slot, static_cast<Allocation *>(a)); +} + +void rsi_ProgramBindSampler(Context *rsc, RsProgram vpf, uint32_t slot, RsSampler s) +{ + Program *p = static_cast<Program *>(vpf); + p->bindSampler(slot, static_cast<Sampler *>(s)); +} } } |