summaryrefslogtreecommitdiff
path: root/libs/rs/rsScriptC.cpp
diff options
context:
space:
mode:
author Jason Sams <rjsams@android.com> 2009-06-17 16:52:59 -0700
committer Jason Sams <rjsams@android.com> 2009-06-17 16:52:59 -0700
commit9c54bdbf458e3c9433d237ae71cf47c4ec47d852 (patch)
tree5c740a213b3ac7518184f53692191d0f3cd8cc48 /libs/rs/rsScriptC.cpp
parentb37c0a5db65cd8b72cac6a3250faddd1aecb722e (diff)
Implement default programs and implement defaults and parents for imports.
Diffstat (limited to 'libs/rs/rsScriptC.cpp')
-rw-r--r--libs/rs/rsScriptC.cpp41
1 files changed, 33 insertions, 8 deletions
diff --git a/libs/rs/rsScriptC.cpp b/libs/rs/rsScriptC.cpp
index 29638311eb37..c650656304ab 100644
--- a/libs/rs/rsScriptC.cpp
+++ b/libs/rs/rsScriptC.cpp
@@ -398,6 +398,9 @@ bool ScriptC::run(Context *rsc, uint32_t launchID)
if (mEnviroment.mFragment.get()) {
rsc->setFragment(mEnviroment.mFragment.get());
}
+ if (mEnviroment.mVertex.get()) {
+ rsc->setVertex(mEnviroment.mVertex.get());
+ }
return mProgram.mScript(&e, &scriptCPtrTable, launchID) != 0;
}
@@ -448,6 +451,9 @@ void ScriptCState::runCompiler(Context *rsc)
accGetScriptLabel(mAccScript, "main", (ACCvoid**) &mProgram.mScript);
rsAssert(mProgram.mScript);
+ mEnviroment.mFragment.set(rsc->getDefaultProgramFragment());
+ mEnviroment.mVertex.set(rsc->getDefaultProgramVertex());
+ mEnviroment.mFragmentStore.set(rsc->getDefaultProgramFragmentStore());
if (mProgram.mScript) {
const static int pragmaMax = 16;
@@ -465,6 +471,18 @@ void ScriptCState::runCompiler(Context *rsc)
if (!strcmp(str[ct], "stateVertex")) {
+ if (!strcmp(str[ct+1], "default")) {
+ continue;
+ }
+ if (!strcmp(str[ct+1], "parent")) {
+ mEnviroment.mVertex.clear();
+ continue;
+ }
+ ProgramVertex * pv = (ProgramVertex *)rsc->lookupName(str[ct+1]);
+ if (pv != NULL) {
+ mEnviroment.mVertex.set(pv);
+ continue;
+ }
LOGE("Unreconized value %s passed to stateVertex", str[ct+1]);
}
@@ -473,8 +491,14 @@ void ScriptCState::runCompiler(Context *rsc)
}
if (!strcmp(str[ct], "stateFragment")) {
- ProgramFragment * pf =
- (ProgramFragment *)rsc->lookupName(str[ct+1]);
+ if (!strcmp(str[ct+1], "default")) {
+ continue;
+ }
+ if (!strcmp(str[ct+1], "parent")) {
+ mEnviroment.mFragment.clear();
+ continue;
+ }
+ ProgramFragment * pf = (ProgramFragment *)rsc->lookupName(str[ct+1]);
if (pf != NULL) {
mEnviroment.mFragment.set(pf);
continue;
@@ -483,18 +507,19 @@ void ScriptCState::runCompiler(Context *rsc)
}
if (!strcmp(str[ct], "stateFragmentStore")) {
+ if (!strcmp(str[ct+1], "default")) {
+ continue;
+ }
+ if (!strcmp(str[ct+1], "parent")) {
+ mEnviroment.mFragmentStore.clear();
+ continue;
+ }
ProgramFragmentStore * pfs =
(ProgramFragmentStore *)rsc->lookupName(str[ct+1]);
if (pfs != NULL) {
mEnviroment.mFragmentStore.set(pfs);
continue;
}
-
- if (!strcmp(str[ct+1], "parent")) {
- //mEnviroment.mStateFragmentStore =
- //Script::Enviroment_t::FRAGMENT_STORE_PARENT;
- continue;
- }
LOGE("Unreconized value %s passed to stateFragmentStore", str[ct+1]);
}