OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 GrGLProcessor_DEFINED | 8 #ifndef GrGLProcessor_DEFINED |
9 #define GrGLProcessor_DEFINED | 9 #define GrGLProcessor_DEFINED |
10 | 10 |
11 #include "GrGLProgramDataManager.h" | 11 #include "GrGLProgramDataManager.h" |
12 #include "GrProcessor.h" | 12 #include "GrProcessor.h" |
13 #include "GrTextureAccess.h" | 13 #include "GrTextureAccess.h" |
14 | 14 |
15 /** @file | 15 /** @file |
16 This file contains specializations for OpenGL of the shader stages declared
in | 16 This file contains specializations for OpenGL of the shader stages declared
in |
17 include/gpu/GrProcessor.h. Objects of type GrGLProcessor are responsible for
emitting the | 17 include/gpu/GrProcessor.h. Objects of type GrGLProcessor are responsible for
emitting the |
18 GLSL code that implements a GrProcessor and for uploading uniforms at draw t
ime. If they don't | 18 GLSL code that implements a GrProcessor and for uploading uniforms at draw t
ime. If they don't |
19 always emit the same GLSL code, they must have a function: | 19 always emit the same GLSL code, they must have a function: |
20 static inline void GenKey(const GrProcessor&, const GrGLCaps&, GrProcess
orKeyBuilder*) | 20 static inline void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProce
ssorKeyBuilder*) |
21 that is used to implement a program cache. When two GrProcessors produce the
same key this means | 21 that is used to implement a program cache. When two GrProcessors produce the
same key this means |
22 that their GrGLProcessors would emit the same GLSL code. | 22 that their GrGLProcessors would emit the same GLSL code. |
23 | 23 |
24 The GrGLProcessor subclass must also have a constructor of the form: | 24 The GrGLProcessor subclass must also have a constructor of the form: |
25 ProcessorSubclass::ProcessorSubclass(const GrBackendProcessorFactory&, c
onst GrProcessor&) | 25 ProcessorSubclass::ProcessorSubclass(const GrBackendProcessorFactory&, c
onst GrProcessor&) |
26 | 26 |
27 These objects are created by the factory object returned by the GrProcessor:
:getFactory(). | 27 These objects are created by the factory object returned by the GrProcessor:
:getFactory(). |
28 */ | 28 */ |
29 // TODO delete this and make TextureSampler its own thing | 29 // TODO delete this and make TextureSampler its own thing |
30 class GrGLProcessor { | 30 class GrGLProcessor { |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 const TextureSamplerArray& samplers) = 0; | 104 const TextureSamplerArray& samplers) = 0; |
105 | 105 |
106 /** A GrGLFragmentProcessor instance can be reused with any GrFragmentProces
sor that produces | 106 /** A GrGLFragmentProcessor instance can be reused with any GrFragmentProces
sor that produces |
107 the same stage key; this function reads data from a GrFragmentProcessor
and uploads any | 107 the same stage key; this function reads data from a GrFragmentProcessor
and uploads any |
108 uniform variables required by the shaders created in emitCode(). The GrF
ragmentProcessor | 108 uniform variables required by the shaders created in emitCode(). The GrF
ragmentProcessor |
109 parameter is guaranteed to be of the same type that created this GrGLFra
gmentProcessor and | 109 parameter is guaranteed to be of the same type that created this GrGLFra
gmentProcessor and |
110 to have an identical processor key as the one that created this GrGLFrag
mentProcessor. */ | 110 to have an identical processor key as the one that created this GrGLFrag
mentProcessor. */ |
111 // TODO update this to pass in GrFragmentProcessor | 111 // TODO update this to pass in GrFragmentProcessor |
112 virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) {} | 112 virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) {} |
113 | 113 |
114 static void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKeyBuilde
r*) {} | 114 static void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKeyBuil
der*) {} |
115 | 115 |
116 private: | 116 private: |
117 typedef GrGLProcessor INHERITED; | 117 typedef GrGLProcessor INHERITED; |
118 }; | 118 }; |
119 | 119 |
120 #endif | 120 #endif |
OLD | NEW |