diff options
| author | 2010-02-11 18:16:21 -0800 | |
|---|---|---|
| committer | 2010-02-11 18:16:21 -0800 | |
| commit | 0b9bbb6dc5d7dabecf23e8c6bb4a267ba8c34fe8 (patch) | |
| tree | 12057a18bb056620ed374ad79ea08b8b16e31ef9 /libs/rs/rsScriptC.cpp | |
| parent | c1eba82ba479006045c1d7a4c8ceba116a9602d1 (diff) | |
DO NOT MERGE. Merge Froyo renderscript to Eclair to support live wallpapers on droid. This gives the necessary CPU reduction to allow the wallpapers to work on the slower CPU.
Committer: Jason Sams <rjsams@android.com>
On branch droid
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: libs/rs/rsAllocation.cpp
modified: libs/rs/rsAllocation.h
modified: libs/rs/rsContext.cpp
modified: libs/rs/rsContext.h
modified: libs/rs/rsProgram.cpp
modified: libs/rs/rsProgram.h
Delete the old rollo sample which is obsolete.
Fix film init
Begin gl2 support. Renderscript still uses GL1.1 by default. However, 2.0 can be enabled and will render most tests correctly.
Fix film
Beging GL2 user shaders. Switch master to using GL2 by default.
Implement RS tracked defered texture and buffer object uploads.
Committer: Jason Sams <rjsams@android.com>
On branch droid
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
modified: libs/rs/rsAllocation.cpp
modified: libs/rs/rsAllocation.h
modified: libs/rs/rsContext.h
modified: libs/rs/rsProgramFragment.cpp
modified: libs/rs/rsSimpleMesh.cpp
Remove check for surface valid that is no longer valid.
Continue development of es2.0 user shader support for renderscript. This change cleans up ProgramVertex creation and adds support for passing input, output, and constant type info.
Continue es2 shader dev
Conflicts:
graphics/java/android/renderscript/Program.java
graphics/java/android/renderscript/ProgramVertex.java
Place shader logging behind prop to declutter logs.
Fix emulated glColor in es2 mode.
Fix live wallpaper many. Z coordinate was being ignored for draw quad call.
Add argument checking to sampler builder to disallow illegal modes.
Move texture bindings to base program object. Change ProgramFragment creation to require a texture format in 1.0 mode.
Element restructuring. Add support for new basic Element types including the RS objects and vectors(2-4). In theory this paves the way for maintaining type info for RS objects, passing elements for GLSL uiforms/attribs/varyings, and supporting nested structures.
This will break some apps, checkings for other projects will follow to unbreak them.
Disable excessive RS logging.
Add RS support for generic attribs as input to vertex programs.
More complete support for named attribs. Adds user typed attribs as available to programVertex. Non user attribs are not treated like user for GL2 for simplicity.
Support npot on es 2.0 HW.
Change user attribs to look for empty slot rather than using them in order. Prevents conflict with numbered legacy slots.
Fix npot but where mipmap level sizes were rounding in the wrong direction. Should always be floor.
Implement type generation for user uniforms in vertex shader.
Remove excessive logging, fix error in GLSL uniform generation.
Fix RS mipmap generation for 8 bit alpha textures.
Cleanup seperation of Legacy and user attribs. All user programs now use the new names. Legacy vertex attribs are given default names.
Fix some minor bugs with GL state setup that were exposed by Droids driver.
Implement drawSpriteCropped on es2.0
Diffstat (limited to 'libs/rs/rsScriptC.cpp')
| -rw-r--r-- | libs/rs/rsScriptC.cpp | 74 |
1 files changed, 30 insertions, 44 deletions
diff --git a/libs/rs/rsScriptC.cpp b/libs/rs/rsScriptC.cpp index f11b862af61b..b7e0b86e81b1 100644 --- a/libs/rs/rsScriptC.cpp +++ b/libs/rs/rsScriptC.cpp @@ -137,7 +137,6 @@ void ScriptCState::runCompiler(Context *rsc, ScriptC *s) rsc->appendNameDefines(&tmp); appendDecls(&tmp); - rsc->appendVarDefines(&tmp); appendVarDefines(rsc, &tmp); appendTypes(rsc, &tmp); tmp.append("#line 1\n"); @@ -270,12 +269,12 @@ void ScriptCState::runCompiler(Context *rsc, ScriptC *s) static void appendElementBody(String8 *s, const Element *e) { s->append(" {\n"); - for (size_t ct2=0; ct2 < e->getComponentCount(); ct2++) { - const Component *c = e->getComponent(ct2); + for (size_t ct2=0; ct2 < e->getFieldCount(); ct2++) { + const Element *c = e->getField(ct2); s->append(" "); s->append(c->getCType()); s->append(" "); - s->append(c->getComponentName()); + s->append(e->getFieldName(ct2)); s->append(";\n"); } s->append("}"); @@ -311,9 +310,15 @@ void ScriptCState::appendTypes(const Context *rsc, String8 *str) char buf[256]; String8 tmp; - str->append("struct vec2_s {float x; float y;};"); - str->append("struct vec3_s {float x; float y; float z;};"); - str->append("struct vec4_s {float x; float y; float z; float w;};"); + str->append("struct vecF32_2_s {float x; float y;};\n"); + str->append("struct vecF32_3_s {float x; float y; float z;};\n"); + str->append("struct vecF32_4_s {float x; float y; float z; float w;};\n"); + str->append("struct vecU8_4_s {char r; char g; char b; char a;};\n"); + str->append("#define vecF32_2_t struct vecF32_2_s\n"); + str->append("#define vecF32_3_t struct vecF32_3_s\n"); + str->append("#define vecF32_4_t struct vecF32_4_s\n"); + str->append("#define vecU8_4_t struct vecU8_4_s\n"); + str->append("#define vecI8_4_t struct vecU8_4_s\n"); for (size_t ct=0; ct < MAX_SCRIPT_BANKS; ct++) { const Type *t = mConstantBufferTypes[ct].get(); @@ -321,11 +326,12 @@ void ScriptCState::appendTypes(const Context *rsc, String8 *str) continue; } const Element *e = t->getElement(); - if (e->getName() && (e->getComponentCount() > 1)) { + if (e->getName() && (e->getFieldCount() > 1)) { String8 s("struct struct_"); s.append(e->getName()); - appendElementBody(&s, e); + s.append(e->getCStructBody()); s.append(";\n"); + s.append("#define "); s.append(e->getName()); s.append("_t struct struct_"); @@ -337,45 +343,25 @@ void ScriptCState::appendTypes(const Context *rsc, String8 *str) str->append(s); } - if (t->getName()) { - for (size_t ct2=0; ct2 < e->getComponentCount(); ct2++) { - const Component *c = e->getComponent(ct2); - tmp.setTo("#define OFFSETOF_"); - tmp.append(t->getName()); - tmp.append("_"); - tmp.append(c->getComponentName()); - sprintf(buf, " %i\n", ct2); - tmp.append(buf); - if (rsc->props.mLogScripts) { - LOGV(tmp); - } - str->append(tmp); - } - } - if (mSlotNames[ct].length() > 0) { String8 s; - if (e->getComponentCount() > 1) { - if (e->getName()) { - // Use the named struct - s.setTo(e->getName()); - s.append("_t *"); - } else { - // create an struct named from the slot. - s.setTo("struct "); - s.append(mSlotNames[ct]); - s.append("_s"); - appendElementBody(&s, e); - s.append(";\n"); - s.append("struct "); - s.append(mSlotNames[ct]); - s.append("_s * "); - } + if (e->getName()) { + // Use the named struct + s.setTo(e->getName()); } else { - // Just make an array - s.setTo(e->getComponent(0)->getCType()); - s.append("_t *"); + // create an struct named from the slot. + s.setTo("struct "); + s.append(mSlotNames[ct]); + s.append("_s"); + s.append(e->getCStructBody()); + //appendElementBody(&s, e); + s.append(";\n"); + s.append("struct "); + s.append(mSlotNames[ct]); + s.append("_s"); } + + s.append(" * "); s.append(mSlotNames[ct]); s.append(";\n"); if (rsc->props.mLogScripts) { |