OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright 2015 Google Inc. | |
3 * | |
4 * Use of this source code is governed by a BSD-style license that can be | |
5 * found in the LICENSE file. | |
6 */ | |
7 | |
8 #ifndef GrVkProgramDesc_DEFINED | |
9 #define GrVkProgramDesc_DEFINED | |
10 | |
11 #include "GrColor.h" | |
12 #include "GrProgramDesc.h" | |
13 #include "GrGpu.h" | |
14 #include "GrTypesPriv.h" | |
15 | |
16 #include "vk/GrVkDefines.h" | |
17 | |
18 class GrVkGpu; | |
19 class GrVkProgramDescBuilder; | |
20 | |
21 class GrVkProgramDesc : public GrProgramDesc { | |
22 private: | |
23 friend class GrVkProgramDescBuilder; | |
24 }; | |
25 | |
26 /** | |
27 * This class can be used to build a GrProgramDesc. It also provides helpers fo
r accessing | |
28 * GL specific info in the header. | |
29 */ | |
30 class GrVkProgramDescBuilder { | |
31 public: | |
32 typedef GrProgramDesc::KeyHeader KeyHeader; | |
33 // The key, stored in fKey, is composed of five parts(first 2 are defined in
the key itself): | |
34 // 1. uint32_t for total key length. | |
35 // 2. uint32_t for a checksum. | |
36 // 3. Header struct defined above. | |
37 // 4. Backend-specific information including per-processor keys and their ke
y lengths. | |
38 // Each processor's key is a variable length array of uint32_t. | |
39 enum { | |
40 // Part 3. | |
41 kHeaderOffset = GrVkProgramDesc::kHeaderOffset, | |
42 kHeaderSize = SkAlign4(sizeof(KeyHeader)), | |
43 // Part 4. | |
44 // This is the offset into the backenend specific part of the key, which
includes | |
45 // per-processor keys. | |
46 kProcessorKeysOffset = kHeaderOffset + kHeaderSize, | |
47 }; | |
48 | |
49 /** | |
50 * Builds a GL specific program descriptor | |
51 * | |
52 * @param GrPrimitiveProcessor The geometry | |
53 * @param GrPipeline The optimized drawstate. The descriptor will represen
t a program | |
54 * which this optstate can use to draw with. The opt
state contains | |
55 * general draw information, as well as the specific
color, geometry, | |
56 * and coverage stages which will be used to generate
the GL Program for | |
57 * this optstate. | |
58 * @param GrVkGpu A GL Gpu, the caps and Gpu object are used to output proc
essor specific | |
59 * parts of the descriptor. | |
60 * @param GrProgramDesc The built and finalized descriptor | |
61 **/ | |
62 static bool Build(GrProgramDesc*, | |
63 const GrPrimitiveProcessor&, | |
64 const GrPipeline&, | |
65 const GrGLSLCaps&); | |
66 }; | |
67 | |
68 #endif | |
OLD | NEW |