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

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

Issue 1246193002: Moved GrGLFragmentProcessor definition to its own file (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Created 5 years, 5 months 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 | « src/gpu/effects/GrYUVtoRGBEffect.cpp ('k') | src/gpu/gl/GrGLGpuProgramCache.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 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 GrGLProcessor_DEFINED 8 #ifndef GrGLFragmentProcessor_DEFINED
9 #define GrGLProcessor_DEFINED 9 #define GrGLFragmentProcessor_DEFINED
10 10
11 #include "GrGLProgramDataManager.h" 11 #include "GrGLProgramDataManager.h"
12 #include "GrProcessor.h" 12 #include "GrGLProcessor.h"
13 #include "GrTextureAccess.h" 13 #include "GrTextureAccess.h"
14 14
15 /** @file
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
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:
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
22 that their GrGLProcessors would emit the same GLSL code.
23
24 The GrGLProcessor subclass must also have a constructor of the form:
25 ProcessorSubclass::ProcessorSubclass(const GrBackendProcessorFactory&, c onst GrProcessor&)
26
27 These objects are created by the factory object returned by the GrProcessor: :getFactory().
28 */
29 // TODO delete this and make TextureSampler its own thing
30 class GrGLProcessor {
31 public:
32 typedef GrGLProgramDataManager::UniformHandle UniformHandle;
33
34 /**
35 * Passed to GrGLProcessors so they can add transformed coordinates to their shader code.
36 */
37 typedef GrShaderVar TransformedCoords;
38 typedef SkTArray<GrShaderVar> TransformedCoordsArray;
39
40 /**
41 * Passed to GrGLProcessors so they can add texture reads to their shader co de.
42 */
43 class TextureSampler {
44 public:
45 TextureSampler(UniformHandle uniform, const GrTextureAccess& access)
46 : fSamplerUniform(uniform)
47 , fConfigComponentMask(GrPixelConfigComponentMask(access.getTexture( )->config())) {
48 SkASSERT(0 != fConfigComponentMask);
49 memcpy(fSwizzle, access.getSwizzle(), 5);
50 }
51
52 // bitfield of GrColorComponentFlags present in the texture's config.
53 uint32_t configComponentMask() const { return fConfigComponentMask; }
54 // this is .abcd
55 const char* swizzle() const { return fSwizzle; }
56
57 private:
58 UniformHandle fSamplerUniform;
59 uint32_t fConfigComponentMask;
60 char fSwizzle[5];
61
62 friend class GrGLShaderBuilder;
63 };
64
65 typedef SkTArray<TextureSampler> TextureSamplerArray;
66 };
67
68 class GrGLFPBuilder; 15 class GrGLFPBuilder;
69 16
70 class GrGLFragmentProcessor { 17 class GrGLFragmentProcessor {
71 public: 18 public:
72 GrGLFragmentProcessor() {} 19 GrGLFragmentProcessor() {}
73 20
74 virtual ~GrGLFragmentProcessor() {} 21 virtual ~GrGLFragmentProcessor() {}
75 22
76 typedef GrGLProgramDataManager::UniformHandle UniformHandle; 23 typedef GrGLProgramDataManager::UniformHandle UniformHandle;
77 typedef GrGLProcessor::TransformedCoordsArray TransformedCoordsArray; 24 typedef GrGLProcessor::TransformedCoordsArray TransformedCoordsArray;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 // TODO update this to pass in GrFragmentProcessor 58 // TODO update this to pass in GrFragmentProcessor
112 virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) {} 59 virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) {}
113 60
114 static void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKeyBuil der*) {} 61 static void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKeyBuil der*) {}
115 62
116 private: 63 private:
117 typedef GrGLProcessor INHERITED; 64 typedef GrGLProcessor INHERITED;
118 }; 65 };
119 66
120 #endif 67 #endif
OLDNEW
« no previous file with comments | « src/gpu/effects/GrYUVtoRGBEffect.cpp ('k') | src/gpu/gl/GrGLGpuProgramCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698