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

Side by Side Diff: src/gpu/glsl/GrGLSLSampler.h

Issue 1885863004: Refactor how we store and use samplers in Ganesh (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove unneeded assert Created 4 years, 8 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/glsl/GrGLSLProgramBuilder.cpp ('k') | src/gpu/glsl/GrGLSLShaderBuilder.h » ('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 2016 Google Inc. 2 * Copyright 2016 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 GrGLSLSampler_DEFINED 8 #ifndef GrGLSLSampler_DEFINED
9 #define GrGLSLSampler_DEFINED 9 #define GrGLSLSampler_DEFINED
10 10
11 #include "GrTypes.h" 11 #include "GrTypes.h"
12 #include "SkTArray.h" 12 #include "GrTypesPriv.h"
13 #include "glsl/GrGLSLProgramDataManager.h" 13 #include "SkString.h"
14 14
15 class GrGLSLSampler { 15 class GrGLSLSampler {
16 public: 16 public:
17 typedef GrGLSLProgramDataManager::UniformHandle UniformHandle; 17 virtual ~GrGLSLSampler() {}
18 typedef SkTArray<GrGLSLSampler> SamplerArray;
19 18
20 GrGLSLSampler(UniformHandle uniform, GrPixelConfig config) 19 explicit GrGLSLSampler(uint32_t visibility, GrPixelConfig config)
21 : fSamplerUniform(uniform) 20 : fVisibility(visibility)
22 , fConfig(config) { 21 , fConfig(config) {
23 SkASSERT(kUnknown_GrPixelConfig != fConfig); 22 SkASSERT(kUnknown_GrPixelConfig != fConfig);
24 } 23 }
25 24
25 uint32_t visibility() const { return fVisibility; }
26 GrPixelConfig config() const { return fConfig; } 26 GrPixelConfig config() const { return fConfig; }
27 virtual GrSLType type() const = 0;
28
29 // Returns the string to be used for the sampler in glsl 2D texture function s (texture,
30 // texture2D, etc.)
31 const char* getSamplerNameForTexture2D() const {
32 SkASSERT(GrSLTypeIs2DTextureType(this->type()));
33 return this->onGetSamplerNameForTexture2D();
34 }
35
36 // Returns the string to be used for the sampler in glsl texelFetch.
37 virtual const char* getSamplerNameForTexelFetch() const = 0;
27 38
28 private: 39 private:
29 UniformHandle fSamplerUniform; 40 virtual const char* onGetSamplerNameForTexture2D() const = 0;
41 uint32_t fVisibility;
30 GrPixelConfig fConfig; 42 GrPixelConfig fConfig;
31
32 friend class GrGLSLShaderBuilder;
33 }; 43 };
34 44
35 #endif 45 #endif
OLDNEW
« no previous file with comments | « src/gpu/glsl/GrGLSLProgramBuilder.cpp ('k') | src/gpu/glsl/GrGLSLShaderBuilder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698