FillTestpublic class FillTest extends Object implements RsBenchBaseTest
Fields Summary |
---|
private static final String | TAG | private RenderScriptGL | mRS | private android.content.res.Resources | mRes | private ProgramFragment | mProgFragmentMultitex | private ProgramFragment | mProgFragmentSingletex | private ProgramFragment | mProgFragmentSingletexModulate | private final BitmapFactory.Options | mOptionsARGB | int | mBenchmarkDimX | int | mBenchmarkDimY | private ScriptC_fill_test | mFillScript | ScriptField_TestScripts_s.Item[] | mTests | ScriptField_FillTestFragData_s | mFragData | private final String[] | mNames |
Constructors Summary |
---|
public FillTest()
mOptionsARGB.inScaled = false;
mOptionsARGB.inPreferredConfig = Bitmap.Config.ARGB_8888;
mBenchmarkDimX = 1280;
mBenchmarkDimY = 720;
|
Methods Summary |
---|
void | addTest(int index, int testId, int blend, int quadCount)
mTests[index] = new ScriptField_TestScripts_s.Item();
mTests[index].testScript = mFillScript;
mTests[index].testName = Allocation.createFromString(mRS,
mNames[index],
Allocation.USAGE_SCRIPT);
mTests[index].debugName = RsBenchRS.createZeroTerminatedAlloc(mRS,
mNames[index],
Allocation.USAGE_SCRIPT);
ScriptField_FillTestData_s.Item dataItem = new ScriptField_FillTestData_s.Item();
dataItem.testId = testId;
dataItem.blend = blend;
dataItem.quadCount = quadCount;
ScriptField_FillTestData_s testData = new ScriptField_FillTestData_s(mRS, 1);
testData.set(dataItem, 0, true);
mTests[index].testData = testData.getAllocation();
| public java.lang.String[] | getTestNames()
return mNames;
| public ScriptField_TestScripts_s.Item[] | getTests()
return mTests;
| public boolean | init(RenderScriptGL rs, android.content.res.Resources res)
mRS = rs;
mRes = res;
initCustomShaders();
initFillScript();
mTests = new ScriptField_TestScripts_s.Item[mNames.length];
int index = 0;
addTest(index++, 1 /*testId*/, 0 /*blend*/, 10 /*quadCount*/);
addTest(index++, 0 /*testId*/, 0 /*blend*/, 10 /*quadCount*/);
addTest(index++, 1 /*testId*/, 1 /*blend*/, 10 /*quadCount*/);
addTest(index++, 0 /*testId*/, 1 /*blend*/, 10 /*quadCount*/);
addTest(index++, 2 /*testId*/, 1 /*blend*/, 3 /*quadCount*/);
addTest(index++, 2 /*testId*/, 1 /*blend*/, 1 /*quadCount*/);
return true;
| private void | initCustomShaders()
ProgramFragment.Builder pfbCustom = new ProgramFragment.Builder(mRS);
pfbCustom.setShader(mRes, R.raw.multitexf);
for (int texCount = 0; texCount < 3; texCount ++) {
pfbCustom.addTexture(Program.TextureType.TEXTURE_2D);
}
mProgFragmentMultitex = pfbCustom.create();
pfbCustom = new ProgramFragment.Builder(mRS);
pfbCustom.setShader(mRes, R.raw.singletexf);
pfbCustom.addTexture(Program.TextureType.TEXTURE_2D);
mProgFragmentSingletex = pfbCustom.create();
pfbCustom = new ProgramFragment.Builder(mRS);
pfbCustom.setShader(mRes, R.raw.singletexfm);
pfbCustom.addTexture(Program.TextureType.TEXTURE_2D);
mFragData = new ScriptField_FillTestFragData_s(mRS, 1);
pfbCustom.addConstant(mFragData.getType());
mProgFragmentSingletexModulate = pfbCustom.create();
mProgFragmentSingletexModulate.bindConstants(mFragData.getAllocation(), 0);
| void | initFillScript()
mFillScript = new ScriptC_fill_test(mRS, mRes, R.raw.fill_test);
ProgramVertexFixedFunction.Builder pvb = new ProgramVertexFixedFunction.Builder(mRS);
ProgramVertexFixedFunction progVertex = pvb.create();
ProgramVertexFixedFunction.Constants PVA = new ProgramVertexFixedFunction.Constants(mRS);
((ProgramVertexFixedFunction)progVertex).bindConstants(PVA);
Matrix4f proj = new Matrix4f();
proj.loadOrthoWindow(mBenchmarkDimX, mBenchmarkDimY);
PVA.setProjection(proj);
mFillScript.set_gProgVertex(progVertex);
mFillScript.set_gProgFragmentTexture(mProgFragmentSingletex);
mFillScript.set_gProgFragmentTextureModulate(mProgFragmentSingletexModulate);
mFillScript.set_gProgFragmentMultitex(mProgFragmentMultitex);
mFillScript.set_gProgStoreBlendNone(ProgramStore.BLEND_NONE_DEPTH_NONE(mRS));
mFillScript.set_gProgStoreBlendAlpha(ProgramStore.BLEND_ALPHA_DEPTH_NONE(mRS));
mFillScript.set_gLinearClamp(Sampler.CLAMP_LINEAR(mRS));
mFillScript.set_gLinearWrap(Sampler.WRAP_LINEAR(mRS));
mFillScript.set_gTexTorus(loadTextureRGB(R.drawable.torusmap));
mFillScript.set_gTexOpaque(loadTextureRGB(R.drawable.data));
mFillScript.set_gTexTransparent(loadTextureARGB(R.drawable.leaf));
mFillScript.set_gTexChecker(loadTextureRGB(R.drawable.checker));
mFillScript.bind_gFragData(mFragData);
| private Allocation | loadTextureARGB(int id)
Bitmap b = BitmapFactory.decodeResource(mRes, id, mOptionsARGB);
return Allocation.createFromBitmap(mRS, b,
Allocation.MipmapControl.MIPMAP_ON_SYNC_TO_TEXTURE,
Allocation.USAGE_GRAPHICS_TEXTURE);
| private Allocation | loadTextureRGB(int id)
return Allocation.createFromBitmapResource(mRS, mRes, id,
Allocation.MipmapControl.MIPMAP_ON_SYNC_TO_TEXTURE,
Allocation.USAGE_GRAPHICS_TEXTURE);
|
|