| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "gl/builders/GrGLFragmentShaderBuilder.h" | 8 #include "gl/builders/GrGLFragmentShaderBuilder.h" |
| 9 #include "GrGLProgramDesc.h" | 9 #include "GrGLProgramDesc.h" |
| 10 #include "GrBackendProcessorFactory.h" | 10 #include "GrBackendProcessorFactory.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 uint16_t* processorKeySize) { | 126 uint16_t* processorKeySize) { |
| 127 const GrBackendProcessorFactory& factory = proc.getFactory(); | 127 const GrBackendProcessorFactory& factory = proc.getFactory(); |
| 128 factory.getGLProcessorKey(proc, caps, b); | 128 factory.getGLProcessorKey(proc, caps, b); |
| 129 size_t size = b->size(); | 129 size_t size = b->size(); |
| 130 if (size > SK_MaxU16) { | 130 if (size > SK_MaxU16) { |
| 131 *processorKeySize = 0; // suppresses a warning. | 131 *processorKeySize = 0; // suppresses a warning. |
| 132 return false; | 132 return false; |
| 133 } | 133 } |
| 134 *processorKeySize = SkToU16(size); | 134 *processorKeySize = SkToU16(size); |
| 135 uint32_t textureKey = gen_texture_key(proc, caps); | 135 uint32_t textureKey = gen_texture_key(proc, caps); |
| 136 uint32_t classID = proc.getFactory().effectClassID(); | 136 uint32_t classID = proc.getFactory().classID(); |
| 137 | 137 |
| 138 // Currently we allow 16 bits for each of the above portions of the meta-key
. Fail if they | 138 // Currently we allow 16 bits for each of the above portions of the meta-key
. Fail if they |
| 139 // don't fit. | 139 // don't fit. |
| 140 static const uint32_t kMetaKeyInvalidMask = ~((uint32_t) SK_MaxU16); | 140 static const uint32_t kMetaKeyInvalidMask = ~((uint32_t) SK_MaxU16); |
| 141 if ((textureKey | transformKey | classID) & kMetaKeyInvalidMask) { | 141 if ((textureKey | transformKey | classID) & kMetaKeyInvalidMask) { |
| 142 return false; | 142 return false; |
| 143 } | 143 } |
| 144 | 144 |
| 145 uint32_t* key = b->add32n(2); | 145 uint32_t* key = b->add32n(2); |
| 146 key[0] = (textureKey << 16 | transformKey); | 146 key[0] = (textureKey << 16 | transformKey); |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 *checksum = 0; | 354 *checksum = 0; |
| 355 *checksum = SkChecksum::Compute(reinterpret_cast<uint32_t*>(fKey.begin()), k
eyLength); | 355 *checksum = SkChecksum::Compute(reinterpret_cast<uint32_t*>(fKey.begin()), k
eyLength); |
| 356 } | 356 } |
| 357 | 357 |
| 358 GrGLProgramDesc& GrGLProgramDesc::operator= (const GrGLProgramDesc& other) { | 358 GrGLProgramDesc& GrGLProgramDesc::operator= (const GrGLProgramDesc& other) { |
| 359 size_t keyLength = other.keyLength(); | 359 size_t keyLength = other.keyLength(); |
| 360 fKey.reset(keyLength); | 360 fKey.reset(keyLength); |
| 361 memcpy(fKey.begin(), other.fKey.begin(), keyLength); | 361 memcpy(fKey.begin(), other.fKey.begin(), keyLength); |
| 362 return *this; | 362 return *this; |
| 363 } | 363 } |
| OLD | NEW |