Merge change 5039

* changes:
  Fix 3 bugs in fountain test.  Correctly generate the last mip level of a non-square mip chain.  Default the background to not blended and disable dither/depth.
This commit is contained in:
Android (Google) Code Review
2009-06-22 18:20:00 -07:00
3 changed files with 20 additions and 9 deletions

View File

@@ -3,7 +3,7 @@
#pragma version(1)
#pragma stateVertex(default)
#pragma stateFragment(PgmFragBackground)
#pragma stateFragmentStore(parent)
#pragma stateFragmentStore(PFSReplace)
int main(int launchID) {
@@ -36,6 +36,7 @@ int main(int launchID) {
drawRect(0, 256, 0, 512);
contextBindProgramFragment(NAMED_PgmFragParts);
contextBindProgramFragmentStore(NAMED_PFSBlend);
if (touch) {
newPart = loadI32(2, 0);

View File

@@ -56,6 +56,7 @@ public class FountainRS {
private RenderScript.Allocation mVertAlloc;
private RenderScript.Script mScript;
private RenderScript.ProgramFragmentStore mPFS;
private RenderScript.ProgramFragmentStore mPFS2;
private RenderScript.ProgramFragment mPF;
private RenderScript.ProgramFragment mPF2;
private RenderScript.Allocation mTexture;
@@ -79,20 +80,29 @@ public class FountainRS {
Bitmap b = bd.getBitmap();
mTexture = mRS.allocationCreateFromBitmap(b,
RenderScript.ElementPredefined.RGB_565,
true);
false);
mTexture.uploadToTexture(0);
}
mRS.programFragmentStoreBegin(null, null);
mRS.programFragmentStoreBlendFunc(RenderScript.BlendSrcFunc.SRC_ALPHA, RenderScript.BlendDstFunc.ONE);
mRS.programFragmentStoreDepthFunc(RenderScript.DepthFunc.ALWAYS);
mRS.programFragmentStoreDepthMask(false);
mRS.programFragmentStoreDitherEnable(false);
mPFS = mRS.programFragmentStoreCreate();
mPFS.setName("MyBlend");
mRS.contextBindProgramFragmentStore(mPFS);
mPFS.setName("PFSBlend");
mRS.programFragmentStoreBegin(null, null);
mRS.programFragmentStoreDepthFunc(RenderScript.DepthFunc.ALWAYS);
mRS.programFragmentStoreDepthMask(false);
mRS.programFragmentStoreDitherEnable(false);
mPFS2 = mRS.programFragmentStoreCreate();
mPFS2.setName("PFSReplace");
mRS.contextBindProgramFragmentStore(mPFS2);
mRS.samplerBegin();
mRS.samplerSet(RenderScript.SamplerParam.FILTER_MAG, RenderScript.SamplerValue.LINEAR);
mRS.samplerSet(RenderScript.SamplerParam.FILTER_MIN, RenderScript.SamplerValue.LINEAR);
mRS.samplerSet(RenderScript.SamplerParam.FILTER_MAG, RenderScript.SamplerValue.NEAREST);
mRS.samplerSet(RenderScript.SamplerParam.FILTER_MIN, RenderScript.SamplerValue.NEAREST);
mSampler = mRS.samplerCreate();

View File

@@ -94,9 +94,9 @@ void Type::compute()
mLODs[lod].mOffset = offset;
//LOGE("txyz %i %i %i", tx, ty, tz);
offset += tx * rsMax(ty, 1u) * rsMax(tz, 1u) * mElement->getSizeBytes();
tx >>= 1;
ty >>= 1;
tz >>= 1;
tx = (tx + 1) >> 1;
ty = (ty + 1) >> 1;
tz = (tz + 1) >> 1;
}
//LOGE("size %i", offset);