| 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 #ifndef GrGLProgramDesc_DEFINED | 8 #ifndef GrGLProgramDesc_DEFINED |
| 9 #define GrGLProgramDesc_DEFINED | 9 #define GrGLProgramDesc_DEFINED |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 class GrGLProgramDescBuilder { | 22 class GrGLProgramDescBuilder { |
| 23 public: | 23 public: |
| 24 struct GLKeyHeader : public GrProgramDesc::KeyHeader { | 24 struct GLKeyHeader : public GrProgramDesc::KeyHeader { |
| 25 SkBool8 fUseNvpr; | 25 SkBool8 fUseNvpr; |
| 26 }; | 26 }; |
| 27 | 27 |
| 28 // The key, stored in fKey, is composed of five parts(first 2 are defined in
the key itself): | 28 // The key, stored in fKey, is composed of five parts(first 2 are defined in
the key itself): |
| 29 // 1. uint32_t for total key length. | 29 // 1. uint32_t for total key length. |
| 30 // 2. uint32_t for a checksum. | 30 // 2. uint32_t for a checksum. |
| 31 // 3. Header struct defined above. | 31 // 3. Header struct defined above. |
| 32 // 4. An array of offsets to effect keys and their sizes (see 5). uint16_t f
or each | 32 // 4. Backend-specific information including per-processor keys and their ke
y lengths. |
| 33 // offset and size. | 33 // Each processor's key is a variable length array of uint32_t. |
| 34 // 5. per-effect keys. Each effect's key is a variable length array of uint3
2_t. | |
| 35 enum { | 34 enum { |
| 36 // Part 3. | 35 // Part 3. |
| 37 kHeaderOffset = GrProgramDesc::kHeaderOffset, | 36 kHeaderOffset = GrProgramDesc::kHeaderOffset, |
| 38 kHeaderSize = SkAlign4(sizeof(GLKeyHeader)), | 37 kHeaderSize = SkAlign4(sizeof(GLKeyHeader)), |
| 39 // Part 4. | 38 // Part 4. |
| 40 // This is the offset in the overall key to the array of per-effect offs
et,length pairs. | 39 // This is the offset into the backenend specific part of the key, which
includes |
| 41 kProcessorKeyOffsetsAndLengthOffset = kHeaderOffset + kHeaderSize, | 40 // per-processor keys. |
| 41 kProcessorKeysOffset = kHeaderOffset + kHeaderSize, |
| 42 }; | 42 }; |
| 43 | 43 |
| 44 /** | 44 /** |
| 45 * Builds a GL specific program descriptor | 45 * Builds a GL specific program descriptor |
| 46 * | 46 * |
| 47 * @param GrOptDrawState The optimized drawstate. The descriptor will repr
esent a program | 47 * @param GrOptDrawState The optimized drawstate. The descriptor will repr
esent a program |
| 48 * which this optstate can use to draw with. The opt
state contains | 48 * which this optstate can use to draw with. The opt
state contains |
| 49 * general draw information, as well as the specific
color, geometry, | 49 * general draw information, as well as the specific
color, geometry, |
| 50 * and coverage stages which will be used to generate
the GL Program for | 50 * and coverage stages which will be used to generate
the GL Program for |
| 51 * this optstate. | 51 * this optstate. |
| 52 * @param DescInfo A descriptor info struct, generated by the optstate, whi
ch contains a number | 52 * @param DescInfo A descriptor info struct, generated by the optstate, whi
ch contains a number |
| 53 * of important facts about the program the built descripto
r will represent | 53 * of important facts about the program the built descripto
r will represent |
| 54 * @param DrawType | 54 * @param DrawType |
| 55 * @param GrGpuGL A GL Gpu, the caps and Gpu object are used to output proc
essor specific | 55 * @param GrGpuGL A GL Gpu, the caps and Gpu object are used to output proc
essor specific |
| 56 * parts of the descriptor. | 56 * parts of the descriptor. |
| 57 * @param GrDeviceCoordTexture A dstCopy texture, which may be null if fram
e buffer fetch is | 57 * @param GrDeviceCoordTexture A dstCopy texture, which may be null if fram
e buffer fetch is |
| 58 * supported | 58 * supported |
| 59 * @param GrProgramDesc The built and finalized descriptor | 59 * @param GrProgramDesc The built and finalized descriptor |
| 60 **/ | 60 **/ |
| 61 static bool Build(const GrOptDrawState&, | 61 static bool Build(const GrOptDrawState&, |
| 62 const GrProgramDesc::DescInfo&, | 62 const GrProgramDesc::DescInfo&, |
| 63 GrGpu::DrawType, | 63 GrGpu::DrawType, |
| 64 GrGpuGL*, | 64 GrGpuGL*, |
| 65 GrProgramDesc*); | 65 GrProgramDesc*); |
| 66 | 66 |
| 67 static const GLKeyHeader& GetHeader(const GrProgramDesc& desc) { | 67 static const GLKeyHeader& GetHeader(const GrProgramDesc& desc) { |
| 68 return *desc.atOffset<GLKeyHeader, kHeaderOffset>(); | 68 return *desc.atOffset<GLKeyHeader, kHeaderOffset>(); |
| 69 } | 69 } |
| 70 | |
| 71 private: | |
| 72 template <class ProcessorKeyBuilder> | |
| 73 static bool BuildStagedProcessorKey(const typename ProcessorKeyBuilder::Stag
edProcessor& stage, | |
| 74 const GrGLCaps& caps, | |
| 75 bool requiresLocalCoordAttrib, | |
| 76 GrProgramDesc* desc, | |
| 77 int* offsetAndSizeIndex); | |
| 78 }; | 70 }; |
| 79 | 71 |
| 80 #endif | 72 #endif |
| OLD | NEW |