OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright 2016 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 GrGLSLProgramDesc_DEFINED | |
9 #define GrGLSLProgramDesc_DEFINED | |
10 | |
11 #include "GrColor.h" | |
12 #include "GrProgramDesc.h" | |
13 #include "GrGpu.h" | |
14 #include "GrTypesPriv.h" | |
15 | |
16 class GrGLSLProgramDescBuilder; | |
17 | |
18 class GrGLSLProgramDesc : public GrProgramDesc { | |
19 friend class GrGLSLProgramDescBuilder; | |
20 }; | |
21 | |
22 /** | |
23 * This class can be used to build a GrProgramDesc. It also provides helpers for
accessing | |
24 * GL specific info in the header. | |
25 */ | |
26 class GrGLSLProgramDescBuilder { | |
27 public: | |
28 typedef GrProgramDesc::KeyHeader KeyHeader; | |
29 // The key, stored in fKey, is composed of five parts(first 2 are defined in
the key itself): | |
30 // 1. uint32_t for total key length. | |
31 // 2. uint32_t for a checksum. | |
32 // 3. Header struct defined above. | |
33 // 4. Backend-specific information including per-processor keys and their ke
y lengths. | |
34 // Each processor's key is a variable length array of uint32_t. | |
35 enum { | |
36 // Part 3. | |
37 kHeaderOffset = GrGLSLProgramDesc::kHeaderOffset, | |
38 kHeaderSize = SkAlign4(sizeof(KeyHeader)), | |
39 // Part 4. | |
40 // This is the offset into the backenend specific part of the key, which
includes | |
41 // per-processor keys. | |
42 kProcessorKeysOffset = kHeaderOffset + kHeaderSize, | |
43 }; | |
44 | |
45 /** | |
46 * Builds a GLSL specific program descriptor | |
47 * | |
48 * @param GrPrimitiveProcessor The geometry | |
49 * @param GrPipeline The optimized drawstate. The descriptor will represent
a program | |
50 * which this optstate can use to draw with. The opts
tate contains | |
51 * general draw information, as well as the specific c
olor, geometry, | |
52 * and coverage stages which will be used to generate
the GL Program for | |
53 * this optstate. | |
54 * @param GrGLSLCaps Capabilities of the GLSL backend. | |
55 * @param GrProgramDesc The built and finalized descriptor | |
56 **/ | |
57 static bool Build(GrProgramDesc*, | |
58 const GrPrimitiveProcessor&, | |
59 const GrPipeline&, | |
60 const GrGLSLCaps&); | |
61 }; | |
62 | |
63 #endif | |
OLD | NEW |