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 | 7dad9c30a59c99b57269e1b498807b6f034d56e9 (patch) | |
| tree | 3652e03385699cd42e0bf1c427224aa3b6601682 /rsProgram.cpp | |
| parent | b2a219b87c56c85d26eab0b702f272a06e912dc5 (diff) | |
Move texture bindings to base program object. Change ProgramFragment creation to require a texture format in 1.0 mode.
Diffstat (limited to 'rsProgram.cpp')
| -rw-r--r-- | rsProgram.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/rsProgram.cpp b/rsProgram.cpp index e6d1e36d..ede8c860 100644 --- a/rsProgram.cpp +++ b/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)); +} } } |
