diff options
author | Romain Guy <romainguy@google.com> | 2011-12-12 20:35:21 -0800 |
---|---|---|
committer | Romain Guy <romainguy@google.com> | 2011-12-12 20:35:21 -0800 |
commit | f3a910b423db7ad79cf61518bdd9278c048ad0d8 (patch) | |
tree | a0ae14d597ee14202ec6ca60cedfb446ff470379 /libs/hwui/Program.cpp | |
parent | d71dd367af604571c7d00ca473184a1b9240eca2 (diff) |
Optimize state changes
Change-Id: Iae59bc8dfd6427d0967472462cc1994987092827
Diffstat (limited to 'libs/hwui/Program.cpp')
-rw-r--r-- | libs/hwui/Program.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/libs/hwui/Program.cpp b/libs/hwui/Program.cpp index cb2a5fd2267e..cbea843acf04 100644 --- a/libs/hwui/Program.cpp +++ b/libs/hwui/Program.cpp @@ -26,7 +26,7 @@ namespace uirenderer { /////////////////////////////////////////////////////////////////////////////// // TODO: Program instance should be created from a factory method -Program::Program(const char* vertex, const char* fragment) { +Program::Program(const ProgramDescription& description, const char* vertex, const char* fragment) { mInitialized = false; mHasColorUniform = false; mUse = false; @@ -43,6 +43,12 @@ Program::Program(const char* vertex, const char* fragment) { glAttachShader(mProgramId, mFragmentShader); position = bindAttrib("position", kBindingPosition); + if (description.hasTexture || description.hasExternalTexture) { + texCoords = bindAttrib("texCoords", kBindingTexCoords); + } else { + texCoords = -1; + } + glLinkProgram(mProgramId); GLint status; |