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