Continue es2 shader dev

Conflicts:

	graphics/java/android/renderscript/Program.java
	graphics/java/android/renderscript/ProgramVertex.java
This commit is contained in:
Jason Sams
2009-12-15 13:27:04 -08:00
parent b686ec7044
commit 7e5ab3b177
11 changed files with 158 additions and 60 deletions

View File

@@ -29,10 +29,12 @@ public class Program extends BaseObj {
public static final int MAX_INPUT = 8;
public static final int MAX_OUTPUT = 8;
public static final int MAX_CONSTANT = 8;
public static final int MAX_TEXTURE = 8;
Element mInputs[];
Element mOutputs[];
Type mConstants[];
int mTextureCount;
String mShader;
Program(int id, RenderScript rs) {
@@ -65,6 +67,7 @@ public class Program extends BaseObj {
mInputCount = 0;
mOutputCount = 0;
mConstantCount = 0;
mTextureCount = 0;
}
public void setShader(String s) {
@@ -95,12 +98,12 @@ public class Program extends BaseObj {
mConstants[mConstantCount++] = t;
}
public void addTexture(Type t) throws IllegalStateException {
public void setTextureCount(int count) throws IllegalArgumentException {
// Should check for consistant and non-conflicting names...
if(mTextureCount >= MAX_CONSTANT) {
throw new IllegalArgumentException("Max input count exceeded.");
if(count >= MAX_CONSTANT) {
throw new IllegalArgumentException("Max texture count exceeded.");
}
mTextures[mTextureCount++] = t;
mTextureCount = count;
}
protected void initProgram(Program p) {
@@ -110,8 +113,7 @@ public class Program extends BaseObj {
System.arraycopy(mOutputs, 0, p.mOutputs, 0, mOutputCount);
p.mConstants = new Type[mConstantCount];
System.arraycopy(mConstants, 0, p.mConstants, 0, mConstantCount);
p.mTextures = new Type[mTextureCount];
System.arraycopy(mTextures, 0, p.mTextures, 0, mTextureCount);
p.mTextureCount = mTextureCount;
}
}