Loading graphics/java/android/renderscript/Allocation.java +0 −2 Original line number Diff line number Diff line Loading @@ -45,13 +45,11 @@ public class Allocation extends BaseObj { public void uploadToTexture(int baseMipLevel) { mRS.validate(); mRS.validateSurface(); mRS.nAllocationUploadToTexture(mID, baseMipLevel); } public void uploadToBufferObject() { mRS.validate(); mRS.validateSurface(); mRS.nAllocationUploadToBufferObject(mID); } Loading graphics/java/android/renderscript/RenderScript.java +11 −6 Original line number Diff line number Diff line Loading @@ -246,13 +246,8 @@ public class RenderScript { } } void validateSurface() { //if (mSurface == null) { //throw new IllegalStateException("Uploading data to GL with no surface."); //} } public void contextSetPriority(Priority p) { validate(); nContextSetPriority(p.mID); } Loading Loading @@ -312,14 +307,17 @@ public class RenderScript { mSurface = sur; mWidth = w; mHeight = h; validate(); nContextSetSurface(w, h, mSurface); } public void contextDump(int bits) { validate(); nContextDump(bits); } public void destroy() { validate(); nContextDeinitToClient(); mMessageThread.mRun = false; Loading @@ -335,10 +333,12 @@ public class RenderScript { } void pause() { validate(); nContextPause(); } void resume() { validate(); nContextResume(); } Loading Loading @@ -379,22 +379,27 @@ public class RenderScript { } public void contextBindRootScript(Script s) { validate(); nContextBindRootScript(safeID(s)); } public void contextBindProgramFragmentStore(ProgramStore p) { validate(); nContextBindProgramFragmentStore(safeID(p)); } public void contextBindProgramFragment(ProgramFragment p) { validate(); nContextBindProgramFragment(safeID(p)); } public void contextBindProgramRaster(ProgramRaster p) { validate(); nContextBindProgramRaster(safeID(p)); } public void contextBindProgramVertex(ProgramVertex p) { validate(); nContextBindProgramVertex(safeID(p)); } Loading libs/rs/rsProgramFragment.cpp +7 −4 Original line number Diff line number Diff line Loading @@ -109,7 +109,7 @@ void ProgramFragment::setupGL(const Context *rsc, ProgramFragmentState *state) } if (mSamplers[ct].get()) { mSamplers[ct]->setupGL(); mSamplers[ct]->setupGL(rsc); } else { glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); Loading Loading @@ -141,32 +141,35 @@ void ProgramFragment::setupGL(const Context *rsc, ProgramFragmentState *state) void ProgramFragment::setupGL2(const Context *rsc, ProgramFragmentState *state, ShaderCache *sc) { //LOGE("sgl2 frag1 %x", glGetError()); if ((state->mLast.get() == this) && !mDirty) { //return; } state->mLast.set(this); rsc->checkError("ProgramFragment::setupGL2 start"); for (uint32_t ct=0; ct < MAX_TEXTURE; ct++) { glActiveTexture(GL_TEXTURE0 + ct); if (!(mTextureEnableMask & (1 << ct)) || !mTextures[ct].get()) { glDisable(GL_TEXTURE_2D); continue; } mTextures[ct]->uploadCheck(rsc); glBindTexture(GL_TEXTURE_2D, mTextures[ct]->getTextureID()); rsc->checkError("ProgramFragment::setupGL2 tex bind"); if (mSamplers[ct].get()) { mSamplers[ct]->setupGL(); mSamplers[ct]->setupGL(rsc); } else { glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); rsc->checkError("ProgramFragment::setupGL2 tex env"); } glEnable(GL_TEXTURE_2D); glUniform1i(sc->fragUniformSlot(ct), ct); rsc->checkError("ProgramFragment::setupGL2 uniforms"); } glActiveTexture(GL_TEXTURE0); Loading libs/rs/rsProgramVertex.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -204,6 +204,7 @@ void ProgramVertex::setupGL2(const Context *rsc, ProgramVertexState *state, Shad //return; } rsc->checkError("ProgramVertex::setupGL2 start"); glVertexAttrib4f(1, state->color[0], state->color[1], state->color[2], state->color[3]); const float *f = static_cast<const float *>(mConstants[0]->getPtr()); Loading @@ -220,6 +221,7 @@ void ProgramVertex::setupGL2(const Context *rsc, ProgramVertexState *state, Shad &f[RS_PROGRAM_VERTEX_TEXTURE_OFFSET]); } rsc->checkError("ProgramVertex::setupGL2 begin uniforms"); uint32_t uidx = 1; for (uint32_t ct=0; ct < mConstantCount; ct++) { Allocation *alloc = mConstants[ct+1].get(); Loading libs/rs/rsSampler.cpp +5 −4 Original line number Diff line number Diff line Loading @@ -53,7 +53,7 @@ Sampler::~Sampler() { } void Sampler::setupGL() void Sampler::setupGL(const Context *rsc) { GLenum trans[] = { GL_NEAREST, //RS_SAMPLER_NEAREST, Loading @@ -69,6 +69,7 @@ void Sampler::setupGL() glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, trans[mWrapS]); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, trans[mWrapT]); rsc->checkError("ProgramFragment::setupGL2 tex env"); } void Sampler::bindToContext(SamplerState *ss, uint32_t slot) Loading @@ -83,18 +84,18 @@ void Sampler::unbindFromContext(SamplerState *ss) mBoundSlot = -1; ss->mSamplers[slot].clear(); } /* void SamplerState::setupGL() { for (uint32_t ct=0; ct < RS_MAX_SAMPLER_SLOT; ct++) { Sampler *s = mSamplers[ct].get(); if (s) { s->setupGL(); s->setupGL(rsc); } else { glBindTexture(GL_TEXTURE_2D, 0); } } } }*/ //////////////////////////////// Loading Loading
graphics/java/android/renderscript/Allocation.java +0 −2 Original line number Diff line number Diff line Loading @@ -45,13 +45,11 @@ public class Allocation extends BaseObj { public void uploadToTexture(int baseMipLevel) { mRS.validate(); mRS.validateSurface(); mRS.nAllocationUploadToTexture(mID, baseMipLevel); } public void uploadToBufferObject() { mRS.validate(); mRS.validateSurface(); mRS.nAllocationUploadToBufferObject(mID); } Loading
graphics/java/android/renderscript/RenderScript.java +11 −6 Original line number Diff line number Diff line Loading @@ -246,13 +246,8 @@ public class RenderScript { } } void validateSurface() { //if (mSurface == null) { //throw new IllegalStateException("Uploading data to GL with no surface."); //} } public void contextSetPriority(Priority p) { validate(); nContextSetPriority(p.mID); } Loading Loading @@ -312,14 +307,17 @@ public class RenderScript { mSurface = sur; mWidth = w; mHeight = h; validate(); nContextSetSurface(w, h, mSurface); } public void contextDump(int bits) { validate(); nContextDump(bits); } public void destroy() { validate(); nContextDeinitToClient(); mMessageThread.mRun = false; Loading @@ -335,10 +333,12 @@ public class RenderScript { } void pause() { validate(); nContextPause(); } void resume() { validate(); nContextResume(); } Loading Loading @@ -379,22 +379,27 @@ public class RenderScript { } public void contextBindRootScript(Script s) { validate(); nContextBindRootScript(safeID(s)); } public void contextBindProgramFragmentStore(ProgramStore p) { validate(); nContextBindProgramFragmentStore(safeID(p)); } public void contextBindProgramFragment(ProgramFragment p) { validate(); nContextBindProgramFragment(safeID(p)); } public void contextBindProgramRaster(ProgramRaster p) { validate(); nContextBindProgramRaster(safeID(p)); } public void contextBindProgramVertex(ProgramVertex p) { validate(); nContextBindProgramVertex(safeID(p)); } Loading
libs/rs/rsProgramFragment.cpp +7 −4 Original line number Diff line number Diff line Loading @@ -109,7 +109,7 @@ void ProgramFragment::setupGL(const Context *rsc, ProgramFragmentState *state) } if (mSamplers[ct].get()) { mSamplers[ct]->setupGL(); mSamplers[ct]->setupGL(rsc); } else { glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); Loading Loading @@ -141,32 +141,35 @@ void ProgramFragment::setupGL(const Context *rsc, ProgramFragmentState *state) void ProgramFragment::setupGL2(const Context *rsc, ProgramFragmentState *state, ShaderCache *sc) { //LOGE("sgl2 frag1 %x", glGetError()); if ((state->mLast.get() == this) && !mDirty) { //return; } state->mLast.set(this); rsc->checkError("ProgramFragment::setupGL2 start"); for (uint32_t ct=0; ct < MAX_TEXTURE; ct++) { glActiveTexture(GL_TEXTURE0 + ct); if (!(mTextureEnableMask & (1 << ct)) || !mTextures[ct].get()) { glDisable(GL_TEXTURE_2D); continue; } mTextures[ct]->uploadCheck(rsc); glBindTexture(GL_TEXTURE_2D, mTextures[ct]->getTextureID()); rsc->checkError("ProgramFragment::setupGL2 tex bind"); if (mSamplers[ct].get()) { mSamplers[ct]->setupGL(); mSamplers[ct]->setupGL(rsc); } else { glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); rsc->checkError("ProgramFragment::setupGL2 tex env"); } glEnable(GL_TEXTURE_2D); glUniform1i(sc->fragUniformSlot(ct), ct); rsc->checkError("ProgramFragment::setupGL2 uniforms"); } glActiveTexture(GL_TEXTURE0); Loading
libs/rs/rsProgramVertex.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -204,6 +204,7 @@ void ProgramVertex::setupGL2(const Context *rsc, ProgramVertexState *state, Shad //return; } rsc->checkError("ProgramVertex::setupGL2 start"); glVertexAttrib4f(1, state->color[0], state->color[1], state->color[2], state->color[3]); const float *f = static_cast<const float *>(mConstants[0]->getPtr()); Loading @@ -220,6 +221,7 @@ void ProgramVertex::setupGL2(const Context *rsc, ProgramVertexState *state, Shad &f[RS_PROGRAM_VERTEX_TEXTURE_OFFSET]); } rsc->checkError("ProgramVertex::setupGL2 begin uniforms"); uint32_t uidx = 1; for (uint32_t ct=0; ct < mConstantCount; ct++) { Allocation *alloc = mConstants[ct+1].get(); Loading
libs/rs/rsSampler.cpp +5 −4 Original line number Diff line number Diff line Loading @@ -53,7 +53,7 @@ Sampler::~Sampler() { } void Sampler::setupGL() void Sampler::setupGL(const Context *rsc) { GLenum trans[] = { GL_NEAREST, //RS_SAMPLER_NEAREST, Loading @@ -69,6 +69,7 @@ void Sampler::setupGL() glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, trans[mWrapS]); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, trans[mWrapT]); rsc->checkError("ProgramFragment::setupGL2 tex env"); } void Sampler::bindToContext(SamplerState *ss, uint32_t slot) Loading @@ -83,18 +84,18 @@ void Sampler::unbindFromContext(SamplerState *ss) mBoundSlot = -1; ss->mSamplers[slot].clear(); } /* void SamplerState::setupGL() { for (uint32_t ct=0; ct < RS_MAX_SAMPLER_SLOT; ct++) { Sampler *s = mSamplers[ct].get(); if (s) { s->setupGL(); s->setupGL(rsc); } else { glBindTexture(GL_TEXTURE_2D, 0); } } } }*/ //////////////////////////////// Loading