Renderscript samples.
Resolving name conflict in model viewer.
Adding fov projection matrix function.
Adding helper methods for blending.

Change-Id: Ibd3f1510436811398787c285845d050158bd6de8
diff --git a/graphics/java/android/renderscript/ProgramStore.java b/graphics/java/android/renderscript/ProgramStore.java
index cce4064..e249842 100644
--- a/graphics/java/android/renderscript/ProgramStore.java
+++ b/graphics/java/android/renderscript/ProgramStore.java
@@ -79,7 +79,140 @@
         super(id, rs);
     }
 
+    public static ProgramStore BlendNone_DepthTest(RenderScript rs) {
+        if(rs.mProgramStore_BlendNone_DepthTest == null) {
+            ProgramStore.Builder builder = new ProgramStore.Builder(rs);
+            builder.setDepthFunc(ProgramStore.DepthFunc.LESS);
+            builder.setBlendFunc(BlendSrcFunc.ONE, BlendDstFunc.ZERO);
+            builder.setDitherEnable(false);
+            builder.setDepthMask(true);
+            rs.mProgramStore_BlendNone_DepthTest = builder.create();
+        }
+        return rs.mProgramStore_BlendNone_DepthTest;
+    }
+    public static ProgramStore BlendNone_DepthNoDepth(RenderScript rs) {
+        if(rs.mProgramStore_BlendNone_DepthNoDepth == null) {
+            ProgramStore.Builder builder = new ProgramStore.Builder(rs);
+            builder.setDepthFunc(ProgramStore.DepthFunc.ALWAYS);
+            builder.setBlendFunc(BlendSrcFunc.ONE, BlendDstFunc.ZERO);
+            builder.setDitherEnable(false);
+            builder.setDepthMask(false);
+            rs.mProgramStore_BlendNone_DepthNoDepth = builder.create();
+        }
+        return rs.mProgramStore_BlendNone_DepthNoDepth;
+    }
+    public static ProgramStore BlendNone_DepthNoTest(RenderScript rs) {
+        if(rs.mProgramStore_BlendNone_DepthNoTest == null) {
+            ProgramStore.Builder builder = new ProgramStore.Builder(rs);
+            builder.setDepthFunc(ProgramStore.DepthFunc.ALWAYS);
+            builder.setBlendFunc(BlendSrcFunc.ONE, BlendDstFunc.ZERO);
+            builder.setDitherEnable(false);
+            builder.setDepthMask(true);
+            rs.mProgramStore_BlendNone_DepthNoTest = builder.create();
+        }
+        return rs.mProgramStore_BlendNone_DepthNoTest;
+    }
+    public static ProgramStore BlendNone_DepthNoWrite(RenderScript rs) {
+        if(rs.mProgramStore_BlendNone_DepthNoWrite == null) {
+            ProgramStore.Builder builder = new ProgramStore.Builder(rs);
+            builder.setDepthFunc(ProgramStore.DepthFunc.LESS);
+            builder.setBlendFunc(BlendSrcFunc.ONE, BlendDstFunc.ZERO);
+            builder.setDitherEnable(false);
+            builder.setDepthMask(false);
+            rs.mProgramStore_BlendNone_DepthNoWrite = builder.create();
+        }
+        return rs.mProgramStore_BlendNone_DepthNoWrite;
+    }
 
+    public static ProgramStore BlendAlpha_DepthTest(RenderScript rs) {
+        if(rs.mProgramStore_BlendAlpha_DepthTest == null) {
+            ProgramStore.Builder builder = new ProgramStore.Builder(rs);
+            builder.setDepthFunc(ProgramStore.DepthFunc.LESS);
+            builder.setBlendFunc(BlendSrcFunc.SRC_ALPHA, BlendDstFunc.ONE_MINUS_SRC_ALPHA);
+            builder.setDitherEnable(false);
+            builder.setDepthMask(true);
+            rs.mProgramStore_BlendAlpha_DepthTest = builder.create();
+        }
+        return rs.mProgramStore_BlendAlpha_DepthTest;
+    }
+    public static ProgramStore BlendAlpha_DepthNoDepth(RenderScript rs) {
+        if(rs.mProgramStore_BlendAlpha_DepthNoDepth == null) {
+            ProgramStore.Builder builder = new ProgramStore.Builder(rs);
+            builder.setDepthFunc(ProgramStore.DepthFunc.ALWAYS);
+            builder.setBlendFunc(BlendSrcFunc.SRC_ALPHA, BlendDstFunc.ONE_MINUS_SRC_ALPHA);
+            builder.setDitherEnable(false);
+            builder.setDepthMask(false);
+            rs.mProgramStore_BlendAlpha_DepthNoDepth = builder.create();
+        }
+        return rs.mProgramStore_BlendAlpha_DepthNoDepth;
+    }
+    public static ProgramStore BlendAlpha_DepthNoTest(RenderScript rs) {
+        if(rs.mProgramStore_BlendAlpha_DepthNoTest == null) {
+            ProgramStore.Builder builder = new ProgramStore.Builder(rs);
+            builder.setDepthFunc(ProgramStore.DepthFunc.ALWAYS);
+            builder.setBlendFunc(BlendSrcFunc.SRC_ALPHA, BlendDstFunc.ONE_MINUS_SRC_ALPHA);
+            builder.setDitherEnable(false);
+            builder.setDepthMask(true);
+            rs.mProgramStore_BlendAlpha_DepthNoTest = builder.create();
+        }
+        return rs.mProgramStore_BlendAlpha_DepthNoTest;
+    }
+    public static ProgramStore BlendAlpha_DepthNoWrite(RenderScript rs) {
+        if(rs.mProgramStore_BlendAlpha_DepthNoWrite == null) {
+            ProgramStore.Builder builder = new ProgramStore.Builder(rs);
+            builder.setDepthFunc(ProgramStore.DepthFunc.LESS);
+            builder.setBlendFunc(BlendSrcFunc.SRC_ALPHA, BlendDstFunc.ONE_MINUS_SRC_ALPHA);
+            builder.setDitherEnable(false);
+            builder.setDepthMask(false);
+            rs.mProgramStore_BlendAlpha_DepthNoWrite = builder.create();
+        }
+        return rs.mProgramStore_BlendAlpha_DepthNoWrite;
+    }
+
+    public static ProgramStore BlendAdd_DepthTest(RenderScript rs) {
+        if(rs.mProgramStore_BlendAdd_DepthTest == null) {
+            ProgramStore.Builder builder = new ProgramStore.Builder(rs);
+            builder.setDepthFunc(ProgramStore.DepthFunc.LESS);
+            builder.setBlendFunc(BlendSrcFunc.ONE, BlendDstFunc.ONE);
+            builder.setDitherEnable(false);
+            builder.setDepthMask(true);
+            rs.mProgramStore_BlendAdd_DepthTest = builder.create();
+        }
+        return rs.mProgramStore_BlendAdd_DepthTest;
+    }
+    public static ProgramStore BlendAdd_DepthNoDepth(RenderScript rs) {
+        if(rs.mProgramStore_BlendAdd_DepthNoDepth == null) {
+            ProgramStore.Builder builder = new ProgramStore.Builder(rs);
+            builder.setDepthFunc(ProgramStore.DepthFunc.ALWAYS);
+            builder.setBlendFunc(BlendSrcFunc.ONE, BlendDstFunc.ONE);
+            builder.setDitherEnable(false);
+            builder.setDepthMask(false);
+            rs.mProgramStore_BlendAdd_DepthNoDepth = builder.create();
+        }
+        return rs.mProgramStore_BlendAdd_DepthNoDepth;
+    }
+    public static ProgramStore BlendAdd_DepthNoTest(RenderScript rs) {
+        if(rs.mProgramStore_BlendAdd_DepthNoTest == null) {
+            ProgramStore.Builder builder = new ProgramStore.Builder(rs);
+            builder.setDepthFunc(ProgramStore.DepthFunc.ALWAYS);
+            builder.setBlendFunc(BlendSrcFunc.ONE, BlendDstFunc.ONE);
+            builder.setDitherEnable(false);
+            builder.setDepthMask(true);
+            rs.mProgramStore_BlendAdd_DepthNoDepth = builder.create();
+        }
+        return rs.mProgramStore_BlendAdd_DepthNoTest;
+    }
+    public static ProgramStore BlendAdd_DepthNoWrite(RenderScript rs) {
+        if(rs.mProgramStore_BlendAdd_DepthNoWrite == null) {
+            ProgramStore.Builder builder = new ProgramStore.Builder(rs);
+            builder.setDepthFunc(ProgramStore.DepthFunc.ALWAYS);
+            builder.setBlendFunc(BlendSrcFunc.ONE, BlendDstFunc.ONE);
+            builder.setDitherEnable(false);
+            builder.setDepthMask(false);
+            rs.mProgramStore_BlendAdd_DepthNoWrite = builder.create();
+        }
+        return rs.mProgramStore_BlendAdd_DepthNoWrite;
+    }
 
     public static class Builder {
         RenderScript mRS;
@@ -109,8 +242,20 @@
             mColorMaskA = true;
             mBlendSrc = BlendSrcFunc.ONE;
             mBlendDst = BlendDstFunc.ZERO;
+        }
 
-
+        public Builder(RenderScript rs) {
+            mRS = rs;
+            mIn = null;
+            mOut = null;
+            mDepthFunc = DepthFunc.ALWAYS;
+            mDepthMask = false;
+            mColorMaskR = true;
+            mColorMaskG = true;
+            mColorMaskB = true;
+            mColorMaskA = true;
+            mBlendSrc = BlendSrcFunc.ONE;
+            mBlendDst = BlendDstFunc.ZERO;
         }
 
         public Builder setDepthFunc(DepthFunc func) {
diff --git a/graphics/java/android/renderscript/ProgramVertex.java b/graphics/java/android/renderscript/ProgramVertex.java
index ec377e2..c99efd6 100644
--- a/graphics/java/android/renderscript/ProgramVertex.java
+++ b/graphics/java/android/renderscript/ProgramVertex.java
@@ -46,6 +46,9 @@
         public Builder(RenderScript rs, Element in, Element out) {
             mRS = rs;
         }
+        public Builder(RenderScript rs) {
+            mRS = rs;
+        }
 
         public Builder setTextureMatrixEnable(boolean enable) {
             mTextureMatrixEnable = enable;
diff --git a/graphics/java/android/renderscript/RenderScript.java b/graphics/java/android/renderscript/RenderScript.java
index d82e524..37c01f5 100644
--- a/graphics/java/android/renderscript/RenderScript.java
+++ b/graphics/java/android/renderscript/RenderScript.java
@@ -549,6 +549,20 @@
     Sampler mSampler_WRAP_LINEAR;
     Sampler mSampler_WRAP_LINEAR_MIP_LINEAR;
 
+    ProgramStore mProgramStore_BlendNone_DepthTest;
+    ProgramStore mProgramStore_BlendNone_DepthNoDepth;
+    ProgramStore mProgramStore_BlendNone_DepthNoTest;
+    ProgramStore mProgramStore_BlendNone_DepthNoWrite;
+    ProgramStore mProgramStore_BlendAlpha_DepthTest;
+    ProgramStore mProgramStore_BlendAlpha_DepthNoDepth;
+    ProgramStore mProgramStore_BlendAlpha_DepthNoTest;
+    ProgramStore mProgramStore_BlendAlpha_DepthNoWrite;
+    ProgramStore mProgramStore_BlendAdd_DepthTest;
+    ProgramStore mProgramStore_BlendAdd_DepthNoDepth;
+    ProgramStore mProgramStore_BlendAdd_DepthNoTest;
+    ProgramStore mProgramStore_BlendAdd_DepthNoWrite;
+
+
     ///////////////////////////////////////////////////////////////////////////////////
     //
 
diff --git a/graphics/java/android/renderscript/Sampler.java b/graphics/java/android/renderscript/Sampler.java
index 60c6cf4..ccd46bd 100644
--- a/graphics/java/android/renderscript/Sampler.java
+++ b/graphics/java/android/renderscript/Sampler.java
@@ -50,13 +50,6 @@
         super(id, rs);
     }
 
-    Sampler mSampler_CLAMP_NEAREST;
-    Sampler mSampler_CLAMP_LINEAR;
-    Sampler mSampler_CLAMP_LINEAR_MIP;
-    Sampler mSampler_WRAP_NEAREST;
-    Sampler mSampler_WRAP_LINEAR;
-    Sampler mSampler_WRAP_LINEAR_MIP;
-
     public static Sampler CLAMP_NEAREST(RenderScript rs) {
         if(rs.mSampler_CLAMP_NEAREST == null) {
             Builder b = new Builder(rs);