diff options
Diffstat (limited to 'graphics/java')
4 files changed, 17 insertions, 20 deletions
diff --git a/graphics/java/android/renderscript/Program.java b/graphics/java/android/renderscript/Program.java index c6ed72a..ffcdbbc 100644 --- a/graphics/java/android/renderscript/Program.java +++ b/graphics/java/android/renderscript/Program.java @@ -154,6 +154,13 @@ public class Program extends BaseObj { mOutputs[mOutputCount++] = e; } + void resetConstant() { + mConstantCount = 0; + for(int i = 0; i < MAX_CONSTANT; i ++) { + mConstants[i] = null; + } + } + public int addConstant(Type t) throws IllegalStateException { // Should check for consistant and non-conflicting names... if(mConstantCount >= MAX_CONSTANT) { @@ -165,7 +172,7 @@ public class Program extends BaseObj { public BaseProgramBuilder setTextureCount(int count) throws IllegalArgumentException { // Should check for consistant and non-conflicting names... - if(count >= MAX_CONSTANT) { + if(count >= MAX_TEXTURE) { throw new IllegalArgumentException("Max texture count exceeded."); } mTextureCount = count; diff --git a/graphics/java/android/renderscript/ProgramFragment.java b/graphics/java/android/renderscript/ProgramFragment.java index 00c5cf1..c1d6428 100644 --- a/graphics/java/android/renderscript/ProgramFragment.java +++ b/graphics/java/android/renderscript/ProgramFragment.java @@ -55,7 +55,7 @@ public class ProgramFragment extends Program { tmp[idx++] = 3; tmp[idx++] = mTextureCount; - int id = mRS.nProgramFragmentCreate2(mShader, tmp); + int id = mRS.nProgramFragmentCreate(mShader, tmp); ProgramFragment pf = new ProgramFragment(id, mRS); initProgram(pf); return pf; @@ -199,6 +199,7 @@ public class ProgramFragment extends Program { mNumTextures ++; } } + resetConstant(); buildShaderString(); Type constType = null; if (!mVaryingColorEnable) { diff --git a/graphics/java/android/renderscript/ProgramVertex.java b/graphics/java/android/renderscript/ProgramVertex.java index 119db69..63e2598 100644 --- a/graphics/java/android/renderscript/ProgramVertex.java +++ b/graphics/java/android/renderscript/ProgramVertex.java @@ -64,7 +64,7 @@ public class ProgramVertex extends Program { tmp[idx++] = 3; tmp[idx++] = mTextureCount; - int id = mRS.nProgramVertexCreate2(mShader, tmp); + int id = mRS.nProgramVertexCreate(mShader, tmp); ProgramVertex pv = new ProgramVertex(id, mRS); initProgram(pv); return pv; diff --git a/graphics/java/android/renderscript/RenderScript.java b/graphics/java/android/renderscript/RenderScript.java index 159e070..2aa3e84 100644 --- a/graphics/java/android/renderscript/RenderScript.java +++ b/graphics/java/android/renderscript/RenderScript.java @@ -447,25 +447,14 @@ public class RenderScript { synchronized void nProgramBindSampler(int vpf, int slot, int s) { rsnProgramBindSampler(mContext, vpf, slot, s); } - - native int rsnProgramFragmentCreate(int con, int[] params); - synchronized int nProgramFragmentCreate(int[] params) { - return rsnProgramFragmentCreate(mContext, params); - } - native int rsnProgramFragmentCreate2(int con, String shader, int[] params); - synchronized int nProgramFragmentCreate2(String shader, int[] params) { - return rsnProgramFragmentCreate2(mContext, shader, params); + native int rsnProgramFragmentCreate(int con, String shader, int[] params); + synchronized int nProgramFragmentCreate(String shader, int[] params) { + return rsnProgramFragmentCreate(mContext, shader, params); } - - native int rsnProgramVertexCreate(int con, boolean texMat); - synchronized int nProgramVertexCreate(boolean texMat) { - return rsnProgramVertexCreate(mContext, texMat); + native int rsnProgramVertexCreate(int con, String shader, int[] params); + synchronized int nProgramVertexCreate(String shader, int[] params) { + return rsnProgramVertexCreate(mContext, shader, params); } - native int rsnProgramVertexCreate2(int con, String shader, int[] params); - synchronized int nProgramVertexCreate2(String shader, int[] params) { - return rsnProgramVertexCreate2(mContext, shader, params); - } - native int rsnMeshCreate(int con, int vtxCount, int indexCount); synchronized int nMeshCreate(int vtxCount, int indexCount) { |