From 68afd01ec9fd37774d8291192952a25e5605b6fb Mon Sep 17 00:00:00 2001 From: Jason Sams Date: Thu, 17 Dec 2009 16:55:08 -0800 Subject: Move texture bindings to base program object. Change ProgramFragment creation to require a texture format in 1.0 mode. --- libs/rs/rsProgram.cpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'libs/rs/rsProgram.cpp') 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(constants)); } +void rsi_ProgramBindTexture(Context *rsc, RsProgram vpf, uint32_t slot, RsAllocation a) +{ + Program *p = static_cast(vpf); + p->bindTexture(slot, static_cast(a)); +} + +void rsi_ProgramBindSampler(Context *rsc, RsProgram vpf, uint32_t slot, RsSampler s) +{ + Program *p = static_cast(vpf); + p->bindSampler(slot, static_cast(s)); +} } } -- cgit v1.2.3-59-g8ed1b