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 GrTextureAccess_DEFINED | 8 #ifndef GrTextureAccess_DEFINED |
9 #define GrTextureAccess_DEFINED | 9 #define GrTextureAccess_DEFINED |
10 | 10 |
(...skipping 15 matching lines...) Expand all Loading... |
26 GrTextureAccess(); | 26 GrTextureAccess(); |
27 | 27 |
28 GrTextureAccess(GrTexture*, const GrTextureParams&); | 28 GrTextureAccess(GrTexture*, const GrTextureParams&); |
29 | 29 |
30 explicit GrTextureAccess(GrTexture*, | 30 explicit GrTextureAccess(GrTexture*, |
31 GrTextureParams::FilterMode = GrTextureParams::kNon
e_FilterMode, | 31 GrTextureParams::FilterMode = GrTextureParams::kNon
e_FilterMode, |
32 SkShader::TileMode tileXAndY = SkShader::kClamp_Til
eMode, | 32 SkShader::TileMode tileXAndY = SkShader::kClamp_Til
eMode, |
33 GrShaderFlags visibility = kFragment_GrShaderFlag, | 33 GrShaderFlags visibility = kFragment_GrShaderFlag, |
34 GrSLPrecision = kDefault_GrSLPrecision); | 34 GrSLPrecision = kDefault_GrSLPrecision); |
35 | 35 |
| 36 // This constructor is only for textures that do not support texture params. |
| 37 explicit GrTextureAccess(GrTexture*, GrShaderFlags visibility, GrSLPrecision
); |
| 38 |
36 void reset(GrTexture*, const GrTextureParams&, | 39 void reset(GrTexture*, const GrTextureParams&, |
37 GrShaderFlags visibility = kFragment_GrShaderFlag, | 40 GrShaderFlags visibility = kFragment_GrShaderFlag, |
38 GrSLPrecision = kDefault_GrSLPrecision); | 41 GrSLPrecision = kDefault_GrSLPrecision); |
39 void reset(GrTexture*, | 42 void reset(GrTexture*, |
40 GrTextureParams::FilterMode = GrTextureParams::kNone_FilterMode, | 43 GrTextureParams::FilterMode = GrTextureParams::kNone_FilterMode, |
41 SkShader::TileMode tileXAndY = SkShader::kClamp_TileMode, | 44 SkShader::TileMode tileXAndY = SkShader::kClamp_TileMode, |
42 GrShaderFlags visibility = kFragment_GrShaderFlag, | 45 GrShaderFlags visibility = kFragment_GrShaderFlag, |
43 GrSLPrecision = kDefault_GrSLPrecision); | 46 GrSLPrecision = kDefault_GrSLPrecision); |
44 | 47 |
| 48 // This version is only for textures that do not support texture params. |
| 49 void reset(GrTexture*, GrShaderFlags visibility, GrSLPrecision); |
| 50 |
45 bool operator==(const GrTextureAccess& that) const { | 51 bool operator==(const GrTextureAccess& that) const { |
46 return this->getTexture() == that.getTexture() && | 52 return this->getTexture() == that.getTexture() && |
47 fParams == that.fParams && | 53 fParams == that.fParams && |
48 fVisibility == that.fVisibility && | 54 fVisibility == that.fVisibility && |
49 fPrecision == that.fPrecision; | 55 fPrecision == that.fPrecision; |
50 } | 56 } |
51 | 57 |
52 bool operator!=(const GrTextureAccess& other) const { return !(*this == othe
r); } | 58 bool operator!=(const GrTextureAccess& other) const { return !(*this == othe
r); } |
53 | 59 |
54 GrTexture* getTexture() const { return fTexture.get(); } | 60 GrTexture* getTexture() const { return fTexture.get(); } |
55 GrShaderFlags getVisibility() const { return fVisibility; } | 61 GrShaderFlags getVisibility() const { return fVisibility; } |
56 GrSLPrecision getPrecision() const { return fPrecision; } | 62 GrSLPrecision getPrecision() const { return fPrecision; } |
57 | 63 |
58 /** | 64 /** |
59 * For internal use by GrProcessor. | 65 * For internal use by GrProcessor. |
60 */ | 66 */ |
61 const GrGpuResourceRef* getProgramTexture() const { return &fTexture; } | 67 const GrGpuResourceRef* getProgramTexture() const { return &fTexture; } |
62 | 68 |
63 const GrTextureParams& getParams() const { return fParams; } | 69 const GrTextureParams& getParams() const { |
| 70 SkASSERT(this->getTexture()->supportsTextureParams()); |
| 71 return fParams; |
| 72 } |
64 | 73 |
65 private: | 74 private: |
66 | 75 |
67 typedef GrTGpuResourceRef<GrTexture> ProgramTexture; | 76 typedef GrTGpuResourceRef<GrTexture> ProgramTexture; |
68 | 77 |
69 ProgramTexture fTexture; | 78 ProgramTexture fTexture; |
70 GrTextureParams fParams; | 79 GrTextureParams fParams; |
71 GrShaderFlags fVisibility; | 80 GrShaderFlags fVisibility; |
72 GrSLPrecision fPrecision; | 81 GrSLPrecision fPrecision; |
73 | 82 |
74 typedef SkNoncopyable INHERITED; | 83 typedef SkNoncopyable INHERITED; |
75 }; | 84 }; |
76 | 85 |
77 #endif | 86 #endif |
OLD | NEW |