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