Merge change I5235cf3f into eclair

* changes:
  Fix but processing raster state pragma. rename stateFragmentStore to stateStore
This commit is contained in:
Android (Google) Code Review
2009-09-28 21:34:37 -04:00
10 changed files with 51 additions and 16 deletions

View File

@@ -66,8 +66,8 @@ class BaseObj {
mRS = null;
mID = 0;
mDestroyed = true;
Log.v(RenderScript.LOG_TAG,
getClass() + " auto finalizing object without having released the RS reference.");
//Log.v(RenderScript.LOG_TAG, getClass() +
// " auto finalizing object without having released the RS reference.");
}
super.finalize();
}

View File

@@ -4,7 +4,7 @@
#pragma stateVertex(orthoWindow)
#pragma stateRaster(flat)
#pragma stateFragment(PgmFragBackground)
#pragma stateFragmentStore(MyBlend)
#pragma stateStore(MyBlend)
int main(void* con, int ft, int launchID) {

View File

@@ -3,7 +3,7 @@
#pragma version(1)
#pragma stateVertex(PVBackground)
#pragma stateFragment(PFBackground)
#pragma stateFragmentStore(PSBackground)
#pragma stateStore(PSBackground)
#define STATE_TRIANGLE_OFFSET_COUNT 0
#define STATE_LAST_FOCUS 1
@@ -33,7 +33,7 @@ int main(int index)
drawSimpleMesh(NAMED_mesh);
// Start of images.
bindProgramFragmentStore(NAMED_PSImages);
bindProgramStore(NAMED_PSImages);
bindProgramFragment(NAMED_PFImages);
bindProgramVertex(NAMED_PVImages);

View File

@@ -1,8 +1,5 @@
// Fountain test script
#pragma version(1)
#pragma stateVertex(default)
#pragma stateFragment(default)
#pragma stateFragmentStore(default)
int newPart = 0;

View File

@@ -1,7 +1,7 @@
#pragma version(1)
#pragma stateVertex(PV)
#pragma stateFragment(PF)
#pragma stateFragmentStore(PFS)
#pragma stateStore(PFS)
// Scratch buffer layout
#define SCRATCH_FADE 0
@@ -105,7 +105,7 @@ int main(void* con, int ft, int launchID)
if ((zoom < 1.1f) && (zoom > 0.9f)) {
bindProgramVertex(NAMED_PVOrtho);
bindProgramFragment(NAMED_PFText);
bindProgramFragmentStore(NAMED_PFSText);
bindProgramStore(NAMED_PFSText);
rot = drawRot * scale;
index = 0;
@@ -144,7 +144,7 @@ int main(void* con, int ft, int launchID)
bindProgramVertex(NAMED_PV);
bindProgramFragment(NAMED_PF);
bindProgramFragmentStore(NAMED_PFS);
bindProgramStore(NAMED_PFS);
}
// Draw the selected icon

View File

@@ -1,7 +1,7 @@
#pragma version(1)
#pragma stateVertex(PV)
#pragma stateFragment(PF)
#pragma stateFragmentStore(PFS)
#pragma stateStore(PFS)
// Scratch buffer layout
#define SCRATCH_FADE 0

View File

@@ -103,12 +103,14 @@ bool Context::runScript(Script *s, uint32_t launchID)
ObjectBaseRef<ProgramFragment> frag(mFragment);
ObjectBaseRef<ProgramVertex> vtx(mVertex);
ObjectBaseRef<ProgramFragmentStore> store(mFragmentStore);
ObjectBaseRef<ProgramRaster> raster(mRaster);
bool ret = s->run(this, launchID);
mFragment.set(frag);
mVertex.set(vtx);
mFragmentStore.set(store);
mRaster.set(raster);
return ret;
}
@@ -124,7 +126,6 @@ bool Context::runRootScript()
eglQuerySurface(mEGL.mDisplay, mEGL.mSurface, EGL_HEIGHT, &mEGL.mHeight);
glViewport(0, 0, mEGL.mWidth, mEGL.mHeight);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
//glEnable(GL_POINT_SMOOTH);
glClearColor(mRootScript->mEnviroment.mClearColor[0],
mRootScript->mEnviroment.mClearColor[1],

View File

@@ -51,7 +51,7 @@ public:
ObjectBaseRef<ProgramVertex> mVertex;
ObjectBaseRef<ProgramFragment> mFragment;
//ObjectBaseRef<ProgramRaster> mRaster;
ObjectBaseRef<ProgramRaster> mRaster;
ObjectBaseRef<ProgramFragmentStore> mFragmentStore;
InvokeFunc_t mInvokables[MAX_SCRIPT_BANKS];
const char * mScriptText;

View File

@@ -72,6 +72,9 @@ bool ScriptC::run(Context *rsc, uint32_t launchIndex)
if (mEnviroment.mVertex.get()) {
rsc->setVertex(mEnviroment.mVertex.get());
}
if (mEnviroment.mRaster.get()) {
rsc->setRaster(mEnviroment.mRaster.get());
}
if (launchIndex == 0) {
mEnviroment.mStartTimeMillis
@@ -175,6 +178,7 @@ void ScriptCState::runCompiler(Context *rsc, ScriptC *s)
s->mEnviroment.mFragment.set(rsc->getDefaultProgramFragment());
s->mEnviroment.mVertex.set(rsc->getDefaultProgramVertex());
s->mEnviroment.mFragmentStore.set(rsc->getDefaultProgramFragmentStore());
s->mEnviroment.mRaster.set(rsc->getDefaultProgramRaster());
if (s->mProgram.mScript) {
const static int pragmaMax = 16;
@@ -204,6 +208,18 @@ void ScriptCState::runCompiler(Context *rsc, ScriptC *s)
}
if (!strcmp(str[ct], "stateRaster")) {
if (!strcmp(str[ct+1], "default")) {
continue;
}
if (!strcmp(str[ct+1], "parent")) {
s->mEnviroment.mRaster.clear();
continue;
}
ProgramRaster * pr = (ProgramRaster *)rsc->lookupName(str[ct+1]);
if (pr != NULL) {
s->mEnviroment.mRaster.set(pr);
continue;
}
LOGE("Unreconized value %s passed to stateRaster", str[ct+1]);
}
@@ -223,7 +239,7 @@ void ScriptCState::runCompiler(Context *rsc, ScriptC *s)
LOGE("Unreconized value %s passed to stateFragment", str[ct+1]);
}
if (!strcmp(str[ct], "stateFragmentStore")) {
if (!strcmp(str[ct], "stateStore")) {
if (!strcmp(str[ct+1], "default")) {
continue;
}
@@ -237,7 +253,7 @@ void ScriptCState::runCompiler(Context *rsc, ScriptC *s)
s->mEnviroment.mFragmentStore.set(pfs);
continue;
}
LOGE("Unreconized value %s passed to stateFragmentStore", str[ct+1]);
LOGE("Unreconized value %s passed to stateStore", str[ct+1]);
}
}

View File

@@ -672,6 +672,23 @@ static void SC_drawLine(float x1, float y1, float z1,
glDrawArrays(GL_LINES, 0, 2);
}
static void SC_drawPoint(float x, float y, float z)
{
GET_TLS();
rsc->setupCheck();
float vtx[] = { x, y, z };
glBindBuffer(GL_ARRAY_BUFFER, 0);
glEnableClientState(GL_VERTEX_ARRAY);
glVertexPointer(3, GL_FLOAT, 0, vtx);
glDisableClientState(GL_NORMAL_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
glDrawArrays(GL_POINTS, 0, 1);
}
static void SC_drawQuadTexCoords(float x1, float y1, float z1,
float u1, float v1,
float x2, float y2, float z2,
@@ -1131,6 +1148,8 @@ ScriptCState::SymbolTable_t ScriptCState::gSyms[] = {
"void", "(int)" },
{ "bindProgramFragmentStore", (void *)&SC_bindProgramFragmentStore,
"void", "(int)" },
{ "bindProgramStore", (void *)&SC_bindProgramFragmentStore,
"void", "(int)" },
{ "bindProgramVertex", (void *)&SC_bindProgramVertex,
"void", "(int)" },
{ "bindSampler", (void *)&SC_bindSampler,
@@ -1155,6 +1174,8 @@ ScriptCState::SymbolTable_t ScriptCState::gSyms[] = {
"void", "(float x1, float y1, float z1, float u1, float v1, float x2, float y2, float z2, float u2, float v2, float x3, float y3, float z3, float u3, float v3, float x4, float y4, float z4, float u4, float v4)" },
{ "drawLine", (void *)&SC_drawLine,
"void", "(float x1, float y1, float z1, float x2, float y2, float z2)" },
{ "drawPoint", (void *)&SC_drawPoint,
"void", "(float x1, float y1, float z1)" },
{ "drawSimpleMesh", (void *)&SC_drawSimpleMesh,
"void", "(int ism)" },
{ "drawSimpleMeshRange", (void *)&SC_drawSimpleMeshRange,