Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Side by Side Diff: src/gpu/gl/GrGLProgramDesc.h

Issue 760593005: Update effect key for descriptor to not record offsets. (Closed) Base URL: https://skia.googlesource.com/skia.git@keyBuilder
Patch Set: Cleaned up and Simplified Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/gpu/gl/GrGLProgramDesc.cpp » ('j') | src/gpu/gl/GrGLProgramDesc.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 // 5. per-effect keys and key length pairs.
bsalomon 2014/11/26 15:25:06 Hmm....
33 // offset and size. 33 // Each effect'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 in the overall key to the array of effect keys.
bsalomon 2014/11/26 15:25:06 can we just say "to the effect keys". "Array" is s
41 kProcessorKeyOffsetsAndLengthOffset = kHeaderOffset + kHeaderSize, 40 kProcessorKeysOffset = kHeaderOffset + kHeaderSize,
42 }; 41 };
43 42
44 /** 43 /**
45 * Builds a GL specific program descriptor 44 * Builds a GL specific program descriptor
46 * 45 *
47 * @param GrOptDrawState The optimized drawstate. The descriptor will repr esent a program 46 * @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 47 * which this optstate can use to draw with. The opt state contains
49 * general draw information, as well as the specific color, geometry, 48 * general draw information, as well as the specific color, geometry,
50 * and coverage stages which will be used to generate the GL Program for 49 * and coverage stages which will be used to generate the GL Program for
51 * this optstate. 50 * this optstate.
52 * @param DescInfo A descriptor info struct, generated by the optstate, whi ch contains a number 51 * @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 52 * of important facts about the program the built descripto r will represent
54 * @param DrawType 53 * @param DrawType
55 * @param GrGpuGL A GL Gpu, the caps and Gpu object are used to output proc essor specific 54 * @param GrGpuGL A GL Gpu, the caps and Gpu object are used to output proc essor specific
56 * parts of the descriptor. 55 * parts of the descriptor.
57 * @param GrDeviceCoordTexture A dstCopy texture, which may be null if fram e buffer fetch is 56 * @param GrDeviceCoordTexture A dstCopy texture, which may be null if fram e buffer fetch is
58 * supported 57 * supported
59 * @param GrProgramDesc The built and finalized descriptor 58 * @param GrProgramDesc The built and finalized descriptor
60 **/ 59 **/
61 static bool Build(const GrOptDrawState&, 60 static bool Build(const GrOptDrawState&,
62 const GrProgramDesc::DescInfo&, 61 const GrProgramDesc::DescInfo&,
63 GrGpu::DrawType, 62 GrGpu::DrawType,
64 GrGpuGL*, 63 GrGpuGL*,
65 GrProgramDesc*); 64 GrProgramDesc*);
66 65
67 static const GLKeyHeader& GetHeader(const GrProgramDesc& desc) { 66 static const GLKeyHeader& GetHeader(const GrProgramDesc& desc) {
68 return *desc.atOffset<GLKeyHeader, kHeaderOffset>(); 67 return *desc.atOffset<GLKeyHeader, kHeaderOffset>();
69 } 68 }
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 }; 69 };
79 70
80 #endif 71 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/gl/GrGLProgramDesc.cpp » ('j') | src/gpu/gl/GrGLProgramDesc.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698