Speed up GrBinHashKey computation by replacing Adler32 with One-at-a-Time hash
function, do 32b at a time instead of 8b at a time.
git-svn-id: http://skia.googlecode.com/svn/trunk@1472 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/gpu/src/GrGLProgram.cpp b/gpu/src/GrGLProgram.cpp
index 516bc98..af83801 100644
--- a/gpu/src/GrGLProgram.cpp
+++ b/gpu/src/GrGLProgram.cpp
@@ -147,7 +147,7 @@
GrGLProgram::~GrGLProgram() {
}
-void GrGLProgram::overrideBlend(GrBlendCoeff* srcCoeff,
+void GrGLProgram::overrideBlend(GrBlendCoeff* srcCoeff,
GrBlendCoeff* dstCoeff) const {
switch (fProgramDesc.fDualSrcOutput) {
case ProgramDesc::kNone_DualSrcOutput:
@@ -167,7 +167,7 @@
void GrGLProgram::buildKey(GrBinHashKeyBuilder& key) const {
// Add stage configuration to the key
- key.keyData(reinterpret_cast<const uint8_t*>(&fProgramDesc), sizeof(ProgramDesc));
+ key.keyData(reinterpret_cast<const uint32_t*>(&fProgramDesc), sizeof(ProgramDesc));
}
// assigns modulation of two vars to an output var
@@ -273,7 +273,6 @@
static void blendTermString(GrStringBuilder* str, SkXfermode::Coeff coeff,
const char* src, const char* dst,
const char* value) {
-
switch (coeff) {
case SkXfermode::kZero_Coeff: /** 0 */
*str = "";
@@ -315,7 +314,7 @@
* the specified color filter.
*/
static void addColorFilter(GrStringBuilder* fsCode, const char * outputVar,
- SkXfermode::Coeff uniformCoeff,
+ SkXfermode::Coeff uniformCoeff,
SkXfermode::Coeff colorCoeff,
const char* inColor) {
GrStringBuilder colorStr, constStr;
@@ -354,7 +353,7 @@
// declare an output, which is incompatible with gl_FragColor/gl_FragData.
const char* fsColorOutput;
bool dualSourceOutputWritten = false;
- bool usingDeclaredOutputs = ProgramDesc::kNone_DualSrcOutput !=
+ bool usingDeclaredOutputs = ProgramDesc::kNone_DualSrcOutput !=
fProgramDesc.fDualSrcOutput;
if (usingDeclaredOutputs) {
GrAssert(0 == segments.fHeader.size());
@@ -1174,4 +1173,3 @@
segments->fFSCode.appendf("\t%s = %s(%s, %s)%s%s;\n", fsOutColor, texFunc.c_str(), samplerName.c_str(), sampleCoords.c_str(), smear, modulate.c_str());
}
}
-