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 #include "GrGLProgramDesc.h" | 7 #include "GrGLProgramDesc.h" |
8 | 8 |
9 #include "GrProcessor.h" | 9 #include "GrProcessor.h" |
10 #include "GrGLGpu.h" | 10 #include "GrGLGpu.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 return; | 23 return; |
24 } | 24 } |
25 uint16_t* k16 = SkTCast<uint16_t*>(b->add32n(word32Count)); | 25 uint16_t* k16 = SkTCast<uint16_t*>(b->add32n(word32Count)); |
26 for (int i = 0; i < numTextures; ++i) { | 26 for (int i = 0; i < numTextures; ++i) { |
27 const GrTextureAccess& access = proc.textureAccess(i); | 27 const GrTextureAccess& access = proc.textureAccess(i); |
28 bool isExternal = (GR_GL_TEXTURE_EXTERNAL == | 28 bool isExternal = (GR_GL_TEXTURE_EXTERNAL == |
29 static_cast<GrGLTexture*>(access.getTexture())->targe
t()); | 29 static_cast<GrGLTexture*>(access.getTexture())->targe
t()); |
30 k16[i] = caps.configTextureSwizzle(access.getTexture()->config()).asKey(
) | | 30 k16[i] = caps.configTextureSwizzle(access.getTexture()->config()).asKey(
) | |
31 (isExternal ? 0xFF00 : 0x0000); | 31 (isExternal ? 0xFF00 : 0x0000); |
32 } | 32 } |
| 33 // zero the last 16 bits if the number of textures is odd. |
| 34 if (numTextures & 0x1) { |
| 35 k16[numTextures] = 0; |
| 36 } |
33 } | 37 } |
34 | 38 |
35 /** | 39 /** |
36 * A function which emits a meta key into the key builder. This is required bec
ause shader code may | 40 * A function which emits a meta key into the key builder. This is required bec
ause shader code may |
37 * be dependent on properties of the effect that the effect itself doesn't use | 41 * be dependent on properties of the effect that the effect itself doesn't use |
38 * in its key (e.g. the pixel format of textures used). So we create a meta-key
for | 42 * in its key (e.g. the pixel format of textures used). So we create a meta-key
for |
39 * every effect using this function. It is also responsible for inserting the ef
fect's class ID | 43 * every effect using this function. It is also responsible for inserting the ef
fect's class ID |
40 * which must be different for every GrProcessor subclass. It can fail if an eff
ect uses too many | 44 * which must be different for every GrProcessor subclass. It can fail if an eff
ect uses too many |
41 * transforms, etc, for the space allotted in the meta-key. NOTE, both FPs and
GPs share this | 45 * transforms, etc, for the space allotted in the meta-key. NOTE, both FPs and
GPs share this |
42 * function because it is hairy, though FPs do not have attribs, and GPs do not
have transforms | 46 * function because it is hairy, though FPs do not have attribs, and GPs do not
have transforms |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 } else { | 144 } else { |
141 header->fIgnoresCoverage = 0; | 145 header->fIgnoresCoverage = 0; |
142 } | 146 } |
143 | 147 |
144 header->fSnapVerticesToPixelCenters = pipeline.snapVerticesToPixelCenters(); | 148 header->fSnapVerticesToPixelCenters = pipeline.snapVerticesToPixelCenters(); |
145 header->fColorEffectCnt = pipeline.numColorFragmentProcessors(); | 149 header->fColorEffectCnt = pipeline.numColorFragmentProcessors(); |
146 header->fCoverageEffectCnt = pipeline.numCoverageFragmentProcessors(); | 150 header->fCoverageEffectCnt = pipeline.numCoverageFragmentProcessors(); |
147 glDesc->finalize(); | 151 glDesc->finalize(); |
148 return true; | 152 return true; |
149 } | 153 } |
OLD | NEW |