diff options
Diffstat (limited to 'libs/rs/rsProgramFragmentStore.cpp')
-rw-r--r-- | libs/rs/rsProgramFragmentStore.cpp | 42 |
1 files changed, 38 insertions, 4 deletions
diff --git a/libs/rs/rsProgramFragmentStore.cpp b/libs/rs/rsProgramFragmentStore.cpp index de33d9c..8a2157f 100644 --- a/libs/rs/rsProgramFragmentStore.cpp +++ b/libs/rs/rsProgramFragmentStore.cpp @@ -24,8 +24,8 @@ using namespace android; using namespace android::renderscript; -ProgramFragmentStore::ProgramFragmentStore(Context *rsc, Element *in, Element *out) : - Program(rsc, in, out) +ProgramFragmentStore::ProgramFragmentStore(Context *rsc) : + Program(rsc) { mAllocFile = __FILE__; mAllocLine = __LINE__; @@ -83,10 +83,44 @@ void ProgramFragmentStore::setupGL(const Context *rsc, ProgramFragmentStoreState } else { glDisable(GL_DITHER); } +} +void ProgramFragmentStore::setupGL2(const Context *rsc, ProgramFragmentStoreState *state) +{ + if (state->mLast.get() == this) { + return; + } + state->mLast.set(this); + + glColorMask(mColorRWriteEnable, + mColorGWriteEnable, + mColorBWriteEnable, + mColorAWriteEnable); + if (mBlendEnable) { + glEnable(GL_BLEND); + glBlendFunc(mBlendSrc, mBlendDst); + } else { + glDisable(GL_BLEND); + } + //LOGE("pfs %i, %i, %x", mDepthWriteEnable, mDepthTestEnable, mDepthFunc); + + glDepthMask(mDepthWriteEnable); + if(mDepthTestEnable || mDepthWriteEnable) { + glEnable(GL_DEPTH_TEST); + glDepthFunc(mDepthFunc); + } else { + glDisable(GL_DEPTH_TEST); + } + + if (mDitherEnable) { + glEnable(GL_DITHER); + } else { + glDisable(GL_DITHER); + } } + void ProgramFragmentStore::setDitherEnable(bool enable) { mDitherEnable = enable; @@ -215,7 +249,7 @@ ProgramFragmentStoreState::~ProgramFragmentStoreState() void ProgramFragmentStoreState::init(Context *rsc, int32_t w, int32_t h) { - ProgramFragmentStore *pfs = new ProgramFragmentStore(rsc, NULL, NULL); + ProgramFragmentStore *pfs = new ProgramFragmentStore(rsc); mDefault.set(pfs); } @@ -232,7 +266,7 @@ namespace renderscript { void rsi_ProgramFragmentStoreBegin(Context * rsc, RsElement in, RsElement out) { delete rsc->mStateFragmentStore.mPFS; - rsc->mStateFragmentStore.mPFS = new ProgramFragmentStore(rsc, (Element *)in, (Element *)out); + rsc->mStateFragmentStore.mPFS = new ProgramFragmentStore(rsc); } |