summaryrefslogtreecommitdiffstats
path: root/libs/rs/rsProgramVertex.cpp
diff options
context:
space:
mode:
authorJason Sams <rjsams@android.com>2009-11-30 14:49:55 -0800
committerJason Sams <rjsams@android.com>2009-11-30 15:34:03 -0800
commit54c0ec14e016e4a1bf3ceab40ed6ca5447da4725 (patch)
tree343acd699d50a4090b451d05135aa7887a6a7984 /libs/rs/rsProgramVertex.cpp
parent5154ae7665743b114c71f90dcc577dc50c63b398 (diff)
downloadframeworks_base-54c0ec14e016e4a1bf3ceab40ed6ca5447da4725.zip
frameworks_base-54c0ec14e016e4a1bf3ceab40ed6ca5447da4725.tar.gz
frameworks_base-54c0ec14e016e4a1bf3ceab40ed6ca5447da4725.tar.bz2
Beging GL2 user shaders. Switch master to using GL2 by default.
Diffstat (limited to 'libs/rs/rsProgramVertex.cpp')
-rw-r--r--libs/rs/rsProgramVertex.cpp32
1 files changed, 21 insertions, 11 deletions
diff --git a/libs/rs/rsProgramVertex.cpp b/libs/rs/rsProgramVertex.cpp
index 1776b02b..482739c 100644
--- a/libs/rs/rsProgramVertex.cpp
+++ b/libs/rs/rsProgramVertex.cpp
@@ -117,18 +117,24 @@ void ProgramVertex::createShader()
mShader.append("varying vec4 varColor;\n");
mShader.append("varying vec4 varTex0;\n");
- mShader.append("void main() {\n");
- mShader.append(" gl_Position = uni_MVP * attrib_Position;\n");
- mShader.append(" varColor = attrib_Color;\n");
- if (mTextureMatrixEnable) {
- mShader.append(" varTex0 = uni_TexMatrix * attrib_T0;\n");
+ if (mUserShader.length() > 1) {
+ mShader.append(mUserShader);
} else {
- mShader.append(" varTex0 = attrib_T0;\n");
+ mShader.append("void main() {\n");
+ mShader.append(" gl_Position = uni_MVP * attrib_Position;\n");
+ mShader.append(" gl_PointSize = attrib_PointSize.x;\n");
+
+ mShader.append(" varColor = attrib_Color;\n");
+ if (mTextureMatrixEnable) {
+ mShader.append(" varTex0 = uni_TexMatrix * attrib_T0;\n");
+ } else {
+ mShader.append(" varTex0 = attrib_T0;\n");
+ }
+ //mShader.append(" pos.x = pos.x / 480.0;\n");
+ //mShader.append(" pos.y = pos.y / 800.0;\n");
+ //mShader.append(" gl_Position = pos;\n");
+ mShader.append("}\n");
}
- //mShader.append(" pos.x = pos.x / 480.0;\n");
- //mShader.append(" pos.y = pos.y / 800.0;\n");
- //mShader.append(" gl_Position = pos;\n");
- mShader.append("}\n");
}
void ProgramVertex::setupGL2(const Context *rsc, ProgramVertexState *state, ShaderCache *sc)
@@ -211,7 +217,6 @@ void ProgramVertex::init(Context *rsc)
createShader();
}
-
///////////////////////////////////////////////////////////////////////
ProgramVertexState::ProgramVertexState()
@@ -294,6 +299,11 @@ void rsi_ProgramVertexSetTextureMatrixEnable(Context *rsc, bool enable)
rsc->mStateVertex.mPV->setTextureMatrixEnable(enable);
}
+void rsi_ProgramVertexSetShader(Context *rsc, const char *txt, uint32_t len)
+{
+ rsc->mStateVertex.mPV->setShader(txt, len);
+}
+
void rsi_ProgramVertexAddLight(Context *rsc, RsLight light)
{
rsc->mStateVertex.mPV->addLight(static_cast<const Light *>(light));