| OLD | NEW |
| 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 GrGLSampler_DEFINED | 8 #ifndef GrGLSampler_DEFINED |
| 9 #define GrGLSampler_DEFINED | 9 #define GrGLSampler_DEFINED |
| 10 | 10 |
| 11 #include "glsl/GrGLSLSampler.h" | 11 #include "glsl/GrGLSLSampler.h" |
| 12 | 12 |
| 13 #include "gl/GrGLTypes.h" | 13 #include "gl/GrGLTypes.h" |
| 14 #include "glsl/GrGLSLShaderVar.h" | 14 #include "glsl/GrGLSLShaderVar.h" |
| 15 | 15 |
| 16 class GrGLSampler : public GrGLSLSampler { | 16 class GrGLSampler : public GrGLSLSampler { |
| 17 public: | 17 public: |
| 18 GrGLSampler(uint32_t visibility, | 18 GrGLSampler(uint32_t visibility, |
| 19 GrPixelConfig config, | 19 GrPixelConfig config, |
| 20 GrSLType type, | 20 GrSLType type, |
| 21 GrSLPrecision precision, | 21 GrSLPrecision precision, |
| 22 const char* name) : INHERITED(visibility, config) { | 22 const char* name) : INHERITED(visibility, config) { |
| 23 SkASSERT(GrSLTypeIsSamplerType(type)); | 23 SkASSERT(GrSLTypeIsCombinedSamplerType(type)); |
| 24 fShaderVar.setType(type); | 24 fShaderVar.setType(type); |
| 25 fShaderVar.setTypeModifier(GrGLSLShaderVar::kUniform_TypeModifier); | 25 fShaderVar.setTypeModifier(GrGLSLShaderVar::kUniform_TypeModifier); |
| 26 fShaderVar.setPrecision(precision); | 26 fShaderVar.setPrecision(precision); |
| 27 fShaderVar.accessName()->set(name); | 27 fShaderVar.accessName()->set(name); |
| 28 } | 28 } |
| 29 | 29 |
| 30 GrGLint location() const { return fLocation; } | 30 GrGLint location() const { return fLocation; } |
| 31 GrSLType type() const override { return fShaderVar.getType(); } | 31 GrSLType type() const override { return fShaderVar.getType(); } |
| 32 | 32 |
| 33 const char* onGetSamplerNameForTexture2D() const override { return fShaderVa
r.c_str(); } | 33 const char* onGetSamplerNameForTexture2D() const override { return fShaderVa
r.c_str(); } |
| 34 const char* getSamplerNameForTexelFetch() const override { return fShaderVar
.c_str(); } | 34 const char* getSamplerNameForTexelFetch() const override { return fShaderVar
.c_str(); } |
| 35 | 35 |
| 36 private: | 36 private: |
| 37 GrGLSLShaderVar fShaderVar; | 37 GrGLSLShaderVar fShaderVar; |
| 38 GrGLint fLocation; | 38 GrGLint fLocation; |
| 39 | 39 |
| 40 friend class GrGLUniformHandler; | 40 friend class GrGLUniformHandler; |
| 41 | 41 |
| 42 typedef GrGLSLSampler INHERITED; | 42 typedef GrGLSLSampler INHERITED; |
| 43 }; | 43 }; |
| 44 | 44 |
| 45 #endif | 45 #endif |
| OLD | NEW |